82 { MNTOPT_LOFS_SUB, sub_cancel, NULL, 0,
83 (void *)0 },
84 { MNTOPT_LOFS_NOSUB, nosub_cancel, NULL, 0,
85 (void *)0 },
86 };
87
88 static mntopts_t lofs_mntopts = {
89 sizeof (mntopts) / sizeof (mntopt_t),
90 mntopts
91 };
92
93 /*
94 * Module linkage information for the kernel.
95 */
96
97 static struct modlfs modlfs = {
98 &mod_fsops, "filesystem for lofs", &vfw
99 };
100
101 static struct modlinkage modlinkage = {
102 MODREV_1, (void *)&modlfs, NULL
103 };
104
105 /*
106 * This is the module initialization routine.
107 */
108
109 int
110 _init(void)
111 {
112 int status;
113
114 lofs_subrinit();
115 status = mod_install(&modlinkage);
116 if (status != 0) {
117 /*
118 * Cleanup previously initialized work.
119 */
120 lofs_subrfini();
121 }
122
535 else
536 return (EIO);
537 }
538
539 /*
540 * Free mount-specific data.
541 */
542 static void
543 lo_freevfs(struct vfs *vfsp)
544 {
545 struct loinfo *li = vtoli(vfsp);
546
547 ldestroy(li);
548 kmem_free(li, sizeof (struct loinfo));
549 }
550
551 static int
552 lofsinit(int fstyp, char *name)
553 {
554 static const fs_operation_def_t lo_vfsops_template[] = {
555 VFSNAME_MOUNT, { .vfs_mount = lo_mount },
556 VFSNAME_UNMOUNT, { .vfs_unmount = lo_unmount },
557 VFSNAME_ROOT, { .vfs_root = lo_root },
558 VFSNAME_STATVFS, { .vfs_statvfs = lo_statvfs },
559 VFSNAME_SYNC, { .vfs_sync = lo_sync },
560 VFSNAME_VGET, { .vfs_vget = lo_vget },
561 VFSNAME_FREEVFS, { .vfs_freevfs = lo_freevfs },
562 NULL, NULL
563 };
564 int error;
565
566 error = vfs_setfsops(fstyp, lo_vfsops_template, &lo_vfsops);
567 if (error != 0) {
568 cmn_err(CE_WARN, "lofsinit: bad vfs ops template");
569 return (error);
570 }
571
572 error = vn_make_ops(name, lo_vnodeops_template, &lo_vnodeops);
573 if (error != 0) {
574 (void) vfs_freevfsops_by_type(fstyp);
575 cmn_err(CE_WARN, "lofsinit: bad vnode ops template");
576 return (error);
577 }
578
579 lofsfstype = fstyp;
580
581 return (0);
582 }
|
82 { MNTOPT_LOFS_SUB, sub_cancel, NULL, 0,
83 (void *)0 },
84 { MNTOPT_LOFS_NOSUB, nosub_cancel, NULL, 0,
85 (void *)0 },
86 };
87
88 static mntopts_t lofs_mntopts = {
89 sizeof (mntopts) / sizeof (mntopt_t),
90 mntopts
91 };
92
93 /*
94 * Module linkage information for the kernel.
95 */
96
97 static struct modlfs modlfs = {
98 &mod_fsops, "filesystem for lofs", &vfw
99 };
100
101 static struct modlinkage modlinkage = {
102 MODREV_1, { (void *)&modlfs, NULL }
103 };
104
105 /*
106 * This is the module initialization routine.
107 */
108
109 int
110 _init(void)
111 {
112 int status;
113
114 lofs_subrinit();
115 status = mod_install(&modlinkage);
116 if (status != 0) {
117 /*
118 * Cleanup previously initialized work.
119 */
120 lofs_subrfini();
121 }
122
535 else
536 return (EIO);
537 }
538
539 /*
540 * Free mount-specific data.
541 */
542 static void
543 lo_freevfs(struct vfs *vfsp)
544 {
545 struct loinfo *li = vtoli(vfsp);
546
547 ldestroy(li);
548 kmem_free(li, sizeof (struct loinfo));
549 }
550
551 static int
552 lofsinit(int fstyp, char *name)
553 {
554 static const fs_operation_def_t lo_vfsops_template[] = {
555 { VFSNAME_MOUNT, { .vfs_mount = lo_mount } },
556 { VFSNAME_UNMOUNT, { .vfs_unmount = lo_unmount } },
557 { VFSNAME_ROOT, { .vfs_root = lo_root } },
558 { VFSNAME_STATVFS, { .vfs_statvfs = lo_statvfs } },
559 { VFSNAME_SYNC, { .vfs_sync = lo_sync } },
560 { VFSNAME_VGET, { .vfs_vget = lo_vget } },
561 { VFSNAME_FREEVFS, { .vfs_freevfs = lo_freevfs } },
562 { NULL, { NULL } }
563 };
564 int error;
565
566 error = vfs_setfsops(fstyp, lo_vfsops_template, &lo_vfsops);
567 if (error != 0) {
568 cmn_err(CE_WARN, "lofsinit: bad vfs ops template");
569 return (error);
570 }
571
572 error = vn_make_ops(name, lo_vnodeops_template, &lo_vnodeops);
573 if (error != 0) {
574 (void) vfs_freevfsops_by_type(fstyp);
575 cmn_err(CE_WARN, "lofsinit: bad vnode ops template");
576 return (error);
577 }
578
579 lofsfstype = fstyp;
580
581 return (0);
582 }
|