88 static void sdev_insert_mntinfo(struct sdev_data *);
89 static int devinit(int, char *);
90
91 static vfsdef_t sdev_vfssw = {
92 VFSDEF_VERSION,
93 "dev", /* type name string */
94 devinit, /* init routine */
95 VSW_CANREMOUNT, /* flags */
96 NULL /* mount options table prototype */
97 };
98
99
100 /*
101 * Module linkage information
102 */
103 static struct modlfs modlfs = {
104 &mod_fsops, "/dev filesystem", &sdev_vfssw
105 };
106
107 static struct modlinkage modlinkage = {
108 MODREV_1, (void *)&modlfs, NULL
109 };
110
111 int
112 _init(void)
113 {
114 int e;
115
116 mutex_init(&sdev_lock, NULL, MUTEX_DEFAULT, NULL);
117 sdev_node_cache_init();
118 sdev_devfsadm_lockinit();
119 if ((e = mod_install(&modlinkage)) != 0) {
120 sdev_devfsadm_lockdestroy();
121 sdev_node_cache_fini();
122 mutex_destroy(&sdev_lock);
123 return (e);
124 }
125 return (0);
126 }
127
128 /*
129 * dev module remained loaded for the global /dev instance
130 */
131 int
132 _fini(void)
133 {
134 return (EBUSY);
135 }
136
137 int
138 _info(struct modinfo *modinfop)
139 {
140 return (mod_info(&modlinkage, modinfop));
141 }
142
143 /*ARGSUSED*/
144 static int
145 devinit(int fstype, char *name)
146 {
147 static const fs_operation_def_t dev_vfsops_tbl[] = {
148 VFSNAME_MOUNT, { .vfs_mount = sdev_mount },
149 VFSNAME_UNMOUNT, { .vfs_unmount = sdev_unmount },
150 VFSNAME_ROOT, { .vfs_root = sdev_root },
151 VFSNAME_STATVFS, { .vfs_statvfs = sdev_statvfs },
152 NULL, NULL
153 };
154
155 int error;
156 extern major_t getudev(void);
157
158 devtype = fstype;
159
160 error = vfs_setfsops(fstype, dev_vfsops_tbl, NULL);
161 if (error != 0) {
162 cmn_err(CE_WARN, "devinit: bad vfs ops tbl");
163 return (error);
164 }
165
166 error = vn_make_ops("dev", sdev_vnodeops_tbl, &sdev_vnodeops);
167 if (error != 0) {
168 (void) vfs_freevfsops_by_type(fstype);
169 cmn_err(CE_WARN, "devinit: bad vnode ops tbl");
170 return (error);
171 }
172
|
88 static void sdev_insert_mntinfo(struct sdev_data *);
89 static int devinit(int, char *);
90
91 static vfsdef_t sdev_vfssw = {
92 VFSDEF_VERSION,
93 "dev", /* type name string */
94 devinit, /* init routine */
95 VSW_CANREMOUNT, /* flags */
96 NULL /* mount options table prototype */
97 };
98
99
100 /*
101 * Module linkage information
102 */
103 static struct modlfs modlfs = {
104 &mod_fsops, "/dev filesystem", &sdev_vfssw
105 };
106
107 static struct modlinkage modlinkage = {
108 MODREV_1, { (void *)&modlfs, NULL }
109 };
110
111 int
112 _init(void)
113 {
114 int e;
115
116 mutex_init(&sdev_lock, NULL, MUTEX_DEFAULT, NULL);
117 sdev_node_cache_init();
118 sdev_devfsadm_lockinit();
119 if ((e = mod_install(&modlinkage)) != 0) {
120 sdev_devfsadm_lockdestroy();
121 sdev_node_cache_fini();
122 mutex_destroy(&sdev_lock);
123 return (e);
124 }
125 return (0);
126 }
127
128 /*
129 * dev module remained loaded for the global /dev instance
130 */
131 int
132 _fini(void)
133 {
134 return (EBUSY);
135 }
136
137 int
138 _info(struct modinfo *modinfop)
139 {
140 return (mod_info(&modlinkage, modinfop));
141 }
142
143 /*ARGSUSED*/
144 static int
145 devinit(int fstype, char *name)
146 {
147 static const fs_operation_def_t dev_vfsops_tbl[] = {
148 { VFSNAME_MOUNT, { .vfs_mount = sdev_mount } },
149 { VFSNAME_UNMOUNT, { .vfs_unmount = sdev_unmount } },
150 { VFSNAME_ROOT, { .vfs_root = sdev_root } },
151 { VFSNAME_STATVFS, { .vfs_statvfs = sdev_statvfs } },
152 { NULL, { NULL } }
153 };
154
155 int error;
156 extern major_t getudev(void);
157
158 devtype = fstype;
159
160 error = vfs_setfsops(fstype, dev_vfsops_tbl, NULL);
161 if (error != 0) {
162 cmn_err(CE_WARN, "devinit: bad vfs ops tbl");
163 return (error);
164 }
165
166 error = vn_make_ops("dev", sdev_vnodeops_tbl, &sdev_vnodeops);
167 if (error != 0) {
168 (void) vfs_freevfsops_by_type(fstype);
169 cmn_err(CE_WARN, "devinit: bad vnode ops tbl");
170 return (error);
171 }
172
|