diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-01-07 02:33:00 +0000 |
---|---|---|
committer | <ralf@linux-mips.org> | 1997-01-07 02:33:00 +0000 |
commit | beb116954b9b7f3bb56412b2494b562f02b864b1 (patch) | |
tree | 120e997879884e1b9d93b265221b939d2ef1ade1 /include/linux/lists.h | |
parent | 908d4681a1dc3792ecafbe64265783a86c4cccb6 (diff) |
Import of Linux/MIPS 2.1.14
Diffstat (limited to 'include/linux/lists.h')
-rw-r--r-- | include/linux/lists.h | 40 |
1 files changed, 40 insertions, 0 deletions
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) |