changes for 4.4BSD-Lite requested by USL
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 21 Sep 1993 22:36:20 +0000 (14:36 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 21 Sep 1993 22:36:20 +0000 (14:36 -0800)
SCCS-vsn: sys/ufs/ffs/ufs_disksubr.c 8.3
SCCS-vsn: sys/ufs/ufs/ufs_disksubr.c 8.3
SCCS-vsn: sys/ufs/ffs/ufs_inode.c 8.2
SCCS-vsn: sys/ufs/ufs/ufs_inode.c 8.2
SCCS-vsn: sys/ufs/ffs/ufs_lookup.c 8.2
SCCS-vsn: sys/ufs/ufs/ufs_lookup.c 8.2
SCCS-vsn: sys/ufs/ffs/ufs_vnops.c 8.3
SCCS-vsn: sys/ufs/ufs/ufs_vnops.c 8.3
SCCS-vsn: sys/ufs/ffs/ufs_bmap.c 8.3
SCCS-vsn: sys/ufs/ufs/ufs_bmap.c 8.3
SCCS-vsn: sys/ufs/ffs/ufs_readwrite.c 8.2
SCCS-vsn: sys/ufs/ufs/ufs_readwrite.c 8.2
SCCS-vsn: sys/ufs/lfs/lfs_subr.c 8.2
SCCS-vsn: sys/ufs/lfs/lfs.h 8.2
SCCS-vsn: sys/ufs/lfs/lfs_bio.c 8.2
SCCS-vsn: sys/ufs/lfs/lfs_vnops.c 8.3
SCCS-vsn: sys/ufs/lfs/lfs_vfsops.c 8.2
SCCS-vsn: sys/ufs/lfs/lfs_alloc.c 8.2
SCCS-vsn: sys/ufs/lfs/lfs_inode.c 8.3
SCCS-vsn: sys/ufs/lfs/lfs_segment.c 8.2
SCCS-vsn: sys/ufs/lfs/lfs_syscalls.c 8.2
SCCS-vsn: sys/kern/vfs_cluster.c 8.2
SCCS-vsn: sys/kern/subr_prof.c 8.2
SCCS-vsn: sys/kern/tty.c 8.3
SCCS-vsn: sys/kern/kern_sig.c 8.3
SCCS-vsn: sys/kern/kern_fork.c 8.2
SCCS-vsn: sys/kern/kern_synch.c 8.3
SCCS-vsn: sys/kern/kern_proc.c 8.2
SCCS-vsn: sys/kern/kern_physio.c 8.2
SCCS-vsn: sys/kern/vfs_bio.c 8.3
SCCS-vsn: sys/kern/kern_exit.c 8.2
SCCS-vsn: sys/kern/sys_generic.c 8.3
SCCS-vsn: sys/kern/sys_process.c 8.2

33 files changed:
usr/src/sys/kern/kern_exit.c
usr/src/sys/kern/kern_fork.c
usr/src/sys/kern/kern_physio.c
usr/src/sys/kern/kern_proc.c
usr/src/sys/kern/kern_sig.c
usr/src/sys/kern/kern_synch.c
usr/src/sys/kern/subr_prof.c
usr/src/sys/kern/sys_generic.c
usr/src/sys/kern/sys_process.c
usr/src/sys/kern/tty.c
usr/src/sys/kern/vfs_bio.c
usr/src/sys/kern/vfs_cluster.c
usr/src/sys/ufs/ffs/ufs_bmap.c
usr/src/sys/ufs/ffs/ufs_disksubr.c
usr/src/sys/ufs/ffs/ufs_inode.c
usr/src/sys/ufs/ffs/ufs_lookup.c
usr/src/sys/ufs/ffs/ufs_readwrite.c
usr/src/sys/ufs/ffs/ufs_vnops.c
usr/src/sys/ufs/lfs/lfs.h
usr/src/sys/ufs/lfs/lfs_alloc.c
usr/src/sys/ufs/lfs/lfs_bio.c
usr/src/sys/ufs/lfs/lfs_inode.c
usr/src/sys/ufs/lfs/lfs_segment.c
usr/src/sys/ufs/lfs/lfs_subr.c
usr/src/sys/ufs/lfs/lfs_syscalls.c
usr/src/sys/ufs/lfs/lfs_vfsops.c
usr/src/sys/ufs/lfs/lfs_vnops.c
usr/src/sys/ufs/ufs/ufs_bmap.c
usr/src/sys/ufs/ufs/ufs_disksubr.c
usr/src/sys/ufs/ufs/ufs_inode.c
usr/src/sys/ufs/ufs/ufs_lookup.c
usr/src/sys/ufs/ufs/ufs_readwrite.c
usr/src/sys/ufs/ufs/ufs_vnops.c

index 96d7bf4..7aa1695 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_exit.c 8.1 (Berkeley) %G%
+ *     @(#)kern_exit.c 8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -294,11 +294,7 @@ wait4(p, uap, retval)
 #define        wait1   wait4
 #endif
 
 #define        wait1   wait4
 #endif
 
-/*
- * Wait: check child processes to see if any have exited,
- * stopped under trace, or (optionally) stopped by a signal.
- * Pass back status and deallocate exited child's proc structure.
- */
+int
 wait1(q, uap, retval)
        register struct proc *q;
        register struct wait_args *uap;
 wait1(q, uap, retval)
        register struct proc *q;
        register struct wait_args *uap;
index 48c3fe3..653f72f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_fork.c 8.1 (Berkeley) %G%
+ *     @(#)kern_fork.c 8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -253,7 +253,7 @@ again:
         */
        (void) splhigh();
        p2->p_stat = SRUN;
         */
        (void) splhigh();
        p2->p_stat = SRUN;
-       setrq(p2);
+       setrunqueue(p2);
        (void) spl0();
 
        /*
        (void) spl0();
 
        /*
index 4d20498..a22cedf 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.proprietary.c%
  *
  *
  * %sccs.include.proprietary.c%
  *
- *     @(#)kern_physio.c       8.1 (Berkeley) %G%
+ *     @(#)kern_physio.c       8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
index f8b202a..c41055d 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_proc.c 8.1 (Berkeley) %G%
+ *     @(#)kern_proc.c 8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -105,14 +105,14 @@ inferior(p)
  */
 struct proc *
 pfind(pid)
  */
 struct proc *
 pfind(pid)
-       register pid;
+       register pid_t pid;
 {
 {
-       register struct proc *p = pidhash[PIDHASH(pid)];
+       register struct proc *p;
 
 
-       for (; p; p = p->p_hash)
+       for (p = pidhash[PIDHASH(pid)]; p != NULL; p = p->p_hash)
                if (p->p_pid == pid)
                        return (p);
                if (p->p_pid == pid)
                        return (p);
-       return ((struct proc *)0);
+       return (NULL);
 }
 
 /*
 }
 
 /*
@@ -122,12 +122,13 @@ struct pgrp *
 pgfind(pgid)
        register pid_t pgid;
 {
 pgfind(pgid)
        register pid_t pgid;
 {
-       register struct pgrp *pgrp = pgrphash[PIDHASH(pgid)];
+       register struct pgrp *pgrp;
 
 
-       for (; pgrp; pgrp = pgrp->pg_hforw)
+       for (pgrp = pgrphash[PIDHASH(pgid)];
+           pgrp != NULL; pgrp = pgrp->pg_hforw)
                if (pgrp->pg_id == pgid)
                        return (pgrp);
                if (pgrp->pg_id == pgid)
                        return (pgrp);
-       return ((struct pgrp *)0);
+       return (NULL);
 }
 
 /*
 }
 
 /*
@@ -144,7 +145,7 @@ enterpgrp(p, pgid, mksess)
        int n;
 
 #ifdef DIAGNOSTIC
        int n;
 
 #ifdef DIAGNOSTIC
-       if (pgrp && mksess)     /* firewalls */
+       if (pgrp != NULL && mksess)     /* firewalls */
                panic("enterpgrp: setsid into non-empty pgrp");
        if (SESS_LEADER(p))
                panic("enterpgrp: session leader attempted setpgrp");
                panic("enterpgrp: setsid into non-empty pgrp");
        if (SESS_LEADER(p))
                panic("enterpgrp: session leader attempted setpgrp");
index bb5bc93..2f702a4 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_sig.c  8.2 (Berkeley) %G%
+ *     @(#)kern_sig.c  8.3 (Berkeley) %G%
  */
 
 #define        SIGPROP         /* include signal properties table */
  */
 
 #define        SIGPROP         /* include signal properties table */
@@ -788,10 +788,10 @@ psignal(p, signum)
                }
 
                /*
                }
 
                /*
-                * If process is sleeping interruptibly, then
-                * simulate a wakeup so that when it is continued,
-                * it will be made runnable and can look at the signal.
-                * But don't setrun the process, leave it stopped.
+                * If process is sleeping interruptibly, then simulate a
+                * wakeup so that when it is continued, it will be made
+                * runnable and can look at the signal.  But don't make
+                * the process runnable, leave it stopped.
                 */
                if (p->p_wchan && p->p_flag & SSINTR)
                        unsleep(p);
                 */
                if (p->p_wchan && p->p_flag & SSINTR)
                        unsleep(p);
@@ -816,7 +816,7 @@ runfast:
        if (p->p_pri > PUSER)
                p->p_pri = PUSER;
 run:
        if (p->p_pri > PUSER)
                p->p_pri = PUSER;
 run:
-       setrun(p);
+       setrunnable(p);
 out:
        splx(s);
 }
 out:
        splx(s);
 }
index 3bcdb7b..58543dd 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_synch.c        8.2 (Berkeley) %G%
+ *     @(#)kern_synch.c        8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -178,7 +178,7 @@ schedcpu(arg)
                            (p->p_pri / PPQ) != (p->p_usrpri / PPQ)) {
                                remrq(p);
                                p->p_pri = p->p_usrpri;
                            (p->p_pri / PPQ) != (p->p_usrpri / PPQ)) {
                                remrq(p);
                                p->p_pri = p->p_usrpri;
-                               setrq(p);
+                               setrunqueue(p);
                        } else
                                p->p_pri = p->p_usrpri;
                }
                        } else
                                p->p_pri = p->p_usrpri;
                }
