cmdlinepart.c patch

Chuck Meade chuckmeade at mindspring.com
Mon Mar 13 08:17:39 EST 2006


> Can you send me his patch then?  Preferrably inline in the mail.
>
> Jörn

Hi Jörn,

Yes.  I have included his patch inline below.  I got it from this
link that he sent:
http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.16-rc5/2.6.16-rc5-mm3/broken-out/mtd-cmdlinepart-allow-zero-offset-va
lue.patch

You may also be interested in this comment he made about this patch:

> I sent same fix to LKML (CC: David Woodhouse, Andrew Morton) on 29
> January.  And it has been in -mm tree since 2.6.16-rc1-mm4...

So just FYI this patch is already in -mm.

Below my signature is the inline version of the patch found at the
above link.

Thanks,
Chuck
----------------------------------------------------------------

From: Atsushi Nemoto <anemo at mba.ocn.ne.jp>

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 at 2M,2M at 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 at mba.ocn.ne.jp>
Cc: David Woodhouse <dwmw2 at infradead.org>
Cc: Thomas Gleixner <tglx at linutronix.de>
Signed-off-by: Andrew Morton <akpm at osdl.org>
---

 drivers/mtd/cmdlinepart.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff -puN drivers/mtd/cmdlinepart.c~mtd-cmdlinepart-allow-zero-offset-value drivers/mtd/cmdlinepart.c
--- 25/drivers/mtd/cmdlinepart.c~mtd-cmdlinepart-allow-zero-offset-value	Wed Feb 22 15:25:21 2006
+++ 25-akpm/drivers/mtd/cmdlinepart.c	Wed Feb 22 15:25:21 2006
@@ -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;
@@ -75,7 +76,7 @@ static struct mtd_partition * newpart(ch
 {
 	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;
@@ -314,7 +315,7 @@ static int parse_cmdline_partitions(stru
 		{
 			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;
_






More information about the linux-mtd mailing list