All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: stephen@networkplumber.org, davem@davemloft.net,
	idosch@mellanox.com, eladr@mellanox.com, yotamg@mellanox.com,
	ogerlitz@mellanox.com, roopa@cumulusnetworks.com,
	nikolay@cumulusnetworks.com, jhs@mojatatu.com,
	john.fastabend@gmail.com, rami.rosen@intel.com,
	gospo@cumulusnetworks.com, sfeldma@gmail.com
Subject: [patch iproute2 02/11] list: add list_for_each_entry_reverse macro
Date: Fri, 15 Apr 2016 09:51:44 +0200	[thread overview]
Message-ID: <1460706713-5942-3-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1460706713-5942-1-git-send-email-jiri@resnulli.us>

From: Jiri Pirko <jiri@mellanox.com>

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 include/list.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/list.h b/include/list.h
index cdebe4d..b549c3e 100644
--- a/include/list.h
+++ b/include/list.h
@@ -50,9 +50,15 @@ static inline void list_del(struct list_head *entry)
 #define list_first_entry(ptr, type, member) \
 	list_entry((ptr)->next, type, member)
 
+#define list_last_entry(ptr, type, member) \
+	list_entry((ptr)->prev, type, member)
+
 #define list_next_entry(pos, member) \
 	list_entry((pos)->member.next, typeof(*(pos)), member)
 
+#define list_prev_entry(pos, member) \
+	list_entry((pos)->member.prev, typeof(*(pos)), member)
+
 #define list_for_each_entry(pos, head, member)				\
 	for (pos = list_first_entry(head, typeof(*pos), member);	\
 	     &pos->member != (head);					\
@@ -64,6 +70,11 @@ static inline void list_del(struct list_head *entry)
 	     &pos->member != (head);					\
 	     pos = n, n = list_next_entry(n, member))
 
+#define list_for_each_entry_reverse(pos, head, member)			\
+	for (pos = list_last_entry(head, typeof(*pos), member);		\
+	     &pos->member != (head);					\
+	     pos = list_prev_entry(pos, member))
+
 struct hlist_head {
 	struct hlist_node *first;
 };
-- 
2.5.5

  parent reply	other threads:[~2016-04-15  7:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15  7:51 [patch iproute2 00/11] devlink: add support for shared buffer configuration and control Jiri Pirko
2016-04-15  7:51 ` [patch iproute2 01/11] devlink: fix "devlink port" help message Jiri Pirko
2016-04-15  7:51 ` Jiri Pirko [this message]
2016-04-15  7:51 ` [patch iproute2 03/11] list: add list_add_tail helper Jiri Pirko
2016-04-15  7:51 ` [patch iproute2 04/11] devlink: introduce pr_out_port_handle helper Jiri Pirko
2016-04-15  7:51 ` [patch iproute2 05/11] devlink: introduce helper to print out nice names (ifnames) Jiri Pirko
2016-04-15  7:51 ` [patch iproute2 06/11] devlink: split dl_argv_parse_put to parse and put parts Jiri Pirko
2016-04-15  7:51 ` [patch iproute2 07/11] devlink: introduce dump filtering function Jiri Pirko
2016-04-15  7:51 ` [patch iproute2 08/11] devlink: allow to parse both devlink and port handle in the same time Jiri Pirko
2016-04-15  7:51 ` [patch iproute2 09/11] devlink: implement shared buffer support Jiri Pirko
2016-04-15  7:51 ` [patch iproute2 10/11] devlink: implement shared buffer occupancy control Jiri Pirko
2016-04-15  7:51 ` [patch iproute2 11/11] devlink: add manpage for shared buffer Jiri Pirko
2016-04-19 15:01 ` [patch iproute2 00/11] devlink: add support for shared buffer configuration and control Stephen Hemminger
2016-05-13 21:44 ` Stephen Hemminger
2016-05-14 13:21 ` [iproute2 net-next repost 1/2] devlink: implement shared buffer support Jiri Pirko
2016-05-14 13:21   ` [iproute2 net-next repost 2/2] devlink: implement shared buffer occupancy control Jiri Pirko
2016-05-16 18:23   ` [iproute2 net-next repost 1/2] devlink: implement shared buffer support Stephen Hemminger

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=1460706713-5942-3-git-send-email-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=eladr@mellanox.com \
    --cc=gospo@cumulusnetworks.com \
    --cc=idosch@mellanox.com \
    --cc=jhs@mojatatu.com \
    --cc=john.fastabend@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=ogerlitz@mellanox.com \
    --cc=rami.rosen@intel.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=sfeldma@gmail.com \
    --cc=stephen@networkplumber.org \
    --cc=yotamg@mellanox.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.