diff options
author | Geoff Levand <geoff@infradead.org> | 2011-11-11 22:52:05 -0800 |
---|---|---|
committer | Geoff Levand <geoff@infradead.org> | 2011-11-11 22:52:05 -0800 |
commit | b8e57298d53e38d660128a795a4c12ecccfde964 (patch) | |
tree | 99060a24ded932c2ac647391cb160f71576c5936 | |
parent | f5e1863e0e0a4fae56192cd588deb687edbfcda4 (diff) | |
download | petitboot-b8e57298d53e38d660128a795a4c12ecccfde964.zip petitboot-b8e57298d53e38d660128a795a4c12ecccfde964.tar.gz |
Add list_prev_entry, list_next_entry
Signed-off-by: Geoff Levand <geoff@infradead.org>
-rw-r--r-- | lib/list/list.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/list/list.h b/lib/list/list.h index d93f8a8..7f9955f 100644 --- a/lib/list/list.h +++ b/lib/list/list.h @@ -27,14 +27,19 @@ struct list { ? NULL \ : container_of(_ptr, _type, _member)) +#define list_prev_entry(_list, _pos, _member) \ + list_entry(_pos->_member.prev, typeof(*_pos), _member, _list) + +#define list_next_entry(_list, _pos, _member) \ + list_entry(_pos->_member.next, typeof(*_pos), _member, _list) + #define list_for_each_entry(_list, _pos, _member) \ for (_pos = list_entry((_list)->head.next, typeof(*_pos), _member, _list); \ - _pos; \ - _pos = list_entry(_pos->_member.next, typeof(*_pos), _member, _list)) + _pos; _pos = list_next_entry(_list, _pos, _member)) #define list_for_each_entry_continue(_list, _pos, _member) \ - for (; _pos; \ - _pos = list_entry(_pos->_member.next, typeof(*_pos), _member, _list)) + for (; _pos; _pos = list_next_entry(_list, _pos, _member)) + #define STATIC_LIST(_list) static struct list _list = { \ .head = { \ |