[DRBD-cvs] r1442 - in trunk/drbd: . linux

drbd-user@lists.linbit.com drbd-user@lists.linbit.com
Sun, 18 Jul 2004 23:47:01 +0200 (CEST)


Author: lars
Date: 2004-07-18 23:47:00 +0200 (Sun, 18 Jul 2004)
New Revision: 1442

Modified:
   trunk/drbd/drbd_compat_types.h
   trunk/drbd/drbd_int.h
   trunk/drbd/linux/drbd_config.h
   trunk/drbd/lru_cache.h
Log:
more 2.4.X (x<20) compatibility

Modified: trunk/drbd/drbd_compat_types.h
===================================================================
--- trunk/drbd/drbd_compat_types.h	2004-07-17 10:30:33 UTC (rev 1441)
+++ trunk/drbd/drbd_compat_types.h	2004-07-18 21:47:00 UTC (rev 1442)
@@ -21,7 +21,7 @@
 	for(pos = (head)->next; pos != (head); pos = pos->next)
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) && !defined(REDHAT_2_4_18)
 #define BH_Launder BH_launder
 #endif
 

Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2004-07-17 10:30:33 UTC (rev 1441)
+++ trunk/drbd/drbd_int.h	2004-07-18 21:47:00 UTC (rev 1442)
@@ -39,6 +39,30 @@
 #include "mempool.h"
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)
+static inline void __list_splice(struct list_head *list,
+				 struct list_head *head)
+{
+	struct list_head *first = list->next;
+	struct list_head *last = list->prev;
+	struct list_head *at = head->next;
+
+	first->prev = head;
+	head->next = first;
+
+	last->next = at;
+	at->prev = last;
+}
+static inline void list_splice_init(struct list_head *list,
+				    struct list_head *head)
+{
+	if (!list_empty(list)) {
+		__list_splice(list, head);
+		INIT_LIST_HEAD(list);
+	}
+}
+#endif
+
 // module parameter, defined in drbd_main.c
 extern int minor_count;
 extern int disable_io_hints;

Modified: trunk/drbd/linux/drbd_config.h
===================================================================
--- trunk/drbd/linux/drbd_config.h	2004-07-17 10:30:33 UTC (rev 1441)
+++ trunk/drbd/linux/drbd_config.h	2004-07-18 21:47:00 UTC (rev 1442)
@@ -35,6 +35,13 @@
 
 //#define SIGHAND_HACK           // Needed for RH 2.4.20 and later kernels.
 //#define REDHAT_HLIST_BACKPORT  // Makes DRBD work on RH9 kernels
+/* Redhat 2.4.18 already includes BH_Launder,
+ * other  2.4.18 still have       BH_launder ...
+ * most likely we could do without it completely,
+ * since it is only used in drbd_ee_bh_prepare().
+ * anyways...
+ */
+//#define REDHAT_2_4_18
 
 //Your 2.4 verndor kernel already defines find_next_bit()
 //#define HAVE_FIND_NEXT_BIT

Modified: trunk/drbd/lru_cache.h
===================================================================
--- trunk/drbd/lru_cache.h	2004-07-17 10:30:33 UTC (rev 1441)
+++ trunk/drbd/lru_cache.h	2004-07-18 21:47:00 UTC (rev 1442)
@@ -51,6 +51,15 @@
 # include "hlist.h"
 #endif
 
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION (2,4,20)
+static inline void list_move(struct list_head *list, struct list_head *head)
+{
+        __list_del(list->prev, list->next);
+        list_add(list, head);
+}
+#endif
+
 struct lc_element {
 	struct hlist_node colision;
 	struct list_head list;           // LRU list or free list