summaryrefslogtreecommitdiff
path: root/libnm-core/nm-setting-connection.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-04-25 10:17:47 +0200
committerThomas Haller <thaller@redhat.com>2019-05-01 13:46:32 +0200
commitb1344b6b94645296e658c8cba383acec7e4dd778 (patch)
tree3a94b92a87e2b8118b2901787687ca9d2325853a /libnm-core/nm-setting-connection.c
parent3c810a84456368c2e3a1c79a5bd80d792f739119 (diff)
downloadNetworkManager-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-connection.c')
-rw-r--r--libnm-core/nm-setting-connection.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libnm-core/nm-setting-connection.c b/libnm-core/nm-setting-connection.c
index e4fb70c247..282bff1e06 100644
--- a/libnm-core/nm-setting-connection.c
+++ b/libnm-core/nm-setting-connection.c
@@ -1268,8 +1268,10 @@ nm_setting_connection_no_interface_name (NMSetting *setting,
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_FLAGS_HAS (flags, NM_SETTING_COMPARE_FLAG_IGNORE_ID)
@@ -1282,8 +1284,10 @@ compare_property (const NMSettInfoSetting *sett_info,
return NM_SETTING_CLASS (nm_setting_connection_parent_class)->compare_property (sett_info,
property_idx,
- setting,
- other,
+ con_a,
+ set_a,
+ con_b,
+ set_b,
flags);
}