debuggers.hg

view tools/blktap/list.h @ 6649:f59e0163540e

Updates to blktap driver and user code.

Mostly this makes the tap code work again with all of the changes that
have happened to the block drivers recently. We now use a shared page
per VBD (to the driver), and handle control information through the
store. The taplib interfaces have changed to be based around per-vbd
data structures that you can attach arbitrary handlers for.

There is also initial code for a user-level blockback driver, which
aims to get around the use of loopbacks for file-based vbds. Still
plenty of work to do here -- this is a working incremental checkin and
I'm away from this for the next four weeks.

Signed-off-by: Andrew Warfield <andrew.warfield@cl.cam.ac.uk>
author akw27@arcadians.cl.cam.ac.uk
date Sun Sep 04 21:19:44 2005 +0000 (2005-09-04)
parents
children b2f4823b6ff0 b35215021b32 9af349b055e5 3233e7ecfa9f
line source
1 /*
2 * list.h
3 *
4 * This is a subset of linux's list.h intended to be used in user-space.
5 *
6 */
8 #ifndef __LIST_H__
9 #define __LIST_H__
11 #define LIST_POISON1 ((void *) 0x00100100)
12 #define LIST_POISON2 ((void *) 0x00200200)
14 struct list_head {
15 struct list_head *next, *prev;
16 };
18 #define LIST_HEAD_INIT(name) { &(name), &(name) }
20 #define LIST_HEAD(name) \
21 struct list_head name = LIST_HEAD_INIT(name)
23 static inline void __list_add(struct list_head *new,
24 struct list_head *prev,
25 struct list_head *next)
26 {
27 next->prev = new;
28 new->next = next;
29 new->prev = prev;
30 prev->next = new;
31 }
33 static inline void list_add(struct list_head *new, struct list_head *head)
34 {
35 __list_add(new, head, head->next);
36 }
37 static inline void __list_del(struct list_head * prev, struct list_head * next)
38 {
39 next->prev = prev;
40 prev->next = next;
41 }
42 static inline void list_del(struct list_head *entry)
43 {
44 __list_del(entry->prev, entry->next);
45 entry->next = LIST_POISON1;
46 entry->prev = LIST_POISON2;
47 }
48 #define list_entry(ptr, type, member) \
49 ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
50 #define list_for_each_entry(pos, head, member) \
51 for (pos = list_entry((head)->next, typeof(*pos), member); \
52 &pos->member != (head); \
53 pos = list_entry(pos->member.next, typeof(*pos), member))
55 #endif /* __LIST_H__ */