[PATCH] BSD disklabel: handle more than 8 partitions

From: Roland McGrath
Date: Sat Sep 11 2004 - 21:49:48 EST



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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/