Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Feb 2009 19:25:14 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r188899 - head/sys/geom/part
Message-ID:  <200902211925.n1LJPENX073539@svn.freebsd.org>

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



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