X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/ae2566d99ca3e1cd82660434ba5078eaa9ec2cd9..cd04be271418d7026e85583c003bd147100b7d9c:/target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch diff --git a/target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch b/target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch index 41cca49cc..685a246a8 100644 --- a/target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch +++ b/target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch @@ -37,7 +37,7 @@ /* * MTD methods which simply translate the effective address and pass through -@@ -489,6 +491,148 @@ out_register: +@@ -489,6 +491,147 @@ out_register: return slave; } @@ -46,32 +46,31 @@ +#define ROOTFS_REMOVED_NAME "" +static int split_squashfs(struct mtd_info *master, int offset, int *split_offset) +{ -+ char buf[512]; -+ struct squashfs_super_block *sb = (struct squashfs_super_block *) buf; ++ struct squashfs_super_block sb; + int len, ret; + -+ ret = master->read(master, offset, sizeof(*sb), &len, buf); -+ if (ret || (len != sizeof(*sb))) { ++ ret = master->read(master, offset, sizeof(sb), &len, (void *) &sb); ++ if (ret || (len != sizeof(sb))) { + printk(KERN_ALERT "split_squashfs: error occured while reading " + "from \"%s\"\n", master->name); + return -EINVAL; + } + -+ if (*((u32 *) buf) != SQUASHFS_MAGIC) { ++ if (sb.s_magic != SQUASHFS_MAGIC) { + printk(KERN_ALERT "split_squashfs: no squashfs found in \"%s\"\n", + master->name); + *split_offset = 0; + return 0; + } + -+ if (sb->bytes_used <= 0) { ++ if (sb.bytes_used <= 0) { + printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n", + master->name); + *split_offset = 0; + return 0; + } + -+ len = (u32) sb->bytes_used; ++ len = (u32) sb.bytes_used; + len += (offset & 0x000fffff); + len += (master->erasesize - 1); + len &= ~(master->erasesize - 1); @@ -186,7 +185,7 @@ /* * This function, given a master MTD object and a partition table, creates * and registers slave MTD objects which are bound to the master according to -@@ -502,14 +646,29 @@ int add_mtd_partitions(struct mtd_info * +@@ -502,14 +645,29 @@ int add_mtd_partitions(struct mtd_info * { struct mtd_part *slave; u_int32_t cur_offset = 0; @@ -219,7 +218,7 @@ cur_offset = slave->offset + slave->mtd.size; } -@@ -517,6 +676,32 @@ int add_mtd_partitions(struct mtd_info * +@@ -517,6 +675,32 @@ int add_mtd_partitions(struct mtd_info * } EXPORT_SYMBOL(add_mtd_partitions); @@ -373,41 +372,53 @@ return err; } -@@ -210,7 +246,12 @@ static int block2mtd_write(struct mtd_in +@@ -210,52 +246,29 @@ static int block2mtd_write(struct mtd_in static void block2mtd_sync(struct mtd_info *mtd) { struct block2mtd_dev *dev = mtd->priv; - sync_blockdev(dev->blkdev); -+ +- return; +-} +- +- +-static void block2mtd_free_device(struct block2mtd_dev *dev) +-{ +- if (!dev) +- return; +- +- kfree(dev->mtd.name); + +- if (dev->blkdev) { +- invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, +- 0, -1); +- close_bdev_excl(dev->blkdev); +- } + read_lock(&dev->bdev_mutex); + if (dev->blkdev) + sync_blockdev(dev->blkdev); + read_unlock(&dev->bdev_mutex); -+ - return; - } -@@ -231,31 +272,22 @@ static void block2mtd_free_device(struct - kfree(dev); +- kfree(dev); ++ return; } -- + -/* FIXME: ensure that mtd->size % erase_size == 0 */ -static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname) +static int _open_bdev(struct block2mtd_dev *dev) { struct block_device *bdev; - struct block2mtd_dev *dev; - struct mtd_partition *part; - char *name; - +- struct block2mtd_dev *dev; +- struct mtd_partition *part; +- char *name; +- - if (!devname) - return NULL; - - dev = kzalloc(sizeof(struct block2mtd_dev), GFP_KERNEL); - if (!dev) - return NULL; -- + /* Get a handle on the device */ - bdev = open_bdev_excl(devname, O_RDWR, NULL); + bdev = open_bdev_excl(dev->devname, O_RDWR, NULL); @@ -422,7 +433,7 @@ if (devt) { bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); } -@@ -263,17 +295,96 @@ static struct block2mtd_dev *add_device( +@@ -263,17 +276,97 @@ static struct block2mtd_dev *add_device( #endif if (IS_ERR(bdev)) { @@ -504,6 +515,7 @@ +{ + struct block2mtd_dev *dev; + struct mtd_partition *part; ++ char *name; + + if (!devname) + return NULL; @@ -522,7 +534,7 @@ if (!mtdname) mtdname = devname; -@@ -297,6 +408,7 @@ static struct block2mtd_dev *add_device( +@@ -297,6 +390,7 @@ static struct block2mtd_dev *add_device( dev->mtd.read = block2mtd_read; dev->mtd.priv = dev; dev->mtd.owner = THIS_MODULE;