Lines Matching refs:elm

62 #define SH_LIST_NEXTP(elm, field, type)					\
63 ((struct type *)(((u_int8_t *)(elm)) + (elm)->field.sle_next))
65 #define SH_LIST_NEXT(elm, field, type) \
66 ((elm)->field.sle_next == -1 ? NULL : \
67 ((struct type *)(((u_int8_t *)(elm)) + (elm)->field.sle_next)))
69 #define SH_LIST_PREV(elm, field) \
70 ((ssize_t *)(((u_int8_t *)(elm)) + (elm)->field.sle_prev))
82 #define SH_LIST_NEXT_TO_PREV(elm, field) \
83 (-(elm)->field.sle_next + SH_PTR_TO_OFF(elm, &(elm)->field.sle_next))
87 #define SH_LIST_INSERT_AFTER(listelm, elm, field, type) do { \
89 (elm)->field.sle_next = SH_PTR_TO_OFF(elm, \
92 SH_LIST_NEXT_TO_PREV(elm, field); \
94 (elm)->field.sle_next = -1; \
95 (listelm)->field.sle_next = SH_PTR_TO_OFF(listelm, elm); \
96 (elm)->field.sle_prev = SH_LIST_NEXT_TO_PREV(listelm, field); \
99 #define SH_LIST_INSERT_HEAD(head, elm, field, type) do { \
101 (elm)->field.sle_next = \
102 (head)->slh_first - SH_PTR_TO_OFF(head, elm); \
104 SH_LIST_NEXT_TO_PREV(elm, field); \
106 (elm)->field.sle_next = -1; \
107 (head)->slh_first = SH_PTR_TO_OFF(head, elm); \
108 (elm)->field.sle_prev = SH_PTR_TO_OFF(elm, &(head)->slh_first); \
111 #define SH_LIST_REMOVE(elm, field, type) do { \
112 if ((elm)->field.sle_next != -1) { \
113 SH_LIST_NEXTP(elm, field, type)->field.sle_prev = \
114 (elm)->field.sle_prev - (elm)->field.sle_next; \
115 *SH_LIST_PREV(elm, field) += (elm)->field.sle_next; \
117 *SH_LIST_PREV(elm, field) = -1; \
144 #define SH_TAILQ_NEXTP(elm, field, type) \
145 ((struct type *)((u_int8_t *)(elm) + (elm)->field.stqe_next))
147 #define SH_TAILQ_NEXT(elm, field, type) \
148 ((elm)->field.stqe_next == -1 ? NULL : SH_TAILQ_NEXTP(elm, field, type))
150 #define SH_TAILQ_PREVP(elm, field) \
151 ((ssize_t *)((u_int8_t *)(elm) + (elm)->field.stqe_prev))
156 #define SH_TAILQ_NEXT_TO_PREV(elm, field) \
157 (-(elm)->field.stqe_next + SH_PTR_TO_OFF(elm, &(elm)->field.stqe_next))
166 #define SH_TAILQ_INSERT_HEAD(head, elm, field, type) do { \
168 (elm)->field.stqe_next = \
169 (head)->stqh_first - SH_PTR_TO_OFF(head, elm); \
171 SH_TAILQ_NEXT_TO_PREV(elm, field); \
173 (elm)->field.stqe_next = -1; \
175 SH_PTR_TO_OFF(head, &(elm)->field.stqe_next); \
177 (head)->stqh_first = SH_PTR_TO_OFF(head, elm); \
178 (elm)->field.stqe_prev = \
179 SH_PTR_TO_OFF(elm, &(head)->stqh_first); \
182 #define SH_TAILQ_INSERT_TAIL(head, elm, field) do { \
183 (elm)->field.stqe_next = -1; \
184 (elm)->field.stqe_prev = \
185 -SH_PTR_TO_OFF(head, elm) + (head)->stqh_last; \
188 (head)->stqh_first = SH_PTR_TO_OFF(head, elm); \
191 SH_PTR_TO_OFF((elm), &(elm)->field.stqe_next) + \
192 SH_PTR_TO_OFF(head, elm); \
194 SH_PTR_TO_OFF(head, &((elm)->field.stqe_next)); \
197 #define SH_TAILQ_INSERT_AFTER(head, listelm, elm, field, type) do { \
199 (elm)->field.stqe_next = (listelm)->field.stqe_next - \
200 SH_PTR_TO_OFF(listelm, elm); \
202 SH_TAILQ_NEXT_TO_PREV(elm, field); \
204 (elm)->field.stqe_next = -1; \
206 SH_PTR_TO_OFF(head, &elm->field.stqe_next); \
208 (listelm)->field.stqe_next = SH_PTR_TO_OFF(listelm, elm); \
209 (elm)->field.stqe_prev = SH_TAILQ_NEXT_TO_PREV(listelm, field); \
212 #define SH_TAILQ_REMOVE(head, elm, field, type) do { \
213 if ((elm)->field.stqe_next != -1) { \
214 SH_TAILQ_NEXTP(elm, field, type)->field.stqe_prev = \
215 (elm)->field.stqe_prev + \
216 SH_PTR_TO_OFF(SH_TAILQ_NEXTP(elm, \
217 field, type), elm); \
218 *SH_TAILQ_PREVP(elm, field) += elm->field.stqe_next; \
220 (head)->stqh_last = (elm)->field.stqe_prev + \
221 SH_PTR_TO_OFF(head, elm); \
222 *SH_TAILQ_PREVP(elm, field) = -1; \
257 #define SH_CIRCLEQ_NEXTP(elm, field, type) \
258 ((struct type *)(((u_int8_t *)(elm)) + (elm)->field.scqe_next))
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))
264 #define SH_CIRCLEQ_PREVP(elm, field, type) \
265 ((struct type *)(((u_int8_t *)(elm)) + (elm)->field.scqe_prev))
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))
278 #define SH_CIRCLEQ_INSERT_AFTER(head, listelm, elm, field, type) do { \
279 (elm)->field.scqe_prev = SH_PTR_TO_OFF(elm, listelm); \
280 (elm)->field.scqe_next = (listelm)->field.scqe_next + \
281 (elm)->field.scqe_prev; \
283 (head)->scqh_last = SH_PTR_TO_OFF(head, elm); \
288 field, type), elm); \
289 (listelm)->field.scqe_next = -(elm)->field.scqe_prev; \
292 #define SH_CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field, type) do { \
293 (elm)->field.scqe_next = SH_PTR_TO_OFF(elm, listelm); \
294 (elm)->field.scqe_prev = (elm)->field.scqe_next - \
297 (head)->scqh_first = SH_PTR_TO_OFF(head, elm); \
302 field, type), elm); \
303 (listelm)->field.scqe_prev = -(elm)->field.scqe_next; \
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 + \
309 (elm)->field.scqe_prev; \
311 (head)->scqh_last = -(elm)->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 + \
321 (elm)->field.scqe_next; \
323 (head)->scqh_first = -(elm)->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; \
334 SH_CIRCLEQ_NEXTP(elm, field, type)->field.scqe_prev += \
335 (elm)->field.scqe_prev; \
336 if (SH_CIRCLEQ_PREVP(elm, field, type) == (void *)(head)) \
337 (head)->scqh_first += (elm)->field.scqe_next; \
339 SH_CIRCLEQ_PREVP(elm, field, type)->field.scqe_next += \
340 (elm)->field.scqe_next; \