diff options
author | Thomas Haller <thaller@redhat.com> | 2022-03-11 09:39:07 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-03-11 09:43:02 +0100 |
commit | 69376e20a533655682ed5ca30d35143f3028ad02 (patch) | |
tree | 76a71db0637426dcc66dcd32466a7d1dab1cf1e3 | |
parent | 513c0b3f24d210f7cb8d8b4c284049ae1674b6b5 (diff) | |
download | NetworkManager-69376e20a533655682ed5ca30d35143f3028ad02.tar.gz |
core: rename nm_utils_host_id_get_timestamp_ns() to "nsec"
We change more and more to prefer "nsec" (and "usec", "msec", and "sec")
as abbreviations, instead of "ns" (and "us", "ms", "s"). Rename.
-rw-r--r-- | src/core/devices/nm-device.c | 4 | ||||
-rw-r--r-- | src/core/nm-core-utils.c | 24 | ||||
-rw-r--r-- | src/core/nm-core-utils.h | 2 |
3 files changed, 15 insertions, 15 deletions
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index b7201dc55c..aa4c99782c 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -1133,7 +1133,7 @@ _prop_get_ipv6_dhcp_duid(NMDevice *self, duid_out = nm_utils_generate_duid_llt(arp_type, hwaddr_bin, hwaddr_len, - nm_utils_host_id_get_timestamp_ns() + nm_utils_host_id_get_timestamp_nsec() / NM_UTILS_NSEC_PER_SEC); } @@ -1234,7 +1234,7 @@ _prop_get_ipv6_dhcp_duid(NMDevice *self, * before. Let's compute the time (in seconds) from 0 to 3 years; then we'll * subtract it from the host_id timestamp. */ - time = nm_utils_host_id_get_timestamp_ns() / NM_UTILS_NSEC_PER_SEC; + time = nm_utils_host_id_get_timestamp_nsec() / NM_UTILS_NSEC_PER_SEC; /* don't use too old timestamps. They cannot be expressed in DUID-LLT and * would all be truncated to zero. */ diff --git a/src/core/nm-core-utils.c b/src/core/nm-core-utils.c index af619be76d..ab0c05ae01 100644 --- a/src/core/nm-core-utils.c +++ b/src/core/nm-core-utils.c @@ -2877,14 +2877,14 @@ typedef struct { guint8 *host_id; gsize host_id_len; - /* The timestamp (in nsec since the Epoch) returned by nm_utils_host_id_get_timestamp_ns(). + /* The timestamp (in nsec since the Epoch) returned by nm_utils_host_id_get_timestamp_nsec(). * It is associated with the host (and the host-id). We currently use this for the LLT DUID * generation for IPv6. Instead of persisting the timestamp separately to disk, we re-use the * file timestamp of the secret_key file. */ - gint64 timestamp_ns; + gint64 timestamp_nsec; - bool is_good : 1; - bool timestamp_is_good : 1; + bool is_good : 1; + bool timestamp_is_good : 1; } HostIdData; static const HostIdData *volatile host_id_static; @@ -2908,7 +2908,7 @@ again: host_id_data.timestamp_is_good = _host_id_read_timestamp(host_id_data.is_good, host_id_data.host_id, host_id_data.host_id_len, - &host_id_data.timestamp_ns); + &host_id_data.timestamp_nsec); if (!host_id_data.timestamp_is_good && host_id_data.is_good) nm_log_warn(LOGD_CORE, "secret-key: failure reading host timestamp (use fake one)"); @@ -2947,9 +2947,9 @@ nm_utils_host_id_get(const guint8 **out_host_id, gsize *out_host_id_len) } gint64 -nm_utils_host_id_get_timestamp_ns(void) +nm_utils_host_id_get_timestamp_nsec(void) { - return _host_id_get()->timestamp_ns; + return _host_id_get()->timestamp_nsec; } static GArray *nmtst_host_id_stack = NULL; @@ -2960,7 +2960,7 @@ void nmtst_utils_host_id_push(const guint8 *host_id, gssize host_id_len, gboolean is_good, - const gint64 *timestamp_ns) + const gint64 *p_timestamp_nsec) { NM_G_MUTEX_LOCKED(&nmtst_host_id_lock); gs_free char *str1_to_free = NULL; @@ -2979,8 +2979,8 @@ nmtst_utils_host_id_push(const guint8 *host_id, &str1_to_free), (gsize) host_id_len, !!is_good, - timestamp_ns ? *timestamp_ns : 0, - timestamp_ns ? "" : " (not-good)"); + p_timestamp_nsec ? *p_timestamp_nsec : 0, + p_timestamp_nsec ? "" : " (not-good)"); if (!nmtst_host_id_stack) { nmtst_host_id_stack = g_array_new(FALSE, FALSE, sizeof(HostIdData)); @@ -2992,9 +2992,9 @@ nmtst_utils_host_id_push(const guint8 *host_id, *h = (HostIdData){ .host_id = nm_memdup(host_id, host_id_len), .host_id_len = host_id_len, - .timestamp_ns = timestamp_ns ? *timestamp_ns : 0, + .timestamp_nsec = p_timestamp_nsec ? *p_timestamp_nsec : 0, .is_good = is_good, - .timestamp_is_good = !!timestamp_ns, + .timestamp_is_good = !!p_timestamp_nsec, }; g_atomic_pointer_set(&host_id_static, h); diff --git a/src/core/nm-core-utils.h b/src/core/nm-core-utils.h index 5594e7371d..d1a62a607f 100644 --- a/src/core/nm-core-utils.h +++ b/src/core/nm-core-utils.h @@ -247,7 +247,7 @@ const char *nm_utils_proc_cmdline(void); const char *const *nm_utils_proc_cmdline_split(void); gboolean nm_utils_host_id_get(const guint8 **out_host_id, gsize *out_host_id_len); -gint64 nm_utils_host_id_get_timestamp_ns(void); +gint64 nm_utils_host_id_get_timestamp_nsec(void); void nmtst_utils_host_id_push(const guint8 *host_id, gssize host_id_len, |