Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Aug 1996 17:58:54 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, hackers@FreeBSD.org, rnordier@iafrica.com
Subject:   Re: Determining disk type & size
Message-ID:  <199608290758.RAA01914@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>>./fdtest /dev/fd0
>>sectors per cylinder: 158 [<-- 30 expected]

>>   if (ioctl(fd, DIOCGDINFO, &dl) == -1)
>>      err(1, argv[1]);
>>   printf("sectors per cylinder: %lu\n", dl.d_secpercyl);

I wrote:
>DIOCGDINFO for floppies just returns whatever happens to be in the label
>area on the disk (*).  The label is garbage unless the disk actually has
>a label.  There is no way to tell from the ioctl() return value whether
>the label is garbage.

Oops, DIOCGDINFO checks the label magic number and checksum, so
d_secpercyl is probably correct if the label is valid.  However,
it's extremely unlikely that a DOS floppy would contain a valid label.
Sector 2 normally contains part of the FAT, and it is very unlikely that
the bytes in the FAT form a valid label.

Bruce



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