From beb116954b9b7f3bb56412b2494b562f02b864b1 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 7 Jan 1997 02:33:00 +0000 Subject: Import of Linux/MIPS 2.1.14 --- include/linux/lists.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 include/linux/lists.h (limited to 'include/linux/lists.h') diff --git a/include/linux/lists.h b/include/linux/lists.h new file mode 100644 index 000000000..04f905aaf --- /dev/null +++ b/include/linux/lists.h @@ -0,0 +1,40 @@ +/* + * lists.h: Simple list macros for Linux + */ + +#define DLNODE(ptype) \ + struct { \ + ptype * dl_prev; \ + ptype * dl_next; \ + } + +#define DNODE_SINGLE(node) {(node),(node)} +#define DNODE_NULL {0,0} + +#define DLIST_INIT(listnam) \ + (listnam).dl_prev = &(listnam); \ + (listnam).dl_last = &(listnam); + +#define DLIST_NEXT(listnam) listnam.dl_next +#define DLIST_PREV(listnam) listnam.dl_prev + +#define DLIST_INSERT_AFTER(node, new, listnam) do { \ + (new)->listnam.dl_prev = (node); \ + (new)->listnam.dl_next = (node)->listnam.dl_next; \ + (node)->listnam.dl_next->listnam.dl_prev = (new); \ + (node)->listnam.dl_next = (new); \ + } while (0) + +#define DLIST_INSERT_BEFORE(node, new, listnam) do { \ + (new)->listnam.dl_next = (node); \ + (new)->listnam.dl_prev = (node)->listnam.dl_prev; \ + (node)->listnam.dl_prev->listnam.dl_next = (new); \ + (node)->listnam.dl_prev = (new); \ + } while (0) + +#define DLIST_DELETE(node, listnam) do { \ + node->listnam.dl_prev->listnam.dl_next = \ + node->listnam.dl_next; \ + node->listnam.dl_next->listnam.dl_prev = \ + node->listnam.dl_prev; \ + } while (0) -- cgit v1.2.3