diff options
-rw-r--r-- | list.h | 16 | ||||
-rw-r--r-- | trace-input.c | 2 |
2 files changed, 14 insertions, 4 deletions
@@ -45,6 +45,16 @@ static inline void list_add(struct list_head *p, struct list_head *head) | |||
45 | head->next = p; | 45 | head->next = p; |
46 | } | 46 | } |
47 | 47 | ||
48 | static inline void list_add_tail(struct list_head *p, struct list_head *head) | ||
49 | { | ||
50 | struct list_head *prev = head->prev; | ||
51 | |||
52 | p->prev = prev; | ||
53 | p->next = head; | ||
54 | prev->next = p; | ||
55 | head->prev = p; | ||
56 | } | ||
57 | |||
48 | static inline void list_del(struct list_head *p) | 58 | static inline void list_del(struct list_head *p) |
49 | { | 59 | { |
50 | struct list_head *next = p->next; | 60 | struct list_head *next = p->next; |
@@ -59,9 +69,9 @@ static inline int list_empty(struct list_head *list) | |||
59 | return list->next == list; | 69 | return list->next == list; |
60 | } | 70 | } |
61 | 71 | ||
62 | #define list_for_each_entry(p, list, type, field) \ | 72 | #define list_for_each_entry(p, list, field) \ |
63 | for (p = container_of((list)->next, type, field); \ | 73 | for (p = container_of((list)->next, typeof(*p), field); \ |
64 | &(p)->field != list; \ | 74 | &(p)->field != list; \ |
65 | p = container_of((p)->field.next, type, field)) | 75 | p = container_of((p)->field.next, typeof(*p), field)) |
66 | 76 | ||
67 | #endif /* __LIST_H */ | 77 | #endif /* __LIST_H */ |
diff --git a/trace-input.c b/trace-input.c index 377ace7..61a02fe 100644 --- a/trace-input.c +++ b/trace-input.c | |||
@@ -624,7 +624,7 @@ static struct page *allocate_page(struct tracecmd_input *handle, | |||
624 | struct page *page; | 624 | struct page *page; |
625 | int ret; | 625 | int ret; |
626 | 626 | ||
627 | list_for_each_entry(page, &cpu_data->pages, struct page, list) { | 627 | list_for_each_entry(page, &cpu_data->pages, list) { |
628 | if (page->offset == offset) { | 628 | if (page->offset == offset) { |
629 | page->ref_count++; | 629 | page->ref_count++; |
630 | return page; | 630 | return page; |