[OpenAFS-devel] Re: sparc64 support fixed..

Russ Allbery rra@stanford.edu
Tue, 20 Dec 2005 20:34:23 -0800


Troy Benjegerdes <hozer@hozed.org> writes:

> I have a working sparc64 afs, with debian's 2.6.8 sparc64 kernel.

> http://source.scl.ameslab.gov/hg/openafs-misc-fixes?cmd=changeset;node=9df9f66943723a4930006c24f097ac581b9064e3

There are a few changes here that affect generic code, and I'm not
completely familiar with the kernel source, so here are a few questions:

| --- a/src/afs/LINUX/osi_module.c	Wed Dec 14 20:47:35 2005
| +++ b/src/afs/LINUX/osi_module.c	Tue Dec 20 00:27:38 2005
| @@ -26,12 +26,16 @@
|  #ifdef AFS_AMD64_LINUX20_ENV
|  #include <asm/ia32_unistd.h>
|  #endif
| +#ifdef AFS_SPARC64_LINUX20_ENV
| +#include <linux/ioctl32.h>
| +#endif
|  
|  #include <linux/proc_fs.h>
|  #include <linux/slab.h>
|  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
|  #include <linux/init.h>
|  #include <linux/sched.h>
| +#include <linux/kernel.h>
|  #endif

Why also include linux/kernel.h unconditionally?  Is that safe on all
Linux varients?

| @@ -283,29 +287,27 @@
|      if (cmd != VIOC_SYSCALL && cmd != VIOC_SYSCALL32) return -EINVAL;
|  
|  #ifdef NEED_IOCTL32
| +#ifdef AFS_LINUX26_ENV 
| +#ifdef AFS_S390X_LINUX26_ENV
| +    if (test_thread_flag(TIF_31BIT))
| +#else
| +    if (test_thread_flag(TIF_32BIT))
| +#endif /* AFS_S390X_LINUX26_ENV */
| +#else
|  #ifdef AFS_SPARC64_LINUX24_ENV
|      if (current->thread.flags & SPARC_FLAG_32BIT)
|  #elif defined(AFS_SPARC64_LINUX20_ENV)
|      if (current->tss.flags & SPARC_FLAG_32BIT)
|  #elif defined(AFS_AMD64_LINUX20_ENV)
| -#ifdef AFS_LINUX26_ENV
| -    if (test_thread_flag(TIF_IA32))
| -#else
|      if (current->thread.flags & THREAD_IA32)
| -#endif
|  #elif defined(AFS_PPC64_LINUX20_ENV)
| -#ifdef AFS_PPC64_LINUX26_ENV
| -    if (current->thread_info->flags & _TIF_32BIT)
| -#else /*Linux 2.6 */
|      if (current->thread.flags & PPC_FLAG_32BIT)
| -#endif
| -#elif defined(AFS_S390X_LINUX26_ENV)
| -    if (test_thread_flag(TIF_31BIT))
|  #elif defined(AFS_S390X_LINUX20_ENV)
|      if (current->thread.flags & S390_FLAG_31BIT)
|  #else
|  #error Not done for this linux type
| -#endif
| +#endif /* AFS_LINUX26_ENV */
| +#endif /* NEED_IOCTL32 */
|      {
|  	if (copy_from_user(&sysargs32, (void *)arg,
|  			   sizeof(struct afsprocdata32)))

The change of existing code for AFS_PPC64_LINUX36_ENV makes me a touch
nervous.  Is test_thread_flag(TIF_32BIT) a safe replacement for
current->thread_info->flags & _TIF_32BIT on that platform?

The rest of this patch seems fine to me.  If the other OpenAFS developers
who know the Linux kernel internals better than I think this is okay, I'm
happy to commit it to both OpenAFS CVS and the Debian package.

Thank you for your work on this!

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>