diff options
Diffstat (limited to 'sys/miscfs/procfs')
-rw-r--r-- | sys/miscfs/procfs/procfs.h | 6 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_subr.c | 13 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_vfsops.c | 83 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_vnops.c | 11 |
4 files changed, 82 insertions, 31 deletions
diff --git a/sys/miscfs/procfs/procfs.h b/sys/miscfs/procfs/procfs.h index 3dd780253c2..413c6509b4f 100644 --- a/sys/miscfs/procfs/procfs.h +++ b/sys/miscfs/procfs/procfs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs.h,v 1.6 1997/10/06 15:19:10 csapuntz Exp $ */ +/* $OpenBSD: procfs.h,v 1.7 1997/10/06 20:20:33 deraadt Exp $ */ /* $NetBSD: procfs.h,v 1.17 1996/02/12 15:01:41 christos Exp $ */ /* @@ -128,9 +128,7 @@ int procfs_rw __P((void *)); extern int (**procfs_vnodeop_p) __P((void *)); extern struct vfsops procfs_vfsops; -struct vfsconf; - -int procfs_init __P((struct vfsconf *)); +void procfs_init __P((void)); int procfs_root __P((struct mount *, struct vnode **)); #endif /* _KERNEL */ diff --git a/sys/miscfs/procfs/procfs_subr.c b/sys/miscfs/procfs/procfs_subr.c index 89ace835528..24cae7cb845 100644 --- a/sys/miscfs/procfs/procfs_subr.c +++ b/sys/miscfs/procfs/procfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_subr.c,v 1.9 1997/10/06 15:19:10 csapuntz Exp $ */ +/* $OpenBSD: procfs_subr.c,v 1.10 1997/10/06 20:20:33 deraadt Exp $ */ /* $NetBSD: procfs_subr.c,v 1.15 1996/02/12 15:01:42 christos Exp $ */ /* @@ -54,14 +54,10 @@ static TAILQ_HEAD(, pfsnode) pfshead; static int pfsvplock; -/*ARGSUSED*/ -int -procfs_init(vfsp) - struct vfsconf *vfsp; - +void +procfs_init(void) { TAILQ_INIT(&pfshead); - return (0); } /* @@ -97,7 +93,6 @@ procfs_allocvp(mp, vpp, pid, pfs_type) long pid; pfstype pfs_type; { - struct proc *p = curproc; struct pfsnode *pfs; struct vnode *vp; int error; @@ -108,7 +103,7 @@ loop: if (pfs->pfs_pid == pid && pfs->pfs_type == pfs_type && vp->v_mount == mp) { - if (vget(vp, 0, p)) + if (vget(vp, 0)) goto loop; *vpp = vp; return (0); diff --git a/sys/miscfs/procfs/procfs_vfsops.c b/sys/miscfs/procfs/procfs_vfsops.c index a9e6c99aae7..c2c31b37595 100644 --- a/sys/miscfs/procfs/procfs_vfsops.c +++ b/sys/miscfs/procfs/procfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_vfsops.c,v 1.5 1997/10/06 15:19:11 csapuntz Exp $ */ +/* $OpenBSD: procfs_vfsops.c,v 1.6 1997/10/06 20:20:34 deraadt Exp $ */ /* $NetBSD: procfs_vfsops.c,v 1.25 1996/02/09 22:40:53 christos Exp $ */ /* @@ -61,7 +61,14 @@ int procfs_mount __P((struct mount *, char *, caddr_t, struct nameidata *, struct proc *)); int procfs_start __P((struct mount *, int, struct proc *)); int procfs_unmount __P((struct mount *, int, struct proc *)); +int procfs_quotactl __P((struct mount *, int, uid_t, caddr_t, + struct proc *)); int procfs_statfs __P((struct mount *, struct statfs *, struct proc *)); +int procfs_sync __P((struct mount *, int, struct ucred *, struct proc *)); +int procfs_vget __P((struct mount *, ino_t, struct vnode **)); +int procfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, + struct vnode **, int *, struct ucred **)); +int procfs_vptofh __P((struct vnode *, struct fid *)); /* * VFS Operations. * @@ -88,7 +95,7 @@ procfs_mount(mp, path, data, ndp, p) mp->mnt_flag |= MNT_LOCAL; mp->mnt_data = 0; - vfs_getnewfsid(mp); + getnewfsid(mp, makefstype(MOUNT_PROCFS)); (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN, &size); bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); @@ -172,25 +179,72 @@ procfs_statfs(mp, sbp, p) bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); } - strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN); + strncpy(sbp->f_fstypename, mp->mnt_op->vfs_name, MFSNAMELEN); return (0); } +/*ARGSUSED*/ +int +procfs_quotactl(mp, cmds, uid, arg, p) + struct mount *mp; + int cmds; + uid_t uid; + caddr_t arg; + struct proc *p; +{ + + return (EOPNOTSUPP); +} + +/*ARGSUSED*/ +int +procfs_sync(mp, waitfor, uc, p) + struct mount *mp; + int waitfor; + struct ucred *uc; + struct proc *p; +{ -#define procfs_sync ((int (*) __P((struct mount *, int, struct ucred *, \ - struct proc *)))nullop) + return (0); +} -#define procfs_fhtovp ((int (*) __P((struct mount *, struct fid *, \ - struct mbuf *, struct vnode **, int *, struct ucred **)))eopnotsupp) -#define procfs_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \ - struct proc *)))eopnotsupp) -#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 *)))eopnotsupp) +/*ARGSUSED*/ +int +procfs_vget(mp, ino, vpp) + struct mount *mp; + ino_t ino; + struct vnode **vpp; +{ + + return (EOPNOTSUPP); +} + +/*ARGSUSED*/ +int +procfs_fhtovp(mp, fhp, mb, vpp, what, anon) + struct mount *mp; + struct fid *fhp; + struct mbuf *mb; + struct vnode **vpp; + int *what; + struct ucred **anon; +{ + + return (EINVAL); +} + +/*ARGSUSED*/ +int +procfs_vptofh(vp, fhp) + struct vnode *vp; + struct fid *fhp; +{ + + return (EINVAL); +} struct vfsops procfs_vfsops = { + MOUNT_PROCFS, procfs_mount, procfs_start, procfs_unmount, @@ -202,5 +256,4 @@ struct vfsops procfs_vfsops = { procfs_fhtovp, procfs_vptofh, procfs_init, - procfs_sysctl }; diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c index 4700c4e2f73..3a7556f819a 100644 --- a/sys/miscfs/procfs/procfs_vnops.c +++ b/sys/miscfs/procfs/procfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_vnops.c,v 1.7 1997/10/06 15:19:11 csapuntz Exp $ */ +/* $OpenBSD: procfs_vnops.c,v 1.8 1997/10/06 20:20:35 deraadt Exp $ */ /* $NetBSD: procfs_vnops.c,v 1.40 1996/03/16 23:52:55 christos Exp $ */ /* @@ -728,7 +728,6 @@ procfs_lookup(v) struct vnode **vpp = ap->a_vpp; struct vnode *dvp = ap->a_dvp; char *pname = cnp->cn_nameptr; - struct proc *curp = curproc; struct proc_target *pt; struct vnode *fvp; pid_t pid; @@ -788,7 +787,7 @@ procfs_lookup(v) fvp = procfs_findtextvp(p); /* We already checked that it exists. */ VREF(fvp); - vn_lock(fvp, LK_EXCLUSIVE | LK_RETRY, curp); + VOP_LOCK(fvp); *vpp = fvp; return (0); } @@ -840,6 +839,8 @@ procfs_readdir(v) struct pfsnode *pfs; int i; int error; + u_long *cookies = ap->a_cookies; + int ncookies = ap->a_ncookies; pfs = VTOPFS(ap->a_vp); @@ -879,6 +880,8 @@ procfs_readdir(v) if ((error = uiomove((caddr_t)&d, UIO_MX, uio)) != 0) break; + if (ncookies-- > 0) + *cookies++ = i + 1; } break; @@ -940,6 +943,8 @@ procfs_readdir(v) if ((error = uiomove((caddr_t)&d, UIO_MX, uio)) != 0) break; + if (ncookies-- > 0) + *cookies++ = i + 1; } done: |