1 /* $OpenBSD: mntopts.h,v 1.18 2016/09/10 16:53:30 natano Exp $ */ 2 /* $NetBSD: mntopts.h,v 1.3 1995/03/18 14:56:59 cgd Exp $ */ 3 4 /*- 5 * Copyright (c) 1994 6 * The Regents of the University of California. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. 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. 19 * 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 30 * SUCH DAMAGE. 31 * 32 * @(#)mntopts.h 8.3 (Berkeley) 3/27/94 33 */ 34 35 #define MFLAG_INVERSE 0x01 /* if a negative option, eg "dev" */ 36 #define MFLAG_SET 0x02 /* 1 => set bit in mntflags, 37 0 => return flag */ 38 #define MFLAG_STRVAL 0x04 /* option needs a string value */ 39 #define MFLAG_INTVAL 0x08 /* option needs an int value */ 40 #define MFLAG_OPT 0x10 /* value is optional */ 41 42 struct mntopt { 43 const char *m_option; /* option name */ 44 int m_flag; /* bit to set, eg. MNT_RDONLY */ 45 int m_oflags; 46 }; 47 48 union mntval { 49 char *strval; 50 int ival; 51 }; 52 53 /* User-visible MNT_ flags. */ 54 #define MOPT_ASYNC { "async", MNT_ASYNC, MFLAG_SET } 55 #define MOPT_NOACCESSTIME { "accesstime", MNT_NOATIME, \ 56 MFLAG_INVERSE | MFLAG_SET } 57 #define MOPT_NOATIME { "atime", MNT_NOATIME, MFLAG_INVERSE | MFLAG_SET } 58 #define MOPT_NODEV { "dev", MNT_NODEV, MFLAG_INVERSE | MFLAG_SET } 59 #define MOPT_NOEXEC { "exec", MNT_NOEXEC, MFLAG_INVERSE | MFLAG_SET } 60 #define MOPT_NOSUID { "suid", MNT_NOSUID, MFLAG_INVERSE | MFLAG_SET } 61 #define MOPT_NOPERM { "perm", MNT_NOPERM, MFLAG_INVERSE | MFLAG_SET } 62 #define MOPT_WXALLOWED { "wxallowed", MNT_WXALLOWED, MFLAG_SET } 63 #define MOPT_RDONLY { "rdonly", MNT_RDONLY, MFLAG_SET } 64 #define MOPT_SYNC { "sync", MNT_SYNCHRONOUS, MFLAG_SET } 65 #define MOPT_USERQUOTA { "userquota", 0, MFLAG_SET | MFLAG_STRVAL \ 66 | MFLAG_OPT } 67 #define MOPT_GROUPQUOTA { "groupquota", 0, MFLAG_SET | MFLAG_STRVAL \ 68 | MFLAG_OPT } 69 #define MOPT_SOFTDEP { "softdep", MNT_SOFTDEP, MFLAG_SET } 70 71 /* Control flags. */ 72 #define MOPT_FORCE { "force", MNT_FORCE, MFLAG_SET } 73 #define MOPT_UPDATE { "update", MNT_UPDATE, MFLAG_SET } 74 #define MOPT_RELOAD { "reload", MNT_RELOAD, MFLAG_SET } 75 76 /* Support for old-style "ro", "rw" flags. */ 77 #define MOPT_RO { "ro", MNT_RDONLY, MFLAG_SET } 78 #define MOPT_RW { "rw", MNT_RDONLY, MFLAG_INVERSE | MFLAG_SET } 79 80 /* These are parsed by mount(8), but are ignored by specific mount_*(8)s. */ 81 #define MOPT_AUTO { "auto", 0, MFLAG_SET } 82 #define MOPT_NET { "net", 0, MFLAG_SET } 83 84 #define MOPT_FSTAB_COMPAT \ 85 MOPT_RO, \ 86 MOPT_RW, \ 87 MOPT_NET, \ 88 MOPT_AUTO 89 90 /* Standard options which all mounts can understand. */ 91 #define MOPT_STDOPTS \ 92 MOPT_USERQUOTA, \ 93 MOPT_GROUPQUOTA, \ 94 MOPT_FSTAB_COMPAT, \ 95 MOPT_NOACCESSTIME, \ 96 MOPT_NOATIME, \ 97 MOPT_NODEV, \ 98 MOPT_NOEXEC, \ 99 MOPT_NOSUID, \ 100 MOPT_RDONLY 101 102 int getmntopts(const char *, const struct mntopt *, int *); 103 int getmntopt(char **, union mntval *, const struct mntopt *, int *); 104