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. 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.6.2.4 2003/02/23 20:17:15 trhodes Exp $
36 .Nd scan mount options
42 .Fn getmntopts "const char *options" "const struct mntopt *mopts" "int *flagp" "int *altflagp"
46 function takes a comma separated option list and a list
47 of valid option names, and computes the bitmask
48 corresponding to the requested set of options.
52 is broken down into a sequence of comma separated tokens.
53 Each token is looked up in the table described by
56 the word referenced by either
62 field of the option's table entry)
64 The flag words are not initialized by
68 has the following format:
71 char *m_option; /* option name */
72 int m_inverse; /* is this a negative option, e.g. "dev" */
73 int m_flag; /* bit to set, e.g. MNT_RDONLY */
74 int m_altloc; /* non-zero to use altflagp rather than flagp */
78 The members of this structure are:
79 .Bl -tag -width m_inverse
87 that the name has the inverse meaning of the
91 is the string, whereas the
94 In this case, the sense of the string and the flag
99 the value of the bit to be set or cleared in
100 the flag word when the option is recognized.
101 The bit is set when the option is discovered,
102 but cleared if the option name was preceded
107 flag causes these two operations to be reversed.
109 the bit should be set or cleared in
115 Each of the user visible
117 flags has a corresponding
119 macro which defines an appropriate
122 To simplify the program interface and ensure consistency across all
123 programs, a general purpose macro,
126 contains an entry for all the generic VFS options.
127 In addition, the macros
136 Finally, the table must be terminated by an entry with a
140 Most commands will use the standard option set.
141 Local file systems which support the
143 flag, would also have an
146 This can be declared and used as follows:
150 struct mntopt mopts[] = {
157 mntflags = mntaltflags = 0;
159 getmntopts(options, mopts, &mntflags, &mntaltflags);
163 If the external integer variable
167 function displays an error message and exits if an
168 unrecognized option is encountered.