diff options
author | Thomas Haller <thaller@redhat.com> | 2017-06-07 17:22:16 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-06-08 22:01:16 +0200 |
commit | e0b7a44062ac870dc884021704f915b21caeaa52 (patch) | |
tree | 7e115be10916dbea55bf19b760234866cee83eb1 | |
parent | 60ce882419201f75ac762e559854c85926263fe1 (diff) | |
download | NetworkManager-e0b7a44062ac870dc884021704f915b21caeaa52.tar.gz |
device: expose nm_device_state_to_str() function for NMDeviceState
(cherry picked from commit 4b15df26561d5cf3890c9f8e1ec0266547d1cb7a)
-rw-r--r-- | src/devices/nm-device.c | 28 | ||||
-rw-r--r-- | src/devices/nm-device.h | 3 |
2 files changed, 17 insertions, 14 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 8f97041586..bb7a9c696a 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -557,8 +557,8 @@ NM_UTILS_LOOKUP_STR_DEFINE_STATIC (queued_state_to_string, NMDeviceState, NM_UTILS_LOOKUP_STR_ITEM (NM_DEVICE_STATE_FAILED, NM_PENDING_ACTIONPREFIX_QUEUED_STATE_CHANGE "failed"), ); -static const char * -state_to_string (NMDeviceState state) +const char * +nm_device_state_to_str (NMDeviceState state) { return queued_state_to_string (state) + NM_STRLEN (NM_PENDING_ACTIONPREFIX_QUEUED_STATE_CHANGE); } @@ -3423,9 +3423,9 @@ slave_state_changed (NMDevice *slave, _LOGD (LOGD_DEVICE, "slave %s state change %d (%s) -> %d (%s)", nm_device_get_iface (slave), slave_old_state, - state_to_string (slave_old_state), + nm_device_state_to_str (slave_old_state), slave_new_state, - state_to_string (slave_new_state)); + nm_device_state_to_str (slave_new_state)); /* Don't try to enslave slaves until the master is ready */ if (priv->state < NM_DEVICE_STATE_CONFIG) @@ -4434,7 +4434,7 @@ recheck_available (gpointer user_data) _LOGD (LOGD_DEVICE, "is %savailable, %s %s", now_available ? "" : "not ", new_state == NM_DEVICE_STATE_UNAVAILABLE ? "no change required for" : "will transition to", - state_to_string (new_state == NM_DEVICE_STATE_UNAVAILABLE ? state : new_state)); + nm_device_state_to_str (new_state == NM_DEVICE_STATE_UNAVAILABLE ? state : new_state)); priv->recheck_available.available_reason = NM_DEVICE_STATE_REASON_NONE; priv->recheck_available.unavailable_reason = NM_DEVICE_STATE_REASON_NONE; @@ -12535,8 +12535,8 @@ _set_state_full (NMDevice *self, && ( state != NM_DEVICE_STATE_UNAVAILABLE || !priv->firmware_missing)) { _LOGD (LOGD_DEVICE, "state change: %s -> %s (reason '%s', internal state '%s'%s)", - state_to_string (old_state), - state_to_string (state), + nm_device_state_to_str (old_state), + nm_device_state_to_str (state), reason_to_string (reason), _sys_iface_state_to_str (priv->sys_iface_state), priv->firmware_missing ? ", missing firmware" : ""); @@ -12544,8 +12544,8 @@ _set_state_full (NMDevice *self, } _LOGI (LOGD_DEVICE, "state change: %s -> %s (reason '%s', internal state '%s')", - state_to_string (old_state), - state_to_string (state), + nm_device_state_to_str (old_state), + nm_device_state_to_str (state), reason_to_string (reason), _sys_iface_state_to_str (priv->sys_iface_state)); @@ -12867,7 +12867,7 @@ queued_state_set (gpointer user_data) nm_assert (priv->queued_state.id); _LOGD (LOGD_DEVICE, "queue-state[%s, reason:%s, id:%u]: %s", - state_to_string (priv->queued_state.state), + nm_device_state_to_str (priv->queued_state.state), reason_to_string (priv->queued_state.reason), priv->queued_state.id, "change state"); @@ -12898,7 +12898,7 @@ nm_device_queue_state (NMDevice *self, if (priv->queued_state.id && priv->queued_state.state == state) { _LOGD (LOGD_DEVICE, "queue-state[%s, reason:%s, id:%u]: %s%s%s%s", - state_to_string (priv->queued_state.state), + nm_device_state_to_str (priv->queued_state.state), reason_to_string (priv->queued_state.reason), priv->queued_state.id, "ignore queuing same state change", @@ -12914,7 +12914,7 @@ nm_device_queue_state (NMDevice *self, /* We should only ever have one delayed state transition at a time */ if (priv->queued_state.id) { _LOGW (LOGD_DEVICE, "queue-state[%s, reason:%s, id:%u]: %s", - state_to_string (priv->queued_state.state), + nm_device_state_to_str (priv->queued_state.state), reason_to_string (priv->queued_state.reason), priv->queued_state.id, "replace previously queued state change"); @@ -12927,7 +12927,7 @@ nm_device_queue_state (NMDevice *self, priv->queued_state.id = g_idle_add (queued_state_set, self); _LOGD (LOGD_DEVICE, "queue-state[%s, reason:%s, id:%u]: %s", - state_to_string (state), + nm_device_state_to_str (state), reason_to_string (reason), priv->queued_state.id, "queue state change"); @@ -12942,7 +12942,7 @@ queued_state_clear (NMDevice *self) return; _LOGD (LOGD_DEVICE, "queue-state[%s, reason:%s, id:%u]: %s", - state_to_string (priv->queued_state.state), + nm_device_state_to_str (priv->queued_state.state), reason_to_string (priv->queued_state.reason), priv->queued_state.id, "clear queued state change"); diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index 01e3938a9e..edbb0aa365 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -722,4 +722,7 @@ void nm_device_check_connectivity (NMDevice *self, gpointer user_data); NMConnectivityState nm_device_get_connectivity_state (NMDevice *self); + +const char *nm_device_state_to_str (NMDeviceState state); + #endif /* __NETWORKMANAGER_DEVICE_H__ */ |