In message: <[EMAIL PROTECTED]>
John Hay <[EMAIL PROTECTED]> writes:
: > What is the GET_GEOMETRY used for anyway?
:
: Well the short version of the problem is that "fdisk -BI <disk>" works
: on -stable to get a FreeBSD partition on the Compact Flash. This does
: not work on -current anymore. I have traced that back to the commit
: in umass.c rev 1.61 that removed the fake geometry setting and just
: leave the cylinders, heads and sectors_per_track zero. This cause
: fdisk to coredump with a floating point error.
fdisk is using them, btw, to create a MBR which needs these fields to
be somewhat sane. The floating point error likely is because we're
dividing by zero on this case:
#define RoundCyl(x) ((((x) + cylsecs - 1) / cylsecs) * cylsecs)
if cylsecs is 0, guess what happens. We do similar things with
dos_cylsecs in init_sector0. There's also code in get_params() that
devides by dos_heads * 512 * dos_sectors:
static int
get_params()
{
int error;
u_int u;
off_t o;
error = ioctl(fd, DIOCGFWSECTORS, &u);
if (error == 0)
sectors = dos_sectors = u;
error = ioctl(fd, DIOCGFWHEADS, &u);
if (error == 0)
heads = dos_heads = u;
dos_cylsecs = cylsecs = heads * sectors;
disksecs = cyls * heads * sectors;
error = ioctl(fd, DIOCGSECTORSIZE, &u);
if (error != 0)
u = 512;
error = ioctl(fd, DIOCGMEDIASIZE, &o);
if (error == 0) {
disksecs = o / u;
cyls = dos_cyls = o / (u * dos_heads * dos_sectors);
}
return (disksecs);
}
fdisk likely should do something sane in the face of such insanity,
but it is unclear what and fdisk is a royal pita to work on anyway :-(
Warner
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message