Subject: Re: 1st argument for mount system call
To: Ian Dall <dall@hfrd.dsto.gov.au>
From: Chris G. Demetriou <cgd@alpha.bostic.com>
List: port-pc532
Date: 10/23/1994 20:39:30
> I notice that in netbsd, mount(1) invokes the mount system call with a
> string as the 1st argument (file system type), whereas the 4.4BSDLite
> distribution uses an integer. Will netbsd change to conform, or is there
> a good reason for using the string?
Net/2 (and NetBSD) used to do this. It was changed to use strings.
Strings are annoying, because they require explicit comparisons, but
on the other hand, they allow a file system to be created as a
loadable kernel module and "just work" with a bunch of utilities w/o
any special support. They also mean that utilities that understand
file system type names don't need to be modified to support the new
file systems.
For instance, say one wants to use an AFS loadable kernel module under
NetBSD. (I use AFS as an example, because such a module recently
became available. The original module that caused us to make the
change was a GPL'd version of an AmigaDOS file system, for the amiga
port.) You have to:
(1) add a MOUNT_ number, so that compiled binaries (such
as mount_afs) will have the correct number, and to
match the fs's index in the file system switch, and
(2) add support to utilities like 'find' and 'mount', which
understand mount fs names (the former uses it for
-fstype, the latter when displaying fs info),
for each new file system.
When you're using strings, you need to do neither of the above.
Instead, every place you used to switch on the fs type (either via
'switch', or via a series of 'if's), you need to change it to do
string comparisons. However, those are few and far between.
At least one commercial system uses strings: SunOS 4.x. That's where
the idea came from, really (at least for us).
chris