[OpenAFS-devel] problems with #define CONFIG_SMP in param*linux*.h (+ patch)

Matthew Miller mattdm@mattdm.org
Sat, 20 Jul 2002 10:33:03 -0400


I was trying to rebuild the OpenAFS 1.2.5 RPM on a Red Hat Linux 7.x system
updated to their 2.4.18-5 kernel package. The build process broke when
trying to make the MP kernel modules -- dying in include/linux/sched.h line
454, where there's this bit:

#if CONFIG_SMP
extern void set_cpus_allowed(task_t *p, unsigned long new_mask);
#else
#define set_cpus_allowed(p, new_mask)   do { } while (0)
#endif

At first I thought that this should be changed to #ifdef (which does indeed
work around the problem), but I talked with a kernel developer at RH, and he
tells me that the kernel is right and OpenAFS is wrong -- either #ifdef or
#if should work. So, I think the following patch (which also causes the
problem to go away) is the correct solution.

If I'm wrong, please let me know. If I'm right, please apply.

Thanks.


--- cut here ---

diff -ur openafs-1.2.5.orig/src/config/param.alpha_linux_22.h openafs-1.2.5/src/config/param.alpha_linux_22.h
--- openafs-1.2.5.orig/src/config/param.alpha_linux_22.h	Thu Jun 28 00:07:16 2001
+++ openafs-1.2.5/src/config/param.alpha_linux_22.h	Sat Jul 20 08:53:50 2002
@@ -31,16 +31,16 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#ifndef __SMP__
-#define __SMP__
-#endif
-#define AFS_GLOBAL_SUNLOCK
+#define CONFIG_SMP 1
+#undef __SMP__
+#define __SMP__ 1
+#define AFS_GLOBAL_SUNLOCK 1
 #endif
+
 #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
 #define MODVERSIONS
 #include <linux/modversions.h>
diff -ur openafs-1.2.5.orig/src/config/param.alpha_linux_24.h openafs-1.2.5/src/config/param.alpha_linux_24.h
--- openafs-1.2.5.orig/src/config/param.alpha_linux_24.h	Sat Oct 13 00:36:14 2001
+++ openafs-1.2.5/src/config/param.alpha_linux_24.h	Sat Jul 20 08:58:01 2002
@@ -33,16 +33,17 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#ifndef __SMP__
-#define __SMP__
+#define CONFIG_SMP 1
+#undef __SMP__
+#define __SMP__ 1
 #endif
 #define AFS_GLOBAL_SUNLOCK
 #endif
+
 #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
 #define MODVERSIONS
 #include <linux/modversions.h>
diff -ur openafs-1.2.5.orig/src/config/param.i386_linux22.h openafs-1.2.5/src/config/param.i386_linux22.h
--- openafs-1.2.5.orig/src/config/param.i386_linux22.h	Mon Jul 16 18:06:26 2001
+++ openafs-1.2.5/src/config/param.i386_linux22.h	Sat Jul 20 08:53:28 2002
@@ -33,18 +33,16 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#ifndef CONFIG_X86_LOCAL_APIC
-#define CONFIG_X86_LOCAL_APIC
-#endif
-#ifndef __SMP__
-#define __SMP__
-#endif
-#define AFS_GLOBAL_SUNLOCK
+#define CONFIG_SMP 1
+#undef CONFIG_X86_LOCAL_APIC
+#define CONFIG_X86_LOCAL_APIC 1
+#undef __SMP__
+#define __SMP__ 1
+#define AFS_GLOBAL_SUNLOCK 1
 #endif
 
 #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
diff -ur openafs-1.2.5.orig/src/config/param.i386_linux24.h openafs-1.2.5/src/config/param.i386_linux24.h
--- openafs-1.2.5.orig/src/config/param.i386_linux24.h	Thu Jul  5 11:20:18 2001
+++ openafs-1.2.5/src/config/param.i386_linux24.h	Sat Jul 20 08:56:51 2002
@@ -26,18 +26,16 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#ifndef CONFIG_X86_LOCAL_APIC
-#define CONFIG_X86_LOCAL_APIC
-#endif
-#ifndef __SMP__
-#define __SMP__
-#endif
-#define AFS_GLOBAL_SUNLOCK
+#define CONFIG_SMP 1
+#undef CONFIG_X86_LOCAL_APIC
+#define CONFIG_X86_LOCAL_APIC 1
+#undef __SMP__
+#define __SMP__ 1
+#define AFS_GLOBAL_SUNLOCK 1
 #endif
 
 #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
