diff --git a/kernel-src/fs/abc.c b/kernel-src/fs/abc.c index 85d8d7a7..15d63447 100644 --- a/kernel-src/fs/abc.c +++ b/kernel-src/fs/abc.c @@ -77,7 +77,7 @@ static void writer_thread(void) { interrupt_loweripl(ipl); for (;;) { - list_t internal_list; + list_node_t internal_list; list_init(&internal_list); eventlistener_t listener; diff --git a/kernel-src/fs/vfs.c b/kernel-src/fs/vfs.c index 714426f8..81c0723d 100644 --- a/kernel-src/fs/vfs.c +++ b/kernel-src/fs/vfs.c @@ -50,7 +50,7 @@ typedef struct { void *ctx; } root_event_waiter_t; -static list_t root_event_list; +static list_node_t root_event_list; static bool root_mounted; static mutex_t root_event_mutex; diff --git a/kernel-src/include/kernel/abc.h b/kernel-src/include/kernel/abc.h index 26c85de6..af80f892 100644 --- a/kernel-src/include/kernel/abc.h +++ b/kernel-src/include/kernel/abc.h @@ -25,7 +25,7 @@ typedef struct { size_t block_size; pushlock_t dirty_list_lock; - list_t dirty_list; + list_node_t dirty_list; bool syncing; eventheader_t dirty_list_sync_event; eventheader_t dirty_list_empty_event; diff --git a/kernel-src/include/kernel/input.h b/kernel-src/include/kernel/input.h index 902edb9d..5179dc58 100644 --- a/kernel-src/include/kernel/input.h +++ b/kernel-src/include/kernel/input.h @@ -264,7 +264,7 @@ typedef struct { struct input_device { spinlock_t lock; - list_t listeners; + list_node_t listeners; int clock_id; diff --git a/kernel-src/include/kernel/scheduler.h b/kernel-src/include/kernel/scheduler.h index 6060ea69..52d8f294 100644 --- a/kernel-src/include/kernel/scheduler.h +++ b/kernel-src/include/kernel/scheduler.h @@ -20,12 +20,12 @@ #define SCHED_SLEEP_TIME_LIMIT_CPU_US 1000 typedef struct { - list_t queues[SCHED_RUN_QUEUE_SIZE]; + list_node_t queues[SCHED_RUN_QUEUE_SIZE]; bitmap_t thread_bitmap; } sched_run_queue_t; typedef struct { - list_t queues[SCHED_RUN_QUEUE_SIZE]; + list_node_t queues[SCHED_RUN_QUEUE_SIZE]; int ins; int run; size_t thread_count; diff --git a/kernel-src/include/kernel/work.h b/kernel-src/include/kernel/work.h index 451de36c..7056d1eb 100644 --- a/kernel-src/include/kernel/work.h +++ b/kernel-src/include/kernel/work.h @@ -11,9 +11,9 @@ typedef void (*work_callback_t)(void *, size_t); typedef struct { const char *name; spinlock_t lock; - list_t work_list; - list_t active_list; - list_t waiter_list; + list_node_t work_list; + list_node_t active_list; + list_node_t waiter_list; semaphore_t pending_work; thread_t **threads; size_t thread_count; diff --git a/kernel-src/include/kernel/xhci.h b/kernel-src/include/kernel/xhci.h index 60808762..5bd2feda 100644 --- a/kernel-src/include/kernel/xhci.h +++ b/kernel-src/include/kernel/xhci.h @@ -377,7 +377,7 @@ typedef struct xhci_ctrl { usb_ctrl_t ctrl; pcienum_t *pci_enum; - list_t hubs; + list_node_t hubs; uint32_t port_count; uint32_t slot_count; @@ -394,7 +394,7 @@ typedef struct xhci_ctrl { spinlock_t event_lock; mutex_t callback_mutex; bitmap_t port_change_bitmap; - list_t completion_list; + list_node_t completion_list; ringbuffer_t callback_ring; dpc_t dpc; diff --git a/kernel-src/include/list.h b/kernel-src/include/list.h index e1836264..2f2812bd 100644 --- a/kernel-src/include/list.h +++ b/kernel-src/include/list.h @@ -9,35 +9,33 @@ typedef struct _list_node { struct _list_node *next; } list_node_t; -typedef list_node_t list_t; +#define LIST_INIT_VALUE(NAME) ((list_node_t) {.prev = &(NAME), .next = &(NAME)}) -#define LIST_INIT_VALUE(NAME) ((list_t) {.prev = &(NAME), .next = &(NAME)}) - -static inline void list_init(list_t *list) { +static inline void list_init(list_node_t *list) { list->prev = list; list->next = list; } -static inline bool list_is_empty(const list_t *list) { +static inline bool list_is_empty(const list_node_t *list) { return list->next == list; } -static inline list_node_t *list_get_first(const list_t *list) { +static inline list_node_t *list_get_first(const list_node_t *list) { return list_is_empty(list) ? NULL : list->next; } -static inline list_node_t *list_get_last(const list_t *list) { +static inline list_node_t *list_get_last(const list_node_t *list) { return list_is_empty(list) ? NULL : list->prev; } -static inline void list_push_front(list_t *list, list_node_t *node) { +static inline void list_push_front(list_node_t *list, list_node_t *node) { node->prev = list; node->next = list->next; list->next->prev = node; list->next = node; } -static inline void list_push_back(list_t *list, list_node_t *node) { +static inline void list_push_back(list_node_t *list, list_node_t *node) { node->next = list; node->prev = list->prev; list->prev->next = node; @@ -51,7 +49,7 @@ static inline void list_remove(list_node_t *node) { node->next = NULL; } -static inline list_node_t *list_pop_front(list_t *list) { +static inline list_node_t *list_pop_front(list_node_t *list) { list_node_t *node = list->next; if (node == list) return NULL; @@ -59,7 +57,7 @@ static inline list_node_t *list_pop_front(list_t *list) { return node; } -static inline list_node_t *list_pop_back(list_t *list) { +static inline list_node_t *list_pop_back(list_node_t *list) { list_node_t *node = list->prev; if (node == list) return NULL; diff --git a/kernel-src/include/x86-64/arch/cpu.h b/kernel-src/include/x86-64/arch/cpu.h index 7ff3778a..5b2cb638 100644 --- a/kernel-src/include/x86-64/arch/cpu.h +++ b/kernel-src/include/x86-64/arch/cpu.h @@ -46,7 +46,7 @@ typedef struct cpu_t { timer_t *timer; isr_t *dpcisr; - list_t dpcqueue; + list_node_t dpcqueue; thread_t *idlethread; timerentry_t schedtimerentry; diff --git a/kernel-src/io/acpi/glue.c b/kernel-src/io/acpi/glue.c index 186e44f4..61cb23aa 100644 --- a/kernel-src/io/acpi/glue.c +++ b/kernel-src/io/acpi/glue.c @@ -365,7 +365,7 @@ struct acpi_work { struct acpi_workctx { work_queue_t *queue; spinlock_t pool_lock; - list_t free_list; + list_node_t free_list; struct acpi_work pool[ACPI_WORK_POOL_SIZE]; bool target_bsp; }; diff --git a/kernel-src/io/audio/hda.c b/kernel-src/io/audio/hda.c index a935176c..cd9dfc04 100644 --- a/kernel-src/io/audio/hda.c +++ b/kernel-src/io/audio/hda.c @@ -197,7 +197,7 @@ typedef struct hda hda_t; typedef struct hda_output_path hda_output_path_t; typedef struct { - list_t waiter_list; + list_node_t waiter_list; spinlock_t waiter_list_lock; size_t function_group_count; size_t starting_node; @@ -630,7 +630,7 @@ static hda_path_t hda_find_path(hda_fg_t *fg, hda_widget_t *pin, int goal_type) hda_path_t path; } path_entry_t; - list_t queue; + list_node_t queue; list_init(&queue); bool *visited = alloc(sizeof(bool) * fg->widget_count); diff --git a/kernel-src/io/net/raw.c b/kernel-src/io/net/raw.c index 3c668b56..97ccfea2 100644 --- a/kernel-src/io/net/raw.c +++ b/kernel-src/io/net/raw.c @@ -11,7 +11,7 @@ #define SOCKET_BUFFER (16 * 1024) SPINLOCK_DEFINE(list_lock); -static list_t socket_list = LIST_INIT_VALUE(socket_list); +static list_node_t socket_list = LIST_INIT_VALUE(socket_list); typedef struct { uint8_t sender[6]; diff --git a/kernel-src/sys/syscalls/futex.c b/kernel-src/sys/syscalls/futex.c index 66bdfc65..09dfde92 100644 --- a/kernel-src/sys/syscalls/futex.c +++ b/kernel-src/sys/syscalls/futex.c @@ -20,7 +20,7 @@ typedef struct { typedef struct { mutex_t mutex; - list_t list; + list_node_t list; } futex_bucket_t; #define BUCKET_COUNT 256