[PATCH] More than one BSD slice per disk

Marcus Sundberg (mackan@stacken.kth.se)
08 Nov 1999 22:34:24 +0100


--=-=-=

Hi,

for some reason the kernel (both 2.2 and 2.3) doesn't support more
than one BSD slice per disk. Here are two small patches for having
up to 4 slices per disk (more aren't useful as afaik you can't make
a BSD slice out of an extended partition).

//Marcus

--=-=-=
Content-Disposition: attachment; filename=multislice-2.2.diff

--- linux/drivers/block/genhd.c.orig Mon Jul 19 01:03:35 1999
+++ linux/drivers/block/genhd.c Mon Jul 19 01:09:29 1999
@@ -476,8 +476,9 @@
int sector_size = sector_partition_scale(dev);
#ifdef CONFIG_BSD_DISKLABEL
/* no bsd disklabel as a default */
- kdev_t bsd_kdev = 0;
- int bsd_maxpart = BSD_MAXPARTITIONS;
+ int bsd_numslices = 0;
+ kdev_t bsd_kdev[4];
+ int bsd_maxpart[4];
#endif
#ifdef CONFIG_BLK_DEV_IDE
int tested_for_xlate = 0;
@@ -598,14 +599,14 @@
/* tag first disklabel for late recognition */
if (SYS_IND(p) == BSD_PARTITION || SYS_IND(p) == NETBSD_PARTITION) {
printk("!");
- if (!bsd_kdev)
- bsd_kdev = MKDEV(hd->major, minor);
+ bsd_kdev[bsd_numslices] = MKDEV(hd->major, minor);
+ bsd_maxpart[bsd_numslices] = BSD_MAXPARTITIONS;
+ bsd_numslices++;
} else if (SYS_IND(p) == OPENBSD_PARTITION) {
printk("!");
- if (!bsd_kdev) {
- bsd_kdev = MKDEV(hd->major, minor);
- bsd_maxpart = OPENBSD_MAXPARTITIONS;
- }
+ bsd_kdev[bsd_numslices] = MKDEV(hd->major, minor);
+ bsd_maxpart[bsd_numslices] = OPENBSD_MAXPARTITIONS;
+ bsd_numslices++;
}
#endif
#ifdef CONFIG_UNIXWARE_DISKLABEL
@@ -626,9 +627,9 @@
#endif
}
#ifdef CONFIG_BSD_DISKLABEL
- if (bsd_kdev) {
+ for (i = 0; i < bsd_numslices; i++) {
printk(" <");
- bsd_disklabel_partition(hd, bsd_kdev, bsd_maxpart);
+ bsd_disklabel_partition(hd, bsd_kdev[i], bsd_maxpart[i]);
printk(" >");
}
#endif

--=-=-=
Content-Disposition: attachment; filename=multislice-2.3.diff

--- linux/fs/partitions/msdos.c.orig Fri Oct 15 00:36:33 1999
+++ linux/fs/partitions/msdos.c Fri Oct 15 00:56:50 1999
@@ -329,8 +329,9 @@
int sector_size = get_hardsect_size(dev) / 512;
#ifdef CONFIG_BSD_DISKLABEL
/* no bsd disklabel as a default */
- kdev_t bsd_kdev = 0;
- int bsd_maxpart = BSD_MAXPARTITIONS;
+ int bsd_numslices = 0;
+ kdev_t bsd_kdev[4];
+ int bsd_maxpart[4];
#endif
#ifdef CONFIG_BLK_DEV_IDE
int tested_for_xlate = 0;
@@ -436,14 +437,14 @@
/* tag first disklabel for late recognition */
if (SYS_IND(p) == BSD_PARTITION || SYS_IND(p) == NETBSD_PARTITION) {
printk("!");
- if (!bsd_kdev)
- bsd_kdev = MKDEV(hd->major, minor);
+ bsd_kdev[bsd_numslices] = MKDEV(hd->major, minor);
+ bsd_maxpart[bsd_numslices] = BSD_MAXPARTITIONS;
+ bsd_numslices++;
} else if (SYS_IND(p) == OPENBSD_PARTITION) {
printk("!");
- if (!bsd_kdev) {
- bsd_kdev = MKDEV(hd->major, minor);
- bsd_maxpart = OPENBSD_MAXPARTITIONS;
- }
+ bsd_kdev[bsd_numslices] = MKDEV(hd->major, minor);
+ bsd_maxpart[bsd_numslices] = OPENBSD_MAXPARTITIONS;
+ bsd_numslices++;
}
#endif
#ifdef CONFIG_UNIXWARE_DISKLABEL
@@ -464,9 +465,9 @@
#endif
}
#ifdef CONFIG_BSD_DISKLABEL
- if (bsd_kdev) {
+ for (i = 0; i < bsd_numslices; i++) {
printk(" <");
- bsd_disklabel_partition(hd, bsd_kdev, bsd_maxpart);
+ bsd_disklabel_partition(hd, bsd_kdev[i], bsd_maxpart[i]);
printk(" >");
}
#endif

--=-=-=

-- 
-------------------------------+------------------------------------
        Marcus Sundberg        | http://www.stacken.kth.se/~mackan
 Royal Institute of Technology |       Phone: +46 707 295404
       Stockholm, Sweden       |   E-Mail: mackan@stacken.kth.se

--=-=-=--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/