summaryrefslogtreecommitdiff
path: root/accel-pppd/triton
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2014-04-08 22:52:18 +0200
committerDmitry Kozlov <xeb@mail.ru>2014-04-11 06:47:26 +0400
commitba47f76156c7fbffe09c2f09fa41eb72aa5c06fd (patch)
tree4879f4c96c610993395d11fa6f2cc84254b790c3 /accel-pppd/triton
parentf6bad674803eb1a6205ed9c440992aa0af7e535a (diff)
downloadaccel-ppp-ba47f76156c7fbffe09c2f09fa41eb72aa5c06fd.tar.gz
accel-ppp-ba47f76156c7fbffe09c2f09fa41eb72aa5c06fd.zip
triton: implement list_first_entry()
* Add list_first_entry() to list.h * Declare parameter of list_empty() as const Both changes are already included in Linux kernel sources. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/triton')
-rw-r--r--accel-pppd/triton/list.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/accel-pppd/triton/list.h b/accel-pppd/triton/list.h
index d95dd714..b17afab7 100644
--- a/accel-pppd/triton/list.h
+++ b/accel-pppd/triton/list.h
@@ -135,7 +135,7 @@ static inline void list_move_tail(struct list_head *list,
* list_empty - tests whether a list is empty
* @head: the list to test.
*/
-static inline int list_empty(struct list_head *head)
+static inline int list_empty(const struct list_head *head)
{
return head->next == head;
}
@@ -191,6 +191,17 @@ static inline void list_splice_init(struct list_head *list,
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
/**
+ * list_first_entry - get the first element from a list
+ * @ptr: the list head to take the element from.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Note, that list is expected to be not empty.
+ */
+#define list_first_entry(ptr, type, member) \
+ list_entry((ptr)->next, type, member)
+
+/**
* list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.