Skip to contentSkip to conversation

BSD disklabel: handle more than 8 partitions

PATCH New Roland McGrath 1 participant 1 message Sep 12, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 BSD disklabel: handle more than 8 partitions

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

include/linux/genhd.h 12 Sep 2004 01:25:58 -0000 renamed from include/linux/genhd.h 24 Aug 2004 18:28:31 -0000 1.51 +1 -1
diff -b -p -u -r1.51 genhd.h
@@ -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

fs/partitions/msdos.c 12 Sep 2004 01:34:35 -0000 renamed from fs/partitions/msdos.c 24 Jun 2004 16:50:56 -0000 1.25 +3 -0
diff -b -p -u -r1.25 msdos.c
@@ -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