kernel: use LIST_DEFINE and list_drain

This commit is contained in:
wnstngs
2026-10-07 21:34:12 +03:00
parent 5180e693d9
commit 8b9fcf54bb
3 changed files with 3 additions and 5 deletions
+1 -2
View File
@@ -164,8 +164,7 @@ static void writer_thread(void) {
__assert(written == block_count * abc->block_size);
}
list_node_t *list_node;
while ((list_node = list_pop_front(&internal_list)) != NULL) {
list_drain_front (&internal_list, list_node) {
abc_block_t *blk = (abc_block_t *)list_node;
if (__atomic_and_fetch(&blk->flags, ~ABC_BLOCK_FLAGS_BUSY, __ATOMIC_ACQUIRE) & ABC_BLOCK_FLAGS_DIRTY) {
pushlock_acquire_exclusive(&abc->dirty_list_lock);
+1 -2
View File
@@ -59,8 +59,7 @@ void vfs_root_event_signal(void) {
root_mounted = true;
MUTEX_RELEASE(&root_event_mutex);
list_node_t *node;
while ((node = list_pop_front(&root_event_list)) != NULL) {
list_drain_front (&root_event_list, node) {
root_event_waiter_t *rew = (root_event_waiter_t *)node;
rew->fn(rew->ctx);
free(rew);
+1 -1
View File
@@ -11,7 +11,7 @@
#define SOCKET_BUFFER (16 * 1024)
SPINLOCK_DEFINE(list_lock);
static list_node_t socket_list = LIST_INIT_VALUE(socket_list);
static LIST_DEFINE(socket_list);
typedef struct {
uint8_t sender[6];