REORG: include: split mini-clist into haproxy/list and list-t.h

Half of the users of this include only need the type definitions and
not the manipulation macros nor the inline functions. Moves the various
types into mini-clist-t.h makes the files cleaner. The other one had all
its includes grouped at the top. A few files continued to reference it
without using it and were cleaned.

In addition it was about time that we'd rename that file, it's not
"mini" anymore and contains a bit more than just circular lists.
diff --git a/include/common/cfgparse.h b/include/common/cfgparse.h
index 8ecb771..86f87bf 100644
--- a/include/common/cfgparse.h
+++ b/include/common/cfgparse.h
@@ -23,7 +23,7 @@
 #define _COMMON_CFGPARSE_H
 
 #include <haproxy/api.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 
 #include <proto/log.h>
 #include <proto/proxy.h>
diff --git a/include/common/memory.h b/include/common/memory.h
index 8b03daf..d80b486 100644
--- a/include/common/memory.h
+++ b/include/common/memory.h
@@ -29,7 +29,7 @@
 #include <unistd.h>
 
 #include <haproxy/api.h>
-#include <common/mini-clist.h>
+#include <haproxy/list.h>
 #include <common/hathreads.h>
 
 /* On architectures supporting threads and double-word CAS, we can implement
diff --git a/include/haproxy/list-t.h b/include/haproxy/list-t.h
new file mode 100644
index 0000000..dd8493e
--- /dev/null
+++ b/include/haproxy/list-t.h
@@ -0,0 +1,73 @@
+/*
+ * include/haproxy/list-t.h
+ * Circular list manipulation types definitions
+ *
+ * Copyright (C) 2002-2020 Willy Tarreau - w@1wt.eu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, version 2.1
+ * exclusively.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef _HAPROXY_LIST_T_H
+#define _HAPROXY_LIST_T_H
+
+
+/* these are circular or bidirectionnal lists only. Each list pointer points to
+ * another list pointer in a structure, and not the structure itself. The
+ * pointer to the next element MUST be the first one so that the list is easily
+ * cast as a single linked list or pointer.
+ */
+struct list {
+    struct list *n;	/* next */
+    struct list *p;	/* prev */
+};
+
+/* This is similar to struct list, but we want to be sure the compiler will
+ * yell at you if you use macroes for one when you're using the other. You have
+ * to expicitely cast if that's really what you want to do.
+ */
+struct mt_list {
+    struct mt_list *next;
+    struct mt_list *prev;
+};
+
+
+/* a back-ref is a pointer to a target list entry. It is used to detect when an
+ * element being deleted is currently being tracked by another user. The best
+ * example is a user dumping the session table. The table does not fit in the
+ * output buffer so we have to set a mark on a session and go on later. But if
+ * that marked session gets deleted, we don't want the user's pointer to go in
+ * the wild. So we can simply link this user's request to the list of this
+ * session's users, and put a pointer to the list element in ref, that will be
+ * used as the mark for next iteration.
+ */
+struct bref {
+	struct list users;
+	struct list *ref; /* pointer to the target's list entry */
+};
+
+/* a word list is a generic list with a pointer to a string in each element. */
+struct wordlist {
+	struct list list;
+	char *s;
+};
+
+/* this is the same as above with an additional pointer to a condition. */
+struct cond_wordlist {
+	struct list list;
+	void *cond;
+	char *s;
+};
+
+#endif /* _HAPROXY_LIST_T_H */
diff --git a/include/common/mini-clist.h b/include/haproxy/list.h
similarity index 94%
rename from include/common/mini-clist.h
rename to include/haproxy/list.h
index 188d118..0281aa1 100644
--- a/include/common/mini-clist.h
+++ b/include/haproxy/list.h
@@ -1,8 +1,8 @@
 /*
- * include/common/mini-clist.h
- * Circular list manipulation macros and structures.
+ * include/haproxy/list.h
+ * Circular list manipulation macros and functions.
  *
- * Copyright (C) 2002-2014 Willy Tarreau - w@1wt.eu
+ * Copyright (C) 2002-2020 Willy Tarreau - w@1wt.eu
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -19,56 +19,12 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _COMMON_MINI_CLIST_H
-#define _COMMON_MINI_CLIST_H
+#ifndef _HAPROXY_LIST_H
+#define _HAPROXY_LIST_H
 
-
-/* these are circular or bidirectionnal lists only. Each list pointer points to
- * another list pointer in a structure, and not the structure itself. The
- * pointer to the next element MUST be the first one so that the list is easily
- * cast as a single linked list or pointer.
- */
-struct list {
-    struct list *n;	/* next */
-    struct list *p;	/* prev */
-};
-
-/* This is similar to struct list, but we want to be sure the compiler will
- * yell at you if you use macroes for one when you're using the other. You have
- * to expicitely cast if that's really what you want to do.
- */
-struct mt_list {
-    struct mt_list *next;
-    struct mt_list *prev;
-};
-
-
-/* a back-ref is a pointer to a target list entry. It is used to detect when an
- * element being deleted is currently being tracked by another user. The best
- * example is a user dumping the session table. The table does not fit in the
- * output buffer so we have to set a mark on a session and go on later. But if
- * that marked session gets deleted, we don't want the user's pointer to go in
- * the wild. So we can simply link this user's request to the list of this
- * session's users, and put a pointer to the list element in ref, that will be
- * used as the mark for next iteration.
- */
-struct bref {
-	struct list users;
-	struct list *ref; /* pointer to the target's list entry */
-};
-
-/* a word list is a generic list with a pointer to a string in each element. */
-struct wordlist {
-	struct list list;
-	char *s;
-};
-
-/* this is the same as above with an additional pointer to a condition. */
-struct cond_wordlist {
-	struct list list;
-	void *cond;
-	char *s;
-};
+#include <haproxy/api.h>
+#include <haproxy/list-t.h>
+#include <common/hathreads.h>
 
 /* First undefine some macros which happen to also be defined on OpenBSD,
  * in sys/queue.h, used by sys/event.h
@@ -257,15 +213,13 @@
 	     &item->member != (list_head);                               \
 	     item = back, back = LIST_ELEM(back->member.p, typeof(back), member))
 
-#include <haproxy/api.h>
-#include <common/hathreads.h>
-#define MT_LIST_BUSY ((struct mt_list *)1)
 
 /*
  * Locked version of list manipulation macros.
  * It is OK to use those concurrently from multiple threads, as long as the
  * list is only used with the locked variants.
  */
