From 0d4dc3c84e68470c1ef3dc115c6a619440626b53 Mon Sep 17 00:00:00 2001 From: sbosse Date: Mon, 14 Oct 2024 23:07:45 +0200 Subject: [PATCH] Mon 14 Oct 23:06:38 CEST 2024 --- kernel/list.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 kernel/list.h diff --git a/kernel/list.h b/kernel/list.h new file mode 100644 index 0000000..a2c8f4b --- /dev/null +++ b/kernel/list.h @@ -0,0 +1,36 @@ +/* +Copyright (C) 2015-2019 The University of Notre Dame +This software is distributed under the GNU General Public License. +See the file LICENSE for details. +*/ + +#ifndef LIST_H +#define LIST_H + +struct list; +struct list_node; + +struct list { + struct list_node *head; + struct list_node *tail; + int size; +}; + +struct list_node { + struct list_node *next; + struct list_node *prev; + struct list *list; + int priority; +}; + +#define LIST_INIT {0,0} + +void list_push_head(struct list *list, struct list_node *node); +void list_push_tail(struct list *list, struct list_node *node); +void list_push_priority(struct list *list, struct list_node *node, int pri); +struct list_node *list_pop_head(struct list *list); +struct list_node *list_pop_tail(struct list *list); +void list_remove(struct list_node *n); +int list_size(struct list *list); + +#endif