patch-2.4.22 linux-2.4.22/include/linux/netfilter_ipv4/listhelp.h

Next file: linux-2.4.22/include/linux/netfilter_ipv4/lockhelp.h
Previous file: linux-2.4.22/include/linux/netfilter_ipv4/ipt_recent.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/include/linux/netfilter_ipv4/listhelp.h linux-2.4.22/include/linux/netfilter_ipv4/listhelp.h
@@ -39,6 +39,22 @@
 	(type)__i;				\
 })
 
+/* Just like LIST_FIND but we search backwards */
+#define LIST_FIND_B(head, cmpfn, type, args...)		\
+({							\
+	const struct list_head *__i = (head);		\
+							\
+	ASSERT_READ_LOCK(head);				\
+	do {						\
+		__i = __i->prev;			\
+		if (__i == (head)) {			\
+			__i = NULL;			\
+			break;				\
+		}					\
+	} while (!cmpfn((const type)__i , ## args));	\
+	(type)__i;					\
+})
+
 static inline int
 __list_cmp_same(const void *p1, const void *p2) { return p1 == p2; }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)