]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: include: move common/buffer.h to haproxy/dynbuf{,-t}.h
authorWilly Tarreau <w@1wt.eu>
Tue, 2 Jun 2020 09:28:02 +0000 (11:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Jun 2020 08:18:57 +0000 (10:18 +0200)
The pretty confusing "buffer.h" was in fact not the place to look for
the definition of "struct buffer" but the one responsible for dynamic
buffer allocation. As such it defines the struct buffer_wait and the
few functions to allocate a buffer or wait for one.

This patch moves it renaming it to dynbuf.h. The type definition was
moved to its own file since it's included in a number of other structs.

Doing this cleanup revealed that a significant number of files used to
rely on this one to inherit struct buffer through it but didn't need
anything from this file at all.

35 files changed:
contrib/prometheus-exporter/service-prometheus.c
include/common/h1.h
include/haproxy/dynbuf-t.h [new file with mode: 0644]
include/haproxy/dynbuf.h [moved from include/common/buffer.h with 90% similarity]
include/proto/channel.h
include/proto/session.h
include/proto/trace.h
include/types/applet.h
include/types/channel.h
include/types/compression.h
include/types/sink.h
include/types/spoe.h
include/types/ssl_sock.h
include/types/stream.h
include/types/trace.h
src/51d.c
src/backend.c
src/buffer.c
src/channel.c
src/checks.c
src/compression.c
src/filters.c
src/flt_http_comp.c
src/haproxy.c
src/mux_h1.c
src/mux_h2.c
src/raw_sock.c
src/session.c
src/ssl_sample.c
src/ssl_sock.c
src/ssl_utils.c
src/stream.c
src/stream_interface.c
src/trace.c
src/wurfl.c

index fe3431ccb4e87402daa04afd5351758b17e52986..fe2520d62bd88464bafeb7da63e1d5a396a0601c 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
-#include <common/buffer.h>
 #include <common/htx.h>
 #include <haproxy/pool.h>
 #include <haproxy/list.h>
index 1295b142005682a751f2ac0ea59855ee1588d152..205a25ce2595a61a3358531950fa3d008e503cf5 100644 (file)
@@ -23,8 +23,8 @@
 #define _COMMON_H1_H
 
 #include <haproxy/api.h>
+#include <haproxy/dynbuf.h>
 #include <haproxy/intops.h>
-#include <common/buffer.h>
 #include <common/http.h>
 #include <common/http-hdr.h>
 #include <import/ist.h>
diff --git a/include/haproxy/dynbuf-t.h b/include/haproxy/dynbuf-t.h
new file mode 100644 (file)
index 0000000..451d58c
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * include/haproxy/dynbuf-t.h
+ * Structure definitions for dynamic buffer management.
+ *
+ * Copyright (C) 2000-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_DYNBUF_T_H
+#define _HAPROXY_DYNBUF_T_H
+
+#include <haproxy/list-t.h>
+
+/* an element of the <buffer_wq> list. It represents an object that need to
+ * acquire a buffer to continue its process. */
+struct buffer_wait {
+       void *target;              /* The waiting object that should be woken up */
+       int (*wakeup_cb)(void *);  /* The function used to wake up the <target>, passed as argument */
+       struct mt_list list;        /* Next element in the <buffer_wq> list */
+};
+
+#endif /* _HAPROXY_DYNBUF_T_H */
+
+/*
+ * Local variables:
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ * End:
+ */
similarity index 90%
rename from include/common/buffer.h
rename to include/haproxy/dynbuf.h
index 4e19c22c2f0611d91919db4a9292e3eedf4ca24b..01a784d4f79d6d05c6667118f898983621d77cc9 100644 (file)
@@ -1,8 +1,8 @@
 /*
- * include/common/buffer.h
- * Buffer management definitions, macros and inline functions.
+ * include/haproxy/dynbuf.h
+ * Buffer management functions.
  *
- * Copyright (C) 2000-2012 Willy Tarreau - w@1wt.eu
+ * Copyright (C) 2000-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
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _COMMON_BUFFER_H
-#define _COMMON_BUFFER_H
+#ifndef _HAPROXY_DYNBUF_H
+#define _HAPROXY_DYNBUF_H
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <import/ist.h>
+#include <haproxy/activity.h>
 #include <haproxy/api.h>
 #include <haproxy/buf.h>
 #include <haproxy/chunk.h>
-#include <import/ist.h>
-#include <haproxy/istbuf.h>
+#include <haproxy/dynbuf-t.h>
+#include <haproxy/list-t.h>
 #include <haproxy/pool.h>
 
-#include <haproxy/activity.h>
-
-/* an element of the <buffer_wq> list. It represents an object that need to
- * acquire a buffer to continue its process. */
-struct buffer_wait {
-       void *target;              /* The waiting object that should be woken up */
-       int (*wakeup_cb)(void *);  /* The function used to wake up the <target>, passed as argument */
-       struct mt_list list;        /* Next element in the <buffer_wq> list */
-};
-
 extern struct pool_head *pool_head_buffer;
 extern struct mt_list buffer_wq;
 __decl_thread(extern HA_SPINLOCK_T buffer_wq_lock);
@@ -210,7 +202,7 @@ static inline void offer_buffers(void *from, unsigned int threshold)
 }
 
 
