]> git.ipfire.org Git - thirdparty/mdadm.git/blame - dlink.h
imsm: FIX: Function rework - imsm_count_failed()
[thirdparty/mdadm.git] / dlink.h
CommitLineData
82b27616
NB
1
2/* doubley linked lists */
3/* This is free software. No strings attached. No copyright claimed */
4
5struct __dl_head
6{
b1ec2d6a
NB
7 void * dh_prev;
8 void * dh_next;
82b27616
NB
9};
10
11#define dl_alloc(size) ((void*)(((char*)calloc(1,(size)+sizeof(struct __dl_head)))+sizeof(struct __dl_head)))
12#define dl_new(t) ((t*)dl_alloc(sizeof(t)))
13#define dl_newv(t,n) ((t*)dl_alloc(sizeof(t)*n))
14
b1ec2d6a
NB
15#define dl_next(p) *(&(((struct __dl_head*)(p))[-1].dh_next))
16#define dl_prev(p) *(&(((struct __dl_head*)(p))[-1].dh_prev))
82b27616 17
e0d19036 18void *dl_head(void);
82b27616
NB
19char *dl_strdup(char *);
20char *dl_strndup(char *, int);
21void dl_insert(void*, void*);
22void dl_add(void*, void*);
23void dl_del(void*);
24void dl_free(void*);
25void dl_init(void*);