Skip to content

Commit b175d03

Browse files
atsushi-nemotoLinus Torvalds
authored andcommitted
[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>
1 parent 87d10f3 commit b175d03

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/mtd/cmdlinepart.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242

4343

4444
/* 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
4647

4748
struct cmdline_mtd_partition {
4849
struct cmdline_mtd_partition *next;
@@ -75,7 +76,7 @@ static struct mtd_partition * newpart(char *s,
7576
{
7677
struct mtd_partition *parts;
7778
unsigned long size;
78-
unsigned long offset = 0;
79+
unsigned long offset = OFFSET_CONTINUOUS;
7980
char *name;
8081
int name_len;
8182
unsigned char *extra_mem;
@@ -314,7 +315,7 @@ static int parse_cmdline_partitions(struct mtd_info *master,
314315
{
315316
for(i = 0, offset = 0; i < part->num_parts; i++)
316317
{
317-
if (!part->parts[i].offset)
318+
if (part->parts[i].offset == OFFSET_CONTINUOUS)
318319
part->parts[i].offset = offset;
319320
else
320321
offset = part->parts[i].offset;

0 commit comments

Comments
 (0)