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,
PROP_SECONDARIES,
NM_SETTING_PARAM_FUZZY_IGNORE,
NULL,
NMSettingConnectionPrivate,
secondaries);

View File

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

View File

@@ -869,36 +869,38 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
/*****************************************************************************/
#define _nm_setting_property_define_direct_strv(properties_override, \
obj_properties, \
prop_name, \
prop_id, \
param_flags, \
private_struct_type, \
private_struct_field, \
... /* extra NMSettInfoProperty fields */) \
({ \
GParamSpec *_param_spec; \
\
G_STATIC_ASSERT(!NM_FLAGS_ANY((param_flags), ~(NM_SETTING_PARAM_FUZZY_IGNORE))); \
\
_param_spec = g_param_spec_boxed("" prop_name "", \
"", \
"", \
G_TYPE_STRV, \
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY \
| G_PARAM_STATIC_STRINGS | (param_flags)); \
\
(obj_properties)[(prop_id)] = _param_spec; \
\
_nm_properties_override_gobj((properties_override), \
_param_spec, \
&nm_sett_info_propert_type_direct_strv, \
.direct_offset = \
NM_STRUCT_OFFSET_ENSURE_TYPE(NMValueStrv, \
private_struct_type, \
private_struct_field), \
__VA_ARGS__); \
#define _nm_setting_property_define_direct_strv(properties_override, \
obj_properties, \
prop_name, \
prop_id, \
param_flags, \
property_type, \
private_struct_type, \
private_struct_field, \
... /* extra NMSettInfoProperty fields */) \
({ \
GParamSpec *_param_spec; \
const NMSettInfoPropertType *_property_type; \
G_STATIC_ASSERT(!NM_FLAGS_ANY((param_flags), ~(NM_SETTING_PARAM_FUZZY_IGNORE))); \
\
_param_spec = g_param_spec_boxed("" prop_name "", \
"", \
"", \
G_TYPE_STRV, \
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY \
| G_PARAM_STATIC_STRINGS | (param_flags)); \
\
(obj_properties)[(prop_id)] = _param_spec; \
_property_type = (property_type) ?: &nm_sett_info_propert_type_direct_strv; \
\
_nm_properties_override_gobj((properties_override), \
_param_spec, \
_property_type, \
.direct_offset = \
NM_STRUCT_OFFSET_ENSURE_TYPE(NMValueStrv, \
private_struct_type, \
private_struct_field), \
__VA_ARGS__); \
})
/*****************************************************************************/

View File

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