mntopts.h revision 153007
1139804Simp/*-
2237477Skib * Copyright (c) 1994
31549Srgrimes *      The Regents of the University of California.  All rights reserved.
41541Srgrimes *
51541Srgrimes * Redistribution and use in source and binary forms, with or without
61541Srgrimes * modification, are permitted provided that the following conditions
71541Srgrimes * are met:
81541Srgrimes * 1. Redistributions of source code must retain the above copyright
91541Srgrimes *    notice, this list of conditions and the following disclaimer.
101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111541Srgrimes *    notice, this list of conditions and the following disclaimer in the
121541Srgrimes *    documentation and/or other materials provided with the distribution.
131541Srgrimes * 4. Neither the name of the University nor the names of its contributors
141549Srgrimes *    may be used to endorse or promote products derived from this software
151541Srgrimes *    without specific prior written permission.
161541Srgrimes *
171549Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
181541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
211541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27116182Sobrien * SUCH DAMAGE.
28116182Sobrien *
29116182Sobrien *	@(#)mntopts.h	8.7 (Berkeley) 3/29/95
30237433Skib * $FreeBSD: head/sbin/mount/mntopts.h 153007 2005-12-02 03:55:02Z rodrigc $
31174982Salc */
3299226Speter
331541Srgrimesstruct mntopt {
341549Srgrimes	const char *m_option;	/* option name */
35237477Skib	int m_inverse;		/* if a negative option, e.g. "atime" */
3676166Smarkm	int m_flag;		/* bit to set, e.g. MNT_RDONLY */
37248084Sattilio	int m_altloc;		/* 1 => set bit in altflags */
386380Ssos};
3914235Speter
40237433Skib/* User-visible MNT_ flags. */
411541Srgrimes#define MOPT_ASYNC		{ "async",	0, MNT_ASYNC, 0 }
421549Srgrimes#define MOPT_NOATIME		{ "atime",	1, MNT_NOATIME, 0 }
4312662Sdg#define MOPT_NOEXEC		{ "exec",	1, MNT_NOEXEC, 0 }
4412662Sdg#define MOPT_NOSUID		{ "suid",	1, MNT_NOSUID, 0 }
45237477Skib#define MOPT_NOSYMFOLLOW	{ "symfollow",  1, MNT_NOSYMFOLLOW, 0 }
46237477Skib#define MOPT_RDONLY		{ "rdonly",	0, MNT_RDONLY, 0 }
4712662Sdg#define MOPT_SYNC		{ "sync",	0, MNT_SYNCHRONOUS, 0 }
4824994Sdg#define MOPT_UNION		{ "union",	0, MNT_UNION, 0 }
49237477Skib#define MOPT_USERQUOTA		{ "userquota",	0, 0, 0 }
5032446Sdyson#define MOPT_GROUPQUOTA		{ "groupquota",	0, 0, 0 }
511549Srgrimes#define MOPT_NOCLUSTERR		{ "clusterr",	1, MNT_NOCLUSTERR, 0 }
52237431Skib#define MOPT_NOCLUSTERW		{ "clusterw",	1, MNT_NOCLUSTERW, 0 }
53217151Skib#define MOPT_SUIDDIR		{ "suiddir",	0, MNT_SUIDDIR, 0 }
54217151Skib#define MOPT_SNAPSHOT		{ "snapshot",	0, MNT_SNAPSHOT, 0 }
55237474Skib#define MOPT_MULTILABEL		{ "multilabel",	0, MNT_MULTILABEL, 0 }
56217151Skib#define MOPT_ACLS		{ "acls",	0, MNT_ACLS, 0 }
57237431Skib
58237431Skib/* Control flags. */
59237431Skib#define MOPT_FORCE		{ "force",	0, MNT_FORCE, 0 }
60237431Skib#define MOPT_UPDATE		{ "update",	0, MNT_UPDATE, 0 }
61237474Skib#define MOPT_RO			{ "ro",		0, MNT_RDONLY, 0 }
62237431Skib#define MOPT_RW			{ "rw",		1, MNT_RDONLY, 0 }
63237431Skib
64237431Skib/* This is parsed by mount(8), but is ignored by specific mount_*(8)s. */
65237431Skib#define MOPT_AUTO		{ "auto",	0, 0, 0 }
66237431Skib
67217151Skib/* A handy macro as terminator of MNT_ array. */
68217151Skib#define MOPT_END		{ NULL,		0, 0, 0 }
69217151Skib
70217151Skib#define MOPT_FSTAB_COMPAT						\
71217151Skib	MOPT_RO,							\
72237431Skib	MOPT_RW,							\
73217151Skib	MOPT_AUTO
74217151Skib
75217151Skib/* Standard options which all mounts can understand. */
76217151Skib#define MOPT_STDOPTS							\
77237431Skib	MOPT_USERQUOTA,							\
78237431Skib	MOPT_GROUPQUOTA,						\
79237431Skib	MOPT_FSTAB_COMPAT,						\
80237431Skib	MOPT_NOATIME,							\
81237431Skib	MOPT_NOEXEC,							\
82237431Skib	MOPT_SUIDDIR,		/* must be before MOPT_NOSUID */	\
83237431Skib	MOPT_NOSUID,							\
84237431Skib	MOPT_NOSYMFOLLOW,						\
85237431Skib	MOPT_RDONLY,							\
86237431Skib	MOPT_UNION,							\
87237431Skib	MOPT_NOCLUSTERR,						\
88237431Skib	MOPT_NOCLUSTERW,						\
89237431Skib	MOPT_MULTILABEL,						\
90237431Skib	MOPT_ACLS
91237431Skib
92237431Skibvoid getmntopts(const char *, const struct mntopt *, int *, int *);
93237431Skibvoid rmslashes(char *, char *);
94237431Skibvoid checkpath(const char *, char resolved_path[]);
95237431Skibextern int getmnt_silent;
96237431Skibvoid build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, size_t len);
97237431Skibvoid build_iovec_argf(struct iovec **iov, int *iovlen, const char *name, const char *fmt, ...);
98237431Skib