Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jan 2007 22:24:22 -0500
From:      Craig Rodrigues <rodrigc@crodrigues.org>
To:        Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= <des@des.no>
Cc:        freebsd-current@freebsd.org, freebsd-arch@freebsd.org
Subject:   Re: [RFC] mount(8) can figure out fstype
Message-ID:  <20070119032422.GB1891@crodrigues.org>
In-Reply-To: <86lkk02wp7.fsf@dwp.des.no>
References:  <20070118134936.GA7391@crodrigues.org> <86lkk02wp7.fsf@dwp.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 18, 2007 at 04:15:00PM +0100, Dag-Erling Smrgrav wrote:
> Didn't somebody mention ordering issues back then?  Your revised patch
> still doesn't even try to address those.  If we ever get ext3 support,
> for instance, mounting an ext2 file system as ext3 might cause it to
> be silently upgraded to ext3.

Since FreeBSD doesn't have any ext3 support right now, I think a more concrete
example of ordering issues is to look at cd9660 vs. udf, which FreeBSD
currently supports.  In my patch, the mount_fs_try() function
does deal with one ordering issue.....no matter what is in the
vfs.conflist sysctl, it always tries to mount "ufs" first.  This approximates
the existing mount(8) behavior.  It would not be hard to modify
mount_fs_try() to deal with ordering of ext3 vs. ext2, udf vs. cd9660,
or whatever.  Not the most elegant solution, but workable for
the limited subset of file systems that FreeBSD supports.

> Not to mention the slew of error messages this will result in as you
> walk the list of filesystems trying to find the right one...

This is true, but in my tests, the "slew of error messages" is not too bad.
Also, with my patch, if you specify the "-t" parameter, mount_fs_try()
is not used, so things like mounting via /etc/fstab, where the fstype
is specified, will behave the same way as now, and not iterate through
a list of file systems.

> A better way would be to have a userland utility attempt to identify
> the file system, and if necessary load the appropriate module, before
> mounting it.

I disagree.  To go down this road, instead of a separate utility,
I think the best approach would be to put all this logic inside mount(8),
the way Linux does, as Christoph Hellwig mentioned here:
http://lists.freebsd.org/pipermail/freebsd-arch/2006-July/005447.html

I've looked at the Linux mount utility source.....it maintains a table
of magic numbers and offsets and tries them in a well defined order.
The logic is quite involved, but it does work.  The Linux code
is under GPL though....

The other suggestion that someone had was to use libmagic in mount(8).
libmagic is good, but using it in mount(8) would introduce link dependencies on
libmagic and libz, and also introduce dependencies on files in
/usr/share/misc/magic.

-- 
Craig Rodrigues        
rodrigc@crodrigues.org



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