mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-09 04:05:56 +00:00
core/logging: move "nm-logging.c" to shared/nm-log-core/libnm-log-core library
We want to move platform code to "shared/nm-platform". However, platform code uses the logging infrastructure from the daemon, there is thus an odd circular dependency. Solve that by moving the "src/nm-logging.[hc]" to a new helper library in "shared/nm-log-core".
This commit is contained in:
parent
c6e1327495
commit
24c634bf57
39
Makefile.am
39
Makefile.am
|
@ -464,6 +464,36 @@ shared_nm_udev_aux_libnm_udev_aux_la_LIBADD = \
|
|||
|
||||
###############################################################################
|
||||
|
||||
noinst_LTLIBRARIES += shared/nm-log-core/libnm-log-core.la
|
||||
|
||||
shared_nm_log_core_libnm_log_core_la_CPPFLAGS = \
|
||||
$(dflt_cppflags) \
|
||||
-I$(srcdir)/shared \
|
||||
$(CODE_COVERAGE_CFLAGS) \
|
||||
$(SANITIZER_LIB_CFLAGS) \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(SYSTEMD_JOURNAL_CFLAGS) \
|
||||
-DG_LOG_DOMAIN=\""NetworkManager"\" \
|
||||
-DNETWORKMANAGER_COMPILATION='(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)' \
|
||||
$(NULL)
|
||||
|
||||
shared_nm_log_core_libnm_log_core_la_SOURCES = \
|
||||
shared/nm-log-core/nm-logging.c \
|
||||
shared/nm-log-core/nm-logging.h \
|
||||
$(NULL)
|
||||
|
||||
shared_nm_log_core_libnm_log_core_la_LDFLAGS = \
|
||||
$(CODE_COVERAGE_LDFLAGS) \
|
||||
$(SANITIZER_LIB_LDFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
shared_nm_log_core_libnm_log_core_la_LIBADD = \
|
||||
$(GLIB_LIBS) \
|
||||
$(SYSTEMD_JOURNAL_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
###############################################################################
|
||||
|
||||
noinst_LTLIBRARIES += shared/nm-platform/libnm-platform.la
|
||||
|
||||
shared_nm_platform_libnm_platform_la_CPPFLAGS = \
|
||||
|
@ -494,6 +524,7 @@ shared_nm_platform_tests_test_nm_platform_CPPFLAGS = \
|
|||
-DNETWORKMANAGER_COMPILATION_TEST \
|
||||
-DNETWORKMANAGER_COMPILATION='(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)' \
|
||||
$(CODE_COVERAGE_CFLAGS) \
|
||||
$(SYSTEMD_JOURNAL_CFLAGS) \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(SANITIZER_LIB_CFLAGS) \
|
||||
$(NULL)
|
||||
|
@ -505,9 +536,11 @@ shared_nm_platform_tests_test_nm_platform_LDFLAGS = \
|
|||
|
||||
shared_nm_platform_tests_test_nm_platform_LDADD = \
|
||||
shared/nm-platform/libnm-platform.la \
|
||||
shared/nm-log-core/libnm-log-core.la \
|
||||
shared/nm-glib-aux/libnm-glib-aux.la \
|
||||
shared/nm-std-aux/libnm-std-aux.la \
|
||||
shared/libcsiphash.la \
|
||||
$(SYSTEMD_JOURNAL_LIBS) \
|
||||
$(GLIB_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
@ -2168,8 +2201,6 @@ src_libNetworkManagerBase_la_SOURCES = \
|
|||
\
|
||||
src/nm-core-utils.c \
|
||||
src/nm-core-utils.h \
|
||||
src/nm-logging.c \
|
||||
src/nm-logging.h \
|
||||
\
|
||||
src/NetworkManagerUtils.c \
|
||||
src/NetworkManagerUtils.h \
|
||||
|
@ -2245,7 +2276,6 @@ endif
|
|||
|
||||
src_libNetworkManagerBase_la_LIBADD = \
|
||||
$(GLIB_LIBS) \
|
||||
$(SYSTEMD_JOURNAL_LIBS) \
|
||||
$(LIBUDEV_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
|
@ -2443,6 +2473,7 @@ src_libNetworkManager_la_LIBADD = \
|
|||
$(libnm_crypto_lib) \
|
||||
libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \
|
||||
shared/nm-platform/libnm-platform.la \
|
||||
shared/nm-log-core/libnm-log-core.la \
|
||||
shared/nm-udev-aux/libnm-udev-aux.la \
|
||||
shared/nm-glib-aux/libnm-glib-aux.la \
|
||||
shared/nm-std-aux/libnm-std-aux.la \
|
||||
|
@ -2555,6 +2586,7 @@ src_nm_iface_helper_LDADD = \
|
|||
$(libnm_crypto_lib) \
|
||||
libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \
|
||||
shared/nm-platform/libnm-platform.la \
|
||||
shared/nm-log-core/libnm-log-core.la \
|
||||
shared/nm-udev-aux/libnm-udev-aux.la \
|
||||
shared/nm-glib-aux/libnm-glib-aux.la \
|
||||
shared/nm-std-aux/libnm-std-aux.la \
|
||||
|
@ -2608,6 +2640,7 @@ src_initrd_nm_initrd_generator_LDADD = \
|
|||
$(libnm_crypto_lib) \
|
||||
libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \
|
||||
shared/nm-platform/libnm-platform.la \
|
||||
shared/nm-log-core/libnm-log-core.la \
|
||||
shared/nm-udev-aux/libnm-udev-aux.la \
|
||||
shared/nm-glib-aux/libnm-glib-aux.la \
|
||||
shared/nm-std-aux/libnm-std-aux.la \
|
||||
|
|
|
@ -147,6 +147,7 @@ libnm/nm-vpn-plugin-old.c
|
|||
libnm/nm-vpn-service-plugin.c
|
||||
data/org.freedesktop.NetworkManager.policy.in.in
|
||||
shared/nm-glib-aux/nm-shared-utils.c
|
||||
shared/nm-log-core/nm-logging.c
|
||||
src/NetworkManagerUtils.c
|
||||
src/main.c
|
||||
src/main-utils.c
|
||||
|
@ -179,7 +180,6 @@ src/devices/wifi/nm-wifi-utils.c
|
|||
src/devices/wwan/nm-modem-broadband.c
|
||||
src/nm-config.c
|
||||
src/nm-iface-helper.c
|
||||
src/nm-logging.c
|
||||
src/nm-manager.c
|
||||
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
|
||||
src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
|
||||
|
|
|
@ -182,6 +182,27 @@ libnm_udev_aux_dep = declare_dependency(
|
|||
link_with: libnm_udev_aux,
|
||||
)
|
||||
|
||||
libnm_log_core = static_library(
|
||||
'nm-log-core',
|
||||
sources: 'nm-log-core/nm-logging.c',
|
||||
dependencies: [
|
||||
glib_nm_default_dep,
|
||||
libsystemd_dep,
|
||||
],
|
||||
c_args: [
|
||||
'-DG_LOG_DOMAIN="NetworkManager"',
|
||||
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)',
|
||||
],
|
||||
)
|
||||
|
||||
libnm_log_core_dep = declare_dependency(
|
||||
include_directories: shared_inc,
|
||||
dependencies: [
|
||||
libnm_utils_base_dep,
|
||||
],
|
||||
link_with: libnm_log_core,
|
||||
)
|
||||
|
||||
libnm_platform = static_library(
|
||||
'nm-platform',
|
||||
sources: [
|
||||
|
|
|
@ -281,7 +281,7 @@ _nm_g_return_if_fail_warning(const char *log_domain, const char *file, int line)
|
|||
#if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_DAEMON
|
||||
#include "nm-core-types.h"
|
||||
#include "nm-types.h"
|
||||
#include "nm-logging.h"
|
||||
#include "nm-log-core/nm-logging.h"
|
||||
#endif
|
||||
|
||||
#if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE
|
||||
|
|
|
@ -7,7 +7,10 @@ exe = executable(
|
|||
'-DNETWORKMANAGER_COMPILATION_TEST',
|
||||
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)',
|
||||
],
|
||||
dependencies: libnm_platform_dep,
|
||||
dependencies: [
|
||||
libnm_log_core_dep,
|
||||
libnm_platform_dep,
|
||||
],
|
||||
link_with: libnm_systemd_logging_stub,
|
||||
)
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include <net/if.h>
|
||||
|
||||
#include "nm-logging.h"
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-manager.h"
|
||||
#include "nm-device-iwd.h"
|
||||
|
|
|
@ -7,6 +7,7 @@ daemon_nm_default_dep = declare_dependency(
|
|||
include_directories: src_inc,
|
||||
dependencies: [
|
||||
libnm_core_nm_default_dep,
|
||||
libnm_log_core_dep,
|
||||
libnm_platform_dep,
|
||||
],
|
||||
)
|
||||
|
@ -52,7 +53,6 @@ sources = files(
|
|||
'nm-ip-config.c',
|
||||
'nm-ip4-config.c',
|
||||
'nm-ip6-config.c',
|
||||
'nm-logging.c',
|
||||
)
|
||||
|
||||
deps = [
|
||||
|
|
|
@ -36,9 +36,13 @@ libnm_systemd_core = static_library(
|
|||
'nm-sd-utils-dhcp.c',
|
||||
'sd-adapt-core/nm-sd-adapt-core.c',
|
||||
),
|
||||
include_directories: incs,
|
||||
include_directories: [
|
||||
incs,
|
||||
src_inc,
|
||||
],
|
||||
dependencies: [
|
||||
daemon_nm_default_dep,
|
||||
glib_nm_default_dep,
|
||||
libnm_core_dep,
|
||||
libnm_systemd_shared_dep,
|
||||
],
|
||||
c_args: '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD',
|
||||
|
@ -49,7 +53,7 @@ libnm_systemd_core_dep = declare_dependency(
|
|||
include_directories: incs,
|
||||
dependencies: [
|
||||
glib_dep,
|
||||
daemon_nm_default_dep,
|
||||
libnm_core_dep,
|
||||
libnm_systemd_shared_dep,
|
||||
],
|
||||
link_with: libnm_systemd_core,
|
||||
|
|
|
@ -32,15 +32,18 @@ endforeach
|
|||
exe = executable(
|
||||
'test-systemd',
|
||||
'test-systemd.c',
|
||||
dependencies: daemon_nm_default_dep,
|
||||
include_directories: [
|
||||
top_inc,
|
||||
src_inc,
|
||||
],
|
||||
dependencies: [
|
||||
libnm_systemd_core_dep,
|
||||
libnm_systemd_shared_dep,
|
||||
],
|
||||
c_args: [
|
||||
'-DNETWORKMANAGER_COMPILATION_TEST',
|
||||
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD',
|
||||
],
|
||||
link_with: [
|
||||
libnm_systemd_core,
|
||||
libnm_systemd_shared,
|
||||
],
|
||||
)
|
||||
|
||||
test(
|
||||
|
|
Loading…
Reference in New Issue
Block a user