.\" The Regents of the University of California. All rights reserved.
.\" %sccs.include.redist.roff%
.\" @(#)getmntopts.3 8.2 (Berkeley) %G%
.Fn getmntopts "char *options" "struct mntopt *mopts" "int *flagp" "int *altflagp"
function takes a comma separated option list and a list
of valid option names, and computes the bitmask
corresponding to the requested set of options.
is broken down into a sequence of comma separated tokens.
Each token is looked up in the table described by
the word referenced by either
field of the option's table entry)
The flag word is not initialized by
has the following format:
char *m_option; /* option name */
int m_inverse; /* is this a negative option, eg "dev" */
int m_flag; /* bit to set, eg MNT_RDONLY */
int m_altloc; /* non-zero to use altflagp rather than flagp */
The members of this structure are:
.Bl -tag -width m_inverse
that the name has the inverse meaning of the
is the string, whereas the
In this case, the sense of the string and the flag
the value of the bit to be set or cleared in
the flag word when the option is recognized.
The bit is set when the option is discovered,
but cleared if the option name was preceded
flag causes these two operations to be reversed.
the bit should be set or cleared in
flags has a corresponding
macro which defines an appropriate
To simplify the program interface and ensure consistency across all
programs, a general purpose macro,
contains an entry for all the generic VFS options.
Finally, the table must be terminated by an entry with a NULL
Most commands will use the standard option set.
Local filesystems which support the
This can be declared and used as follows:
struct mntopt mopts[] = {
getmntopts(options, mopts, &mntflags)
function displays an error message and exits if an
unrecognized option is encountered.