2 * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #ifndef _OPENSOLARIS_SYS_VFS_H_
30 #define _OPENSOLARIS_SYS_VFS_H_
32 #include <sys/param.h>
36 #include <sys/mount.h>
37 #include <sys/vnode.h>
39 #define rootdir rootvnode
41 typedef struct mount vfs_t;
43 #define vfs_flag mnt_flag
44 #define vfs_data mnt_data
45 #define vfs_count mnt_ref
46 #define vfs_fsid mnt_stat.f_fsid
47 #define vfs_bsize mnt_stat.f_bsize
49 #define v_flag v_vflag
50 #define v_vfsp v_mount
52 #define VFS_RDONLY MNT_RDONLY
53 #define VFS_NOSETUID MNT_NOSUID
54 #define VFS_NOEXEC MNT_NOEXEC
56 #define VFS_HOLD(vfsp) do { \
61 #define VFS_RELE(vfsp) do { \
70 * Structure defining a mount option for a filesystem.
71 * option names are found in mntent.h
73 typedef struct mntopt {
74 char *mo_name; /* option name */
75 char **mo_cancel; /* list of options cancelled by this one */
76 char *mo_arg; /* argument string for this option */
77 int mo_flags; /* flags for this mount option */
78 void *mo_data; /* filesystem specific data */
82 * Flags that apply to mount options
85 #define MO_SET 0x01 /* option is set */
86 #define MO_NODISPLAY 0x02 /* option not listed in mnttab */
87 #define MO_HASVALUE 0x04 /* option takes a value */
88 #define MO_IGNORE 0x08 /* option ignored by parser */
89 #define MO_DEFAULT MO_SET /* option is on by default */
90 #define MO_TAG 0x10 /* flags a tag set by user program */
91 #define MO_EMPTY 0x20 /* empty space in option table */
93 #define VFS_NOFORCEOPT 0x01 /* honor MO_IGNORE (don't set option) */
94 #define VFS_DISPLAY 0x02 /* Turn off MO_NODISPLAY bit for opt */
95 #define VFS_NODISPLAY 0x04 /* Turn on MO_NODISPLAY bit for opt */
96 #define VFS_CREATEOPT 0x08 /* Create the opt if it's not there */
99 * Structure holding mount option strings for the mounted file system.
101 typedef struct mntopts {
102 uint_t mo_count; /* number of entries in table */
103 mntopt_t *mo_list; /* list of mount options */
106 void vfs_setmntopt(vfs_t *vfsp, const char *name, const char *arg,
108 void vfs_clearmntopt(vfs_t *vfsp, const char *name);
109 int vfs_optionisset(const vfs_t *vfsp, const char *opt, char **argp);
110 int traverse(vnode_t **cvpp, int lktype);
111 int domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath,
112 char *fspec, int fsflags);
116 #endif /* _OPENSOLARIS_SYS_VFS_H_ */