int do_uncompress(void *dst, int dstlen, void *src, int srclen, int type) { switch (type) { case JFFS2_COMPR_NONE: memcpy(dst, src, dstlen); return dstlen; break; case JFFS2_COMPR_ZERO: memset(dst, 0, dstlen); return dstlen; break; case JFFS2_COMPR_RTIME: rtime_decompress((unsigned char*)src, (unsigned char*)dst, srclen, dstlen); return dstlen; case JFFS2_COMPR_RUBINMIPS: break; case JFFS2_COMPR_COPY: break; case JFFS2_COMPR_DYNRUBIN: dynrubin_decompress((unsigned char*)src, (unsigned char*)dst, srclen, dstlen); return dstlen; case JFFS2_COMPR_ZLIB: return zlib_decompress((unsigned char*)src, (unsigned char*)dst, srclen, dstlen); } printf(" ** unknown compression type %d!\n", type); return -1; }
int jffs2_decompress(unsigned char comprtype, unsigned char *cdata_in, unsigned char *data_out, __u32 cdatalen, __u32 datalen) { /* xde */ int i ; 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: /* xde memset(data_out, 0, datalen);*/ for (i = 0 ; i < datalen ; i ++) data_out[i] = 0 ; break; case JFFS2_COMPR_ZLIB: zlib_decompress(cdata_in, data_out, cdatalen, datalen); break; case JFFS2_COMPR_RTIME: rtime_decompress(cdata_in, data_out, cdatalen, datalen); break; case JFFS2_COMPR_RUBINMIPS: #if 0 /* Disabled 23/9/1 */ 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 */ 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; }