diff options
Diffstat (limited to 'src/core/nm-active-connection.c')
| -rw-r--r-- | src/core/nm-active-connection.c | 133 |
1 files changed, 67 insertions, 66 deletions
diff --git a/src/core/nm-active-connection.c b/src/core/nm-active-connection.c index eb7b1cca..b08d26c2 100644 --- a/src/core/nm-active-connection.c +++ b/src/core/nm-active-connection.c @@ -38,7 +38,7 @@ typedef struct _NMActiveConnectionPrivate { bool is_default6 : 1; bool state_set : 1; bool vpn : 1; - bool master_ready : 1; + bool controller_ready : 1; NMActivationType activation_type : 3; @@ -49,7 +49,7 @@ typedef struct _NMActiveConnectionPrivate { NMActivationReason activation_reason : 4; NMAuthSubject *subject; - NMActiveConnection *master; + NMActiveConnection *controller; NMActiveConnection *parent; @@ -87,8 +87,8 @@ NM_GOBJECT_PROPERTIES_DEFINE(NMActiveConnection, PROP_INT_APPLIED_CONNECTION, PROP_INT_DEVICE, PROP_INT_SUBJECT, - PROP_INT_MASTER, - PROP_INT_MASTER_READY, + PROP_INT_CONTROLLER, + PROP_INT_CONTROLLER_READY, PROP_INT_ACTIVATION_TYPE, PROP_INT_ACTIVATION_REASON, ); @@ -105,7 +105,7 @@ G_DEFINE_ABSTRACT_TYPE(NMActiveConnection, nm_active_connection, NM_TYPE_DBUS_OB static const NMDBusInterfaceInfoExtended interface_info_active_connection; static const GDBusSignalInfo signal_info_state_changed; -static void check_master_ready(NMActiveConnection *self); +static void check_controller_ready(NMActiveConnection *self); static void _device_cleanup(NMActiveConnection *self); static void _settings_connection_flags_changed(NMSettingsConnection *settings_connection, NMActiveConnection *self); @@ -276,7 +276,7 @@ nm_active_connection_set_state(NMActiveConnection *self, emit_state_changed(self, new_state, reason); _notify(self, PROP_STATE); - check_master_ready(self); + check_controller_ready(self); if (new_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED || old_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { @@ -446,7 +446,7 @@ _set_applied_connection_take(NMActiveConnection *self, NMConnection *applied_con /* we determine whether the connection is a master/slave, based solely * on the connection properties itself. */ s_con = nm_connection_get_setting_connection(priv->applied_connection); - if (nm_setting_connection_get_master(s_con)) + if (nm_setting_connection_get_controller(s_con)) flags_val |= NM_ACTIVATION_STATE_FLAG_IS_SLAVE; if (_nm_connection_type_is_master(nm_setting_connection_get_connection_type(s_con))) @@ -650,13 +650,13 @@ device_master_changed(GObject *object, GParamSpec *pspec, gpointer user_data) if (NM_ACTIVE_CONNECTION(nm_device_get_act_request(device)) != self) return; - if (!nm_device_get_master(device)) + if (!nm_device_get_controller(device)) return; - if (!nm_active_connection_get_master(self)) + if (!nm_active_connection_get_controller(self)) return; g_signal_handlers_disconnect_by_func(device, G_CALLBACK(device_master_changed), self); - master = nm_active_connection_get_master(self); + master = nm_active_connection_get_controller(self); master_state = nm_active_connection_get_state(master); if (master_state >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) { /* Master failed before attaching the slave */ @@ -704,15 +704,15 @@ nm_active_connection_set_device(NMActiveConnection *self, NMDevice *device) if (device) { /* Device obviously can't be its own master */ - g_return_val_if_fail(!priv->master - || device != nm_active_connection_get_device(priv->master), + g_return_val_if_fail(!priv->controller + || device != nm_active_connection_get_device(priv->controller), FALSE); priv->device = g_object_ref(device); g_signal_connect(device, NM_DEVICE_STATE_CHANGED, G_CALLBACK(device_state_changed), self); g_signal_connect(device, - "notify::" NM_DEVICE_MASTER, + "notify::" NM_DEVICE_CONTROLLER, G_CALLBACK(device_master_changed), self); g_signal_connect(device, @@ -747,30 +747,30 @@ nm_active_connection_set_device(NMActiveConnection *self, NMDevice *device) } NMActiveConnection * -nm_active_connection_get_master(NMActiveConnection *self) +nm_active_connection_get_controller(NMActiveConnection *self) { g_return_val_if_fail(NM_IS_ACTIVE_CONNECTION(self), NULL); - return NM_ACTIVE_CONNECTION_GET_PRIVATE(self)->master; + return NM_ACTIVE_CONNECTION_GET_PRIVATE(self)->controller; } /** - * nm_active_connection_get_master_ready: + * nm_active_connection_get_controller_ready: * @self: the #NMActiveConnection * - * Returns: %TRUE if the connection has a master connection, and that - * master connection is ready to accept slaves. Otherwise, %FALSE. + * Returns: %TRUE if the connection has a controller connection, and that + * controller connection is ready to accept ports. Otherwise, %FALSE. */ gboolean -nm_active_connection_get_master_ready(NMActiveConnection *self) +nm_active_connection_get_controller_ready(NMActiveConnection *self) { g_return_val_if_fail(NM_IS_ACTIVE_CONNECTION(self), FALSE); - return NM_ACTIVE_CONNECTION_GET_PRIVATE(self)->master_ready; + return NM_ACTIVE_CONNECTION_GET_PRIVATE(self)->controller_ready; } static void -check_master_ready(NMActiveConnection *self) +check_controller_ready(NMActiveConnection *self) { NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE(self); gboolean signalling = FALSE; @@ -780,30 +780,31 @@ check_master_ready(NMActiveConnection *self) * device will be ready to accept slaves when the master is in ACTIVATING * or higher states. */ - if (!priv->master_ready && priv->master && priv->state == NM_ACTIVE_CONNECTION_STATE_ACTIVATING - && NM_IN_SET(nm_active_connection_get_state(priv->master), + if (!priv->controller_ready && priv->controller + && priv->state == NM_ACTIVE_CONNECTION_STATE_ACTIVATING + && NM_IN_SET(nm_active_connection_get_state(priv->controller), NM_ACTIVE_CONNECTION_STATE_ACTIVATING, NM_ACTIVE_CONNECTION_STATE_ACTIVATED)) { signalling = TRUE; } - _LOGD("check-master-ready: %s (state %s, %s)", - signalling ? "signal" : (priv->master_ready ? "already signalled" : "not signalling"), + _LOGD("check-controller-ready: %s (state %s, %s)", + signalling ? "signal" : (priv->controller_ready ? "already signalled" : "not signalling"), state_to_string_a(priv->state), - priv->master + priv->controller ? nm_sprintf_bufa(128, - "master %p is in state %s", - priv->master, - state_to_string_a(nm_active_connection_get_state(priv->master))) - : "no master"); + "controller %p is in state %s", + priv->controller, + state_to_string_a(nm_active_connection_get_state(priv->controller))) + : "no controller"); if (signalling) { - priv->master_ready = TRUE; - _notify(self, PROP_INT_MASTER_READY); + priv->controller_ready = TRUE; + _notify(self, PROP_INT_CONTROLLER_READY); - /* Also notify clients to recheck the exported 'master' property to - * ensure that if the master connection was created without a device - * that we notify clients when the master device is known. + /* Also notify clients to recheck the exported 'controller' property to + * ensure that if the controller connection was created without a device + * that we notify clients when the controller device is known. */ nm_gobject_notify_together(self, PROP_MASTER, PROP_CONTROLLER); } @@ -816,9 +817,9 @@ master_state_cb(NMActiveConnection *master, GParamSpec *pspec, gpointer user_dat NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE(self); NMActiveConnectionState master_state = nm_active_connection_get_state(master); - check_master_ready(self); + check_controller_ready(self); - if (master_state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATING && !priv->master_ready) { + if (master_state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATING && !priv->controller_ready) { /* Master disconnected before the slave was added */ if (NM_ACTIVE_CONNECTION_GET_CLASS(self)->master_failed) NM_ACTIVE_CONNECTION_GET_CLASS(self)->master_failed(self); @@ -826,44 +827,44 @@ master_state_cb(NMActiveConnection *master, GParamSpec *pspec, gpointer user_dat } /** - * nm_active_connection_set_master: + * nm_active_connection_set_controller: * @self: the #NMActiveConnection - * @master: if the activation depends on another device (ie, bond or bridge - * master to which this device will be enslaved) pass the #NMActiveConnection + * @controller: if the activation depends on another device (ie, bond or bridge + * controller to which this device will be set as port) pass the #NMActiveConnection * that this activation request is a child of * - * Sets the master active connection of @self. + * Sets the controller active connection of @self. */ void -nm_active_connection_set_master(NMActiveConnection *self, NMActiveConnection *master) +nm_active_connection_set_controller(NMActiveConnection *self, NMActiveConnection *controller) { NMActiveConnectionPrivate *priv; g_return_if_fail(NM_IS_ACTIVE_CONNECTION(self)); - g_return_if_fail(NM_IS_ACTIVE_CONNECTION(master)); + g_return_if_fail(NM_IS_ACTIVE_CONNECTION(controller)); priv = NM_ACTIVE_CONNECTION_GET_PRIVATE(self); - /* Master is write-once, and must be set before exporting the object */ - g_return_if_fail(priv->master == NULL); + /* Controller is write-once, and must be set before exporting the object */ + g_return_if_fail(priv->controller == NULL); g_return_if_fail(!nm_dbus_object_is_exported(NM_DBUS_OBJECT(self))); if (priv->device) { /* Note, the master ActiveConnection may not yet have a device */ - g_return_if_fail(priv->device != nm_active_connection_get_device(master)); + g_return_if_fail(priv->device != nm_active_connection_get_device(controller)); } - _LOGD("set master %p, %s, state %s", - master, - nm_active_connection_get_settings_connection_id(master), - state_to_string_a(nm_active_connection_get_state(master))); + _LOGD("set controller %p, %s, state %s", + controller, + nm_active_connection_get_settings_connection_id(controller), + state_to_string_a(nm_active_connection_get_state(controller))); - priv->master = g_object_ref(master); - g_signal_connect(priv->master, + priv->controller = g_object_ref(controller); + g_signal_connect(priv->controller, "notify::" NM_ACTIVE_CONNECTION_STATE, G_CALLBACK(master_state_cb), self); - check_master_ready(self); + check_controller_ready(self); } NMActivationType @@ -1347,15 +1348,15 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) break; case PROP_CONTROLLER: case PROP_MASTER: - if (priv->master) - master_device = nm_active_connection_get_device(priv->master); + if (priv->controller) + master_device = nm_active_connection_get_device(priv->controller); nm_dbus_utils_g_value_set_object_path(value, master_device); break; case PROP_INT_SUBJECT: g_value_set_object(value, priv->subject); break; - case PROP_INT_MASTER_READY: - g_value_set_boolean(value, priv->master_ready); + case PROP_INT_CONTROLLER_READY: + g_value_set_boolean(value, priv->controller_ready); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -1401,8 +1402,8 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps /* construct-only */ priv->subject = g_value_dup_object(value); break; - case PROP_INT_MASTER: - nm_active_connection_set_master(self, g_value_get_object(value)); + case PROP_INT_CONTROLLER: + nm_active_connection_set_controller(self, g_value_get_object(value)); break; case PROP_INT_ACTIVATION_TYPE: /* construct-only */ @@ -1529,10 +1530,10 @@ dispose(GObject *object) _device_cleanup(self); - if (priv->master) { - g_signal_handlers_disconnect_by_func(priv->master, G_CALLBACK(master_state_cb), self); + if (priv->controller) { + g_signal_handlers_disconnect_by_func(priv->controller, G_CALLBACK(master_state_cb), self); } - g_clear_object(&priv->master); + g_clear_object(&priv->controller); if (priv->parent) unwatch_parent(self, TRUE); @@ -1774,15 +1775,15 @@ nm_active_connection_class_init(NMActiveConnectionClass *ac_class) NM_TYPE_AUTH_SUBJECT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); - obj_properties[PROP_INT_MASTER] = - g_param_spec_object(NM_ACTIVE_CONNECTION_INT_MASTER, + obj_properties[PROP_INT_CONTROLLER] = + g_param_spec_object(NM_ACTIVE_CONNECTION_INT_CONTROLLER, "", "", NM_TYPE_ACTIVE_CONNECTION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - obj_properties[PROP_INT_MASTER_READY] = - g_param_spec_boolean(NM_ACTIVE_CONNECTION_INT_MASTER_READY, + obj_properties[PROP_INT_CONTROLLER_READY] = + g_param_spec_boolean(NM_ACTIVE_CONNECTION_INT_CONTROLLER_READY, "", "", FALSE, |