shared,platform: move "nmp-netns.[hc]" to shared/nm-platform

This commit is contained in:
Thomas Haller 2020-12-25 17:54:46 +01:00
parent 24c634bf57
commit 31dca65e04
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
18 changed files with 51 additions and 12 deletions

View file

@ -503,6 +503,9 @@ shared_nm_platform_libnm_platform_la_CPPFLAGS = \
shared_nm_platform_libnm_platform_la_SOURCES = \
shared/nm-platform/nm-netlink.c \
shared/nm-platform/nm-netlink.h \
shared/nm-platform/nmp-base.h \
shared/nm-platform/nmp-netns.c \
shared/nm-platform/nmp-netns.h \
$(NULL)
shared_nm_platform_libnm_platform_la_LDFLAGS = \
@ -2205,8 +2208,6 @@ src_libNetworkManagerBase_la_SOURCES = \
src/NetworkManagerUtils.c \
src/NetworkManagerUtils.h \
\
src/platform/nmp-netns.c \
src/platform/nmp-netns.h \
src/platform/nmp-object.c \
src/platform/nmp-object.h \
src/platform/nm-platform-utils.c \

View file

@ -207,6 +207,7 @@ libnm_platform = static_library(
'nm-platform',
sources: [
'nm-platform/nm-netlink.c',
'nm-platform/nmp-netns.c',
],
dependencies: [
glib_nm_default_dep,

View file

@ -0,0 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef __NMP_FWD_H__
#define __NMP_FWD_H__
typedef struct _NMPNetns NMPNetns;
#endif /* __NMP_FWD_H__ */

View file

@ -13,6 +13,8 @@
#include <sys/types.h>
#include <pthread.h>
#include "nm-log-core/nm-logging.h"
/*****************************************************************************/
/* NOTE: NMPNetns and all code used here must be thread-safe! */

View file

@ -6,6 +6,8 @@
#ifndef __NMP_NETNS_UTILS_H__
#define __NMP_NETNS_UTILS_H__
#include "nmp-base.h"
/*****************************************************************************/
#define NMP_TYPE_NETNS (nmp_netns_get_type())
@ -18,6 +20,7 @@
#define NMP_NETNS_FD_NET "fd-net"
#define NMP_NETNS_FD_MNT "fd-mnt"
typedef struct _NMPNetns NMPNetns;
typedef struct _NMPNetnsClass NMPNetnsClass;
GType nmp_netns_get_type(void);

View file

@ -11,7 +11,6 @@ exe = executable(
libnm_log_core_dep,
libnm_platform_dep,
],
link_with: libnm_systemd_logging_stub,
)
test(

View file

@ -4,12 +4,22 @@
#include "nm-default.h"
#include "nm-log-core/nm-logging.h"
#include "nm-platform/nm-netlink.h"
#include "nm-platform/nmp-netns.h"
#include "nm-utils/nm-test-utils.h"
/*****************************************************************************/
void
_nm_logging_clear_platform_logging_cache(void)
{
/* this symbols is required by nm-log-core library. */
}
/*****************************************************************************/
static void
test_use_symbols(void)
{
@ -72,6 +82,19 @@ test_use_symbols(void)
(void (*)(void)) nl_send,
(void (*)(void)) nl_send_auto,
(void (*)(void)) nl_recv,
(void (*)(void)) nmp_netns_bind_to_path,
(void (*)(void)) nmp_netns_bind_to_path_destroy,
(void (*)(void)) nmp_netns_get_current,
(void (*)(void)) nmp_netns_get_fd_mnt,
(void (*)(void)) nmp_netns_get_fd_net,
(void (*)(void)) nmp_netns_get_initial,
(void (*)(void)) nmp_netns_is_initial,
(void (*)(void)) nmp_netns_new,
(void (*)(void)) nmp_netns_pop,
(void (*)(void)) nmp_netns_push,
(void (*)(void)) nmp_netns_push_type,
NULL,
};

View file

@ -38,7 +38,6 @@ sources = files(
'platform/nm-linux-platform.c',
'platform/nm-platform.c',
'platform/nm-platform-utils.c',
'platform/nmp-netns.c',
'platform/nmp-object.c',
'platform/nmp-rules-manager.c',
'main-utils.c',

View file

@ -18,7 +18,7 @@
#include "nm-ndisc-private.h"
#include "NetworkManagerUtils.h"
#include "platform/nm-platform.h"
#include "platform/nmp-netns.h"
#include "nm-platform/nmp-netns.h"
#define _NMLOG_PREFIX_NAME "ndisc-lndp"

View file

@ -15,7 +15,7 @@
#include "nm-ndisc-private.h"
#include "nm-utils.h"
#include "platform/nm-platform.h"
#include "platform/nmp-netns.h"
#include "nm-platform/nmp-netns.h"
#include "nm-l3-config-data.h"
#define _NMLOG_PREFIX_NAME "ndisc"

View file

@ -14,7 +14,7 @@
#include "nm-core-internal.h"
#include "nm-l3cfg.h"
#include "platform/nm-platform.h"
#include "platform/nmp-netns.h"
#include "nm-platform/nmp-netns.h"
#include "platform/nmp-rules-manager.h"
/*****************************************************************************/

View file

@ -6,6 +6,8 @@
#ifndef __NM_NETNS_H__
#define __NM_NETNS_H__
#include "nm-platform/nmp-base.h"
#define NM_TYPE_NETNS (nm_netns_get_type())
#define NM_NETNS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_NETNS, NMNetns))
#define NM_NETNS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_NETNS, NMNetnsClass))

View file

@ -121,7 +121,6 @@ typedef struct _NMPlatformIP4Route NMPlatformIP4Route;
typedef struct _NMPlatformIP6Address NMPlatformIP6Address;
typedef struct _NMPlatformIP6Route NMPlatformIP6Route;
typedef struct _NMPlatformLink NMPlatformLink;
typedef struct _NMPNetns NMPNetns;
typedef struct _NMPObject NMPObject;
typedef enum {

View file

@ -43,7 +43,7 @@
#include "nm-platform/nm-netlink.h"
#include "nm-core-utils.h"
#include "nmp-object.h"
#include "nmp-netns.h"
#include "nm-platform/nmp-netns.h"
#include "nm-platform-utils.h"
#include "nm-platform-private.h"
#include "wifi/nm-wifi-utils.h"

View file

@ -32,7 +32,7 @@
#include "nm-platform-utils.h"
#include "nm-platform-private.h"
#include "nmp-object.h"
#include "nmp-netns.h"
#include "nm-platform/nmp-netns.h"
/*****************************************************************************/

View file

@ -9,6 +9,8 @@
#include "nm-dbus-interface.h"
#include "nm-core-types-internal.h"
#include "nm-platform/nmp-base.h"
#include "nm-core-utils.h"
#include "nm-setting-vlan.h"
#include "nm-setting-wired.h"

View file

@ -13,7 +13,7 @@
#include "nm-glib-aux/nm-io-utils.h"
#include "platform/nmp-object.h"
#include "platform/nmp-netns.h"
#include "nm-platform/nmp-netns.h"
#include "platform/nm-platform-utils.h"
#include "test-common.h"

View file

@ -6,7 +6,7 @@
#include "nm-test-utils-core.h"
#include "platform/nmp-object.h"
#include "platform/nmp-netns.h"
#include "nm-platform/nmp-netns.h"
#include "platform/nm-platform-utils.h"
#include "test-common.h"