++ found:
++ if (part->size == 0)
++ return 0;
++
++ if (mtd->read(mtd, part->offset, sizeof(buf), &len, buf) || len != sizeof(buf))
++ return 0;
++
++ if (*((__u32 *) buf) == SQUASHFS_MAGIC) {
++ printk(KERN_INFO "%s: Filesystem type: squashfs, size=0x%x\n", mtd->name, (u32) sb->bytes_used);
++
++ /* Update the squashfs partition size based on the superblock info */
++ part->size = sb->bytes_used;
++ len = part->offset + part->size;
++ len += (mtd->erasesize - 1);
++ len &= ~(mtd->erasesize - 1);
++ part->size = len - part->offset;
++ } else if (*((__u16 *) buf) == JFFS2_MAGIC_BITMASK) {
++ printk(KERN_INFO "%s: Filesystem type: jffs2\n", mtd->name);
++
++ /* Move the squashfs outside of the trx */
++ part->size = 0;
++ } else {
++ printk(KERN_INFO "%s: Filesystem type: unknown\n", mtd->name);
++ return 0;
++ }
++
++ if (trx.len != part->offset + part->size - off) {
++ /* Update the trx offsets and length */
++ trx.len = part->offset + part->size - off;
++
++ /* Update the trx crc32 */
++ for (i = (u32) &(((struct trx_header *)NULL)->flag_version); i <= trx.len; i += sizeof(buf)) {
++ if (mtd->read(mtd, off + i, sizeof(buf), &len, buf) || len != sizeof(buf))
++ return 0;
++ crc = crc32_le(crc, buf, min(sizeof(buf), trx.len - i));
++ }
++ trx.crc32 = crc;
++
++ /* read first eraseblock from the trx */
++ block = kmalloc(mtd->erasesize, GFP_KERNEL);
++ trx2 = (struct trx_header *) block;
++ if (mtd->read(mtd, off, mtd->erasesize, &len, block) || len != mtd->erasesize) {
++ printk("Error accessing the first trx eraseblock\n");
++ return 0;
++ }
++
++ printk("Updating TRX offsets and length:\n");
++ printk("old trx = [0x%08x, 0x%08x, 0x%08x], len=0x%08x crc32=0x%08x\n", trx2->offsets[0], trx2->offsets[1], trx2->offsets[2], trx2->len, trx2->crc32);
++ printk("new trx = [0x%08x, 0x%08x, 0x%08x], len=0x%08x crc32=0x%08x\n", trx.offsets[0], trx.offsets[1], trx.offsets[2], trx.len, trx.crc32);
++
++ /* Write updated trx header to the flash */
++ memcpy(block, &trx, sizeof(trx));
++ if (mtd->unlock)
++ mtd->unlock(mtd, off, mtd->erasesize);
++ erase_write(mtd, off, mtd->erasesize, block);
++ if (mtd->sync)
++ mtd->sync(mtd);
++ kfree(block);
++ printk("Done\n");
++ }
++