]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: include: move fd.h to haproxy/fd{,-t}.h
authorWilly Tarreau <w@1wt.eu>
Wed, 3 Jun 2020 17:33:00 +0000 (19:33 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Jun 2020 08:18:57 +0000 (10:18 +0200)
A few includes were missing in each file. A definition of
struct polled_mask was moved to fd-t.h. The MAX_POLLERS macro was
moved to defaults.h

Stdio used to be silently inherited from whatever path but it's needed
for list_pollers() which takes a FILE* and which can thus not be
forward-declared.

34 files changed:
include/haproxy/defaults.h
include/haproxy/fd-t.h [moved from include/types/fd.h with 91% similarity]
include/haproxy/fd.h [moved from include/proto/fd.h with 94% similarity]
include/proto/connection.h
include/proto/stream.h
include/proto/task.h
src/checks.c
src/cli.c
src/connection.c
src/debug.c
src/dns.c
src/ev_epoll.c
src/ev_evports.c
src/ev_kqueue.c
src/ev_poll.c
src/ev_select.c
src/fd.c
src/frontend.c
src/haproxy.c
src/listener.c
src/log.c
src/mworker.c
src/peers.c
src/proto_sockpair.c
src/proto_tcp.c
src/proto_udp.c
src/proto_uxst.c
src/proxy.c
src/raw_sock.c
src/ssl_sock.c
src/stats.c
src/stream.c
src/task.c
src/thread.c

index 165c78b8e51027ba97d8a7aa328de245e4c14c68..dff5436d598a3c3613d2bee189b1516bf9446fb7 100644 (file)
 #define DEFAULT_PAT_LRU_SIZE 10000
 #endif
 
+/* maximum number of pollers that may be registered */
+#ifndef MAX_POLLERS
+#define MAX_POLLERS    10
+#endif
+
 #endif /* _HAPROXY_DEFAULTS_H */
similarity index 91%
rename from include/types/fd.h
rename to include/haproxy/fd-t.h
index 66fab44dea69cbaf4161b57894e0be232e28779b..5f1c173aaabbaac053cf1f6a34ce64a7f9f5eb17 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * include/types/fd.h
+ * include/haproxy/fd-t.h
  * File descriptors states - check src/fd.c for explanations.
  *
  * Copyright (C) 2000-2014 Willy Tarreau - w@1wt.eu
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef _TYPES_FD_H
-#define _TYPES_FD_H
+#ifndef _HAPROXY_FD_T_H
+#define _HAPROXY_FD_T_H
 
 #include <haproxy/api-t.h>
-#include <import/ist.h>
 #include <haproxy/port_range-t.h>
 
 /* Direction for each FD event update */
@@ -107,13 +106,13 @@ enum {
 struct fdlist_entry {
        int next;
        int prev;
-} __attribute__ ((aligned(8)));
+} ALIGNED(8);
 
 /* head of the fd cache */
 struct fdlist {
        int first;
        int last;
-} __attribute__ ((aligned(8)));
+} ALIGNED(8);
 
 /* info about one given fd */
 struct fdtab {
@@ -133,10 +132,16 @@ struct fdtab {
 /* only align on cache lines when using threads; 32-bit small archs
  * can put everything in 32-bytes when threads are disabled.
  */
-__attribute__((aligned(64)))
+ALIGNED(64)
 #endif
 ;
 
+/* polled mask, one bit per thread and per direction for each FD */
+struct polled_mask {
+       unsigned long poll_recv;
+       unsigned long poll_send;
+};
+
 /* less often used information */
 struct fdinfo {
        struct port_range *port_range;       /* optional port range to bind to */
@@ -174,17 +179,7 @@ struct poller {
        int    pref;                                         /* try pollers with higher preference first */
 };
 
-extern struct poller cur_poller; /* the current poller */
-extern int nbpollers;
-#define MAX_POLLERS    10
-extern struct poller pollers[MAX_POLLERS];   /* all registered pollers */
-
-extern struct fdtab *fdtab;             /* array of all the file descriptors */
-extern struct fdinfo *fdinfo;           /* less-often used infos for file descriptors */
-extern int totalconn;                   /* total # of terminated sessions */
-extern int actconn;                     /* # of active sessions */
-
-#endif /* _TYPES_FD_H */
+#endif /* _HAPROXY_FD_T_H */
 
 /*
  * Local variables:
similarity index 94%
rename from include/proto/fd.h
rename to include/haproxy/fd.h
index 65442391598d5613a099c17a35885a0e81de4499..0f1799d346d1f6fc62c46b4d90513728014581e1 100644 (file)
@@ -1,8 +1,8 @@
 /*
- * include/proto/fd.h
- * File descriptors states.
+ * include/haproxy/fd.h
+ * File descriptors states - exported variables and functions
  *
- * Copyright (C) 2000-2014 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_FD_H
-#define _PROTO_FD_H
+#ifndef _HAPROXY_FD_H
+#define _HAPROXY_FD_H
 
-#include <stdio.h>
 #include <sys/time.h>
 #include <sys/types.h>
+#include <stdio.h>
 #include <unistd.h>
-
+#include <import/ist.h>
+#include <haproxy/activity.h>
 #include <haproxy/api.h>
+#include <haproxy/fd-t.h>
+#include <haproxy/thread.h>
 #include <haproxy/ticks.h>
 #include <haproxy/time.h>
-#include <types/fd.h>
-#include <haproxy/activity.h>
 
 /* public variables */
 
-extern volatile struct fdlist update_list;
-
+extern struct poller cur_poller; /* the current poller */
+extern int nbpollers;
+extern struct poller pollers[MAX_POLLERS];   /* all registered pollers */
+extern struct fdtab *fdtab;             /* array of all the file descriptors */
+extern struct fdinfo *fdinfo;           /* less-often used infos for file descriptors */
+extern int totalconn;                   /* total # of terminated sessions */
+extern int actconn;                     /* # of active sessions */
 
-extern struct polled_mask {
-       unsigned long poll_recv;
-       unsigned long poll_send;
-} *polled_mask;
+extern volatile struct fdlist update_list;
+extern struct polled_mask *polled_mask;
 
 extern THREAD_LOCAL int *fd_updt;  // FD updates list
 extern THREAD_LOCAL int fd_nbupdt; // number of updates in the list
@@ -66,6 +70,7 @@ void fd_remove(int fd);
  */
 int fd_takeover(int fd, void *expected_owner);
 
+/* lock used by FD migration */
 #ifndef HA_HAVE_CAS_DW
 __decl_thread(extern HA_RWLOCK_T fd_mig_lock);
 #endif
@@ -497,7 +502,7 @@ static inline void wake_thread(int tid)
 }
 
 
-#endif /* _PROTO_FD_H */
+#endif /* _HAPROXY_FD_H */
 
 /*
  * Local variables:
index de976d7a750b1bc157439e23de8a5bbac7f9a314..9cf1aaaad4f26dc8655ce154a1192c1764b26164 100644 (file)
@@ -27,7 +27,7 @@
 #include <haproxy/pool.h>
 #include <types/connection.h>
 #include <types/listener.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/obj_type.h>
 #include <proto/session.h>
 #include <proto/task.h>
index 80c56ef8889f97c342abfe90b941f8a5955a4423..ac555451ede0fe56ee29470f74736728ac877b11 100644 (file)
@@ -26,7 +26,7 @@
 #include <haproxy/pool.h>
 #include <types/action.h>
 #include <types/stream.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <proto/obj_type.h>
 #include <proto/queue.h>
index c928a11c0fe0666a92e42f57d29ec1232d2a35cf..17a82881364ac14084a260760f1f88fe97e9c783 100644 (file)
@@ -38,7 +38,7 @@
 #include <types/global.h>
 #include <types/task.h>
 
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 
 /* Principle of the wait queue.
  *
index 499bc516077a3346741f21c752f043435e1fc6c8..3d3fbd118ef39fe228f119c66c0b449e41be97b6 100644 (file)
@@ -52,7 +52,7 @@
 #include <proto/backend.h>
 #include <proto/checks.h>
 #include <proto/stats.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/http_htx.h>
 #include <proto/log.h>
 #include <proto/mux_pt.h>
index df0e0f28d8a26a94197100f17dfdb8030bbe4bc4..bdfb27091928169968a6dda4b7033312fb0dfa38 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -48,7 +48,7 @@
 #include <proto/cli.h>
 #include <proto/compression.h>
 #include <proto/stats.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <proto/frontend.h>
 #include <proto/log.h>
index 688be9a5562f66aaee23daf1737bf8226e27628f..d7c77d287298bc4be94a5ab5bd960cdaec49652c 100644 (file)
@@ -19,7 +19,7 @@
 #include <haproxy/net_helper.h>
 
 #include <proto/connection.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/frontend.h>
 #include <proto/proto_tcp.h>
 #include <proto/stream_interface.h>
index 9aef05ba5de724046c7efb1d61c9ded16110df12..bf2bc1a14893251764ad44b51aac01c1dbd00c03 100644 (file)
@@ -31,7 +31,7 @@
 #include <types/signal.h>
 
 #include <proto/cli.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/hlua.h>
 #include <proto/stream_interface.h>
 #include <proto/task.h>
index 0390212060af78bd1c80d36111ef801bb8df643a..a74bd36685c1cd3400d8ad15d08de6316347a9b1 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -38,7 +38,7 @@
 #include <proto/cli.h>
 #include <proto/checks.h>
 #include <proto/dns.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/http_ana.h>
 #include <proto/http_rules.h>
 #include <proto/log.h>
index 40f5e9cbb54569b8c1fcb2e9d3c9a9d66a070f28..d5717e74c77b6d46aaf0d0f353f4c0057f43b3af 100644 (file)
@@ -23,7 +23,7 @@
 #include <types/global.h>
 
 #include <haproxy/activity.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/signal.h>
 
 
index 9f3158ae0ff27a05624d53796176f3a08ada6979..0a18bd3a7cd6011e902636a079053c79bb37d8d0 100644 (file)
@@ -26,7 +26,7 @@
 #include <types/global.h>
 
 #include <haproxy/activity.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/log.h>
 #include <proto/signal.h>
 
index 95a6897faf81bea4c31b0c8e5e687f1fd59008e7..5746f1a2f947ae932d3eecdd234b699370aea5db 100644 (file)
@@ -25,7 +25,7 @@
 #include <types/global.h>
 
 #include <haproxy/activity.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/signal.h>
 
 
index 0d0fcaa92a0696b7c0139c5749e1f96a1107115c..344b6d4a1616172257df0e3074a90033b85a8b10 100644 (file)
@@ -25,7 +25,7 @@
 #include <types/global.h>
 
 #include <haproxy/activity.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 
 
 #ifndef POLLRDHUP
index c6c3f438c7c19beada673316c81f53159a6430b3..6a5d2f8b39663d270663ba06e2cff7cdccac64b9 100644 (file)
@@ -22,7 +22,7 @@
 #include <types/global.h>
 
 #include <haproxy/activity.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 
 
 /* private data */
index 56a0b7b40eda1f845e812ed929891691c53cabbd..60db19ccc1ac4cc1a8104466a3995a81e5e7c940 100644 (file)
--- a/src/fd.c
+++ b/src/fd.c
@@ -91,7 +91,7 @@
 #include <haproxy/api.h>
 #include <types/global.h>
 
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/log.h>
 #include <haproxy/port_range.h>
 
index 22e2acc4978eb5a0db3c415616c3be81d75c3b6a..82067090c480a2042108aabba29d10f5f947f1e1 100644 (file)
@@ -32,7 +32,7 @@
 #include <proto/acl.h>
 #include <proto/arg.h>
 #include <proto/channel.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/frontend.h>
 #include <proto/log.h>
 #include <proto/proto_tcp.h>
index 57fedf86e6c67439fe78fd4db8758c349bd4f111..3f2dd130838526f0e9d53faca665c682e6ba4ebd 100644 (file)
 #include <proto/channel.h>
 #include <proto/cli.h>
 #include <proto/connection.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/filters.h>
 #include <proto/hlua.h>
 #include <proto/http_rules.h>
index ac7b3287ed0678362882e8c273f223fcedb33ecd..aa935d6daed7714628f48fd1cb3103c1b0f5cca2 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <proto/acl.h>
 #include <proto/connection.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <proto/log.h>
 #include <proto/listener.h>
index 353b4283c37b7a4a799a9a51f402f5c42953174c..b036c9990966494b4c4b71da58c43cb9f95fa902 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -36,7 +36,7 @@
 
 #include <proto/applet.h>
 #include <proto/cli.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/frontend.h>
 #include <proto/log.h>
 #include <proto/ring.h>
index 4b2a7afafd70ab8d7918a553c2e3ffcf36a2f3f4..4f5ade24a7ec5f0b2d88de5651a6b7e4996337bd 100644 (file)
@@ -28,7 +28,7 @@
 #include <types/signal.h>
 
 #include <proto/cli.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/listener.h>
 #include <proto/log.h>
 #include <proto/mworker.h>
index d4011d3eec107290dfc7de02e73907ae5e0b1bbd..4d16b41a4608d81e006ac6115af209fd03cffe8f 100644 (file)
@@ -37,7 +37,7 @@
 #include <proto/applet.h>
 #include <proto/channel.h>
 #include <proto/cli.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/frontend.h>
 #include <proto/log.h>
 #include <proto/mux_pt.h>
index e133a84a771d9f1fa906d5e878c4db05fe4a7221..0bff96d883915ae8ba4636429c6e5a55b394f417 100644 (file)
@@ -36,7 +36,7 @@
 #include <types/global.h>
 
 #include <proto/connection.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <proto/listener.h>
 #include <proto/log.h>
index 2abfd85337e66f41ec3edbf9fc73c7520278c27b..9b109f4259b25d92f0f5894ae6dfe1e564a4767a 100644 (file)
@@ -44,7 +44,7 @@
 #include <proto/arg.h>
 #include <proto/channel.h>
 #include <proto/connection.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/http_rules.h>
 #include <proto/listener.h>
 #include <proto/log.h>
index 810c31416ddd6593ce38848a97c93cadf9dc60d9..a1d91760a725ab891bf0810603e4bea6d92ce600 100644 (file)
  */
 
 #include <types/global.h>
-#include <types/fd.h>
+#include <haproxy/fd-t.h>
 #include <types/proto_udp.h>
 
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 
 /* datagram handler callback */
 void dgram_fd_handler(int fd)
index 429ca1cc34b95cdbe5f56ddaa87dd84d324604ab..a3eefa95332604d899e754473b4e477d4f41b249 100644 (file)
@@ -36,7 +36,7 @@
 #include <types/global.h>
 
 #include <proto/connection.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/listener.h>
 #include <proto/log.h>
 #include <haproxy/protocol.h>
index a8ca53a318d7ecbb07f6dc5206cdf222a409d96e..45750b723b928c8702a2c4b1fa00e49ddfee6744 100644 (file)
@@ -36,7 +36,7 @@
 #include <proto/applet.h>
 #include <proto/cli.h>
 #include <proto/backend.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/filters.h>
 #include <proto/listener.h>
 #include <proto/log.h>
index 6503b3b8496270ac04471b8fdce61ecfefb679aa..c1af72a2cc6e1b2654619d0350ef4c8db26fa352 100644 (file)
@@ -29,7 +29,7 @@
 #include <haproxy/time.h>
 
 #include <proto/connection.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <proto/log.h>
 #include <proto/pipe.h>
index 44818d0af2af5de44d2d201ba4665616d20d3b33..357828d29301dbf6d67e0cbfd06f6685382b9e9e 100644 (file)
@@ -68,7 +68,7 @@
 #include <proto/channel.h>
 #include <proto/connection.h>
 #include <proto/cli.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <proto/frontend.h>
 #include <proto/http_rules.h>
index b43665c0137f09aa52844272545eb02925697bcc..115b9adebc2ff738f447f1eae1fd4d7bfaf4ba40 100644 (file)
@@ -51,7 +51,7 @@
 #include <proto/compression.h>
 #include <proto/dns.h>
 #include <proto/stats.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <proto/frontend.h>
 #include <proto/http_htx.h>
index f0e2c88427bac3c0f7b884752205410c93b8eb82..904eaef03a7481e324933e4e3792f81e95f15f0a 100644 (file)
@@ -41,7 +41,7 @@
 #include <proto/connection.h>
 #include <proto/dns.h>
 #include <proto/stats.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <proto/filters.h>
 #include <haproxy/freq_ctr.h>
 #include <proto/frontend.h>
index eacc3fdee7993d6e04e858d6d8da25bf0c329462..24c3b3e5476a39a7e485da2f921e123ba88fcbc2 100644 (file)
@@ -20,7 +20,7 @@
 #include <import/eb32sctree.h>
 #include <import/eb32tree.h>
 
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 #include <haproxy/freq_ctr.h>
 #include <proto/proxy.h>
 #include <proto/stream.h>
index 2a7ec9ae452fce675345a3d8fd3d8e7c6d988b2d..0ee9332d062f22b37a55788981726611f1612151 100644 (file)
@@ -27,7 +27,7 @@
 #include <haproxy/thread.h>
 #include <haproxy/tools.h>
 #include <types/global.h>
-#include <proto/fd.h>
+#include <haproxy/fd.h>
 
 struct thread_info ha_thread_info[MAX_THREADS] = { };
 THREAD_LOCAL struct thread_info *ti = &ha_thread_info[0];