mntopts.h revision 225736
1232633Smp/*-
259243Sobrien * Copyright (c) 1994
359243Sobrien *      The Regents of the University of California.  All rights reserved.
459243Sobrien *
559243Sobrien * Redistribution and use in source and binary forms, with or without
659243Sobrien * modification, are permitted provided that the following conditions
759243Sobrien * are met:
859243Sobrien * 1. Redistributions of source code must retain the above copyright
959243Sobrien *    notice, this list of conditions and the following disclaimer.
1059243Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1159243Sobrien *    notice, this list of conditions and the following disclaimer in the
1259243Sobrien *    documentation and/or other materials provided with the distribution.
1359243Sobrien * 4. Neither the name of the University nor the names of its contributors
1459243Sobrien *    may be used to endorse or promote products derived from this software
1559243Sobrien *    without specific prior written permission.
1659243Sobrien *
1759243Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1859243Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1959243Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2059243Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2159243Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22100616Smp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2359243Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2459243Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2559243Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2659243Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2759243Sobrien * SUCH DAMAGE.
2859243Sobrien *
2959243Sobrien *	@(#)mntopts.h	8.7 (Berkeley) 3/29/95
3059243Sobrien * $FreeBSD: stable/9/sbin/mount/mntopts.h 200796 2009-12-21 19:39:10Z trasz $
3159243Sobrien */
3259243Sobrien
3359243Sobrienstruct mntopt {
3459243Sobrien	const char *m_option;	/* option name */
3559243Sobrien	int m_inverse;		/* if a negative option, e.g. "atime" */
3659243Sobrien	int m_flag;		/* bit to set, e.g. MNT_RDONLY */
3759243Sobrien	int m_altloc;		/* 1 => set bit in altflags */
3859243Sobrien};
3959243Sobrien
4059243Sobrien/* User-visible MNT_ flags. */
4159243Sobrien#define MOPT_ASYNC		{ "async",	0, MNT_ASYNC, 0 }
42145479Smp#define MOPT_NOATIME		{ "atime",	1, MNT_NOATIME, 0 }
4359243Sobrien#define MOPT_NOEXEC		{ "exec",	1, MNT_NOEXEC, 0 }
4459243Sobrien#define MOPT_NOSUID		{ "suid",	1, MNT_NOSUID, 0 }
4559243Sobrien#define MOPT_NOSYMFOLLOW	{ "symfollow",  1, MNT_NOSYMFOLLOW, 0 }
4659243Sobrien#define MOPT_RDONLY		{ "rdonly",	0, MNT_RDONLY, 0 }
4759243Sobrien#define MOPT_SYNC		{ "sync",	0, MNT_SYNCHRONOUS, 0 }
4859243Sobrien#define MOPT_UNION		{ "union",	0, MNT_UNION, 0 }
4959243Sobrien#define MOPT_USERQUOTA		{ "userquota",	0, 0, 0 }
50145479Smp#define MOPT_GROUPQUOTA		{ "groupquota",	0, 0, 0 }
51145479Smp#define MOPT_NOCLUSTERR		{ "clusterr",	1, MNT_NOCLUSTERR, 0 }
52145479Smp#define MOPT_NOCLUSTERW		{ "clusterw",	1, MNT_NOCLUSTERW, 0 }
53232633Smp#define MOPT_SUIDDIR		{ "suiddir",	0, MNT_SUIDDIR, 0 }
54145479Smp#define MOPT_SNAPSHOT		{ "snapshot",	0, MNT_SNAPSHOT, 0 }
55232633Smp#define MOPT_MULTILABEL		{ "multilabel",	0, MNT_MULTILABEL, 0 }
56232633Smp#define MOPT_ACLS		{ "acls",	0, MNT_ACLS, 0 }
57232633Smp#define MOPT_NFS4ACLS		{ "nfsv4acls",	0, MNT_NFS4ACLS, 0 }
58145479Smp
59145479Smp/* Control flags. */
60145479Smp#define MOPT_FORCE		{ "force",	0, MNT_FORCE, 0 }
6159243Sobrien#define MOPT_UPDATE		{ "update",	0, MNT_UPDATE, 0 }
6259243Sobrien#define MOPT_RO			{ "ro",		0, MNT_RDONLY, 0 }
6359243Sobrien#define MOPT_RW			{ "rw",		1, MNT_RDONLY, 0 }
6459243Sobrien
6559243Sobrien/* This is parsed by mount(8), but is ignored by specific mount_*(8)s. */
6659243Sobrien#define MOPT_AUTO		{ "auto",	0, 0, 0 }
6759243Sobrien
6859243Sobrien/* A handy macro as terminator of MNT_ array. */
6959243Sobrien#define MOPT_END		{ NULL,		0, 0, 0 }
7059243Sobrien
7159243Sobrien#define MOPT_FSTAB_COMPAT						\
7259243Sobrien	MOPT_RO,							\
7359243Sobrien	MOPT_RW,							\
7459243Sobrien	MOPT_AUTO
7559243Sobrien
7659243Sobrien/* Standard options which all mounts can understand. */
7759243Sobrien#define MOPT_STDOPTS							\
7859243Sobrien	MOPT_USERQUOTA,							\
7959243Sobrien	MOPT_GROUPQUOTA,						\
8059243Sobrien	MOPT_FSTAB_COMPAT,						\
8159243Sobrien	MOPT_NOATIME,							\
8259243Sobrien	MOPT_NOEXEC,							\
8359243Sobrien	MOPT_SUIDDIR,		/* must be before MOPT_NOSUID */	\
8459243Sobrien	MOPT_NOSUID,							\
8559243Sobrien	MOPT_NOSYMFOLLOW,						\
8659243Sobrien	MOPT_RDONLY,							\
8759243Sobrien	MOPT_UNION,							\
8859243Sobrien	MOPT_NOCLUSTERR,						\
8959243Sobrien	MOPT_NOCLUSTERW,						\
9059243Sobrien	MOPT_MULTILABEL,						\
9159243Sobrien	MOPT_ACLS,							\
9259243Sobrien	MOPT_NFS4ACLS
9359243Sobrien
9459243Sobrienvoid getmntopts(const char *, const struct mntopt *, int *, int *);
9559243Sobrienvoid rmslashes(char *, char *);
9659243Sobrienvoid checkpath(const char *, char resolved_path[]);
9759243Sobrienextern int getmnt_silent;
9859243Sobrienvoid build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, size_t len);
9959243Sobrienvoid build_iovec_argf(struct iovec **iov, int *iovlen, const char *name, const char *fmt, ...);
10059243Sobrien