Lines Matching full:node

39 		struct _dnode *next; /* ptr to next node    (sys_dnode_t) */
43 struct _dnode *prev; /* ptr to previous node (sys_dnode_t) */
52 * @brief Doubly-linked list node structure.
70 * @param __dn A sys_dnode_t pointer to peek each node of the list
77 * @brief Provide the primitive to iterate on a list, from a node in the list
86 * Like SYS_DLIST_FOR_EACH_NODE(), but __dn already contains a node in the list
93 * @param __dn A sys_dnode_t pointer to peek each node of the list;
94 * it contains the starting node, or NULL to start from the head
115 * @param __dn A sys_dnode_t pointer to peek each node of the list
125 * @brief Provide the primitive to resolve the container of a list node
214 * @brief initialize node to its state when not in a list
216 * @param node the node
219 static inline void sys_dnode_init(sys_dnode_t *node) in sys_dnode_init() argument
221 node->next = NULL; in sys_dnode_init()
222 node->prev = NULL; in sys_dnode_init()
226 * @brief check if a node is a member of any list
228 * @param node the node
230 * @return true if node is linked into a list, false if it is not
233 static inline bool sys_dnode_is_linked(const sys_dnode_t *node) in sys_dnode_is_linked() argument
235 return node->next != NULL; in sys_dnode_is_linked()
239 * @brief check if a node is the list's head
242 * @param node the node to check
244 * @return true if node is the head, false otherwise
247 static inline bool sys_dlist_is_head(sys_dlist_t *list, sys_dnode_t *node) in sys_dlist_is_head() argument
249 return list->head == node; in sys_dlist_is_head()
253 * @brief check if a node is the list's tail
256 * @param node the node to check
258 * @return true if node is the tail, false otherwise
261 static inline bool sys_dlist_is_tail(sys_dlist_t *list, sys_dnode_t *node) in sys_dlist_is_tail() argument
263 return list->tail == node; in sys_dlist_is_tail()
280 * @brief check if more than one node present
323 * @brief get a reference to the next item in the list, node is not NULL
325 * Faster than sys_dlist_peek_next() if node is known not to be NULL.
328 * @param node the node from which to get the next element in the list
330 * @return a pointer to the next element from a node, NULL if node is the tail
334 sys_dnode_t *node) in sys_dlist_peek_next_no_check() argument
336 return (node == list->tail) ? NULL : node->next; in sys_dlist_peek_next_no_check()
343 * @param node the node from which to get the next element in the list
345 * @return a pointer to the next element from a node, NULL if node is the tail
346 * or NULL (when node comes from reading the head of an empty list).
350 sys_dnode_t *node) in sys_dlist_peek_next() argument
352 return (node != NULL) ? sys_dlist_peek_next_no_check(list, node) : NULL; in sys_dlist_peek_next()
356 * @brief get a reference to the previous item in the list, node is not NULL
358 * Faster than sys_dlist_peek_prev() if node is known not to be NULL.
361 * @param node the node from which to get the previous element in the list
363 * @return a pointer to the previous element from a node, NULL if node is the
368 sys_dnode_t *node) in sys_dlist_peek_prev_no_check() argument
370 return (node == list->head) ? NULL : node->prev; in sys_dlist_peek_prev_no_check()
377 * @param node the node from which to get the previous element in the list
379 * @return a pointer to the previous element from a node, NULL if node is the
380 * tail or NULL (when node comes from reading the head of an empty
385 sys_dnode_t *node) in sys_dlist_peek_prev() argument
387 return (node != NULL) ? sys_dlist_peek_prev_no_check(list, node) : NULL; in sys_dlist_peek_prev()
404 * @brief add node to tail of list
409 * @param node the element to append
412 static inline void sys_dlist_append(sys_dlist_t *list, sys_dnode_t *node) in sys_dlist_append() argument
416 node->next = list; in sys_dlist_append()
417 node->prev = tail; in sys_dlist_append()
419 tail->next = node; in sys_dlist_append()
420 list->tail = node; in sys_dlist_append()
424 * @brief add node to head of list
429 * @param node the element to append
432 static inline void sys_dlist_prepend(sys_dlist_t *list, sys_dnode_t *node) in sys_dlist_prepend() argument
436 node->next = head; in sys_dlist_prepend()
437 node->prev = list; in sys_dlist_prepend()
439 head->prev = node; in sys_dlist_prepend()
440 list->head = node; in sys_dlist_prepend()
444 * @brief Insert a node into a list
446 * Insert a node before a specified node in a dlist.
448 * @param successor the position before which "node" will be inserted
449 * @param node the element to insert
451 static inline void sys_dlist_insert(sys_dnode_t *successor, sys_dnode_t *node) in sys_dlist_insert() argument
455 node->prev = prev; in sys_dlist_insert()
456 node->next = successor; in sys_dlist_insert()
457 prev->next = node; in sys_dlist_insert()
458 successor->prev = node; in sys_dlist_insert()
462 * @brief insert node at position
464 * Insert a node in a location depending on a external condition. The cond()
465 * function checks if the node is to be inserted _before_ the current node
470 * @param node the element to insert
471 * @param cond a function that determines if the current node is the correct
476 static inline void sys_dlist_insert_at(sys_dlist_t *list, sys_dnode_t *node, in sys_dlist_insert_at() argument
477 int (*cond)(sys_dnode_t *node, void *data), void *data) in sys_dlist_insert_at() argument
480 sys_dlist_append(list, node); in sys_dlist_insert_at()
488 sys_dlist_insert(pos, node); in sys_dlist_insert_at()
490 sys_dlist_append(list, node); in sys_dlist_insert_at()
496 * @brief remove a specific node from a list
498 * The list is implicit from the node. The node must be part of a list.
501 * @param node the node to remove
504 static inline void sys_dlist_remove(sys_dnode_t *node) in sys_dlist_remove() argument
506 sys_dnode_t *const prev = node->prev; in sys_dlist_remove()
507 sys_dnode_t *const next = node->next; in sys_dlist_remove()
511 sys_dnode_init(node); in sys_dlist_remove()
515 * @brief get the first node in a list
521 * @return the first node in the list, NULL if list is empty
526 sys_dnode_t *node = NULL; in sys_dlist_get() local
529 node = list->head; in sys_dlist_get()
530 sys_dlist_remove(node); in sys_dlist_get()
533 return node; in sys_dlist_get()
546 sys_dnode_t *node = NULL; in sys_dlist_len() local
548 SYS_DLIST_FOR_EACH_NODE(list, node) { in sys_dlist_len()