@@ -361,7 +361,7 @@ endtsleep(arg)
        s = splhigh();
        if (p->p_wchan) {
                if (p->p_stat == SSLEEP)
        s = splhigh();
        if (p->p_wchan) {
                if (p->p_stat == SSLEEP)
-                       setrun(p);
+                       setrunnable(p);
                else
                        unsleep(p);
                p->p_flag |= STIMO;
                else
                        unsleep(p);
                p->p_flag |= STIMO;
@@ -479,13 +479,13 @@ restart:
                        if (qp->sq_tailp == &p->p_link)
                                qp->sq_tailp = q;
                        if (p->p_stat == SSLEEP) {
                        if (qp->sq_tailp == &p->p_link)
                                qp->sq_tailp = q;
                        if (p->p_stat == SSLEEP) {
-                               /* OPTIMIZED INLINE EXPANSION OF setrun(p) */
+                               /* OPTIMIZED EXPANSION OF setrunnable(p); */
                                if (p->p_slptime > 1)
                                        updatepri(p);
                                p->p_slptime = 0;
                                p->p_stat = SRUN;
                                if (p->p_flag & SLOAD)
                                if (p->p_slptime > 1)
                                        updatepri(p);
                                p->p_slptime = 0;
                                p->p_stat = SRUN;
                                if (p->p_flag & SLOAD)
-                                       setrq(p);
+                                       setrunqueue(p);
                                /*
                                 * Since curpriority is a user priority,
                                 * p->p_pri is always better than curpriority.
                                /*
                                 * Since curpriority is a user priority,
                                 * p->p_pri is always better than curpriority.
@@ -578,21 +578,18 @@ rqinit()
  * and awakening the swapper if it isn't in memory.
  */
 void
  * and awakening the swapper if it isn't in memory.
  */
 void
-setrun(p)
+setrunnable(p)
        register struct proc *p;
 {
        register int s;
 
        s = splhigh();
        switch (p->p_stat) {
        register struct proc *p;
 {
        register int s;
 
        s = splhigh();
        switch (p->p_stat) {
-
        case 0:
        case 0:
-       case SWAIT:
        case SRUN:
        case SZOMB:
        default:
        case SRUN:
        case SZOMB:
        default:
-               panic("setrun");
-
+               panic("setrunnable");
        case SSTOP:
        case SSLEEP:
                unsleep(p);             /* e.g. when sending signals */
        case SSTOP:
        case SSLEEP:
                unsleep(p);             /* e.g. when sending signals */
@@ -603,7 +600,7 @@ setrun(p)
        }
        p->p_stat = SRUN;
        if (p->p_flag & SLOAD)
        }
        p->p_stat = SRUN;
        if (p->p_flag & SLOAD)
-               setrq(p);
+               setrunqueue(p);
        splx(s);
        if (p->p_slptime > 1)
                updatepri(p);
        splx(s);
        if (p->p_slptime > 1)
                updatepri(p);
index 30c2a2a..54cbbcc 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)subr_prof.c 8.1 (Berkeley) %G%
+ *     @(#)subr_prof.c 8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -114,8 +114,8 @@ sysctl_doprof(name, namelen, oldp, oldlenp, newp, newlen, p)
  * 1.0 is represented as 0x10000.  A scale factor of 0 turns off profiling.
  */
 struct profil_args {
  * 1.0 is represented as 0x10000.  A scale factor of 0 turns off profiling.
  */
 struct profil_args {
-       caddr_t buf;
-       u_int   bufsize;
+       caddr_t samples;
+       u_int   size;
        u_int   offset;
        u_int   scale;
 };
        u_int   offset;
        u_int   scale;
 };
@@ -135,13 +135,16 @@ profil(p, uap, retval)
                return (0);
        }
        upp = &p->p_stats->p_prof;
                return (0);
        }
        upp = &p->p_stats->p_prof;
-       s = splstatclock(); /* block profile interrupts while changing state */
-       upp->pr_base = uap->buf;
-       upp->pr_size = uap->bufsize;
+
+       /* Block profile interrupts while changing state. */
+       s = splstatclock();
        upp->pr_off = uap->offset;
        upp->pr_scale = uap->scale;
        upp->pr_off = uap->offset;
        upp->pr_scale = uap->scale;
+       upp->pr_base = uap->samples;
+       upp->pr_size = uap->size;
        startprofclock(p);
        splx(s);
        startprofclock(p);
        splx(s);
+
        return (0);
 }
 
        return (0);
 }
 
index a5db90f..b02d7cb 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)sys_generic.c       8.2 (Berkeley) %G%
+ *     @(#)sys_generic.c       8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -335,43 +335,44 @@ ioctl(p, uap, retval)
        int *retval;
 {
        register struct file *fp;
        int *retval;
 {
        register struct file *fp;
-       register struct filedesc *fdp = p->p_fd;
+       register struct filedesc *fdp;
        register int com, error;
        register u_int size;
        register int com, error;
        register u_int size;
-       caddr_t memp = 0;
+       caddr_t data, memp;
+       int tmp;
 #define STK_PARAMS     128
        char stkbuf[STK_PARAMS];
 #define STK_PARAMS     128
        char stkbuf[STK_PARAMS];
-       caddr_t data = stkbuf;
-       int tmp;
 
 
+       fdp = p->p_fd;
        if ((u_int)uap->fd >= fdp->fd_nfiles ||
            (fp = fdp->fd_ofiles[uap->fd]) == NULL)
                return (EBADF);
        if ((u_int)uap->fd >= fdp->fd_nfiles ||
            (fp = fdp->fd_ofiles[uap->fd]) == NULL)
                return (EBADF);
-       if ((fp->f_flag & (FREAD|FWRITE)) == 0)
+
+       if ((fp->f_flag & (FREAD | FWRITE)) == 0)
                return (EBADF);
                return (EBADF);
-       com = uap->com;
 
 
-       if (com == FIOCLEX) {
-               fdp->fd_ofileflags[uap->fd] |= UF_EXCLOSE;
-               return (0);
-       }
-       if (com == FIONCLEX) {
+       switch (com = uap->com) {
+       case FIONCLEX:
                fdp->fd_ofileflags[uap->fd] &= ~UF_EXCLOSE;
                return (0);
                fdp->fd_ofileflags[uap->fd] &= ~UF_EXCLOSE;
                return (0);
+       case FIOCLEX:
+               fdp->fd_ofileflags[uap->fd] |= UF_EXCLOSE;
+               return (0);
        }
 
        /*
        }
 
        /*
-        * Interpret high order word to find
-        * amount of data to be copied to/from the
-        * user's address space.
+        * Interpret high order word to find amount of data to be
+        * copied to/from the user's address space.
         */
        size = IOCPARM_LEN(com);
        if (size > IOCPARM_MAX)
                return (ENOTTY);
         */
        size = IOCPARM_LEN(com);
        if (size > IOCPARM_MAX)
                return (ENOTTY);
+       memp = NULL;
        if (size > sizeof (stkbuf)) {
                memp = (caddr_t)malloc((u_long)size, M_IOCTLOPS, M_WAITOK);
                data = memp;
        if (size > sizeof (stkbuf)) {
                memp = (caddr_t)malloc((u_long)size, M_IOCTLOPS, M_WAITOK);
                data = memp;
-       }
+       } else
+               data = stkbuf;
        if (com&IOC_IN) {
                if (size) {
                        error = copyin(uap->data, data, (u_int)size);
        if (com&IOC_IN) {
                if (size) {
                        error = copyin(uap->data, data, (u_int)size);
@@ -641,7 +642,7 @@ selwakeup(sip)
                s = splhigh();
                if (p->p_wchan == (caddr_t)&selwait) {
                        if (p->p_stat == SSLEEP)
                s = splhigh();
                if (p->p_wchan == (caddr_t)&selwait) {
                        if (p->p_stat == SSLEEP)
-                               setrun(p);
+                               setrunnable(p);
                        else
                                unsleep(p);
                } else if (p->p_flag & SSEL)
                        else
                                unsleep(p);
                } else if (p->p_flag & SSEL)
index 2dc56a3..5c09d76 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.proprietary.c%
  *
  *
  * %sccs.include.proprietary.c%
  *
- *     @(#)sys_process.c       8.1 (Berkeley) %G%
+ *     @(#)sys_process.c       8.2 (Berkeley) %G%
  */
 
 #define IPCREG
  */
 
 #define IPCREG
@@ -105,7 +105,7 @@ ptrace(curp, uap, retval)
        p->p_flag &= ~SWTED;
        while (ipc.ip_req > 0) {
                if (p->p_stat==SSTOP)
        p->p_flag &= ~SWTED;
        while (ipc.ip_req > 0) {
                if (p->p_stat==SSTOP)
-                       setrun(p);
+                       setrunnable(p);
                sleep((caddr_t)&ipc, IPCPRI);
        }
        *retval = ipc.ip_data;
                sleep((caddr_t)&ipc, IPCPRI);
        }
        *retval = ipc.ip_data;
index 3ae158a..455c472 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tty.c       8.2 (Berkeley) %G%
+ *     @(#)tty.c       8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -322,7 +322,7 @@ ttyinput(c, tp)
                        catq(&tp->t_rawq, &tp->t_canq);
                        ttwakeup(tp);
                } else if (tp->t_rocount++ == 0)
                        catq(&tp->t_rawq, &tp->t_canq);
                        ttwakeup(tp);
                } else if (tp->t_rocount++ == 0)
-                       tp->t_rocol = tp->t_col;
+                       tp->t_rocol = tp->t_column;
                if (CCEQ(cc[VQUOTE], c) && (iflag&ISTRIP))
                        tp->t_state |= TS_QUOT; /* '\' escape */
                if (ISSET(tp->t_state, TS_ERASE)) {
                if (CCEQ(cc[VQUOTE], c) && (iflag&ISTRIP))
                        tp->t_state |= TS_QUOT; /* '\' escape */
                if (ISSET(tp->t_state, TS_ERASE)) {
@@ -335,13 +335,13 @@ ttyinput(c, tp)
                        CLR(tp->t_state, TS_ERASE);
                        (void)ttyoutput('/', tp);
                }
                        CLR(tp->t_state, TS_ERASE);
                        (void)ttyoutput('/', tp);
                }
-               i = tp->t_col;
+               i = tp->t_column;
                ttyecho(c, tp);
                if (CCEQ(cc[VEOF], c) && lflag&ECHO) {
                        /*
                         * Place the cursor over the '^' of the ^D.
                         */
                ttyecho(c, tp);
                if (CCEQ(cc[VEOF], c) && lflag&ECHO) {
                        /*
                         * Place the cursor over the '^' of the ^D.
                         */
-                       i = min(2, tp->t_col - i);
+                       i = min(2, tp->t_column - i);
                        while (i > 0) {
                                (void)ttyoutput('\b', tp);
                                i--;
                        while (i > 0) {
                                (void)ttyoutput('\b', tp);
                                i--;
@@ -392,7 +392,7 @@ ttyoutput(c, tp)
        c &= TTY_CHARMASK;
        if (c == '\t' &&
            ISSET(oflag, OXTABS) && !ISSET(tp->t_lflag, EXTPROC)) {
        c &= TTY_CHARMASK;
        if (c == '\t' &&
            ISSET(oflag, OXTABS) && !ISSET(tp->t_lflag, EXTPROC)) {
-               c = 8 - (tp->t_col & 7);
+               c = 8 - (tp->t_column & 7);
                if (!ISSET(tp->t_lflag, FLUSHO)) {
                        s = spltty();           /* Don't interrupt tabs. */
                        c -= b_to_q("        ", c, &tp->t_outq);
                if (!ISSET(tp->t_lflag, FLUSHO)) {
                        s = spltty();           /* Don't interrupt tabs. */
                        c -= b_to_q("        ", c, &tp->t_outq);
@@ -400,7 +400,7 @@ ttyoutput(c, tp)
                        tp->t_outcc += c;
                        splx(s);
                }
                        tp->t_outcc += c;
                        splx(s);
                }
-               tp->t_col += c;
+               tp->t_column += c;
                return (c ? -1 : '\t');
        }
        if (c == CEOT && ISSET(oflag, ONOEOT))
                return (c ? -1 : '\t');
        }
        if (c == CEOT && ISSET(oflag, ONOEOT))
@@ -418,7 +418,7 @@ ttyoutput(c, tp)
        if (!ISSET(tp->t_lflag, FLUSHO) && putc(c, &tp->t_outq))
                return (c);
 
        if (!ISSET(tp->t_lflag, FLUSHO) && putc(c, &tp->t_outq))
                return (c);
 
-       col = tp->t_col;
+       col = tp->t_column;
        switch (CCLASS(c)) {
        case BACKSPACE:
                if (col > 0)
        switch (CCLASS(c)) {
        case BACKSPACE:
                if (col > 0)
@@ -437,7 +437,7 @@ ttyoutput(c, tp)
                col = (col + 8) & ~7;
                break;
        }
                col = (col + 8) & ~7;
                break;
        }
-       tp->t_col = col;
+       tp->t_column = col;
        return (-1);
 }
 
        return (-1);
 }
 
@@ -1309,7 +1309,7 @@ loop:
                        tp->t_rocount = 0;
                        i = b_to_q(cp, ce, &tp->t_outq);
                        ce -= i;
                        tp->t_rocount = 0;
                        i = b_to_q(cp, ce, &tp->t_outq);
                        ce -= i;
-                       tp->t_col += ce;
+                       tp->t_column += ce;
                        cp += ce, cc -= ce, tk_nout += ce;
                        tp->t_outcc += ce;
                        if (i > 0) {
                        cp += ce, cc -= ce, tk_nout += ce;
                        tp->t_outcc += ce;
                        if (i > 0) {
@@ -1402,9 +1402,9 @@ ttyrub(c, tp)
                                return;
                        }
                        s = spltty();
                                return;
                        }
                        s = spltty();
-                       savecol = tp->t_col;
+                       savecol = tp->t_column;
                        tp->t_lflag |= FLUSHO;
                        tp->t_lflag |= FLUSHO;
-                       tp->t_col = tp->t_rocol;
+                       tp->t_column = tp->t_rocol;
                        cp = tp->t_rawq.c_cf;
                                tabc = *cp;     /* XXX FIX NEXTC */
                        for (; cp; cp = nextc(&tp->t_rawq, cp, &tabc))
                        cp = tp->t_rawq.c_cf;
                                tabc = *cp;     /* XXX FIX NEXTC */
                        for (; cp; cp = nextc(&tp->t_rawq, cp, &tabc))
@@ -1414,8 +1414,8 @@ ttyrub(c, tp)
                        splx(s);
 
                        /* savecol will now be length of the tab. */
                        splx(s);
 
                        /* savecol will now be length of the tab. */
-                       savecol -= tp->t_col;
-                       tp->t_col += savecol;
+                       savecol -= tp->t_column;
+                       tp->t_column += savecol;
                        if (savecol > 8)
                                savecol = 8;            /* overflow screw */
                        while (--savecol >= 0)
                        if (savecol > 8)
                                savecol = 8;            /* overflow screw */
                        while (--savecol >= 0)
index acb8198..fe22e38 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)vfs_bio.c   8.2 (Berkeley) %G%
+ *     @(#)vfs_bio.c   8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -100,7 +100,7 @@ bufinit()
                bp->b_dev = NODEV;
                bp->b_rcred = NOCRED;
                bp->b_wcred = NOCRED;
                bp->b_dev = NODEV;
                bp->b_rcred = NOCRED;
                bp->b_wcred = NOCRED;
-               bp->b_un.b_addr = buffers + i * MAXBSIZE;
+               bp->b_data = buffers + i * MAXBSIZE;
                if (i < residual)
                        bp->b_bufsize = (base + 1) * CLBYTES;
                else
                if (i < residual)
                        bp->b_bufsize = (base + 1) * CLBYTES;
                else
@@ -572,7 +572,7 @@ allocbuf(tp, size)
                bremfree(ep);
                ep->b_flags |= B_BUSY;
                splx(s);
                bremfree(ep);
                ep->b_flags |= B_BUSY;
                splx(s);
-               pagemove(tp->b_un.b_addr + sizealloc, ep->b_un.b_addr,
+               pagemove((char *)tp->b_data + sizealloc, ep->b_data,
                    (int)tp->b_bufsize - sizealloc);
                ep->b_bufsize = tp->b_bufsize - sizealloc;
                tp->b_bufsize = sizealloc;
                    (int)tp->b_bufsize - sizealloc);
                ep->b_bufsize = tp->b_bufsize - sizealloc;
                tp->b_bufsize = sizealloc;
@@ -592,8 +592,8 @@ allocbuf(tp, size)
                        /* void */;
                if (take >= bp->b_bufsize)
                        take = bp->b_bufsize;
                        /* void */;
                if (take >= bp->b_bufsize)
                        take = bp->b_bufsize;
-               pagemove(&bp->b_un.b_addr[bp->b_bufsize - take],
-                   &tp->b_un.b_addr[tp->b_bufsize], take);
+               pagemove(&((char *)bp->b_data)[bp->b_bufsize - take],
+                   &((char *)tp->b_data)[tp->b_bufsize], take);
                tp->b_bufsize += take;
                bp->b_bufsize = bp->b_bufsize - take;
                if (bp->b_bcount > bp->b_bufsize)
                tp->b_bufsize += take;
                bp->b_bufsize = bp->b_bufsize - take;
                if (bp->b_bcount > bp->b_bufsize)
index 685221e..159f855 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)vfs_cluster.c       8.1 (Berkeley) %G%
+ *     @(#)vfs_cluster.c       8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -301,10 +301,10 @@ cluster_callback(bp)
        b_save = (struct cluster_save *)(bp->b_saveaddr);
        bp->b_saveaddr = b_save->bs_saveaddr;
 
        b_save = (struct cluster_save *)(bp->b_saveaddr);
        bp->b_saveaddr = b_save->bs_saveaddr;
 
-       cp = bp->b_un.b_addr + b_save->bs_bufsize;
+       cp = (char *)bp->b_data + b_save->bs_bufsize;
        daddr = bp->b_blkno + b_save->bs_bufsize / DEV_BSIZE;
        for (tbp = b_save->bs_children; b_save->bs_nchildren--; ++tbp) {
        daddr = bp->b_blkno + b_save->bs_bufsize / DEV_BSIZE;
        for (tbp = b_save->bs_children; b_save->bs_nchildren--; ++tbp) {
-               pagemove(cp, (*tbp)->b_un.b_addr, (*tbp)->b_bufsize);
+               pagemove(cp, (*tbp)->b_data, (*tbp)->b_bufsize);
                cp += (*tbp)->b_bufsize;
                bp->b_bufsize -= (*tbp)->b_bufsize;
                if ((*tbp)->b_blkno != daddr) {
                cp += (*tbp)->b_bufsize;
                bp->b_bufsize -= (*tbp)->b_bufsize;
                if ((*tbp)->b_blkno != daddr) {
@@ -480,7 +480,7 @@ redo:
 
        bp->b_flags |= B_CALL;
        bp->b_iodone = cluster_callback;
 
        bp->b_flags |= B_CALL;
        bp->b_iodone = cluster_callback;
-       cp = bp->b_un.b_addr + bp->b_bufsize;
+       cp = (char *)bp->b_data + bp->b_bufsize;
        for (++start_lbn, i = 0; i < len; ++i, ++start_lbn) {
                if (!incore(vp, start_lbn) || start_lbn == lbn)
                        break;
        for (++start_lbn, i = 0; i < len; ++i, ++start_lbn) {
                if (!incore(vp, start_lbn) || start_lbn == lbn)
                        break;
@@ -509,7 +509,7 @@ redo:
                        panic("Clustered write to wrong blocks");
                }
 
                        panic("Clustered write to wrong blocks");
                }
 
-               pagemove(tbp->b_un.b_daddr, cp, size);
+               pagemove(tbp->b_data, cp, size);
                bp->b_bcount += size;
                bp->b_bufsize += size;
 
                bp->b_bcount += size;
                bp->b_bufsize += size;
 
index dbc6ba6..d24f93a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_bmap.c  8.2 (Berkeley) %G%
+ *     @(#)ufs_bmap.c  8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -166,12 +166,12 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
                        }
                }
 
                        }
                }
 
-               daddr = bp->b_un.b_daddr[xap->in_off];
+               daddr = ((daddr_t *)bp->b_data)[xap->in_off];
                if (num == 1 && daddr && runp)
                        for (bn = xap->in_off + 1;
                            bn < MNINDIR(ump) && *runp < maxrun &&
                if (num == 1 && daddr && runp)
                        for (bn = xap->in_off + 1;
                            bn < MNINDIR(ump) && *runp < maxrun &&
-                           is_sequential(ump, bp->b_un.b_daddr[bn - 1],
-                           bp->b_un.b_daddr[bn]);
+                           is_sequential(ump, ((daddr_t *)bp->b_data)[bn - 1],
+                           ((daddr_t *)bp->b_data)[bn]);
                            ++bn, ++*runp);
        }
        if (bp)
                            ++bn, ++*runp);
        }
        if (bp)
index e63e109..4a3c157 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_disksubr.c      8.2 (Berkeley) %G%
+ *     @(#)ufs_disksubr.c      8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -147,8 +147,9 @@ readdisklabel(dev, strat, lp)
        (*strat)(bp);
        if (biowait(bp))
                msg = "I/O error";
        (*strat)(bp);
        if (biowait(bp))
                msg = "I/O error";
-       else for (dlp = (struct disklabel *)bp->b_un.b_addr;
-           dlp <= (struct disklabel *)(bp->b_un.b_addr+DEV_BSIZE-sizeof(*dlp));
+       else for (dlp = (struct disklabel *)bp->b_data;
+           dlp <= (struct disklabel *)((char *)bp->b_data +
+           DEV_BSIZE - sizeof(*dlp));
            dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
                if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
                        if (msg == NULL)
            dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
                if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
                        if (msg == NULL)
@@ -240,9 +241,9 @@ writedisklabel(dev, strat, lp)
        (*strat)(bp);
        if (error = biowait(bp))
                goto done;
        (*strat)(bp);
        if (error = biowait(bp))
                goto done;
-       for (dlp = (struct disklabel *)bp->b_un.b_addr;
+       for (dlp = (struct disklabel *)bp->b_data;
            dlp <= (struct disklabel *)
            dlp <= (struct disklabel *)
-             (bp->b_un.b_addr + lp->d_secsize - sizeof(*dlp));
+             ((char *)bp->b_data + lp->d_secsize - sizeof(*dlp));
            dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
                if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
                    dkcksum(dlp) == 0) {
            dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
                if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
                    dkcksum(dlp) == 0) {
index cb1f49a..a4ed2ca 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_inode.c 8.1 (Berkeley) %G%
+ *     @(#)ufs_inode.c 8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -86,10 +86,10 @@ ufs_inactive(ap)
                mode = ip->i_mode;
                ip->i_mode = 0;
                ip->i_rdev = 0;
                mode = ip->i_mode;
                ip->i_mode = 0;
                ip->i_rdev = 0;
-               ip->i_flag |= IUPD|ICHG;
+               ip->i_flag |= IUPDATE | ICHANGE;
                VOP_VFREE(vp, ip->i_number, mode);
        }
                VOP_VFREE(vp, ip->i_number, mode);
        }
-       if (ip->i_flag&(IUPD|IACC|ICHG|IMOD)) {
+       if (ip->i_flag & (IMODIFIED | IACCESS | IUPDATE | ICHANGE)) {
                tv = time;
                VOP_UPDATE(vp, &tv, &tv, 0);
        }
                tv = time;
                VOP_UPDATE(vp, &tv, &tv, 0);
        }
index 7c69612..7aa71dc 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_lookup.c        8.1 (Berkeley) %G%
+ *     @(#)ufs_lookup.c        8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -237,7 +237,7 @@ searchloop:
                 * directory. Complete checks can be run by patching
                 * "dirchk" to be true.
                 */
                 * directory. Complete checks can be run by patching
                 * "dirchk" to be true.
                 */
-               ep = (struct direct *)(bp->b_un.b_addr + entryoffsetinblock);
+               ep = (struct direct *)((char *)bp->b_data + entryoffsetinblock);
                if (ep->d_reclen == 0 ||
                    dirchk && ufs_dirbadentry(vdp, ep, entryoffsetinblock)) {
                        int i;
                if (ep->d_reclen == 0 ||
                    dirchk && ufs_dirbadentry(vdp, ep, entryoffsetinblock)) {
                        int i;
@@ -356,7 +356,7 @@ searchloop:
                                enduseful = slotoffset + slotsize;
                }
                dp->i_endoff = roundup(enduseful, DIRBLKSIZ);
                                enduseful = slotoffset + slotsize;
                }
                dp->i_endoff = roundup(enduseful, DIRBLKSIZ);
-               dp->i_flag |= IUPD|ICHG;
+               dp->i_flag |= IUPDATE | ICHANGE;
                /*
                 * We return with the directory locked, so that
                 * the parameters we set up above will still be
                /*
                 * We return with the directory locked, so that
                 * the parameters we set up above will still be
@@ -392,7 +392,7 @@ found:
        if (entryoffsetinblock + DIRSIZ(FSFMT(vdp), ep) > dp->i_size) {
                ufs_dirbad(dp, dp->i_offset, "i_size too small");
                dp->i_size = entryoffsetinblock + DIRSIZ(FSFMT(vdp), ep);
        if (entryoffsetinblock + DIRSIZ(FSFMT(vdp), ep) > dp->i_size) {
                ufs_dirbad(dp, dp->i_offset, "i_size too small");
                dp->i_size = entryoffsetinblock + DIRSIZ(FSFMT(vdp), ep);
-               dp->i_flag |= IUPD|ICHG;
+               dp->i_flag |= IUPDATE | ICHANGE;
        }
 
        /*
        }
 
        /*
@@ -657,7 +657,7 @@ ufs_direnter(ip, dvp, cnp)
                        panic("ufs_direnter: frag size");
                else if (!error) {
                        dp->i_size = roundup(dp->i_size, DIRBLKSIZ);
                        panic("ufs_direnter: frag size");
                else if (!error) {
                        dp->i_size = roundup(dp->i_size, DIRBLKSIZ);
-                       dp->i_flag |= ICHG;
+                       dp->i_flag |= ICHANGE;
                }
                return (error);
        }
                }
                return (error);
        }
@@ -727,7 +727,7 @@ ufs_direnter(ip, dvp, cnp)
        }
        bcopy((caddr_t)&newdir, (caddr_t)ep, (u_int)newentrysize);
        error = VOP_BWRITE(bp);
        }
        bcopy((caddr_t)&newdir, (caddr_t)ep, (u_int)newentrysize);
        error = VOP_BWRITE(bp);
-       dp->i_flag |= IUPD|ICHG;
+       dp->i_flag |= IUPDATE | ICHANGE;
        if (!error && dp->i_endoff && dp->i_endoff < dp->i_size)
                error = VOP_TRUNCATE(dvp, (off_t)dp->i_endoff, IO_SYNC,
                    cnp->cn_cred, cnp->cn_proc);
        if (!error && dp->i_endoff && dp->i_endoff < dp->i_size)
                error = VOP_TRUNCATE(dvp, (off_t)dp->i_endoff, IO_SYNC,
                    cnp->cn_cred, cnp->cn_proc);
@@ -766,7 +766,7 @@ ufs_dirremove(dvp, cnp)
                        return (error);
                ep->d_ino = 0;
                error = VOP_BWRITE(bp);
                        return (error);
                ep->d_ino = 0;
                error = VOP_BWRITE(bp);
-               dp->i_flag |= IUPD|ICHG;
+               dp->i_flag |= IUPDATE | ICHANGE;
                return (error);
        }
        /*
                return (error);
        }
        /*
@@ -777,7 +777,7 @@ ufs_dirremove(dvp, cnp)
                return (error);
        ep->d_reclen += dp->i_reclen;
        error = VOP_BWRITE(bp);
                return (error);
        ep->d_reclen += dp->i_reclen;
        error = VOP_BWRITE(bp);
-       dp->i_flag |= IUPD|ICHG;
+       dp->i_flag |= IUPDATE | ICHANGE;
        return (error);
 }
 
        return (error);
 }
 
@@ -802,7 +802,7 @@ ufs_dirrewrite(dp, ip, cnp)
        if (vdp->v_mount->mnt_maxsymlinklen > 0)
                ep->d_type = IFTODT(ip->i_mode);
        error = VOP_BWRITE(bp);
        if (vdp->v_mount->mnt_maxsymlinklen > 0)
                ep->d_type = IFTODT(ip->i_mode);
        error = VOP_BWRITE(bp);
-       dp->i_flag |= IUPD|ICHG;
+       dp->i_flag |= IUPDATE | ICHANGE;
        return (error);
 }
 
        return (error);
 }
 
index a5f682e..1a785ec 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_readwrite.c     8.1 (Berkeley) %G%
+ *     @(#)ufs_readwrite.c     8.2 (Berkeley) %G%
  */
 
 #ifdef LFS_READWRITE
  */
 
 #ifdef LFS_READWRITE
@@ -115,7 +115,7 @@ READ(ap)
                        xfersize = size;
                }
                if (error =
                        xfersize = size;
                }
                if (error =
-                   uiomove(bp->b_un.b_addr + blkoffset, (int)xfersize, uio))
+                   uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio))
                        break;
 
                if (S_ISREG(mode) && (xfersize + blkoffset == fs->fs_bsize ||
                        break;
 
                if (S_ISREG(mode) && (xfersize + blkoffset == fs->fs_bsize ||
@@ -125,7 +125,7 @@ READ(ap)
        }
        if (bp != NULL)
                brelse(bp);
        }
        if (bp != NULL)
                brelse(bp);
-       ip->i_flag |= IACC;
+       ip->i_flag |= IACCESS;
        return (error);
 }
 
        return (error);
 }
 
@@ -228,7 +228,7 @@ WRITE(ap)
                        xfersize = size;
 
                error =
                        xfersize = size;
 
                error =
-                   uiomove(bp->b_un.b_addr + blkoffset, (int)xfersize, uio);
+                   uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio);
 #ifdef LFS_READWRITE
                (void)VOP_BWRITE(bp);
 #else
 #ifdef LFS_READWRITE
                (void)VOP_BWRITE(bp);
 #else
@@ -246,7 +246,7 @@ WRITE(ap)
 #endif
                if (error || xfersize == 0)
                        break;
 #endif
                if (error || xfersize == 0)
                        break;
-               ip->i_flag |= IUPD | ICHG;
+               ip->i_flag |= IUPDATE | ICHANGE;
        }
        /*
         * If we successfully wrote any data, and we are not the superuser
        }
        /*
         * If we successfully wrote any data, and we are not the superuser
index dded9e9..7f6704f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_vnops.c 8.2 (Berkeley) %G%
+ *     @(#)ufs_vnops.c 8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -98,7 +98,7 @@ ufs_mknod(ap)
            ap->a_dvp, vpp, ap->a_cnp))
                return (error);
        ip = VTOI(*vpp);
            ap->a_dvp, vpp, ap->a_cnp))
                return (error);
        ip = VTOI(*vpp);
-       ip->i_flag |= IACC|IUPD|ICHG;
+       ip->i_flag |= IUPDATE | IACCESS | ICHANGE;
        if (vap->va_rdev != VNOVAL) {
                /*
                 * Want to be able to use this to make badblock
        if (vap->va_rdev != VNOVAL) {
                /*
                 * Want to be able to use this to make badblock
@@ -144,7 +144,7 @@ ufs_open(ap)
 }
 
 /*
 }
 
 /*
- * Close called
+ * Close called.
  *
  * Update the times on the inode.
  */
  *
  * Update the times on the inode.
  */
@@ -166,11 +166,6 @@ ufs_close(ap)
        return (0);
 }
 
        return (0);
 }
 
-/*
- * Check mode permission on inode pointer. Mode is READ, WRITE or EXEC.
- * The mode is shifted to select the owner/group/other fields. The
- * super user is granted all permissions.
- */
 int
 ufs_access(ap)
        struct vop_access_args /* {
 int
 ufs_access(ap)
        struct vop_access_args /* {
@@ -194,37 +189,60 @@ ufs_access(ap)
        }
 #endif
 #ifdef QUOTA
        }
 #endif
 #ifdef QUOTA
-       if (mode & VWRITE) {
+       if (mode & VWRITE)
                switch (vp->v_type) {
                switch (vp->v_type) {
-               case VREG: case VDIR: case VLNK:
+               case VDIR:
+               case VLNK:
+               case VREG:
                        if (error = getinoquota(ip))
                                return (error);
                        if (error = getinoquota(ip))
                                return (error);
+                       break;
                }
                }
-       }
-#endif /* QUOTA */
+#endif
+
+       /* If immutable bit set, nobody gets to write it. */
        if ((mode & VWRITE) && (ip->i_flags & IMMUTABLE))
                return (EPERM);
        if ((mode & VWRITE) && (ip->i_flags & IMMUTABLE))
                return (EPERM);
-       /*
-        * If you're the super-user, you always get access.
-        */
+
+       /* Otherwise, user id 0 always gets access. */
        if (cred->cr_uid == 0)
                return (0);
        if (cred->cr_uid == 0)
                return (0);
-       /*
-        * Access check is based on only one of owner, group, public.
-        * If not owner, then check group. If not a member of the
-        * group, then check public access.
-        */
-       if (cred->cr_uid != ip->i_uid) {
-               mode >>= 3;
-               gp = cred->cr_groups;
-               for (i = 0; i < cred->cr_ngroups; i++, gp++)
-                       if (ip->i_gid == *gp)
-                               goto found;
-               mode >>= 3;
-found:
-               ;
+
+       /* Otherwise, check the owner. */
+       if (cred->cr_uid == ip->i_uid)
+               switch (mode) {
+               case VEXEC:
+                       return (ip->i_mode & S_IXUSR ? 0 : EACCES);
+               case VREAD:
+                       return (ip->i_mode & S_IRUSR ? 0 : EACCES);
+               case VWRITE:
+                       return (ip->i_mode & S_IWUSR ? 0 : EACCES);
+               }
+
+       /* Otherwise, check the groups. */
+       for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++)
+               if (ip->i_gid == *gp)
+                       switch (mode) {
+                       case VEXEC:
+                               return (ip->i_mode & S_IXGRP ? 0 : EACCES);
+                       case VREAD:
+                               return (ip->i_mode & S_IRGRP ? 0 : EACCES);
+                       case VWRITE:
+                               return (ip->i_mode & S_IWGRP ? 0 : EACCES);
+                       }
+
+       /* Otherwise, check everyone else. */
+       switch (mode) {
+       case VEXEC:
+               return (ip->i_mode & S_IXOTH ? 0 : EACCES);
+       case VREAD:
+               return (ip->i_mode & S_IROTH ? 0 : EACCES);
+       case VWRITE:
+               return (ip->i_mode & S_IWOTH ? 0 : EACCES);
        }
        }
-       return ((ip->i_mode & mode) == mode ? 0 : EACCES);
+
+       panic("ufs_access: unknown mode %x\n", mode);
+       /* NOTREACHED */
 }
 
 /* ARGSUSED */
 }
 
 /* ARGSUSED */
@@ -315,7 +333,7 @@ ufs_setattr(ap)
                        ip->i_flags &= SF_SETTABLE;
                        ip->i_flags |= (vap->va_flags & UF_SETTABLE);
                }
                        ip->i_flags &= SF_SETTABLE;
                        ip->i_flags |= (vap->va_flags & UF_SETTABLE);
                }
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
                if (vap->va_flags & (IMMUTABLE | APPEND))
                        return (0);
        }
                if (vap->va_flags & (IMMUTABLE | APPEND))
                        return (0);
        }
@@ -341,9 +359,9 @@ ufs_setattr(ap)
                    (error = VOP_ACCESS(vp, VWRITE, cred, p))))
                        return (error);
                if (vap->va_atime.ts_sec != VNOVAL)
                    (error = VOP_ACCESS(vp, VWRITE, cred, p))))
                        return (error);
                if (vap->va_atime.ts_sec != VNOVAL)
