[PATCH] list_del_all
John Tyner (jtyner@cs.ucr.edu)
Mon, 8 Apr 2002 13:27:49 -0700 (PDT)
--- 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/