1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1989, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed 8 * to Berkeley by John Heidemann of the UCLA Ficus project. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. Neither the name of the University nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 */ 34 35 #include <sys/param.h> 36 #include <sys/systm.h> 37 #include <sys/fnv_hash.h> 38 #include <sys/jail.h> 39 #include <sys/kernel.h> 40 #include <sys/linker.h> 41 #include <sys/mount.h> 42 #include <sys/proc.h> 43 #include <sys/sx.h> 44 #include <sys/syscallsubr.h> 45 #include <sys/sysctl.h> 46 #include <sys/vnode.h> 47 #include <sys/malloc.h> 48 49 static int vfs_register(struct vfsconf *); 50 static int vfs_unregister(struct vfsconf *); 51 52 MALLOC_DEFINE(M_VNODE, "vnodes", "Dynamically allocated vnodes"); 53 54 /* 55 * The highest defined VFS number. 56 */ 57 int maxvfsconf = VFS_GENERIC + 1; 58 59 /* 60 * Single-linked list of configured VFSes. 61 * New entries are added/deleted by vfs_register()/vfs_unregister() 62 */ 63 struct vfsconfhead vfsconf = TAILQ_HEAD_INITIALIZER(vfsconf); 64 struct sx vfsconf_sx; 65 SX_SYSINIT(vfsconf, &vfsconf_sx, "vfsconf"); 66 67 /* 68 * Loader.conf variable vfs.typenumhash enables setting vfc_typenum using a hash 69 * calculation on vfc_name, so that it doesn't change when file systems are 70 * loaded in a different order. This will avoid the NFS server file handles from 71 * changing for file systems that use vfc_typenum in their fsid. 72 */ 73 static int vfs_typenumhash = 1; 74 SYSCTL_INT(_vfs, OID_AUTO, typenumhash, CTLFLAG_RDTUN, &vfs_typenumhash, 0, 75 "Set vfc_typenum using a hash calculation on vfc_name, so that it does not" 76 " change when file systems are loaded in a different order."); 77 78 /* 79 * A Zen vnode attribute structure. 80 * 81 * Initialized when the first filesystem registers by vfs_register(). 82 */ 83 struct vattr va_null; 84 85 /* 86 * vfs_init.c 87 * 88 * Allocate and fill in operations vectors. 89 * 90 * An undocumented feature of this approach to defining operations is that 91 * there can be multiple entries in vfs_opv_descs for the same operations 92 * vector. This allows third parties to extend the set of operations 93 * supported by another layer in a binary compatibile way. For example, 94 * assume that NFS needed to be modified to support Ficus. NFS has an entry 95 * (probably nfs_vnopdeop_decls) declaring all the operations NFS supports by 96 * default. Ficus could add another entry (ficus_nfs_vnodeop_decl_entensions) 97 * listing those new operations Ficus adds to NFS, all without modifying the 98 * NFS code. (Of couse, the OTW NFS protocol still needs to be munged, but 99 * that is a(whole)nother story.) This is a feature. 100 */ 101 102 /* 103 * Routines having to do with the management of the vnode table. 104 */ 105 106 void 107 vfs_unref_vfsconf(struct vfsconf *vfsp) 108 { 109 vfsconf_lock(); 110 KASSERT(vfsp->vfc_refcount > 0, 111 ("vfs %p refcount underflow %d", vfsp, vfsp->vfc_refcount)); 112 vfsp->vfc_refcount--; 113 vfsconf_unlock(); 114 } 115 116 static struct vfsconf * 117 vfs_byname_locked(const char *name) 118 { 119 struct vfsconf *vfsp; 120 121 sx_assert(&vfsconf_sx, SA_LOCKED); 122 if (!strcmp(name, "ffs")) 123 name = "ufs"; 124 TAILQ_FOREACH(vfsp, &vfsconf, vfc_list) { 125 if (!strcmp(name, vfsp->vfc_name)) 126 return (vfsp); 127 } 128 return (NULL); 129 } 130 131 struct vfsconf * 132 vfs_byname(const char *name) 133 { 134 struct vfsconf *vfsp; 135 136 vfsconf_lock(); 137 vfsp = vfs_byname_locked(name); 138 if (vfsp != NULL) 139 vfsp->vfc_refcount++; 140 vfsconf_unlock(); 141 return (vfsp); 142 } 143 144 struct vfsconf * 145 vfs_byname_kld(const char *fstype, struct thread *td, int *error) 146 { 147 struct vfsconf *vfsp; 148 int fileid, loaded; 149 150 vfsp = vfs_byname(fstype); 151 if (vfsp != NULL) 152 return (vfsp); 153 154 /* Try to load the respective module. */ 155 *error = kern_kldload(td, fstype, &fileid); 156 loaded = (*error == 0); 157 if (*error == EEXIST) 158 *error = 0; 159 if (*error) { 160 *error = ENODEV; 161 return (NULL); 162 } 163 164 /* Look up again to see if the VFS was loaded. */ 165 vfsp = vfs_byname(fstype); 166 if (vfsp == NULL) { 167 if (loaded) 168 (void)kern_kldunload(td, fileid, LINKER_UNLOAD_FORCE); 169 *error = ENODEV; 170 return (NULL); 171 } 172 return (vfsp); 173 } 174 175 static int 176 vfs_mount_sigdefer(struct mount *mp) 177 { 178 int prev_stops, rc; 179 180 TSRAW(curthread, TS_ENTER, "VFS_MOUNT", mp->mnt_vfc->vfc_name); 181 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 182 rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_mount)(mp); 183 sigallowstop(prev_stops); 184 TSRAW(curthread, TS_EXIT, "VFS_MOUNT", mp->mnt_vfc->vfc_name); 185 return (rc); 186 } 187 188 static int 189 vfs_unmount_sigdefer(struct mount *mp, int mntflags) 190 { 191 int prev_stops, rc; 192 193 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 194 rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_unmount)(mp, mntflags); 195 sigallowstop(prev_stops); 196 return (rc); 197 } 198 199 static int 200 vfs_root_sigdefer(struct mount *mp, int flags, struct vnode **vpp) 201 { 202 int prev_stops, rc; 203 204 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 205 rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_root)(mp, flags, vpp); 206 sigallowstop(prev_stops); 207 return (rc); 208 } 209 210 static int 211 vfs_cachedroot_sigdefer(struct mount *mp, int flags, struct vnode **vpp) 212 { 213 int prev_stops, rc; 214 215 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 216 rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_cachedroot)(mp, flags, vpp); 217 sigallowstop(prev_stops); 218 return (rc); 219 } 220 221 static int 222 vfs_quotactl_sigdefer(struct mount *mp, int cmd, uid_t uid, void *arg, 223 bool *mp_busy) 224 { 225 int prev_stops, rc; 226 227 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 228 rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_quotactl)(mp, cmd, uid, arg, 229 mp_busy); 230 sigallowstop(prev_stops); 231 return (rc); 232 } 233 234 static int 235 vfs_statfs_sigdefer(struct mount *mp, struct statfs *sbp) 236 { 237 int prev_stops, rc; 238 239 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 240 rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_statfs)(mp, sbp); 241 sigallowstop(prev_stops); 242 return (rc); 243 } 244 245 static int 246 vfs_sync_sigdefer(struct mount *mp, int waitfor) 247 { 248 int prev_stops, rc; 249 250 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 251 rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_sync)(mp, waitfor); 252 sigallowstop(prev_stops); 253 return (rc); 254 } 255 256 static int 257 vfs_vget_sigdefer(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) 258 { 259 int prev_stops, rc; 260 261 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 262 rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_vget)(mp, ino, flags, vpp); 263 sigallowstop(prev_stops); 264 return (rc); 265 } 266 267 static int 268 vfs_fhtovp_sigdefer(struct mount *mp, struct fid *fidp, int flags, 269 struct vnode **vpp) 270 { 271 int prev_stops, rc; 272 273 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 274 rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_fhtovp)(mp, fidp, flags, vpp); 275 sigallowstop(prev_stops); 276 return (rc); 277 } 278 279 static int 280 vfs_checkexp_sigdefer(struct mount *mp, struct sockaddr *nam, uint64_t *exflg, 281 struct ucred **credp, int *numsecflavors, int *secflavors) 282 { 283 int prev_stops, rc; 284 285 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 286 rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_checkexp)(mp, nam, exflg, credp, 287 numsecflavors, secflavors); 288 sigallowstop(prev_stops); 289 return (rc); 290 } 291 292 static int 293 vfs_extattrctl_sigdefer(struct mount *mp, int cmd, struct vnode *filename_vp, 294 int attrnamespace, const char *attrname) 295 { 296 int prev_stops, rc; 297 298 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 299 rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_extattrctl)(mp, cmd, 300 filename_vp, attrnamespace, attrname); 301 sigallowstop(prev_stops); 302 return (rc); 303 } 304 305 static int 306 vfs_sysctl_sigdefer(struct mount *mp, fsctlop_t op, struct sysctl_req *req) 307 { 308 int prev_stops, rc; 309 310 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 311 rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_sysctl)(mp, op, req); 312 sigallowstop(prev_stops); 313 return (rc); 314 } 315 316 static void 317 vfs_susp_clean_sigdefer(struct mount *mp) 318 { 319 int prev_stops; 320 321 if (*mp->mnt_vfc->vfc_vfsops_sd->vfs_susp_clean == NULL) 322 return; 323 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 324 (*mp->mnt_vfc->vfc_vfsops_sd->vfs_susp_clean)(mp); 325 sigallowstop(prev_stops); 326 } 327 328 static void 329 vfs_reclaim_lowervp_sigdefer(struct mount *mp, struct vnode *vp) 330 { 331 int prev_stops; 332 333 if (*mp->mnt_vfc->vfc_vfsops_sd->vfs_reclaim_lowervp == NULL) 334 return; 335 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 336 (*mp->mnt_vfc->vfc_vfsops_sd->vfs_reclaim_lowervp)(mp, vp); 337 sigallowstop(prev_stops); 338 } 339 340 static void 341 vfs_unlink_lowervp_sigdefer(struct mount *mp, struct vnode *vp) 342 { 343 int prev_stops; 344 345 if (*mp->mnt_vfc->vfc_vfsops_sd->vfs_unlink_lowervp == NULL) 346 return; 347 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 348 (*(mp)->mnt_vfc->vfc_vfsops_sd->vfs_unlink_lowervp)(mp, vp); 349 sigallowstop(prev_stops); 350 } 351 352 static void 353 vfs_purge_sigdefer(struct mount *mp) 354 { 355 int prev_stops; 356 357 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 358 (*mp->mnt_vfc->vfc_vfsops_sd->vfs_purge)(mp); 359 sigallowstop(prev_stops); 360 } 361 362 static int 363 vfs_report_lockf_sigdefer(struct mount *mp, struct sbuf *sb) 364 { 365 int prev_stops, rc; 366 367 prev_stops = sigdeferstop(SIGDEFERSTOP_SILENT); 368 rc = (*mp->mnt_vfc->vfc_vfsops_sd->vfs_report_lockf)(mp, sb); 369 sigallowstop(prev_stops); 370 return (rc); 371 } 372 373 static struct vfsops vfsops_sigdefer = { 374 .vfs_mount = vfs_mount_sigdefer, 375 .vfs_unmount = vfs_unmount_sigdefer, 376 .vfs_root = vfs_root_sigdefer, 377 .vfs_cachedroot = vfs_cachedroot_sigdefer, 378 .vfs_quotactl = vfs_quotactl_sigdefer, 379 .vfs_statfs = vfs_statfs_sigdefer, 380 .vfs_sync = vfs_sync_sigdefer, 381 .vfs_vget = vfs_vget_sigdefer, 382 .vfs_fhtovp = vfs_fhtovp_sigdefer, 383 .vfs_checkexp = vfs_checkexp_sigdefer, 384 .vfs_extattrctl = vfs_extattrctl_sigdefer, 385 .vfs_sysctl = vfs_sysctl_sigdefer, 386 .vfs_susp_clean = vfs_susp_clean_sigdefer, 387 .vfs_reclaim_lowervp = vfs_reclaim_lowervp_sigdefer, 388 .vfs_unlink_lowervp = vfs_unlink_lowervp_sigdefer, 389 .vfs_purge = vfs_purge_sigdefer, 390 .vfs_report_lockf = vfs_report_lockf_sigdefer, 391 }; 392 393 /* Register a new filesystem type in the global table */ 394 static int 395 vfs_register(struct vfsconf *vfc) 396 { 397 struct sysctl_oid *oidp; 398 struct vfsops *vfsops; 399 static int once; 400 struct vfsconf *tvfc; 401 uint32_t hashval; 402 int error, prevmaxconf, secondpass; 403 404 if (!once) { 405 vattr_null(&va_null); 406 once = 1; 407 } 408 409 if (vfc->vfc_version != VFS_VERSION) { 410 printf("ERROR: filesystem %s, unsupported ABI version %x\n", 411 vfc->vfc_name, vfc->vfc_version); 412 return (EINVAL); 413 } 414 vfsconf_lock(); 415 if (vfs_byname_locked(vfc->vfc_name) != NULL) { 416 vfsconf_unlock(); 417 return (EEXIST); 418 } 419 420 prevmaxconf = maxvfsconf; 421 if (vfs_typenumhash != 0) { 422 /* 423 * Calculate a hash on vfc_name to use for vfc_typenum. Unless 424 * all of 1<->255 are assigned, it is limited to 8bits since 425 * that is what ZFS uses from vfc_typenum and is also the 426 * preferred range for vfs_getnewfsid(). 427 */ 428 hashval = fnv_32_str(vfc->vfc_name, FNV1_32_INIT); 429 hashval &= 0xff; 430 if (hashval == 0) 431 hashval = 1; 432 secondpass = 0; 433 do { 434 /* Look for and fix any collision. */ 435 TAILQ_FOREACH(tvfc, &vfsconf, vfc_list) { 436 if (hashval == tvfc->vfc_typenum) { 437 if (hashval == 255 && secondpass == 0) { 438 hashval = 1; 439 secondpass = 1; 440 } else 441 hashval++; 442 break; 443 } 444 } 445 } while (tvfc != NULL); 446 vfc->vfc_typenum = hashval; 447 if (vfc->vfc_typenum >= maxvfsconf) 448 maxvfsconf = vfc->vfc_typenum + 1; 449 } else 450 vfc->vfc_typenum = maxvfsconf++; 451 TAILQ_INSERT_TAIL(&vfsconf, vfc, vfc_list); 452 453 /* 454 * Initialise unused ``struct vfsops'' fields, to use 455 * the vfs_std*() functions. Note, we need the mount 456 * and unmount operations, at the least. The check 457 * for vfsops available is just a debugging aid. 458 */ 459 KASSERT(vfc->vfc_vfsops != NULL, 460 ("Filesystem %s has no vfsops", vfc->vfc_name)); 461 /* 462 * Check the mount and unmount operations. 463 */ 464 vfsops = vfc->vfc_vfsops; 465 KASSERT(vfsops->vfs_mount != NULL, 466 ("Filesystem %s has no mount op", vfc->vfc_name)); 467 KASSERT(vfsops->vfs_unmount != NULL, 468 ("Filesystem %s has no unmount op", vfc->vfc_name)); 469 470 if (vfsops->vfs_root == NULL) 471 /* return file system's root vnode */ 472 vfsops->vfs_root = vfs_stdroot; 473 if (vfsops->vfs_quotactl == NULL) 474 /* quota control */ 475 vfsops->vfs_quotactl = vfs_stdquotactl; 476 if (vfsops->vfs_statfs == NULL) 477 /* return file system's status */ 478 vfsops->vfs_statfs = vfs_stdstatfs; 479 if (vfsops->vfs_sync == NULL) 480 /* 481 * flush unwritten data (nosync) 482 * file systems can use vfs_stdsync 483 * explicitly by setting it in the 484 * vfsop vector. 485 */ 486 vfsops->vfs_sync = vfs_stdnosync; 487 if (vfsops->vfs_vget == NULL) 488 /* convert an inode number to a vnode */ 489 vfsops->vfs_vget = vfs_stdvget; 490 if (vfsops->vfs_fhtovp == NULL) 491 /* turn an NFS file handle into a vnode */ 492 vfsops->vfs_fhtovp = vfs_stdfhtovp; 493 if (vfsops->vfs_checkexp == NULL) 494 /* check if file system is exported */ 495 vfsops->vfs_checkexp = vfs_stdcheckexp; 496 if (vfsops->vfs_init == NULL) 497 /* file system specific initialisation */ 498 vfsops->vfs_init = vfs_stdinit; 499 if (vfsops->vfs_uninit == NULL) 500 /* file system specific uninitialisation */ 501 vfsops->vfs_uninit = vfs_stduninit; 502 if (vfsops->vfs_extattrctl == NULL) 503 /* extended attribute control */ 504 vfsops->vfs_extattrctl = vfs_stdextattrctl; 505 if (vfsops->vfs_sysctl == NULL) 506 vfsops->vfs_sysctl = vfs_stdsysctl; 507 if (vfsops->vfs_report_lockf == NULL) 508 vfsops->vfs_report_lockf = vfs_report_lockf; 509 510 if ((vfc->vfc_flags & VFCF_SBDRY) != 0) { 511 vfc->vfc_vfsops_sd = vfc->vfc_vfsops; 512 vfc->vfc_vfsops = &vfsops_sigdefer; 513 } 514 515 /* 516 * Call init function for this VFS... 517 */ 518 if ((vfc->vfc_flags & VFCF_SBDRY) != 0) 519 error = vfc->vfc_vfsops_sd->vfs_init(vfc); 520 else 521 error = vfc->vfc_vfsops->vfs_init(vfc); 522 523 if (error != 0) { 524 maxvfsconf = prevmaxconf; 525 TAILQ_REMOVE(&vfsconf, vfc, vfc_list); 526 vfsconf_unlock(); 527 return (error); 528 } 529 530 if ((vfc->vfc_flags & VFCF_JAIL) != 0) 531 prison_add_vfs(vfc); 532 533 vfsconf_unlock(); 534 535 /* 536 * If this filesystem has a sysctl node under vfs 537 * (i.e. vfs.xxfs), then change the oid number of that node to 538 * match the filesystem's type number. This allows user code 539 * which uses the type number to read sysctl variables defined 540 * by the filesystem to continue working. Since the oids are 541 * in a sorted list, we need to make sure the order is 542 * preserved by re-registering the oid after modifying its 543 * number. 544 */ 545 sysctl_wlock(); 546 RB_FOREACH(oidp, sysctl_oid_list, SYSCTL_CHILDREN(&sysctl___vfs)) { 547 if (strcmp(oidp->oid_name, vfc->vfc_name) == 0) { 548 sysctl_unregister_oid(oidp); 549 oidp->oid_number = vfc->vfc_typenum; 550 sysctl_register_oid(oidp); 551 break; 552 } 553 } 554 sysctl_wunlock(); 555 556 return (0); 557 } 558 559 /* Remove registration of a filesystem type */ 560 static int 561 vfs_unregister(struct vfsconf *vfc) 562 { 563 struct vfsconf *vfsp; 564 int error, maxtypenum; 565 566 vfsconf_lock(); 567 vfsp = vfs_byname_locked(vfc->vfc_name); 568 if (vfsp == NULL) { 569 vfsconf_unlock(); 570 return (EINVAL); 571 } 572 if (vfsp->vfc_refcount != 0) { 573 vfsconf_unlock(); 574 return (EBUSY); 575 } 576 error = 0; 577 if ((vfc->vfc_flags & VFCF_SBDRY) != 0) { 578 if (vfc->vfc_vfsops_sd->vfs_uninit != NULL) 579 error = vfc->vfc_vfsops_sd->vfs_uninit(vfsp); 580 } else { 581 if (vfc->vfc_vfsops->vfs_uninit != NULL) 582 error = vfc->vfc_vfsops->vfs_uninit(vfsp); 583 } 584 if (error != 0) { 585 vfsconf_unlock(); 586 return (error); 587 } 588 TAILQ_REMOVE(&vfsconf, vfsp, vfc_list); 589 maxtypenum = VFS_GENERIC; 590 TAILQ_FOREACH(vfsp, &vfsconf, vfc_list) 591 if (maxtypenum < vfsp->vfc_typenum) 592 maxtypenum = vfsp->vfc_typenum; 593 maxvfsconf = maxtypenum + 1; 594 vfsconf_unlock(); 595 return (0); 596 } 597 598 /* 599 * Standard kernel module handling code for filesystem modules. 600 * Referenced from VFS_SET(). 601 */ 602 int 603 vfs_modevent(module_t mod, int type, void *data) 604 { 605 struct vfsconf *vfc; 606 int error = 0; 607 608 vfc = (struct vfsconf *)data; 609 610 switch (type) { 611 case MOD_LOAD: 612 if (vfc) 613 error = vfs_register(vfc); 614 break; 615 616 case MOD_UNLOAD: 617 if (vfc) 618 error = vfs_unregister(vfc); 619 break; 620 default: 621 error = EOPNOTSUPP; 622 break; 623 } 624 return (error); 625 } 626