]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: include: move stats.h to haproxy/stats{,-t}.h
authorWilly Tarreau <w@1wt.eu>
Thu, 4 Jun 2020 17:58:55 +0000 (19:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Jun 2020 08:18:58 +0000 (10:18 +0200)
Just some minor reordering, and the usual cleanup of call places for
those which didn't need it. We don't include the whole tools.h into
stats-t anymore but just tools-t.h.

21 files changed:
contrib/prometheus-exporter/service-prometheus.c
include/haproxy/stats-t.h [moved from include/types/stats.h with 98% similarity]
include/haproxy/stats.h [moved from include/proto/stats.h with 94% similarity]
src/cfgparse-listen.c
src/cfgparse.c
src/check.c
src/cli.c
src/dns.c
src/hlua.c
src/hlua_fcn.c
src/http_ana.c
src/map.c
src/peers.c
src/pool.c
src/proxy.c
src/server.c
src/ssl_sock.c
src/stats.c
src/stick_table.c
src/stream.c
src/uri_auth.c

index f0b1adf6315f0142bbea4291c6a357dbb05c8364..d64d8ae72c3dcf27fd4c195e7c2acb33c0b675ce 100644 (file)
@@ -33,7 +33,7 @@
 #include <haproxy/sample.h>
 #include <proto/server.h>
 #include <proto/ssl_sock.h>
-#include <proto/stats.h>
+#include <haproxy/stats.h>
 #include <proto/stream.h>
 #include <proto/stream_interface.h>
 #include <haproxy/task.h>
similarity index 98%
rename from include/types/stats.h
rename to include/haproxy/stats-t.h
index bc25a5c24504b0fe27f8d01a5621d6cdd08586f8..657300851da203f1726f360a18acda40bb3e2606 100644 (file)
@@ -1,7 +1,9 @@
 /*
- * include/types/stats.h
+ * include/haproxy/stats-t.h
  * This file provides structures and types for stats.
  *
+ * 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
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _TYPES_STATS_H
-#define _TYPES_STATS_H
+#ifndef _HAPROXY_STATS_T_H
+#define _HAPROXY_STATS_T_H
+
+#include <haproxy/api-t.h>
 
 /* Flags for applet.ctx.stats.flags */
 #define STAT_FMT_HTML   0x00000001      /* dump the stats in HTML format */
@@ -242,22 +246,6 @@ enum field_scope {
        FS_MASK     = 0xFF000000,
 };
 
-/* Please consider updating stats_dump_fields_*(),
- * stats_dump_.*_info_fields() and stats_*_schema()
- * when modifying struct field or related enums.
- */
-struct field {
-       uint32_t type;
-       union {
-               int32_t     s32; /* FF_S32 */
-               uint32_t    u32; /* FF_U32 */
-               int64_t     s64; /* FF_S64 */
-               uint64_t    u64; /* FF_U64 */
-               double      flt; /* FF_FLT */
-               const char *str; /* FF_STR */
-       } u;
-};
-
 /* Show Info fields for CLI output. For any field added here, please add the text
  * representation in the info_field_names array below. Please only append at the end,
  * before the INF_TOTAL_FIELDS entry, and never insert anything in the middle
@@ -440,5 +428,21 @@ enum stat_field {
        ST_F_TOTAL_FIELDS
 };
 
+/* Please consider updating stats_dump_fields_*(),
+ * stats_dump_.*_info_fields() and stats_*_schema()
+ * when modifying struct field or related enums.
+ */
+struct field {
+       uint32_t type;
+       union {
+               int32_t     s32; /* FF_S32 */
+               uint32_t    u32; /* FF_U32 */
+               int64_t     s64; /* FF_S64 */
+               uint64_t    u64; /* FF_U64 */
+               double      flt; /* FF_FLT */
+               const char *str; /* FF_STR */
+       } u;
+};
+
 
-#endif /* _TYPES_STATS_H */
+#endif /* _HAPROXY_STATS_T_H */
similarity index 94%
rename from include/proto/stats.h
rename to include/haproxy/stats.h
index 84c64d03e60db55b18f180e95ed4c8e963676d5d..7fb57754c3a96730cdf21b39adc800e75a3938c4 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * include/proto/stats.h
+ * include/haproxy/stats.h
  * This file contains definitions of some primitives to dedicated to
  * statistics output.
  *
- * Copyright (C) 2000-2011 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 _PROTO_STATS_H
-#define _PROTO_STATS_H
+#ifndef _HAPROXY_STATS_H
+#define _HAPROXY_STATS_H
 
 #include <haproxy/applet-t.h>
-#include <haproxy/tools.h>
 #include <haproxy/api.h>
+#include <haproxy/stats-t.h>
+#include <haproxy/tools-t.h>
 #include <types/stream_interface.h>
-#include <types/stats.h>
+
+
+/* These two structs contains all field names and descriptions according to
+ * the the number of entries in "enum stat_field" and "enum info_field"
+ */
+extern const struct name_desc stat_fields[];
+extern const struct name_desc info_fields[];
+extern const char *stat_status_codes[];
+extern struct applet http_stats_applet;
+
+
+int stats_fill_info(struct field *info, int len);
+int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len);
+int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
+                        struct field *stats, int len);
+int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
+                        struct field *stats, int len);
+int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int len);
+
+void stats_io_handler(struct stream_interface *si);
+int stats_emit_raw_data_field(struct buffer *out, const struct field *f);
+int stats_emit_typed_data_field(struct buffer *out, const struct field *f);
+int stats_emit_field_tags(struct buffer *out, const struct field *f,
+                         char delim);
 
 
 static inline enum field_format field_format(const struct field *f, int e)
