Date: Mon, 8 Apr 2002 22:10:02 -0700 (PDT) From: Seth Kingsley <sethk@meowfishies.com> To: freebsd-qa@FreeBSD.org Subject: Re: i386/8867: /stand/sysinstall core dumps (signal 11) if you try to allocate 25 partitions at once. Message-ID: <200204090510.g395A2883433@freefall.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR i386/8867; it has been noted by GNATS.
From: Seth Kingsley <sethk@meowfishies.com>
To: freebsd-gnats-submit@FreeBSD.org, fehr@regolith.net
Cc:
Subject: Re: i386/8867: /stand/sysinstall core dumps (signal 11) if you try to allocate 25 partitions at once.
Date: 8 Apr 2002 22:04:38 -0700
--Kj7319i9nmIyA2yE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
The following patch does two things, in addition to solving the problem
above:
1. Do not allow the creation of more slices than allowed by the target
architecture (4 on i386, 16 on PC98).
2. Advise the user, upon creation of the last slice, that they will
waste space unless they use the maximum available size.
Index: disks.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
RCS file: /home/ncvs/src/usr.sbin/sysinstall/disks.c,v
retrieving revision 1.130
diff -u -p -r1.130 disks.c
--- disks.c 2002/03/28 08:23:33 1.130
+++ disks.c 2002/04/09 04:45:34
@@ -54,8 +54,8 @@ enum size_units_t { UNIT_BLOCKS, UNIT_KI
#define CHUNK_START_ROW 5
=20
/* Where we keep track of MBR chunks */
-static struct chunk *chunk_info[16];
-static int current_chunk;
+static struct chunk *chunk_info[NDOSPART + 1];
+static int current_chunk, num_chunks;
=20
static void diskPartitionNonInteractive(Device *dev);
static u_char * bootalloc(char *name, size_t *size);
@@ -64,22 +64,21 @@ static void
record_chunks(Disk *d)
{
struct chunk *c1 =3D NULL;
- int i =3D 0;
int last_free =3D 0;
=20
if (!d->chunks)
msgFatal("No chunk list found for %s!", d->name);
=20
- for (c1 =3D d->chunks->part; c1; c1 =3D c1->next) {
+ for (num_chunks =3D 0, c1 =3D d->chunks->part; c1 && num_chunks < NDOS=
PART; c1 =3D c1->next) {
if (c1->type =3D=3D unused && c1->size > last_free) {
last_free =3D c1->size;
- current_chunk =3D i;
+ current_chunk =3D num_chunks;
}
- chunk_info[i++] =3D c1;
+ chunk_info[num_chunks++] =3D c1;
}
- chunk_info[i] =3D NULL;
- if (current_chunk >=3D i)
- current_chunk =3D i - 1;
+ chunk_info[num_chunks] =3D NULL;
+ if (current_chunk >=3D num_chunks)
+ current_chunk =3D num_chunks - 1;
}
=20
static int Total;
@@ -410,14 +409,24 @@ diskPartition(Device *dev)
int subtype;
chunk_e partitiontype;
#endif
- snprintf(tmp, 20, "%lu", chunk_info[current_chunk]->size);
- val =3D msgGetInput(tmp, "Please specify the size for new FreeBSD slice =
in blocks\n"
- "or append a trailing `M' for megabytes (e.g. 20M).");
- if (val && (size =3D strtol(val, &cp, 0)) > 0) {
- if (*cp && toupper(*cp) =3D=3D 'M')
- size *=3D ONE_MEG;
- else if (*cp && toupper(*cp) =3D=3D 'G')
- size *=3D ONE_GIG;
+ size =3D -1;
+ if (current_chunk =3D=3D (NDOSPART - 1) &&
+ !msgYesNo("This is the last slice available. Would you like to\n"
+ "create it using the maximum available size, to avoid wasting\n"
+ "space?"))
+ size =3D chunk_info[current_chunk]->size;
+ else {
+ snprintf(tmp, 20, "%lu", chunk_info[current_chunk]->size);
+ val =3D msgGetInput(tmp, "Please specify the size for new FreeBSD sl=
ice in blocks\n"
+ "or append a trailing `M' for megabytes (e.g. 20M).");
+ if (val && (size =3D strtol(val, &cp, 0)) > 0) {
+ if (*cp && toupper(*cp) =3D=3D 'M')
+ size *=3D ONE_MEG;
+ else if (*cp && toupper(*cp) =3D=3D 'G')
+ size *=3D ONE_GIG;
+ }
+ }
+ if (size > 0) {
#ifdef PC98
Create_Chunk(d, chunk_info[current_chunk]->offset, size,
freebsd, 3,
--=20
|| Seth Kingsley || sethk@meowfishies.com ||
|| http://www.meowfishies.com/ | Meow ^_^ ||
--Kj7319i9nmIyA2yE
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org
iD8DBQE8snZmD1AymFxBOwgRAlsNAJ0YJAPTMrDEutY+rEAg+uSSmxjevQCeMVCR
ULODk4yLLY2HYbfseywgaww=
=eLWP
-----END PGP SIGNATURE-----
--Kj7319i9nmIyA2yE--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-qa" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204090510.g395A2883433>
