BSD 4_4_Lite1 release
[unix-history] / usr / src / sys / ufs / lfs / lfs_vfsops.c
index 335fc32..0c8186e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 1989, 1991, 1993
+ * Copyright (c) 1989, 1991, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  *     The Regents of the University of California.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,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.
  *
- *     @(#)lfs_vfsops.c        8.1 (Berkeley) 6/11/93
+ *     @(#)lfs_vfsops.c        8.7 (Berkeley) 4/16/94
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -65,7 +65,7 @@ struct vfsops lfs_vfsops = {
        lfs_mount,
        ufs_start,
        lfs_unmount,
        lfs_mount,
        ufs_start,
        lfs_unmount,
-       lfs_root,
+       ufs_root,
        ufs_quotactl,
        lfs_statfs,
        lfs_sync,
        ufs_quotactl,
        lfs_statfs,
        lfs_sync,
@@ -104,8 +104,9 @@ lfs_mount(mp, path, data, ndp, p)
                return (error);
 
        /* Until LFS can do NFS right.          XXX */
                return (error);
 
        /* Until LFS can do NFS right.          XXX */
-       if (args.exflags & MNT_EXPORTED)
+       if (args.export.ex_flags & MNT_EXPORTED)
                return (EINVAL);
                return (EINVAL);
+
        /*
         * If updating, check whether changing from read-only to
         * read/write; if there is no device name, that's all we do.
        /*
         * If updating, check whether changing from read-only to
         * read/write; if there is no device name, that's all we do.
@@ -125,17 +126,7 @@ lfs_mount(mp, path, data, ndp, p)
                        /*
                         * Process export requests.
                         */
                        /*
                         * Process export requests.
                         */
-                       if (args.exflags & MNT_EXPORTED) {
-                               if (error = ufs_hang_addrlist(mp, &args))
-                                       return (error);
-                               mp->mnt_flag |= MNT_EXPORTED;
-                       }
-                       if (args.exflags & MNT_DELEXPORT) {
-                               ufs_free_addrlist(ump);
-                               mp->mnt_flag &=
-                                   ~(MNT_EXPORTED | MNT_DEFEXPORTED);
-                       }
-                       return (0);
+                       return (vfs_export(mp, &ump->um_export, &args.export));
                }
        }
        /*
                }
        }
        /*
@@ -215,11 +206,11 @@ lfs_mountfs(devvp, mp, p)
         * (except for root, which might share swap device for miniroot).
         * Flush out any old buffers remaining from a previous use.
         */
         * (except for root, which might share swap device for miniroot).
         * Flush out any old buffers remaining from a previous use.
         */
-       if (error = ufs_mountedon(devvp))
+       if (error = vfs_mountedon(devvp))
                return (error);
        if (vcount(devvp) > 1 && devvp != rootvp)
                return (EBUSY);
                return (error);
        if (vcount(devvp) > 1 && devvp != rootvp)
                return (EBUSY);
-       if (error = vinvalbuf(devvp, 1, p->p_ucred, p, 0, 0))
+       if (error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0))
                return (error);
 
        ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
                return (error);
 
        ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
@@ -245,7 +236,7 @@ lfs_mountfs(devvp, mp, p)
        /* Read in the superblock. */
        if (error = bread(devvp, LFS_LABELPAD / size, LFS_SBPAD, NOCRED, &bp))
                goto out;
        /* Read in the superblock. */
        if (error = bread(devvp, LFS_LABELPAD / size, LFS_SBPAD, NOCRED, &bp))
                goto out;
