summaryrefslogtreecommitdiffstats
path: root/dlink.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:55:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:55:34 +0000
commit7f1d6c8fec531fa1762d6d65576aecbee837982c (patch)
treeb37177c380fa30d0336aad7cac9c72035523206a /dlink.h
parentInitial commit. (diff)
downloadmdadm-7f1d6c8fec531fa1762d6d65576aecbee837982c.tar.xz
mdadm-7f1d6c8fec531fa1762d6d65576aecbee837982c.zip
Adding upstream version 4.3.upstream/4.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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..ab2a945
--- /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
+{
+ void * dh_prev;
+ void * dh_next;
+};
+
+#define dl_alloc(size) ((void*)(((char*)xcalloc(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) *(&(((struct __dl_head*)(p))[-1].dh_next))
+#define dl_prev(p) *(&(((struct __dl_head*)(p))[-1].dh_prev))
+
+void *dl_head(void);
+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*);