[PATCH] BTT patch: (2/3) per-IO stream output
[blktrace.git] / btt / list.h
index b165ecf80b8db696064d5775ae57a3c88aca65dc..f28f0fb2050bd831efd6268e49c588258348ea5d 100644 (file)
@@ -145,4 +145,25 @@ static inline int list_empty(const struct list_head *head)
        return head->next == head;
 }
 
+/**
+ * list_first - Returns first entry on list, or NULL if empty
+ * @head: the list
+ */
+static inline struct list_head *list_first(const struct list_head *head)
+{
+       return list_empty(head) ? NULL : head->next;
+}
+
+/**
+ * list_move_tail - delete from one list and add as another's tail
+ * @list: the entry to move
+ * @head: the head that will follow our entry
+ */
+static inline void list_move_tail(struct list_head *list,
+                                 struct list_head *head)
+{
+        __list_del(list->prev, list->next);
+        list_add_tail(list, head);
+}
+
 #endif