From fd139fd7d009dbf6f6353b2011b0ff0bf4b32d44 Mon Sep 17 00:00:00 2001 From: phk Date: Thu, 12 Jun 2003 20:48:38 +0000 Subject: Initialize struct vfsops C99-sparsely. Submitted by: hmp Reviewed by: phk --- sys/coda/coda_vfsops.c | 20 ++++--------- sys/coda/coda_vfsops.h | 24 +++++++-------- sys/fs/cd9660/cd9660_vfsops.c | 23 ++++++--------- sys/fs/coda/coda_vfsops.c | 20 ++++--------- sys/fs/coda/coda_vfsops.h | 24 +++++++-------- sys/fs/devfs/devfs_vfsops.c | 19 +++--------- sys/fs/fdescfs/fdesc_vfsops.c | 31 ++++++-------------- sys/fs/hpfs/hpfs_vfsops.c | 44 ++++++++++++---------------- sys/fs/msdosfs/msdosfs_vfsops.c | 23 ++++++--------- sys/fs/ntfs/ntfs_vfsops.c | 43 ++++++++++++--------------- sys/fs/nullfs/null_vfsops.c | 63 +++++++++++++++++----------------------- sys/fs/nwfs/nwfs_vfsops.c | 40 +++++++++++-------------- sys/fs/portalfs/portal_vfsops.c | 29 +++++------------- sys/fs/pseudofs/pseudofs.h | 21 ++++---------- sys/fs/smbfs/smbfs_vfsops.c | 41 +++++++++++--------------- sys/fs/udf/udf_vfsops.c | 41 ++++++++++++-------------- sys/fs/umapfs/umap_vfsops.c | 58 +++++++++++++++--------------------- sys/fs/unionfs/union_vfsops.c | 33 +++++++-------------- sys/gnu/ext2fs/ext2_vfsops.c | 46 ++++++++++++++--------------- sys/gnu/fs/ext2fs/ext2_vfsops.c | 46 ++++++++++++++--------------- sys/isofs/cd9660/cd9660_vfsops.c | 23 ++++++--------- sys/kern/vfs_init.c | 61 ++++++++++++++++++++++++++++++++++++++ sys/nfsclient/nfs_vfsops.c | 21 +++++--------- sys/ufs/ffs/ffs_vfsops.c | 27 +++++++++-------- 24 files changed, 362 insertions(+), 459 deletions(-) (limited to 'sys') diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c index 4c03a6c..3c326bd 100644 --- a/sys/coda/coda_vfsops.c +++ b/sys/coda/coda_vfsops.c @@ -550,20 +550,12 @@ struct mount *devtomp(dev) } struct vfsops coda_vfsops = { - coda_mount, - coda_start, - coda_unmount, - coda_root, - vfs_stdquotactl, - coda_nb_statfs, - coda_sync, - vfs_stdvget, - vfs_stdfhtovp, - vfs_stdcheckexp, - vfs_stdvptofh, - vfs_stdinit, - vfs_stduninit, - vfs_stdextattrctl, + .vfs_mount = coda_mount, + .vfs_root = coda_root, + .vfs_start = coda_start, + .vfs_statfs = coda_nb_statfs, + .vfs_sync = coda_sync, + .vfs_unmount = coda_unmount, }; VFS_SET(coda_vfsops, coda, VFCF_NETWORK); diff --git a/sys/coda/coda_vfsops.h b/sys/coda/coda_vfsops.h index 57b9a5a..fbbcec4 100644 --- a/sys/coda/coda_vfsops.h +++ b/sys/coda/coda_vfsops.h @@ -47,18 +47,18 @@ struct mbuf; struct mount; int coda_vfsopstats_init(void); -int coda_mount(struct mount *, char *, caddr_t, struct nameidata *, - struct thread *); -int coda_start(struct mount *, int, struct thread *); -int coda_unmount(struct mount *, int, struct thread *); -int coda_root(struct mount *, struct vnode **); -int coda_quotactl(struct mount *, int, uid_t, caddr_t, struct thread *); -int coda_nb_statfs(struct mount *, struct statfs *, struct thread *); -int coda_sync(struct mount *, int, struct ucred *, struct thread *); -int coda_vget(struct mount *, ino_t, struct vnode **); int coda_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **, - int *, struct ucred **); -int coda_vptofh(struct vnode *, struct fid *); -int coda_init(struct vfsconf *vfsp); + int *, struct ucred **); + +vfs_mount_t coda_mount; +vfs_start_t coda_start; +vfs_unmount_t coda_unmount; +vfs_root_t coda_root; +vfs_quotactl_t coda_quotactl; +vfs_statfs_t coda_nb_statfs; +vfs_sync_t coda_sync; +vfs_vget_t coda_vget; +vfs_vptofh_t coda_vptofh; +vfs_init_t coda_init; int getNewVnode(struct vnode **vpp); diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index f62298e..c076d08 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -75,20 +75,15 @@ static vfs_fhtovp_t cd9660_fhtovp; static vfs_vptofh_t cd9660_vptofh; static struct vfsops cd9660_vfsops = { - cd9660_mount, - vfs_stdstart, - cd9660_unmount, - cd9660_root, - vfs_stdquotactl, - cd9660_statfs, - vfs_stdnosync, - cd9660_vget, - cd9660_fhtovp, - vfs_stdcheckexp, - cd9660_vptofh, - cd9660_init, - cd9660_uninit, - vfs_stdextattrctl, + .vfs_fhtovp = cd9660_fhtovp, + .vfs_init = cd9660_init, + .vfs_mount = cd9660_mount, + .vfs_root = cd9660_root, + .vfs_statfs = cd9660_statfs, + .vfs_uninit = cd9660_uninit, + .vfs_unmount = cd9660_unmount, + .vfs_vget = cd9660_vget, + .vfs_vptofh = cd9660_vptofh, }; VFS_SET(cd9660_vfsops, cd9660, VFCF_READONLY); MODULE_VERSION(cd9660, 1); diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c index 4c03a6c..3c326bd 100644 --- a/sys/fs/coda/coda_vfsops.c +++ b/sys/fs/coda/coda_vfsops.c @@ -550,20 +550,12 @@ struct mount *devtomp(dev) } struct vfsops coda_vfsops = { - coda_mount, - coda_start, - coda_unmount, - coda_root, - vfs_stdquotactl, - coda_nb_statfs, - coda_sync, - vfs_stdvget, - vfs_stdfhtovp, - vfs_stdcheckexp, - vfs_stdvptofh, - vfs_stdinit, - vfs_stduninit, - vfs_stdextattrctl, + .vfs_mount = coda_mount, + .vfs_root = coda_root, + .vfs_start = coda_start, + .vfs_statfs = coda_nb_statfs, + .vfs_sync = coda_sync, + .vfs_unmount = coda_unmount, }; VFS_SET(coda_vfsops, coda, VFCF_NETWORK); diff --git a/sys/fs/coda/coda_vfsops.h b/sys/fs/coda/coda_vfsops.h index 57b9a5a..fbbcec4 100644 --- a/sys/fs/coda/coda_vfsops.h +++ b/sys/fs/coda/coda_vfsops.h @@ -47,18 +47,18 @@ struct mbuf; struct mount; int coda_vfsopstats_init(void); -int coda_mount(struct mount *, char *, caddr_t, struct nameidata *, - struct thread *); -int coda_start(struct mount *, int, struct thread *); -int coda_unmount(struct mount *, int, struct thread *); -int coda_root(struct mount *, struct vnode **); -int coda_quotactl(struct mount *, int, uid_t, caddr_t, struct thread *); -int coda_nb_statfs(struct mount *, struct statfs *, struct thread *); -int coda_sync(struct mount *, int, struct ucred *, struct thread *); -int coda_vget(struct mount *, ino_t, struct vnode **); int coda_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **, - int *, struct ucred **); -int coda_vptofh(struct vnode *, struct fid *); -int coda_init(struct vfsconf *vfsp); + int *, struct ucred **); + +vfs_mount_t coda_mount; +vfs_start_t coda_start; +vfs_unmount_t coda_unmount; +vfs_root_t coda_root; +vfs_quotactl_t coda_quotactl; +vfs_statfs_t coda_nb_statfs; +vfs_sync_t coda_sync; +vfs_vget_t coda_vget; +vfs_vptofh_t coda_vptofh; +vfs_init_t coda_init; int getNewVnode(struct vnode **vpp); diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c index c1af1cd..a10efa2 100644 --- a/sys/fs/devfs/devfs_vfsops.c +++ b/sys/fs/devfs/devfs_vfsops.c @@ -188,21 +188,10 @@ devfs_statfs(mp, sbp, td) } static struct vfsops devfs_vfsops = { - NULL, - vfs_stdstart, - devfs_unmount, - devfs_root, - vfs_stdquotactl, - devfs_statfs, - vfs_stdnosync, - vfs_stdvget, - vfs_stdfhtovp, - vfs_stdcheckexp, - vfs_stdvptofh, - vfs_stdinit, - vfs_stduninit, - vfs_stdextattrctl, - devfs_nmount, + .vfs_nmount = devfs_nmount, + .vfs_root = devfs_root, + .vfs_statfs = devfs_statfs, + .vfs_unmount = devfs_unmount, }; VFS_SET(devfs_vfsops, devfs, VFCF_SYNTHETIC); diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index fbe73d9..ff9396d 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -58,13 +58,10 @@ static MALLOC_DEFINE(M_FDESCMNT, "FDESC mount", "FDESC mount structure"); -static int fdesc_mount(struct mount *mp, struct nameidata *ndp, - struct thread *td); -static int fdesc_unmount(struct mount *mp, int mntflags, - struct thread *td); -static int fdesc_statfs(struct mount *mp, struct statfs *sbp, - struct thread *td); - +static vfs_nmount_t fdesc_mount; +static vfs_unmount_t fdesc_unmount; +static vfs_statfs_t fdesc_statfs; + /* * Mount the per-process file descriptors (/dev/fd) */ @@ -207,21 +204,11 @@ fdesc_statfs(mp, sbp, td) } static struct vfsops fdesc_vfsops = { - NULL, - vfs_stdstart, - fdesc_unmount, - fdesc_root, - vfs_stdquotactl, - fdesc_statfs, - vfs_stdnosync, - vfs_stdvget, - vfs_stdfhtovp, - vfs_stdcheckexp, - vfs_stdvptofh, - fdesc_init, - vfs_stduninit, - vfs_stdextattrctl, - fdesc_mount, + .vfs_init = fdesc_init, + .vfs_nmount = fdesc_mount, + .vfs_root = fdesc_root, + .vfs_statfs = fdesc_statfs, + .vfs_unmount = fdesc_unmount, }; VFS_SET(fdesc_vfsops, fdescfs, VFCF_SYNTHETIC); diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index 225f340..a838909 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -55,19 +55,18 @@ MALLOC_DEFINE(M_HPFSNO, "HPFS node", "HPFS node structure"); struct sockaddr; -static int hpfs_root(struct mount *, struct vnode **); -static int hpfs_statfs(struct mount *, struct statfs *, struct thread *); -static int hpfs_unmount(struct mount *, int, struct thread *); -static int hpfs_vget(struct mount *mp, ino_t ino, int flags, - struct vnode **vpp); static int hpfs_mountfs(register struct vnode *, struct mount *, struct hpfs_args *, struct thread *); -static int hpfs_vptofh(struct vnode *, struct fid *); -static int hpfs_fhtovp(struct mount *, struct fid *, struct vnode **); -static int hpfs_mount(struct mount *, char *, caddr_t, - struct nameidata *, struct thread *); -static int hpfs_init(struct vfsconf *); -static int hpfs_uninit(struct vfsconf *); + +static vfs_init_t hpfs_init; +static vfs_uninit_t hpfs_uninit; +static vfs_fhtovp_t hpfs_fhtovp; +static vfs_vget_t hpfs_vget; +static vfs_mount_t hpfs_mount; +static vfs_root_t hpfs_root; +static vfs_statfs_t hpfs_statfs; +static vfs_unmount_t hpfs_unmount; +static vfs_vptofh_t hpfs_vptofh; static int hpfs_init ( @@ -571,19 +570,14 @@ hpfs_vget( } static struct vfsops hpfs_vfsops = { - hpfs_mount, - vfs_stdstart, - hpfs_unmount, - hpfs_root, - vfs_stdquotactl, - hpfs_statfs, - vfs_stdnosync, - hpfs_vget, - hpfs_fhtovp, - vfs_stdcheckexp, - hpfs_vptofh, - hpfs_init, - hpfs_uninit, - vfs_stdextattrctl, + .vfs_fhtovp = hpfs_fhtovp, + .vfs_init = hpfs_init, + .vfs_mount = hpfs_mount, + .vfs_root = hpfs_root, + .vfs_statfs = hpfs_statfs, + .vfs_uninit = hpfs_uninit, + .vfs_unmount = hpfs_unmount, + .vfs_vget = hpfs_vget, + .vfs_vptofh = hpfs_vptofh, }; VFS_SET(hpfs_vfsops, hpfs, 0); diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 3c5565e..ac092b8 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -832,20 +832,15 @@ msdosfs_vptofh(vp, fhp) } static struct vfsops msdosfs_vfsops = { - msdosfs_mount, - vfs_stdstart, - msdosfs_unmount, - msdosfs_root, - vfs_stdquotactl, - msdosfs_statfs, - msdosfs_sync, - vfs_stdvget, - msdosfs_fhtovp, - vfs_stdcheckexp, - msdosfs_vptofh, - msdosfs_init, - msdosfs_uninit, - vfs_stdextattrctl, + .vfs_fhtovp = msdosfs_fhtovp, + .vfs_init = msdosfs_init, + .vfs_mount = msdosfs_mount, + .vfs_root = msdosfs_root, + .vfs_statfs = msdosfs_statfs, + .vfs_sync = msdosfs_sync, + .vfs_uninit = msdosfs_uninit, + .vfs_unmount = msdosfs_unmount, + .vfs_vptofh = msdosfs_vptofh, }; VFS_SET(msdosfs_vfsops, msdosfs, 0); diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 2506b28..0f3e60e 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -64,18 +64,18 @@ MALLOC_DEFINE(M_NTFSDIR,"NTFS dir", "NTFS dir buffer"); struct sockaddr; -static int ntfs_root(struct mount *, struct vnode **); -static int ntfs_statfs(struct mount *, struct statfs *, struct thread *); -static int ntfs_unmount(struct mount *, int, struct thread *); -static int ntfs_vget(struct mount *mp, ino_t ino, int lkflags, - struct vnode **vpp); static int ntfs_mountfs(register struct vnode *, struct mount *, struct ntfs_args *, struct thread *); -static int ntfs_vptofh(struct vnode *, struct fid *); -static int ntfs_fhtovp(struct mount *, struct fid *, struct vnode **); -static int ntfs_mount(struct mount *, char *, caddr_t, - struct nameidata *, struct thread *); -static int ntfs_init(struct vfsconf *); + +static vfs_init_t ntfs_init; +static vfs_uninit_t ntfs_uninit; +static vfs_vget_t ntfs_vget; +static vfs_fhtovp_t ntfs_fhtovp; +static vfs_mount_t ntfs_mount; +static vfs_root_t ntfs_root; +static vfs_statfs_t ntfs_statfs; +static vfs_unmount_t ntfs_unmount; +static vfs_vptofh_t ntfs_vptofh; static int ntfs_init ( @@ -775,19 +775,14 @@ ntfs_vget( } static struct vfsops ntfs_vfsops = { - ntfs_mount, - vfs_stdstart, - ntfs_unmount, - ntfs_root, - vfs_stdquotactl, - ntfs_statfs, - vfs_stdnosync, - ntfs_vget, - ntfs_fhtovp, - vfs_stdcheckexp, - ntfs_vptofh, - ntfs_init, - ntfs_uninit, - vfs_stdextattrctl, + .vfs_fhtovp = ntfs_fhtovp, + .vfs_init = ntfs_init, + .vfs_mount = ntfs_mount, + .vfs_root = ntfs_root, + .vfs_statfs = ntfs_statfs, + .vfs_uninit = ntfs_uninit, + .vfs_unmount = ntfs_unmount, + .vfs_vget = ntfs_vget, + .vfs_vptofh = ntfs_vptofh, }; VFS_SET(ntfs_vfsops, ntfs, 0); diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 6ace172..19fed32 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -58,28 +58,18 @@ static MALLOC_DEFINE(M_NULLFSMNT, "NULLFS mount", "NULLFS mount structure"); -static int nullfs_fhtovp(struct mount *mp, struct fid *fidp, - struct vnode **vpp); -static int nullfs_checkexp(struct mount *mp, struct sockaddr *nam, - int *extflagsp, struct ucred **credanonp); -static int nullfs_mount(struct mount *mp, struct nameidata *ndp, - struct thread *td); -static int nullfs_quotactl(struct mount *mp, int cmd, uid_t uid, - caddr_t arg, struct thread *td); -static int nullfs_root(struct mount *mp, struct vnode **vpp); -static int nullfs_start(struct mount *mp, int flags, struct thread *td); -static int nullfs_statfs(struct mount *mp, struct statfs *sbp, - struct thread *td); -static int nullfs_sync(struct mount *mp, int waitfor, - struct ucred *cred, struct thread *td); -static int nullfs_unmount(struct mount *mp, int mntflags, struct thread *td); -static int nullfs_vget(struct mount *mp, ino_t ino, int flags, - struct vnode **vpp); -static int nullfs_vptofh(struct vnode *vp, struct fid *fhp); -static int nullfs_extattrctl(struct mount *mp, int cmd, - struct vnode *filename_vp, - int namespace, const char *attrname, - struct thread *td); +static vfs_fhtovp_t nullfs_fhtovp; +static vfs_checkexp_t nullfs_checkexp; +static vfs_nmount_t nullfs_mount; +static vfs_quotactl_t nullfs_quotactl; +static vfs_root_t nullfs_root; +static vfs_start_t nullfs_start; +static vfs_sync_t nullfs_sync; +static vfs_statfs_t nullfs_statfs; +static vfs_unmount_t nullfs_unmount; +static vfs_vget_t nullfs_vget; +static vfs_vptofh_t nullfs_vptofh; +static vfs_extattrctl_t nullfs_extattrctl; /* * Mount null layer @@ -412,21 +402,20 @@ nullfs_extattrctl(mp, cmd, filename_vp, namespace, attrname, td) static struct vfsops null_vfsops = { - NULL, - nullfs_start, - nullfs_unmount, - nullfs_root, - nullfs_quotactl, - nullfs_statfs, - nullfs_sync, - nullfs_vget, - nullfs_fhtovp, - nullfs_checkexp, - nullfs_vptofh, - nullfs_init, - nullfs_uninit, - nullfs_extattrctl, - nullfs_mount, + .vfs_checkexp = nullfs_checkexp, + .vfs_extattrctl = nullfs_extattrctl, + .vfs_fhtovp = nullfs_fhtovp, + .vfs_init = nullfs_init, + .vfs_nmount = nullfs_mount, + .vfs_quotactl = nullfs_quotactl, + .vfs_root = nullfs_root, + .vfs_start = nullfs_start, + .vfs_statfs = nullfs_statfs, + .vfs_sync = nullfs_sync, + .vfs_uninit = nullfs_uninit, + .vfs_unmount = nullfs_unmount, + .vfs_vget = nullfs_vget, + .vfs_vptofh = nullfs_vptofh, }; VFS_SET(null_vfsops, nullfs, VFCF_LOOPBACK); diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c index 7979410..ee040c9 100644 --- a/sys/fs/nwfs/nwfs_vfsops.c +++ b/sys/fs/nwfs/nwfs_vfsops.c @@ -70,31 +70,25 @@ SYSCTL_INT(_vfs_nwfs, OID_AUTO, debuglevel, CTLFLAG_RW, &nwfs_debuglevel, 0, "") MODULE_DEPEND(nwfs, ncp, 1, 1, 1); MODULE_DEPEND(nwfs, libmchain, 1, 1, 1); -static int nwfs_mount(struct mount *, char *, caddr_t, - struct nameidata *, struct thread *); -static int nwfs_quotactl(struct mount *, int, uid_t, caddr_t, struct thread *); -static int nwfs_root(struct mount *, struct vnode **); -static int nwfs_start(struct mount *, int, struct thread *); -static int nwfs_statfs(struct mount *, struct statfs *, struct thread *); -static int nwfs_unmount(struct mount *, int, struct thread *); -static int nwfs_init(struct vfsconf *vfsp); -static int nwfs_uninit(struct vfsconf *vfsp); +static vfs_mount_t nwfs_mount; +static vfs_quotactl_t nwfs_quotactl; +static vfs_root_t nwfs_root; +static vfs_start_t nwfs_start; +static vfs_statfs_t nwfs_statfs; +static vfs_unmount_t nwfs_unmount; +static vfs_init_t nwfs_init; +static vfs_uninit_t nwfs_uninit; static struct vfsops nwfs_vfsops = { - nwfs_mount, - nwfs_start, - nwfs_unmount, - nwfs_root, - nwfs_quotactl, - nwfs_statfs, - vfs_stdsync, - vfs_stdvget, - vfs_stdfhtovp, /* shouldn't happen */ - vfs_stdcheckexp, - vfs_stdvptofh, /* shouldn't happen */ - nwfs_init, - nwfs_uninit, - vfs_stdextattrctl, + .vfs_init = nwfs_init, + .vfs_mount = nwfs_mount, + .vfs_quotactl = nwfs_quotactl, + .vfs_root = nwfs_root, + .vfs_start = nwfs_start, + .vfs_statfs = nwfs_statfs, + .vfs_sync = vfs_stdsync, + .vfs_uninit = nwfs_uninit, + .vfs_unmount = nwfs_unmount, }; diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c index f731dc0..20f684f 100644 --- a/sys/fs/portalfs/portal_vfsops.c +++ b/sys/fs/portalfs/portal_vfsops.c @@ -62,13 +62,10 @@ static MALLOC_DEFINE(M_PORTALFSMNT, "PORTAL mount", "PORTAL mount structure"); -static int portal_mount(struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct thread *td); -static int portal_unmount(struct mount *mp, int mntflags, - struct thread *td); -static int portal_root(struct mount *mp, struct vnode **vpp); -static int portal_statfs(struct mount *mp, struct statfs *sbp, - struct thread *td); +static vfs_mount_t portal_mount; +static vfs_unmount_t portal_unmount; +static vfs_root_t portal_root; +static vfs_statfs_t portal_statfs; /* * Mount the per-process file descriptors (/dev/fd) @@ -243,20 +240,10 @@ portal_statfs(mp, sbp, td) } static struct vfsops portal_vfsops = { - portal_mount, - vfs_stdstart, - portal_unmount, - portal_root, - vfs_stdquotactl, - portal_statfs, - vfs_stdnosync, - vfs_stdvget, - vfs_stdfhtovp, - vfs_stdcheckexp, - vfs_stdvptofh, - vfs_stdinit, - vfs_stduninit, - vfs_stdextattrctl, + .vfs_mount = portal_mount, + .vfs_root = portal_root, + .vfs_statfs = portal_statfs, + .vfs_unmount = portal_unmount, }; VFS_SET(portal_vfsops, portalfs, VFCF_SYNTHETIC); diff --git a/sys/fs/pseudofs/pseudofs.h b/sys/fs/pseudofs/pseudofs.h index 3c9b34a..021ea3f 100644 --- a/sys/fs/pseudofs/pseudofs.h +++ b/sys/fs/pseudofs/pseudofs.h @@ -250,21 +250,12 @@ _##name##_uninit(struct vfsconf *vfc) { \ } \ \ static struct vfsops name##_vfsops = { \ - NULL, \ - vfs_stdstart, \ - pfs_unmount, \ - pfs_root, \ - vfs_stdquotactl, \ - pfs_statfs, \ - vfs_stdnosync, \ - vfs_stdvget, \ - vfs_stdfhtovp, \ - vfs_stdcheckexp, \ - vfs_stdvptofh, \ - _##name##_init, \ - _##name##_uninit, \ - vfs_stdextattrctl, \ - _##name##_mount, \ + .vfs_init = _##name##_init, \ + .vfs_nmount = _##name##_mount, \ + .vfs_root = pfs_root, \ + .vfs_statfs = pfs_statfs, \ + .vfs_uninit = _##name##_uninit, \ + .vfs_unmount = pfs_unmount, \ }; \ VFS_SET(name##_vfsops, name, VFCF_SYNTHETIC); \ MODULE_VERSION(name, version); \ diff --git a/sys/fs/smbfs/smbfs_vfsops.c b/sys/fs/smbfs/smbfs_vfsops.c index 753efe8..2d8b3ac 100644 --- a/sys/fs/smbfs/smbfs_vfsops.c +++ b/sys/fs/smbfs/smbfs_vfsops.c @@ -76,32 +76,25 @@ SYSCTL_INT(_vfs_smbfs, OID_AUTO, debuglevel, CTLFLAG_RW, &smbfs_debuglevel, 0, " static MALLOC_DEFINE(M_SMBFSHASH, "SMBFS hash", "SMBFS hash table"); - -static int smbfs_mount(struct mount *, char *, caddr_t, - struct nameidata *, struct thread *); -static int smbfs_quotactl(struct mount *, int, uid_t, caddr_t, struct thread *); -static int smbfs_root(struct mount *, struct vnode **); -static int smbfs_start(struct mount *, int, struct thread *); -static int smbfs_statfs(struct mount *, struct statfs *, struct thread *); -static int smbfs_unmount(struct mount *, int, struct thread *); -static int smbfs_init(struct vfsconf *vfsp); -static int smbfs_uninit(struct vfsconf *vfsp); +static vfs_init_t smbfs_init; +static vfs_uninit_t smbfs_uninit; +static vfs_mount_t smbfs_mount; +static vfs_start_t smbfs_start; +static vfs_root_t smbfs_root; +static vfs_quotactl_t smbfs_quotactl; +static vfs_statfs_t smbfs_statfs; +static vfs_unmount_t smbfs_unmount; static struct vfsops smbfs_vfsops = { - smbfs_mount, - smbfs_start, - smbfs_unmount, - smbfs_root, - smbfs_quotactl, - smbfs_statfs, - vfs_stdsync, - vfs_stdvget, - vfs_stdfhtovp, /* shouldn't happen */ - vfs_stdcheckexp, - vfs_stdvptofh, /* shouldn't happen */ - smbfs_init, - smbfs_uninit, - vfs_stdextattrctl + .vfs_init = smbfs_init, + .vfs_mount = smbfs_mount, + .vfs_quotactl = smbfs_quotactl, + .vfs_root = smbfs_root, + .vfs_start = smbfs_start, + .vfs_statfs = smbfs_statfs, + .vfs_sync = vfs_stdsync, + .vfs_uninit = smbfs_uninit, + .vfs_unmount = smbfs_unmount, }; diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c index e047d75..2810bb8 100644 --- a/sys/fs/udf/udf_vfsops.c +++ b/sys/fs/udf/udf_vfsops.c @@ -101,32 +101,27 @@ uma_zone_t udf_zone_trans = NULL; uma_zone_t udf_zone_node = NULL; uma_zone_t udf_zone_ds = NULL; -static int udf_init(struct vfsconf *); -static int udf_uninit(struct vfsconf *); -static int udf_mount(struct mount *, struct nameidata *, struct thread *); -static int udf_unmount(struct mount *, int, struct thread *); -static int udf_root(struct mount *, struct vnode **); -static int udf_statfs(struct mount *, struct statfs *, struct thread *); -static int udf_fhtovp(struct mount *, struct fid *, struct vnode **); -static int udf_vptofh(struct vnode *, struct fid *); +static vfs_init_t udf_init; +static vfs_uninit_t udf_uninit; +static vfs_nmount_t udf_mount; +static vfs_root_t udf_root; +static vfs_statfs_t udf_statfs; +static vfs_unmount_t udf_unmount; +static vfs_fhtovp_t udf_fhtovp; +static vfs_vptofh_t udf_vptofh; + static int udf_find_partmaps(struct udf_mnt *, struct logvol_desc *); static struct vfsops udf_vfsops = { - NULL, - vfs_stdstart, - udf_unmount, - udf_root, - vfs_stdquotactl, - udf_statfs, - vfs_stdnosync, - udf_vget, - udf_fhtovp, - vfs_stdcheckexp, - udf_vptofh, - udf_init, - udf_uninit, - vfs_stdextattrctl, - udf_mount, + .vfs_fhtovp = udf_fhtovp, + .vfs_init = udf_init, + .vfs_nmount = udf_mount, + .vfs_root = udf_root, + .vfs_statfs = udf_statfs, + .vfs_uninit = udf_uninit, + .vfs_unmount = udf_unmount, + .vfs_vget = udf_vget, + .vfs_vptofh = udf_vptofh, }; VFS_SET(udf_vfsops, udf, VFCF_READONLY); diff --git a/sys/fs/umapfs/umap_vfsops.c b/sys/fs/umapfs/umap_vfsops.c index 5fb2d01..e42d590 100644 --- a/sys/fs/umapfs/umap_vfsops.c +++ b/sys/fs/umapfs/umap_vfsops.c @@ -57,27 +57,17 @@ static MALLOC_DEFINE(M_UMAPFSMNT, "UMAP mount", "UMAP mount structure"); -static int umapfs_fhtovp(struct mount *mp, struct fid *fidp, - struct vnode **vpp); -static int umapfs_checkexp(struct mount *mp, struct sockaddr *nam, - int *extflagsp, struct ucred **credanonp); -static int umapfs_mount(struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct thread *td); -static int umapfs_quotactl(struct mount *mp, int cmd, uid_t uid, - caddr_t arg, struct thread *td); -static int umapfs_root(struct mount *mp, struct vnode **vpp); -static int umapfs_start(struct mount *mp, int flags, struct thread *td); -static int umapfs_statfs(struct mount *mp, struct statfs *sbp, - struct thread *td); -static int umapfs_unmount(struct mount *mp, int mntflags, - struct thread *td); -static int umapfs_vget(struct mount *mp, ino_t ino, int flags, - struct vnode **vpp); -static int umapfs_vptofh(struct vnode *vp, struct fid *fhp); -static int umapfs_extattrctl(struct mount *mp, int cmd, - struct vnode *filename_vp, - int namespace, const char *attrname, - struct thread *td); +static vfs_mount_t umapfs_mount; +static vfs_start_t umapfs_start; +static vfs_root_t umapfs_root; +static vfs_quotactl_t umapfs_quotactl; +static vfs_statfs_t umapfs_statfs; +static vfs_unmount_t umapfs_unmount; +static vfs_fhtovp_t umapfs_fhtovp; +static vfs_vptofh_t umapfs_vptofh; +static vfs_checkexp_t umapfs_checkexp; +static vfs_vget_t umapfs_vget; +static vfs_extattrctl_t umapfs_extattrctl; /* * Mount umap layer @@ -439,20 +429,18 @@ umapfs_extattrctl(mp, cmd, filename_vp, namespace, attrname, td) } static struct vfsops umap_vfsops = { - umapfs_mount, - umapfs_start, - umapfs_unmount, - umapfs_root, - umapfs_quotactl, - umapfs_statfs, - vfs_stdnosync, - umapfs_vget, - umapfs_fhtovp, - umapfs_checkexp, - umapfs_vptofh, - umapfs_init, - vfs_stduninit, - umapfs_extattrctl, + .vfs_checkexp = umapfs_checkexp, + .vfs_extattrctl = umapfs_extattrctl, + .vfs_fhtovp = umapfs_fhtovp, + .vfs_init = umapfs_init, + .vfs_mount = umapfs_mount, + .vfs_quotactl = umapfs_quotactl, + .vfs_root = umapfs_root, + .vfs_start = umapfs_start, + .vfs_statfs = umapfs_statfs, + .vfs_unmount = umapfs_unmount, + .vfs_vget = umapfs_vget, + .vfs_vptofh = umapfs_vptofh, }; VFS_SET(umap_vfsops, umapfs, VFCF_LOOPBACK); diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index 0da935e..dae39b5 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -57,14 +57,11 @@ static MALLOC_DEFINE(M_UNIONFSMNT, "UNION mount", "UNION mount structure"); -extern int union_init(struct vfsconf *); -static int union_mount(struct mount *mp, struct nameidata *ndp, - struct thread *td); -static int union_root(struct mount *mp, struct vnode **vpp); -static int union_statfs(struct mount *mp, struct statfs *sbp, - struct thread *td); -static int union_unmount(struct mount *mp, int mntflags, - struct thread *td); +extern vfs_init_t union_init; +static vfs_root_t union_root; +static vfs_nmount_t union_mount; +static vfs_statfs_t union_statfs; +static vfs_unmount_t union_unmount; /* * Mount union filesystem. @@ -496,21 +493,11 @@ union_statfs(mp, sbp, td) } static struct vfsops union_vfsops = { - NULL, - vfs_stdstart, /* underlying start already done */ - union_unmount, - union_root, - vfs_stdquotactl, - union_statfs, - vfs_stdnosync, /* XXX assumes no cached data on union level */ - vfs_stdvget, - vfs_stdfhtovp, - vfs_stdcheckexp, - vfs_stdvptofh, - union_init, - vfs_stduninit, - vfs_stdextattrctl, - union_mount, + .vfs_init = union_init, + .vfs_nmount = union_mount, + .vfs_root = union_root, + .vfs_statfs = union_statfs, + .vfs_unmount = union_unmount, }; VFS_SET(union_vfsops, unionfs, VFCF_LOOPBACK); diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c index 964be9f..dde2d38 100644 --- a/sys/gnu/ext2fs/ext2_vfsops.c +++ b/sys/gnu/ext2fs/ext2_vfsops.c @@ -63,41 +63,37 @@ #include #include -static int ext2_fhtovp(struct mount *, struct fid *, struct vnode **); static int ext2_flushfiles(struct mount *mp, int flags, struct thread *td); -static int ext2_init(struct vfsconf *); -static int ext2_mount(struct mount *, struct nameidata *, struct thread *); static int ext2_mountfs(struct vnode *, struct mount *, struct thread *); static int ext2_reload(struct mount *mountp, struct ucred *cred, struct thread *td); -static int ext2_root(struct mount *, struct vnode **vpp); static int ext2_sbupdate(struct ext2mount *, int); -static int ext2_statfs(struct mount *, struct statfs *, struct thread *); -static int ext2_sync(struct mount *, int, struct ucred *, struct thread *); -static int ext2_uninit(struct vfsconf *); -static int ext2_unmount(struct mount *, int, struct thread *); -static int ext2_vget(struct mount *, ino_t, int, struct vnode **); -static int ext2_vptofh(struct vnode *, struct fid *); + +static vfs_unmount_t ext2_unmount; +static vfs_root_t ext2_root; +static vfs_statfs_t ext2_statfs; +static vfs_sync_t ext2_sync; +static vfs_vget_t ext2_vget; +static vfs_fhtovp_t ext2_fhtovp; +static vfs_vptofh_t ext2_vptofh; +static vfs_init_t ext2_init; +static vfs_uninit_t ext2_uninit; +static vfs_nmount_t ext2_mount; MALLOC_DEFINE(M_EXT2NODE, "EXT2 node", "EXT2 vnode private part"); static MALLOC_DEFINE(M_EXT2MNT, "EXT2 mount", "EXT2 mount structure"); static struct vfsops ext2fs_vfsops = { - NULL, - vfs_stdstart, - ext2_unmount, - ext2_root, /* root inode via vget */ - vfs_stdquotactl, - ext2_statfs, - ext2_sync, - ext2_vget, - ext2_fhtovp, - vfs_stdcheckexp, - ext2_vptofh, - ext2_init, - ext2_uninit, - vfs_stdextattrctl, - ext2_mount, + .vfs_fhtovp = ext2_fhtovp, + .vfs_init = ext2_init, + .vfs_nmount = ext2_mount, + .vfs_root = ext2_root, /* root inode via vget */ + .vfs_statfs = ext2_statfs, + .vfs_sync = ext2_sync, + .vfs_uninit = ext2_uninit, + .vfs_unmount = ext2_unmount, + .vfs_vget = ext2_vget, + .vfs_vptofh = ext2_vptofh, }; VFS_SET(ext2fs_vfsops, ext2fs, 0); diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index 964be9f..dde2d38 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -63,41 +63,37 @@ #include #include -static int ext2_fhtovp(struct mount *, struct fid *, struct vnode **); static int ext2_flushfiles(struct mount *mp, int flags, struct thread *td); -static int ext2_init(struct vfsconf *); -static int ext2_mount(struct mount *, struct nameidata *, struct thread *); static int ext2_mountfs(struct vnode *, struct mount *, struct thread *); static int ext2_reload(struct mount *mountp, struct ucred *cred, struct thread *td); -static int ext2_root(struct mount *, struct vnode **vpp); static int ext2_sbupdate(struct ext2mount *, int); -static int ext2_statfs(struct mount *, struct statfs *, struct thread *); -static int ext2_sync(struct mount *, int, struct ucred *, struct thread *); -static int ext2_uninit(struct vfsconf *); -static int ext2_unmount(struct mount *, int, struct thread *); -static int ext2_vget(struct mount *, ino_t, int, struct vnode **); -static int ext2_vptofh(struct vnode *, struct fid *); + +static vfs_unmount_t ext2_unmount; +static vfs_root_t ext2_root; +static vfs_statfs_t ext2_statfs; +static vfs_sync_t ext2_sync; +static vfs_vget_t ext2_vget; +static vfs_fhtovp_t ext2_fhtovp; +static vfs_vptofh_t ext2_vptofh; +static vfs_init_t ext2_init; +static vfs_uninit_t ext2_uninit; +static vfs_nmount_t ext2_mount; MALLOC_DEFINE(M_EXT2NODE, "EXT2 node", "EXT2 vnode private part"); static MALLOC_DEFINE(M_EXT2MNT, "EXT2 mount", "EXT2 mount structure"); static struct vfsops ext2fs_vfsops = { - NULL, - vfs_stdstart, - ext2_unmount, - ext2_root, /* root inode via vget */ - vfs_stdquotactl, - ext2_statfs, - ext2_sync, - ext2_vget, - ext2_fhtovp, - vfs_stdcheckexp, - ext2_vptofh, - ext2_init, - ext2_uninit, - vfs_stdextattrctl, - ext2_mount, + .vfs_fhtovp = ext2_fhtovp, + .vfs_init = ext2_init, + .vfs_nmount = ext2_mount, + .vfs_root = ext2_root, /* root inode via vget */ + .vfs_statfs = ext2_statfs, + .vfs_sync = ext2_sync, + .vfs_uninit = ext2_uninit, + .vfs_unmount = ext2_unmount, + .vfs_vget = ext2_vget, + .vfs_vptofh = ext2_vptofh, }; VFS_SET(ext2fs_vfsops, ext2fs, 0); diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index f62298e..c076d08 100644 --- a/sys/isofs/cd9660/cd9660_vfsops.c +++ b/sys/isofs/cd9660/cd9660_vfsops.c @@ -75,20 +75,15 @@ static vfs_fhtovp_t cd9660_fhtovp; static vfs_vptofh_t cd9660_vptofh; static struct vfsops cd9660_vfsops = { - cd9660_mount, - vfs_stdstart, - cd9660_unmount, - cd9660_root, - vfs_stdquotactl, - cd9660_statfs, - vfs_stdnosync, - cd9660_vget, - cd9660_fhtovp, - vfs_stdcheckexp, - cd9660_vptofh, - cd9660_init, - cd9660_uninit, - vfs_stdextattrctl, + .vfs_fhtovp = cd9660_fhtovp, + .vfs_init = cd9660_init, + .vfs_mount = cd9660_mount, + .vfs_root = cd9660_root, + .vfs_statfs = cd9660_statfs, + .vfs_uninit = cd9660_uninit, + .vfs_unmount = cd9660_unmount, + .vfs_vget = cd9660_vget, + .vfs_vptofh = cd9660_vptofh, }; VFS_SET(cd9660_vfsops, cd9660, VFCF_READONLY); MODULE_VERSION(cd9660, 1); 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); diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index ec93345..51c7a0e 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -109,20 +109,13 @@ static vfs_sync_t nfs_sync; * nfs vfs operations. */ static struct vfsops nfs_vfsops = { - nfs_mount, - vfs_stdstart, - nfs_unmount, - nfs_root, - vfs_stdquotactl, - nfs_statfs, - nfs_sync, - vfs_stdvget, - vfs_stdfhtovp, /* shouldn't happen */ - vfs_stdcheckexp, - vfs_stdvptofh, /* shouldn't happen */ - nfs_init, - nfs_uninit, - vfs_stdextattrctl, + .vfs_init = nfs_init, + .vfs_mount = nfs_mount, + .vfs_root = nfs_root, + .vfs_statfs = nfs_statfs, + .vfs_sync = nfs_sync, + .vfs_uninit = nfs_uninit, + .vfs_unmount = nfs_unmount, }; VFS_SET(nfs_vfsops, nfs, VFCF_NETWORK); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index b421e62..f74affb 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -83,20 +83,19 @@ static vfs_uninit_t ffs_uninit; static vfs_extattrctl_t ffs_extattrctl; static struct vfsops ufs_vfsops = { - ffs_mount, - ufs_start, - ffs_unmount, - ufs_root, - ufs_quotactl, - ffs_statfs, - ffs_sync, - ffs_vget, - ffs_fhtovp, - vfs_stdcheckexp, - ffs_vptofh, - ffs_init, - ffs_uninit, - ffs_extattrctl, + .vfs_extattrctl = ffs_extattrctl, + .vfs_fhtovp = ffs_fhtovp, + .vfs_init = ffs_init, + .vfs_mount = ffs_mount, + .vfs_quotactl = ufs_quotactl, + .vfs_root = ufs_root, + .vfs_start = ufs_start, + .vfs_statfs = ffs_statfs, + .vfs_sync = ffs_sync, + .vfs_uninit = ffs_uninit, + .vfs_unmount = ffs_unmount, + .vfs_vget = ffs_vget, + .vfs_vptofh = ffs_vptofh, }; VFS_SET(ufs_vfsops, ufs, 0); -- cgit v1.1