@@ -91,31 +115,7 @@ static inline struct field mkf_flt(uint32_t type, double value)
        return f;
 }
 
-extern const char *stat_status_codes[];
-
-/* These two structs contains all field names and descriptions according to
- * the the number of entries in "enum stat_field" and "enum info_field"
- */
-extern const struct name_desc stat_fields[];
-extern const struct name_desc info_fields[];
-
-int stats_fill_info(struct field *info, int len);
-int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len);
-int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
-                        struct field *stats, int len);
-int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
-                        struct field *stats, int len);
-int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int len);
-
-extern struct applet http_stats_applet;
-
-void stats_io_handler(struct stream_interface *si);
-int stats_emit_raw_data_field(struct buffer *out, const struct field *f);
-int stats_emit_typed_data_field(struct buffer *out, const struct field *f);
-int stats_emit_field_tags(struct buffer *out, const struct field *f,
-                         char delim);
-
-#endif /* _PROTO_STATS_H */
+#endif /* _HAPROXY_STATS_H */
 
 /*
  * Local variables:
index 44474fde2097db44ff08da467f046b20c06ee97e..9ec25a3c5e4df0a711660e191c4b830a0dcd959a 100644 (file)
@@ -24,7 +24,7 @@
 #include <haproxy/listener.h>
 #include <haproxy/peers.h>
 #include <haproxy/sample.h>
-#include <types/stats.h>
+#include <haproxy/stats-t.h>
 
 #include <haproxy/protocol.h>
 #include <proto/proxy.h>
index 5f2787792a62d5e850b88122c5a090466cc85199..e3d33edb18b61eec8d2f46e7e1cd9f43012c50e9 100644 (file)
@@ -56,6 +56,7 @@
 #include <haproxy/peers-t.h>
 #include <haproxy/pool.h>
 #include <haproxy/session.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/tools.h>
 #include <haproxy/time.h>
 #include <haproxy/uri_auth-t.h>
 
 #include <types/filters.h>
 #include <haproxy/global.h>
-#include <types/stats.h>
 
 #include <proto/backend.h>
 #include <proto/channel.h>
-#include <proto/stats.h>
 #include <proto/filters.h>
 #include <proto/lb_map.h>
 #include <proto/log.h>
index dfa30988d01c6914353e66c7eb39480d69728aeb..6e8e2383c40dcf6b2076328c905bbfd7051abfc9 100644 (file)
 #include <haproxy/h1.h>
 #include <haproxy/htx.h>
 #include <haproxy/signal.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/task.h>
 #include <haproxy/vars.h>
 
 #include <haproxy/global.h>
-#include <types/stats.h>
 
 #include <haproxy/arg.h>
 #include <proto/backend.h>
-#include <proto/stats.h>
 #include <haproxy/fd.h>
 #include <proto/log.h>
 #include <proto/queue.h>
index e3b914ddee5b42a5818cfde1cae2834116a7005f..2a0f423b8089c733409c3fdd96149368ce9bb982 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -39,6 +39,7 @@
 #include <haproxy/peers.h>
 #include <haproxy/sample-t.h>
 #include <haproxy/session.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
 #include <haproxy/ticks.h>
 #include <haproxy/base64.h>
 
 #include <haproxy/global.h>
-#include <types/stats.h>
 
 #include <haproxy/activity.h>
 #include <proto/backend.h>
 #include <proto/channel.h>
 #include <proto/cli.h>
 #include <haproxy/compression.h>
-#include <proto/stats.h>
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <proto/log.h>
index 9fc767d06218ad2cdc13ca4d4d5621b3f0a97048..036d4af3dc34c7fe0fb13ccf86369cb992a9cfe2 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -27,6 +27,7 @@
 #include <haproxy/errors.h>
 #include <haproxy/http_rules.h>
 #include <haproxy/sample.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/task.h>
 #include <haproxy/tcp_rules.h>
 #include <haproxy/time.h>
@@ -36,7 +37,6 @@
 
 #include <types/cli.h>
 #include <haproxy/global.h>
-#include <types/stats.h>
 
 #include <proto/channel.h>
 #include <proto/cli.h>
index 0d3a3e9ce4fe0f94d08bd97ed6cb81016bfbb350..04319bc7822db3f8c2f1eb02db8c22f361a506d3 100644 (file)
@@ -42,6 +42,7 @@
 #include <haproxy/payload.h>
 #include <haproxy/sample.h>
 #include <haproxy/session.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/task.h>
 #include <haproxy/tcp_rules.h>
 #include <haproxy/tools.h>
 
 #include <types/cli.h>
 #include <types/proxy.h>
-#include <types/stats.h>
 
 #include <haproxy/arg.h>
 #include <proto/channel.h>
 #include <proto/cli.h>
-#include <proto/stats.h>
 #include <proto/queue.h>
 #include <proto/http_ana.h>
 #include <proto/server.h>
index f4ac3d5d2471453d6ebb89aefcc070357289366b..c9ef840e4bfe5ea889e29e2005d0dfda30786127 100644 (file)
 #include <haproxy/http.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/regex.h>
+#include <haproxy/stats.h>
 #include <haproxy/time.h>
 
 #include <types/cli.h>
 #include <types/proxy.h>
-#include <types/stats.h>
 
 #include <proto/proxy.h>
 #include <proto/server.h>
-#include <proto/stats.h>
 #include <haproxy/stick_table.h>
 
 /* Contains the class reference of the concat object. */