-                       ip->i_flag |= IACC;
+                       ip->i_flag |= IACCESS;
                if (vap->va_mtime.ts_sec != VNOVAL)
                if (vap->va_mtime.ts_sec != VNOVAL)
-                       ip->i_flag |= IUPD | ICHG;
+                       ip->i_flag |= IUPDATE | ICHANGE;
                atimeval.tv_sec = vap->va_atime.ts_sec;
                atimeval.tv_usec = vap->va_atime.ts_nsec / 1000;
                mtimeval.tv_sec = vap->va_mtime.ts_sec;
                atimeval.tv_sec = vap->va_atime.ts_sec;
                atimeval.tv_usec = vap->va_atime.ts_nsec / 1000;
                mtimeval.tv_sec = vap->va_mtime.ts_sec;
@@ -381,8 +399,7 @@ ufs_chmod(vp, mode, cred, p)
                        return (EPERM);
        }
        ip->i_mode &= ~ALLPERMS;
                        return (EPERM);
        }
        ip->i_mode &= ~ALLPERMS;
-       ip->i_mode |= mode & ALLPERMS;
-       ip->i_flag |= ICHG;
+       ip->i_mode |= (mode & ALLPERMS) | ICHANGE;
        if ((vp->v_flag & VTEXT) && (ip->i_mode & S_ISTXT) == 0)
                (void) vnode_pager_uncache(vp);
        return (0);
        if ((vp->v_flag & VTEXT) && (ip->i_mode & S_ISTXT) == 0)
                (void) vnode_pager_uncache(vp);
        return (0);
