BSD 4_4_Lite1 release
[unix-history] / usr / src / sys / ufs / lfs / lfs_inode.c
index 666d6d8..1a06aa2 100644 (file)
@@ -2,9 +2,35 @@
  * Copyright (c) 1986, 1989, 1991, 1993
  *     The Regents of the University of California.  All rights reserved.
  *
  * Copyright (c) 1986, 1989, 1991, 1993
  *     The Regents of the University of California.  All rights reserved.
  *
- * %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.
  *
  *
- *     @(#)lfs_inode.c 8.3 (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.
+ *
+ *     @(#)lfs_inode.c 8.5 (Berkeley) 12/30/93
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -66,21 +92,22 @@ lfs_update(ap)
        if (vp->v_mount->mnt_flag & MNT_RDONLY)
                return (0);
        ip = VTOI(vp);
        if (vp->v_mount->mnt_flag & MNT_RDONLY)
                return (0);
        ip = VTOI(vp);
-       if ((ip->i_flag & (IUPDATE | IACCESS | ICHANGE | IMODIFIED)) == 0)
+       if ((ip->i_flag &
+           (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0)
                return (0);
                return (0);
-       if (ip->i_flag & IACCESS)
+       if (ip->i_flag & IN_ACCESS)
                ip->i_atime.ts_sec = ap->a_access->tv_sec;
                ip->i_atime.ts_sec = ap->a_access->tv_sec;
-       if (ip->i_flag & IUPDATE) {
+       if (ip->i_flag & IN_UPDATE) {
                ip->i_mtime.ts_sec = ap->a_modify->tv_sec;
                (ip)->i_modrev++;
        }
                ip->i_mtime.ts_sec = ap->a_modify->tv_sec;
                (ip)->i_modrev++;
        }
-       if (ip->i_flag & ICHANGE)
+       if (ip->i_flag & IN_CHANGE)
                ip->i_ctime.ts_sec = time.tv_sec;
                ip->i_ctime.ts_sec = time.tv_sec;
-       ip->i_flag &= ~(IUPDATE | IACCESS | ICHANGE);
+       ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE);
 
 
-       if (!(ip->i_flag & IMODIFIED))
+       if (!(ip->i_flag & IN_MODIFIED))
                ++(VFSTOUFS(vp->v_mount)->um_lfs->lfs_uinodes);
                ++(VFSTOUFS(vp->v_mount)->um_lfs->lfs_uinodes);
-       ip->i_flag |= IMODIFIED;
+       ip->i_flag |= IN_MODIFIED;
 
        /* If sync, push back the vnode and any dirty blocks it may have. */
        return (ap->a_waitfor & LFS_SYNC ? lfs_vflush(vp) : 0);
 
        /* If sync, push back the vnode and any dirty blocks it may have. */
        return (ap->a_waitfor & LFS_SYNC ? lfs_vflush(vp) : 0);
@@ -149,7 +176,7 @@ lfs_truncate(ap)
 #endif
                bzero((char *)&ip->i_shortlink, (u_int)ip->i_size);
                ip->i_size = 0;
 #endif
                bzero((char *)&ip->i_shortlink, (u_int)ip->i_size);
                ip->i_size = 0;
-               ip->i_flag |= IUPDATE | ICHANGE;
+               ip->i_flag |= IN_CHANGE | IN_UPDATE;
                return (VOP_UPDATE(vp, &tv, &tv, 0));
        }
        vnode_pager_setsize(vp, (u_long)length);
                return (VOP_UPDATE(vp, &tv, &tv, 0));
        }
        vnode_pager_setsize(vp, (u_long)length);
@@ -158,7 +185,7 @@ lfs_truncate(ap)
 
        /* If length is larger than the file, just update the times. */
        if (ip->i_size <= length) {
 
        /* If length is larger than the file, just update the times. */
        if (ip->i_size <= length) {
-               ip->i_flag |= IUPDATE | ICHANGE;
+               ip->i_flag |= IN_CHANGE | IN_UPDATE;
                return (VOP_UPDATE(vp, &tv, &tv, 0));
        }
 
                return (VOP_UPDATE(vp, &tv, &tv, 0));
        }
 
@@ -283,7 +310,7 @@ lfs_truncate(ap)
 #endif
        ip->i_blocks -= fsbtodb(fs, blocksreleased);
        fs->lfs_bfree +=  fsbtodb(fs, blocksreleased);
 #endif
        ip->i_blocks -= fsbtodb(fs, blocksreleased);
        fs->lfs_bfree +=  fsbtodb(fs, blocksreleased);
-       ip->i_flag |= IUPDATE | ICHANGE;
+       ip->i_flag |= IN_CHANGE | IN_UPDATE;
        /*
         * Traverse dirty block list counting number of dirty buffers
         * that are being deleted out of the cache, so that the lfs_avail
        /*
         * Traverse dirty block list counting number of dirty buffers
         * that are being deleted out of the cache, so that the lfs_avail
@@ -291,7 +318,7 @@ lfs_truncate(ap)
         */
        a_released = 0;
        i_released = 0;
         */
        a_released = 0;
        i_released = 0;
-       for (bp = vp->v_dirtyblkhd.le_next; bp; bp = bp->b_vnbufs.qe_next)
+       for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = bp->b_vnbufs.le_next)
                if (bp->b_flags & B_LOCKED) {
                        ++a_released;
                        /*
                if (bp->b_flags & B_LOCKED) {
                        ++a_released;
                        /*