Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jul 2006 13:14:52 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-arch@FreeBSD.ORG
Subject:   Re: [RFC] mount can figure out fstype automatically
Message-ID:  <200607131114.k6DBEqQ6067292@lurza.secnetix.de>
In-Reply-To: <20060710193005.GA34287@crodrigues.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Sorry for re-posting this, but I only posted to the -current
list ...  now I'm seeing that the real discussion seems to
take place here on -arch.

Craig Rodrigues <rodrigc@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.

"And believe me, as a C++ programmer, I don't hesitate to question
the decisions of language designers.  After a decent amount of C++
exposure, Python's flaws seem ridiculously small." -- Ville Vainio



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