summaryrefslogtreecommitdiffstats
path: root/dlink.h
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2001-07-26 07:00:09 +0000
committerNeil Brown <neilb@suse.de>2001-07-26 07:00:09 +0000
commit82b27616de634964db1a71bd5d9813db71e391a1 (patch)
tree310a2ed60dbb0903c73ba261914da269e9ec9072 /dlink.h
parent682c705194a869b882cd710d5f996142912db390 (diff)
downloadmdadm-82b27616de634964db1a71bd5d9813db71e391a1.tar.gz
mdadm-82b27616de634964db1a71bd5d9813db71e391a1.tar.xz
mdadm-82b27616de634964db1a71bd5d9813db71e391a1.zip
mdctl-v0.4mdctl-v0.4
Diffstat (limited to 'dlink.h')
-rw-r--r--dlink.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/dlink.h b/dlink.h
new file mode 100644
index 0000000..aa178e6
--- /dev/null
+++ b/dlink.h
@@ -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*);