-#endif /* _COMMON_BUFFER_H */
+#endif /* _HAPROXY_DYNBUF_H */
 
 /*
  * Local variables:
index a36b63a61f7feb742b08a4ab7331f0e01f474e1f..d343c027626a000c547bf95fbf7ca572a88d04ff 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <haproxy/api.h>
 #include <haproxy/chunk.h>
+#include <haproxy/dynbuf.h>
 #include <common/htx.h>
 #include <common/ticks.h>
 #include <haproxy/time.h>
index 866217ec2864fb53558a47adfe842a84e44b0e5b..a52e982c9c32a2a980a227631dd53ed7b5d00d37 100644 (file)
@@ -23,7 +23,6 @@
 #define _PROTO_SESSION_H
 
 #include <haproxy/api.h>
-#include <common/buffer.h>
 #include <haproxy/pool.h>
 
 #include <types/global.h>
index 7a2b5e7e1034b30b7d1e5ca887909a762ed9bce4..f16763d7f19716dadf40f431a374cf9933f88114 100644 (file)
@@ -23,7 +23,6 @@
 #define _PROTO_TRACE_H
 
 #include <haproxy/api.h>
-#include <common/buffer.h>
 #include <common/standard.h>
 #include <import/ist.h>
 #include <haproxy/list.h>
index ac7f38d714febab785b619d2da926feb4429301e..7b21f9ab39dd201f672df715327e56767fb54f26 100644 (file)
 #define _TYPES_APPLET_H
 
 #include <haproxy/api-t.h>
+#include <haproxy/buf.h>
+#include <haproxy/dynbuf-t.h>
 #include <haproxy/freq_ctr-t.h>
 #include <types/hlua.h>
 #include <types/obj_type.h>
 #include <types/proxy.h>
 #include <types/stream.h>
-#include <common/buffer.h>
-#include <haproxy/chunk.h>
 #include <common/xref.h>
 
 struct appctx;
index 863c3fba69767222e3e9e8d7bbe0b09e616416f1..d3823f26261fd0e05e291ff49a6194cba1eff184 100644 (file)
@@ -23,7 +23,7 @@
 #define _TYPES_CHANNEL_H
 
 #include <haproxy/api-t.h>
-#include <common/buffer.h>
+#include <haproxy/buf-t.h>
 
 /* The CF_* macros designate Channel Flags, which may be ORed in the bit field
  * member 'flags' in struct channel. Here we have several types of flags :
index fc2ad26687c5067cf75bae82c249f042717f806a..16049099924abb5853e1a5bb61061d6b02cce8fc 100644 (file)
@@ -32,7 +32,7 @@
 #include <zlib.h>
 #endif
 
-#include <common/buffer.h>
+#include <haproxy/buf-t.h>
 
 struct comp {
        struct comp_algo *algos;
index 3feb05ddf753fdc61af0d3d7db62da4026effd34..aad6ba7d1690cf95e4fc1c6c5f413c62f10a5b66 100644 (file)
@@ -23,8 +23,8 @@
 #define _TYPES_SINK_H
 
 #include <haproxy/api-t.h>
-#include <common/buffer.h>
 #include <import/ist.h>
+#include <haproxy/api.h>
 
 /* A sink may be of 4 distinct types :
  *   - file descriptor (such as stdout)
index 42b4bd5a4188aaf1d0a5cf52529190c8458686d3..f08b9adcdd81621bda49e183592dd6dcd3e9ee6c 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <sys/time.h>
 
-#include <common/buffer.h>
+#include <haproxy/dynbuf-t.h>
 #include <haproxy/list-t.h>
 #include <haproxy/thread.h>
 
index 27633ecbd1800906f7460d58cda28c64f544ef62..ca41ffc2c009d3865106baed44059031f0199b04 100644 (file)
@@ -31,7 +31,7 @@
 #include <types/ssl_ckch.h>
 #include <types/ssl_crtlist.h>
 
-#include <common/buffer.h>
+#include <haproxy/buf-t.h>
 #include <haproxy/thread.h>
 #include <haproxy/list-t.h>
 #include <haproxy/openssl-compat.h>
index 37bdb96c56009d7a65496ecf8673165df83ae4a8..08e0f1255a02ee8f9c732dd9a69725458f235503 100644 (file)
@@ -29,6 +29,7 @@
 #include <arpa/inet.h>
 
 #include <haproxy/api-t.h>
+#include <haproxy/dynbuf-t.h>
 #include <haproxy/list-t.h>
 
 #include <types/channel.h>
index c119ab33f0dc080a4a1535788c4f6ee942017501..2114d410f6c60a18d99613108e53b312f57fac55 100644 (file)
@@ -23,7 +23,6 @@
 #define _TYPES_TRACE_H
 
 #include <haproxy/api-t.h>
-#include <common/buffer.h>
 #include <import/ist.h>
 #include <haproxy/list-t.h>
 #include <types/sink.h>
index c53d68138fb1193583a4a2f190ab4026dcd5b6b7..ab628fe642b5fd94815270cfcb79d99a123f5258 100644 (file)
--- a/src/51d.c
+++ b/src/51d.c
@@ -3,7 +3,7 @@
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
 #include <haproxy/chunk.h>
-#include <common/buffer.h>
+#include <haproxy/buf-t.h>
 #include <haproxy/errors.h>
 #include <haproxy/thread.h>
 #include <types/global.h>
index ff6c37d2bdd760ec31534d69099b7fecbb7aa96c..c9abbc7ab3f2a515eb7a679b3be28be8b8935ecf 100644 (file)
@@ -20,7 +20,6 @@
 #include <sys/types.h>
 
 #include <haproxy/api.h>
-#include <common/buffer.h>
 #include <haproxy/hash.h>
 #include <common/htx.h>
 #include <common/ticks.h>
index ec07e76e6beb92534c230377dcf90554b10f6d82..b41716b7e246425bdfb894d752ac7ac2ad635694 100644 (file)
@@ -15,7 +15,8 @@
 #include <string.h>
 
 #include <haproxy/api.h>
-#include <common/buffer.h>
+#include <haproxy/dynbuf.h>
+#include <haproxy/list.h>
 #include <haproxy/pool.h>
 
 #include <types/global.h>
index cd7da30b400336a51ae702e742b56dbae379ff6c..ae5c981c7246009c79c6874e864c8e05b7737a47 100644 (file)
@@ -16,7 +16,7 @@
 #include <string.h>
 
 #include <haproxy/api.h>
-#include <common/buffer.h>
+#include <haproxy/buf.h>
 
 #include <proto/channel.h>
 
index 0a1d0e2e0db16d4b1c5a98538038a77cee32e91a..45de864c3f87b80f8db8efe1ad3f165a2c0b87b0 100644 (file)
@@ -33,6 +33,7 @@
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
 #include <haproxy/chunk.h>
+#include <haproxy/istbuf.h>
 #include <haproxy/list.h>
 #include <common/standard.h>
 #include <haproxy/time.h>
index 45471c33397fd2acda7e873a6544cc0154cded02..f1d739e70d2a550b0ea0c9b4033b3e4f4f81f66b 100644 (file)
@@ -27,6 +27,7 @@
 #endif /* USE_ZLIB */
 
 #include <haproxy/api.h>
