[DRBD-cvs] r1553 - branches/drbd-0.7/drbd

svn at svn.drbd.org svn at svn.drbd.org
Thu Sep 23 16:34:58 CEST 2004


Author: phil
Date: 2004-09-23 16:34:55 +0200 (Thu, 23 Sep 2004)
New Revision: 1553

Modified:
   branches/drbd-0.7/drbd/drbd_compat_types.h
   branches/drbd-0.7/drbd/drbd_compat_wrappers.h
   branches/drbd-0.7/drbd/drbd_int.h
   branches/drbd-0.7/drbd/lru_cache.h
Log:
Now it compiles on RH AS 2.1's Linux-2.4.9 kernel.


Modified: branches/drbd-0.7/drbd/drbd_compat_types.h
===================================================================
--- branches/drbd-0.7/drbd/drbd_compat_types.h	2004-09-23 13:09:50 UTC (rev 1552)
+++ branches/drbd-0.7/drbd/drbd_compat_types.h	2004-09-23 14:34:55 UTC (rev 1553)
@@ -21,12 +21,30 @@
 	for(pos = (head)->next; pos != (head); pos = pos->next)
 #endif
 
+// RH 2.4.9 does not have min() / max()
+#ifndef min
+# define min(x,y) \
+	({ typeof(x) __x = (x); typeof(y) __y = (y); \
+	   (void)(&__x == &__y); \
+	   __x < __y ? __x: __y; })
+#endif
+
+#ifndef max
+# define max(x,y) \
+	({ typeof(x) __x = (x); typeof(y) __y = (y); \
+	   (void)(&__x == &__y); \
+	   __x > __y ? __x: __y; })
+#endif
+
+#ifndef MODULE_LICENSE
+# define MODULE_LICENSE(L)
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
 #define min_t(type,x,y) \
 	({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
 #define max_t(type,x,y) \
 	({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
-#define MODULE_LICENSE(L)
 #endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,7)

Modified: branches/drbd-0.7/drbd/drbd_compat_wrappers.h
===================================================================
--- branches/drbd-0.7/drbd/drbd_compat_wrappers.h	2004-09-23 13:09:50 UTC (rev 1552)
+++ branches/drbd-0.7/drbd/drbd_compat_wrappers.h	2004-09-23 14:34:55 UTC (rev 1553)
@@ -14,7 +14,10 @@
  */
 static inline void dump_stack(void)
 {
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,9)
+	// It seems that on 2.4.9 even show_stack is not available.
         show_stack(0);
+#endif
 }
 #endif
 

Modified: branches/drbd-0.7/drbd/drbd_int.h
===================================================================
--- branches/drbd-0.7/drbd/drbd_int.h	2004-09-23 13:09:50 UTC (rev 1552)
+++ branches/drbd-0.7/drbd/drbd_int.h	2004-09-23 14:34:55 UTC (rev 1553)
@@ -222,7 +222,14 @@
 
 // to debug dec_*(), while we still have the <0!! issue
 // to debug dec_*(), while we still have the <0!! issue
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,9)
 #include <linux/stringify.h>
+#else
+// RH 2.4.9 does not have linux/stringify.h
+#define __stringify_1(x)	#x
+#define __stringify(x)		__stringify_1(x)
+#endif
+
 #define HERE __stringify(__FILE__ __LINE__) // __FUNCTION__
 
 // integer division, round _UP_ to the next integer

Modified: branches/drbd-0.7/drbd/lru_cache.h
===================================================================
--- branches/drbd-0.7/drbd/lru_cache.h	2004-09-23 13:09:50 UTC (rev 1552)
+++ branches/drbd-0.7/drbd/lru_cache.h	2004-09-23 14:34:55 UTC (rev 1553)
@@ -60,6 +60,14 @@
 }
 #endif
 
+#ifndef max
+// For RH 2.4.9
+# define max(x,y) \
+	({ typeof(x) __x = (x); typeof(y) __y = (y); \
+	   (void)(&__x == &__y); \
+	   __x > __y ? __x: __y; })
+#endif
+
 struct lc_element {
 	struct hlist_node colision;
 	struct list_head list;           // LRU list or free list



More information about the drbd-cvs mailing list