mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 14:13:16 +00:00
generic/3.10: reduce number of ifdefs in the rootfs split code
Use the config_enabled() macro where it is possible. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 37980
This commit is contained in:
parent
02e858d88c
commit
ac28225e24
@ -127,7 +127,6 @@
|
|||||||
+ return len;
|
+ return len;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+#ifdef CONFIG_MTD_ROOTFS_SPLIT
|
|
||||||
+#define ROOTFS_SPLIT_NAME "rootfs_data"
|
+#define ROOTFS_SPLIT_NAME "rootfs_data"
|
||||||
+#define ROOTFS_REMOVED_NAME "<removed>"
|
+#define ROOTFS_REMOVED_NAME "<removed>"
|
||||||
+
|
+
|
||||||
@ -191,11 +190,15 @@
|
|||||||
+ __mtd_add_partition(master, ROOTFS_SPLIT_NAME, split_offset,
|
+ __mtd_add_partition(master, ROOTFS_SPLIT_NAME, split_offset,
|
||||||
+ split_size, false);
|
+ split_size, false);
|
||||||
+}
|
+}
|
||||||
+#endif /* CONFIG_MTD_ROOTFS_SPLIT */
|
|
||||||
+
|
+
|
||||||
+#ifdef CONFIG_MTD_UIMAGE_SPLIT
|
|
||||||
+#define UBOOT_MAGIC 0x27051956
|
+#define UBOOT_MAGIC 0x27051956
|
||||||
+
|
+
|
||||||
|
+#ifdef CONFIG_MTD_UIMAGE_SPLIT_NAME
|
||||||
|
+#define UIMAGE_SPLIT_NAME CONFIG_MTD_UIMAGE_SPLIT_NAME
|
||||||
|
+#else
|
||||||
|
+#define UIMAGE_SPLIT_NAME "unused"
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
+static void split_uimage(struct mtd_info *master, struct mtd_part *part)
|
+static void split_uimage(struct mtd_info *master, struct mtd_part *part)
|
||||||
+{
|
+{
|
||||||
+ struct {
|
+ struct {
|
||||||
@ -205,7 +208,7 @@
|
|||||||
+ } hdr;
|
+ } hdr;
|
||||||
+ size_t len;
|
+ size_t len;
|
||||||
+
|
+
|
||||||
+ if (strcmp(part->mtd.name, CONFIG_MTD_UIMAGE_SPLIT_NAME) != 0)
|
+ if (strcmp(part->mtd.name, UIMAGE_SPLIT_NAME) != 0)
|
||||||
+ return;
|
+ return;
|
||||||
+
|
+
|
||||||
+ if (mtd_read(master, part->offset, sizeof(hdr), &len, (void *) &hdr))
|
+ if (mtd_read(master, part->offset, sizeof(hdr), &len, (void *) &hdr))
|
||||||
@ -222,7 +225,6 @@
|
|||||||
+ __mtd_add_partition(master, "rootfs", part->offset + len,
|
+ __mtd_add_partition(master, "rootfs", part->offset + len,
|
||||||
+ part->mtd.size - len, false);
|
+ part->mtd.size - len, false);
|
||||||
+}
|
+}
|
||||||
+#endif
|
|
||||||
+
|
+
|
||||||
+void __weak arch_split_mtd_part(struct mtd_info *master, const char *name,
|
+void __weak arch_split_mtd_part(struct mtd_info *master, const char *name,
|
||||||
+ int offset, int size)
|
+ int offset, int size)
|
||||||
@ -240,21 +242,19 @@
|
|||||||
+ if (!strcmp(part->mtd.name, "rootfs")) {
|
+ if (!strcmp(part->mtd.name, "rootfs")) {
|
||||||
+ rootfs_found = 1;
|
+ rootfs_found = 1;
|
||||||
+
|
+
|
||||||
+#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV
|
+ if (config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
|
||||||
+ if (ROOT_DEV == 0) {
|
+ ROOT_DEV == 0) {
|
||||||
+ printk(KERN_NOTICE "mtd: partition \"rootfs\" "
|
+ printk(KERN_NOTICE "mtd: partition \"rootfs\" "
|
||||||
+ "set to be root filesystem\n");
|
+ "set to be root filesystem\n");
|
||||||
+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, part->mtd.index);
|
+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, part->mtd.index);
|
||||||
+ }
|
+ }
|
||||||
+#endif
|
+
|
||||||
+#ifdef CONFIG_MTD_ROOTFS_SPLIT
|
+ if (config_enabled(CONFIG_MTD_ROOTFS_SPLIT))
|
||||||
+ split_rootfs_data(master, part);
|
+ split_rootfs_data(master, part);
|
||||||
+#endif
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+#ifdef CONFIG_MTD_UIMAGE_SPLIT
|
+ if (config_enabled(CONFIG_MTD_UIMAGE_SPLIT))
|
||||||
+ split_uimage(master, part);
|
+ split_uimage(master, part);
|
||||||
+#endif
|
|
||||||
+
|
+
|
||||||
+ arch_split_mtd_part(master, part->mtd.name, part->offset,
|
+ arch_split_mtd_part(master, part->mtd.name, part->offset,
|
||||||
+ part->mtd.size);
|
+ part->mtd.size);
|
||||||
|
Loading…
Reference in New Issue
Block a user