mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
kernel: use LIST_DEFINE and list_drain
This commit is contained in:
+1
-2
@@ -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
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user