mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 05:20:08 +01:00
core: rearrange and remove some NMDevice getters
For any function in nm-device.h which is not used outside of nm-device.c, remove the public prototypes. Functions that are actually used get moved above their caller, and functions that have no callers are removed.
This commit is contained in:
parent
b4c368692d
commit
f3fbbf4a77
2 changed files with 45 additions and 65 deletions
|
|
@ -314,11 +314,14 @@ static gboolean nm_device_set_ip6_config (NMDevice *dev,
|
|||
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 void addrconf6_start_with_link_ready (NMDevice *self);
|
||||
|
||||
static gboolean nm_device_get_default_unmanaged (NMDevice *device);
|
||||
|
||||
/***********************************************************/
|
||||
|
||||
static GQuark
|
||||
|
|
@ -852,7 +855,7 @@ carrier_changed (NMDevice *device, gboolean carrier)
|
|||
if (priv->ignore_carrier && !carrier)
|
||||
return;
|
||||
|
||||
if (nm_device_is_master (device)) {
|
||||
if (priv->is_master) {
|
||||
/* Bridge/bond/team carrier does not affect its own activation,
|
||||
* but when carrier comes on, if there are slaves waiting,
|
||||
* it will restart them.
|
||||
|
|
@ -1217,7 +1220,7 @@ slave_state_changed (NMDevice *slave,
|
|||
*
|
||||
* Returns: %TRUE on success, %FALSE on failure
|
||||
*/
|
||||
gboolean
|
||||
static gboolean
|
||||
nm_device_master_add_slave (NMDevice *dev, NMDevice *slave, gboolean configure)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev);
|
||||
|
|
@ -1326,18 +1329,6 @@ nm_device_master_check_slave_physical_port (NMDevice *dev, NMDevice *slave,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_is_master:
|
||||
* @dev: the device
|
||||
*
|
||||
* Returns: whether @dev can enslave other devices (eg, bridge or bond or team)
|
||||
*/
|
||||
gboolean
|
||||
nm_device_is_master (NMDevice *dev)
|
||||
{
|
||||
return NM_DEVICE_GET_PRIVATE (dev)->is_master;
|
||||
}
|
||||
|
||||
/* release all slaves */
|
||||
static void
|
||||
nm_device_master_release_slaves (NMDevice *self)
|
||||
|
|
@ -2892,7 +2883,7 @@ act_stage3_ip4_config_start (NMDevice *self,
|
|||
g_assert_cmpstr (method, ==, NM_SETTING_IP4_CONFIG_METHOD_DISABLED);
|
||||
|
||||
if ( strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) != 0
|
||||
&& nm_device_is_master (self)
|
||||
&& priv->is_master
|
||||
&& !priv->carrier) {
|
||||
nm_log_info (LOGD_IP4 | LOGD_DEVICE,
|
||||
"(%s): IPv4 config waiting until carrier is on",
|
||||
|
|
@ -3778,7 +3769,7 @@ act_stage3_ip6_config_start (NMDevice *self,
|
|||
g_assert_cmpstr (method, ==, NM_SETTING_IP6_CONFIG_METHOD_IGNORE);
|
||||
|
||||
if ( strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL) != 0
|
||||
&& nm_device_is_master (self)
|
||||
&& priv->is_master
|
||||
&& !priv->carrier) {
|
||||
nm_log_info (LOGD_IP6 | LOGD_DEVICE,
|
||||
"(%s): IPv6 config waiting until carrier is on", ip_iface);
|
||||
|
|
@ -4725,6 +4716,30 @@ _update_ip4_address (NMDevice *self)
|
|||
close (fd);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_device_get_is_nm_owned (NMDevice *device)
|
||||
{
|
||||
return NM_DEVICE_GET_PRIVATE (device)->is_nm_owned;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_device_set_is_nm_owned (NMDevice *device,
|
||||
gboolean is_nm_owned)
|
||||
{
|
||||
NMDevicePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DEVICE (device), FALSE);
|
||||
|
||||
priv = NM_DEVICE_GET_PRIVATE (device);
|
||||
|
||||
if (is_nm_owned == priv->is_nm_owned)
|
||||
return TRUE;
|
||||
if (!is_nm_owned)
|
||||
return FALSE;
|
||||
priv->is_nm_owned = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* delete_on_deactivate_link_delete
|
||||
*
|
||||
|
|
@ -4772,12 +4787,12 @@ delete_on_deactivate_unschedule (NMDevice *self)
|
|||
static void
|
||||
delete_on_deactivate_check_and_schedule (NMDevice *self, int ifindex)
|
||||
{
|
||||
NMDevicePrivate *priv;
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
DeleteOnDeactivateData *data;
|
||||
|
||||
if (ifindex <= 0)
|
||||
return;
|
||||
if (!nm_device_get_is_nm_owned (self))
|
||||
if (!priv->is_nm_owned)
|
||||
return;
|
||||
if (!nm_device_is_software (self))
|
||||
return;
|
||||
|
|
@ -4787,8 +4802,6 @@ delete_on_deactivate_check_and_schedule (NMDevice *self, int ifindex)
|
|||
return;
|
||||
delete_on_deactivate_unschedule (self); /* always cancel and reschedule */
|
||||
|
||||
priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
data = g_new (DeleteOnDeactivateData, 1);
|
||||
g_object_add_weak_pointer (G_OBJECT (self), (void **) &data->device);
|
||||
data->device = self;
|
||||
|
|
@ -4800,31 +4813,6 @@ delete_on_deactivate_check_and_schedule (NMDevice *self, int ifindex)
|
|||
ifindex, nm_device_get_iface (self), data->idle_add_id);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_device_get_is_nm_owned (NMDevice *device)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_DEVICE (device), FALSE);
|
||||
return NM_DEVICE_GET_PRIVATE (device)->is_nm_owned;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_device_set_is_nm_owned (NMDevice *device,
|
||||
gboolean is_nm_owned)
|
||||
{
|
||||
NMDevicePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DEVICE (device), FALSE);
|
||||
|
||||
priv = NM_DEVICE_GET_PRIVATE (device);
|
||||
|
||||
if (is_nm_owned == priv->is_nm_owned)
|
||||
return TRUE;
|
||||
if (!is_nm_owned)
|
||||
return FALSE;
|
||||
priv->is_nm_owned = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
disconnect_cb (NMDevice *device,
|
||||
DBusGMethodInvocation *context,
|
||||
|
|
@ -5820,18 +5808,6 @@ nm_device_get_managed (NMDevice *device)
|
|||
return managed;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_get_default_unmanaged():
|
||||
* @device: the #NMDevice
|
||||
*
|
||||
* Returns: %TRUE if the device is by default unmanaged
|
||||
*/
|
||||
gboolean
|
||||
nm_device_get_default_unmanaged (NMDevice *device)
|
||||
{
|
||||
return nm_device_get_unmanaged_flag (device, NM_UNMANAGED_DEFAULT);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_get_unmanaged_flag():
|
||||
* @device: the #NMDevice
|
||||
|
|
@ -5844,6 +5820,18 @@ nm_device_get_unmanaged_flag (NMDevice *device, NMUnmanagedFlags flag)
|
|||
return NM_DEVICE_GET_PRIVATE (device)->unmanaged_flags & flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_get_default_unmanaged():
|
||||
* @device: the #NMDevice
|
||||
*
|
||||
* Returns: %TRUE if the device is by default unmanaged
|
||||
*/
|
||||
static gboolean
|
||||
nm_device_get_default_unmanaged (NMDevice *device)
|
||||
{
|
||||
return nm_device_get_unmanaged_flag (device, NM_UNMANAGED_DEFAULT);
|
||||
}
|
||||
|
||||
void
|
||||
nm_device_set_unmanaged (NMDevice *device,
|
||||
NMUnmanagedFlags flag,
|
||||
|
|
|
|||
|
|
@ -247,9 +247,7 @@ void nm_device_set_vpn6_config (NMDevice *dev, NMIP6Config *config)
|
|||
void nm_device_capture_initial_config (NMDevice *dev);
|
||||
|
||||
/* Master */
|
||||
gboolean nm_device_master_add_slave (NMDevice *dev, NMDevice *slave, gboolean configure);
|
||||
GSList * nm_device_master_get_slaves (NMDevice *dev);
|
||||
gboolean nm_device_is_master (NMDevice *dev);
|
||||
|
||||
/* Slave */
|
||||
NMDevice * nm_device_get_master (NMDevice *dev);
|
||||
|
|
@ -276,9 +274,6 @@ gboolean nm_device_check_connection_compatible (NMDevice *device, NMConnection *
|
|||
|
||||
gboolean nm_device_can_assume_connections (NMDevice *device);
|
||||
|
||||
NMConnection * nm_device_find_assumable_connection (NMDevice *device,
|
||||
const GSList *connections);
|
||||
|
||||
gboolean nm_device_spec_match_list (NMDevice *device, const GSList *specs);
|
||||
|
||||
gboolean nm_device_is_activating (NMDevice *dev);
|
||||
|
|
@ -312,7 +307,6 @@ typedef enum {
|
|||
} NMUnmanagedFlags;
|
||||
|
||||
gboolean nm_device_get_managed (NMDevice *device);
|
||||
gboolean nm_device_get_default_unmanaged (NMDevice *device);
|
||||
gboolean nm_device_get_unmanaged_flag (NMDevice *device, NMUnmanagedFlags flag);
|
||||
void nm_device_set_unmanaged (NMDevice *device,
|
||||
NMUnmanagedFlags flag,
|
||||
|
|
@ -340,8 +334,6 @@ void nm_device_queue_state (NMDevice *self,
|
|||
NMDeviceState state,
|
||||
NMDeviceStateReason reason);
|
||||
|
||||
void nm_device_queue_ip_config_change (NMDevice *self);
|
||||
|
||||
gboolean nm_device_get_firmware_missing (NMDevice *self);
|
||||
|
||||
void nm_device_queue_activation (NMDevice *device, NMActRequest *req);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue