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

Marcel Moolenaar marcel at FreeBSD.org
Sat Feb 21 11:25:15 PST 2009


Author: marcel
Date: Sat Feb 21 19:25:13 2009
New Revision: 188899
URL: http://svn.freebsd.org/changeset/base/188899

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

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

Modified: head/sys/geom/part/g_part_ebr.c
==============================================================================
--- head/sys/geom/part/g_part_ebr.c	Sat Feb 21 19:19:11 2009	(r188898)
+++ head/sys/geom/part/g_part_ebr.c	Sat Feb 21 19:25:13 2009	(r188899)
@@ -218,6 +218,7 @@ g_part_ebr_add(struct g_part_table *base
 
 	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 *b
 		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);


More information about the svn-src-all mailing list