mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +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);
|
__assert(written == block_count * abc->block_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_node_t *list_node;
|
list_drain_front (&internal_list, list_node) {
|
||||||
while ((list_node = list_pop_front(&internal_list)) != NULL) {
|
|
||||||
abc_block_t *blk = (abc_block_t *)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) {
|
if (__atomic_and_fetch(&blk->flags, ~ABC_BLOCK_FLAGS_BUSY, __ATOMIC_ACQUIRE) & ABC_BLOCK_FLAGS_DIRTY) {
|
||||||
pushlock_acquire_exclusive(&abc->dirty_list_lock);
|
pushlock_acquire_exclusive(&abc->dirty_list_lock);
|
||||||
|
|||||||
+1
-2
@@ -59,8 +59,7 @@ void vfs_root_event_signal(void) {
|
|||||||
root_mounted = true;
|
root_mounted = true;
|
||||||
MUTEX_RELEASE(&root_event_mutex);
|
MUTEX_RELEASE(&root_event_mutex);
|
||||||
|
|
||||||
list_node_t *node;
|
list_drain_front (&root_event_list, node) {
|
||||||
while ((node = list_pop_front(&root_event_list)) != NULL) {
|
|
||||||
root_event_waiter_t *rew = (root_event_waiter_t *)node;
|
root_event_waiter_t *rew = (root_event_waiter_t *)node;
|
||||||
rew->fn(rew->ctx);
|
rew->fn(rew->ctx);
|
||||||
free(rew);
|
free(rew);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#define SOCKET_BUFFER (16 * 1024)
|
#define SOCKET_BUFFER (16 * 1024)
|
||||||
|
|
||||||
SPINLOCK_DEFINE(list_lock);
|
SPINLOCK_DEFINE(list_lock);
|
||||||
static list_node_t socket_list = LIST_INIT_VALUE(socket_list);
|
static LIST_DEFINE(socket_list);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t sender[6];
|
uint8_t sender[6];
|
||||||
|
|||||||
Reference in New Issue
Block a user