]> xenbits.xensource.com Git - people/liuw/mini-os.git/commitdiff
mini-os is missing list_top in its list.h
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 18 Jul 2008 14:44:39 +0000 (15:44 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 18 Jul 2008 14:44:39 +0000 (15:44 +0100)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
include/list.h

index 33a6d80f29c5533fdc24f1dd9d6af80bd3674ae4..fbb1fa8cc07ae600d3c572a426df4a967fe3f451 100644 (file)
@@ -24,6 +24,12 @@ struct list_head {
        (ptr)->next = (ptr); (ptr)->prev = (ptr); \
 } while (0)
 
+#define list_top(head, type, member)                                     \
+({                                                                       \
+       struct list_head *_head = (head);                                 \
+       list_empty(_head) ? NULL : list_entry(_head->next, type, member); \
+})
+
 /*
  * Insert a new entry between two known consecutive entries. 
  *