libnm: pass around property_info instead of property_idx in NMSetting API
Various NMSetting API would accept a property_idx parameter. Together with the NMSettInfoSetting instance, this was useful to find the actual NMSettInfoProperty instance. The idea was, to provide the most of the functionality. That is, if you might need the property_idx too, you had it -- after all, the property_info you could lookup yourself. However, - literally zero users care about the property_idx. The care about the property_info. - if the user really, really required the property_idx, then it is a given that it can be easily computed by (property_info - sett_info->property_infos)
This commit is contained in:
@@ -1091,19 +1091,18 @@ options_equal(NMSettingBond *s_bond, NMSettingBond *s_bond2, NMSettingCompareFla
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
NMSetting * set_b,
|
NMSetting * set_b,
|
||||||
NMSettingCompareFlags flags)
|
NMSettingCompareFlags flags)
|
||||||
{
|
{
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_BOND_OPTIONS)) {
|
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 (!set_b || options_equal(NM_SETTING_BOND(set_a), NM_SETTING_BOND(set_b), flags));
|
||||||
}
|
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_bond_parent_class)
|
return NM_SETTING_CLASS(nm_setting_bond_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@@ -369,7 +369,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
@@ -380,7 +380,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
NMSettingBridgePortPrivate *priv_b;
|
NMSettingBridgePortPrivate *priv_b;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_BRIDGE_PORT_VLANS)) {
|
if (property_info->param_spec == obj_properties[PROP_VLANS]) {
|
||||||
if (set_b) {
|
if (set_b) {
|
||||||
priv_a = NM_SETTING_BRIDGE_PORT_GET_PRIVATE(set_a);
|
priv_a = NM_SETTING_BRIDGE_PORT_GET_PRIVATE(set_a);
|
||||||
priv_b = NM_SETTING_BRIDGE_PORT_GET_PRIVATE(set_b);
|
priv_b = NM_SETTING_BRIDGE_PORT_GET_PRIVATE(set_b);
|
||||||
@@ -396,7 +396,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_bridge_port_parent_class)
|
return NM_SETTING_CLASS(nm_setting_bridge_port_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@@ -1316,7 +1316,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
@@ -1327,7 +1327,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
NMSettingBridgePrivate *priv_b;
|
NMSettingBridgePrivate *priv_b;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_BRIDGE_VLANS)) {
|
if (property_info->param_spec == obj_properties[PROP_VLANS]) {
|
||||||
if (set_b) {
|
if (set_b) {
|
||||||
priv_a = NM_SETTING_BRIDGE_GET_PRIVATE(set_a);
|
priv_a = NM_SETTING_BRIDGE_GET_PRIVATE(set_a);
|
||||||
priv_b = NM_SETTING_BRIDGE_GET_PRIVATE(set_b);
|
priv_b = NM_SETTING_BRIDGE_GET_PRIVATE(set_b);
|
||||||
@@ -1343,7 +1343,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_bridge_parent_class)
|
return NM_SETTING_CLASS(nm_setting_bridge_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@@ -622,7 +622,7 @@ nm_setting_connection_get_timestamp(NMSettingConnection *setting)
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
_to_dbus_fcn_timestamp(const NMSettInfoSetting * sett_info,
|
_to_dbus_fcn_timestamp(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -1559,23 +1559,23 @@ nm_setting_connection_no_interface_name(NMSetting * setting,
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
NMSetting * set_b,
|
NMSetting * set_b,
|
||||||
NMSettingCompareFlags flags)
|
NMSettingCompareFlags flags)
|
||||||
{
|
{
|
||||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_IGNORE_ID)
|
if (property_info->param_spec == obj_properties[PROP_ID]) {
|
||||||
&& nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_CONNECTION_ID))
|
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_IGNORE_ID))
|
||||||
return NM_TERNARY_DEFAULT;
|
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)
|
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_IGNORE_TIMESTAMP))
|
||||||
&& nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_CONNECTION_TIMESTAMP))
|
|
||||||
return NM_TERNARY_DEFAULT;
|
return NM_TERNARY_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_connection_parent_class)
|
return NM_SETTING_CLASS(nm_setting_connection_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@@ -4944,7 +4944,7 @@ nm_setting_ip_config_clear_routing_rules(NMSettingIPConfig *setting)
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
_routing_rules_dbus_only_synth(const NMSettInfoSetting * sett_info,
|
_routing_rules_dbus_only_synth(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -5621,7 +5621,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
@@ -5632,7 +5632,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
NMSettingIPConfigPrivate *b_priv;
|
NMSettingIPConfigPrivate *b_priv;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_IP_CONFIG_ADDRESSES)) {
|
if (property_info->param_spec == obj_properties[PROP_ADDRESSES]) {
|
||||||
if (set_b) {
|
if (set_b) {
|
||||||
a_priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(set_a);
|
a_priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(set_a);
|
||||||
b_priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(set_b);
|
b_priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(set_b);
|
||||||
@@ -5650,7 +5650,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_IP_CONFIG_ROUTES)) {
|
if (property_info->param_spec == obj_properties[PROP_ROUTES]) {
|
||||||
if (set_b) {
|
if (set_b) {
|
||||||
a_priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(set_a);
|
a_priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(set_a);
|
||||||
b_priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(set_b);
|
b_priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(set_b);
|
||||||
@@ -5667,8 +5667,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name,
|
if (nm_streq(property_info->name, NM_SETTING_IP_CONFIG_ROUTING_RULES)) {
|
||||||
NM_SETTING_IP_CONFIG_ROUTING_RULES)) {
|
|
||||||
if (set_b) {
|
if (set_b) {
|
||||||
guint n;
|
guint n;
|
||||||
|
|
||||||
@@ -5689,7 +5688,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_ip_config_parent_class)
|
return NM_SETTING_CLASS(nm_setting_ip_config_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -334,7 +334,7 @@ ip4_dns_from_dbus(GVariant *dbus_value, GValue *prop_value)
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
ip4_addresses_get(const NMSettInfoSetting * sett_info,
|
ip4_addresses_get(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -394,7 +394,7 @@ ip4_addresses_set(NMSetting * setting,
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
ip4_address_labels_get(const NMSettInfoSetting * sett_info,
|
ip4_address_labels_get(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -438,7 +438,7 @@ ip4_address_labels_get(const NMSettInfoSetting * sett_info,
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
ip4_address_data_get(const NMSettInfoSetting * sett_info,
|
ip4_address_data_get(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -477,7 +477,7 @@ ip4_address_data_set(NMSetting * setting,
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
ip4_routes_get(const NMSettInfoSetting * sett_info,
|
ip4_routes_get(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -512,7 +512,7 @@ ip4_routes_set(NMSetting * setting,
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
ip4_route_data_get(const NMSettInfoSetting * sett_info,
|
ip4_route_data_get(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
|
@@ -375,7 +375,7 @@ ip6_dns_from_dbus(GVariant *dbus_value, GValue *prop_value)
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
ip6_addresses_get(const NMSettInfoSetting * sett_info,
|
ip6_addresses_get(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -420,7 +420,7 @@ ip6_addresses_set(NMSetting * setting,
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
ip6_address_data_get(const NMSettInfoSetting * sett_info,
|
ip6_address_data_get(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -459,7 +459,7 @@ ip6_address_data_set(NMSetting * setting,
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
ip6_routes_get(const NMSettInfoSetting * sett_info,
|
ip6_routes_get(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -494,7 +494,7 @@ ip6_routes_set(NMSetting * setting,
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
ip6_route_data_get(const NMSettInfoSetting * sett_info,
|
ip6_route_data_get(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
|
@@ -388,7 +388,7 @@ connection_type_is_good:
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
@@ -398,7 +398,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
NMSettingOvsExternalIDsPrivate *priv;
|
NMSettingOvsExternalIDsPrivate *priv;
|
||||||
NMSettingOvsExternalIDsPrivate *pri2;
|
NMSettingOvsExternalIDsPrivate *pri2;
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_OVS_EXTERNAL_IDS_DATA)) {
|
if (property_info->param_spec == obj_properties[PROP_DATA]) {
|
||||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||||
return NM_TERNARY_DEFAULT;
|
return NM_TERNARY_DEFAULT;
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_ovs_external_ids_parent_class)
|
return NM_SETTING_CLASS(nm_setting_ovs_external_ids_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@@ -70,7 +70,7 @@ struct _NMSettingClass {
|
|||||||
GError ** error);
|
GError ** error);
|
||||||
|
|
||||||
gboolean (*clear_secrets)(const struct _NMSettInfoSetting *sett_info,
|
gboolean (*clear_secrets)(const struct _NMSettInfoSetting *sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMSettingClearSecretsWithFlagsFn func,
|
NMSettingClearSecretsWithFlagsFn func,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
@@ -82,7 +82,7 @@ struct _NMSettingClass {
|
|||||||
* @other may be %NULL, in which case the function only determines whether
|
* @other may be %NULL, in which case the function only determines whether
|
||||||
* the setting should be compared (TRUE) or not (DEFAULT). */
|
* the setting should be compared (TRUE) or not (DEFAULT). */
|
||||||
NMTernary (*compare_property)(const struct _NMSettInfoSetting *sett_info,
|
NMTernary (*compare_property)(const struct _NMSettInfoSetting *sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
@@ -326,14 +326,14 @@ void _nm_setting_property_set_property_direct(GObject * object,
|
|||||||
GParamSpec * pspec);
|
GParamSpec * pspec);
|
||||||
|
|
||||||
GVariant *_nm_setting_property_to_dbus_fcn_gprop(const NMSettInfoSetting * sett_info,
|
GVariant *_nm_setting_property_to_dbus_fcn_gprop(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
const NMConnectionSerializationOptions *options);
|
const NMConnectionSerializationOptions *options);
|
||||||
|
|
||||||
GVariant *_nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting * sett_info,
|
GVariant *_nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
|
@@ -876,7 +876,7 @@ _nm_setting_sriov_sort_vfs(NMSettingSriov *setting)
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
vfs_to_dbus(const NMSettInfoSetting * sett_info,
|
vfs_to_dbus(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -1120,7 +1120,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
@@ -1131,7 +1131,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
NMSettingSriov *b;
|
NMSettingSriov *b;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_SRIOV_VFS)) {
|
if (property_info->param_spec == obj_properties[PROP_VFS]) {
|
||||||
if (set_b) {
|
if (set_b) {
|
||||||
a = NM_SETTING_SRIOV(set_a);
|
a = NM_SETTING_SRIOV(set_a);
|
||||||
b = NM_SETTING_SRIOV(set_b);
|
b = NM_SETTING_SRIOV(set_b);
|
||||||
@@ -1147,7 +1147,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_sriov_parent_class)
|
return NM_SETTING_CLASS(nm_setting_sriov_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@@ -1315,7 +1315,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
@@ -1326,7 +1326,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
NMSettingTCConfig *b_tc_config = NM_SETTING_TC_CONFIG(set_b);
|
NMSettingTCConfig *b_tc_config = NM_SETTING_TC_CONFIG(set_b);
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_TC_CONFIG_QDISCS)) {
|
if (property_info->param_spec == obj_properties[PROP_QDISCS]) {
|
||||||
if (set_b) {
|
if (set_b) {
|
||||||
if (a_tc_config->qdiscs->len != b_tc_config->qdiscs->len)
|
if (a_tc_config->qdiscs->len != b_tc_config->qdiscs->len)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1339,7 +1339,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_TC_CONFIG_TFILTERS)) {
|
if (property_info->param_spec == obj_properties[PROP_TFILTERS]) {
|
||||||
if (set_b) {
|
if (set_b) {
|
||||||
if (a_tc_config->tfilters->len != b_tc_config->tfilters->len)
|
if (a_tc_config->tfilters->len != b_tc_config->tfilters->len)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1353,7 +1353,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_tc_config_parent_class)
|
return NM_SETTING_CLASS(nm_setting_tc_config_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1482,7 +1482,7 @@ next:
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
tc_qdiscs_get(const NMSettInfoSetting * sett_info,
|
tc_qdiscs_get(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -1680,7 +1680,7 @@ next:
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
tc_tfilters_get(const NMSettInfoSetting * sett_info,
|
tc_tfilters_get(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
|
@@ -351,7 +351,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
@@ -361,8 +361,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
NMSettingTeamPortPrivate *a_priv;
|
NMSettingTeamPortPrivate *a_priv;
|
||||||
NMSettingTeamPortPrivate *b_priv;
|
NMSettingTeamPortPrivate *b_priv;
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name,
|
if (property_info->param_spec == obj_properties[NM_TEAM_ATTRIBUTE_LINK_WATCHERS]) {
|
||||||
NM_SETTING_TEAM_PORT_LINK_WATCHERS)) {
|
|
||||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||||
return NM_TERNARY_DEFAULT;
|
return NM_TERNARY_DEFAULT;
|
||||||
if (!set_b)
|
if (!set_b)
|
||||||
@@ -374,7 +373,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
TRUE);
|
TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_TEAM_PORT_CONFIG)) {
|
if (property_info->param_spec == obj_properties[NM_TEAM_ATTRIBUTE_CONFIG]) {
|
||||||
if (set_b) {
|
if (set_b) {
|
||||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE)) {
|
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
|
/* If we are trying to match a connection in order to assume it (and thus
|
||||||
@@ -395,7 +394,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_team_port_parent_class)
|
return NM_SETTING_CLASS(nm_setting_team_port_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -1276,7 +1276,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
@@ -1285,7 +1285,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
{
|
{
|
||||||
NMSettingTeamPrivate *a_priv, *b_priv;
|
NMSettingTeamPrivate *a_priv, *b_priv;
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_TEAM_LINK_WATCHERS)) {
|
if (property_info->param_spec == obj_properties[NM_TEAM_ATTRIBUTE_LINK_WATCHERS]) {
|
||||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||||
return NM_TERNARY_DEFAULT;
|
return NM_TERNARY_DEFAULT;
|
||||||
if (!set_b)
|
if (!set_b)
|
||||||
@@ -1297,7 +1297,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
TRUE);
|
TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_TEAM_CONFIG)) {
|
if (property_info->param_spec == obj_properties[NM_TEAM_ATTRIBUTE_CONFIG]) {
|
||||||
if (set_b) {
|
if (set_b) {
|
||||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE)) {
|
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
|
/* If we are trying to match a connection in order to assume it (and thus
|
||||||
@@ -1318,7 +1318,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_team_parent_class)
|
return NM_SETTING_CLASS(nm_setting_team_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -398,7 +398,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
@@ -407,7 +407,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
{
|
{
|
||||||
NMSettingUserPrivate *priv, *pri2;
|
NMSettingUserPrivate *priv, *pri2;
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_USER_DATA)) {
|
if (property_info->param_spec == obj_properties[PROP_DATA]) {
|
||||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||||
return NM_TERNARY_DEFAULT;
|
return NM_TERNARY_DEFAULT;
|
||||||
|
|
||||||
@@ -424,7 +424,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_user_parent_class)
|
return NM_SETTING_CLASS(nm_setting_user_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@@ -677,7 +677,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
_override_flags_get(const NMSettInfoSetting * sett_info,
|
_override_flags_get(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
|
@@ -852,40 +852,40 @@ compare_property_secrets(NMSettingVpn *a, NMSettingVpn *b, NMSettingCompareFlags
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
NMSetting * set_b,
|
NMSetting * set_b,
|
||||||
NMSettingCompareFlags flags)
|
NMSettingCompareFlags flags)
|
||||||
{
|
{
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_VPN_SECRETS)) {
|
if (property_info->param_spec == obj_properties[PROP_SECRETS]) {
|
||||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||||
return NM_TERNARY_DEFAULT;
|
return NM_TERNARY_DEFAULT;
|
||||||
return compare_property_secrets(NM_SETTING_VPN(set_a), NM_SETTING_VPN(set_b), flags);
|
return compare_property_secrets(NM_SETTING_VPN(set_a), NM_SETTING_VPN(set_b), flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_vpn_parent_class)
|
return NM_SETTING_CLASS(nm_setting_vpn_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
clear_secrets(const NMSettInfoSetting * sett_info,
|
clear_secrets(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMSettingClearSecretsWithFlagsFn func,
|
NMSettingClearSecretsWithFlagsFn func,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
NMSettingVpnPrivate *priv = NM_SETTING_VPN_GET_PRIVATE(setting);
|
NMSettingVpnPrivate *priv = NM_SETTING_VPN_GET_PRIVATE(setting);
|
||||||
GParamSpec * prop_spec = sett_info->property_infos[property_idx].param_spec;
|
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
const char * secret;
|
const char * secret;
|
||||||
gboolean changed = TRUE;
|
gboolean changed = TRUE;
|
||||||
|
|
||||||
if (!prop_spec || !NM_FLAGS_HAS(prop_spec->flags, NM_SETTING_PARAM_SECRET))
|
if (!property_info->param_spec
|
||||||
|
|| !NM_FLAGS_HAS(property_info->param_spec->flags, NM_SETTING_PARAM_SECRET))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
nm_assert(nm_streq(prop_spec->name, NM_SETTING_VPN_SECRETS));
|
nm_assert(nm_streq(property_info->param_spec->name, NM_SETTING_VPN_SECRETS));
|
||||||
|
|
||||||
if (!priv->secrets)
|
if (!priv->secrets)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -943,7 +943,7 @@ vpn_secrets_from_dbus(NMSetting * setting,
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
vpn_secrets_to_dbus(const NMSettInfoSetting * sett_info,
|
vpn_secrets_to_dbus(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
|
@@ -977,22 +977,21 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
NMSetting * set_b,
|
NMSetting * set_b,
|
||||||
NMSettingCompareFlags flags)
|
NMSettingCompareFlags flags)
|
||||||
{
|
{
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name,
|
if (property_info->param_spec == obj_properties[PROP_CLONED_MAC_ADDRESS]) {
|
||||||
NM_SETTING_WIRED_CLONED_MAC_ADDRESS)) {
|
|
||||||
return !set_b
|
return !set_b
|
||||||
|| nm_streq0(NM_SETTING_WIRED_GET_PRIVATE(set_a)->cloned_mac_address,
|
|| nm_streq0(NM_SETTING_WIRED_GET_PRIVATE(set_a)->cloned_mac_address,
|
||||||
NM_SETTING_WIRED_GET_PRIVATE(set_b)->cloned_mac_address);
|
NM_SETTING_WIRED_GET_PRIVATE(set_b)->cloned_mac_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_wired_parent_class)
|
return NM_SETTING_CLASS(nm_setting_wired_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@@ -1461,7 +1461,7 @@ nm_setting_wireguard_clear_peers(NMSettingWireGuard *self)
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
_peers_dbus_only_synth(const NMSettInfoSetting * sett_info,
|
_peers_dbus_only_synth(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -1842,12 +1842,12 @@ need_secrets(NMSetting *setting)
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
clear_secrets(const NMSettInfoSetting * sett_info,
|
clear_secrets(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMSettingClearSecretsWithFlagsFn func,
|
NMSettingClearSecretsWithFlagsFn func,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_WIREGUARD_PEERS)) {
|
if (nm_streq(property_info->name, NM_SETTING_WIREGUARD_PEERS)) {
|
||||||
NMSettingWireGuardPrivate *priv = NM_SETTING_WIREGUARD_GET_PRIVATE(setting);
|
NMSettingWireGuardPrivate *priv = NM_SETTING_WIREGUARD_GET_PRIVATE(setting);
|
||||||
gboolean peers_changed = FALSE;
|
gboolean peers_changed = FALSE;
|
||||||
guint i, j;
|
guint i, j;
|
||||||
@@ -1894,7 +1894,7 @@ clear_secrets(const NMSettInfoSetting * sett_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_wireguard_parent_class)
|
return NM_SETTING_CLASS(nm_setting_wireguard_parent_class)
|
||||||
->clear_secrets(sett_info, property_idx, setting, func, user_data);
|
->clear_secrets(sett_info, property_info, setting, func, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1998,7 +1998,7 @@ update_one_secret(NMSetting *setting, const char *key, GVariant *value, GError *
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
@@ -2009,7 +2009,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
NMSettingWireGuardPrivate *b_priv;
|
NMSettingWireGuardPrivate *b_priv;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
if (nm_streq(sett_info->property_infos[property_idx].name, NM_SETTING_WIREGUARD_PEERS)) {
|
if (nm_streq(property_info->name, NM_SETTING_WIREGUARD_PEERS)) {
|
||||||
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
if (NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||||
return NM_TERNARY_DEFAULT;
|
return NM_TERNARY_DEFAULT;
|
||||||
|
|
||||||
@@ -2033,7 +2033,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_wireguard_parent_class)
|
return NM_SETTING_CLASS(nm_setting_wireguard_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -744,7 +744,7 @@ nm_setting_wireless_get_seen_bssid(NMSettingWireless *setting, guint32 i)
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
_to_dbus_fcn_seen_bssids(const NMSettInfoSetting * sett_info,
|
_to_dbus_fcn_seen_bssids(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -1103,20 +1103,19 @@ mac_addr_rand_ok:
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
NMSetting * set_b,
|
NMSetting * set_b,
|
||||||
NMSettingCompareFlags flags)
|
NMSettingCompareFlags flags)
|
||||||
{
|
{
|
||||||
if (sett_info->property_infos[property_idx].param_spec
|
if (property_info->param_spec == obj_properties[PROP_CLONED_MAC_ADDRESS]) {
|
||||||
== obj_properties[PROP_CLONED_MAC_ADDRESS]) {
|
|
||||||
return !set_b
|
return !set_b
|
||||||
|| nm_streq0(NM_SETTING_WIRELESS_GET_PRIVATE(set_a)->cloned_mac_address,
|
|| nm_streq0(NM_SETTING_WIRELESS_GET_PRIVATE(set_a)->cloned_mac_address,
|
||||||
NM_SETTING_WIRELESS_GET_PRIVATE(set_b)->cloned_mac_address);
|
NM_SETTING_WIRELESS_GET_PRIVATE(set_b)->cloned_mac_address);
|
||||||
}
|
}
|
||||||
if (sett_info->property_infos[property_idx].param_spec == obj_properties[PROP_SEEN_BSSIDS]) {
|
if (property_info->param_spec == obj_properties[PROP_SEEN_BSSIDS]) {
|
||||||
return !set_b
|
return !set_b
|
||||||
|| (nm_strv_ptrarray_cmp(NM_SETTING_WIRELESS_GET_PRIVATE(set_a)->seen_bssids,
|
|| (nm_strv_ptrarray_cmp(NM_SETTING_WIRELESS_GET_PRIVATE(set_a)->seen_bssids,
|
||||||
NM_SETTING_WIRELESS_GET_PRIVATE(set_b)->seen_bssids)
|
NM_SETTING_WIRELESS_GET_PRIVATE(set_b)->seen_bssids)
|
||||||
@@ -1124,14 +1123,14 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NM_SETTING_CLASS(nm_setting_wireless_parent_class)
|
return NM_SETTING_CLASS(nm_setting_wireless_parent_class)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
nm_setting_wireless_get_security(const NMSettInfoSetting * sett_info,
|
nm_setting_wireless_get_security(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
|
@@ -471,7 +471,7 @@ const NMSettInfoProperty *
|
|||||||
_nm_sett_info_setting_get_property_info(const NMSettInfoSetting *sett_info,
|
_nm_sett_info_setting_get_property_info(const NMSettInfoSetting *sett_info,
|
||||||
const char * property_name)
|
const char * property_name)
|
||||||
{
|
{
|
||||||
const NMSettInfoProperty *property;
|
const NMSettInfoProperty *property_info;
|
||||||
gssize idx;
|
gssize idx;
|
||||||
|
|
||||||
nm_assert(property_name);
|
nm_assert(property_name);
|
||||||
@@ -490,13 +490,13 @@ _nm_sett_info_setting_get_property_info(const NMSettInfoSetting *sett_info,
|
|||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
property = &sett_info->property_infos[idx];
|
property_info = &sett_info->property_infos[idx];
|
||||||
|
|
||||||
nm_assert(idx == 0 || strcmp(property[-1].name, property[0].name) < 0);
|
nm_assert(idx == 0 || strcmp(property_info[-1].name, property_info[0].name) < 0);
|
||||||
nm_assert(idx == sett_info->property_infos_len - 1
|
nm_assert(idx == sett_info->property_infos_len - 1
|
||||||
|| strcmp(property[0].name, property[1].name) < 0);
|
|| strcmp(property_info[0].name, property_info[1].name) < 0);
|
||||||
|
|
||||||
return property;
|
return property_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NMSettInfoSetting *
|
const NMSettInfoSetting *
|
||||||
@@ -851,14 +851,12 @@ _finalize_direct(NMSetting *setting)
|
|||||||
|
|
||||||
GVariant *
|
GVariant *
|
||||||
_nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting * sett_info,
|
_nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
const NMConnectionSerializationOptions *options)
|
const NMConnectionSerializationOptions *options)
|
||||||
{
|
{
|
||||||
const NMSettInfoProperty *property_info = &sett_info->property_infos[property_idx];
|
|
||||||
|
|
||||||
switch (property_info->property_type->direct_type) {
|
switch (property_info->property_type->direct_type) {
|
||||||
case NM_VALUE_TYPE_BOOL:
|
case NM_VALUE_TYPE_BOOL:
|
||||||
{
|
{
|
||||||
@@ -909,38 +907,37 @@ _nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting *
|
|||||||
|
|
||||||
GVariant *
|
GVariant *
|
||||||
_nm_setting_property_to_dbus_fcn_gprop(const NMSettInfoSetting * sett_info,
|
_nm_setting_property_to_dbus_fcn_gprop(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
const NMConnectionSerializationOptions *options)
|
const NMConnectionSerializationOptions *options)
|
||||||
{
|
{
|
||||||
const NMSettInfoProperty *const property = &sett_info->property_infos[property_idx];
|
|
||||||
nm_auto_unset_gvalue GValue prop_value = {
|
nm_auto_unset_gvalue GValue prop_value = {
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
GArray *tmp_array;
|
GArray *tmp_array;
|
||||||
|
|
||||||
nm_assert(property->param_spec);
|
nm_assert(property_info->param_spec);
|
||||||
nm_assert(property->property_type->to_dbus_fcn == _nm_setting_property_to_dbus_fcn_gprop);
|
nm_assert(property_info->property_type->to_dbus_fcn == _nm_setting_property_to_dbus_fcn_gprop);
|
||||||
nm_assert(property->property_type->typdata_to_dbus.gprop_type
|
nm_assert(property_info->property_type->typdata_to_dbus.gprop_type
|
||||||
== NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_DEFAULT
|
== NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_DEFAULT
|
||||||
|| !property->to_dbus_data.gprop_to_dbus_fcn);
|
|| !property_info->to_dbus_data.gprop_to_dbus_fcn);
|
||||||
|
|
||||||
g_value_init(&prop_value, property->param_spec->value_type);
|
g_value_init(&prop_value, property_info->param_spec->value_type);
|
||||||
|
|
||||||
g_object_get_property(G_OBJECT(setting), property->param_spec->name, &prop_value);
|
g_object_get_property(G_OBJECT(setting), property_info->param_spec->name, &prop_value);
|
||||||
|
|
||||||
if (!property->to_dbus_data.including_default
|
if (!property_info->to_dbus_data.including_default
|
||||||
&& g_param_value_defaults(property->param_spec, &prop_value))
|
&& g_param_value_defaults(property_info->param_spec, &prop_value))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
switch (property->property_type->typdata_to_dbus.gprop_type) {
|
switch (property_info->property_type->typdata_to_dbus.gprop_type) {
|
||||||
case NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_DEFAULT:
|
case NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_DEFAULT:
|
||||||
if (property->to_dbus_data.gprop_to_dbus_fcn)
|
if (property_info->to_dbus_data.gprop_to_dbus_fcn)
|
||||||
return property->to_dbus_data.gprop_to_dbus_fcn(&prop_value);
|
return property_info->to_dbus_data.gprop_to_dbus_fcn(&prop_value);
|
||||||
|
|
||||||
return g_dbus_gvalue_to_gvariant(&prop_value, property->property_type->dbus_type);
|
return g_dbus_gvalue_to_gvariant(&prop_value, property_info->property_type->dbus_type);
|
||||||
case NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_BYTES:
|
case NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_BYTES:
|
||||||
nm_assert(G_VALUE_HOLDS(&prop_value, G_TYPE_BYTES));
|
nm_assert(G_VALUE_HOLDS(&prop_value, G_TYPE_BYTES));
|
||||||
return nm_utils_gbytes_to_variant_ay(g_value_get_boxed(&prop_value));
|
return nm_utils_gbytes_to_variant_ay(g_value_get_boxed(&prop_value));
|
||||||
@@ -966,42 +963,45 @@ _nm_setting_property_to_dbus_fcn_gprop(const NMSettInfoSetting * s
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
property_to_dbus(const NMSettInfoSetting * sett_info,
|
property_to_dbus(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
const NMConnectionSerializationOptions *options,
|
const NMConnectionSerializationOptions *options,
|
||||||
gboolean ignore_flags)
|
gboolean ignore_flags)
|
||||||
{
|
{
|
||||||
const NMSettInfoProperty *property = &sett_info->property_infos[property_idx];
|
|
||||||
GVariant *variant;
|
GVariant *variant;
|
||||||
|
|
||||||
nm_assert(property->property_type->dbus_type);
|
nm_assert(property_info->property_type->dbus_type);
|
||||||
|
|
||||||
if (!property->property_type->to_dbus_fcn) {
|
if (!property_info->property_type->to_dbus_fcn) {
|
||||||
nm_assert(!property->param_spec);
|
nm_assert(!property_info->param_spec);
|
||||||
nm_assert(!property->to_dbus_data.none);
|
nm_assert(!property_info->to_dbus_data.none);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property->param_spec
|
if (property_info->param_spec
|
||||||
&& (!ignore_flags
|
&& (!ignore_flags
|
||||||
&& !NM_FLAGS_HAS(property->param_spec->flags, NM_SETTING_PARAM_TO_DBUS_IGNORE_FLAGS))) {
|
&& !NM_FLAGS_HAS(property_info->param_spec->flags,
|
||||||
if (!NM_FLAGS_HAS(property->param_spec->flags, G_PARAM_WRITABLE))
|
NM_SETTING_PARAM_TO_DBUS_IGNORE_FLAGS))) {
|
||||||
|
if (!NM_FLAGS_HAS(property_info->param_spec->flags, G_PARAM_WRITABLE))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (NM_FLAGS_HAS(property->param_spec->flags, NM_SETTING_PARAM_LEGACY)
|
if (NM_FLAGS_HAS(property_info->param_spec->flags, NM_SETTING_PARAM_LEGACY)
|
||||||
&& !_nm_utils_is_manager_process)
|
&& !_nm_utils_is_manager_process)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (NM_FLAGS_HAS(property->param_spec->flags, NM_SETTING_PARAM_SECRET)) {
|
if (NM_FLAGS_HAS(property_info->param_spec->flags, NM_SETTING_PARAM_SECRET)) {
|
||||||
NMSettingSecretFlags f = NM_SETTING_SECRET_FLAG_NONE;
|
NMSettingSecretFlags f = NM_SETTING_SECRET_FLAG_NONE;
|
||||||
|
|
||||||
if (NM_FLAGS_ANY(flags,
|
if (NM_FLAGS_ANY(flags,
|
||||||
NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED
|
NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED
|
||||||
| NM_CONNECTION_SERIALIZE_WITH_SECRETS_SYSTEM_OWNED
|
| NM_CONNECTION_SERIALIZE_WITH_SECRETS_SYSTEM_OWNED
|
||||||
| NM_CONNECTION_SERIALIZE_WITH_SECRETS_NOT_SAVED)) {
|
| NM_CONNECTION_SERIALIZE_WITH_SECRETS_NOT_SAVED)) {
|
||||||
if (!nm_setting_get_secret_flags(setting, property->param_spec->name, &f, NULL))
|
if (!nm_setting_get_secret_flags(setting,
|
||||||
|
property_info->param_spec->name,
|
||||||
|
&f,
|
||||||
|
NULL))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1013,26 +1013,28 @@ property_to_dbus(const NMSettInfoSetting * sett_info,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
variant = property->property_type
|
variant = property_info->property_type
|
||||||
->to_dbus_fcn(sett_info, property_idx, connection, setting, flags, options);
|
->to_dbus_fcn(sett_info, property_info, connection, setting, flags, options);
|
||||||
nm_g_variant_take_ref(variant);
|
nm_g_variant_take_ref(variant);
|
||||||
|
|
||||||
nm_assert(!variant || g_variant_is_of_type(variant, property->property_type->dbus_type));
|
nm_assert(!variant || g_variant_is_of_type(variant, property_info->property_type->dbus_type));
|
||||||
|
|
||||||
return variant;
|
return variant;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
set_property_from_dbus(const NMSettInfoProperty *property, GVariant *src_value, GValue *dst_value)
|
set_property_from_dbus(const NMSettInfoProperty *property_info,
|
||||||
|
GVariant * src_value,
|
||||||
|
GValue * dst_value)
|
||||||
{
|
{
|
||||||
nm_assert(property->param_spec);
|
nm_assert(property_info->param_spec);
|
||||||
nm_assert(property->property_type->dbus_type);
|
nm_assert(property_info->property_type->dbus_type);
|
||||||
|
|
||||||
if (property->property_type->gprop_from_dbus_fcn) {
|
if (property_info->property_type->gprop_from_dbus_fcn) {
|
||||||
if (!g_variant_type_equal(g_variant_get_type(src_value),
|
if (!g_variant_type_equal(g_variant_get_type(src_value),
|
||||||
property->property_type->dbus_type))
|
property_info->property_type->dbus_type))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
property->property_type->gprop_from_dbus_fcn(src_value, dst_value);
|
property_info->property_type->gprop_from_dbus_fcn(src_value, dst_value);
|
||||||
} else if (dst_value->g_type == G_TYPE_BYTES) {
|
} else if (dst_value->g_type == G_TYPE_BYTES) {
|
||||||
if (!g_variant_is_of_type(src_value, G_VARIANT_TYPE_BYTESTRING))
|
if (!g_variant_is_of_type(src_value, G_VARIANT_TYPE_BYTESTRING))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1102,11 +1104,13 @@ _nm_setting_to_dbus(NMSetting * setting,
|
|||||||
|
|
||||||
sett_info = _nm_setting_class_get_sett_info(NM_SETTING_GET_CLASS(setting));
|
sett_info = _nm_setting_class_get_sett_info(NM_SETTING_GET_CLASS(setting));
|
||||||
for (j = 0; j < sett_info->property_infos_len; j++) {
|
for (j = 0; j < sett_info->property_infos_len; j++) {
|
||||||
|
const NMSettInfoProperty *property_info = &sett_info->property_infos[j];
|
||||||
gs_unref_variant GVariant *dbus_value = NULL;
|
gs_unref_variant GVariant *dbus_value = NULL;
|
||||||
|
|
||||||
dbus_value = property_to_dbus(sett_info, j, connection, setting, flags, options, FALSE);
|
dbus_value =
|
||||||
|
property_to_dbus(sett_info, property_info, connection, setting, flags, options, FALSE);
|
||||||
if (dbus_value) {
|
if (dbus_value) {
|
||||||
g_variant_builder_add(&builder, "{sv}", sett_info->property_infos[j].name, dbus_value);
|
g_variant_builder_add(&builder, "{sv}", property_info->name, dbus_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1382,19 +1386,21 @@ init_from_dbus(NMSetting * setting,
|
|||||||
const GVariantType *
|
const GVariantType *
|
||||||
nm_setting_get_dbus_property_type(NMSetting *setting, const char *property_name)
|
nm_setting_get_dbus_property_type(NMSetting *setting, const char *property_name)
|
||||||
{
|
{
|
||||||
const NMSettInfoProperty *property;
|
const NMSettInfoProperty *property_info;
|
||||||
|
|
||||||
g_return_val_if_fail(NM_IS_SETTING(setting), NULL);
|
g_return_val_if_fail(NM_IS_SETTING(setting), NULL);
|
||||||
g_return_val_if_fail(property_name != NULL, NULL);
|
g_return_val_if_fail(property_name != NULL, NULL);
|
||||||
|
|
||||||
property = _nm_setting_class_get_property_info(NM_SETTING_GET_CLASS(setting), property_name);
|
property_info =
|
||||||
|
_nm_setting_class_get_property_info(NM_SETTING_GET_CLASS(setting), property_name);
|
||||||
|
|
||||||
g_return_val_if_fail(property != NULL, NULL);
|
g_return_val_if_fail(property_info != NULL, NULL);
|
||||||
|
|
||||||
nm_assert(property->property_type);
|
nm_assert(property_info->property_type);
|
||||||
nm_assert(g_variant_type_string_is_valid((const char *) property->property_type->dbus_type));
|
nm_assert(
|
||||||
|
g_variant_type_string_is_valid((const char *) property_info->property_type->dbus_type));
|
||||||
|
|
||||||
return property->property_type->dbus_type;
|
return property_info->property_type->dbus_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@@ -1691,14 +1697,13 @@ _nm_setting_should_compare_secret_property(NMSetting * setting,
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
compare_property(const NMSettInfoSetting * sett_info,
|
compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
NMSetting * set_b,
|
NMSetting * set_b,
|
||||||
NMSettingCompareFlags flags)
|
NMSettingCompareFlags flags)
|
||||||
{
|
{
|
||||||
const NMSettInfoProperty *property_info = &sett_info->property_infos[property_idx];
|
|
||||||
const GParamSpec *param_spec = property_info->param_spec;
|
const GParamSpec *param_spec = property_info->param_spec;
|
||||||
|
|
||||||
if (!param_spec)
|
if (!param_spec)
|
||||||
@@ -1732,14 +1737,14 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
gs_unref_variant GVariant *value2 = NULL;
|
gs_unref_variant GVariant *value2 = NULL;
|
||||||
|
|
||||||
value1 = property_to_dbus(sett_info,
|
value1 = property_to_dbus(sett_info,
|
||||||
property_idx,
|
property_info,
|
||||||
con_a,
|
con_a,
|
||||||
set_a,
|
set_a,
|
||||||
NM_CONNECTION_SERIALIZE_ALL,
|
NM_CONNECTION_SERIALIZE_ALL,
|
||||||
NULL,
|
NULL,
|
||||||
TRUE);
|
TRUE);
|
||||||
value2 = property_to_dbus(sett_info,
|
value2 = property_to_dbus(sett_info,
|
||||||
property_idx,
|
property_info,
|
||||||
con_b,
|
con_b,
|
||||||
set_b,
|
set_b,
|
||||||
NM_CONNECTION_SERIALIZE_ALL,
|
NM_CONNECTION_SERIALIZE_ALL,
|
||||||
@@ -1754,7 +1759,7 @@ compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
|
|
||||||
static NMTernary
|
static NMTernary
|
||||||
_compare_property(const NMSettInfoSetting * sett_info,
|
_compare_property(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty *property_info,
|
||||||
NMConnection * con_a,
|
NMConnection * con_a,
|
||||||
NMSetting * set_a,
|
NMSetting * set_a,
|
||||||
NMConnection * con_b,
|
NMConnection * con_b,
|
||||||
@@ -1765,21 +1770,19 @@ _compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
|
|
||||||
nm_assert(sett_info);
|
nm_assert(sett_info);
|
||||||
nm_assert(NM_IS_SETTING_CLASS(sett_info->setting_class));
|
nm_assert(NM_IS_SETTING_CLASS(sett_info->setting_class));
|
||||||
nm_assert(property_idx < sett_info->property_infos_len);
|
nm_assert(property_info);
|
||||||
nm_assert(NM_SETTING_GET_CLASS(set_a) == sett_info->setting_class);
|
nm_assert(NM_SETTING_GET_CLASS(set_a) == sett_info->setting_class);
|
||||||
nm_assert(!set_b || NM_SETTING_GET_CLASS(set_b) == sett_info->setting_class);
|
nm_assert(!set_b || NM_SETTING_GET_CLASS(set_b) == sett_info->setting_class);
|
||||||
|
|
||||||
compare_result =
|
compare_result =
|
||||||
NM_SETTING_GET_CLASS(set_a)
|
NM_SETTING_GET_CLASS(set_a)
|
||||||
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
->compare_property(sett_info, property_info, con_a, set_a, con_b, set_b, flags);
|
||||||
|
|
||||||
nm_assert(NM_IN_SET(compare_result, NM_TERNARY_DEFAULT, NM_TERNARY_FALSE, NM_TERNARY_TRUE));
|
nm_assert(NM_IN_SET(compare_result, NM_TERNARY_DEFAULT, NM_TERNARY_FALSE, NM_TERNARY_TRUE));
|
||||||
|
|
||||||
/* check that the inferable flag and the GObject property flag corresponds. */
|
/* check that the inferable flag and the GObject property flag corresponds. */
|
||||||
nm_assert(!NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE)
|
nm_assert(!NM_FLAGS_HAS(flags, NM_SETTING_COMPARE_FLAG_INFERRABLE) || !property_info->param_spec
|
||||||
|| !sett_info->property_infos[property_idx].param_spec
|
|| NM_FLAGS_HAS(property_info->param_spec->flags, NM_SETTING_PARAM_INFERRABLE)
|
||||||
|| NM_FLAGS_HAS(sett_info->property_infos[property_idx].param_spec->flags,
|
|
||||||
NM_SETTING_PARAM_INFERRABLE)
|
|
||||||
|| compare_result == NM_TERNARY_DEFAULT);
|
|| compare_result == NM_TERNARY_DEFAULT);
|
||||||
|
|
||||||
#if NM_MORE_ASSERTS > 10
|
#if NM_MORE_ASSERTS > 10
|
||||||
@@ -1787,7 +1790,7 @@ _compare_property(const NMSettInfoSetting *sett_info,
|
|||||||
nm_assert(!set_b
|
nm_assert(!set_b
|
||||||
|| compare_result
|
|| compare_result
|
||||||
== NM_SETTING_GET_CLASS(set_a)->compare_property(sett_info,
|
== NM_SETTING_GET_CLASS(set_a)->compare_property(sett_info,
|
||||||
property_idx,
|
property_info,
|
||||||
con_b,
|
con_b,
|
||||||
set_b,
|
set_b,
|
||||||
con_a,
|
con_a,
|
||||||
@@ -1849,7 +1852,8 @@ _nm_setting_compare(NMConnection * con_a,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < sett_info->property_infos_len; i++) {
|
for (i = 0; i < sett_info->property_infos_len; i++) {
|
||||||
if (_compare_property(sett_info, i, con_a, a, con_b, b, flags) == NM_TERNARY_FALSE)
|
if (_compare_property(sett_info, &sett_info->property_infos[i], con_a, a, con_b, b, flags)
|
||||||
|
== NM_TERNARY_FALSE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2006,11 +2010,11 @@ _nm_setting_diff(NMConnection * con_a,
|
|||||||
} else {
|
} else {
|
||||||
for (i = 0; i < sett_info->property_infos_len; i++) {
|
for (i = 0; i < sett_info->property_infos_len; i++) {
|
||||||
NMSettingDiffResult r = NM_SETTING_DIFF_RESULT_UNKNOWN;
|
NMSettingDiffResult r = NM_SETTING_DIFF_RESULT_UNKNOWN;
|
||||||
const NMSettInfoProperty *property_info;
|
const NMSettInfoProperty *property_info = &sett_info->property_infos[i];
|
||||||
NMTernary compare_result;
|
NMTernary compare_result;
|
||||||
GParamSpec * prop_spec;
|
GParamSpec * prop_spec;
|
||||||
|
|
||||||
compare_result = _compare_property(sett_info, i, con_a, a, con_b, b, flags);
|
compare_result = _compare_property(sett_info, property_info, con_a, a, con_b, b, flags);
|
||||||
if (compare_result == NM_TERNARY_DEFAULT)
|
if (compare_result == NM_TERNARY_DEFAULT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2031,14 +2035,13 @@ _nm_setting_diff(NMConnection * con_a,
|
|||||||
*
|
*
|
||||||
* We need to double-check whether the property should be ignored by
|
* We need to double-check whether the property should be ignored by
|
||||||
* looking at @a alone. */
|
* looking at @a alone. */
|
||||||
if (_compare_property(sett_info, i, con_a, a, NULL, NULL, flags)
|
if (_compare_property(sett_info, property_info, con_a, a, NULL, NULL, flags)
|
||||||
== NM_TERNARY_DEFAULT)
|
== NM_TERNARY_DEFAULT)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
compared_any = TRUE;
|
compared_any = TRUE;
|
||||||
|
|
||||||
property_info = &sett_info->property_infos[i];
|
|
||||||
prop_spec = property_info->param_spec;
|
prop_spec = property_info->param_spec;
|
||||||
|
|
||||||
if (b) {
|
if (b) {
|
||||||
@@ -2287,13 +2290,13 @@ _nm_setting_aggregate(NMSetting *setting, NMConnectionAggregateType type, gpoint
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
clear_secrets(const NMSettInfoSetting * sett_info,
|
clear_secrets(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMSettingClearSecretsWithFlagsFn func,
|
NMSettingClearSecretsWithFlagsFn func,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE;
|
NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE;
|
||||||
GParamSpec * param_spec = sett_info->property_infos[property_idx].param_spec;
|
GParamSpec * param_spec = property_info->param_spec;
|
||||||
|
|
||||||
if (!param_spec)
|
if (!param_spec)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -2344,7 +2347,7 @@ _nm_setting_clear_secrets(NMSetting * setting,
|
|||||||
gboolean changed = FALSE;
|
gboolean changed = FALSE;
|
||||||
guint16 i;
|
guint16 i;
|
||||||
gboolean (*my_clear_secrets)(const struct _NMSettInfoSetting *sett_info,
|
gboolean (*my_clear_secrets)(const struct _NMSettInfoSetting *sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMSettingClearSecretsWithFlagsFn func,
|
NMSettingClearSecretsWithFlagsFn func,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
@@ -2355,7 +2358,8 @@ _nm_setting_clear_secrets(NMSetting * setting,
|
|||||||
|
|
||||||
sett_info = _nm_setting_class_get_sett_info(NM_SETTING_GET_CLASS(setting));
|
sett_info = _nm_setting_class_get_sett_info(NM_SETTING_GET_CLASS(setting));
|
||||||
for (i = 0; i < sett_info->property_infos_len; i++) {
|
for (i = 0; i < sett_info->property_infos_len; i++) {
|
||||||
changed |= my_clear_secrets(sett_info, i, setting, func, user_data);
|
changed |=
|
||||||
|
my_clear_secrets(sett_info, &sett_info->property_infos[i], setting, func, user_data);
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
@@ -2689,7 +2693,7 @@ nm_setting_to_string(NMSetting *setting)
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
_nm_setting_get_deprecated_virtual_interface_name(const NMSettInfoSetting * sett_info,
|
_nm_setting_get_deprecated_virtual_interface_name(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
|
@@ -2731,7 +2731,7 @@ _nm_setting_get_team_setting(struct _NMSetting *setting)
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
_nm_team_settings_property_to_dbus(const NMSettInfoSetting * sett_info,
|
_nm_team_settings_property_to_dbus(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -2739,8 +2739,7 @@ _nm_team_settings_property_to_dbus(const NMSettInfoSetting * sett_
|
|||||||
{
|
{
|
||||||
NMTeamSetting * self = _nm_setting_get_team_setting(setting);
|
NMTeamSetting * self = _nm_setting_get_team_setting(setting);
|
||||||
const TeamAttrData *attr_data =
|
const TeamAttrData *attr_data =
|
||||||
_team_attr_data_get(self->d.is_port,
|
_team_attr_data_get(self->d.is_port, property_info->param_spec->param_id);
|
||||||
sett_info->property_infos[property_idx].param_spec->param_id);
|
|
||||||
|
|
||||||
if (attr_data->team_attr == NM_TEAM_ATTRIBUTE_CONFIG) {
|
if (attr_data->team_attr == NM_TEAM_ATTRIBUTE_CONFIG) {
|
||||||
const char *config;
|
const char *config;
|
||||||
|
@@ -4004,7 +4004,7 @@ nm_utils_hwaddr_to_dbus(const char *str)
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
_nm_utils_hwaddr_cloned_get(const NMSettInfoSetting * sett_info,
|
_nm_utils_hwaddr_cloned_get(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -4012,7 +4012,7 @@ _nm_utils_hwaddr_cloned_get(const NMSettInfoSetting * sett_info,
|
|||||||
{
|
{
|
||||||
gs_free char *addr = NULL;
|
gs_free char *addr = NULL;
|
||||||
|
|
||||||
nm_assert(nm_streq(sett_info->property_infos[property_idx].name, "cloned-mac-address"));
|
nm_assert(nm_streq(property_info->name, "cloned-mac-address"));
|
||||||
|
|
||||||
g_object_get(setting, "cloned-mac-address", &addr, NULL);
|
g_object_get(setting, "cloned-mac-address", &addr, NULL);
|
||||||
return nm_utils_hwaddr_to_dbus(addr);
|
return nm_utils_hwaddr_to_dbus(addr);
|
||||||
@@ -4069,7 +4069,7 @@ const NMSettInfoPropertType nm_sett_info_propert_type_cloned_mac_address =
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
_nm_utils_hwaddr_cloned_data_synth(const NMSettInfoSetting * sett_info,
|
_nm_utils_hwaddr_cloned_data_synth(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -4080,7 +4080,7 @@ _nm_utils_hwaddr_cloned_data_synth(const NMSettInfoSetting * sett_
|
|||||||
if (!_nm_connection_serialize_non_secret(flags))
|
if (!_nm_connection_serialize_non_secret(flags))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
nm_assert(nm_streq0(sett_info->property_infos[property_idx].name, "assigned-mac-address"));
|
nm_assert(nm_streq0(property_info->name, "assigned-mac-address"));
|
||||||
|
|
||||||
g_object_get(setting, "cloned-mac-address", &addr, NULL);
|
g_object_get(setting, "cloned-mac-address", &addr, NULL);
|
||||||
|
|
||||||
@@ -5447,7 +5447,7 @@ nm_utils_base64secret_normalize(const char *base64_key,
|
|||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
_nm_utils_bridge_vlans_to_dbus(const NMSettInfoSetting * sett_info,
|
_nm_utils_bridge_vlans_to_dbus(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
@@ -5456,7 +5456,7 @@ _nm_utils_bridge_vlans_to_dbus(const NMSettInfoSetting * sett_info
|
|||||||
gs_unref_ptrarray GPtrArray *vlans = NULL;
|
gs_unref_ptrarray GPtrArray *vlans = NULL;
|
||||||
GVariantBuilder builder;
|
GVariantBuilder builder;
|
||||||
guint i;
|
guint i;
|
||||||
const char * property_name = sett_info->property_infos[property_idx].name;
|
const char * property_name = property_info->name;
|
||||||
|
|
||||||
nm_assert(property_name);
|
nm_assert(property_name);
|
||||||
|
|
||||||
|
@@ -651,7 +651,7 @@ typedef struct _NMSettInfoSetting NMSettInfoSetting;
|
|||||||
typedef struct _NMSettInfoProperty NMSettInfoProperty;
|
typedef struct _NMSettInfoProperty NMSettInfoProperty;
|
||||||
|
|
||||||
typedef GVariant *(*NMSettInfoPropToDBusFcn)(const NMSettInfoSetting * sett_info,
|
typedef GVariant *(*NMSettInfoPropToDBusFcn)(const NMSettInfoSetting * sett_info,
|
||||||
guint property_idx,
|
const NMSettInfoProperty * property_info,
|
||||||
NMConnection * connection,
|
NMConnection * connection,
|
||||||
NMSetting * setting,
|
NMSetting * setting,
|
||||||
NMConnectionSerializationFlags flags,
|
NMConnectionSerializationFlags flags,
|
||||||
|
Reference in New Issue
Block a user