+#define MT_LIST_BUSY ((struct mt_list *)1)
 
 /*
  * Add an item at the beginning of a list.
@@ -733,4 +687,4 @@
 
 }
 
-#endif /* _COMMON_MINI_CLIST_H */
+#endif /* _HAPROXY_LIST_H */
diff --git a/include/proto/applet.h b/include/proto/applet.h
index ea8bc0b..aaa4903 100644
--- a/include/proto/applet.h
+++ b/include/proto/applet.h
@@ -26,7 +26,7 @@
 
 #include <haproxy/api.h>
 #include <common/memory.h>
-#include <common/mini-clist.h>
+#include <haproxy/list.h>
 #include <types/applet.h>
 #include <proto/task.h>
 
diff --git a/include/proto/http_rules.h b/include/proto/http_rules.h
index 27c4b6a..84f302d 100644
--- a/include/proto/http_rules.h
+++ b/include/proto/http_rules.h
@@ -23,7 +23,7 @@
 #define _PROTO_HTTP_RULES_H
 
 #include <haproxy/api.h>
-#include <common/mini-clist.h>
+#include <haproxy/list.h>
 #include <types/action.h>
 #include <types/proxy.h>
 
diff --git a/include/proto/queue.h b/include/proto/queue.h
index 8ef9179..9bec9b4 100644
--- a/include/proto/queue.h
+++ b/include/proto/queue.h
@@ -24,7 +24,6 @@
 
 #include <haproxy/api.h>
 #include <common/memory.h>
