logging: make logging independent of platform
"nm-logging.h" is a basic core module that should have few other dependencies. Instead of letting nm-logging.c directly call a function from "nm-linux-platform.c", let platform register a handler as needed. This way, you can build a core library containing nm-logging but no nm-platform.
This commit is contained in:
@@ -2520,8 +2520,8 @@ sysctl_set (NMPlatform *platform, const char *path, const char *value)
|
||||
|
||||
static GSList *sysctl_clear_cache_list;
|
||||
|
||||
void
|
||||
_nm_linux_platform_sysctl_clear_cache (void)
|
||||
static void
|
||||
_nm_logging_clear_platform_logging_cache_impl (void)
|
||||
{
|
||||
while (sysctl_clear_cache_list) {
|
||||
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (sysctl_clear_cache_list->data);
|
||||
@@ -2541,6 +2541,7 @@ _log_dbg_sysctl_get_impl (NMPlatform *platform, const char *path, const char *co
|
||||
const char *prev_value = NULL;
|
||||
|
||||
if (!priv->sysctl_get_prev_values) {
|
||||
_nm_logging_clear_platform_logging_cache = _nm_logging_clear_platform_logging_cache_impl;
|
||||
sysctl_clear_cache_list = g_slist_prepend (sysctl_clear_cache_list, platform);
|
||||
priv->sysctl_get_prev_values = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
} else
|
||||
|
Reference in New Issue
Block a user