rename file flags to UF_* and SF_*, minimize name space problems
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 5 Mar 1993 07:56:36 +0000 (23:56 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 5 Mar 1993 07:56:36 +0000 (23:56 -0800)
SCCS-vsn: sys/sys/stat.h 7.19
SCCS-vsn: lib/libc/sys/chflags.2 6.9
SCCS-vsn: sys/ufs/ffs/ufs_vnops.c 7.114
SCCS-vsn: sys/ufs/ufs/ufs_vnops.c 7.114
SCCS-vsn: bin/ls/stat_flags.c 5.2

usr/src/bin/ls/stat_flags.c
usr/src/lib/libc/sys/chflags.2
usr/src/sys/sys/stat.h
usr/src/sys/ufs/ffs/ufs_vnops.c
usr/src/sys/ufs/ufs/ufs_vnops.c

index 3c36833..425f25d 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)stat_flags.c       5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)stat_flags.c       5.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -37,18 +37,18 @@ flags_to_string(flags, def)
 
        string[0] = '\0';
        prefix = NULL;
 
        string[0] = '\0';
        prefix = NULL;
-       if (flags & ARCHIVED)
-               SAPPEND("arch");
-       if (flags & NODUMP)
-               SAPPEND("nodump");
-       if (flags & USR_IMMUTABLE)
-               SAPPEND("uchg");
-       if (flags & USR_APPEND)
+       if (flags & UF_APPEND)
                SAPPEND("uappnd");
                SAPPEND("uappnd");
-       if (flags & SYS_IMMUTABLE)
-               SAPPEND("schg");
-       if (flags & SYS_APPEND)
+       if (flags & UF_IMMUTABLE)
+               SAPPEND("uchg");
+       if (flags & UF_NODUMP)
+               SAPPEND("nodump");
+       if (flags & SF_APPEND)
                SAPPEND("sappnd");
                SAPPEND("sappnd");
+       if (flags & SF_ARCHIVED)
+               SAPPEND("arch");
+       if (flags & SF_IMMUTABLE)
+               SAPPEND("schg");
        return (prefix == NULL && def != NULL ? def : string);
 }
 
        return (prefix == NULL && def != NULL ? def : string);
 }
 