-#include <common/mini-clist.h>
 
 #include <types/proxy.h>
 #include <types/queue.h>
diff --git a/include/proto/shctx.h b/include/proto/shctx.h
index 25bf377..76f498f 100644
--- a/include/proto/shctx.h
+++ b/include/proto/shctx.h
@@ -14,7 +14,7 @@
 #ifndef SHCTX_H
 #define SHCTX_H
 
-#include <common/mini-clist.h>
+#include <haproxy/list.h>
 #include <types/shctx.h>
 
 #include <inttypes.h>
diff --git a/include/proto/sink.h b/include/proto/sink.h
index d30f30a..c0c75c3 100644
--- a/include/proto/sink.h
+++ b/include/proto/sink.h
@@ -22,7 +22,7 @@
 #ifndef _PROTO_SINK_H
 #define _PROTO_SINK_H
 
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <types/sink.h>
 
 extern struct list sink_list;
diff --git a/include/proto/task.h b/include/proto/task.h
index a42431a..944ada5 100644
--- a/include/proto/task.h
+++ b/include/proto/task.h
@@ -27,7 +27,7 @@
 
 #include <haproxy/api.h>
 #include <common/memory.h>
-#include <common/mini-clist.h>
+#include <haproxy/list.h>
 #include <common/standard.h>
 #include <common/ticks.h>
 #include <common/hathreads.h>
diff --git a/include/proto/trace.h b/include/proto/trace.h
index f43faf5..1447940 100644
--- a/include/proto/trace.h
+++ b/include/proto/trace.h
@@ -25,7 +25,7 @@
 #include <haproxy/api.h>
 #include <common/buffer.h>
 #include <import/ist.h>
-#include <common/mini-clist.h>
+#include <haproxy/list.h>
 #include <types/log.h>
 #include <types/sink.h>
 #include <types/trace.h>
diff --git a/include/types/acl.h b/include/types/acl.h
index 748f361..7afa3d8 100644
--- a/include/types/acl.h
+++ b/include/types/acl.h
@@ -23,7 +23,7 @@
 #define _TYPES_ACL_H
 
 #include <haproxy/api-t.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 
 #include <types/arg.h>
 #include <types/auth.h>
diff --git a/include/types/arg.h b/include/types/arg.h
index 60fd007..366c09e 100644
--- a/include/types/arg.h
+++ b/include/types/arg.h
@@ -26,7 +26,7 @@
 #include <netinet/in.h>
 
 #include <common/chunk.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 
 #include <types/vars.h>
 #include <types/protocol_buffers.h>
diff --git a/include/types/auth.h b/include/types/auth.h
index c10aced..f9b56f1 100644
--- a/include/types/auth.h
+++ b/include/types/auth.h
@@ -14,7 +14,7 @@
 #define _TYPES_AUTH_H
 
 #include <haproxy/api-t.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 
 #include <types/auth.h>
 
diff --git a/include/types/checks.h b/include/types/checks.h
index 6d07c9a..3ea4a06 100644
--- a/include/types/checks.h
+++ b/include/types/checks.h
@@ -18,7 +18,7 @@
 
 #include <common/standard.h>
 #include <import/ist.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <common/regex.h>
 #include <haproxy/buf-t.h>
 
diff --git a/include/types/cli.h b/include/types/cli.h
index 8a44124..41753c5 100644
--- a/include/types/cli.h
+++ b/include/types/cli.h
@@ -20,7 +20,7 @@
 #ifndef _TYPES_CLI_H
 #define _TYPES_CLI_H
 
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <types/applet.h>
 
 /* Access level for a stats socket */
diff --git a/include/types/dns.h b/include/types/dns.h
index 06afda8..84a8219 100644
--- a/include/types/dns.h
+++ b/include/types/dns.h
@@ -24,7 +24,7 @@
 
 #include <import/eb32tree.h>
 
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <common/hathreads.h>
 
 #include <types/connection.h>
