Go to the documentation of this file. 82 #define LIST_HEAD(name, type) \ 84 struct type *lh_first; \ 87 #define LIST_ENTRY(type) \ 89 struct type *le_next; \ 90 struct type **le_prev; \ 96 #define LIST_INIT(head) { \ 97 (head)->lh_first = NULL; \ 100 #define LIST_INSERT_AFTER(listelm, elm, field) { \ 101 if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ 102 (listelm)->field.le_next->field.le_prev = \ 103 &(elm)->field.le_next; \ 104 (listelm)->field.le_next = (elm); \ 105 (elm)->field.le_prev = &(listelm)->field.le_next; \ 108 #define LIST_INSERT_HEAD(head, elm, field) { \ 109 if (((elm)->field.le_next = (head)->lh_first) != NULL) \ 110 (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ 111 (head)->lh_first = (elm); \ 112 (elm)->field.le_prev = &(head)->lh_first; \ 115 #define LIST_REMOVE(elm, field) { \ 116 if ((elm)->field.le_next != NULL) \ 117 (elm)->field.le_next->field.le_prev = \ 118 (elm)->field.le_prev; \ 119 *(elm)->field.le_prev = (elm)->field.le_next; \ 126 #define TAILQ_HEAD(name, type) \ 128 struct type *tqh_first; \ 129 struct type **tqh_last; \ 132 #define TAILQ_ENTRY(type) \ 134 struct type *tqe_next; \ 135 struct type **tqe_prev; \ 141 #define TAILQ_INIT(head) { \ 142 (head)->tqh_first = NULL; \ 143 (head)->tqh_last = &(head)->tqh_first; \ 146 #define TAILQ_INSERT_HEAD(head, elm, field) { \ 147 if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ 148 (elm)->field.tqe_next->field.tqe_prev = \ 149 &(elm)->field.tqe_next; \ 151 (head)->tqh_last = &(elm)->field.tqe_next; \ 152 (head)->tqh_first = (elm); \ 153 (elm)->field.tqe_prev = &(head)->tqh_first; \ 156 #define TAILQ_INSERT_TAIL(head, elm, field) { \ 157 (elm)->field.tqe_next = NULL; \ 158 (elm)->field.tqe_prev = (head)->tqh_last; \ 159 *(head)->tqh_last = (elm); \ 160 (head)->tqh_last = &(elm)->field.tqe_next; \ 163 #define TAILQ_INSERT_AFTER(head, listelm, elm, field) { \ 164 if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ 165 (elm)->field.tqe_next->field.tqe_prev = \ 166 &(elm)->field.tqe_next; \ 168 (head)->tqh_last = &(elm)->field.tqe_next; \ 169 (listelm)->field.tqe_next = (elm); \ 170 (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ 173 #define TAILQ_REMOVE(head, elm, field) { \ 174 if (((elm)->field.tqe_next) != NULL) \ 175 (elm)->field.tqe_next->field.tqe_prev = \ 176 (elm)->field.tqe_prev; \ 178 (head)->tqh_last = (elm)->field.tqe_prev; \ 179 *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ 185 #define CIRCLEQ_HEAD(name, type) \ 187 struct type *cqh_first; \ 188 struct type *cqh_last; \ 191 #define CIRCLEQ_ENTRY(type) \ 193 struct type *cqe_next; \ 194 struct type *cqe_prev; \ 200 #define CIRCLEQ_INIT(head) { \ 201 (head)->cqh_first = (void *)(head); \ 202 (head)->cqh_last = (void *)(head); \ 205 #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) { \ 206 (elm)->field.cqe_next = (listelm)->field.cqe_next; \ 207 (elm)->field.cqe_prev = (listelm); \ 208 if ((listelm)->field.cqe_next == (void *)(head)) \ 209 (head)->cqh_last = (elm); \ 211 (listelm)->field.cqe_next->field.cqe_prev = (elm); \ 212 (listelm)->field.cqe_next = (elm); \ 215 #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) { \ 216 (elm)->field.cqe_next = (listelm); \ 217 (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ 218 if ((listelm)->field.cqe_prev == (void *)(head)) \ 219 (head)->cqh_first = (elm); \ 221 (listelm)->field.cqe_prev->field.cqe_next = (elm); \ 222 (listelm)->field.cqe_prev = (elm); \ 225 #define CIRCLEQ_INSERT_HEAD(head, elm, field) { \ 226 (elm)->field.cqe_next = (head)->cqh_first; \ 227 (elm)->field.cqe_prev = (void *)(head); \ 228 if ((head)->cqh_last == (void *)(head)) \ 229 (head)->cqh_last = (elm); \ 231 (head)->cqh_first->field.cqe_prev = (elm); \ 232 (head)->cqh_first = (elm); \ 235 #define CIRCLEQ_INSERT_TAIL(head, elm, field) { \ 236 (elm)->field.cqe_next = (void *)(head); \ 237 (elm)->field.cqe_prev = (head)->cqh_last; \ 238 if ((head)->cqh_first == (void *)(head)) \ 239 (head)->cqh_first = (elm); \ 241 (head)->cqh_last->field.cqe_next = (elm); \ 242 (head)->cqh_last = (elm); \ 245 #define CIRCLEQ_REMOVE(head, elm, field) { \ 246 if ((elm)->field.cqe_next == (void *)(head)) \ 247 (head)->cqh_last = (elm)->field.cqe_prev; \ 249 (elm)->field.cqe_next->field.cqe_prev = \ 250 (elm)->field.cqe_prev; \ 251 if ((elm)->field.cqe_prev == (void *)(head)) \ 252 (head)->cqh_first = (elm)->field.cqe_next; \ 254 (elm)->field.cqe_prev->field.cqe_next = \ 255 (elm)->field.cqe_next; \
MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:53