+#include <haproxy/dynbuf.h>
 #include <common/cfgparse.h>
 #include <haproxy/thread.h>
 #include <haproxy/pool.h>
index e9f846b6626fdc8589d8c2af0a7f59d60d492863..1b715735308a528c2c2cb2f475e979c33e0695ca 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #include <haproxy/api.h>
-#include <common/buffer.h>
+#include <haproxy/buf-t.h>
 #include <common/cfgparse.h>
 #include <haproxy/errors.h>
 #include <common/htx.h>
index 9ca51e538c5bec10dece202ce5e087d3dd3f7d71..4b0e546ab6667400626eab19955d7bd836b322d7 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #include <haproxy/api.h>
-#include <common/buffer.h>
+#include <haproxy/dynbuf.h>
 #include <common/cfgparse.h>
 #include <common/htx.h>
 #include <haproxy/list.h>
index 99e89075ef6ae9949ba81e526cefebd9bfcfbf1f..f178e51f65ad0e98c538787c8662843f2c7331c2 100644 (file)
@@ -84,6 +84,7 @@
 #include <haproxy/base64.h>
 #include <common/cfgparse.h>
 #include <haproxy/chunk.h>
+#include <haproxy/dynbuf.h>
 #include <haproxy/errors.h>
 #include <haproxy/pool.h>
 #include <haproxy/list.h>
