From: Sam Hartman Date: Tue, 16 Jan 2001 05:39:10 +0000 (+0000) Subject: Add support for ppc and sparc X-Git-Tag: debian/1.0.2-1~25 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=bb36b0cd4786b4e5b9b302ee72b04e35a1f46405;p=packages%2Fo%2Fopenafs.git Add support for ppc and sparc --- diff --git a/debian/changelog b/debian/changelog index 8a298f62d..d4b695bce 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +openafs (1.0.1-4) unstable; urgency=low + + * Add support for ppc and sparc. + * Update maintainer address for modules. + + -- + openafs (1.0.1-3) unstable; urgency=low * Add support for Linux Kernel 2.4.x. diff --git a/debian/control b/debian/control index d13d955fb..d7fd41604 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Build-Depends: debhelper (>= 2.1.16), libncurses5-dev, libpam0g-dev, bison Standards-Version: 3.1.1 Package: openafs-client -Architecture: i386 +Architecture: i386, powerpc, sparc Depends: ${shlibs:Depends}, debconf, dnsutils, openafs-modules Conflicts: arla Description: The AFS distributed filesystem- client support @@ -19,7 +19,7 @@ Description: The AFS distributed filesystem- client support Package: openafs-kpasswd Priority: extra -Architecture: i386 +Architecture: i386, powerpc, sparc Depends: ${shlibs:Depends}, openafs-client (= ${Source-Version}) Conflicts: krb5-user, heimdal-clients Description: The AFS distributed filesystem- old password changing @@ -31,7 +31,7 @@ Description: The AFS distributed filesystem- old password changing Transarc kaserver to create users and change passwords. Package: openafs-fileserver -Architecture: i386 +Architecture: i386, powerpc, sparc Depends: ${shlibs:Depends}, debconf, openafs-client (= ${Source-Version}) Recommends: ntp Description: The AFS distributed filesystem- file server @@ -43,7 +43,7 @@ Description: The AFS distributed filesystem- file server installed on any machine that will export files into AFS. Package: openafs-dbserver -Architecture: i386 +Architecture: i386, powerpc, sparc Depends: ${shlibs:Depends}, debconf, openafs-fileserver (= ${Source-Version}), openafs-client (= ${Source-Version}), perl5, openafs-ptutil Description: The AFS distributed filesystem- database server AFS is a distributed filesystem allowing cross-platform sharing of @@ -55,7 +55,7 @@ Description: The AFS distributed filesystem- database server protection servers. Package: libopenafs-dev -Architecture: i386 +Architecture: i386, powerpc, sparc Priority: extra Description: The AFS distributed filesystem- development libraries AFS is a distributed filesystem allowing cross-platform sharing of diff --git a/debian/control.module b/debian/control.module index d61a2b0df..dd21164bb 100644 --- a/debian/control.module +++ b/debian/control.module @@ -1,7 +1,7 @@ Source: openafs Section: non-us/main Priority: optional -Maintainer: Sam Hartman +Maintainer: Sam Hartman Standards-Version: 3.1.1 Package: openafs-modules-=KVERS diff --git a/debian/control.module-image b/debian/control.module-image index 7ce7172ff..9a0619df4 100644 --- a/debian/control.module-image +++ b/debian/control.module-image @@ -1,7 +1,7 @@ Source: openafs Section: non-us/main Priority: optional -Maintainer: Sam Hartman +Maintainer: Sam Hartman Standards-Version: 3.1.1 Package: openafs-modules-=KVERS diff --git a/debian/kern-sysname b/debian/kern-sysname index 025dcc4ae..a775209c3 100644 --- a/debian/kern-sysname +++ b/debian/kern-sysname @@ -10,6 +10,37 @@ i[3456]86) ;; esac ;; + sparc) + case $KVERS in + 2.2*) + echo sparc_linux22 + ;; + 2.4*) + echo Error: Not Supported + ;; + esac + ;; + sparc64) + case $KVERS in + 2.2*) + echo sparc64_linux22 + ;; + 2.4*) + echo Error: Not Supported + ;; + esac + ;; + + ppc) + case $KVERS in + 2.2*) + echo error_not_supported + ;; + 2.4*) + echo ppc_linux24 + ;; + esac + ;; *) echo ERROr: sysname not yet known exit 1 diff --git a/debian/rules b/debian/rules index e7d0fed94..a11669cba 100755 --- a/debian/rules +++ b/debian/rules @@ -220,7 +220,7 @@ binary-source: build-modules: build-modules-stamp -build-modules-stamp: configure +build-modules-stamp: configure-stamp $(MAKE) SYS_NAME=$(SYS_NAME) lwp $(MAKE) SYS_NAME=$(SYS_NAME) libafs touch build-modules-stamp diff --git a/debian/sysname b/debian/sysname index 75cb49464..a455e9576 100755 --- a/debian/sysname +++ b/debian/sysname @@ -3,6 +3,12 @@ case `arch` in i[3456]86) echo i386_linux22 ;; + ppc) + echo ppc_linux24 + ;; + sparc|sparc64) + echo sparc_linux22 + ;; *) echo ERROr: sysname not yet known exit 1 diff --git a/openafs-1.0.1-sparclinux.patch b/openafs-1.0.1-sparclinux.patch new file mode 100644 index 000000000..1c1186652 --- /dev/null +++ b/openafs-1.0.1-sparclinux.patch @@ -0,0 +1,1536 @@ +*** src/Makefile 09:50:15 1.1.1.2 +--- src/Makefile 10:48:14 1.3 +*************** +*** 69,75 **** + cmd: basics comerr + ${COMPILE_PART1} cmd ${COMPILE_PART2} + @case ${SYS_NAME} in \ +! sgi_6* | sun4x_57 | sun4x_58 | hp_ux11* ) \ + ${COMPILE_PART1} cmd ${COMPILE_PART2} install64 ;; \ + esac + +--- 69,75 ---- + cmd: basics comerr + ${COMPILE_PART1} cmd ${COMPILE_PART2} + @case ${SYS_NAME} in \ +! sgi_6* | sun4x_57 | sun4x_58 | hp_ux11* | sparc64_linux* ) \ + ${COMPILE_PART1} cmd ${COMPILE_PART2} install64 ;; \ + esac + +*** src/afs/afs.h 09:50:34 1.1.1.2 +--- src/afs/afs.h 10:06:59 1.4 +*************** +*** 809,815 **** +--- 809,819 ---- + */ + ino64_t inode; /* Unix inode for this chunk */ + #else ++ #if defined(AFS_LINUX_64BIT_KERNEL) ++ long inode; /* Unix inode for this chunk */ ++ #else + afs_int32 inode; /* Unix inode for this chunk */ ++ #endif + #endif + afs_int32 chunkBytes; /* Num bytes in this chunk */ + char states; /* Has this chunk been modified? */ +*** src/afs/afs_call.c 09:50:34 1.1.1.2 +--- src/afs/afs_call.c 16:37:18 1.9 +*************** +*** 816,821 **** +--- 816,836 ---- + } + #endif /* AFS_SUN57_64BIT_ENV */ + ++ #if defined(AFS_LINUX_64BIT_KERNEL) ++ struct iparam32 dst32; ++ ++ #ifdef AFS_SPARC64_LINUX20_ENV ++ if (current->tss.flags & SPARC_FLAG_32BIT) { ++ #else ++ #error Not done for this linux version ++ #endif ++ AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code); ++ if (!code) ++ iparam32_to_iparam(&dst32, dst); ++ return code; ++ } ++ #endif /* AFS_LINUX_64BIT_KERNEL */ ++ + AFS_COPYIN(cmarg, (caddr_t) dst, sizeof *dst, code); + return code; + } +*************** +*** 888,896 **** + long parm4) + { + struct afssysargs args, *uap = &args; +! int linux_ret=0; +! int *retval = &linux_ret; +! int eparm[4]; /* matches AFSCALL_ICL in fstrace.c */ + #else + #if defined(UKERNEL) + Afs_syscall () +--- 903,911 ---- + long parm4) + { + struct afssysargs args, *uap = &args; +! long linux_ret=0; +! long *retval = &linux_ret; +! long eparm[4]; /* matches AFSCALL_ICL in fstrace.c */ + #else + #if defined(UKERNEL) + Afs_syscall () +*************** +*** 1114,1120 **** + { + extern short afs_brsDaemons; + extern afs_int32 afs_CheckServerDaemonStarted; +! extern struct osi_WaitHandle AFS_WaitHandler, AFS_CSWaitHandler; + extern struct osi_file *afs_cacheInodep; + + AFS_STATCNT(afs_shutdown); +--- 1129,1135 ---- + { + extern short afs_brsDaemons; + extern afs_int32 afs_CheckServerDaemonStarted; +! extern struct afs_osi_WaitHandle AFS_WaitHandler, AFS_CSWaitHandler; + extern struct osi_file *afs_cacheInodep; + + AFS_STATCNT(afs_shutdown); +*** src/afs/afs_daemons.c 09:50:35 1.1.1.2 +--- src/afs/afs_daemons.c 10:48:14 1.3 +*************** +*** 353,359 **** + #ifdef AFS_LINUX22_ENV + code = gop_lookupname((char *)ab->parm[0], AFS_UIOSYS, 1, (struct vnode **) 0, &dp); + if (dp) +! tvn = (struct vcache*)dp->d_inode; + #else + code = gop_lookupname((char *)ab->parm[0], AFS_UIOSYS, 1, (struct vnode **) 0, (struct vnode **)&tvn); + #endif +--- 353,359 ---- + #ifdef AFS_LINUX22_ENV + code = gop_lookupname((char *)ab->parm[0], AFS_UIOSYS, 1, (struct vnode **) 0, &dp); + if (dp) +! tvn = (struct vnode*)dp->d_inode; + #else + code = gop_lookupname((char *)ab->parm[0], AFS_UIOSYS, 1, (struct vnode **) 0, (struct vnode **)&tvn); + #endif +*** src/afs/afs_osi.h 09:50:35 1.1.1.2 +--- src/afs/afs_osi.h 10:06:59 1.4 +*************** +*** 154,160 **** + */ + + +! #if defined(AFS_HPUX_ENV) || defined(AFS_SUN57_ENV) || (defined(AFS_SGI61_ENV) && defined(KERNEL) && defined(_K64U64)) + typedef struct { + afs_int32 tv_sec; + afs_int32 tv_usec; +--- 154,160 ---- + */ + + +! #if defined(AFS_HPUX_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_LINUX_64BIT_KERNEL) || (defined(AFS_SGI61_ENV) && defined(KERNEL) && defined(_K64U64)) + typedef struct { + afs_int32 tv_sec; + afs_int32 tv_usec; +*** src/afs/afs_pioctl.c 09:50:35 1.1.1.2 +--- src/afs/afs_pioctl.c 10:06:59 1.6 +*************** +*** 180,185 **** +--- 180,200 ---- + } + #endif /* defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64) */ + ++ #if defined(AFS_LINUX_64BIT_KERNEL) ++ struct afs_ioctl32 dst32; ++ ++ #ifdef AFS_SPARC64_LINUX20_ENV ++ if (current->tss.flags & SPARC_FLAG_32BIT) { ++ #else ++ #error Not done for this linux type ++ #endif ++ AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code); ++ if (!code) ++ afs_ioctl32_to_afs_ioctl(&dst32, dst); ++ return code; ++ } ++ #endif /* defined(AFS_LINUX_64BIT_KERNEL) */ ++ + AFS_COPYIN(cmarg, (caddr_t) dst, sizeof *dst, code); + return code; + } +*************** +*** 792,798 **** + #ifdef AFS_LINUX22_ENV + code = gop_lookupname(path, AFS_UIOUSER, follow, (struct vnode **) 0, &dp); + if (!code) +! vp = (struct vcache *)dp->d_inode; + #else + code = gop_lookupname(path, AFS_UIOUSER, follow, (struct vnode **) 0, &vp); + #endif /* AFS_LINUX22_ENV */ +--- 807,813 ---- + #ifdef AFS_LINUX22_ENV + code = gop_lookupname(path, AFS_UIOUSER, follow, (struct vnode **) 0, &dp); + if (!code) +! vp = (struct vnode *)dp->d_inode; + #else + code = gop_lookupname(path, AFS_UIOUSER, follow, (struct vnode **) 0, &vp); + #endif /* AFS_LINUX22_ENV */ +*************** +*** 2753,2759 **** + /* Note that it doesn't have a cell yet... */ + if (!matches) { + afs_uint32 temp = sp->host.s_addr; +! srvr = afs_GetServer(&temp, 1, NULL, (vlonly ? AFS_VLPORT : AFS_FSPORT), + WRITE_LOCK, (afsUUID *)0,0); + srvr->addr->sa_iprank = sp->rank + afs_randomMod15(); + afs_PutServer(srvr, WRITE_LOCK); +--- 2768,2774 ---- + /* Note that it doesn't have a cell yet... */ + if (!matches) { + afs_uint32 temp = sp->host.s_addr; +! srvr = afs_GetServer(&temp, 1, 0, (vlonly ? AFS_VLPORT : AFS_FSPORT), + WRITE_LOCK, (afsUUID *)0,0); + srvr->addr->sa_iprank = sp->rank + afs_randomMod15(); + afs_PutServer(srvr, WRITE_LOCK); +*************** +*** 3318,3325 **** +--- 3333,3342 ---- + + if ( ainSize < sizeof(struct setspref) ) + return EINVAL; ++ #if 0 /* num_servers is unsigned */ + if ( sin->num_servers < 0 ) + return EINVAL; ++ #endif + if ( sin->num_servers > AFS_MAX_INTERFACE_ADDR) + return ENOMEM; + +*** src/afs/exporter.h 09:50:35 1.1.1.2 +--- src/afs/exporter.h 10:06:59 1.4 +*************** +*** 33,39 **** + * up 2 bytes + */ + +! #if defined(AFS_SUN57_64BIT_ENV) || defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZPTR==64)) + #define AFS_XLATOR_MAGIC 0x8765 /* XXX */ + #else + #define AFS_XLATOR_MAGIC 0x87654321 +--- 33,39 ---- + * up 2 bytes + */ + +! #if defined(AFS_SUN57_64BIT_ENV) || defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZPTR==64)) || defined(AFS_LINUX_64BIT_KERNEL) + #define AFS_XLATOR_MAGIC 0x8765 /* XXX */ + #else + #define AFS_XLATOR_MAGIC 0x87654321 +*** src/afs/LINUX/osi_alloc.c 09:50:35 1.1.1.2 +--- src/afs/LINUX/osi_alloc.c 10:06:59 1.6 +*************** +*** 32,39 **** + }; + + /* These assume 32-bit pointers */ +! #define MEMTYPE(A) (((unsigned int)A) & 0x3) +! #define MEMADDR(A) (void *)((unsigned int)(A) & (~0x3)) + + /* globals */ + afs_atomlist *al_mem_pool; /* pool of osi_linux_mem structures */ +--- 32,39 ---- + }; + + /* These assume 32-bit pointers */ +! #define MEMTYPE(A) (((unsigned long)A) & 0x3) +! #define MEMADDR(A) (void *)((unsigned long)(A) & (~0x3)) + + /* globals */ + afs_atomlist *al_mem_pool; /* pool of osi_linux_mem structures */ +*************** +*** 82,90 **** + + /* if we can use kmalloc use it to allocate the required memory. */ + if (asize < MAX_KMALLOC_SIZE) { +! new = (void *)kmalloc(asize, GFP_KERNEL); + if (new) /* piggy back alloc type */ +! (unsigned int)new |= KM_TYPE; + } + if (!new) { /* otherwise use vmalloc */ + int max_wait = 10; +--- 82,90 ---- + + /* if we can use kmalloc use it to allocate the required memory. */ + if (asize < MAX_KMALLOC_SIZE) { +! new = (void *)(long)kmalloc(asize, GFP_KERNEL); + if (new) /* piggy back alloc type */ +! (unsigned long)new |= KM_TYPE; + } + if (!new) { /* otherwise use vmalloc */ + int max_wait = 10; +*************** +*** 95,101 **** + schedule(); + } + if (new) /* piggy back alloc type */ +! (unsigned int)new |= VM_TYPE; + } + if (new) + memset(MEMADDR(new), 0, asize); +--- 95,101 ---- + schedule(); + } + if (new) /* piggy back alloc type */ +! (unsigned long)new |= VM_TYPE; + } + if (new) + memset(MEMADDR(new), 0, asize); +*************** +*** 139,145 **** + { + unsigned int key; + +! key = (unsigned int)p >> 2; + key = (key * HASH_CONST)%HASH_PRIME; + + return key; +--- 139,145 ---- + { + unsigned int key; + +! key = (unsigned int)(long)p >> 2; + key = (key * HASH_CONST)%HASH_PRIME; + + return key; +*** src/afs/LINUX/osi_cred.c 09:50:35 1.1.1.2 +--- src/afs/LINUX/osi_cred.c 10:06:59 1.4 +*************** +*** 48,54 **** + osi_Panic("crget: No more memory for creds!\n"); + + for (i=0; i < CRED_ALLOC_STEP-1; i++) +! cred_pool[i].cr_ref = (int)&cred_pool[i+1]; + cred_pool[i].cr_ref = 0; + } + tmp = cred_pool; +--- 48,54 ---- + osi_Panic("crget: No more memory for creds!\n"); + + for (i=0; i < CRED_ALLOC_STEP-1; i++) +! cred_pool[i].cr_ref = (long)&cred_pool[i+1]; + cred_pool[i].cr_ref = 0; + } + tmp = cred_pool; +*************** +*** 69,75 **** + } + + CRED_LOCK(); +! cr->cr_ref = (int)cred_pool; + cred_pool = cr; + CRED_UNLOCK(); + ncreds_inuse --; +--- 69,75 ---- + } + + CRED_LOCK(); +! cr->cr_ref = (long)cred_pool; + cred_pool = cr; + CRED_UNLOCK(); + ncreds_inuse --; +*** src/afs/LINUX/osi_file.c 09:50:35 1.1.1.2 +--- src/afs/LINUX/osi_file.c 10:48:14 1.3 +*************** +*** 181,187 **** + char *aptr; + afs_int32 asize; { + struct AFS_UCRED *oldCred; +! unsigned int resid; + register afs_int32 code; + register afs_int32 cnt1=0; + AFS_STATCNT(osi_Read); +--- 181,187 ---- + char *aptr; + afs_int32 asize; { + struct AFS_UCRED *oldCred; +! size_t resid; + register afs_int32 code; + register afs_int32 cnt1=0; + AFS_STATCNT(osi_Read); +*************** +*** 220,226 **** + afs_int32 offset; + afs_int32 asize; { + struct AFS_UCRED *oldCred; +! unsigned int resid; + register afs_int32 code; + AFS_STATCNT(osi_Write); + if ( !afile ) +--- 220,226 ---- + afs_int32 offset; + afs_int32 asize; { + struct AFS_UCRED *oldCred; +! size_t resid; + register afs_int32 code; + AFS_STATCNT(osi_Write); + if ( !afile ) +*** src/afs/LINUX/osi_groups.c 09:50:35 1.1.1.2 +--- src/afs/LINUX/osi_groups.c 10:06:59 1.5 +*************** +*** 101,107 **** + { + int code; + cred_t *cr = crref(); +! int junk; + int old_pag; + + lock_kernel(); +--- 101,107 ---- + { + int code; + cred_t *cr = crref(); +! afs_uint32 junk; + int old_pag; + + lock_kernel(); +*************** +*** 125,130 **** +--- 125,149 ---- + + return code; + } ++ ++ #ifdef AFS_SPARC64_LINUX20_ENV ++ asmlinkage int afs_xsetgroups32(int gidsetsize, __kernel_gid_t32 *grouplist) ++ { ++ gid_t gl[NGROUPS]; ++ int ret, i; ++ mm_segment_t old_fs = get_fs (); ++ ++ if ((unsigned) gidsetsize > NGROUPS) ++ return -EINVAL; ++ for (i = 0; i < gidsetsize; i++, grouplist++) ++ if (__get_user (gl[i], grouplist)) ++ return -EFAULT; ++ set_fs (KERNEL_DS); ++ ret = afs_xsetgroups(gidsetsize, gl); ++ set_fs (old_fs); ++ return ret; ++ } ++ #endif + + static int afs_setgroups(cred_t **cr, int ngroups, gid_t *gidset, int change_parent) + { +*** src/afs/LINUX/osi_machdep.h 09:50:36 1.1.1.2 +--- src/afs/LINUX/osi_machdep.h 10:48:14 1.3 +*************** +*** 30,36 **** +--- 30,40 ---- + #define afs_hz HZ + #include "../h/sched.h" + #define osi_Time() (xtime.tv_sec) ++ #if (CPU == sparc64) ++ #define osi_GetTime(V) do { (*##V##).tv_sec = xtime.tv_sec; (*##V##).tv_usec = xtime.tv_usec; } while (0) ++ #else + #define osi_GetTime(V) (*(V)=xtime) ++ #endif + + #undef gop_lookupname + #define gop_lookupname osi_lookupname +*************** +*** 89,95 **** +--- 93,103 ---- + + /* cred struct */ + typedef struct cred { /* maps to task field: */ ++ #if (CPU == sparc64) ++ long cr_ref; ++ #else + int cr_ref; ++ #endif + unsigned short cr_uid; /* euid */ + unsigned short cr_ruid; /* uid */ + unsigned short cr_gid; /* egid */ +*** src/afs/LINUX/osi_misc.c 09:50:36 1.1.1.2 +--- src/afs/LINUX/osi_misc.c 10:06:59 1.4 +*************** +*** 264,269 **** +--- 264,276 ---- + void afs_osi_SetTime(osi_timeval_t *tvp) + { + extern int (*sys_settimeofdayp)(struct timeval *tv, struct timezone *tz); ++ #ifdef AFS_LINUX_64BIT_KERNEL ++ struct timeval tv; ++ AFS_STATCNT(osi_SetTime); ++ tv.tv_sec = tvp->tv_sec; ++ tv.tv_usec = tvp->tv_usec; ++ (void) (*sys_settimeofdayp)(&tv, NULL); ++ #else + KERNEL_SPACE_DECL; + + AFS_STATCNT(osi_SetTime); +*************** +*** 271,276 **** +--- 278,284 ---- + TO_USER_SPACE(); + (void) (*sys_settimeofdayp)(tvp, NULL); + TO_KERNEL_SPACE(); ++ #endif + } + + /* Free all the pages on any of the vnodes in the vlru. Must be done before +*** src/afs/LINUX/osi_module.c 09:50:36 1.1.1.2 +--- src/afs/LINUX/osi_module.c 10:06:59 1.8 +*************** +*** 26,32 **** + asmlinkage int (*sys_killp)(int pid, int signal); + asmlinkage int (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist); + +! extern void *sys_call_table[]; + extern struct file_system_type afs_file_system; + + static long get_page_offset(void); +--- 26,32 ---- + asmlinkage int (*sys_killp)(int pid, int signal); + asmlinkage int (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist); + +! extern unsigned int sys_call_table[]; /* changed to uint because SPARC64 has syscaltable of 32bit items */ + extern struct file_system_type afs_file_system; + + static long get_page_offset(void); +*************** +*** 42,53 **** + /* Since sys_ni_syscall is not exported, I need to cache it in order to restore + * it. + */ +! static void *afs_ni_syscall = NULL; + + int init_module(void) + { + extern int afs_syscall(); + extern int afs_xsetgroups(); + + /* obtain PAGE_OFFSET value */ + afs_linux_page_offset = get_page_offset(); +--- 42,78 ---- + /* Since sys_ni_syscall is not exported, I need to cache it in order to restore + * it. + */ +! static unsigned int afs_ni_syscall = 0; + ++ #ifdef AFS_SPARC64_LINUX20_ENV ++ static unsigned int afs_ni_syscall32 = 0; ++ asmlinkage int (*sys_setgroupsp32)(int gidsetsize, __kernel_gid_t32 *grouplist); ++ extern unsigned int sys_call_table32[]; ++ ++ asmlinkage int afs_syscall32(long syscall, long parm1, long parm2, long parm3, ++ long parm4, long parm5) ++ { ++ __asm__ __volatile__ (" ++ srl %o4, 0, %o4 ++ mov %o7, %i7 ++ call afs_syscall ++ srl %o5, 0, %o5 ++ ret ++ nop ++ "); ++ } ++ #endif ++ ++ #define POINTER2SYSCALL (unsigned int)(unsigned long) ++ #define SYSCALL2POINTER (void *)(long) ++ + int init_module(void) + { + extern int afs_syscall(); + extern int afs_xsetgroups(); ++ #ifdef AFS_SPARC64_LINUX20_ENV ++ extern int afs_xsetgroups32(); ++ #endif + + /* obtain PAGE_OFFSET value */ + afs_linux_page_offset = get_page_offset(); +*************** +*** 59,84 **** + } + + /* Initialize pointers to kernel syscalls. */ +! sys_settimeofdayp = sys_call_table[__NR_settimeofday]; +! sys_socketcallp = sys_call_table[__NR_socketcall]; +! sys_killp = sys_call_table[__NR_kill]; + + /* setup AFS entry point. */ +! if (sys_call_table[__NR_afs_syscall] == afs_syscall) { + printf("AFS syscall entry point already in use!\n"); + return -EBUSY; + } + + + afs_ni_syscall = sys_call_table[__NR_afs_syscall]; +! sys_call_table[__NR_afs_syscall] = afs_syscall; + + osi_Init(); + register_filesystem(&afs_file_system); + + /* Intercept setgroups calls */ +! sys_setgroupsp = sys_call_table[__NR_setgroups]; +! sys_call_table[__NR_setgroups] = afs_xsetgroups; + + return 0; + } +--- 84,117 ---- + } + + /* Initialize pointers to kernel syscalls. */ +! sys_settimeofdayp = SYSCALL2POINTER sys_call_table[__NR_settimeofday]; +! sys_socketcallp = SYSCALL2POINTER sys_call_table[__NR_socketcall]; +! sys_killp = SYSCALL2POINTER sys_call_table[__NR_kill]; + + /* setup AFS entry point. */ +! if (SYSCALL2POINTER sys_call_table[__NR_afs_syscall] == afs_syscall) { + printf("AFS syscall entry point already in use!\n"); + return -EBUSY; + } + + + afs_ni_syscall = sys_call_table[__NR_afs_syscall]; +! sys_call_table[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall; +! #ifdef AFS_SPARC64_LINUX20_ENV +! afs_ni_syscall32 = sys_call_table32[__NR_afs_syscall]; +! sys_call_table32[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall32; +! #endif + + osi_Init(); + register_filesystem(&afs_file_system); + + /* Intercept setgroups calls */ +! sys_setgroupsp = SYSCALL2POINTER sys_call_table[__NR_setgroups]; +! sys_call_table[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups; +! #ifdef AFS_SPARC64_LINUX20_ENV +! sys_setgroupsp32 = SYSCALL2POINTER sys_call_table32[__NR_setgroups]; +! sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups32; +! #endif + + return 0; + } +*************** +*** 87,94 **** + { + struct task_struct *t; + +! sys_call_table[__NR_setgroups] = sys_setgroupsp; + sys_call_table[__NR_afs_syscall] = afs_ni_syscall; + + unregister_filesystem(&afs_file_system); + +--- 120,131 ---- + { + struct task_struct *t; + +! sys_call_table[__NR_setgroups] = POINTER2SYSCALL sys_setgroupsp; + sys_call_table[__NR_afs_syscall] = afs_ni_syscall; ++ #ifdef AFS_SPARC64_LINUX20_ENV ++ sys_call_table32[__NR_setgroups] = POINTER2SYSCALL sys_setgroupsp32; ++ sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32; ++ #endif + + unregister_filesystem(&afs_file_system); + +*************** +*** 100,106 **** + + static long get_page_offset(void) + { +! #if defined(AFS_PPC_LINUX22_ENV) + return PAGE_OFFSET; + #else + struct task_struct *p; +--- 137,143 ---- + + static long get_page_offset(void) + { +! #if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) + return PAGE_OFFSET; + #else + struct task_struct *p; +*** src/afs/LINUX/osi_sleep.c 09:50:36 1.1.1.2 +--- src/afs/LINUX/osi_sleep.c 12:33:16 +*************** +*** 16,24 **** + + #if defined(AFS_GLOBAL_SUNLOCK) + static int osi_TimedSleep(char *event, afs_int32 ams, int aintok); + void afs_osi_Wakeup(char *event); + void afs_osi_Sleep(char *event); +- #endif + + static char waitV; + +--- 16,24 ---- + + #if defined(AFS_GLOBAL_SUNLOCK) + static int osi_TimedSleep(char *event, afs_int32 ams, int aintok); ++ #endif + void afs_osi_Wakeup(char *event); + void afs_osi_Sleep(char *event); + + static char waitV; + +*** src/afs/LINUX/osi_vnodeops.c 09:50:36 1.1.1.2 +--- src/afs/LINUX/osi_vnodeops.c 10:48:14 1.3 +*************** +*** 146,151 **** +--- 146,152 ---- + static int afs_linux_readdir(struct file *fp, + void *dirbuf, filldir_t filldir) + { ++ extern struct DirEntry * afs_dir_GetBlob(); + struct vcache *avc = (struct vcache*)FILE_INODE(fp); + struct vrequest treq; + register struct dcache *tdc; +*************** +*** 525,531 **** + } + + /* Not allowed to directly read a directory. */ +! int afs_linux_dir_read(struct file *fp, char *buf, size_t count, loff_t *ppos) + { + return -EISDIR; + } +--- 526,532 ---- + } + + /* Not allowed to directly read a directory. */ +! ssize_t afs_linux_dir_read(struct file *fp, char *buf, size_t count, loff_t *ppos) + { + return -EISDIR; + } +*** src/afs/VNOPS/afs_vnop_lookup.c 09:50:36 1.1.1.2 +--- src/afs/VNOPS/afs_vnop_lookup.c 10:06:59 1.4 +*************** +*** 325,331 **** +--- 325,335 ---- + #if (defined(AFS_SGI62_ENV) || defined(AFS_SUN57_64BIT_ENV)) + extern int BlobScan(ino64_t *afile, afs_int32 ablob); + #else ++ #if defined AFS_LINUX_64BIT_KERNEL ++ extern int BlobScan(long *afile, afs_int32 ablob); ++ #else + extern int BlobScan(afs_int32 *afile, afs_int32 ablob); ++ #endif + #endif + + +*** src/afs/VNOPS/afs_vnop_readdir.c 09:50:36 1.1.1.2 +--- src/afs/VNOPS/afs_vnop_readdir.c 10:06:59 1.4 +*************** +*** 59,65 **** +--- 59,69 ---- + #if defined(AFS_SGI62_ENV) || defined(AFS_SUN57_64BIT_ENV) + int BlobScan(ino64_t *afile, afs_int32 ablob) + #else ++ #ifdef AFS_LINUX_64BIT_KERNEL ++ int BlobScan(long *afile, afs_int32 ablob) ++ #else + int BlobScan(afs_int32 *afile, afs_int32 ablob) ++ #endif + #endif + { + register afs_int32 relativeBlob; +*** src/config/Makefile.sparc64_linux22 May 5 22:32:27 1998 +--- src/config/Makefile.sparc64_linux22 Dec 22 14:37:51 2000 +*************** +*** 0 **** +--- 1,50 ---- ++ # Copyright 1998 Transarc Corporation ++ # ++ # 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 = 2.2.14 ++ ++ # ++ # 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= ++ SHARE_LDFLAGS = -shared -Xlinker -x ++ SHLIB_SUFFIX=so ++ SHLIB_CFLAGS= ++ # ++ # libraries ++ MTLIBS=-lpthread ++ TXLIBS= /usr/lib/libncurses.so ++ XLIBS= ++ # ++ # programs ++ AR=ar ++ AS=as ++ CP=cp ++ INSTALL=${SRCDIR}bin/install ++ LD=ld ++ MT_CC=cc ++ MV=mv ++ RANLIB=ranlib ++ RM=rm ++ WASHTOOL=${SRCDIR}bin/washtool ++ # ++ # Other OS specific requirements ++ # ++ YACC = bison -y ++ LEX = flex -l ++ # Used in des library. ++ CRYPT_OBJ = crypt.o +*** src/config/Makefile.sparc_linux22 May 5 22:32:27 1998 +--- src/config/Makefile.sparc_linux22 Dec 22 14:37:51 2000 +*************** +*** 0 **** +--- 1,50 ---- ++ # Copyright 1998 Transarc Corporation ++ # ++ # 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 = 2.2.14 ++ ++ # ++ # 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= ++ SHARE_LDFLAGS = -shared -Xlinker -x ++ SHLIB_SUFFIX=so ++ SHLIB_CFLAGS= ++ # ++ # libraries ++ MTLIBS=-lpthread ++ TXLIBS= /usr/lib/libncurses.so ++ XLIBS= ++ # ++ # programs ++ AR=ar ++ AS=as ++ CP=cp ++ INSTALL=${SRCDIR}bin/install ++ LD=ld ++ MT_CC=cc ++ MV=mv ++ RANLIB=ranlib ++ RM=rm ++ WASHTOOL=${SRCDIR}bin/washtool ++ # ++ # Other OS specific requirements ++ # ++ YACC = bison -y ++ LEX = flex -l ++ # Used in des library. ++ CRYPT_OBJ = crypt.o +*** src/config/afs_sysnames.h 09:50:41 1.1.1.2 +--- src/config/afs_sysnames.h 10:48:14 1.3 +*************** +*** 114,119 **** +--- 114,124 ---- + #define SYS_NAME_ID_ppc_linux22 1601 + #define SYS_NAME_ID_ppc_linux24 1602 + ++ #define SYS_NAME_ID_sparc_linux2 1700 ++ #define SYS_NAME_ID_sparc_linux22 1701 ++ ++ #define SYS_NAME_ID_sparc64_linux2 1800 ++ #define SYS_NAME_ID_sparc64_linux22 1801 + + + /* +*** src/config/param.sparc64_linux22.h May 5 22:32:27 1998 +--- src/config/param.sparc64_linux22.h Dec 22 12:58:37 2000 +*************** +*** 0 **** +--- 1,79 ---- ++ /* Copyright (C) 1998 by Transarc Corporation */ ++ ++ ++ #ifndef _PARAM_SPARC64_LINUX22_H_ ++ #define _PARAM_SPARC64_LINUX22_H_ ++ ++ /* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, ++ * it's a judgment call. If something is obviously sparc64 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_SPARC64_LINUX20_ENV 1 ++ #define AFS_SPARC64_LINUX22_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 227 ++ #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_32BIT_USR_ENV 1 /* user level processes are 32bit */ ++ #define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ ++ ++ #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 "sparc64_linux22" ++ #define SYS_NAME_ID SYS_NAME_ID_sparc64_linux22 ++ #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 */ ++ ++ #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 ++ #define __SMP__ ++ #define AFS_GLOBAL_SUNLOCK ++ #endif ++ ++ #endif /* __KERNEL__ && !DUMP_KERNEL*/ ++ ++ #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 */ ++ ++ /* on sparclinux is O_LARGEFILE defined but there is not off64_t, ++ so small hack to get usd_file.c work */ ++ #ifndef KERNEL ++ #define __USE_FILE_OFFSET64 1 ++ #define __USE_LARGEFILE64 1 ++ #if !defined off64_t ++ #define off64_t __off64_t ++ #endif ++ #endif ++ ++ #endif /* _PARAM_SPARC64_LINUX20_H_ */ +*** src/config/param.sparc64_linux22_usr.h May 5 22:32:27 1998 +--- src/config/param.sparc64_linux22_usr.h Dec 22 12:10:53 2000 +*************** +*** 0 **** +--- 1,56 ---- ++ /* Copyright (C) 1998 by Transarc Corporation */ ++ ++ ++ #ifndef _PARAM_USR_SPARC64_LINUX22_H_ ++ #define _PARAM_USR_SPARC64_LINUX22_H_ ++ ++ /* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, ++ * it's a judgment call. If something is obviously sparc64 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_NONFSTRANS 1 ++ ++ #define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ ++ #define AFS_SYSCALL 227 ++ #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 "sparc64_linux22" ++ #define SYS_NAME_ID SYS_NAME_ID_sparc64_linux22 ++ #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 /* _PARAM_USR_SPARC64_LINUX22_H_ */ +*** src/config/param.sparc_linux22.h May 5 22:32:27 1998 +--- src/config/param.sparc_linux22.h Dec 22 12:58:26 2000 +*************** +*** 0 **** +--- 1,81 ---- ++ /* Copyright (C) 1998 by Transarc Corporation */ ++ ++ ++ #ifndef _PARAM_SPARC_LINUX22_H_ ++ #define _PARAM_SPARC_LINUX22_H_ ++ ++ /* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, ++ * it's a judgment call. If something is obviously sparc 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_SPARC_LINUX20_ENV 1 ++ #define AFS_SPARC_LINUX22_ENV 1 ++ #define AFS_NONFSTRANS 1 ++ ++ #define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ ++ #define AFS_SYSCALL 227 ++ #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 "sparc_linux22" ++ #define SYS_NAME_ID SYS_NAME_ID_sparc_linux22 ++ #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 */ ++ ++ #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 ++ #define __SMP__ ++ #define AFS_GLOBAL_SUNLOCK ++ #endif ++ ++ #endif /* __KERNEL__ && !DUMP_KERNEL*/ ++ ++ #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 */ ++ ++ #if defined(AFS_SMP) && defined(CONFIG_MODVERSIONS) ++ /* hack, I don't know what else with theese symbols */ ++ #define _do_spin_lock _do_spin_lock_R__ver__do_spin_lock ++ #define _do_spin_unlock _do_spin_unlock_R__ver__do_spin_unlock ++ #define kernel_flag kernel_flag_R__ver_kernel_flag ++ #endif ++ ++ /* on sparclinux is O_LARGEFILE defined but there is not off64_t, ++ so small hack to get usd_file.c work */ ++ #ifndef KERNEL ++ #define __USE_FILE_OFFSET64 1 ++ #define __USE_LARGEFILE64 1 ++ #if !defined off64_t ++ #define off64_t __off64_t ++ #endif ++ #endif ++ ++ #endif /* _PARAM_SPARC_LINUX20_H_ */ +*** src/config/param.sparc_linux22_usr.h May 5 22:32:27 1998 +--- src/config/param.sparc_linux22_usr.h Dec 22 12:10:34 2000 +*************** +*** 0 **** +--- 1,56 ---- ++ /* Copyright (C) 1998 by Transarc Corporation */ ++ ++ ++ #ifndef _PARAM_USR_SPARC_LINUX22_H_ ++ #define _PARAM_USR_SPARC_LINUX22_H_ ++ ++ /* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, ++ * it's a judgment call. If something is obviously sparc 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_NONFSTRANS 1 ++ ++ #define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ ++ #define AFS_SYSCALL 227 ++ #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 "sparc_linux22" ++ #define SYS_NAME_ID SYS_NAME_ID_sparc_linux22 ++ #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 /* _PARAM_USR_SPARC_LINUX22_H_ */ +*** src/des/andrew-conf.h 09:50:41 1.1.1.2 +--- src/des/andrew-conf.h 10:48:14 1.3 +*************** +*** 44,50 **** +--- 44,58 ---- + #ifdef AFS_PPC_LINUX20_ENV + #include "conf-ppc-linux.h" + #else ++ #ifdef AFS_SPARC_LINUX20_ENV ++ #include "conf-sparc-linux.h" ++ #else ++ #ifdef AFS_SPARC64_LINUX20_ENV ++ #include "conf-sparc64-linux.h" ++ #else + #include "conf-i386-linux.h" ++ #endif /* AFS_SPARC64_LINUX20_ENV */ ++ #endif /* AFS_SPARC_LINUX20_ENV */ + #endif + #else + Sorry, you lose. +*** src/des/conf-sparc-linux.h May 5 22:32:27 1998 +--- src/des/conf-sparc-linux.h Dec 22 14:37:52 2000 +*************** +*** 0 **** +--- 1,15 ---- ++ /* ++ * Copyright 1988 by the Massachusetts Institute of Technology. ++ * ++ * For copying and distribution information, please see the file ++ * . ++ * ++ * Machine-type definitions: Linux on Intel ++ */ ++ ++ #include ++ ++ #define BITS32 ++ #define BIG ++ #define MSBFIRST ++ #define MUSTALIGN +*** src/des/conf-sparc64-linux.h May 5 22:32:27 1998 +--- src/des/conf-sparc64-linux.h Dec 22 14:37:52 2000 +*************** +*** 0 **** +--- 1,15 ---- ++ /* ++ * Copyright 1988 by the Massachusetts Institute of Technology. ++ * ++ * For copying and distribution information, please see the file ++ * . ++ * ++ * Machine-type definitions: Linux on Intel ++ */ ++ ++ #include ++ ++ #define BITS32 ++ #define BIG ++ #define MSBFIRST ++ #define MUSTALIGN +*** src/libafs/MakefileProto.LINUX 09:50:43 1.1.1.2 +--- src/libafs/MakefileProto.LINUX 15:24:19 1.5 +*************** +*** 41,46 **** +--- 41,57 ---- + -fno-strength-reduce -pipe -m486 -malign-loops=2 -malign-jumps=2 \ + -malign-functions=2 + DEFINES = -D__KERNEL__ -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} ++ ++ LD = ld -m elf32_sparc ++ CCFLAGS = -O2 -fomit-frame-pointer \ ++ -fno-strength-reduce -pipe -mcpu=v8 -mno-fpu -fcall-used-g5 -fcall-used-g7 ++ DEFINES = -D__KERNEL__ -DCPU=sparc -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} ++ ++ CC = sparc64-linux-gcc ++ LD = ld -m elf64_sparc ++ CCFLAGS = -O2 -fomit-frame-pointer \ ++ -fno-strength-reduce -pipe -mcpu=ultrasparc -m64 -mno-fpu -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare ++ DEFINES = -D__KERNEL__ -DCPU=sparc64 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} + + CCFLAGS = -O2 -fomit-frame-pointer -fno-strength-reduce \ + -fno-strict-aliasing -fsigned-char -msoft-float -pipe \ +*************** +*** 95,100 **** +--- 106,115 ---- + ln -s ${LINUX_SRCDIR}$$v/include/asm-i386 asm ; \ + + ln -s ${LINUX_SRCDIR}$$v/include/asm-ppc asm ; \ ++ ++ ln -s ${LINUX_SRCDIR}$$v/include/asm-sparc asm ; \ ++ ++ ln -s ${LINUX_SRCDIR}$$v/include/asm-sparc64 asm ; \ + + for m in ${MPS} ; do \ + KDIR=${KOBJ}-$$v-$$m ; \ +*** src/lwp/lwp.c 09:50:44 1.1.1.2 +--- src/lwp/lwp.c 10:48:14 1.3 +*************** +*** 342,351 **** +--- 342,357 ---- + savecontext(Create_Process_Part2, &temp2->context, + stackptr+stacksize-16); /* 16 = 2 * jmp_buf_type*/ + #else ++ #if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) + savecontext(Create_Process_Part2, &temp2->context, ++ stackptr+stacksize-0x40); /* lomgjmp does something ++ with %fp + 0x38 */ ++ #else ++ savecontext(Create_Process_Part2, &temp2->context, + stackptr+stacksize-sizeof(void *)); + #endif + #endif ++ #endif + /* End of gross hack */ + + Set_LWP_RC(); +*************** +*** 463,470 **** +--- 469,481 ---- + savecontext(Dispatcher, &(temp -> context), + &(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-8])); + #else ++ #if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) + savecontext(Dispatcher, &(temp -> context), ++ &(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-0x40])); ++ #else ++ savecontext(Dispatcher, &(temp -> context), + &(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-sizeof(void *)])); ++ #endif + #endif + #endif + } +*** src/lwp/lwp.h 09:50:44 1.1.1.2 +--- src/lwp/lwp.h 10:48:14 1.3 +*************** +*** 193,199 **** + #else + struct lwp_context { /* saved context for dispatcher */ + char *topstack; /* ptr to top of process stack */ +! #ifdef sparc + #ifdef save_allregs + int globals[7+1+32+2+32+2]; /* g1-g7, y reg, f0-f31, fsr, fq, c0-c31, csr, cq. */ + #else +--- 193,199 ---- + #else + struct lwp_context { /* saved context for dispatcher */ + char *topstack; /* ptr to top of process stack */ +! #if defined(sparc) && !defined(__linux__) + #ifdef save_allregs + int globals[7+1+32+2+32+2]; /* g1-g7, y reg, f0-f31, fsr, fq, c0-c31, csr, cq. */ + #else +*** src/lwp/preempt.c 09:50:44 1.1.1.2 +--- src/lwp/preempt.c 10:48:14 1.3 +*************** +*** 95,98 **** + return(LWP_SUCCESS); + } + +! #endif /* AFS_I386_LINUX20_ENV */ +--- 95,98 ---- + return(LWP_SUCCESS); + } + +! #endif /* AFS_LINUX20_ENV */ +*** src/lwp/process.c 09:50:44 1.1.1.2 +--- src/lwp/process.c 15:24:19 1.5 +*************** +*** 33,40 **** + #elif defined(AFS_LINUX20_ENV) + #if defined(AFS_PPC_LINUX20_ENV) + #define LWP_SP 0 +! #else + #define LWP_SP 4 + #endif + #else + Need offset to SP in jmp_buf for this platform. +--- 33,48 ---- + #elif defined(AFS_LINUX20_ENV) + #if defined(AFS_PPC_LINUX20_ENV) + #define LWP_SP 0 +! #elif defined(AFS_I386_LINUX20_ENV) + #define LWP_SP 4 ++ #elif defined(AFS_SPARC_LINUX20_ENV) ++ #define LWP_SP 0 ++ #define LWP_FP 1 ++ #elif defined(AFS_SPARC64_LINUX20_ENV) && defined(AFS_32BIT_USR_ENV) ++ #define LWP_SP 0 ++ #define LWP_FP 1 ++ #else ++ #error Unsupported linux LWP system type. + #endif + #else + Need offset to SP in jmp_buf for this platform. +*************** +*** 97,102 **** +--- 105,113 ---- + { + case 0: jmpBuffer = (jmp_buf_type *)jmp_tmp; + jmpBuffer[LWP_SP] = (jmp_buf_type)sp; ++ #if defined(AFS_SPARC_LINUX20_ENV) || (defined(AFS_SPARC64_LINUX20_ENV) && defined(AFS_32BIT_USR_ENV)) ++ jmpBuffer[LWP_FP] = (jmp_buf_type)sp; ++ #endif + longjmp(jmp_tmp,1); + break; + case 1: (*EP)(); +*** src/rx/rx.c 09:50:47 1.1.1.2 +--- src/rx/rx.c 10:07:00 1.4 +*************** +*** 4927,4933 **** + (char *)call, istack); + #else /* RX_ENABLE_LOCKS */ + call->resendEvent = rxevent_Post(&retryTime, rxi_Start, +! (char *)call, (void*)istack); + #endif /* RX_ENABLE_LOCKS */ + } + } +--- 4927,4933 ---- + (char *)call, istack); + #else /* RX_ENABLE_LOCKS */ + call->resendEvent = rxevent_Post(&retryTime, rxi_Start, +! (char *)call, (void*)(long)istack); + #endif /* RX_ENABLE_LOCKS */ + } + } +*** src/rx/rx_clock.h 09:50:47 1.1.1.2 +--- src/rx/rx_clock.h 10:32:48 +*************** +*** 83,89 **** + #else /* KERNEL */ + #include "../afs/afs_osi.h" + #define clock_Init() +! #if defined(AFS_SGI61_ENV) || defined(AFS_HPUX_ENV) + #define clock_GetTime(cv) osi_GetTime((osi_timeval_t *)cv) + #else + #define clock_GetTime(cv) osi_GetTime((struct timeval *)cv) +--- 83,89 ---- + #else /* KERNEL */ + #include "../afs/afs_osi.h" + #define clock_Init() +! #if defined(AFS_SGI61_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX_64BIT_KERNEL) + #define clock_GetTime(cv) osi_GetTime((osi_timeval_t *)cv) + #else + #define clock_GetTime(cv) osi_GetTime((struct timeval *)cv) +*** src/venus/fstrace.c 09:50:49 1.1.1.2 +--- src/venus/fstrace.c 16:37:18 1.6 +*************** +*** 2072,2082 **** +--- 2072,2091 ---- + { + int code; + #ifdef AFS_LINUX20_ENV ++ #if defined AFS_LINUX_64BIT_KERNEL ++ long long eparm[4]; ++ /* don't want to sign extend it to 64bit, so using ulong */ ++ eparm[0] = (unsigned long)parm3; ++ eparm[1] = (unsigned long)parm4; ++ eparm[2] = (unsigned long)parm5; ++ eparm[3] = (unsigned long)parm6; ++ #else + int eparm[4]; + eparm[0] = parm3; + eparm[1] = parm4; + eparm[2] = parm5; + eparm[3] = parm6; ++ #endif + /* Linux can only handle 5 arguments in the actual syscall. */ + if (call == AFSCALL_ICL) { + code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, eparm); +*************** +*** 2084,2089 **** +--- 2093,2106 ---- + else { + code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, parm3); + } ++ #if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) ++ /* on sparc this function returns none value, so do it myself */ ++ __asm__ __volatile__ (" ++ mov %o0, %i0 ++ ret ++ restore ++ "); ++ #endif + #else + #if !defined(AFS_SGI_ENV) && !defined(AFS_AIX32_ENV) + code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, parm3, parm4); +*** src/venus/kdump.c 09:50:49 1.1.1.2 +--- src/venus/kdump.c 10:48:14 1.4 +*************** +*** 211,216 **** +--- 211,218 ---- + #define _LINUX_TIME_H + #define _LINUX_FCNTL_H + #define _I386_STATFS_H ++ #define _SPARC_STATFS_H ++ #define _SPARC64_STATFS_H + struct timezone { + int a,b; + }; +*************** +*** 219,224 **** +--- 221,227 ---- + int tv_usec; + } timeval_t; /* Needed here since KERNEL defined. */ + #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H ++ #define _LINUX_BYTEORDER_BIG_ENDIAN_H + #include + #include + #include +*************** +*** 1892,1898 **** + #endif + } + +! #if defined(sparc) + int readmem(kmem, buf, vad, len) + int kmem, len; + #ifdef AFS_SUN57_ENV +--- 1895,1901 ---- + #endif + } + +! #if defined(sparc) && !defined(__linux__) + int readmem(kmem, buf, vad, len) + int kmem, len; + #ifdef AFS_SUN57_ENV +*************** +*** 1990,1996 **** + } + } + #else +! #if defined(sparc) + #ifndef AFS_SUN5_ENV + if (mem) { + #endif +--- 1993,1999 ---- + } + } + #else +! #if defined(sparc) && !defined(__linux__) + #ifndef AFS_SUN5_ENV + if (mem) { + #endif +*************** +*** 2103,2109 **** + #else /* AFS_KDUMP_LIB */ + int fd; + +! #if defined(sparc) + #ifndef AFS_SUN5_ENV + if (mem) { + #endif +--- 2106,2112 ---- + #else /* AFS_KDUMP_LIB */ + int fd; + +! #if defined(sparc) && !defined(__linux__) + #ifndef AFS_SUN5_ENV + if (mem) { + #endif +*** src/volser/volmain.c 09:50:51 1.1.1.2 +--- src/volser/volmain.c 10:48:14 1.3 +*************** +*** 163,169 **** + #ifndef AFS_LINUX20_ENV + old = signal(SIGSYS, SIG_IGN); + #endif +! rcode = syscall (31 /* AFS_SYSCALL */, 28 /* AFSCALL_CALL */, a3, a4, a5); + #ifndef AFS_LINUX20_ENV + signal(SIGSYS, old); + #endif +--- 163,169 ---- + #ifndef AFS_LINUX20_ENV + old = signal(SIGSYS, SIG_IGN); + #endif +! rcode = syscall (AFS_SYSCALL /* AFS_SYSCALL */, 28 /* AFSCALL_CALL */, a3, a4, a5); + #ifndef AFS_LINUX20_ENV + signal(SIGSYS, old); + #endif diff --git a/src/Makefile b/src/Makefile index 239a4b5bc..c77eccc9c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -68,7 +68,7 @@ comerr: basics util cmd: basics comerr ${COMPILE_PART1} cmd ${COMPILE_PART2} @case ${SYS_NAME} in \ - sgi_6* | sun4x_57 | sun4x_58 | hp_ux11* ) \ + sgi_6* | sun4x_57 | sun4x_58 | hp_ux11* | sparc64_linux* ) \ ${COMPILE_PART1} cmd ${COMPILE_PART2} install64 ;; \ esac diff --git a/src/afs/LINUX/osi_alloc.c b/src/afs/LINUX/osi_alloc.c index 75d7498f1..404639a90 100644 --- a/src/afs/LINUX/osi_alloc.c +++ b/src/afs/LINUX/osi_alloc.c @@ -32,8 +32,8 @@ struct osi_linux_mem { }; /* These assume 32-bit pointers */ -#define MEMTYPE(A) (((unsigned int)A) & 0x3) -#define MEMADDR(A) (void *)((unsigned int)(A) & (~0x3)) +#define MEMTYPE(A) (((unsigned long)A) & 0x3) +#define MEMADDR(A) (void *)((unsigned long)(A) & (~0x3)) /* globals */ afs_atomlist *al_mem_pool; /* pool of osi_linux_mem structures */ @@ -82,9 +82,9 @@ static void *linux_alloc(unsigned int asize) /* if we can use kmalloc use it to allocate the required memory. */ if (asize < MAX_KMALLOC_SIZE) { - new = (void *)kmalloc(asize, GFP_KERNEL); + new = (void *)(long)kmalloc(asize, GFP_KERNEL); if (new) /* piggy back alloc type */ - (unsigned int)new |= KM_TYPE; + (unsigned long)new |= KM_TYPE; } if (!new) { /* otherwise use vmalloc */ int max_wait = 10; @@ -95,7 +95,7 @@ static void *linux_alloc(unsigned int asize) schedule(); } if (new) /* piggy back alloc type */ - (unsigned int)new |= VM_TYPE; + (unsigned long)new |= VM_TYPE; } if (new) memset(MEMADDR(new), 0, asize); @@ -139,7 +139,7 @@ static unsigned hash_chunk(void *p) { unsigned int key; - key = (unsigned int)p >> 2; + key = (unsigned int)(long)p >> 2; key = (key * HASH_CONST)%HASH_PRIME; return key; diff --git a/src/afs/LINUX/osi_cred.c b/src/afs/LINUX/osi_cred.c index f452e030a..14643fd94 100644 --- a/src/afs/LINUX/osi_cred.c +++ b/src/afs/LINUX/osi_cred.c @@ -48,7 +48,7 @@ cred_t *crget(void) osi_Panic("crget: No more memory for creds!\n"); for (i=0; i < CRED_ALLOC_STEP-1; i++) - cred_pool[i].cr_ref = (int)&cred_pool[i+1]; + cred_pool[i].cr_ref = (long)&cred_pool[i+1]; cred_pool[i].cr_ref = 0; } tmp = cred_pool; @@ -69,7 +69,7 @@ void crfree(cred_t *cr) } CRED_LOCK(); - cr->cr_ref = (int)cred_pool; + cr->cr_ref = (long)cred_pool; cred_pool = cr; CRED_UNLOCK(); ncreds_inuse --; diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c index bb57725ac..7f3ed0ffc 100644 --- a/src/afs/LINUX/osi_file.c +++ b/src/afs/LINUX/osi_file.c @@ -181,7 +181,7 @@ afs_osi_Read(afile, offset, aptr, asize) char *aptr; afs_int32 asize; { struct AFS_UCRED *oldCred; - unsigned int resid; + size_t resid; register afs_int32 code; register afs_int32 cnt1=0; AFS_STATCNT(osi_Read); @@ -220,7 +220,7 @@ afs_osi_Write(afile, offset, aptr, asize) afs_int32 offset; afs_int32 asize; { struct AFS_UCRED *oldCred; - unsigned int resid; + size_t resid; register afs_int32 code; AFS_STATCNT(osi_Write); if ( !afile ) diff --git a/src/afs/LINUX/osi_groups.c b/src/afs/LINUX/osi_groups.c index 446eaed96..b20538fe6 100644 --- a/src/afs/LINUX/osi_groups.c +++ b/src/afs/LINUX/osi_groups.c @@ -101,7 +101,7 @@ asmlinkage int afs_xsetgroups(int gidsetsize, gid_t *grouplist) { int code; cred_t *cr = crref(); - int junk; + afs_uint32 junk; int old_pag; lock_kernel(); @@ -126,6 +126,25 @@ asmlinkage int afs_xsetgroups(int gidsetsize, gid_t *grouplist) return code; } +#ifdef AFS_SPARC64_LINUX20_ENV +asmlinkage int afs_xsetgroups32(int gidsetsize, __kernel_gid_t32 *grouplist) +{ + gid_t gl[NGROUPS]; + int ret, i; + mm_segment_t old_fs = get_fs (); + + if ((unsigned) gidsetsize > NGROUPS) + return -EINVAL; + for (i = 0; i < gidsetsize; i++, grouplist++) + if (__get_user (gl[i], grouplist)) + return -EFAULT; + set_fs (KERNEL_DS); + ret = afs_xsetgroups(gidsetsize, gl); + set_fs (old_fs); + return ret; +} +#endif + static int afs_setgroups(cred_t **cr, int ngroups, gid_t *gidset, int change_parent) { int ngrps; diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index c192e961e..6640fbe33 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -30,7 +30,11 @@ #define afs_hz HZ #include "../h/sched.h" #define osi_Time() (xtime.tv_sec) +#if (CPU == sparc64) +#define osi_GetTime(V) do { (*##V##).tv_sec = xtime.tv_sec; (*##V##).tv_usec = xtime.tv_usec; } while (0) +#else #define osi_GetTime(V) (*(V)=xtime) +#endif #undef gop_lookupname #define gop_lookupname osi_lookupname @@ -89,7 +93,11 @@ extern struct vnodeops afs_dir_iops, afs_symlink_iops; /* cred struct */ typedef struct cred { /* maps to task field: */ +#if (CPU == sparc64) + long cr_ref; +#else int cr_ref; +#endif unsigned short cr_uid; /* euid */ unsigned short cr_ruid; /* uid */ unsigned short cr_gid; /* egid */ diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index edda974af..1478be6a9 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -264,6 +264,13 @@ int uiomove(char *dp, int length, uio_flag_t rw, uio_t *uiop) void afs_osi_SetTime(osi_timeval_t *tvp) { extern int (*sys_settimeofdayp)(struct timeval *tv, struct timezone *tz); +#ifdef AFS_LINUX_64BIT_KERNEL + struct timeval tv; + AFS_STATCNT(osi_SetTime); + tv.tv_sec = tvp->tv_sec; + tv.tv_usec = tvp->tv_usec; + (void) (*sys_settimeofdayp)(&tv, NULL); +#else KERNEL_SPACE_DECL; AFS_STATCNT(osi_SetTime); @@ -271,6 +278,7 @@ void afs_osi_SetTime(osi_timeval_t *tvp) TO_USER_SPACE(); (void) (*sys_settimeofdayp)(tvp, NULL); TO_KERNEL_SPACE(); +#endif } /* Free all the pages on any of the vnodes in the vlru. Must be done before diff --git a/src/afs/LINUX/osi_module.c b/src/afs/LINUX/osi_module.c index 5d29b43c5..c3c29b529 100644 --- a/src/afs/LINUX/osi_module.c +++ b/src/afs/LINUX/osi_module.c @@ -26,7 +26,7 @@ asmlinkage int (*sys_socketcallp)(int call, long *args); asmlinkage int (*sys_killp)(int pid, int signal); asmlinkage int (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist); -extern void *sys_call_table[]; +extern unsigned int sys_call_table[]; /* changed to uint because SPARC64 has syscaltable of 32bit items */ extern struct file_system_type afs_file_system; static long get_page_offset(void); @@ -42,12 +42,37 @@ unsigned long afs_linux_page_offset = 0; /* contains the PAGE_OFFSET value */ /* Since sys_ni_syscall is not exported, I need to cache it in order to restore * it. */ -static void *afs_ni_syscall = NULL; +static unsigned int afs_ni_syscall = 0; + +#ifdef AFS_SPARC64_LINUX20_ENV +static unsigned int afs_ni_syscall32 = 0; +asmlinkage int (*sys_setgroupsp32)(int gidsetsize, __kernel_gid_t32 *grouplist); +extern unsigned int sys_call_table32[]; + +asmlinkage int afs_syscall32(long syscall, long parm1, long parm2, long parm3, + long parm4, long parm5) +{ +__asm__ __volatile__ (" + srl %o4, 0, %o4 + mov %o7, %i7 + call afs_syscall + srl %o5, 0, %o5 + ret + nop +"); +} +#endif + +#define POINTER2SYSCALL (unsigned int)(unsigned long) +#define SYSCALL2POINTER (void *)(long) int init_module(void) { extern int afs_syscall(); extern int afs_xsetgroups(); +#ifdef AFS_SPARC64_LINUX20_ENV + extern int afs_xsetgroups32(); +#endif /* obtain PAGE_OFFSET value */ afs_linux_page_offset = get_page_offset(); @@ -59,26 +84,34 @@ int init_module(void) } /* Initialize pointers to kernel syscalls. */ - sys_settimeofdayp = sys_call_table[__NR_settimeofday]; - sys_socketcallp = sys_call_table[__NR_socketcall]; - sys_killp = sys_call_table[__NR_kill]; + sys_settimeofdayp = SYSCALL2POINTER sys_call_table[__NR_settimeofday]; + sys_socketcallp = SYSCALL2POINTER sys_call_table[__NR_socketcall]; + sys_killp = SYSCALL2POINTER sys_call_table[__NR_kill]; /* setup AFS entry point. */ - if (sys_call_table[__NR_afs_syscall] == afs_syscall) { + if (SYSCALL2POINTER sys_call_table[__NR_afs_syscall] == afs_syscall) { printf("AFS syscall entry point already in use!\n"); return -EBUSY; } afs_ni_syscall = sys_call_table[__NR_afs_syscall]; - sys_call_table[__NR_afs_syscall] = afs_syscall; + sys_call_table[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall; +#ifdef AFS_SPARC64_LINUX20_ENV + afs_ni_syscall32 = sys_call_table32[__NR_afs_syscall]; + sys_call_table32[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall32; +#endif osi_Init(); register_filesystem(&afs_file_system); /* Intercept setgroups calls */ - sys_setgroupsp = sys_call_table[__NR_setgroups]; - sys_call_table[__NR_setgroups] = afs_xsetgroups; + sys_setgroupsp = SYSCALL2POINTER sys_call_table[__NR_setgroups]; + sys_call_table[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups; +#ifdef AFS_SPARC64_LINUX20_ENV + sys_setgroupsp32 = SYSCALL2POINTER sys_call_table32[__NR_setgroups]; + sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups32; +#endif return 0; } @@ -87,8 +120,12 @@ void cleanup_module(void) { struct task_struct *t; - sys_call_table[__NR_setgroups] = sys_setgroupsp; + sys_call_table[__NR_setgroups] = POINTER2SYSCALL sys_setgroupsp; sys_call_table[__NR_afs_syscall] = afs_ni_syscall; +#ifdef AFS_SPARC64_LINUX20_ENV + sys_call_table32[__NR_setgroups] = POINTER2SYSCALL sys_setgroupsp32; + sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32; +#endif unregister_filesystem(&afs_file_system); @@ -100,7 +137,7 @@ void cleanup_module(void) static long get_page_offset(void) { -#if defined(AFS_PPC_LINUX22_ENV) +#if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) return PAGE_OFFSET; #else struct task_struct *p; diff --git a/src/afs/LINUX/osi_sleep.c b/src/afs/LINUX/osi_sleep.c index f1b75d89a..17f113996 100644 --- a/src/afs/LINUX/osi_sleep.c +++ b/src/afs/LINUX/osi_sleep.c @@ -16,9 +16,9 @@ #if defined(AFS_GLOBAL_SUNLOCK) static int osi_TimedSleep(char *event, afs_int32 ams, int aintok); +#endif void afs_osi_Wakeup(char *event); void afs_osi_Sleep(char *event); -#endif static char waitV; diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index d1894e790..2bc82879a 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -146,6 +146,7 @@ static ssize_t afs_linux_write(struct file *fp, const char *buf, size_t count, static int afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) { + extern struct DirEntry * afs_dir_GetBlob(); struct vcache *avc = (struct vcache*)FILE_INODE(fp); struct vrequest treq; register struct dcache *tdc; @@ -525,7 +526,7 @@ int afs_linux_flush(struct file *fp) } /* Not allowed to directly read a directory. */ -int afs_linux_dir_read(struct file *fp, char *buf, size_t count, loff_t *ppos) +ssize_t afs_linux_dir_read(struct file *fp, char *buf, size_t count, loff_t *ppos) { return -EISDIR; } diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index c02fcfb03..aaed884d0 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -325,8 +325,12 @@ void afs_HandleAtName(aname, aresult, areq, adp) #if (defined(AFS_SGI62_ENV) || defined(AFS_SUN57_64BIT_ENV)) extern int BlobScan(ino64_t *afile, afs_int32 ablob); #else +#if defined AFS_LINUX_64BIT_KERNEL +extern int BlobScan(long *afile, afs_int32 ablob); +#else extern int BlobScan(afs_int32 *afile, afs_int32 ablob); #endif +#endif /* called with an unlocked directory and directory cookie. Areqp diff --git a/src/afs/VNOPS/afs_vnop_readdir.c b/src/afs/VNOPS/afs_vnop_readdir.c index 1227d7ef5..c6992f18c 100644 --- a/src/afs/VNOPS/afs_vnop_readdir.c +++ b/src/afs/VNOPS/afs_vnop_readdir.c @@ -59,8 +59,12 @@ extern struct DirEntry * afs_dir_GetBlob(); #if defined(AFS_SGI62_ENV) || defined(AFS_SUN57_64BIT_ENV) int BlobScan(ino64_t *afile, afs_int32 ablob) #else +#ifdef AFS_LINUX_64BIT_KERNEL +int BlobScan(long *afile, afs_int32 ablob) +#else int BlobScan(afs_int32 *afile, afs_int32 ablob) #endif +#endif { register afs_int32 relativeBlob; afs_int32 pageBlob; diff --git a/src/afs/afs.h b/src/afs/afs.h index adca1b8a3..12e3a5a36 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -808,8 +808,12 @@ struct fcache { * the size correctly. */ ino64_t inode; /* Unix inode for this chunk */ +#else +#if defined(AFS_LINUX_64BIT_KERNEL) + long inode; /* Unix inode for this chunk */ #else afs_int32 inode; /* Unix inode for this chunk */ +#endif #endif afs_int32 chunkBytes; /* Num bytes in this chunk */ char states; /* Has this chunk been modified? */ diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index 652e407ac..27beb93b8 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -816,6 +816,21 @@ copyin_iparam(caddr_t cmarg, struct iparam *dst) } #endif /* AFS_SUN57_64BIT_ENV */ +#if defined(AFS_LINUX_64BIT_KERNEL) + struct iparam32 dst32; + +#ifdef AFS_SPARC64_LINUX20_ENV + if (current->tss.flags & SPARC_FLAG_32BIT) { +#else +#error Not done for this linux version +#endif + AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code); + if (!code) + iparam32_to_iparam(&dst32, dst); + return code; + } +#endif /* AFS_LINUX_64BIT_KERNEL */ + AFS_COPYIN(cmarg, (caddr_t) dst, sizeof *dst, code); return code; } @@ -888,9 +903,9 @@ asmlinkage int afs_syscall(long syscall, long parm1, long parm2, long parm3, long parm4) { struct afssysargs args, *uap = &args; - int linux_ret=0; - int *retval = &linux_ret; - int eparm[4]; /* matches AFSCALL_ICL in fstrace.c */ + long linux_ret=0; + long *retval = &linux_ret; + long eparm[4]; /* matches AFSCALL_ICL in fstrace.c */ #else #if defined(UKERNEL) Afs_syscall () @@ -1114,7 +1129,7 @@ afs_shutdown() { extern short afs_brsDaemons; extern afs_int32 afs_CheckServerDaemonStarted; - extern struct osi_WaitHandle AFS_WaitHandler, AFS_CSWaitHandler; + extern struct afs_osi_WaitHandle AFS_WaitHandler, AFS_CSWaitHandler; extern struct osi_file *afs_cacheInodep; AFS_STATCNT(afs_shutdown); diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index 766d57cb1..9810b7fe8 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -353,7 +353,7 @@ void BPath(ab) #ifdef AFS_LINUX22_ENV code = gop_lookupname((char *)ab->parm[0], AFS_UIOSYS, 1, (struct vnode **) 0, &dp); if (dp) - tvn = (struct vcache*)dp->d_inode; + tvn = (struct vnode*)dp->d_inode; #else code = gop_lookupname((char *)ab->parm[0], AFS_UIOSYS, 1, (struct vnode **) 0, (struct vnode **)&tvn); #endif diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index 4586e4474..9676fb344 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -154,7 +154,7 @@ extern struct vnodeops *afs_ops; */ -#if defined(AFS_HPUX_ENV) || defined(AFS_SUN57_ENV) || (defined(AFS_SGI61_ENV) && defined(KERNEL) && defined(_K64U64)) +#if defined(AFS_HPUX_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_LINUX_64BIT_KERNEL) || (defined(AFS_SGI61_ENV) && defined(KERNEL) && defined(_K64U64)) typedef struct { afs_int32 tv_sec; afs_int32 tv_usec; diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index fe5c9b5fc..1eeb44910 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -180,6 +180,21 @@ copyin_afs_ioctl(caddr_t cmarg, struct afs_ioctl *dst) } #endif /* defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64) */ +#if defined(AFS_LINUX_64BIT_KERNEL) + struct afs_ioctl32 dst32; + +#ifdef AFS_SPARC64_LINUX20_ENV + if (current->tss.flags & SPARC_FLAG_32BIT) { +#else +#error Not done for this linux type +#endif + AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code); + if (!code) + afs_ioctl32_to_afs_ioctl(&dst32, dst); + return code; + } +#endif /* defined(AFS_LINUX_64BIT_KERNEL) */ + AFS_COPYIN(cmarg, (caddr_t) dst, sizeof *dst, code); return code; } @@ -792,7 +807,7 @@ afs_syscall_pioctl(path, com, cmarg, follow) #ifdef AFS_LINUX22_ENV code = gop_lookupname(path, AFS_UIOUSER, follow, (struct vnode **) 0, &dp); if (!code) - vp = (struct vcache *)dp->d_inode; + vp = (struct vnode *)dp->d_inode; #else code = gop_lookupname(path, AFS_UIOUSER, follow, (struct vnode **) 0, &vp); #endif /* AFS_LINUX22_ENV */ @@ -2753,7 +2768,7 @@ static int afs_setsprefs(sp, num, vlonly) /* Note that it doesn't have a cell yet... */ if (!matches) { afs_uint32 temp = sp->host.s_addr; - srvr = afs_GetServer(&temp, 1, NULL, (vlonly ? AFS_VLPORT : AFS_FSPORT), + srvr = afs_GetServer(&temp, 1, 0, (vlonly ? AFS_VLPORT : AFS_FSPORT), WRITE_LOCK, (afsUUID *)0,0); srvr->addr->sa_iprank = sp->rank + afs_randomMod15(); afs_PutServer(srvr, WRITE_LOCK); @@ -3318,8 +3333,10 @@ afs_int32 *aoutSize; if ( ainSize < sizeof(struct setspref) ) return EINVAL; +#if 0 /* num_servers is unsigned */ if ( sin->num_servers < 0 ) return EINVAL; +#endif if ( sin->num_servers > AFS_MAX_INTERFACE_ADDR) return ENOMEM; diff --git a/src/afs/exporter.h b/src/afs/exporter.h index da17b1efd..974cf8e3f 100644 --- a/src/afs/exporter.h +++ b/src/afs/exporter.h @@ -33,7 +33,7 @@ * up 2 bytes */ -#if defined(AFS_SUN57_64BIT_ENV) || defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZPTR==64)) +#if defined(AFS_SUN57_64BIT_ENV) || defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZPTR==64)) || defined(AFS_LINUX_64BIT_KERNEL) #define AFS_XLATOR_MAGIC 0x8765 /* XXX */ #else #define AFS_XLATOR_MAGIC 0x87654321 diff --git a/src/config/Makefile.ppc_linux24 b/src/config/Makefile.ppc_linux24 index b5cb76836..fa14ecb8f 100644 --- a/src/config/Makefile.ppc_linux24 +++ b/src/config/Makefile.ppc_linux24 @@ -3,10 +3,10 @@ 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- +LINUX_SRCDIR = $(KSRC) # 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 = 2.4.0-test9 +LINUX_VERS = $(KVERS) # # compilation and link editor flags diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index 33d64d40b..32504e411 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -114,6 +114,11 @@ #define SYS_NAME_ID_ppc_linux22 1601 #define SYS_NAME_ID_ppc_linux24 1602 +#define SYS_NAME_ID_sparc_linux2 1700 +#define SYS_NAME_ID_sparc_linux22 1701 + +#define SYS_NAME_ID_sparc64_linux2 1800 +#define SYS_NAME_ID_sparc64_linux22 1801 /* diff --git a/src/config/param.sparc64_linux22.h b/src/config/param.sparc64_linux22.h new file mode 100644 index 000000000..28f097729 --- /dev/null +++ b/src/config/param.sparc64_linux22.h @@ -0,0 +1,79 @@ +/* Copyright (C) 1998 by Transarc Corporation */ + + +#ifndef _PARAM_SPARC64_LINUX22_H_ +#define _PARAM_SPARC64_LINUX22_H_ + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously sparc64 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_SPARC64_LINUX20_ENV 1 +#define AFS_SPARC64_LINUX22_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 227 +#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_32BIT_USR_ENV 1 /* user level processes are 32bit */ +#define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ + +#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 "sparc64_linux22" +#define SYS_NAME_ID SYS_NAME_ID_sparc64_linux22 +#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 */ + +#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 +#define __SMP__ +#define AFS_GLOBAL_SUNLOCK +#endif + +#endif /* __KERNEL__ && !DUMP_KERNEL*/ + +#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 */ + +/* on sparclinux is O_LARGEFILE defined but there is not off64_t, + so small hack to get usd_file.c work */ +#ifndef KERNEL +#define __USE_FILE_OFFSET64 1 +#define __USE_LARGEFILE64 1 +#if !defined off64_t +#define off64_t __off64_t +#endif +#endif + +#endif /* _PARAM_SPARC64_LINUX20_H_ */ diff --git a/src/config/param.sparc64_linux22_usr.h b/src/config/param.sparc64_linux22_usr.h new file mode 100644 index 000000000..a5c5052fa --- /dev/null +++ b/src/config/param.sparc64_linux22_usr.h @@ -0,0 +1,56 @@ +/* Copyright (C) 1998 by Transarc Corporation */ + + +#ifndef _PARAM_USR_SPARC64_LINUX22_H_ +#define _PARAM_USR_SPARC64_LINUX22_H_ + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously sparc64 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_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 227 +#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 "sparc64_linux22" +#define SYS_NAME_ID SYS_NAME_ID_sparc64_linux22 +#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 /* _PARAM_USR_SPARC64_LINUX22_H_ */ diff --git a/src/config/param.sparc_linux22.h b/src/config/param.sparc_linux22.h new file mode 100644 index 000000000..f0b4214d6 --- /dev/null +++ b/src/config/param.sparc_linux22.h @@ -0,0 +1,81 @@ +/* Copyright (C) 1998 by Transarc Corporation */ + + +#ifndef _PARAM_SPARC_LINUX22_H_ +#define _PARAM_SPARC_LINUX22_H_ + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously sparc 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_SPARC_LINUX20_ENV 1 +#define AFS_SPARC_LINUX22_ENV 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 227 +#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 "sparc_linux22" +#define SYS_NAME_ID SYS_NAME_ID_sparc_linux22 +#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 */ + +#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 +#define __SMP__ +#define AFS_GLOBAL_SUNLOCK +#endif + +#endif /* __KERNEL__ && !DUMP_KERNEL*/ + +#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 */ + +#if defined(AFS_SMP) && defined(CONFIG_MODVERSIONS) +/* hack, I don't know what else with theese symbols */ +#define _do_spin_lock _do_spin_lock_R__ver__do_spin_lock +#define _do_spin_unlock _do_spin_unlock_R__ver__do_spin_unlock +#define kernel_flag kernel_flag_R__ver_kernel_flag +#endif + +/* on sparclinux is O_LARGEFILE defined but there is not off64_t, + so small hack to get usd_file.c work */ +#ifndef KERNEL +#define __USE_FILE_OFFSET64 1 +#define __USE_LARGEFILE64 1 +#if !defined off64_t +#define off64_t __off64_t +#endif +#endif + +#endif /* _PARAM_SPARC_LINUX20_H_ */ diff --git a/src/config/param.sparc_linux22_usr.h b/src/config/param.sparc_linux22_usr.h new file mode 100644 index 000000000..4c488a590 --- /dev/null +++ b/src/config/param.sparc_linux22_usr.h @@ -0,0 +1,56 @@ +/* Copyright (C) 1998 by Transarc Corporation */ + + +#ifndef _PARAM_USR_SPARC_LINUX22_H_ +#define _PARAM_USR_SPARC_LINUX22_H_ + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously sparc 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_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 227 +#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 "sparc_linux22" +#define SYS_NAME_ID SYS_NAME_ID_sparc_linux22 +#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 /* _PARAM_USR_SPARC_LINUX22_H_ */ diff --git a/src/des/andrew-conf.h b/src/des/andrew-conf.h index 5613adf65..554b41423 100644 --- a/src/des/andrew-conf.h +++ b/src/des/andrew-conf.h @@ -44,7 +44,15 @@ #ifdef AFS_PPC_LINUX20_ENV #include "conf-ppc-linux.h" #else +#ifdef AFS_SPARC_LINUX20_ENV +#include "conf-sparc-linux.h" +#else +#ifdef AFS_SPARC64_LINUX20_ENV +#include "conf-sparc64-linux.h" +#else #include "conf-i386-linux.h" +#endif /* AFS_SPARC64_LINUX20_ENV */ +#endif /* AFS_SPARC_LINUX20_ENV */ #endif #else Sorry, you lose. diff --git a/src/des/conf-ppc-linux.h b/src/des/conf-ppc-linux.h new file mode 100644 index 000000000..e2f3b23d5 --- /dev/null +++ b/src/des/conf-ppc-linux.h @@ -0,0 +1,15 @@ +/* + * Copyright 1988 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Machine-type definitions: Linux on PPC + */ + +#include + +#define BITS32 +#define BIG +#define MSBFIRST +#define MUSTALLIGN diff --git a/src/des/conf-sparc-linux.h b/src/des/conf-sparc-linux.h new file mode 100644 index 000000000..90a74d7b5 --- /dev/null +++ b/src/des/conf-sparc-linux.h @@ -0,0 +1,15 @@ +/* + * Copyright 1988 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Machine-type definitions: Linux on Intel + */ + +#include + +#define BITS32 +#define BIG +#define MSBFIRST +#define MUSTALIGN diff --git a/src/des/conf-sparc64-linux.h b/src/des/conf-sparc64-linux.h new file mode 100644 index 000000000..90a74d7b5 --- /dev/null +++ b/src/des/conf-sparc64-linux.h @@ -0,0 +1,15 @@ +/* + * Copyright 1988 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Machine-type definitions: Linux on Intel + */ + +#include + +#define BITS32 +#define BIG +#define MSBFIRST +#define MUSTALIGN diff --git a/src/libafs/MakefileProto.LINUX b/src/libafs/MakefileProto.LINUX index a9f01dcc0..42558cc88 100644 --- a/src/libafs/MakefileProto.LINUX +++ b/src/libafs/MakefileProto.LINUX @@ -41,6 +41,17 @@ CCFLAGS = -O2 -fomit-frame-pointer \ -fno-strength-reduce -pipe -m486 -malign-loops=2 -malign-jumps=2 \ -malign-functions=2 DEFINES = -D__KERNEL__ -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} + +LD = ld -m elf32_sparc +CCFLAGS = -O2 -fomit-frame-pointer \ + -fno-strength-reduce -pipe -mcpu=v8 -mno-fpu -fcall-used-g5 -fcall-used-g7 +DEFINES = -D__KERNEL__ -DCPU=sparc -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} + +CC = sparc64-linux-gcc +LD = ld -m elf64_sparc +CCFLAGS = -O2 -fomit-frame-pointer \ + -fno-strength-reduce -pipe -mcpu=ultrasparc -m64 -mno-fpu -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare +DEFINES = -D__KERNEL__ -DCPU=sparc64 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} CCFLAGS = -O2 -fomit-frame-pointer -fno-strength-reduce \ -fno-strict-aliasing -fsigned-char -msoft-float -pipe \ @@ -84,6 +95,8 @@ ${COMPDIRS}: ln -s $${IDIR} h; \ rm -f linux; \ ln -s $${IDIR} linux; \ + rm -f asm-generic; \ + ln -s ${LINUX_SRCDIR}/include/asm-generic asm-generic; \ rm -f net; \ ln -s $${IDIR} net; \ rm -f netinet; \ @@ -95,6 +108,10 @@ ${COMPDIRS}: ln -s ${LINUX_SRCDIR}/include/asm-i386 asm ; \ ln -s ${LINUX_SRCDIR}/include/asm-ppc asm ; \ + + ln -s ${LINUX_SRCDIR}$$v/include/asm-sparc asm ; \ + + ln -s ${LINUX_SRCDIR}$$v/include/asm-sparc64 asm ; \ for m in ${MPS} ; do \ KDIR=${KOBJ}-$$m ; \ diff --git a/src/lwp/lwp.c b/src/lwp/lwp.c index aa1de78dd..1ff6c2d7b 100644 --- a/src/lwp/lwp.c +++ b/src/lwp/lwp.c @@ -341,10 +341,16 @@ int LWP_CreateProcess(ep, stacksize, priority, parm, name, pid) /* Need to have the sp on an 8-byte boundary for storing doubles. */ savecontext(Create_Process_Part2, &temp2->context, stackptr+stacksize-16); /* 16 = 2 * jmp_buf_type*/ +#else +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) + savecontext(Create_Process_Part2, &temp2->context, + stackptr+stacksize-0x40); /* lomgjmp does something + with %fp + 0x38 */ #else savecontext(Create_Process_Part2, &temp2->context, stackptr+stacksize-sizeof(void *)); #endif +#endif #endif /* End of gross hack */ @@ -462,10 +468,15 @@ int LWP_DestroyProcess(pid) /* destroy a lightweight process */ #ifdef AFS_SGI62_ENV savecontext(Dispatcher, &(temp -> context), &(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-8])); +#else +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) + savecontext(Dispatcher, &(temp -> context), + &(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-0x40])); #else savecontext(Dispatcher, &(temp -> context), &(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-sizeof(void *)])); #endif +#endif #endif } return LWP_SUCCESS; diff --git a/src/lwp/lwp.h b/src/lwp/lwp.h index d8cb02d2e..e9c13eb48 100644 --- a/src/lwp/lwp.h +++ b/src/lwp/lwp.h @@ -193,7 +193,7 @@ typedef struct lwp_pcb { #else struct lwp_context { /* saved context for dispatcher */ char *topstack; /* ptr to top of process stack */ -#ifdef sparc +#if defined(sparc) && !defined(__linux__) #ifdef save_allregs int globals[7+1+32+2+32+2]; /* g1-g7, y reg, f0-f31, fsr, fq, c0-c31, csr, cq. */ #else diff --git a/src/lwp/preempt.c b/src/lwp/preempt.c index 6eaba2e1d..3b8971c1a 100644 --- a/src/lwp/preempt.c +++ b/src/lwp/preempt.c @@ -95,4 +95,4 @@ int PRE_EndPreempt() return(LWP_SUCCESS); } -#endif /* AFS_I386_LINUX20_ENV */ +#endif /* AFS_LINUX20_ENV */ diff --git a/src/lwp/process.c b/src/lwp/process.c index 706752bdf..2618ad2dc 100644 --- a/src/lwp/process.c +++ b/src/lwp/process.c @@ -33,8 +33,16 @@ extern char PRE_Block; /* used in lwp.c and process.s */ #elif defined(AFS_LINUX20_ENV) #if defined(AFS_PPC_LINUX20_ENV) #define LWP_SP 0 -#else +#elif defined(AFS_I386_LINUX20_ENV) #define LWP_SP 4 +#elif defined(AFS_SPARC_LINUX20_ENV) +#define LWP_SP 0 +#define LWP_FP 1 +#elif defined(AFS_SPARC64_LINUX20_ENV) && defined(AFS_32BIT_USR_ENV) +#define LWP_SP 0 +#define LWP_FP 1 +#else +#error Unsupported linux LWP system type. #endif #else Need offset to SP in jmp_buf for this platform. @@ -97,6 +105,9 @@ char* sp; { case 0: jmpBuffer = (jmp_buf_type *)jmp_tmp; jmpBuffer[LWP_SP] = (jmp_buf_type)sp; +#if defined(AFS_SPARC_LINUX20_ENV) || (defined(AFS_SPARC64_LINUX20_ENV) && defined(AFS_32BIT_USR_ENV)) + jmpBuffer[LWP_FP] = (jmp_buf_type)sp; +#endif longjmp(jmp_tmp,1); break; case 1: (*EP)(); diff --git a/src/rx/rx.c b/src/rx/rx.c index 47689089b..ace254d08 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -4927,7 +4927,7 @@ void rxi_Start(event, call, istack) (char *)call, istack); #else /* RX_ENABLE_LOCKS */ call->resendEvent = rxevent_Post(&retryTime, rxi_Start, - (char *)call, (void*)istack); + (char *)call, (void*)(long)istack); #endif /* RX_ENABLE_LOCKS */ } } diff --git a/src/rx/rx_clock.h b/src/rx/rx_clock.h index 766765703..65a6663f2 100644 --- a/src/rx/rx_clock.h +++ b/src/rx/rx_clock.h @@ -83,7 +83,7 @@ extern void clock_UpdateTime(); #else /* KERNEL */ #include "../afs/afs_osi.h" #define clock_Init() -#if defined(AFS_SGI61_ENV) || defined(AFS_HPUX_ENV) +#if defined(AFS_SGI61_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX_64BIT_KERNEL) #define clock_GetTime(cv) osi_GetTime((osi_timeval_t *)cv) #else #define clock_GetTime(cv) osi_GetTime((struct timeval *)cv) diff --git a/src/venus/Makefile b/src/venus/Makefile index c10e302b5..cbaedbf5d 100644 --- a/src/venus/Makefile +++ b/src/venus/Makefile @@ -59,7 +59,7 @@ cacheout: cacheout.o cacheout.o: cacheout.c -all: fs up cmdebug fstrace kdump gcpags kdump64 +all: fs up cmdebug fstrace gcpags ${DESTDIR}bin/fs ${DESTDIR}root.server/usr/afs/bin/fs: fs ${INSTALL} -s $? $@ @@ -73,40 +73,40 @@ ${DESTDIR}etc/fstrace: fstrace ${DESTDIR}bin/cmdebug: cmdebug ${INSTALL} -s $? $@ -${DESTDIR}etc/kdump: kdump - set -x; \ - case ${SYS_NAME} in \ - sgi_6? ) \ - ${INSTALLex} -f kdump.sh.sgi_ipnos $@; \ - ln -fs kdump ${DESTDIR}etc/kdump32; \ - ln -fs kdump.IP20 ${DESTDIR}etc/kdump.IP22; \ - ln -fs kdump.IP20 ${DESTDIR}etc/kdump.IP32; \ - for f in kdump.IP??; \ - do ${INSTALL} -s $$f ${DESTDIR}etc/$$f || exit $$? ; \ - done ;; \ - sun4x_57 ) \ - ${INSTALLex} -f kdump.sh.solaris7 $@; \ - ${INSTALL} -s -f $? ${DESTDIR}etc/kdump32;; \ - hp_ux11* ) \ - ${INSTALLex} -f kdump.sh.hp_ux11 $@; \ - ${INSTALL} -s -f $? ${DESTDIR}etc/kdump32;; \ - *) \ - ${INSTALL} -s $? $@ ;; \ - esac - -${DESTDIR}etc/kdump64: kdump64 - set -x; \ - case ${SYS_NAME} in \ - sun4x_57 | hp_ux11* ) \ - ${INSTALL} -s $? $@ ;;\ - * ) \ - echo skipping kdump64 for ${SYS_NAME} ;; \ - esac +#${DESTDIR}etc/kdump: kdump +# set -x; \ +# case ${SYS_NAME} in \ +# sgi_6? ) \ +# ${INSTALLex} -f kdump.sh.sgi_ipnos $@; \ +# ln -fs kdump ${DESTDIR}etc/kdump32; \ +# ln -fs kdump.IP20 ${DESTDIR}etc/kdump.IP22; \ +# ln -fs kdump.IP20 ${DESTDIR}etc/kdump.IP32; \ +# for f in kdump.IP??; \ +# do ${INSTALL} -s $$f ${DESTDIR}etc/$$f || exit $$? ; \ +# done ;; \ +# sun4x_57 ) \ +# ${INSTALLex} -f kdump.sh.solaris7 $@; \ +# ${INSTALL} -s -f $? ${DESTDIR}etc/kdump32;; \ +# hp_ux11* ) \ +# ${INSTALLex} -f kdump.sh.hp_ux11 $@; \ +# ${INSTALL} -s -f $? ${DESTDIR}etc/kdump32;; \ +# *) \ +# ${INSTALL} -s $? $@ ;; \ +# esac + +# ${DESTDIR}etc/kdump64: kdump64 +# set -x; \ +# case ${SYS_NAME} in \ +# sun4x_57 | hp_ux11* ) \ +# ${INSTALL} -s $? $@ ;;\ +# * ) \ +# echo skipping kdump64 for ${SYS_NAME} ;; \ +# esac install: all ${DESTDIR}bin/fs ${DESTDIR}root.server/usr/afs/bin/fs \ ${DESTDIR}bin/up ${DESTDIR}etc/fstrace ${DESTDIR}bin/cmdebug \ - ${DESTDIR}etc/kdump ${DESTDIR}etc/kdump64 + system: install diff --git a/src/venus/fstrace.c b/src/venus/fstrace.c index 34c815709..08c983559 100644 --- a/src/venus/fstrace.c +++ b/src/venus/fstrace.c @@ -2072,11 +2072,20 @@ long call, parm0, parm1, parm2, parm3, parm4, parm5, parm6; { int code; #ifdef AFS_LINUX20_ENV +#if defined AFS_LINUX_64BIT_KERNEL + long long eparm[4]; + /* don't want to sign extend it to 64bit, so using ulong */ + eparm[0] = (unsigned long)parm3; + eparm[1] = (unsigned long)parm4; + eparm[2] = (unsigned long)parm5; + eparm[3] = (unsigned long)parm6; +#else int eparm[4]; eparm[0] = parm3; eparm[1] = parm4; eparm[2] = parm5; eparm[3] = parm6; +#endif /* Linux can only handle 5 arguments in the actual syscall. */ if (call == AFSCALL_ICL) { code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, eparm); @@ -2084,6 +2093,14 @@ long call, parm0, parm1, parm2, parm3, parm4, parm5, parm6; else { code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, parm3); } +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) + /* on sparc this function returns none value, so do it myself */ + __asm__ __volatile__ (" + mov %o0, %i0 + ret + restore +"); +#endif #else #if !defined(AFS_SGI_ENV) && !defined(AFS_AIX32_ENV) code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, parm3, parm4); diff --git a/src/venus/kdump.c b/src/venus/kdump.c index 54d4e9836..880ab7e94 100644 --- a/src/venus/kdump.c +++ b/src/venus/kdump.c @@ -211,6 +211,8 @@ typedef struct adaptive_mutex2 adaptive_mutex2_t; #define _LINUX_TIME_H #define _LINUX_FCNTL_H #define _I386_STATFS_H +#define _SPARC_STATFS_H +#define _SPARC64_STATFS_H struct timezone { int a,b; }; @@ -219,6 +221,7 @@ typedef struct timeval { int tv_usec; } timeval_t; /* Needed here since KERNEL defined. */ #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H +#define _LINUX_BYTEORDER_BIG_ENDIAN_H #include #include #include @@ -1892,7 +1895,7 @@ int pnt; #endif } -#if defined(sparc) +#if defined(sparc) && !defined(__linux__) int readmem(kmem, buf, vad, len) int kmem, len; #ifdef AFS_SUN57_ENV @@ -1990,7 +1993,7 @@ void kread(int kmem,off_t loc,void *buf,KDUMP_SIZE_T len) } } #else -#if defined(sparc) +#if defined(sparc) && !defined(__linux__) #ifndef AFS_SUN5_ENV if (mem) { #endif @@ -2103,7 +2106,7 @@ int opencore(core) #else /* AFS_KDUMP_LIB */ int fd; -#if defined(sparc) +#if defined(sparc) && !defined(__linux__) #ifndef AFS_SUN5_ENV if (mem) { #endif diff --git a/src/vol/partition.c b/src/vol/partition.c index c3409de5f..9e3ad50dc 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -71,8 +71,7 @@ #else #ifdef AFS_LINUX22_ENV #include -#include -#include +#include #else #include #endif diff --git a/src/volser/volmain.c b/src/volser/volmain.c index 7a5ef93a3..0ae13bb5c 100644 --- a/src/volser/volmain.c +++ b/src/volser/volmain.c @@ -163,7 +163,7 @@ void * a5; #ifndef AFS_LINUX20_ENV old = signal(SIGSYS, SIG_IGN); #endif - rcode = syscall (31 /* AFS_SYSCALL */, 28 /* AFSCALL_CALL */, a3, a4, a5); + rcode = syscall (AFS_SYSCALL /* AFS_SYSCALL */, 28 /* AFSCALL_CALL */, a3, a4, a5); #ifndef AFS_LINUX20_ENV signal(SIGSYS, old); #endif