[RFC] mount can figure out fstype automatically
olli at lurza.secnetix.de
Thu Jul 13 11:15:00 UTC 2006
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 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.
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
More information about the freebsd-arch