From d5aa87a7a54888d8c4c041f676accc199562ed28 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Tue, 27 Aug 2002 22:42:25 +0000 Subject: [PATCH] cachemgr-setuerror-ifdef-cleanup-20020827 feature-ifdef for setuerror, and clean up where it's called --- src/afs/IRIX/osi_groups.c | 12 +++++----- src/afs/afs_call.c | 28 ++++++++++++-------------- src/afs/afs_nfsclnt.c | 6 ++-- src/afs/afs_pioctl.c | 44 ++++++++++++++++++++---------------------- src/config/param.hp_ux102.h | 2 + src/config/param.hp_ux110.h | 2 + src/config/param.rs_aix42.h | 2 + src/config/param.sgi_62.h | 2 + src/config/param.sgi_63.h | 1 + src/config/param.sun4_413.h | 2 + 10 files changed, 54 insertions(+), 47 deletions(-) diff --git a/src/afs/IRIX/osi_groups.c b/src/afs/IRIX/osi_groups.c index 213e30e..040dcb7 100644 --- a/src/afs/IRIX/osi_groups.c +++ b/src/afs/IRIX/osi_groups.c @@ -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; diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index 71ee1af..0fc8ba6 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -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 diff --git a/src/afs/afs_nfsclnt.c b/src/afs/afs_nfsclnt.c index b93819a..42725d1 100644 --- a/src/afs/afs_nfsclnt.c +++ b/src/afs/afs_nfsclnt.c @@ -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); diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 1dd5839..e9b108f 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -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); diff --git a/src/config/param.hp_ux102.h b/src/config/param.hp_ux102.h index 34a71e7..762787a 100644 --- a/src/config/param.hp_ux102.h +++ b/src/config/param.hp_ux102.h @@ -46,6 +46,8 @@ } \ } +#define KERNEL_HAVE_SETUERROR 1 + /* Extra kernel definitions (from kdefs file) */ #ifdef KERNEL #define _KERNEL 1 diff --git a/src/config/param.hp_ux110.h b/src/config/param.hp_ux110.h index cb5fc78..02e3b3e 100644 --- a/src/config/param.hp_ux110.h +++ b/src/config/param.hp_ux110.h @@ -50,6 +50,8 @@ } \ } +#define KERNEL_HAVE_SETUERROR 1 + /* Extra kernel definitions (from kdefs file) */ #ifdef KERNEL #define _KERNEL 1 diff --git a/src/config/param.rs_aix42.h b/src/config/param.rs_aix42.h index 3ed8e27..4a3f5fc 100644 --- a/src/config/param.rs_aix42.h +++ b/src/config/param.rs_aix42.h @@ -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 diff --git a/src/config/param.sgi_62.h b/src/config/param.sgi_62.h index 3055712..0803007 100644 --- a/src/config/param.sgi_62.h +++ b/src/config/param.sgi_62.h @@ -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 */ diff --git a/src/config/param.sgi_63.h b/src/config/param.sgi_63.h index 0cecc28..a34237b 100644 --- a/src/config/param.sgi_63.h +++ b/src/config/param.sgi_63.h @@ -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 */ diff --git a/src/config/param.sun4_413.h b/src/config/param.sun4_413.h index a93bd4a..8fedc5f 100644 --- a/src/config/param.sun4_413.h +++ b/src/config/param.sun4_413.h @@ -35,6 +35,8 @@ #define AFS_HAVE_STATVFS 0 #define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ +#define KERNEL_HAVE_SETUERROR 1 + /* Extra kernel definitions (from kdefs file) */ #ifdef KERNEL /* sun definitions here */ -- 1.7.1