2 * klist.h - Some generic list helpers, extending struct list_head a bit.
4 * Implementations are found in lib/klist.c
7 * Copyright (C) 2005 Patrick Mochel
9 * This file is rleased under the GPL v2.
12 #include <linux/spinlock.h>
13 #include <linux/completion.h>
14 #include <linux/kref.h>
15 #include <linux/list.h>
20 struct list_head k_list
;
24 extern void klist_init(struct klist
* k
);
28 struct klist
* n_klist
;
29 struct list_head n_node
;
31 struct completion n_removed
;
34 extern void klist_add_tail(struct klist
* k
, struct klist_node
* n
);
35 extern void klist_add_head(struct klist
* k
, struct klist_node
* n
);
37 extern void klist_del(struct klist_node
* n
);
38 extern void klist_remove(struct klist_node
* n
);
40 extern int klist_node_attached(struct klist_node
* n
);
44 struct klist
* i_klist
;
45 struct list_head
* i_head
;
46 struct klist_node
* i_cur
;
50 extern void klist_iter_init(struct klist
* k
, struct klist_iter
* i
);
51 extern void klist_iter_init_node(struct klist
* k
, struct klist_iter
* i
,
52 struct klist_node
* n
);
53 extern void klist_iter_exit(struct klist_iter
* i
);
54 extern struct klist_node
* klist_next(struct klist_iter
* i
);