vbos/include/lib/list.h
Michael Shaw 2076f1dae1
lock: merge spinlock and mtx locks into one
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
2026-08-13 14:19:10 -04:00

31 lines
626 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _LIST_H_
#define _LIST_H_
#include <kernel/lock.h>
typedef struct _list_item {
union {
void *ptr;
u64 val;
};
struct _list_head *list;
struct _list_item *next;
struct _list_item *prev;
} list_item_t;
typedef struct _list_head {
struct _list_item *head;
struct _list_item *tail;
lock_t lock;
} list_t;
void list_create(list_t *list);
void list_destroy(list_t *list);
list_item_t *list_insert(list_t *list, void *item);
void list_remove(list_item_t *item);
void list_lock(list_t *list);
void list_unlock(list_t *list);
void list_init();
#endif /* _LIST_H_ */