From a93b71cb03c8c5aa9a7a11d5e02340baa2753443 Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Thu, 3 Oct 2002 01:42:43 +0000 Subject: [PATCH] Clean up the #ifdefs around getuerror calls: change KERNEL_HAVE_SETUERROR to KERNEL_HAVE_UERROR, and use that for both setuerror and getuerror. --- src/afs/IRIX/osi_groups.c | 4 ++-- src/afs/afs_call.c | 14 +++++++------- src/afs/afs_dcache.c | 4 ++-- src/afs/afs_nfsclnt.c | 6 +++--- src/afs/afs_osi_pag.c | 22 +++++++++------------- src/afs/afs_pioctl.c | 16 ++++++++-------- 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 | 2 +- src/config/param.sun4_413.h | 2 +- 12 files changed, 37 insertions(+), 41 deletions(-) diff --git a/src/afs/IRIX/osi_groups.c b/src/afs/IRIX/osi_groups.c index 040dcb704..97518a1ef 100644 --- a/src/afs/IRIX/osi_groups.c +++ b/src/afs/IRIX/osi_groups.c @@ -283,7 +283,7 @@ 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) { -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) return (setuerror(E2BIG), E2BIG); #else return (E2BIG); @@ -297,7 +297,7 @@ 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)) { -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) return (setuerror(code), code); #else return code; diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index f10e12393..5c5c33fc2 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -323,7 +323,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(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) setuerror(EACCES); return(EACCES); #else @@ -558,7 +558,7 @@ long parm, parm2, parm3, parm4, parm5, parm6; AFS_COPYIN((char *)parm2, (caddr_t) &cparms, sizeof(cparms), code); if (code) { -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) setuerror(code); code = -1; #endif @@ -741,7 +741,7 @@ long parm, parm2, parm3, parm4, parm5, parm6; #ifdef AFS_HPUX_ENV vfsmount(parm2, parm3, parm4, parm5); #else /* defined(AFS_HPUX_ENV) */ -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) setuerror(EINVAL); #else code = EINVAL; @@ -1316,7 +1316,7 @@ Afs_syscall () code = copyin_iparam((char *)uap->parm3, &iparams); if (code) { -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) setuerror(code); #endif } else @@ -1364,13 +1364,13 @@ Afs_syscall () } #else if (code) { -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) setuerror(code); #endif } #endif /* !AFS_LINUX20_ENV */ } else { -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) setuerror(EINVAL); #else code = EINVAL; @@ -1592,7 +1592,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(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) setuerror(EACCES); return EACCES; #else diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index ed7e3a196..0fcfa3cb4 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -1258,7 +1258,7 @@ static int afs_UFSCacheStoreProc(register struct rx_call *acall, tlen = (alen > AFS_LRALLOCSIZ ? AFS_LRALLOCSIZ : alen); got = afs_osi_Read(afile, -1, tbuffer, tlen); if ((got < 0) -#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) +#if defined(KERNEL_HAVE_UERROR) || (got != tlen && getuerror()) #endif ) { @@ -2768,7 +2768,7 @@ struct dcache *afs_UFSGetDSlot(register afs_int32 aslot, register struct dcache tdc->f.chunk = -1; hones(tdc->f.versionNo); tdc->dflags |= DFEntryMod; -#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) +#if defined(KERNEL_HAVE_UERROR) last_error = getuerror(); #endif lasterrtime = osi_Time(); diff --git a/src/afs/afs_nfsclnt.c b/src/afs/afs_nfsclnt.c index fc36d1609..27481415d 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(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) setuerror(code); #endif return (code); @@ -228,7 +228,7 @@ afs_int32 *pagparam; #endif afs_PutNfsClientPag(np); /* ReleaseWriteLock(&afs_xnfsreq); */ -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) 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(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) setuerror(code); #endif return (code); diff --git a/src/afs/afs_osi_pag.c b/src/afs/afs_osi_pag.c index 4b4f5216e..924355afa 100644 --- a/src/afs/afs_osi_pag.c +++ b/src/afs/afs_osi_pag.c @@ -207,16 +207,14 @@ afs_setpag (void) #endif afs_Trace1(afs_iclSetp, CM_TRACE_SETPAG, ICL_TYPE_INT32, code); -#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) +#if defined(KERNEL_HAVE_UERROR) + if (!getuerror()) + setuerror(code); +#endif #if defined(AFS_SGI53_ENV) && defined(MP) AFS_GUNLOCK(); -#endif /* defined(AFS_SGI53_ENV) && defined(MP) */ +#endif /* defined(AFS_SGI53_ENV) && defined(MP) */ return (code); -#else - if (!getuerror()) - setuerror(code); - return (code); -#endif } #if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS) @@ -300,16 +298,14 @@ afs_setpag_val (int pagval) #endif afs_Trace1(afs_iclSetp, CM_TRACE_SETPAG, ICL_TYPE_INT32, code); -#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) +#if defined(KERNEL_HAVE_UERROR) + if (!getuerror()) + setuerror(code); +#endif #if defined(AFS_SGI53_ENV) && defined(MP) AFS_GUNLOCK(); #endif /* defined(AFS_SGI53_ENV) && defined(MP) */ return (code); -#else - if (!getuerror()) - setuerror(code); - return (code); -#endif } #endif /* UKERNEL && AFS_WEB_ENHANCEMENTS */ diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index b1132d7fb..ccb6cecab 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -671,7 +671,7 @@ int afs_xioctl (void) #ifdef AFS_LINUX22_ENV return -code; #else -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) if (!getuerror()) setuerror(code); #if defined(AFS_AIX32_ENV) && !defined(AFS_AIX41_ENV) @@ -798,7 +798,7 @@ afs_syscall_pioctl(path, com, cmarg, follow) code = copyin_afs_ioctl(cmarg, &data); if (code) { PIOCTL_FREE_CRED(); -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) setuerror(code); #endif return (code); @@ -830,7 +830,7 @@ afs_syscall_pioctl(path, com, cmarg, follow) crfree(foreigncreds); } PIOCTL_FREE_CRED(); -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) return (setuerror(code), code); #else return (code); @@ -918,7 +918,7 @@ afs_syscall_pioctl(path, com, cmarg, follow) } #endif /* AFS_LINUX22_ENV */ PIOCTL_FREE_CRED(); -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) return (setuerror(code), code); #else return (code); @@ -961,7 +961,7 @@ afs_syscall_pioctl(path, com, cmarg, follow) } #endif /* AFS_LINUX22_ENV */ PIOCTL_FREE_CRED(); -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) return(setuerror(code), code); #else return (code); @@ -1026,7 +1026,7 @@ afs_syscall_pioctl(path, com, cmarg, follow) #endif /* AFS_AIX41_ENV */ #endif /* AFS_SUN5_ENV */ } else { -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) setuerror(EINVAL); #else code = EINVAL; /* not in /afs */ @@ -1067,7 +1067,7 @@ afs_syscall_pioctl(path, com, cmarg, follow) #endif } PIOCTL_FREE_CRED(); -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) if (!getuerror()) setuerror(code); return (getuerror()); @@ -2606,7 +2606,7 @@ DECL_PIOCTL(PSetSysName) AFS_STATCNT(PSetSysName); if (!afs_globalVFS) { /* Afsd is NOT running; disable it */ -#if defined(KERNEL_HAVE_SETUERROR) +#if defined(KERNEL_HAVE_UERROR) return (setuerror(EINVAL), EINVAL); #else return (EINVAL); diff --git a/src/config/param.hp_ux102.h b/src/config/param.hp_ux102.h index 762787a24..0a69d60e8 100644 --- a/src/config/param.hp_ux102.h +++ b/src/config/param.hp_ux102.h @@ -46,7 +46,7 @@ } \ } -#define KERNEL_HAVE_SETUERROR 1 +#define KERNEL_HAVE_UERROR 1 /* Extra kernel definitions (from kdefs file) */ #ifdef KERNEL diff --git a/src/config/param.hp_ux110.h b/src/config/param.hp_ux110.h index 02e3b3e7b..79b59785b 100644 --- a/src/config/param.hp_ux110.h +++ b/src/config/param.hp_ux110.h @@ -50,7 +50,7 @@ } \ } -#define KERNEL_HAVE_SETUERROR 1 +#define KERNEL_HAVE_UERROR 1 /* Extra kernel definitions (from kdefs file) */ #ifdef KERNEL diff --git a/src/config/param.rs_aix42.h b/src/config/param.rs_aix42.h index 90595be4a..327fd0116 100644 --- a/src/config/param.rs_aix42.h +++ b/src/config/param.rs_aix42.h @@ -48,7 +48,7 @@ #define COMPAT_43 #endif -#define KERNEL_HAVE_SETUERROR 1 +#define KERNEL_HAVE_UERROR 1 #define KERNEL_HAVE_PIN 1 /* Extra kernel definitions (from kdefs file) */ diff --git a/src/config/param.sgi_62.h b/src/config/param.sgi_62.h index 0803007c2..20e8934d1 100644 --- a/src/config/param.sgi_62.h +++ b/src/config/param.sgi_62.h @@ -63,7 +63,7 @@ #define SYS_NAME_ID SYS_NAME_ID_sgi_62 #define AFSBIG_ENDIAN 1 -#define KERNEL_HAVE_SETUERROR 1 +#define KERNEL_HAVE_UERROR 1 /* Extra kernel definitions (from kdefs file) */ #ifdef KERNEL diff --git a/src/config/param.sgi_63.h b/src/config/param.sgi_63.h index a34237bdd..6f01cab4d 100644 --- a/src/config/param.sgi_63.h +++ b/src/config/param.sgi_63.h @@ -55,7 +55,7 @@ #define AFSBIG_ENDIAN 1 #define AFS_VM_RDWR_ENV 1 -#define KERNEL_HAVE_SETUERROR 1 +#define KERNEL_HAVE_UERROR 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 8fedc5fdf..c714e0166 100644 --- a/src/config/param.sun4_413.h +++ b/src/config/param.sun4_413.h @@ -35,7 +35,7 @@ #define AFS_HAVE_STATVFS 0 #define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ -#define KERNEL_HAVE_SETUERROR 1 +#define KERNEL_HAVE_UERROR 1 /* Extra kernel definitions (from kdefs file) */ #ifdef KERNEL -- 2.39.5