summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2013-08-08 16:09:20 +0000
committerae <ae@FreeBSD.org>2013-08-08 16:09:20 +0000
commit4c7750d3a89a6915e36b36744198453b6ab9996e (patch)
tree9422c97ade76f0cdf4e17c58da14141ed2036064
parenta9f5589a92d440ca845506369a6a7ae7c1ceb3b9 (diff)
downloadFreeBSD-src-4c7750d3a89a6915e36b36744198453b6ab9996e.zip
FreeBSD-src-4c7750d3a89a6915e36b36744198453b6ab9996e.tar.gz
gpt_entries is used as limit for the number of partition entries in
the GEOM_PART. Instead of just using number of entries from the GPT header, calculate this limit based on the reserved space between GPT header and first available LBA. MFC after: 2 weeks
-rw-r--r--sys/geom/part/g_part_gpt.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c
index 12b0f89..8634b1e 100644
--- a/sys/geom/part/g_part_gpt.c
+++ b/sys/geom/part/g_part_gpt.c
@@ -916,9 +916,10 @@ g_part_gpt_read(struct g_part_table *basetable, struct g_consumer *cp)
basetable->gpt_first = table->hdr->hdr_lba_start;
basetable->gpt_last = table->hdr->hdr_lba_end;
- basetable->gpt_entries = table->hdr->hdr_entries;
+ basetable->gpt_entries = (table->hdr->hdr_lba_start - 2) *
+ pp->sectorsize / table->hdr->hdr_entsz;
- for (index = basetable->gpt_entries - 1; index >= 0; index--) {
+ for (index = table->hdr->hdr_entries - 1; index >= 0; index--) {
if (EQUUID(&tbl[index].ent_type, &gpt_uuid_unused))
continue;
entry = (struct g_part_gpt_entry *)g_part_new_entry(
OpenPOWER on IntegriCloud