Subject: Re: newfs_msdos
To: None <email@example.com>
From: Wolfgang Solfrank <firstname.lastname@example.org>
Date: 12/10/1999 20:11:04
> The only issue I'm not really familiar with is matching the
> information from the kernel (obtained by sysctl()) or from the
> disklabel (obtained by ioctl()) with the device file (e.g.,
> /dev/rwd0h) to write to. For the disklabel, I guess I can assume that
> we aren't looking at any links and take the last letter as the index
> into the partition table returned by ioctl(). This isn't foolproof if
> people create links and call newfs_msdos with the other names, but
> perhaps that isn't our problem and the names given could be checked to
> fall within certain patterns. What about for the information returned
> by sysctl()? Any suggestions for these issues?
What you should do here, is stat(2) the file, look whether it's a device
(otherwise you can only use the length as a hint for what to do), and if
yes, extract the partition from the minor device number.
Hope it helps.
ws@TooLs.DE (Wolfgang Solfrank, TooLs GmbH) +49-228-985800