linux24-ppc-has-no-setgroups32-20010420
[openafs.git] / src / afs / LINUX / osi_module.c
index fcd5754..6080127 100644 (file)
@@ -48,8 +48,12 @@ 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.
  */
+#ifdef AFS_SPARC64_LINUX20_ENV
 static unsigned int afs_ni_syscall = 0;
-
+#else
+static void* afs_ni_syscall = 0;
+#endif
 #ifdef AFS_SPARC64_LINUX20_ENV
 static unsigned int afs_ni_syscall32 = 0;
 asmlinkage int (*sys_setgroupsp32)(int gidsetsize, __kernel_gid_t32 *grouplist);
@@ -69,6 +73,10 @@ __asm__ __volatile__ ("
 }
 #endif
 
+#if defined(AFS_LINUX24_ENV)
+asmlinkage int (*sys_setgroups32p)(int gidsetsize, __kernel_gid32_t *grouplist);
+#endif 
+
 #ifdef AFS_SPARC64_LINUX20_ENV
 #define POINTER2SYSCALL (unsigned int)(unsigned long)
 #define SYSCALL2POINTER (void *)(long)
@@ -81,18 +89,20 @@ int init_module(void)
 {
     extern int afs_syscall();
     extern int afs_xsetgroups();
-#ifdef AFS_SPARC64_LINUX20_ENV
+#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_LINUX24_ENV)
     extern int afs_xsetgroups32();
 #endif
 
     /* obtain PAGE_OFFSET value */
     afs_linux_page_offset = get_page_offset();
 
+#ifndef AFS_S390_LINUX22_ENV
     if (afs_linux_page_offset == 0) {
         /* couldn't obtain page offset so can't continue */
         printf("afs: Unable to obtain PAGE_OFFSET. Exiting..");
         return -EIO;
     }
+#endif
 
     /* Initialize pointers to kernel syscalls. */
     sys_settimeofdayp = SYSCALL2POINTER sys_call_table[__NR_settimeofday];
@@ -125,6 +135,10 @@ int init_module(void)
     sys_setgroupsp32 = SYSCALL2POINTER sys_call_table32[__NR_setgroups];
     sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups32;
 #endif
+#if defined(__NR_setgroups32)
+    sys_setgroups32p = SYSCALL2POINTER sys_call_table[__NR_setgroups32];
+    sys_call_table[__NR_setgroups32] = POINTER2SYSCALL afs_xsetgroups32;
+#endif
 
     return 0;
 }
@@ -139,7 +153,9 @@ void cleanup_module(void)
     sys_call_table32[__NR_setgroups] = POINTER2SYSCALL sys_setgroupsp32;
     sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32;
 #endif
-
+#if defined(__NR_setgroups32)
+    sys_call_table[__NR_setgroups32] = POINTER2SYSCALL sys_setgroups32p;
+#endif
     unregister_filesystem(&afs_file_system);
 
     osi_linux_free_inode_pages(); /* Invalidate all pages using AFS inodes. */
@@ -150,7 +166,7 @@ void cleanup_module(void)
 
 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)
+#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)
     return PAGE_OFFSET;
 #else
     struct task_struct *p;