diff options
author | alfred <alfred@FreeBSD.org> | 1999-09-07 22:42:38 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 1999-09-07 22:42:38 +0000 |
commit | e16a3900a7835b58a16e19a58511db912f1081f8 (patch) | |
tree | f6801d0b7edc902d94f170cf5d4a357c90e1fdb6 /sys/miscfs | |
parent | 16f9b4552c757be79df4ea6fa44b8be88902894b (diff) | |
download | FreeBSD-src-e16a3900a7835b58a16e19a58511db912f1081f8.zip FreeBSD-src-e16a3900a7835b58a16e19a58511db912f1081f8.tar.gz |
All unimplemented VFS ops now have entries in kern/vfs_default.c that return
reasonable defaults.
This avoids confusing and ugly casting to eopnotsupp or making dummy functions.
Bogus casting of filesystem sysctls to eopnotsupp() have been removed.
This should make *_vfsops.c more readable and reduce bloat.
Reviewed by: msmith, eivind
Approved by: phk
Tested by: Jeroen Ruigrok/Asmodai <asmodai@wxs.nl>
Diffstat (limited to 'sys/miscfs')
-rw-r--r-- | sys/miscfs/devfs/devfs_vfsops.c | 53 | ||||
-rw-r--r-- | sys/miscfs/fdesc/fdesc_vfsops.c | 45 | ||||
-rw-r--r-- | sys/miscfs/kernfs/kernfs.h | 11 | ||||
-rw-r--r-- | sys/miscfs/kernfs/kernfs_vfsops.c | 35 | ||||
-rw-r--r-- | sys/miscfs/portal/portal_vfsops.c | 46 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_vfsops.c | 47 | ||||
-rw-r--r-- | sys/miscfs/union/union_vfsops.c | 55 |
7 files changed, 39 insertions, 253 deletions
diff --git a/sys/miscfs/devfs/devfs_vfsops.c b/sys/miscfs/devfs/devfs_vfsops.c index dbc2f31..b6be038 100644 --- a/sys/miscfs/devfs/devfs_vfsops.c +++ b/sys/miscfs/devfs/devfs_vfsops.c @@ -160,13 +160,6 @@ DBPRINT(("mount ")); } -static int -devfs_start(struct mount *mp, int flags, struct proc *p) -{ -DBPRINT(("start ")); - return 0; -} - /*- * Unmount the filesystem described by mp. */ @@ -205,14 +198,6 @@ DBPRINT(("root ")); } static int -devfs_quotactl(struct mount *mp, int cmds, uid_t uid, caddr_t arg, - struct proc *p) -{ -DBPRINT(("quotactl ")); - return EOPNOTSUPP; -} - -static int devfs_statfs( struct mount *mp, struct statfs *sbp, struct proc *p) { struct devfsmount *devfs_mp_p = (struct devfsmount *)mp->mnt_data; @@ -308,45 +293,17 @@ loop: return (allerror); } -static int -devfs_vget(struct mount *mp, ino_t ino,struct vnode **vpp) -{ -DBPRINT(("vget ")); - return EOPNOTSUPP; -} - -/************************************************************* - * The concept of exporting a kernel generated devfs is stupid - * So don't handle filehandles - */ - -static int -devfs_fhtovp (struct mount *mp, struct fid *fhp, struct sockaddr *nam, - struct vnode **vpp, int *exflagsp, struct ucred **credanonp) -{ -DBPRINT(("fhtovp ")); - return (EINVAL); -} - - -static int -devfs_vptofh (struct vnode *vp, struct fid *fhp) -{ -DBPRINT(("vptofh ")); - return (EINVAL); -} - static struct vfsops devfs_vfsops = { devfs_mount, - devfs_start, + vfs_stdstart, devfs_unmount, devfs_root, - devfs_quotactl, + vfs_stdquotactl, devfs_statfs, devfs_sync, - devfs_vget, - devfs_fhtovp, - devfs_vptofh, + vfs_stdvget, + vfs_stdfhtovp, + vfs_stdvptofh, devfs_init }; diff --git a/sys/miscfs/fdesc/fdesc_vfsops.c b/sys/miscfs/fdesc/fdesc_vfsops.c index 157454c..97231a4 100644 --- a/sys/miscfs/fdesc/fdesc_vfsops.c +++ b/sys/miscfs/fdesc/fdesc_vfsops.c @@ -57,13 +57,10 @@ static MALLOC_DEFINE(M_FDESCMNT, "FDESC mount", "FDESC mount structure"); static int fdesc_mount __P((struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, struct proc *p)); -static int fdesc_start __P((struct mount *mp, int flags, struct proc *p)); static int fdesc_unmount __P((struct mount *mp, int mntflags, struct proc *p)); static int fdesc_statfs __P((struct mount *mp, struct statfs *sbp, struct proc *p)); -static int fdesc_sync __P((struct mount *mp, int waitfor, - struct ucred *cred, struct proc *p)); /* * Mount the per-process file descriptors (/dev/fd) @@ -110,15 +107,6 @@ fdesc_mount(mp, path, data, ndp, p) } static int -fdesc_start(mp, flags, p) - struct mount *mp; - int flags; - struct proc *p; -{ - return (0); -} - -static int fdesc_unmount(mp, mntflags, p) struct mount *mp; int mntflags; @@ -226,38 +214,17 @@ fdesc_statfs(mp, sbp, p) return (0); } -static int -fdesc_sync(mp, waitfor, cred, p) - struct mount *mp; - int waitfor; - struct ucred *cred; - struct proc *p; -{ - - return (0); -} - -#define fdesc_fhtovp ((int (*) __P((struct mount *, struct fid *, \ - struct sockaddr *, struct vnode **, int *, struct ucred **)))eopnotsupp) -#define fdesc_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \ - struct proc *)))eopnotsupp) -#define fdesc_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ - size_t, struct proc *)))eopnotsupp) -#define fdesc_vget ((int (*) __P((struct mount *, ino_t, struct vnode **))) \ - eopnotsupp) -#define fdesc_vptofh ((int (*) __P((struct vnode *, struct fid *)))eopnotsupp) - static struct vfsops fdesc_vfsops = { fdesc_mount, - fdesc_start, + vfs_stdstart, fdesc_unmount, fdesc_root, - fdesc_quotactl, + vfs_stdquotactl, fdesc_statfs, - fdesc_sync, - fdesc_vget, - fdesc_fhtovp, - fdesc_vptofh, + vfs_stdsync, + vfs_stdvget, + vfs_stdfhtovp, + vfs_stdvptofh, fdesc_init, }; diff --git a/sys/miscfs/kernfs/kernfs.h b/sys/miscfs/kernfs/kernfs.h index 361d489..bb03fea 100644 --- a/sys/miscfs/kernfs/kernfs.h +++ b/sys/miscfs/kernfs/kernfs.h @@ -51,17 +51,6 @@ struct kernfs_node { #define VFSTOKERNFS(mp) ((struct kernfs_mount *)((mp)->mnt_data)) #define VTOKERN(vp) ((struct kernfs_node *)(vp)->v_data) -#define kernfs_fhtovp ((int (*) __P((struct mount *, struct fid *, \ - struct sockaddr *, struct vnode **, int *, struct ucred **)))eopnotsupp) -#define kernfs_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \ - struct proc *)))eopnotsupp) -#define kernfs_sync ((int (*) __P((struct mount *, int, struct ucred *, \ - struct proc *)))nullop) -#define kernfs_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ - size_t, struct proc *)))eopnotsupp) -#define kernfs_vget ((int (*) __P((struct mount *, ino_t, struct vnode **))) \ - eopnotsupp) -#define kernfs_vptofh ((int (*) __P((struct vnode *, struct fid *)))eopnotsupp) extern vop_t **kernfs_vnodeop_p; extern dev_t rrootdev; #endif /* KERNEL */ diff --git a/sys/miscfs/kernfs/kernfs_vfsops.c b/sys/miscfs/kernfs/kernfs_vfsops.c index 85a63b7..0f21035 100644 --- a/sys/miscfs/kernfs/kernfs_vfsops.c +++ b/sys/miscfs/kernfs/kernfs_vfsops.c @@ -57,24 +57,14 @@ static MALLOC_DEFINE(M_KERNFSMNT, "KERNFS mount", "KERNFS mount structure"); dev_t rrootdev = NODEV; static void kernfs_get_rrootdev __P((void)); -static int kernfs_init __P((struct vfsconf *vfsp)); static int kernfs_mount __P((struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, struct proc *p)); -static int kernfs_start __P((struct mount *mp, int flags, struct proc *p)); static int kernfs_unmount __P((struct mount *mp, int mntflags, - struct proc *p)); + struct proc *p)); static int kernfs_root __P((struct mount *mp, struct vnode **vpp)); static int kernfs_statfs __P((struct mount *mp, struct statfs *sbp, struct proc *p)); -static int -kernfs_init(vfsp) - struct vfsconf *vfsp; -{ - - return (0); -} - static void kernfs_get_rrootdev() { @@ -154,15 +144,6 @@ kernfs_mount(mp, path, data, ndp, p) } static int -kernfs_start(mp, flags, p) - struct mount *mp; - int flags; - struct proc *p; -{ - return (0); -} - -static int kernfs_unmount(mp, mntflags, p) struct mount *mp; int mntflags; @@ -263,16 +244,16 @@ kernfs_statfs(mp, sbp, p) static struct vfsops kernfs_vfsops = { kernfs_mount, - kernfs_start, + vfs_stdstart, kernfs_unmount, kernfs_root, - kernfs_quotactl, + vfs_stdquotactl, kernfs_statfs, - kernfs_sync, - kernfs_vget, - kernfs_fhtovp, - kernfs_vptofh, - kernfs_init, + vfs_stdsync, + vfs_stdvget, + vfs_stdfhtovp, + vfs_stdvptofh, + vfs_stdinit, }; VFS_SET(kernfs_vfsops, kernfs, VFCF_SYNTHETIC); diff --git a/sys/miscfs/portal/portal_vfsops.c b/sys/miscfs/portal/portal_vfsops.c index d447664..bdb172b 100644 --- a/sys/miscfs/portal/portal_vfsops.c +++ b/sys/miscfs/portal/portal_vfsops.c @@ -59,24 +59,14 @@ static MALLOC_DEFINE(M_PORTALFSMNT, "PORTAL mount", "PORTAL mount structure"); -static int portal_init __P((struct vfsconf *)); static int portal_mount __P((struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, struct proc *p)); -static int portal_start __P((struct mount *mp, int flags, struct proc *p)); static int portal_unmount __P((struct mount *mp, int mntflags, struct proc *p)); static int portal_root __P((struct mount *mp, struct vnode **vpp)); static int portal_statfs __P((struct mount *mp, struct statfs *sbp, struct proc *p)); -static int -portal_init(vfsp) - struct vfsconf *vfsp; -{ - - return (0); -} - /* * Mount the per-process file descriptors (/dev/fd) */ @@ -156,16 +146,6 @@ portal_mount(mp, path, data, ndp, p) } static int -portal_start(mp, flags, p) - struct mount *mp; - int flags; - struct proc *p; -{ - - return (0); -} - -static int portal_unmount(mp, mntflags, p) struct mount *mp; int mntflags; @@ -263,30 +243,18 @@ portal_statfs(mp, sbp, p) return (0); } -#define portal_fhtovp ((int (*) __P((struct mount *, struct fid *, \ - struct sockaddr *, struct vnode **, int *, struct ucred **)))eopnotsupp) -#define portal_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \ - struct proc *)))eopnotsupp) -#define portal_sync ((int (*) __P((struct mount *, int, struct ucred *, \ - struct proc *)))nullop) -#define portal_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ - size_t, struct proc *)))eopnotsupp) -#define portal_vget ((int (*) __P((struct mount *, ino_t, struct vnode **))) \ - eopnotsupp) -#define portal_vptofh ((int (*) __P((struct vnode *, struct fid *)))eopnotsupp) - static struct vfsops portal_vfsops = { portal_mount, - portal_start, + vfs_stdstart, portal_unmount, portal_root, - portal_quotactl, + vfs_stdquotactl, portal_statfs, - portal_sync, - portal_vget, - portal_fhtovp, - portal_vptofh, - portal_init, + vfs_stdsync, + vfs_stdvget, + vfs_stdfhtovp, + vfs_stdvptofh, + vfs_stdinit, }; VFS_SET(portal_vfsops, portal, VFCF_SYNTHETIC); diff --git a/sys/miscfs/procfs/procfs_vfsops.c b/sys/miscfs/procfs/procfs_vfsops.c index 0478e38..92245b8 100644 --- a/sys/miscfs/procfs/procfs_vfsops.c +++ b/sys/miscfs/procfs/procfs_vfsops.c @@ -52,10 +52,8 @@ #include <sys/vnode.h> #include <miscfs/procfs/procfs.h> -static int procfs_init __P((struct vfsconf *vfsp)); static int procfs_mount __P((struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, struct proc *p)); -static int procfs_start __P((struct mount *mp, int flags, struct proc *p)); static int procfs_statfs __P((struct mount *mp, struct statfs *sbp, struct proc *p)); static int procfs_unmount __P((struct mount *mp, int mntflags, @@ -135,17 +133,6 @@ procfs_root(mp, vpp) return (procfs_allocvp(mp, vpp, 0, Proot)); } -/* ARGSUSED */ -static int -procfs_start(mp, flags, p) - struct mount *mp; - int flags; - struct proc *p; -{ - - return (0); -} - /* * Get file system statistics. */ @@ -173,38 +160,18 @@ procfs_statfs(mp, sbp, p) return (0); } -static int -procfs_init(vfsp) - struct vfsconf *vfsp; -{ - - return (0); -} - -#define procfs_fhtovp ((int (*) __P((struct mount *, struct fid *, \ - struct sockaddr *, struct vnode **, int *, struct ucred **)))einval) -#define procfs_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \ - struct proc *)))eopnotsupp) -#define procfs_sync ((int (*) __P((struct mount *, int, struct ucred *, \ - struct proc *)))nullop) -#define procfs_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ - size_t, struct proc *)))eopnotsupp) -#define procfs_vget ((int (*) __P((struct mount *, ino_t, struct vnode **))) \ - eopnotsupp) -#define procfs_vptofh ((int (*) __P((struct vnode *, struct fid *)))einval) - static struct vfsops procfs_vfsops = { procfs_mount, - procfs_start, + vfs_stdstart, procfs_unmount, procfs_root, - procfs_quotactl, + vfs_stdquotactl, procfs_statfs, - procfs_sync, - procfs_vget, - procfs_fhtovp, - procfs_vptofh, - procfs_init, + vfs_stdsync, + vfs_stdvget, + vfs_stdfhtovp, + vfs_stdvptofh, + vfs_stdinit, }; VFS_SET(procfs_vfsops, procfs, VFCF_SYNTHETIC); diff --git a/sys/miscfs/union/union_vfsops.c b/sys/miscfs/union/union_vfsops.c index 888ad30..def8416 100644 --- a/sys/miscfs/union/union_vfsops.c +++ b/sys/miscfs/union/union_vfsops.c @@ -56,25 +56,13 @@ static MALLOC_DEFINE(M_UNIONFSMNT, "UNION mount", "UNION mount structure"); extern int union_init __P((struct vfsconf *)); - -extern int union_fhtovp __P((struct mount *mp, struct fid *fidp, - struct mbuf *nam, struct vnode **vpp, - int *exflagsp, struct ucred **credanonp)); static int union_mount __P((struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, struct proc *p)); -extern int union_quotactl __P((struct mount *mp, int cmd, uid_t uid, - caddr_t arg, struct proc *p)); static int union_root __P((struct mount *mp, struct vnode **vpp)); -static int union_start __P((struct mount *mp, int flags, struct proc *p)); static int union_statfs __P((struct mount *mp, struct statfs *sbp, struct proc *p)); -extern int union_sync __P((struct mount *mp, int waitfor, - struct ucred *cred, struct proc *p)); static int union_unmount __P((struct mount *mp, int mntflags, struct proc *p)); -extern int union_vget __P((struct mount *mp, ino_t ino, - struct vnode **vpp)); -extern int union_vptofh __P((struct vnode *vp, struct fid *fhp)); /* * Mount union filesystem @@ -289,21 +277,6 @@ bad: } /* - * VFS start. Nothing needed here - the start routine - * on the underlying filesystem(s) will have been called - * when that filesystem was mounted. - */ -static int -union_start(mp, flags, p) - struct mount *mp; - int flags; - struct proc *p; -{ - - return (0); -} - -/* * Free reference to union layer */ static int @@ -521,33 +494,17 @@ union_statfs(mp, sbp, p) return (0); } -/* - * XXX - Assumes no data cached at union layer. - */ -#define union_sync ((int (*) __P((struct mount *, int, struct ucred *, \ - struct proc *)))nullop) - -#define union_fhtovp ((int (*) __P((struct mount *, struct fid *, \ - struct sockaddr *, struct vnode **, int *, struct ucred **)))eopnotsupp) -#define union_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \ - struct proc *)))eopnotsupp) -#define union_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ - size_t, struct proc *)))eopnotsupp) -#define union_vget ((int (*) __P((struct mount *, ino_t, struct vnode **))) \ - eopnotsupp) -#define union_vptofh ((int (*) __P((struct vnode *, struct fid *)))eopnotsupp) - static struct vfsops union_vfsops = { union_mount, - union_start, + vfs_stdstart, union_unmount, union_root, - union_quotactl, + vfs_stdquotactl, union_statfs, - union_sync, - union_vget, - union_fhtovp, - union_vptofh, + vfs_stdsync, /* XXX assumes no cached data on union level */ + vfs_stdvget, + vfs_stdfhtovp, + vfs_stdvptofh, union_init, }; |