X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=lib%2Flist%2Flist.h;h=ad562e4cc9bedece8d299893329d084f1abddefd;hp=97fb615cdb9fd1bc8361c876c2e063fb11a41b32;hb=dd8fe077022138d1f6aca7e6d6cceec61f56ce95;hpb=7b396a45d43cc464539cc25799ddda3a27339bd8 diff --git a/lib/list/list.h b/lib/list/list.h index 97fb615..ad562e4 100644 --- a/lib/list/list.h +++ b/lib/list/list.h @@ -1,6 +1,8 @@ #ifndef _LIST_H #define _LIST_H +#include + struct list_item { struct list_item *prev, *next; }; @@ -9,16 +11,6 @@ struct list { struct list_item head; }; -#ifndef container_of -#define container_of(_ptr, _type, _member) ({ \ - const typeof( ((_type *)0)->_member ) *__mptr = (_ptr); \ - (_type *)( (char *)__mptr - offsetof(_type,_member) );}) -#endif - -#ifndef offsetof -#define offsetof(_type, _member) ((size_t) &((_type *)0)->_member) -#endif - #define list_for_each(_list, _pos) \ for (_pos = (_list)->head.next; _pos != ((_list)->head); _pos = _pos->next) @@ -46,8 +38,7 @@ struct list { _member); \ &_pos->_member != &(_list)->head; \ _pos = _tmp, \ - _tmp = list_entry(_tmp->_member.next, typeof(*_pos), \ - _member, _list)) + _tmp = container_of(_tmp->_member.next, typeof(*_pos), _member)) #define DEFINE_LIST(_list) struct list _list = { \ .head = { \