diff options
| author | Michael Biebl <biebl@debian.org> | 2022-01-13 22:30:39 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2022-01-13 22:30:39 +0100 |
| commit | 88c227d90a6b7b388c5c85d72802a0ca8f05ed5c (patch) | |
| tree | 71f32df6617802270e8a78574bd8e1637dc532f4 /src/nm-cloud-setup | |
| parent | e74c568b07b50b97873fb4ee1d776dedefbd54d6 (diff) | |
New upstream version 1.34.0 upstream/1.34.0
Diffstat (limited to 'src/nm-cloud-setup')
| -rw-r--r-- | src/nm-cloud-setup/nm-cloud-setup-utils.c | 63 | ||||
| -rw-r--r-- | src/nm-cloud-setup/nm-cloud-setup-utils.h | 20 | ||||
| -rw-r--r-- | src/nm-cloud-setup/nmcs-provider-aliyun.c | 6 | ||||
| -rw-r--r-- | src/nm-cloud-setup/nmcs-provider-ec2.c | 6 | ||||
| -rw-r--r-- | src/nm-cloud-setup/tests/test-cloud-setup-general.c | 2 |
5 files changed, 11 insertions, 86 deletions
diff --git a/src/nm-cloud-setup/nm-cloud-setup-utils.c b/src/nm-cloud-setup/nm-cloud-setup-utils.c index ed36b4dd..206461e4 100644 --- a/src/nm-cloud-setup/nm-cloud-setup-utils.c +++ b/src/nm-cloud-setup/nm-cloud-setup-utils.c @@ -13,69 +13,6 @@ /*****************************************************************************/ -volatile NMLogLevel _nm_logging_configured_level = LOGL_TRACE; - -void -_nm_logging_enabled_init(const char *level_str) -{ - NMLogLevel level; - - if (!_nm_log_parse_level(level_str, &level)) - level = LOGL_WARN; - else if (level == _LOGL_KEEP) - level = LOGL_WARN; - - _nm_logging_configured_level = level; -} - -void -_nm_log_impl_cs(NMLogLevel level, const char *fmt, ...) -{ - gs_free char *msg = NULL; - va_list ap; - const char * level_str; - gint64 ts; - - va_start(ap, fmt); - msg = g_strdup_vprintf(fmt, ap); - va_end(ap); - - switch (level) { - case LOGL_TRACE: - level_str = "<trace>"; - break; - case LOGL_DEBUG: - level_str = "<debug>"; - break; - case LOGL_INFO: - level_str = "<info> "; - break; - case LOGL_WARN: - level_str = "<warn> "; - break; - default: - nm_assert(level == LOGL_ERR); - level_str = "<error>"; - break; - } - - ts = nm_utils_clock_gettime_nsec(CLOCK_BOOTTIME); - - g_print("[%" G_GINT64_FORMAT ".%05" G_GINT64_FORMAT "] %s %s\n", - ts / NM_UTILS_NSEC_PER_SEC, - (ts / (NM_UTILS_NSEC_PER_SEC / 10000)) % 10000, - level_str, - msg); -} - -void -_nm_utils_monotonic_timestamp_initialized(const struct timespec *tp, - gint64 offset_sec, - gboolean is_boottime) -{} - -/*****************************************************************************/ - G_LOCK_DEFINE_STATIC(_wait_for_objects_lock); static GSList *_wait_for_objects_list; static GSList *_wait_for_objects_iterate_loops; diff --git a/src/nm-cloud-setup/nm-cloud-setup-utils.h b/src/nm-cloud-setup/nm-cloud-setup-utils.h index 3ca7298f..e1502b95 100644 --- a/src/nm-cloud-setup/nm-cloud-setup-utils.h +++ b/src/nm-cloud-setup/nm-cloud-setup-utils.h @@ -3,7 +3,7 @@ #ifndef __NM_CLOUD_SETUP_UTILS_H__ #define __NM_CLOUD_SETUP_UTILS_H__ -#include "libnm-glib-aux/nm-logging-fwd.h" +#include "libnm-glib-aux/nm-logging-base.h" /*****************************************************************************/ @@ -13,26 +13,14 @@ /*****************************************************************************/ -extern volatile NMLogLevel _nm_logging_configured_level; - -static inline gboolean -nm_logging_enabled(NMLogLevel level) -{ - return level >= _nm_logging_configured_level; -} - -void _nm_logging_enabled_init(const char *level_str); - -void _nm_log_impl_cs(NMLogLevel level, const char *fmt, ...) _nm_printf(2, 3); - -#define _nm_log(level, ...) _nm_log_impl_cs((level), __VA_ARGS__); +#define _nm_log(level, ...) _nm_log_simple_printf((level), __VA_ARGS__); #define _NMLOG(level, ...) \ G_STMT_START \ { \ const NMLogLevel _level = (level); \ \ - if (nm_logging_enabled(_level)) { \ + if (_nm_logging_enabled(_level)) { \ _nm_log(_level, __VA_ARGS__); \ } \ } \ @@ -41,7 +29,7 @@ void _nm_log_impl_cs(NMLogLevel level, const char *fmt, ...) _nm_printf(2, 3); /*****************************************************************************/ #ifndef NM_DIST_VERSION - #define NM_DIST_VERSION VERSION +#define NM_DIST_VERSION VERSION #endif /*****************************************************************************/ diff --git a/src/nm-cloud-setup/nmcs-provider-aliyun.c b/src/nm-cloud-setup/nmcs-provider-aliyun.c index 126980fd..7073318c 100644 --- a/src/nm-cloud-setup/nmcs-provider-aliyun.c +++ b/src/nm-cloud-setup/nmcs-provider-aliyun.c @@ -158,9 +158,9 @@ _get_config_fetch_done_cb(NMHttpClient * http_client, switch (fetch_type) { case GET_CONFIG_FETCH_DONE_TYPE_PRIVATE_IPV4S: - s_addrs = nm_utils_strsplit_set_full(g_bytes_get_data(response, NULL), - ",", - NM_UTILS_STRSPLIT_SET_FLAGS_STRSTRIP); + s_addrs = nm_strsplit_set_full(g_bytes_get_data(response, NULL), + ",", + NM_STRSPLIT_SET_FLAGS_STRSTRIP); len = NM_PTRARRAY_LEN(s_addrs); nm_assert(!config_iface_data->has_ipv4s); nm_assert(!config_iface_data->ipv4s_arr); diff --git a/src/nm-cloud-setup/nmcs-provider-ec2.c b/src/nm-cloud-setup/nmcs-provider-ec2.c index 9fe62518..96b08807 100644 --- a/src/nm-cloud-setup/nmcs-provider-ec2.c +++ b/src/nm-cloud-setup/nmcs-provider-ec2.c @@ -142,9 +142,9 @@ _get_config_fetch_done_cb(NMHttpClient *http_client, gs_free const char **s_addrs = NULL; gsize i, len; - s_addrs = nm_utils_strsplit_set_full(g_bytes_get_data(response, NULL), - "\n", - NM_UTILS_STRSPLIT_SET_FLAGS_STRSTRIP); + s_addrs = nm_strsplit_set_full(g_bytes_get_data(response, NULL), + "\n", + NM_STRSPLIT_SET_FLAGS_STRSTRIP); len = NM_PTRARRAY_LEN(s_addrs); nm_assert(!config_iface_data->has_ipv4s); diff --git a/src/nm-cloud-setup/tests/test-cloud-setup-general.c b/src/nm-cloud-setup/tests/test-cloud-setup-general.c index 2039ce34..82df4e17 100644 --- a/src/nm-cloud-setup/tests/test-cloud-setup-general.c +++ b/src/nm-cloud-setup/tests/test-cloud-setup-general.c @@ -56,7 +56,7 @@ _test_ri4a(const char *const *addrs_before, const char *const *addrs_new) changed = nmcs_setting_ip_replace_ipv4_addresses(s_ip, (NMIPAddress **) arr->pdata, arr->len); - g_assert_cmpint(changed, !=, nm_utils_strv_equal(addrs_before, addrs_new)); + g_assert_cmpint(changed, !=, nm_strv_equal(addrs_before, addrs_new)); g_assert_cmpint(nm_setting_ip_config_get_num_addresses(s_ip), ==, n); for (i = 0; i < n; i++) { |