From 50313a72a99ab312a796108d807aef0f6b4d2ca9 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Thu, 15 Oct 2009 19:21:54 -0400 Subject: [PATCH] snowleopard 64 bit warning death make all errors from warnings when compiling on snowleopard die as a note, the ukernel pid, and pthread self as id changes, probably should be revisited, but for now i have changed nothing. it should be a separate change. Reviewed-on: http://gerrit.openafs.org/666 Reviewed-by: Simon Wilkinson Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/afs/UKERNEL/afs_usrops.c | 7 +- src/afs/UKERNEL/sysincludes.h | 3 +- src/afs/afs_icl.c | 2 +- src/afs/afs_lock.c | 33 +---- src/afs/afs_osi.h | 10 +- src/aklog/aklog.c | 4 - src/aklog/aklog_main.c | 5 +- src/aklog/asetkey.c | 9 -- src/aklog/klog.c | 3 +- src/butc/lwps.c | 6 +- src/config/NTMakefile.amd64_w2k | 1 + src/config/param.alpha_linux_26.h | 1 + src/config/param.amd64_fbsd_70.h | 1 + src/config/param.amd64_fbsd_71.h | 1 + src/config/param.amd64_fbsd_80.h | 1 + src/config/param.amd64_linux26.h | 1 + src/config/param.amd64_nbsd30.h | 1 + src/config/param.amd64_nbsd40.h | 1 + src/config/param.amd64_obsd39.h | 1 + src/config/param.amd64_obsd40.h | 1 + src/config/param.amd64_obsd41.h | 1 + src/config/param.amd64_obsd42.h | 1 + src/config/param.amd64_obsd43.h | 1 + src/config/param.amd64_obsd44.h | 1 + src/config/param.amd64_obsd45.h | 1 + src/config/param.hp_ux1123.h | 1 + src/config/param.hp_ux11i.h | 1 + src/config/param.ia64_hpux1122.h | 1 + src/config/param.ia64_hpux1123.h | 1 + src/config/param.ia64_linux26.h | 1 + src/config/param.ppc64_linux26.h | 1 + src/config/param.s390x_linux26.h | 2 + src/config/param.sgi_65.h | 1 + src/config/param.x86_darwin_100.h | 8 +- src/config/stds.h | 8 + src/des/cksum.c | 6 +- src/des/des.c | 4 +- src/des/pcbc_encrypt.c | 14 +- src/kauth/authclient.c | 17 +-- src/kauth/read_passwd.c | 3 +- src/rxkad/rxkad_prototypes.h | 4 + src/ubik/ubik.p.h | 7 +- src/ubik/ubikclient.c | 299 +++++++++++++++++++------------------- src/update/server.c | 2 +- src/util/snprintf.c | 4 +- src/util/uuid.c | 2 + src/vol/daemon_com.c | 2 +- src/volser/vos.c | 15 +- src/volser/vsprocs.c | 9 +- src/volser/vsutils.c | 3 +- 50 files changed, 268 insertions(+), 245 deletions(-) diff --git a/src/afs/UKERNEL/afs_usrops.c b/src/afs/UKERNEL/afs_usrops.c index 2fa5412..1f63ded 100644 --- a/src/afs/UKERNEL/afs_usrops.c +++ b/src/afs/UKERNEL/afs_usrops.c @@ -1301,7 +1301,10 @@ SweepAFSCache(int *vFilesFound) for (currp = readdir(cdirp); currp; currp = readdir(cdirp)) { if (afsd_debug) { printf("%s: Current directory entry:\n", rn); -#if defined(AFS_USR_DFBSD_ENV) +#if defined(AFS_SGI62_ENV) || defined(AFS_USR_DARWIN100_ENV) + printf("\tinode=%" AFS_INT64_FMT ", reclen=%d, name='%s'\n", + currp->d_ino, currp->d_reclen, currp->d_name); +#elif defined(AFS_USR_DFBSD_ENV) printf("\tinode=%d, name='%s'\n", currp->d_ino, currp->d_name); #else @@ -1509,7 +1512,7 @@ uafs_Init(char *rn, char *mountDirParam, char *confDirParam, afs_global_procp = (struct usr_proc *) afs_osi_Alloc(sizeof(struct usr_proc)); usr_assert(afs_global_procp != NULL); - afs_global_procp->p_pid = getpid(); + afs_global_procp->p_pid = osi_getpid(); afs_global_procp->p_ppid = (pid_t) 1; afs_global_procp->p_ucred = afs_global_ucredp; diff --git a/src/afs/UKERNEL/sysincludes.h b/src/afs/UKERNEL/sysincludes.h index 16b65fe..8c1e04d 100644 --- a/src/afs/UKERNEL/sysincludes.h +++ b/src/afs/UKERNEL/sysincludes.h @@ -253,6 +253,7 @@ typedef unsigned int fsblkcnt_t; #define offset_t usr_offset_t #define getpid() usr_getpid() #define setpag(A,B,C,D) usr_setpag((A),(B),(C),(D)) +#define osi_getpid() afs_pointer_to_int(usr_thread_self()) #ifdef pid_t #undef pid_t #endif @@ -840,7 +841,7 @@ enum usr_uio_rw { USR_UIO_READ, USR_UIO_WRITE }; #endif #define NBPG 4096 -#define panic(S) do{fprintf(stderr, S);assert(0);}while(0) +#define panic(S) do{fprintf(stderr, "%s", S);assert(0);}while(0) #define abort() assert(0) #define usr_assert(A) assert(A) diff --git a/src/afs/afs_icl.c b/src/afs/afs_icl.c index 54ce04e..f018324 100644 --- a/src/afs/afs_icl.c +++ b/src/afs/afs_icl.c @@ -514,7 +514,7 @@ afs_icl_AppendString(struct afs_icl_log *logp, char *astr) (lp)->logElements++; \ MACRO_END -#if defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) +#if defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) || defined(AFS_DARWIN_ENV) && defined(__amd64__) #define ICL_APPENDLONG(lp, x) \ MACRO_BEGIN \ ICL_APPENDINT32((lp), ((x) >> 32) & 0xffffffffL); \ diff --git a/src/afs/afs_lock.c b/src/afs/afs_lock.c index a29357f..3b3608c 100644 --- a/src/afs/afs_lock.c +++ b/src/afs/afs_lock.c @@ -272,28 +272,10 @@ afs_BozonLock(struct afs_bozoLock *alock, struct vcache *avc) while (1) { if (alock->count == 0) { /* lock not held, we win */ -#ifdef AFS_SUN5_ENV - alock->proc = (char *)ttoproc(curthread); -#else -#ifdef AFS_64BITPOINTER_ENV - /* To shut up SGI compiler on remark(1413) warnings. */ - alock->proc = (char *)(long)MyPidxx; -#else /* AFS_64BITPOINTER_ENV */ - alock->proc = (char *)MyPidxx; -#endif /* AFS_64BITPOINTER_ENV */ -#endif + alock->proc = afs_int_to_pointer(MyPidxx2Pid(MyPidxx)); alock->count = 1; return; -#ifdef AFS_SUN5_ENV - } else if (alock->proc == (char *)ttoproc(curthread)) { -#else -#ifdef AFS_64BITPOINTER_ENV - /* To shut up SGI compiler on remark(1413) warnings. */ - } else if (alock->proc == (char *)(long)MyPidxx) { -#else /* AFS_64BITPOINTER_ENV */ - } else if (alock->proc == (char *)MyPidxx) { -#endif /* AFS_64BITPOINTER_ENV */ -#endif + } else if (alock->proc == afs_int_to_pointer(MyPidxx2Pid(MyPidxx))) { /* lock is held, but by us, so we win anyway */ alock->count++; return; @@ -343,16 +325,7 @@ afs_CheckBozonLockBlocking(struct afs_bozoLock *alock) { AFS_STATCNT(afs_CheckBozonLockBlocking); if (alock->count || (alock->flags & AFS_BOZONWAITING)) -#ifdef AFS_SUN5_ENV - if (alock->proc != (char *)ttoproc(curthread)) -#else -#ifdef AFS_64BITPOINTER_ENV - /* To shut up SGI compiler on remark(1413) warnings. */ - if (alock->proc != (char *)(long)MyPidxx) -#else /* AFS_64BITPOINTER_ENV */ - if (alock->proc != (char *)MyPidxx) -#endif /* AFS_64BITPOINTER_ENV */ -#endif + if (alock->proc != afs_int_to_pointer(MyPidxx2Pid(MyPidxx))) return 1; return 0; } diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index 1dab445..e91c229 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -191,9 +191,9 @@ typedef struct timeval32 osi_timeval_t; typedef struct timeval osi_timeval_t; #endif /* AFS_SGI61_ENV */ +#ifndef UKERNEL #define osi_getpid() getpid() - -#define osi_getpid() getpid() +#endif /* * osi_ThreadUnique() should yield a value that can be found in ps @@ -204,13 +204,13 @@ typedef struct timeval osi_timeval_t; #ifdef AFS_FBSD50_ENV /* should use curthread, but 'ps' can't display it */ #define osi_ThreadUnique() curproc -#else -#ifdef AFS_LINUX_ENV +#elif defined(AFS_LINUX_ENV) #define osi_ThreadUnique() (current->pid) +#elif defined(UKERNEL) +#define osi_ThreadUnique() osi_getpid() #else #define osi_ThreadUnique() getpid() #endif -#endif diff --git a/src/aklog/aklog.c b/src/aklog/aklog.c index 548b5e3..cdca700 100644 --- a/src/aklog/aklog.c +++ b/src/aklog/aklog.c @@ -5,10 +5,6 @@ * For distribution and copying rights, see the file "mit-copyright.h" */ -#if !defined(lint) && !defined(SABER) -static char *rcsid = "$Id$"; -#endif /* lint || SABER */ - #include #include "aklog.h" diff --git a/src/aklog/aklog_main.c b/src/aklog/aklog_main.c index cdf6d77..8cb91cb 100644 --- a/src/aklog/aklog_main.c +++ b/src/aklog/aklog_main.c @@ -638,7 +638,10 @@ static int auth_to_cell(krb5_context context, char *cell, char *realm) printf("Using Kerberos V5 ticket natively\n"); #ifndef HAVE_NO_KRB5_524 - status = krb5_524_conv_principal (context, v5cred->client, &k4name, &k4inst, &k4realm); + status = krb5_524_conv_principal (context, v5cred->client, + (char *) &k4name, + (char *) &k4inst, + (char *) &k4realm); if (status) { afs_com_err(progname, status, "while converting principal " "to Kerberos V4 format"); diff --git a/src/aklog/asetkey.c b/src/aklog/asetkey.c index 927606e..c763274 100644 --- a/src/aklog/asetkey.c +++ b/src/aklog/asetkey.c @@ -51,15 +51,6 @@ char2hex(char c) return -1; } -static int -hex2char(char c) -{ - if (c <= 9) - return (c + 48); - - return (c - 10 + 'a'); -} - int main(int argc, char *argv[]) { diff --git a/src/aklog/klog.c b/src/aklog/klog.c index b48dd32..61fefde 100644 --- a/src/aklog/klog.c +++ b/src/aklog/klog.c @@ -668,10 +668,11 @@ CommandProc(struct cmd_syndesc *as, void *arock) memset(atoken, 0, sizeof *atoken); if (evil) { + size_t elen = enc_part->length; atoken->kvno = RXKAD_TKT_TYPE_KERBEROS_V5_ENCPART_ONLY; if (afs_krb5_skip_ticket_wrapper(afscred->ticket.data, afscred->ticket.length, &enc_part->data, - &enc_part->length)) { + &elen)) { afs_com_err(rn, 0, "Can't unwrap %s AFS credential", cellconfig->name); KLOGEXIT(1); diff --git a/src/butc/lwps.c b/src/butc/lwps.c index 2e540ce..3f4017f 100644 --- a/src/butc/lwps.c +++ b/src/butc/lwps.c @@ -144,7 +144,7 @@ PrintLogStr(FILE *log, afs_int32 error1, afs_int32 error2, char *str) { char *err1, *err2; - fprintf(log, str); + fprintf(log, "%s", str); if (error1) { err2 = "vols"; switch (error1) { @@ -2455,7 +2455,9 @@ readVolumeHeader(char *buffer, /* in - buffer to read header from */ /* Handle Case 1 */ memset(&vhptr, 0, sizeof(struct volumeHeader)); memcpy(&vhptr, buffer + bufloc, firstSplice); - memcpy(&vhptr + firstSplice, buffer + bufloc + firstSplice + padLen, + /* probably GCC bug 37060; however, no guarantee on length of buffer */ + tempvhptr = (struct volumeHeader *)(buffer + firstSplice); + memcpy(tempvhptr, buffer + bufloc + firstSplice + padLen, nextSplice); HEADER_CHECKS(vhptr, header); diff --git a/src/config/NTMakefile.amd64_w2k b/src/config/NTMakefile.amd64_w2k index ebc662c..320d85d 100644 --- a/src/config/NTMakefile.amd64_w2k +++ b/src/config/NTMakefile.amd64_w2k @@ -233,6 +233,7 @@ afscdefs =\ -DAFS_AFSDB_ENV \ -DAFS_FREELANCE_CLIENT \ -DAFS_64BITPOINTER_ENV \ + -DAFS_64BITUSERPOINTER_ENV \ -DAFS_64BIT_ENV \ -DAFS_64BIT_CLIENT \ -DAFS_LARGEFILE_ENV \ diff --git a/src/config/param.alpha_linux_26.h b/src/config/param.alpha_linux_26.h index ddb2ec8..62ffd99 100644 --- a/src/config/param.alpha_linux_26.h +++ b/src/config/param.alpha_linux_26.h @@ -20,6 +20,7 @@ #define __alpha 1 #define AFS_LINUX_64BIT_KERNEL 1 #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits */ +#define AFS_64BITUSERPOINTER_ENV 1 #else /* !defined(UKERNEL) */ diff --git a/src/config/param.amd64_fbsd_70.h b/src/config/param.amd64_fbsd_70.h index 2a54ea6..602cbfe 100644 --- a/src/config/param.amd64_fbsd_70.h +++ b/src/config/param.amd64_fbsd_70.h @@ -25,6 +25,7 @@ #define AFS_64BIT_ENV 1 #define AFS_64BIT_CLIENT 1 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ #define AFS_FBSD_ENV 1 #define AFS_FBSD40_ENV 1 diff --git a/src/config/param.amd64_fbsd_71.h b/src/config/param.amd64_fbsd_71.h index 0134b6e..3ae1b7b 100644 --- a/src/config/param.amd64_fbsd_71.h +++ b/src/config/param.amd64_fbsd_71.h @@ -25,6 +25,7 @@ #define AFS_64BIT_ENV 1 #define AFS_64BIT_CLIENT 1 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ #define AFS_FBSD_ENV 1 #define AFS_FBSD40_ENV 1 diff --git a/src/config/param.amd64_fbsd_80.h b/src/config/param.amd64_fbsd_80.h index 8c109cc..ed0c492 100644 --- a/src/config/param.amd64_fbsd_80.h +++ b/src/config/param.amd64_fbsd_80.h @@ -25,6 +25,7 @@ #define AFS_64BIT_ENV 1 #define AFS_64BIT_CLIENT 1 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ #define AFS_FBSD_ENV 1 #define AFS_FBSD40_ENV 1 diff --git a/src/config/param.amd64_linux26.h b/src/config/param.amd64_linux26.h index 42ce403..f8a2d08 100644 --- a/src/config/param.amd64_linux26.h +++ b/src/config/param.amd64_linux26.h @@ -19,6 +19,7 @@ #define AFS_AMD64_LINUX26_ENV 1 #define AFS_LINUX_64BIT_KERNEL 1 #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits */ +#define AFS_64BITUSERPOINTER_ENV 1 #define AFS_MAXVCOUNT_ENV 1 #else /* !defined(UKERNEL) */ diff --git a/src/config/param.amd64_nbsd30.h b/src/config/param.amd64_nbsd30.h index 7d7e170..cd16f71 100644 --- a/src/config/param.amd64_nbsd30.h +++ b/src/config/param.amd64_nbsd30.h @@ -9,6 +9,7 @@ #define SYS_NAME_ID SYS_NAME_ID_amd64_nbsd30 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #ifndef UKERNEL /* This section for kernel libafs compiles only */ diff --git a/src/config/param.amd64_nbsd40.h b/src/config/param.amd64_nbsd40.h index f6f3b13..3da603a 100644 --- a/src/config/param.amd64_nbsd40.h +++ b/src/config/param.amd64_nbsd40.h @@ -9,6 +9,7 @@ #define SYS_NAME_ID SYS_NAME_ID_amd64_nbsd40 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #ifndef UKERNEL /* This section for kernel libafs compiles only */ diff --git a/src/config/param.amd64_obsd39.h b/src/config/param.amd64_obsd39.h index 84f307c..f8d1a52 100644 --- a/src/config/param.amd64_obsd39.h +++ b/src/config/param.amd64_obsd39.h @@ -13,6 +13,7 @@ #define AFS_X86_XBSD_ENV 1 #define AFS_X86_ENV 1 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #define AFSLITTLE_ENDIAN 1 #endif /* AFS_AMD64_PARAM_H */ diff --git a/src/config/param.amd64_obsd40.h b/src/config/param.amd64_obsd40.h index e92387e..3561a62 100644 --- a/src/config/param.amd64_obsd40.h +++ b/src/config/param.amd64_obsd40.h @@ -13,6 +13,7 @@ #define AFS_X86_XBSD_ENV 1 #define AFS_X86_ENV 1 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #define AFSLITTLE_ENDIAN 1 #endif /* AFS_AMD64_PARAM_H */ diff --git a/src/config/param.amd64_obsd41.h b/src/config/param.amd64_obsd41.h index 4916750..2157b9b 100644 --- a/src/config/param.amd64_obsd41.h +++ b/src/config/param.amd64_obsd41.h @@ -13,6 +13,7 @@ #define AFS_X86_XBSD_ENV 1 #define AFS_X86_ENV 1 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #define AFSLITTLE_ENDIAN 1 #endif /* AFS_AMD64_PARAM_H */ diff --git a/src/config/param.amd64_obsd42.h b/src/config/param.amd64_obsd42.h index 747c056..f22fbb5 100644 --- a/src/config/param.amd64_obsd42.h +++ b/src/config/param.amd64_obsd42.h @@ -13,6 +13,7 @@ #define AFS_X86_XBSD_ENV 1 #define AFS_X86_ENV 1 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #define AFSLITTLE_ENDIAN 1 #endif /* AFS_AMD64_PARAM_H */ diff --git a/src/config/param.amd64_obsd43.h b/src/config/param.amd64_obsd43.h index 5a05c1d..058ae0e 100644 --- a/src/config/param.amd64_obsd43.h +++ b/src/config/param.amd64_obsd43.h @@ -13,6 +13,7 @@ #define AFS_X86_XBSD_ENV 1 #define AFS_X86_ENV 1 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #define AFSLITTLE_ENDIAN 1 #endif /* AFS_AMD64_PARAM_H */ diff --git a/src/config/param.amd64_obsd44.h b/src/config/param.amd64_obsd44.h index 2b13174..851904b 100644 --- a/src/config/param.amd64_obsd44.h +++ b/src/config/param.amd64_obsd44.h @@ -13,6 +13,7 @@ #define AFS_X86_XBSD_ENV 1 #define AFS_X86_ENV 1 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #define AFSLITTLE_ENDIAN 1 #endif /* AFS_AMD64_PARAM_H */ diff --git a/src/config/param.amd64_obsd45.h b/src/config/param.amd64_obsd45.h index 8c1b02e..a9afed7 100644 --- a/src/config/param.amd64_obsd45.h +++ b/src/config/param.amd64_obsd45.h @@ -13,6 +13,7 @@ #define AFS_X86_XBSD_ENV 1 #define AFS_X86_ENV 1 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #define AFSLITTLE_ENDIAN 1 #endif /* AFS_AMD64_PARAM_H */ diff --git a/src/config/param.hp_ux1123.h b/src/config/param.hp_ux1123.h index ebb6fe7..0c29dd5 100644 --- a/src/config/param.hp_ux1123.h +++ b/src/config/param.hp_ux1123.h @@ -24,6 +24,7 @@ #define AFS_64BIT_CLIENT 1 #if defined(__LP64__) #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ +#define AFS_64BITUSERPOINTER_ENV 1 #endif #include diff --git a/src/config/param.hp_ux11i.h b/src/config/param.hp_ux11i.h index 948245c..3ba156f 100644 --- a/src/config/param.hp_ux11i.h +++ b/src/config/param.hp_ux11i.h @@ -24,6 +24,7 @@ #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ #define AFS_64BIT_CLIENT 1 #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ +#define AFS_64BITUSERPOINTER_ENV 1 #define AFS_64BIT_IOPS_ENV 1 #include diff --git a/src/config/param.ia64_hpux1122.h b/src/config/param.ia64_hpux1122.h index 598abe7..08e1a29 100644 --- a/src/config/param.ia64_hpux1122.h +++ b/src/config/param.ia64_hpux1122.h @@ -25,6 +25,7 @@ #define AFS_64BIT_CLIENT 1 #if defined(__LP64__) #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ +#define AFS_64BITUSERPOINTER_ENV 1 #endif #include diff --git a/src/config/param.ia64_hpux1123.h b/src/config/param.ia64_hpux1123.h index adb9d05..ae685a8 100644 --- a/src/config/param.ia64_hpux1123.h +++ b/src/config/param.ia64_hpux1123.h @@ -26,6 +26,7 @@ #define AFS_64BIT_CLIENT 1 #if defined(__LP64__) #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ +#define AFS_64BITUSERPOINTER_ENV 1 #endif #include diff --git a/src/config/param.ia64_linux26.h b/src/config/param.ia64_linux26.h index 5ae045e..d0b413e 100644 --- a/src/config/param.ia64_linux26.h +++ b/src/config/param.ia64_linux26.h @@ -19,6 +19,7 @@ #define AFS_IA64_LINUX26_ENV 1 #define AFS_LINUX_64BIT_KERNEL 1 #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ +#define AFS_64BITUSERPOINTER_ENV 1 #define AFS_MAXVCOUNT_ENV 1 #else /* !defined(UKERNEL) */ diff --git a/src/config/param.ppc64_linux26.h b/src/config/param.ppc64_linux26.h index baedb0f..3c83386 100644 --- a/src/config/param.ppc64_linux26.h +++ b/src/config/param.ppc64_linux26.h @@ -18,6 +18,7 @@ #define AFS_PPC64_LINUX26_ENV 1 #define AFS_LINUX_64BIT_KERNEL 1 #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits */ +#define AFS_64BITUSERPOINTER_ENV 1 #else /* !defined(UKERNEL) */ diff --git a/src/config/param.s390x_linux26.h b/src/config/param.s390x_linux26.h index 27dd260..1815218 100644 --- a/src/config/param.s390x_linux26.h +++ b/src/config/param.s390x_linux26.h @@ -23,6 +23,7 @@ #define AFS_S390X_LINUX26_ENV 1 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #define AFS_64BIT_KERNEL 1 #else /* !defined(UKERNEL) */ @@ -35,6 +36,7 @@ #define AFS_S390X_LINUX26_ENV 1 #define AFS_64BITPOINTER_ENV 1 +#define AFS_64BITUSERPOINTER_ENV 1 #endif /* !defined(UKERNEL) */ diff --git a/src/config/param.sgi_65.h b/src/config/param.sgi_65.h index 3f50faf..674bfac 100644 --- a/src/config/param.sgi_65.h +++ b/src/config/param.sgi_65.h @@ -40,6 +40,7 @@ #define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ #define AFS_64BIT_CLIENT 1 #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ +#define AFS_64BITUSERPOINTER_ENV 1 #define AFS_HAVE_FFS 1 /* Use system's ffs. */ #define AFS_HAVE_STATVFS 1 /* System supports statvfs */ diff --git a/src/config/param.x86_darwin_100.h b/src/config/param.x86_darwin_100.h index a560d48..38ede9b 100644 --- a/src/config/param.x86_darwin_100.h +++ b/src/config/param.x86_darwin_100.h @@ -16,7 +16,10 @@ #error Unsupported architecture #endif #define AFS_VFSINCL_ENV 1 - +#ifdef __amd64__ +#define AFS_64BITUSERPOINTER_ENV 1 +#endif +#define AFS_64BIT_SIZEOF 1 /* seriously? */ #include #define AFS_DARWIN_ENV @@ -144,6 +147,9 @@ #else #error Unsupported architecture #endif +#ifdef __amd64__ +#define AFS_64BITUSERPOINTER_ENV 1 +#endif #include #define AFS_USERSPACE_ENV diff --git a/src/config/stds.h b/src/config/stds.h index d0516ac..f1ff418 100644 --- a/src/config/stds.h +++ b/src/config/stds.h @@ -321,6 +321,14 @@ hdr_static_inline(long) afs_printable_int32_ld(afs_int32 d) { return (long) d; } hdr_static_inline(unsigned long) afs_printable_uint32_lu(afs_uint32 d) { return (unsigned long) d; } +#ifdef AFS_64BITUSERPOINTER_ENV +#define afs_pointer_to_int(p) ((afs_uint32) (afs_uint64) (p)) +#define afs_int_to_pointer(i) ((void *) (afs_uint64) (i)) +#else +#define afs_pointer_to_int(p) ((afs_uint32) (p)) +#define afs_int_to_pointer(i) ((void *) (i)) +#endif + #if !defined(__GNUC__) || __GNUC__ < 2 #define AFS_UNUSED #else diff --git a/src/des/cksum.c b/src/des/cksum.c index 9e570ed..1764ce1 100644 --- a/src/des/cksum.c +++ b/src/des/cksum.c @@ -75,7 +75,7 @@ des_cbc_cksum(des_cblock * in, des_cblock * out, register afs_int32 length, unsigned char *t_in_p = (unsigned char *)t_input; #ifdef MUSTALIGN - if ((afs_int32) ivec & 3) { + if (afs_pointer_to_int(ivec) & 3) { memcpy((char *)&t_output[0], (char *)ivec++, sizeof(t_output[0])); memcpy((char *)&t_output[1], (char *)ivec, sizeof(t_output[1])); } else @@ -88,7 +88,7 @@ des_cbc_cksum(des_cblock * in, des_cblock * out, register afs_int32 length, for (i = 0; length > 0; i++, length -= 8) { /* get input */ #ifdef MUSTALIGN - if ((afs_int32) input & 3) { + if (afs_pointer_to_int(input) & 3) { memcpy((char *)&t_input[0], (char *)input++, sizeof(t_input[0])); memcpy((char *)&t_input[1], (char *)input++, sizeof(t_input[1])); } else @@ -125,7 +125,7 @@ des_cbc_cksum(des_cblock * in, des_cblock * out, register afs_int32 length, } /* copy temp output and save it for checksum */ #ifdef MUSTALIGN - if ((afs_int32) output & 3) { + if (afs_pointer_to_int(output) & 3) { memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); memcpy((char *)output, (char *)&t_output[1], sizeof(t_output[1])); } else diff --git a/src/des/des.c b/src/des/des.c index 31feb03..0c0b069 100644 --- a/src/des/des.c +++ b/src/des/des.c @@ -117,7 +117,7 @@ des_ecb_encrypt(void * clear, void * cipher, abort(); } #endif - if ((afs_uint32) clear & 3) { + if (afs_pointer_to_int(clear) & 3) { memcpy((char *)(&L_save), (char *)clear, sizeof(L_save)); clear=((afs_uint32*)clear)+1; memcpy((char *)(&R_save), (char *)clear, sizeof(R_save)); @@ -429,7 +429,7 @@ des_ecb_encrypt(void * clear, void * cipher, */ #ifdef MUSTALIGN - if ((afs_int32) cipher & 3) { + if (afs_pointer_to_int(cipher) & 3) { L_save = L2; /* cant bcopy a reg */ R_save = R2; memcpy((char *)cipher, (char *)&L_save, sizeof(L_save)); diff --git a/src/des/pcbc_encrypt.c b/src/des/pcbc_encrypt.c index 469415d..8f8cd6e 100644 --- a/src/des/pcbc_encrypt.c +++ b/src/des/pcbc_encrypt.c @@ -88,7 +88,7 @@ des_pcbc_encrypt(void * in, void * out, register afs_int32 length, if (encrypt) { #ifdef MUSTALIGN - if ((afs_int32) ivec & 3) { + if (afs_pointer_to_int(ivec) & 3) { memcpy((char *)&xor_0, (char *)ivec++, sizeof(xor_0)); memcpy((char *)&xor_1, (char *)ivec, sizeof(xor_1)); } else @@ -101,7 +101,7 @@ des_pcbc_encrypt(void * in, void * out, register afs_int32 length, for (i = 0; length > 0; i++, length -= 8) { /* get input */ #ifdef MUSTALIGN - if ((afs_int32) input & 3) { + if (afs_pointer_to_int(input) & 3) { memcpy((char *)&t_input[0], (char *)input, sizeof(t_input[0])); memcpy((char *)&t_input[1], (char *)(input + 1), @@ -134,7 +134,7 @@ des_pcbc_encrypt(void * in, void * out, register afs_int32 length, * case both input and output are the same space. */ #ifdef MUSTALIGN - if ((afs_int32) input & 3) { + if (afs_pointer_to_int(input) & 3) { memcpy((char *)&xor_0, (char *)input++, sizeof(xor_0)); xor_0 ^= t_output[0]; memcpy((char *)&xor_1, (char *)input++, sizeof(xor_1)); @@ -149,7 +149,7 @@ des_pcbc_encrypt(void * in, void * out, register afs_int32 length, /* copy temp output and save it for cbc */ #ifdef MUSTALIGN - if ((afs_int32) output & 3) { + if (afs_pointer_to_int(output) & 3) { memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); memcpy((char *)output++, (char *)&t_output[1], @@ -178,7 +178,7 @@ des_pcbc_encrypt(void * in, void * out, register afs_int32 length, else { /* decrypt */ #ifdef MUSTALIGN - if ((afs_int32) ivec & 3) { + if (afs_pointer_to_int(ivec) & 3) { memcpy((char *)&xor_0, (char *)ivec++, sizeof(xor_0)); memcpy((char *)&xor_1, (char *)ivec, sizeof(xor_1)); } else @@ -191,7 +191,7 @@ des_pcbc_encrypt(void * in, void * out, register afs_int32 length, for (i = 0; length > 0; i++, length -= 8) { /* get input */ #ifdef MUSTALIGN - if ((afs_int32) input & 3) { + if (afs_pointer_to_int(input) & 3) { memcpy((char *)&t_input[0], (char *)input++, sizeof(t_input[0])); memcpy((char *)&t_input[1], (char *)input++, @@ -223,7 +223,7 @@ des_pcbc_encrypt(void * in, void * out, register afs_int32 length, t_output[1] ^= xor_1; /* copy temp output */ #ifdef MUSTALIGN - if ((afs_int32) output & 3) { + if (afs_pointer_to_int(output) & 3) { memcpy((char *)output++, (char *)&t_output[0], sizeof(t_output[0])); memcpy((char *)output++, (char *)&t_output[1], diff --git a/src/kauth/authclient.c b/src/kauth/authclient.c index 9a6cc1c..9257fa5 100644 --- a/src/kauth/authclient.c +++ b/src/kauth/authclient.c @@ -570,15 +570,15 @@ ka_Authenticate(char *name, char *instance, char *cell, struct ubik_client * con oanswer.SeqBody = (char *)&answer; version = 1; code = - ubik_Call(KAA_Authenticate, conn, 0, name, instance, start, end, - &arequest, &oanswer, 0, 0); + ubik_KAA_Authenticate(conn, 0, name, instance, start, end, + &arequest, &oanswer); if (code == RXGEN_OPCODE) { oanswer.MaxSeqLen = sizeof(answer_old); oanswer.SeqBody = (char *)&answer_old; version = 0; code = - ubik_Call(KAA_Authenticate_old, conn, 0, name, instance, - start, end, &arequest, &oanswer); + ubik_KAA_Authenticate_old(conn, 0, name, instance, + start, end, &arequest, &oanswer); } if (code == RXGEN_OPCODE) { code = KAOLDINTERFACE; @@ -686,7 +686,7 @@ ka_GetToken(char *name, char *instance, char *cell, char *cname, char *cinst, st version = 1; code = - ubik_Call(KAT_GetTicket, conn, 0, auth_token->kvno, auth_domain, + ubik_KAT_GetTicket(conn, 0, auth_token->kvno, auth_domain, &aticket, name, instance, &atimes, &oanswer); if (code == RXGEN_OPCODE) { oanswer.SeqLen = 0; /* this may be set by first call */ @@ -694,7 +694,7 @@ ka_GetToken(char *name, char *instance, char *cell, char *cname, char *cinst, st oanswer.SeqBody = (char *)&answer_old; version = 0; code = - ubik_Call(KAT_GetTicket_old, conn, 0, auth_token->kvno, + ubik_KAT_GetTicket_old(conn, 0, auth_token->kvno, auth_domain, &aticket, name, instance, &atimes, &oanswer); if (code == RXGEN_OPCODE) { @@ -803,11 +803,10 @@ ka_ChangePassword(char *name, char *instance, struct ubik_client * conn, /* Ubik LOCK_GLOBAL_MUTEX; #if defined(AFS_S390_LINUX20_ENV) && !defined(AFS_S390X_LINUX20_ENV) code = - ubik_Call_New(KAM_SetPassword, conn, 0, name, instance, 0, 0, - *newkey); + ubik_KAM_SetPassword(conn, UBIK_CALL_NEW, name, instance, 0, 0, *(EncryptionKey *)newkey); #else code = - ubik_Call_New(KAM_SetPassword, conn, 0, name, instance, 0, *newkey); + ubik_KAM_SetPassword(conn, UBIK_CALL_NEW, name, instance, 0, *(EncryptionKey *)newkey); #endif UNLOCK_GLOBAL_MUTEX; return code; diff --git a/src/kauth/read_passwd.c b/src/kauth/read_passwd.c index 99a2b9f..32288a2 100644 --- a/src/kauth/read_passwd.c +++ b/src/kauth/read_passwd.c @@ -13,7 +13,6 @@ #include #include - #include #include @@ -164,7 +163,7 @@ read_pw_string(char *s, int max, char *prompt, int verify) #endif while (!ok) { - printf(prompt); + printf("%s", prompt); fflush(stdout); #ifdef CROSSMSDOS h19line(s, sizeof(s), 0); diff --git a/src/rxkad/rxkad_prototypes.h b/src/rxkad/rxkad_prototypes.h index 3968071..430b821 100644 --- a/src/rxkad/rxkad_prototypes.h +++ b/src/rxkad/rxkad_prototypes.h @@ -148,6 +148,10 @@ extern afs_int32 ktohl(char flags, afs_int32 l); extern afs_uint32 life_to_time(afs_uint32 start, unsigned char life); extern unsigned char time_to_life(afs_uint32 start, afs_uint32 end); +/* crc.c */ +extern void _rxkad_crc_init_table(void); +extern afs_uint32 _rxkad_crc_update(const char *p, size_t len, afs_uint32 res); + /* ticket5.c */ extern int tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len, int (*get_key) (void *, int, diff --git a/src/ubik/ubik.p.h b/src/ubik/ubik.p.h index 5173c52..32d5ebe 100644 --- a/src/ubik/ubik.p.h +++ b/src/ubik/ubik.p.h @@ -57,6 +57,7 @@ /*! \name ubik client flags */ #define UPUBIKONLY 1 /*!< only check servers presumed functional */ +#define UBIK_CALL_NEW 2 /*!< use the semantics of ubik_Call_New */ /*\}*/ /*! \name RX services types */ @@ -500,8 +501,12 @@ extern afs_int32 ubik_CallIter(int (*aproc) (), struct ubik_client *aclient, long p3, long p4, long p5, long p6, long p7, long p8, long p9, long p10, long p11, long p12, long p13, long p14, long p15, long p16); +extern afs_int32 ubik_Call_New(int (*aproc) (), register struct ubik_client + *aclient, afs_int32 aflags, long p1, long p2, + long p3, long p4, long p5, long p6, long p7, + long p8, long p9, long p10, long p11, long p12, + long p13, long p14, long p15, long p16); #endif - /*\}*/ /* \name ubikcmd.c */ diff --git a/src/ubik/ubikclient.c b/src/ubik/ubikclient.c index a286b67..2f413bf 100644 --- a/src/ubik/ubikclient.c +++ b/src/ubik/ubikclient.c @@ -364,145 +364,6 @@ ubik_client_init_mutex(void) static int *calls_needsync[SYNCCOUNT]; /* proc calls that need the sync site */ static int synccount = 0; -/*! - * call this instead of stub and we'll guarantee to find a host that's up. - * - * \todo In the future, we should also put in a protocol to find the sync site. - */ -afs_int32 -ubik_Call(int (*aproc) (), register struct ubik_client *aclient, - afs_int32 aflags, long p1, long p2, long p3, long p4, - long p5, long p6, long p7, long p8, long p9, long p10, - long p11, long p12, long p13, long p14, long p15, long p16) -{ - afs_int32 rcode, code, newHost, thisHost, i, count; - int chaseCount, pass, needsync, inlist, j; - struct rx_connection *tc; - struct rx_peer *rxp; - short origLevel; - - if (!aclient) - return UNOENT; - LOCK_UBIK_CLIENT(aclient); - - restart: - origLevel = aclient->initializationState; - rcode = UNOSERVERS; - chaseCount = inlist = needsync = 0; - - LOCK_UCLNT_CACHE; - for (j = 0; ((j < SYNCCOUNT) && calls_needsync[j]); j++) { - if (calls_needsync[j] == (int *)aproc) { - inlist = needsync = 1; - break; - } - } - UNLOCK_UCLNT_CACHE; - /* - * First pass, we try all servers that are up. - * Second pass, we try all servers. - */ - for (pass = 0; pass < 2; pass++) { /*p */ - /* For each entry in our servers list */ - for (count = 0;; count++) { /*s */ - - if (needsync) { - /* Need a sync site. Lets try to quickly find it */ - if (aclient->syncSite) { - newHost = aclient->syncSite; /* already in network order */ - aclient->syncSite = 0; /* Will reset if it works */ - } else if (aclient->conns[3]) { - /* If there are fewer than four db servers in a cell, - * there's no point in making the GetSyncSite call. - * At best, it's a wash. At worst, it results in more - * RPCs than you would otherwise make. - */ - tc = aclient->conns[count]; - if (tc && rx_ConnError(tc)) { - aclient->conns[count] = tc = ubik_RefreshConn(tc); - } - if (!tc) - break; - code = VOTE_GetSyncSite(tc, &newHost); - if (aclient->initializationState != origLevel) - goto restart; /* somebody did a ubik_ClientInit */ - if (code) - newHost = 0; - newHost = htonl(newHost); /* convert to network order */ - } else { - newHost = 0; - } - if (newHost) { - /* position count at the appropriate slot in the client - * structure and retry. If we can't find in slot, we'll - * just continue through the whole list - */ - for (i = 0; i < MAXSERVERS && aclient->conns[i]; i++) { - rxp = rx_PeerOf(aclient->conns[i]); - thisHost = rx_HostOf(rxp); - if (!thisHost) - break; - if (thisHost == newHost) { - if (chaseCount++ > 2) - break; /* avoid loop asking */ - count = i; /* this index is the sync site */ - break; - } - } - } - } - /*needsync */ - tc = aclient->conns[count]; - if (tc && rx_ConnError(tc)) { - aclient->conns[count] = tc = ubik_RefreshConn(tc); - } - if (!tc) - break; - - if ((pass == 0) && (aclient->states[count] & CFLastFailed)) { - continue; /* this guy's down */ - } - - rcode = - (*aproc) (tc, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, - p12, p13, p14, p15, p16); - if (aclient->initializationState != origLevel) { - /* somebody did a ubik_ClientInit */ - if (rcode) - goto restart; /* call failed */ - else - goto done; /* call suceeded */ - } - if (rcode < 0) { /* network errors */ - aclient->states[count] |= CFLastFailed; /* Mark serer down */ - } else if (rcode == UNOTSYNC) { - needsync = 1; - } else if (rcode != UNOQUORUM) { - /* either misc ubik code, or misc appl code, or success. */ - aclient->states[count] &= ~CFLastFailed; /* mark server up */ - goto done; /* all done */ - } - } /*s */ - } /*p */ - - done: - if (needsync) { - if (!inlist) { /* Remember proc call that needs sync site */ - LOCK_UCLNT_CACHE; - calls_needsync[synccount % SYNCCOUNT] = (int *)aproc; - synccount++; - UNLOCK_UCLNT_CACHE; - inlist = 1; - } - if (!rcode) { /* Remember the sync site - cmd successful */ - rxp = rx_PeerOf(aclient->conns[count]); - aclient->syncSite = rx_HostOf(rxp); - } - } - UNLOCK_UBIK_CLIENT(aclient); - return rcode; -} - /*! @@ -640,6 +501,20 @@ CallIter(int (*aproc) (), register struct ubik_client *aclient, return code; } +/*! + * \brief This is part of an iterator. It doesn't handle finding sync sites. + */ +afs_int32 +ubik_CallIter(int (*aproc) (), struct ubik_client *aclient, + afs_int32 aflags, int *apos, long p1, long p2, + long p3, long p4, long p5, long p6, long p7, + long p8, long p9, long p10, long p11, long p12, + long p13, long p14, long p15, long p16) +{ + return CallIter(aproc, aclient, aflags, apos, p1, p2, p3, p4, p5, p6, p7, + p8, p9, p10, p11, p12, p13, p14, p15, p16, NEED_LOCK); +} + /*! * \brief Call this instead of stub and we'll guarantee to find a host that's up. * @@ -702,15 +577,145 @@ ubik_Call_New(int (*aproc) (), register struct ubik_client *aclient, } /*! - * \brief This is part of an iterator. It doesn't handle finding sync sites. + * call this instead of stub and we'll guarantee to find a host that's up. + * + * \todo In the future, we should also put in a protocol to find the sync site. */ afs_int32 -ubik_CallIter(int (*aproc) (), struct ubik_client *aclient, - afs_int32 aflags, int *apos, long p1, long p2, - long p3, long p4, long p5, long p6, long p7, - long p8, long p9, long p10, long p11, long p12, - long p13, long p14, long p15, long p16) +ubik_Call(int (*aproc) (), register struct ubik_client *aclient, + afs_int32 aflags, long p1, long p2, long p3, long p4, + long p5, long p6, long p7, long p8, long p9, long p10, + long p11, long p12, long p13, long p14, long p15, long p16) { - return CallIter(aproc, aclient, aflags, apos, p1, p2, p3, p4, p5, p6, p7, - p8, p9, p10, p11, p12, p13, p14, p15, p16, NEED_LOCK); + afs_int32 rcode, code, newHost, thisHost, i, count; + int chaseCount, pass, needsync, inlist, j; + struct rx_connection *tc; + struct rx_peer *rxp; + short origLevel; + + if (aflags & UBIK_CALL_NEW) + return ubik_Call_New(aproc, aclient, aflags, p1, p2, p3, p4, + p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, + p16); + + if (!aclient) + return UNOENT; + LOCK_UBIK_CLIENT(aclient); + + restart: + origLevel = aclient->initializationState; + rcode = UNOSERVERS; + chaseCount = inlist = needsync = 0; + + LOCK_UCLNT_CACHE; + for (j = 0; ((j < SYNCCOUNT) && calls_needsync[j]); j++) { + if (calls_needsync[j] == (int *)aproc) { + inlist = needsync = 1; + break; + } + } + UNLOCK_UCLNT_CACHE; + /* + * First pass, we try all servers that are up. + * Second pass, we try all servers. + */ + for (pass = 0; pass < 2; pass++) { /*p */ + /* For each entry in our servers list */ + for (count = 0;; count++) { /*s */ + + if (needsync) { + /* Need a sync site. Lets try to quickly find it */ + if (aclient->syncSite) { + newHost = aclient->syncSite; /* already in network order */ + aclient->syncSite = 0; /* Will reset if it works */ + } else if (aclient->conns[3]) { + /* If there are fewer than four db servers in a cell, + * there's no point in making the GetSyncSite call. + * At best, it's a wash. At worst, it results in more + * RPCs than you would otherwise make. + */ + tc = aclient->conns[count]; + if (tc && rx_ConnError(tc)) { + aclient->conns[count] = tc = ubik_RefreshConn(tc); + } + if (!tc) + break; + code = VOTE_GetSyncSite(tc, &newHost); + if (aclient->initializationState != origLevel) + goto restart; /* somebody did a ubik_ClientInit */ + if (code) + newHost = 0; + newHost = htonl(newHost); /* convert to network order */ + } else { + newHost = 0; + } + if (newHost) { + /* position count at the appropriate slot in the client + * structure and retry. If we can't find in slot, we'll + * just continue through the whole list + */ + for (i = 0; i < MAXSERVERS && aclient->conns[i]; i++) { + rxp = rx_PeerOf(aclient->conns[i]); + thisHost = rx_HostOf(rxp); + if (!thisHost) + break; + if (thisHost == newHost) { + if (chaseCount++ > 2) + break; /* avoid loop asking */ + count = i; /* this index is the sync site */ + break; + } + } + } + } + /*needsync */ + tc = aclient->conns[count]; + if (tc && rx_ConnError(tc)) { + aclient->conns[count] = tc = ubik_RefreshConn(tc); + } + if (!tc) + break; + + if ((pass == 0) && (aclient->states[count] & CFLastFailed)) { + continue; /* this guy's down */ + } + + rcode = + (*aproc) (tc, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, + p12, p13, p14, p15, p16); + if (aclient->initializationState != origLevel) { + /* somebody did a ubik_ClientInit */ + if (rcode) + goto restart; /* call failed */ + else + goto done; /* call suceeded */ + } + if (rcode < 0) { /* network errors */ + aclient->states[count] |= CFLastFailed; /* Mark serer down */ + } else if (rcode == UNOTSYNC) { + needsync = 1; + } else if (rcode != UNOQUORUM) { + /* either misc ubik code, or misc appl code, or success. */ + aclient->states[count] &= ~CFLastFailed; /* mark server up */ + goto done; /* all done */ + } + } /*s */ + } /*p */ + + done: + if (needsync) { + if (!inlist) { /* Remember proc call that needs sync site */ + LOCK_UCLNT_CACHE; + calls_needsync[synccount % SYNCCOUNT] = (int *)aproc; + synccount++; + UNLOCK_UCLNT_CACHE; + inlist = 1; + } + if (!rcode) { /* Remember the sync site - cmd successful */ + rxp = rx_PeerOf(aclient->conns[count]); + aclient->syncSite = rx_HostOf(rxp); + } + } + UNLOCK_UBIK_CLIENT(aclient); + return rcode; } diff --git a/src/update/server.c b/src/update/server.c index 0650af9..9b5641c 100644 --- a/src/update/server.c +++ b/src/update/server.c @@ -403,7 +403,7 @@ UPDATE_FetchInfo(struct rx_call *call, char *name) static int Quit(char *msg) { - fprintf(stderr, msg); + fprintf(stderr, "%s", msg); exit(1); } diff --git a/src/util/snprintf.c b/src/util/snprintf.c index 3a901a6..09be431 100644 --- a/src/util/snprintf.c +++ b/src/util/snprintf.c @@ -88,7 +88,7 @@ * of 100 digits. * * - The 'p' specifier for printing pointers is implemented using - * compile time knowledge. (AFS_64BITPOINTER_ENV) + * compile time knowledge. (AFS_64BITUSERPOINTER_ENV) * * - Floating-point specifier (%e, %f, %g) are implemented by * calling the standard sprintf, and thus may be unsafe. @@ -731,7 +731,7 @@ xyzprintf (struct snprintf_state *state, const char *char_format, va_list ap) break; } case 'p' : { -#ifdef AFS_64BITPOINTER_ENV +#ifdef AFS_64BITUSERPOINTER_ENV u_longest arg = (u_longest)va_arg(ap, void*); #else u_longest arg = (unsigned long)va_arg(ap, void*); diff --git a/src/util/uuid.c b/src/util/uuid.c index 7439311..b9af9fd 100644 --- a/src/util/uuid.c +++ b/src/util/uuid.c @@ -274,6 +274,8 @@ afs_uuid_create(afsUUID * uuid) seed ^= uuid_time.seed[3]; #if defined(KERNEL) && defined(AFS_XBSD_ENV) rand_irand += seed + (afs_uint32) curproc->p_pid; +#elif defined(UKERNEL) + rand_irand += seed + (afs_uint32) osi_getpid(); #else rand_irand += seed + (afs_uint32) getpid(); #endif diff --git a/src/vol/daemon_com.c b/src/vol/daemon_com.c index 5c3d801..aaf6780 100644 --- a/src/vol/daemon_com.c +++ b/src/vol/daemon_com.c @@ -379,7 +379,7 @@ SYNC_ask_internal(SYNC_client_state * state, SYNC_command * com, SYNC_response * #else com->hdr.pid = getpid(); #ifdef AFS_PTHREAD_ENV - com->hdr.tid = (afs_int32)pthread_self(); + com->hdr.tid = afs_pointer_to_int(pthread_self()); #else { PROCESS handle = LWP_ThreadId(); diff --git a/src/volser/vos.c b/src/volser/vos.c index a2274ac..d5df2e5 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -5170,7 +5170,7 @@ ChangeAddr(register struct cmd_syndesc *as, void *arock) ip1 = 0xffffffff; } - vcode = ubik_Call_New(VL_ChangeAddr, cstruct, 0, ntohl(ip1), ntohl(ip2)); + vcode = ubik_VL_ChangeAddr(cstruct, UBIK_CALL_NEW, ntohl(ip1), ntohl(ip2)); if (vcode) { if (remove) { fprintf(STDERR, "Could not remove server %s from the VLDB\n", @@ -5237,7 +5237,8 @@ print_addrs(const bulkaddrs * addrs, afsUUID * m_uuid, int nentries, m_addrs.bulkaddrs_len = 0; vcode = ubik_VL_GetAddrsU(cstruct, 0, &m_attrs, m_uuid, - (afs_int32 *)&vlcb, &m_nentries, &m_addrs); + (afs_int32 *)&vlcb, &m_nentries, + &m_addrs); if (vcode) { fprintf(STDERR, "vos: could not list the multi-homed server addresses\n"); @@ -5286,7 +5287,7 @@ print_addrs(const bulkaddrs * addrs, afsUUID * m_uuid, int nentries, static int ListAddrs(register struct cmd_syndesc *as, void *arock) { - afs_int32 vcode; + afs_int32 vcode, m_uniq=0; afs_int32 i, printuuid = 0; struct VLCallBack vlcb; afs_int32 nentries; @@ -5332,8 +5333,8 @@ ListAddrs(register struct cmd_syndesc *as, void *arock) m_addrs.bulkaddrs_len = 0; vcode = - ubik_Call_New(VL_GetAddrs, cstruct, 0, 0, 0, &vlcb, &nentries, - &m_addrs); + ubik_VL_GetAddrs(cstruct, UBIK_CALL_NEW, 0, 0, &vlcb, &nentries, + &m_addrs); if (vcode) { fprintf(STDERR, "vos: could not list the server addresses\n"); PrintError("", vcode); @@ -5348,8 +5349,8 @@ ListAddrs(register struct cmd_syndesc *as, void *arock) m_attrs.index = i; vcode = - ubik_Call_New(VL_GetAddrsU, cstruct, 0, &m_attrs, &m_uuid, - &vlcb, &m_nentries, &m_addrs); + ubik_VL_GetAddrsU(cstruct, UBIK_CALL_NEW, &m_attrs, &m_uuid, + &m_uniq, &m_nentries, &m_addrs); if (vcode == VL_NOENT) { if (m_attrs.Mask == VLADDR_UUID) { diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index fe7d1c9..678effe 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -225,7 +225,7 @@ yesprompt(char *str) int PrintError(char *msg, afs_int32 errcode) { - fprintf(STDERR, msg); + fprintf(STDERR, "%s", msg); /*replace by a big switch statement */ switch (errcode) { case 0: @@ -3143,6 +3143,7 @@ DelVol(struct rx_connection *conn, afs_uint32 vid, afs_int32 part, } #define ONERROR(ec, ep, es) if (ec) { fprintf(STDERR, (es), (ep)); error = (ec); goto rfail; } +#define ONERROR0(ec, es) if (ec) { fprintf(STDERR, (es)); error = (ec); goto rfail; } #define ERROREXIT(ec) { error = (ec); goto rfail; } /* Get a "transaction" on this replica. Create the volume @@ -3368,7 +3369,7 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_int32 afromserver, roclone = ((roindex == -1) ? 0 : 1); rwindex = Lp_GetRwIndex(&entry); if (rwindex < 0) - ONERROR(VOLSERNOVOL, 0, "There is no RW volume \n"); + ONERROR0(VOLSERNOVOL, "There is no RW volume \n"); /* Make sure we have a RO volume id to work with */ if (entry.volumeId[ROVOL] == INVALID_BID) { @@ -3620,7 +3621,7 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_int32 afromserver, results.manyResults_val = (afs_int32 *) malloc(sizeof(afs_int32) * nservers + 1); if (!replicas || !times || !!!results.manyResults_val || !toconns) - ONERROR(ENOMEM, 0, + ONERROR0(ENOMEM, "Failed to create transaction on the release clone\n"); memset(replicas, 0, (sizeof(struct replica) * nservers + 1)); @@ -3635,7 +3636,7 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_int32 afromserver, if (!fullrelease && code) ONERROR(VOLSERNOVOL, afromvol, "Old clone is inaccessible. Try vos release -f %u.\n"); - ONERROR(code, 0, "Failed to create transaction on the release clone\n"); + ONERROR0(code, "Failed to create transaction on the release clone\n"); VDONE; /* For each index in the VLDB */ diff --git a/src/volser/vsutils.c b/src/volser/vsutils.c index 2060c06..54ad129 100644 --- a/src/volser/vsutils.c +++ b/src/volser/vsutils.c @@ -425,7 +425,6 @@ vsu_ExtractName(char rname[], char name[]) } } - /* returns 0 if failed */ afs_uint32 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp) @@ -441,7 +440,7 @@ vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp) char *end; afs_uint32 result; result = strtoul(astring, &end, 10); - if (result != ULONG_MAX && *end == '\0') + if (result != UINT_MAX && *end == '\0') return result; } -- 1.9.4