Coda Distributed File System
dllist.h
Go to the documentation of this file.
1/* BLURB lgpl
2
3 Coda File System
4 Release 5
5
6 Copyright (c) 1987-1999 Carnegie Mellon University
7 Additional copyrights listed below
8
9This code is distributed "AS IS" without warranty of any kind under
10the terms of the GNU Library General Public Licence Version 2, as
11shown in the file LICENSE. The technical and financial contributors to
12Coda are listed in the file CREDITS.
13
14 Additional copyrights
15 none currently
16
17#*/
18
19#ifndef _DLLIST_H_
20#define _DLLIST_H_
21
22/* based on linux kernel code lists. */
23
24struct list_head {
25 struct list_head *next, *prev;
26};
27
28#define list_entry(ptr, type, member) \
29 ((type *)((char *)(ptr) - (unsigned long)(&((type *)0)->member)))
30
31#define list_init(head) \
32 do { \
33 struct list_head *h = head; \
34 h->prev = h->next = h; \
35 } while (0);
36
37#define list_add(entry, head) \
38 do { \
39 struct list_head *h = head, *e = entry; \
40 h->next->prev = e; \
41 e->next = h->next; \
42 e->prev = h; \
43 h->next = e; \
44 } while (0);
45
46#define list_del(entry) \
47 do { \
48 struct list_head *e = entry; \
49 e->prev->next = e->next; \
50 e->next->prev = e->prev; \
51 e->prev = e->next = e; \
52 } while (0);
53
54#define list_empty(head) ((head)->next == head)
55#define list_for_each(ptr, head) \
56 for (ptr = (head)->next; ptr != head; ptr = ptr->next)
57
58#endif /* _DLLIST_H_ */
Definition: dllist.h:24
struct list_head * prev
Definition: dllist.h:25
struct list_head * next
Definition: dllist.h:25