Skip to contentSkip to conversation

: net: Add skb_queue_is_last().

PATCH New David Miller 1 participant 1 message Sep 23, 2008

Subsystems (2)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 1/1 : net: Add skb_queue_is_last().

net: Add skb_queue_is_last().

Several bits of code want to know "is this the last SKB in a queue", and all of them implement this by hand.

Provide an common interface to make this check.

---
 include/linux/skbuff.h |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
include/linux/skbuff.h +13 -0
index 4a144e8..3a5838d 100644
@@ -473,6 +473,19 @@ static inline int skb_queue_empty(const struct sk_buff_head *list)
 }
 
 /**
+ *	skb_queue_is_last - check if skb is the last entry in the queue
+ *	@list: queue head
+ *	@skb: buffer
+ *
+ *	Returns true if @skb is the last buffer on the list.
+ */
+static inline bool skb_queue_is_last(const struct sk_buff_head *list,
+				     const struct sk_buff *skb)
+{
+	return (skb->next == (struct sk_buff *) list);
+}
+
+/**
  *	skb_get - reference buffer
  *	@skb: buffer to reference
  *
Signature · 1 line
1.5.6.5