⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getmntopts.3

📁 早期freebsd实现
💻 3
字号:
.\" Copyright (c) 1994.\"	The Regents of the University of California.  All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\"    notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\"    notice, this list of conditions and the following disclaimer in the.\"    documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\"    must display the following acknowledgement:.\"	This product includes software developed by the University of.\"	California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\"    may be used to endorse or promote products derived from this software.\"    without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\"	@(#)getmntopts.3	8.1 (Berkeley) 3/27/94.\".Dd March 27, 1994.Dt GETMNTOPTS 3.Os BSD 4.4.Sh NAME.Nm getmntopts.Nd scan mount options.Sh SYNOPSIS.Fd #include <mntopts.h>.Ft void.Fn getmntopts "char *options" "struct mntopt *mopts" "int *flagp".Sh DESCRIPTIONThe.Nm getmntoptsfunction takes a comma separated option list and a listof valid option names, and computes the bitmaskcorresponding to the requested set of options..PpThe string.Dv optionsis broken down into a sequence of comma separated tokens.Each token is looked up in the table described by.Dv moptsand the bits inthe word referenced by.Dv flagpare updated.The flag word is not initialized by.Nm getmntopt .The table,.Dv mopts ,has the following format:.Bd -literalstruct mntopt {	char *m_option;		/* option name */	int m_inverse;		/* is this a negative option, eg "dev" */	int m_flag;		/* bit to set, eg MNT_RDONLY */};.Ed.PpThe members of this structure are:.Bl -tag -width m_inverse.It Fa m_optionthe option name,for example.Dq suid ..It Fa m_inversetells.Nm getmntoptsthat the name has the inverse meaning of thebit.For example,.Dq suidis the string, whereas themount flag is.Dv MNT_NOSUID .In this case, the sense of the string and the flagare inverted, so the.Dv m_inverseflag should be set..It Fa m_flagthe value of the bit to be set or cleared inthe flag word when the option is recognized.The bit is set when the option is discovered,but cleared if the option name was precededby the letters.Dq no .The.Dv m_inverseflag causes these two operations to be reversed..El.PpEach of the user visible.Dv MNT_flags has a corresponding.Dv MOPT_macro which defines an appropriate.Li "struct mntopt"entry.To simplify the program interface and ensure consistency across allprograms, a general purpose macro,.Dv MOPT_STDOPTS ,is defined whichcontains an entry for all the generic VFS options.In addition, the macros.Dv MOPT_FORCEand.Dv MOPT_UPDATEexist to enable the.Dv MNT_FORCEand.Dv MNT_UPDATEflags to be set.Finally, the table must be terminated by an entry with a NULLfirst element..Sh EXAMPLESMost commands will use the standard option set.Local filesystems which support the.Dv MNT_UPDATEflag, would also have an.Dv MOPT_UPDATEentry.This can be declared and used as follows:.Bd -literal#include "mntopts.h"struct mntopt mopts[] = {	MOPT_STDOPTS,	MOPT_UPDATE,	{ NULL }};	...	mntflags = 0;	...	getmntopts(options, mopts, &mntflags)	....Ed.Sh DIAGNOSTICSThe.Nm getmntoptsfunction displays an error message and exits if anunrecognized option is encountered..Sh SEE ALSO.Xr err 3 ,.Xr mount 8.Sh HISTORYThe.Fn getmntoptsfunction appeared in .Bx 4.4 .

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -