summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey V. Elsukov <ae@FreeBSD.org>2012-08-13 13:08:30 +0000
committerAndrey V. Elsukov <ae@FreeBSD.org>2012-08-13 13:08:30 +0000
commit42b577fe7686b80cd940b09d4b45c59c410e5deb (patch)
tree94cd955dfa84c0abe0692c5cac01d4de19af1277
parent347c7fd7bf12d64faebb148b3bdc8c3b21c16273 (diff)
Notes
-rw-r--r--sys/boot/common/disk.c12
-rw-r--r--sys/boot/common/disk.h5
2 files changed, 14 insertions, 3 deletions
diff --git a/sys/boot/common/disk.c b/sys/boot/common/disk.c
index 5711a106fbbe..0ad9e3785c03 100644
--- a/sys/boot/common/disk.c
+++ b/sys/boot/common/disk.c
@@ -173,7 +173,13 @@ disk_open(struct disk_devdesc *dev, off_t mediasize, u_int sectorsize)
rc = ENXIO;
goto out;
}
- if (dev->d_slice > 0) {
+ if (ptable_gettype(od->table) == PTABLE_BSD &&
+ dev->d_partition >= 0) {
+ /* It doesn't matter what value has d_slice */
+ rc = ptable_getpart(od->table, &part, dev->d_partition);
+ if (rc == 0)
+ dev->d_offset = part.start;
+ } else if (dev->d_slice > 0) {
/* Try to get information about partition */
rc = ptable_getpart(od->table, &part, dev->d_slice);
if (rc != 0) /* Partition doesn't exist */
@@ -247,9 +253,9 @@ disk_fmtdev(struct disk_devdesc *dev)
#ifdef LOADER_MBR_SUPPORT
cp += sprintf(cp, "s%d", dev->d_slice);
#endif
- if (dev->d_partition >= 0)
- cp += sprintf(cp, "%c", dev->d_partition + 'a');
}
+ if (dev->d_partition >= 0)
+ cp += sprintf(cp, "%c", dev->d_partition + 'a');
strcat(cp, ":");
return (buf);
}
diff --git a/sys/boot/common/disk.h b/sys/boot/common/disk.h
index dc2c3c1658e6..4894661770a4 100644
--- a/sys/boot/common/disk.h
+++ b/sys/boot/common/disk.h
@@ -45,6 +45,11 @@
* d_slice = MBR slice number (typically 1..4)
* d_partition = disklabel partition (typically 0..7)
*
+ * BSD disklabel partition on the true dedicated disk:
+ *
+ * d_slice = -1
+ * d_partition = disklabel partition (typically 0..7)
+ *
* GPT partition:
*
* d_slice = GPT partition number (typically 1..N)