From 0d540f6fba7ad33aa2877885fb2b93ade51660fc Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Wed, 29 Mar 1995 07:23:57 -0800 Subject: [PATCH] cleanups; getnewfsid => vfs_getnewfsid; add fdesc_sysctl SCCS-vsn: sys/miscfs/fdesc/fdesc.h 8.7 SCCS-vsn: sys/miscfs/fdesc/fdesc_vfsops.c 8.6 SCCS-vsn: sys/miscfs/fdesc/fdesc_vnops.c 8.13 SCCS-vsn: sys/miscfs/kernfs/kernfs.h 8.6 SCCS-vsn: sys/miscfs/kernfs/kernfs_vfsops.c 8.7 SCCS-vsn: sys/miscfs/nullfs/null_vfsops.c 8.4 SCCS-vsn: sys/miscfs/portal/portal_vfsops.c 8.8 --- usr/src/sys/miscfs/fdesc/fdesc.h | 13 ++++- usr/src/sys/miscfs/fdesc/fdesc_vfsops.c | 52 ++--------------- usr/src/sys/miscfs/fdesc/fdesc_vnops.c | 56 ++++++------------ usr/src/sys/miscfs/kernfs/kernfs.h | 13 ++++- usr/src/sys/miscfs/kernfs/kernfs_vfsops.c | 58 +++---------------- usr/src/sys/miscfs/nullfs/null_vfsops.c | 10 +++- usr/src/sys/miscfs/portal/portal_vfsops.c | 70 ++++++----------------- 7 files changed, 76 insertions(+), 196 deletions(-) diff --git a/usr/src/sys/miscfs/fdesc/fdesc.h b/usr/src/sys/miscfs/fdesc/fdesc.h index 8578cab059..d4a9fbf79c 100644 --- a/usr/src/sys/miscfs/fdesc/fdesc.h +++ b/usr/src/sys/miscfs/fdesc/fdesc.h @@ -7,7 +7,7 @@ * * %sccs.include.redist.c% * - * @(#)fdesc.h 8.6 (Berkeley) %G% + * @(#)fdesc.h 8.7 (Berkeley) %G% * * $Id: fdesc.h,v 1.8 1993/04/06 15:28:33 jsp Exp $ */ @@ -47,9 +47,18 @@ struct fdescnode { #define VTOFDESC(vp) ((struct fdescnode *)(vp)->v_data) extern dev_t devctty; -extern int fdesc_init __P((void)); +extern int fdesc_init __P((struct vfsconf *)); extern int fdesc_root __P((struct mount *, struct vnode **)); extern int fdesc_allocvp __P((fdntype, int, struct mount *, struct vnode **)); +#define fdesc_fhtovp ((int (*) __P((struct mount *, struct fid *, \ + struct mbuf *, 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) extern int (**fdesc_vnodeop_p)(); extern struct vfsops fdesc_vfsops; #endif /* KERNEL */ diff --git a/usr/src/sys/miscfs/fdesc/fdesc_vfsops.c b/usr/src/sys/miscfs/fdesc/fdesc_vfsops.c index 0fdd0a7abc..74e88c34a5 100644 --- a/usr/src/sys/miscfs/fdesc/fdesc_vfsops.c +++ b/usr/src/sys/miscfs/fdesc/fdesc_vfsops.c @@ -7,7 +7,7 @@ * * %sccs.include.redist.c% * - * @(#)fdesc_vfsops.c 8.5 (Berkeley) %G% + * @(#)fdesc_vfsops.c 8.6 (Berkeley) %G% * * $Id: fdesc_vfsops.c,v 1.9 1993/04/06 15:28:33 jsp Exp $ */ @@ -63,7 +63,7 @@ fdesc_mount(mp, path, data, ndp, p) /* XXX -- don't mark as local to work around fts() problems */ /*mp->mnt_flag |= MNT_LOCAL;*/ mp->mnt_data = (qaddr_t) fmp; - getnewfsid(mp, MOUNT_FDESC); + vfs_getnewfsid(mp); (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); @@ -143,18 +143,6 @@ fdesc_root(mp, vpp) return (0); } -int -fdesc_quotactl(mp, cmd, uid, arg, p) - struct mount *mp; - int cmd; - uid_t uid; - caddr_t arg; - struct proc *p; -{ - - return (EOPNOTSUPP); -} - int fdesc_statfs(mp, sbp, p) struct mount *mp; @@ -188,7 +176,6 @@ fdesc_statfs(mp, sbp, p) if (fdp->fd_nfiles < lim) freefd += (lim - fdp->fd_nfiles); - sbp->f_type = MOUNT_FDESC; sbp->f_flags = 0; sbp->f_bsize = DEV_BSIZE; sbp->f_iosize = DEV_BSIZE; @@ -198,6 +185,7 @@ fdesc_statfs(mp, sbp, p) sbp->f_files = lim + 1; /* Allow for "." */ sbp->f_ffree = freefd; /* See comments above */ if (sbp != &mp->mnt_stat) { + sbp->f_type = mp->mnt_vfc->vfc_typenum; bcopy(&mp->mnt_stat.f_fsid, &sbp->f_fsid, sizeof(sbp->f_fsid)); bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); @@ -214,39 +202,6 @@ fdesc_sync(mp, waitfor) return (0); } -/* - * Fdesc flat namespace lookup. - * Currently unsupported. - */ -int -fdesc_vget(mp, ino, vpp) - struct mount *mp; - ino_t ino; - struct vnode **vpp; -{ - - return (EOPNOTSUPP); -} - -int -fdesc_fhtovp(mp, fhp, setgen, vpp) - struct mount *mp; - struct fid *fhp; - int setgen; - struct vnode **vpp; -{ - return (EOPNOTSUPP); -} - -int -fdesc_vptofh(vp, fhp) - struct vnode *vp; - struct fid *fhp; -{ - - return (EOPNOTSUPP); -} - struct vfsops fdesc_vfsops = { fdesc_mount, fdesc_start, @@ -259,4 +214,5 @@ struct vfsops fdesc_vfsops = { fdesc_fhtovp, fdesc_vptofh, fdesc_init, + fdesc_sysctl, }; diff --git a/usr/src/sys/miscfs/fdesc/fdesc_vnops.c b/usr/src/sys/miscfs/fdesc/fdesc_vnops.c index 9fd052594d..0e4579bd55 100644 --- a/usr/src/sys/miscfs/fdesc/fdesc_vnops.c +++ b/usr/src/sys/miscfs/fdesc/fdesc_vnops.c @@ -7,7 +7,7 @@ * * %sccs.include.redist.c% * - * @(#)fdesc_vnops.c 8.12 (Berkeley) %G% + * @(#)fdesc_vnops.c 8.13 (Berkeley) %G% * * $Id: fdesc_vnops.c,v 1.12 1993/04/06 16:17:17 jsp Exp $ */ @@ -56,7 +56,8 @@ u_long fdhash; /* * Initialise cache headers */ -fdesc_init() +fdesc_init(vfsp) + struct vfsconf *vfsp; { devctty = makedev(nchrdev, 0); @@ -825,16 +826,6 @@ fdesc_vfree(ap) return (0); } -/* - * /dev/fd vnode unsupported operation - */ -int -fdesc_enotsupp() -{ - - return (EOPNOTSUPP); -} - /* * /dev/fd "should never get here" operation */ @@ -846,48 +837,37 @@ fdesc_badop() /* NOTREACHED */ } -/* - * /dev/fd vnode null operation - */ -int -fdesc_nullop() -{ - - return (0); -} - -#define fdesc_create ((int (*) __P((struct vop_create_args *)))fdesc_enotsupp) -#define fdesc_mknod ((int (*) __P((struct vop_mknod_args *)))fdesc_enotsupp) +#define fdesc_create ((int (*) __P((struct vop_create_args *)))eopnotsupp) +#define fdesc_mknod ((int (*) __P((struct vop_mknod_args *)))eopnotsupp) #define fdesc_close ((int (*) __P((struct vop_close_args *)))nullop) #define fdesc_access ((int (*) __P((struct vop_access_args *)))nullop) -#define fdesc_mmap ((int (*) __P((struct vop_mmap_args *)))fdesc_enotsupp) +#define fdesc_mmap ((int (*) __P((struct vop_mmap_args *)))eopnotsupp) #define fdesc_fsync ((int (*) __P((struct vop_fsync_args *)))nullop) #define fdesc_seek ((int (*) __P((struct vop_seek_args *)))nullop) -#define fdesc_remove ((int (*) __P((struct vop_remove_args *)))fdesc_enotsupp) -#define fdesc_link ((int (*) __P((struct vop_link_args *)))fdesc_enotsupp) -#define fdesc_rename ((int (*) __P((struct vop_rename_args *)))fdesc_enotsupp) -#define fdesc_mkdir ((int (*) __P((struct vop_mkdir_args *)))fdesc_enotsupp) -#define fdesc_rmdir ((int (*) __P((struct vop_rmdir_args *)))fdesc_enotsupp) -#define fdesc_symlink ((int (*) __P((struct vop_symlink_args *)))fdesc_enotsupp) +#define fdesc_remove ((int (*) __P((struct vop_remove_args *)))eopnotsupp) +#define fdesc_link ((int (*) __P((struct vop_link_args *)))eopnotsupp) +#define fdesc_rename ((int (*) __P((struct vop_rename_args *)))eopnotsupp) +#define fdesc_mkdir ((int (*) __P((struct vop_mkdir_args *)))eopnotsupp) +#define fdesc_rmdir ((int (*) __P((struct vop_rmdir_args *)))eopnotsupp) +#define fdesc_symlink ((int (*) __P((struct vop_symlink_args *)))eopnotsupp) #define fdesc_abortop ((int (*) __P((struct vop_abortop_args *)))nullop) #define fdesc_lock ((int (*) __P((struct vop_lock_args *)))nullop) #define fdesc_unlock ((int (*) __P((struct vop_unlock_args *)))nullop) #define fdesc_bmap ((int (*) __P((struct vop_bmap_args *)))fdesc_badop) #define fdesc_strategy ((int (*) __P((struct vop_strategy_args *)))fdesc_badop) #define fdesc_islocked ((int (*) __P((struct vop_islocked_args *)))nullop) -#define fdesc_advlock ((int (*) __P((struct vop_advlock_args *)))fdesc_enotsupp) +#define fdesc_advlock ((int (*) __P((struct vop_advlock_args *)))eopnotsupp) #define fdesc_blkatoff \ - ((int (*) __P((struct vop_blkatoff_args *)))fdesc_enotsupp) -#define fdesc_vget ((int (*) __P((struct vop_vget_args *)))fdesc_enotsupp) + ((int (*) __P((struct vop_blkatoff_args *)))eopnotsupp) #define fdesc_valloc ((int(*) __P(( \ struct vnode *pvp, \ int mode, \ struct ucred *cred, \ - struct vnode **vpp))) fdesc_enotsupp) + struct vnode **vpp))) eopnotsupp) #define fdesc_truncate \ - ((int (*) __P((struct vop_truncate_args *)))fdesc_enotsupp) -#define fdesc_update ((int (*) __P((struct vop_update_args *)))fdesc_enotsupp) -#define fdesc_bwrite ((int (*) __P((struct vop_bwrite_args *)))fdesc_enotsupp) + ((int (*) __P((struct vop_truncate_args *)))eopnotsupp) +#define fdesc_update ((int (*) __P((struct vop_update_args *)))eopnotsupp) +#define fdesc_bwrite ((int (*) __P((struct vop_bwrite_args *)))eopnotsupp) int (**fdesc_vnodeop_p)(); struct vnodeopv_entry_desc fdesc_vnodeop_entries[] = { diff --git a/usr/src/sys/miscfs/kernfs/kernfs.h b/usr/src/sys/miscfs/kernfs/kernfs.h index 294234fb5b..d2f104e14e 100644 --- a/usr/src/sys/miscfs/kernfs/kernfs.h +++ b/usr/src/sys/miscfs/kernfs/kernfs.h @@ -7,7 +7,7 @@ * * %sccs.include.redist.c% * - * @(#)kernfs.h 8.5 (Berkeley) %G% + * @(#)kernfs.h 8.6 (Berkeley) %G% */ #define _PATH_KERNFS "/kern" /* Default mountpoint */ @@ -24,6 +24,17 @@ 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 mbuf *, 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 int (**kernfs_vnodeop_p)(); extern struct vfsops kernfs_vfsops; extern dev_t rrootdev; diff --git a/usr/src/sys/miscfs/kernfs/kernfs_vfsops.c b/usr/src/sys/miscfs/kernfs/kernfs_vfsops.c index ac1b89b7af..f2071554bd 100644 --- a/usr/src/sys/miscfs/kernfs/kernfs_vfsops.c +++ b/usr/src/sys/miscfs/kernfs/kernfs_vfsops.c @@ -7,7 +7,7 @@ * * %sccs.include.redist.c% * - * @(#)kernfs_vfsops.c 8.6 (Berkeley) %G% + * @(#)kernfs_vfsops.c 8.7 (Berkeley) %G% */ /* @@ -29,9 +29,11 @@ dev_t rrootdev = NODEV; -kernfs_init() +kernfs_init(vfsp) + struct vfsconf *vfsp; { + return (0); } void @@ -96,7 +98,7 @@ kernfs_mount(mp, path, data, ndp, p) fmp->kf_root = rvp; mp->mnt_flag |= MNT_LOCAL; mp->mnt_data = (qaddr_t) fmp; - getnewfsid(mp, MOUNT_KERNFS); + vfs_getnewfsid(mp); (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); @@ -191,16 +193,6 @@ kernfs_root(mp, vpp) return (0); } -kernfs_quotactl(mp, cmd, uid, arg, p) - struct mount *mp; - int cmd; - uid_t uid; - caddr_t arg; - struct proc *p; -{ - return (EOPNOTSUPP); -} - kernfs_statfs(mp, sbp, p) struct mount *mp; struct statfs *sbp; @@ -210,7 +202,6 @@ kernfs_statfs(mp, sbp, p) printf("kernfs_statfs(mp = %x)\n", mp); #endif - sbp->f_type = MOUNT_KERNFS; sbp->f_flags = 0; sbp->f_bsize = DEV_BSIZE; sbp->f_iosize = DEV_BSIZE; @@ -220,6 +211,7 @@ kernfs_statfs(mp, sbp, p) sbp->f_files = 0; sbp->f_ffree = 0; if (sbp != &mp->mnt_stat) { + sbp->f_type = mp->mnt_vfc->vfc_typenum; bcopy(&mp->mnt_stat.f_fsid, &sbp->f_fsid, sizeof(sbp->f_fsid)); bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); @@ -227,43 +219,6 @@ kernfs_statfs(mp, sbp, p) return (0); } -kernfs_sync(mp, waitfor) - struct mount *mp; - int waitfor; -{ - return (0); -} - -/* - * Kernfs flat namespace lookup. - * Currently unsupported. - */ -kernfs_vget(mp, ino, vpp) - struct mount *mp; - ino_t ino; - struct vnode **vpp; -{ - - return (EOPNOTSUPP); -} - - -kernfs_fhtovp(mp, fhp, setgen, vpp) - struct mount *mp; - struct fid *fhp; - int setgen; - struct vnode **vpp; -{ - return (EOPNOTSUPP); -} - -kernfs_vptofh(vp, fhp) - struct vnode *vp; - struct fid *fhp; -{ - return (EOPNOTSUPP); -} - struct vfsops kernfs_vfsops = { kernfs_mount, kernfs_start, @@ -276,4 +231,5 @@ struct vfsops kernfs_vfsops = { kernfs_fhtovp, kernfs_vptofh, kernfs_init, + kernfs_sysctl, }; diff --git a/usr/src/sys/miscfs/nullfs/null_vfsops.c b/usr/src/sys/miscfs/nullfs/null_vfsops.c index 82101804b4..1c9dd5b8f6 100644 --- a/usr/src/sys/miscfs/nullfs/null_vfsops.c +++ b/usr/src/sys/miscfs/nullfs/null_vfsops.c @@ -7,7 +7,7 @@ * * %sccs.include.redist.c% * - * @(#)null_vfsops.c 8.3 (Berkeley) %G% + * @(#)null_vfsops.c 8.4 (Berkeley) %G% * * @(#)lofs_vfsops.c 1.2 (Berkeley) 6/18/92 * $Id: lofs_vfsops.c,v 1.9 1992/05/30 10:26:24 jsp Exp jsp $ @@ -116,7 +116,7 @@ nullfs_mount(mp, path, data, ndp, p) if (NULLVPTOLOWERVP(nullm_rootvp)->v_mount->mnt_flag & MNT_LOCAL) mp->mnt_flag |= MNT_LOCAL; mp->mnt_data = (qaddr_t) xmp; - getnewfsid(mp, MOUNT_LOFS); + vfs_getnewfsid(mp); (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); @@ -323,7 +323,10 @@ nullfs_vptofh(vp, fhp) return VFS_VPTOFH(NULLVPTOLOWERVP(vp), fhp); } -int nullfs_init __P((void)); +int nullfs_init __P((struct vfsconf *)); + +#define nullfs_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ + size_t, struct proc *)))eopnotsupp) struct vfsops null_vfsops = { nullfs_mount, @@ -337,4 +340,5 @@ struct vfsops null_vfsops = { nullfs_fhtovp, nullfs_vptofh, nullfs_init, + nullfs_sysctl, }; diff --git a/usr/src/sys/miscfs/portal/portal_vfsops.c b/usr/src/sys/miscfs/portal/portal_vfsops.c index 22b9410517..1f4c6b0ddb 100644 --- a/usr/src/sys/miscfs/portal/portal_vfsops.c +++ b/usr/src/sys/miscfs/portal/portal_vfsops.c @@ -7,7 +7,7 @@ * * %sccs.include.redist.c% * - * @(#)portal_vfsops.c 8.7 (Berkeley) %G% + * @(#)portal_vfsops.c 8.8 (Berkeley) %G% * * $Id: portal_vfsops.c,v 1.5 1992/05/30 10:25:27 jsp Exp jsp $ */ @@ -36,7 +36,8 @@ #include int -portal_init() +portal_init(vfsp) + struct vfsconf *vfsp; { return (0); @@ -94,7 +95,7 @@ portal_mount(mp, path, data, ndp, p) mp->mnt_flag |= MNT_LOCAL; mp->mnt_data = (qaddr_t) fmp; - getnewfsid(mp, MOUNT_PORTAL); + vfs_getnewfsid(mp); (void)copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); @@ -198,18 +199,6 @@ portal_root(mp, vpp) return (0); } -int -portal_quotactl(mp, cmd, uid, arg, p) - struct mount *mp; - int cmd; - uid_t uid; - caddr_t arg; - struct proc *p; -{ - - return (EOPNOTSUPP); -} - int portal_statfs(mp, sbp, p) struct mount *mp; @@ -217,7 +206,6 @@ portal_statfs(mp, sbp, p) struct proc *p; { - sbp->f_type = MOUNT_PORTAL; sbp->f_flags = 0; sbp->f_bsize = DEV_BSIZE; sbp->f_iosize = DEV_BSIZE; @@ -227,6 +215,7 @@ portal_statfs(mp, sbp, p) sbp->f_files = 1; /* Allow for "." */ sbp->f_ffree = 0; /* See comments above */ if (sbp != &mp->mnt_stat) { + sbp->f_type = mp->mnt_vfc->vfc_typenum; bcopy(&mp->mnt_stat.f_fsid, &sbp->f_fsid, sizeof(sbp->f_fsid)); bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); @@ -234,43 +223,17 @@ portal_statfs(mp, sbp, p) return (0); } -int -portal_sync(mp, waitfor) - struct mount *mp; - int waitfor; -{ - - return (0); -} - -int -portal_vget(mp, ino, vpp) - struct mount *mp; - ino_t ino; - struct vnode **vpp; -{ - - return (EOPNOTSUPP); -} - -int -portal_fhtovp(mp, fhp, vpp) - struct mount *mp; - struct fid *fhp; - struct vnode **vpp; -{ - - return (EOPNOTSUPP); -} - -int -portal_vptofh(vp, fhp) - struct vnode *vp; - struct fid *fhp; -{ - - return (EOPNOTSUPP); -} +#define portal_fhtovp ((int (*) __P((struct mount *, struct fid *, \ + struct mbuf *, 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) struct vfsops portal_vfsops = { portal_mount, @@ -284,4 +247,5 @@ struct vfsops portal_vfsops = { portal_fhtovp, portal_vptofh, portal_init, + portal_sysctl, }; -- 2.20.1