Subject: Re: PATCH: disklabel & fdisk regular files
To: None <tech-userlevel@NetBSD.org, lukem@netbsd.org>
From: Luke Mewburn <lukem@NetBSD.org>
List: tech-userlevel
Date: 03/05/2004 17:09:10
--sBcizk6cgRZY6rnJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 =
this.
  |=20
  | 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 ?
  |=20
  | 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));
  |  }
  | =20
  | +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 ...




Luke.

--sBcizk6cgRZY6rnJ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (NetBSD)

iD8DBQFASBmGpBhtmn8zJHIRAiy+AJ4pAQ2buWqCK+vmn0UjrqmWiPnkpACfT93O
PUwHIzUf0iQI+/Hz1zsQcWg=
=osuY
-----END PGP SIGNATURE-----

--sBcizk6cgRZY6rnJ--