index 1c75e93cd12fcd09515de3432c85929f64c1ae4c..963ed16afb26d0701658e11cace9c7b6fd43e8f9 100644 (file)
@@ -10,6 +10,7 @@
  *
  */
 #include <haproxy/api.h>
+#include <haproxy/istbuf.h>
 #include <common/cfgparse.h>
 #include <common/h1.h>
 #include <common/h2.h>
index 3c0ef5f8e26dfb5be734a2b4f5b59ee3a9588b1a..7050469a7efdf3d64e8a298d7084e82822c4e795 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include <haproxy/api.h>
+#include <haproxy/istbuf.h>
 #include <common/cfgparse.h>
 #include <common/h1.h>
 #include <common/h2.h>
index 4033625feb0f019fc1e42413d0c2e2dbf9cafddf..faa8e1e97241d814d004cfd4e9b432387f283288 100644 (file)
@@ -23,7 +23,7 @@
 #include <netinet/tcp.h>
 
 #include <haproxy/api.h>
-#include <common/buffer.h>
+#include <haproxy/buf.h>
 #include <common/standard.h>
 #include <common/ticks.h>
 #include <haproxy/time.h>
index 804416901c5b9afd190d47daad76e24b8e64c02f..d31806a2ba28ac8459ed0271f26ae9b6ff82f68d 100644 (file)
@@ -11,7 +11,6 @@
  */
 
 #include <haproxy/api.h>
-#include <common/buffer.h>
 #include <common/http.h>
 #include <haproxy/pool.h>
 
index 8bc78e1c686798f09767f95b3bdc84893ef56732..de3abeeb4ec6d608bce0191f6deee78f840f69a4 100644 (file)
@@ -21,7 +21,7 @@
 #include <unistd.h>
 
 #include <haproxy/api.h>
-#include <common/buffer.h>
+#include <haproxy/buf-t.h>
 #include <haproxy/openssl-compat.h>
 #include <common/standard.h>
 
index fe194b7a743178eef708c867b0b7f362b32fedb4..e89fa5ae65840348c0b415d7ac7dcc113affb37a 100644 (file)
@@ -44,7 +44,7 @@
 #include <import/lru.h>
 #include <import/xxhash.h>
 
-#include <common/buffer.h>
+#include <haproxy/dynbuf.h>
 #include <haproxy/chunk.h>
 #include <haproxy/errors.h>
 #include <haproxy/openssl-compat.h>
index 10b71d565294008f74c37ea4b6da7114fc686cb7..38efe7ec463452367fd90275e490552ec769cc77 100644 (file)
@@ -12,7 +12,8 @@
  */
 
 
-#include <common/buffer.h>
+#include <haproxy/api.h>
+#include <haproxy/buf-t.h>
 #include <haproxy/openssl-compat.h>
 
 #include <proto/ssl_sock.h>
index b6b2e1450cf951391a8cd0db5e4e3aa3371dc170..4af498602759cfbf0559be76d3e245081f23d636 100644 (file)
@@ -16,7 +16,8 @@
 
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
-#include <common/buffer.h>
+#include <haproxy/dynbuf.h>
+#include <haproxy/istbuf.h>
 #include <haproxy/thread.h>
 #include <common/htx.h>
 #include <haproxy/pool.h>
index 89f37ee13f236e5f3c0282b2cda0d275b41284b4..d0f5f1abee2564369edb1f8859f59f2a7fcff269 100644 (file)
@@ -20,7 +20,7 @@
 #include <sys/types.h>
 
 #include <haproxy/api.h>
-#include <common/buffer.h>
+#include <haproxy/dynbuf.h>
 #include <common/standard.h>
 #include <common/ticks.h>
 #include <haproxy/time.h>
index a0b9648844a9207373a160e90890c3ccf2204b98..4111bdbb7656246d5742b0ad1bbd1f5e7f9697ca 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <haproxy/api.h>
-#include <common/buffer.h>
 #include <import/ist.h>
+#include <haproxy/api.h>
+#include <haproxy/buf.h>
+#include <haproxy/istbuf.h>
 #include <haproxy/list.h>
 #include <proto/cli.h>
 #include <proto/log.h>
index 65a591732d2f1ccface3c2b10990da26c6233411..0bc10fa989ef1e18ea338bd133c56d3d1af7b01c 100644 (file)
@@ -2,9 +2,9 @@
 #include <stdarg.h>
 
 #include <haproxy/api.h>
+#include <haproxy/buf-t.h>
 #include <common/cfgparse.h>
 #include <haproxy/chunk.h>
-#include <common/buffer.h>
 #include <haproxy/errors.h>
 #include <types/global.h>
 #include <proto/arg.h>