@@ -93,26 +93,26 @@ string_to_flags(stringp, setp, clrp)
                }
                switch (p[0]) {
                case 'a':
                }
                switch (p[0]) {
                case 'a':
-                       TEST(p, "arch", ARCHIVED);
-                       TEST(p, "archived", ARCHIVED);
+                       TEST(p, "arch", SF_ARCHIVED);
+                       TEST(p, "archived", SF_ARCHIVED);
                        return (1);
                case 'd':
                        clear = !clear;
                        return (1);
                case 'd':
                        clear = !clear;
-                       TEST(p, "dump", NODUMP);
+                       TEST(p, "dump", UF_NODUMP);
                        return (1);
                case 's':
                        return (1);
                case 's':
-                       TEST(p, "sappnd", SYS_APPEND);
-                       TEST(p, "sappend", SYS_APPEND);
-                       TEST(p, "schg", SYS_IMMUTABLE);
-                       TEST(p, "schange", SYS_IMMUTABLE);
-                       TEST(p, "simmutable", SYS_IMMUTABLE);
+                       TEST(p, "sappnd", SF_APPEND);
+                       TEST(p, "sappend", SF_APPEND);
+                       TEST(p, "schg", SF_IMMUTABLE);
+                       TEST(p, "schange", SF_IMMUTABLE);
+                       TEST(p, "simmutable", SF_IMMUTABLE);
                        return (1);
                case 'u':
                        return (1);
                case 'u':
-                       TEST(p, "uappnd", USR_APPEND);
-                       TEST(p, "uappend", USR_APPEND);
-                       TEST(p, "uchg", USR_IMMUTABLE);
-                       TEST(p, "uchange", USR_IMMUTABLE);
-                       TEST(p, "uimmutable", SYS_IMMUTABLE);
+                       TEST(p, "uappnd", UF_APPEND);
+                       TEST(p, "uappend", UF_APPEND);
+                       TEST(p, "uchg", UF_IMMUTABLE);
+                       TEST(p, "uchange", UF_IMMUTABLE);
+                       TEST(p, "uimmutable", UF_IMMUTABLE);
                        /* FALLTHROUGH */
                default:
                        return (1);
                        /* FALLTHROUGH */
                default:
                        return (1);
index 2d3a2e7..cf1aed6 100644 (file)
@@ -3,7 +3,7 @@
 .\"
 .\" %sccs.include.redist.roff%
 .\"
 .\"
 .\" %sccs.include.redist.roff%
 .\"
-.\"    @(#)chflags.2   6.8 (Berkeley) %G%
+.\"    @(#)chflags.2   6.9 (Berkeley) %G%
 .\"
 .Dd 
 .Dt CHFLAGS 2
 .\"
 .Dd 
 .Dt CHFLAGS 2
@@ -32,31 +32,31 @@ The flags specified are formed by
 .Em or Ns 'ing
 the following values
 .Pp
 .Em or Ns 'ing
 the following values
 .Pp
-.Bl -tag -width "SYS_IMMUTABLE" -compact -offset indent
-.It NODUMP
+.Bl -tag -width "SF_IMMUTABLE" -compact -offset indent
+.It UF_NODUMP
 Do not dump the file.
 Do not dump the file.
-.It USR_IMMUTABLE
+.It UF_IMMUTABLE
 The file may not be changed.
 The file may not be changed.
-.It USR_APPEND
+.It UF_APPEND
 The file may only be appended to.
 .\".It ARCHIVED
 .\"File is archived.
 The file may only be appended to.
 .\".It ARCHIVED
 .\"File is archived.
-.It SYS_IMMUTABLE
+.It SF_IMMUTABLE
 The file may not be changed.
 The file may not be changed.
-.It SYS_APPEND
+.It SF_APPEND
 The file may only be appended to.
 .El
 .Pp
 The
 The file may only be appended to.
 .El
 .Pp
 The
-.Dq USR_IMMUTABLE
+.Dq UF_IMMUTABLE
 and
 and
-.Dq USR_APPEND
+.Dq UF_APPEND
 flags may be set or unset by either the owner of a file or the super-user.
 .Pp
 The
 flags may be set or unset by either the owner of a file or the super-user.
 .Pp
 The
-.Dq SYS_IMMUTABLE
+.Dq SF_IMMUTABLE
 and
 and
-.Dq SYS_APPEND
+.Dq SF_APPEND
 flags may only be set or unset by the super-user.
 They may be set at any time, but normally may only be unset when
 the system is in single-user mode.
 flags may only be set or unset by the super-user.
 They may be set at any time, but normally may only be unset when
 the system is in single-user mode.
index 16ec0ba..9f7d084 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)stat.h      7.18 (Berkeley) %G%
+ *     @(#)stat.h      7.19 (Berkeley) %G%
  */
 
 #include <sys/time.h>
  */
 
 #include <sys/time.h>
@@ -110,20 +110,23 @@ struct stat {
  *
  * Low 16-bits: super-user and owner settable.
  */
  *
  * Low 16-bits: super-user and owner settable.
  */
-#define        NODUMP          0x00000001      /* do not dump file */
-#define        USR_IMMUTABLE   0x00000002      /* file may not be changed */
-#define        USR_APPEND      0x00000004      /* writes to file may only append */
+#define        UF_NODUMP       0x00000001      /* do not dump file */
+#define        UF_IMMUTABLE    0x00000002      /* file may not be changed */
+#define        UF_APPEND       0x00000004      /* writes to file may only append */
 /*
  * High 16-bits: super-user settable.
  */
 /*
  * High 16-bits: super-user settable.
  */
-#define        ARCHIVED        0x00010000      /* file is archived */
-#define        SYS_IMMUTABLE   0x00020000      /* file may not be changed */
-#define        SYS_APPEND      0x00040000      /* writes to file may only append */
+#define        SF_ARCHIVED     0x00010000      /* file is archived */
+#define        SF_IMMUTABLE    0x00020000      /* file may not be changed */
+#define        SF_APPEND       0x00040000      /* writes to file may only append */
+
+#ifdef KERNEL
 /*
  * Shorthand abbreviations of above.
  */
 /*
  * Shorthand abbreviations of above.
  */
-#define        IMMUTABLE       (USR_IMMUTABLE | SYS_IMMUTABLE)
-#define        APPEND          (USR_APPEND | SYS_APPEND)
+#define        APPEND          (UF_APPEND | SF_APPEND)
+#define        IMMUTABLE       (UF_IMMUTABLE | SF_IMMUTABLE)
+#endif
 #endif
 
 #ifndef KERNEL
 #endif
 
 #ifndef KERNEL
index 332bf9a..031648b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_vnops.c 7.113 (Berkeley) %G%
+ *     @(#)ufs_vnops.c 7.114 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -305,12 +305,12 @@ ufs_setattr(ap)
                    (error = suser(cred, &p->p_acflag)))
                        return (error);
                if (cred->cr_uid == 0) {
                    (error = suser(cred, &p->p_acflag)))
                        return (error);
                if (cred->cr_uid == 0) {
-                       if ((ip->i_flags & (SYS_IMMUTABLE | SYS_APPEND)) &&
+                       if ((ip->i_flags & (SF_IMMUTABLE | SF_APPEND)) &&
                            securelevel > 0)
                                return (EPERM);
                        ip->i_flags = vap->va_flags;
                } else {
                            securelevel > 0)
                                return (EPERM);
                        ip->i_flags = vap->va_flags;
                } else {
-                       if (ip->i_flags & (SYS_IMMUTABLE | SYS_APPEND))
+                       if (ip->i_flags & (SF_IMMUTABLE | SF_APPEND))
                                return (EPERM);
                        ip->i_flags &= 0xffff0000;
                        ip->i_flags |= (vap->va_flags & 0xffff);
                                return (EPERM);
                        ip->i_flags &= 0xffff0000;
                        ip->i_flags |= (vap->va_flags & 0xffff);
index 332bf9a..031648b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_vnops.c 7.113 (Berkeley) %G%
+ *     @(#)ufs_vnops.c 7.114 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -305,12 +305,12 @@ ufs_setattr(ap)
                    (error = suser(cred, &p->p_acflag)))
                        return (error);
                if (cred->cr_uid == 0) {
                    (error = suser(cred, &p->p_acflag)))
                        return (error);
                if (cred->cr_uid == 0) {
-                       if ((ip->i_flags & (SYS_IMMUTABLE | SYS_APPEND)) &&
+                       if ((ip->i_flags & (SF_IMMUTABLE | SF_APPEND)) &&
                            securelevel > 0)
                                return (EPERM);
                        ip->i_flags = vap->va_flags;
                } else {
                            securelevel > 0)
                                return (EPERM);
                        ip->i_flags = vap->va_flags;
                } else {
-                       if (ip->i_flags & (SYS_IMMUTABLE | SYS_APPEND))
+                       if (ip->i_flags & (SF_IMMUTABLE | SF_APPEND))
                                return (EPERM);
                        ip->i_flags &= 0xffff0000;
                        ip->i_flags |= (vap->va_flags & 0xffff);
                                return (EPERM);
                        ip->i_flags &= 0xffff0000;
                        ip->i_flags |= (vap->va_flags & 0xffff);