2
.\" The Regents of the University of California. All rights reserved.
4
.\" Redistribution and use in source and binary forms, with or without
5
.\" modification, are permitted provided that the following conditions
7
.\" 1. Redistributions of source code must retain the above copyright
8
.\" notice, this list of conditions and the following disclaimer.
9
.\" 2. Redistributions in binary form must reproduce the above copyright
10
.\" notice, this list of conditions and the following disclaimer in the
11
.\" documentation and/or other materials provided with the distribution.
12
.\" 4. Neither the name of the University nor the names of its contributors
13
.\" may be used to endorse or promote products derived from this software
14
.\" without specific prior written permission.
16
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28
.\" @(#)getmntopts.3 8.3 (Berkeley) 3/30/95
29
.\" $FreeBSD: src/sbin/mount/getmntopts.3,v 1.14.10.1 2010/02/10 00:26:20 kensmith Exp $
36
.Nd scan mount options
38
.Fd #include \&"mntopts.h"
41
.Fa "const char *options" "const struct mntopt *mopts"
42
.Fa "int *flagp" "int *altflagp"
47
function takes a comma separated option list and a list
48
of valid option names, and computes the bitmask
49
corresponding to the requested set of options.
53
is broken down into a sequence of comma separated tokens.
54
Each token is looked up in the table described by
57
the word referenced by either
63
field of the option's table entry)
65
The flag words are not initialized by
69
has the following format:
72
char *m_option; /* option name */
73
int m_inverse; /* is this a negative option, e.g. "dev" */
74
int m_flag; /* bit to set, e.g. MNT_RDONLY */
75
int m_altloc; /* non-zero to use altflagp rather than flagp */
79
The members of this structure are:
80
.Bl -tag -width m_inverse
88
that the name has the inverse meaning of the
92
is the string, whereas the
95
In this case, the sense of the string and the flag
100
the value of the bit to be set or cleared in
101
the flag word when the option is recognized.
102
The bit is set when the option is discovered,
103
but cleared if the option name was preceded
108
flag causes these two operations to be reversed.
110
the bit should be set or cleared in
116
Each of the user visible
118
flags has a corresponding
120
macro which defines an appropriate
123
To simplify the program interface and ensure consistency across all
124
programs, a general purpose macro,
127
contains an entry for all the generic VFS options.
128
In addition, the macros
137
Finally, the table must be terminated by an entry with a
141
Most commands will use the standard option set.
142
Local file systems which support the
144
flag, would also have an
147
This can be declared and used as follows:
151
struct mntopt mopts[] = {
158
mntflags = mntaltflags = 0;
160
getmntopts(options, mopts, &mntflags, &mntaltflags);
164
If the external integer variable
168
function displays an error message and exits if an
169
unrecognized option is encountered.