summaryrefslogtreecommitdiff
path: root/src/nm-config.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-05-11 19:26:28 +0200
committerThomas Haller <thaller@redhat.com>2017-05-11 19:58:10 +0200
commit81008c90ac9832ade1c9783078823fdd45221225 (patch)
tree6dce2bbcfb3374cffe33674b74ed26f365c634e4 /src/nm-config.c
parent3063a5eda3cadf33ec7d302a24ea27f23a4d560b (diff)
downloadNetworkManager-81008c90ac9832ade1c9783078823fdd45221225.tar.gz
core: cleanup logging reading device-state
- print string value instead of numerical "managed" - for missing state, print the same format. After all, some defaults apply and it is interesting to know what they are.
Diffstat (limited to 'src/nm-config.c')
-rw-r--r--src/nm-config.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/nm-config.c b/src/nm-config.c
index 63998b6268..1606ab4c6c 100644
--- a/src/nm-config.c
+++ b/src/nm-config.c
@@ -1873,6 +1873,13 @@ _nm_config_state_set (NMConfig *self,
#define DEVICE_RUN_STATE_KEYFILE_KEY_DEVICE_PERM_HW_ADDR_FAKE "perm-hw-addr-fake"
#define DEVICE_RUN_STATE_KEYFILE_KEY_DEVICE_CONNECTION_UUID "connection-uuid"
+NM_UTILS_LOOKUP_STR_DEFINE_STATIC (_device_state_managed_type_to_str, NMConfigDeviceStateManagedType,
+ NM_UTILS_LOOKUP_DEFAULT_NM_ASSERT ("unknown"),
+ NM_UTILS_LOOKUP_STR_ITEM (NM_CONFIG_DEVICE_STATE_MANAGED_TYPE_UNKNOWN, "unknown"),
+ NM_UTILS_LOOKUP_STR_ITEM (NM_CONFIG_DEVICE_STATE_MANAGED_TYPE_UNMANAGED, "unmanaged"),
+ NM_UTILS_LOOKUP_STR_ITEM (NM_CONFIG_DEVICE_STATE_MANAGED_TYPE_MANAGED, "managed"),
+);
+
static NMConfigDeviceStateData *
_config_device_state_data_new (int ifindex, GKeyFile *kf)
{
@@ -1968,27 +1975,16 @@ nm_config_device_state_load (int ifindex)
device_state = _config_device_state_data_new (ifindex, kf);
- if (kf) {
- _LOGT ("device-state: read #%d (%s); managed=%d%s%s%s%s%s%s",
- ifindex, path,
- device_state->managed,
- NM_PRINT_FMT_QUOTED (device_state->connection_uuid, ", connection-uuid=", device_state->connection_uuid, "", ""),
- NM_PRINT_FMT_QUOTED (device_state->perm_hw_addr_fake, ", perm-hw-addr-fake=", device_state->perm_hw_addr_fake, "", ""));
- } else {
- _LOGT ("device-state: read #%d (%s); no persistent state",
- ifindex, path);
- }
+ _LOGT ("device-state: %s #%d (%s); managed=%s%s%s%s%s%s%s",
+ kf ? "read" : "miss",
+ ifindex, path,
+ _device_state_managed_type_to_str (device_state->managed),
+ NM_PRINT_FMT_QUOTED (device_state->connection_uuid, ", connection-uuid=", device_state->connection_uuid, "", ""),
+ NM_PRINT_FMT_QUOTED (device_state->perm_hw_addr_fake, ", perm-hw-addr-fake=", device_state->perm_hw_addr_fake, "", ""));
return device_state;
}
-NM_UTILS_LOOKUP_STR_DEFINE_STATIC (_device_state_managed_type_to_str, NMConfigDeviceStateManagedType,
- NM_UTILS_LOOKUP_DEFAULT_NM_ASSERT ("unknown"),
- NM_UTILS_LOOKUP_STR_ITEM (NM_CONFIG_DEVICE_STATE_MANAGED_TYPE_UNKNOWN, "unknown"),
- NM_UTILS_LOOKUP_STR_ITEM (NM_CONFIG_DEVICE_STATE_MANAGED_TYPE_UNMANAGED, "unmanaged"),
- NM_UTILS_LOOKUP_STR_ITEM (NM_CONFIG_DEVICE_STATE_MANAGED_TYPE_MANAGED, "managed"),
-);
-
gboolean
nm_config_device_state_write (int ifindex,
NMConfigDeviceStateManagedType managed,