25#ifndef ZEPHYR_INCLUDE_SYS_SFLIST_H_
26#define ZEPHYR_INCLUDE_SYS_SFLIST_H_
71#define SYS_SFLIST_FOR_EACH_NODE(__sl, __sn) \
72 Z_GENLIST_FOR_EACH_NODE(sflist, __sl, __sn)
94#define SYS_SFLIST_ITERATE_FROM_NODE(__sl, __sn) \
95 Z_GENLIST_ITERATE_FROM_NODE(sflist, __sl, __sn)
113#define SYS_SFLIST_FOR_EACH_NODE_SAFE(__sl, __sn, __sns) \
114 Z_GENLIST_FOR_EACH_NODE_SAFE(sflist, __sl, __sn, __sns)
124#define SYS_SFLIST_CONTAINER(__ln, __cn, __n) \
125 Z_GENLIST_CONTAINER(__ln, __cn, __n)
134#define SYS_SFLIST_PEEK_HEAD_CONTAINER(__sl, __cn, __n) \
135 Z_GENLIST_PEEK_HEAD_CONTAINER(sflist, __sl, __cn, __n)
144#define SYS_SFLIST_PEEK_TAIL_CONTAINER(__sl, __cn, __n) \
145 Z_GENLIST_PEEK_TAIL_CONTAINER(sflist, __sl, __cn, __n)
153#define SYS_SFLIST_PEEK_NEXT_CONTAINER(__cn, __n) \
154 Z_GENLIST_PEEK_NEXT_CONTAINER(sflist, __cn, __n)
170#define SYS_SFLIST_FOR_EACH_CONTAINER(__sl, __cn, __n) \
171 Z_GENLIST_FOR_EACH_CONTAINER(sflist, __sl, __cn, __n)
188#define SYS_SFLIST_FOR_EACH_CONTAINER_SAFE(__sl, __cn, __cns, __n) \
189 Z_GENLIST_FOR_EACH_CONTAINER_SAFE(sflist, __sl, __cn, __cns, __n)
214#define SYS_SFLIST_STATIC_INIT(ptr_to_list) {NULL, NULL}
217#define SYS_SFLIST_FLAGS_MASK ((uintptr_t)(__alignof__(sys_sfnode_t) - 1))
223 return (
sys_sfnode_t *)(node->next_and_flags & ~SYS_SFLIST_FLAGS_MASK);
228static inline void z_sfnode_next_set(
sys_sfnode_t *parent,
233 parent->next_and_flags = cur_flags | (
uintptr_t)child;
303 node->next_and_flags =
flags;
320 node->next_and_flags = (
uintptr_t)(z_sfnode_next_peek(node)) |
flags;
336Z_GENLIST_IS_EMPTY(sflist)
349Z_GENLIST_PEEK_NEXT_NO_CHECK(sflist, sfnode)
360Z_GENLIST_PEEK_NEXT(sflist, sfnode)
373Z_GENLIST_PREPEND(sflist, sfnode)
386Z_GENLIST_APPEND(sflist, sfnode)
402 void *head,
void *tail);
404Z_GENLIST_APPEND_LIST(sflist, sfnode)
418Z_GENLIST_MERGE_LIST(sflist, sfnode)
433Z_GENLIST_INSERT(sflist, sfnode)
447Z_GENLIST_GET_NOT_EMPTY(sflist, sfnode)
460Z_GENLIST_GET(sflist, sfnode)
476Z_GENLIST_REMOVE(sflist, sfnode)
491Z_GENLIST_FIND_AND_REMOVE(sflist, sfnode)
502Z_GENLIST_LEN(sflist, sfnode)
struct _sfnode sys_sfnode_t
Flagged single-linked list node structure.
Definition: sflist.h:44
static sys_sfnode_t * sys_sflist_get_not_empty(sys_sflist_t *list)
Fetch and remove the first node of the given list.
Definition: sflist.h:447
static uint8_t sys_sfnode_flags_get(sys_sfnode_t *node)
Fetch flags value for a particular sfnode.
Definition: sflist.h:281
static sys_sfnode_t * sys_sflist_get(sys_sflist_t *list)
Fetch and remove the first node of the given list.
Definition: sflist.h:460
#define SYS_SFLIST_FLAGS_MASK
Definition: sflist.h:217
static sys_sfnode_t * sys_sflist_peek_next(sys_sfnode_t *node)
Peek the next node from current node.
Definition: sflist.h:360
static void sys_sflist_remove(sys_sflist_t *list, sys_sfnode_t *prev_node, sys_sfnode_t *node)
Remove a node.
Definition: sflist.h:476
static void sys_sflist_merge_sflist(sys_sflist_t *list, sys_sflist_t *list_to_append)
merge two sflists, appending the second one to the first
Definition: sflist.h:418
static sys_sfnode_t * sys_sflist_peek_head(sys_sflist_t *list)
Peek the first node from the list.
Definition: sflist.h:253
static void sys_sflist_append(sys_sflist_t *list, sys_sfnode_t *node)
Append a node to the given list.
Definition: sflist.h:386
static void sys_sflist_prepend(sys_sflist_t *list, sys_sfnode_t *node)
Prepend a node to the given list.
Definition: sflist.h:373
static void sys_sfnode_flags_set(sys_sfnode_t *node, uint8_t flags)
Set flags value for an sflist node.
Definition: sflist.h:317
static void sys_sflist_insert(sys_sflist_t *list, sys_sfnode_t *prev, sys_sfnode_t *node)
Insert a node to the given list.
Definition: sflist.h:433
static void sys_sflist_init(sys_sflist_t *list)
Initialize a list.
Definition: sflist.h:204
struct _sflist sys_sflist_t
Flagged single-linked list structure.
Definition: sflist.h:54
static size_t sys_sflist_len(sys_sflist_t *list)
Compute the size of the given list in O(n) time.
Definition: sflist.h:502
static sys_sfnode_t * sys_sflist_peek_next_no_check(sys_sfnode_t *node)
Peek the next node from current node, node is not NULL.
Definition: sflist.h:349
static void sys_sflist_append_list(sys_sflist_t *list, void *head, void *tail)
Append a list to the given list.
Definition: sflist.h:404
static sys_sfnode_t * sys_sflist_peek_tail(sys_sflist_t *list)
Peek the last node from the list.
Definition: sflist.h:265
static bool sys_sflist_is_empty(sys_sflist_t *list)
Test if the given list is empty.
Definition: sflist.h:336
static bool sys_sflist_find_and_remove(sys_sflist_t *list, sys_sfnode_t *node)
Find and remove a node from a list.
Definition: sflist.h:491
static void sys_sfnode_init(sys_sfnode_t *node, uint8_t flags)
Initialize an sflist node.
Definition: sflist.h:300
flags
Definition: parser.h:96
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINTPTR_TYPE__ uintptr_t
Definition: stdint.h:105