1994-05-26 08:35:07 +02:00
|
|
|
.\" Copyright (c) 1994
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
2017-03-01 00:42:47 +01:00
|
|
|
.\" 3. Neither the name of the University nor the names of its contributors
|
1994-05-26 08:35:07 +02:00
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1997-03-11 13:28:00 +01:00
|
|
|
.\" @(#)getmntopts.3 8.3 (Berkeley) 3/30/95
|
1999-08-28 02:22:10 +02:00
|
|
|
.\" $FreeBSD$
|
1994-05-26 08:35:07 +02:00
|
|
|
.\"
|
2008-02-17 21:25:25 +01:00
|
|
|
.Dd February 17, 2008
|
1994-05-26 08:35:07 +02:00
|
|
|
.Dt GETMNTOPTS 3
|
2001-07-10 13:04:34 +02:00
|
|
|
.Os
|
1994-05-26 08:35:07 +02:00
|
|
|
.Sh NAME
|
|
|
|
.Nm getmntopts
|
|
|
|
.Nd scan mount options
|
|
|
|
.Sh SYNOPSIS
|
2001-10-04 15:11:11 +02:00
|
|
|
.Fd #include \&"mntopts.h"
|
1994-05-26 08:35:07 +02:00
|
|
|
.Ft void
|
2005-11-24 15:27:53 +01:00
|
|
|
.Fo getmntopts
|
|
|
|
.Fa "const char *options" "const struct mntopt *mopts"
|
|
|
|
.Fa "int *flagp" "int *altflagp"
|
|
|
|
.Fc
|
1994-05-26 08:35:07 +02:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
2000-11-20 17:52:27 +01:00
|
|
|
.Fn getmntopts
|
1994-05-26 08:35:07 +02:00
|
|
|
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.
|
|
|
|
.Pp
|
|
|
|
The string
|
2001-04-26 13:47:49 +02:00
|
|
|
.Fa options
|
1994-05-26 08:35:07 +02:00
|
|
|
is broken down into a sequence of comma separated tokens.
|
|
|
|
Each token is looked up in the table described by
|
2001-04-26 13:47:49 +02:00
|
|
|
.Fa mopts
|
1994-05-26 08:35:07 +02:00
|
|
|
and the bits in
|
1994-11-02 00:51:53 +01:00
|
|
|
the word referenced by either
|
2001-04-26 13:47:49 +02:00
|
|
|
.Fa flagp
|
1994-11-02 00:51:53 +01:00
|
|
|
or
|
2001-04-26 13:47:49 +02:00
|
|
|
.Fa altflagp
|
1994-11-02 00:51:53 +01:00
|
|
|
(depending on the
|
2001-04-26 13:47:49 +02:00
|
|
|
.Va m_altloc
|
1994-11-02 00:51:53 +01:00
|
|
|
field of the option's table entry)
|
1994-05-26 08:35:07 +02:00
|
|
|
are updated.
|
1997-03-11 13:28:00 +01:00
|
|
|
The flag words are not initialized by
|
2000-11-20 17:52:27 +01:00
|
|
|
.Fn getmntopts .
|
1994-05-26 08:35:07 +02:00
|
|
|
The table,
|
2001-04-26 13:47:49 +02:00
|
|
|
.Fa mopts ,
|
1994-05-26 08:35:07 +02:00
|
|
|
has the following format:
|
|
|
|
.Bd -literal
|
|
|
|
struct mntopt {
|
|
|
|
char *m_option; /* option name */
|
2012-10-15 15:20:08 +02:00
|
|
|
int m_inverse; /* is this a negative option, e.g., "dev" */
|
|
|
|
int m_flag; /* bit to set, e.g., MNT_RDONLY */
|
1994-11-02 00:51:53 +01:00
|
|
|
int m_altloc; /* non-zero to use altflagp rather than flagp */
|
1994-05-26 08:35:07 +02:00
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
The members of this structure are:
|
|
|
|
.Bl -tag -width m_inverse
|
2001-04-26 13:47:49 +02:00
|
|
|
.It Va m_option
|
1994-05-26 08:35:07 +02:00
|
|
|
the option name,
|
|
|
|
for example
|
2001-04-26 13:47:49 +02:00
|
|
|
.Dq Li suid .
|
|
|
|
.It Va m_inverse
|
1994-05-26 08:35:07 +02:00
|
|
|
tells
|
2000-11-20 17:52:27 +01:00
|
|
|
.Fn getmntopts
|
1994-05-26 08:35:07 +02:00
|
|
|
that the name has the inverse meaning of the
|
|
|
|
bit.
|
|
|
|
For example,
|
2001-04-26 13:47:49 +02:00
|
|
|
.Dq Li suid
|
1994-05-26 08:35:07 +02:00
|
|
|
is the string, whereas the
|
|
|
|
mount flag is
|
|
|
|
.Dv MNT_NOSUID .
|
|
|
|
In this case, the sense of the string and the flag
|
|
|
|
are inverted, so the
|
2001-04-26 13:47:49 +02:00
|
|
|
.Va m_inverse
|
1994-05-26 08:35:07 +02:00
|
|
|
flag should be set.
|
2001-04-26 13:47:49 +02:00
|
|
|
.It Va m_flag
|
1994-05-26 08:35:07 +02:00
|
|
|
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
|
|
|
|
by the letters
|
2001-04-26 13:47:49 +02:00
|
|
|
.Dq Li no .
|
1994-05-26 08:35:07 +02:00
|
|
|
The
|
2001-04-26 13:47:49 +02:00
|
|
|
.Va m_inverse
|
1994-05-26 08:35:07 +02:00
|
|
|
flag causes these two operations to be reversed.
|
2001-04-26 13:47:49 +02:00
|
|
|
.It Va m_altloc
|
1994-11-02 00:51:53 +01:00
|
|
|
the bit should be set or cleared in
|
2001-04-26 13:47:49 +02:00
|
|
|
.Fa altflagp
|
1994-11-02 00:51:53 +01:00
|
|
|
rather than
|
2001-04-26 13:47:49 +02:00
|
|
|
.Fa flagp .
|
1994-05-26 08:35:07 +02:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Each of the user visible
|
|
|
|
.Dv MNT_
|
|
|
|
flags has a corresponding
|
|
|
|
.Dv MOPT_
|
|
|
|
macro which defines an appropriate
|
2001-04-26 13:47:49 +02:00
|
|
|
.Vt "struct mntopt"
|
1994-05-26 08:35:07 +02:00
|
|
|
entry.
|
|
|
|
To simplify the program interface and ensure consistency across all
|
|
|
|
programs, a general purpose macro,
|
|
|
|
.Dv MOPT_STDOPTS ,
|
|
|
|
is defined which
|
|
|
|
contains an entry for all the generic VFS options.
|
|
|
|
In addition, the macros
|
|
|
|
.Dv MOPT_FORCE
|
|
|
|
and
|
|
|
|
.Dv MOPT_UPDATE
|
|
|
|
exist to enable the
|
|
|
|
.Dv MNT_FORCE
|
|
|
|
and
|
|
|
|
.Dv MNT_UPDATE
|
|
|
|
flags to be set.
|
2001-04-26 13:47:49 +02:00
|
|
|
Finally, the table must be terminated by an entry with a
|
|
|
|
.Dv NULL
|
1994-05-26 08:35:07 +02:00
|
|
|
first element.
|
|
|
|
.Sh EXAMPLES
|
|
|
|
Most commands will use the standard option set.
|
2002-08-21 20:11:48 +02:00
|
|
|
Local file systems which support the
|
1994-05-26 08:35:07 +02:00
|
|
|
.Dv MNT_UPDATE
|
|
|
|
flag, would also have an
|
|
|
|
.Dv MOPT_UPDATE
|
|
|
|
entry.
|
|
|
|
This can be declared and used as follows:
|
|
|
|
.Bd -literal
|
|
|
|
#include "mntopts.h"
|
|
|
|
|
|
|
|
struct mntopt mopts[] = {
|
|
|
|
MOPT_STDOPTS,
|
|
|
|
MOPT_UPDATE,
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
...
|
1997-03-11 13:28:00 +01:00
|
|
|
mntflags = mntaltflags = 0;
|
1994-05-26 08:35:07 +02:00
|
|
|
...
|
1997-03-11 13:28:00 +01:00
|
|
|
getmntopts(options, mopts, &mntflags, &mntaltflags);
|
1994-05-26 08:35:07 +02:00
|
|
|
...
|
|
|
|
.Ed
|
|
|
|
.Sh DIAGNOSTICS
|
1997-03-11 13:28:00 +01:00
|
|
|
If the external integer variable
|
2001-04-26 13:47:49 +02:00
|
|
|
.Va getmnt_silent
|
2008-02-17 21:25:25 +01:00
|
|
|
is zero, then the
|
2000-11-20 17:52:27 +01:00
|
|
|
.Fn getmntopts
|
1994-05-26 08:35:07 +02:00
|
|
|
function displays an error message and exits if an
|
|
|
|
unrecognized option is encountered.
|
2008-02-17 21:25:25 +01:00
|
|
|
Otherwise unrecognized options are silently ignored.
|
1997-03-11 13:28:00 +01:00
|
|
|
By default
|
2001-04-26 13:47:49 +02:00
|
|
|
.Va getmnt_silent
|
1997-03-11 13:28:00 +01:00
|
|
|
is zero.
|
1994-05-26 08:35:07 +02:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr err 3 ,
|
|
|
|
.Xr mount 8
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Fn getmntopts
|
2001-04-26 13:47:49 +02:00
|
|
|
function appeared in
|
1994-05-26 08:35:07 +02:00
|
|
|
.Bx 4.4 .
|