153 static int pcfstype;
154
155 static vfsdef_t vfw = {
156 VFSDEF_VERSION,
157 "pcfs",
158 pcfsinit,
159 VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_CANLOFI,
160 &pcfs_mntopts
161 };
162
163 extern struct mod_ops mod_fsops;
164
165 static struct modlfs modlfs = {
166 &mod_fsops,
167 "PC filesystem",
168 &vfw
169 };
170
171 static struct modlinkage modlinkage = {
172 MODREV_1,
173 &modlfs,
174 NULL
175 };
176
177 int
178 _init(void)
179 {
180 int error;
181
182 #if !defined(lint)
183 /* make sure the on-disk structures are sane */
184 ASSERT(sizeof (struct pcdir) == 32);
185 ASSERT(sizeof (struct pcdir_lfn) == 32);
186 #endif
187 mutex_init(&pcfslock, NULL, MUTEX_DEFAULT, NULL);
188 rw_init(&pcnodes_lock, NULL, RW_DEFAULT, NULL);
189 error = mod_install(&modlinkage);
190 if (error) {
191 mutex_destroy(&pcfslock);
192 rw_destroy(&pcnodes_lock);
193 }
194 return (error);
216 /*
217 * Tear down the operations vectors
218 */
219 (void) vfs_freevfsops_by_type(pcfstype);
220 vn_freevnodeops(pcfs_fvnodeops);
221 vn_freevnodeops(pcfs_dvnodeops);
222 return (0);
223 }
224
225 int
226 _info(struct modinfo *modinfop)
227 {
228 return (mod_info(&modlinkage, modinfop));
229 }
230
231 /* ARGSUSED1 */
232 static int
233 pcfsinit(int fstype, char *name)
234 {
235 static const fs_operation_def_t pcfs_vfsops_template[] = {
236 VFSNAME_MOUNT, { .vfs_mount = pcfs_mount },
237 VFSNAME_UNMOUNT, { .vfs_unmount = pcfs_unmount },
238 VFSNAME_ROOT, { .vfs_root = pcfs_root },
239 VFSNAME_STATVFS, { .vfs_statvfs = pcfs_statvfs },
240 VFSNAME_SYNC, { .vfs_sync = pcfs_sync },
241 VFSNAME_VGET, { .vfs_vget = pcfs_vget },
242 VFSNAME_FREEVFS, { .vfs_freevfs = pcfs_freevfs },
243 NULL, NULL
244 };
245 int error;
246
247 error = vfs_setfsops(fstype, pcfs_vfsops_template, NULL);
248 if (error != 0) {
249 cmn_err(CE_WARN, "pcfsinit: bad vfs ops template");
250 return (error);
251 }
252
253 error = vn_make_ops("pcfs", pcfs_fvnodeops_template, &pcfs_fvnodeops);
254 if (error != 0) {
255 (void) vfs_freevfsops_by_type(fstype);
256 cmn_err(CE_WARN, "pcfsinit: bad file vnode ops template");
257 return (error);
258 }
259
260 error = vn_make_ops("pcfsd", pcfs_dvnodeops_template, &pcfs_dvnodeops);
261 if (error != 0) {
262 (void) vfs_freevfsops_by_type(fstype);
263 vn_freevnodeops(pcfs_fvnodeops);
|
153 static int pcfstype;
154
155 static vfsdef_t vfw = {
156 VFSDEF_VERSION,
157 "pcfs",
158 pcfsinit,
159 VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_CANLOFI,
160 &pcfs_mntopts
161 };
162
163 extern struct mod_ops mod_fsops;
164
165 static struct modlfs modlfs = {
166 &mod_fsops,
167 "PC filesystem",
168 &vfw
169 };
170
171 static struct modlinkage modlinkage = {
172 MODREV_1,
173 { &modlfs, NULL }
174 };
175
176 int
177 _init(void)
178 {
179 int error;
180
181 #if !defined(lint)
182 /* make sure the on-disk structures are sane */
183 ASSERT(sizeof (struct pcdir) == 32);
184 ASSERT(sizeof (struct pcdir_lfn) == 32);
185 #endif
186 mutex_init(&pcfslock, NULL, MUTEX_DEFAULT, NULL);
187 rw_init(&pcnodes_lock, NULL, RW_DEFAULT, NULL);
188 error = mod_install(&modlinkage);
189 if (error) {
190 mutex_destroy(&pcfslock);
191 rw_destroy(&pcnodes_lock);
192 }
193 return (error);
215 /*
216 * Tear down the operations vectors
217 */
218 (void) vfs_freevfsops_by_type(pcfstype);
219 vn_freevnodeops(pcfs_fvnodeops);
220 vn_freevnodeops(pcfs_dvnodeops);
221 return (0);
222 }
223
224 int
225 _info(struct modinfo *modinfop)
226 {
227 return (mod_info(&modlinkage, modinfop));
228 }
229
230 /* ARGSUSED1 */
231 static int
232 pcfsinit(int fstype, char *name)
233 {
234 static const fs_operation_def_t pcfs_vfsops_template[] = {
235 { VFSNAME_MOUNT, { .vfs_mount = pcfs_mount } },
236 { VFSNAME_UNMOUNT, { .vfs_unmount = pcfs_unmount } },
237 { VFSNAME_ROOT, { .vfs_root = pcfs_root } },
238 { VFSNAME_STATVFS, { .vfs_statvfs = pcfs_statvfs } },
239 { VFSNAME_SYNC, { .vfs_sync = pcfs_sync } },
240 { VFSNAME_VGET, { .vfs_vget = pcfs_vget } },
241 { VFSNAME_FREEVFS, { .vfs_freevfs = pcfs_freevfs } },
242 { NULL, { NULL } }
243 };
244 int error;
245
246 error = vfs_setfsops(fstype, pcfs_vfsops_template, NULL);
247 if (error != 0) {
248 cmn_err(CE_WARN, "pcfsinit: bad vfs ops template");
249 return (error);
250 }
251
252 error = vn_make_ops("pcfs", pcfs_fvnodeops_template, &pcfs_fvnodeops);
253 if (error != 0) {
254 (void) vfs_freevfsops_by_type(fstype);
255 cmn_err(CE_WARN, "pcfsinit: bad file vnode ops template");
256 return (error);
257 }
258
259 error = vn_make_ops("pcfsd", pcfs_dvnodeops_template, &pcfs_dvnodeops);
260 if (error != 0) {
261 (void) vfs_freevfsops_by_type(fstype);
262 vn_freevnodeops(pcfs_fvnodeops);
|