[OpenAFS-devel] Builds against older 2.6.x kernels

Russ Allbery rra@stanford.edu
Wed, 05 Jul 2006 13:09:55 -0700


[ Bcc to openafs-bugs. ]

This problem was reported by Wes Chow and is rather annoying; I'm not sure
if it's worth writing an Autoconf test for it.

The current OpenAFS source fails to build against 2.6.8 with the error:

>   CC [M] /usr/src/modules/openafs/src/libafs/MODLOAD-2.6.8-3-386-SP/osi_probe.o
> /usr/src/modules/openafs/src/libafs/MODLOAD-2.6.8-3-386-SP/osi_probe.c:121:
> error: invalid lvalue in unary `&'

The problem is that the third argument of module_param_array() in the
current 2.6 kernels is a pointer to an int, but in 2.6.8 (and presumably
earlier) is an int whose address is then taken.  The following patch,
which forces the module to use the deprecated interface for 2.6.8, makes
the problem go away, but is clearly the wrong approach.

I suppose we could add an Autoconf probe that tries to call
module_param_array with NULL as the third argument and sets something if
it works, and then make our use of module_param_array conditional on
that.  (I'm not sure what the right thing to pass into the 2.6.8-era
module_param_array for that argument would be.)

--- openafs/src/afs/LINUX/osi_probe.c.orig	2006-04-06 22:23:11.000000000 -0700
+++ openafs/src/afs/LINUX/osi_probe.c	2006-07-05 10:53:09.000000000 -0700
@@ -117,11 +117,7 @@
 
 /* Allow the user to specify sys_call_table addresses */
 static unsigned long sys_call_table_addr[4] = { 0,0,0,0 };
-#ifdef module_param_array
-module_param_array(sys_call_table_addr, long, NULL, 0);
-#else
 MODULE_PARM(sys_call_table_addr, "1-4l");
-#endif
 MODULE_PARM_DESC(sys_call_table_addr, "Location of system call tables");
 
 /* If this is set, we are more careful about avoiding duplicate matches */
@@ -134,11 +130,7 @@
 MODULE_PARM_DESC(probe_carefully, "Probe for system call tables carefully");
 
 static int probe_ignore_syscalls[8] = { -1, -1, -1, -1, -1, -1, -1, -1 };
-#ifdef module_param_array
-module_param_array(probe_ignore_syscalls, int, NULL, 0);
-#else
 MODULE_PARM(probe_ignore_syscalls, "1-8i");
-#endif
 MODULE_PARM_DESC(probe_ignore_syscalls, "Syscalls to ignore in table checks");
 
 #ifdef OSI_PROBE_DEBUG

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