Files
net/exec/list.h
2025-12-20 18:49:21 -08:00

47 lines
1.1 KiB
C

#pragma once
#include <exec/sync.h>
#include <stdint.h>
#define LP_NONE 0
#define LP_CLI 1
#define LP_SPIN 2
#define LP_BLOCK 3
struct List {
struct Node *head;
struct Node *tail;
struct Node *tailPrev;
uint8_t type;
uint32_t length;
struct Semaphore semaphore;
};
struct Node {
struct Node *next;
struct Node *prev;
int8_t priority;
uint8_t type;
char *name;
};
struct PriMinNode {
struct Node *next;
struct Node *prev;
int8_t priority;
};
struct MinNode {
struct Node *next;
struct Node *prev;
};
void NewList(struct List *list, int protect);
void Enqueue(struct List *list, struct Node *node);
void Insert(struct List *list, struct Node *node, struct Node *after);
void Remove(struct List *list, struct Node *node);
void AddHead(struct List *list, struct Node *node);
void AddTail(struct List *list, struct Node *node);
struct Node *RemHead(struct List *list);
struct Node *RemTail(struct List *list);
struct Node *FindNode(struct List *list, char *name);
void SetPriority(struct Node *node, int8_t priority);