From e1fbe9bc4264df024144375a74239c93fc853244 Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Fri, 30 May 2003 20:29:54 +0000 Subject: [PATCH] STABLE12-i386-user-mode-linux-support-20030513 FIXES 1396 usermode linux support for 1.2.x (cherry picked from commit fcdc120ce70a189ca7ed908688721b72ab3ffe77) --- .cvsignore | 2 + README | 2 + acinclude.m4 | 5 ++ src/afs/LINUX/osi_alloc.c | 2 +- src/afs/Makefile.in | 2 +- src/config/Makefile.i386_umlinux22.in | 52 ++++++++++++++++ src/config/Makefile.i386_umlinux24.in | 44 ++++++++++++++ src/config/afs_sysnames.h | 4 ++ src/config/param.i386_umlinux22.h | 85 +++++++++++++++++++++++++++ src/config/param.i386_umlinux22_usr.h | 64 ++++++++++++++++++++ src/config/param.i386_umlinux24.h | 83 ++++++++++++++++++++++++++ src/config/param.i386_umlinux24_usr.h | 57 ++++++++++++++++++ src/libafs/MakefileProto.LINUX.in | 6 ++ src/lwp/Makefile.in | 2 +- src/util/afs_lhash.c | 64 ++++++++++---------- 15 files changed, 439 insertions(+), 35 deletions(-) create mode 100644 src/config/Makefile.i386_umlinux22.in create mode 100644 src/config/Makefile.i386_umlinux24.in create mode 100644 src/config/param.i386_umlinux22.h create mode 100644 src/config/param.i386_umlinux22_usr.h create mode 100644 src/config/param.i386_umlinux24.h create mode 100644 src/config/param.i386_umlinux24_usr.h diff --git a/.cvsignore b/.cvsignore index c2948c21e..4f075370c 100644 --- a/.cvsignore +++ b/.cvsignore @@ -9,6 +9,8 @@ hp_ux102 hp_ux110 i386_linux22 i386_linux24 +i386_umlinux22 +i386_umlinux24 include lib sgi_65 diff --git a/README b/README index c3bf7103e..7ef295b2a 100644 --- a/README +++ b/README @@ -36,6 +36,8 @@ A. Creating the proper directory structure. i386_fbsd46 (gmake is required to build for FreeBSD) i386_linux22 i386_linux24 + i386_umlinux22 + i386_umlinux24 rs_aix42 sgi_65 (file server not tested) sun4_413 (No client support, no fileserver support, db servers only) diff --git a/acinclude.m4 b/acinclude.m4 index 81ee1126c..7ed8e040d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -486,6 +486,11 @@ else fi _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/` AFS_SYSNAME="$_AFS_SYSNAME" + AFS_ISUML=`cat /proc/cpuinfo | awk '/^model name/ {print $[]4}'` + if test "x${AFS_ISUML}" = "xUML"; then + _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/linux/umlinux/` + fi + AFS_SYSNAME="$_AFS_SYSNAME" ;; esac AC_MSG_RESULT($AFS_SYSNAME) diff --git a/src/afs/LINUX/osi_alloc.c b/src/afs/LINUX/osi_alloc.c index a89a74d18..f2ba713f9 100644 --- a/src/afs/LINUX/osi_alloc.c +++ b/src/afs/LINUX/osi_alloc.c @@ -188,7 +188,7 @@ hash_verify(size_t index, unsigned key, void *data) int memtype; memtype = MEMTYPE(lmp->chunk); -#ifdef AFS_SPARC64_LINUX24_ENV +#if defined(AFS_SPARC64_LINUX24_ENV) || defined(AFS_I386_UMLINUX20_ENV) if ((memtype == KM_TYPE) && (!VALID_PAGE(virt_to_page(lmp->chunk)))) { printf("osi_linux_verify_alloced_memory: address 0x%x outside range, index=%d, key=%d\n", lmp->chunk, index, key); } diff --git a/src/afs/Makefile.in b/src/afs/Makefile.in index f4396dc41..986c26bcd 100644 --- a/src/afs/Makefile.in +++ b/src/afs/Makefile.in @@ -50,7 +50,7 @@ kinstall: ${KERNELDIR}/afs AFS_component_version_number.c gencat -m afszcm.cat afs_trace.msf ;; \ sun*_4* ) \ /usr/etc/gencat afszcm.cat afs_trace.msf ;; \ - *_linux* ) \ + *_linux* | *_umlinux* ) \ gencat --new afszcm.cat afs_trace.msf ;; \ ppc_darwin* | i386_fbsd*) \ echo No gencat for ${SYS_NAME} ;; \ diff --git a/src/config/Makefile.i386_umlinux22.in b/src/config/Makefile.i386_umlinux22.in new file mode 100644 index 000000000..6f2b45165 --- /dev/null +++ b/src/config/Makefile.i386_umlinux22.in @@ -0,0 +1,52 @@ +# Copyright 2000, International Business Machines Corporation and others. +# All Rights Reserved. +# +# This software has been released under the terms of the IBM Public +# License. For details, see the LICENSE file in the top-level source +# directory or online at http://www.openafs.org/dl/license10.html + +# Keep macros within each section in sorted order for clean diff displays. +# +# AFS_OSTYPE used to indicate suffixes and os specific subdirectories. +AFS_OSTYPE = LINUX + +# Base directory for linux kernel source. Actually a prefix which is complete +# when LINUX_VERS is appended to it. +LINUX_SRCDIR = /usr/src/linux- +# Default list of Linux kernels to build. Build will run only if all +# can be built. To build a different set, specify LINUX_VERS to make. +LINUX_VERS = @LINUX_VERSION@ + +# compilation and link editor flags +DBG=-g +OPTMZ=-O2 +PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC +# Put -O2 here to _ensure_ all Makefiles pick it up. +XCFLAGS= -O2 +MT_CFLAGS=-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS} +XLDFLAGS= +SHLIB_LDFLAGS = -shared -Xlinker -x +SHLIB_SUFFIX=so +SHLIB_CFLAGS= +SHLIB_LINKER=${MT_CC} -shared +# +# libraries +MTLIBS=-lpthread +TXLIBS= /usr/lib/libncurses.so +XLIBS= @LIB_AFSDB@ +# +# programs +AR=ar +AS=as +CP=cp +LD=ld +MT_CC=cc +MV=mv +RANLIB=ranlib +RM=rm +INSTALL=${TOP_SRCDIR}/pinstall/pinstall +# +# Other OS specific requirements +# +YACC = bison -y +LEX = flex -l diff --git a/src/config/Makefile.i386_umlinux24.in b/src/config/Makefile.i386_umlinux24.in new file mode 100644 index 000000000..e905612e2 --- /dev/null +++ b/src/config/Makefile.i386_umlinux24.in @@ -0,0 +1,44 @@ +# AFS_OSTYPE used to indicate suffixes and os specific subdirectories. +AFS_OSTYPE = LINUX + +# Base directory for linux kernel source. Actually a prefix which is complete +# when LINUX_VERS is appended to it. +LINUX_SRCDIR = /usr/src/linux- +# Default list of Linux kernels to build. Build will run only if all +# can be built. To build a different set, specify LINUX_VERS to make. +LINUX_VERS = @LINUX_VERSION@ + +# +# compilation and link editor flags +DBG=-g +OPTMZ=-O2 +PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC +# Put -O2 here to _ensure_ all Makefiles pick it up. +XCFLAGS= -O2 +MT_CFLAGS=-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS} +XLDFLAGS= +SHLIB_LDFLAGS = -shared -Xlinker -x +SHLIB_SUFFIX=so +SHLIB_CFLAGS= +SHLIB_LINKER=${MT_CC} -shared +# +# libraries +MTLIBS=-lpthread +TXLIBS= /usr/lib/libncurses.so +XLIBS= @LIB_AFSDB@ +# +# programs +AR=ar +AS=as +CP=cp +LD=ld +MT_CC=cc +MV=mv +RANLIB=ranlib +RM=rm +INSTALL=${TOP_SRCDIR}/pinstall/pinstall +# +# Other OS specific requirements +# +YACC = bison -y +LEX = flex -l diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index f3e8928fb..330204aa0 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -7,6 +7,10 @@ * directory or online at http://www.openafs.org/dl/license10.html */ +#define SYS_NAME_ID_i386_umlinux2 2700 +#define SYS_NAME_ID_i386_umlinux22 2701 +#define SYS_NAME_ID_i386_umlinux24 2702 + /* * File: afs_sysnames.h * diff --git a/src/config/param.i386_umlinux22.h b/src/config/param.i386_umlinux22.h new file mode 100644 index 000000000..246071fa2 --- /dev/null +++ b/src/config/param.i386_umlinux22.h @@ -0,0 +1,85 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously i386 specific, use that + * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2" + * in the sysname is the current version of the client. This takes into + * account the perferred OS user space configuration as well as the kernel. + */ + +#define AFS_LINUX20_ENV 1 +#define AFS_LINUX22_ENV 1 +#define AFS_UMLINUX20_ENV 1 +#define AFS_UMLINUX22_ENV 1 +#define AFS_I386_LINUX20_ENV 1 +#define AFS_I386_LINUX22_ENV 1 +#define AFS_I386_UMLINUX20_ENV 1 +#define AFS_I386_UMLINUX22_ENV 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 137 +#define AFS_64BIT_IOPS_ENV 1 +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ + +#if defined(__KERNEL__) && !defined(KDUMP_KERNEL) +#include +#ifdef CONFIG_SMP +#undef CONFIG_SMP +#endif +/* Using "AFS_SMP" to map to however many #define's are required to get + * MP to compile for Linux + */ +#ifdef AFS_SMP +#define CONFIG_SMP 1 +#ifndef CONFIG_X86_LOCAL_APIC +#define CONFIG_X86_LOCAL_APIC 1 +#endif +#ifndef __SMP__ +#define __SMP__ +#endif +#define AFS_GLOBAL_SUNLOCK +#endif + +#if defined(MODULE) && defined(CONFIG_MODVERSIONS) +#define MODVERSIONS +#include +#endif + +#endif /* __KERNEL__ && !DUMP_KERNEL*/ + +#include + +#define AFS_USERSPACE_IP_ADDR 1 +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ + + +/* Machine / Operating system information */ +#define SYS_NAME "i386_umlinux22" +#define SYS_NAME_ID SYS_NAME_ID_i386_umlinux22 +#define AFSLITTLE_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ + +#ifdef KERNEL +#ifndef MIN +#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#endif +#ifndef MAX +#define MAX(A,B) ((A) > (B) ? (A) : (B)) +#endif +#endif /* KERNEL */ + +#endif /* AFS_PARAM_H */ diff --git a/src/config/param.i386_umlinux22_usr.h b/src/config/param.i386_umlinux22_usr.h new file mode 100644 index 000000000..d2cf3c91c --- /dev/null +++ b/src/config/param.i386_umlinux22_usr.h @@ -0,0 +1,64 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously i386 specific, use that + * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2" + * in the sysname is the current version of the client. This takes into + * account the perferred OS user space configuration as well as the kernel. + */ + +#define UKERNEL 1 /* user space kernel */ +#define AFS_ENV 1 +#define AFS_USR_LINUX20_ENV 1 +#define AFS_USR_LINUX22_ENV 1 +#define AFS_USR_UMLINUX20_ENV 1 +#define AFS_USR_UMLINUX22_ENV 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 137 +#define AFS_64BIT_IOPS_ENV 1 +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#include + +#define AFS_USERSPACE_IP_ADDR 1 +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ + + +/* Machine / Operating system information */ +#define SYS_NAME "i386_umlinux22" +#define SYS_NAME_ID SYS_NAME_ID_i386_umlinux22 +#define AFSLITTLE_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ + +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_fmode uio_fmode +#define afsio_resid uio_resid +#define AFS_UIOSYS 1 +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES MCLBYTES +#define AFS_MINCHANGE 2 +#define VATTR_NULL usr_vattr_null + +#define AFS_DIRENT +#ifndef CMSERVERPREF +#define CMSERVERPREF +#endif + +#endif /* AFS_PARAM_H */ diff --git a/src/config/param.i386_umlinux24.h b/src/config/param.i386_umlinux24.h new file mode 100644 index 000000000..df3b8c8ae --- /dev/null +++ b/src/config/param.i386_umlinux24.h @@ -0,0 +1,83 @@ +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously i386 specific, use that + * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2" + * in the sysname is the current version of the client. This takes into + * account the perferred OS user space configuration as well as the kernel. + */ + +#define AFS_LINUX20_ENV 1 +#define AFS_LINUX22_ENV 1 +#define AFS_LINUX24_ENV 1 +#define AFS_UMLINUX20_ENV 1 +#define AFS_UMLINUX22_ENV 1 +#define AFS_UMLINUX24_ENV 1 +#define AFS_I386_LINUX20_ENV 1 +#define AFS_I386_LINUX22_ENV 1 +#define AFS_I386_LINUX24_ENV 1 +#define AFS_I386_UMLINUX20_ENV 1 +#define AFS_I386_UMLINUX22_ENV 1 +#define AFS_I386_UMLINUX24_ENV 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 137 +#define AFS_64BIT_IOPS_ENV 1 +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ + +#if defined(__KERNEL__) && !defined(KDUMP_KERNEL) +#include + +#include +#ifdef CONFIG_SMP +#undef CONFIG_SMP +#endif +/* Using "AFS_SMP" to map to however many #define's are required to get + * MP to compile for Linux + */ +#ifdef AFS_SMP +#define CONFIG_SMP 1 +#ifndef CONFIG_X86_LOCAL_APIC +#define CONFIG_X86_LOCAL_APIC 1 +#endif +#ifndef __SMP__ +#define __SMP__ +#endif +#define AFS_GLOBAL_SUNLOCK +#endif + +#if defined(MODULE) && defined(CONFIG_MODVERSIONS) +#define MODVERSIONS +#include +#endif + +#endif /* __KERNEL__ && !DUMP_KERNEL*/ + +#include +#define AFS_USERSPACE_IP_ADDR 1 +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ + +#define AFSLITTLE_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ + +#ifdef KERNEL +#ifndef MIN +#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#endif +#ifndef MAX +#define MAX(A,B) ((A) > (B) ? (A) : (B)) +#endif +#endif /* KERNEL */ + +/* Machine / Operating system information */ +#define SYS_NAME "i386_umlinux24" +#define SYS_NAME_ID SYS_NAME_ID_i386_umlinux24 + +#endif /* AFS_PARAM_H */ + + diff --git a/src/config/param.i386_umlinux24_usr.h b/src/config/param.i386_umlinux24_usr.h new file mode 100644 index 000000000..45b0eddb0 --- /dev/null +++ b/src/config/param.i386_umlinux24_usr.h @@ -0,0 +1,57 @@ +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously i386 specific, use that + * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2" + * in the sysname is the current version of the client. This takes into + * account the perferred OS user space configuration as well as the kernel. + */ + +#define UKERNEL 1 /* user space kernel */ +#define AFS_ENV 1 +#define AFS_USR_LINUX20_ENV 1 +#define AFS_USR_LINUX22_ENV 1 +#define AFS_USR_LINUX24_ENV 1 +#define AFS_USR_UMLINUX20_ENV 1 +#define AFS_USR_UMLINUX22_ENV 1 +#define AFS_USR_UMLINUX24_ENV 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 137 +#define AFS_64BIT_IOPS_ENV 1 +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#include + +#define AFS_USERSPACE_IP_ADDR 1 +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ + + +/* Machine / Operating system information */ +#define SYS_NAME "i386_umlinux24" +#define SYS_NAME_ID SYS_NAME_ID_i386_umlinux24 +#define AFSLITTLE_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ + +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_fmode uio_fmode +#define afsio_resid uio_resid +#define AFS_UIOSYS 1 +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES MCLBYTES +#define AFS_MINCHANGE 2 +#define VATTR_NULL usr_vattr_null + +#define AFS_DIRENT +#ifndef CMSERVERPREF +#define CMSERVERPREF +#endif + +#endif /* AFS_PARAM_H */ diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in index efde6935f..910f3c5cd 100644 --- a/src/libafs/MakefileProto.LINUX.in +++ b/src/libafs/MakefileProto.LINUX.in @@ -54,6 +54,10 @@ CC = gcc LD = ld GCC_KOPTS=@LINUX_GCC_KOPTS@ # -Wall + +P5PLUS=@P5PLUS_KOPTS@ +CCFLAGS = $(KDEBUG) -O2 $(FOMIT) $(GCC_KOPTS) -pipe $(P5PLUS) -I/usr/src/linux/arch/um/include -I/usr/src/linux/arch/um/kernel/tt/include -I/usr/src/linux/arch/um/kernel/skas/include +DEFINES = -D__KERNEL__ -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} ${KDEFINES} P5PLUS=@P5PLUS_KOPTS@ CCFLAGS = $(KDEBUG) -O2 $(FOMIT) $(GCC_KOPTS) -pipe $(P5PLUS) @@ -143,6 +147,8 @@ ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}: ln -s ${LINUX_KERNEL_PATH}/include/asm-alpha asm ln -s ${LINUX_KERNEL_PATH}/include/asm-i386 asm + + ln -s ${LINUX_KERNEL_PATH}/include/asm-um asm ln -fs ${LINUX_KERNEL_PATH}/include/asm-x86_64 asm diff --git a/src/lwp/Makefile.in b/src/lwp/Makefile.in index 80f0dec17..eaa044e78 100644 --- a/src/lwp/Makefile.in +++ b/src/lwp/Makefile.in @@ -73,7 +73,7 @@ process.o : process.s process.c /usr/bin/cpp -P process.fbsd.s > process.ss; \ ${AS} -o process.o process.ss; \ $(RM) process.ss ;; \ - hp* | *_linux* | sgi_64 | sgi_65 | ia64_hpux* ) \ + hp* | *_linux* | *_umlinux* | sgi_64 | sgi_65 | ia64_hpux* ) \ ${CC} ${CFLAGS} -c process.c;; \ alpha_osf1 | alpha_osf20 | alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux?? ) \ ${AS} -v -P -DOSF -I${TOP_INCDIR} -DASSEMBLER process.s; \ diff --git a/src/util/afs_lhash.c b/src/util/afs_lhash.c index 77feabeaf..9caec331c 100644 --- a/src/util/afs_lhash.c +++ b/src/util/afs_lhash.c @@ -179,7 +179,7 @@ afs_lhash_expand( size_t old_address; /* index of bucket to split */ size_t new_address; /* index of new bucket */ - struct bucket *current; /* for scanning down old chain */ + struct bucket *curr; /* for scanning down old chain */ struct bucket *previous; struct bucket *last_of_new; /* last element in new chain */ @@ -216,36 +216,36 @@ afs_lhash_expand( /* relocate records to the new bucket */ - current = lh->table[old_address]; + curr = lh->table[old_address]; previous = 0; last_of_new = 0; lh->table[new_address] = 0; - while (current) { + while (curr) { size_t addr; - addr = afs_lhash_address(lh, current->key); + addr = afs_lhash_address(lh, curr->key); if (addr == new_address) { /* attach it to the end of the new chain */ if (last_of_new) { - last_of_new->next = current; + last_of_new->next = curr; } else { - lh->table[new_address] = current; + lh->table[new_address] = curr; } if (previous) { - previous->next = current->next; + previous->next = curr->next; } else { - lh->table[old_address] = current->next; + lh->table[old_address] = curr->next; } - last_of_new = current; - current = current->next; + last_of_new = curr; + curr = curr->next; last_of_new->next = 0; } else { #ifdef CHECK_INVARIANTS assert(addr == old_address); #endif /* CHECK_INVARIANTS */ /* leave it on the old chain */ - previous = current; - current = current->next; + previous = curr; + curr = curr->next; } } } @@ -345,12 +345,12 @@ afs_lhash_iter( #endif /* CHECK_INVARIANTS */ for (i = 0; i < lh->ltable; i++) { - struct bucket *current; + struct bucket *curr; - for (current = lh->table[i]; - current; - current = current->next) { - f(i, current->key, current->data); + for (curr = lh->table[i]; + curr; + curr = curr->next) { + f(i, curr->key, curr->data); } } } @@ -364,16 +364,16 @@ afs_lhash_search( { size_t k; struct bucket *previous; - struct bucket *current; + struct bucket *curr; lh->search_calls++; k = afs_lhash_address(lh, key); - for (previous = 0, current = lh->table[k]; - current; - previous = current, current = current->next) { + for (previous = 0, curr = lh->table[k]; + curr; + previous = curr, curr = curr->next) { lh->search_tests++; - if (lh->equal(data, current->data)) { + if (lh->equal(data, curr->data)) { /* * Since we found what we were looking for, move @@ -389,12 +389,12 @@ afs_lhash_search( */ if (previous) { - previous->next = current->next; - current->next = lh->table[k]; - lh->table[k] = current; + previous->next = curr->next; + curr->next = lh->table[k]; + lh->table[k] = curr; } - return current->data; + return curr->data; } } @@ -409,14 +409,14 @@ afs_lhash_rosearch( ) { size_t k; - struct bucket *current; + struct bucket *curr; k = afs_lhash_address(lh, key); - for (current = lh->table[k]; - current; - current = current->next) { - if (lh->equal(data, current->data)) { - return current->data; + for (curr = lh->table[k]; + curr; + curr = curr->next) { + if (lh->equal(data, curr->data)) { + return curr->data; } } -- 2.39.5