patch-2.4.23 linux-2.4.23/include/linux/list.h
Next file: linux-2.4.23/include/linux/lvm.h
Previous file: linux-2.4.23/include/linux/ipv6_route.h
Back to the patch index
Back to the overall index
- Lines: 20
- Date:
2003-11-28 10:26:21.000000000 -0800
- Orig file:
linux-2.4.22/include/linux/list.h
- Orig date:
2002-11-28 15:53:15.000000000 -0800
diff -urN linux-2.4.22/include/linux/list.h linux-2.4.23/include/linux/list.h
@@ -227,6 +227,19 @@
pos = list_entry(pos->member.next, typeof(*pos), member), \
prefetch(pos->member.next))
+/**
+ * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * @pos: the type * to use as a loop counter.
+ * @n: another type * to use as temporary storage
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_safe(pos, n, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member), \
+ n = list_entry(pos->member.next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
#endif /* __KERNEL__ || _LVM_H_INCLUDE */
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)