Hi Jason, hi Thordur, just to warn you, i had a brief look at this, and what you have does not seem right yet. This looks like a can of worms.
Jason McIntyre wrote on Thu, Jun 25, 2009 at 02:11:08PM +0100: > On Wed, Jun 24, 2009 at 01:42:58PM +0000, Thordur I. Bjornsson wrote: >> I like this a little bit better then what was previously proposed. >> I wouldn't mind just removing the long options all togather, but I >> doubt thats possible now. Not even talking about not breaking existing configurations, there are plenty of long options not having any short counterparts, for example async,noatime,nosuid,sync,... and for example port for mount_nfs (not exhaustive). Besides, mount(8) talks about providing some long options for compatibility with other operating systems, including synonyms for other long options. > here's the diff then. please check the alternative option names, as i > suspect some may be wrong (i cannot find the source to verify). /usr/src/sbin/mount/mntopts.h /usr/src/sbin/mount/mount.c /usr/src/sbin/mount_*/mount_*.c That's not necessarily exhaustive, related definitions can be found in quite a few different files. > also -d has no long form given. dumbtimer. But there are short options without long counterparts, for example -a. To specity that in fstab(5), you would have to use, e.g., "rw,-a=4". I cannot confirm the long form "readahead" you provide, it doesn't seem to exist. > +The options are documented below. > +An equivalent is given in parentheses, > +suitable for use in > +.Xr fstab 5 > +entries. Not only that, the long options are also suitable for -o. The mount(8) manual explains this completely differently: It lists both the short options below DESCRIPTION, and the long options below -o, and it cross-references the long options from some of the short ones (e.g. from -r) but not from all (e.g. -w), and it cross- references the short options from the long ones. So there is a lot of duplication in there. On top of that, mount(8) is not consistent. It lists rdonly, but not ro and rw, but then proceeds to use rw in the examples instead of nordonly (uh, nord-only does look silly, though). Not even the code is fully consistent. The header mntopts.h calls ro and rw "old-style", seeming to favour rdonly just like the manual, but then mount.c proceeds to translate -r into ro and -w into rw. Besides, mount.c uses hasopt to make sure that, if you specify "-o force -f", the force option is passed to the backend only once, but if you specify "-f -o force", it will happily pass "force,force", and if you specify "-o rdonly -r", it will happily pass "rdonly,ro"; that is, synonyms aren't normalized before filtering duplicate options, and duplicates are not filtered from -o at all. Hopefully, that doesn't cause any bugs, but one might want to either fix it or check all backends. Then, judging from the source, mount(8) seems to behave in weird ways when passed mutually exclusive options. For example, -r -w results in -w -r -w -r results in -w -r -w -o ro results in -r -o ro,rw -r results in -w -o rdonly,rw -r results in -r (Try it!) So, the last *long* option always wins, but *short* options only count in that game if they weren't specified before, not counting some synonyms (preceding -o rdonly doesn't prevent later -r from winning), but indeed counting other synonyms (preceding -o ro does prevent later -r from winning). That is assuming all backends honour the last option, which i didn't check for all backends; in case some don't, this might get even more complicated. Do you feel confused now? Some cleanup of the manual would definitely seem useful, and maybe some cleanup of the code, too - even though breaking mount(8) would be really scary, so great care is needed. Sorry, i can't come up with any diffs right now, just wanted to tell you all this is not as simple as it might seem on first sight... Yours, Ingo