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 $
34 .\" $DragonFly: src/sbin/mount/getmntopts.3,v 1.2 2003/06/17 04:27:33 dillon Exp $
41 .Nd scan mount options
43 .Fd #include \&"mntopts.h"
45 .Fn getmntopts "char *options" "struct mntopt *mopts" "int *flagp" "int *altflagp"
49 function takes a comma separated option list and a list
50 of valid option names, and computes the bitmask
51 corresponding to the requested set of options.
55 is broken down into a sequence of comma separated tokens.
56 Each token is looked up in the table described by
59 the word referenced by either
65 field of the option's table entry)
67 The flag words are not initialized by
71 has the following format:
74 char *m_option; /* option name */
75 int m_inverse; /* is this a negative option, e.g. "dev" */
76 int m_flag; /* bit to set, e.g. MNT_RDONLY */
77 int m_altloc; /* non-zero to use altflagp rather than flagp */
81 The members of this structure are:
82 .Bl -tag -width m_inverse
90 that the name has the inverse meaning of the
94 is the string, whereas the
97 In this case, the sense of the string and the flag
102 the value of the bit to be set or cleared in
103 the flag word when the option is recognized.
104 The bit is set when the option is discovered,
105 but cleared if the option name was preceded
110 flag causes these two operations to be reversed.
112 the bit should be set or cleared in
118 Each of the user visible
120 flags has a corresponding
122 macro which defines an appropriate
125 To simplify the program interface and ensure consistency across all
126 programs, a general purpose macro,
129 contains an entry for all the generic VFS options.
130 In addition, the macros
139 Finally, the table must be terminated by an entry with a
143 Most commands will use the standard option set.
144 Local file systems which support the
146 flag, would also have an
149 This can be declared and used as follows:
153 struct mntopt mopts[] = {
160 mntflags = mntaltflags = 0;
162 getmntopts(options, mopts, &mntflags, &mntaltflags);
166 If the external integer variable
170 function displays an error message and exits if an
171 unrecognized option is encountered.