mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 14:48:10 +02:00
libnm: move NMSettInfoProperty.to_dbus_including_default flag
The "to_dbus_data" existed for namespacing the properties inside it. However, such a struct adds overhead due to the alignment that it enforces. We can share the memory needed for the bitfield by having them beside each other.
This commit is contained in:
parent
9a05db61d6
commit
36f552c5ca
4 changed files with 11 additions and 13 deletions
|
|
@ -1383,7 +1383,7 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
|
||||||
NM_SETTING_PARAM_NONE,
|
NM_SETTING_PARAM_NONE,
|
||||||
NMSettingWiredPrivate,
|
NMSettingWiredPrivate,
|
||||||
auto_negotiate,
|
auto_negotiate,
|
||||||
.to_dbus_data.including_default = TRUE);
|
.to_dbus_including_default = TRUE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NMSettingWired:mac-address:
|
* NMSettingWired:mac-address:
|
||||||
|
|
|
||||||
|
|
@ -886,7 +886,7 @@ _nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting *
|
||||||
gboolean val;
|
gboolean val;
|
||||||
|
|
||||||
val = *((bool *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset));
|
val = *((bool *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset));
|
||||||
if (!property_info->to_dbus_data.including_default
|
if (!property_info->to_dbus_including_default
|
||||||
&& val == NM_G_PARAM_SPEC_GET_DEFAULT_BOOLEAN(property_info->param_spec))
|
&& val == NM_G_PARAM_SPEC_GET_DEFAULT_BOOLEAN(property_info->param_spec))
|
||||||
return NULL;
|
return NULL;
|
||||||
return g_variant_ref(nm_g_variant_singleton_b(val));
|
return g_variant_ref(nm_g_variant_singleton_b(val));
|
||||||
|
|
@ -897,7 +897,7 @@ _nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting *
|
||||||
|
|
||||||
val = *(
|
val = *(
|
||||||
(guint32 *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset));
|
(guint32 *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset));
|
||||||
if (!property_info->to_dbus_data.including_default
|
if (!property_info->to_dbus_including_default
|
||||||
&& val == NM_G_PARAM_SPEC_GET_DEFAULT_UINT(property_info->param_spec))
|
&& val == NM_G_PARAM_SPEC_GET_DEFAULT_UINT(property_info->param_spec))
|
||||||
return NULL;
|
return NULL;
|
||||||
return g_variant_new_uint32(val);
|
return g_variant_new_uint32(val);
|
||||||
|
|
@ -912,7 +912,7 @@ _nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting *
|
||||||
* Setting "including_default" for a string makes no sense because a
|
* Setting "including_default" for a string makes no sense because a
|
||||||
* GVariant of type "s" cannot express NULL. */
|
* GVariant of type "s" cannot express NULL. */
|
||||||
nm_assert(!NM_G_PARAM_SPEC_GET_DEFAULT_STRING(property_info->param_spec));
|
nm_assert(!NM_G_PARAM_SPEC_GET_DEFAULT_STRING(property_info->param_spec));
|
||||||
nm_assert(!property_info->to_dbus_data.including_default);
|
nm_assert(!property_info->to_dbus_including_default);
|
||||||
|
|
||||||
val = *((const char *const *) _nm_setting_get_private(setting,
|
val = *((const char *const *) _nm_setting_get_private(setting,
|
||||||
sett_info,
|
sett_info,
|
||||||
|
|
@ -948,7 +948,7 @@ _nm_setting_property_to_dbus_fcn_gprop(const NMSettInfoSetting * s
|
||||||
|
|
||||||
g_object_get_property(G_OBJECT(setting), property_info->param_spec->name, &prop_value);
|
g_object_get_property(G_OBJECT(setting), property_info->param_spec->name, &prop_value);
|
||||||
|
|
||||||
if (!property_info->to_dbus_data.including_default
|
if (!property_info->to_dbus_including_default
|
||||||
&& g_param_value_defaults(property_info->param_spec, &prop_value))
|
&& g_param_value_defaults(property_info->param_spec, &prop_value))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4512,7 +4512,7 @@ check_done:;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!can_set_including_default)
|
if (!can_set_including_default)
|
||||||
g_assert(!sip->to_dbus_data.including_default);
|
g_assert(!sip->to_dbus_including_default);
|
||||||
|
|
||||||
g_assert(!sip->property_type->from_dbus_fcn
|
g_assert(!sip->property_type->from_dbus_fcn
|
||||||
|| !sip->property_type->gprop_from_dbus_fcn);
|
|| !sip->property_type->gprop_from_dbus_fcn);
|
||||||
|
|
|
||||||
|
|
@ -744,13 +744,11 @@ struct _NMSettInfoProperty {
|
||||||
* except of marking those properties and serve as a reminder that special care needs to be taken. */
|
* except of marking those properties and serve as a reminder that special care needs to be taken. */
|
||||||
bool direct_has_special_setter : 1;
|
bool direct_has_special_setter : 1;
|
||||||
|
|
||||||
struct {
|
/* Usually, properties that are set to the default value for the GParamSpec
|
||||||
/* Usually, properties that are set to the default value for the GParamSpec
|
* are not serialized to GVariant (and NULL is returned by to_dbus_data().
|
||||||
* are not serialized to GVariant (and NULL is returned by to_dbus_data().
|
* Set this flag to force always converting the property even if the value
|
||||||
* Set this flag to force always converting the property even if the value
|
* is the default. */
|
||||||
* is the default. */
|
bool to_dbus_including_default : 1;
|
||||||
bool including_default : 1;
|
|
||||||
} to_dbus_data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue