diff options
author | phk <phk@FreeBSD.org> | 2003-06-12 20:48:38 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-06-12 20:48:38 +0000 |
commit | fd139fd7d009dbf6f6353b2011b0ff0bf4b32d44 (patch) | |
tree | 18550103bc5d68f2255cbfa41b2ed5008e5dd743 /sys/kern | |
parent | c4e22440ca79ff6a8d00e3d6d31f6029efa1cb8e (diff) | |
download | FreeBSD-src-fd139fd7d009dbf6f6353b2011b0ff0bf4b32d44.zip FreeBSD-src-fd139fd7d009dbf6f6353b2011b0ff0bf4b32d44.tar.gz |
Initialize struct vfsops C99-sparsely.
Submitted by: hmp
Reviewed by: phk
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_init.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index 8fceb39..59a9b3e 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -374,6 +374,8 @@ vfs_register(struct vfsconf *vfc) struct sysctl_oid *oidp; struct vfsconf *vfsp; + struct vfsops *vfsops; + vfsp = NULL; if (vfsconf) for (vfsp = vfsconf; vfsp->vfc_next; vfsp = vfsp->vfc_next) @@ -405,6 +407,65 @@ vfs_register(struct vfsconf *vfc) } /* + * Initialise unused ``struct vfsops'' fields, to use + * the vfs_std*() functions. Note, we need the mount + * and unmount operations, at the least. The check + * for vfsops available is just a debugging aid. + */ + KASSERT(vfc->vfc_vfsops != NULL, + ("Filesystem %s has no vfsops", vfc->vfc_name)); + /* + * Check the mount and unmount operations. + */ + vfsops = vfc->vfc_vfsops; + KASSERT(vfsops->vfs_mount != NULL || vfsops->vfs_nmount != NULL, + ("Filesystem %s has no (n)mount op", vfc->vfc_name)); + KASSERT(vfsops->vfs_unmount != NULL, + ("Filesystem %s has no unmount op", vfc->vfc_name)); + + if (vfsops->vfs_start == NULL) + /* make a file system operational */ + vfsops->vfs_start = vfs_stdstart; + if (vfsops->vfs_root == NULL) + /* return file system's root vnode */ + vfsops->vfs_root = vfs_stdroot; + if (vfsops->vfs_quotactl == NULL) + /* quota control */ + vfsops->vfs_quotactl = vfs_stdquotactl; + if (vfsops->vfs_statfs == NULL) + /* return file system's status */ + vfsops->vfs_statfs = vfs_stdstatfs; + if (vfsops->vfs_sync == NULL) + /* + * flush unwritten data (nosync) + * file systems can use vfs_stdsync + * explicitly by setting it in the + * vfsop vector. + */ + vfsops->vfs_sync = vfs_stdnosync; + if (vfsops->vfs_vget == NULL) + /* convert an inode number to a vnode */ + vfsops->vfs_vget = vfs_stdvget; + if (vfsops->vfs_fhtovp == NULL) + /* turn an NFS file handle into a vnode */ + vfsops->vfs_fhtovp = vfs_stdfhtovp; + if (vfsops->vfs_checkexp == NULL) + /* check if file system is exported */ + vfsops->vfs_checkexp = vfs_stdcheckexp; + if (vfsops->vfs_vptofh == NULL) + /* turn a vnode into an NFS file handle */ + vfsops->vfs_vptofh = vfs_stdvptofh; + if (vfsops->vfs_init == NULL) + /* file system specific initialisation */ + vfsops->vfs_init = vfs_stdinit; + if (vfsops->vfs_uninit == NULL) + /* file system specific uninitialisation */ + vfsops->vfs_uninit = vfs_stduninit; + if (vfsops->vfs_extattrctl == NULL) + /* extended attribute control */ + vfsops->vfs_extattrctl = vfs_stdextattrctl; + + /* * Call init function for this VFS... */ (*(vfc->vfc_vfsops->vfs_init))(vfc); |