diff options
author | Thomas Haller <thaller@redhat.com> | 2017-03-01 17:26:45 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-03-16 18:27:33 +0100 |
commit | 9e60de87f54c1832d26dc44b0e08326e63c39e2b (patch) | |
tree | 650b63872671ee6c90c40259174f7b159b36baf9 | |
parent | c59532ee40419e4ed7d31f1d1edbaa6bc3c2278e (diff) | |
download | NetworkManager-9e60de87f54c1832d26dc44b0e08326e63c39e2b.tar.gz |
core: minor cleanups
Some minor changes that make the code more similar to what will
be done later for the related bug bgo#746440.
-rw-r--r-- | src/devices/nm-device.c | 27 | ||||
-rw-r--r-- | src/nm-active-connection.c | 13 |
2 files changed, 24 insertions, 16 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index cb1cc63707..f9c492706b 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -206,6 +206,7 @@ typedef struct _NMDevicePrivate { NMDeviceState state; NMDeviceStateReason reason; } queued_state; + guint queued_ip4_config_id; guint queued_ip6_config_id; GSList *pending_actions; @@ -250,6 +251,8 @@ typedef struct _NMDevicePrivate { NMUtilsStableType current_stable_id_type:3; + bool is_nm_owned:1; /* whether the device is a device owned and created by NM */ + GHashTable * available_connections; char * hw_addr; char * hw_addr_perm; @@ -259,7 +262,6 @@ typedef struct _NMDevicePrivate { NMUnmanagedFlags unmanaged_mask; NMUnmanagedFlags unmanaged_flags; - bool is_nm_owned; /* whether the device is a device owned and created by NM */ DeleteOnDeactivateData *delete_on_deactivate_data; /* data for scheduled cleanup when deleting link (g_idle_add) */ GCancellable *deactivating_cancellable; @@ -289,15 +291,16 @@ typedef struct _NMDevicePrivate { guint link_connected_id; guint link_disconnected_id; guint carrier_defer_id; - bool carrier; guint carrier_wait_id; - bool ignore_carrier; gulong ignore_carrier_id; guint32 mtu; guint32 ip6_mtu; guint32 mtu_initial; guint32 ip6_mtu_initial; + bool carrier:1; + bool ignore_carrier:1; + bool mtu_initialized:1; bool up:1; /* IFF_UP */ @@ -1725,7 +1728,7 @@ nm_device_master_release_one_slave (NMDevice *self, NMDevice *slave, gboolean co info = find_slave_info (self, slave); - _LOGt (LOGD_CORE, "master: release one slave %p/%s%s", slave, nm_device_get_iface (slave), + _LOGT (LOGD_CORE, "master: release one slave %p/%s%s", slave, nm_device_get_iface (slave), !info ? " (not registered)" : ""); if (!info) @@ -3005,7 +3008,7 @@ nm_device_master_add_slave (NMDevice *self, NMDevice *slave, gboolean configure) info = find_slave_info (self, slave); - _LOGt (LOGD_CORE, "master: add one slave %p/%s%s", slave, nm_device_get_iface (slave), + _LOGT (LOGD_CORE, "master: add one slave %p/%s%s", slave, nm_device_get_iface (slave), info ? " (already registered)" : ""); if (configure) @@ -3248,15 +3251,19 @@ nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason) if ( priv->state > NM_DEVICE_STATE_DISCONNECTED && priv->state <= NM_DEVICE_STATE_ACTIVATED) { - if (nm_device_state_reason_check (reason) == NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED) { + switch (nm_device_state_reason_check (reason)) { + case NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED: new_state = NM_DEVICE_STATE_FAILED; master_status = "failed"; - } else if (nm_device_state_reason_check (reason) == NM_DEVICE_STATE_REASON_USER_REQUESTED) { + break; + case NM_DEVICE_STATE_REASON_USER_REQUESTED: new_state = NM_DEVICE_STATE_DEACTIVATING; master_status = "deactivated by user request"; - } else { + break; + default: new_state = NM_DEVICE_STATE_DISCONNECTED; master_status = "deactivated"; + break; } _LOGD (LOGD_DEVICE, "Activation: connection '%s' master %s", @@ -3920,12 +3927,14 @@ recheck_available (gpointer user_data) { NMDevice *self = NM_DEVICE (user_data); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - gboolean now_available = nm_device_is_available (self, NM_DEVICE_CHECK_DEV_AVAILABLE_NONE); + gboolean now_available; NMDeviceState state = nm_device_get_state (self); NMDeviceState new_state = NM_DEVICE_STATE_UNKNOWN; priv->recheck_available.call_id = 0; + now_available = nm_device_is_available (self, NM_DEVICE_CHECK_DEV_AVAILABLE_NONE); + if (state == NM_DEVICE_STATE_UNAVAILABLE && now_available) { new_state = NM_DEVICE_STATE_DISCONNECTED; nm_device_queue_state (self, new_state, priv->recheck_available.available_reason); diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c index ab2a9b3b6b..a96f33b432 100644 --- a/src/nm-active-connection.c +++ b/src/nm-active-connection.c @@ -44,20 +44,19 @@ typedef struct _NMActiveConnectionPrivate { char *pending_activation_id; - gboolean is_default; - gboolean is_default6; NMActiveConnectionState state; - gboolean state_set; - gboolean vpn; + bool is_default:1; + bool is_default6:1; + bool state_set:1; + bool vpn:1; + bool assumed:1; + bool master_ready:1; NMAuthSubject *subject; NMActiveConnection *master; - gboolean master_ready; NMActiveConnection *parent; - gboolean assumed; - NMAuthChain *chain; const char *wifi_shared_permission; NMActiveConnectionAuthResultFunc result_func; |