Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Nov 2011 19:32:24 +0400
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        Torfinn Ingolfsen <torfinn.ingolfsen@broadpark.no>
Cc:        Marcel Moolenaar <marcel@FreeBSD.org>, freebsd-ppc@freebsd.org
Subject:   Re: IBook G4 and FreeBSD 9.0-RC2: unable to create four slices on hard drive?
Message-ID:  <4EC52908.50000@FreeBSD.org>
In-Reply-To: <4EC4F868.9020901@FreeBSD.org>
References:  <20111116224604.6403be5a.torfinn.ingolfsen@broadpark.no>	<4EC4D537.4050704@FreeBSD.org>	<20111117124742.50779e7a.torfinn.ingolfsen@broadpark.no> <4EC4F868.9020901@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigA31172432069B59A2B864B4F
Content-Type: multipart/mixed; boundary="------------070404080008030609000504"

This is a multi-part message in MIME format.
--------------070404080008030609000504
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

On 17.11.2011 16:04, Andrey V. Elsukov wrote:
>> entries: 3
>           ^^^ - this is why you get this error.
>=20
> This information is from the metadata.
> I'm not familiar with APM partition table, but may be Marcel can sugges=
t something?

So, i wrote a small patch. It reserves first 14 sectors to be able
create new partitions. Also, we can add a check that is there some free
space to extend APM when we are trying to add new partition.
Marcel what you think about that?

--=20
WBR, Andrey V. Elsukov

--------------070404080008030609000504
Content-Type: text/plain;
 name="g_part_apm.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
 filename="g_part_apm.diff"

Index: head/sys/geom/part/g_part_apm.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- head/sys/geom/part/g_part_apm.c	(revision 227391)
+++ head/sys/geom/part/g_part_apm.c	(working copy)
@@ -96,12 +96,13 @@ static kobj_method_t g_part_apm_methods[] =3D {
 	{ 0, 0 }
 };
=20
+#define	APM_MINENT	16
 static struct g_part_scheme g_part_apm_scheme =3D {
 	"APM",
 	g_part_apm_methods,
 	sizeof(struct g_part_apm_table),
 	.gps_entrysz =3D sizeof(struct g_part_apm_entry),
-	.gps_minent =3D 16,
+	.gps_minent =3D APM_MINENT,
 	.gps_maxent =3D INT_MAX,
 };
 G_PART_SCHEME_DECLARE(g_part_apm);
@@ -440,13 +441,11 @@ g_part_apm_read(struct g_part_table *basetable, st
 	struct g_part_apm_entry *entry;
 	struct g_part_apm_table *table;
 	int error, index;
+	uint32_t first;
=20
 	table =3D (struct g_part_apm_table *)basetable;
+	first =3D MAX(table->self.ent_pmblkcnt, APM_MINENT) + 1;
=20
-	basetable->gpt_first =3D table->self.ent_pmblkcnt + 1;
-	basetable->gpt_last =3D table->ddr.ddr_blkcount - 1;
-	basetable->gpt_entries =3D table->self.ent_pmblkcnt - 1;
-
 	for (index =3D table->self.ent_pmblkcnt - 1; index > 0; index--) {
 		error =3D apm_read_ent(cp, index + 1, &ent, table->tivo_series1);
 		if (error)
@@ -456,8 +455,14 @@ g_part_apm_read(struct g_part_table *basetable, st
 		entry =3D (struct g_part_apm_entry *)g_part_new_entry(basetable,
 		    index, ent.ent_start, ent.ent_start + ent.ent_size - 1);
 		entry->ent =3D ent;
+		if (ent.ent_start < first)
+			first =3D ent.ent_start;
 	}
=20
+	basetable->gpt_first =3D MAX(table->self.ent_pmblkcnt + 1, first);
+	basetable->gpt_last =3D table->ddr.ddr_blkcount - 1;
+	basetable->gpt_entries =3D first - 1;
+
 	return (0);
 }
=20

--------------070404080008030609000504--

--------------enigA31172432069B59A2B864B4F
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (FreeBSD)

iQEcBAEBAgAGBQJOxSkMAAoJEAHF6gQQyKF6PkUH/jQ4/g7g9w08rodW9mE/w/gZ
N2F4amiVaJa9YkbfJ34wiCMkfbst1cD16sh4fuIN7AQnZ6acItw+7wnii9th/b5t
Qgc6eTzi/xWZa0UY+kV/jsWyTR16T8k+Cdg4mIoimFkvD9av+8DTxAlKgObfYQbk
FD9OUiYc1jT3bV3CUnfKJ63FrqVnipYfXXSebBbR17MhS42iqx+hqOIvqsUKDibG
DlXWEXbzoLv9QiqGaFGAPM+gO1GiEDE2OI9JtYQPf3QFHYHOq7f3v5+cgpa3cJ6R
Y8Pip75ntHRWzPN2CnUwHesJZFtkqS2JBbQbZCIS21zQcl0mPaqh6G18GNCZgFs=
=avGy
-----END PGP SIGNATURE-----

--------------enigA31172432069B59A2B864B4F--



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