index 37ae6481ce37caaca21ca4e526f34643e0330a56..690640fb0faa66460950336d934c65d054a5cc5c 100644 (file)
@@ -21,6 +21,7 @@
 #include <haproxy/htx.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/regex.h>
+#include <haproxy/stats.h>
 #include <haproxy/uri_auth-t.h>
 #include <haproxy/vars.h>
 
@@ -34,7 +35,6 @@
 #include <proto/server.h>
 #include <proto/stream.h>
 #include <proto/stream_interface.h>
-#include <proto/stats.h>
 
 #define TRACE_SOURCE &trace_strm
 
index 77d687bb83902a65b6d655d4166ae225703321f7..65fd1edb08793d84f22bea8d88075ea099477e56 100644 (file)
--- a/src/map.c
+++ b/src/map.c
 #include <haproxy/map.h>
 #include <haproxy/pattern.h>
 #include <haproxy/regex.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/tools.h>
 
 #include <types/cli.h>
-#include <types/stats.h>
 
 #include <haproxy/arg.h>
 #include <proto/cli.h>
index 1d60e3f53307a76724468dbd3afa35fbff823974..c9d57355bb7423cd5d36a723ac9fd7e3f1d3237f 100644 (file)
 #include <haproxy/task.h>
 #include <haproxy/session-t.h>
 #include <haproxy/signal.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/time.h>
 #include <haproxy/tools.h>
 #include <haproxy/thread.h>
 
-#include <types/stats.h>
-
 #include <proto/channel.h>
 #include <proto/cli.h>
 #include <haproxy/fd.h>
index 1e8e2f8637afb0777235a5a409bfdb1b2a767576..e8b96a0e37018d3abe477b14a24b120e8dd49696 100644 (file)
 #include <haproxy/api.h>
 #include <types/cli.h>
 #include <haproxy/global.h>
-#include <types/stats.h>
 
 #include <common/cfgparse.h>
 #include <haproxy/thread.h>
 #include <haproxy/pool.h>
 #include <haproxy/list.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/tools.h>
 
 #include <haproxy/activity-t.h>
@@ -29,7 +29,6 @@
 #include <proto/channel.h>
 #include <proto/log.h>
 #include <proto/stream_interface.h>
