summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShailabh Nagar <nagar@watson.ibm.com>2006-07-14 00:24:35 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-14 21:53:56 -0700
commite8f4d97e1b58b50ad6449bb2d35e6632c0236abd (patch)
tree9017dccfcaf05124c01d36f48f7b38d0f1e5df82
parent22caf04297896e515c6d5cdfb8e08a79a523946c (diff)
[PATCH] list_is_last utility
Add another list utility function to check for last element in a list. Signed-off-by: Shailabh Nagar <nagar@watson.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--include/linux/list.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h
index 6b74adf5297f..65a5b5ceda49 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -265,6 +265,17 @@ static inline void list_move_tail(struct list_head *list,
}
/**
+ * list_is_last - tests whether @list is the last entry in list @head
+ * @list: the entry to test
+ * @head: the head of the list
+ */
+static inline int list_is_last(const struct list_head *list,
+ const struct list_head *head)
+{
+ return list->next == head;
+}
+
+/**
* list_empty - tests whether a list is empty
* @head: the list to test.
*/