BSD 4_4_Lite2 release
[unix-history] / usr / src / sys / miscfs / procfs / procfs_vfsops.c
index 3938ca1..b2bcd70 100644 (file)
@@ -34,7 +34,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *     @(#)procfs_vfsops.c     8.4 (Berkeley) 1/21/94
+ *     @(#)procfs_vfsops.c     8.7 (Berkeley) 5/10/95
  *
  * From:
  *     $Id: procfs_vfsops.c,v 3.1 1993/12/15 09:40:17 jsp Exp $
  *
  * From:
  *     $Id: procfs_vfsops.c,v 3.1 1993/12/15 09:40:17 jsp Exp $
@@ -45,6 +45,7 @@
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
+#include <sys/systm.h>
 #include <sys/time.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
 #include <sys/time.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
@@ -81,7 +82,7 @@ procfs_mount(mp, path, data, ndp, p)
 
        mp->mnt_flag |= MNT_LOCAL;
        mp->mnt_data = 0;
 
        mp->mnt_flag |= MNT_LOCAL;
        mp->mnt_data = 0;
-       getnewfsid(mp, MOUNT_PROCFS);
+       vfs_getnewfsid(mp);
 
        (void) copyinstr(path, (caddr_t)mp->mnt_stat.f_mntonname, MNAMELEN, &size);
        bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
 
        (void) copyinstr(path, (caddr_t)mp->mnt_stat.f_mntonname, MNAMELEN, &size);
        bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
@@ -102,15 +103,10 @@ procfs_unmount(mp, mntflags, p)
        struct proc *p;
 {
        int error;
        struct proc *p;
 {
        int error;
-       extern int doforce;
        int flags = 0;
 
        int flags = 0;
 
-       if (mntflags & MNT_FORCE) {
-               /* procfs can never be rootfs so don't check for it */
-               if (!doforce)
-                       return (EINVAL);
+       if (mntflags & MNT_FORCE)
                flags |= FORCECLOSE;
                flags |= FORCECLOSE;
-       }
 
        if (error = vflush(mp, 0, flags))
                return (error);
 
        if (error = vflush(mp, 0, flags))
                return (error);
@@ -122,24 +118,10 @@ procfs_root(mp, vpp)
        struct mount *mp;
        struct vnode **vpp;
 {
        struct mount *mp;
        struct vnode **vpp;
 {
-       struct pfsnode *pfs;
-       struct vnode *vp;
-       int error;
-
-       error = procfs_allocvp(mp, &vp, (pid_t) 0, Proot);
-       if (error)
-               return (error);
-
-       vp->v_type = VDIR;
-       vp->v_flag = VROOT;
-       pfs = VTOPFS(vp);
 
 
-       *vpp = vp;
-       return (0);
+       return (procfs_allocvp(mp, vpp, 0, Proot));
 }
 
 }
 
-/*
- */
 /* ARGSUSED */
 procfs_start(mp, flags, p)
        struct mount *mp;
 /* ARGSUSED */
 procfs_start(mp, flags, p)
        struct mount *mp;
@@ -158,7 +140,6 @@ procfs_statfs(mp, sbp, p)
        struct statfs *sbp;
        struct proc *p;
 {
        struct statfs *sbp;
        struct proc *p;
 {
-       sbp->f_type = MOUNT_PROCFS;
        sbp->f_bsize = PAGE_SIZE;
        sbp->f_iosize = PAGE_SIZE;
        sbp->f_blocks = 1;      /* avoid divide by zero in some df's */
        sbp->f_bsize = PAGE_SIZE;
        sbp->f_iosize = PAGE_SIZE;
        sbp->f_blocks = 1;      /* avoid divide by zero in some df's */
@@ -168,6 +149,7 @@ procfs_statfs(mp, sbp, p)
        sbp->f_ffree = maxproc - nprocs;        /* approx */
 
        if (sbp != &mp->mnt_stat) {
        sbp->f_ffree = maxproc - nprocs;        /* approx */
 
        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);
                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);
@@ -176,57 +158,24 @@ procfs_statfs(mp, sbp, p)
        return (0);
 }
 
        return (0);
 }
 
-
-procfs_quotactl(mp, cmds, uid, arg, p)
-       struct mount *mp;
-       int cmds;
-       uid_t uid;
-       caddr_t arg;
-       struct proc *p;
-{
-
-       return (EOPNOTSUPP);
-}
-
-procfs_sync(mp, waitfor)
-       struct mount *mp;
-       int waitfor;
+procfs_init(vfsp)
+       struct vfsconf *vfsp;
 {
 
        return (0);
 }
 
 {
 
        return (0);
 }
 
-procfs_vget(mp, ino, vpp)
-       struct mount *mp;
-       ino_t ino;
-       struct vnode **vpp;
-{
-
-       return (EOPNOTSUPP);
-}
-
-procfs_fhtovp(mp, fhp, vpp)
-       struct mount *mp;
-       struct fid *fhp;
-       struct vnode **vpp;
-{
-
-       return (EINVAL);
-}
-
-procfs_vptofh(vp, fhp)
-       struct vnode *vp;
-       struct fid *fhp;
-{
-
-       return EINVAL;
-}
-
-procfs_init()
-{
-
-       return (0);
-}
+#define procfs_fhtovp ((int (*) __P((struct mount *, struct fid *, \
+           struct mbuf *, 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)
 
 struct vfsops procfs_vfsops = {
        procfs_mount,
 
 struct vfsops procfs_vfsops = {
        procfs_mount,
@@ -240,4 +189,5 @@ struct vfsops procfs_vfsops = {
        procfs_fhtovp,
        procfs_vptofh,
        procfs_init,
        procfs_fhtovp,
        procfs_vptofh,
        procfs_init,
+       procfs_sysctl,
 };
 };