diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2006-03-31 05:29:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-31 15:18:48 -0500 |
commit | b175d03dd207283609b7f8bfdaa5dc93ac9b16dd (patch) | |
tree | 2a570c584d29fccf8159e87ddbd9b1cf4096b00b /drivers/mtd/cmdlinepart.c | |
parent | 87d10f3c7954d143e509a2af2bca2a27aeb3114d (diff) |
[PATCH] mtd cmdlinepart: allow zero offset value
Current cmdlinepart.c uses offset value 0 to specify a continuous
partition. This prevents creating a second partition starting at 0.
For example, I can split 4MB device using "mtdparts=id:2M,2M", but I can
not do "mtdparts=id:2M@2M,2M@0" to swap mtd0 and mtd1.
This patch introduces special OFFSET_CONTINUOUS value for a continuous
partition and allows 0 for offset value.
Also this patch replaces 0xffffffff with UINT_MAX for SIZE_REMAINING.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Thomas Gleixner <tglx@linutronix.de>
Acked-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/mtd/cmdlinepart.c')
-rw-r--r-- | drivers/mtd/cmdlinepart.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c index 6b8bb2e4dcfd..a7a7bfe33879 100644 --- a/drivers/mtd/cmdlinepart.c +++ b/drivers/mtd/cmdlinepart.c | |||
@@ -42,7 +42,8 @@ | |||
42 | 42 | ||
43 | 43 | ||
44 | /* special size referring to all the remaining space in a partition */ | 44 | /* special size referring to all the remaining space in a partition */ |
45 | #define SIZE_REMAINING 0xffffffff | 45 | #define SIZE_REMAINING UINT_MAX |
46 | #define OFFSET_CONTINUOUS UINT_MAX | ||
46 | 47 | ||
47 | struct cmdline_mtd_partition { | 48 | struct cmdline_mtd_partition { |
48 | struct cmdline_mtd_partition *next; | 49 | struct cmdline_mtd_partition *next; |
@@ -75,7 +76,7 @@ static struct mtd_partition * newpart(char *s, | |||
75 | { | 76 | { |
76 | struct mtd_partition *parts; | 77 | struct mtd_partition *parts; |
77 | unsigned long size; | 78 | unsigned long size; |
78 | unsigned long offset = 0; | 79 | unsigned long offset = OFFSET_CONTINUOUS; |
79 | char *name; | 80 | char *name; |
80 | int name_len; | 81 | int name_len; |
81 | unsigned char *extra_mem; | 82 | unsigned char *extra_mem; |
@@ -314,7 +315,7 @@ static int parse_cmdline_partitions(struct mtd_info *master, | |||
314 | { | 315 | { |
315 | for(i = 0, offset = 0; i < part->num_parts; i++) | 316 | for(i = 0, offset = 0; i < part->num_parts; i++) |
316 | { | 317 | { |
317 | if (!part->parts[i].offset) | 318 | if (part->parts[i].offset == OFFSET_CONTINUOUS) |
318 | part->parts[i].offset = offset; | 319 | part->parts[i].offset = offset; |
319 | else | 320 | else |
320 | offset = part->parts[i].offset; | 321 | offset = part->parts[i].offset; |