From: "Chuck Meade" <chuckmeade@mindspring.com>
To: <linux-mtd@lists.infradead.org>
Subject: cmdlinepart.c patch
Date: Mon, 6 Mar 2006 10:46:30 -0500 [thread overview]
Message-ID: <IIEEICKJLNEPBBDJICNGAEHLKDAA.chuckmeade@mindspring.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1008 bytes --]
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 on the cmdline.
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.
Chuck
[-- Attachment #2: cmdlinepart.c.patch --]
[-- Type: application/octet-stream, Size: 996 bytes --]
--- 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;
next reply other threads:[~2006-03-06 16:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-06 15:46 Chuck Meade [this message]
2006-03-12 22:14 ` cmdlinepart.c patch Jörn Engel
2006-03-13 0:07 ` Chuck Meade
2006-03-13 10:33 ` Jörn Engel
2006-03-13 13:17 ` Chuck Meade
2006-03-13 13:18 ` Jörn Engel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=IIEEICKJLNEPBBDJICNGAEHLKDAA.chuckmeade@mindspring.com \
--to=chuckmeade@mindspring.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox