Lines Matching refs:head
55 #define SH_LIST_FIRSTP(head, type) \
56 ((struct type *)(((u_int8_t *)(head)) + (head)->slh_first))
58 #define SH_LIST_FIRST(head, type) \
59 ((head)->slh_first == -1 ? NULL : \
60 ((struct type *)(((u_int8_t *)(head)) + (head)->slh_first)))
75 #define SH_LIST_END(head) NULL
85 #define SH_LIST_INIT(head) (head)->slh_first = -1
99 #define SH_LIST_INSERT_HEAD(head, elm, field, type) do { \
100 if ((head)->slh_first != -1) { \
102 (head)->slh_first - SH_PTR_TO_OFF(head, elm); \
103 SH_LIST_FIRSTP(head, type)->field.sle_prev = \
107 (head)->slh_first = SH_PTR_TO_OFF(head, elm); \
108 (elm)->field.sle_prev = SH_PTR_TO_OFF(elm, &(head)->slh_first); \
138 #define SH_TAILQ_FIRSTP(head, type) \
139 ((struct type *)((u_int8_t *)(head) + (head)->stqh_first))
141 #define SH_TAILQ_FIRST(head, type) \
142 ((head)->stqh_first == -1 ? NULL : SH_TAILQ_FIRSTP(head, type))
153 #define SH_TAILQ_LAST(head) \
154 ((ssize_t *)(((u_int8_t *)(head)) + (head)->stqh_last))
159 #define SH_TAILQ_END(head) NULL
161 #define SH_TAILQ_INIT(head) { \
162 (head)->stqh_first = -1; \
163 (head)->stqh_last = SH_PTR_TO_OFF(head, &(head)->stqh_first); \
166 #define SH_TAILQ_INSERT_HEAD(head, elm, field, type) do { \
167 if ((head)->stqh_first != -1) { \
169 (head)->stqh_first - SH_PTR_TO_OFF(head, elm); \
170 SH_TAILQ_FIRSTP(head, type)->field.stqe_prev = \
174 (head)->stqh_last = \
175 SH_PTR_TO_OFF(head, &(elm)->field.stqe_next); \
177 (head)->stqh_first = SH_PTR_TO_OFF(head, elm); \
179 SH_PTR_TO_OFF(elm, &(head)->stqh_first); \
182 #define SH_TAILQ_INSERT_TAIL(head, elm, field) do { \
185 -SH_PTR_TO_OFF(head, elm) + (head)->stqh_last; \
186 if ((head)->stqh_last == \
187 SH_PTR_TO_OFF((head), &(head)->stqh_first)) \
188 (head)->stqh_first = SH_PTR_TO_OFF(head, elm); \
190 *SH_TAILQ_LAST(head) = -(head)->stqh_last + \
192 SH_PTR_TO_OFF(head, elm); \
193 (head)->stqh_last = \
194 SH_PTR_TO_OFF(head, &((elm)->field.stqe_next)); \
197 #define SH_TAILQ_INSERT_AFTER(head, listelm, elm, field, type) do { \
205 (head)->stqh_last = \
206 SH_PTR_TO_OFF(head, &elm->field.stqe_next); \
212 #define SH_TAILQ_REMOVE(head, elm, field, type) do { \
220 (head)->stqh_last = (elm)->field.stqe_prev + \
221 SH_PTR_TO_OFF(head, elm); \
244 #define SH_CIRCLEQ_FIRSTP(head, type) \
245 ((struct type *)(((u_int8_t *)(head)) + (head)->scqh_first))
247 #define SH_CIRCLEQ_FIRST(head, type) \
248 ((head)->scqh_first == -1 ? \
249 (void *)head : SH_CIRCLEQ_FIRSTP(head, type))
251 #define SH_CIRCLEQ_LASTP(head, type) \
252 ((struct type *)(((u_int8_t *)(head)) + (head)->scqh_last))
254 #define SH_CIRCLEQ_LAST(head, type) \
255 ((head)->scqh_last == -1 ? (void *)head : SH_CIRCLEQ_LASTP(head, type))
260 #define SH_CIRCLEQ_NEXT(head, elm, field, type) \
261 ((elm)->field.scqe_next == SH_PTR_TO_OFF(elm, head) ? \
262 (void *)head : SH_CIRCLEQ_NEXTP(elm, field, type))
267 #define SH_CIRCLEQ_PREV(head, elm, field, type) \
268 ((elm)->field.scqe_prev == SH_PTR_TO_OFF(elm, head) ? \
269 (void *)head : SH_CIRCLEQ_PREVP(elm, field, type))
271 #define SH_CIRCLEQ_END(head) ((void *)(head))
273 #define SH_CIRCLEQ_INIT(head) { \
274 (head)->scqh_first = 0; \
275 (head)->scqh_last = 0; \
278 #define SH_CIRCLEQ_INSERT_AFTER(head, listelm, elm, field, type) do { \
282 if (SH_CIRCLEQ_NEXTP(listelm, field, type) == (void *)head) \
283 (head)->scqh_last = SH_PTR_TO_OFF(head, elm); \
292 #define SH_CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field, type) do { \
296 if (SH_CIRCLEQ_PREVP(listelm, field, type) == (void *)(head)) \
297 (head)->scqh_first = SH_PTR_TO_OFF(head, elm); \
306 #define SH_CIRCLEQ_INSERT_HEAD(head, elm, field, type) do { \
307 (elm)->field.scqe_prev = SH_PTR_TO_OFF(elm, head); \
308 (elm)->field.scqe_next = (head)->scqh_first + \
310 if ((head)->scqh_last == 0) \
311 (head)->scqh_last = -(elm)->field.scqe_prev; \
313 SH_CIRCLEQ_FIRSTP(head, type)->field.scqe_prev = \
314 SH_PTR_TO_OFF(SH_CIRCLEQ_FIRSTP(head, type), elm); \
315 (head)->scqh_first = -(elm)->field.scqe_prev; \
318 #define SH_CIRCLEQ_INSERT_TAIL(head, elm, field, type) do { \
319 (elm)->field.scqe_next = SH_PTR_TO_OFF(elm, head); \
320 (elm)->field.scqe_prev = (head)->scqh_last + \
322 if ((head)->scqh_first == 0) \
323 (head)->scqh_first = -(elm)->field.scqe_next; \
325 SH_CIRCLEQ_LASTP(head, type)->field.scqe_next = \
326 SH_PTR_TO_OFF(SH_CIRCLEQ_LASTP(head, type), elm); \
327 (head)->scqh_last = -(elm)->field.scqe_next; \
330 #define SH_CIRCLEQ_REMOVE(head, elm, field, type) do { \
331 if (SH_CIRCLEQ_NEXTP(elm, field, type) == (void *)(head)) \
332 (head)->scqh_last += (elm)->field.scqe_prev; \
336 if (SH_CIRCLEQ_PREVP(elm, field, type) == (void *)(head)) \
337 (head)->scqh_first += (elm)->field.scqe_next; \