Introduce typedefs for the member functions of struct vfsops and employ

these in the main filesystems.  This does not change the resulting code
but makes the source a little bit more grepable.

Sponsored by:	DARPA and NAI Labs.
This commit is contained in:
Poul-Henning Kamp 2002-08-13 10:05:50 +00:00
parent e74101e4ef
commit 9bf1a75697
12 changed files with 93 additions and 95 deletions

View File

@ -64,14 +64,13 @@
MALLOC_DEFINE(M_ISOFSMNT, "ISOFS mount", "ISOFS mount structure");
MALLOC_DEFINE(M_ISOFSNODE, "ISOFS node", "ISOFS vnode private part");
static int cd9660_mount(struct mount *,
char *, caddr_t, struct nameidata *, struct thread *);
static int cd9660_unmount(struct mount *, int, struct thread *);
static int cd9660_root(struct mount *, struct vnode **);
static int cd9660_statfs(struct mount *, struct statfs *, struct thread *);
static int cd9660_vget(struct mount *, ino_t, int, struct vnode **);
static int cd9660_fhtovp(struct mount *, struct fid *, struct vnode **);
static int cd9660_vptofh(struct vnode *, struct fid *);
static vfs_mount_t cd9660_mount;
static vfs_unmount_t cd9660_unmount;
static vfs_root_t cd9660_root;
static vfs_statfs_t cd9660_statfs;
static vfs_vget_t cd9660_vget;
static vfs_fhtovp_t cd9660_fhtovp;
static vfs_vptofh_t cd9660_vptofh;
static struct vfsops cd9660_vfsops = {
cd9660_mount,

View File

@ -52,19 +52,16 @@
MALLOC_DEFINE(M_DEVFS, "DEVFS", "DEVFS data");
static int devfs_mount(struct mount *mp, struct nameidata *ndp,
struct thread *td);
static int devfs_unmount(struct mount *mp, int mntflags,
struct thread *td);
static int devfs_root(struct mount *mp, struct vnode **vpp);
static int devfs_statfs(struct mount *mp, struct statfs *sbp,
struct thread *td);
static vfs_nmount_t devfs_nmount;
static vfs_unmount_t devfs_unmount;
static vfs_root_t devfs_root;
static vfs_statfs_t devfs_statfs;
/*
* Mount the filesystem
*/
static int
devfs_mount(mp, ndp, td)
devfs_nmount(mp, ndp, td)
struct mount *mp;
struct nameidata *ndp;
struct thread *td;
@ -201,7 +198,7 @@ static struct vfsops devfs_vfsops = {
vfs_stdinit,
vfs_stduninit,
vfs_stdextattrctl,
devfs_mount,
devfs_nmount,
};
VFS_SET(devfs_vfsops, devfs, VFCF_SYNTHETIC);

View File

@ -89,16 +89,13 @@ static MALLOC_DEFINE(M_MSDOSFSFAT, "MSDOSFS FAT", "MSDOSFS file allocation table
static int update_mp(struct mount *mp, struct msdosfs_args *argp);
static int mountmsdosfs(struct vnode *devvp, struct mount *mp,
struct thread *td, struct msdosfs_args *argp);
static int msdosfs_fhtovp(struct mount *, struct fid *, struct vnode **);
static int msdosfs_mount(struct mount *, char *, caddr_t,
struct nameidata *, struct thread *);
static int msdosfs_root(struct mount *, struct vnode **);
static int msdosfs_statfs(struct mount *, struct statfs *,
struct thread *);
static int msdosfs_sync(struct mount *, int, struct ucred *,
struct thread *);
static int msdosfs_unmount(struct mount *, int, struct thread *);
static int msdosfs_vptofh(struct vnode *, struct fid *);
static vfs_fhtovp_t msdosfs_fhtovp;
static vfs_mount_t msdosfs_mount;
static vfs_root_t msdosfs_root;
static vfs_statfs_t msdosfs_statfs;
static vfs_sync_t msdosfs_sync;
static vfs_unmount_t msdosfs_unmount;
static vfs_vptofh_t msdosfs_vptofh;
static int
update_mp(mp, argp)

View File

@ -64,14 +64,13 @@
MALLOC_DEFINE(M_ISOFSMNT, "ISOFS mount", "ISOFS mount structure");
MALLOC_DEFINE(M_ISOFSNODE, "ISOFS node", "ISOFS vnode private part");
static int cd9660_mount(struct mount *,
char *, caddr_t, struct nameidata *, struct thread *);
static int cd9660_unmount(struct mount *, int, struct thread *);
static int cd9660_root(struct mount *, struct vnode **);
static int cd9660_statfs(struct mount *, struct statfs *, struct thread *);
static int cd9660_vget(struct mount *, ino_t, int, struct vnode **);
static int cd9660_fhtovp(struct mount *, struct fid *, struct vnode **);
static int cd9660_vptofh(struct vnode *, struct fid *);
static vfs_mount_t cd9660_mount;
static vfs_unmount_t cd9660_unmount;
static vfs_root_t cd9660_root;
static vfs_statfs_t cd9660_statfs;
static vfs_vget_t cd9660_vget;
static vfs_fhtovp_t cd9660_fhtovp;
static vfs_vptofh_t cd9660_vptofh;
static struct vfsops cd9660_vfsops = {
cd9660_mount,

View File

@ -248,8 +248,8 @@ extern int nfs_debug;
#endif
int nfs_init(struct vfsconf *vfsp);
int nfs_uninit(struct vfsconf *vfsp);
vfs_init_t nfs_init;
vfs_uninit_t nfs_uninit;
int nfs_mountroot(struct mount *mp, struct thread *td);
int nfs_send(struct socket *, struct sockaddr *, struct mbuf *,
struct nfsreq *);

View File

@ -94,14 +94,11 @@ static void nfs_decode_args(struct nfsmount *nmp, struct nfs_args *argp);
static int mountnfs(struct nfs_args *, struct mount *,
struct sockaddr *, char *, char *, struct vnode **,
struct ucred *cred);
static int nfs_mount(struct mount *mp, char *path, caddr_t data,
struct nameidata *ndp, struct thread *td);
static int nfs_unmount(struct mount *mp, int mntflags, struct thread *td);
static int nfs_root(struct mount *mp, struct vnode **vpp);
static int nfs_statfs(struct mount *mp, struct statfs *sbp,
struct thread *td);
static int nfs_sync(struct mount *mp, int waitfor, struct ucred *cred,
struct thread *td);
static vfs_mount_t nfs_mount;
static vfs_unmount_t nfs_unmount;
static vfs_root_t nfs_root;
static vfs_statfs_t nfs_statfs;
static vfs_sync_t nfs_sync;
/*
* nfs vfs operations.

View File

@ -376,34 +376,48 @@ struct mbuf;
struct mount_args;
#endif
struct vfsops {
int (*vfs_mount)(struct mount *mp, char *path, caddr_t data,
struct nameidata *ndp, struct thread *td);
int (*vfs_start)(struct mount *mp, int flags, struct thread *td);
int (*vfs_unmount)(struct mount *mp, int mntflags,
struct thread *td);
int (*vfs_root)(struct mount *mp, struct vnode **vpp);
int (*vfs_quotactl)(struct mount *mp, int cmds, uid_t uid,
typedef int vfs_mount_t(struct mount *mp, char *path, caddr_t data,
struct nameidata *ndp, struct thread *td);
typedef int vfs_start_t(struct mount *mp, int flags, struct thread *td);
typedef int vfs_unmount_t(struct mount *mp, int mntflags, struct thread *td);
typedef int vfs_root_t(struct mount *mp, struct vnode **vpp);
typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid,
caddr_t arg, struct thread *td);
int (*vfs_statfs)(struct mount *mp, struct statfs *sbp,
typedef int vfs_statfs_t(struct mount *mp, struct statfs *sbp,
struct thread *td);
int (*vfs_sync)(struct mount *mp, int waitfor, struct ucred *cred,
typedef int vfs_sync_t(struct mount *mp, int waitfor, struct ucred *cred,
struct thread *td);
int (*vfs_vget)(struct mount *mp, ino_t ino, int flags,
typedef int vfs_vget_t(struct mount *mp, ino_t ino, int flags,
struct vnode **vpp);
int (*vfs_fhtovp)(struct mount *mp, struct fid *fhp,
struct vnode **vpp);
int (*vfs_checkexp)(struct mount *mp, struct sockaddr *nam,
typedef int vfs_fhtovp_t(struct mount *mp, struct fid *fhp, struct vnode **vpp);
typedef int vfs_checkexp_t(struct mount *mp, struct sockaddr *nam,
int *extflagsp, struct ucred **credanonp);
int (*vfs_vptofh)(struct vnode *vp, struct fid *fhp);
int (*vfs_init)(struct vfsconf *);
int (*vfs_uninit)(struct vfsconf *);
int (*vfs_extattrctl)(struct mount *mp, int cmd,
typedef int vfs_vptofh_t(struct vnode *vp, struct fid *fhp);
typedef int vfs_init_t(struct vfsconf *);
typedef int vfs_uninit_t(struct vfsconf *);
typedef int vfs_extattrctl_t(struct mount *mp, int cmd,
struct vnode *filename_vp, int attrnamespace,
const char *attrname, struct thread *td);
/* additions below are not binary compatible with 5.0 and below */
int (*vfs_nmount)(struct mount *mp, struct nameidata *ndp,
typedef int vfs_nmount_t(struct mount *mp, struct nameidata *ndp,
struct thread *td);
struct vfsops {
vfs_mount_t *vfs_mount;
vfs_start_t *vfs_start;
vfs_unmount_t *vfs_unmount;
vfs_root_t *vfs_root;
vfs_quotactl_t *vfs_quotactl;
vfs_statfs_t *vfs_statfs;
vfs_sync_t *vfs_sync;
vfs_vget_t *vfs_vget;
vfs_fhtovp_t *vfs_fhtovp;
vfs_checkexp_t *vfs_checkexp;
vfs_vptofh_t *vfs_vptofh;
vfs_init_t *vfs_init;
vfs_uninit_t *vfs_uninit;
vfs_extattrctl_t *vfs_extattrctl;
/* additions below are not binary compatible with 5.0 and below */
vfs_nmount_t *vfs_nmount;
};
#define VFS_NMOUNT(MP, NDP, P) (*(MP)->mnt_op->vfs_nmount)(MP, NDP, P)
@ -485,23 +499,18 @@ extern struct nfs_public nfs_pub;
* kern/vfs_default.c, they should be used instead of making "dummy"
* functions or casting entries in the VFS op table to "enopnotsupp()".
*/
int vfs_stdstart(struct mount *mp, int flags, struct thread *td);
int vfs_stdroot(struct mount *mp, struct vnode **vpp);
int vfs_stdquotactl(struct mount *mp, int cmds, uid_t uid,
caddr_t arg, struct thread *td);
int vfs_stdstatfs(struct mount *mp, struct statfs *sbp, struct thread *td);
int vfs_stdsync(struct mount *mp, int waitfor, struct ucred *cred,
struct thread *td);
int vfs_stdvget(struct mount *mp, ino_t ino, int, struct vnode **vpp);
int vfs_stdfhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp);
int vfs_stdcheckexp(struct mount *mp, struct sockaddr *nam,
int *extflagsp, struct ucred **credanonp);
int vfs_stdvptofh(struct vnode *vp, struct fid *fhp);
int vfs_stdinit(struct vfsconf *);
int vfs_stduninit(struct vfsconf *);
int vfs_stdextattrctl(struct mount *mp, int cmd,
struct vnode *filename_vp, int attrnamespace, const char *attrname,
struct thread *td);
vfs_start_t vfs_stdstart;
vfs_root_t vfs_stdroot;
vfs_quotactl_t vfs_stdquotactl;
vfs_statfs_t vfs_stdstatfs;
vfs_sync_t vfs_stdsync;
vfs_vget_t vfs_stdvget;
vfs_fhtovp_t vfs_stdfhtovp;
vfs_checkexp_t vfs_stdcheckexp;
vfs_vptofh_t vfs_stdvptofh;
vfs_init_t vfs_stdinit;
vfs_uninit_t vfs_stduninit;
vfs_extattrctl_t vfs_stdextattrctl;
/* XXX - these should be indirect functions!!! */
int softdep_process_worklist(struct mount *);

View File

@ -65,7 +65,7 @@ ufs2_daddr_t ffs_blkpref_ufs1(struct inode *, ufs_lbn_t, int, ufs1_daddr_t *);
ufs2_daddr_t ffs_blkpref_ufs2(struct inode *, ufs_lbn_t, int, ufs2_daddr_t *);
void ffs_clrblock(struct fs *, u_char *, ufs1_daddr_t);
void ffs_clusteracct (struct fs *, struct cg *, ufs1_daddr_t, int);
int ffs_fhtovp(struct mount *, struct fid *, struct vnode **);
vfs_fhtovp_t ffs_fhtovp;
int ffs_flushfiles(struct mount *, int, struct thread *);
void ffs_fragacct(struct fs *, int, int32_t [], int);
int ffs_freefile(struct fs *, struct vnode *, ino_t, int );
@ -75,8 +75,7 @@ void ffs_load_inode(struct buf *, struct inode *, struct malloc_type *,
int ffs_mountfs(struct vnode *, struct mount *, struct thread *,
struct malloc_type *);
int ffs_mountroot(void);
int ffs_mount(struct mount *, char *, caddr_t, struct nameidata *,
struct thread *);
vfs_mount_t ffs_mount;
int ffs_reallocblks(struct vop_reallocblks_args *);
int ffs_realloccg(struct inode *, ufs2_daddr_t, ufs2_daddr_t,
ufs2_daddr_t, int, int, struct ucred *, struct buf **);
@ -86,16 +85,16 @@ void ffs_snapremove(struct vnode *vp);
int ffs_snapshot(struct mount *mp, char *snapfile);
void ffs_snapshot_mount(struct mount *mp);
void ffs_snapshot_unmount(struct mount *mp);
int ffs_statfs(struct mount *, struct statfs *, struct thread *);
int ffs_sync(struct mount *, int, struct ucred *, struct thread *);
vfs_statfs_t ffs_statfs;
vfs_sync_t ffs_sync;
int ffs_truncate(struct vnode *, off_t, int, struct ucred *, struct thread *);
int ffs_unmount(struct mount *, int, struct thread *);
vfs_unmount_t ffs_unmount;
int ffs_update(struct vnode *, int);
int ffs_valloc(struct vnode *, int, struct ucred *, struct vnode **);
int ffs_vfree(struct vnode *, ino_t, int);
int ffs_vget(struct mount *, ino_t, int, struct vnode **);
int ffs_vptofh(struct vnode *, struct fid *);
vfs_vget_t ffs_vget;
vfs_vptofh_t ffs_vptofh;
extern vop_t **ffs_vnodeop_p;
extern vop_t **ffs_specop_p;

View File

@ -72,8 +72,8 @@ static int ffs_sbupdate(struct ufsmount *, int);
static void ffs_oldfscompat_read(struct fs *, struct ufsmount *,
ufs2_daddr_t);
static void ffs_oldfscompat_write(struct fs *, struct ufsmount *);
static int ffs_init(struct vfsconf *);
static int ffs_uninit(struct vfsconf *);
static vfs_init_t ffs_init;
static vfs_uninit_t ffs_uninit;
static struct vfsops ufs_vfsops = {
ffs_mount,

View File

@ -190,7 +190,7 @@ int quotaoff(struct thread *td, struct mount *, int);
int quotaon(struct thread *td, struct mount *, int, caddr_t);
int setquota(struct mount *, u_long, int, caddr_t);
int setuse(struct mount *, u_long, int, caddr_t);
int ufs_quotactl(struct mount *, int, uid_t, caddr_t, struct thread *td);
vfs_quotactl_t ufs_quotactl;
#else /* !_KERNEL */

View File

@ -90,8 +90,8 @@ int ufs_lookup(struct vop_cachedlookup_args *);
int ufs_readdir(struct vop_readdir_args *);
int ufs_reclaim(struct vop_reclaim_args *);
void ffs_snapgone(struct inode *);
int ufs_root(struct mount *, struct vnode **);
int ufs_start(struct mount *, int, struct thread *);
vfs_root_t ufs_root;
vfs_start_t ufs_start;
int ufs_uninit(struct vfsconf *);
int ufs_vinit(struct mount *, vop_t **, vop_t **, struct vnode **);

View File

@ -42,6 +42,7 @@
#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/mutex.h>
#include <sys/mount.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>