-#include <proto/stats.h>
 
 #ifdef CONFIG_HAP_LOCAL_POOLS
 /* These are the most common pools, expected to be initialized first. These
index b00ea01b0f95b3cc054d21457ac7f0be9a62d210..8e0f03a102ef6ca90b6ed2bbde9990090900d414 100644 (file)
@@ -26,6 +26,7 @@
 #include <haproxy/obj_type-t.h>
 #include <haproxy/peers.h>
 #include <haproxy/pool.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/task.h>
 #include <haproxy/time.h>
 
@@ -34,7 +35,6 @@
 
 #include <haproxy/capture-t.h>
 #include <types/cli.h>
-#include <types/stats.h>
 
 #include <proto/cli.h>
 #include <proto/backend.h>
index 2e2ada887a8409cfb657518dcbd76c53320b7723..c4a453bf94356f1cd3dc0ff0dab36497dc764fdd 100644 (file)
 #include <haproxy/global.h>
 #include <haproxy/namespace.h>
 #include <haproxy/sample.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/task.h>
 #include <haproxy/time.h>
 
 #include <types/cli.h>
 #include <types/cli.h>
-#include <types/stats.h>
 
 #include <proto/cli.h>
 #include <haproxy/port_range.h>
@@ -41,7 +41,6 @@
 #include <proto/server.h>
 #include <proto/stream.h>
 #include <proto/stream_interface.h>
-#include <proto/stats.h>
 #include <netinet/tcp.h>
 
 #include <import/ebsttree.h>
index 308dbfacdb58158c363f6711e47005b11471ec02..aa983bd03b3bfbecfb847c74199d3eb65364b174 100644 (file)
@@ -57,6 +57,7 @@
 #include <haproxy/ssl_ckch.h>
 #include <haproxy/ssl_crtlist.h>
 #include <haproxy/ssl_utils.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
 #include <haproxy/ticks.h>
@@ -69,7 +70,6 @@
 
 #include <types/cli.h>
 #include <types/ssl_sock.h>
-#include <types/stats.h>
 
 #include <haproxy/arg.h>
 #include <proto/channel.h>
index b527eafda682fca444d88026e88775d5073bb6fd..bc590660ad4628117b0f9a767c5f9a9b3e4efeab 100644 (file)
@@ -42,6 +42,7 @@
 #include <haproxy/map-t.h>
 #include <haproxy/pattern-t.h>
 #include <haproxy/session.h>
+#include <haproxy/stats.h>
 #include <haproxy/task.h>
 #include <haproxy/tools.h>
 #include <haproxy/ticks.h>
 #include <haproxy/base64.h>
 
 #include <types/cli.h>
-#include <types/stats.h>
 
 #include <proto/backend.h>
 #include <proto/channel.h>
 #include <proto/cli.h>
-#include <proto/stats.h>
 #include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <proto/log.h>
index ebb903371090522606cbe6cc43d7c855c7c1f3ce..a79defc79bfc77b599c870ec5947501b693ff405 100644 (file)
@@ -22,6 +22,7 @@
 #include <haproxy/list.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/peers.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/task.h>
 #include <haproxy/tcp_rules.h>
 #include <haproxy/tools.h>
@@ -31,7 +32,6 @@
 #include <import/ebsttree.h>
 
 #include <types/cli.h>
-#include <types/stats.h>
 
 #include <haproxy/arg.h>
 #include <proto/cli.h>
index 0dd4745b9de5246e66b0de62696173cd5e140c34..e6058c5cf566c4566ace301e8d2aea59174bd0bb 100644 (file)
 #include <haproxy/htx.h>
 #include <haproxy/pool.h>
 #include <haproxy/session.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/task.h>
 #include <haproxy/tcp_rules.h>
 #include <haproxy/vars.h>
 
 #include <types/cli.h>
 #include <types/filters.h>
-#include <types/stats.h>
 
 #include <haproxy/activity.h>
 #include <haproxy/arg.h>
 #include <proto/backend.h>
 #include <proto/channel.h>
 #include <proto/cli.h>
-#include <proto/stats.h>
 #include <haproxy/fd.h>
 #include <proto/filters.h>
 #include <haproxy/freq_ctr.h>
index 236f578725506065d6434e4e62e9f56b88014eef..2005bc8124a6089194f1ccfe08f5f57cac26bdb3 100644 (file)
@@ -15,9 +15,9 @@
 
 #include <haproxy/api.h>
 #include <haproxy/base64.h>
+#include <haproxy/stats-t.h>
 #include <haproxy/uri_auth.h>
 
-#include <types/stats.h>
 #include <proto/log.h>
 
 /*