43 #ifndef CYGONCE_FS_JFFS2_LIST_H 44 #define CYGONCE_FS_JFFS2_LIST_H 53 #include <cyg/infra/cyg_type.h> 64 #define LIST_HEAD_INIT(name) { &(name), &(name) } 66 #define LIST_HEAD(name) \ 67 struct list_head name = LIST_HEAD_INIT(name) 69 #define INIT_LIST_HEAD( _list_ ) \ 71 (_list_)->next = (_list_)->prev = (_list_); \ 77 static __inline__
void 80 struct list_head *next = afterthisent->next;
82 newent->prev = afterthisent;
83 afterthisent->next = newent;
88 static __inline__
void 91 struct list_head *prev = beforethisent->prev;
93 newent->next = beforethisent;
94 beforethisent->prev = newent;
99 static __inline__
void 102 ent->prev->next = ent->next;
103 ent->next->prev = ent->prev;
106 static __inline__
void 110 list_add( list, head );
113 static __inline__
void 117 list_add_tail( list, head );
121 static __inline__
int 124 return ( list->next == list );
132 #define list_entry( _list_, _type_, _member_ ) \ 133 ((_type_ *)((char *)(_list_)-(char *)(offsetof(_type_,_member_)))) 137 #define list_for_each( _ent_, _list_ ) \ 138 for ( (_ent_) = (_list_)->next; \ 139 (_ent_) != (_list_); \ 140 (_ent_) = (_ent_)->next ) 146 #define list_for_each_entry(_list_, _head_, _item_) \ 147 for ((_list_) = list_entry((_head_)->next, typeof(*_list_), _item_); \ 148 &((_list_)->_item_) != (_head_); \ 149 (_list_) = list_entry((_list_)->_item_.next, typeof(*_list_), _item_))