@@ -422,8 +439,8 @@ ufs_chown(vp, uid, gid, cred, p)
            !groupmember((gid_t)gid, cred)) &&
            (error = suser(cred, &p->p_acflag)))
                return (error);
            !groupmember((gid_t)gid, cred)) &&
            (error = suser(cred, &p->p_acflag)))
                return (error);
-       ouid = ip->i_uid;
        ogid = ip->i_gid;
        ogid = ip->i_gid;
+       ouid = ip->i_uid;
 #ifdef QUOTA
        if (error = getinoquota(ip))
                return (error);
 #ifdef QUOTA
        if (error = getinoquota(ip))
                return (error);
@@ -443,8 +460,8 @@ ufs_chown(vp, uid, gid, cred, p)
                ip->i_dquot[i] = NODQUOT;
        }
 #endif
                ip->i_dquot[i] = NODQUOT;
        }
 #endif
-       ip->i_uid = uid;
        ip->i_gid = gid;
        ip->i_gid = gid;
+       ip->i_uid = uid;
 #ifdef QUOTA
        if ((error = getinoquota(ip)) == 0) {
                if (ouid == uid) {
 #ifdef QUOTA
        if ((error = getinoquota(ip)) == 0) {
                if (ouid == uid) {
@@ -466,8 +483,8 @@ ufs_chown(vp, uid, gid, cred, p)
                        ip->i_dquot[i] = NODQUOT;
                }
        }
                        ip->i_dquot[i] = NODQUOT;
                }
        }
-       ip->i_uid = ouid;
        ip->i_gid = ogid;
        ip->i_gid = ogid;
+       ip->i_uid = ouid;
        if (getinoquota(ip) == 0) {
                if (ouid == uid) {
                        dqrele(vp, ip->i_dquot[USRQUOTA]);
        if (getinoquota(ip) == 0) {
                if (ouid == uid) {
                        dqrele(vp, ip->i_dquot[USRQUOTA]);
@@ -487,7 +504,7 @@ good:
                panic("chown: lost quota");
 #endif /* QUOTA */
        if (ouid != uid || ogid != gid)
                panic("chown: lost quota");
 #endif /* QUOTA */
        if (ouid != uid || ogid != gid)
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
        if (ouid != uid && cred->cr_uid != 0)
                ip->i_mode &= ~ISUID;
        if (ogid != gid && cred->cr_uid != 0)
        if (ouid != uid && cred->cr_uid != 0)
                ip->i_mode &= ~ISUID;
        if (ogid != gid && cred->cr_uid != 0)
@@ -588,7 +605,7 @@ ufs_remove(ap)
        }
        if ((error = ufs_dirremove(dvp, ap->a_cnp)) == 0) {
                ip->i_nlink--;
        }
        if ((error = ufs_dirremove(dvp, ap->a_cnp)) == 0) {
                ip->i_nlink--;
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
        }
 out:
        if (dvp == vp)
        }
 out:
        if (dvp == vp)
@@ -642,14 +659,14 @@ ufs_link(ap)
                goto out1;
        }
        ip->i_nlink++;
                goto out1;
        }
        ip->i_nlink++;
-       ip->i_flag |= ICHG;
+       ip->i_flag |= ICHANGE;
        tv = time;
        error = VOP_UPDATE(tdvp, &tv, &tv, 1);
        if (!error)
                error = ufs_direnter(ip, vp, cnp);
        if (error) {
                ip->i_nlink--;
        tv = time;
        error = VOP_UPDATE(tdvp, &tv, &tv, 1);
        if (!error)
                error = ufs_direnter(ip, vp, cnp);
        if (error) {
                ip->i_nlink--;
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
        }
        FREE(cnp->cn_pnbuf, M_NAMEI);
 out1:
        }
        FREE(cnp->cn_pnbuf, M_NAMEI);
 out1:
@@ -958,7 +975,7 @@ abortit:
         *    may be wrong, but correctable.
         */
        ip->i_nlink++;
         *    may be wrong, but correctable.
         */
        ip->i_nlink++;
-       ip->i_flag |= ICHG;
+       ip->i_flag |= ICHANGE;
        tv = time;
        if (error = VOP_UPDATE(fvp, &tv, &tv, 1)) {
                VOP_UNLOCK(fvp);
        tv = time;
        if (error = VOP_UPDATE(fvp, &tv, &tv, 1)) {
                VOP_UNLOCK(fvp);
@@ -1017,14 +1034,14 @@ abortit:
                                goto bad;
                        }
                        dp->i_nlink++;
                                goto bad;
                        }
                        dp->i_nlink++;
-                       dp->i_flag |= ICHG;
+                       dp->i_flag |= ICHANGE;
                        if (error = VOP_UPDATE(tdvp, &tv, &tv, 1))
                                goto bad;
                }
                if (error = ufs_direnter(ip, tdvp, tcnp)) {
                        if (doingdirectory && newparent) {
                                dp->i_nlink--;
                        if (error = VOP_UPDATE(tdvp, &tv, &tv, 1))
                                goto bad;
                }
                if (error = ufs_direnter(ip, tdvp, tcnp)) {
                        if (doingdirectory && newparent) {
                                dp->i_nlink--;
-                               dp->i_flag |= ICHG;
+                               dp->i_flag |= ICHANGE;
                                (void)VOP_UPDATE(tdvp, &tv, &tv, 1);
                        }
                        goto bad;
                                (void)VOP_UPDATE(tdvp, &tv, &tv, 1);
                        }
                        goto bad;
@@ -1080,7 +1097,7 @@ abortit:
                 */
                 if (doingdirectory && !newparent) {
                        dp->i_nlink--;
                 */
                 if (doingdirectory && !newparent) {
                        dp->i_nlink--;
-                       dp->i_flag |= ICHG;
+                       dp->i_flag |= ICHANGE;
                }
                vput(tdvp);
                /*
                }
                vput(tdvp);
                /*
@@ -1100,7 +1117,7 @@ abortit:
                        error = VOP_TRUNCATE(tvp, (off_t)0, IO_SYNC,
                            tcnp->cn_cred, tcnp->cn_proc);
                }
                        error = VOP_TRUNCATE(tvp, (off_t)0, IO_SYNC,
                            tcnp->cn_cred, tcnp->cn_proc);
                }
-               xp->i_flag |= ICHG;
+               xp->i_flag |= ICHANGE;
                vput(tvp);
                xp = NULL;
        }
                vput(tvp);
                xp = NULL;
        }
@@ -1148,7 +1165,7 @@ abortit:
                 */
                if (doingdirectory && newparent) {
                        dp->i_nlink--;
                 */
                if (doingdirectory && newparent) {
                        dp->i_nlink--;
-                       dp->i_flag |= ICHG;
+                       dp->i_flag |= ICHANGE;
                        error = vn_rdwr(UIO_READ, fvp, (caddr_t)&dirbuf,
                                sizeof (struct dirtemplate), (off_t)0,
                                UIO_SYSSPACE, IO_NODELOCKED, 
                        error = vn_rdwr(UIO_READ, fvp, (caddr_t)&dirbuf,
                                sizeof (struct dirtemplate), (off_t)0,
                                UIO_SYSSPACE, IO_NODELOCKED, 
@@ -1183,7 +1200,7 @@ abortit:
                error = ufs_dirremove(fdvp, fcnp);
                if (!error) {
                        xp->i_nlink--;
                error = ufs_dirremove(fdvp, fcnp);
                if (!error) {
                        xp->i_nlink--;
-                       xp->i_flag |= ICHG;
+                       xp->i_flag |= ICHANGE;
                }
                xp->i_flag &= ~IRENAME;
        }
                }
                xp->i_flag &= ~IRENAME;
        }
@@ -1201,7 +1218,7 @@ bad:
 out:
        if (VOP_LOCK(fvp) == 0) {
                ip->i_nlink--;
 out:
        if (VOP_LOCK(fvp) == 0) {
                ip->i_nlink--;
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
                vput(fvp);
        } else
                vrele(fvp);
                vput(fvp);
        } else
                vrele(fvp);
@@ -1272,7 +1289,7 @@ ufs_mkdir(ap)
                return (error);
        }
 #endif
                return (error);
        }
 #endif
-       ip->i_flag |= IACC|IUPD|ICHG;
+       ip->i_flag |= IUPDATE | IACCESS | ICHANGE;
        ip->i_mode = dmode;
        tvp->v_type = VDIR;     /* Rest init'd in iget() */
        ip->i_nlink = 2;
        ip->i_mode = dmode;
        tvp->v_type = VDIR;     /* Rest init'd in iget() */
        ip->i_nlink = 2;
@@ -1286,7 +1303,7 @@ ufs_mkdir(ap)
         * so reparation is possible if we crash.
         */
        dp->i_nlink++;
         * so reparation is possible if we crash.
         */
        dp->i_nlink++;
-       dp->i_flag |= ICHG;
+       dp->i_flag |= ICHANGE;
        if (error = VOP_UPDATE(dvp, &tv, &tv, 1))
                goto bad;
 
        if (error = VOP_UPDATE(dvp, &tv, &tv, 1))
                goto bad;
 
@@ -1303,20 +1320,20 @@ ufs_mkdir(ap)
            IO_NODELOCKED|IO_SYNC, cnp->cn_cred, (int *)0, (struct proc *)0);
        if (error) {
                dp->i_nlink--;
            IO_NODELOCKED|IO_SYNC, cnp->cn_cred, (int *)0, (struct proc *)0);
        if (error) {
                dp->i_nlink--;
-               dp->i_flag |= ICHG;
+               dp->i_flag |= ICHANGE;
                goto bad;
        }
        if (DIRBLKSIZ > VFSTOUFS(dvp->v_mount)->um_mountp->mnt_stat.f_bsize)
                panic("ufs_mkdir: blksize"); /* XXX should grow with balloc() */
        else {
                ip->i_size = DIRBLKSIZ;
                goto bad;
        }
        if (DIRBLKSIZ > VFSTOUFS(dvp->v_mount)->um_mountp->mnt_stat.f_bsize)
                panic("ufs_mkdir: blksize"); /* XXX should grow with balloc() */
        else {
                ip->i_size = DIRBLKSIZ;
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
        }
 
        /* Directory set up, now install it's entry in the parent directory. */
        if (error = ufs_direnter(ip, dvp, cnp)) {
                dp->i_nlink--;
        }
 
        /* Directory set up, now install it's entry in the parent directory. */
        if (error = ufs_direnter(ip, dvp, cnp)) {
                dp->i_nlink--;
-               dp->i_flag |= ICHG;
+               dp->i_flag |= ICHANGE;
        }
 bad:
        /*
        }
 bad:
        /*
@@ -1325,7 +1342,7 @@ bad:
         */
        if (error) {
                ip->i_nlink = 0;
         */
        if (error) {
                ip->i_nlink = 0;
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
                vput(tvp);
        } else
                *ap->a_vpp = tvp;
                vput(tvp);
        } else
                *ap->a_vpp = tvp;
@@ -1387,7 +1404,7 @@ ufs_rmdir(ap)
        if (error = ufs_dirremove(dvp, cnp))
                goto out;
        dp->i_nlink--;
        if (error = ufs_dirremove(dvp, cnp))
                goto out;
        dp->i_nlink--;
-       dp->i_flag |= ICHG;
+       dp->i_flag |= ICHANGE;
        cache_purge(dvp);
        vput(dvp);
        dvp = NULL;
        cache_purge(dvp);
        vput(dvp);
        dvp = NULL;
@@ -1439,7 +1456,7 @@ ufs_symlink(ap)
                ip = VTOI(vp);
                bcopy(ap->a_target, (char *)ip->i_shortlink, len);
                ip->i_size = len;
                ip = VTOI(vp);
                bcopy(ap->a_target, (char *)ip->i_shortlink, len);
                ip->i_size = len;
-               ip->i_flag |= IUPD|ICHG;
+               ip->i_flag |= IUPDATE |ICHANGE;
        } else
                error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,
                    UIO_SYSSPACE, IO_NODELOCKED, ap->a_cnp->cn_cred, (int *)0,
        } else
                error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,
                    UIO_SYSSPACE, IO_NODELOCKED, ap->a_cnp->cn_cred, (int *)0,
@@ -1771,7 +1788,7 @@ ufsspec_read(ap)
        /*
         * Set access flag.
         */
        /*
         * Set access flag.
         */
-       VTOI(ap->a_vp)->i_flag |= IACC;
+       VTOI(ap->a_vp)->i_flag |= IACCESS;
        return (VOCALL (spec_vnodeop_p, VOFFSET(vop_read), ap));
 }
 
        return (VOCALL (spec_vnodeop_p, VOFFSET(vop_read), ap));
 }
 
@@ -1791,7 +1808,7 @@ ufsspec_write(ap)
        /*
         * Set update and change flags.
         */
        /*
         * Set update and change flags.
         */
-       VTOI(ap->a_vp)->i_flag |= IUPD|ICHG;
+       VTOI(ap->a_vp)->i_flag |= IUPDATE | ICHANGE;
        return (VOCALL (spec_vnodeop_p, VOFFSET(vop_write), ap));
 }
 
        return (VOCALL (spec_vnodeop_p, VOFFSET(vop_write), ap));
 }
 
@@ -1834,7 +1851,7 @@ ufsfifo_read(ap)
        /*
         * Set access flag.
         */
        /*
         * Set access flag.
         */
-       VTOI(ap->a_vp)->i_flag |= IACC;
+       VTOI(ap->a_vp)->i_flag |= IACCESS;
        return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_read), ap));
 }
 
        return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_read), ap));
 }
 
@@ -1855,7 +1872,7 @@ ufsfifo_write(ap)
        /*
         * Set update and change flags.
         */
        /*
         * Set update and change flags.
         */
-       VTOI(ap->a_vp)->i_flag |= IUPD|ICHG;
+       VTOI(ap->a_vp)->i_flag |= IUPDATE | ICHANGE;
        return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_write), ap));
 }
 
        return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_write), ap));
 }
 
@@ -2111,7 +2128,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
                return (error);
        }
 #endif
                return (error);
        }
 #endif
