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
46 .Fn getmntopts "char *options" "struct mntopt *mopts" "int *flagp" "int *altflagp"
50 function takes a comma separated option list and a list
51 of valid option names, and computes the bitmask
52 corresponding to the requested set of options.
56 is broken down into a sequence of comma separated tokens.
57 Each token is looked up in the table described by
60 the word referenced by either
66 field of the option's table entry)
68 The flag words are not initialized by
72 has the following format:
75 char *m_option; /* option name */
76 int m_inverse; /* is this a negative option, e.g. "dev" */
77 int m_flag; /* bit to set, e.g. MNT_RDONLY */
78 int m_altloc; /* non-zero to use altflagp rather than flagp */
82 The members of this structure are:
83 .Bl -tag -width m_inverse
91 that the name has the inverse meaning of the
95 is the string, whereas the
98 In this case, the sense of the string and the flag
103 the value of the bit to be set or cleared in
104 the flag word when the option is recognized.
105 The bit is set when the option is discovered,
106 but cleared if the option name was preceded
111 flag causes these two operations to be reversed.
113 the bit should be set or cleared in
119 Each of the user visible
121 flags has a corresponding
123 macro which defines an appropriate
126 To simplify the program interface and ensure consistency across all
127 programs, a general purpose macro,
130 contains an entry for all the generic VFS options.
131 In addition, the macros
140 Finally, the table must be terminated by an entry with a
144 Most commands will use the standard option set.
145 Local file systems which support the
147 flag, would also have an
150 This can be declared and used as follows:
154 struct mntopt mopts[] = {
161 mntflags = mntaltflags = 0;
163 getmntopts(options, mopts, &mntflags, &mntaltflags);
167 If the external integer variable
171 function displays an error message and exits if an
172 unrecognized option is encountered.