Subject: Re: PATCH: disklabel & fdisk regular files
To: None <tech-userlevel@NetBSD.org, firstname.lastname@example.org>
From: Luke Mewburn <lukem@NetBSD.org>
Date: 03/05/2004 17:09:10
Content-Type: text/plain; charset=us-ascii
On Tue, Mar 02, 2004 at 02:11:46AM -0600, David Young wrote:
| On Tue, Feb 17, 2004 at 07:39:06PM +1100, Luke Mewburn wrote:
| > I'd prefer that disklabel(8) took a specific option to use a regular
| > file to enable this behaviour; other disk related tools use '-F' for =
| Done. Patches attached.
| > As for fdisk; is there a way we can implement '-F' to enable the
| > "don't bother disklabeling" stuff, rather than the -t/-T stuff ?
| There is a way. I can provide -F by "faking up" the disk geometry.
| Patches attached.
Modulo the comments below, this looks good.
| @@ -2213,36 +2230,63 @@
| return (write(wfd, buf, 512));
| +static void
| +guess_geometry(daddr_t _sectors)
| + /* guess - has to better than the above */
| + dos_sectors =3D MAXSECTOR;
| + dos_heads =3D MAXHEAD - 1; /* some BIOS might use 256 */
| + dos_cylinders =3D _sectors / (MAXSECTOR * (MAXHEAD - 1));
| + if (dos_cylinders > MAXCYL - 1)
| + dos_cylinders =3D MAXCYL - 1;
Maybe this should sanity check for underflow as well,
as there may be less than 1008 sectors, although that
is fairly unlikely ...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (NetBSD)
-----END PGP SIGNATURE-----