mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
REORG: include: move common/namespace.h to haproxy/namespace{,-t}.h
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).
This commit is contained in:
parent
6131d6a731
commit
7a00efbe43
@ -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 */
|
@ -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>
|
||||
|
39
include/haproxy/namespace-t.h
Normal file
39
include/haproxy/namespace-t.h
Normal file
@ -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 */
|
47
include/haproxy/namespace.h
Normal file
47
include/haproxy/namespace.h
Normal file
@ -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 */
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user