DEVEL15-linux-2626-updates-20080612
[openafs.git] / src / afs / LINUX / osi_pag_module.c
index 7b5d015..0395a2f 100644 (file)
@@ -17,6 +17,7 @@
 RCSID
     ("$Header$");
 
+#if !defined(AFS_NONFSTRANS) || defined(AFS_AIX_IAUTH_ENV)
 #include <linux/module.h> /* early to avoid printf->printk mapping */
 #include "afs/sysincludes.h"
 #include "afsincludes.h"
@@ -39,7 +40,7 @@ RCSID
 #endif
 
 static unsigned long nfs_server_addr = 0;
-#if defined(module_param)
+#if defined(module_param) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
 module_param(nfs_server_addr, long, 0);
 #else
 MODULE_PARM(nfs_server_addr,  "l");
@@ -55,7 +56,11 @@ MODULE_PARM(this_cell, "s");
 MODULE_PARM_DESC(this_cell, "Local cell name");
 
 #if defined(AFS_LINUX24_ENV)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+DEFINE_MUTEX(afs_global_lock);
+#else
 DECLARE_MUTEX(afs_global_lock);
+#endif
 struct proc_dir_entry *openafs_procfs;
 #else
 struct semaphore afs_global_lock = MUTEX;
@@ -70,6 +75,9 @@ int
 init_module(void)
 #endif
 {
+#if !defined(EXPORTED_PROC_ROOT_FS) && defined(AFS_LINUX24_ENV)
+    char path[64];
+#endif
     int err;
 
     osi_Init();
@@ -78,7 +86,12 @@ init_module(void)
     if (err)
        return err;
 #ifdef AFS_LINUX24_ENV
+#if defined(EXPORTED_PROC_ROOT_FS)
     openafs_procfs = proc_mkdir(PROC_FSDIRNAME, proc_root_fs);
+#else
+    sprintf(path, "fs/%s", PROC_FSDIRNAME);
+    openafs_procfs = proc_mkdir(path, NULL);
+#endif
     osi_ioctl_init();
 #endif
 
@@ -97,13 +110,21 @@ void
 cleanup_module(void)
 #endif
 {
+#if !defined(EXPORTED_PROC_ROOT_FS) && defined(AFS_LINUX24_ENV)
+    char path[64];
+#endif
     osi_syscall_clean();
 
     osi_linux_free_afs_memory();
 
 #ifdef AFS_LINUX24_ENV
     osi_ioctl_clean();
+#if defined(EXPORTED_PROC_ROOT_FS)
     remove_proc_entry(PROC_FSDIRNAME, proc_root_fs);
+#else
+    sprintf(path, "fs/%s", PROC_FSDIRNAME);
+    remove_proc_entry(path, NULL);
+#endif
 #endif
     return;
 }
@@ -136,3 +157,5 @@ afs_nfsclient_reqhandler(struct afs_exporter *exporter,
     return EINVAL;
 }
 #endif
+#endif /* AFS_NONFSTRANS */
+