diff --git a/include/types/fcgi-app.h b/include/types/fcgi-app.h
index 7fb20ee..c88dda3 100644
--- a/include/types/fcgi-app.h
+++ b/include/types/fcgi-app.h
@@ -25,7 +25,7 @@
 #include <haproxy/api-t.h>
 #include <import/ist.h>
 #include <common/fcgi.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <common/regex.h>
 
 #include <import/ebistree.h>
diff --git a/include/types/filters.h b/include/types/filters.h
index 5de4eee..2e06b83 100644
--- a/include/types/filters.h
+++ b/include/types/filters.h
@@ -22,7 +22,7 @@
 #define _TYPES_FILTERS_H
 
 #include <haproxy/api-t.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 
 struct http_msg;
 struct proxy;
diff --git a/include/types/listener.h b/include/types/listener.h
index 7374dc8..4314209 100644
--- a/include/types/listener.h
+++ b/include/types/listener.h
@@ -30,7 +30,7 @@
 #include <haproxy/openssl-compat.h>
 #endif
 
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <common/hathreads.h>
 
 #include <types/obj_type.h>
diff --git a/include/types/log.h b/include/types/log.h
index 2c2ac02..301c2bf 100644
--- a/include/types/log.h
+++ b/include/types/log.h
@@ -27,7 +27,7 @@
 #include <netinet/in.h>
 #include <haproxy/api-t.h>
 #include <common/hathreads.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <types/ring.h>
 
 #define NB_LOG_FACILITIES       24
diff --git a/include/types/pattern.h b/include/types/pattern.h
index f1468b3..1a3e076 100644
--- a/include/types/pattern.h
+++ b/include/types/pattern.h
@@ -23,7 +23,7 @@
 #define _TYPES_PATTERN_H
 
 #include <haproxy/api-t.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <common/regex.h>
 
 #include <types/sample.h>
diff --git a/include/types/peers.h b/include/types/peers.h
index 7461347..b3e1e44 100644
--- a/include/types/peers.h
+++ b/include/types/peers.h
@@ -28,7 +28,7 @@
 #include <arpa/inet.h>
 
 #include <haproxy/api-t.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <common/regex.h>
 #include <import/eb32tree.h>
 
diff --git a/include/types/protocol.h b/include/types/protocol.h
index edda61c..0c49068 100644
--- a/include/types/protocol.h
+++ b/include/types/protocol.h
@@ -26,7 +26,7 @@
 #include <sys/socket.h>
 
 #include <haproxy/api-t.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <import/eb32tree.h>
 
 /* some pointer types referenced below */
diff --git a/include/types/proxy.h b/include/types/proxy.h
index c75f0b6..f7bdd30 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -30,7 +30,7 @@
 #include <haproxy/api-t.h>
 #include <common/chunk.h>
 #include <common/http.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <common/regex.h>
 #include <common/hathreads.h>
 
diff --git a/include/types/queue.h b/include/types/queue.h
index b0800f3..9333468 100644
--- a/include/types/queue.h
+++ b/include/types/queue.h
@@ -23,7 +23,7 @@
 #define _TYPES_QUEUE_H
 
 #include <haproxy/api-t.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <common/hathreads.h>
 
 #include <types/server.h>
diff --git a/include/types/sample.h b/include/types/sample.h
index bb6b092..618be08 100644
--- a/include/types/sample.h
+++ b/include/types/sample.h
@@ -28,7 +28,7 @@
 
 #include <haproxy/buf-t.h>
 #include <common/http.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 
 struct arg;
 
diff --git a/include/types/server.h b/include/types/server.h
index c8e5bb6..1737f80 100644
--- a/include/types/server.h
+++ b/include/types/server.h
@@ -26,7 +26,7 @@
 #include <arpa/inet.h>
 
 #include <haproxy/api-t.h>
