Return-Path: <roland@frob.com>
Received: from localhost (bix [127.0.0.1])
	by localhost.localdomain (8.12.10/8.12.10) with ESMTP id i8C2oEGe029486
	for <akpm@localhost>; Sat, 11 Sep 2004 19:50:14 -0700
Received: from bix [127.0.0.1]
	by localhost with POP3 (fetchmail-6.2.0)
	for akpm@localhost (single-drop); Sat, 11 Sep 2004 19:50:14 -0700 (PDT)
Received: from fire-1.osdl.org (fire.osdl.org [65.172.181.4])
	by mail.osdl.org (8.11.6/8.11.6) with ESMTP id i8C2mKv11509
	for <akpm@mail.gateway.osdl.net>; Sat, 11 Sep 2004 19:48:22 -0700
Received: from mail2.speakeasy.net (mail2.speakeasy.net [216.254.0.202])
	by fire-1.osdl.org (8.12.8/8.12.8) with ESMTP id i8C2mFSf000834
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO)
	for <akpm@osdl.org>; Sat, 11 Sep 2004 19:48:18 -0700
Received: (qmail 10920 invoked from network); 12 Sep 2004 02:48:14 -0000
Received: from gateway.sf.frob.com ([64.81.54.130])
          (envelope-sender <roland@frob.com>)
          by mail2.speakeasy.net (qmail-ldap-1.03) with SMTP
          for <akpm@osdl.org>; 12 Sep 2004 02:48:13 -0000
Received: from magilla.sf.frob.com (magilla.sf.frob.com [198.49.250.228])
	by gateway.sf.frob.com (Postfix) with ESMTP
	id DD045357B; Sat, 11 Sep 2004 19:48:12 -0700 (PDT)
Received: from magilla.sf.frob.com (localhost.localdomain [127.0.0.1])
	by magilla.sf.frob.com (8.12.11/8.12.9) with ESMTP id i8C2mAMD025902;
	Sat, 11 Sep 2004 19:48:10 -0700
Received: (from roland@localhost)
	by magilla.sf.frob.com (8.12.11/8.12.11/Submit) id i8C2mAeW025899;
	Sat, 11 Sep 2004 19:48:10 -0700
Date: Sat, 11 Sep 2004 19:48:10 -0700
Message-Id: <200409120248.i8C2mAeW025899@magilla.sf.frob.com>
From: Roland McGrath <roland@frob.com>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] BSD disklabel: handle more than 8 partitions
Emacs: because editing your files should be a traumatic experience.
X-MIMEDefang-Filter: osdl$Revision: 1.1 $
X-Scanned-By: MIMEDefang 2.36
X-Spam-Status: No, hits=-4.9 required=1.0 tests=BAYES_00 autolearn=ham 
	version=2.60
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on bix


NetBSD allows 16 partitions, not just 8.  This patch both ups the number,
and makes the recognition code tell you if the count in the disklabel
exceeds the number supported by the kernel.


Thanks,
Roland


Index: linux-2.6/include/linux/genhd.h
===================================================================
RCS file: /home/roland/redhat/bkcvs/linux-2.5/include/linux/genhd.h,v
retrieving revision 1.51
diff -b -p -u -r1.51 genhd.h
--- linux-2.6/include/linux/genhd.h 24 Aug 2004 18:28:31 -0000 1.51
+++ linux-2.6/include/linux/genhd.h 12 Sep 2004 01:25:58 -0000
@@ -249,7 +249,7 @@ struct solaris_x86_vtoc {
 /* check against BSD src/sys/sys/disklabel.h for consistency */
 
 #define BSD_DISKMAGIC	(0x82564557UL)	/* The disk magic number */
-#define BSD_MAXPARTITIONS	8
+#define BSD_MAXPARTITIONS	16
 #define OPENBSD_MAXPARTITIONS	16
 #define BSD_FS_UNUSED		0	/* disklabel unused partition entry ID */
 struct bsd_disklabel {
Index: linux-2.6/fs/partitions/msdos.c
===================================================================
RCS file: /home/roland/redhat/bkcvs/linux-2.5/fs/partitions/msdos.c,v
retrieving revision 1.25
diff -b -p -u -r1.25 msdos.c
--- linux-2.6/fs/partitions/msdos.c 24 Jun 2004 16:50:56 -0000 1.25
+++ linux-2.6/fs/partitions/msdos.c 12 Sep 2004 01:34:35 -0000
@@ -246,6 +246,9 @@ parse_bsd(struct parsed_partitions *stat
 		put_partition(state, state->next++, bsd_start, bsd_size);
 	}
 	put_dev_sector(sect);
+	if (le16_to_cpu(l->d_npartitions) > max_partitions)
+		printk(" (ignored %d more)",
+		       le16_to_cpu(l->d_npartitions) - max_partitions);
 	printk(" >\n");
 }
 #endif
