[OpenAFS-devel] [PATCH] openafs-1.1.1 doesn't compile on linux-2.4.9

Matthieu Verbert/Zurich/IBM MVE@zurich.ibm.com
Fri, 17 Aug 2001 17:38:39 +0200


Hi folks,
 I wanted to give a try to the newest kernel and compilation failed 
because of late changes by davem in min/max macros.
I have modified OpenAFS sources so that they compile, but I would not 
guarantee in any ways that the patch is correct.
That will give at least an indication of the files to touch...

Matthieu

PS: I don't trust Notes, so I will just insert patch below.

diff -u --recursive openafs-1.1.1.orig/src/afs/afs_server.c 
openafs-1.1.1-patched2.4.9/src/afs/afs_server.c
--- openafs-1.1.1.orig/src/afs/afs_server.c     Sun Jul 15 00:19:27 2001
+++ openafs-1.1.1-patched2.4.9/src/afs/afs_server.c     Fri Aug 17 
14:42:42 2001
@@ -972,9 +972,10 @@
 #endif
 
 #ifdef AFS_USERSPACE_IP_ADDR
-#ifndef min
-#define min(A,B) ((A)<(B)) ? (A) : (B)
+#ifdef min
+#undef min
 #endif
+#define min(A,B) ((A)<(B)) ? (A) : (B)
 /*
  * The IP addresses and ranks are determined by afsd (in user space) and
  * passed into the kernel at startup time through the AFSOP_ADVISEADDR
diff -u --recursive openafs-1.1.1.orig/src/auth/ktc.c 
openafs-1.1.1-patched2.4.9/src/auth/ktc.c
--- openafs-1.1.1.orig/src/auth/ktc.c   Sun Jul 15 00:20:40 2001
+++ openafs-1.1.1-patched2.4.9/src/auth/ktc.c   Fri Aug 17 14:43:31 2001
@@ -29,9 +29,10 @@
 #include "../afs/pthread_glock.h"
 #include "../afs/dirpath.h"
 
-#if !defined(min)
+#if defined(min)
+#undef min
+#endif /* defined(min) */
 #define min(a,b) ((a)<(b)?(a):(b))
-#endif /* !defined(min) */
 
 #else /* defined(UKERNEL) */
 
diff -u --recursive openafs-1.1.1.orig/src/config/stds.h 
openafs-1.1.1-patched2.4.9/src/config/stds.h
--- openafs-1.1.1.orig/src/config/stds.h        Wed Jul 11 05:08:31 2001
+++ openafs-1.1.1-patched2.4.9/src/config/stds.h        Fri Aug 17 
14:44:04 2001
@@ -180,6 +180,13 @@
 
 #ifndef        KERNEL
 #ifndef AFS_NT40_ENV
+#ifdef min
+#undef min
+#endif
+#ifdef max
+#undef max
+#endif
+
 #define max(a, b)               ((a) < (b) ? (b) : (a))
 #define min(a, b)               ((a) > (b) ? (b) : (a))
 #endif
diff -u --recursive openafs-1.1.1.orig/src/rxkad/rxkad_client.c 
openafs-1.1.1-patched2.4.9/src/rxkad/rxkad_client.c
--- openafs-1.1.1.orig/src/rxkad/rxkad_client.c Sun Jul 15 00:23:52 2001
+++ openafs-1.1.1-patched2.4.9/src/rxkad/rxkad_client.c Fri Aug 17 
14:51:00 2001
@@ -58,9 +58,11 @@
 
 char *rxi_Alloc();
 
-#ifndef max
-#define        max(a,b)    ((a) < (b)? (b) : (a))
+#ifdef max
+#undef max
 #endif /* max */
+#define        max(a,b)    ((a) < (b)? (b) : (a))
+
 
 static struct rx_securityOps rxkad_client_ops = {
     rxkad_Close,
diff -u --recursive openafs-1.1.1.orig/src/rxkad/rxkad_common.c 
openafs-1.1.1-patched2.4.9/src/rxkad/rxkad_common.c
--- openafs-1.1.1.orig/src/rxkad/rxkad_common.c Sun Jul 15 00:23:53 2001
+++ openafs-1.1.1-patched2.4.9/src/rxkad/rxkad_common.c Fri Aug 17 
14:51:16 2001
@@ -59,9 +59,10 @@
 
 char *rxi_Alloc();
 
-#ifndef max
-#define        max(a,b)    ((a) < (b)? (b) : (a))
+#ifdef max
+#undef max
 #endif /* max */
+#define        max(a,b)    ((a) < (b)? (b) : (a))
 
 #ifndef KERNEL
 #define osi_Time() time(0)