-#include <common/mini-clist.h>
+#include <haproxy/api.h>
 #include <common/hathreads.h>
 #include <haproxy/openssl-compat.h>
 
diff --git a/include/types/session.h b/include/types/session.h
index fb6b621..57ee52a 100644
--- a/include/types/session.h
+++ b/include/types/session.h
@@ -29,7 +29,7 @@
 #include <arpa/inet.h>
 
 #include <haproxy/api-t.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 
 #include <types/obj_type.h>
 #include <types/proxy.h>
diff --git a/include/types/signal.h b/include/types/signal.h
index 661347a..838aefd 100644
--- a/include/types/signal.h
+++ b/include/types/signal.h
@@ -17,7 +17,7 @@
 
 #include <signal.h>
 #include <haproxy/api-t.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <common/standard.h>
 
 /* flags for -> flags */
diff --git a/include/types/spoe.h b/include/types/spoe.h
index eaa0ef0..85f8b43 100644
--- a/include/types/spoe.h
+++ b/include/types/spoe.h
@@ -25,7 +25,7 @@
 #include <sys/time.h>
 
 #include <common/buffer.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <common/hathreads.h>
 
 #include <types/filters.h>
diff --git a/include/types/ssl_ckch.h b/include/types/ssl_ckch.h
index a63ec1d..a410810 100644
--- a/include/types/ssl_ckch.h
+++ b/include/types/ssl_ckch.h
@@ -33,7 +33,7 @@
 #define _TYPES_SSL_CKCH_H
 #ifdef USE_OPENSSL
 
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <haproxy/openssl-compat.h>
 
 /* This is used to preload the certificate, private key
diff --git a/include/types/ssl_crtlist.h b/include/types/ssl_crtlist.h
index 2879d74..ed8c135 100644
--- a/include/types/ssl_crtlist.h
+++ b/include/types/ssl_crtlist.h
@@ -25,7 +25,7 @@
 
 #include <import/ebmbtree.h>
 
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 
 /* forward declarations for structures below */
 struct bind_conf;
diff --git a/include/types/ssl_sock.h b/include/types/ssl_sock.h
index be58aa8..d62e4dd 100644
--- a/include/types/ssl_sock.h
+++ b/include/types/ssl_sock.h
@@ -33,7 +33,7 @@
 
 #include <common/buffer.h>
 #include <common/hathreads.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <haproxy/openssl-compat.h>
 
 /* ***** READ THIS before adding code here! *****
diff --git a/include/types/stream.h b/include/types/stream.h
index e450c63..37bdb96 100644
--- a/include/types/stream.h
+++ b/include/types/stream.h
@@ -29,7 +29,7 @@
 #include <arpa/inet.h>
 
 #include <haproxy/api-t.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 
 #include <types/channel.h>
 #include <types/filters.h>
diff --git a/include/types/task.h b/include/types/task.h
index 01756ea..fe945df 100644
--- a/include/types/task.h
+++ b/include/types/task.h
@@ -25,7 +25,7 @@
 #include <sys/time.h>
 
 #include <haproxy/api-t.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <import/eb32sctree.h>
 #include <import/eb32tree.h>
 
diff --git a/include/types/trace.h b/include/types/trace.h
index ad9d7b6..c119ab3 100644
--- a/include/types/trace.h
+++ b/include/types/trace.h
@@ -25,7 +25,7 @@
 #include <haproxy/api-t.h>
 #include <common/buffer.h>
 #include <import/ist.h>
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <types/sink.h>
 
 /* the macros below define an optional type for each of the 4 args passed to
diff --git a/include/types/vars.h b/include/types/vars.h
index a72469f..91fcf07 100644
--- a/include/types/vars.h
+++ b/include/types/vars.h
@@ -1,7 +1,7 @@
 #ifndef _TYPES_VARS_H
 #define _TYPES_VARS_H
 
-#include <common/mini-clist.h>
+#include <haproxy/list-t.h>
 #include <common/hathreads.h>
 
 #include <types/sample.h>