-       fs = bp->b_un.b_lfs;
+       fs = (struct lfs *)bp->b_data;
 
        /* Check the basics. */
        if (fs->lfs_magic != LFS_MAGIC || fs->lfs_bsize > MAXBSIZE ||
 
        /* Check the basics. */
        if (fs->lfs_magic != LFS_MAGIC || fs->lfs_bsize > MAXBSIZE ||
@@ -257,7 +248,7 @@ lfs_mountfs(devvp, mp, p)
        /* Allocate the mount structure, copy the superblock into it. */
        ump = (struct ufsmount *)malloc(sizeof *ump, M_UFSMNT, M_WAITOK);
        fs = ump->um_lfs = malloc(sizeof(struct lfs), M_UFSMNT, M_WAITOK);
        /* Allocate the mount structure, copy the superblock into it. */
        ump = (struct ufsmount *)malloc(sizeof *ump, M_UFSMNT, M_WAITOK);
        fs = ump->um_lfs = malloc(sizeof(struct lfs), M_UFSMNT, M_WAITOK);
-       bcopy(bp->b_un.b_addr, fs, sizeof(struct lfs));
+       bcopy(bp->b_data, fs, sizeof(struct lfs));
        if (sizeof(struct lfs) < LFS_SBPAD)                     /* XXX why? */
                bp->b_flags |= B_INVAL;
        brelse(bp);
        if (sizeof(struct lfs) < LFS_SBPAD)                     /* XXX why? */
                bp->b_flags |= B_INVAL;
        brelse(bp);
@@ -333,7 +324,7 @@ lfs_unmount(mp, mntflags, p)
 
        flags = 0;
        if (mntflags & MNT_FORCE) {
 
        flags = 0;
        if (mntflags & MNT_FORCE) {
-               if (!doforce || mp == rootfs)
+               if (!doforce || (mp->mnt_flag & MNT_ROOTFS))
                        return (EINVAL);
                flags |= FORCECLOSE;
        }
                        return (EINVAL);
                flags |= FORCECLOSE;
        }
@@ -360,7 +351,7 @@ lfs_unmount(mp, mntflags, p)
        fs->lfs_clean = 1;
        if (error = VFS_SYNC(mp, 1, p->p_ucred, p))
                return (error);
        fs->lfs_clean = 1;
        if (error = VFS_SYNC(mp, 1, p->p_ucred, p))
                return (error);
-       if (fs->lfs_ivnode->v_dirtyblkhd.le_next)
+       if (fs->lfs_ivnode->v_dirtyblkhd.lh_first)
                panic("lfs_unmount: still dirty blocks on ifile vnode\n");
        vrele(fs->lfs_ivnode);
        vgone(fs->lfs_ivnode);
                panic("lfs_unmount: still dirty blocks on ifile vnode\n");
        vrele(fs->lfs_ivnode);
        vgone(fs->lfs_ivnode);
@@ -377,23 +368,6 @@ lfs_unmount(mp, mntflags, p)
        return (error);
 }
 
        return (error);
 }
 
-/*
- * Return root of a filesystem
- */
-int
-lfs_root(mp, vpp)
-       struct mount *mp;
-       struct vnode **vpp;
-{
-       struct vnode *nvp;
-       int error;
-
-       if (error = VFS_VGET(mp, (ino_t)ROOTINO, &nvp))
-               return (error);
-       *vpp = nvp;
-       return (0);
-}
-
 /*
  * Get file system statistics.
  */
 /*
  * Get file system statistics.
  */
@@ -441,7 +415,6 @@ lfs_sync(mp, waitfor, cred, p)
        struct ucred *cred;
        struct proc *p;
 {
        struct ucred *cred;
        struct proc *p;
 {
-       extern int syncprt;
        int error;
 
        /* All syncs must be checkpoints until roll-forward is implemented. */
        int error;
 
        /* All syncs must be checkpoints until roll-forward is implemented. */
@@ -527,7 +500,7 @@ lfs_vget(mp, ino, vpp)
                *vpp = NULL;
                return (error);
        }
                *vpp = NULL;
                return (error);
        }
-       ip->i_din = *lfs_ifind(fs, ino, bp->b_un.b_dino);
+       ip->i_din = *lfs_ifind(fs, ino, (struct dinode *)bp->b_data);
        brelse(bp);
 
        /*
        brelse(bp);
 
        /*