-       ip->i_flag |= IACC|IUPD|ICHG;
+       ip->i_flag |= IUPDATE | IACCESS | ICHANGE;
        ip->i_mode = mode;
        tvp->v_type = IFTOVT(mode);     /* Rest init'd in iget() */
        ip->i_nlink = 1;
        ip->i_mode = mode;
        tvp->v_type = IFTOVT(mode);     /* Rest init'd in iget() */
        ip->i_nlink = 1;
@@ -2141,7 +2158,7 @@ bad:
        free(cnp->cn_pnbuf, M_NAMEI);
        vput(dvp);
        ip->i_nlink = 0;
        free(cnp->cn_pnbuf, M_NAMEI);
        vput(dvp);
        ip->i_nlink = 0;
-       ip->i_flag |= ICHG;
+       ip->i_flag |= ICHANGE;
        vput(tvp);
        return (error);
 }
        vput(tvp);
        return (error);
 }
index efec0b6..f72fdf4 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs.h       8.1 (Berkeley) %G%
+ *     @(#)lfs.h       8.2 (Berkeley) %G%
  */
 
 #define        LFS_LABELPAD    8192            /* LFS label size */
  */
 
 #define        LFS_LABELPAD    8192            /* LFS label size */
@@ -219,32 +219,32 @@ struct segsum {
 
 /* Read in the block with the cleaner info from the ifile. */
 #define LFS_CLEANERINFO(CP, F, BP) { \
 
 /* Read in the block with the cleaner info from the ifile. */
 #define LFS_CLEANERINFO(CP, F, BP) { \
-       VTOI((F)->lfs_ivnode)->i_flag |= IACC; \
+       VTOI((F)->lfs_ivnode)->i_flag |= IACCESS; \
        if (bread((F)->lfs_ivnode, (daddr_t)0, (F)->lfs_bsize, NOCRED, &(BP))) \
                panic("lfs: ifile read"); \
        if (bread((F)->lfs_ivnode, (daddr_t)0, (F)->lfs_bsize, NOCRED, &(BP))) \
                panic("lfs: ifile read"); \
-       (CP) = (CLEANERINFO *)(BP)->b_un.b_addr; \
+       (CP) = (CLEANERINFO *)(BP)->b_data; \
 }
 
 /* Read in the block with a specific inode from the ifile. */
 #define        LFS_IENTRY(IP, F, IN, BP) { \
        int _e; \
 }
 
 /* Read in the block with a specific inode from the ifile. */
 #define        LFS_IENTRY(IP, F, IN, BP) { \
        int _e; \
-       VTOI((F)->lfs_ivnode)->i_flag |= IACC; \
+       VTOI((F)->lfs_ivnode)->i_flag |= IACCESS; \
        if (_e = bread((F)->lfs_ivnode, \
            (IN) / (F)->lfs_ifpb + (F)->lfs_cleansz + (F)->lfs_segtabsz, \
            (F)->lfs_bsize, NOCRED, &(BP))) \
                panic("lfs: ifile read %d", _e); \
        if (_e = bread((F)->lfs_ivnode, \
            (IN) / (F)->lfs_ifpb + (F)->lfs_cleansz + (F)->lfs_segtabsz, \
            (F)->lfs_bsize, NOCRED, &(BP))) \
                panic("lfs: ifile read %d", _e); \
-       (IP) = (IFILE *)(BP)->b_un.b_addr + (IN) % (F)->lfs_ifpb; \
+       (IP) = (IFILE *)(BP)->b_data + (IN) % (F)->lfs_ifpb; \
 }
 
 /* Read in the block with a specific segment usage entry from the ifile. */
 #define        LFS_SEGENTRY(SP, F, IN, BP) { \
        int _e; \
 }
 
 /* Read in the block with a specific segment usage entry from the ifile. */
 #define        LFS_SEGENTRY(SP, F, IN, BP) { \
        int _e; \
-       VTOI((F)->lfs_ivnode)->i_flag |= IACC; \
+       VTOI((F)->lfs_ivnode)->i_flag |= IACCESS; \
        if (_e = bread((F)->lfs_ivnode, \
            ((IN) >> (F)->lfs_sushift) + (F)->lfs_cleansz, \
            (F)->lfs_bsize, NOCRED, &(BP))) \
                panic("lfs: ifile read: %d", _e); \
        if (_e = bread((F)->lfs_ivnode, \
            ((IN) >> (F)->lfs_sushift) + (F)->lfs_cleansz, \
            (F)->lfs_bsize, NOCRED, &(BP))) \
                panic("lfs: ifile read: %d", _e); \
-       (SP) = (SEGUSE *)(BP)->b_un.b_addr + ((IN) & (F)->lfs_sepb - 1); \
+       (SP) = (SEGUSE *)(BP)->b_data + ((IN) & (F)->lfs_sepb - 1); \
 }
 
 /* 
 }
 
 /* 
index 72df16e..d8311cd 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_alloc.c 8.1 (Berkeley) %G%
+ *     @(#)lfs_alloc.c 8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -78,7 +78,7 @@ lfs_valloc(ap)
                    fs->lfs_ifpb;
                fs->lfs_free = i;
                max = i + fs->lfs_ifpb;
                    fs->lfs_ifpb;
                fs->lfs_free = i;
                max = i + fs->lfs_ifpb;
-               for (ifp = (struct ifile *)bp->b_un.b_words; i < max; ++ifp) {
+               for (ifp = (struct ifile *)bp->b_data; i < max; ++ifp) {
                        ifp->if_version = 1;
                        ifp->if_daddr = LFS_UNUSED_DADDR;
                        ifp->if_nextfree = ++i;
                        ifp->if_version = 1;
                        ifp->if_daddr = LFS_UNUSED_DADDR;
                        ifp->if_nextfree = ++i;
@@ -149,7 +149,7 @@ lfs_vcreate(mp, ino, vpp)
        (*vpp)->v_data = ip;
        ip->i_vnode = *vpp;
        ip->i_devvp = ump->um_devvp;
        (*vpp)->v_data = ip;
        ip->i_vnode = *vpp;
        ip->i_devvp = ump->um_devvp;
-       ip->i_flag = IMOD;
+       ip->i_flag = IMODIFIED;
        ip->i_dev = ump->um_dev;
        ip->i_number = ip->i_din.di_inumber = ino;
 ip->i_din.di_spare[0] = 0xdeadbeef;
        ip->i_dev = ump->um_dev;
        ip->i_number = ip->i_din.di_inumber = ino;
 ip->i_din.di_spare[0] = 0xdeadbeef;
@@ -191,9 +191,9 @@ lfs_vfree(ap)
        ip = VTOI(ap->a_pvp);
        fs = ip->i_lfs;
        ino = ip->i_number;
        ip = VTOI(ap->a_pvp);
        fs = ip->i_lfs;
        ino = ip->i_number;
-       if (ip->i_flag & IMOD) {
+       if (ip->i_flag & IMODIFIED) {
                --fs->lfs_uinodes;
                --fs->lfs_uinodes;
-               ip->i_flag &= ~(IMOD | IACC | IUPD | ICHG);
+               ip->i_flag &= ~(IMODIFIED | IACCESS | IUPDATE | ICHANGE);
        }
        /*
         * Set the ifile's inode entry to unused, increment its version number
        }
        /*
         * Set the ifile's inode entry to unused, increment its version number
index 5b555c2..0ef7f68 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_bio.c   8.1 (Berkeley) %G%
+ *     @(#)lfs_bio.c   8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -79,9 +79,9 @@ lfs_bwrite(ap)
                        }
                }
                ip = VTOI((bp)->b_vp);
                        }
                }
                ip = VTOI((bp)->b_vp);
-               if (!(ip->i_flag & IMOD))
+               if (!(ip->i_flag & IMODIFIED))
                        ++fs->lfs_uinodes;
                        ++fs->lfs_uinodes;
-               ip->i_flag |= IMOD | ICHG | IUPD;                       \
+               ip->i_flag |= IMODIFIED | ICHANGE | IUPDATE;
                fs->lfs_avail -= fsbtodb(fs, 1);
                ++locked_queue_count;
                bp->b_flags |= B_DELWRI | B_LOCKED;
                fs->lfs_avail -= fsbtodb(fs, 1);
                ++locked_queue_count;
                bp->b_flags |= B_DELWRI | B_LOCKED;
index 741ef98..666d6d8 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_inode.c 8.2 (Berkeley) %G%
+ *     @(#)lfs_inode.c 8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -66,21 +66,21 @@ 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 & (IUPD | IACC | ICHG | IMOD)) == 0)
+       if ((ip->i_flag & (IUPDATE | IACCESS | ICHANGE | IMODIFIED)) == 0)
                return (0);
                return (0);
-       if (ip->i_flag & IACC)
+       if (ip->i_flag & IACCESS)
                ip->i_atime.ts_sec = ap->a_access->tv_sec;
                ip->i_atime.ts_sec = ap->a_access->tv_sec;
-       if (ip->i_flag & IUPD) {
+       if (ip->i_flag & IUPDATE) {
                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 & ICHG)
+       if (ip->i_flag & ICHANGE)
                ip->i_ctime.ts_sec = time.tv_sec;
                ip->i_ctime.ts_sec = time.tv_sec;
-       ip->i_flag &= ~(IUPD | IACC | ICHG);
+       ip->i_flag &= ~(IUPDATE | IACCESS | ICHANGE);
 
 
-       if (!(ip->i_flag & IMOD))
+       if (!(ip->i_flag & IMODIFIED))
                ++(VFSTOUFS(vp->v_mount)->um_lfs->lfs_uinodes);
                ++(VFSTOUFS(vp->v_mount)->um_lfs->lfs_uinodes);
-       ip->i_flag |= IMOD;
+       ip->i_flag |= IMODIFIED;
 
        /* 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 +149,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 |= ICHG|IUPD;
+               ip->i_flag |= IUPDATE | ICHANGE;
                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 +158,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 |= ICHG|IUPD;
+               ip->i_flag |= IUPDATE | ICHANGE;
                return (VOP_UPDATE(vp, &tv, &tv, 0));
        }
 
                return (VOP_UPDATE(vp, &tv, &tv, 0));
        }
 
@@ -190,7 +190,7 @@ lfs_truncate(ap)
                ip->i_size = length;
                size = blksize(fs);
                (void)vnode_pager_uncache(vp);
                ip->i_size = length;
                size = blksize(fs);
                (void)vnode_pager_uncache(vp);
-               bzero(bp->b_un.b_addr + offset, (unsigned)(size - offset));
+               bzero((char *)bp->b_data + offset, (u_int)(size - offset));
                allocbuf(bp, size);
                if (e1 = VOP_BWRITE(bp))
                        return (e1);
                allocbuf(bp, size);
                if (e1 = VOP_BWRITE(bp))
                        return (e1);
@@ -234,7 +234,7 @@ lfs_truncate(ap)
                                    inp->in_lbn, fs->lfs_bsize, NOCRED, &bp))
                                        panic("lfs_truncate: bread bno %d",
                                            inp->in_lbn);
                                    inp->in_lbn, fs->lfs_bsize, NOCRED, &bp))
                                        panic("lfs_truncate: bread bno %d",
                                            inp->in_lbn);
-                               daddrp = bp->b_un.b_daddr + inp->in_off;
+                               daddrp = (daddr_t *)bp->b_data + inp->in_off;
                                for (i = inp->in_off;
                                    i++ <= a_end[depth].in_off;) {
                                        daddr = *daddrp++;
                                for (i = inp->in_off;
                                    i++ <= a_end[depth].in_off;) {
                                        daddr = *daddrp++;
@@ -244,8 +244,8 @@ lfs_truncate(ap)
                                if (inp->in_off == 0)
                                        brelse (bp);
                                else {
                                if (inp->in_off == 0)
                                        brelse (bp);
                                else {
-                                       bzero(bp->b_un.b_daddr + inp->in_off,
-                                           fs->lfs_bsize - 
+                                       bzero((daddr_t *)bp->b_data +
+                                           inp->in_off, fs->lfs_bsize - 
                                            inp->in_off * sizeof(daddr_t));
                                        if (e1 = VOP_BWRITE(bp)) 
                                                return (e1);
                                            inp->in_off * sizeof(daddr_t));
                                        if (e1 = VOP_BWRITE(bp)) 
                                                return (e1);
@@ -283,7 +283,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 |= ICHG|IUPD;
+       ip->i_flag |= IUPDATE | ICHANGE;
        /*
         * 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
index ce64f86..e3e6a32 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_segment.c       8.1 (Berkeley) %G%
+ *     @(#)lfs_segment.c       8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -162,7 +162,7 @@ loop:       for (vp = mp->mnt_mounth; vp; vp = vp->v_mountf) {
                 * the IFILE.
                 */
                ip = VTOI(vp);
                 * the IFILE.
                 */
                ip = VTOI(vp);
-               if ((ip->i_flag & (IMOD | IACC | IUPD | ICHG) ||
+               if ((ip->i_flag & (IMODIFIED | IACCESS | IUPDATE | ICHANGE) ||
                    vp->v_dirtyblkhd.le_next != NULL) &&
                    ip->i_number != LFS_IFILE_INUM) {
                        if (vp->v_dirtyblkhd.le_next != NULL)
                    vp->v_dirtyblkhd.le_next != NULL) &&
                    ip->i_number != LFS_IFILE_INUM) {
                        if (vp->v_dirtyblkhd.le_next != NULL)
@@ -245,7 +245,7 @@ lfs_segwrite(mp, flags)
                            NOCRED, &bp))
 
                                panic("lfs: ifile read");
                            NOCRED, &bp))
 
                                panic("lfs: ifile read");
-                       segusep = (SEGUSE *)bp->b_un.b_addr;
+                       segusep = (SEGUSE *)bp->b_data;
                        for (i = fs->lfs_sepb; i--; segusep++)
                                segusep->su_flags &= ~SEGUSE_ACTIVE;
                                
                        for (i = fs->lfs_sepb; i--; segusep++)
                                segusep->su_flags &= ~SEGUSE_ACTIVE;
                                
@@ -352,7 +352,7 @@ lfs_writeinode(fs, sp, ip)
        int error, i, ndx;
        int redo_ifile = 0;
 
        int error, i, ndx;
        int redo_ifile = 0;
 
-       if (!(ip->i_flag & (IMOD | IACC | IUPD | ICHG)))
+       if (!(ip->i_flag & (IMODIFIED | IACCESS | IUPDATE | ICHANGE)))
                return(0);
 
        /* Allocate a new inode block if necessary. */
                return(0);
 
        /* Allocate a new inode block if necessary. */
@@ -370,7 +370,7 @@ lfs_writeinode(fs, sp, ip)
                    fs->lfs_bsize);
                /* Zero out inode numbers */
                for (i = 0; i < INOPB(fs); ++i)
                    fs->lfs_bsize);
                /* Zero out inode numbers */
                for (i = 0; i < INOPB(fs); ++i)
-                       sp->ibp->b_un.b_dino[i].di_inumber = 0;
+                       ((struct dinode *)sp->ibp->b_data)[i].di_inumber = 0;
                ++sp->start_bpp;
                fs->lfs_avail -= fsbtodb(fs, 1);
                /* Set remaining space counters. */
                ++sp->start_bpp;
                fs->lfs_avail -= fsbtodb(fs, 1);
                /* Set remaining space counters. */
@@ -382,12 +382,12 @@ lfs_writeinode(fs, sp, ip)
        }
 
        /* Update the inode times and copy the inode onto the inode page. */
        }
 
        /* Update the inode times and copy the inode onto the inode page. */
