67 #include <sys/spa_boot.h>
68 #include "zfs_comutil.h"
69
70 int zfsfstype;
71 vfsops_t *zfs_vfsops = NULL;
72 static major_t zfs_major;
73 static minor_t zfs_minor;
74 static kmutex_t zfs_dev_mtx;
75
76 extern int sys_shutdown;
77
78 static int zfs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr);
79 static int zfs_umount(vfs_t *vfsp, int fflag, cred_t *cr);
80 static int zfs_mountroot(vfs_t *vfsp, enum whymountroot);
81 static int zfs_root(vfs_t *vfsp, vnode_t **vpp);
82 static int zfs_statvfs(vfs_t *vfsp, struct statvfs64 *statp);
83 static int zfs_vget(vfs_t *vfsp, vnode_t **vpp, fid_t *fidp);
84 static void zfs_freevfs(vfs_t *vfsp);
85
86 static const fs_operation_def_t zfs_vfsops_template[] = {
87 VFSNAME_MOUNT, { .vfs_mount = zfs_mount },
88 VFSNAME_MOUNTROOT, { .vfs_mountroot = zfs_mountroot },
89 VFSNAME_UNMOUNT, { .vfs_unmount = zfs_umount },
90 VFSNAME_ROOT, { .vfs_root = zfs_root },
91 VFSNAME_STATVFS, { .vfs_statvfs = zfs_statvfs },
92 VFSNAME_SYNC, { .vfs_sync = zfs_sync },
93 VFSNAME_VGET, { .vfs_vget = zfs_vget },
94 VFSNAME_FREEVFS, { .vfs_freevfs = zfs_freevfs },
95 NULL, NULL
96 };
97
98 static const fs_operation_def_t zfs_vfsops_eio_template[] = {
99 VFSNAME_FREEVFS, { .vfs_freevfs = zfs_freevfs },
100 NULL, NULL
101 };
102
103 /*
104 * We need to keep a count of active fs's.
105 * This is necessary to prevent our module
106 * from being unloaded after a umount -f
107 */
108 static uint32_t zfs_active_fs_count = 0;
109
110 static char *noatime_cancel[] = { MNTOPT_ATIME, NULL };
111 static char *atime_cancel[] = { MNTOPT_NOATIME, NULL };
112 static char *noxattr_cancel[] = { MNTOPT_XATTR, NULL };
113 static char *xattr_cancel[] = { MNTOPT_NOXATTR, NULL };
114
115 /*
116 * MO_DEFAULT is not used since the default value is determined
117 * by the equivalent property.
118 */
119 static mntopt_t mntopts[] = {
120 { MNTOPT_NOXATTR, noxattr_cancel, NULL, 0, NULL },
|
67 #include <sys/spa_boot.h>
68 #include "zfs_comutil.h"
69
70 int zfsfstype;
71 vfsops_t *zfs_vfsops = NULL;
72 static major_t zfs_major;
73 static minor_t zfs_minor;
74 static kmutex_t zfs_dev_mtx;
75
76 extern int sys_shutdown;
77
78 static int zfs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr);
79 static int zfs_umount(vfs_t *vfsp, int fflag, cred_t *cr);
80 static int zfs_mountroot(vfs_t *vfsp, enum whymountroot);
81 static int zfs_root(vfs_t *vfsp, vnode_t **vpp);
82 static int zfs_statvfs(vfs_t *vfsp, struct statvfs64 *statp);
83 static int zfs_vget(vfs_t *vfsp, vnode_t **vpp, fid_t *fidp);
84 static void zfs_freevfs(vfs_t *vfsp);
85
86 static const fs_operation_def_t zfs_vfsops_template[] = {
87 { VFSNAME_MOUNT, { .vfs_mount = zfs_mount } },
88 { VFSNAME_MOUNTROOT, { .vfs_mountroot = zfs_mountroot } },
89 { VFSNAME_UNMOUNT, { .vfs_unmount = zfs_umount } },
90 { VFSNAME_ROOT, { .vfs_root = zfs_root } },
91 { VFSNAME_STATVFS, { .vfs_statvfs = zfs_statvfs } },
92 { VFSNAME_SYNC, { .vfs_sync = zfs_sync } },
93 { VFSNAME_VGET, { .vfs_vget = zfs_vget } },
94 { VFSNAME_FREEVFS, { .vfs_freevfs = zfs_freevfs } },
95 { NULL, { NULL } }
96 };
97
98 static const fs_operation_def_t zfs_vfsops_eio_template[] = {
99 { VFSNAME_FREEVFS, { .vfs_freevfs = zfs_freevfs } },
100 { NULL, { NULL } }
101 };
102
103 /*
104 * We need to keep a count of active fs's.
105 * This is necessary to prevent our module
106 * from being unloaded after a umount -f
107 */
108 static uint32_t zfs_active_fs_count = 0;
109
110 static char *noatime_cancel[] = { MNTOPT_ATIME, NULL };
111 static char *atime_cancel[] = { MNTOPT_NOATIME, NULL };
112 static char *noxattr_cancel[] = { MNTOPT_XATTR, NULL };
113 static char *xattr_cancel[] = { MNTOPT_NOXATTR, NULL };
114
115 /*
116 * MO_DEFAULT is not used since the default value is determined
117 * by the equivalent property.
118 */
119 static mntopt_t mntopts[] = {
120 { MNTOPT_NOXATTR, noxattr_cancel, NULL, 0, NULL },
|