Example #1
0
int jffs2_decompress(unsigned char comprtype, unsigned char *cdata_in, 
		     unsigned char *data_out, uint32_t cdatalen, uint32_t datalen)
{
	switch (comprtype) {
	case JFFS2_COMPR_NONE:
		/* This should be special-cased elsewhere, but we might as well deal with it */
		memcpy(data_out, cdata_in, datalen);
		break;

	case JFFS2_COMPR_ZERO:
		memset(data_out, 0, datalen);
		break;

	case JFFS2_COMPR_ZLIB:
		jffs2_zlib_decompress(cdata_in, data_out, cdatalen, datalen);
		break;

	case JFFS2_COMPR_RTIME:
		jffs2_rtime_decompress(cdata_in, data_out, cdatalen, datalen);
		break;

	case JFFS2_COMPR_RUBINMIPS:
#if 0 /* Disabled 23/9/1 */
		jffs2_rubinmips_decompress(cdata_in, data_out, cdatalen, datalen);
#else
		printk(KERN_WARNING "JFFS2: Rubinmips compression encountered but support not compiled in!\n");
#endif
		break;
	case JFFS2_COMPR_DYNRUBIN:
#if 1 /* Phase this one out */
		jffs2_dynrubin_decompress(cdata_in, data_out, cdatalen, datalen);
#else
		printk(KERN_WARNING "JFFS2: Dynrubin compression encountered but support not compiled in!\n");
#endif
		break;

	default:
		printk(KERN_NOTICE "Unknown JFFS2 compression type 0x%02x\n", comprtype);
		return -EIO;
	}
	return 0;
}
Example #2
0
int jffs2_decompress(unsigned char comprtype, unsigned char *cdata_in, 
		     unsigned char *data_out, uint32_t cdatalen, uint32_t datalen)
{
	switch (comprtype) {
	case JFFS2_COMPR_NONE:
		/* This should be special-cased elsewhere, but we might as well deal with it */
		memcpy(data_out, cdata_in, datalen);
		break;

	case JFFS2_COMPR_ZERO:
		memset(data_out, 0, datalen);
		break;
#ifdef JFFS2_USE_ZLIB
	case JFFS2_COMPR_ZLIB:
		jffs2_zlib_decompress(cdata_in, data_out, cdatalen, datalen);
		break;
#endif
#ifdef JFFS2_USE_RTIME
	case JFFS2_COMPR_RTIME:
		jffs2_rtime_decompress(cdata_in, data_out, cdatalen, datalen);
		break;
#endif
#ifdef JFFS2_USE_RUBINMIPS
	case JFFS2_COMPR_RUBINMIPS:
		jffs2_rubinmips_decompress(cdata_in, data_out, cdatalen, datalen);
		break;
#endif
#ifdef JFFS2_USE_DYNRUBIN
	case JFFS2_COMPR_DYNRUBIN:

		jffs2_dynrubin_decompress(cdata_in, data_out, cdatalen, datalen);
		break;
#endif
	default:
		printk(KERN_NOTICE "Unknown JFFS2 compression type 0x%02x\n", comprtype);
		return -EIO;
	}
	return 0;
}