libnm: add property_type argument to _nm_setting_property_define_direct_strv

The purpose of this is to allow overriding to_dbus_fcn and from_dbus_fcn when
necessary (such as for special behavior regarding a deprecated/aliased properties).
This commit is contained in:
Jan Vaclav
2024-02-19 14:39:25 +01:00
committed by Fernando Fernandez Mancera
parent 8f9ed29e2c
commit ec91aa3c70
4 changed files with 38 additions and 30 deletions

View File

@@ -2751,6 +2751,7 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
NM_SETTING_CONNECTION_SECONDARIES, NM_SETTING_CONNECTION_SECONDARIES,
PROP_SECONDARIES, PROP_SECONDARIES,
NM_SETTING_PARAM_FUZZY_IGNORE, NM_SETTING_PARAM_FUZZY_IGNORE,
NULL,
NMSettingConnectionPrivate, NMSettingConnectionPrivate,
secondaries); secondaries);

View File

@@ -739,6 +739,7 @@ nm_setting_match_class_init(NMSettingMatchClass *klass)
NM_SETTING_MATCH_INTERFACE_NAME, NM_SETTING_MATCH_INTERFACE_NAME,
PROP_INTERFACE_NAME, PROP_INTERFACE_NAME,
NM_SETTING_PARAM_FUZZY_IGNORE, NM_SETTING_PARAM_FUZZY_IGNORE,
NULL,
NMSettingMatch, NMSettingMatch,
interface_name); interface_name);
@@ -764,6 +765,7 @@ nm_setting_match_class_init(NMSettingMatchClass *klass)
NM_SETTING_MATCH_KERNEL_COMMAND_LINE, NM_SETTING_MATCH_KERNEL_COMMAND_LINE,
PROP_KERNEL_COMMAND_LINE, PROP_KERNEL_COMMAND_LINE,
NM_SETTING_PARAM_FUZZY_IGNORE, NM_SETTING_PARAM_FUZZY_IGNORE,
NULL,
NMSettingMatch, NMSettingMatch,
kernel_command_line); kernel_command_line);
@@ -783,6 +785,7 @@ nm_setting_match_class_init(NMSettingMatchClass *klass)
NM_SETTING_MATCH_DRIVER, NM_SETTING_MATCH_DRIVER,
PROP_DRIVER, PROP_DRIVER,
NM_SETTING_PARAM_FUZZY_IGNORE, NM_SETTING_PARAM_FUZZY_IGNORE,
NULL,
NMSettingMatch, NMSettingMatch,
driver); driver);
@@ -824,6 +827,7 @@ nm_setting_match_class_init(NMSettingMatchClass *klass)
NM_SETTING_MATCH_PATH, NM_SETTING_MATCH_PATH,
PROP_PATH, PROP_PATH,
NM_SETTING_PARAM_FUZZY_IGNORE, NM_SETTING_PARAM_FUZZY_IGNORE,
NULL,
NMSettingMatch, NMSettingMatch,
path); path);

View File

@@ -874,12 +874,13 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
prop_name, \ prop_name, \
prop_id, \ prop_id, \
param_flags, \ param_flags, \
property_type, \
private_struct_type, \ private_struct_type, \
private_struct_field, \ private_struct_field, \
... /* extra NMSettInfoProperty fields */) \ ... /* extra NMSettInfoProperty fields */) \
({ \ ({ \
GParamSpec *_param_spec; \ GParamSpec *_param_spec; \
\ const NMSettInfoPropertType *_property_type; \
G_STATIC_ASSERT(!NM_FLAGS_ANY((param_flags), ~(NM_SETTING_PARAM_FUZZY_IGNORE))); \ G_STATIC_ASSERT(!NM_FLAGS_ANY((param_flags), ~(NM_SETTING_PARAM_FUZZY_IGNORE))); \
\ \
_param_spec = g_param_spec_boxed("" prop_name "", \ _param_spec = g_param_spec_boxed("" prop_name "", \
@@ -890,10 +891,11 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
| G_PARAM_STATIC_STRINGS | (param_flags)); \ | G_PARAM_STATIC_STRINGS | (param_flags)); \
\ \
(obj_properties)[(prop_id)] = _param_spec; \ (obj_properties)[(prop_id)] = _param_spec; \
_property_type = (property_type) ?: &nm_sett_info_propert_type_direct_strv; \
\ \
_nm_properties_override_gobj((properties_override), \ _nm_properties_override_gobj((properties_override), \
_param_spec, \ _param_spec, \
&nm_sett_info_propert_type_direct_strv, \ _property_type, \
.direct_offset = \ .direct_offset = \
NM_STRUCT_OFFSET_ENSURE_TYPE(NMValueStrv, \ NM_STRUCT_OFFSET_ENSURE_TYPE(NMValueStrv, \
private_struct_type, \ private_struct_type, \

View File

@@ -1717,6 +1717,7 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST, NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST,
PROP_MAC_ADDRESS_BLACKLIST, PROP_MAC_ADDRESS_BLACKLIST,
NM_SETTING_PARAM_FUZZY_IGNORE, NM_SETTING_PARAM_FUZZY_IGNORE,
NULL,
NMSettingWirelessPrivate, NMSettingWirelessPrivate,
mac_address_blacklist, mac_address_blacklist,
.direct_set_strv_normalize_hwaddr = TRUE, .direct_set_strv_normalize_hwaddr = TRUE,