Date: Thu, 29 Aug 1996 16:05:18 +0200 (SAT) From: Robert Nordier <rnordier@iafrica.com> To: bde@zeta.org.au (Bruce Evans) Cc: hackers@freebsd.org Subject: Re: Determining disk type & size Message-ID: <199608291405.QAA00992@eac.iafrica.com> In-Reply-To: <199608290758.RAA01914@godzilla.zeta.org.au> from "Bruce Evans" at Aug 29, 96 05:58:54 pm
next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans wrote: > > >>./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. That clarifies it. Thanks. -- Robert Nordier
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199608291405.QAA00992>