From: Sven Oehme Date: Tue, 3 Feb 2004 06:23:30 +0000 (+0000) Subject: linux-ppc64-fixes-20040202 X-Git-Tag: openafs-devel-1_3_60~98 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=eca259c292f430de52414111e1b1514b22114510 linux-ppc64-fixes-20040202 FIXES 3058 linux ppc64 port --- diff --git a/acinclude.m4 b/acinclude.m4 index 8e1c8b4..86b2012 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -535,6 +535,9 @@ else powerpc-*-linux*) AFS_SYSNAME="ppc_linuxXX" ;; + powerpc64-*-linux*) + AFS_SYSNAME="ppc64_linuxXX" + ;; alpha*-linux*) AFS_SYSNAME="alpha_linux_XX" ;; diff --git a/src/afs/LINUX/osi_groups.c b/src/afs/LINUX/osi_groups.c index fec9eb9..1ca3057 100644 --- a/src/afs/LINUX/osi_groups.c +++ b/src/afs/LINUX/osi_groups.c @@ -183,6 +183,40 @@ afs_xsetgroups32(int gidsetsize, gid_t * grouplist) } #endif +#if defined(AFS_PPC64_LINUX20_ENV) +/* Intercept the uid16 system call as used by 32bit programs. */ +extern long (*sys32_setgroupsp)(int gidsetsize, gid_t *grouplist); +asmlinkage long afs32_xsetgroups(int gidsetsize, gid_t *grouplist) +{ + long code; + cred_t *cr = crref(); + afs_uint32 junk; + int old_pag; + + lock_kernel(); + old_pag = PagInCred(cr); + crfree(cr); + unlock_kernel(); + + code = (*sys32_setgroupsp)(gidsetsize, grouplist); + if (code) { + return code; + } + + lock_kernel(); + cr = crref(); + if (old_pag != NOPAG && PagInCred(cr) == NOPAG) { + /* re-install old pag if there's room. */ + code = setpag(&cr, old_pag, &junk, 0); + } + crfree(cr); + unlock_kernel(); + + /* Linux syscall ABI returns errno as negative */ + return (-code); +} +#endif + #if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_AMD64_LINUX20_ENV) /* Intercept the uid16 system call as used by 32bit programs. */ extern long (*sys32_setgroupsp) (int gidsetsize, u16 * grouplist); @@ -193,17 +227,17 @@ afs32_xsetgroups(int gidsetsize, u16 * grouplist) cred_t *cr = crref(); afs_uint32 junk; int old_pag; - + lock_kernel(); old_pag = PagInCred(cr); crfree(cr); unlock_kernel(); - + code = (*sys32_setgroupsp) (gidsetsize, grouplist); if (code) { return code; } - + lock_kernel(); cr = crref(); if (old_pag != NOPAG && PagInCred(cr) == NOPAG) { @@ -212,7 +246,7 @@ afs32_xsetgroups(int gidsetsize, u16 * grouplist) } crfree(cr); unlock_kernel(); - + /* Linux syscall ABI returns errno as negative */ return (-code); } diff --git a/src/afs/LINUX/osi_module.c b/src/afs/LINUX/osi_module.c index c28a953..77abefd 100644 --- a/src/afs/LINUX/osi_module.c +++ b/src/afs/LINUX/osi_module.c @@ -92,6 +92,10 @@ asmlinkage long (*sys32_setgroups32p) (int gidsetsize, gid_t * grouplist); #endif /* __NR_ia32_setgroups32 */ #endif /* AFS_AMD64_LINUX20_ENV */ +#ifdef AFS_PPC64_LINUX20_ENV +asmlinkage long (*sys32_setgroupsp)(int gidsetsize, gid_t *grouplist); +#endif /* AFS_AMD64_LINUX20_ENV */ + #ifdef AFS_SPARC64_LINUX20_ENV static unsigned int afs_ni_syscall32 = 0; asmlinkage int (*sys32_setgroupsp) (int gidsetsize, @@ -158,6 +162,12 @@ asmlinkage int (*sys_setgroups32p) (int gidsetsize, #define SYSCALL2POINTER (void *) #endif +#ifdef AFS_PPC64_LINUX20_ENV +extern void *set_afs_syscall(void*); +extern void *set_afs_xsetgroups_syscall(void*); +extern void *set_afs_xsetgroups_syscall32(void*); +#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) int __init afs_init(void) @@ -175,7 +185,7 @@ init_module(void) #if defined(__NR_setgroups32) extern int afs_xsetgroups32(); #endif /* __NR_setgroups32 */ -#if defined(AFS_SPARC64_LINUX20_ENV) || defined (AFS_AMD64_LINUX20_ENV) +#if defined(AFS_SPARC64_LINUX20_ENV) || defined (AFS_AMD64_LINUX20_ENV) || defined(AFS_PPC64_LINUX20_ENV) extern int afs32_xsetgroups(); #if (defined(__NR_setgroups32) && defined(AFS_SPARC64_LINUX20_ENV)) extern int afs32_xsetgroups32(); @@ -466,6 +476,12 @@ init_module(void) #endif /* AFS_AMD64_LINUX20_ENV */ #endif /* AFS_IA64_LINUX20_ENV */ +#ifdef AFS_PPC64_LINUX20_ENV + afs_ni_syscall = set_afs_syscall(afs_syscall); + sys_setgroupsp = set_afs_xsetgroups_syscall(afs_xsetgroups); + sys32_setgroupsp = set_afs_xsetgroups_syscall32(afs32_xsetgroups); +#endif + osi_sysctl_init(); return 0; @@ -513,6 +529,11 @@ cleanup_module(void) #endif } #endif +#ifdef AFS_PPC64_LINUX20_ENV + set_afs_syscall(afs_ni_syscall); + set_afs_xsetgroups_syscall(sys_setgroupsp); + set_afs_xsetgroups_syscall32(sys32_setgroupsp); +#endif unregister_filesystem(&afs_file_system); osi_linux_free_inode_pages(); /* Invalidate all pages using AFS inodes. */ @@ -530,7 +551,7 @@ module_exit(afs_cleanup); static long get_page_offset(void) { -#if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_S390_LINUX22_ENV) || defined(AFS_IA64_LINUX20_ENV) || defined(AFS_PARISC_LINUX24_ENV) || defined(AFS_AMD64_LINUX20_ENV) +#if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_S390_LINUX22_ENV) || defined(AFS_IA64_LINUX20_ENV) || defined(AFS_PARISC_LINUX24_ENV) || defined(AFS_AMD64_LINUX20_ENV) || defined(AFS_PPC64_LINUX20_ENV) return PAGE_OFFSET; #else struct task_struct *p, *q; diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index c0d9565..e33c50c 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -1118,6 +1118,8 @@ copyin_iparam(caddr_t cmarg, struct iparam *dst) if (current->tss.flags & SPARC_FLAG_32BIT) #elif defined(AFS_AMD64_LINUX20_ENV) if (current->thread.flags & THREAD_IA32) +#elif defined(AFS_PPC64_LINUX20_ENV) + if (current->thread.flags & PPC_FLAG_32BIT) #else #error Not done for this linux version #endif diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index bc2eb22..05f5100 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -265,6 +265,8 @@ copyin_afs_ioctl(caddr_t cmarg, struct afs_ioctl *dst) if (current->tss.flags & SPARC_FLAG_32BIT) #elif defined(AFS_AMD64_LINUX20_ENV) if (current->thread.flags & THREAD_IA32) +#elif defined(AFS_PPC64_LINUX20_ENV) + if (current->thread.flags & PPC_FLAG_32BIT) #else #error Not done for this linux type #endif diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4 index fbf5799..56d509e 100644 --- a/src/cf/osconf.m4 +++ b/src/cf/osconf.m4 @@ -238,6 +238,18 @@ case $AFS_SYSNAME in SHLIB_LINKER="${MT_CC} -shared" ;; + ppc64_linux24) + KERN_OPTMZ=-O2 + LEX="flex -l" + MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' + MT_LIBS="-lpthread" + PAM_CFLAGS="-g -O2 -Dlinux -DLINUX_PAM -fPIC" + SHLIB_LDFLAGS="-shared -Xlinker -x" + TXLIBS="/usr/lib64/libncurses.so" + XCFLAGS="-g -O2 -D_LARGEFILE64_SOURCE" + SHLIB_LINKER="${MT_CC} -shared" + ;; + i386_linux22) CC="gcc -pipe" MT_CC="gcc -pipe" diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index 11e768f..9ffaa6e 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -202,6 +202,10 @@ #define SYS_NAME_ID_i386_umlinux22 2801 #define SYS_NAME_ID_i386_umlinux24 2802 +#define SYS_NAME_ID_ppc64_linux2 2900 +#define SYS_NAME_ID_ppc64_linux22 2901 +#define SYS_NAME_ID_ppc64_linux24 2902 + /* * Placeholder to keep system-wide standard flags since this file is included by all * files (i.e in afs/param.h) diff --git a/src/config/param.ppc64_linux24.h b/src/config/param.ppc64_linux24.h new file mode 100644 index 0000000..f947013 --- /dev/null +++ b/src/config/param.ppc64_linux24.h @@ -0,0 +1,149 @@ +#ifndef UKERNEL +#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 ppc64 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_PPC64_LINUX20_ENV 1 +#define AFS_PPC64_LINUX22_ENV 1 +#define AFS_PPC64_LINUX24_ENV 1 +#define AFS_LINUX_64BIT_KERNEL 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 */ + +#define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ + +#define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ + +#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 __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 "ppc64_linux24" +#define SYS_NAME_ID SYS_NAME_ID_ppc64_linux24 +#define AFSBIG_ENDIAN 0 +#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 /* _PARAM_PPC64_LINUX20_H_ */ + +#else /* !defined(UKERNEL) */ + +/* This section for user space compiles only */ + +/* + * 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 ppc64 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_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 "ppc64_linux24" +#define SYS_NAME_ID SYS_NAME_ID_ppc64_linux24 +#define AFSBIG_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 */ + +#endif /* !defined(UKERNEL) */ diff --git a/src/des/andrew-conf.h b/src/des/andrew-conf.h index 4673833..0c3e3ef 100644 --- a/src/des/andrew-conf.h +++ b/src/des/andrew-conf.h @@ -79,7 +79,11 @@ #ifdef AFS_AMD64_LINUX20_ENV #include "conf-amd64-linux.h" #else +#ifdef AFS_PPC64_LINUX20_ENV +#include "conf-ppc64-linux.h" +#else #include "conf-i386-linux.h" +#endif /* AFS_PPC64_LINUX20_ENV */ #endif /* AFS_AMD64_LINUX20_ENV */ #endif /* AFS_IA64_LINUX20_ENV */ #endif /* AFS_ALPHA_LINUX20_ENV */ diff --git a/src/des/conf-ppc64-linux.h b/src/des/conf-ppc64-linux.h new file mode 100644 index 0000000..3d29372 --- /dev/null +++ b/src/des/conf-ppc64-linux.h @@ -0,0 +1,4 @@ +#define BITS32 +#define BIG +#define MSBFIRST +#define MUSTALIGN diff --git a/src/des/crypt.c b/src/des/crypt.c index ba0b4db..54dfa6b 100644 --- a/src/des/crypt.c +++ b/src/des/crypt.c @@ -91,7 +91,7 @@ RCSID */ /* XXX shouldn't this be !AFS_64BIT_ENV ? */ -#if !defined(cray) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) && !defined(AFS_AMD64_LINUX20_ENV) +#if !defined(cray) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) && !defined(AFS_AMD64_LINUX20_ENV) && !defined(AFS_PPC64_LINUX20_ENV) #define LONG_IS_32_BITS #endif diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in index ea8ff63..10a4e55 100644 --- a/src/libafs/MakefileProto.LINUX.in +++ b/src/libafs/MakefileProto.LINUX.in @@ -67,7 +67,7 @@ CCFLAGS = $(COMMON_KERN_CFLAGS) \ -mcpu=ultrasparc -m64 -mno-fpu -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare DEFINES = $(COMMON_DEFINES) -DCPU=sparc64 - + CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char -msoft-float -fno-builtin -ffixed-r2 DEFINES = $(COMMON_DEFINES) -D__powerpc__ @@ -141,6 +141,8 @@ ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}: ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390 asm ln -fs ${LINUX_KERNEL_PATH}/include/asm-ppc asm + + ln -s ${LINUX_KERNEL_PATH}/include/asm-ppc64 asm ln -fs ${LINUX_KERNEL_PATH}/include/asm-sparc asm diff --git a/src/lwp/process.c b/src/lwp/process.c index 2e4113c..06f4266 100644 --- a/src/lwp/process.c +++ b/src/lwp/process.c @@ -101,7 +101,7 @@ returnto(savearea) #elif defined(AFS_HPUX_ENV) #define LWP_SP 1 #elif defined(AFS_LINUX20_ENV) -#if defined(AFS_PPC_LINUX20_ENV) +#if defined(AFS_PPC_LINUX20_ENV) || defined(AFS_PPC64_LINUX20_ENV) #define LWP_SP 0 #elif defined(AFS_I386_LINUX20_ENV) #define LWP_SP 4 @@ -139,7 +139,7 @@ Need offset to SP in jmp_buf for this platform. typedef __uint64_t jmp_buf_type; #endif #else -#ifdef AFS_ALPHA_LINUX20_ENV +#if defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_PPC64_LINUX20_ENV) typedef long jmp_buf_type; #else typedef int jmp_buf_type; diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index f8e13ee..64b7293 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -510,6 +510,8 @@ rxi_GetcbiInfo(void) memset((void *)mtus, 0, sizeof(mtus)); for (i = 0; i < afs_cb_interface.numberOfInterfaces; i++) { + if (!afs_cb_interface.mtu[i]) + afs_cb_interface.mtu[i] = htonl(1500); rxmtu = (ntohl(afs_cb_interface.mtu[i]) - RX_IPUDP_SIZE); ifinaddr = ntohl(afs_cb_interface.addr_in[i]); if (myNetAddrs[i] != ifinaddr) diff --git a/src/rx/rx_packet.h b/src/rx/rx_packet.h index ddfd466..8517499 100644 --- a/src/rx/rx_packet.h +++ b/src/rx/rx_packet.h @@ -41,7 +41,7 @@ #define MAX(a,b) ((a)>(b)?(a):(b)) #endif #else /* AFS_NT40_ENV */ -#if !defined(AFS_DARWIN_ENV) && !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_USR_FBSD_ENV) +#if !defined(AFS_DARWIN_ENV) && !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_USR_FBSD_ENV) && !defined(AFS_LINUX20_ENV) #include /* MIN, MAX on Solaris */ #endif #include /* MIN, MAX elsewhere */ diff --git a/src/rx/rx_pthread.c b/src/rx/rx_pthread.c index 9811ffa..bd3d3b4 100644 --- a/src/rx/rx_pthread.c +++ b/src/rx/rx_pthread.c @@ -38,6 +38,7 @@ RCSID #include #include #include +#include /* * Number of times the event handling thread was signalled because a new @@ -87,7 +88,7 @@ void rxi_InitializeThreadSupport(void) { listeners_started = 0; - gettimeofday((struct timeval *)&rxi_clockNow, NULL); + clock_GetTime(&rxi_clockNow); } static void * @@ -154,8 +155,8 @@ event_handler(void *argp) next.sec = 30; /* Time to sleep if there are no events scheduled */ next.usec = 0; - gettimeofday((struct timeval *)&cv, NULL); - rxevent_RaiseEvents(&next); + clock_GetTime(&cv); + rxevent_RaiseEvents(&next); assert(pthread_mutex_lock(&event_handler_mutex) == 0); if (rx_pthread_event_rescheduled) {