public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [MTD] cmdlineparts.c: fix to allow partition offset zero for any partition
@ 2006-03-06 17:38 Chuck Meade
  2006-03-08  1:29 ` Atsushi Nemoto
  0 siblings, 1 reply; 6+ messages in thread
From: Chuck Meade @ 2006-03-06 17:38 UTC (permalink / raw)
  To: linux-mtd

Here is the patch I sent earlier today (that email is pending moderator
approval) in the MTD-approved patch format.  Sorry I didn't see this MTD
patch format earlier.

[MTD] cmdlineparts.c: fix to allow partition offset zero for any partition

The cmdlinepart.c logic treats a partition offset that has been explicitly
specified as zero the same as an unspecified offset.  This causes the
partitioning logic to fail if your partition that starts at 0x0 is not the
first partition listed in your cmdline partitions.

For example, if you have several partitions, and you want the third partition
to be an all-encompassing partition covering the whole device, then you
would give it offset 0x0.  The cmdlinepart.c logic treats this the same as
if you had not specified an offset, and instead tries to start the third
partition after the end of your second partition.  This is because the logic
uses zero as the "unspecified offset" value.  However, zero is not a good
choice for "unspecified offset" -- it is quite valid as a "specified" offset.

The attached patch defines the "unspecified offset" value as 0xffffffff and
makes the changes needed to support partitions that explicitly start at
offset 0x0, but are not necessarily listed first on the cmdline.

From: Chuck Meade <chuckmeade@mindspring.com>
Signed-off-by: Chuck Meade <chuckmeade@mindspring.com>

--- cmdlinepart.c.ORIG	2006-03-05 19:34:43.000000000 -0500
+++ cmdlinepart.c	2006-03-06 10:17:15.063475104 -0500
@@ -40,6 +40,10 @@
 #define dbg(x)
 #endif
 
+/* indicates that the offset for a partition was not specified, so start at
+ * end of previous partition.
+ */
+#define OFFSET_UNSPECIFIED 0xffffffff
 
 /* special size referring to all the remaining space in a partition */
 #define SIZE_REMAINING 0xffffffff
@@ -75,7 +79,7 @@ static struct mtd_partition * newpart(ch
 {
 	struct mtd_partition *parts;
 	unsigned long size;
-	unsigned long offset = 0;
+	unsigned long offset = OFFSET_UNSPECIFIED;
 	char *name;
 	int name_len;
 	unsigned char *extra_mem;
@@ -314,7 +318,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_UNSPECIFIED)
 				  part->parts[i].offset = offset;
 				else
 				  offset = part->parts[i].offset;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [MTD] cmdlineparts.c: fix to allow partition offset zero for any partition
  2006-03-06 17:38 [MTD] cmdlineparts.c: fix to allow partition offset zero for any partition Chuck Meade
@ 2006-03-08  1:29 ` Atsushi Nemoto
  2006-03-08  3:21   ` Chuck Meade
  0 siblings, 1 reply; 6+ messages in thread
From: Atsushi Nemoto @ 2006-03-08  1:29 UTC (permalink / raw)
  To: chuckmeade; +Cc: linux-mtd

>>>>> On Mon, 6 Mar 2006 12:38:46 -0500, "Chuck Meade" <chuckmeade@mindspring.com> said:
chuck> Here is the patch I sent earlier today (that email is pending
chuck> moderator approval) in the MTD-approved patch format.  Sorry I
chuck> didn't see this MTD patch format earlier.

chuck> [MTD] cmdlineparts.c: fix to allow partition offset zero for
chuck> any partition

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.  You can
get the latest version from:

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-value.patch

I wish it was merged to mainline someday ...
---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [MTD] cmdlineparts.c: fix to allow partition offset zero for any partition
  2006-03-08  1:29 ` Atsushi Nemoto
@ 2006-03-08  3:21   ` Chuck Meade
  2006-03-08  5:27     ` Intel P3 flash support yh
  2006-03-08  7:47     ` [MTD] cmdlineparts.c: fix to allow partition offset zero for any partition Atsushi Nemoto
  0 siblings, 2 replies; 6+ messages in thread
From: Chuck Meade @ 2006-03-08  3:21 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mtd

Hello Atsushi,

> 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.  You can
> get the latest version from:
>
>
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
>
> I wish it was merged to mainline someday ...

That is quite a coincidence!  I viewed your patch -- since yours has the
additional advantage of using UINT_MAX instead of 0xffffffff, plus it is
already in -mm, it makes much more sense to proceed with your version of
the patch.

Thanks for the info,
Chuck

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Intel P3 flash support
  2006-03-08  3:21   ` Chuck Meade
@ 2006-03-08  5:27     ` yh
  2006-03-09 16:55       ` Nicolas Pitre
  2006-03-08  7:47     ` [MTD] cmdlineparts.c: fix to allow partition offset zero for any partition Atsushi Nemoto
  1 sibling, 1 reply; 6+ messages in thread
From: yh @ 2006-03-08  5:27 UTC (permalink / raw)
  To: linux-mtd

Hello,

Does MTD support Intel P3 flash?

Thanks.

Jim

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [MTD] cmdlineparts.c: fix to allow partition offset zero for any partition
  2006-03-08  3:21   ` Chuck Meade
  2006-03-08  5:27     ` Intel P3 flash support yh
@ 2006-03-08  7:47     ` Atsushi Nemoto
  1 sibling, 0 replies; 6+ messages in thread
From: Atsushi Nemoto @ 2006-03-08  7:47 UTC (permalink / raw)
  To: chuckmeade; +Cc: linux-mtd

>>>>> On Tue, 7 Mar 2006 22:21:31 -0500, "Chuck Meade" <chuckmeade@mindspring.com> said:
>> I wish it was merged to mainline someday ...

chuck> That is quite a coincidence!  I viewed your patch -- since
chuck> yours has the additional advantage of using UINT_MAX instead of
chuck> 0xffffffff, plus it is already in -mm, it makes much more sense
chuck> to proceed with your version of the patch.

Actually, that is third trial.  I sent almost same patch to this ML on
Aug 2003 and Oct 2003, but could not get any response at that time.

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Intel P3 flash support
  2006-03-08  5:27     ` Intel P3 flash support yh
@ 2006-03-09 16:55       ` Nicolas Pitre
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Pitre @ 2006-03-09 16:55 UTC (permalink / raw)
  To: yh; +Cc: linux-mtd

On Wed, 8 Mar 2006, yh@bizmail.com.au wrote:

> Hello,
> 
> Does MTD support Intel P3 flash?

It should.


Nicolas

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-03-09 16:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-06 17:38 [MTD] cmdlineparts.c: fix to allow partition offset zero for any partition Chuck Meade
2006-03-08  1:29 ` Atsushi Nemoto
2006-03-08  3:21   ` Chuck Meade
2006-03-08  5:27     ` Intel P3 flash support yh
2006-03-09 16:55       ` Nicolas Pitre
2006-03-08  7:47     ` [MTD] cmdlineparts.c: fix to allow partition offset zero for any partition Atsushi Nemoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox