diff --git a/src/devices/nm-device-private.h b/src/devices/nm-device-private.h index ec245f4356..bed89f7c39 100644 --- a/src/devices/nm-device-private.h +++ b/src/devices/nm-device-private.h @@ -90,10 +90,10 @@ gboolean nm_device_get_enslaved (NMDevice *device); NMDevice *nm_device_master_get_slave_by_ifindex (NMDevice *dev, int ifindex); -void nm_device_master_check_slave_physical_port (NMDevice *dev, NMDevice *slave, +void nm_device_master_check_slave_physical_port (NMDevice *self, NMDevice *slave, guint64 log_domain); -void nm_device_set_carrier (NMDevice *device, gboolean carrier); +void nm_device_set_carrier (NMDevice *self, gboolean carrier); void nm_device_emit_recheck_auto_activate (NMDevice *device); void nm_device_queue_recheck_assume (NMDevice *device); diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 08f35c442d..8f86830026 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -73,8 +73,8 @@ #include "nm-config.h" #include "nm-dns-manager.h" -static void impl_device_disconnect (NMDevice *device, DBusGMethodInvocation *context); -static void impl_device_delete (NMDevice *device, DBusGMethodInvocation *context); +static void impl_device_disconnect (NMDevice *self, DBusGMethodInvocation *context); +static void impl_device_delete (NMDevice *self, DBusGMethodInvocation *context); #include "nm-device-glue.h" @@ -312,7 +312,7 @@ typedef struct { NMConnectionProvider *con_provider; } NMDevicePrivate; -static gboolean nm_device_set_ip4_config (NMDevice *dev, +static gboolean nm_device_set_ip4_config (NMDevice *self, NMIP4Config *config, gboolean commit, NMDeviceStateReason *reason); @@ -321,25 +321,25 @@ static gboolean ip4_config_merge_and_apply (NMDevice *self, gboolean commit, NMDeviceStateReason *out_reason); -static gboolean nm_device_set_ip6_config (NMDevice *dev, +static gboolean nm_device_set_ip6_config (NMDevice *self, NMIP6Config *config, gboolean commit, NMDeviceStateReason *reason); -static gboolean nm_device_master_add_slave (NMDevice *dev, NMDevice *slave, gboolean configure); -static void nm_device_slave_notify_enslave (NMDevice *dev, gboolean success); -static void nm_device_slave_notify_release (NMDevice *dev, NMDeviceStateReason reason); +static gboolean nm_device_master_add_slave (NMDevice *self, NMDevice *slave, gboolean configure); +static void nm_device_slave_notify_enslave (NMDevice *self, gboolean success); +static void nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason); static gboolean addrconf6_start_with_link_ready (NMDevice *self); -static gboolean nm_device_get_default_unmanaged (NMDevice *device); +static gboolean nm_device_get_default_unmanaged (NMDevice *self); -static void _set_state_full (NMDevice *device, +static void _set_state_full (NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, gboolean quitting); -static void nm_device_update_hw_address (NMDevice *dev); +static void nm_device_update_hw_address (NMDevice *self); /***********************************************************/ @@ -467,27 +467,27 @@ nm_device_ipv6_sysctl_set (NMDevice *self, const char *property, const char *val } static gboolean -device_has_capability (NMDevice *device, NMDeviceCapabilities caps) +device_has_capability (NMDevice *self, NMDeviceCapabilities caps) { - return !!(NM_DEVICE_GET_PRIVATE (device)->capabilities & caps); + return !!(NM_DEVICE_GET_PRIVATE (self)->capabilities & caps); } /***********************************************************/ void -nm_device_dbus_export (NMDevice *device) +nm_device_dbus_export (NMDevice *self) { static guint32 devcount = 0; NMDevicePrivate *priv; - g_return_if_fail (NM_IS_DEVICE (device)); + g_return_if_fail (NM_IS_DEVICE (self)); - priv = NM_DEVICE_GET_PRIVATE (device); + priv = NM_DEVICE_GET_PRIVATE (self); g_return_if_fail (priv->path == NULL); priv->path = g_strdup_printf ("/org/freedesktop/NetworkManager/Devices/%d", devcount++); nm_log_info (LOGD_DEVICE, "(%s): exported as %s", priv->iface, priv->path); - nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, device); + nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, self); } const char * @@ -523,9 +523,9 @@ nm_device_get_ifindex (NMDevice *self) } gboolean -nm_device_is_software (NMDevice *device) +nm_device_is_software (NMDevice *self) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); return priv->is_software; } @@ -649,15 +649,15 @@ nm_device_get_device_type (NMDevice *self) /** * nm_device_get_priority(): - * @dev: the #NMDevice + * @self: the #NMDevice * * Returns: the device's routing priority. Lower numbers means a "better" * device, eg higher priority. */ int -nm_device_get_priority (NMDevice *dev) +nm_device_get_priority (NMDevice *self) { - g_return_val_if_fail (NM_IS_DEVICE (dev), 100); + g_return_val_if_fail (NM_IS_DEVICE (self), 100); /* Device 'priority' is used for two things: * @@ -669,7 +669,7 @@ nm_device_get_priority (NMDevice *dev) * it's using that connection. */ - switch (nm_device_get_device_type (dev)) { + switch (nm_device_get_device_type (self)) { case NM_DEVICE_TYPE_ETHERNET: return 1; case NM_DEVICE_TYPE_INFINIBAND: @@ -706,9 +706,9 @@ nm_device_get_type_desc (NMDevice *self) } gboolean -nm_device_has_carrier (NMDevice *device) +nm_device_has_carrier (NMDevice *self) { - return NM_DEVICE_GET_PRIVATE (device)->carrier; + return NM_DEVICE_GET_PRIVATE (self)->carrier; } NMActRequest * @@ -736,9 +736,9 @@ nm_device_get_rfkill_type (NMDevice *self) } static const char * -nm_device_get_physical_port_id (NMDevice *device) +nm_device_get_physical_port_id (NMDevice *self) { - return NM_DEVICE_GET_PRIVATE (device)->physical_port_id; + return NM_DEVICE_GET_PRIVATE (self)->physical_port_id; } /***********************************************************/ @@ -780,28 +780,28 @@ free_slave_info (SlaveInfo *info) /** * nm_device_enslave_slave: - * @dev: the master device + * @self: the master device * @slave: the slave device to enslave * @connection: (allow-none): the slave device's connection * - * If @dev is capable of enslaving other devices (ie it's a bridge, bond, team, + * If @self is capable of enslaving other devices (ie it's a bridge, bond, team, * etc) then this function enslaves @slave. * * Returns: %TRUE on success, %FALSE on failure or if this device cannot enslave * other devices. */ static gboolean -nm_device_enslave_slave (NMDevice *dev, NMDevice *slave, NMConnection *connection) +nm_device_enslave_slave (NMDevice *self, NMDevice *slave, NMConnection *connection) { SlaveInfo *info; gboolean success = FALSE; gboolean configure; - g_return_val_if_fail (dev != NULL, FALSE); + g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (slave != NULL, FALSE); - g_return_val_if_fail (NM_DEVICE_GET_CLASS (dev)->enslave_slave != NULL, FALSE); + g_return_val_if_fail (NM_DEVICE_GET_CLASS (self)->enslave_slave != NULL, FALSE); - info = find_slave_info (dev, slave); + info = find_slave_info (self, slave); if (!info) return FALSE; @@ -812,7 +812,7 @@ nm_device_enslave_slave (NMDevice *dev, NMDevice *slave, NMConnection *connectio if (configure) g_return_val_if_fail (nm_device_get_state (slave) >= NM_DEVICE_STATE_DISCONNECTED, FALSE); - success = NM_DEVICE_GET_CLASS (dev)->enslave_slave (dev, slave, connection, configure); + success = NM_DEVICE_GET_CLASS (self)->enslave_slave (self, slave, connection, configure); info->enslaved = success; } @@ -821,18 +821,18 @@ nm_device_enslave_slave (NMDevice *dev, NMDevice *slave, NMConnection *connectio /* Ensure the device's hardware address is up-to-date; it often changes * when slaves change. */ - nm_device_update_hw_address (dev); + nm_device_update_hw_address (self); /* Restart IP configuration if we're waiting for slaves. Do this * after updating the hardware address as IP config may need the * new address. */ if (success) { - if (NM_DEVICE_GET_PRIVATE (dev)->ip4_state == IP_WAIT) - nm_device_activate_stage3_ip4_start (dev); + if (NM_DEVICE_GET_PRIVATE (self)->ip4_state == IP_WAIT) + nm_device_activate_stage3_ip4_start (self); - if (NM_DEVICE_GET_PRIVATE (dev)->ip6_state == IP_WAIT) - nm_device_activate_stage3_ip6_start (dev); + if (NM_DEVICE_GET_PRIVATE (self)->ip6_state == IP_WAIT) + nm_device_activate_stage3_ip6_start (self); } return success; @@ -840,35 +840,35 @@ nm_device_enslave_slave (NMDevice *dev, NMDevice *slave, NMConnection *connectio /** * nm_device_release_one_slave: - * @dev: the master device + * @self: the master device * @slave: the slave device to release - * @configure: whether @dev needs to actually release @slave + * @configure: whether @self needs to actually release @slave * @reason: the state change reason for the @slave * - * If @dev is capable of enslaving other devices (ie it's a bridge, bond, team, + * If @self is capable of enslaving other devices (ie it's a bridge, bond, team, * etc) then this function releases the previously enslaved @slave and/or - * updates the state of @dev and @slave to reflect its release. + * updates the state of @self and @slave to reflect its release. * * Returns: %TRUE on success, %FALSE on failure, if this device cannot enslave * other devices, or if @slave was never enslaved. */ static gboolean -nm_device_release_one_slave (NMDevice *dev, NMDevice *slave, gboolean configure, NMDeviceStateReason reason) +nm_device_release_one_slave (NMDevice *self, NMDevice *slave, gboolean configure, NMDeviceStateReason reason) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); SlaveInfo *info; gboolean success = FALSE; g_return_val_if_fail (slave != NULL, FALSE); - g_return_val_if_fail (NM_DEVICE_GET_CLASS (dev)->release_slave != NULL, FALSE); + g_return_val_if_fail (NM_DEVICE_GET_CLASS (self)->release_slave != NULL, FALSE); - info = find_slave_info (dev, slave); + info = find_slave_info (self, slave); if (!info) return FALSE; priv->slaves = g_slist_remove (priv->slaves, info); if (info->enslaved) { - success = NM_DEVICE_GET_CLASS (dev)->release_slave (dev, slave, configure); + success = NM_DEVICE_GET_CLASS (self)->release_slave (self, slave, configure); /* The release_slave() implementation logs success/failure (in the * correct device-specific log domain), so we don't have to do anything. */ @@ -888,20 +888,20 @@ nm_device_release_one_slave (NMDevice *dev, NMDevice *slave, gboolean configure, /* Ensure the device's hardware address is up-to-date; it often changes * when slaves change. */ - nm_device_update_hw_address (dev); + nm_device_update_hw_address (self); return success; } static void -carrier_changed (NMDevice *device, gboolean carrier) +carrier_changed (NMDevice *self, gboolean carrier) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - if (!nm_device_get_managed (device)) + if (!nm_device_get_managed (self)) return; - nm_device_recheck_available_connections (device); + nm_device_recheck_available_connections (self); /* ignore-carrier devices ignore all carrier-down events */ if (priv->ignore_carrier && !carrier) @@ -915,13 +915,13 @@ carrier_changed (NMDevice *device, gboolean carrier) if (!carrier) return; - if (nm_device_activate_ip4_state_in_wait (device)) - nm_device_activate_stage3_ip4_start (device); - if (nm_device_activate_ip6_state_in_wait (device)) - nm_device_activate_stage3_ip6_start (device); + if (nm_device_activate_ip4_state_in_wait (self)) + nm_device_activate_stage3_ip4_start (self); + if (nm_device_activate_ip6_state_in_wait (self)) + nm_device_activate_stage3_ip6_start (self); return; - } else if (nm_device_get_enslaved (device) && !carrier) { + } else if (nm_device_get_enslaved (self) && !carrier) { /* Slaves don't deactivate when they lose carrier; for * bonds/teams in particular that would be actively * counterproductive. @@ -933,7 +933,7 @@ carrier_changed (NMDevice *device, gboolean carrier) g_warn_if_fail (priv->state >= NM_DEVICE_STATE_UNAVAILABLE); if (priv->state == NM_DEVICE_STATE_UNAVAILABLE) { - nm_device_queue_state (device, NM_DEVICE_STATE_DISCONNECTED, + nm_device_queue_state (self, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_CARRIER); } else if (priv->state == NM_DEVICE_STATE_DISCONNECTED) { /* If the device is already in DISCONNECTED state without a carrier @@ -941,16 +941,16 @@ carrier_changed (NMDevice *device, gboolean carrier) * when the carrier appears, auto connections are rechecked for * the device. */ - nm_device_emit_recheck_auto_activate (device); + nm_device_emit_recheck_auto_activate (self); } } else { g_return_if_fail (priv->state >= NM_DEVICE_STATE_UNAVAILABLE); if (priv->state == NM_DEVICE_STATE_UNAVAILABLE) { - if (nm_device_queued_state_peek (device) >= NM_DEVICE_STATE_DISCONNECTED) - nm_device_queued_state_clear (device); + if (nm_device_queued_state_peek (self) >= NM_DEVICE_STATE_DISCONNECTED) + nm_device_queued_state_clear (self); } else { - nm_device_queue_state (device, NM_DEVICE_STATE_UNAVAILABLE, + nm_device_queue_state (self, NM_DEVICE_STATE_UNAVAILABLE, NM_DEVICE_STATE_REASON_CARRIER); } } @@ -961,18 +961,18 @@ carrier_changed (NMDevice *device, gboolean carrier) static gboolean link_disconnect_action_cb (gpointer user_data) { - NMDevice *device = NM_DEVICE (user_data); - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevice *self = NM_DEVICE (user_data); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); nm_log_dbg (LOGD_DEVICE, "(%s): link disconnected (calling deferred action) (id=%u)", - nm_device_get_iface (device), priv->carrier_defer_id); + nm_device_get_iface (self), priv->carrier_defer_id); priv->carrier_defer_id = 0; nm_log_info (LOGD_DEVICE, "(%s): link disconnected (calling deferred action)", - nm_device_get_iface (device)); + nm_device_get_iface (self)); - NM_DEVICE_GET_CLASS (device)->carrier_changed (device, FALSE); + NM_DEVICE_GET_CLASS (self)->carrier_changed (self, FALSE); return FALSE; } @@ -991,60 +991,60 @@ link_disconnect_action_cancel (NMDevice *self) } void -nm_device_set_carrier (NMDevice *device, gboolean carrier) +nm_device_set_carrier (NMDevice *self, gboolean carrier) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); - NMDeviceClass *klass = NM_DEVICE_GET_CLASS (device); - NMDeviceState state = nm_device_get_state (device); - const char *iface = nm_device_get_iface (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + NMDeviceClass *klass = NM_DEVICE_GET_CLASS (self); + NMDeviceState state = nm_device_get_state (self); + const char *iface = nm_device_get_iface (self); if (priv->carrier == carrier) return; priv->carrier = carrier; - g_object_notify (G_OBJECT (device), NM_DEVICE_CARRIER); + g_object_notify (G_OBJECT (self), NM_DEVICE_CARRIER); if (priv->carrier) { nm_log_info (LOGD_DEVICE, "(%s): link connected", iface); - link_disconnect_action_cancel (device); - klass->carrier_changed (device, TRUE); + link_disconnect_action_cancel (self); + klass->carrier_changed (self, TRUE); if (priv->carrier_wait_id) { g_source_remove (priv->carrier_wait_id); priv->carrier_wait_id = 0; - nm_device_remove_pending_action (device, "carrier wait", TRUE); + nm_device_remove_pending_action (self, "carrier wait", TRUE); } } else if (state <= NM_DEVICE_STATE_DISCONNECTED) { nm_log_info (LOGD_DEVICE, "(%s): link disconnected", iface); - klass->carrier_changed (device, FALSE); + klass->carrier_changed (self, FALSE); } else { nm_log_info (LOGD_DEVICE, "(%s): link disconnected (deferring action for %d seconds)", iface, LINK_DISCONNECT_DELAY); priv->carrier_defer_id = g_timeout_add_seconds (LINK_DISCONNECT_DELAY, - link_disconnect_action_cb, device); + link_disconnect_action_cb, self); nm_log_dbg (LOGD_DEVICE, "(%s): link disconnected (deferring action for %d seconds) (id=%u)", iface, LINK_DISCONNECT_DELAY, priv->carrier_defer_id); } } static void -update_for_ip_ifname_change (NMDevice *device) +update_for_ip_ifname_change (NMDevice *self) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); g_hash_table_remove_all (priv->ip6_saved_properties); if (priv->dhcp4_client) { - if (!nm_device_dhcp4_renew (device, FALSE)) { - nm_device_state_changed (device, + if (!nm_device_dhcp4_renew (self, FALSE)) { + nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_DHCP_FAILED); return; } } if (priv->dhcp6_client) { - if (!nm_device_dhcp6_renew (device, FALSE)) { - nm_device_state_changed (device, + if (!nm_device_dhcp6_renew (self, FALSE)) { + nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_DHCP_FAILED); return; @@ -1059,23 +1059,23 @@ update_for_ip_ifname_change (NMDevice *device) } static void -device_link_changed (NMDevice *device, NMPlatformLink *info) +device_link_changed (NMDevice *self, NMPlatformLink *info) { - NMDeviceClass *klass = NM_DEVICE_GET_CLASS (device); - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDeviceClass *klass = NM_DEVICE_GET_CLASS (self); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); gboolean ip_ifname_changed = FALSE; if (info->udi && g_strcmp0 (info->udi, priv->udi)) { /* Update UDI to what udev gives us */ g_free (priv->udi); priv->udi = g_strdup (info->udi); - g_object_notify (G_OBJECT (device), NM_DEVICE_UDI); + g_object_notify (G_OBJECT (self), NM_DEVICE_UDI); } /* Update MTU if it has changed. */ if (priv->mtu != info->mtu) { priv->mtu = info->mtu; - g_object_notify (G_OBJECT (device), NM_DEVICE_MTU); + g_object_notify (G_OBJECT (self), NM_DEVICE_MTU); } if (info->name[0] && strcmp (priv->iface, info->name) != 0) { @@ -1087,17 +1087,17 @@ device_link_changed (NMDevice *device, NMPlatformLink *info) /* If the device has no explicit ip_iface, then changing iface changes ip_iface too. */ ip_ifname_changed = !priv->ip_iface; - g_object_notify (G_OBJECT (device), NM_DEVICE_IFACE); + g_object_notify (G_OBJECT (self), NM_DEVICE_IFACE); if (ip_ifname_changed) - g_object_notify (G_OBJECT (device), NM_DEVICE_IP_IFACE); + g_object_notify (G_OBJECT (self), NM_DEVICE_IP_IFACE); /* Re-match available connections against the new interface name */ - nm_device_recheck_available_connections (device); + nm_device_recheck_available_connections (self); /* Let any connections that use the new interface name have a chance * to auto-activate on the device. */ - nm_device_emit_recheck_auto_activate (device); + nm_device_emit_recheck_auto_activate (self); } /* Update slave status for external changes */ @@ -1108,49 +1108,49 @@ device_link_changed (NMDevice *device, NMPlatformLink *info) if (master && NM_DEVICE_GET_CLASS (master)->enslave_slave) { g_clear_object (&priv->master); priv->master = g_object_ref (master); - nm_device_master_add_slave (master, device, FALSE); - nm_device_enslave_slave (master, device, NULL); + nm_device_master_add_slave (master, self, FALSE); + nm_device_enslave_slave (master, self, NULL); } else if (master) { nm_log_info (LOGD_DEVICE, "(%s): enslaved to non-master-type device %s; ignoring", - nm_device_get_iface (device), + nm_device_get_iface (self), nm_device_get_iface (master)); } else { nm_log_warn (LOGD_DEVICE, "(%s): enslaved to unknown device %d %s", - nm_device_get_iface (device), + nm_device_get_iface (self), info->master, nm_platform_link_get_name (info->master)); } } else if (priv->enslaved && !info->master) - nm_device_release_one_slave (priv->master, device, FALSE, NM_DEVICE_STATE_REASON_NONE); + nm_device_release_one_slave (priv->master, self, FALSE, NM_DEVICE_STATE_REASON_NONE); if (klass->link_changed) - klass->link_changed (device, info); + klass->link_changed (self, info); /* Update DHCP, etc, if needed */ if (ip_ifname_changed) - update_for_ip_ifname_change (device); + update_for_ip_ifname_change (self); } static void -device_ip_link_changed (NMDevice *device, NMPlatformLink *info) +device_ip_link_changed (NMDevice *self, NMPlatformLink *info) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); if (info->name[0] && g_strcmp0 (priv->ip_iface, info->name)) { nm_log_info (LOGD_DEVICE, "(%s): interface index %d renamed ip_iface (%d) from '%s' to '%s'", - priv->iface, priv->ifindex, nm_device_get_ip_ifindex (device), + priv->iface, priv->ifindex, nm_device_get_ip_ifindex (self), priv->ip_iface, info->name); g_free (priv->ip_iface); priv->ip_iface = g_strdup (info->name); - g_object_notify (G_OBJECT (device), NM_DEVICE_IP_IFACE); - update_for_ip_ifname_change (device); + g_object_notify (G_OBJECT (self), NM_DEVICE_IP_IFACE); + update_for_ip_ifname_change (self); } } static void -link_changed_cb (NMPlatform *platform, int ifindex, NMPlatformLink *info, NMPlatformSignalChangeType change_type, NMPlatformReason reason, NMDevice *device) +link_changed_cb (NMPlatform *platform, int ifindex, NMPlatformLink *info, NMPlatformSignalChangeType change_type, NMPlatformReason reason, NMDevice *self) { if (change_type != NM_PLATFORM_SIGNAL_CHANGED) return; @@ -1161,24 +1161,24 @@ link_changed_cb (NMPlatform *platform, int ifindex, NMPlatformLink *info, NMPlat * and it results in also setting IFF_LOWER_UP. */ - if (ifindex == nm_device_get_ifindex (device)) - device_link_changed (device, info); - else if (ifindex == nm_device_get_ip_ifindex (device)) - device_ip_link_changed (device, info); + if (ifindex == nm_device_get_ifindex (self)) + device_link_changed (self, info); + else if (ifindex == nm_device_get_ip_ifindex (self)) + device_ip_link_changed (self, info); } static void -link_changed (NMDevice *device, NMPlatformLink *info) +link_changed (NMDevice *self, NMPlatformLink *info) { /* Update carrier from link event if applicable. */ - if ( device_has_capability (device, NM_DEVICE_CAP_CARRIER_DETECT) - && !device_has_capability (device, NM_DEVICE_CAP_NONSTANDARD_CARRIER)) - nm_device_set_carrier (device, info->connected); + if ( device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT) + && !device_has_capability (self, NM_DEVICE_CAP_NONSTANDARD_CARRIER)) + nm_device_set_carrier (self, info->connected); } /** * nm_device_notify_component_added(): - * @device: the #NMDevice + * @self: the #NMDevice * @component: the component being added by a plugin * * Called by the manager to notify the device that a new component has @@ -1189,16 +1189,16 @@ link_changed (NMDevice *device, NMPlatformLink *info) * claimed. */ gboolean -nm_device_notify_component_added (NMDevice *device, GObject *component) +nm_device_notify_component_added (NMDevice *self, GObject *component) { - if (NM_DEVICE_GET_CLASS (device)->component_added) - return NM_DEVICE_GET_CLASS (device)->component_added (device, component); + if (NM_DEVICE_GET_CLASS (self)->component_added) + return NM_DEVICE_GET_CLASS (self)->component_added (self, component); return FALSE; } /** * nm_device_owns_iface(): - * @device: the #NMDevice + * @self: the #NMDevice * @iface: an interface name * * Called by the manager to ask if the device or any of its components owns @@ -1207,14 +1207,14 @@ nm_device_notify_component_added (NMDevice *device, GObject *component) * because that ethernet interface is controlled by the WWAN device and cannot * be used independently of the WWAN device. * - * Returns: %TRUE if @device or it's components owns the interface name, + * Returns: %TRUE if @self or it's components owns the interface name, * %FALSE if not */ gboolean -nm_device_owns_iface (NMDevice *device, const char *iface) +nm_device_owns_iface (NMDevice *self, const char *iface) { - if (NM_DEVICE_GET_CLASS (device)->owns_iface) - return NM_DEVICE_GET_CLASS (device)->owns_iface (device, iface); + if (NM_DEVICE_GET_CLASS (self)->owns_iface) + return NM_DEVICE_GET_CLASS (self)->owns_iface (self, iface); return FALSE; } @@ -1262,35 +1262,35 @@ slave_state_changed (NMDevice *slave, /** * nm_device_master_add_slave: - * @dev: the master device + * @self: the master device * @slave: the slave device to enslave * @configure: pass %TRUE if the slave should be configured by the master, or * %FALSE if it is already configured outside NetworkManager * - * If @dev is capable of enslaving other devices (ie it's a bridge, bond, team, + * If @self is capable of enslaving other devices (ie it's a bridge, bond, team, * etc) then this function adds @slave to the slave list for later enslavement. * * Returns: %TRUE on success, %FALSE on failure */ static gboolean -nm_device_master_add_slave (NMDevice *dev, NMDevice *slave, gboolean configure) +nm_device_master_add_slave (NMDevice *self, NMDevice *slave, gboolean configure) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); SlaveInfo *info; - g_return_val_if_fail (dev != NULL, FALSE); + g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (slave != NULL, FALSE); - g_return_val_if_fail (NM_DEVICE_GET_CLASS (dev)->enslave_slave != NULL, FALSE); + g_return_val_if_fail (NM_DEVICE_GET_CLASS (self)->enslave_slave != NULL, FALSE); if (configure) g_return_val_if_fail (nm_device_get_state (slave) >= NM_DEVICE_STATE_DISCONNECTED, FALSE); - if (!find_slave_info (dev, slave)) { + if (!find_slave_info (self, slave)) { info = g_malloc0 (sizeof (SlaveInfo)); info->slave = g_object_ref (slave); info->configure = configure; info->watch_id = g_signal_connect (slave, "state-changed", - G_CALLBACK (slave_state_changed), dev); + G_CALLBACK (slave_state_changed), self); priv->slaves = g_slist_append (priv->slaves, info); } @@ -1300,14 +1300,14 @@ nm_device_master_add_slave (NMDevice *dev, NMDevice *slave, gboolean configure) /** * nm_device_master_get_slaves: - * @dev: the master device + * @self: the master device * - * Returns: any slaves of which @device is the master. Caller owns returned list. + * Returns: any slaves of which @self is the master. Caller owns returned list. */ GSList * -nm_device_master_get_slaves (NMDevice *dev) +nm_device_master_get_slaves (NMDevice *self) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); GSList *slaves = NULL, *iter; for (iter = priv->slaves; iter; iter = g_slist_next (iter)) @@ -1318,18 +1318,18 @@ nm_device_master_get_slaves (NMDevice *dev) /** * nm_device_master_get_slave_by_ifindex: - * @dev: the master device + * @self: the master device * @ifindex: the slave's interface index * - * Returns: the slave with the given @ifindex of which @device is the master, - * or %NULL if no device with @ifindex is a slave of @device. + * Returns: the slave with the given @ifindex of which @self is the master, + * or %NULL if no device with @ifindex is a slave of @self. */ NMDevice * -nm_device_master_get_slave_by_ifindex (NMDevice *dev, int ifindex) +nm_device_master_get_slave_by_ifindex (NMDevice *self, int ifindex) { GSList *iter; - for (iter = NM_DEVICE_GET_PRIVATE (dev)->slaves; iter; iter = g_slist_next (iter)) { + for (iter = NM_DEVICE_GET_PRIVATE (self)->slaves; iter; iter = g_slist_next (iter)) { SlaveInfo *info = iter->data; if (nm_device_get_ip_ifindex (info->slave) == ifindex) @@ -1340,18 +1340,18 @@ nm_device_master_get_slave_by_ifindex (NMDevice *dev, int ifindex) /** * nm_device_master_check_slave_physical_port: - * @dev: the master device + * @self: the master device * @slave: a slave device * @log_domain: domain to log a warning in * - * Checks if @dev already has a slave with the same #NMDevice:physical-port-id + * Checks if @self already has a slave with the same #NMDevice:physical-port-id * as @slave, and logs a warning if so. */ void -nm_device_master_check_slave_physical_port (NMDevice *dev, NMDevice *slave, +nm_device_master_check_slave_physical_port (NMDevice *self, NMDevice *slave, guint64 log_domain) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); const char *slave_physical_port_id, *existing_physical_port_id; SlaveInfo *info; GSList *iter; @@ -1368,7 +1368,7 @@ nm_device_master_check_slave_physical_port (NMDevice *dev, NMDevice *slave, existing_physical_port_id = nm_device_get_physical_port_id (info->slave); if (!g_strcmp0 (slave_physical_port_id, existing_physical_port_id)) { nm_log_warn (log_domain, "(%s): slave %s shares a physical port with existing slave %s", - nm_device_get_ip_iface (dev), + nm_device_get_ip_iface (self), nm_device_get_ip_iface (slave), nm_device_get_ip_iface (info->slave)); /* Since this function will get called for every slave, we only have @@ -1405,19 +1405,19 @@ nm_device_master_release_slaves (NMDevice *self) /** * nm_device_get_master: - * @dev: the device + * @self: the device * - * If @dev has been enslaved by another device, this returns that + * If @self has been enslaved by another device, this returns that * device. Otherwise it returns %NULL. (In particular, note that if - * @dev is in the process of activating as a slave, but has not yet + * @self is in the process of activating as a slave, but has not yet * been enslaved by its master, this will return %NULL.) * - * Returns: (transfer none): @dev's master, or %NULL + * Returns: (transfer none): @self's master, or %NULL */ NMDevice * -nm_device_get_master (NMDevice *dev) +nm_device_get_master (NMDevice *self) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); if (priv->enslaved) return priv->master; @@ -1427,17 +1427,17 @@ nm_device_get_master (NMDevice *dev) /** * nm_device_slave_notify_enslave: - * @dev: the slave device + * @self: the slave device * @success: whether the enslaving operation succeeded * * Notifies a slave that either it has been enslaved, or else its master tried * to enslave it and failed. */ static void -nm_device_slave_notify_enslave (NMDevice *dev, gboolean success) +nm_device_slave_notify_enslave (NMDevice *self, gboolean success) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); - NMConnection *connection = nm_device_get_connection (dev); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + NMConnection *connection = nm_device_get_connection (self); gboolean activating = (priv->state == NM_DEVICE_STATE_IP_CONFIG); g_assert (priv->master); @@ -1447,21 +1447,21 @@ nm_device_slave_notify_enslave (NMDevice *dev, gboolean success) if (activating) { nm_log_info (LOGD_DEVICE, "Activation (%s) connection '%s' enslaved, continuing activation", - nm_device_get_iface (dev), + nm_device_get_iface (self), nm_connection_get_id (connection)); } else { nm_log_info (LOGD_DEVICE, "(%s): enslaved to %s", - nm_device_get_iface (dev), + nm_device_get_iface (self), nm_device_get_iface (priv->master)); } priv->enslaved = TRUE; - g_object_notify (G_OBJECT (dev), NM_DEVICE_MASTER); + g_object_notify (G_OBJECT (self), NM_DEVICE_MASTER); } else if (activating) { nm_log_warn (LOGD_DEVICE, "Activation (%s) connection '%s' could not be enslaved", - nm_device_get_iface (dev), + nm_device_get_iface (self), nm_connection_get_id (connection)); } } @@ -1469,25 +1469,25 @@ nm_device_slave_notify_enslave (NMDevice *dev, gboolean success) if (activating) { priv->ip4_state = IP_DONE; priv->ip6_state = IP_DONE; - nm_device_queue_state (dev, + nm_device_queue_state (self, success ? NM_DEVICE_STATE_SECONDARIES : NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_NONE); } else - nm_device_queue_recheck_assume (dev); + nm_device_queue_recheck_assume (self); } /** * nm_device_slave_notify_release: - * @dev: the slave device + * @self: the slave device * @reason: the reason associated with the state change * * Notifies a slave that it has been released, and why. */ static void -nm_device_slave_notify_release (NMDevice *dev, NMDeviceStateReason reason) +nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); - NMConnection *connection = nm_device_get_connection (dev); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + NMConnection *connection = nm_device_get_connection (self); NMDeviceState new_state; const char *master_status; @@ -1507,41 +1507,41 @@ nm_device_slave_notify_release (NMDevice *dev, NMDeviceStateReason reason) nm_log_dbg (LOGD_DEVICE, "Activation (%s) connection '%s' master %s", - nm_device_get_iface (dev), + nm_device_get_iface (self), nm_connection_get_id (connection), master_status); - nm_device_queue_state (dev, new_state, reason); + nm_device_queue_state (self, new_state, reason); } else { nm_log_info (LOGD_DEVICE, "(%s): released from master %s", - nm_device_get_iface (dev), + nm_device_get_iface (self), nm_device_get_iface (priv->master)); } if (priv->enslaved) { priv->enslaved = FALSE; - g_object_notify (G_OBJECT (dev), NM_DEVICE_MASTER); + g_object_notify (G_OBJECT (self), NM_DEVICE_MASTER); } } /** * nm_device_get_enslaved: - * @device: the #NMDevice + * @self: the #NMDevice * * Returns: %TRUE if the device is enslaved to a master device (eg bridge or * bond or team), %FALSE if not */ gboolean -nm_device_get_enslaved (NMDevice *device) +nm_device_get_enslaved (NMDevice *self) { - return NM_DEVICE_GET_PRIVATE (device)->enslaved; + return NM_DEVICE_GET_PRIVATE (self)->enslaved; } static gboolean -is_available (NMDevice *device) +is_available (NMDevice *self) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); return priv->carrier || priv->ignore_carrier; } @@ -1594,11 +1594,11 @@ nm_device_set_enabled (NMDevice *self, gboolean enabled) } gboolean -nm_device_get_autoconnect (NMDevice *device) +nm_device_get_autoconnect (NMDevice *self) { - g_return_val_if_fail (NM_IS_DEVICE (device), FALSE); + g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); - return NM_DEVICE_GET_PRIVATE (device)->autoconnect; + return NM_DEVICE_GET_PRIVATE (self)->autoconnect; } static gboolean @@ -1635,7 +1635,7 @@ nm_device_autoconnect_allowed (NMDevice *self) } static gboolean -can_auto_connect (NMDevice *device, +can_auto_connect (NMDevice *self, NMConnection *connection, char **specific_object) { @@ -1645,13 +1645,13 @@ can_auto_connect (NMDevice *device, if (!nm_setting_connection_get_autoconnect (s_con)) return FALSE; - return nm_device_connection_is_available (device, connection, FALSE); + return nm_device_connection_is_available (self, connection, FALSE); } static gboolean -device_has_config (NMDevice *device) +device_has_config (NMDevice *self) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); /* Check for IP configuration. */ if (priv->ip4_config && nm_ip4_config_get_num_addresses (priv->ip4_config)) @@ -1660,7 +1660,7 @@ device_has_config (NMDevice *device) return TRUE; /* The existence of a software device is good enough. */ - if (nm_device_is_software (device)) + if (nm_device_is_software (self)) return TRUE; /* Slaves are also configured by definition */ @@ -1720,11 +1720,11 @@ nm_device_master_update_slave_connection (NMDevice *self, } NMConnection * -nm_device_generate_connection (NMDevice *device, NMDevice *master) +nm_device_generate_connection (NMDevice *self, NMDevice *master) { - NMDeviceClass *klass = NM_DEVICE_GET_CLASS (device); - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); - const char *ifname = nm_device_get_iface (device); + NMDeviceClass *klass = NM_DEVICE_GET_CLASS (self); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + const char *ifname = nm_device_get_iface (self); NMConnection *connection; NMSetting *s_con; NMSetting *s_ip4; @@ -1738,7 +1738,7 @@ nm_device_generate_connection (NMDevice *device, NMDevice *master) return NULL; /* Return NULL if device is unconfigured. */ - if (!device_has_config (device)) { + if (!device_has_config (self)) { nm_log_dbg (LOGD_DEVICE, "(%s): device has no existing configuration", ifname); return NULL; } @@ -1761,7 +1761,7 @@ nm_device_generate_connection (NMDevice *device, NMDevice *master) /* If the device is a slave, update various slave settings */ if (master) { if (!nm_device_master_update_slave_connection (master, - device, + self, connection, &error)) { @@ -1780,12 +1780,12 @@ nm_device_generate_connection (NMDevice *device, NMDevice *master) nm_connection_add_setting (connection, s_ip6); } - klass->update_connection (device, connection); + klass->update_connection (self, connection); /* Check the connection in case of update_connection() bug. */ if (!nm_connection_verify (connection, &error)) { nm_log_err (LOGD_DEVICE, "(%s): Generated connection does not verify: %s", - nm_device_get_iface (device), error->message); + nm_device_get_iface (self), error->message); g_clear_error (&error); g_object_unref (connection); return NULL; @@ -1809,15 +1809,15 @@ nm_device_generate_connection (NMDevice *device, NMDevice *master) /** * nm_device_get_best_auto_connection: - * @dev: an #NMDevice + * @self: an #NMDevice * @connections: (element-type #NMConnection): a list of connections * @specific_object: (out) (transfer full): on output, the path of an * object associated with the returned connection, to be passed to * nm_manager_activate_connection(), or %NULL. * * Looks through @connections to see if there is a connection that can - * be auto-activated on @dev right now. This requires, at a minimum, - * that the connection be compatible with @dev, and that it have the + * be auto-activated on @self right now. This requires, at a minimum, + * that the connection be compatible with @self, and that it have the * #NMSettingConnection:autoconnect property set. Some devices impose * additional requirements. (Eg, a Wi-Fi connection can only be * activated if its SSID was seen in the last scan.) @@ -1827,20 +1827,20 @@ nm_device_generate_connection (NMDevice *device, NMDevice *master) */ NMConnection * -nm_device_get_best_auto_connection (NMDevice *dev, +nm_device_get_best_auto_connection (NMDevice *self, GSList *connections, char **specific_object) { GSList *iter; - g_return_val_if_fail (NM_IS_DEVICE (dev), NULL); + g_return_val_if_fail (NM_IS_DEVICE (self), NULL); g_return_val_if_fail (specific_object != NULL, NULL); g_return_val_if_fail (*specific_object == NULL, NULL); for (iter = connections; iter; iter = iter->next) { NMConnection *connection = NM_CONNECTION (iter->data); - if (NM_DEVICE_GET_CLASS (dev)->can_auto_connect (dev, connection, specific_object)) + if (NM_DEVICE_GET_CLASS (self)->can_auto_connect (self, connection, specific_object)) return connection; } @@ -1878,7 +1878,7 @@ nm_device_complete_connection (NMDevice *self, } static gboolean -check_connection_compatible (NMDevice *device, NMConnection *connection) +check_connection_compatible (NMDevice *self, NMConnection *connection) { NMSettingConnection *s_con; const char *config_iface, *device_iface; @@ -1887,7 +1887,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection) g_assert (s_con); config_iface = nm_setting_connection_get_interface_name (s_con); - device_iface = nm_device_get_iface (device); + device_iface = nm_device_get_iface (self); if (config_iface && strcmp (config_iface, device_iface) != 0) return FALSE; @@ -1896,26 +1896,26 @@ check_connection_compatible (NMDevice *device, NMConnection *connection) /** * nm_device_check_connection_compatible: - * @device: an #NMDevice + * @self: an #NMDevice * @connection: an #NMConnection * - * Checks if @connection could potentially be activated on @device. - * This means only that @device has the proper capabilities, and that + * Checks if @connection could potentially be activated on @self. + * This means only that @self has the proper capabilities, and that * @connection is not locked to some other device. It does not - * necessarily mean that @connection could be activated on @device + * necessarily mean that @connection could be activated on @self * right now. (Eg, it might refer to a Wi-Fi network that is not * currently available.) * * Returns: #TRUE if @connection could potentially be activated on - * @device. + * @self. */ gboolean -nm_device_check_connection_compatible (NMDevice *device, NMConnection *connection) +nm_device_check_connection_compatible (NMDevice *self, NMConnection *connection) { - g_return_val_if_fail (NM_IS_DEVICE (device), FALSE); + g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE); - return NM_DEVICE_GET_CLASS (device)->check_connection_compatible (device, connection); + return NM_DEVICE_GET_CLASS (self)->check_connection_compatible (self, connection); } static gboolean @@ -1932,7 +1932,7 @@ string_in_list (const char *str, const char **array, gsize array_len) /** * nm_device_can_assume_connections: - * @device: #NMDevice instance + * @self: #NMDevice instance * * This is a convenience function to determine whether connection assumption * is available for this device. @@ -1940,14 +1940,14 @@ string_in_list (const char *str, const char **array, gsize array_len) * Returns: %TRUE if the device is capable of assuming connections, %FALSE if not */ static gboolean -nm_device_can_assume_connections (NMDevice *device) +nm_device_can_assume_connections (NMDevice *self) { - return !!NM_DEVICE_GET_CLASS (device)->update_connection; + return !!NM_DEVICE_GET_CLASS (self)->update_connection; } /** * nm_device_can_assume_active_connection: - * @device: #NMDevice instance + * @self: #NMDevice instance * * This is a convenience function to determine whether the device's active * connection can be assumed if NetworkManager restarts. This method returns @@ -1959,9 +1959,9 @@ nm_device_can_assume_connections (NMDevice *device) * assumed. */ gboolean -nm_device_can_assume_active_connection (NMDevice *device) +nm_device_can_assume_active_connection (NMDevice *self) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMConnection *connection; const char *method; const char *assumable_ip6_methods[] = { @@ -1977,10 +1977,10 @@ nm_device_can_assume_active_connection (NMDevice *device) NM_SETTING_IP6_CONFIG_METHOD_MANUAL, }; - if (!nm_device_can_assume_connections (device)) + if (!nm_device_can_assume_connections (self)) return FALSE; - connection = nm_device_get_connection (device); + connection = nm_device_get_connection (self); if (!connection) return FALSE; @@ -2248,7 +2248,7 @@ nm_device_activate_schedule_stage1_device_prepare (NMDevice *self) } static NMActStageReturn -act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason) +act_stage2_config (NMDevice *self, NMDeviceStateReason *reason) { /* Nothing to do */ return NM_ACT_STAGE_RETURN_SUCCESS; @@ -2723,15 +2723,15 @@ dhcp4_lease_change (NMDevice *self, NMIP4Config *config) } static void -dhcp4_fail (NMDevice *device, gboolean timeout) +dhcp4_fail (NMDevice *self, gboolean timeout) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - dhcp4_cleanup (device, TRUE, FALSE); + dhcp4_cleanup (self, TRUE, FALSE); if (timeout || (priv->ip4_state == IP_CONF)) - nm_device_activate_schedule_ip4_config_timeout (device); + nm_device_activate_schedule_ip4_config_timeout (self); else if (priv->ip4_state == IP_FAIL) - nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED); + nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED); } static void @@ -2757,40 +2757,40 @@ dhcp4_state_changed (NMDHCPClient *client, GHashTable *options, gpointer user_data) { - NMDevice *device = NM_DEVICE (user_data); - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevice *self = NM_DEVICE (user_data); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); g_return_if_fail (nm_dhcp_client_get_ipv6 (client) == FALSE); g_return_if_fail (!ip4_config || NM_IS_IP4_CONFIG (ip4_config)); nm_log_dbg (LOGD_DHCP4, "(%s): new DHCPv4 client state %d", - nm_device_get_iface (device), state); + nm_device_get_iface (self), state); switch (state) { case NM_DHCP_STATE_BOUND: if (!ip4_config) { nm_log_warn (LOGD_DHCP4, "(%s): failed to get IPv4 config in response to DHCP event.", - nm_device_get_ip_iface (device)); - nm_device_state_changed (device, + nm_device_get_ip_iface (self)); + nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE); break; } - dhcp4_update_config (device, priv->dhcp4_config, options); + dhcp4_update_config (self, priv->dhcp4_config, options); if (priv->ip4_state == IP_CONF) - nm_device_activate_schedule_ip4_config_result (device, ip4_config); + nm_device_activate_schedule_ip4_config_result (self, ip4_config); else if (priv->ip4_state == IP_DONE) - dhcp4_lease_change (device, ip4_config); + dhcp4_lease_change (self, ip4_config); break; case NM_DHCP_STATE_TIMEOUT: - dhcp4_fail (device, TRUE); + dhcp4_fail (self, TRUE); break; case NM_DHCP_STATE_DONE: case NM_DHCP_STATE_FAIL: /* dhclient quit and can't get/renew a lease; so kill the connection */ - dhcp4_fail (device, FALSE); + dhcp4_fail (self, FALSE); break; default: break; @@ -2955,7 +2955,7 @@ shared4_new_config (NMDevice *self, NMConnection *connection, NMDeviceStateReaso /*********************************************/ static gboolean -have_any_ready_slaves (NMDevice *device, const GSList *slaves) +have_any_ready_slaves (NMDevice *self, const GSList *slaves) { const GSList *iter; @@ -3131,51 +3131,51 @@ ip6_config_merge_and_apply (NMDevice *self, } static void -dhcp6_lease_change (NMDevice *device) +dhcp6_lease_change (NMDevice *self) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMConnection *connection; NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE; if (priv->dhcp6_ip6_config == NULL) { nm_log_warn (LOGD_DHCP6, "(%s): failed to get DHCPv6 config for rebind", - nm_device_get_ip_iface (device)); - nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED); + nm_device_get_ip_iface (self)); + nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED); return; } g_assert (priv->dhcp6_client); /* sanity check */ - connection = nm_device_get_connection (device); + connection = nm_device_get_connection (self); g_assert (connection); /* Apply the updated config */ - if (ip6_config_merge_and_apply (device, TRUE, &reason) == FALSE) { + if (ip6_config_merge_and_apply (self, TRUE, &reason) == FALSE) { nm_log_warn (LOGD_DHCP6, "(%s): failed to update IPv6 config in response to DHCP event.", - nm_device_get_ip_iface (device)); - nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, reason); + nm_device_get_ip_iface (self)); + nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); } else { /* Notify dispatcher scripts of new DHCPv6 config */ - nm_dispatcher_call (DISPATCHER_ACTION_DHCP6_CHANGE, connection, device, NULL, NULL, NULL); + nm_dispatcher_call (DISPATCHER_ACTION_DHCP6_CHANGE, connection, self, NULL, NULL, NULL); } } static void -dhcp6_fail (NMDevice *device, gboolean timeout) +dhcp6_fail (NMDevice *self, gboolean timeout) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - dhcp6_cleanup (device, TRUE, FALSE); + dhcp6_cleanup (self, TRUE, FALSE); if (priv->dhcp6_mode == NM_RDISC_DHCP_LEVEL_MANAGED) { if (timeout || (priv->ip6_state == IP_CONF)) - nm_device_activate_schedule_ip6_config_timeout (device); + nm_device_activate_schedule_ip6_config_timeout (self); else if (priv->ip6_state == IP_FAIL) - nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED); + nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED); } else { /* not a hard failure; just live with the RA info */ if (priv->ip6_state == IP_CONF) - nm_device_activate_schedule_ip6_config_result (device); + nm_device_activate_schedule_ip6_config_result (self); } } @@ -3217,35 +3217,35 @@ dhcp6_state_changed (NMDHCPClient *client, GHashTable *options, gpointer user_data) { - NMDevice *device = NM_DEVICE (user_data); - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevice *self = NM_DEVICE (user_data); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); g_return_if_fail (nm_dhcp_client_get_ipv6 (client) == TRUE); g_return_if_fail (!ip6_config || NM_IS_IP6_CONFIG (ip6_config)); nm_log_dbg (LOGD_DHCP6, "(%s): new DHCPv6 client state %d", - nm_device_get_iface (device), state); + nm_device_get_iface (self), state); switch (state) { case NM_DHCP_STATE_BOUND: g_clear_object (&priv->dhcp6_ip6_config); if (ip6_config) { priv->dhcp6_ip6_config = g_object_ref (ip6_config); - dhcp6_update_config (device, priv->dhcp6_config, options); + dhcp6_update_config (self, priv->dhcp6_config, options); } if (priv->ip6_state == IP_CONF) { if (priv->dhcp6_ip6_config == NULL) { /* FIXME: Initial DHCP failed; should we fail IPv6 entirely then? */ - nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_DHCP_FAILED); + nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_DHCP_FAILED); break; } - nm_device_activate_schedule_ip6_config_result (device); + nm_device_activate_schedule_ip6_config_result (self); } else if (priv->ip6_state == IP_DONE) - dhcp6_lease_change (device); + dhcp6_lease_change (self); break; case NM_DHCP_STATE_TIMEOUT: - dhcp6_timeout (device, client); + dhcp6_timeout (self, client); break; case NM_DHCP_STATE_DONE: /* In IPv6 info-only mode, the client doesn't handle leases so it @@ -3257,7 +3257,7 @@ dhcp6_state_changed (NMDHCPClient *client, /* Otherwise, fall through */ case NM_DHCP_STATE_FAIL: /* dhclient quit and can't get/renew a lease; so kill the connection */ - dhcp6_fail (device, FALSE); + dhcp6_fail (self, FALSE); break; default: break; @@ -3513,9 +3513,9 @@ print_support_extended_ifa_flags (NMSettingIP6ConfigPrivacy use_tempaddr) } static void -rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device) +rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *self) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMConnection *connection; int i; NMDeviceStateReason reason; @@ -3544,7 +3544,7 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device } g_return_if_fail (priv->act_request); - connection = nm_device_get_connection (device); + connection = nm_device_get_connection (self); g_assert (connection); if (!priv->ac_ip6_config) @@ -3606,7 +3606,7 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device route.plen = discovered_route->plen; route.gateway = discovered_route->gateway; route.source = NM_PLATFORM_SOURCE_RDISC; - route.metric = nm_device_get_priority (device); + route.metric = nm_device_get_priority (self); nm_ip6_config_add_route (priv->ac_ip6_config, &route); } @@ -3636,7 +3636,7 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device } if (changed & NM_RDISC_CONFIG_DHCP_LEVEL) { - dhcp6_cleanup (device, TRUE, TRUE); + dhcp6_cleanup (self, TRUE, TRUE); priv->dhcp6_mode = rdisc->dhcp_level; @@ -3648,14 +3648,14 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device "Activation (%s) Stage 3 of 5 (IP Configure Start) starting DHCPv6" " as requested by IPv6 router...", priv->iface); - switch (dhcp6_start (device, connection, priv->dhcp6_mode, &reason)) { + switch (dhcp6_start (self, connection, priv->dhcp6_mode, &reason)) { case NM_ACT_STAGE_RETURN_SUCCESS: g_warn_if_reached (); break; case NM_ACT_STAGE_RETURN_POSTPONE: return; default: - nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, reason); + nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason); return; } } @@ -3665,10 +3665,10 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device char val[16]; g_snprintf (val, sizeof (val), "%d", rdisc->hop_limit); - nm_device_ipv6_sysctl_set (device, "hop_limit", val); + nm_device_ipv6_sysctl_set (self, "hop_limit", val); } - nm_device_activate_schedule_ip6_config_result (device); + nm_device_activate_schedule_ip6_config_result (self); } static gboolean @@ -4840,17 +4840,17 @@ _update_ip4_address (NMDevice *self) } gboolean -nm_device_get_is_nm_owned (NMDevice *device) +nm_device_get_is_nm_owned (NMDevice *self) { - return NM_DEVICE_GET_PRIVATE (device)->is_nm_owned; + return NM_DEVICE_GET_PRIVATE (self)->is_nm_owned; } void -nm_device_set_nm_owned (NMDevice *device) +nm_device_set_nm_owned (NMDevice *self) { - g_return_if_fail (NM_IS_DEVICE (device)); + g_return_if_fail (NM_IS_DEVICE (self)); - NM_DEVICE_GET_PRIVATE (device)->is_nm_owned = TRUE; + NM_DEVICE_GET_PRIVATE (self)->is_nm_owned = TRUE; } /* @@ -4927,12 +4927,12 @@ delete_on_deactivate_check_and_schedule (NMDevice *self, int ifindex) } static void -disconnect_cb (NMDevice *device, +disconnect_cb (NMDevice *self, DBusGMethodInvocation *context, GError *error, gpointer user_data) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); GError *local = NULL; if (error) { @@ -4950,7 +4950,7 @@ disconnect_cb (NMDevice *device, } else { priv->autoconnect = FALSE; - nm_device_state_changed (device, + nm_device_state_changed (self, NM_DEVICE_STATE_DEACTIVATING, NM_DEVICE_STATE_REASON_USER_REQUESTED); dbus_g_method_return (context); @@ -4958,12 +4958,12 @@ disconnect_cb (NMDevice *device, } static void -impl_device_disconnect (NMDevice *device, DBusGMethodInvocation *context) +impl_device_disconnect (NMDevice *self, DBusGMethodInvocation *context) { NMConnection *connection; GError *error = NULL; - if (NM_DEVICE_GET_PRIVATE (device)->act_request == NULL) { + if (NM_DEVICE_GET_PRIVATE (self)->act_request == NULL) { error = g_error_new_literal (NM_DEVICE_ERROR, NM_DEVICE_ERROR_NOT_ACTIVE, "This device is not active"); @@ -4972,11 +4972,11 @@ impl_device_disconnect (NMDevice *device, DBusGMethodInvocation *context) return; } - connection = nm_device_get_connection (device); + connection = nm_device_get_connection (self); g_assert (connection); /* Ask the manager to authenticate this request for us */ - g_signal_emit (device, signals[AUTH_REQUEST], 0, + g_signal_emit (self, signals[AUTH_REQUEST], 0, context, connection, NM_AUTH_PERMISSION_NETWORK_CONTROL, @@ -4986,7 +4986,7 @@ impl_device_disconnect (NMDevice *device, DBusGMethodInvocation *context) } static void -delete_cb (NMDevice *device, +delete_cb (NMDevice *self, DBusGMethodInvocation *context, GError *error, gpointer user_data) @@ -4997,16 +4997,16 @@ delete_cb (NMDevice *device, } /* Authorized */ - nm_platform_link_delete (nm_device_get_ifindex (device)); + nm_platform_link_delete (nm_device_get_ifindex (self)); dbus_g_method_return (context); } static void -impl_device_delete (NMDevice *device, DBusGMethodInvocation *context) +impl_device_delete (NMDevice *self, DBusGMethodInvocation *context) { GError *error = NULL; - if (!nm_device_is_software (device)) { + if (!nm_device_is_software (self)) { error = g_error_new_literal (NM_DEVICE_ERROR, NM_DEVICE_ERROR_NOT_SOFTWARE, "This device is not a software device"); @@ -5016,7 +5016,7 @@ impl_device_delete (NMDevice *device, DBusGMethodInvocation *context) } /* Ask the manager to authenticate this request for us */ - g_signal_emit (device, signals[AUTH_REQUEST], 0, + g_signal_emit (self, signals[AUTH_REQUEST], 0, context, NULL, NM_AUTH_PERMISSION_NETWORK_CONTROL, @@ -5090,14 +5090,14 @@ nm_device_queue_activation (NMDevice *self, NMActRequest *req) * */ gboolean -nm_device_is_activating (NMDevice *device) +nm_device_is_activating (NMDevice *self) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMDeviceState state; - g_return_val_if_fail (NM_IS_DEVICE (device), FALSE); + g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); - state = nm_device_get_state (device); + state = nm_device_get_state (self); if (state >= NM_DEVICE_STATE_PREPARE && state <= NM_DEVICE_STATE_SECONDARIES) return TRUE; @@ -5218,9 +5218,9 @@ nm_device_set_ip4_config (NMDevice *self, } void -nm_device_set_vpn4_config (NMDevice *device, NMIP4Config *config) +nm_device_set_vpn4_config (NMDevice *self, NMIP4Config *config) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); if (priv->vpn4_config == config) return; @@ -5230,16 +5230,16 @@ nm_device_set_vpn4_config (NMDevice *device, NMIP4Config *config) priv->vpn4_config = g_object_ref (config); /* NULL to use existing configs */ - if (!ip4_config_merge_and_apply (device, NULL, TRUE, NULL)) { + if (!ip4_config_merge_and_apply (self, NULL, TRUE, NULL)) { nm_log_warn (LOGD_IP4, "(%s): failed to set VPN routes for device", - nm_device_get_ip_iface (device)); + nm_device_get_ip_iface (self)); } } void -nm_device_set_wwan_ip4_config (NMDevice *device, NMIP4Config *config) +nm_device_set_wwan_ip4_config (NMDevice *self, NMIP4Config *config) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); if (priv->wwan_ip4_config == config) return; @@ -5249,9 +5249,9 @@ nm_device_set_wwan_ip4_config (NMDevice *device, NMIP4Config *config) priv->wwan_ip4_config = g_object_ref (config); /* NULL to use existing configs */ - if (!ip4_config_merge_and_apply (device, NULL, TRUE, NULL)) { + if (!ip4_config_merge_and_apply (self, NULL, TRUE, NULL)) { nm_log_warn (LOGD_IP4, "(%s): failed to set WWAN IPv4 configuration", - nm_device_get_ip_iface (device)); + nm_device_get_ip_iface (self)); } } @@ -5341,9 +5341,9 @@ nm_device_set_ip6_config (NMDevice *self, } void -nm_device_set_vpn6_config (NMDevice *device, NMIP6Config *config) +nm_device_set_vpn6_config (NMDevice *self, NMIP6Config *config) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); if (priv->vpn6_config == config) return; @@ -5353,16 +5353,16 @@ nm_device_set_vpn6_config (NMDevice *device, NMIP6Config *config) priv->vpn6_config = g_object_ref (config); /* NULL to use existing configs */ - if (!ip6_config_merge_and_apply (device, TRUE, NULL)) { + if (!ip6_config_merge_and_apply (self, TRUE, NULL)) { nm_log_warn (LOGD_IP6, "(%s): failed to set VPN routes for device", - nm_device_get_ip_iface (device)); + nm_device_get_ip_iface (self)); } } void -nm_device_set_wwan_ip6_config (NMDevice *device, NMIP6Config *config) +nm_device_set_wwan_ip6_config (NMDevice *self, NMIP6Config *config) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); if (priv->wwan_ip6_config == config) return; @@ -5372,9 +5372,9 @@ nm_device_set_wwan_ip6_config (NMDevice *device, NMIP6Config *config) priv->wwan_ip6_config = g_object_ref (config); /* NULL to use existing configs */ - if (!ip6_config_merge_and_apply (device, TRUE, NULL)) { + if (!ip6_config_merge_and_apply (self, TRUE, NULL)) { nm_log_warn (LOGD_IP6, "(%s): failed to set WWAN IPv6 configuration", - nm_device_get_ip_iface (device)); + nm_device_get_ip_iface (self)); } } @@ -5643,9 +5643,9 @@ nm_device_is_up (NMDevice *self) } static gboolean -is_up (NMDevice *device) +is_up (NMDevice *self) { - int ifindex = nm_device_get_ip_ifindex (device); + int ifindex = nm_device_get_ip_ifindex (self); return ifindex > 0 ? nm_platform_link_is_up (ifindex) : TRUE; } @@ -5708,18 +5708,18 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware) } static void -check_carrier (NMDevice *device) +check_carrier (NMDevice *self) { - int ifindex = nm_device_get_ip_ifindex (device); + int ifindex = nm_device_get_ip_ifindex (self); - if (!device_has_capability (device, NM_DEVICE_CAP_NONSTANDARD_CARRIER)) - nm_device_set_carrier (device, nm_platform_link_is_connected (ifindex)); + if (!device_has_capability (self, NM_DEVICE_CAP_NONSTANDARD_CARRIER)) + nm_device_set_carrier (self, nm_platform_link_is_connected (ifindex)); } static gboolean -bring_up (NMDevice *device, gboolean *no_firmware) +bring_up (NMDevice *self, gboolean *no_firmware) { - int ifindex = nm_device_get_ip_ifindex (device); + int ifindex = nm_device_get_ip_ifindex (self); gboolean result; if (ifindex <= 0) { @@ -5733,8 +5733,8 @@ bring_up (NMDevice *device, gboolean *no_firmware) *no_firmware = nm_platform_get_error () == NM_PLATFORM_ERROR_NO_FIRMWARE; /* Store carrier immediately. */ - if (result && device_has_capability (device, NM_DEVICE_CAP_CARRIER_DETECT)) - check_carrier (device); + if (result && device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)) + check_carrier (self); return result; } @@ -5775,15 +5775,15 @@ nm_device_take_down (NMDevice *self, gboolean block) } static gboolean -take_down (NMDevice *device) +take_down (NMDevice *self) { - int ifindex = nm_device_get_ip_ifindex (device); + int ifindex = nm_device_get_ip_ifindex (self); if (ifindex > 0) return nm_platform_link_set_down (ifindex); /* devices without ifindex are always up. */ - nm_log_dbg (LOGD_HW, "(%s): cannot take down device without ifindex", nm_device_get_iface (device)); + nm_log_dbg (LOGD_HW, "(%s): cannot take down device without ifindex", nm_device_get_iface (self)); return FALSE; } @@ -5808,11 +5808,11 @@ nm_device_get_firmware_missing (NMDevice *self) } static NMIP4Config * -find_ip4_lease_config (NMDevice *device, +find_ip4_lease_config (NMDevice *self, NMConnection *connection, NMIP4Config *ext_ip4_config) { - const char *ip_iface = nm_device_get_ip_iface (device); + const char *ip_iface = nm_device_get_ip_iface (self); GSList *leases, *liter; NMIP4Config *found = NULL; @@ -5841,13 +5841,13 @@ find_ip4_lease_config (NMDevice *device, } static void -capture_lease_config (NMDevice *device, +capture_lease_config (NMDevice *self, NMIP4Config *ext_ip4_config, NMIP4Config **out_ip4_config, NMIP6Config *ext_ip6_config, NMIP6Config **out_ip6_config) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); const GSList *connections, *citer; guint i; gboolean dhcp_used = FALSE; @@ -5886,13 +5886,13 @@ capture_lease_config (NMDevice *device, NMConnection *candidate = citer->data; const char *method; - if (!nm_device_check_connection_compatible (device, candidate)) + if (!nm_device_check_connection_compatible (self, candidate)) continue; /* IPv4 leases */ method = nm_utils_get_ip_config_method (candidate, NM_TYPE_SETTING_IP4_CONFIG); if (out_ip4_config && strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0) { - *out_ip4_config = find_ip4_lease_config (device, candidate, ext_ip4_config); + *out_ip4_config = find_ip4_lease_config (self, candidate, ext_ip4_config); if (*out_ip4_config) return; } @@ -5970,9 +5970,9 @@ update_ip_config (NMDevice *self, gboolean initial) } void -nm_device_capture_initial_config (NMDevice *dev) +nm_device_capture_initial_config (NMDevice *self) { - update_ip_config (dev, TRUE); + update_ip_config (self, TRUE); } static gboolean @@ -6021,19 +6021,19 @@ nm_device_queued_ip_config_change_clear (NMDevice *self) /** * nm_device_get_managed(): - * @device: the #NMDevice + * @self: the #NMDevice * * Returns: %TRUE if the device is managed */ gboolean -nm_device_get_managed (NMDevice *device) +nm_device_get_managed (NMDevice *self) { NMDevicePrivate *priv; gboolean managed; - g_return_val_if_fail (NM_IS_DEVICE (device), FALSE); + g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); - priv = NM_DEVICE_GET_PRIVATE (device); + priv = NM_DEVICE_GET_PRIVATE (self); /* Return the composite of all managed flags. However, if the device * is a default-unmanaged device, and would be managed except for the @@ -6049,30 +6049,30 @@ nm_device_get_managed (NMDevice *device) /** * nm_device_get_unmanaged_flag(): - * @device: the #NMDevice + * @self: the #NMDevice * * Returns: %TRUE if the device is unmanaged for @flag. */ gboolean -nm_device_get_unmanaged_flag (NMDevice *device, NMUnmanagedFlags flag) +nm_device_get_unmanaged_flag (NMDevice *self, NMUnmanagedFlags flag) { - return NM_DEVICE_GET_PRIVATE (device)->unmanaged_flags & flag; + return NM_DEVICE_GET_PRIVATE (self)->unmanaged_flags & flag; } /** * nm_device_get_default_unmanaged(): - * @device: the #NMDevice + * @self: the #NMDevice * * Returns: %TRUE if the device is by default unmanaged */ static gboolean -nm_device_get_default_unmanaged (NMDevice *device) +nm_device_get_default_unmanaged (NMDevice *self) { - return nm_device_get_unmanaged_flag (device, NM_UNMANAGED_DEFAULT); + return nm_device_get_unmanaged_flag (self, NM_UNMANAGED_DEFAULT); } void -nm_device_set_unmanaged (NMDevice *device, +nm_device_set_unmanaged (NMDevice *self, NMUnmanagedFlags flag, gboolean unmanaged, NMDeviceStateReason reason) @@ -6080,42 +6080,42 @@ nm_device_set_unmanaged (NMDevice *device, NMDevicePrivate *priv; gboolean was_managed, now_managed; - g_return_if_fail (NM_IS_DEVICE (device)); + g_return_if_fail (NM_IS_DEVICE (self)); g_return_if_fail (flag <= NM_UNMANAGED_LAST); - priv = NM_DEVICE_GET_PRIVATE (device); + priv = NM_DEVICE_GET_PRIVATE (self); - was_managed = nm_device_get_managed (device); + was_managed = nm_device_get_managed (self); if (unmanaged) priv->unmanaged_flags |= flag; else priv->unmanaged_flags &= ~flag; - now_managed = nm_device_get_managed (device); + now_managed = nm_device_get_managed (self); if (was_managed != now_managed) { nm_log_dbg (LOGD_DEVICE, "(%s): now %s", - nm_device_get_iface (device), + nm_device_get_iface (self), unmanaged ? "unmanaged" : "managed"); - g_object_notify (G_OBJECT (device), NM_DEVICE_MANAGED); + g_object_notify (G_OBJECT (self), NM_DEVICE_MANAGED); if (unmanaged) - nm_device_state_changed (device, NM_DEVICE_STATE_UNMANAGED, reason); + nm_device_state_changed (self, NM_DEVICE_STATE_UNMANAGED, reason); else - nm_device_state_changed (device, NM_DEVICE_STATE_UNAVAILABLE, reason); + nm_device_state_changed (self, NM_DEVICE_STATE_UNAVAILABLE, reason); } } void -nm_device_set_unmanaged_quitting (NMDevice *device) +nm_device_set_unmanaged_quitting (NMDevice *self) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); /* It's OK to block here because we're quitting */ - if (nm_device_is_activating (device) || priv->state == NM_DEVICE_STATE_ACTIVATED) - _set_state_full (device, NM_DEVICE_STATE_DEACTIVATING, NM_DEVICE_STATE_REASON_REMOVED, TRUE); + if (nm_device_is_activating (self) || priv->state == NM_DEVICE_STATE_ACTIVATED) + _set_state_full (self, NM_DEVICE_STATE_DEACTIVATING, NM_DEVICE_STATE_REASON_REMOVED, TRUE); - nm_device_set_unmanaged (device, + nm_device_set_unmanaged (self, NM_UNMANAGED_INTERNAL, TRUE, NM_DEVICE_STATE_REASON_REMOVED); @@ -6123,7 +6123,7 @@ nm_device_set_unmanaged_quitting (NMDevice *device) /** * nm_device_set_initial_unmanaged_flag(): - * @device: the #NMDevice + * @self: the #NMDevice * @flag: an #NMUnmanagedFlag * @unmanaged: %TRUE or %FALSE to set or clear @flag * @@ -6132,16 +6132,16 @@ nm_device_set_unmanaged_quitting (NMDevice *device) * a device. */ void -nm_device_set_initial_unmanaged_flag (NMDevice *device, +nm_device_set_initial_unmanaged_flag (NMDevice *self, NMUnmanagedFlags flag, gboolean unmanaged) { NMDevicePrivate *priv; - g_return_if_fail (NM_IS_DEVICE (device)); + g_return_if_fail (NM_IS_DEVICE (self)); g_return_if_fail (flag <= NM_UNMANAGED_LAST); - priv = NM_DEVICE_GET_PRIVATE (device); + priv = NM_DEVICE_GET_PRIVATE (self); g_return_if_fail (priv->path == NULL); if (unmanaged) @@ -6151,21 +6151,21 @@ nm_device_set_initial_unmanaged_flag (NMDevice *device, } void -nm_device_set_dhcp_timeout (NMDevice *device, guint32 timeout) +nm_device_set_dhcp_timeout (NMDevice *self, guint32 timeout) { - g_return_if_fail (NM_IS_DEVICE (device)); + g_return_if_fail (NM_IS_DEVICE (self)); - NM_DEVICE_GET_PRIVATE (device)->dhcp_timeout = timeout; + NM_DEVICE_GET_PRIVATE (self)->dhcp_timeout = timeout; } void -nm_device_set_dhcp_anycast_address (NMDevice *device, guint8 *addr) +nm_device_set_dhcp_anycast_address (NMDevice *self, guint8 *addr) { NMDevicePrivate *priv; - g_return_if_fail (NM_IS_DEVICE (device)); + g_return_if_fail (NM_IS_DEVICE (self)); - priv = NM_DEVICE_GET_PRIVATE (device); + priv = NM_DEVICE_GET_PRIVATE (self); if (priv->dhcp_anycast_address) { g_byte_array_free (priv->dhcp_anycast_address, TRUE); @@ -6180,31 +6180,31 @@ nm_device_set_dhcp_anycast_address (NMDevice *device, guint8 *addr) /** * nm_device_connection_is_available(): - * @device: the #NMDevice + * @self: the #NMDevice * @connection: the #NMConnection to check for availability * @allow_device_override: set to %TRUE to let the device do specific checks * - * Check if @connection is available to be activated on @device. Normally this - * only checks if the connection is in @device's AvailableConnections property. + * Check if @connection is available to be activated on @self. Normally this + * only checks if the connection is in @self's AvailableConnections property. * If @allow_device_override is %TRUE then the device is asked to do specific * checks that may bypass the AvailableConnections property. * - * Returns: %TRUE if @connection can be activated on @device + * Returns: %TRUE if @connection can be activated on @self */ gboolean -nm_device_connection_is_available (NMDevice *device, +nm_device_connection_is_available (NMDevice *self, NMConnection *connection, gboolean allow_device_override) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); gboolean available = FALSE; - if (nm_device_get_default_unmanaged (device) && (priv->state == NM_DEVICE_STATE_UNMANAGED)) { + if (nm_device_get_default_unmanaged (self) && (priv->state == NM_DEVICE_STATE_UNMANAGED)) { /* default-unmanaged devices in UNMANAGED state have no available connections * so we must manually check whether the connection is available here. */ - if ( nm_device_check_connection_compatible (device, connection) - && NM_DEVICE_GET_CLASS (device)->check_connection_available (device, connection, NULL)) + if ( nm_device_check_connection_compatible (self, connection) + && NM_DEVICE_GET_CLASS (self)->check_connection_available (self, connection, NULL)) return TRUE; } @@ -6215,26 +6215,26 @@ nm_device_connection_is_available (NMDevice *device, * activating but the network isn't available let the device recheck * availability. */ - if ( nm_device_check_connection_compatible (device, connection) - && NM_DEVICE_GET_CLASS (device)->check_connection_available_wifi_hidden) - available = NM_DEVICE_GET_CLASS (device)->check_connection_available_wifi_hidden (device, connection); + if ( nm_device_check_connection_compatible (self, connection) + && NM_DEVICE_GET_CLASS (self)->check_connection_available_wifi_hidden) + available = NM_DEVICE_GET_CLASS (self)->check_connection_available_wifi_hidden (self, connection); } return available; } static void -_signal_available_connections_changed (NMDevice *device) +_signal_available_connections_changed (NMDevice *self) { - g_object_notify (G_OBJECT (device), NM_DEVICE_AVAILABLE_CONNECTIONS); + g_object_notify (G_OBJECT (self), NM_DEVICE_AVAILABLE_CONNECTIONS); } static void -_clear_available_connections (NMDevice *device, gboolean do_signal) +_clear_available_connections (NMDevice *self, gboolean do_signal) { - g_hash_table_remove_all (NM_DEVICE_GET_PRIVATE (device)->available_connections); + g_hash_table_remove_all (NM_DEVICE_GET_PRIVATE (self)->available_connections); if (do_signal == TRUE) - _signal_available_connections_changed (device); + _signal_available_connections_changed (self); } static gboolean @@ -6255,9 +6255,9 @@ _try_add_available_connection (NMDevice *self, NMConnection *connection) } static gboolean -_del_available_connection (NMDevice *device, NMConnection *connection) +_del_available_connection (NMDevice *self, NMConnection *connection) { - return g_hash_table_remove (NM_DEVICE_GET_PRIVATE (device)->available_connections, connection); + return g_hash_table_remove (NM_DEVICE_GET_PRIVATE (self)->available_connections, connection); } static gboolean @@ -6310,43 +6310,43 @@ connection_requires_carrier (NMConnection *connection) } static gboolean -check_connection_available (NMDevice *device, +check_connection_available (NMDevice *self, NMConnection *connection, const char *specific_object) { /* Connections which require a network connection are not available when * the device has no carrier, even with ignore-carrer=TRUE. */ - if (NM_DEVICE_GET_PRIVATE (device)->carrier == FALSE) + if (NM_DEVICE_GET_PRIVATE (self)->carrier == FALSE) return connection_requires_carrier (connection) ? FALSE : TRUE; return TRUE; } void -nm_device_recheck_available_connections (NMDevice *device) +nm_device_recheck_available_connections (NMDevice *self) { NMDevicePrivate *priv; const GSList *connections, *iter; - g_return_if_fail (NM_IS_DEVICE (device)); + g_return_if_fail (NM_IS_DEVICE (self)); - priv = NM_DEVICE_GET_PRIVATE(device); + priv = NM_DEVICE_GET_PRIVATE(self); if (priv->con_provider) { - _clear_available_connections (device, FALSE); + _clear_available_connections (self, FALSE); connections = nm_connection_provider_get_connections (priv->con_provider); for (iter = connections; iter; iter = g_slist_next (iter)) - _try_add_available_connection (device, NM_CONNECTION (iter->data)); + _try_add_available_connection (self, NM_CONNECTION (iter->data)); - _signal_available_connections_changed (device); + _signal_available_connections_changed (self); } } /** * nm_device_get_available_connections: - * @device: the #NMDevice + * @self: the #NMDevice * @specific_object: a specific object path if any * * Returns a list of connections available to activate on the device, taking @@ -6356,9 +6356,9 @@ nm_device_recheck_available_connections (NMDevice *device) * Returns: caller-owned #GPtrArray of #NMConnections */ GPtrArray * -nm_device_get_available_connections (NMDevice *device, const char *specific_object) +nm_device_get_available_connections (NMDevice *self, const char *specific_object) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); GHashTableIter iter; guint num_available; NMConnection *connection = NULL; @@ -6373,7 +6373,7 @@ nm_device_get_available_connections (NMDevice *device, const char *specific_obje * compatible with it. */ if ( !specific_object - || NM_DEVICE_GET_CLASS (device)->check_connection_available (device, connection, specific_object)) + || NM_DEVICE_GET_CLASS (self)->check_connection_available (self, connection, specific_object)) g_ptr_array_add (array, connection); } } @@ -6409,14 +6409,14 @@ cp_connection_updated (NMConnectionProvider *cp, NMConnection *connection, gpoin } gboolean -nm_device_supports_vlans (NMDevice *device) +nm_device_supports_vlans (NMDevice *self) { - return nm_platform_link_supports_vlans (nm_device_get_ifindex (device)); + return nm_platform_link_supports_vlans (nm_device_get_ifindex (self)); } /** * nm_device_add_pending_action(): - * @device: the #NMDevice to add the pending action to + * @self: the #NMDevice to add the pending action to * @action: a static string that identifies the action * @assert_not_yet_pending: if %TRUE, assert that the @action is currently not yet pending. * Otherwise, ignore duplicate scheduling of the same action silently. @@ -6428,9 +6428,9 @@ nm_device_supports_vlans (NMDevice *device) * a second time. */ gboolean -nm_device_add_pending_action (NMDevice *device, const char *action, gboolean assert_not_yet_pending) +nm_device_add_pending_action (NMDevice *self, const char *action, gboolean assert_not_yet_pending) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); GSList *iter; guint count = 0; @@ -6441,13 +6441,13 @@ nm_device_add_pending_action (NMDevice *device, const char *action, gboolean ass if (!strcmp (action, iter->data)) { if (assert_not_yet_pending) { nm_log_warn (LOGD_DEVICE, "(%s): add_pending_action (%d): '%s' already pending", - nm_device_get_iface (device), + nm_device_get_iface (self), count + g_slist_length (iter), action); g_return_val_if_reached (FALSE); } else { nm_log_dbg (LOGD_DEVICE, "(%s): add_pending_action (%d): '%s' already pending (expected)", - nm_device_get_iface (device), + nm_device_get_iface (self), count + g_slist_length (iter), action); } @@ -6460,19 +6460,19 @@ nm_device_add_pending_action (NMDevice *device, const char *action, gboolean ass count++; nm_log_dbg (LOGD_DEVICE, "(%s): add_pending_action (%d): '%s'", - nm_device_get_iface (device), + nm_device_get_iface (self), count, action); if (count == 1) - g_object_notify (G_OBJECT (device), NM_DEVICE_HAS_PENDING_ACTION); + g_object_notify (G_OBJECT (self), NM_DEVICE_HAS_PENDING_ACTION); return TRUE; } /** * nm_device_remove_pending_action(): - * @device: the #NMDevice to remove the pending action from + * @self: the #NMDevice to remove the pending action from * @action: a static string that identifies the action * @assert_is_pending: if %TRUE, assert that the @action is pending. * If %FALSE, don't do anything if the current action is not pending and @@ -6483,9 +6483,9 @@ nm_device_add_pending_action (NMDevice *device, const char *action, gboolean ass * Returns: whether the @action was pending and is now removed. */ gboolean -nm_device_remove_pending_action (NMDevice *device, const char *action, gboolean assert_is_pending) +nm_device_remove_pending_action (NMDevice *self, const char *action, gboolean assert_is_pending) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); GSList *iter; guint count = 0; @@ -6494,13 +6494,13 @@ nm_device_remove_pending_action (NMDevice *device, const char *action, gboolean for (iter = priv->pending_actions; iter; iter = iter->next) { if (!strcmp (action, iter->data)) { nm_log_dbg (LOGD_DEVICE, "(%s): remove_pending_action (%d): '%s'", - nm_device_get_iface (device), + nm_device_get_iface (self), count + g_slist_length (iter->next), /* length excluding 'iter' */ action); g_free (iter->data); priv->pending_actions = g_slist_delete_link (priv->pending_actions, iter); if (priv->pending_actions == NULL) - g_object_notify (G_OBJECT (device), NM_DEVICE_HAS_PENDING_ACTION); + g_object_notify (G_OBJECT (self), NM_DEVICE_HAS_PENDING_ACTION); return TRUE; } count++; @@ -6508,13 +6508,13 @@ nm_device_remove_pending_action (NMDevice *device, const char *action, gboolean if (assert_is_pending) { nm_log_warn (LOGD_DEVICE, "(%s): remove_pending_action (%d): '%s' not pending", - nm_device_get_iface (device), + nm_device_get_iface (self), count, action); g_return_val_if_reached (FALSE); } else { nm_log_dbg (LOGD_DEVICE, "(%s): remove_pending_action (%d): '%s' not pending (expected)", - nm_device_get_iface (device), + nm_device_get_iface (self), count, action); } @@ -6522,9 +6522,9 @@ nm_device_remove_pending_action (NMDevice *device, const char *action, gboolean } gboolean -nm_device_has_pending_action (NMDevice *device) +nm_device_has_pending_action (NMDevice *self) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); return !!priv->pending_actions; } @@ -6681,22 +6681,22 @@ ip_config_valid (NMDeviceState state) } static void -notify_ip_properties (NMDevice *device) +notify_ip_properties (NMDevice *self) { - g_object_notify (G_OBJECT (device), NM_DEVICE_IP_IFACE); - g_object_notify (G_OBJECT (device), NM_DEVICE_IP4_CONFIG); - g_object_notify (G_OBJECT (device), NM_DEVICE_DHCP4_CONFIG); - g_object_notify (G_OBJECT (device), NM_DEVICE_IP6_CONFIG); - g_object_notify (G_OBJECT (device), NM_DEVICE_DHCP6_CONFIG); + g_object_notify (G_OBJECT (self), NM_DEVICE_IP_IFACE); + g_object_notify (G_OBJECT (self), NM_DEVICE_IP4_CONFIG); + g_object_notify (G_OBJECT (self), NM_DEVICE_DHCP4_CONFIG); + g_object_notify (G_OBJECT (self), NM_DEVICE_IP6_CONFIG); + g_object_notify (G_OBJECT (self), NM_DEVICE_DHCP6_CONFIG); } static void -_set_state_full (NMDevice *device, +_set_state_full (NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, gboolean quitting) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMDeviceState old_state; NMActRequest *req; gboolean no_firmware = FALSE; @@ -6706,7 +6706,7 @@ _set_state_full (NMDevice *device, g_warn_if_fail (priv->in_state_changed == FALSE); priv->in_state_changed = TRUE; - g_return_if_fail (NM_IS_DEVICE (device)); + g_return_if_fail (NM_IS_DEVICE (self)); /* Do nothing if state isn't changing, but as a special case allow * re-setting UNAVAILABLE if the device is missing firmware so that we @@ -6723,7 +6723,7 @@ _set_state_full (NMDevice *device, priv->state_reason = reason; nm_log_info (LOGD_DEVICE, "(%s): device state change: %s -> %s (reason '%s') [%d %d %d]", - nm_device_get_iface (device), + nm_device_get_iface (self), state_to_string (old_state), state_to_string (state), reason_to_string (reason), @@ -6732,53 +6732,53 @@ _set_state_full (NMDevice *device, reason); /* Clear any queued transitions */ - nm_device_queued_state_clear (device); + nm_device_queued_state_clear (self); - dispatcher_cleanup (device); + dispatcher_cleanup (self); /* Cache the activation request for the dispatcher */ req = priv->act_request ? g_object_ref (priv->act_request) : NULL; if (state <= NM_DEVICE_STATE_UNAVAILABLE) { - _clear_available_connections (device, TRUE); + _clear_available_connections (self, TRUE); g_clear_object (&priv->queued_act_request); } /* Update the available connections list when a device first becomes available */ if ( state >= NM_DEVICE_STATE_DISCONNECTED && old_state < NM_DEVICE_STATE_DISCONNECTED) - nm_device_recheck_available_connections (device); + nm_device_recheck_available_connections (self); /* Handle the new state here; but anything that could trigger * another state change should be done below. */ switch (state) { case NM_DEVICE_STATE_UNMANAGED: - nm_device_set_firmware_missing (device, FALSE); + nm_device_set_firmware_missing (self, FALSE); if (old_state > NM_DEVICE_STATE_UNMANAGED) { /* Clean up if the device is now unmanaged but was activated */ - if (nm_device_get_act_request (device)) - nm_device_cleanup (device, reason); - nm_device_take_down (device, TRUE); - restore_ip6_properties (device); + if (nm_device_get_act_request (self)) + nm_device_cleanup (self, reason); + nm_device_take_down (self, TRUE); + restore_ip6_properties (self); } break; case NM_DEVICE_STATE_UNAVAILABLE: if (old_state == NM_DEVICE_STATE_UNMANAGED) { - save_ip6_properties (device); + save_ip6_properties (self); if (reason != NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED) { - nm_device_ipv6_sysctl_set (device, "disable_ipv6", "1"); - nm_device_ipv6_sysctl_set (device, "accept_ra_defrtr", "0"); - nm_device_ipv6_sysctl_set (device, "accept_ra_pinfo", "0"); - nm_device_ipv6_sysctl_set (device, "accept_ra_rtr_pref", "0"); - nm_device_ipv6_sysctl_set (device, "use_tempaddr", "0"); + nm_device_ipv6_sysctl_set (self, "disable_ipv6", "1"); + nm_device_ipv6_sysctl_set (self, "accept_ra_defrtr", "0"); + nm_device_ipv6_sysctl_set (self, "accept_ra_pinfo", "0"); + nm_device_ipv6_sysctl_set (self, "accept_ra_rtr_pref", "0"); + nm_device_ipv6_sysctl_set (self, "use_tempaddr", "0"); } } if (old_state == NM_DEVICE_STATE_UNMANAGED || priv->firmware_missing) { - if (!nm_device_bring_up (device, TRUE, &no_firmware) && no_firmware) - nm_log_warn (LOGD_HW, "(%s): firmware may be missing.", nm_device_get_iface (device)); - nm_device_set_firmware_missing (device, no_firmware ? TRUE : FALSE); + if (!nm_device_bring_up (self, TRUE, &no_firmware) && no_firmware) + nm_log_warn (LOGD_HW, "(%s): firmware may be missing.", nm_device_get_iface (self)); + nm_device_set_firmware_missing (self, no_firmware ? TRUE : FALSE); } /* Ensure the device gets deactivated in response to stuff like * carrier changes or rfkill. But don't deactivate devices that are @@ -6789,11 +6789,11 @@ _set_state_full (NMDevice *device, * UNMANAGED, to ensure that it's in a clean state. */ if (reason != NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED) - nm_device_cleanup (device, reason); + nm_device_cleanup (self, reason); break; case NM_DEVICE_STATE_DISCONNECTED: if (old_state > NM_DEVICE_STATE_UNAVAILABLE) - nm_device_cleanup (device, reason); + nm_device_cleanup (self, reason); break; default: break; @@ -6804,9 +6804,9 @@ _set_state_full (NMDevice *device, && state <= NM_DEVICE_STATE_ACTIVATED) priv->autoconnect = TRUE; - g_object_notify (G_OBJECT (device), NM_DEVICE_STATE); - g_object_notify (G_OBJECT (device), NM_DEVICE_STATE_REASON); - g_signal_emit_by_name (device, "state-changed", state, old_state, reason); + g_object_notify (G_OBJECT (self), NM_DEVICE_STATE); + g_object_notify (G_OBJECT (self), NM_DEVICE_STATE_REASON); + g_signal_emit_by_name (self, "state-changed", state, old_state, reason); /* Post-process the event after internal notification */ @@ -6818,35 +6818,35 @@ _set_state_full (NMDevice *device, * we can't change states again from the state handler for a variety of * reasons. */ - if (nm_device_is_available (device)) { + if (nm_device_is_available (self)) { nm_log_dbg (LOGD_DEVICE, "(%s): device is available, will transition to DISCONNECTED", - nm_device_get_iface (device)); - nm_device_queue_state (device, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_NONE); + nm_device_get_iface (self)); + nm_device_queue_state (self, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_NONE); } else { if (old_state == NM_DEVICE_STATE_UNMANAGED) { nm_log_dbg (LOGD_DEVICE, "(%s): device not yet available for transition to DISCONNECTED", - nm_device_get_iface (device)); + nm_device_get_iface (self)); } else if ( old_state > NM_DEVICE_STATE_UNAVAILABLE - && nm_device_get_default_unmanaged (device)) - nm_device_queue_state (device, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE); + && nm_device_get_default_unmanaged (self)) + nm_device_queue_state (self, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE); } break; case NM_DEVICE_STATE_DEACTIVATING: if (quitting) { nm_dispatcher_call_sync (DISPATCHER_ACTION_PRE_DOWN, nm_act_request_get_connection (req), - device); + self); } else { priv->dispatcher.post_state = NM_DEVICE_STATE_DISCONNECTED; priv->dispatcher.post_state_reason = reason; if (!nm_dispatcher_call (DISPATCHER_ACTION_PRE_DOWN, nm_act_request_get_connection (req), - device, + self, dispatcher_complete_proceed_state, - device, + self, &priv->dispatcher.call_id)) { /* Just proceed on errors */ - dispatcher_complete_proceed_state (0, device); + dispatcher_complete_proceed_state (0, self); } } break; @@ -6856,26 +6856,26 @@ _set_state_full (NMDevice *device, queued_req = priv->queued_act_request; priv->queued_act_request = NULL; - _device_activate (device, queued_req); + _device_activate (self, queued_req); g_object_unref (queued_req); } else if ( old_state > NM_DEVICE_STATE_DISCONNECTED - && nm_device_get_default_unmanaged (device)) - nm_device_queue_state (device, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE); + && nm_device_get_default_unmanaged (self)) + nm_device_queue_state (self, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE); break; case NM_DEVICE_STATE_ACTIVATED: nm_log_info (LOGD_DEVICE, "Activation (%s) successful, device activated.", - nm_device_get_iface (device)); - nm_dispatcher_call (DISPATCHER_ACTION_UP, nm_act_request_get_connection (req), device, NULL, NULL, NULL); + nm_device_get_iface (self)); + nm_dispatcher_call (DISPATCHER_ACTION_UP, nm_act_request_get_connection (req), self, NULL, NULL, NULL); break; case NM_DEVICE_STATE_FAILED: - connection = nm_device_get_connection (device); + connection = nm_device_get_connection (self); nm_log_warn (LOGD_DEVICE | LOGD_WIFI, "Activation (%s) failed for connection '%s'", - nm_device_get_iface (device), + nm_device_get_iface (self), connection ? nm_connection_get_id (connection) : ""); /* Notify any slaves of the unexpected failure */ - nm_device_master_release_slaves (device); + nm_device_master_release_slaves (self); /* If the connection doesn't yet have a timestamp, set it to zero so that * we can distinguish between connections we've tried to activate and have @@ -6892,41 +6892,41 @@ _set_state_full (NMDevice *device, * immediately because we can't change states again from the state * handler for a variety of reasons. */ - nm_device_queue_state (device, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_NONE); + nm_device_queue_state (self, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_NONE); break; case NM_DEVICE_STATE_IP_CHECK: - nm_device_start_ip_check (device); + nm_device_start_ip_check (self); /* IP-related properties are only valid when the device has IP configuration; * now that it does, ensure their change notifications are emitted. */ - notify_ip_properties (device); + notify_ip_properties (self); break; case NM_DEVICE_STATE_SECONDARIES: - ip_check_gw_ping_cleanup (device); + ip_check_gw_ping_cleanup (self); nm_log_dbg (LOGD_DEVICE, "(%s): device entered SECONDARIES state", - nm_device_get_iface (device)); + nm_device_get_iface (self)); break; default: break; } if (state > NM_DEVICE_STATE_DISCONNECTED) - delete_on_deactivate_unschedule (device); + delete_on_deactivate_unschedule (self); if ( (old_state == NM_DEVICE_STATE_ACTIVATED || old_state == NM_DEVICE_STATE_DEACTIVATING) && (state != NM_DEVICE_STATE_DEACTIVATING)) { if (quitting) - nm_dispatcher_call_sync (DISPATCHER_ACTION_DOWN, nm_act_request_get_connection (req), device); + nm_dispatcher_call_sync (DISPATCHER_ACTION_DOWN, nm_act_request_get_connection (req), self); else - nm_dispatcher_call (DISPATCHER_ACTION_DOWN, nm_act_request_get_connection (req), device, NULL, NULL, NULL); + nm_dispatcher_call (DISPATCHER_ACTION_DOWN, nm_act_request_get_connection (req), self, NULL, NULL, NULL); } /* IP-related properties are only valid when the device has IP configuration. * If it no longer does, ensure their change notifications are emitted. */ if (ip_config_valid (old_state) && !ip_config_valid (state)) - notify_ip_properties (device); + notify_ip_properties (self); /* Dispose of the cached activation request */ if (req) @@ -6936,11 +6936,11 @@ _set_state_full (NMDevice *device, } void -nm_device_state_changed (NMDevice *device, +nm_device_state_changed (NMDevice *self, NMDeviceState state, NMDeviceStateReason reason) { - _set_state_full (device, state, reason, FALSE); + _set_state_full (self, state, reason, FALSE); } static gboolean @@ -7037,23 +7037,23 @@ nm_device_queued_state_clear (NMDevice *self) } NMDeviceState -nm_device_get_state (NMDevice *device) +nm_device_get_state (NMDevice *self) { - g_return_val_if_fail (NM_IS_DEVICE (device), NM_DEVICE_STATE_UNKNOWN); + g_return_val_if_fail (NM_IS_DEVICE (self), NM_DEVICE_STATE_UNKNOWN); - return NM_DEVICE_GET_PRIVATE (device)->state; + return NM_DEVICE_GET_PRIVATE (self)->state; } /***********************************************************/ /* NMConfigDevice interface related stuff */ const guint8 * -nm_device_get_hw_address (NMDevice *dev, guint *out_len) +nm_device_get_hw_address (NMDevice *self, guint *out_len) { NMDevicePrivate *priv; - g_return_val_if_fail (NM_IS_DEVICE (dev), NULL); - priv = NM_DEVICE_GET_PRIVATE (dev); + g_return_val_if_fail (NM_IS_DEVICE (self), NULL); + priv = NM_DEVICE_GET_PRIVATE (self); if (out_len) *out_len = priv->hw_addr_len; @@ -7062,11 +7062,11 @@ nm_device_get_hw_address (NMDevice *dev, guint *out_len) } static void -nm_device_update_hw_address (NMDevice *dev) +nm_device_update_hw_address (NMDevice *self) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); - int ifindex = nm_device_get_ifindex (dev); - const char *iface = nm_device_get_iface (dev); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + int ifindex = nm_device_get_ifindex (self); + const char *iface = nm_device_get_iface (self); const guint8 *hwaddr; gsize hwaddrlen = 0; @@ -7085,7 +7085,7 @@ nm_device_update_hw_address (NMDevice *dev) nm_log_dbg (LOGD_HW | LOGD_DEVICE, "(%s): hardware address now %s", iface, addrstr); g_free (addrstr); } - g_object_notify (G_OBJECT (dev), NM_DEVICE_HW_ADDRESS); + g_object_notify (G_OBJECT (self), NM_DEVICE_HW_ADDRESS); } } else { /* Invalid or no hardware address */ @@ -7094,25 +7094,25 @@ nm_device_update_hw_address (NMDevice *dev) nm_log_dbg (LOGD_HW | LOGD_DEVICE, "(%s): previous hardware address is no longer valid", iface); - g_object_notify (G_OBJECT (dev), NM_DEVICE_HW_ADDRESS); + g_object_notify (G_OBJECT (self), NM_DEVICE_HW_ADDRESS); } } priv->hw_addr_len = hwaddrlen; } gboolean -nm_device_set_hw_addr (NMDevice *device, const guint8 *addr, +nm_device_set_hw_addr (NMDevice *self, const guint8 *addr, const char *detail, guint64 hw_log_domain) { const char *iface; char *mac_str = NULL; gboolean success = FALSE; guint len; - const guint8 *cur_addr = nm_device_get_hw_address (device, &len); + const guint8 *cur_addr = nm_device_get_hw_address (self, &len); g_return_val_if_fail (addr != NULL, FALSE); - iface = nm_device_get_iface (device); + iface = nm_device_get_iface (self); /* Do nothing if current MAC is same */ if (cur_addr && !memcmp (cur_addr, addr, len)) { @@ -7123,13 +7123,13 @@ nm_device_set_hw_addr (NMDevice *device, const guint8 *addr, mac_str = nm_utils_hwaddr_ntoa_len (addr, len); /* Can't change MAC address while device is up */ - nm_device_take_down (device, FALSE); + nm_device_take_down (self, FALSE); - success = nm_platform_link_set_address (nm_device_get_ip_ifindex (device), addr, len); + success = nm_platform_link_set_address (nm_device_get_ip_ifindex (self), addr, len); if (success) { /* MAC address succesfully changed; update the current MAC to match */ - nm_device_update_hw_address (device); - cur_addr = nm_device_get_hw_address (device, NULL); + nm_device_update_hw_address (self); + cur_addr = nm_device_get_hw_address (self, NULL); if (memcmp (cur_addr, addr, len) == 0) { nm_log_info (LOGD_DEVICE | hw_log_domain, "(%s): %s MAC address to %s", iface, detail, mac_str); @@ -7143,7 +7143,7 @@ nm_device_set_hw_addr (NMDevice *device, const guint8 *addr, nm_log_warn (LOGD_DEVICE | hw_log_domain, "(%s): failed to %s MAC address to %s", iface, detail, mac_str); } - nm_device_bring_up (device, TRUE, NULL); + nm_device_bring_up (self, TRUE, NULL); g_free (mac_str); return success; @@ -7151,10 +7151,10 @@ nm_device_set_hw_addr (NMDevice *device, const guint8 *addr, /** * nm_device_spec_match_list: - * @device: an #NMDevice + * @self: an #NMDevice * @specs: (element-type utf8): a list of device specs * - * Checks if @device matches any of the specifications in @specs. The + * Checks if @self matches any of the specifications in @specs. The * currently-supported spec types are: * * "mac:00:11:22:33:44:55" - matches a device with the given @@ -7168,23 +7168,23 @@ nm_device_set_hw_addr (NMDevice *device, const guint8 *addr, * * "*" - matches any device * - * Returns: #TRUE if @device matches one of the specs in @specs + * Returns: #TRUE if @self matches one of the specs in @specs */ gboolean -nm_device_spec_match_list (NMDevice *device, const GSList *specs) +nm_device_spec_match_list (NMDevice *self, const GSList *specs) { - g_return_val_if_fail (NM_IS_DEVICE (device), FALSE); + g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); if (!specs) return FALSE; - return NM_DEVICE_GET_CLASS (device)->spec_match_list (device, specs); + return NM_DEVICE_GET_CLASS (self)->spec_match_list (self, specs); } static gboolean -spec_match_list (NMDevice *device, const GSList *specs) +spec_match_list (NMDevice *self, const GSList *specs) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); char *hwaddr_str; gboolean matched = FALSE; @@ -7198,7 +7198,7 @@ spec_match_list (NMDevice *device, const GSList *specs) } if (!matched) - matched = nm_match_spec_interface_name (specs, nm_device_get_iface (device)); + matched = nm_match_spec_interface_name (specs, nm_device_get_iface (self)); return matched; } @@ -7270,7 +7270,7 @@ constructor (GType type, GObjectConstructParam *construct_params) { GObject *object; - NMDevice *dev; + NMDevice *self; NMDevicePrivate *priv; NMPlatform *platform; static guint32 id = 0; @@ -7281,8 +7281,8 @@ constructor (GType type, if (!object) return NULL; - dev = NM_DEVICE (object); - priv = NM_DEVICE_GET_PRIVATE (dev); + self = NM_DEVICE (object); + priv = NM_DEVICE_GET_PRIVATE (self); if (!priv->iface) { nm_log_err (LOGD_DEVICE, "No device interface provided, ignoring"); @@ -7294,48 +7294,48 @@ constructor (GType type, priv->udi = g_strdup_printf ("/virtual/device/placeholder/%d", id++); } - if (NM_DEVICE_GET_CLASS (dev)->get_generic_capabilities) - priv->capabilities |= NM_DEVICE_GET_CLASS (dev)->get_generic_capabilities (dev); + if (NM_DEVICE_GET_CLASS (self)->get_generic_capabilities) + priv->capabilities |= NM_DEVICE_GET_CLASS (self)->get_generic_capabilities (self); device_get_driver_info (priv->iface, &priv->driver_version, &priv->firmware_version); /* Watch for external IP config changes */ platform = nm_platform_get (); - g_signal_connect (platform, NM_PLATFORM_SIGNAL_IP4_ADDRESS_CHANGED, G_CALLBACK (device_ip_changed), dev); - g_signal_connect (platform, NM_PLATFORM_SIGNAL_IP6_ADDRESS_CHANGED, G_CALLBACK (device_ip_changed), dev); - g_signal_connect (platform, NM_PLATFORM_SIGNAL_IP4_ROUTE_CHANGED, G_CALLBACK (device_ip_changed), dev); - g_signal_connect (platform, NM_PLATFORM_SIGNAL_IP6_ROUTE_CHANGED, G_CALLBACK (device_ip_changed), dev); - g_signal_connect (platform, NM_PLATFORM_SIGNAL_LINK_CHANGED, G_CALLBACK (link_changed_cb), dev); + g_signal_connect (platform, NM_PLATFORM_SIGNAL_IP4_ADDRESS_CHANGED, G_CALLBACK (device_ip_changed), self); + g_signal_connect (platform, NM_PLATFORM_SIGNAL_IP6_ADDRESS_CHANGED, G_CALLBACK (device_ip_changed), self); + g_signal_connect (platform, NM_PLATFORM_SIGNAL_IP4_ROUTE_CHANGED, G_CALLBACK (device_ip_changed), self); + g_signal_connect (platform, NM_PLATFORM_SIGNAL_IP6_ROUTE_CHANGED, G_CALLBACK (device_ip_changed), self); + g_signal_connect (platform, NM_PLATFORM_SIGNAL_LINK_CHANGED, G_CALLBACK (link_changed_cb), self); return object; error: - g_object_unref (dev); + g_object_unref (self); return NULL; } static void constructed (GObject *object) { - NMDevice *dev = NM_DEVICE (object); - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev); + NMDevice *self = NM_DEVICE (object); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - nm_device_update_hw_address (dev); + nm_device_update_hw_address (self); - if (NM_DEVICE_GET_CLASS (dev)->update_permanent_hw_address) - NM_DEVICE_GET_CLASS (dev)->update_permanent_hw_address (dev); + if (NM_DEVICE_GET_CLASS (self)->update_permanent_hw_address) + NM_DEVICE_GET_CLASS (self)->update_permanent_hw_address (self); - if (NM_DEVICE_GET_CLASS (dev)->update_initial_hw_address) - NM_DEVICE_GET_CLASS (dev)->update_initial_hw_address (dev); + if (NM_DEVICE_GET_CLASS (self)->update_initial_hw_address) + NM_DEVICE_GET_CLASS (self)->update_initial_hw_address (self); /* Have to call update_initial_hw_address() before calling get_ignore_carrier() */ - if (device_has_capability (dev, NM_DEVICE_CAP_CARRIER_DETECT)) { - priv->ignore_carrier = nm_config_get_ignore_carrier (nm_config_get (), dev); + if (device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)) { + priv->ignore_carrier = nm_config_get_ignore_carrier (nm_config_get (), self); - check_carrier (dev); + check_carrier (self); nm_log_info (LOGD_HW, "(%s): carrier is %s%s", - nm_device_get_iface (NM_DEVICE (dev)), + nm_device_get_iface (NM_DEVICE (self)), priv->carrier ? "ON" : "OFF", priv->ignore_carrier ? " (but ignored)" : ""); } else { @@ -7357,17 +7357,17 @@ constructed (GObject *object) g_signal_connect (priv->con_provider, NM_CP_SIGNAL_CONNECTION_ADDED, G_CALLBACK (cp_connection_added), - dev); + self); g_signal_connect (priv->con_provider, NM_CP_SIGNAL_CONNECTION_REMOVED, G_CALLBACK (cp_connection_removed), - dev); + self); g_signal_connect (priv->con_provider, NM_CP_SIGNAL_CONNECTION_UPDATED, G_CALLBACK (cp_connection_updated), - dev); + self); G_OBJECT_CLASS (nm_device_parent_class)->constructed (object); } @@ -7447,7 +7447,8 @@ static void set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (object); + NMDevice *self = NM_DEVICE (object); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMPlatformLink *platform_device; const char *hw_addr, *p; guint count; diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index ed0c06a7be..c4d0d3da11 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -260,7 +260,7 @@ NMConnection * nm_device_get_connection (NMDevice *dev); gboolean nm_device_is_available (NMDevice *dev); gboolean nm_device_has_carrier (NMDevice *dev); -NMConnection * nm_device_generate_connection (NMDevice *device, NMDevice *master); +NMConnection * nm_device_generate_connection (NMDevice *self, NMDevice *master); gboolean nm_device_master_update_slave_connection (NMDevice *master, NMDevice *slave,