diff options
author | Neil Brown <neilb@suse.de> | 2001-07-26 07:00:09 +0000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2001-07-26 07:00:09 +0000 |
commit | 82b27616de634964db1a71bd5d9813db71e391a1 (patch) | |
tree | 310a2ed60dbb0903c73ba261914da269e9ec9072 /dlink.h | |
parent | 682c705194a869b882cd710d5f996142912db390 (diff) | |
download | mdadm-82b27616de634964db1a71bd5d9813db71e391a1.tar.gz mdadm-82b27616de634964db1a71bd5d9813db71e391a1.tar.xz mdadm-82b27616de634964db1a71bd5d9813db71e391a1.zip |
mdctl-v0.4mdctl-v0.4
Diffstat (limited to 'dlink.h')
-rw-r--r-- | dlink.h | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ + +/* doubley linked lists */ +/* This is free software. No strings attached. No copyright claimed */ + +struct __dl_head +{ + struct __dl_head * dh_prev; + struct __dl_head * dh_next; +}; + +#define dl_alloc(size) ((void*)(((char*)calloc(1,(size)+sizeof(struct __dl_head)))+sizeof(struct __dl_head))) +#define dl_new(t) ((t*)dl_alloc(sizeof(t))) +#define dl_newv(t,n) ((t*)dl_alloc(sizeof(t)*n)) + +#define dl_next(p) *((void**)&(((struct __dl_head*)(p))[-1].dh_next)) +#define dl_prev(p) *((void**)&(((struct __dl_head*)(p))[-1].dh_prev)) + +void *dl_head(); +char *dl_strdup(char *); +char *dl_strndup(char *, int); +void dl_insert(void*, void*); +void dl_add(void*, void*); +void dl_del(void*); +void dl_free(void*); +void dl_init(void*); |