1 #ifndef ACL_RING_INCLUDE_H 2 #define ACL_RING_INCLUDE_H 80 #define ACL_RING_SUCC(c) ((c)->succ) 81 #define acl_ring_succ ACL_RING_SUCC 86 #define ACL_RING_PRED(c) ((c)->pred) 87 #define acl_ring_pred ACL_RING_PRED 96 #define ACL_RING_TO_APPL(ring_ptr, app_type, ring_member) \ 97 ((app_type *) (((char *) (ring_ptr)) - offsetof(app_type,ring_member))) 99 #define acl_ring_to_appl ACL_RING_TO_APPL 140 #define ACL_RING_FOREACH(iter, head_ptr) \ 141 for ((iter).ptr = acl_ring_succ((head_ptr)); (iter).ptr != (head_ptr); \ 142 (iter).ptr = acl_ring_succ((iter).ptr)) 144 #define acl_ring_foreach ACL_RING_FOREACH 151 #define ACL_RING_FOREACH_REVERSE(iter, head_ptr) \ 152 for ((iter).ptr = acl_ring_pred((head_ptr)); (iter).ptr != (head_ptr); \ 153 (iter).ptr = acl_ring_pred((iter).ptr)) 155 #define acl_ring_foreach_reverse ACL_RING_FOREACH_REVERSE 162 #define ACL_RING_FIRST(head) \ 163 (acl_ring_succ(head) != (head) ? acl_ring_succ(head) : 0) 165 #define acl_ring_first ACL_RING_FIRST 174 #define ACL_RING_FIRST_APPL(head, app_type, ring_member) \ 175 (acl_ring_succ(head) != (head) ? \ 176 ACL_RING_TO_APPL(acl_ring_succ(head), app_type, ring_member) : 0) 178 #define acl_ring_first_appl ACL_RING_FIRST_APPL 185 #define ACL_RING_LAST(head) \ 186 (acl_ring_pred(head) != (head) ? acl_ring_pred(head) : 0) 188 #define acl_ring_last ACL_RING_LAST 197 #define ACL_RING_LAST_APPL(head, app_type, ring_member) \ 198 (acl_ring_pred(head) != (head) ? \ 199 ACL_RING_TO_APPL(acl_ring_pred(head), app_type, ring_member) : 0) 201 #define acl_ring_last_appl ACL_RING_LAST_APPL 208 #define ACL_RING_APPEND(ring_in, entry_in) do { \ 209 ACL_RING *ring_ptr = (ring_in), *entry_ptr = (entry_in); \ 210 entry_ptr->succ = ring_ptr->succ; \ 211 entry_ptr->pred = ring_ptr; \ 212 entry_ptr->parent = ring_ptr->parent; \ 213 ring_ptr->succ->pred = entry_ptr; \ 214 ring_ptr->succ = entry_ptr; \ 215 ring_ptr->parent->len++; \ 223 #define ACL_RING_PREPEND(ring_in, entry_in) do { \ 224 ACL_RING *ring_ptr = (ring_in), *entry_ptr = (entry_in); \ 225 entry_ptr->pred = ring_ptr->pred; \ 226 entry_ptr->succ = ring_ptr; \ 227 entry_ptr->parent = ring_ptr->parent; \ 228 ring_ptr->pred->succ = entry_ptr; \ 229 ring_ptr->pred = entry_ptr; \ 230 ring_ptr->parent->len++; \ 237 #define ACL_RING_DETACH(entry_in) do { \ 238 ACL_RING *succ, *pred, *entry_ptr = (entry_in); \ 239 succ = entry_ptr->succ; \ 240 pred = entry_ptr->pred; \ 241 if (succ != NULL && pred != NULL) { \ 244 entry_ptr->parent->len--; \ 245 entry_ptr->succ = entry_ptr->pred = NULL; \
ACL_API void acl_ring_detach(ACL_RING *entry)
ACL_API int acl_ring_size(const ACL_RING *ring)
ACL_API ACL_RING * acl_ring_pop_head(ACL_RING *ring)
ACL_API void acl_ring_init(ACL_RING *ring)
ACL_API ACL_RING * acl_ring_pop_tail(ACL_RING *ring)
ACL_API void acl_ring_append(ACL_RING *ring, ACL_RING *entry)
struct ACL_RING_ITER ACL_RING_ITER
ACL_API void acl_ring_prepend(ACL_RING *ring, ACL_RING *entry)