]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: include: move common/namespace.h to haproxy/namespace{,-t}.h
authorWilly Tarreau <w@1wt.eu>
Tue, 2 Jun 2020 15:02:59 +0000 (17:02 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Jun 2020 08:18:57 +0000 (10:18 +0200)
The type was moved out as it's used by standard.h for netns_entry.
Instead of just being a forward declaration when not used, it's an
empty struct, which makes gdb happier (the resulting stripped executable
is the same).

13 files changed:
include/common/namespace.h [deleted file]
include/common/standard.h
include/haproxy/namespace-t.h [new file with mode: 0644]
include/haproxy/namespace.h [new file with mode: 0644]
src/backend.c
src/cfgparse.c
src/connection.c
src/filters.c
src/haproxy.c
src/namespace.c
src/proto_tcp.c
src/server.c
src/standard.c

diff --git a/include/common/namespace.h b/include/common/namespace.h
deleted file mode 100644 (file)
index 596aac3..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _NAMESPACE_H
-#define _NAMESPACE_H
-
-#include <stdlib.h>
-#include <import/ebistree.h>
-
-#ifdef USE_NS
-
-struct netns_entry
-{
-       struct ebpt_node node;
-       size_t name_len;
-       int fd;
-};
-
-int my_socketat(const struct netns_entry *ns, int domain, int type, int protocol);
-struct netns_entry* netns_store_insert(const char *ns_name);
-const struct netns_entry* netns_store_lookup(const char *ns_name, size_t ns_name_len);
-
-int netns_init(void);
-
-#else /* no namespace support */
-
-struct netns_entry;
-
-static inline int my_socketat(const struct netns_entry *ns, int domain, int type, int protocol)
-{
-       return socket(domain, type, protocol);
-}
-
-#endif /* USE_NS */
-
-#endif /* _NAMESPACE_H */
index d2231d803255d2a2ee65ba56d9efe7251de7f4c5..fdaa2a8ae8537f22cf478155761b9d852e576ead 100644 (file)
@@ -40,7 +40,7 @@
 #include <haproxy/api.h>
 #include <haproxy/intops.h>
 #include <haproxy/chunk.h>
-#include <common/namespace.h>
+#include <haproxy/namespace-t.h>
 #include <import/eb32tree.h>
 #include <import/eb32sctree.h>
 #include <types/protocol.h>
diff --git a/include/haproxy/namespace-t.h b/include/haproxy/namespace-t.h
new file mode 100644 (file)
index 0000000..3a97336
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * include/haproxy/namespace-t.h
+ * Linux network namespaces types definitions
+ *
+ * Copyright (C) 2014 Tamas Kovacs, Sarkozi Laszlo, Krisztian Kovacs
+ * Copyright (C) 2015-2020 Willy Tarreau
+ *
+ * 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_NAMESPACE_T_H
+#define _HAPROXY_NAMESPACE_T_H
+
+#include <stddef.h>
+#include <import/ebpttree.h>
+
+/* the struct is just empty if namespaces are not supported */
+struct netns_entry
+{
+#ifdef USE_NS
+       struct ebpt_node node;
+       size_t name_len;
+       int fd;
+#endif
+};
+
+#endif /* _HAPROXY_NAMESPACE_T_H */
diff --git a/include/haproxy/namespace.h b/include/haproxy/namespace.h
new file mode 100644 (file)
index 0000000..ad52cb1
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * include/haproxy/namespace.h
+ * Linux network namespaces management
+ *
+ * Copyright (C) 2014 Tamas Kovacs, Sarkozi Laszlo, Krisztian Kovacs
+ * Copyright (C) 2015-2020 Willy Tarreau
+ *
+ * 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_NAMESPACE_H
+#define _HAPROXY_NAMESPACE_H
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <haproxy/namespace-t.h>
+#include <import/ebistree.h>
+
+#ifdef USE_NS
+
+int my_socketat(const struct netns_entry *ns, int domain, int type, int protocol);
+struct netns_entry* netns_store_insert(const char *ns_name);
+const struct netns_entry* netns_store_lookup(const char *ns_name, size_t ns_name_len);
+int netns_init(void);
+
+#else /* no namespace support */
+
+static inline int my_socketat(const struct netns_entry *ns, int domain, int type, int protocol)
+{
+       return socket(domain, type, protocol);
+}
+
+#endif /* USE_NS */
+
+#endif /* _HAPROXY_NAMESPACE_H */
index c9abbc7ab3f2a515eb7a679b3be28be8b8935ecf..9f87a3c0b8af17b483ac5eea38dcca557c6e11d4 100644 (file)
@@ -24,7 +24,7 @@
 #include <common/htx.h>
 #include <common/ticks.h>
 #include <haproxy/time.h>
-#include <common/namespace.h>
+#include <haproxy/namespace.h>
 
 #include <types/global.h>
 
index 205f4fbee4d80d697d975a12091304dd4f42eabe..8cdfb15a4bee151bcc2d9287bf88237ca4d35577 100644 (file)
@@ -41,7 +41,7 @@
 #include <common/standard.h>
 #include <haproxy/time.h>
 #include <common/uri_auth.h>
-#include <common/namespace.h>
+#include <haproxy/namespace.h>
 #include <haproxy/thread.h>
 
 #include <types/capture.h>
index a74585a1578733eac216800659e1fb1e39e6fdea..688be9a5562f66aaee23daf1737bf8226e27628f 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <haproxy/api.h>
 #include <common/cfgparse.h>
-#include <common/namespace.h>
+#include <haproxy/namespace.h>
 #include <haproxy/hash.h>
 #include <haproxy/net_helper.h>
 
index 1b715735308a528c2c2cb2f475e979c33e0695ca..50d1c8a4cf47b5e1371dff2e6e0523c7ad5b76c4 100644 (file)
@@ -15,7 +15,7 @@
 #include <common/cfgparse.h>
 #include <haproxy/errors.h>
 #include <common/htx.h>
-#include <common/namespace.h>
+#include <haproxy/namespace.h>
 #include <common/standard.h>
 
 #include <types/filters.h>
index 8e5342043f7ec0b665e83a831dd9d912b87f2346..36f669419a04b61a23ddfb929e89545a0a7f7e6b 100644 (file)
@@ -88,7 +88,7 @@
 #include <haproxy/errors.h>
 #include <haproxy/pool.h>
 #include <haproxy/list.h>
-#include <common/namespace.h>
+#include <haproxy/namespace.h>
 #include <haproxy/net_helper.h>
 #include <haproxy/openssl-compat.h>
 #include <common/regex.h>
index 6165994ec9c010c96d2ad1ae5df3f164cc07da5b..4f82c620371c898fe0844a9f6b39e8f946cea0ca 100644 (file)
@@ -11,7 +11,7 @@
 #include <string.h>
 
 #include <haproxy/api.h>
-#include <common/namespace.h>
+#include <haproxy/namespace.h>
 #include <haproxy/hash.h>
 #include <haproxy/errors.h>
 #include <proto/log.h>
index 9d875153773620d596592d4dd0e33d99e62b1b5c..973a4d3138c40cc79b5f2100f44c8669af97f99e 100644 (file)
@@ -34,7 +34,7 @@
 #include <haproxy/errors.h>
 #include <haproxy/list.h>
 #include <common/standard.h>
-#include <common/namespace.h>
+#include <haproxy/namespace.h>
 
 #include <types/action.h>
 #include <types/connection.h>
index d06c46502e31dd457dff3d82cc9dd6c9bdad0121..29919ee4150964a6ef0f5a8f5fbecf09e82da782 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <common/cfgparse.h>
 #include <haproxy/errors.h>
-#include <common/namespace.h>
+#include <haproxy/namespace.h>
 #include <haproxy/time.h>
 
 #include <types/applet.h>
index 2b32429eb276fef036f89552aa42f86701ca5091..8e9722e3497d375eb7c728ad4177a8ba8b1095f8 100644 (file)
@@ -38,6 +38,7 @@
 
 #include <haproxy/api.h>
 #include <haproxy/chunk.h>
+#include <haproxy/namespace.h>
 #include <common/standard.h>
 #include <types/global.h>
 #include <proto/applet.h>