diff -ur openafs-1.2.5.orig/src/config/param.ia64_linux24.h openafs-1.2.5/src/config/param.ia64_linux24.h
--- openafs-1.2.5.orig/src/config/param.ia64_linux24.h	Mon Aug  6 20:05:00 2001
+++ openafs-1.2.5/src/config/param.ia64_linux24.h	Sat Jul 20 08:53:15 2002
@@ -34,15 +34,14 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#ifndef __SMP__
-#define __SMP__
-#endif
-#define AFS_GLOBAL_SUNLOCK
+#define CONFIG_SMP 1
+#undef __SMP__
+#define __SMP__ 1
+#define AFS_GLOBAL_SUNLOCK 1
 #endif
 
 #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
diff -ur openafs-1.2.5.orig/src/config/param.parisc_linux24.h openafs-1.2.5/src/config/param.parisc_linux24.h
--- openafs-1.2.5.orig/src/config/param.parisc_linux24.h	Sat Oct 13 00:36:14 2001
+++ openafs-1.2.5/src/config/param.parisc_linux24.h	Sat Jul 20 08:56:26 2002
@@ -24,15 +24,14 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#ifndef __SMP__
-#define __SMP__
-#endif
-#define AFS_GLOBAL_SUNLOCK
+#define CONFIG_SMP 1
+#undef __SMP__
+#define __SMP__ 1
+#define AFS_GLOBAL_SUNLOCK 1
 #endif
 
 #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
diff -ur openafs-1.2.5.orig/src/config/param.ppc_linux22.h openafs-1.2.5/src/config/param.ppc_linux22.h
--- openafs-1.2.5.orig/src/config/param.ppc_linux22.h	Thu Jul  5 11:20:18 2001
+++ openafs-1.2.5/src/config/param.ppc_linux22.h	Sat Jul 20 08:52:19 2002
@@ -24,15 +24,14 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#ifndef __SMP__
-#define __SMP__
-#endif
-#define AFS_GLOBAL_SUNLOCK
+#define CONFIG_SMP 1
+#undef __SMP__
+#define __SMP__ 1
+#define AFS_GLOBAL_SUNLOCK 1
 #endif
 
 #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
diff -ur openafs-1.2.5.orig/src/config/param.ppc_linux24.h openafs-1.2.5/src/config/param.ppc_linux24.h
--- openafs-1.2.5.orig/src/config/param.ppc_linux24.h	Thu Jul  5 11:20:18 2001
+++ openafs-1.2.5/src/config/param.ppc_linux24.h	Sat Jul 20 08:56:01 2002
@@ -26,15 +26,15 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#ifndef __SMP__
-#define __SMP__
+#define CONFIG_SMP 1
+#undef __SMP__
+#define __SMP__ 1
 #endif
-#define AFS_GLOBAL_SUNLOCK
+#define AFS_GLOBAL_SUNLOCK 1
 #endif
 
 #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
diff -ur openafs-1.2.5.orig/src/config/param.s390_linux22.h openafs-1.2.5/src/config/param.s390_linux22.h
--- openafs-1.2.5.orig/src/config/param.s390_linux22.h	Thu Jul  5 11:20:18 2001
+++ openafs-1.2.5/src/config/param.s390_linux22.h	Sat Jul 20 08:52:01 2002
@@ -27,18 +27,16 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#ifndef CONFIG_S390_LOCAL_APIC
-#define CONFIG_S390_LOCAL_APIC
-#endif
-#ifndef __SMP__
-#define __SMP__
-#endif
-#define AFS_GLOBAL_SUNLOCK
+#define CONFIG_SMP 1
+#undef CONFIG_S390_LOCAL_APIC
+#define CONFIG_S390_LOCAL_APIC 1
+#undef __SMP__
+#define __SMP__ 1
+#define AFS_GLOBAL_SUNLOCK 1
 #endif
 
 #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
