[PATCH] list_del_all

From: John Tyner (jtyner@cs.ucr.edu)
Date: Mon Apr 08 2002 - 15:27:49 EST


--- include/linux/list.h.orig Mon Apr 8 13:10:55 2002
+++ include/linux/list.h Mon Apr 8 13:22:48 2002
@@ -170,7 +170,23 @@
 #define list_for_each_prev(pos, head) \
         for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
                 pos = pos->prev, prefetch(pos->prev))
-
+
+/**
+ * list_del_all - delete all entries in list and call func for each entry
+ * @head: the head for your list
+ * @func: callback that should be called for each entry
+ * @type: the type of the struct this is embedded in
+ * @member: the name of the list_struct within the struct
+ */
+#define list_del_all( head, func, type, member ) \
+ do { \
+ struct list_head *curr, *next; \
+ list_for_each_safe( curr, next, head ) { \
+ type *var = list_entry( curr, type, member ); \
+ list_del( curr ); \
+ func( var ); \
+ } \
+ } while ( 0 )

 #endif /* __KERNEL__ || _LVM_H_INCLUDE */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Apr 15 2002 - 22:00:11 EST