Skip to content

Commit

Permalink
[PATCH] mtd cmdlinepart: allow zero offset value
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Atsushi Nemoto authored and Linus Torvalds committed Mar 31, 2006
1 parent 87d10f3 commit b175d03
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/mtd/cmdlinepart.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@


/* special size referring to all the remaining space in a partition */
#define SIZE_REMAINING 0xffffffff
#define SIZE_REMAINING UINT_MAX
#define OFFSET_CONTINUOUS UINT_MAX

struct cmdline_mtd_partition {
struct cmdline_mtd_partition *next;
Expand Down Expand Up @@ -75,7 +76,7 @@ static struct mtd_partition * newpart(char *s,
{
struct mtd_partition *parts;
unsigned long size;
unsigned long offset = 0;
unsigned long offset = OFFSET_CONTINUOUS;
char *name;
int name_len;
unsigned char *extra_mem;
Expand Down Expand Up @@ -314,7 +315,7 @@ static int parse_cmdline_partitions(struct mtd_info *master,
{
for(i = 0, offset = 0; i < part->num_parts; i++)
{
if (!part->parts[i].offset)
if (part->parts[i].offset == OFFSET_CONTINUOUS)
part->parts[i].offset = offset;
else
offset = part->parts[i].offset;
Expand Down

0 comments on commit b175d03

Please sign in to comment.