diff -ur openafs-1.2.5.orig/src/config/param.s390_linux24.h openafs-1.2.5/src/config/param.s390_linux24.h
--- openafs-1.2.5.orig/src/config/param.s390_linux24.h	Thu Jul  5 11:20:18 2001
+++ openafs-1.2.5/src/config/param.s390_linux24.h	Sat Jul 20 08:55:11 2002
@@ -29,21 +29,20 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#ifndef CONFIG_S390_LOCAL_APIC
-#define CONFIG_S390_LOCAL_APIC
-#endif
-#ifndef __SMP__
-#define __SMP__
-#endif
-#define AFS_GLOBAL_SUNLOCK
+#define CONFIG_SMP 1
+#undef CONFIG_S390_LOCAL_APIC
+#define CONFIG_S390_LOCAL_APIC 1
+#undef __SMP__
+#define __SMP__ 1
+#define AFS_GLOBAL_SUNLOCK 1
 #endif
+
 #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
-#define MODVERSIONS
+#define MODVERSIONS 1
 #include <linux/modversions.h>
 #endif
 #endif /* __KERNEL__  && !DUMP_KERNEL*/
diff -ur openafs-1.2.5.orig/src/config/param.sparc64_linux22.h openafs-1.2.5/src/config/param.sparc64_linux22.h
--- openafs-1.2.5.orig/src/config/param.sparc64_linux22.h	Thu Jul  5 11:20:18 2001
+++ openafs-1.2.5/src/config/param.sparc64_linux22.h	Sat Jul 20 08:58:51 2002
@@ -32,15 +32,15 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#ifndef __SMP__
-#define __SMP__
+#define CONFIG_SMP 1
+#undef __SMP__
+#define __SMP__ 1
 #endif
-#define AFS_GLOBAL_SUNLOCK
+#define AFS_GLOBAL_SUNLOCK 1
 #endif
 
 #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
diff -ur openafs-1.2.5.orig/src/config/param.sparc64_linux24.h openafs-1.2.5/src/config/param.sparc64_linux24.h
--- openafs-1.2.5.orig/src/config/param.sparc64_linux24.h	Fri Jun 29 00:44:00 2001
+++ openafs-1.2.5/src/config/param.sparc64_linux24.h	Sat Jul 20 08:54:49 2002
@@ -38,13 +38,14 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#define __SMP__
-#define AFS_GLOBAL_SUNLOCK
+#define CONFIG_SMP 1
+#undef __SMP__
+#define __SMP__ 1
+#define AFS_GLOBAL_SUNLOCK 1
 #endif
 
 #endif /* __KERNEL__  && !DUMP_KERNEL*/
diff -ur openafs-1.2.5.orig/src/config/param.sparc_linux22.h openafs-1.2.5/src/config/param.sparc_linux22.h
--- openafs-1.2.5.orig/src/config/param.sparc_linux22.h	Thu Jul  5 11:20:18 2001
+++ openafs-1.2.5/src/config/param.sparc_linux22.h	Sat Jul 20 08:58:21 2002
@@ -27,15 +27,14 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#ifndef __SMP__
-#define __SMP__
-#endif
-#define AFS_GLOBAL_SUNLOCK
+#define CONFIG_SMP 1
+#undef __SMP__
+#define __SMP__ 1
+#define AFS_GLOBAL_SUNLOCK 1
 #endif
 
 #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
diff -ur openafs-1.2.5.orig/src/config/param.sparc_linux24.h openafs-1.2.5/src/config/param.sparc_linux24.h
--- openafs-1.2.5.orig/src/config/param.sparc_linux24.h	Sun Jan 20 03:49:33 2002
+++ openafs-1.2.5/src/config/param.sparc_linux24.h	Sat Jul 20 08:54:22 2002
@@ -29,15 +29,14 @@
 #ifdef CONFIG_SMP
 #undef CONFIG_SMP
 #endif
-/* Using "AFS_SMP" to map to however many #define's are required to get
+/* Using "AFS_SMP" to map to however many #defines are required to get
  * MP to compile for Linux
  */
 #ifdef AFS_SMP
-#define CONFIG_SMP
-#ifndef __SMP__
-#define __SMP__
-#endif
-#define AFS_GLOBAL_SUNLOCK
+#define CONFIG_SMP 1
+#undef __SMP__
+#define __SMP__ 1
+#define AFS_GLOBAL_SUNLOCK 1
 #endif
 
 #if defined(MODULE) && defined(CONFIG_MODVERSIONS)

--- cut here ---

-- 
Matthew Miller           mattdm@mattdm.org        <http://www.mattdm.org/>
Boston University Linux      ------>                <http://linux.bu.edu/>