diff options
author | marcel <marcel@FreeBSD.org> | 2009-02-08 23:39:30 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2009-02-08 23:39:30 +0000 |
commit | fdc13c7097b6fdc980ce12b5290b5c0552c5c77e (patch) | |
tree | 00d18debcf04193ef4449897918280ce4bdd4cc3 /sys/geom/part | |
parent | 719ba982f29fc81ee8072f46770b8f92f9cde327 (diff) | |
download | FreeBSD-src-fdc13c7097b6fdc980ce12b5290b5c0552c5c77e.zip FreeBSD-src-fdc13c7097b6fdc980ce12b5290b5c0552c5c77e.tar.gz |
Allow gpe_offset to be set by the scheme. When gpe_offset is zero,
or invalid, initialize it to the start of the partition. Adjust
the mediasize when the offset lies somewhere inside the partition.
Diffstat (limited to 'sys/geom/part')
-rw-r--r-- | sys/geom/part/g_part.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c index ac8b3d7..9a345bb 100644 --- a/sys/geom/part/g_part.c +++ b/sys/geom/part/g_part.c @@ -244,7 +244,8 @@ g_part_new_entry(struct g_part_table *table, int index, quad_t start, LIST_INSERT_HEAD(&table->gpt_entry, entry, gpe_entry); else LIST_INSERT_AFTER(last, entry, gpe_entry); - } + } else + entry->gpe_offset = 0; entry->gpe_start = start; entry->gpe_end = end; return (entry); @@ -257,11 +258,14 @@ g_part_new_provider(struct g_geom *gp, struct g_part_table *table, char buf[32]; struct g_consumer *cp; struct g_provider *pp; + off_t offset; cp = LIST_FIRST(&gp->consumer); pp = cp->provider; - entry->gpe_offset = entry->gpe_start * pp->sectorsize; + offset = entry->gpe_start * pp->sectorsize; + if (entry->gpe_offset < offset) + entry->gpe_offset = offset; if (entry->gpe_pp == NULL) { entry->gpe_pp = g_new_providerf(gp, "%s%s", gp->name, @@ -271,6 +275,7 @@ g_part_new_provider(struct g_geom *gp, struct g_part_table *table, entry->gpe_pp->index = entry->gpe_index - 1; /* index is 1-based. */ entry->gpe_pp->mediasize = (entry->gpe_end - entry->gpe_start + 1) * pp->sectorsize; + entry->gpe_pp->mediasize -= entry->gpe_offset - offset; entry->gpe_pp->sectorsize = pp->sectorsize; entry->gpe_pp->flags = pp->flags & G_PF_CANDELETE; if (pp->stripesize > 0) { |