BSD 4_4_Lite2 release
[unix-history] / usr / src / sys / miscfs / portal / portal_vfsops.c
index 22b9410..8aff570 100644 (file)
@@ -1,13 +1,39 @@
 /*
 /*
- * Copyright (c) 1992, 1993
+ * Copyright (c) 1992, 1993, 1995
  *     The Regents of the University of California.  All rights reserved.
  *
  * This code is derived from software donated to Berkeley by
  * Jan-Simon Pendry.
  *
  *     The Regents of the University of California.  All rights reserved.
  *
  * This code is derived from software donated to Berkeley by
  * Jan-Simon Pendry.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
  *
- *     @(#)portal_vfsops.c     8.7 (Berkeley) %G%
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)portal_vfsops.c     8.11 (Berkeley) 5/14/95
  *
  * $Id: portal_vfsops.c,v 1.5 1992/05/30 10:25:27 jsp Exp jsp $
  */
  *
  * $Id: portal_vfsops.c,v 1.5 1992/05/30 10:25:27 jsp Exp jsp $
  */
@@ -36,7 +62,8 @@
 #include <miscfs/portal/portal.h>
 
 int
 #include <miscfs/portal/portal.h>
 
 int
-portal_init()
+portal_init(vfsp)
+       struct vfsconf *vfsp;
 {
 
        return (0);
 {
 
        return (0);
@@ -94,7 +121,7 @@ portal_mount(mp, path, data, ndp, p)
 
        mp->mnt_flag |= MNT_LOCAL;
        mp->mnt_data = (qaddr_t) fmp;
 
        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);
 
        (void)copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
        bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
@@ -126,17 +153,12 @@ portal_unmount(mp, mntflags, p)
        int mntflags;
        struct proc *p;
 {
        int mntflags;
        struct proc *p;
 {
-       extern int doforce;
        struct vnode *rootvp = VFSTOPORTAL(mp)->pm_root;
        int error, flags = 0;
 
 
        struct vnode *rootvp = VFSTOPORTAL(mp)->pm_root;
        int error, flags = 0;
 
 
-       if (mntflags & MNT_FORCE) {
-               /* portal can never be rootfs so don't check for it */
-               if (!doforce)
-                       return (EINVAL);
+       if (mntflags & MNT_FORCE)
                flags |= FORCECLOSE;
                flags |= FORCECLOSE;
-       }
 
        /*
         * Clear out buffer cache.  I don't think we
 
        /*
         * Clear out buffer cache.  I don't think we
@@ -160,7 +182,7 @@ portal_unmount(mp, mntflags, p)
        /*
         * And blow it away for future re-use
         */
        /*
         * And blow it away for future re-use
         */
-       VOP_REVOKE(rootvp, 0);
+       vgone(rootvp);
        /*
         * Shutdown the socket.  This will cause the select in the
         * daemon to wake up, and then the accept will get ECONNABORTED
        /*
         * Shutdown the socket.  This will cause the select in the
         * daemon to wake up, and then the accept will get ECONNABORTED
@@ -185,31 +207,19 @@ portal_root(mp, vpp)
        struct mount *mp;
        struct vnode **vpp;
 {
        struct mount *mp;
        struct vnode **vpp;
 {
+       struct proc *p = curproc;       /* XXX */
        struct vnode *vp;
 
        struct vnode *vp;
 
-
        /*
         * Return locked reference to root.
         */
        vp = VFSTOPORTAL(mp)->pm_root;
        VREF(vp);
        /*
         * Return locked reference to root.
         */
        vp = VFSTOPORTAL(mp)->pm_root;
        VREF(vp);
-       VOP_LOCK(vp);
+       vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
        *vpp = vp;
        return (0);
 }
 
        *vpp = vp;
        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;
 int
 portal_statfs(mp, sbp, p)
        struct mount *mp;
@@ -217,7 +227,6 @@ portal_statfs(mp, sbp, p)
        struct proc *p;
 {
 
        struct proc *p;
 {
 
-       sbp->f_type = MOUNT_PORTAL;
        sbp->f_flags = 0;
        sbp->f_bsize = DEV_BSIZE;
        sbp->f_iosize = DEV_BSIZE;
        sbp->f_flags = 0;
        sbp->f_bsize = DEV_BSIZE;
        sbp->f_iosize = DEV_BSIZE;
@@ -227,6 +236,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_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);
                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 +244,17 @@ portal_statfs(mp, sbp, p)
        return (0);
 }
 
        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,
 
 struct vfsops portal_vfsops = {
        portal_mount,
@@ -284,4 +268,5 @@ struct vfsops portal_vfsops = {
        portal_fhtovp,
        portal_vptofh,
        portal_init,
        portal_fhtovp,
        portal_vptofh,
        portal_init,
+       portal_sysctl,
 };
 };