diff options
author | Thomas Haller <thaller@redhat.com> | 2019-04-25 10:17:47 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-05-01 13:46:32 +0200 |
commit | b1344b6b94645296e658c8cba383acec7e4dd778 (patch) | |
tree | 3a94b92a87e2b8118b2901787687ca9d2325853a /libnm-core/nm-setting-wireless.c | |
parent | 3c810a84456368c2e3a1c79a5bd80d792f739119 (diff) | |
download | NetworkManager-b1344b6b94645296e658c8cba383acec7e4dd778.tar.gz |
libnm: pass connection to compare_property() function
We have certain artificial properties that not only depend on one
property alone or that depend on a property in another(!) setting.
For that, we have synth_func.
Other than that, synth_func and get_func are really fundamentally
similar and should be merged. That is because the distinction whether a
property value is "synthetized" or just based on a plain property is
minor. It's better to have the general concept of "convert property to
GVariant" in one form only.
Note that compare_property() is by default implemented based
on get_func. Hence, if get_func and synth_func get merged,
compare_property() will also require access to the NMConnection.
Also it makes some sense: some properties are artificial and actually
stored in "another" setting of the connection. But still, the property
descriptor for the property is in this setting. The example is the
"bond.interface-name" which only exists on D-Bus. It's stored as
"connection.interface-name".
I don't really like to say "exists on D-Bus only". It's still a valid
property, despite in NMSetting it's stored somehow differently (or not
at all). So, this is also just a regular property for which we have a
property-info vtable.
Does it make sense to compare such properties? Maybe. But the point is that
compare_property() function needs sometimes access to the entire
connection. So add the argument.
Diffstat (limited to 'libnm-core/nm-setting-wireless.c')
-rw-r--r-- | libnm-core/nm-setting-wireless.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/libnm-core/nm-setting-wireless.c b/libnm-core/nm-setting-wireless.c index d8056c6c59..e03fbefd6c 100644 --- a/libnm-core/nm-setting-wireless.c +++ b/libnm-core/nm-setting-wireless.c @@ -919,20 +919,24 @@ mac_addr_rand_ok: static NMTernary compare_property (const NMSettInfoSetting *sett_info, guint property_idx, - NMSetting *setting, - NMSetting *other, + NMConnection *con_a, + NMSetting *set_a, + NMConnection *con_b, + NMSetting *set_b, NMSettingCompareFlags flags) { if (nm_streq (sett_info->property_infos[property_idx].name, NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS)) { - return !other - || nm_streq0 (NM_SETTING_WIRELESS_GET_PRIVATE (setting)->cloned_mac_address, - NM_SETTING_WIRELESS_GET_PRIVATE (other)->cloned_mac_address); + return !set_b + || nm_streq0 (NM_SETTING_WIRELESS_GET_PRIVATE (set_a)->cloned_mac_address, + NM_SETTING_WIRELESS_GET_PRIVATE (set_b)->cloned_mac_address); } return NM_SETTING_CLASS (nm_setting_wireless_parent_class)->compare_property (sett_info, property_idx, - setting, - other, + con_a, + set_a, + con_b, + set_b, flags); } |