[OpenAFS-devel] Mutexes in afs/LINUX/osi*

Jason McCormick jasonmc@cert.org
Fri, 11 Aug 2006 23:10:10 -0400


This is a multi-part message in MIME format.
--------------010408090608010803080604
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

I've been trying to compile 1.5.6 to test out the new keyring PAG
support and I've been running into some compile problems (Fedora 4,
2.6.17 kernel, x86_64).  One was solved (MODULE_PARM) after getting the
latest files from HEAD that Derrick committed to to MODULE_PARM ->
module_parm.  The second is DECLARE_MUTEX vs. DEFINE_MUTEX.  I've
attached a patch that provides conditionals for this.

However there's still a bug in the use of module_param_array on line 51
of osi_pag_module.c.  There needs to be a 4th element to the function
that I think should be NULL in the 3rd position, but I can't make it
work and my Google skills are failing me.

- Jason

--------------010408090608010803080604
Content-Type: text/x-patch;
 name="afs_osi_mutex.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="afs_osi_mutex.patch"

--- src/afs/LINUX/osi_alloc.c.orig	2006-08-11 22:23:13.000000000 -0400
+++ src/afs/LINUX/osi_alloc.c	2006-08-11 22:33:06.000000000 -0400
@@ -282,7 +282,11 @@
 /************** Linux memory allocator interface functions **********/
 
 #if defined(AFS_LINUX24_ENV)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+DEFINE_MUTEX(afs_linux_alloc_sem);
+#else
 DECLARE_MUTEX(afs_linux_alloc_sem);
+#endif
 #else
 struct semaphore afs_linux_alloc_sem = MUTEX;
 #endif
--- src/afs/LINUX/osi_cred.c.orig	2006-08-11 22:30:19.000000000 -0400
+++ src/afs/LINUX/osi_cred.c	2006-08-11 22:33:35.000000000 -0400
@@ -33,7 +33,11 @@
  * test if no creds in pool before grabbing lock in crfree().
  */
 #if defined(AFS_LINUX24_ENV)
-static DECLARE_MUTEX(linux_cred_pool_lock);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+DEFINE_MUTEX(linux_cred_pool_lock);
+#else
+DECLARE_MUTEX(linux_cred_pool_lock);
+#endif
 #else
 static struct semaphore linux_cred_pool_lock = MUTEX;
 #endif
--- src/afs/LINUX/osi_pag_module.c.orig	2006-08-11 22:11:27.000000000 -0400
+++ src/afs/LINUX/osi_pag_module.c	2006-08-11 22:15:41.000000000 -0400
@@ -47,7 +47,11 @@
 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;

--------------010408090608010803080604--