Lines Matching refs:head

51  * head of the list.  Elements being removed from the head of the list
61 * or after an existing element or at the head of the list. A list
64 * A simple queue is headed by a pair of pointers, one the head of the
67 * head of the list. New elements can be added to the list after
68 * an existing element, at the head of the list, or at the end of the
71 * A tail queue is headed by a pair of pointers, one to the head of the
75 * after an existing element, at the head of the list, or at the end of
91 #define QLIST_HEAD_INITIALIZER(head) \
103 #define QLIST_INIT(head) do { \
104 (head)->lh_first = NULL; \
122 #define QLIST_INSERT_HEAD(head, elm, field) do { \
123 if (((elm)->field.le_next = (head)->lh_first) != NULL) \
124 (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
125 (head)->lh_first = (elm); \
126 (elm)->field.le_prev = &(head)->lh_first; \
129 #define QLIST_INSERT_HEAD_RCU(head, elm, field) do { \
130 (elm)->field.le_prev = &(head)->lh_first; \
131 (elm)->field.le_next = (head)->lh_first; \
133 if ((head)->lh_first != NULL) { \
134 (head)->lh_first->field.le_prev = &(elm)->field.le_next; \
136 (head)->lh_first = (elm); \
147 #define QLIST_FOREACH(var, head, field) \
148 for ((var) = ((head)->lh_first); \
152 #define QLIST_FOREACH_SAFE(var, head, field, next_var) \
153 for ((var) = ((head)->lh_first); \
160 #define QLIST_EMPTY(head) ((head)->lh_first == NULL)
161 #define QLIST_FIRST(head) ((head)->lh_first)
173 #define QSLIST_HEAD_INITIALIZER(head) \
184 #define QSLIST_INIT(head) do { \
185 (head)->slh_first = NULL; \
193 #define QSLIST_INSERT_HEAD(head, elm, field) do { \
194 (elm)->field.sle_next = (head)->slh_first; \
195 (head)->slh_first = (elm); \
198 #define QSLIST_REMOVE_HEAD(head, field) do { \
199 (head)->slh_first = (head)->slh_first->field.sle_next; \
207 #define QSLIST_FOREACH(var, head, field) \
208 for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
210 #define QSLIST_FOREACH_SAFE(var, head, field, tvar) \
211 for ((var) = QSLIST_FIRST((head)); \
218 #define QSLIST_EMPTY(head) ((head)->slh_first == NULL)
219 #define QSLIST_FIRST(head) ((head)->slh_first)
232 #define QSIMPLEQ_HEAD_INITIALIZER(head) \
233 { NULL, &(head).sqh_first }
243 #define QSIMPLEQ_INIT(head) do { \
244 (head)->sqh_first = NULL; \
245 (head)->sqh_last = &(head)->sqh_first; \
248 #define QSIMPLEQ_INSERT_HEAD(head, elm, field) do { \
249 if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
250 (head)->sqh_last = &(elm)->field.sqe_next; \
251 (head)->sqh_first = (elm); \
254 #define QSIMPLEQ_INSERT_TAIL(head, elm, field) do { \
256 *(head)->sqh_last = (elm); \
257 (head)->sqh_last = &(elm)->field.sqe_next; \
260 #define QSIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
262 (head)->sqh_last = &(elm)->field.sqe_next; \
266 #define QSIMPLEQ_REMOVE_HEAD(head, field) do { \
267 if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL)\
268 (head)->sqh_last = &(head)->sqh_first; \
271 #define QSIMPLEQ_REMOVE(head, elm, type, field) do { \
272 if ((head)->sqh_first == (elm)) { \
273 QSIMPLEQ_REMOVE_HEAD((head), field); \
275 struct type *curelm = (head)->sqh_first; \
280 (head)->sqh_last = &(curelm)->field.sqe_next; \
284 #define QSIMPLEQ_FOREACH(var, head, field) \
285 for ((var) = ((head)->sqh_first); \
289 #define QSIMPLEQ_FOREACH_SAFE(var, head, field, next) \
290 for ((var) = ((head)->sqh_first); \
302 #define QSIMPLEQ_LAST(head, type, field) \
303 (QSIMPLEQ_EMPTY((head)) ? \
306 ((char *)((head)->sqh_last) - offsetof(struct type, field))))
311 #define QSIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL)
312 #define QSIMPLEQ_FIRST(head) ((head)->sqh_first)
326 #define QTAILQ_HEAD_INITIALIZER(head) \
327 { NULL, &(head).tqh_first }
339 #define QTAILQ_INIT(head) do { \
340 (head)->tqh_first = NULL; \
341 (head)->tqh_last = &(head)->tqh_first; \
344 #define QTAILQ_INSERT_HEAD(head, elm, field) do { \
345 if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
346 (head)->tqh_first->field.tqe_prev = \
349 (head)->tqh_last = &(elm)->field.tqe_next; \
350 (head)->tqh_first = (elm); \
351 (elm)->field.tqe_prev = &(head)->tqh_first; \
354 #define QTAILQ_INSERT_TAIL(head, elm, field) do { \
356 (elm)->field.tqe_prev = (head)->tqh_last; \
357 *(head)->tqh_last = (elm); \
358 (head)->tqh_last = &(elm)->field.tqe_next; \
361 #define QTAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
366 (head)->tqh_last = &(elm)->field.tqe_next; \
378 #define QTAILQ_REMOVE(head, elm, field) do { \
383 (head)->tqh_last = (elm)->field.tqe_prev; \
387 #define QTAILQ_FOREACH(var, head, field) \
388 for ((var) = ((head)->tqh_first); \
392 #define QTAILQ_FOREACH_SAFE(var, head, field, next_var) \
393 for ((var) = ((head)->tqh_first); \
397 #define QTAILQ_FOREACH_REVERSE(var, head, headname, field) \
398 for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
405 #define QTAILQ_EMPTY(head) ((head)->tqh_first == NULL)
406 #define QTAILQ_FIRST(head) ((head)->tqh_first)
409 #define QTAILQ_LAST(head, headname) \
410 (*(((struct headname *)((head)->tqh_last))->tqh_last))