-       if (ip->i_flag & IMOD)
+       if (ip->i_flag & IMODIFIED)
                --fs->lfs_uinodes;
        ITIMES(ip, &time, &time);
                --fs->lfs_uinodes;
        ITIMES(ip, &time, &time);
-       ip->i_flag &= ~(IMOD | IACC | IUPD | ICHG);
+       ip->i_flag &= ~(IMODIFIED | IACCESS | IUPDATE | ICHANGE);
        bp = sp->ibp;
        bp = sp->ibp;
-       bp->b_un.b_dino[sp->ninodes % INOPB(fs)] = ip->i_din;
+       ((struct dinode *)bp->b_data)[sp->ninodes % INOPB(fs)] = ip->i_din;
        /* Increment inode count in segment summary block. */
        ++((SEGSUM *)(sp->segsum))->ss_ninos;
 
        /* Increment inode count in segment summary block. */
        ++((SEGSUM *)(sp->segsum))->ss_ninos;
 
@@ -574,7 +574,7 @@ printf ("Updatemeta allocating indirect block: shouldn't happen\n");
                                ip->i_blocks += btodb(fs->lfs_bsize);
                                fs->lfs_bfree -= btodb(fs->lfs_bsize);
                        }
                                ip->i_blocks += btodb(fs->lfs_bsize);
                                fs->lfs_bfree -= btodb(fs->lfs_bsize);
                        }
-                       bp->b_un.b_daddr[ap->in_off] = off;
+                       ((daddr_t *)bp->b_data)[ap->in_off] = off;
                        VOP_BWRITE(bp);
                }
 
                        VOP_BWRITE(bp);
                }
 
@@ -649,7 +649,7 @@ lfs_initseg(fs)
        sp->cbpp = sp->bpp;
        *sp->cbpp = lfs_newbuf(VTOI(fs->lfs_ivnode)->i_devvp, fs->lfs_offset,
             LFS_SUMMARY_SIZE);
        sp->cbpp = sp->bpp;
        *sp->cbpp = lfs_newbuf(VTOI(fs->lfs_ivnode)->i_devvp, fs->lfs_offset,
             LFS_SUMMARY_SIZE);
-       sp->segsum = (*sp->cbpp)->b_un.b_addr;
+       sp->segsum = (*sp->cbpp)->b_data;
        bzero(sp->segsum, LFS_SUMMARY_SIZE);
        sp->start_bpp = ++sp->cbpp;
        fs->lfs_offset += LFS_SUMMARY_SIZE / DEV_BSIZE;
        bzero(sp->segsum, LFS_SUMMARY_SIZE);
        sp->start_bpp = ++sp->cbpp;
        fs->lfs_offset += LFS_SUMMARY_SIZE / DEV_BSIZE;
@@ -767,7 +767,7 @@ lfs_writeseg(fs, sp)
                        if (copyin((*bpp)->b_saveaddr, dp++, sizeof(u_long)))
                                panic("lfs_writeseg: copyin failed");
                } else
                        if (copyin((*bpp)->b_saveaddr, dp++, sizeof(u_long)))
                                panic("lfs_writeseg: copyin failed");
                } else
-                       *dp++ = (*bpp)->b_un.b_words[0];
+                       *dp++ = ((u_long *)(*bpp)->b_data)[0];
        }
        ssp->ss_create = time.tv_sec;
        ssp->ss_datasum = cksum(datap, (nblocks - 1) * sizeof(u_long));
        }
        ssp->ss_create = time.tv_sec;
        ssp->ss_datasum = cksum(datap, (nblocks - 1) * sizeof(u_long));
@@ -813,7 +813,7 @@ lfs_writeseg(fs, sp)
 
                s = splbio();
                ++fs->lfs_iocount;
 
                s = splbio();
                ++fs->lfs_iocount;
-               for (p = cbp->b_un.b_addr; num--;) {
+               for (p = cbp->b_data; num--;) {
                        bp = *bpp++;
                        /*
                         * Fake buffers from the cleaner are marked as B_INVAL.
                        bp = *bpp++;
                        /*
                         * Fake buffers from the cleaner are marked as B_INVAL.
@@ -825,7 +825,7 @@ lfs_writeseg(fs, sp)
                                if (copyin(bp->b_saveaddr, p, bp->b_bcount))
                                        panic("lfs_writeseg: copyin failed");
                        } else
                                if (copyin(bp->b_saveaddr, p, bp->b_bcount))
                                        panic("lfs_writeseg: copyin failed");
                        } else
-                               bcopy(bp->b_un.b_addr, p, bp->b_bcount);
+                               bcopy(bp->b_data, p, bp->b_bcount);
                        p += bp->b_bcount;
                        if (bp->b_flags & B_LOCKED)
                                --locked_queue_count;
                        p += bp->b_bcount;
                        if (bp->b_flags & B_LOCKED)
                                --locked_queue_count;
@@ -835,7 +835,7 @@ lfs_writeseg(fs, sp)
                                /* if B_CALL, it was created with newbuf */
                                brelvp(bp);
                                if (!(bp->b_flags & B_INVAL))
                                /* if B_CALL, it was created with newbuf */
                                brelvp(bp);
                                if (!(bp->b_flags & B_INVAL))
-                                       free(bp->b_un.b_addr, M_SEGMENT);
+                                       free(bp->b_data, M_SEGMENT);
                                free(bp, M_SEGMENT);
                        } else {
                                bremfree(bp);
                                free(bp, M_SEGMENT);
                        } else {
                                bremfree(bp);
@@ -846,7 +846,7 @@ lfs_writeseg(fs, sp)
                }
                ++cbp->b_vp->v_numoutput;
                splx(s);
                }
                ++cbp->b_vp->v_numoutput;
                splx(s);
-               cbp->b_bcount = p - cbp->b_un.b_addr;
+               cbp->b_bcount = p - (char *)cbp->b_data;
                /*
                 * XXXX This is a gross and disgusting hack.  Since these
                 * buffers are physically addressed, they hang off the
                /*
                 * XXXX This is a gross and disgusting hack.  Since these
                 * buffers are physically addressed, they hang off the
@@ -900,7 +900,7 @@ lfs_writesuper(fs)
        fs->lfs_cksum = cksum(fs, sizeof(struct lfs) - sizeof(fs->lfs_cksum));
        bp = lfs_newbuf(VTOI(fs->lfs_ivnode)->i_devvp, fs->lfs_sboffs[0],
            LFS_SBPAD);
        fs->lfs_cksum = cksum(fs, sizeof(struct lfs) - sizeof(fs->lfs_cksum));
        bp = lfs_newbuf(VTOI(fs->lfs_ivnode)->i_devvp, fs->lfs_sboffs[0],
            LFS_SBPAD);
-       *bp->b_un.b_lfs = *fs;
+       *(struct lfs *)bp->b_data = *fs;
 
        /* XXX Toggle between first two superblocks; for now just write first */
        bp->b_dev = i_dev;
 
        /* XXX Toggle between first two superblocks; for now just write first */
        bp->b_dev = i_dev;
@@ -976,8 +976,7 @@ lfs_newbuf(vp, daddr, size)
        bp = malloc(sizeof(struct buf), M_SEGMENT, M_WAITOK);
        bzero(bp, sizeof(struct buf));
        if (nbytes)
        bp = malloc(sizeof(struct buf), M_SEGMENT, M_WAITOK);
        bzero(bp, sizeof(struct buf));
        if (nbytes)
-               bp->b_un.b_addr =
-                   malloc(nbytes, M_SEGMENT, M_WAITOK);
+               bp->b_data = malloc(nbytes, M_SEGMENT, M_WAITOK);
        bgetvp(vp, bp);
        bp->b_bufsize = size;
        bp->b_bcount = size;
        bgetvp(vp, bp);
        bp->b_bufsize = size;
        bp->b_bcount = size;
@@ -1005,7 +1004,7 @@ lfs_callback(bp)
                wakeup(&fs->lfs_iocount);
 
        brelvp(bp);
                wakeup(&fs->lfs_iocount);
 
        brelvp(bp);
-       free(bp->b_un.b_addr, M_SEGMENT);
+       free(bp->b_data, M_SEGMENT);
        free(bp, M_SEGMENT);
 }
 
        free(bp, M_SEGMENT);
 }
 
@@ -1014,7 +1013,7 @@ lfs_supercallback(bp)
        struct buf *bp;
 {
        brelvp(bp);
        struct buf *bp;
 {
        brelvp(bp);
-       free(bp->b_un.b_addr, M_SEGMENT);
+       free(bp->b_data, M_SEGMENT);
        free(bp, M_SEGMENT);
 }
 
        free(bp, M_SEGMENT);
 }
 
index 87b554b..945cd90 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_subr.c  8.1 (Berkeley) %G%
+ *     @(#)lfs_subr.c  8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -51,7 +51,7 @@ lfs_blkatoff(ap)
                return (error);
        }
        if (ap->a_res)
                return (error);
        }
        if (ap->a_res)
-               *ap->a_res = bp->b_un.b_addr + blkoff(fs, ap->a_offset);
+               *ap->a_res = (char *)bp->b_data + blkoff(fs, ap->a_offset);
        *ap->a_bpp = bp;
        return (0);
 }
        *ap->a_bpp = bp;
        return (0);
 }
@@ -119,7 +119,7 @@ lfs_segunlock(fs)
                        /* Free allocated segment summary */
                        fs->lfs_offset -= LFS_SUMMARY_SIZE / DEV_BSIZE;
                        brelvp(*sp->bpp);
                        /* Free allocated segment summary */
                        fs->lfs_offset -= LFS_SUMMARY_SIZE / DEV_BSIZE;
                        brelvp(*sp->bpp);
-                       free((*sp->bpp)->b_un.b_addr, M_SEGMENT);
+                       free((*sp->bpp)->b_data, M_SEGMENT);
                        free(*sp->bpp, M_SEGMENT);
                } else
                        printf ("unlock to 0 with no summary");
                        free(*sp->bpp, M_SEGMENT);
                } else
                        printf ("unlock to 0 with no summary");
index 5ff6a18..e4e5965 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_syscalls.c      8.1 (Berkeley) %G%
+ *     @(#)lfs_syscalls.c      8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -171,7 +171,7 @@ lfs_markv(p, uap, retval)
                else {
                        bp = getblk(vp, blkp->bi_lbn, bsize, 0, 0);
                        if (!(bp->b_flags & (B_DELWRI | B_DONE | B_CACHE)) &&
                else {
                        bp = getblk(vp, blkp->bi_lbn, bsize, 0, 0);
                        if (!(bp->b_flags & (B_DELWRI | B_DONE | B_CACHE)) &&
-                           (error = copyin(blkp->bi_bp, bp->b_un.b_addr,
+                           (error = copyin(blkp->bi_bp, bp->b_data,
                            bsize)))
                                goto err2;
                        if (error = VOP_BWRITE(bp))
                            bsize)))
                                goto err2;
                        if (error = VOP_BWRITE(bp))
@@ -419,11 +419,11 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp)
                ip = VTOI(*vpp);
                if (ip->i_flags & ILOCKED)
                        printf ("Cleaned vnode ILOCKED\n");
                ip = VTOI(*vpp);
                if (ip->i_flags & ILOCKED)
                        printf ("Cleaned vnode ILOCKED\n");
-               if (!(ip->i_flag & IMOD)) {
+               if (!(ip->i_flag & IMODIFIED)) {
                        ++ump->um_lfs->lfs_uinodes;
                        ++ump->um_lfs->lfs_uinodes;
-                       ip->i_flag |= IMOD;
+                       ip->i_flag |= IMODIFIED;
                }
                }
-               ip->i_flag |= IMOD;
+               ip->i_flag |= IMODIFIED;
                return (0);
        }
 
                return (0);
        }
 
@@ -470,7 +470,8 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp)
                        *vpp = NULL;
                        return (error);
                }
                        *vpp = NULL;
                        return (error);
                }
-               ip->i_din = *lfs_ifind(ump->um_lfs, ino, bp->b_un.b_dino);
+               ip->i_din =
+                   *lfs_ifind(ump->um_lfs, ino, (struct dinode *)bp->b_data);
                brelse(bp);
        }
 
                brelse(bp);
        }
 
@@ -490,7 +491,7 @@ lfs_fastvget(mp, ino, daddr, vpp, dinp)
         * Finish inode initialization now that aliasing has been resolved.
         */
        ip->i_devvp = ump->um_devvp;
         * Finish inode initialization now that aliasing has been resolved.
         */
        ip->i_devvp = ump->um_devvp;
-       ip->i_flag |= IMOD;
+       ip->i_flag |= IMODIFIED;
        ++ump->um_lfs->lfs_uinodes;
        VREF(ip->i_devvp);
        *vpp = vp;
        ++ump->um_lfs->lfs_uinodes;
        VREF(ip->i_devvp);
        *vpp = vp;
index 571d242..378c6d9 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_vfsops.c        8.1 (Berkeley) %G%
+ *     @(#)lfs_vfsops.c        8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -215,7 +215,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);
@@ -458,7 +458,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);
 
        /*
index 97f51d1..bd757c7 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_vnops.c 8.2 (Berkeley) %G%
+ *     @(#)lfs_vnops.c 8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -435,9 +435,9 @@ lfs_close(ap)
        int mod;
 
        if (vp->v_usecount > 1 && !(ip->i_flag & ILOCKED)) {
        int mod;
 
        if (vp->v_usecount > 1 && !(ip->i_flag & ILOCKED)) {
-               mod = ip->i_flag & IMOD;
+               mod = ip->i_flag & IMODIFIED;
                ITIMES(ip, &time, &time);
                ITIMES(ip, &time, &time);
-               if (!mod && ip->i_flag & IMOD)
+               if (!mod && ip->i_flag & IMODIFIED)
                        ip->i_lfs->lfs_uinodes++;
        }
        return (0);
                        ip->i_lfs->lfs_uinodes++;
        }
        return (0);
index dbc6ba6..d24f93a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_bmap.c  8.2 (Berkeley) %G%
+ *     @(#)ufs_bmap.c  8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -166,12 +166,12 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
                        }
                }
 
                        }
                }
 
-               daddr = bp->b_un.b_daddr[xap->in_off];
+               daddr = ((daddr_t *)bp->b_data)[xap->in_off];
                if (num == 1 && daddr && runp)
                        for (bn = xap->in_off + 1;
                            bn < MNINDIR(ump) && *runp < maxrun &&
                if (num == 1 && daddr && runp)
                        for (bn = xap->in_off + 1;
                            bn < MNINDIR(ump) && *runp < maxrun &&
-                           is_sequential(ump, bp->b_un.b_daddr[bn - 1],
-                           bp->b_un.b_daddr[bn]);
+                           is_sequential(ump, ((daddr_t *)bp->b_data)[bn - 1],
+                           ((daddr_t *)bp->b_data)[bn]);
                            ++bn, ++*runp);
        }
        if (bp)
                            ++bn, ++*runp);
        }
        if (bp)
index e63e109..4a3c157 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_disksubr.c      8.2 (Berkeley) %G%
+ *     @(#)ufs_disksubr.c      8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -147,8 +147,9 @@ readdisklabel(dev, strat, lp)
        (*strat)(bp);
        if (biowait(bp))
                msg = "I/O error";
        (*strat)(bp);
        if (biowait(bp))
                msg = "I/O error";
-       else for (dlp = (struct disklabel *)bp->b_un.b_addr;
-           dlp <= (struct disklabel *)(bp->b_un.b_addr+DEV_BSIZE-sizeof(*dlp));
+       else for (dlp = (struct disklabel *)bp->b_data;
+           dlp <= (struct disklabel *)((char *)bp->b_data +
+           DEV_BSIZE - sizeof(*dlp));
            dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
                if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
                        if (msg == NULL)
            dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
                if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
                        if (msg == NULL)
@@ -240,9 +241,9 @@ writedisklabel(dev, strat, lp)
        (*strat)(bp);
        if (error = biowait(bp))
                goto done;
        (*strat)(bp);
        if (error = biowait(bp))
                goto done;
-       for (dlp = (struct disklabel *)bp->b_un.b_addr;
+       for (dlp = (struct disklabel *)bp->b_data;
            dlp <= (struct disklabel *)
            dlp <= (struct disklabel *)
-             (bp->b_un.b_addr + lp->d_secsize - sizeof(*dlp));
+             ((char *)bp->b_data + lp->d_secsize - sizeof(*dlp));
            dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
                if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
                    dkcksum(dlp) == 0) {
            dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
                if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
                    dkcksum(dlp) == 0) {
index cb1f49a..a4ed2ca 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_inode.c 8.1 (Berkeley) %G%
+ *     @(#)ufs_inode.c 8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -86,10 +86,10 @@ ufs_inactive(ap)
                mode = ip->i_mode;
                ip->i_mode = 0;
                ip->i_rdev = 0;
                mode = ip->i_mode;
                ip->i_mode = 0;
                ip->i_rdev = 0;
-               ip->i_flag |= IUPD|ICHG;
+               ip->i_flag |= IUPDATE | ICHANGE;
                VOP_VFREE(vp, ip->i_number, mode);
        }
                VOP_VFREE(vp, ip->i_number, mode);
        }
-       if (ip->i_flag&(IUPD|IACC|ICHG|IMOD)) {
+       if (ip->i_flag & (IMODIFIED | IACCESS | IUPDATE | ICHANGE)) {
                tv = time;
                VOP_UPDATE(vp, &tv, &tv, 0);
        }
                tv = time;
                VOP_UPDATE(vp, &tv, &tv, 0);
        }
index 7c69612..7aa71dc 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_lookup.c        8.1 (Berkeley) %G%
+ *     @(#)ufs_lookup.c        8.2 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -237,7 +237,7 @@ searchloop:
                 * directory. Complete checks can be run by patching
                 * "dirchk" to be true.
                 */
                 * directory. Complete checks can be run by patching
                 * "dirchk" to be true.
                 */
