mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-04 08:17:58 +02:00
device: have realize_start_notify() call link_changed()
Most implementations of realize_start_notify() do the same for link_changed(). Let NMDevice's base implementation of realize_start_notify() call link_changed() -- which by default does notthing. This allows subclasses to only overwrite link_changed().
This commit is contained in:
parent
0bb84d1b85
commit
0eb4b404f2
8 changed files with 10 additions and 60 deletions
|
|
@ -1675,15 +1675,6 @@ link_changed (NMDevice *device,
|
|||
_update_s390_subchannels ((NMDeviceEthernet *) device);
|
||||
}
|
||||
|
||||
static void
|
||||
realize_start_notify (NMDevice *device,
|
||||
const NMPlatformLink *pllink)
|
||||
{
|
||||
NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->realize_start_notify (device, pllink);
|
||||
if (pllink->initialized)
|
||||
_update_s390_subchannels ((NMDeviceEthernet *) device);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
|
||||
{
|
||||
|
|
@ -1789,7 +1780,6 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
|
|||
parent_class->update_connection = update_connection;
|
||||
parent_class->carrier_changed = carrier_changed;
|
||||
parent_class->link_changed = link_changed;
|
||||
parent_class->realize_start_notify = realize_start_notify;
|
||||
parent_class->is_available = is_available;
|
||||
|
||||
parent_class->state_changed = device_state_changed;
|
||||
|
|
|
|||
|
|
@ -760,14 +760,6 @@ create_and_realize (NMDevice *device,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
realize_start_notify (NMDevice *device, const NMPlatformLink *plink)
|
||||
{
|
||||
NM_DEVICE_CLASS (nm_device_ip_tunnel_parent_class)->realize_start_notify (device, plink);
|
||||
|
||||
update_properties (device);
|
||||
}
|
||||
|
||||
static void
|
||||
ip4_config_pre_commit (NMDevice *device, NMIP4Config *config)
|
||||
{
|
||||
|
|
@ -903,7 +895,6 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *klass)
|
|||
device_class->create_and_realize = create_and_realize;
|
||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||
device_class->ip4_config_pre_commit = ip4_config_pre_commit;
|
||||
device_class->realize_start_notify = realize_start_notify;
|
||||
device_class->unrealize_notify = unrealize_notify;
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass,
|
||||
|
|
|
|||
|
|
@ -530,14 +530,6 @@ ip4_config_pre_commit (NMDevice *device, NMIP4Config *config)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
realize_start_notify (NMDevice *device, const NMPlatformLink *plink)
|
||||
{
|
||||
NM_DEVICE_CLASS (nm_device_macvlan_parent_class)->realize_start_notify (device, plink);
|
||||
|
||||
update_properties (device);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
|
|
@ -622,7 +614,6 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *klass)
|
|||
device_class->is_available = is_available;
|
||||
device_class->link_changed = link_changed;
|
||||
device_class->notify_new_device_added = notify_new_device_added;
|
||||
device_class->realize_start_notify = realize_start_notify;
|
||||
device_class->update_connection = update_connection;
|
||||
|
||||
obj_properties[PROP_PARENT] =
|
||||
|
|
|
|||
|
|
@ -251,13 +251,6 @@ create_and_realize (NMDevice *device,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
realize_start_notify (NMDevice *device, const NMPlatformLink *plink)
|
||||
{
|
||||
NM_DEVICE_CLASS (nm_device_tun_parent_class)->realize_start_notify (device, plink);
|
||||
reload_tun_properties ((NMDeviceTun *) device);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_connection_compatible (NMDevice *device, NMConnection *connection)
|
||||
{
|
||||
|
|
@ -438,7 +431,6 @@ nm_device_tun_class_init (NMDeviceTunClass *klass)
|
|||
device_class->check_connection_compatible = check_connection_compatible;
|
||||
device_class->create_and_realize = create_and_realize;
|
||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||
device_class->realize_start_notify = realize_start_notify;
|
||||
device_class->unrealize_notify = unrealize_notify;
|
||||
device_class->update_connection = update_connection;
|
||||
device_class->act_stage1_prepare = act_stage1_prepare;
|
||||
|
|
|
|||
|
|
@ -209,14 +209,6 @@ link_changed (NMDevice *device,
|
|||
update_properties (device);
|
||||
}
|
||||
|
||||
static void
|
||||
realize_start_notify (NMDevice *device,
|
||||
const NMPlatformLink *pllink)
|
||||
{
|
||||
NM_DEVICE_CLASS (nm_device_vlan_parent_class)->realize_start_notify (device, pllink);
|
||||
update_properties (device);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
create_and_realize (NMDevice *device,
|
||||
NMConnection *connection,
|
||||
|
|
@ -663,7 +655,6 @@ nm_device_vlan_class_init (NMDeviceVlanClass *klass)
|
|||
|
||||
parent_class->create_and_realize = create_and_realize;
|
||||
parent_class->link_changed = link_changed;
|
||||
parent_class->realize_start_notify = realize_start_notify;
|
||||
parent_class->unrealize_notify = unrealize_notify;
|
||||
parent_class->get_generic_capabilities = get_generic_capabilities;
|
||||
parent_class->act_stage1_prepare = act_stage1_prepare;
|
||||
|
|
|
|||
|
|
@ -159,14 +159,6 @@ link_changed (NMDevice *device,
|
|||
update_properties (device);
|
||||
}
|
||||
|
||||
static void
|
||||
realize_start_notify (NMDevice *device, const NMPlatformLink *plink)
|
||||
{
|
||||
g_return_if_fail (plink->type == NM_LINK_TYPE_VXLAN);
|
||||
NM_DEVICE_CLASS (nm_device_vxlan_parent_class)->realize_start_notify (device, plink);
|
||||
update_properties (device);
|
||||
}
|
||||
|
||||
static void
|
||||
unrealize_notify (NMDevice *device)
|
||||
{
|
||||
|
|
@ -646,7 +638,6 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *klass)
|
|||
object_class->dispose = dispose;
|
||||
|
||||
device_class->link_changed = link_changed;
|
||||
device_class->realize_start_notify = realize_start_notify;
|
||||
device_class->unrealize_notify = unrealize_notify;
|
||||
device_class->connection_type = NM_SETTING_VXLAN_SETTING_NAME;
|
||||
device_class->create_and_realize = create_and_realize;
|
||||
|
|
|
|||
|
|
@ -2320,11 +2320,12 @@ check_carrier (NMDevice *self)
|
|||
}
|
||||
|
||||
static void
|
||||
realize_start_notify (NMDevice *self, const NMPlatformLink *plink)
|
||||
realize_start_notify (NMDevice *self,
|
||||
const NMPlatformLink *pllink)
|
||||
{
|
||||
/* Stub implementation for realize_start_notify(). It does nothing,
|
||||
* but allows derived classes to uniformly invoke the parent
|
||||
* implementation. */
|
||||
/* the default implementation of realize_start_notify() just calls
|
||||
* link_changed() -- which by default does nothing. */
|
||||
NM_DEVICE_GET_CLASS (self)->link_changed (self, pllink);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -182,12 +182,15 @@ typedef struct {
|
|||
/**
|
||||
* realize_start_notify():
|
||||
* @self: the #NMDevice
|
||||
* @plink: the #NMPlatformLink if backed by a kernel netdevice
|
||||
* @pllink: the #NMPlatformLink if backed by a kernel netdevice
|
||||
*
|
||||
* Hook for derived classes to be notfied during realize_start_setup()
|
||||
* and perform additional setup.
|
||||
*
|
||||
* The default implemention of NMDevice calls link_changed().
|
||||
*/
|
||||
void (*realize_start_notify) (NMDevice *self, const NMPlatformLink *plink);
|
||||
void (*realize_start_notify) (NMDevice *self,
|
||||
const NMPlatformLink *pllink);
|
||||
|
||||
/**
|
||||
* unrealize():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue