Commit 9e60de87 authored by Thomas Haller's avatar Thomas Haller

core: minor cleanups

Some minor changes that make the code more similar to what will
be done later for the related bug bgo#746440.
parent c59532ee
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment