mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Andries Brouwer <Andries.Brouwer@cwi.nl>
Cc: aebr@win.tue.nl, hubert.tonneau@fullpliant.org,
	linux-kernel@vger.kernel.org
Subject: Re: 2.6.12-rc3 fails to read partition table
Date: Fri, 6 May 2005 04:47:20 -0700	[thread overview]
Message-ID: <20050506044720.2bb95792.akpm@osdl.org> (raw)
In-Reply-To: <20050506111445.GC25418@apps.cwi.nl>

Andries Brouwer <Andries.Brouwer@cwi.nl> wrote:
>
> Discussion:

Thanks for that.

> 
> (iv) If I were maintainer of 2.6 - would I revert it?
> 
> Hmm... Not sure... Maybe, yes.
> 

How about the old fallback?


From: Andrew Morton <akpm@osdl.org>

Since early March we've been skipping partitions which have a signature byte
of zero - this was to accomodate an incorrectly manufactured USB stick.

But it broke a few people's setups because it caused device renumbering.

So add a new boot option `msdos_skip_null_part' to enable this workaround.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 Documentation/kernel-parameters.txt |    6 ++++++
 fs/partitions/msdos.c               |   14 ++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff -puN fs/partitions/msdos.c~msdos-partitions-null-handling-boot-option fs/partitions/msdos.c
--- 25/fs/partitions/msdos.c~msdos-partitions-null-handling-boot-option	2005-05-06 04:37:32.000000000 -0700
+++ 25-akpm/fs/partitions/msdos.c	2005-05-06 04:46:16.000000000 -0700
@@ -20,6 +20,7 @@
  */
 
 #include <linux/config.h>
+#include <linux/init.h>
 
 #include "check.h"
 #include "msdos.h"
@@ -53,6 +54,15 @@ static inline int is_extended_partition(
 #define MSDOS_LABEL_MAGIC1	0x55
 #define MSDOS_LABEL_MAGIC2	0xAA
 
+static int skip_null_part;
+
+static int __init msdos_skip_null_part(char *str)
+{
+	skip_null_part = 1;
+	return 0;
+}
+__setup("msdos_skip_null_part", msdos_skip_null_part);
+
 static inline int
 msdos_magic_present(unsigned char *p)
 {
@@ -115,7 +125,7 @@ parse_extended(struct parsed_partitions 
 		for (i=0; i<4; i++, p++) {
 			u32 offs, size, next;
 
-			if (SYS_IND(p) == 0)
+			if (skip_null_part && SYS_IND(p) == 0)
 				continue;
 			if (!NR_SECTS(p) || is_extended_partition(p))
 				continue;
@@ -433,7 +443,7 @@ int msdos_partition(struct parsed_partit
 	for (slot = 1 ; slot <= 4 ; slot++, p++) {
 		u32 start = START_SECT(p)*sector_size;
 		u32 size = NR_SECTS(p)*sector_size;
-		if (SYS_IND(p) == 0)
+		if (skip_null_part && SYS_IND(p) == 0)
 			continue;
 		if (!size)
 			continue;
diff -puN Documentation/kernel-parameters.txt~msdos-partitions-null-handling-boot-option Documentation/kernel-parameters.txt
--- 25/Documentation/kernel-parameters.txt~msdos-partitions-null-handling-boot-option	2005-05-06 04:43:52.000000000 -0700
+++ 25-akpm/Documentation/kernel-parameters.txt	2005-05-06 04:45:43.000000000 -0700
@@ -808,6 +808,12 @@ running once the system is up.
 	mpu401=		[HW,OSS]
 			Format: <io>,<irq>
 
+	msdos_skip_null_part
+			Make the MSDOS partition parsing code skip partitions
+			which have a signature of zero.  This can help with
+			mounting some incorrectly manufactured USB memory
+			devices.
+
 	MTD_Partition=	[MTD]
 			Format: <name>,<region-number>,<size>,<offset>
 
_


  reply	other threads:[~2005-05-06 11:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-24 14:37 Hubert Tonneau
2005-05-05 16:16 ` Andries Brouwer
2005-05-06  2:43   ` Andrew Morton
2005-05-06 11:14     ` Andries Brouwer
2005-05-06 11:47       ` Andrew Morton [this message]
2005-05-06 12:29         ` Andries Brouwer
2005-04-24 19:15 Hubert Tonneau
     [not found] <3WVhg-283-17@gated-at.bofh.it>
2005-04-25  2:31 ` Bodo Eggert <harvested.in.lkml@posting.7eggert.dyndns.org>

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=20050506044720.2bb95792.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=Andries.Brouwer@cwi.nl \
    --cc=aebr@win.tue.nl \
    --cc=hubert.tonneau@fullpliant.org \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome