Re: [RFC] mount can figure out fstype automatically

From: Oliver Fromme <olli_at_lurza.secnetix.de>
Date: Tue, 11 Jul 2006 14:46:36 +0200 (CEST)
Craig Rodrigues <rodrigc_at_crodrigues.org> wrote:
 > Scott Long wrote:
 > > So in your opinion and experience, what are the pros and cons of 
 > > maintaining a table of magic numbers?
 > 
 > One con: every time you add a new filesystem, you need to update
 > mount(8).  Not a big deal, but it is something.

How about this idea:  Every filesystem registers a piece
of "magic information" somewhere (maybe kenv or sysctl,
or even a file somewhere in /etc or whatever).

Then mount(8) just has to look at that list, compare in
turn with the device in question, and call the respective
filesystem if found (if the mount fails even though the
magic matched, mount(8) could print a warning and continue
looking at the remaining filesystems' magics).  If a new
filesystem is added, it registers its magic as explained
above.  No need to update mount(8) itself.

For the case where multiple filesystems can share their
structures (like UDF + ISO9660), a priority code could be
assigned, so that the filesystem that's "more useful" (or
more popular) is probed first.  Also, filesystems that are
difficult to recognize (like FAT) would get a low priority
code, so they are probed last.

Note that the user can always override the selection by
manually specifying the filesystem with the -t flag of
mount(8), so there shouldn't be any regression.

Just my 2 cents.

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"Being really good at C++ is like being really good
at using rocks to sharpen sticks."
        -- Thant Tessman
Received on Tue Jul 11 2006 - 10:46:45 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:58 UTC