-               ep = (struct direct *)(bp->b_un.b_addr + entryoffsetinblock);
+               ep = (struct direct *)((char *)bp->b_data + entryoffsetinblock);
                if (ep->d_reclen == 0 ||
                    dirchk && ufs_dirbadentry(vdp, ep, entryoffsetinblock)) {
                        int i;
                if (ep->d_reclen == 0 ||
                    dirchk && ufs_dirbadentry(vdp, ep, entryoffsetinblock)) {
                        int i;
@@ -356,7 +356,7 @@ searchloop:
                                enduseful = slotoffset + slotsize;
                }
                dp->i_endoff = roundup(enduseful, DIRBLKSIZ);
                                enduseful = slotoffset + slotsize;
                }
                dp->i_endoff = roundup(enduseful, DIRBLKSIZ);
-               dp->i_flag |= IUPD|ICHG;
+               dp->i_flag |= IUPDATE | ICHANGE;
                /*
                 * We return with the directory locked, so that
                 * the parameters we set up above will still be
                /*
                 * We return with the directory locked, so that
                 * the parameters we set up above will still be
@@ -392,7 +392,7 @@ found:
        if (entryoffsetinblock + DIRSIZ(FSFMT(vdp), ep) > dp->i_size) {
                ufs_dirbad(dp, dp->i_offset, "i_size too small");
                dp->i_size = entryoffsetinblock + DIRSIZ(FSFMT(vdp), ep);
        if (entryoffsetinblock + DIRSIZ(FSFMT(vdp), ep) > dp->i_size) {
                ufs_dirbad(dp, dp->i_offset, "i_size too small");
                dp->i_size = entryoffsetinblock + DIRSIZ(FSFMT(vdp), ep);
-               dp->i_flag |= IUPD|ICHG;
+               dp->i_flag |= IUPDATE | ICHANGE;
        }
 
        /*
        }
 
        /*
@@ -657,7 +657,7 @@ ufs_direnter(ip, dvp, cnp)
                        panic("ufs_direnter: frag size");
                else if (!error) {
                        dp->i_size = roundup(dp->i_size, DIRBLKSIZ);
                        panic("ufs_direnter: frag size");
                else if (!error) {
                        dp->i_size = roundup(dp->i_size, DIRBLKSIZ);
-                       dp->i_flag |= ICHG;
+                       dp->i_flag |= ICHANGE;
                }
                return (error);
        }
                }
                return (error);
        }
@@ -727,7 +727,7 @@ ufs_direnter(ip, dvp, cnp)
        }
        bcopy((caddr_t)&newdir, (caddr_t)ep, (u_int)newentrysize);
        error = VOP_BWRITE(bp);
        }
        bcopy((caddr_t)&newdir, (caddr_t)ep, (u_int)newentrysize);
        error = VOP_BWRITE(bp);
-       dp->i_flag |= IUPD|ICHG;
+       dp->i_flag |= IUPDATE | ICHANGE;
        if (!error && dp->i_endoff && dp->i_endoff < dp->i_size)
                error = VOP_TRUNCATE(dvp, (off_t)dp->i_endoff, IO_SYNC,
                    cnp->cn_cred, cnp->cn_proc);
        if (!error && dp->i_endoff && dp->i_endoff < dp->i_size)
                error = VOP_TRUNCATE(dvp, (off_t)dp->i_endoff, IO_SYNC,
                    cnp->cn_cred, cnp->cn_proc);
@@ -766,7 +766,7 @@ ufs_dirremove(dvp, cnp)
                        return (error);
                ep->d_ino = 0;
                error = VOP_BWRITE(bp);
                        return (error);
                ep->d_ino = 0;
                error = VOP_BWRITE(bp);
-               dp->i_flag |= IUPD|ICHG;
+               dp->i_flag |= IUPDATE | ICHANGE;
                return (error);
        }
        /*
                return (error);
        }
        /*
@@ -777,7 +777,7 @@ ufs_dirremove(dvp, cnp)
                return (error);
        ep->d_reclen += dp->i_reclen;
        error = VOP_BWRITE(bp);
                return (error);
        ep->d_reclen += dp->i_reclen;
        error = VOP_BWRITE(bp);
-       dp->i_flag |= IUPD|ICHG;
+       dp->i_flag |= IUPDATE | ICHANGE;
        return (error);
 }
 
        return (error);
 }
 
@@ -802,7 +802,7 @@ ufs_dirrewrite(dp, ip, cnp)
        if (vdp->v_mount->mnt_maxsymlinklen > 0)
                ep->d_type = IFTODT(ip->i_mode);
        error = VOP_BWRITE(bp);
        if (vdp->v_mount->mnt_maxsymlinklen > 0)
                ep->d_type = IFTODT(ip->i_mode);
        error = VOP_BWRITE(bp);
-       dp->i_flag |= IUPD|ICHG;
+       dp->i_flag |= IUPDATE | ICHANGE;
        return (error);
 }
 
        return (error);
 }
 
index a5f682e..1a785ec 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_readwrite.c     8.1 (Berkeley) %G%
+ *     @(#)ufs_readwrite.c     8.2 (Berkeley) %G%
  */
 
 #ifdef LFS_READWRITE
  */
 
 #ifdef LFS_READWRITE
@@ -115,7 +115,7 @@ READ(ap)
                        xfersize = size;
                }
                if (error =
                        xfersize = size;
                }
                if (error =
-                   uiomove(bp->b_un.b_addr + blkoffset, (int)xfersize, uio))
+                   uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio))
                        break;
 
                if (S_ISREG(mode) && (xfersize + blkoffset == fs->fs_bsize ||
                        break;
 
                if (S_ISREG(mode) && (xfersize + blkoffset == fs->fs_bsize ||
@@ -125,7 +125,7 @@ READ(ap)
        }
        if (bp != NULL)
                brelse(bp);
        }
        if (bp != NULL)
                brelse(bp);
-       ip->i_flag |= IACC;
+       ip->i_flag |= IACCESS;
        return (error);
 }
 
        return (error);
 }
 
@@ -228,7 +228,7 @@ WRITE(ap)
                        xfersize = size;
 
                error =
                        xfersize = size;
 
                error =
-                   uiomove(bp->b_un.b_addr + blkoffset, (int)xfersize, uio);
+                   uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio);
 #ifdef LFS_READWRITE
                (void)VOP_BWRITE(bp);
 #else
 #ifdef LFS_READWRITE
                (void)VOP_BWRITE(bp);
 #else
@@ -246,7 +246,7 @@ WRITE(ap)
 #endif
                if (error || xfersize == 0)
                        break;
 #endif
                if (error || xfersize == 0)
                        break;
-               ip->i_flag |= IUPD | ICHG;
+               ip->i_flag |= IUPDATE | ICHANGE;
        }
        /*
         * If we successfully wrote any data, and we are not the superuser
        }
        /*
         * If we successfully wrote any data, and we are not the superuser
index dded9e9..7f6704f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_vnops.c 8.2 (Berkeley) %G%
+ *     @(#)ufs_vnops.c 8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -98,7 +98,7 @@ ufs_mknod(ap)
            ap->a_dvp, vpp, ap->a_cnp))
                return (error);
        ip = VTOI(*vpp);
            ap->a_dvp, vpp, ap->a_cnp))
                return (error);
        ip = VTOI(*vpp);
-       ip->i_flag |= IACC|IUPD|ICHG;
+       ip->i_flag |= IUPDATE | IACCESS | ICHANGE;
        if (vap->va_rdev != VNOVAL) {
                /*
                 * Want to be able to use this to make badblock
        if (vap->va_rdev != VNOVAL) {
                /*
                 * Want to be able to use this to make badblock
@@ -144,7 +144,7 @@ ufs_open(ap)
 }
 
 /*
 }
 
 /*
- * Close called
+ * Close called.
  *
  * Update the times on the inode.
  */
  *
  * Update the times on the inode.
  */
@@ -166,11 +166,6 @@ ufs_close(ap)
        return (0);
 }
 
        return (0);
 }
 
-/*
- * Check mode permission on inode pointer. Mode is READ, WRITE or EXEC.
- * The mode is shifted to select the owner/group/other fields. The
- * super user is granted all permissions.
- */
 int
 ufs_access(ap)
        struct vop_access_args /* {
 int
 ufs_access(ap)
        struct vop_access_args /* {
@@ -194,37 +189,60 @@ ufs_access(ap)
        }
 #endif
 #ifdef QUOTA
        }
 #endif
 #ifdef QUOTA
-       if (mode & VWRITE) {
+       if (mode & VWRITE)
                switch (vp->v_type) {
                switch (vp->v_type) {
-               case VREG: case VDIR: case VLNK:
+               case VDIR:
+               case VLNK:
+               case VREG:
                        if (error = getinoquota(ip))
                                return (error);
                        if (error = getinoquota(ip))
                                return (error);
+                       break;
                }
                }
-       }
-#endif /* QUOTA */
+#endif
+
+       /* If immutable bit set, nobody gets to write it. */
        if ((mode & VWRITE) && (ip->i_flags & IMMUTABLE))
                return (EPERM);
        if ((mode & VWRITE) && (ip->i_flags & IMMUTABLE))
                return (EPERM);
-       /*
-        * If you're the super-user, you always get access.
-        */
+
+       /* Otherwise, user id 0 always gets access. */
        if (cred->cr_uid == 0)
                return (0);
        if (cred->cr_uid == 0)
                return (0);
-       /*
-        * Access check is based on only one of owner, group, public.
-        * If not owner, then check group. If not a member of the
-        * group, then check public access.
-        */
-       if (cred->cr_uid != ip->i_uid) {
-               mode >>= 3;
-               gp = cred->cr_groups;
-               for (i = 0; i < cred->cr_ngroups; i++, gp++)
-                       if (ip->i_gid == *gp)
-                               goto found;
-               mode >>= 3;
-found:
-               ;
+
+       /* Otherwise, check the owner. */
+       if (cred->cr_uid == ip->i_uid)
+               switch (mode) {
+               case VEXEC:
+                       return (ip->i_mode & S_IXUSR ? 0 : EACCES);
+               case VREAD:
+                       return (ip->i_mode & S_IRUSR ? 0 : EACCES);
+               case VWRITE:
+                       return (ip->i_mode & S_IWUSR ? 0 : EACCES);
+               }
+
+       /* Otherwise, check the groups. */
+       for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++)
+               if (ip->i_gid == *gp)
+                       switch (mode) {
+                       case VEXEC:
+                               return (ip->i_mode & S_IXGRP ? 0 : EACCES);
+                       case VREAD:
+                               return (ip->i_mode & S_IRGRP ? 0 : EACCES);
+                       case VWRITE:
+                               return (ip->i_mode & S_IWGRP ? 0 : EACCES);
+                       }
+
+       /* Otherwise, check everyone else. */
+       switch (mode) {
+       case VEXEC:
+               return (ip->i_mode & S_IXOTH ? 0 : EACCES);
+       case VREAD:
+               return (ip->i_mode & S_IROTH ? 0 : EACCES);
+       case VWRITE:
+               return (ip->i_mode & S_IWOTH ? 0 : EACCES);
        }
        }
-       return ((ip->i_mode & mode) == mode ? 0 : EACCES);
+
+       panic("ufs_access: unknown mode %x\n", mode);
+       /* NOTREACHED */
 }
 
 /* ARGSUSED */
 }
 
 /* ARGSUSED */
@@ -315,7 +333,7 @@ ufs_setattr(ap)
                        ip->i_flags &= SF_SETTABLE;
                        ip->i_flags |= (vap->va_flags & UF_SETTABLE);
                }
                        ip->i_flags &= SF_SETTABLE;
                        ip->i_flags |= (vap->va_flags & UF_SETTABLE);
                }
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
                if (vap->va_flags & (IMMUTABLE | APPEND))
                        return (0);
        }
                if (vap->va_flags & (IMMUTABLE | APPEND))
                        return (0);
        }
@@ -341,9 +359,9 @@ ufs_setattr(ap)
                    (error = VOP_ACCESS(vp, VWRITE, cred, p))))
                        return (error);
                if (vap->va_atime.ts_sec != VNOVAL)
                    (error = VOP_ACCESS(vp, VWRITE, cred, p))))
                        return (error);
                if (vap->va_atime.ts_sec != VNOVAL)
-                       ip->i_flag |= IACC;
+                       ip->i_flag |= IACCESS;
                if (vap->va_mtime.ts_sec != VNOVAL)
                if (vap->va_mtime.ts_sec != VNOVAL)
-                       ip->i_flag |= IUPD | ICHG;
+                       ip->i_flag |= IUPDATE | ICHANGE;
                atimeval.tv_sec = vap->va_atime.ts_sec;
                atimeval.tv_usec = vap->va_atime.ts_nsec / 1000;
                mtimeval.tv_sec = vap->va_mtime.ts_sec;
                atimeval.tv_sec = vap->va_atime.ts_sec;
                atimeval.tv_usec = vap->va_atime.ts_nsec / 1000;
                mtimeval.tv_sec = vap->va_mtime.ts_sec;
@@ -381,8 +399,7 @@ ufs_chmod(vp, mode, cred, p)
                        return (EPERM);
        }
        ip->i_mode &= ~ALLPERMS;
                        return (EPERM);
        }
        ip->i_mode &= ~ALLPERMS;
