From 4980160eccaef7d2671a123f9e5af88d0cfead2c Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 4 Jun 2020 22:50:02 +0200 Subject: [PATCH] REORG: include: move backend.h to haproxy/backend{,-t}.h The files remained mostly unchanged since they were OK. However, half of the users didn't need to include them, and about as many actually needed to have it and used to find functions like srv_currently_usable() through a long chain that broke when moving the file. --- contrib/prometheus-exporter/service-prometheus.c | 2 +- include/{types/backend.h => haproxy/backend-t.h} | 11 +++++------ include/{proto => haproxy}/backend.h | 11 +++++------ include/haproxy/proxy-t.h | 2 +- include/proto/queue.h | 3 +-- src/backend.c | 2 +- src/cfgparse.c | 2 +- src/check.c | 1 - src/cli.c | 1 - src/flt_spoe.c | 1 - src/haproxy.c | 1 - src/http_ana.c | 1 + src/lb_chash.c | 3 +-- src/lb_fas.c | 3 +-- src/lb_fwlc.c | 3 +-- src/lb_fwrr.c | 3 +-- src/lb_map.c | 3 +-- src/proxy.c | 1 - src/queue.c | 3 ++- src/server.c | 1 + src/stats.c | 2 +- src/stream.c | 2 +- 22 files changed, 26 insertions(+), 36 deletions(-) rename include/{types/backend.h => haproxy/backend-t.h} (98%) rename include/{proto => haproxy}/backend.h (96%) diff --git a/contrib/prometheus-exporter/service-prometheus.c b/contrib/prometheus-exporter/service-prometheus.c index 6e9e11631..c3f9f9525 100644 --- a/contrib/prometheus-exporter/service-prometheus.c +++ b/contrib/prometheus-exporter/service-prometheus.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -26,7 +27,6 @@ #include #include -#include #include #include #include diff --git a/include/types/backend.h b/include/haproxy/backend-t.h similarity index 98% rename from include/types/backend.h rename to include/haproxy/backend-t.h index 120081f7b..757bb2fc3 100644 --- a/include/types/backend.h +++ b/include/haproxy/backend-t.h @@ -1,5 +1,5 @@ /* - * include/types/backend.h + * include/haproxy/backend-t.h * This file assembles definitions for backends * * Copyright (C) 2000-2012 Willy Tarreau - w@1wt.eu @@ -19,17 +19,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _TYPES_BACKEND_H -#define _TYPES_BACKEND_H +#ifndef _HAPROXY_BACKEND_T_H +#define _HAPROXY_BACKEND_T_H #include #include #include #include #include +#include #include -#include - #include /* Parameters for lbprm.algo */ @@ -168,7 +167,7 @@ struct lbprm { void (*server_drop_conn)(struct server *); /* to be called when connection is dropped */ }; -#endif /* _TYPES_BACKEND_H */ +#endif /* _HAPROXY_BACKEND_T_H */ /* * Local variables: diff --git a/include/proto/backend.h b/include/haproxy/backend.h similarity index 96% rename from include/proto/backend.h rename to include/haproxy/backend.h index 57d606e66..6662d59ff 100644 --- a/include/proto/backend.h +++ b/include/haproxy/backend.h @@ -1,5 +1,5 @@ /* - * include/proto/backend.h + * include/haproxy/backend.h * Functions prototypes for the backend. * * Copyright (C) 2000-2012 Willy Tarreau - w@1wt.eu @@ -19,14 +19,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _PROTO_BACKEND_H -#define _PROTO_BACKEND_H +#ifndef _HAPROXY_BACKEND_H +#define _HAPROXY_BACKEND_H +#include #include #include #include - -#include #include #include @@ -144,7 +143,7 @@ static inline int srv_lb_status_changed(const struct server *srv) */ void set_backend_down(struct proxy *be); -#endif /* _PROTO_BACKEND_H */ +#endif /* _HAPROXY_BACKEND_H */ /* * Local variables: diff --git a/include/haproxy/proxy-t.h b/include/haproxy/proxy-t.h index d66ab3448..b89fb2192 100644 --- a/include/haproxy/proxy-t.h +++ b/include/haproxy/proxy-t.h @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -38,7 +39,6 @@ #include #include #include -#include #include /* values for proxy->state */ diff --git a/include/proto/queue.h b/include/proto/queue.h index 735a1f147..cd4c5ca55 100644 --- a/include/proto/queue.h +++ b/include/proto/queue.h @@ -22,6 +22,7 @@ #ifndef _PROTO_QUEUE_H #define _PROTO_QUEUE_H +#include #include #include #include @@ -30,8 +31,6 @@ #include #include -#include - extern struct pool_head *pool_head_pendconn; struct pendconn *pendconn_add(struct stream *strm); diff --git a/src/backend.c b/src/backend.c index 18a569763..6e6280ac7 100644 --- a/src/backend.c +++ b/src/backend.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -49,7 +50,6 @@ #include #include -#include #include #include #include diff --git a/src/cfgparse.c b/src/cfgparse.c index 0be9834ad..631f10021 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -72,7 +73,6 @@ #include -#include #include #include #include diff --git a/src/check.c b/src/check.c index d32835094..4e898b036 100644 --- a/src/check.c +++ b/src/check.c @@ -58,7 +58,6 @@ #include #include -#include #include #include #include diff --git a/src/cli.c b/src/cli.c index dd4ef0d25..321a974e2 100644 --- a/src/cli.c +++ b/src/cli.c @@ -55,7 +55,6 @@ #include #include -#include #include #include #include diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 35a99c6c7..47a43e69a 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -37,7 +37,6 @@ #include #include -#include #include #include diff --git a/src/haproxy.c b/src/haproxy.c index b617249a9..d2aebce93 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -123,7 +123,6 @@ #include #include -#include #include #include #include diff --git a/src/http_ana.c b/src/http_ana.c index c420d796a..c6b292e79 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include diff --git a/src/lb_chash.c b/src/lb_chash.c index 4cb97ada4..508b90c04 100644 --- a/src/lb_chash.c +++ b/src/lb_chash.c @@ -16,13 +16,12 @@ * */ +#include #include #include #include #include - -#include #include /* Return next tree node after which must still be in the tree, or be diff --git a/src/lb_fas.c b/src/lb_fas.c index ae1297ea1..896740682 100644 --- a/src/lb_fas.c +++ b/src/lb_fas.c @@ -16,12 +16,11 @@ * */ +#include #include #include #include - -#include #include diff --git a/src/lb_fwlc.c b/src/lb_fwlc.c index 3aa050f4e..aef9353c8 100644 --- a/src/lb_fwlc.c +++ b/src/lb_fwlc.c @@ -10,12 +10,11 @@ * */ +#include #include #include #include - -#include #include diff --git a/src/lb_fwrr.c b/src/lb_fwrr.c index 7eafe489a..72029a6a4 100644 --- a/src/lb_fwrr.c +++ b/src/lb_fwrr.c @@ -10,12 +10,11 @@ * */ +#include #include #include #include - -#include #include static inline void fwrr_remove_from_tree(struct server *s); diff --git a/src/lb_map.c b/src/lb_map.c index 2b00fdb59..a6d1cf864 100644 --- a/src/lb_map.c +++ b/src/lb_map.c @@ -10,13 +10,12 @@ * */ +#include #include #include #include #include - -#include #include /* this function updates the map according to server 's new state. diff --git a/src/proxy.c b/src/proxy.c index 1ca6ab276..173f17dff 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -41,7 +41,6 @@ #include -#include #include #include #include diff --git a/src/queue.c b/src/queue.c index 6e9976966..9cdce013a 100644 --- a/src/queue.c +++ b/src/queue.c @@ -44,7 +44,7 @@ * - a pendconn_add() is only performed by the stream which will own the * pendconn ; the pendconn is allocated at this moment and returned ; it is * added to either the server or the proxy's queue while holding this - * queue's lock. +s * queue's lock. * * - the pendconn is then met by a thread walking over the proxy or server's * queue with the respective lock held. This lock is exclusive and the @@ -69,6 +69,7 @@ * - a pendconn doesn't switch between queues, it stays where it is. */ +#include #include #include #include diff --git a/src/server.c b/src/server.c index 7ac890513..df90b2240 100644 --- a/src/server.c +++ b/src/server.c @@ -15,6 +15,7 @@ #include #include +#include #include #include diff --git a/src/stats.c b/src/stats.c index 477b0ab87..4f6f6c009 100644 --- a/src/stats.c +++ b/src/stats.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -57,7 +58,6 @@ #include #include -#include #include #include #include diff --git a/src/stream.c b/src/stream.c index 4bf1bdc7d..b73060d32 100644 --- a/src/stream.c +++ b/src/stream.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -50,7 +51,6 @@ #include #include -#include #include #include #include