summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFernando Fernandez Mancera <ffmancera@riseup.net>2024-03-11 12:13:57 +0100
committerFernando Fernandez Mancera <ffmancera@riseup.net>2024-03-13 18:24:47 +0100
commit170e1282156ff8bd4af3757996fa491d41c788e4 (patch)
treeb88d762666903b847feb494e5853e6636ba3db93
parent1f05526ed77ee1bf7b5ca52f35a0992e0a461184 (diff)
core: deprecate master in NMActiveConnection internal APIff/active_connection_conscious_lang
PROP_INT_MASTER_READY and PROP_INT_MASTER are internal API only, that means we can replace it right away. In addition, replace the functions related to the properties. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1885
-rw-r--r--src/core/devices/nm-device.c20
-rw-r--r--src/core/devices/ovs/nm-device-ovs-interface.c4
-rw-r--r--src/core/devices/ovs/nm-device-ovs-port.c2
-rw-r--r--src/core/devices/wifi/nm-device-wifi.c2
-rw-r--r--src/core/nm-active-connection.c127
-rw-r--r--src/core/nm-active-connection.h10
-rw-r--r--src/core/nm-manager.c4
7 files changed, 85 insertions, 84 deletions
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c
index 72cf4bba0c..2557e7a982 100644
--- a/src/core/devices/nm-device.c
+++ b/src/core/devices/nm-device.c
@@ -3727,7 +3727,7 @@ _dev_ip_state_check(NMDevice *self, int addr_family)
}
if (priv->ip_data_x[IS_IPv4].state == NM_DEVICE_IP_STATE_PENDING
- && nm_active_connection_get_master(NM_ACTIVE_CONNECTION(priv->act_request.obj))
+ && nm_active_connection_get_controller(NM_ACTIVE_CONNECTION(priv->act_request.obj))
&& !priv->is_enslaved) {
/* Don't progress into IP_CHECK or SECONDARIES if we're waiting for the
* master to enslave us. */
@@ -9794,10 +9794,10 @@ master_ready(NMDevice *self, NMActiveConnection *active)
NMActiveConnection *master_connection;
NMDevice *master;
- /* Notify a master device that it has a new slave */
- nm_assert(nm_active_connection_get_master_ready(active));
+ /* Notify a controller device that it has a new port */
+ nm_assert(nm_active_connection_get_controller_ready(active));
- master_connection = nm_active_connection_get_master(active);
+ master_connection = nm_active_connection_get_controller(active);
master = nm_active_connection_get_device(master_connection);
@@ -9820,7 +9820,7 @@ master_ready_cb(NMActiveConnection *active, GParamSpec *pspec, NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
- nm_assert(nm_active_connection_get_master_ready(active));
+ nm_assert(nm_active_connection_get_controller_ready(active));
if (priv->state == NM_DEVICE_STATE_PREPARE)
nm_device_activate_schedule_stage1_device_prepare(self, FALSE);
@@ -10067,7 +10067,7 @@ activate_stage1_device_prepare(NMDevice *self)
}
active = NM_ACTIVE_CONNECTION(priv->act_request.obj);
- master = nm_active_connection_get_master(active);
+ master = nm_active_connection_get_controller(active);
if (master) {
if (nm_active_connection_get_state(master) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) {
NMDevice *master_device = nm_active_connection_get_device(master);
@@ -10082,13 +10082,13 @@ activate_stage1_device_prepare(NMDevice *self)
nm_device_state_changed(self, NM_DEVICE_STATE_FAILED, failure_reason);
return;
}
- /* If the master connection is ready for slaves, attach ourselves */
- if (!nm_active_connection_get_master_ready(active)) {
+ /* If the controller connection is ready for ports, attach ourselves */
+ if (!nm_active_connection_get_controller_ready(active)) {
if (priv->controller_ready_id == 0) {
- _LOGD(LOGD_DEVICE, "waiting for master connection to become ready");
+ _LOGD(LOGD_DEVICE, "waiting for controller connection to become ready");
priv->controller_ready_id =
g_signal_connect(active,
- "notify::" NM_ACTIVE_CONNECTION_INT_MASTER_READY,
+ "notify::" NM_ACTIVE_CONNECTION_INT_CONTROLLER_READY,
G_CALLBACK(master_ready_cb),
self);
}
diff --git a/src/core/devices/ovs/nm-device-ovs-interface.c b/src/core/devices/ovs/nm-device-ovs-interface.c
index 17eb2c2d12..778f230b34 100644
--- a/src/core/devices/ovs/nm-device-ovs-interface.c
+++ b/src/core/devices/ovs/nm-device-ovs-interface.c
@@ -355,12 +355,12 @@ ovs_interface_is_netdev_datapath(NMDeviceOvsInterface *self)
return FALSE;
/* get ovs-port active-connection */
- ac = nm_active_connection_get_master(ac);
+ ac = nm_active_connection_get_controller(ac);
if (!ac)
return FALSE;
/* get ovs-bridge active-connection */
- ac = nm_active_connection_get_master(ac);
+ ac = nm_active_connection_get_controller(ac);
if (!ac)
return FALSE;
diff --git a/src/core/devices/ovs/nm-device-ovs-port.c b/src/core/devices/ovs/nm-device-ovs-port.c
index 2c5846e266..e102028060 100644
--- a/src/core/devices/ovs/nm-device-ovs-port.c
+++ b/src/core/devices/ovs/nm-device-ovs-port.c
@@ -160,7 +160,7 @@ attach_port(NMDevice *device,
return TRUE;
ac_port = NM_ACTIVE_CONNECTION(nm_device_get_act_request(device));
- ac_bridge = nm_active_connection_get_master(ac_port);
+ ac_bridge = nm_active_connection_get_controller(ac_port);
if (!ac_bridge) {
_LOGW(LOGD_DEVICE,
"can't attach %s: bridge active-connection not found",
diff --git a/src/core/devices/wifi/nm-device-wifi.c b/src/core/devices/wifi/nm-device-wifi.c
index 5f977b47a0..206113e471 100644
--- a/src/core/devices/wifi/nm-device-wifi.c
+++ b/src/core/devices/wifi/nm-device-wifi.c
@@ -3374,7 +3374,7 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason)
/* Tell the supplicant in which bridge the interface is */
if ((request = nm_device_get_act_request(device))
- && (master_ac = nm_active_connection_get_master(NM_ACTIVE_CONNECTION(request)))
+ && (master_ac = nm_active_connection_get_controller(NM_ACTIVE_CONNECTION(request)))
&& (master = nm_active_connection_get_device(master_ac))
&& nm_device_get_device_type(master) == NM_DEVICE_TYPE_BRIDGE) {
nm_supplicant_interface_set_bridge(priv->sup_iface, nm_device_get_iface(master));
diff --git a/src/core/nm-active-connection.c b/src/core/nm-active-connection.c
index 0807af07ba..b08d26c28b 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) {
@@ -652,11 +652,11 @@ device_master_changed(GObject *object, GParamSpec *pspec, gpointer user_data)
return;
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,8 +704,8 @@ 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);
@@ -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,
diff --git a/src/core/nm-active-connection.h b/src/core/nm-active-connection.h
index 8032294f3c..12cb311c97 100644
--- a/src/core/nm-active-connection.h
+++ b/src/core/nm-active-connection.h
@@ -45,8 +45,8 @@
#define NM_ACTIVE_CONNECTION_INT_APPLIED_CONNECTION "int-applied-connection"
#define NM_ACTIVE_CONNECTION_INT_DEVICE "int-device"
#define NM_ACTIVE_CONNECTION_INT_SUBJECT "int-subject"
-#define NM_ACTIVE_CONNECTION_INT_MASTER "int-master"
-#define NM_ACTIVE_CONNECTION_INT_MASTER_READY "int-master-ready"
+#define NM_ACTIVE_CONNECTION_INT_CONTROLLER "int-controller"
+#define NM_ACTIVE_CONNECTION_INT_CONTROLLER_READY "int-controller-ready"
#define NM_ACTIVE_CONNECTION_INT_ACTIVATION_TYPE "int-activation-type"
#define NM_ACTIVE_CONNECTION_INT_ACTIVATION_REASON "int-activation-reason"
@@ -170,11 +170,11 @@ NMAuthSubject *nm_active_connection_get_subject(NMActiveConnection *self);
gboolean nm_active_connection_get_user_requested(NMActiveConnection *self);
-NMActiveConnection *nm_active_connection_get_master(NMActiveConnection *self);
+NMActiveConnection *nm_active_connection_get_controller(NMActiveConnection *self);
-gboolean nm_active_connection_get_master_ready(NMActiveConnection *self);
+gboolean nm_active_connection_get_controller_ready(NMActiveConnection *self);
-void nm_active_connection_set_master(NMActiveConnection *self, NMActiveConnection *master);
+void nm_active_connection_set_controller(NMActiveConnection *self, NMActiveConnection *controller);
void nm_active_connection_set_parent(NMActiveConnection *self, NMActiveConnection *parent);
diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c
index 407e54dec1..a8176546fc 100644
--- a/src/core/nm-manager.c
+++ b/src/core/nm-manager.c
@@ -3777,7 +3777,7 @@ recheck_assume_connection(NMManager *self, NMDevice *device)
&master_ac,
NULL)
&& master_ac)
- nm_active_connection_set_master(active, master_ac);
+ nm_active_connection_set_controller(active, master_ac);
active_connection_add(self, active);
nm_device_queue_activation(device, NM_ACT_REQUEST(active));
@@ -5924,7 +5924,7 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError **
NM_DEVICE_STATE_REASON_USER_REQUESTED);
}
- nm_active_connection_set_master(active, master_ac);
+ nm_active_connection_set_controller(active, master_ac);
_LOGD(LOGD_CORE,
"Activation of '%s' depends on active connection %p %s",
nm_settings_connection_get_id(sett_conn),