37 #include <sys/cdefs.h> 
   40 #include <sys/param.h> 
   41 #include <sys/systm.h> 
   42 #include <sys/fnv_hash.h> 
   43 #include <sys/kernel.h> 
   44 #include <sys/linker.h> 
   45 #include <sys/mount.h> 
   47 #include <sys/syscallsubr.h> 
   48 #include <sys/sysctl.h> 
   49 #include <sys/vnode.h> 
   50 #include <sys/malloc.h> 
   55 MALLOC_DEFINE(M_VNODE, 
"vnodes", 
"Dynamically allocated vnodes");
 
   77     "Set vfc_typenum using a hash calculation on vfc_name, so that it does not" 
   78     "change when file systems are loaded in a different order.");
 
  113         if (!strcmp(name, 
"ffs"))
 
  115         TAILQ_FOREACH(vfsp, &
vfsconf, vfc_list)
 
  116                 if (!strcmp(name, vfsp->vfc_name))
 
  133         loaded = (*error == 0);
 
  134         if (*error == EEXIST)
 
  155         struct sysctl_oid *oidp;
 
  156         struct vfsops *vfsops;
 
  167         if (vfc->vfc_version != VFS_VERSION) {
 
  168                 printf(
"ERROR: filesystem %s, unsupported ABI version %x\n",
 
  169                     vfc->vfc_name, vfc->vfc_version);
 
  182                 hashval = fnv_32_str(vfc->vfc_name, FNV1_32_INIT);
 
  187                         TAILQ_FOREACH(tvfc, &
vfsconf, vfc_list) {
 
  188                                 if (hashval == tvfc->vfc_typenum) {
 
  189                                         if (hashval == 255 && secondpass == 0) {
 
  197                 } 
while (tvfc != NULL);
 
  198                 vfc->vfc_typenum = hashval;
 
  203         TAILQ_INSERT_TAIL(&
vfsconf, vfc, vfc_list);
 
  216         SLIST_FOREACH(oidp, &sysctl__vfs_children, oid_link)
 
  217                 if (strcmp(oidp->oid_name, vfc->vfc_name) == 0) {
 
  219                         oidp->oid_number = vfc->vfc_typenum;
 
  231         KASSERT(vfc->vfc_vfsops != NULL,
 
  232             (
"Filesystem %s has no vfsops", vfc->vfc_name));
 
  236         vfsops = vfc->vfc_vfsops;
 
  237         KASSERT(vfsops->vfs_mount != NULL,
 
  238             (
"Filesystem %s has no mount op", vfc->vfc_name));
 
  239         KASSERT(vfsops->vfs_unmount != NULL,
 
  240             (
"Filesystem %s has no unmount op", vfc->vfc_name));
 
  242         if (vfsops->vfs_root == NULL)
 
  245         if (vfsops->vfs_quotactl == NULL)
 
  248         if (vfsops->vfs_statfs == NULL)
 
  251         if (vfsops->vfs_sync == NULL)
 
  259         if (vfsops->vfs_vget == NULL)
 
  262         if (vfsops->vfs_fhtovp == NULL)
 
  265         if (vfsops->vfs_checkexp == NULL)
 
  268         if (vfsops->vfs_init == NULL)
 
  271         if (vfsops->vfs_uninit == NULL)
 
  274         if (vfsops->vfs_extattrctl == NULL)
 
  277         if (vfsops->vfs_sysctl == NULL)
 
  283         (*(vfc->vfc_vfsops->vfs_init))(vfc);
 
  294         int error, i, maxtypenum;
 
  296         i = vfc->vfc_typenum;
 
  301         if (vfsp->vfc_refcount)
 
  303         if (vfc->vfc_vfsops->vfs_uninit != NULL) {
 
  304                 error = (*vfc->vfc_vfsops->vfs_uninit)(vfsp);
 
  308         TAILQ_REMOVE(&
vfsconf, vfsp, vfc_list);
 
  309         maxtypenum = VFS_GENERIC;
 
  310         TAILQ_FOREACH(vfsp, &
vfsconf, vfc_list)
 
  311                 if (maxtypenum < vfsp->vfc_typenum)
 
  312                         maxtypenum = vfsp->vfc_typenum;
 
SYSCTL_INT(_vfs, OID_AUTO, typenumhash, CTLFLAG_RDTUN,&vfs_typenumhash, 0,"Set vfc_typenum using a hash calculation on vfc_name, so that it does not""change when file systems are loaded in a different order.")
MALLOC_DEFINE(M_VNODE,"vnodes","Dynamically allocated vnodes")
int vfs_stdquotactl(struct mount *mp, int cmds, uid_t uid, void *arg)
void sysctl_register_oid(struct sysctl_oid *oidp)
int vfs_stdroot(struct mount *mp, int flags, struct vnode **vpp)
int vfs_stdvget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
void vattr_null(struct vattr *vap)
static int vfs_unregister(struct vfsconf *)
struct vfsconf * vfs_byname_kld(const char *fstype, struct thread *td, int *error)
int vfs_stdextattrctl(struct mount *mp, int cmd, struct vnode *filename_vp, int attrnamespace, const char *attrname)
struct vfsconfhead vfsconf
int vfs_stdnosync(struct mount *mp, int waitfor)
struct vfsconf * vfs_byname(const char *name)
int vfs_stdinit(struct vfsconf *vfsp)
int vfs_stduninit(struct vfsconf *vfsp)
int vfs_modevent(module_t mod, int type, void *data)
int printf(const char *fmt,...)
int kern_kldload(struct thread *td, const char *file, int *fileid)
int vfs_stdfhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp)
int vfs_stdsysctl(struct mount *mp, fsctlop_t op, struct sysctl_req *req)
void sysctl_unregister_oid(struct sysctl_oid *oidp)
int vfs_stdcheckexp(struct mount *mp, struct sockaddr *nam, int *extflagsp, struct ucred **credanonp, int *numsecflavors, int **secflavors)
TUNABLE_INT("vfs.typenumhash",&vfs_typenumhash)
int vfs_stdstatfs(struct mount *mp, struct statfs *sbp)
int kern_kldunload(struct thread *td, int fileid, int flags)
static int vfs_register(struct vfsconf *)
static int vfs_typenumhash