mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 22:10:14 +01:00
device: don't return error from release_slave()
release_slave() should do the right thing and handle errors as good as it can. There is no value in propagating the error and it's not clear what the caller should do in face of a failure during release.
This commit is contained in:
parent
a39dc1cd4b
commit
e7a8607695
5 changed files with 11 additions and 22 deletions
|
|
@ -419,13 +419,13 @@ enslave_slave (NMDevice *device,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
release_slave (NMDevice *device,
|
||||
NMDevice *slave,
|
||||
gboolean configure)
|
||||
{
|
||||
NMDeviceBond *self = NM_DEVICE_BOND (device);
|
||||
gboolean success = TRUE, no_firmware = FALSE;
|
||||
gboolean success, no_firmware = FALSE;
|
||||
|
||||
if (configure) {
|
||||
success = nm_platform_link_release (NM_PLATFORM_GET,
|
||||
|
|
@ -444,8 +444,7 @@ release_slave (NMDevice *device,
|
|||
nm_device_get_ip_iface (slave));
|
||||
}
|
||||
|
||||
if (success)
|
||||
g_object_notify (G_OBJECT (device), NM_DEVICE_BOND_SLAVES);
|
||||
g_object_notify (G_OBJECT (device), NM_DEVICE_BOND_SLAVES);
|
||||
|
||||
if (configure) {
|
||||
/* Kernel bonding code "closes" the slave when releasing it, (which clears
|
||||
|
|
@ -455,8 +454,6 @@ release_slave (NMDevice *device,
|
|||
if (!nm_device_bring_up (slave, TRUE, &no_firmware))
|
||||
_LOGW (LOGD_BOND, "released bond slave could not be brought up.");
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
|
|
@ -356,13 +356,13 @@ enslave_slave (NMDevice *device,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
release_slave (NMDevice *device,
|
||||
NMDevice *slave,
|
||||
gboolean configure)
|
||||
{
|
||||
NMDeviceBridge *self = NM_DEVICE_BRIDGE (device);
|
||||
gboolean success = TRUE;
|
||||
gboolean success;
|
||||
|
||||
if (configure) {
|
||||
success = nm_platform_link_release (NM_PLATFORM_GET,
|
||||
|
|
@ -382,7 +382,6 @@ release_slave (NMDevice *device,
|
|||
}
|
||||
|
||||
g_object_notify (G_OBJECT (device), NM_DEVICE_BRIDGE_SLAVES);
|
||||
return success;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
|
|
@ -1123,12 +1123,8 @@ nm_device_master_release_one_slave (NMDevice *self, NMDevice *slave, gboolean co
|
|||
return FALSE;
|
||||
priv->slaves = g_slist_remove (priv->slaves, info);
|
||||
|
||||
if (info->slave_is_enslaved) {
|
||||
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.
|
||||
*/
|
||||
}
|
||||
if (info->slave_is_enslaved)
|
||||
NM_DEVICE_GET_CLASS (self)->release_slave (self, slave, configure);
|
||||
|
||||
nm_device_slave_notify_release (info->slave, reason);
|
||||
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ typedef struct {
|
|||
NMConnection *connection,
|
||||
gboolean configure);
|
||||
|
||||
gboolean (* release_slave) (NMDevice *self,
|
||||
void (* release_slave) (NMDevice *self,
|
||||
NMDevice *slave,
|
||||
gboolean configure);
|
||||
|
||||
|
|
|
|||
|
|
@ -649,13 +649,13 @@ enslave_slave (NMDevice *device,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
release_slave (NMDevice *device,
|
||||
NMDevice *slave,
|
||||
gboolean configure)
|
||||
{
|
||||
NMDeviceTeam *self = NM_DEVICE_TEAM (device);
|
||||
gboolean success = TRUE, no_firmware = FALSE;
|
||||
gboolean success, no_firmware = FALSE;
|
||||
|
||||
if (configure) {
|
||||
success = nm_platform_link_release (NM_PLATFORM_GET,
|
||||
|
|
@ -669,8 +669,7 @@ release_slave (NMDevice *device,
|
|||
} else
|
||||
_LOGI (LOGD_TEAM, "team port %s was released", nm_device_get_ip_iface (slave));
|
||||
|
||||
if (success)
|
||||
g_object_notify (G_OBJECT (device), NM_DEVICE_TEAM_SLAVES);
|
||||
g_object_notify (G_OBJECT (device), NM_DEVICE_TEAM_SLAVES);
|
||||
|
||||
if (configure) {
|
||||
/* Kernel team code "closes" the port when releasing it, (which clears
|
||||
|
|
@ -681,8 +680,6 @@ release_slave (NMDevice *device,
|
|||
_LOGW (LOGD_TEAM, "released team port %s could not be brought up",
|
||||
nm_device_get_ip_iface (slave));
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue