libnm: refactor NMSettingClass.compare_property() to NMSettInfoPropertType.compare_fcn()
NMSettingClass.compare_property() will be dropped.
This commit is contained in:
@@ -1090,7 +1090,7 @@ options_equal(NMSettingBond *s_bond, NMSettingBond *s_bond2, NMSettingCompareFla
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_options(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -1098,11 +1098,7 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
if (property_info->param_spec == obj_properties[PROP_OPTIONS])
|
||||
return (!set_b || options_equal(NM_SETTING_BOND(set_a), NM_SETTING_BOND(set_b), flags));
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_bond_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -1190,7 +1186,6 @@ nm_setting_bond_class_init(NMSettingBondClass *klass)
|
||||
object_class->finalize = finalize;
|
||||
|
||||
setting_class->verify = verify;
|
||||
setting_class->compare_property = compare_property;
|
||||
|
||||
/**
|
||||
* NMSettingBond:options: (type GHashTable(utf8,utf8)):
|
||||
@@ -1212,9 +1207,14 @@ nm_setting_bond_class_init(NMSettingBondClass *klass)
|
||||
"",
|
||||
G_TYPE_HASH_TABLE,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
obj_properties[PROP_OPTIONS],
|
||||
&nm_sett_info_propert_type_strdict);
|
||||
NM_SETT_INFO_PROPERT_TYPE_GPROP(NM_G_VARIANT_TYPE("a{ss}"),
|
||||
.gprop_from_dbus_fcn = _nm_utils_strdict_from_dbus,
|
||||
.typdata_to_dbus.gprop_type =
|
||||
NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_STRDICT,
|
||||
.compare_fcn = compare_fcn_options));
|
||||
|
||||
/* ---dbus---
|
||||
* property: interface-name
|
||||
|
@@ -368,7 +368,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_vlans(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -376,29 +376,13 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
NMSettingBridgePortPrivate *priv_a;
|
||||
NMSettingBridgePortPrivate *priv_b;
|
||||
guint i;
|
||||
|
||||
if (property_info->param_spec == obj_properties[PROP_VLANS]) {
|
||||
if (set_b) {
|
||||
priv_a = NM_SETTING_BRIDGE_PORT_GET_PRIVATE(set_a);
|
||||
priv_b = NM_SETTING_BRIDGE_PORT_GET_PRIVATE(set_b);
|
||||
|
||||
if (priv_a->vlans->len != priv_b->vlans->len)
|
||||
return FALSE;
|
||||
for (i = 0; i < priv_a->vlans->len; i++) {
|
||||
if (nm_bridge_vlan_cmp(priv_a->vlans->pdata[i], priv_b->vlans->pdata[i]))
|
||||
return FALSE;
|
||||
}
|
||||
return _nm_utils_bridge_compare_vlans(NM_SETTING_BRIDGE_PORT_GET_PRIVATE(set_a)->vlans,
|
||||
NM_SETTING_BRIDGE_PORT_GET_PRIVATE(set_b)->vlans);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_bridge_port_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
@@ -504,7 +488,6 @@ nm_setting_bridge_port_class_init(NMSettingBridgePortClass *klass)
|
||||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
||||
setting_class->compare_property = compare_property;
|
||||
setting_class->verify = verify;
|
||||
|
||||
/**
|
||||
@@ -604,9 +587,13 @@ nm_setting_bridge_port_class_init(NMSettingBridgePortClass *klass)
|
||||
G_TYPE_PTR_ARRAY,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE
|
||||
| G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
obj_properties[PROP_VLANS],
|
||||
&nm_sett_info_propert_type_bridge_vlans);
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("aa{sv}"),
|
||||
.compare_fcn = compare_fcn_vlans,
|
||||
.to_dbus_fcn = _nm_utils_bridge_vlans_to_dbus,
|
||||
.from_dbus_fcn = _nm_utils_bridge_vlans_from_dbus, ));
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
|
@@ -1315,7 +1315,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_vlans(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -1323,29 +1323,13 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
NMSettingBridgePrivate *priv_a;
|
||||
NMSettingBridgePrivate *priv_b;
|
||||
guint i;
|
||||
|
||||
if (property_info->param_spec == obj_properties[PROP_VLANS]) {
|
||||
if (set_b) {
|
||||
priv_a = NM_SETTING_BRIDGE_GET_PRIVATE(set_a);
|
||||
priv_b = NM_SETTING_BRIDGE_GET_PRIVATE(set_b);
|
||||
|
||||
if (priv_a->vlans->len != priv_b->vlans->len)
|
||||
return FALSE;
|
||||
for (i = 0; i < priv_a->vlans->len; i++) {
|
||||
if (nm_bridge_vlan_cmp(priv_a->vlans->pdata[i], priv_b->vlans->pdata[i]))
|
||||
return FALSE;
|
||||
}
|
||||
return _nm_utils_bridge_compare_vlans(NM_SETTING_BRIDGE_GET_PRIVATE(set_a)->vlans,
|
||||
NM_SETTING_BRIDGE_GET_PRIVATE(set_b)->vlans);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_bridge_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
@@ -1611,7 +1595,6 @@ nm_setting_bridge_class_init(NMSettingBridgeClass *klass)
|
||||
object_class->set_property = set_property;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
setting_class->compare_property = compare_property;
|
||||
setting_class->verify = verify;
|
||||
|
||||
/**
|
||||
@@ -1914,9 +1897,13 @@ nm_setting_bridge_class_init(NMSettingBridgeClass *klass)
|
||||
G_TYPE_PTR_ARRAY,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE
|
||||
| G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
obj_properties[PROP_VLANS],
|
||||
&nm_sett_info_propert_type_bridge_vlans);
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("aa{sv}"),
|
||||
.to_dbus_fcn = _nm_utils_bridge_vlans_to_dbus,
|
||||
.compare_fcn = compare_fcn_vlans,
|
||||
.from_dbus_fcn = _nm_utils_bridge_vlans_from_dbus, ));
|
||||
|
||||
/* ---dbus---
|
||||
* property: interface-name
|
||||
|
@@ -1558,7 +1558,7 @@ nm_setting_connection_no_interface_name(NMSetting * setting,
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_id(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -1566,16 +1566,37 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
if (property_info->param_spec == obj_properties[PROP_ID]) {
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_IGNORE_ID))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
} else if (property_info->param_spec == obj_properties[PROP_TIMESTAMP]) {
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_IGNORE_TIMESTAMP))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
|
||||
return _nm_setting_property_compare_fcn_default(sett_info,
|
||||
property_info,
|
||||
con_a,
|
||||
set_a,
|
||||
con_b,
|
||||
set_b,
|
||||
flags);
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_connection_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
static NMTernary
|
||||
compare_fcn_timestamp(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_IGNORE_TIMESTAMP))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
|
||||
return _nm_setting_property_compare_fcn_default(sett_info,
|
||||
property_info,
|
||||
con_a,
|
||||
set_a,
|
||||
con_b,
|
||||
set_b,
|
||||
flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -1857,7 +1878,6 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
|
||||
object_class->finalize = finalize;
|
||||
|
||||
setting_class->verify = verify;
|
||||
setting_class->compare_property = compare_property;
|
||||
|
||||
/**
|
||||
* NMSettingConnection:id:
|
||||
@@ -1871,11 +1891,17 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
|
||||
* description: User friendly name for the connection profile.
|
||||
* ---end---
|
||||
*/
|
||||
_nm_setting_property_define_direct_string(properties_override,
|
||||
_nm_setting_property_define_direct_string_full(
|
||||
properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_CONNECTION_ID,
|
||||
PROP_ID,
|
||||
NM_SETTING_PARAM_FUZZY_IGNORE,
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_STRING,
|
||||
.direct_type = NM_VALUE_TYPE_STRING,
|
||||
.compare_fcn = compare_fcn_id,
|
||||
.to_dbus_fcn = _nm_setting_property_to_dbus_fcn_direct),
|
||||
|
||||
NMSettingConnectionPrivate,
|
||||
id);
|
||||
|
||||
@@ -2197,7 +2223,7 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
|
||||
properties_override,
|
||||
obj_properties[PROP_TIMESTAMP],
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_UINT64,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.compare_fcn = compare_fcn_timestamp,
|
||||
.to_dbus_fcn = _to_dbus_fcn_timestamp, ));
|
||||
|
||||
/**
|
||||
|
@@ -5619,8 +5619,8 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMTernary
|
||||
_nm_setting_ip_config_compare_fcn_addresses(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -5632,7 +5632,6 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSettingIPConfigPrivate *b_priv;
|
||||
guint i;
|
||||
|
||||
if (property_info->param_spec == obj_properties[PROP_ADDRESSES]) {
|
||||
if (set_b) {
|
||||
a_priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(set_a);
|
||||
b_priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(set_b);
|
||||
@@ -5650,7 +5649,19 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (property_info->param_spec == obj_properties[PROP_ROUTES]) {
|
||||
NMTernary
|
||||
_nm_setting_ip_config_compare_fcn_routes(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
NMSettingIPConfigPrivate *a_priv;
|
||||
NMSettingIPConfigPrivate *b_priv;
|
||||
guint i;
|
||||
|
||||
if (set_b) {
|
||||
a_priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(set_a);
|
||||
b_priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(set_b);
|
||||
@@ -5667,7 +5678,19 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (nm_streq(property_info->name, NM_SETTING_IP_CONFIG_ROUTING_RULES)) {
|
||||
static NMTernary
|
||||
compare_fcn_routing_rules(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
NMSettingIPConfigPrivate *a_priv;
|
||||
NMSettingIPConfigPrivate *b_priv;
|
||||
guint i;
|
||||
|
||||
if (set_b) {
|
||||
guint n;
|
||||
|
||||
@@ -5687,10 +5710,6 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_ip_config_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
}
|
||||
|
||||
static void
|
||||
duplicate_copy_properties(const NMSettInfoSetting *sett_info, NMSetting *src, NMSetting *dst)
|
||||
{
|
||||
@@ -5814,7 +5833,7 @@ _nm_sett_info_property_override_create_array_ip_config(void)
|
||||
NM_SETTING_IP_CONFIG_ROUTING_RULES,
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("aa{sv}"),
|
||||
.to_dbus_fcn = _routing_rules_dbus_only_synth,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.compare_fcn = compare_fcn_routing_rules,
|
||||
.from_dbus_fcn = _routing_rules_dbus_only_set, ));
|
||||
|
||||
_nm_properties_override_gobj(
|
||||
@@ -6114,7 +6133,6 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass)
|
||||
object_class->finalize = finalize;
|
||||
|
||||
setting_class->verify = verify;
|
||||
setting_class->compare_property = compare_property;
|
||||
setting_class->duplicate_copy_properties = duplicate_copy_properties;
|
||||
setting_class->enumerate_values = enumerate_values;
|
||||
|
||||
|
@@ -987,7 +987,7 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass)
|
||||
g_object_class_find_property(G_OBJECT_CLASS(setting_class), NM_SETTING_IP_CONFIG_ADDRESSES),
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("aau"),
|
||||
.to_dbus_fcn = ip4_addresses_get,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.compare_fcn = _nm_setting_ip_config_compare_fcn_addresses,
|
||||
.from_dbus_fcn = ip4_addresses_set, ));
|
||||
_nm_properties_override_dbus(
|
||||
properties_override,
|
||||
@@ -1044,7 +1044,7 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass)
|
||||
g_object_class_find_property(G_OBJECT_CLASS(setting_class), NM_SETTING_IP_CONFIG_ROUTES),
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("aau"),
|
||||
.to_dbus_fcn = ip4_routes_get,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.compare_fcn = _nm_setting_ip_config_compare_fcn_routes,
|
||||
.from_dbus_fcn = ip4_routes_set, ));
|
||||
|
||||
/* ---dbus---
|
||||
|
@@ -1045,7 +1045,7 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
|
||||
g_object_class_find_property(G_OBJECT_CLASS(setting_class), NM_SETTING_IP_CONFIG_ADDRESSES),
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("a(ayuay)"),
|
||||
.to_dbus_fcn = ip6_addresses_get,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.compare_fcn = _nm_setting_ip_config_compare_fcn_addresses,
|
||||
.from_dbus_fcn = ip6_addresses_set, ));
|
||||
|
||||
/* ---dbus---
|
||||
@@ -1084,7 +1084,7 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
|
||||
g_object_class_find_property(G_OBJECT_CLASS(setting_class), NM_SETTING_IP_CONFIG_ROUTES),
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("a(ayuayu)"),
|
||||
.to_dbus_fcn = ip6_routes_get,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.compare_fcn = _nm_setting_ip_config_compare_fcn_routes,
|
||||
.from_dbus_fcn = ip6_routes_set, ));
|
||||
|
||||
/* ---dbus---
|
||||
|
@@ -387,7 +387,7 @@ connection_type_is_good:
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_data(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -398,7 +398,6 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSettingOvsExternalIDsPrivate *priv;
|
||||
NMSettingOvsExternalIDsPrivate *pri2;
|
||||
|
||||
if (property_info->param_spec == obj_properties[PROP_DATA]) {
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
|
||||
@@ -410,10 +409,6 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
return nm_utils_hashtable_equal(priv->data, pri2->data, TRUE, g_str_equal);
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_ovs_external_ids_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
@@ -523,7 +518,6 @@ nm_setting_ovs_external_ids_class_init(NMSettingOvsExternalIDsClass *klass)
|
||||
object_class->set_property = set_property;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
setting_class->compare_property = compare_property;
|
||||
setting_class->verify = verify;
|
||||
|
||||
/**
|
||||
@@ -538,9 +532,14 @@ nm_setting_ovs_external_ids_class_init(NMSettingOvsExternalIDsClass *klass)
|
||||
"",
|
||||
G_TYPE_HASH_TABLE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
obj_properties[PROP_DATA],
|
||||
&nm_sett_info_propert_type_strdict);
|
||||
NM_SETT_INFO_PROPERT_TYPE_GPROP(NM_G_VARIANT_TYPE("a{ss}"),
|
||||
.gprop_from_dbus_fcn = _nm_utils_strdict_from_dbus,
|
||||
.typdata_to_dbus.gprop_type =
|
||||
NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_STRDICT,
|
||||
.compare_fcn = compare_fcn_data));
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
|
@@ -627,6 +627,56 @@ gboolean _nm_setting_should_compare_secret_property(NMSetting * settin
|
||||
NMBridgeVlan *_nm_bridge_vlan_dup(const NMBridgeVlan *vlan);
|
||||
NMBridgeVlan *_nm_bridge_vlan_dup_and_seal(const NMBridgeVlan *vlan);
|
||||
|
||||
gboolean _nm_utils_bridge_vlans_from_dbus(NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
const char * property,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error);
|
||||
|
||||
GVariant *_nm_utils_bridge_vlans_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options);
|
||||
|
||||
NMTernary _nm_setting_ip_config_compare_fcn_addresses(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags);
|
||||
|
||||
NMTernary _nm_setting_ip_config_compare_fcn_routes(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags);
|
||||
|
||||
gboolean _nm_utils_hwaddr_cloned_not_set(NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
const char * property,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error);
|
||||
|
||||
GVariant *_nm_utils_hwaddr_cloned_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options);
|
||||
|
||||
gboolean _nm_utils_hwaddr_cloned_set(NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
const char * property,
|
||||
GVariant * value,
|
||||
NMSettingParseFlags parse_flags,
|
||||
GError ** error);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif /* NM_SETTING_PRIVATE_H */
|
||||
|
@@ -1119,7 +1119,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_vfs(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -1131,7 +1131,6 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSettingSriov *b;
|
||||
guint i;
|
||||
|
||||
if (property_info->param_spec == obj_properties[PROP_VFS]) {
|
||||
if (set_b) {
|
||||
a = NM_SETTING_SRIOV(set_a);
|
||||
b = NM_SETTING_SRIOV(set_b);
|
||||
@@ -1146,10 +1145,6 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_sriov_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
@@ -1246,7 +1241,6 @@ nm_setting_sriov_class_init(NMSettingSriovClass *klass)
|
||||
object_class->set_property = set_property;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
setting_class->compare_property = compare_property;
|
||||
setting_class->verify = verify;
|
||||
|
||||
/**
|
||||
@@ -1323,12 +1317,11 @@ nm_setting_sriov_class_init(NMSettingSriovClass *klass)
|
||||
G_TYPE_PTR_ARRAY,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE
|
||||
| G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
obj_properties[PROP_VFS],
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("aa{sv}"),
|
||||
.to_dbus_fcn = vfs_to_dbus,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.compare_fcn = compare_fcn_vfs,
|
||||
.from_dbus_fcn = vfs_from_dbus, ));
|
||||
|
||||
/**
|
||||
|
@@ -1314,7 +1314,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_qdiscs(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -1326,20 +1326,30 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSettingTCConfig *b_tc_config = NM_SETTING_TC_CONFIG(set_b);
|
||||
guint i;
|
||||
|
||||
if (property_info->param_spec == obj_properties[PROP_QDISCS]) {
|
||||
if (set_b) {
|
||||
if (a_tc_config->qdiscs->len != b_tc_config->qdiscs->len)
|
||||
return FALSE;
|
||||
for (i = 0; i < a_tc_config->qdiscs->len; i++) {
|
||||
if (!nm_tc_qdisc_equal(a_tc_config->qdiscs->pdata[i],
|
||||
b_tc_config->qdiscs->pdata[i]))
|
||||
if (!nm_tc_qdisc_equal(a_tc_config->qdiscs->pdata[i], b_tc_config->qdiscs->pdata[i]))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (property_info->param_spec == obj_properties[PROP_TFILTERS]) {
|
||||
static NMTernary
|
||||
compare_fcn_tfilter(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
NMSettingTCConfig *a_tc_config = NM_SETTING_TC_CONFIG(set_a);
|
||||
NMSettingTCConfig *b_tc_config = NM_SETTING_TC_CONFIG(set_b);
|
||||
guint i;
|
||||
|
||||
if (set_b) {
|
||||
if (a_tc_config->tfilters->len != b_tc_config->tfilters->len)
|
||||
return FALSE;
|
||||
@@ -1352,10 +1362,6 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_tc_config_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* _qdiscs_to_variant:
|
||||
* @qdiscs: (element-type NMTCQdisc): an array of #NMTCQdisc objects
|
||||
@@ -1803,7 +1809,6 @@ nm_setting_tc_config_class_init(NMSettingTCConfigClass *klass)
|
||||
object_class->set_property = set_property;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
setting_class->compare_property = compare_property;
|
||||
setting_class->verify = verify;
|
||||
|
||||
/**
|
||||
@@ -2112,12 +2117,11 @@ nm_setting_tc_config_class_init(NMSettingTCConfigClass *klass)
|
||||
G_TYPE_PTR_ARRAY,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE
|
||||
| G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
obj_properties[PROP_QDISCS],
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("aa{sv}"),
|
||||
.to_dbus_fcn = tc_qdiscs_get,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.compare_fcn = compare_fcn_qdiscs,
|
||||
.from_dbus_fcn = tc_qdiscs_set, ));
|
||||
|
||||
/**
|
||||
@@ -2256,7 +2260,7 @@ nm_setting_tc_config_class_init(NMSettingTCConfigClass *klass)
|
||||
obj_properties[PROP_TFILTERS],
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("aa{sv}"),
|
||||
.to_dbus_fcn = tc_tfilters_get,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.compare_fcn = compare_fcn_tfilter,
|
||||
.from_dbus_fcn = tc_tfilters_set, ));
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
@@ -350,7 +350,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_link_watchers(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -361,7 +361,6 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSettingTeamPortPrivate *a_priv;
|
||||
NMSettingTeamPortPrivate *b_priv;
|
||||
|
||||
if (property_info->param_spec == obj_properties[NM_TEAM_ATTRIBUTE_LINK_WATCHERS]) {
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
if (!set_b)
|
||||
@@ -373,7 +372,18 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
if (property_info->param_spec == obj_properties[NM_TEAM_ATTRIBUTE_CONFIG]) {
|
||||
static NMTernary
|
||||
compare_fcn_config(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
NMSettingTeamPortPrivate *a_priv;
|
||||
NMSettingTeamPortPrivate *b_priv;
|
||||
|
||||
if (set_b) {
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE)) {
|
||||
/* If we are trying to match a connection in order to assume it (and thus
|
||||
@@ -393,10 +403,6 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_team_port_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
}
|
||||
|
||||
static void
|
||||
duplicate_copy_properties(const NMSettInfoSetting *sett_info, NMSetting *src, NMSetting *dst)
|
||||
{
|
||||
@@ -544,7 +550,6 @@ nm_setting_team_port_class_init(NMSettingTeamPortClass *klass)
|
||||
object_class->set_property = set_property;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
setting_class->compare_property = compare_property;
|
||||
setting_class->verify = verify;
|
||||
setting_class->duplicate_copy_properties = duplicate_copy_properties;
|
||||
setting_class->init_from_dbus = init_from_dbus;
|
||||
@@ -569,9 +574,12 @@ nm_setting_team_port_class_init(NMSettingTeamPortClass *klass)
|
||||
"",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
obj_properties[NM_TEAM_ATTRIBUTE_CONFIG],
|
||||
&nm_sett_info_propert_type_team_s);
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_STRING,
|
||||
.compare_fcn = compare_fcn_config,
|
||||
.to_dbus_fcn = _nm_team_settings_property_to_dbus, ));
|
||||
|
||||
/**
|
||||
* NMSettingTeamPort:queue-id:
|
||||
@@ -687,9 +695,14 @@ nm_setting_team_port_class_init(NMSettingTeamPortClass *klass)
|
||||
"",
|
||||
G_TYPE_PTR_ARRAY,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
obj_properties[NM_TEAM_ATTRIBUTE_LINK_WATCHERS],
|
||||
&nm_sett_info_propert_type_team_link_watchers);
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("aa{sv}"),
|
||||
.compare_fcn = compare_fcn_link_watchers,
|
||||
.to_dbus_fcn = _nm_team_settings_property_to_dbus,
|
||||
.gprop_from_dbus_fcn =
|
||||
_nm_team_settings_property_from_dbus_link_watchers, ));
|
||||
|
||||
g_object_class_install_properties(object_class, G_N_ELEMENTS(obj_properties), obj_properties);
|
||||
|
||||
|
@@ -1275,7 +1275,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_link_watchers(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -1283,9 +1283,9 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
NMSettingTeamPrivate *a_priv, *b_priv;
|
||||
NMSettingTeamPrivate *a_priv;
|
||||
NMSettingTeamPrivate *b_priv;
|
||||
|
||||
if (property_info->param_spec == obj_properties[NM_TEAM_ATTRIBUTE_LINK_WATCHERS]) {
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
if (!set_b)
|
||||
@@ -1297,7 +1297,18 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
if (property_info->param_spec == obj_properties[NM_TEAM_ATTRIBUTE_CONFIG]) {
|
||||
static NMTernary
|
||||
compare_fcn_config(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
NMSettingTeamPrivate *a_priv;
|
||||
NMSettingTeamPrivate *b_priv;
|
||||
|
||||
if (set_b) {
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE)) {
|
||||
/* If we are trying to match a connection in order to assume it (and thus
|
||||
@@ -1317,10 +1328,6 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_team_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
}
|
||||
|
||||
static void
|
||||
duplicate_copy_properties(const NMSettInfoSetting *sett_info, NMSetting *src, NMSetting *dst)
|
||||
{
|
||||
@@ -1505,7 +1512,6 @@ nm_setting_team_class_init(NMSettingTeamClass *klass)
|
||||
object_class->set_property = set_property;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
setting_class->compare_property = compare_property;
|
||||
setting_class->verify = verify;
|
||||
setting_class->duplicate_copy_properties = duplicate_copy_properties;
|
||||
setting_class->init_from_dbus = init_from_dbus;
|
||||
@@ -1530,9 +1536,12 @@ nm_setting_team_class_init(NMSettingTeamClass *klass)
|
||||
"",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
obj_properties[NM_TEAM_ATTRIBUTE_CONFIG],
|
||||
&nm_sett_info_propert_type_team_s);
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_STRING,
|
||||
.compare_fcn = compare_fcn_config,
|
||||
.to_dbus_fcn = _nm_team_settings_property_to_dbus, ));
|
||||
|
||||
/**
|
||||
* NMSettingTeam:notify-peers-count:
|
||||
@@ -1809,9 +1818,14 @@ nm_setting_team_class_init(NMSettingTeamClass *klass)
|
||||
"",
|
||||
G_TYPE_PTR_ARRAY,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
obj_properties[NM_TEAM_ATTRIBUTE_LINK_WATCHERS],
|
||||
&nm_sett_info_propert_type_team_link_watchers);
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("aa{sv}"),
|
||||
.compare_fcn = compare_fcn_link_watchers,
|
||||
.to_dbus_fcn = _nm_team_settings_property_to_dbus,
|
||||
.gprop_from_dbus_fcn =
|
||||
_nm_team_settings_property_from_dbus_link_watchers, ));
|
||||
|
||||
/* ---dbus---
|
||||
* property: interface-name
|
||||
|
@@ -397,7 +397,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_data(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -405,9 +405,9 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
NMSettingUserPrivate *priv, *pri2;
|
||||
NMSettingUserPrivate *priv;
|
||||
NMSettingUserPrivate *pri2;
|
||||
|
||||
if (property_info->param_spec == obj_properties[PROP_DATA]) {
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
|
||||
@@ -417,14 +417,7 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
priv = NM_SETTING_USER_GET_PRIVATE(NM_SETTING_USER(set_a));
|
||||
pri2 = NM_SETTING_USER_GET_PRIVATE(NM_SETTING_USER(set_b));
|
||||
return nm_utils_hashtable_equal(priv->data, pri2->data, TRUE, g_str_equal)
|
||||
&& nm_utils_hashtable_equal(priv->data_invalid,
|
||||
pri2->data_invalid,
|
||||
TRUE,
|
||||
g_str_equal);
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_user_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
&& nm_utils_hashtable_equal(priv->data_invalid, pri2->data_invalid, TRUE, g_str_equal);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -552,7 +545,6 @@ nm_setting_user_class_init(NMSettingUserClass *klass)
|
||||
object_class->set_property = set_property;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
setting_class->compare_property = compare_property;
|
||||
setting_class->verify = verify;
|
||||
|
||||
/**
|
||||
@@ -581,9 +573,14 @@ nm_setting_user_class_init(NMSettingUserClass *klass)
|
||||
"",
|
||||
G_TYPE_HASH_TABLE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
obj_properties[PROP_DATA],
|
||||
&nm_sett_info_propert_type_strdict);
|
||||
NM_SETT_INFO_PROPERT_TYPE_GPROP(NM_G_VARIANT_TYPE("a{ss}"),
|
||||
.gprop_from_dbus_fcn = _nm_utils_strdict_from_dbus,
|
||||
.typdata_to_dbus.gprop_type =
|
||||
NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_STRDICT,
|
||||
.compare_fcn = compare_fcn_data));
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
|
@@ -851,7 +851,7 @@ compare_property_secrets(NMSettingVpn *a, NMSettingVpn *b, NMSettingCompareFlags
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_secrets(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -859,16 +859,11 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
if (property_info->param_spec == obj_properties[PROP_SECRETS]) {
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
return compare_property_secrets(NM_SETTING_VPN(set_a), NM_SETTING_VPN(set_b), flags);
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_vpn_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clear_secrets(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
@@ -1131,7 +1126,6 @@ nm_setting_vpn_class_init(NMSettingVpnClass *klass)
|
||||
setting_class->get_secret_flags = get_secret_flags;
|
||||
setting_class->set_secret_flags = set_secret_flags;
|
||||
setting_class->need_secrets = need_secrets;
|
||||
setting_class->compare_property = compare_property;
|
||||
setting_class->clear_secrets = clear_secrets;
|
||||
setting_class->aggregate = aggregate;
|
||||
|
||||
@@ -1231,7 +1225,7 @@ nm_setting_vpn_class_init(NMSettingVpnClass *klass)
|
||||
obj_properties[PROP_SECRETS],
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("a{ss}"),
|
||||
.to_dbus_fcn = vpn_secrets_to_dbus,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.compare_fcn = compare_fcn_secrets,
|
||||
.from_dbus_fcn = vpn_secrets_from_dbus, ));
|
||||
|
||||
/**
|
||||
|
@@ -976,7 +976,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_cloned_mac_address(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -984,16 +984,11 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
if (property_info->param_spec == obj_properties[PROP_CLONED_MAC_ADDRESS]) {
|
||||
return !set_b
|
||||
|| nm_streq0(NM_SETTING_WIRED_GET_PRIVATE(set_a)->cloned_mac_address,
|
||||
NM_SETTING_WIRED_GET_PRIVATE(set_b)->cloned_mac_address);
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_wired_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
@@ -1274,7 +1269,6 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
|
||||
object_class->finalize = finalize;
|
||||
|
||||
setting_class->verify = verify;
|
||||
setting_class->compare_property = compare_property;
|
||||
|
||||
/**
|
||||
* NMSettingWired:port:
|
||||
@@ -1474,9 +1468,14 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
|
||||
"",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
obj_properties[PROP_CLONED_MAC_ADDRESS],
|
||||
&nm_sett_info_propert_type_cloned_mac_address);
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_BYTESTRING,
|
||||
.compare_fcn = compare_fcn_cloned_mac_address,
|
||||
.to_dbus_fcn = _nm_utils_hwaddr_cloned_get,
|
||||
.from_dbus_fcn = _nm_utils_hwaddr_cloned_set,
|
||||
.missing_from_dbus_fcn = _nm_utils_hwaddr_cloned_not_set, ));
|
||||
|
||||
/* ---dbus---
|
||||
* property: assigned-mac-address
|
||||
|
@@ -1997,7 +1997,7 @@ update_one_secret(NMSetting *setting, const char *key, GVariant *value, GError *
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_peers(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -2009,7 +2009,6 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSettingWireGuardPrivate *b_priv;
|
||||
guint i;
|
||||
|
||||
if (nm_streq(property_info->name, NM_SETTING_WIREGUARD_PEERS)) {
|
||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||
return NM_TERNARY_DEFAULT;
|
||||
|
||||
@@ -2032,10 +2031,6 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_wireguard_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
}
|
||||
|
||||
static void
|
||||
duplicate_copy_properties(const NMSettInfoSetting *sett_info, NMSetting *src, NMSetting *dst)
|
||||
{
|
||||
@@ -2421,7 +2416,6 @@ nm_setting_wireguard_class_init(NMSettingWireGuardClass *klass)
|
||||
setting_class->need_secrets = need_secrets;
|
||||
setting_class->clear_secrets = clear_secrets;
|
||||
setting_class->update_one_secret = update_one_secret;
|
||||
setting_class->compare_property = compare_property;
|
||||
setting_class->duplicate_copy_properties = duplicate_copy_properties;
|
||||
setting_class->enumerate_values = enumerate_values;
|
||||
setting_class->aggregate = aggregate;
|
||||
@@ -2597,7 +2591,7 @@ nm_setting_wireguard_class_init(NMSettingWireGuardClass *klass)
|
||||
NM_SETTING_WIREGUARD_PEERS,
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(NM_G_VARIANT_TYPE("aa{sv}"),
|
||||
.to_dbus_fcn = _peers_dbus_only_synth,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.compare_fcn = compare_fcn_peers,
|
||||
.from_dbus_fcn = _peers_dbus_only_set, ));
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
@@ -1102,7 +1102,7 @@ mac_addr_rand_ok:
|
||||
}
|
||||
|
||||
static NMTernary
|
||||
compare_property(const NMSettInfoSetting * sett_info,
|
||||
compare_fcn_cloned_mac_address(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
@@ -1110,22 +1110,26 @@ compare_property(const NMSettInfoSetting * sett_info,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
if (property_info->param_spec == obj_properties[PROP_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);
|
||||
}
|
||||
if (property_info->param_spec == obj_properties[PROP_SEEN_BSSIDS]) {
|
||||
|
||||
static NMTernary
|
||||
compare_fcn_seen_bssids(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty *property_info,
|
||||
NMConnection * con_a,
|
||||
NMSetting * set_a,
|
||||
NMConnection * con_b,
|
||||
NMSetting * set_b,
|
||||
NMSettingCompareFlags flags)
|
||||
{
|
||||
return !set_b
|
||||
|| (nm_strv_ptrarray_cmp(NM_SETTING_WIRELESS_GET_PRIVATE(set_a)->seen_bssids,
|
||||
NM_SETTING_WIRELESS_GET_PRIVATE(set_b)->seen_bssids)
|
||||
== 0);
|
||||
}
|
||||
|
||||
return NM_SETTING_CLASS(nm_setting_wireless_parent_class)
|
||||
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static GVariant *
|
||||
@@ -1419,7 +1423,6 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
|
||||
object_class->finalize = finalize;
|
||||
|
||||
setting_class->verify = verify;
|
||||
setting_class->compare_property = compare_property;
|
||||
|
||||
/**
|
||||
* NMSettingWireless:ssid:
|
||||
@@ -1665,9 +1668,14 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
|
||||
"",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
|
||||
_nm_properties_override_gobj(properties_override,
|
||||
_nm_properties_override_gobj(
|
||||
properties_override,
|
||||
obj_properties[PROP_CLONED_MAC_ADDRESS],
|
||||
&nm_sett_info_propert_type_cloned_mac_address);
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_BYTESTRING,
|
||||
.compare_fcn = compare_fcn_cloned_mac_address,
|
||||
.to_dbus_fcn = _nm_utils_hwaddr_cloned_get,
|
||||
.from_dbus_fcn = _nm_utils_hwaddr_cloned_set,
|
||||
.missing_from_dbus_fcn = _nm_utils_hwaddr_cloned_not_set, ));
|
||||
|
||||
/* ---dbus---
|
||||
* property: assigned-mac-address
|
||||
@@ -1786,7 +1794,7 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_STRING_ARRAY,
|
||||
.to_dbus_fcn = _to_dbus_fcn_seen_bssids,
|
||||
.from_dbus_fcn = _from_dbus_fcn_seen_bssids,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default, ));
|
||||
.compare_fcn = compare_fcn_seen_bssids, ));
|
||||
|
||||
/**
|
||||
* NMSettingWireless:mtu:
|
||||
|
@@ -2729,7 +2729,7 @@ _nm_setting_get_team_setting(struct _NMSetting *setting)
|
||||
return _nm_setting_team_port_get_team_setting(NM_SETTING_TEAM_PORT(setting));
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
GVariant *
|
||||
_nm_team_settings_property_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
@@ -2778,7 +2778,7 @@ _nm_team_settings_property_to_dbus(const NMSettInfoSetting * sett_
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
_nm_team_settings_property_from_dbus_link_watchers(GVariant *dbus_value, GValue *prop_value)
|
||||
{
|
||||
g_value_take_boxed(prop_value,
|
||||
@@ -2805,13 +2805,6 @@ const NMSettInfoPropertType nm_sett_info_propert_type_team_as =
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.to_dbus_fcn = _nm_team_settings_property_to_dbus, );
|
||||
|
||||
const NMSettInfoPropertType nm_sett_info_propert_type_team_link_watchers =
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(NM_G_VARIANT_TYPE("aa{sv}"),
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.to_dbus_fcn = _nm_team_settings_property_to_dbus,
|
||||
.gprop_from_dbus_fcn =
|
||||
_nm_team_settings_property_from_dbus_link_watchers, );
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NMTeamSetting *
|
||||
|
@@ -266,6 +266,5 @@ extern const NMSettInfoPropertType nm_sett_info_propert_type_team_b;
|
||||
extern const NMSettInfoPropertType nm_sett_info_propert_type_team_i;
|
||||
extern const NMSettInfoPropertType nm_sett_info_propert_type_team_s;
|
||||
extern const NMSettInfoPropertType nm_sett_info_propert_type_team_as;
|
||||
extern const NMSettInfoPropertType nm_sett_info_propert_type_team_link_watchers;
|
||||
|
||||
#endif /* __NM_TEAM_UITLS_H__ */
|
||||
|
@@ -36,12 +36,8 @@ extern const NMSettInfoPropertType nm_sett_info_propert_type_strdict;
|
||||
|
||||
extern const NMSettInfoPropertType nm_sett_info_propert_type_mac_address;
|
||||
|
||||
extern const NMSettInfoPropertType nm_sett_info_propert_type_cloned_mac_address;
|
||||
|
||||
extern const NMSettInfoPropertType nm_sett_info_propert_type_assigned_mac_address;
|
||||
|
||||
extern const NMSettInfoPropertType nm_sett_info_propert_type_bridge_vlans;
|
||||
|
||||
void _nm_utils_strdict_from_dbus(GVariant *dbus_value, GValue *prop_value);
|
||||
|
||||
void _nm_utils_bytes_from_dbus(GVariant *dbus_value, GValue *prop_value);
|
||||
@@ -58,4 +54,15 @@ gboolean _nm_utils_bridge_vlan_verify_list(GPtrArray * vlans,
|
||||
const char *setting,
|
||||
const char *property);
|
||||
|
||||
NMTernary _nm_utils_bridge_compare_vlans(GPtrArray *vlans_a, GPtrArray *vlans_b);
|
||||
|
||||
GVariant *_nm_team_settings_property_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
NMSetting * setting,
|
||||
NMConnectionSerializationFlags flags,
|
||||
const NMConnectionSerializationOptions *options);
|
||||
|
||||
void _nm_team_settings_property_from_dbus_link_watchers(GVariant *dbus_value, GValue *prop_value);
|
||||
|
||||
#endif
|
||||
|
@@ -4003,7 +4003,7 @@ nm_utils_hwaddr_to_dbus(const char *str)
|
||||
return nm_g_variant_new_ay(buf, len);
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
GVariant *
|
||||
_nm_utils_hwaddr_cloned_get(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
@@ -4019,7 +4019,7 @@ _nm_utils_hwaddr_cloned_get(const NMSettInfoSetting * sett_info,
|
||||
return nm_utils_hwaddr_to_dbus(addr);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gboolean
|
||||
_nm_utils_hwaddr_cloned_set(NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
const char * property,
|
||||
@@ -4051,7 +4051,7 @@ _nm_utils_hwaddr_cloned_set(NMSetting * setting,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gboolean
|
||||
_nm_utils_hwaddr_cloned_not_set(NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
const char * property,
|
||||
@@ -4062,13 +4062,6 @@ _nm_utils_hwaddr_cloned_not_set(NMSetting * setting,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
const NMSettInfoPropertType nm_sett_info_propert_type_cloned_mac_address =
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(G_VARIANT_TYPE_BYTESTRING,
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.to_dbus_fcn = _nm_utils_hwaddr_cloned_get,
|
||||
.from_dbus_fcn = _nm_utils_hwaddr_cloned_set,
|
||||
.missing_from_dbus_fcn = _nm_utils_hwaddr_cloned_not_set, );
|
||||
|
||||
static GVariant *
|
||||
_nm_utils_hwaddr_cloned_data_synth(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
@@ -5449,7 +5442,7 @@ nm_utils_base64secret_normalize(const char *base64_key,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
GVariant *
|
||||
_nm_utils_bridge_vlans_to_dbus(const NMSettInfoSetting * sett_info,
|
||||
const NMSettInfoProperty * property_info,
|
||||
NMConnection * connection,
|
||||
@@ -5496,7 +5489,7 @@ _nm_utils_bridge_vlans_to_dbus(const NMSettInfoSetting * sett_info
|
||||
return g_variant_builder_end(&builder);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gboolean
|
||||
_nm_utils_bridge_vlans_from_dbus(NMSetting * setting,
|
||||
GVariant * connection_dict,
|
||||
const char * property,
|
||||
@@ -5548,11 +5541,20 @@ _nm_utils_bridge_vlans_from_dbus(NMSetting * setting,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
const NMSettInfoPropertType nm_sett_info_propert_type_bridge_vlans =
|
||||
NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(NM_G_VARIANT_TYPE("aa{sv}"),
|
||||
.compare_fcn = _nm_setting_property_compare_fcn_default,
|
||||
.to_dbus_fcn = _nm_utils_bridge_vlans_to_dbus,
|
||||
.from_dbus_fcn = _nm_utils_bridge_vlans_from_dbus, );
|
||||
NMTernary
|
||||
_nm_utils_bridge_compare_vlans(GPtrArray *vlans_a, GPtrArray *vlans_b)
|
||||
{
|
||||
guint l = nm_g_ptr_array_len(vlans_a);
|
||||
guint i;
|
||||
|
||||
if (l != nm_g_ptr_array_len(vlans_b))
|
||||
return FALSE;
|
||||
for (i = 0; i < l; i++) {
|
||||
if (nm_bridge_vlan_cmp(vlans_a->pdata[i], vlans_b->pdata[i]))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_nm_utils_bridge_vlan_verify_list(GPtrArray * vlans,
|
||||
|
@@ -4525,9 +4525,12 @@ check_done:;
|
||||
g_assert_not_reached();
|
||||
|
||||
if (sip->property_type->compare_fcn == _nm_setting_property_compare_fcn_default) {
|
||||
/* for the moment, all types have this implementation. This will change. */
|
||||
} else
|
||||
/* pass */
|
||||
} else if (sip->property_type->compare_fcn) {
|
||||
/* pass */
|
||||
} else {
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
property_types_data = g_hash_table_lookup(h_property_types, sip->property_type);
|
||||
if (!property_types_data) {
|
||||
|
Reference in New Issue
Block a user