[patch] Proposal: move getmntopts(3) into libutil
pluknet at gmail.com
Tue Feb 26 11:39:28 UTC 2013
The functions from sbin/mount/getmntopts.c are used in a bunch of other
stuff like mount_* utilities which have to suck them in as their own
functions in quite a hackish way. getmntopts.c copies are compiled in to
an every utility-consumer instead of being present in one place. Looks
like getmntopts.c was brought together with mount_ufs.c in 4.4BSD-Lite.
After that other mount_* were converted to use getmntopts().
The utilities consuming getmntopts.c as currently present in HEAD:
External mount-like utilities may also have difficulties with building
to get getmntopts.c source as this requires /usr/src presence which is
in sync with installed world. Look how mount_fusefs from ports compiles:
# mount_fusefs needs mntopts.h and getmntopts.c from src/sbin/mount/
The attached patch moves them to the IMHO architecturally more correct
place: a separate library -lutil.
sbin/mount/mntopts.h -> include/mntopts.h
sbin/mount/getmntopts.[3c] -> lib/libutil/getmntopts.[3c]
The full list of functions in getmntopts.c:
This will eventually give them public and documented status. It will
also bring back to live its semi-dead man page getmntopts(3) currently
disconnected from build, that will force us to update (and use) it which
is also a goody. getmntopts.3 was never installed.
As a bonus, it will bring us in sync with others BSDs.
The attached patch was buildworld-tested and contains only minimal changes;
getmntopts(3) updates and other improvements could be made separately.
- rearrange files from sbin/mount/ to the new place
- update Makefiles's of mount_* to use getmntopts(3) from libutil
- #include "mntopts.h" -> #include <mntopts.h>
Well, the include changes should be safe to commit as is.
Below is a changelist from svn stat, for convenience 'sake.
A + include/mntopts.h
A + lib/libutil/getmntopts.3
A + lib/libutil/getmntopts.c
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 36278 bytes
Desc: not available
More information about the freebsd-current