cachemgr-setuerror-ifdef-cleanup-20020827
authorDerrick Brashear <shadow@dementia.org>
Tue, 27 Aug 2002 22:42:25 +0000 (22:42 +0000)
committerDerrick Brashear <shadow@dementia.org>
Tue, 27 Aug 2002 22:42:25 +0000 (22:42 +0000)
feature-ifdef for setuerror, and clean up where it's called

src/afs/IRIX/osi_groups.c
src/afs/afs_call.c
src/afs/afs_nfsclnt.c
src/afs/afs_pioctl.c
src/config/param.hp_ux102.h
src/config/param.hp_ux110.h
src/config/param.rs_aix42.h
src/config/param.sgi_62.h
src/config/param.sgi_63.h
src/config/param.sun4_413.h

index 213e30e..040dcb7 100644 (file)
@@ -283,10 +283,10 @@ setpag(cred, pagvalue, newpag, change_parent)
     if (afs_get_pag_from_groups(gidset[0], gidset[1]) == NOPAG) {
        /* We will have to shift grouplist to make room for pag */
        if (ngroups + 2 > NGROUPS) {
-#ifdef AFS_SGI64_ENV
-           return (E2BIG);
-#else
+#if defined(KERNEL_HAVE_SETUERROR)
            return (setuerror(E2BIG), E2BIG);
+#else
+           return (E2BIG);
 #endif
        }
        for (j = ngroups -1; j >= 0; j--) {
@@ -297,10 +297,10 @@ setpag(cred, pagvalue, newpag, change_parent)
     *newpag = (pagvalue == -1 ? genpag(): pagvalue);
     afs_get_groups_from_pag(*newpag, &gidset[0], &gidset[1]);
     if (code = afs_setgroups(cred, ngroups, gidset, change_parent)) {
-#ifdef AFS_SGI64_ENV
-        return code;
-#else
+#if defined(KERNEL_HAVE_SETUERROR)
        return (setuerror(code), code);
+#else
+        return code;
 #endif
     }
     return code;
index 71ee1af..0fc8ba6 100644 (file)
@@ -153,7 +153,7 @@ long parm, parm2, parm3, parm4, parm5, parm6;
     if (!afs_suser() && (parm != AFSOP_GETMTU)
        && (parm != AFSOP_GETMASK)) {
       /* only root can run this code */
-#if !defined(AFS_SGI_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
+#if defined(KERNEL_HAVE_SETUERROR)
        setuerror(EACCES);
        return(EACCES);
 #else
@@ -381,13 +381,11 @@ long parm, parm2, parm3, parm4, parm5, parm6;
 
        AFS_COPYIN((char *)parm2, (caddr_t) &cparms, sizeof(cparms), code);
        if (code) {
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined (AFS_SGI64_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-           goto out;
-#else
+#if defined(KERNEL_HAVE_SETUERROR)
            setuerror(code);
            code = -1;
-           goto out;
 #endif
+           goto out;
        }
        afs_CacheInit_Done = 1;
     {
@@ -572,10 +570,10 @@ long parm, parm2, parm3, parm4, parm5, parm6;
       afs_vfs_mount(parm2, parm3, parm4, parm5);
 #endif /* AFS_HPUX100_ENV */
 #else /* defined(AFS_HPUX_ENV) */
-#if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-      code = EINVAL;
-#else
+#if defined(KERNEL_HAVE_SETUERROR)
       setuerror(EINVAL);
+#else
+      code = EINVAL;
 #endif
 #endif /* defined(AFS_HPUX_ENV) */
     }
@@ -1150,7 +1148,7 @@ Afs_syscall ()
 
        code = copyin_iparam((char *)uap->parm3, &iparams);
        if (code) {
-#if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
+#if defined(KERNEL_HAVE_SETUERROR)
            setuerror(code);
 #endif
        } else
@@ -1198,17 +1196,17 @@ Afs_syscall ()
        }
 #else
         if (code) {
-#if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
+#if defined(KERNEL_HAVE_SETUERROR)
            setuerror(code);
 #endif
         }
 #endif /* !AFS_LINUX20_ENV */
     } else {
-#if defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-       code = EINVAL;
-#else
+#if defined(KERNEL_HAVE_SETUERROR)
         setuerror(EINVAL);
-#endif /* AFS_SUN5_ENV */
+#else
+       code = EINVAL;
+#endif
     }
 out:
 #ifdef AFS_LINUX20_ENV
@@ -1426,7 +1424,7 @@ Afscall_icl(long opcode, long p1, long p2, long p3, long p4, long *retval)
     }
 #else
     if (!afs_suser()) {        /* only root can run this code */
-#if !defined(AFS_SGI_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
+#if defined(KERNEL_HAVE_SETUERROR)
        setuerror(EACCES);
        return EACCES;
 #else
index b93819a..42725d1 100644 (file)
@@ -212,7 +212,7 @@ afs_int32 *pagparam;
 #endif
            if (au) afs_PutUser(au, READ_LOCK);
 /*         ReleaseWriteLock(&afs_xnfsreq);             */
-#if    !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_SGI64_ENV)
+#if defined(KERNEL_HAVE_SETUERROR)
            setuerror(code);
 #endif
            return (code);
@@ -228,7 +228,7 @@ afs_int32 *pagparam;
 #endif
                afs_PutNfsClientPag(np);
 /*             ReleaseWriteLock(&afs_xnfsreq); */
-#if    !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_SGI64_ENV)
+#if defined(KERNEL_HAVE_SETUERROR)
                setuerror(code);
 #endif
                return (code);
@@ -245,7 +245,7 @@ afs_int32 *pagparam;
                    afs_PutNfsClientPag(np);
                    afs_PutUser(au, READ_LOCK);
                    /*      ReleaseWriteLock(&afs_xnfsreq);     */
-#if    !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_SGI64_ENV)
+#if defined(KERNEL_HAVE_SETUERROR)
                    setuerror(code);
 #endif
                    return (code);
index 1dd5839..e9b108f 100644 (file)
@@ -650,7 +650,7 @@ int afs_xioctl (void)
 #ifdef AFS_LINUX22_ENV
       return -code;
 #else
-#if    !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
+#if defined(KERNEL_HAVE_SETUERROR)
       if (!getuerror())
          setuerror(code);
 #if    defined(AFS_AIX32_ENV) && !defined(AFS_AIX41_ENV)
@@ -777,12 +777,10 @@ afs_syscall_pioctl(path, com, cmarg, follow)
     code = copyin_afs_ioctl(cmarg, &data);
     if (code) {
        PIOCTL_FREE_CRED();
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-       return (code);
-#else
+#if defined(KERNEL_HAVE_SETUERROR)
        setuerror(code);
-       return code;
 #endif
+       return (code);
   }
     if ((com & 0xff) == PSetClientContext) {
 #if defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
@@ -807,10 +805,10 @@ afs_syscall_pioctl(path, com, cmarg, follow)
              crfree(foreigncreds);
          }
          PIOCTL_FREE_CRED();
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-         return (code);
-#else
+#if defined(KERNEL_HAVE_SETUERROR)
          return (setuerror(code), code);
+#else
+         return (code);
 #endif
       }
     } 
