* [PATCH 1/5] [bonding] backport 2.6 changes to 2.4
@ 2003-07-30 17:07 Amir Noam
0 siblings, 0 replies; only message in thread
From: Amir Noam @ 2003-07-30 17:07 UTC (permalink / raw)
To: fubar, jgarzik; +Cc: bonding-devel, netdev
Add list_for_each_entry_safe()
Amir
diff -Nuarp linux-2.4.22-pre9/include/linux/list.h linux-2.4.22-pre9-devel/include/linux/list.h
--- linux-2.4.22-pre9/include/linux/list.h Wed Jul 30 19:14:01 2003
+++ linux-2.4.22-pre9-devel/include/linux/list.h Wed Jul 30 19:14:02 2003
@@ -227,6 +227,19 @@ static inline void list_splice_init(stru
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-07-30 17:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-30 17:07 [PATCH 1/5] [bonding] backport 2.6 changes to 2.4 Amir Noam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).