]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/cddl/compat/opensolaris/sys/vfs.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / cddl / compat / opensolaris / sys / vfs.h
1 /*-
2  * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
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.
13  *
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
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28
29 #ifndef _OPENSOLARIS_SYS_VFS_H_
30 #define _OPENSOLARIS_SYS_VFS_H_
31
32 #include <sys/param.h>
33
34 #ifdef _KERNEL
35
36 #include <sys/mount.h>
37 #include <sys/vnode.h>
38
39 #define rootdir rootvnode
40
41 typedef struct mount    vfs_t;
42
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
48 #define vfs_resource    mnt_stat.f_mntfromname
49
50 #define v_flag          v_vflag
51 #define v_vfsp          v_mount
52
53 #define VFS_RDONLY      MNT_RDONLY
54 #define VFS_NOSETUID    MNT_NOSUID
55 #define VFS_NOEXEC      MNT_NOEXEC
56
57 #define VFS_HOLD(vfsp)  do {                                            \
58         MNT_ILOCK(vfsp);                                                \
59         MNT_REF(vfsp);                                                  \
60         MNT_IUNLOCK(vfsp);                                              \
61 } while (0)
62 #define VFS_RELE(vfsp)  do {                                            \
63         MNT_ILOCK(vfsp);                                                \
64         MNT_REL(vfsp);                                                  \
65         MNT_IUNLOCK(vfsp);                                              \
66 } while (0)
67
68 #define fs_vscan(vp, cr, async) (0)
69
70 #define VROOT           VV_ROOT
71
72 /*
73  * Structure defining a mount option for a filesystem.
74  * option names are found in mntent.h
75  */
76 typedef struct mntopt {
77         char    *mo_name;       /* option name */
78         char    **mo_cancel;    /* list of options cancelled by this one */
79         char    *mo_arg;        /* argument string for this option */
80         int     mo_flags;       /* flags for this mount option */
81         void    *mo_data;       /* filesystem specific data */
82 } mntopt_t;
83
84 /*
85  * Flags that apply to mount options
86  */
87
88 #define MO_SET          0x01            /* option is set */
89 #define MO_NODISPLAY    0x02            /* option not listed in mnttab */
90 #define MO_HASVALUE     0x04            /* option takes a value */
91 #define MO_IGNORE       0x08            /* option ignored by parser */
92 #define MO_DEFAULT      MO_SET          /* option is on by default */
93 #define MO_TAG          0x10            /* flags a tag set by user program */
94 #define MO_EMPTY        0x20            /* empty space in option table */
95
96 #define VFS_NOFORCEOPT  0x01            /* honor MO_IGNORE (don't set option) */
97 #define VFS_DISPLAY     0x02            /* Turn off MO_NODISPLAY bit for opt */
98 #define VFS_NODISPLAY   0x04            /* Turn on MO_NODISPLAY bit for opt */
99 #define VFS_CREATEOPT   0x08            /* Create the opt if it's not there */
100
101 /*
102  * Structure holding mount option strings for the mounted file system.
103  */
104 typedef struct mntopts {
105         uint_t          mo_count;               /* number of entries in table */
106         mntopt_t        *mo_list;               /* list of mount options */
107 } mntopts_t;
108
109 void vfs_setmntopt(vfs_t *vfsp, const char *name, const char *arg,
110     int flags __unused);
111 void vfs_clearmntopt(vfs_t *vfsp, const char *name);
112 int vfs_optionisset(const vfs_t *vfsp, const char *opt, char **argp);
113 int mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype,
114     char *fspath, char *fspec, int fsflags);
115
116 typedef uint64_t        vfs_feature_t;
117
118 #define VFSFT_XVATTR            0x100000001     /* Supports xvattr for attrs */
119 #define VFSFT_CASEINSENSITIVE   0x100000002     /* Supports case-insensitive */
120 #define VFSFT_NOCASESENSITIVE   0x100000004     /* NOT case-sensitive */
121 #define VFSFT_DIRENTFLAGS       0x100000008     /* Supports dirent flags */
122 #define VFSFT_ACLONCREATE       0x100000010     /* Supports ACL on create */
123 #define VFSFT_ACEMASKONACCESS   0x100000020     /* Can use ACEMASK for access */
124 #define VFSFT_SYSATTR_VIEWS     0x100000040     /* Supports sysattr view i/f */
125 #define VFSFT_ACCESS_FILTER     0x100000080     /* dirents filtered by access */
126 #define VFSFT_REPARSE           0x100000100     /* Supports reparse point */
127 #define VFSFT_ZEROCOPY_SUPPORTED        0x100000200
128                                 /* Support loaning /returning cache buffer */
129
130 #define vfs_set_feature(vfsp, feature)          do { } while (0)
131 #define vfs_clear_feature(vfsp, feature)        do { } while (0)
132 #define vfs_has_feature(vfsp, feature)          (0)
133
134 #endif  /* _KERNEL */
135
136 #endif  /* _OPENSOLARIS_SYS_VFS_H_ */