libnm: rename direct_hook union in NMSettInfoProperty

direct_hook is a union, which currently only has one member (the set function
for a direct string). Extending this might make sense, for other set functions
(e.g. overwriting setting a strv array).

However, then the name was bad. The union is already for the set-function of
direct properties, it's not a place for various kinds of hooks (as it is
a union).

Rename.
This commit is contained in:
Thomas Haller 2023-12-11 10:31:14 +01:00
parent 2485a49a0d
commit ed97b1dc25
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
5 changed files with 14 additions and 14 deletions

View file

@ -1181,7 +1181,7 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
NM_SETTING_PARAM_NONE,
NMSettingIP6ConfigPrivate,
dhcp_pd_hint,
.direct_hook.set_string_fcn =
.direct_set_fcn.set_string =
_set_string_fcn_dhcp_pd_hint);
/* IP6-specific property overrides */

View file

@ -2362,7 +2362,7 @@ nm_setting_wireguard_class_init(NMSettingWireGuardClass *klass)
NM_SETTING_PARAM_SECRET,
NMSettingWireGuard,
_priv.private_key,
.direct_hook.set_string_fcn =
.direct_set_fcn.set_string =
_set_string_fcn_public_key);
/**

View file

@ -683,10 +683,10 @@ _property_direct_set_string(const NMSettInfoSetting *sett_info,
+ (!!property_info->direct_string_is_refstr)
+ (property_info->direct_set_string_mac_address_len > 0)
+ (property_info->direct_set_string_ip_address_addr_family != 0))
<= (property_info->direct_hook.set_string_fcn ? 0 : 1));
<= (property_info->direct_set_fcn.set_string ? 0 : 1));
if (property_info->direct_hook.set_string_fcn) {
return property_info->direct_hook.set_string_fcn(sett_info, property_info, setting, src);
if (property_info->direct_set_fcn.set_string) {
return property_info->direct_set_fcn.set_string(sett_info, property_info, setting, src);
}
dst = _nm_setting_get_private_field(setting, sett_info, property_info);

View file

@ -4565,7 +4565,7 @@ test_setting_metadata(void)
GArray *property_types_data;
guint prop_idx_val;
gboolean can_set_including_default = FALSE;
gboolean can_have_direct_hook = FALSE;
gboolean can_have_direct_set_fcn = FALSE;
int n_special_options;
g_assert(sip->name);
@ -4708,7 +4708,7 @@ test_setting_metadata(void)
g_assert(g_variant_type_equal(sip->property_type->dbus_type, "s"));
g_assert(sip->property_type->to_dbus_fcn
== _nm_setting_property_to_dbus_fcn_direct);
can_have_direct_hook = TRUE;
can_have_direct_set_fcn = TRUE;
}
g_assert(sip->param_spec);
g_assert(sip->param_spec->value_type == G_TYPE_STRING);
@ -4746,8 +4746,8 @@ test_setting_metadata(void)
g_assert(sip->property_type->direct_type == NM_VALUE_TYPE_STRING);
}
if (!can_have_direct_hook)
g_assert(!sip->direct_hook.set_string_fcn);
if (!can_have_direct_set_fcn)
g_assert(!sip->direct_set_fcn.set_string);
n_special_options = (sip->direct_set_string_mac_address_len != 0)
+ (!!sip->direct_set_string_strip)

View file

@ -778,11 +778,11 @@ struct _NMSettInfoProperty {
union {
/* Optional hook for direct string properties, this gets called when setting the string.
* Return whether the value changed. */
gboolean (*set_string_fcn)(const NMSettInfoSetting *sett_info,
const NMSettInfoProperty *property_info,
NMSetting *setting,
const char *src);
} direct_hook;
gboolean (*set_string)(const NMSettInfoSetting *sett_info,
const NMSettInfoProperty *property_info,
NMSetting *setting,
const char *src);
} direct_set_fcn;
/* This only has meaning for direct properties (property_type->direct_type != NM_VALUE_TYPE_UNSPEC).
* In that case, this is the offset where _nm_setting_get_private() can find