svn commit: r254095 - head/sys/geom/part

Andrey V. Elsukov ae at FreeBSD.org
Thu Aug 8 16:09:21 UTC 2013


Author: ae
Date: Thu Aug  8 16:09:20 2013
New Revision: 254095
URL: http://svnweb.freebsd.org/changeset/base/254095

Log:
  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

Modified:
  head/sys/geom/part/g_part_gpt.c

Modified: head/sys/geom/part/g_part_gpt.c
==============================================================================
--- head/sys/geom/part/g_part_gpt.c	Thu Aug  8 15:59:00 2013	(r254094)
+++ head/sys/geom/part/g_part_gpt.c	Thu Aug  8 16:09:20 2013	(r254095)
@@ -916,9 +916,10 @@ g_part_gpt_read(struct g_part_table *bas
 
 	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(


More information about the svn-src-all mailing list