Jan Kiszka wrote:
> Thanks, but... mind to integrate it into stack/include/rtnet_port.h?
> 
> We can then ask Wolfgang to do some tests on 2.4.

Here it comes.

--- stack/include/rtnet_port.h~ 2008-03-31 19:33:11.000000000 +0200
+++ stack/include/rtnet_port.h  2008-09-01 11:24:31.000000000 +0200
@@ -24,6 +24,7 @@
 
 #include <linux/bitops.h>
 #include <linux/moduleparam.h>
+#include <linux/list.h>
 
 #if 1
 #include <rtskb.h>
@@ -56,6 +57,56 @@
     module_param_array(name, int, NULL, 0444)
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+# define LIST_POISON1  ((void *) 0x00100100)
+# define LIST_POISON2  ((void *) 0x00200200)
+
+struct hlist_head {
+       struct hlist_node *first;
+};
+
+struct hlist_node {
+       struct hlist_node *next, **pprev;
+};
+
+# define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
+
+static inline void __hlist_del(struct hlist_node *n)
+{
+       struct hlist_node *next = n->next;
+       struct hlist_node **pprev = n->pprev;
+       *pprev = next;
+       if (next)
+               next->pprev = pprev;
+}
+
+static inline void hlist_del(struct hlist_node *n)
+{
+       __hlist_del(n);
+       n->next = LIST_POISON1;
+       n->pprev = LIST_POISON2;
+}
+
+static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
+{
+       struct hlist_node *first = h->first;
+       n->next = first;
+       if (first)
+               first->pprev = &n->next;
+       h->first = n;
+       n->pprev = &h->first;
+}
+
+# define hlist_entry(ptr, type, member) \
+       ((type *)((char *)(ptr) - (unsigned long)(&((type *)0)->member)))
+
+# define hlist_for_each_entry(tpos, pos, head, member)                  \
+       for (pos = (head)->first;                                        \
+            pos && ({ prefetch(pos->next); 1;}) &&                      \
+               ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
+            pos = pos->next)
+#endif
+
 static inline void rtnetif_start_queue(struct rtnet_device *rtdev)
 {
     clear_bit(__LINK_STATE_XOFF, &rtdev->state);

-- 
                                                 Gilles.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
RTnet-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rtnet-developers

Reply via email to