From: Amir Noam <amir.noam@intel.com>
To: fubar@us.ibm.com, jgarzik@pobox.com
Cc: bonding-devel@lists.sourceforge.net, netdev@oss.sgi.com
Subject: [PATCH 1/5] [bonding] backport 2.6 changes to 2.4
Date: Wed, 30 Jul 2003 20:07:00 +0300 [thread overview]
Message-ID: <200307302007.00926.amir.noam@intel.com> (raw)
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
reply other threads:[~2003-07-30 17:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200307302007.00926.amir.noam@intel.com \
--to=amir.noam@intel.com \
--cc=bonding-devel@lists.sourceforge.net \
--cc=fubar@us.ibm.com \
--cc=jgarzik@pobox.com \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.