Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Aug 2013 16:09:21 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254095 - head/sys/geom/part
Message-ID:  <201308081609.r78G9LGj038818@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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(



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308081609.r78G9LGj038818>