@@ -886,10 +884,10 @@ afs_syscall_pioctl(path, com, cmarg, follow)
        }
 #endif /* AFS_LINUX22_ENV */
        PIOCTL_FREE_CRED();
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-       return (code);
-#else
+#if defined(KERNEL_HAVE_SETUERROR)
        return (setuerror(code), code);
+#else
+       return (code);
 #endif
     }
     if (path) {
@@ -929,10 +927,10 @@ afs_syscall_pioctl(path, com, cmarg, follow)
            }
 #endif /* AFS_LINUX22_ENV */
            PIOCTL_FREE_CRED();
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-           return (code);
-#else
+#if defined(KERNEL_HAVE_SETUERROR)
            return(setuerror(code), code);
+#else
+           return (code);
 #endif
        }
     }
@@ -994,10 +992,10 @@ afs_syscall_pioctl(path, com, cmarg, follow)
 #endif /* AFS_AIX41_ENV */
 #endif /* AFS_SUN5_ENV */
     } else {
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-       code = EINVAL;  /* not in /afs */
-#else
+#if defined(KERNEL_HAVE_SETUERROR)
        setuerror(EINVAL);
+#else
+       code = EINVAL;  /* not in /afs */
 #endif
 #ifdef AFS_DEC_ENV
        if (vp) {
@@ -1035,12 +1033,12 @@ afs_syscall_pioctl(path, com, cmarg, follow)
 #endif
     }
     PIOCTL_FREE_CRED();
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-    return (code);
-#else
+#if defined(KERNEL_HAVE_SETUERROR)
     if (!getuerror())  
        setuerror(code);
     return (getuerror());
+#else
+    return (code);
 #endif
 }
   
@@ -2573,10 +2571,10 @@ DECL_PIOCTL(PSetSysName)
     AFS_STATCNT(PSetSysName);
     if (!afs_globalVFS) {
       /* Afsd is NOT running; disable it */
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-       return (EINVAL);
-#else
+#if defined(KERNEL_HAVE_SETUERROR)
        return (setuerror(EINVAL), EINVAL);
+#else
+       return (EINVAL);
 #endif
     }
     memset(inname, 0, MAXSYSNAME);
index 34a71e7..762787a 100644 (file)
@@ -46,6 +46,8 @@
                 }                                       \
                 }
 
+#define KERNEL_HAVE_SETUERROR 1
+
 /* Extra kernel definitions (from kdefs file) */
 #ifdef KERNEL
 #define _KERNEL 1
index cb5fc78..02e3b3e 100644 (file)
@@ -50,6 +50,8 @@
                 }                                       \
                 }
 
+#define KERNEL_HAVE_SETUERROR 1
+
 /* Extra kernel definitions (from kdefs file) */
 #ifdef KERNEL
 #define _KERNEL 1
index 3ed8e27..4a3f5fc 100644 (file)
@@ -44,6 +44,8 @@
 #define COMPAT_43
 #endif
 
+#define KERNEL_HAVE_SETUERROR 1
+
 /* Extra kernel definitions (from kdefs file) */
 #ifdef _KERNEL
 #define        AFS_SHORTGID    1
index 3055712..0803007 100644 (file)
@@ -63,6 +63,8 @@
 #define SYS_NAME_ID    SYS_NAME_ID_sgi_62
 #define AFSBIG_ENDIAN  1
 
+#define KERNEL_HAVE_SETUERROR 1
+
 /* Extra kernel definitions (from kdefs file) */
 #ifdef KERNEL
 /* definitions here */
index 0cecc28..a34237b 100644 (file)
@@ -55,6 +55,7 @@
 #define AFSBIG_ENDIAN  1
 #define AFS_VM_RDWR_ENV        1
 
+#define KERNEL_HAVE_SETUERROR 1
 /* Extra kernel definitions (from kdefs file) */
 #ifdef KERNEL
 /* definitions here */
index a93bd4a..8fedc5f 100644 (file)
@@ -35,6 +35,8 @@
 #define AFS_HAVE_STATVFS 0\r
 #define AFS_VM_RDWR_ENV        1       /* read/write implemented via VM */\r
 \r
+#define KERNEL_HAVE_SETUERROR 1\r
+\r
 /* Extra kernel definitions (from kdefs file) */\r
 #ifdef KERNEL\r
 /* sun definitions here */\r