-       ip->i_mode |= mode & ALLPERMS;
-       ip->i_flag |= ICHG;
+       ip->i_mode |= (mode & ALLPERMS) | ICHANGE;
        if ((vp->v_flag & VTEXT) && (ip->i_mode & S_ISTXT) == 0)
                (void) vnode_pager_uncache(vp);
        return (0);
        if ((vp->v_flag & VTEXT) && (ip->i_mode & S_ISTXT) == 0)
                (void) vnode_pager_uncache(vp);
        return (0);
@@ -422,8 +439,8 @@ ufs_chown(vp, uid, gid, cred, p)
            !groupmember((gid_t)gid, cred)) &&
            (error = suser(cred, &p->p_acflag)))
                return (error);
            !groupmember((gid_t)gid, cred)) &&
            (error = suser(cred, &p->p_acflag)))
                return (error);
-       ouid = ip->i_uid;
        ogid = ip->i_gid;
        ogid = ip->i_gid;
+       ouid = ip->i_uid;
 #ifdef QUOTA
        if (error = getinoquota(ip))
                return (error);
 #ifdef QUOTA
        if (error = getinoquota(ip))
                return (error);
@@ -443,8 +460,8 @@ ufs_chown(vp, uid, gid, cred, p)
                ip->i_dquot[i] = NODQUOT;
        }
 #endif
                ip->i_dquot[i] = NODQUOT;
        }
 #endif
-       ip->i_uid = uid;
        ip->i_gid = gid;
        ip->i_gid = gid;
+       ip->i_uid = uid;
 #ifdef QUOTA
        if ((error = getinoquota(ip)) == 0) {
                if (ouid == uid) {
 #ifdef QUOTA
        if ((error = getinoquota(ip)) == 0) {
                if (ouid == uid) {
@@ -466,8 +483,8 @@ ufs_chown(vp, uid, gid, cred, p)
                        ip->i_dquot[i] = NODQUOT;
                }
        }
                        ip->i_dquot[i] = NODQUOT;
                }
        }
-       ip->i_uid = ouid;
        ip->i_gid = ogid;
        ip->i_gid = ogid;
+       ip->i_uid = ouid;
        if (getinoquota(ip) == 0) {
                if (ouid == uid) {
                        dqrele(vp, ip->i_dquot[USRQUOTA]);
        if (getinoquota(ip) == 0) {
                if (ouid == uid) {
                        dqrele(vp, ip->i_dquot[USRQUOTA]);
@@ -487,7 +504,7 @@ good:
                panic("chown: lost quota");
 #endif /* QUOTA */
        if (ouid != uid || ogid != gid)
                panic("chown: lost quota");
 #endif /* QUOTA */
        if (ouid != uid || ogid != gid)
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
        if (ouid != uid && cred->cr_uid != 0)
                ip->i_mode &= ~ISUID;
        if (ogid != gid && cred->cr_uid != 0)
        if (ouid != uid && cred->cr_uid != 0)
                ip->i_mode &= ~ISUID;
        if (ogid != gid && cred->cr_uid != 0)
@@ -588,7 +605,7 @@ ufs_remove(ap)
        }
        if ((error = ufs_dirremove(dvp, ap->a_cnp)) == 0) {
                ip->i_nlink--;
        }
        if ((error = ufs_dirremove(dvp, ap->a_cnp)) == 0) {
                ip->i_nlink--;
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
        }
 out:
        if (dvp == vp)
        }
 out:
        if (dvp == vp)
@@ -642,14 +659,14 @@ ufs_link(ap)
                goto out1;
        }
        ip->i_nlink++;
                goto out1;
        }
        ip->i_nlink++;
-       ip->i_flag |= ICHG;
+       ip->i_flag |= ICHANGE;
        tv = time;
        error = VOP_UPDATE(tdvp, &tv, &tv, 1);
        if (!error)
                error = ufs_direnter(ip, vp, cnp);
        if (error) {
                ip->i_nlink--;
        tv = time;
        error = VOP_UPDATE(tdvp, &tv, &tv, 1);
        if (!error)
                error = ufs_direnter(ip, vp, cnp);
        if (error) {
                ip->i_nlink--;
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
        }
        FREE(cnp->cn_pnbuf, M_NAMEI);
 out1:
        }
        FREE(cnp->cn_pnbuf, M_NAMEI);
 out1:
@@ -958,7 +975,7 @@ abortit:
         *    may be wrong, but correctable.
         */
        ip->i_nlink++;
         *    may be wrong, but correctable.
         */
        ip->i_nlink++;
-       ip->i_flag |= ICHG;
+       ip->i_flag |= ICHANGE;
        tv = time;
        if (error = VOP_UPDATE(fvp, &tv, &tv, 1)) {
                VOP_UNLOCK(fvp);
        tv = time;
        if (error = VOP_UPDATE(fvp, &tv, &tv, 1)) {
                VOP_UNLOCK(fvp);
@@ -1017,14 +1034,14 @@ abortit:
                                goto bad;
                        }
                        dp->i_nlink++;
                                goto bad;
                        }
                        dp->i_nlink++;
-                       dp->i_flag |= ICHG;
+                       dp->i_flag |= ICHANGE;
                        if (error = VOP_UPDATE(tdvp, &tv, &tv, 1))
                                goto bad;
                }
                if (error = ufs_direnter(ip, tdvp, tcnp)) {
                        if (doingdirectory && newparent) {
                                dp->i_nlink--;
                        if (error = VOP_UPDATE(tdvp, &tv, &tv, 1))
                                goto bad;
                }
                if (error = ufs_direnter(ip, tdvp, tcnp)) {
                        if (doingdirectory && newparent) {
                                dp->i_nlink--;
-                               dp->i_flag |= ICHG;
+                               dp->i_flag |= ICHANGE;
                                (void)VOP_UPDATE(tdvp, &tv, &tv, 1);
                        }
                        goto bad;
                                (void)VOP_UPDATE(tdvp, &tv, &tv, 1);
                        }
                        goto bad;
@@ -1080,7 +1097,7 @@ abortit:
                 */
                 if (doingdirectory && !newparent) {
                        dp->i_nlink--;
                 */
                 if (doingdirectory && !newparent) {
                        dp->i_nlink--;
-                       dp->i_flag |= ICHG;
+                       dp->i_flag |= ICHANGE;
                }
                vput(tdvp);
                /*
                }
                vput(tdvp);
                /*
@@ -1100,7 +1117,7 @@ abortit:
                        error = VOP_TRUNCATE(tvp, (off_t)0, IO_SYNC,
                            tcnp->cn_cred, tcnp->cn_proc);
                }
                        error = VOP_TRUNCATE(tvp, (off_t)0, IO_SYNC,
                            tcnp->cn_cred, tcnp->cn_proc);
                }
-               xp->i_flag |= ICHG;
+               xp->i_flag |= ICHANGE;
                vput(tvp);
                xp = NULL;
        }
                vput(tvp);
                xp = NULL;
        }
@@ -1148,7 +1165,7 @@ abortit:
                 */
                if (doingdirectory && newparent) {
                        dp->i_nlink--;
                 */
                if (doingdirectory && newparent) {
                        dp->i_nlink--;
-                       dp->i_flag |= ICHG;
+                       dp->i_flag |= ICHANGE;
                        error = vn_rdwr(UIO_READ, fvp, (caddr_t)&dirbuf,
                                sizeof (struct dirtemplate), (off_t)0,
                                UIO_SYSSPACE, IO_NODELOCKED, 
                        error = vn_rdwr(UIO_READ, fvp, (caddr_t)&dirbuf,
                                sizeof (struct dirtemplate), (off_t)0,
                                UIO_SYSSPACE, IO_NODELOCKED, 
@@ -1183,7 +1200,7 @@ abortit:
                error = ufs_dirremove(fdvp, fcnp);
                if (!error) {
                        xp->i_nlink--;
                error = ufs_dirremove(fdvp, fcnp);
                if (!error) {
                        xp->i_nlink--;
-                       xp->i_flag |= ICHG;
+                       xp->i_flag |= ICHANGE;
                }
                xp->i_flag &= ~IRENAME;
        }
                }
                xp->i_flag &= ~IRENAME;
        }
@@ -1201,7 +1218,7 @@ bad:
 out:
        if (VOP_LOCK(fvp) == 0) {
                ip->i_nlink--;
 out:
        if (VOP_LOCK(fvp) == 0) {
                ip->i_nlink--;
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
                vput(fvp);
        } else
                vrele(fvp);
                vput(fvp);
        } else
                vrele(fvp);
@@ -1272,7 +1289,7 @@ ufs_mkdir(ap)
                return (error);
        }
 #endif
                return (error);
        }
 #endif
-       ip->i_flag |= IACC|IUPD|ICHG;
+       ip->i_flag |= IUPDATE | IACCESS | ICHANGE;
        ip->i_mode = dmode;
        tvp->v_type = VDIR;     /* Rest init'd in iget() */
        ip->i_nlink = 2;
        ip->i_mode = dmode;
        tvp->v_type = VDIR;     /* Rest init'd in iget() */
        ip->i_nlink = 2;
@@ -1286,7 +1303,7 @@ ufs_mkdir(ap)
         * so reparation is possible if we crash.
         */
        dp->i_nlink++;
         * so reparation is possible if we crash.
         */
        dp->i_nlink++;
-       dp->i_flag |= ICHG;
+       dp->i_flag |= ICHANGE;
        if (error = VOP_UPDATE(dvp, &tv, &tv, 1))
                goto bad;
 
        if (error = VOP_UPDATE(dvp, &tv, &tv, 1))
                goto bad;
 
@@ -1303,20 +1320,20 @@ ufs_mkdir(ap)
            IO_NODELOCKED|IO_SYNC, cnp->cn_cred, (int *)0, (struct proc *)0);
        if (error) {
                dp->i_nlink--;
            IO_NODELOCKED|IO_SYNC, cnp->cn_cred, (int *)0, (struct proc *)0);
        if (error) {
                dp->i_nlink--;
-               dp->i_flag |= ICHG;
+               dp->i_flag |= ICHANGE;
                goto bad;
        }
        if (DIRBLKSIZ > VFSTOUFS(dvp->v_mount)->um_mountp->mnt_stat.f_bsize)
                panic("ufs_mkdir: blksize"); /* XXX should grow with balloc() */
        else {
                ip->i_size = DIRBLKSIZ;
                goto bad;
        }
        if (DIRBLKSIZ > VFSTOUFS(dvp->v_mount)->um_mountp->mnt_stat.f_bsize)
                panic("ufs_mkdir: blksize"); /* XXX should grow with balloc() */
        else {
                ip->i_size = DIRBLKSIZ;
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
        }
 
        /* Directory set up, now install it's entry in the parent directory. */
        if (error = ufs_direnter(ip, dvp, cnp)) {
                dp->i_nlink--;
        }
 
        /* Directory set up, now install it's entry in the parent directory. */
        if (error = ufs_direnter(ip, dvp, cnp)) {
                dp->i_nlink--;
-               dp->i_flag |= ICHG;
+               dp->i_flag |= ICHANGE;
        }
 bad:
        /*
        }
 bad:
        /*
@@ -1325,7 +1342,7 @@ bad:
         */
        if (error) {
                ip->i_nlink = 0;
         */
        if (error) {
                ip->i_nlink = 0;
-               ip->i_flag |= ICHG;
+               ip->i_flag |= ICHANGE;
                vput(tvp);
        } else
                *ap->a_vpp = tvp;
                vput(tvp);
        } else
                *ap->a_vpp = tvp;
@@ -1387,7 +1404,7 @@ ufs_rmdir(ap)
        if (error = ufs_dirremove(dvp, cnp))
                goto out;
        dp->i_nlink--;
        if (error = ufs_dirremove(dvp, cnp))
                goto out;
        dp->i_nlink--;
-       dp->i_flag |= ICHG;
+       dp->i_flag |= ICHANGE;
        cache_purge(dvp);
        vput(dvp);
        dvp = NULL;
        cache_purge(dvp);
        vput(dvp);
        dvp = NULL;
@@ -1439,7 +1456,7 @@ ufs_symlink(ap)
                ip = VTOI(vp);
                bcopy(ap->a_target, (char *)ip->i_shortlink, len);
                ip->i_size = len;
                ip = VTOI(vp);
                bcopy(ap->a_target, (char *)ip->i_shortlink, len);
                ip->i_size = len;
-               ip->i_flag |= IUPD|ICHG;
+               ip->i_flag |= IUPDATE |ICHANGE;
        } else
                error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,
                    UIO_SYSSPACE, IO_NODELOCKED, ap->a_cnp->cn_cred, (int *)0,
        } else
                error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,
                    UIO_SYSSPACE, IO_NODELOCKED, ap->a_cnp->cn_cred, (int *)0,
@@ -1771,7 +1788,7 @@ ufsspec_read(ap)
        /*
         * Set access flag.
         */
        /*
         * Set access flag.
         */
-       VTOI(ap->a_vp)->i_flag |= IACC;
+       VTOI(ap->a_vp)->i_flag |= IACCESS;
        return (VOCALL (spec_vnodeop_p, VOFFSET(vop_read), ap));
 }
 
        return (VOCALL (spec_vnodeop_p, VOFFSET(vop_read), ap));
 }
 
@@ -1791,7 +1808,7 @@ ufsspec_write(ap)
        /*
         * Set update and change flags.
         */
        /*
         * Set update and change flags.
         */
-       VTOI(ap->a_vp)->i_flag |= IUPD|ICHG;
+       VTOI(ap->a_vp)->i_flag |= IUPDATE | ICHANGE;
        return (VOCALL (spec_vnodeop_p, VOFFSET(vop_write), ap));
 }
 
        return (VOCALL (spec_vnodeop_p, VOFFSET(vop_write), ap));
 }
 
@@ -1834,7 +1851,7 @@ ufsfifo_read(ap)
        /*
         * Set access flag.
         */
        /*
         * Set access flag.
         */
-       VTOI(ap->a_vp)->i_flag |= IACC;
+       VTOI(ap->a_vp)->i_flag |= IACCESS;
        return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_read), ap));
 }
 
        return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_read), ap));
 }
 
@@ -1855,7 +1872,7 @@ ufsfifo_write(ap)
        /*
         * Set update and change flags.
         */
        /*
         * Set update and change flags.
         */
-       VTOI(ap->a_vp)->i_flag |= IUPD|ICHG;
+       VTOI(ap->a_vp)->i_flag |= IUPDATE | ICHANGE;
        return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_write), ap));
 }
 
        return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_write), ap));
 }
 
@@ -2111,7 +2128,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
                return (error);
        }
 #endif
                return (error);
        }
 #endif
-       ip->i_flag |= IACC|IUPD|ICHG;
+       ip->i_flag |= IUPDATE | IACCESS | ICHANGE;
        ip->i_mode = mode;
        tvp->v_type = IFTOVT(mode);     /* Rest init'd in iget() */
        ip->i_nlink = 1;
        ip->i_mode = mode;
        tvp->v_type = IFTOVT(mode);     /* Rest init'd in iget() */
        ip->i_nlink = 1;
@@ -2141,7 +2158,7 @@ bad:
        free(cnp->cn_pnbuf, M_NAMEI);
        vput(dvp);
        ip->i_nlink = 0;
        free(cnp->cn_pnbuf, M_NAMEI);
        vput(dvp);
        ip->i_nlink = 0;
-       ip->i_flag |= ICHG;
+       ip->i_flag |= ICHANGE;
        vput(tvp);
        return (error);
 }
        vput(tvp);
        return (error);
 }