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 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)getmntopts.3 8.3 (Berkeley) 3/30/95
33 .\" $FreeBSD: src/sbin/mount/getmntopts.3,v 1.6.2.4 2003/02/23 20:17:15 trhodes Exp $
40 .Nd scan mount options
42 .Fd #include \&"mntopts.h"
44 .Fn getmntopts "char *options" "struct mntopt *mopts" "int *flagp" "int *altflagp"
48 function takes a comma separated option list and a list
49 of valid option names, and computes the bitmask
50 corresponding to the requested set of options.
54 is broken down into a sequence of comma separated tokens.
55 Each token is looked up in the table described by
58 the word referenced by either
64 field of the option's table entry)
66 The flag words are not initialized by
70 has the following format:
73 char *m_option; /* option name */
74 int m_inverse; /* is this a negative option, e.g. "dev" */
75 int m_flag; /* bit to set, e.g. MNT_RDONLY */
76 int m_altloc; /* non-zero to use altflagp rather than flagp */
80 The members of this structure are:
81 .Bl -tag -width m_inverse
89 that the name has the inverse meaning of the
93 is the string, whereas the
96 In this case, the sense of the string and the flag
101 the value of the bit to be set or cleared in
102 the flag word when the option is recognized.
103 The bit is set when the option is discovered,
104 but cleared if the option name was preceded
109 flag causes these two operations to be reversed.
111 the bit should be set or cleared in
117 Each of the user visible
119 flags has a corresponding
121 macro which defines an appropriate
124 To simplify the program interface and ensure consistency across all
125 programs, a general purpose macro,
128 contains an entry for all the generic VFS options.
129 In addition, the macros
138 Finally, the table must be terminated by an entry with a
142 Most commands will use the standard option set.
143 Local file systems which support the
145 flag, would also have an
148 This can be declared and used as follows:
152 struct mntopt mopts[] = {
159 mntflags = mntaltflags = 0;
161 getmntopts(options, mopts, &mntflags, &mntaltflags);
165 If the external integer variable
169 function displays an error message and exits if an
170 unrecognized option is encountered.