int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen, void *model) 
static int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen, void *model) 
int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, 		   uint32_t *sourcelen, uint32_t *dstlen, void *model){	int ret;	if (*dstlen <= STREAM_END_SPACE)		return -1;	down(&deflate_sem);	if (Z_OK != zlib_deflateInit(&def_strm, 3)) {		printk(KERN_WARNING "deflateInit failed\n");		up(&deflate_sem);		return -1;	}	def_strm.next_in = data_in;	def_strm.total_in = 0;		def_strm.next_out = cpage_out;	def_strm.total_out = 0;	while (def_strm.total_out < *dstlen - STREAM_END_SPACE && def_strm.total_in < *sourcelen) {		def_strm.avail_out = *dstlen - (def_strm.total_out + STREAM_END_SPACE);		def_strm.avail_in = min((unsigned)(*sourcelen-def_strm.total_in), def_strm.avail_out);		D1(printk(KERN_DEBUG "calling deflate with avail_in %d, avail_out %d\n",			  def_strm.avail_in, def_strm.avail_out));		ret = zlib_deflate(&def_strm, Z_PARTIAL_FLUSH);		D1(printk(KERN_DEBUG "deflate returned with avail_in %d, avail_out %d, total_in %ld, total_out %ld\n", 			  def_strm.avail_in, def_strm.avail_out, def_strm.total_in, def_strm.total_out));		if (ret != Z_OK) {			D1(printk(KERN_DEBUG "deflate in loop returned %d\n", ret));			zlib_deflateEnd(&def_strm);			up(&deflate_sem);			return -1;		}	}	def_strm.avail_out += STREAM_END_SPACE;	def_strm.avail_in = 0;	ret = zlib_deflate(&def_strm, Z_FINISH);	zlib_deflateEnd(&def_strm);	if (ret != Z_STREAM_END) {		D1(printk(KERN_DEBUG "final deflate returned %d\n", ret));		ret = -1;		goto out;	}	if (def_strm.total_out >= def_strm.total_in) {		D1(printk(KERN_DEBUG "zlib compressed %ld bytes into %ld; failing\n",			  def_strm.total_in, def_strm.total_out));		ret = -1;		goto out;	}	D1(printk(KERN_DEBUG "zlib compressed %ld bytes into %ld\n",		  def_strm.total_in, def_strm.total_out));	*dstlen = def_strm.total_out;	*sourcelen = def_strm.total_in;	ret = 0; out:	up(&deflate_sem);	return ret;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/75c96f85845a6707b0f9916cb263cb3584f7d48f/compr_zlib.c/buggy/fs/jffs2/compr_zlib.c