Re: [RFC] mount(8) can figure out fstype



On Thu, Jan 18, 2007 at 10:17:49PM +0200, Rostislav Krasny wrote:
OpenBSD already has such a functionality. It uses readlabelfs(3) for
this. What disadvantages or advantages does it have beside your
implementation?

Thanks for the pointer, I did not know about readlabelfs on
OpenBSD! From what I understand from reading the code:
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libutil/readlabel.c
http://www.openbsd.org/cgi-bin/cvsweb/src/sys/sys/disklabel.h

the readlabelfs() function tries to open the device
and do a DIOCGDINFO ioctl() on the device to read the disklabel.

Once the disklabel is read, (i.e. DIOCDINFO returns a 'struct disklabel'),
the p_fstype member of 'struct partition' which is inside the
'struct disklabel' is converted to a string name
based on the fstypesnames array in <sys/disklabel.h>.

This approach relies heavily on disklabels, and correct information
being stored in disklabels.

For FreeBSD, I do not like the idea of introducing a new dependency
between mount(8) and BSD disklabels.

The existing FreeBSD mount(8) program just tries to open a device,
does an nmount() with
a "fstype" parameter, and then relies on the underlying file system
code (i.e. "ufs", "msdosfs", etc.) to read the superblock from
the device, figure out if it can mount it, and return an error if it
cannot.

That's the behavior I tried to preserve with my patch.
It's kind of simplistic, but it does work.

--
Craig Rodrigues
rodrigc@xxxxxxxxxxxxxx
_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: [RFC] mount(8) can figure out fstype
    ... I did not know about readlabelfs on ... Once the disklabel is read, (i.e. DIOCDINFO returns a 'struct disklabel'), ... For FreeBSD, I do not like the idea of introducing a new dependency ...
    (freebsd-current)
  • UDMA ICRC error
    ... OS version: FreeBSD 4.7-Stable FreeBSD #3 ... I just added a disk to my box and after playing with ... fdisk and disklabel with this configuration: ...
    (freebsd-stable)
  • Re: Help deriving a corrupted disklabel
    ... For those who encounter a similar problem (damaged disklabel on a FreeBSD ... 'pkg_add -r' doesn't work in a Fixit shell). ... >> cannot find a written copy of my disklabel for that disk (a good ...
    (freebsd-questions)
  • disklabel differences FreeBSD, DragonFly
    ... DragonFly uses another disklabel as FreeBSD I discovered. ... Would be cool to be able to mount fs's across BSDs. ...
    (freebsd-hackers)
  • Creating a disklabel for NetBSD slice
    ... I have FreeBSD 6.1 and NetBSD 3.0 on my machine. ... entries for the FreeBSD partitions, ... So I make up a disklabel for ad0s2. ...
    (freebsd-questions)