191 };
192
193 static vfsdef_t vfw = {
194 VFSDEF_VERSION,
195 "ufs",
196 ufsinit,
197 VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_CANLOFI,
198 &ufs_mntopts
199 };
200
201 /*
202 * Module linkage information for the kernel.
203 */
204 extern struct mod_ops mod_fsops;
205
206 static struct modlfs modlfs = {
207 &mod_fsops, "filesystem for ufs", &vfw
208 };
209
210 static struct modlinkage modlinkage = {
211 MODREV_1, (void *)&modlfs, NULL
212 };
213
214 /*
215 * An attempt has been made to make this module unloadable. In order to
216 * test it, we need a system in which the root fs is NOT ufs. THIS HAS NOT
217 * BEEN DONE
218 */
219
220 extern kstat_t *ufs_inode_kstat;
221 extern uint_t ufs_lockfs_key;
222 extern void ufs_lockfs_tsd_destructor(void *);
223 extern uint_t bypass_snapshot_throttle_key;
224
225 int
226 _init(void)
227 {
228 /*
229 * Create an index into the per thread array so that any thread doing
230 * VOP will have a lockfs mark on it.
231 */
2054 */
2055 if (ip->i_gen != ufid->ufid_gen || ip->i_mode == 0 ||
2056 (ip->i_nlink <= 0)) {
2057 VN_RELE(ITOV(ip));
2058 error = EINVAL;
2059 goto errout;
2060 }
2061
2062 *vpp = ITOV(ip);
2063 return (0);
2064
2065 errout:
2066 *vpp = NULL;
2067 return (error);
2068 }
2069
2070 static int
2071 ufsinit(int fstype, char *name)
2072 {
2073 static const fs_operation_def_t ufs_vfsops_template[] = {
2074 VFSNAME_MOUNT, { .vfs_mount = ufs_mount },
2075 VFSNAME_UNMOUNT, { .vfs_unmount = ufs_unmount },
2076 VFSNAME_ROOT, { .vfs_root = ufs_root },
2077 VFSNAME_STATVFS, { .vfs_statvfs = ufs_statvfs },
2078 VFSNAME_SYNC, { .vfs_sync = ufs_sync },
2079 VFSNAME_VGET, { .vfs_vget = ufs_vget },
2080 VFSNAME_MOUNTROOT, { .vfs_mountroot = ufs_mountroot },
2081 NULL, NULL
2082 };
2083 int error;
2084
2085 ufsfstype = fstype;
2086
2087 error = vfs_setfsops(fstype, ufs_vfsops_template, &ufs_vfsops);
2088 if (error != 0) {
2089 cmn_err(CE_WARN, "ufsinit: bad vfs ops template");
2090 return (error);
2091 }
2092
2093 error = vn_make_ops(name, ufs_vnodeops_template, &ufs_vnodeops);
2094 if (error != 0) {
2095 (void) vfs_freevfsops_by_type(fstype);
2096 cmn_err(CE_WARN, "ufsinit: bad vnode ops template");
2097 return (error);
2098 }
2099
2100 ufs_iinit();
2101 return (0);
|
191 };
192
193 static vfsdef_t vfw = {
194 VFSDEF_VERSION,
195 "ufs",
196 ufsinit,
197 VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_CANLOFI,
198 &ufs_mntopts
199 };
200
201 /*
202 * Module linkage information for the kernel.
203 */
204 extern struct mod_ops mod_fsops;
205
206 static struct modlfs modlfs = {
207 &mod_fsops, "filesystem for ufs", &vfw
208 };
209
210 static struct modlinkage modlinkage = {
211 MODREV_1, { (void *)&modlfs, NULL }
212 };
213
214 /*
215 * An attempt has been made to make this module unloadable. In order to
216 * test it, we need a system in which the root fs is NOT ufs. THIS HAS NOT
217 * BEEN DONE
218 */
219
220 extern kstat_t *ufs_inode_kstat;
221 extern uint_t ufs_lockfs_key;
222 extern void ufs_lockfs_tsd_destructor(void *);
223 extern uint_t bypass_snapshot_throttle_key;
224
225 int
226 _init(void)
227 {
228 /*
229 * Create an index into the per thread array so that any thread doing
230 * VOP will have a lockfs mark on it.
231 */
2054 */
2055 if (ip->i_gen != ufid->ufid_gen || ip->i_mode == 0 ||
2056 (ip->i_nlink <= 0)) {
2057 VN_RELE(ITOV(ip));
2058 error = EINVAL;
2059 goto errout;
2060 }
2061
2062 *vpp = ITOV(ip);
2063 return (0);
2064
2065 errout:
2066 *vpp = NULL;
2067 return (error);
2068 }
2069
2070 static int
2071 ufsinit(int fstype, char *name)
2072 {
2073 static const fs_operation_def_t ufs_vfsops_template[] = {
2074 { VFSNAME_MOUNT, { .vfs_mount = ufs_mount } },
2075 { VFSNAME_UNMOUNT, { .vfs_unmount = ufs_unmount } },
2076 { VFSNAME_ROOT, { .vfs_root = ufs_root } },
2077 { VFSNAME_STATVFS, { .vfs_statvfs = ufs_statvfs } },
2078 { VFSNAME_SYNC, { .vfs_sync = ufs_sync } },
2079 { VFSNAME_VGET, { .vfs_vget = ufs_vget } },
2080 { VFSNAME_MOUNTROOT, { .vfs_mountroot = ufs_mountroot } },
2081 { NULL, { NULL } }
2082 };
2083 int error;
2084
2085 ufsfstype = fstype;
2086
2087 error = vfs_setfsops(fstype, ufs_vfsops_template, &ufs_vfsops);
2088 if (error != 0) {
2089 cmn_err(CE_WARN, "ufsinit: bad vfs ops template");
2090 return (error);
2091 }
2092
2093 error = vn_make_ops(name, ufs_vnodeops_template, &ufs_vnodeops);
2094 if (error != 0) {
2095 (void) vfs_freevfsops_by_type(fstype);
2096 cmn_err(CE_WARN, "ufsinit: bad vnode ops template");
2097 return (error);
2098 }
2099
2100 ufs_iinit();
2101 return (0);
|