summaryrefslogtreecommitdiffstats
path: root/sys/geom/part
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2009-02-21 19:25:13 +0000
committermarcel <marcel@FreeBSD.org>2009-02-21 19:25:13 +0000
commitef2c45517283867221ddf0db10565c7ca9c93bce (patch)
tree7544fbb16a32db8b0a9c93a7fe93c306a828c0be /sys/geom/part
parentd6b23ce1539543a5cc3dfe32ca002797fb016713 (diff)
downloadFreeBSD-src-ef2c45517283867221ddf0db10565c7ca9c93bce.zip
FreeBSD-src-ef2c45517283867221ddf0db10565c7ca9c93bce.tar.gz
o When creating the EBR scheme, set the number of entries
properly. Otherwise the minimum of 1 is used and you can only insert a single partition/slice and only at sector 0 (index 1). o When adding a partition/slice, recalculate the index after the start and size of the partition/slice are adjusted to make them a multiple of the track size. Since the precheck method sets the index based on the start of the partition as provided by the user, we know that we're off by at most 1 and adjusting the index is safe.
Diffstat (limited to 'sys/geom/part')
-rw-r--r--sys/geom/part/g_part_ebr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/geom/part/g_part_ebr.c b/sys/geom/part/g_part_ebr.c
index 184ab60..c307330 100644
--- a/sys/geom/part/g_part_ebr.c
+++ b/sys/geom/part/g_part_ebr.c
@@ -218,6 +218,7 @@ g_part_ebr_add(struct g_part_table *basetable, struct g_part_entry *baseentry,
KASSERT(baseentry->gpe_start <= start, (__func__));
KASSERT(baseentry->gpe_end >= start + size - 1, (__func__));
+ baseentry->gpe_index = (start / sectors) + 1;
baseentry->gpe_offset = (off_t)(start + sectors) * pp->sectorsize;
baseentry->gpe_start = start;
baseentry->gpe_end = start + size - 1;
@@ -257,6 +258,7 @@ g_part_ebr_create(struct g_part_table *basetable, struct g_part_parms *gpp)
return (ENXIO);
msize = pp->mediasize / pp->sectorsize;
+ basetable->gpt_entries = msize / basetable->gpt_sectors;
basetable->gpt_first = 0;
basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1;
return (0);
OpenPOWER on IntegriCloud