diff options
author | Thomas Haller <thaller@redhat.com> | 2017-01-02 15:53:18 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-01-04 14:18:01 +0100 |
commit | 0eb4b404f25f711d27171064b993974b220a4b94 (patch) | |
tree | 2bb4630fb1172285118104a44756fccaabf5710e | |
parent | 0bb84d1b854a8e370d433d37cdb3d708ed477d03 (diff) | |
download | NetworkManager-0eb4b404f25f711d27171064b993974b220a4b94.tar.gz |
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().
-rw-r--r-- | src/devices/nm-device-ethernet.c | 10 | ||||
-rw-r--r-- | src/devices/nm-device-ip-tunnel.c | 9 | ||||
-rw-r--r-- | src/devices/nm-device-macvlan.c | 9 | ||||
-rw-r--r-- | src/devices/nm-device-tun.c | 8 | ||||
-rw-r--r-- | src/devices/nm-device-vlan.c | 9 | ||||
-rw-r--r-- | src/devices/nm-device-vxlan.c | 9 | ||||
-rw-r--r-- | src/devices/nm-device.c | 9 | ||||
-rw-r--r-- | src/devices/nm-device.h | 7 |
8 files changed, 10 insertions, 60 deletions
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index 7e84b49025..07f60d05b8 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -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; diff --git a/src/devices/nm-device-ip-tunnel.c b/src/devices/nm-device-ip-tunnel.c index 332e53e05e..3ddb9c0b6f 100644 --- a/src/devices/nm-device-ip-tunnel.c +++ b/src/devices/nm-device-ip-tunnel.c @@ -761,14 +761,6 @@ create_and_realize (NMDevice *device, } 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) { NMConnection *connection; @@ -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, diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c index 917c8dcbf4..5ec8bda078 100644 --- a/src/devices/nm-device-macvlan.c +++ b/src/devices/nm-device-macvlan.c @@ -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] = diff --git a/src/devices/nm-device-tun.c b/src/devices/nm-device-tun.c index 55de1500a3..45b1eebdb7 100644 --- a/src/devices/nm-device-tun.c +++ b/src/devices/nm-device-tun.c @@ -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; diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c index fc5a71cff6..af4413f199 100644 --- a/src/devices/nm-device-vlan.c +++ b/src/devices/nm-device-vlan.c @@ -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; diff --git a/src/devices/nm-device-vxlan.c b/src/devices/nm-device-vxlan.c index e5ba1ef10c..d2eb289e0c 100644 --- a/src/devices/nm-device-vxlan.c +++ b/src/devices/nm-device-vxlan.c @@ -160,14 +160,6 @@ link_changed (NMDevice *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) { NMDeviceVxlan *self = NM_DEVICE_VXLAN (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; diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 8bfc9688cd..87085ecc40 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -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); } /** diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index b843c67121..dfd7b36b56 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -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(): |