netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] list: introduce list_is_first()
@ 2015-12-10 14:17 Geliang Tang
  2015-12-10 14:17 ` [PATCH 2/4] livepatch: use list_is_first() Geliang Tang
  2015-12-10 15:10 ` [PATCH 1/4] list: introduce list_is_first() Jens Axboe
  0 siblings, 2 replies; 9+ messages in thread
From: Geliang Tang @ 2015-12-10 14:17 UTC (permalink / raw)
  To: Paul E. McKenney, Jan Kara, Josef Bacik, Josh Triplett
  Cc: Geliang Tang, Josh Poimboeuf, Seth Jennings, Jiri Kosina,
	Vojtech Pavlik, Pablo Neira Ayuso, Patrick McHardy,
	Jozsef Kadlecsik, David S. Miller, Jens Axboe, live-patching,
	netfilter-devel, coreteam, netdev, linux-block, linux-kernel

We already have list_is_last(), it makes sense to also add
list_is_first() for consistency. This list utility function
to check for first element in a list.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 include/linux/list.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/linux/list.h b/include/linux/list.h
index 5356f4d..2c43ef4 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -170,6 +170,17 @@ static inline void list_move_tail(struct list_head *list,
 }
 
 /**
+ * list_is_first - tests whether @list is the first entry in list @head
+ * @list: the entry to test
+ * @head: the head of the list
+ */
+static inline int list_is_first(const struct list_head *list,
+				const struct list_head *head)
+{
+	return list->prev == head;
+}
+
+/**
  * list_is_last - tests whether @list is the last entry in list @head
  * @list: the entry to test
  * @head: the head of the list
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-12-10 16:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-10 14:17 [PATCH 1/4] list: introduce list_is_first() Geliang Tang
2015-12-10 14:17 ` [PATCH 2/4] livepatch: use list_is_first() Geliang Tang
2015-12-10 14:17   ` [PATCH 3/4] netfilter: ipset: " Geliang Tang
2015-12-10 14:20     ` [PATCH 4/4] elevator: use list_is_{first,last} Geliang Tang
2015-12-10 15:10 ` [PATCH 1/4] list: introduce list_is_first() Jens Axboe
2015-12-10 15:23   ` Josh Poimboeuf
2015-12-10 15:35     ` Jens Axboe
2015-12-10 16:47       ` Jiri Kosina
2015-12-10 15:35     ` Christoph Hellwig

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).