summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-07-12 14:01:47 +0200
committerThomas Haller <thaller@redhat.com>2021-07-12 14:01:47 +0200
commitfdea09a2d1b6c0a4217e7c6550c4084a10cf9101 (patch)
treebe54f570ac88bd5912526ec8723b508f7e3e9eb5
parentc2e46b7786442cc5ce577d5f60588369625f300e (diff)
parent4c9fa15e39b468d33eeab53c0c4635bca1f993dd (diff)
downloadNetworkManager-fdea09a2d1b6c0a4217e7c6550c4084a10cf9101.tar.gz
libnm: merge branch 'th/setting-direct-properties'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/910
-rw-r--r--src/libnm-core-impl/nm-keyfile.c4
-rw-r--r--src/libnm-core-impl/nm-setting-6lowpan.c76
-rw-r--r--src/libnm-core-impl/nm-setting-8021x.c43
-rw-r--r--src/libnm-core-impl/nm-setting-adsl.c69
-rw-r--r--src/libnm-core-impl/nm-setting-bluetooth.c9
-rw-r--r--src/libnm-core-impl/nm-setting-bond.c9
-rw-r--r--src/libnm-core-impl/nm-setting-bridge-port.c26
-rw-r--r--src/libnm-core-impl/nm-setting-bridge.c117
-rw-r--r--src/libnm-core-impl/nm-setting-cdma.c2
-rw-r--r--src/libnm-core-impl/nm-setting-connection.c160
-rw-r--r--src/libnm-core-impl/nm-setting-dcb.c9
-rw-r--r--src/libnm-core-impl/nm-setting-dummy.c2
-rw-r--r--src/libnm-core-impl/nm-setting-ethtool.c5
-rw-r--r--src/libnm-core-impl/nm-setting-generic.c2
-rw-r--r--src/libnm-core-impl/nm-setting-gsm.c43
-rw-r--r--src/libnm-core-impl/nm-setting-hostname.c2
-rw-r--r--src/libnm-core-impl/nm-setting-infiniband.c9
-rw-r--r--src/libnm-core-impl/nm-setting-ip-config.c159
-rw-r--r--src/libnm-core-impl/nm-setting-ip-tunnel.c97
-rw-r--r--src/libnm-core-impl/nm-setting-ip4-config.c67
-rw-r--r--src/libnm-core-impl/nm-setting-ip6-config.c48
-rw-r--r--src/libnm-core-impl/nm-setting-macsec.c45
-rw-r--r--src/libnm-core-impl/nm-setting-macvlan.c49
-rw-r--r--src/libnm-core-impl/nm-setting-match.c2
-rw-r--r--src/libnm-core-impl/nm-setting-olpc-mesh.c9
-rw-r--r--src/libnm-core-impl/nm-setting-ovs-bridge.c60
-rw-r--r--src/libnm-core-impl/nm-setting-ovs-dpdk.c2
-rw-r--r--src/libnm-core-impl/nm-setting-ovs-external-ids.c9
-rw-r--r--src/libnm-core-impl/nm-setting-ovs-interface.c2
-rw-r--r--src/libnm-core-impl/nm-setting-ovs-patch.c2
-rw-r--r--src/libnm-core-impl/nm-setting-ovs-port.c2
-rw-r--r--src/libnm-core-impl/nm-setting-ppp.c468
-rw-r--r--src/libnm-core-impl/nm-setting-pppoe.c2
-rw-r--r--src/libnm-core-impl/nm-setting-private.h381
-rw-r--r--src/libnm-core-impl/nm-setting-proxy.c26
-rw-r--r--src/libnm-core-impl/nm-setting-serial.c9
-rw-r--r--src/libnm-core-impl/nm-setting-sriov.c9
-rw-r--r--src/libnm-core-impl/nm-setting-tc-config.c9
-rw-r--r--src/libnm-core-impl/nm-setting-team-port.c9
-rw-r--r--src/libnm-core-impl/nm-setting-team.c9
-rw-r--r--src/libnm-core-impl/nm-setting-tun.c60
-rw-r--r--src/libnm-core-impl/nm-setting-user.c9
-rw-r--r--src/libnm-core-impl/nm-setting-veth.c2
-rw-r--r--src/libnm-core-impl/nm-setting-vlan.c9
-rw-r--r--src/libnm-core-impl/nm-setting-vpn.c35
-rw-r--r--src/libnm-core-impl/nm-setting-vrf.c64
-rw-r--r--src/libnm-core-impl/nm-setting-vxlan.c96
-rw-r--r--src/libnm-core-impl/nm-setting-wifi-p2p.c2
-rw-r--r--src/libnm-core-impl/nm-setting-wimax.c9
-rw-r--r--src/libnm-core-impl/nm-setting-wired.c93
-rw-r--r--src/libnm-core-impl/nm-setting-wireguard.c27
-rw-r--r--src/libnm-core-impl/nm-setting-wireless-security.c9
-rw-r--r--src/libnm-core-impl/nm-setting-wireless.c26
-rw-r--r--src/libnm-core-impl/nm-setting-wpan.c2
-rw-r--r--src/libnm-core-impl/nm-setting.c546
-rw-r--r--src/libnm-core-impl/tests/test-setting.c145
-rw-r--r--src/libnm-core-intern/nm-core-internal.h59
-rw-r--r--src/libnm-glib-aux/nm-json-aux.h55
-rw-r--r--src/libnm-glib-aux/nm-value-type.h40
59 files changed, 1994 insertions, 1356 deletions
diff --git a/src/libnm-core-impl/nm-keyfile.c b/src/libnm-core-impl/nm-keyfile.c
index c6c4a2eb57..a58c76db6a 100644
--- a/src/libnm-core-impl/nm-keyfile.c
+++ b/src/libnm-core-impl/nm-keyfile.c
@@ -3351,7 +3351,7 @@ _read_setting(KeyfileReaderInfo *info)
gs_unref_object NMSetting *setting = NULL;
const char * alias;
GType type;
- guint i;
+ guint16 i;
alias = nm_keyfile_plugin_get_setting_name_for_alias(info->group);
if (!alias)
@@ -4088,7 +4088,7 @@ nm_keyfile_write(NMConnection * connection,
KeyfileWriterInfo info;
NMSetting ** settings;
int i;
- guint j;
+ guint16 j;
g_return_val_if_fail(NM_IS_CONNECTION(connection), NULL);
g_return_val_if_fail(!error || !*error, NULL);
diff --git a/src/libnm-core-impl/nm-setting-6lowpan.c b/src/libnm-core-impl/nm-setting-6lowpan.c
index c07fb38e69..fe7bf1c566 100644
--- a/src/libnm-core-impl/nm-setting-6lowpan.c
+++ b/src/libnm-core-impl/nm-setting-6lowpan.c
@@ -129,41 +129,6 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
/*****************************************************************************/
static void
-get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- NMSetting6Lowpan * setting = NM_SETTING_6LOWPAN(object);
- NMSetting6LowpanPrivate *priv = NM_SETTING_6LOWPAN_GET_PRIVATE(setting);
-
- switch (prop_id) {
- case PROP_PARENT:
- g_value_set_string(value, priv->parent);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
- break;
- }
-}
-
-static void
-set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- NMSetting6Lowpan * setting = NM_SETTING_6LOWPAN(object);
- NMSetting6LowpanPrivate *priv = NM_SETTING_6LOWPAN_GET_PRIVATE(setting);
-
- switch (prop_id) {
- case PROP_PARENT:
- g_free(priv->parent);
- priv->parent = g_value_dup_string(value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
- break;
- }
-}
-
-/*****************************************************************************/
-
-static void
nm_setting_6lowpan_init(NMSetting6Lowpan *setting)
{}
@@ -183,17 +148,6 @@ nm_setting_6lowpan_new(void)
}
static void
-finalize(GObject *object)
-{
- NMSetting6Lowpan * setting = NM_SETTING_6LOWPAN(object);
- NMSetting6LowpanPrivate *priv = NM_SETTING_6LOWPAN_GET_PRIVATE(setting);
-
- g_free(priv->parent);
-
- G_OBJECT_CLASS(nm_setting_6lowpan_parent_class)->finalize(object);
-}
-
-static void
nm_setting_6lowpan_class_init(NMSetting6LowpanClass *klass)
{
GObjectClass * object_class = G_OBJECT_CLASS(klass);
@@ -202,11 +156,11 @@ nm_setting_6lowpan_class_init(NMSetting6LowpanClass *klass)
g_type_class_add_private(klass, sizeof(NMSetting6LowpanPrivate));
- object_class->get_property = get_property;
- object_class->set_property = set_property;
- object_class->finalize = finalize;
+ object_class->get_property = _nm_setting_property_get_property_direct;
+ object_class->set_property = _nm_setting_property_set_property_direct;
- setting_class->verify = verify;
+ setting_class->verify = verify;
+ setting_class->finalize_direct = TRUE;
/**
* NMSetting6Lowpan:parent:
@@ -216,17 +170,19 @@ nm_setting_6lowpan_class_init(NMSetting6LowpanClass *klass)
*
* Since: 1.14
**/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_6LOWPAN_PARENT,
- PROP_PARENT,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_6lowpan_get_parent);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_6LOWPAN_PARENT,
+ PROP_PARENT,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSetting6LowpanPrivate,
+ parent);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_6LOWPAN,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_6LOWPAN,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-8021x.c b/src/libnm-core-impl/nm-setting-8021x.c
index 6ddbd68066..f5592c97a5 100644
--- a/src/libnm-core-impl/nm-setting-8021x.c
+++ b/src/libnm-core-impl/nm-setting-8021x.c
@@ -176,8 +176,8 @@ typedef struct {
NMSettingSecretFlags pin_flags;
NMSettingSecretFlags private_key_password_flags;
NMSettingSecretFlags phase2_private_key_password_flags;
- bool optional : 1;
- bool system_ca_certs : 1;
+ bool optional;
+ bool system_ca_certs;
} NMSetting8021xPrivate;
/**
@@ -4588,13 +4588,14 @@ nm_setting_802_1x_class_init(NMSetting8021xClass *klass)
* description: a boolean value.
* ---end---
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_802_1X_SYSTEM_CA_CERTS,
- PROP_SYSTEM_CA_CERTS,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_802_1x_get_system_ca_certs);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_802_1X_SYSTEM_CA_CERTS,
+ PROP_SYSTEM_CA_CERTS,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSetting8021xPrivate,
+ system_ca_certs);
/**
* NMSetting8021x:auth-timeout:
@@ -4638,18 +4639,20 @@ nm_setting_802_1x_class_init(NMSetting8021xClass *klass)
* description: whether the 802.1X authentication is optional
* ---end---
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_802_1X_OPTIONAL,
- PROP_OPTIONAL,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_802_1x_get_optional);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_802_1X_OPTIONAL,
+ PROP_OPTIONAL,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSetting8021xPrivate,
+ optional);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_802_1X,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_802_1X,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-adsl.c b/src/libnm-core-impl/nm-setting-adsl.c
index 9f45163dff..470753b1d0 100644
--- a/src/libnm-core-impl/nm-setting-adsl.c
+++ b/src/libnm-core-impl/nm-setting-adsl.c
@@ -370,24 +370,26 @@ nm_setting_adsl_class_init(NMSettingAdslClass *klass)
*
* Username used to authenticate with the ADSL service.
**/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_ADSL_USERNAME,
- PROP_USERNAME,
- NM_SETTING_PARAM_NONE,
- nm_setting_adsl_get_username);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_ADSL_USERNAME,
+ PROP_USERNAME,
+ NM_SETTING_PARAM_NONE,
+ NMSettingAdslPrivate,
+ username);
/**
* NMSettingAdsl:password:
*
* Password used to authenticate with the ADSL service.
**/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_ADSL_PASSWORD,
- PROP_PASSWORD,
- NM_SETTING_PARAM_SECRET,
- nm_setting_adsl_get_password);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_ADSL_PASSWORD,
+ PROP_PASSWORD,
+ NM_SETTING_PARAM_SECRET,
+ NMSettingAdslPrivate,
+ password);
/**
* NMSettingAdsl:password-flags:
@@ -407,24 +409,34 @@ nm_setting_adsl_class_init(NMSettingAdslClass *klass)
*
* ADSL connection protocol. Can be "pppoa", "pppoe" or "ipoatm".
**/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_ADSL_PROTOCOL,
- PROP_PROTOCOL,
- NM_SETTING_PARAM_NONE,
- nm_setting_adsl_get_protocol);
+ _nm_setting_property_define_direct_string(
+ properties_override,
+ obj_properties,
+ NM_SETTING_ADSL_PROTOCOL,
+ PROP_PROTOCOL,
+ NM_SETTING_PARAM_NONE,
+ NMSettingAdslPrivate,
+ protocol,
+ /* it's special, because set_property() calls g_ascii_strdown() on
+ * the string! */
+ .direct_has_special_setter = TRUE);
/**
* NMSettingAdsl:encapsulation:
*
* Encapsulation of ADSL connection. Can be "vcmux" or "llc".
**/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_ADSL_ENCAPSULATION,
- PROP_ENCAPSULATION,
- NM_SETTING_PARAM_NONE,
- nm_setting_adsl_get_encapsulation);
+ _nm_setting_property_define_direct_string(
+ properties_override,
+ obj_properties,
+ NM_SETTING_ADSL_ENCAPSULATION,
+ PROP_ENCAPSULATION,
+ NM_SETTING_PARAM_NONE,
+ NMSettingAdslPrivate,
+ encapsulation,
+ /* it's special, because set_property() calls g_ascii_strdown() on
+ * the string! */
+ .direct_has_special_setter = TRUE);
/**
* NMSettingAdsl:vpi:
@@ -454,8 +466,9 @@ nm_setting_adsl_class_init(NMSettingAdslClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_ADSL,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_ADSL,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-bluetooth.c b/src/libnm-core-impl/nm-setting-bluetooth.c
index 4bd91a691a..aa97e4dcb9 100644
--- a/src/libnm-core-impl/nm-setting-bluetooth.c
+++ b/src/libnm-core-impl/nm-setting-bluetooth.c
@@ -341,8 +341,9 @@ nm_setting_bluetooth_class_init(NMSettingBluetoothClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_BLUETOOTH,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_BLUETOOTH,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-bond.c b/src/libnm-core-impl/nm-setting-bond.c
index 252adc73b5..6ef85f633e 100644
--- a/src/libnm-core-impl/nm-setting-bond.c
+++ b/src/libnm-core-impl/nm-setting-bond.c
@@ -1231,8 +1231,9 @@ nm_setting_bond_class_init(NMSettingBondClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_BOND,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_BOND,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-bridge-port.c b/src/libnm-core-impl/nm-setting-bridge-port.c
index 33d0c00915..50be8452d1 100644
--- a/src/libnm-core-impl/nm-setting-bridge-port.c
+++ b/src/libnm-core-impl/nm-setting-bridge-port.c
@@ -36,7 +36,7 @@ typedef struct {
GPtrArray *vlans;
guint16 priority;
guint16 path_cost;
- bool hairpin_mode : 1;
+ bool hairpin_mode;
} NMSettingBridgePortPrivate;
/**
@@ -564,13 +564,14 @@ nm_setting_bridge_port_class_init(NMSettingBridgePortClass *klass)
* description: Hairpin mode of the bridge port.
* ---end---
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE,
- PROP_HAIRPIN_MODE,
- FALSE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_bridge_port_get_hairpin_mode);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE,
+ PROP_HAIRPIN_MODE,
+ FALSE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingBridgePortPrivate,
+ hairpin_mode);
/**
* NMSettingBridgePort:vlans: (type GPtrArray(NMBridgeVlan))
@@ -609,8 +610,9 @@ nm_setting_bridge_port_class_init(NMSettingBridgePortClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_BRIDGE_PORT,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_BRIDGE_PORT,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-bridge.c b/src/libnm-core-impl/nm-setting-bridge.c
index e987310f6f..4567a28f0a 100644
--- a/src/libnm-core-impl/nm-setting-bridge.c
+++ b/src/libnm-core-impl/nm-setting-bridge.c
@@ -77,12 +77,12 @@ typedef struct {
guint16 max_age;
guint16 vlan_default_pvid;
guint16 group_forward_mask;
- bool multicast_snooping : 1;
- bool vlan_filtering : 1;
- bool stp : 1;
- bool vlan_stats_enabled : 1;
- bool multicast_query_use_ifaddr : 1;
- bool multicast_querier : 1;
+ bool stp;
+ bool multicast_snooping;
+ bool vlan_filtering;
+ bool vlan_stats_enabled;
+ bool multicast_query_use_ifaddr;
+ bool multicast_querier;
} NMSettingBridgePrivate;
/**
@@ -1564,19 +1564,13 @@ nm_setting_bridge_init(NMSettingBridge *setting)
priv->multicast_last_member_interval = NM_BRIDGE_MULTICAST_LAST_MEMBER_INTERVAL_DEF;
priv->multicast_membership_interval = NM_BRIDGE_MULTICAST_MEMBERSHIP_INTERVAL_DEF;
priv->multicast_hash_max = NM_BRIDGE_MULTICAST_HASH_MAX_DEF;
- priv->multicast_snooping = NM_BRIDGE_MULTICAST_SNOOPING_DEF;
priv->priority = NM_BRIDGE_PRIORITY_DEF;
- priv->stp = NM_BRIDGE_STP_DEF;
priv->vlan_default_pvid = NM_BRIDGE_VLAN_DEFAULT_PVID_DEF;
priv->multicast_query_interval = NM_BRIDGE_MULTICAST_QUERY_INTERVAL_DEF;
priv->multicast_query_response_interval = NM_BRIDGE_MULTICAST_QUERY_RESPONSE_INTERVAL_DEF;
priv->multicast_querier_interval = NM_BRIDGE_MULTICAST_QUERIER_INTERVAL_DEF;
priv->multicast_startup_query_count = NM_BRIDGE_MULTICAST_STARTUP_QUERY_COUNT_DEF;
priv->multicast_startup_query_interval = NM_BRIDGE_MULTICAST_STARTUP_QUERY_INTERVAL_DEF;
-
- nm_assert(priv->multicast_querier == NM_BRIDGE_MULTICAST_QUERIER_DEF);
- nm_assert(priv->multicast_query_use_ifaddr == NM_BRIDGE_MULTICAST_QUERY_USE_IFADDR_DEF);
- nm_assert(priv->vlan_stats_enabled == NM_BRIDGE_VLAN_STATS_ENABLED_DEF);
}
/**
@@ -1672,13 +1666,14 @@ nm_setting_bridge_class_init(NMSettingBridgeClass *klass)
* description: Span tree protocol participation.
* ---end---
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_BRIDGE_STP,
- PROP_STP,
- NM_BRIDGE_STP_DEF,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_bridge_get_stp);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_BRIDGE_STP,
+ PROP_STP,
+ NM_BRIDGE_STP_DEF,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingBridgePrivate,
+ stp);
/**
* NMSettingBridge:priority:
@@ -1831,13 +1826,14 @@ nm_setting_bridge_class_init(NMSettingBridgeClass *klass)
* description: IGMP snooping support.
* ---end---
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_BRIDGE_MULTICAST_SNOOPING,
- PROP_MULTICAST_SNOOPING,
- NM_BRIDGE_MULTICAST_SNOOPING_DEF,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_bridge_get_multicast_snooping);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_BRIDGE_MULTICAST_SNOOPING,
+ PROP_MULTICAST_SNOOPING,
+ NM_BRIDGE_MULTICAST_SNOOPING_DEF,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingBridgePrivate,
+ multicast_snooping);
/**
* NMSettingBridge:vlan-filtering:
@@ -1854,13 +1850,14 @@ nm_setting_bridge_class_init(NMSettingBridgeClass *klass)
* description: VLAN filtering support.
* ---end---
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_BRIDGE_VLAN_FILTERING,
- PROP_VLAN_FILTERING,
- FALSE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_bridge_get_vlan_filtering);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_BRIDGE_VLAN_FILTERING,
+ PROP_VLAN_FILTERING,
+ FALSE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingBridgePrivate,
+ vlan_filtering);
/**
* NMSettingBridge:vlan-default-pvid:
@@ -2001,13 +1998,14 @@ nm_setting_bridge_class_init(NMSettingBridgeClass *klass)
*
* Since: 1.24
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_BRIDGE_VLAN_STATS_ENABLED,
- PROP_VLAN_STATS_ENABLED,
- NM_BRIDGE_VLAN_STATS_ENABLED_DEF,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_bridge_get_vlan_stats_enabled);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_BRIDGE_VLAN_STATS_ENABLED,
+ PROP_VLAN_STATS_ENABLED,
+ NM_BRIDGE_VLAN_STATS_ENABLED_DEF,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingBridgePrivate,
+ vlan_stats_enabled);
/**
* NMSettingBridge:multicast-router:
@@ -2052,13 +2050,14 @@ nm_setting_bridge_class_init(NMSettingBridgeClass *klass)
*
* Since: 1.24
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_BRIDGE_MULTICAST_QUERY_USE_IFADDR,
- PROP_MULTICAST_QUERY_USE_IFADDR,
- NM_BRIDGE_MULTICAST_QUERY_USE_IFADDR_DEF,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_bridge_get_multicast_query_use_ifaddr);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_BRIDGE_MULTICAST_QUERY_USE_IFADDR,
+ PROP_MULTICAST_QUERY_USE_IFADDR,
+ NM_BRIDGE_MULTICAST_QUERY_USE_IFADDR_DEF,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingBridgePrivate,
+ multicast_query_use_ifaddr);
/**
* NMSettingBridge:multicast-querier:
@@ -2075,13 +2074,14 @@ nm_setting_bridge_class_init(NMSettingBridgeClass *klass)
*
* Since: 1.24
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_BRIDGE_MULTICAST_QUERIER,
- PROP_MULTICAST_QUERIER,
- NM_BRIDGE_MULTICAST_QUERIER_DEF,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_bridge_get_multicast_querier);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_BRIDGE_MULTICAST_QUERIER,
+ PROP_MULTICAST_QUERIER,
+ NM_BRIDGE_MULTICAST_QUERIER_DEF,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingBridgePrivate,
+ multicast_querier);
/**
* NMSettingBridge:multicast-hash-max:
@@ -2301,8 +2301,9 @@ nm_setting_bridge_class_init(NMSettingBridgeClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_BRIDGE,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_BRIDGE,
+ NULL,
+ properties_override,
+ G_STRUCT_OFFSET(NMSettingBridge, _priv));
}
diff --git a/src/libnm-core-impl/nm-setting-cdma.c b/src/libnm-core-impl/nm-setting-cdma.c
index 6dc61e8385..ca81bf385c 100644
--- a/src/libnm-core-impl/nm-setting-cdma.c
+++ b/src/libnm-core-impl/nm-setting-cdma.c
@@ -370,5 +370,5 @@ nm_setting_cdma_class_init(NMSettingCdmaClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_CDMA);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_CDMA, NULL, NULL, 0);
}
diff --git a/src/libnm-core-impl/nm-setting-connection.c b/src/libnm-core-impl/nm-setting-connection.c
index 4441d965d9..869093f156 100644
--- a/src/libnm-core-impl/nm-setting-connection.c
+++ b/src/libnm-core-impl/nm-setting-connection.c
@@ -93,8 +93,8 @@ typedef struct {
NMSettingConnectionAutoconnectSlaves autoconnect_slaves;
NMMetered metered;
NMSettingConnectionLldp lldp;
- bool read_only : 1;
- bool autoconnect : 1;
+ bool autoconnect;
+ bool read_only;
} NMSettingConnectionPrivate;
/**
@@ -1801,7 +1801,6 @@ nm_setting_connection_init(NMSettingConnection *setting)
NMSettingConnectionPrivate *priv = NM_SETTING_CONNECTION_GET_PRIVATE(setting);
priv->auth_retries = -1;
- priv->autoconnect = TRUE;
priv->autoconnect_priority = NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT;
priv->autoconnect_retries = -1;
priv->autoconnect_slaves = NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT;
@@ -1872,12 +1871,13 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* description: User friendly name for the connection profile.
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_CONNECTION_ID,
- PROP_ID,
- NM_SETTING_PARAM_FUZZY_IGNORE,
- nm_setting_connection_get_id);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_CONNECTION_ID,
+ PROP_ID,
+ NM_SETTING_PARAM_FUZZY_IGNORE,
+ NMSettingConnectionPrivate,
+ id);
/**
* NMSettingConnection:uuid:
@@ -1902,12 +1902,13 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* creates the UUID itself (by hashing the filename).
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_CONNECTION_UUID,
- PROP_UUID,
- NM_SETTING_PARAM_FUZZY_IGNORE,
- nm_setting_connection_get_uuid);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_CONNECTION_UUID,
+ PROP_UUID,
+ NM_SETTING_PARAM_FUZZY_IGNORE,
+ NMSettingConnectionPrivate,
+ uuid);
/**
* NMSettingConnection:stable-id:
@@ -1956,12 +1957,13 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* description: Token to generate stable IDs.
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_CONNECTION_STABLE_ID,
- PROP_STABLE_ID,
- NM_SETTING_PARAM_FUZZY_IGNORE,
- nm_setting_connection_get_stable_id);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_CONNECTION_STABLE_ID,
+ PROP_STABLE_ID,
+ NM_SETTING_PARAM_FUZZY_IGNORE,
+ NMSettingConnectionPrivate,
+ stable_id);
/**
* NMSettingConnection:interface-name:
@@ -1986,17 +1988,19 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* can be required for some connection types.
* ---end---
*/
- _nm_setting_property_define_string_full(
+ _nm_setting_property_define_direct_string_full(
properties_override,
obj_properties,
NM_SETTING_CONNECTION_INTERFACE_NAME,
PROP_INTERFACE_NAME,
NM_SETTING_PARAM_INFERRABLE,
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_STRING,
- .to_dbus_fcn = _nm_setting_property_to_dbus_fcn_get_string,
+ .direct_type = NM_VALUE_TYPE_STRING,
+ .to_dbus_fcn = _nm_setting_property_to_dbus_fcn_direct,
.missing_from_dbus_fcn =
nm_setting_connection_no_interface_name),
- nm_setting_connection_get_interface_name);
+ NMSettingConnectionPrivate,
+ interface_name);
/**
* NMSettingConnection:type:
@@ -2016,12 +2020,13 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* example: TYPE=Ethernet; TYPE=Bond; TYPE=Bridge; DEVICETYPE=TeamPort
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_CONNECTION_TYPE,
- PROP_TYPE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_connection_get_connection_type);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_CONNECTION_TYPE,
+ PROP_TYPE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingConnectionPrivate,
+ type);
/**
* NMSettingConnection:permissions:
@@ -2078,13 +2083,14 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* description: Whether the connection should be autoconnected (not only while booting).
* ---end---
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_CONNECTION_AUTOCONNECT,
- PROP_AUTOCONNECT,
- TRUE,
- NM_SETTING_PARAM_FUZZY_IGNORE,
- nm_setting_connection_get_autoconnect);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_CONNECTION_AUTOCONNECT,
+ PROP_AUTOCONNECT,
+ TRUE,
+ NM_SETTING_PARAM_FUZZY_IGNORE,
+ NMSettingConnectionPrivate,
+ autoconnect);
/**
* NMSettingConnection:autoconnect-priority:
@@ -2199,13 +2205,14 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* service's D-Bus interface with the right privileges, or %TRUE if the
* connection is read-only and cannot be modified.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_CONNECTION_READ_ONLY,
- PROP_READ_ONLY,
- FALSE,
- NM_SETTING_PARAM_FUZZY_IGNORE,
- nm_setting_connection_get_read_only);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_CONNECTION_READ_ONLY,
+ PROP_READ_ONLY,
+ FALSE,
+ NM_SETTING_PARAM_FUZZY_IGNORE,
+ NMSettingConnectionPrivate,
+ read_only);
/**
* NMSettingConnection:zone:
@@ -2226,13 +2233,14 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* example: ZONE=Work
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_CONNECTION_ZONE,
- PROP_ZONE,
- NM_SETTING_PARAM_FUZZY_IGNORE
- | NM_SETTING_PARAM_REAPPLY_IMMEDIATELY,
- nm_setting_connection_get_zone);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_CONNECTION_ZONE,
+ PROP_ZONE,
+ NM_SETTING_PARAM_FUZZY_IGNORE
+ | NM_SETTING_PARAM_REAPPLY_IMMEDIATELY,
+ NMSettingConnectionPrivate,
+ zone);
/**
* NMSettingConnection:master:
@@ -2248,12 +2256,14 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* for compatibility with legacy tooling.
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_CONNECTION_MASTER,
- PROP_MASTER,
- NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_INFERRABLE,
- nm_setting_connection_get_master);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_CONNECTION_MASTER,
+ PROP_MASTER,
+ NM_SETTING_PARAM_FUZZY_IGNORE
+ | NM_SETTING_PARAM_INFERRABLE,
+ NMSettingConnectionPrivate,
+ master);
/**
* NMSettingConnection:slave-type:
@@ -2272,12 +2282,14 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* and BRIDGE_UUID for bridging.
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_CONNECTION_SLAVE_TYPE,
- PROP_SLAVE_TYPE,
- NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_INFERRABLE,
- nm_setting_connection_get_slave_type);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_CONNECTION_SLAVE_TYPE,
+ PROP_SLAVE_TYPE,
+ NM_SETTING_PARAM_FUZZY_IGNORE
+ | NM_SETTING_PARAM_INFERRABLE,
+ NMSettingConnectionPrivate,
+ slave_type);
/**
* NMSettingConnection:autoconnect-slaves:
@@ -2559,17 +2571,19 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* example: https://yourdevice.example.com/model.json
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_CONNECTION_MUD_URL,
- PROP_MUD_URL,
- NM_SETTING_PARAM_NONE,
- nm_setting_connection_get_mud_url);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_CONNECTION_MUD_URL,
+ PROP_MUD_URL,
+ NM_SETTING_PARAM_NONE,
+ NMSettingConnectionPrivate,
+ mud_url);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_CONNECTION,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_CONNECTION,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-dcb.c b/src/libnm-core-impl/nm-setting-dcb.c
index f9602c3bbf..fa666654c5 100644
--- a/src/libnm-core-impl/nm-setting-dcb.c
+++ b/src/libnm-core-impl/nm-setting-dcb.c
@@ -1282,8 +1282,9 @@ nm_setting_dcb_class_init(NMSettingDcbClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_DCB,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_DCB,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-dummy.c b/src/libnm-core-impl/nm-setting-dummy.c
index a998a27b14..bfc82aeaec 100644
--- a/src/libnm-core-impl/nm-setting-dummy.c
+++ b/src/libnm-core-impl/nm-setting-dummy.c
@@ -78,5 +78,5 @@ nm_setting_dummy_class_init(NMSettingDummyClass *klass)
setting_class->verify = verify;
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_DUMMY);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_DUMMY, NULL, NULL, 0);
}
diff --git a/src/libnm-core-impl/nm-setting-ethtool.c b/src/libnm-core-impl/nm-setting-ethtool.c
index abedcae3eb..901dab487f 100644
--- a/src/libnm-core-impl/nm-setting-ethtool.c
+++ b/src/libnm-core-impl/nm-setting-ethtool.c
@@ -407,11 +407,12 @@ nm_setting_ethtool_class_init(NMSettingEthtoolClass *klass)
setting_class->verify = verify;
- _nm_setting_class_commit_full(
+ _nm_setting_class_commit(
setting_class,
NM_META_SETTING_TYPE_ETHTOOL,
NM_SETT_INFO_SETT_DETAIL(.gendata_info =
NM_SETT_INFO_SETT_GENDATA(.get_variant_type =
get_variant_type, ), ),
- NULL);
+ NULL,
+ 0);
}
diff --git a/src/libnm-core-impl/nm-setting-generic.c b/src/libnm-core-impl/nm-setting-generic.c
index 0eff1ddf49..ce212554cf 100644
--- a/src/libnm-core-impl/nm-setting-generic.c
+++ b/src/libnm-core-impl/nm-setting-generic.c
@@ -74,5 +74,5 @@ nm_setting_generic_class_init(NMSettingGenericClass *klass)
g_type_class_add_private(klass, sizeof(NMSettingGenericPrivate));
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_GENERIC);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_GENERIC, NULL, NULL, 0);
}
diff --git a/src/libnm-core-impl/nm-setting-gsm.c b/src/libnm-core-impl/nm-setting-gsm.c
index a177f7fb8c..8b2749d9ae 100644
--- a/src/libnm-core-impl/nm-setting-gsm.c
+++ b/src/libnm-core-impl/nm-setting-gsm.c
@@ -51,8 +51,8 @@ typedef struct {
NMSettingSecretFlags password_flags;
NMSettingSecretFlags pin_flags;
guint32 mtu;
- bool auto_config : 1;
- bool home_only : 1;
+ bool auto_config;
+ bool home_only;
} NMSettingGsmPrivate;
/**
@@ -667,13 +667,14 @@ nm_setting_gsm_class_init(NMSettingGsmClass *klass)
*
* Since: 1.22
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_GSM_AUTO_CONFIG,
- PROP_AUTO_CONFIG,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_gsm_get_auto_config);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_GSM_AUTO_CONFIG,
+ PROP_AUTO_CONFIG,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingGsmPrivate,
+ auto_config);
/**
* NMSettingGsm:number:
@@ -794,13 +795,14 @@ nm_setting_gsm_class_init(NMSettingGsmClass *klass)
* When %TRUE, only connections to the home network will be allowed.
* Connections to roaming networks will not be made.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_GSM_HOME_ONLY,
- PROP_HOME_ONLY,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_gsm_get_home_only);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_GSM_HOME_ONLY,
+ PROP_HOME_ONLY,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingGsmPrivate,
+ home_only);
/**
* NMSettingGsm:device-id:
@@ -879,8 +881,9 @@ nm_setting_gsm_class_init(NMSettingGsmClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_GSM,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_GSM,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-hostname.c b/src/libnm-core-impl/nm-setting-hostname.c
index 248ae556e3..d002d70eab 100644
--- a/src/libnm-core-impl/nm-setting-hostname.c
+++ b/src/libnm-core-impl/nm-setting-hostname.c
@@ -335,5 +335,5 @@ nm_setting_hostname_class_init(NMSettingHostnameClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_HOSTNAME);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_HOSTNAME, NULL, NULL, 0);
}
diff --git a/src/libnm-core-impl/nm-setting-infiniband.c b/src/libnm-core-impl/nm-setting-infiniband.c
index 95dc7b6696..730b2d2649 100644
--- a/src/libnm-core-impl/nm-setting-infiniband.c
+++ b/src/libnm-core-impl/nm-setting-infiniband.c
@@ -530,8 +530,9 @@ nm_setting_infiniband_class_init(NMSettingInfinibandClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_INFINIBAND,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_INFINIBAND,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-ip-config.c b/src/libnm-core-impl/nm-setting-ip-config.c
index 2ae02eeb99..f1e0d7adce 100644
--- a/src/libnm-core-impl/nm-setting-ip-config.c
+++ b/src/libnm-core-impl/nm-setting-ip-config.c
@@ -3911,36 +3911,25 @@ NM_GOBJECT_PROPERTIES_DEFINE(NMSettingIPConfig,
PROP_DHCP_IAID,
PROP_DHCP_REJECT_SERVERS, );
-typedef struct {
- GPtrArray *dns; /* array of IP address strings */
- GPtrArray *dns_search; /* array of domain name strings */
- GPtrArray *dns_options; /* array of DNS options */
- GPtrArray *addresses; /* array of NMIPAddress */
- GPtrArray *routes; /* array of NMIPRoute */
- GPtrArray *routing_rules;
- GArray * dhcp_reject_servers;
- char * method;
- char * gateway;
- char * dhcp_hostname;
- char * dhcp_iaid;
- gint64 route_metric;
- guint dhcp_hostname_flags;
- int dns_priority;
- int dad_timeout;
- int dhcp_timeout;
- int required_timeout;
- guint32 route_table;
- bool ignore_auto_routes : 1;
- bool ignore_auto_dns : 1;
- bool dhcp_send_hostname : 1;
- bool never_default : 1;
- bool may_fail : 1;
-} NMSettingIPConfigPrivate;
-
G_DEFINE_ABSTRACT_TYPE(NMSettingIPConfig, nm_setting_ip_config, NM_TYPE_SETTING)
-#define NM_SETTING_IP_CONFIG_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfigPrivate))
+static inline NMSettingIPConfigPrivate *
+_NM_SETTING_IP_CONFIG_GET_PRIVATE(NMSettingIPConfig *self)
+{
+ NMSettingIPConfigClass *klass;
+
+ nm_assert(NM_IS_SETTING_IP_CONFIG(self));
+
+ klass = NM_SETTING_IP_CONFIG_GET_CLASS(self);
+
+ nm_assert(klass->private_offset < 0);
+
+ return (gpointer) (((char *) ((gpointer) self)) + klass->private_offset);
+}
+
+#define NM_SETTING_IP_CONFIG_GET_PRIVATE(self) \
+ _NM_SETTING_IP_CONFIG_GET_PRIVATE( \
+ NM_GOBJECT_CAST_NON_NULL(NMSettingIPConfig, self, NM_IS_SETTING_IP_CONFIG, NMSetting))
/*****************************************************************************/
@@ -5787,32 +5776,32 @@ _nm_sett_info_property_override_create_array_ip_config(void)
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_METHOD],
- &nm_sett_info_propert_type_string,
- .to_dbus_data.get_string =
- (const char *(*) (NMSetting *) ) nm_setting_ip_config_get_method);
+ &nm_sett_info_propert_type_direct_string,
+ .direct_offset = NM_STRUCT_OFFSET_ENSURE_TYPE(char *, NMSettingIPConfigPrivate, method));
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_GATEWAY],
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_STRING,
- .to_dbus_fcn = _nm_setting_property_to_dbus_fcn_get_string,
+ .direct_type = NM_VALUE_TYPE_STRING,
+ .to_dbus_fcn = _nm_setting_property_to_dbus_fcn_direct,
.from_dbus_fcn = ip_gateway_set),
- .to_dbus_data.get_string =
- (const char *(*) (NMSetting *) ) nm_setting_ip_config_get_gateway);
+ .direct_offset = NM_STRUCT_OFFSET_ENSURE_TYPE(char *, NMSettingIPConfigPrivate, gateway),
+ /* The property setter for the gateway performs some normalization and is special! */
+ .direct_has_special_setter = TRUE);
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_DHCP_HOSTNAME],
- &nm_sett_info_propert_type_string,
- .to_dbus_data.get_string =
- (const char *(*) (NMSetting *) ) nm_setting_ip_config_get_dhcp_hostname);
+ &nm_sett_info_propert_type_direct_string,
+ .direct_offset =
+ NM_STRUCT_OFFSET_ENSURE_TYPE(char *, NMSettingIPConfigPrivate, dhcp_hostname));
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_DHCP_IAID],
- &nm_sett_info_propert_type_string,
- .to_dbus_data.get_string =
- (const char *(*) (NMSetting *) ) nm_setting_ip_config_get_dhcp_iaid);
+ &nm_sett_info_propert_type_direct_string,
+ .direct_offset = NM_STRUCT_OFFSET_ENSURE_TYPE(char *, NMSettingIPConfigPrivate, dhcp_iaid));
/* ---dbus---
* property: routing-rules
@@ -5827,35 +5816,39 @@ _nm_sett_info_property_override_create_array_ip_config(void)
.to_dbus_fcn = _routing_rules_dbus_only_synth,
.from_dbus_fcn = _routing_rules_dbus_only_set, ));
- _nm_properties_override_gobj(properties_override,
- obj_properties[PROP_IGNORE_AUTO_ROUTES],
- &nm_sett_info_propert_type_boolean,
- .to_dbus_data.get_boolean = (gboolean(*)(
- NMSetting *)) nm_setting_ip_config_get_ignore_auto_routes);
-
- _nm_properties_override_gobj(properties_override,
- obj_properties[PROP_IGNORE_AUTO_DNS],
- &nm_sett_info_propert_type_boolean,
- .to_dbus_data.get_boolean = (gboolean(*)(
- NMSetting *)) nm_setting_ip_config_get_ignore_auto_dns);
-
- _nm_properties_override_gobj(properties_override,
- obj_properties[PROP_DHCP_SEND_HOSTNAME],
- &nm_sett_info_propert_type_boolean,
- .to_dbus_data.get_boolean = (gboolean(*)(
- NMSetting *)) nm_setting_ip_config_get_dhcp_send_hostname);
-
- _nm_properties_override_gobj(properties_override,
- obj_properties[PROP_NEVER_DEFAULT],
- &nm_sett_info_propert_type_boolean,
- .to_dbus_data.get_boolean = (gboolean(*)(
- NMSetting *)) nm_setting_ip_config_get_never_default);
-
- _nm_properties_override_gobj(properties_override,
- obj_properties[PROP_MAY_FAIL],
- &nm_sett_info_propert_type_boolean,
- .to_dbus_data.get_boolean =
- (gboolean(*)(NMSetting *)) nm_setting_ip_config_get_may_fail);
+ _nm_properties_override_gobj(
+ properties_override,
+ obj_properties[PROP_IGNORE_AUTO_ROUTES],
+ &nm_sett_info_propert_type_direct_boolean,
+ .direct_offset =
+ NM_STRUCT_OFFSET_ENSURE_TYPE(bool, NMSettingIPConfigPrivate, ignore_auto_routes));
+
+ _nm_properties_override_gobj(
+ properties_override,
+ obj_properties[PROP_IGNORE_AUTO_DNS],
+ &nm_sett_info_propert_type_direct_boolean,
+ .direct_offset =
+ NM_STRUCT_OFFSET_ENSURE_TYPE(bool, NMSettingIPConfigPrivate, ignore_auto_dns));
+
+ _nm_properties_override_gobj(
+ properties_override,
+ obj_properties[PROP_DHCP_SEND_HOSTNAME],
+ &nm_sett_info_propert_type_direct_boolean,
+ .direct_offset =
+ NM_STRUCT_OFFSET_ENSURE_TYPE(bool, NMSettingIPConfigPrivate, dhcp_send_hostname));
+
+ _nm_properties_override_gobj(
+ properties_override,
+ obj_properties[PROP_NEVER_DEFAULT],
+ &nm_sett_info_propert_type_direct_boolean,
+ .direct_offset =
+ NM_STRUCT_OFFSET_ENSURE_TYPE(bool, NMSettingIPConfigPrivate, never_default));
+
+ _nm_properties_override_gobj(
+ properties_override,
+ obj_properties[PROP_MAY_FAIL],
+ &nm_sett_info_propert_type_direct_boolean,
+ .direct_offset = NM_STRUCT_OFFSET_ENSURE_TYPE(bool, NMSettingIPConfigPrivate, may_fail));
return properties_override;
}
@@ -6065,20 +6058,24 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
/*****************************************************************************/
+void
+_nm_setting_ip_config_private_init(gpointer self, NMSettingIPConfigPrivate *priv)
+{
+ nm_assert(NM_IS_SETTING_IP_CONFIG(self));
+
+ priv->dns = g_ptr_array_new_with_free_func(g_free);
+ priv->dns_search = g_ptr_array_new_with_free_func(g_free);
+ priv->addresses = g_ptr_array_new_with_free_func((GDestroyNotify) nm_ip_address_unref);
+ priv->routes = g_ptr_array_new_with_free_func((GDestroyNotify) nm_ip_route_unref);
+ priv->route_metric = -1;
+ priv->dad_timeout = -1;
+ priv->required_timeout = -1;
+}
+
static void
nm_setting_ip_config_init(NMSettingIPConfig *setting)
{
- NMSettingIPConfigPrivate *priv = NM_SETTING_IP_CONFIG_GET_PRIVATE(setting);
-
- priv->dns = g_ptr_array_new_with_free_func(g_free);
- priv->dns_search = g_ptr_array_new_with_free_func(g_free);
- priv->addresses = g_ptr_array_new_with_free_func((GDestroyNotify) nm_ip_address_unref);
- priv->routes = g_ptr_array_new_with_free_func((GDestroyNotify) nm_ip_route_unref);
- priv->route_metric = -1;
- priv->dhcp_send_hostname = TRUE;
- priv->may_fail = TRUE;
- priv->dad_timeout = -1;
- priv->required_timeout = -1;
+ /* cannot yet access NM_SETTING_IP_CONFIG_GET_PRIVATE(). */
}
static void
@@ -6111,8 +6108,6 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass)
GObjectClass * object_class = G_OBJECT_CLASS(klass);
NMSettingClass *setting_class = NM_SETTING_CLASS(klass);
- g_type_class_add_private(klass, sizeof(NMSettingIPConfigPrivate));
-
object_class->get_property = get_property;
object_class->set_property = set_property;
object_class->finalize = finalize;
diff --git a/src/libnm-core-impl/nm-setting-ip-tunnel.c b/src/libnm-core-impl/nm-setting-ip-tunnel.c
index d87a59f4a8..f75ca1d5b7 100644
--- a/src/libnm-core-impl/nm-setting-ip-tunnel.c
+++ b/src/libnm-core-impl/nm-setting-ip-tunnel.c
@@ -44,7 +44,7 @@ typedef struct {
NMIPTunnelMode mode;
guint32 mtu;
guint32 flags;
- bool path_mtu_discovery : 1;
+ bool path_mtu_discovery;
} NMSettingIPTunnelPrivate;
/**
@@ -615,11 +615,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
static void
nm_setting_ip_tunnel_init(NMSettingIPTunnel *self)
-{
- NMSettingIPTunnelPrivate *priv = NM_SETTING_IP_TUNNEL_GET_PRIVATE(self);
-
- priv->path_mtu_discovery = TRUE;
-}
+{}
/**
* nm_setting_ip_tunnel_new:
@@ -675,12 +671,13 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_IP_TUNNEL_PARENT,
- PROP_PARENT,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_ip_tunnel_get_parent);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_IP_TUNNEL_PARENT,
+ PROP_PARENT,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingIPTunnelPrivate,
+ parent);
/**
* NMSettingIPTunnel:mode:
@@ -707,12 +704,13 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_IP_TUNNEL_LOCAL,
- PROP_LOCAL,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_ip_tunnel_get_local);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_IP_TUNNEL_LOCAL,
+ PROP_LOCAL,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingIPTunnelPrivate,
+ local);
/**
* NMSettingIPTunnel:remote:
@@ -722,12 +720,13 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_IP_TUNNEL_REMOTE,
- PROP_REMOTE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_ip_tunnel_get_remote);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_IP_TUNNEL_REMOTE,
+ PROP_REMOTE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingIPTunnelPrivate,
+ remote);
/**
* NMSettingIPTunnel:ttl
@@ -770,13 +769,14 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_IP_TUNNEL_PATH_MTU_DISCOVERY,
- PROP_PATH_MTU_DISCOVERY,
- TRUE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_ip_tunnel_get_path_mtu_discovery);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_IP_TUNNEL_PATH_MTU_DISCOVERY,
+ PROP_PATH_MTU_DISCOVERY,
+ TRUE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingIPTunnelPrivate,
+ path_mtu_discovery);
/**
* NMSettingIPTunnel:input-key:
@@ -786,12 +786,13 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_IP_TUNNEL_INPUT_KEY,
- PROP_INPUT_KEY,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_ip_tunnel_get_input_key);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_IP_TUNNEL_INPUT_KEY,
+ PROP_INPUT_KEY,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingIPTunnelPrivate,
+ input_key);
/**
* NMSettingIPTunnel:output-key:
@@ -801,12 +802,13 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_IP_TUNNEL_OUTPUT_KEY,
- PROP_OUTPUT_KEY,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_ip_tunnel_get_output_key);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_IP_TUNNEL_OUTPUT_KEY,
+ PROP_OUTPUT_KEY,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingIPTunnelPrivate,
+ output_key);
/**
* NMSettingIPTunnel:encapsulation-limit:
@@ -881,8 +883,9 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_IP_TUNNEL,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_IP_TUNNEL,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-ip4-config.c b/src/libnm-core-impl/nm-setting-ip4-config.c
index 15bae0cd40..4b6f92083d 100644
--- a/src/libnm-core-impl/nm-setting-ip4-config.c
+++ b/src/libnm-core-impl/nm-setting-ip4-config.c
@@ -40,6 +40,8 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_DHCP_CLIENT_ID,
PROP_DHCP_VENDOR_CLASS_IDENTIFIER, );
typedef struct {
+ NMSettingIPConfigPrivate parent;
+
char *dhcp_client_id;
char *dhcp_fqdn;
char *dhcp_vendor_class_identifier;
@@ -598,7 +600,11 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
static void
nm_setting_ip4_config_init(NMSettingIP4Config *setting)
-{}
+{
+ NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE(setting);
+
+ _nm_setting_ip_config_private_init(setting, &priv->parent);
+}
/**
* nm_setting_ip4_config_new:
@@ -628,11 +634,12 @@ finalize(GObject *object)
static void
nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass)
{
- GObjectClass * object_class = G_OBJECT_CLASS(klass);
- NMSettingClass *setting_class = NM_SETTING_CLASS(klass);
- GArray * properties_override = _nm_sett_info_property_override_create_array_ip_config();
+ GObjectClass * object_class = G_OBJECT_CLASS(klass);
+ NMSettingClass * setting_class = NM_SETTING_CLASS(klass);
+ NMSettingIPConfigClass *setting_ip_config_class = NM_SETTING_IP_CONFIG_CLASS(klass);
+ GArray *properties_override = _nm_sett_info_property_override_create_array_ip_config();
- g_type_class_add_private(setting_class, sizeof(NMSettingIP4ConfigPrivate));
+ g_type_class_add_private(klass, sizeof(NMSettingIP4ConfigPrivate));
object_class->get_property = get_property;
object_class->set_property = set_property;
@@ -640,6 +647,8 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass)
setting_class->verify = verify;
+ setting_ip_config_class->private_offset = g_type_class_get_instance_private_offset(klass);
+
/* ---ifcfg-rh---
* property: method
* variable: BOOTPROTO
@@ -847,12 +856,13 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass)
* example: DHCP_CLIENT_ID=ax-srv-1; DHCP_CLIENT_ID=01:44:44:44:44:44:44
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID,
- PROP_DHCP_CLIENT_ID,
- NM_SETTING_PARAM_NONE,
- nm_setting_ip4_config_get_dhcp_client_id);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID,
+ PROP_DHCP_CLIENT_ID,
+ NM_SETTING_PARAM_NONE,
+ NMSettingIP4ConfigPrivate,
+ dhcp_client_id);
/* ---ifcfg-rh---
* property: dad-timeout
@@ -898,12 +908,13 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass)
* example: DHCP_FQDN=foo.bar.com
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_IP4_CONFIG_DHCP_FQDN,
- PROP_DHCP_FQDN,
- NM_SETTING_PARAM_NONE,
- nm_setting_ip4_config_get_dhcp_fqdn);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_IP4_CONFIG_DHCP_FQDN,
+ PROP_DHCP_FQDN,
+ NM_SETTING_PARAM_NONE,
+ NMSettingIP4ConfigPrivate,
+ dhcp_fqdn);
/**
* NMSettingIP4Config:dhcp-vendor-class-identifier:
@@ -924,12 +935,13 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass)
* example: DHCP_VENDOR_CLASS_IDENTIFIER=foo
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_IP4_CONFIG_DHCP_VENDOR_CLASS_IDENTIFIER,
- PROP_DHCP_VENDOR_CLASS_IDENTIFIER,
- NM_SETTING_PARAM_NONE,
- nm_setting_ip4_config_get_dhcp_vendor_class_identifier);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_IP4_CONFIG_DHCP_VENDOR_CLASS_IDENTIFIER,
+ PROP_DHCP_VENDOR_CLASS_IDENTIFIER,
+ NM_SETTING_PARAM_NONE,
+ NMSettingIP4ConfigPrivate,
+ dhcp_vendor_class_identifier);
/* IP4-specific property overrides */
@@ -1052,8 +1064,9 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_IP4_CONFIG,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_IP4_CONFIG,
+ NULL,
+ properties_override,
+ setting_ip_config_class->private_offset);
}
diff --git a/src/libnm-core-impl/nm-setting-ip6-config.c b/src/libnm-core-impl/nm-setting-ip6-config.c
index f6d59a46d1..6e0e9897b7 100644
--- a/src/libnm-core-impl/nm-setting-ip6-config.c
+++ b/src/libnm-core-impl/nm-setting-ip6-config.c
@@ -45,6 +45,8 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_IP6_PRIVACY,
PROP_RA_TIMEOUT, );
typedef struct {
+ NMSettingIPConfigPrivate parent;
+
char * token;
char * dhcp_duid;
NMSettingIP6ConfigPrivacy ip6_privacy;
@@ -594,6 +596,8 @@ nm_setting_ip6_config_init(NMSettingIP6Config *setting)
{
NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting);
+ _nm_setting_ip_config_private_init(setting, &priv->parent);
+
priv->ip6_privacy = NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN;
priv->addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY;
}
@@ -626,9 +630,10 @@ finalize(GObject *object)
static void
nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
{
- GObjectClass * object_class = G_OBJECT_CLASS(klass);
- NMSettingClass *setting_class = NM_SETTING_CLASS(klass);
- GArray * properties_override = _nm_sett_info_property_override_create_array_ip_config();
+ GObjectClass * object_class = G_OBJECT_CLASS(klass);
+ NMSettingClass * setting_class = NM_SETTING_CLASS(klass);
+ NMSettingIPConfigClass *setting_ip_config_class = NM_SETTING_IP_CONFIG_CLASS(klass);
+ GArray *properties_override = _nm_sett_info_property_override_create_array_ip_config();
g_type_class_add_private(klass, sizeof(NMSettingIP6ConfigPrivate));
@@ -638,6 +643,8 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
setting_class->verify = verify;
+ setting_ip_config_class->private_offset = g_type_class_get_instance_private_offset(klass);
+
/* ---ifcfg-rh---
* property: method
* variable: IPV6INIT, IPV6FORWARDING, IPV6_AUTOCONF, DHCPV6C, IPV6_DISABLED
@@ -914,12 +921,13 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
* example: IPV6_TOKEN=::53
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_IP6_CONFIG_TOKEN,
- PROP_TOKEN,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_ip6_config_get_token);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_IP6_CONFIG_TOKEN,
+ PROP_TOKEN,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingIP6ConfigPrivate,
+ token);
/**
* NMSettingIP6Config:ra-timeout:
@@ -994,12 +1002,13 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
* example: DHCPV6_DUID=LL; DHCPV6_DUID=0301deadbeef0001; DHCPV6_DUID=03:01:de:ad:be:ef:00:01
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_IP6_CONFIG_DHCP_DUID,
- PROP_DHCP_DUID,
- NM_SETTING_PARAM_NONE,
- nm_setting_ip6_config_get_dhcp_duid);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_IP6_CONFIG_DHCP_DUID,
+ PROP_DHCP_DUID,
+ NM_SETTING_PARAM_NONE,
+ NMSettingIP6ConfigPrivate,
+ dhcp_duid);
/* IP6-specific property overrides */
@@ -1096,8 +1105,9 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_IP6_CONFIG,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_IP6_CONFIG,
+ NULL,
+ properties_override,
+ setting_ip_config_class->private_offset);
}
diff --git a/src/libnm-core-impl/nm-setting-macsec.c b/src/libnm-core-impl/nm-setting-macsec.c
index 55024bb4c2..1a9e9bd8ab 100644
--- a/src/libnm-core-impl/nm-setting-macsec.c
+++ b/src/libnm-core-impl/nm-setting-macsec.c
@@ -45,8 +45,8 @@ typedef struct {
NMSettingMacsecMode mode;
NMSettingSecretFlags mka_cak_flags;
NMSettingMacsecValidation validation;
- bool encrypt : 1;
- bool send_sci : 1;
+ bool encrypt;
+ bool send_sci;
} NMSettingMacsecPrivate;
/**
@@ -492,9 +492,7 @@ nm_setting_macsec_init(NMSettingMacsec *self)
NMSettingMacsecPrivate *priv = NM_SETTING_MACSEC_GET_PRIVATE(self);
nm_assert(priv->mode == NM_SETTING_MACSEC_MODE_PSK);
- priv->encrypt = TRUE;
priv->port = 1;
- priv->send_sci = TRUE;
priv->validation = NM_SETTING_MACSEC_VALIDATION_STRICT;
}
@@ -583,13 +581,14 @@ nm_setting_macsec_class_init(NMSettingMacsecClass *klass)
*
* Since: 1.6
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_MACSEC_ENCRYPT,
- PROP_ENCRYPT,
- TRUE,
- NM_SETTING_PARAM_NONE,
- nm_setting_macsec_get_encrypt);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_MACSEC_ENCRYPT,
+ PROP_ENCRYPT,
+ TRUE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingMacsecPrivate,
+ encrypt);
/**
* NMSettingMacsec:mka-cak:
@@ -676,18 +675,20 @@ nm_setting_macsec_class_init(NMSettingMacsecClass *klass)
*
* Since: 1.12
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_MACSEC_SEND_SCI,
- PROP_SEND_SCI,
- TRUE,
- NM_SETTING_PARAM_NONE,
- nm_setting_macsec_get_send_sci);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_MACSEC_SEND_SCI,
+ PROP_SEND_SCI,
+ TRUE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingMacsecPrivate,
+ send_sci);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_MACSEC,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_MACSEC,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-macvlan.c b/src/libnm-core-impl/nm-setting-macvlan.c
index 9cb2b2621f..32b30c2cfa 100644
--- a/src/libnm-core-impl/nm-setting-macvlan.c
+++ b/src/libnm-core-impl/nm-setting-macvlan.c
@@ -30,8 +30,8 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_PARENT, PROP_MODE, PROP_PROMISCUOUS, PROP
typedef struct {
char * parent;
NMSettingMacvlanMode mode;
- bool promiscuous : 1;
- bool tap : 1;
+ bool promiscuous;
+ bool tap;
} NMSettingMacvlanPrivate;
/**
@@ -234,11 +234,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
static void
nm_setting_macvlan_init(NMSettingMacvlan *self)
-{
- NMSettingMacvlanPrivate *priv = NM_SETTING_MACVLAN_GET_PRIVATE(self);
-
- priv->promiscuous = TRUE;
-}
+{}
/**
* nm_setting_macvlan_new:
@@ -322,13 +318,14 @@ nm_setting_macvlan_class_init(NMSettingMacvlanClass *klass)
*
* Since: 1.2
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_MACVLAN_PROMISCUOUS,
- PROP_PROMISCUOUS,
- TRUE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_macvlan_get_promiscuous);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_MACVLAN_PROMISCUOUS,
+ PROP_PROMISCUOUS,
+ TRUE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingMacvlanPrivate,
+ promiscuous);
/**
* NMSettingMacvlan:tap:
@@ -337,18 +334,20 @@ nm_setting_macvlan_class_init(NMSettingMacvlanClass *klass)
*
* Since: 1.2
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_MACVLAN_TAP,
- PROP_TAP,
- FALSE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_macvlan_get_tap);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_MACVLAN_TAP,
+ PROP_TAP,
+ FALSE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingMacvlanPrivate,
+ tap);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_MACVLAN,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_MACVLAN,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-match.c b/src/libnm-core-impl/nm-setting-match.c
index e4f7c1a810..20c6b798e6 100644
--- a/src/libnm-core-impl/nm-setting-match.c
+++ b/src/libnm-core-impl/nm-setting-match.c
@@ -901,5 +901,5 @@ nm_setting_match_class_init(NMSettingMatchClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_MATCH);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_MATCH, NULL, NULL, 0);
}
diff --git a/src/libnm-core-impl/nm-setting-olpc-mesh.c b/src/libnm-core-impl/nm-setting-olpc-mesh.c
index 103f619519..ce7bdf1fb7 100644
--- a/src/libnm-core-impl/nm-setting-olpc-mesh.c
+++ b/src/libnm-core-impl/nm-setting-olpc-mesh.c
@@ -285,8 +285,9 @@ nm_setting_olpc_mesh_class_init(NMSettingOlpcMeshClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_OLPC_MESH,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_OLPC_MESH,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-ovs-bridge.c b/src/libnm-core-impl/nm-setting-ovs-bridge.c
index 22738d204d..711d5461c1 100644
--- a/src/libnm-core-impl/nm-setting-ovs-bridge.c
+++ b/src/libnm-core-impl/nm-setting-ovs-bridge.c
@@ -37,9 +37,9 @@ struct _NMSettingOvsBridge {
char *fail_mode;
char *datapath_type;
- bool mcast_snooping_enable : 1;
- bool rstp_enable : 1;
- bool stp_enable : 1;
+ bool mcast_snooping_enable;
+ bool rstp_enable;
+ bool stp_enable;
};
struct _NMSettingOvsBridgeClass {
@@ -320,13 +320,14 @@ nm_setting_ovs_bridge_class_init(NMSettingOvsBridgeClass *klass)
*
* Since: 1.10
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE,
- PROP_MCAST_SNOOPING_ENABLE,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_ovs_bridge_get_mcast_snooping_enable);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE,
+ PROP_MCAST_SNOOPING_ENABLE,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingOvsBridge,
+ mcast_snooping_enable);
/**
* NMSettingOvsBridge:rstp-enable:
@@ -335,13 +336,14 @@ nm_setting_ovs_bridge_class_init(NMSettingOvsBridgeClass *klass)
*
* Since: 1.10
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_OVS_BRIDGE_RSTP_ENABLE,
- PROP_RSTP_ENABLE,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_ovs_bridge_get_rstp_enable);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_OVS_BRIDGE_RSTP_ENABLE,
+ PROP_RSTP_ENABLE,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingOvsBridge,
+ rstp_enable);
/**
* NMSettingOvsBridge:stp-enable:
@@ -350,13 +352,14 @@ nm_setting_ovs_bridge_class_init(NMSettingOvsBridgeClass *klass)
*
* Since: 1.10
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_OVS_BRIDGE_STP_ENABLE,
- PROP_STP_ENABLE,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_ovs_bridge_get_stp_enable);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_OVS_BRIDGE_STP_ENABLE,
+ PROP_STP_ENABLE,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingOvsBridge,
+ stp_enable);
/**
* NMSettingOvsBridge:datapath-type:
@@ -374,8 +377,9 @@ nm_setting_ovs_bridge_class_init(NMSettingOvsBridgeClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_OVS_BRIDGE,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_OVS_BRIDGE,
+ NULL,
+ properties_override,
+ 0);
}
diff --git a/src/libnm-core-impl/nm-setting-ovs-dpdk.c b/src/libnm-core-impl/nm-setting-ovs-dpdk.c
index 957b0f5716..3107531b27 100644
--- a/src/libnm-core-impl/nm-setting-ovs-dpdk.c
+++ b/src/libnm-core-impl/nm-setting-ovs-dpdk.c
@@ -148,5 +148,5 @@ nm_setting_ovs_dpdk_class_init(NMSettingOvsDpdkClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_OVS_DPDK);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_OVS_DPDK, NULL, NULL, 0);
}
diff --git a/src/libnm-core-impl/nm-setting-ovs-external-ids.c b/src/libnm-core-impl/nm-setting-ovs-external-ids.c
index b73c1af497..d8f41a5919 100644
--- a/src/libnm-core-impl/nm-setting-ovs-external-ids.c
+++ b/src/libnm-core-impl/nm-setting-ovs-external-ids.c
@@ -544,8 +544,9 @@ nm_setting_ovs_external_ids_class_init(NMSettingOvsExternalIDsClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_OVS_EXTERNAL_IDS,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_OVS_EXTERNAL_IDS,
+ NULL,
+ properties_override,
+ G_STRUCT_OFFSET(NMSettingOvsExternalIDs, _priv));
}
diff --git a/src/libnm-core-impl/nm-setting-ovs-interface.c b/src/libnm-core-impl/nm-setting-ovs-interface.c
index 1fde96050a..58a01fcc4c 100644
--- a/src/libnm-core-impl/nm-setting-ovs-interface.c
+++ b/src/libnm-core-impl/nm-setting-ovs-interface.c
@@ -423,5 +423,5 @@ nm_setting_ovs_interface_class_init(NMSettingOvsInterfaceClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_OVS_INTERFACE);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_OVS_INTERFACE, NULL, NULL, 0);
}
diff --git a/src/libnm-core-impl/nm-setting-ovs-patch.c b/src/libnm-core-impl/nm-setting-ovs-patch.c
index a226a26d47..578f5ee247 100644
--- a/src/libnm-core-impl/nm-setting-ovs-patch.c
+++ b/src/libnm-core-impl/nm-setting-ovs-patch.c
@@ -184,5 +184,5 @@ nm_setting_ovs_patch_class_init(NMSettingOvsPatchClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_OVS_PATCH);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_OVS_PATCH, NULL, NULL, 0);
}
diff --git a/src/libnm-core-impl/nm-setting-ovs-port.c b/src/libnm-core-impl/nm-setting-ovs-port.c
index 821f29ab14..a5d92019be 100644
--- a/src/libnm-core-impl/nm-setting-ovs-port.c
+++ b/src/libnm-core-impl/nm-setting-ovs-port.c
@@ -463,5 +463,5 @@ nm_setting_ovs_port_class_init(NMSettingOvsPortClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_OVS_PORT);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_OVS_PORT, NULL, NULL, 0);
}
diff --git a/src/libnm-core-impl/nm-setting-ppp.c b/src/libnm-core-impl/nm-setting-ppp.c
index cc722c4456..83708515ce 100644
--- a/src/libnm-core-impl/nm-setting-ppp.c
+++ b/src/libnm-core-impl/nm-setting-ppp.c
@@ -47,19 +47,19 @@ typedef struct {
guint32 mtu;
guint32 lcp_echo_failure;
guint32 lcp_echo_interval;
- bool noauth : 1;
- bool refuse_eap : 1;
- bool refuse_pap : 1;
- bool refuse_chap : 1;
- bool refuse_mschap : 1;
- bool refuse_mschapv2 : 1;
- bool nobsdcomp : 1;
- bool nodeflate : 1;
- bool no_vj_comp : 1;
- bool require_mppe : 1;
- bool require_mppe_128 : 1;
- bool mppe_stateful : 1;
- bool crtscts : 1;
+ bool noauth;
+ bool refuse_eap;
+ bool refuse_pap;
+ bool refuse_chap;
+ bool refuse_mschap;
+ bool refuse_mschapv2;
+ bool nobsdcomp;
+ bool nodeflate;
+ bool no_vj_comp;
+ bool require_mppe;
+ bool require_mppe_128;
+ bool mppe_stateful;
+ bool crtscts;
} NMSettingPppPrivate;
/**
@@ -337,6 +337,8 @@ nm_setting_ppp_get_lcp_echo_interval(NMSettingPpp *setting)
return NM_SETTING_PPP_GET_PRIVATE(setting)->lcp_echo_interval;
}
+/*****************************************************************************/
+
static gboolean
verify(NMSetting *setting, NMConnection *connection, GError **error)
{
@@ -377,146 +379,8 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
/*****************************************************************************/
static void
-get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- NMSettingPpp *setting = NM_SETTING_PPP(object);
-
- switch (prop_id) {
- case PROP_NOAUTH:
- g_value_set_boolean(value, nm_setting_ppp_get_noauth(setting));
- break;
- case PROP_REFUSE_EAP:
- g_value_set_boolean(value, nm_setting_ppp_get_refuse_eap(setting));
- break;
- case PROP_REFUSE_PAP:
- g_value_set_boolean(value, nm_setting_ppp_get_refuse_pap(setting));
- break;
- case PROP_REFUSE_CHAP:
- g_value_set_boolean(value, nm_setting_ppp_get_refuse_chap(setting));
- break;
- case PROP_REFUSE_MSCHAP:
- g_value_set_boolean(value, nm_setting_ppp_get_refuse_mschap(setting));
- break;
- case PROP_REFUSE_MSCHAPV2:
- g_value_set_boolean(value, nm_setting_ppp_get_refuse_mschapv2(setting));
- break;
- case PROP_NOBSDCOMP:
- g_value_set_boolean(value, nm_setting_ppp_get_nobsdcomp(setting));
- break;
- case PROP_NODEFLATE:
- g_value_set_boolean(value, nm_setting_ppp_get_nodeflate(setting));
- break;
- case PROP_NO_VJ_COMP:
- g_value_set_boolean(value, nm_setting_ppp_get_no_vj_comp(setting));
- break;
- case PROP_REQUIRE_MPPE:
- g_value_set_boolean(value, nm_setting_ppp_get_require_mppe(setting));
- break;
- case PROP_REQUIRE_MPPE_128:
- g_value_set_boolean(value, nm_setting_ppp_get_require_mppe_128(setting));
- break;
- case PROP_MPPE_STATEFUL:
- g_value_set_boolean(value, nm_setting_ppp_get_mppe_stateful(setting));
- break;
- case PROP_CRTSCTS:
- g_value_set_boolean(value, nm_setting_ppp_get_crtscts(setting));
- break;
- case PROP_BAUD:
- g_value_set_uint(value, nm_setting_ppp_get_baud(setting));
- break;
- case PROP_MRU:
- g_value_set_uint(value, nm_setting_ppp_get_mru(setting));
- break;
- case PROP_MTU:
- g_value_set_uint(value, nm_setting_ppp_get_mtu(setting));
- break;
- case PROP_LCP_ECHO_FAILURE:
- g_value_set_uint(value, nm_setting_ppp_get_lcp_echo_failure(setting));
- break;
- case PROP_LCP_ECHO_INTERVAL:
- g_value_set_uint(value, nm_setting_ppp_get_lcp_echo_interval(setting));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
- break;
- }
-}
-
-static void
-set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- NMSettingPppPrivate *priv = NM_SETTING_PPP_GET_PRIVATE(object);
-
- switch (prop_id) {
- case PROP_NOAUTH:
- priv->noauth = g_value_get_boolean(value);
- break;
- case PROP_REFUSE_EAP:
- priv->refuse_eap = g_value_get_boolean(value);
- break;
- case PROP_REFUSE_PAP:
- priv->refuse_pap = g_value_get_boolean(value);
- break;
- case PROP_REFUSE_CHAP:
- priv->refuse_chap = g_value_get_boolean(value);
- break;
- case PROP_REFUSE_MSCHAP:
- priv->refuse_mschap = g_value_get_boolean(value);
- break;
- case PROP_REFUSE_MSCHAPV2:
- priv->refuse_mschapv2 = g_value_get_boolean(value);
- break;
- case PROP_NOBSDCOMP:
- priv->nobsdcomp = g_value_get_boolean(value);
- break;
- case PROP_NODEFLATE:
- priv->nodeflate = g_value_get_boolean(value);
- break;
- case PROP_NO_VJ_COMP:
- priv->no_vj_comp = g_value_get_boolean(value);
- break;
- case PROP_REQUIRE_MPPE:
- priv->require_mppe = g_value_get_boolean(value);
- break;
- case PROP_REQUIRE_MPPE_128:
- priv->require_mppe_128 = g_value_get_boolean(value);
- break;
- case PROP_MPPE_STATEFUL:
- priv->mppe_stateful = g_value_get_boolean(value);
- break;
- case PROP_CRTSCTS:
- priv->crtscts = g_value_get_boolean(value);
- break;
- case PROP_BAUD:
- priv->baud = g_value_get_uint(value);
- break;
- case PROP_MRU:
- priv->mru = g_value_get_uint(value);
- break;
- case PROP_MTU:
- priv->mtu = g_value_get_uint(value);
- break;
- case PROP_LCP_ECHO_FAILURE:
- priv->lcp_echo_failure = g_value_get_uint(value);
- break;
- case PROP_LCP_ECHO_INTERVAL:
- priv->lcp_echo_interval = g_value_get_uint(value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
- break;
- }
-}
-
-/*****************************************************************************/
-
-static void
nm_setting_ppp_init(NMSettingPpp *self)
-{
- NMSettingPppPrivate *priv = NM_SETTING_PPP_GET_PRIVATE(self);
-
- priv->noauth = TRUE;
-}
+{}
/**
* nm_setting_ppp_new:
@@ -540,10 +404,11 @@ nm_setting_ppp_class_init(NMSettingPppClass *klass)
g_type_class_add_private(klass, sizeof(NMSettingPppPrivate));
- object_class->get_property = get_property;
- object_class->set_property = set_property;
+ object_class->get_property = _nm_setting_property_get_property_direct;
+ object_class->set_property = _nm_setting_property_set_property_direct;
- setting_class->verify = verify;
+ setting_class->verify = verify;
+ setting_class->finalize_direct = TRUE;
/**
* NMSettingPpp:noauth:
@@ -552,117 +417,126 @@ nm_setting_ppp_class_init(NMSettingPppClass *klass)
* authenticate itself to the client. If %FALSE, require authentication
* from the remote side. In almost all cases, this should be %TRUE.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PPP_NOAUTH,
- PROP_NOAUTH,
- TRUE,
- NM_SETTING_PARAM_NONE,
- nm_setting_ppp_get_noauth);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_NOAUTH,
+ PROP_NOAUTH,
+ TRUE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingPppPrivate,
+ noauth);
/**
* NMSettingPpp:refuse-eap:
*
* If %TRUE, the EAP authentication method will not be used.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PPP_REFUSE_EAP,
- PROP_REFUSE_EAP,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_ppp_get_refuse_eap);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_REFUSE_EAP,
+ PROP_REFUSE_EAP,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingPppPrivate,
+ refuse_eap);
/**
* NMSettingPpp:refuse-pap:
*
* If %TRUE, the PAP authentication method will not be used.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PPP_REFUSE_PAP,
- PROP_REFUSE_PAP,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_ppp_get_refuse_pap);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_REFUSE_PAP,
+ PROP_REFUSE_PAP,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingPppPrivate,
+ refuse_pap);
/**
* NMSettingPpp:refuse-chap:
*
* If %TRUE, the CHAP authentication method will not be used.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PPP_REFUSE_CHAP,
- PROP_REFUSE_CHAP,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_ppp_get_refuse_chap);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_REFUSE_CHAP,
+ PROP_REFUSE_CHAP,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingPppPrivate,
+ refuse_chap);
/**
* NMSettingPpp:refuse-mschap:
*
* If %TRUE, the MSCHAP authentication method will not be used.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PPP_REFUSE_MSCHAP,
- PROP_REFUSE_MSCHAP,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_ppp_get_refuse_mschap);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_REFUSE_MSCHAP,
+ PROP_REFUSE_MSCHAP,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingPppPrivate,
+ refuse_mschap);
/**
* NMSettingPpp:refuse-mschapv2:
*
* If %TRUE, the MSCHAPv2 authentication method will not be used.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PPP_REFUSE_MSCHAPV2,
- PROP_REFUSE_MSCHAPV2,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_ppp_get_refuse_mschapv2);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_REFUSE_MSCHAPV2,
+ PROP_REFUSE_MSCHAPV2,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingPppPrivate,
+ refuse_mschapv2);
/**
* NMSettingPpp:nobsdcomp:
*
* If %TRUE, BSD compression will not be requested.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PPP_NOBSDCOMP,
- PROP_NOBSDCOMP,
- FALSE,
- NM_SETTING_PARAM_FUZZY_IGNORE,
- nm_setting_ppp_get_nobsdcomp);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_NOBSDCOMP,
+ PROP_NOBSDCOMP,
+ FALSE,
+ NM_SETTING_PARAM_FUZZY_IGNORE,
+ NMSettingPppPrivate,
+ nobsdcomp);
/**
* NMSettingPpp:nodeflate:
*
* If %TRUE, "deflate" compression will not be requested.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PPP_NODEFLATE,
- PROP_NODEFLATE,
- FALSE,
- NM_SETTING_PARAM_FUZZY_IGNORE,
- nm_setting_ppp_get_nodeflate);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_NODEFLATE,
+ PROP_NODEFLATE,
+ FALSE,
+ NM_SETTING_PARAM_FUZZY_IGNORE,
+ NMSettingPppPrivate,
+ nodeflate);
/**
* NMSettingPpp:no-vj-comp:
*
* If %TRUE, Van Jacobsen TCP header compression will not be requested.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PPP_NO_VJ_COMP,
- PROP_NO_VJ_COMP,
- FALSE,
- NM_SETTING_PARAM_FUZZY_IGNORE,
- nm_setting_ppp_get_no_vj_comp);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_NO_VJ_COMP,
+ PROP_NO_VJ_COMP,
+ FALSE,
+ NM_SETTING_PARAM_FUZZY_IGNORE,
+ NMSettingPppPrivate,
+ no_vj_comp);
/**
* NMSettingPpp:require-mppe:
@@ -672,13 +546,14 @@ nm_setting_ppp_class_init(NMSettingPppClass *klass)
* session will fail. Note that MPPE is not used on mobile broadband
* connections.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PPP_REQUIRE_MPPE,
- PROP_REQUIRE_MPPE,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_ppp_get_require_mppe);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_REQUIRE_MPPE,
+ PROP_REQUIRE_MPPE,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingPppPrivate,
+ require_mppe);
/**
* NMSettingPpp:require-mppe-128:
@@ -687,13 +562,14 @@ nm_setting_ppp_class_init(NMSettingPppClass *klass)
* required for the PPP session, and the "require-mppe" property must also
* be set to %TRUE. If 128-bit MPPE is not available the session will fail.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PPP_REQUIRE_MPPE_128,
- PROP_REQUIRE_MPPE_128,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_ppp_get_require_mppe_128);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_REQUIRE_MPPE_128,
+ PROP_REQUIRE_MPPE_128,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingPppPrivate,
+ require_mppe_128);
/**
* NMSettingPpp:mppe-stateful:
@@ -701,13 +577,14 @@ nm_setting_ppp_class_init(NMSettingPppClass *klass)
* If %TRUE, stateful MPPE is used. See pppd documentation for more
* information on stateful MPPE.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PPP_MPPE_STATEFUL,
- PROP_MPPE_STATEFUL,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_ppp_get_mppe_stateful);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_MPPE_STATEFUL,
+ PROP_MPPE_STATEFUL,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingPppPrivate,
+ mppe_stateful);
/**
* NMSettingPpp:crtscts:
@@ -716,13 +593,14 @@ nm_setting_ppp_class_init(NMSettingPppClass *klass)
* flow control with RTS and CTS signals. This value should normally be set
* to %FALSE.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PPP_CRTSCTS,
- PROP_CRTSCTS,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_ppp_get_crtscts);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_CRTSCTS,
+ PROP_CRTSCTS,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingPppPrivate,
+ crtscts);
/**
* NMSettingPpp:baud:
@@ -731,14 +609,16 @@ nm_setting_ppp_class_init(NMSettingPppClass *klass)
* baudrate. This value should normally be left as 0 to automatically
* choose the speed.
**/
- obj_properties[PROP_BAUD] = g_param_spec_uint(NM_SETTING_PPP_BAUD,
- "",
- "",
- 0,
- G_MAXUINT32,
- 0,
- G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE
- | G_PARAM_STATIC_STRINGS);
+ _nm_setting_property_define_direct_uint32(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_BAUD,
+ PROP_BAUD,
+ 0,
+ G_MAXUINT32,
+ 0,
+ NM_SETTING_PARAM_FUZZY_IGNORE,
+ NMSettingPppPrivate,
+ baud);
/**
* NMSettingPpp:mru:
@@ -747,13 +627,16 @@ nm_setting_ppp_class_init(NMSettingPppClass *klass)
* larger than the specified size. If non-zero, the MRU should be between
* 128 and 16384.
*/
- obj_properties[PROP_MRU] = g_param_spec_uint(NM_SETTING_PPP_MRU,
- "",
- "",
- 0,
- 16384,
- 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ _nm_setting_property_define_direct_uint32(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_MRU,
+ PROP_MRU,
+ 0,
+ 16384,
+ 0,
+ NM_SETTING_PARAM_NONE,
+ NMSettingPppPrivate,
+ mru);
/**
* NMSettingPpp:mtu:
@@ -761,14 +644,16 @@ nm_setting_ppp_class_init(NMSettingPppClass *klass)
* If non-zero, instruct pppd to send packets no larger than the specified
* size.
**/
- obj_properties[PROP_MTU] = g_param_spec_uint(NM_SETTING_PPP_MTU,
- "",
- "",
- 0,
- G_MAXUINT32,
- 0,
- G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE
- | G_PARAM_STATIC_STRINGS);
+ _nm_setting_property_define_direct_uint32(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_MTU,
+ PROP_MTU,
+ 0,
+ G_MAXUINT32,
+ 0,
+ NM_SETTING_PARAM_FUZZY_IGNORE,
+ NMSettingPppPrivate,
+ mtu);
/**
* NMSettingPpp:lcp-echo-failure:
@@ -778,14 +663,16 @@ nm_setting_ppp_class_init(NMSettingPppClass *klass)
* peer. The "lcp-echo-interval" property must also be set to a non-zero
* value if this property is used.
**/
- obj_properties[PROP_LCP_ECHO_FAILURE] = g_param_spec_uint(
- NM_SETTING_PPP_LCP_ECHO_FAILURE,
- "",
- "",
- 0,
- G_MAXUINT32,
- 0,
- G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS);
+ _nm_setting_property_define_direct_uint32(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_LCP_ECHO_FAILURE,
+ PROP_LCP_ECHO_FAILURE,
+ 0,
+ G_MAXUINT32,
+ 0,
+ NM_SETTING_PARAM_FUZZY_IGNORE,
+ NMSettingPppPrivate,
+ lcp_echo_failure);
/**
* NMSettingPpp:lcp-echo-interval:
@@ -795,19 +682,22 @@ nm_setting_ppp_class_init(NMSettingPppClass *klass)
* peers will respond to echo requests and some will not, and it is not
* possible to autodetect this.
**/
- obj_properties[PROP_LCP_ECHO_INTERVAL] = g_param_spec_uint(
- NM_SETTING_PPP_LCP_ECHO_INTERVAL,
- "",
- "",
- 0,
- G_MAXUINT32,
- 0,
- G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS);
+ _nm_setting_property_define_direct_uint32(properties_override,
+ obj_properties,
+ NM_SETTING_PPP_LCP_ECHO_INTERVAL,
+ PROP_LCP_ECHO_INTERVAL,
+ 0,
+ G_MAXUINT32,
+ 0,
+ NM_SETTING_PARAM_FUZZY_IGNORE,
+ NMSettingPppPrivate,
+ lcp_echo_interval);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_PPP,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_PPP,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-pppoe.c b/src/libnm-core-impl/nm-setting-pppoe.c
index 12beb51a5b..1c97c05b15 100644
--- a/src/libnm-core-impl/nm-setting-pppoe.c
+++ b/src/libnm-core-impl/nm-setting-pppoe.c
@@ -370,5 +370,5 @@ nm_setting_pppoe_class_init(NMSettingPppoeClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_PPPOE);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_PPPOE, NULL, NULL, 0);
}
diff --git a/src/libnm-core-impl/nm-setting-private.h b/src/libnm-core-impl/nm-setting-private.h
index a16004905b..48f225b6d4 100644
--- a/src/libnm-core-impl/nm-setting-private.h
+++ b/src/libnm-core-impl/nm-setting-private.h
@@ -115,7 +115,20 @@ struct _NMSettingClass {
guint /* NMSettingParseFlags */ parse_flags,
GError ** error);
- gpointer padding[1];
+ union {
+ gpointer padding[1];
+ struct {
+ /* Whether NMSetting.finalize() calls _nm_setting_property_finalize_direct(). Subclasses
+ * need to be aware of that, and currently this is opt-in.
+ *
+ * The only reason because subclasses need to be aware of this, is that they
+ * otherwise might clear the properties already and leave dangling pointers.
+ *
+ * Eventually all setting classes should stop touching their direct properties
+ * during finalize, and always let NMSetting.finalize() handle them. */
+ bool finalize_direct : 1;
+ };
+ };
const struct _NMMetaSettingInfo *setting_info;
};
@@ -127,15 +140,48 @@ struct _NMSettingClass {
*/
struct _NMSettingIPConfig {
NMSetting parent;
+ /* In the past, this struct was public API. Preserve ABI! */
};
struct _NMSettingIPConfigClass {
NMSettingClass parent;
- /* Padding for future expansion */
- gpointer padding[8];
+ /* In the past, this struct was public API. Preserve ABI! */
+ union {
+ gpointer _dummy;
+ int private_offset;
+ };
+ gpointer padding[7];
};
+typedef struct {
+ GPtrArray *dns; /* array of IP address strings */
+ GPtrArray *dns_search; /* array of domain name strings */
+ GPtrArray *dns_options; /* array of DNS options */
+ GPtrArray *addresses; /* array of NMIPAddress */
+ GPtrArray *routes; /* array of NMIPRoute */
+ GPtrArray *routing_rules;
+ GArray * dhcp_reject_servers;
+ char * method;
+ char * gateway;
+ char * dhcp_hostname;
+ char * dhcp_iaid;
+ gint64 route_metric;
+ guint dhcp_hostname_flags;
+ int dns_priority;
+ int dad_timeout;
+ int dhcp_timeout;
+ int required_timeout;
+ guint32 route_table;
+ bool ignore_auto_routes;
+ bool ignore_auto_dns;
+ bool dhcp_send_hostname;
+ bool never_default;
+ bool may_fail;
+} NMSettingIPConfigPrivate;
+
+void _nm_setting_ip_config_private_init(gpointer self, NMSettingIPConfigPrivate *priv);
+
/*****************************************************************************/
NMSettingPriority _nm_setting_get_base_type_priority(NMSetting *setting);
@@ -253,8 +299,9 @@ extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_ignore_u
extern const NMSettInfoPropertType nm_sett_info_propert_type_plain_i;
extern const NMSettInfoPropertType nm_sett_info_propert_type_plain_u;
-extern const NMSettInfoPropertType nm_sett_info_propert_type_boolean;
-extern const NMSettInfoPropertType nm_sett_info_propert_type_string;
+extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_boolean;
+extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_uint32;
+extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_string;
NMSettingVerifyResult
_nm_setting_verify(NMSetting *setting, NMConnection *connection, GError **error);
@@ -268,6 +315,16 @@ gboolean _nm_setting_aggregate(NMSetting *setting, NMConnectionAggregateType typ
gboolean _nm_setting_slave_type_is_valid(const char *slave_type, const char **out_port_type);
+void _nm_setting_property_get_property_direct(GObject * object,
+ guint prop_id,
+ GValue * value,
+ GParamSpec *pspec);
+
+void _nm_setting_property_set_property_direct(GObject * object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec * pspec);
+
GVariant *_nm_setting_property_to_dbus_fcn_gprop(const NMSettInfoSetting * sett_info,
guint property_idx,
NMConnection * connection,
@@ -275,21 +332,12 @@ GVariant *_nm_setting_property_to_dbus_fcn_gprop(const NMSettInfoSetting *
NMConnectionSerializationFlags flags,
const NMConnectionSerializationOptions *options);
-GVariant *
-_nm_setting_property_to_dbus_fcn_get_boolean(const NMSettInfoSetting * sett_info,
- guint property_idx,
- NMConnection * connection,
- NMSetting * setting,
- NMConnectionSerializationFlags flags,
- const NMConnectionSerializationOptions *options);
-
-GVariant *
-_nm_setting_property_to_dbus_fcn_get_string(const NMSettInfoSetting * sett_info,
- guint property_idx,
- NMConnection * connection,
- NMSetting * setting,
- NMConnectionSerializationFlags flags,
- const NMConnectionSerializationOptions *options);
+GVariant *_nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting * sett_info,
+ guint property_idx,
+ NMConnection * connection,
+ NMSetting * setting,
+ NMConnectionSerializationFlags flags,
+ const NMConnectionSerializationOptions *options);
GVariant *_nm_setting_to_dbus(NMSetting * setting,
NMConnection * connection,
@@ -308,6 +356,10 @@ gboolean _nm_setting_property_is_regular_secret_flags(NMSetting * setting,
/*****************************************************************************/
+const NMSettInfoProperty *
+_nm_sett_info_property_lookup_by_param_spec(const NMSettInfoSetting *sett_info,
+ const GParamSpec * param_spec);
+
static inline GArray *
_nm_sett_info_property_override_create_array_sized(guint reserved_size)
{
@@ -319,22 +371,17 @@ _nm_sett_info_property_override_create_array(void)
{
/* pre-allocate a relatively large buffer to avoid frequent re-allocations.
* Note that the buffer is only short-lived and will be destroyed by
- * _nm_setting_class_commit_full(). */
+ * _nm_setting_class_commit(). */
return _nm_sett_info_property_override_create_array_sized(20);
}
GArray *_nm_sett_info_property_override_create_array_ip_config(void);
-void _nm_setting_class_commit_full(NMSettingClass * setting_class,
- NMMetaSettingType meta_type,
- const NMSettInfoSettDetail *detail,
- GArray * properties_override);
-
-static inline void
-_nm_setting_class_commit(NMSettingClass *setting_class, NMMetaSettingType meta_type)
-{
- _nm_setting_class_commit_full(setting_class, meta_type, NULL, NULL);
-}
+void _nm_setting_class_commit(NMSettingClass * setting_class,
+ NMMetaSettingType meta_type,
+ const NMSettInfoSettDetail *detail,
+ GArray * properties_override,
+ gint16 private_offset);
#define NM_SETT_INFO_SETT_GENDATA(...) \
({ \
@@ -381,11 +428,14 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
g_array_append_vals(properties_override, prop_info, 1);
}
-#define _nm_properties_override_gobj(properties_override, p_param_spec, p_property_type, ...) \
- _nm_properties_override((properties_override), \
- NM_SETT_INFO_PROPERTY(.name = NULL, \
- .param_spec = (p_param_spec), \
- .property_type = (p_property_type), \
+#define _nm_properties_override_gobj(properties_override, \
+ p_param_spec, \
+ p_property_type, \
+ ... /* extra NMSettInfoProperty fields */) \
+ _nm_properties_override((properties_override), \
+ NM_SETT_INFO_PROPERTY(.name = NULL, \
+ .param_spec = (p_param_spec), \
+ .property_type = (p_property_type), \
__VA_ARGS__))
#define _nm_properties_override_dbus(properties_override, p_name, p_property_type) \
@@ -395,122 +445,163 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
/*****************************************************************************/
-#define _nm_setting_property_define_boolean_full(properties_override, \
- obj_properties, \
- prop_name, \
- prop_id, \
- default_value, \
- param_flags, \
- property_type, \
- get_fcn, \
- ...) \
- G_STMT_START \
- { \
- const gboolean _default_value = (default_value); \
- GParamSpec * _param_spec; \
- const NMSettInfoPropertType *const _property_type = (property_type); \
- \
- G_STATIC_ASSERT( \
- !NM_FLAGS_ANY((param_flags), \
- ~(NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_INFERRABLE \
- | NM_SETTING_PARAM_REAPPLY_IMMEDIATELY))); \
- \
- nm_assert(_property_type); \
- nm_assert(_property_type->to_dbus_fcn == _nm_setting_property_to_dbus_fcn_get_boolean); \
- \
- nm_assert(NM_IN_SET(_default_value, 0, 1)); \
- \
- _param_spec = \
- g_param_spec_boolean("" prop_name "", \
- "", \
- "", \
- _default_value, \
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | (param_flags)); \
- \
- (obj_properties)[(prop_id)] = _param_spec; \
- \
- _nm_properties_override_gobj((properties_override), \
- _param_spec, \
- _property_type, \
- .to_dbus_data.get_boolean = \
- (gboolean(*)(NMSetting *)) (get_fcn), \
- __VA_ARGS__); \
- } \
+/* Define "direct" properties. These are properties that have a GParamSpec and
+ * NMSettInfoPropertType.direct_type != NM_VALUE_TYPE_NONE.
+ *
+ * With this, the location of the data is known at
+ *
+ * _nm_setting_get_private(setting, sett_info, property_info->direct_offset)
+ *
+ * which allows to generically handle the property operations (like get, set, compare).
+ */
+
+#define _nm_setting_property_define_direct_boolean(properties_override, \
+ obj_properties, \
+ prop_name, \
+ prop_id, \
+ default_value, \
+ param_flags, \
+ private_struct_type, \
+ private_struct_field, \
+ ... /* extra NMSettInfoProperty fields */) \
+ G_STMT_START \
+ { \
+ const gboolean _default_value = (default_value); \
+ GParamSpec * _param_spec; \
+ \
+ G_STATIC_ASSERT( \
+ !NM_FLAGS_ANY((param_flags), \
+ ~(NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_INFERRABLE \
+ | NM_SETTING_PARAM_REAPPLY_IMMEDIATELY))); \
+ \
+ nm_assert(NM_IN_SET(_default_value, 0, 1)); \
+ \
+ _param_spec = \
+ g_param_spec_boolean("" prop_name "", \
+ "", \
+ "", \
+ _default_value, \
+ G_PARAM_READWRITE | 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_boolean, \
+ .direct_offset = \
+ NM_STRUCT_OFFSET_ENSURE_TYPE(bool, private_struct_type, private_struct_field), \
+ __VA_ARGS__); \
+ } \
G_STMT_END
-#define _nm_setting_property_define_boolean(properties_override, \
- obj_properties, \
- prop_name, \
- prop_id, \
- default_value, \
- param_flags, \
- get_fcn, \
- ...) \
- _nm_setting_property_define_boolean_full((properties_override), \
- (obj_properties), \
- prop_name, \
- (prop_id), \
- (default_value), \
- (param_flags), \
- &nm_sett_info_propert_type_boolean, \
- (get_fcn), \
- __VA_ARGS__)
+/*****************************************************************************/
+
+#define _nm_setting_property_define_direct_uint32(properties_override, \
+ obj_properties, \
+ prop_name, \
+ prop_id, \
+ min_value, \
+ max_value, \
+ default_value, \
+ param_flags, \
+ private_struct_type, \
+ private_struct_field, \
+ ... /* extra NMSettInfoProperty fields */) \
+ G_STMT_START \
+ { \
+ GParamSpec *_param_spec; \
+ \
+ G_STATIC_ASSERT( \
+ !NM_FLAGS_ANY((param_flags), \
+ ~(NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_INFERRABLE))); \
+ G_STATIC_ASSERT((min_value) <= (guint64) G_MAXUINT32); \
+ G_STATIC_ASSERT((max_value) <= (guint64) G_MAXUINT32); \
+ G_STATIC_ASSERT((default_value) <= (guint64) G_MAXUINT32); \
+ \
+ _param_spec = \
+ g_param_spec_uint("" prop_name "", \
+ "", \
+ "", \
+ (min_value), \
+ (max_value), \
+ (default_value), \
+ G_PARAM_READWRITE | 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_uint32, \
+ .direct_offset = \
+ NM_STRUCT_OFFSET_ENSURE_TYPE(guint32, private_struct_type, private_struct_field), \
+ __VA_ARGS__); \
+ } \
+ G_STMT_END
/*****************************************************************************/
-#define _nm_setting_property_define_string_full(properties_override, \
- obj_properties, \
- prop_name, \
- prop_id, \
- param_flags, \
- property_type, \
- get_fcn, \
- ...) \
- G_STMT_START \
- { \
- GParamSpec * _param_spec; \
- const NMSettInfoPropertType *const _property_type = (property_type); \
- \
- G_STATIC_ASSERT(!NM_FLAGS_ANY((param_flags), \
- ~(NM_SETTING_PARAM_SECRET | NM_SETTING_PARAM_FUZZY_IGNORE \
- | NM_SETTING_PARAM_INFERRABLE \
- | NM_SETTING_PARAM_REAPPLY_IMMEDIATELY))); \
- nm_assert(_property_type); \
- nm_assert(_property_type->to_dbus_fcn == _nm_setting_property_to_dbus_fcn_get_string); \
- \
- _param_spec = \
- g_param_spec_string("" prop_name "", \
- "", \
- "", \
- NULL, \
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | (param_flags)); \
- \
- (obj_properties)[(prop_id)] = _param_spec; \
- \
- _nm_properties_override_gobj((properties_override), \
- _param_spec, \
- _property_type, \
- .to_dbus_data.get_string = \
- (const char *(*) (NMSetting *) ) (get_fcn), \
- __VA_ARGS__); \
- } \
+#define _nm_setting_property_define_direct_string_full(properties_override, \
+ obj_properties, \
+ prop_name, \
+ prop_id, \
+ param_flags, \
+ property_type, \
+ private_struct_type, \
+ private_struct_field, \
+ ... /* extra NMSettInfoProperty fields */) \
+ G_STMT_START \
+ { \
+ GParamSpec * _param_spec; \
+ const NMSettInfoPropertType *_property_type = (property_type); \
+ \
+ G_STATIC_ASSERT(!NM_FLAGS_ANY((param_flags), \
+ ~(NM_SETTING_PARAM_SECRET | NM_SETTING_PARAM_FUZZY_IGNORE \
+ | NM_SETTING_PARAM_INFERRABLE \
+ | NM_SETTING_PARAM_REAPPLY_IMMEDIATELY))); \
+ \
+ nm_assert(_property_type); \
+ nm_assert(g_variant_type_equal(_property_type->dbus_type, "s")); \
+ nm_assert(_property_type->direct_type == NM_VALUE_TYPE_STRING); \
+ nm_assert(_property_type->to_dbus_fcn == _nm_setting_property_to_dbus_fcn_direct); \
+ \
+ _param_spec = \
+ g_param_spec_string("" prop_name "", \
+ "", \
+ "", \
+ NULL, \
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | (param_flags)); \
+ \
+ (obj_properties)[(prop_id)] = _param_spec; \
+ \
+ _nm_properties_override_gobj( \
+ (properties_override), \
+ _param_spec, \
+ _property_type, \
+ .direct_offset = \
+ NM_STRUCT_OFFSET_ENSURE_TYPE(char *, private_struct_type, private_struct_field), \
+ __VA_ARGS__); \
+ } \
G_STMT_END
-#define _nm_setting_property_define_string(properties_override, \
- obj_properties, \
- prop_name, \
- prop_id, \
- param_flags, \
- get_fcn, \
- ...) \
- _nm_setting_property_define_string_full((properties_override), \
- (obj_properties), \
- prop_name, \
- (prop_id), \
- (param_flags), \
- &nm_sett_info_propert_type_string, \
- (get_fcn), \
- __VA_ARGS__)
+#define _nm_setting_property_define_direct_string(properties_override, \
+ obj_properties, \
+ prop_name, \
+ prop_id, \
+ param_flags, \
+ private_struct_type, \
+ private_struct_field, \
+ ... /* extra NMSettInfoProperty fields */) \
+ _nm_setting_property_define_direct_string_full((properties_override), \
+ (obj_properties), \
+ prop_name, \
+ (prop_id), \
+ (param_flags), \
+ &nm_sett_info_propert_type_direct_string, \
+ private_struct_type, \
+ private_struct_field, \
+ __VA_ARGS__)
/*****************************************************************************/
diff --git a/src/libnm-core-impl/nm-setting-proxy.c b/src/libnm-core-impl/nm-setting-proxy.c
index fd09e1d402..3f888ec7d3 100644
--- a/src/libnm-core-impl/nm-setting-proxy.c
+++ b/src/libnm-core-impl/nm-setting-proxy.c
@@ -32,7 +32,7 @@ typedef struct {
char *pac_url;
char *pac_script;
int method;
- bool browser_only : 1;
+ bool browser_only;
} NMSettingProxyPrivate;
/**
@@ -345,13 +345,14 @@ nm_setting_proxy_class_init(NMSettingProxyClass *klass)
* description: Whether the proxy configuration is for browser only.
* ---end---
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_PROXY_BROWSER_ONLY,
- PROP_BROWSER_ONLY,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_proxy_get_browser_only);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_PROXY_BROWSER_ONLY,
+ PROP_BROWSER_ONLY,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingProxyPrivate,
+ browser_only);
/**
* NMSettingProxy:pac-url:
@@ -396,8 +397,9 @@ nm_setting_proxy_class_init(NMSettingProxyClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_PROXY,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_PROXY,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-serial.c b/src/libnm-core-impl/nm-setting-serial.c
index c87de166ac..0029551bc4 100644
--- a/src/libnm-core-impl/nm-setting-serial.c
+++ b/src/libnm-core-impl/nm-setting-serial.c
@@ -345,8 +345,9 @@ nm_setting_serial_class_init(NMSettingSerialClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_SERIAL,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_SERIAL,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-sriov.c b/src/libnm-core-impl/nm-setting-sriov.c
index b18d184af8..e55bc4c53f 100644
--- a/src/libnm-core-impl/nm-setting-sriov.c
+++ b/src/libnm-core-impl/nm-setting-sriov.c
@@ -1365,8 +1365,9 @@ nm_setting_sriov_class_init(NMSettingSriovClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_SRIOV,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_SRIOV,
+ NULL,
+ properties_override,
+ 0);
}
diff --git a/src/libnm-core-impl/nm-setting-tc-config.c b/src/libnm-core-impl/nm-setting-tc-config.c
index a23371a10b..a82e65e61b 100644
--- a/src/libnm-core-impl/nm-setting-tc-config.c
+++ b/src/libnm-core-impl/nm-setting-tc-config.c
@@ -2258,8 +2258,9 @@ nm_setting_tc_config_class_init(NMSettingTCConfigClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_TC_CONFIG,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_TC_CONFIG,
+ NULL,
+ properties_override,
+ 0);
}
diff --git a/src/libnm-core-impl/nm-setting-team-port.c b/src/libnm-core-impl/nm-setting-team-port.c
index 316fc67c96..11aae92638 100644
--- a/src/libnm-core-impl/nm-setting-team-port.c
+++ b/src/libnm-core-impl/nm-setting-team-port.c
@@ -694,8 +694,9 @@ nm_setting_team_port_class_init(NMSettingTeamPortClass *klass)
g_object_class_install_properties(object_class, G_N_ELEMENTS(obj_properties), obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_TEAM_PORT,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_TEAM_PORT,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-team.c b/src/libnm-core-impl/nm-setting-team.c
index b9a368c51d..8669c58618 100644
--- a/src/libnm-core-impl/nm-setting-team.c
+++ b/src/libnm-core-impl/nm-setting-team.c
@@ -1827,8 +1827,9 @@ nm_setting_team_class_init(NMSettingTeamClass *klass)
g_object_class_install_properties(object_class, G_N_ELEMENTS(obj_properties), obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_TEAM,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_TEAM,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-tun.c b/src/libnm-core-impl/nm-setting-tun.c
index d75dcf80ab..99a68024ee 100644
--- a/src/libnm-core-impl/nm-setting-tun.c
+++ b/src/libnm-core-impl/nm-setting-tun.c
@@ -35,9 +35,9 @@ typedef struct {
char * owner;
char * group;
NMSettingTunMode mode;
- bool pi : 1;
- bool vnet_hdr : 1;
- bool multi_queue : 1;
+ bool pi;
+ bool vnet_hdr;
+ bool multi_queue;
} NMSettingTunPrivate;
/**
@@ -369,13 +369,14 @@ nm_setting_tun_class_init(NMSettingTunClass *klass)
*
* Since: 1.2
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_TUN_PI,
- PROP_PI,
- FALSE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_tun_get_pi);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_TUN_PI,
+ PROP_PI,
+ FALSE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingTunPrivate,
+ pi);
/**
* NMSettingTun:vnet-hdr:
@@ -385,13 +386,14 @@ nm_setting_tun_class_init(NMSettingTunClass *klass)
*
* Since: 1.2
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_TUN_VNET_HDR,
- PROP_VNET_HDR,
- FALSE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_tun_get_vnet_hdr);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_TUN_VNET_HDR,
+ PROP_VNET_HDR,
+ FALSE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingTunPrivate,
+ vnet_hdr);
/**
* NMSettingTun:multi-queue:
@@ -403,18 +405,20 @@ nm_setting_tun_class_init(NMSettingTunClass *klass)
*
* Since: 1.2
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_TUN_MULTI_QUEUE,
- PROP_MULTI_QUEUE,
- FALSE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_tun_get_multi_queue);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_TUN_MULTI_QUEUE,
+ PROP_MULTI_QUEUE,
+ FALSE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingTunPrivate,
+ multi_queue);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_TUN,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_TUN,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-user.c b/src/libnm-core-impl/nm-setting-user.c
index 0f99baa221..d5e028ce53 100644
--- a/src/libnm-core-impl/nm-setting-user.c
+++ b/src/libnm-core-impl/nm-setting-user.c
@@ -587,8 +587,9 @@ nm_setting_user_class_init(NMSettingUserClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_USER,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_USER,
+ NULL,
+ properties_override,
+ G_STRUCT_OFFSET(NMSettingUser, _priv));
}
diff --git a/src/libnm-core-impl/nm-setting-veth.c b/src/libnm-core-impl/nm-setting-veth.c
index 70cfe50b42..43d8da4f93 100644
--- a/src/libnm-core-impl/nm-setting-veth.c
+++ b/src/libnm-core-impl/nm-setting-veth.c
@@ -190,5 +190,5 @@ nm_setting_veth_class_init(NMSettingVethClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_VETH);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_VETH, NULL, NULL, 0);
}
diff --git a/src/libnm-core-impl/nm-setting-vlan.c b/src/libnm-core-impl/nm-setting-vlan.c
index e4e07e35dd..78eb9924bc 100644
--- a/src/libnm-core-impl/nm-setting-vlan.c
+++ b/src/libnm-core-impl/nm-setting-vlan.c
@@ -994,8 +994,9 @@ nm_setting_vlan_class_init(NMSettingVlanClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_VLAN,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_VLAN,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-vpn.c b/src/libnm-core-impl/nm-setting-vpn.c
index 351f3fd721..1df4f66130 100644
--- a/src/libnm-core-impl/nm-setting-vpn.c
+++ b/src/libnm-core-impl/nm-setting-vpn.c
@@ -47,11 +47,6 @@ typedef struct {
*/
char *user_name;
- /* Whether the VPN stays up across link changes, until the user
- * explicitly disconnects it.
- */
- gboolean persistent;
-
/* The hash table is created at setting object
* init time and should not be replaced. It is
* a char * -> char * mapping, and both the key
@@ -72,6 +67,12 @@ typedef struct {
/* Timeout for the VPN service to establish the connection */
guint32 timeout;
+
+ /* Whether the VPN stays up across link changes, until the user
+ * explicitly disconnects it.
+ */
+ bool persistent;
+
} NMSettingVpnPrivate;
/**
@@ -1172,13 +1173,14 @@ nm_setting_vpn_class_init(NMSettingVpnClass *klass)
* the VPN will attempt to stay connected across link changes and outages,
* until explicitly disconnected.
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_VPN_PERSISTENT,
- PROP_PERSISTENT,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_vpn_get_persistent);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_VPN_PERSISTENT,
+ PROP_PERSISTENT,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingVpnPrivate,
+ persistent);
/**
* NMSettingVpn:data: (type GHashTable(utf8,utf8)):
@@ -1252,8 +1254,9 @@ nm_setting_vpn_class_init(NMSettingVpnClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_VPN,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_VPN,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-vrf.c b/src/libnm-core-impl/nm-setting-vrf.c
index a5ee739592..e2707053ef 100644
--- a/src/libnm-core-impl/nm-setting-vrf.c
+++ b/src/libnm-core-impl/nm-setting-vrf.c
@@ -81,38 +81,6 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
/*****************************************************************************/
static void
-get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- NMSettingVrf *self = NM_SETTING_VRF(object);
-
- switch (prop_id) {
- case PROP_TABLE:
- g_value_set_uint(value, self->table);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
- break;
- }
-}
-
-static void
-set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- NMSettingVrf *self = NM_SETTING_VRF(object);
-
- switch (prop_id) {
- case PROP_TABLE:
- self->table = g_value_get_uint(value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
- break;
- }
-}
-
-/*****************************************************************************/
-
-static void
nm_setting_vrf_init(NMSettingVrf *setting)
{}
@@ -134,13 +102,15 @@ nm_setting_vrf_new(void)
static void
nm_setting_vrf_class_init(NMSettingVrfClass *klass)
{
- GObjectClass * object_class = G_OBJECT_CLASS(klass);
- NMSettingClass *setting_class = NM_SETTING_CLASS(klass);
+ GObjectClass * object_class = G_OBJECT_CLASS(klass);
+ NMSettingClass *setting_class = NM_SETTING_CLASS(klass);
+ GArray * properties_override = _nm_sett_info_property_override_create_array();
- object_class->get_property = get_property;
- object_class->set_property = set_property;
+ object_class->get_property = _nm_setting_property_get_property_direct;
+ object_class->set_property = _nm_setting_property_set_property_direct;
- setting_class->verify = verify;
+ setting_class->verify = verify;
+ setting_class->finalize_direct = TRUE;
/**
* NMSettingVrf:table:
@@ -149,16 +119,18 @@ nm_setting_vrf_class_init(NMSettingVrfClass *klass)
*
* Since: 1.24
**/
- obj_properties[PROP_TABLE] =
- g_param_spec_uint(NM_SETTING_VRF_TABLE,
- "",
- "",
- 0,
- G_MAXUINT32,
- 0,
- G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
+ _nm_setting_property_define_direct_uint32(properties_override,
+ obj_properties,
+ NM_SETTING_VRF_TABLE,
+ PROP_TABLE,
+ 0,
+ G_MAXUINT32,
+ 0,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingVrf,
+ table);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_VRF);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_VRF, NULL, properties_override, 0);
}
diff --git a/src/libnm-core-impl/nm-setting-vxlan.c b/src/libnm-core-impl/nm-setting-vxlan.c
index f2aeb66a16..c2d23a7fb6 100644
--- a/src/libnm-core-impl/nm-setting-vxlan.c
+++ b/src/libnm-core-impl/nm-setting-vxlan.c
@@ -53,11 +53,11 @@ typedef struct {
guint ttl;
guint ageing;
guint limit;
- bool learning : 1;
- bool proxy : 1;
- bool rsc : 1;
- bool l2_miss : 1;
- bool l3_miss : 1;
+ bool proxy;
+ bool learning;
+ bool rsc;
+ bool l2_miss;
+ bool l3_miss;
} NMSettingVxlanPrivate;
/**
@@ -536,7 +536,6 @@ nm_setting_vxlan_init(NMSettingVxlan *self)
priv->destination_port = DST_PORT_DEFAULT;
priv->ageing = 300;
- priv->learning = TRUE;
}
/**
@@ -595,6 +594,7 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
"",
NULL,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
+
/**
* NMSettingVxlan:id:
*
@@ -765,13 +765,14 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
*
* Since: 1.2
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_VXLAN_PROXY,
- PROP_PROXY,
- FALSE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_vxlan_get_proxy);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_VXLAN_PROXY,
+ PROP_PROXY,
+ FALSE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingVxlanPrivate,
+ proxy);
/**
* NMSettingVxlan:learning:
@@ -781,13 +782,14 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
*
* Since: 1.2
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_VXLAN_LEARNING,
- PROP_LEARNING,
- TRUE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_vxlan_get_learning);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_VXLAN_LEARNING,
+ PROP_LEARNING,
+ TRUE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingVxlanPrivate,
+ learning);
/**
* NMSettingVxlan:rsc:
@@ -796,13 +798,14 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
*
* Since: 1.2
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_VXLAN_RSC,
- PROP_RSC,
- FALSE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_vxlan_get_rsc);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_VXLAN_RSC,
+ PROP_RSC,
+ FALSE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingVxlanPrivate,
+ rsc);
/**
* NMSettingVxlan:l2-miss:
@@ -811,13 +814,14 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
*
* Since: 1.2
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_VXLAN_L2_MISS,
- PROP_L2_MISS,
- FALSE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_vxlan_get_l2_miss);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_VXLAN_L2_MISS,
+ PROP_L2_MISS,
+ FALSE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingVxlanPrivate,
+ l2_miss);
/**
* NMSettingVxlan:l3-miss:
@@ -826,18 +830,20 @@ nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
*
* Since: 1.2
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_VXLAN_L3_MISS,
- PROP_L3_MISS,
- FALSE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_vxlan_get_l3_miss);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_VXLAN_L3_MISS,
+ PROP_L3_MISS,
+ FALSE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingVxlanPrivate,
+ l3_miss);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_VXLAN,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_VXLAN,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-wifi-p2p.c b/src/libnm-core-impl/nm-setting-wifi-p2p.c
index 8f677479d3..1d27ee538a 100644
--- a/src/libnm-core-impl/nm-setting-wifi-p2p.c
+++ b/src/libnm-core-impl/nm-setting-wifi-p2p.c
@@ -300,5 +300,5 @@ nm_setting_wifi_p2p_class_init(NMSettingWifiP2PClass *setting_wifi_p2p_class)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_WIFI_P2P);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_WIFI_P2P, NULL, NULL, 0);
}
diff --git a/src/libnm-core-impl/nm-setting-wimax.c b/src/libnm-core-impl/nm-setting-wimax.c
index 6d9f3284fa..9f2f6e3bf5 100644
--- a/src/libnm-core-impl/nm-setting-wimax.c
+++ b/src/libnm-core-impl/nm-setting-wimax.c
@@ -264,8 +264,9 @@ nm_setting_wimax_class_init(NMSettingWimaxClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_WIMAX,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_WIMAX,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-wired.c b/src/libnm-core-impl/nm-setting-wired.c
index 7a702de2cc..3c0f0302f5 100644
--- a/src/libnm-core-impl/nm-setting-wired.c
+++ b/src/libnm-core-impl/nm-setting-wired.c
@@ -66,7 +66,7 @@ typedef struct {
NMTernary accept_all_mac_addresses;
guint32 speed;
guint32 mtu;
- bool auto_negotiate : 1;
+ bool auto_negotiate;
} NMSettingWiredPrivate;
/**
@@ -1291,12 +1291,13 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* description: The property is not saved by the plugin.
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_WIRED_PORT,
- PROP_PORT,
- NM_SETTING_PARAM_NONE,
- nm_setting_wired_get_port);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_WIRED_PORT,
+ PROP_PORT,
+ NM_SETTING_PARAM_NONE,
+ NMSettingWiredPrivate,
+ port);
/**
* NMSettingWired:speed:
@@ -1353,12 +1354,13 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* "duplex" parameter in the ETHOOL_OPTS variable.
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_WIRED_DUPLEX,
- PROP_DUPLEX,
- NM_SETTING_PARAM_NONE,
- nm_setting_wired_get_duplex);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_WIRED_DUPLEX,
+ PROP_DUPLEX,
+ NM_SETTING_PARAM_NONE,
+ NMSettingWiredPrivate,
+ duplex);
/**
* NMSettingWired:auto-negotiate:
@@ -1380,14 +1382,15 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* "speed" and "duplex" parameters (skips link configuration).
* ---end---
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_WIRED_AUTO_NEGOTIATE,
- PROP_AUTO_NEGOTIATE,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_wired_get_auto_negotiate,
- .to_dbus_data.including_default = TRUE);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_WIRED_AUTO_NEGOTIATE,
+ PROP_AUTO_NEGOTIATE,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingWiredPrivate,
+ auto_negotiate,
+ .to_dbus_data.including_default = TRUE);
/**
* NMSettingWired:mac-address:
@@ -1531,12 +1534,13 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* cloned-mac-address.
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK,
- PROP_GENERATE_MAC_ADDRESS_MASK,
- NM_SETTING_PARAM_FUZZY_IGNORE,
- nm_setting_wired_get_generate_mac_address_mask);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK,
+ PROP_GENERATE_MAC_ADDRESS_MASK,
+ NM_SETTING_PARAM_FUZZY_IGNORE,
+ NMSettingWiredPrivate,
+ generate_mac_address_mask);
/**
* NMSettingWired:mac-address-blacklist:
@@ -1627,12 +1631,13 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* example: NETTYPE=qeth
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_WIRED_S390_NETTYPE,
- PROP_S390_NETTYPE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_wired_get_s390_nettype);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_WIRED_S390_NETTYPE,
+ PROP_S390_NETTYPE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingWiredPrivate,
+ s390_nettype);
/**
* NMSettingWired:s390-options: (type GHashTable(utf8,utf8)):
@@ -1712,12 +1717,13 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* example: ETHTOOL_OPTS="wol gs sopass 00:11:22:33:44:55"
* ---end---
*/
- _nm_setting_property_define_string(properties_override,
- obj_properties,
- NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD,
- PROP_WAKE_ON_LAN_PASSWORD,
- NM_SETTING_PARAM_NONE,
- nm_setting_wired_get_wake_on_lan_password);
+ _nm_setting_property_define_direct_string(properties_override,
+ obj_properties,
+ NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD,
+ PROP_WAKE_ON_LAN_PASSWORD,
+ NM_SETTING_PARAM_NONE,
+ NMSettingWiredPrivate,
+ wol_password);
/**
* NMSettingWired:accept-all-mac-addresses:
@@ -1745,8 +1751,9 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_WIRED,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_WIRED,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-wireguard.c b/src/libnm-core-impl/nm-setting-wireguard.c
index 3290ff567f..a270881edf 100644
--- a/src/libnm-core-impl/nm-setting-wireguard.c
+++ b/src/libnm-core-impl/nm-setting-wireguard.c
@@ -902,8 +902,8 @@ typedef struct {
guint32 fwmark;
guint32 mtu;
guint16 listen_port;
+ bool peer_routes;
bool private_key_valid : 1;
- bool peer_routes : 1;
} NMSettingWireGuardPrivate;
/**
@@ -2372,7 +2372,6 @@ nm_setting_wireguard_init(NMSettingWireGuard *setting)
priv->peers_arr = g_ptr_array_new();
priv->peers_hash = g_hash_table_new(nm_pstr_hash, nm_pstr_equal);
- priv->peer_routes = TRUE;
priv->ip4_auto_default_route = NM_TERNARY_DEFAULT;
priv->ip6_auto_default_route = NM_TERNARY_DEFAULT;
}
@@ -2514,13 +2513,14 @@ nm_setting_wireguard_class_init(NMSettingWireGuardClass *klass)
*
* Since: 1.16
**/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_WIREGUARD_PEER_ROUTES,
- PROP_PEER_ROUTES,
- TRUE,
- NM_SETTING_PARAM_INFERRABLE,
- nm_setting_wireguard_get_peer_routes);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_WIREGUARD_PEER_ROUTES,
+ PROP_PEER_ROUTES,
+ TRUE,
+ NM_SETTING_PARAM_INFERRABLE,
+ NMSettingWireGuardPrivate,
+ peer_routes);
/**
* NMSettingWireGuard:mtu:
@@ -2601,8 +2601,9 @@ nm_setting_wireguard_class_init(NMSettingWireGuardClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_WIREGUARD,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_WIREGUARD,
+ NULL,
+ properties_override,
+ G_STRUCT_OFFSET(NMSettingWireGuard, _priv));
}
diff --git a/src/libnm-core-impl/nm-setting-wireless-security.c b/src/libnm-core-impl/nm-setting-wireless-security.c
index 9e3c8d819f..ed77563295 100644
--- a/src/libnm-core-impl/nm-setting-wireless-security.c
+++ b/src/libnm-core-impl/nm-setting-wireless-security.c
@@ -1993,8 +1993,9 @@ nm_setting_wireless_security_class_init(NMSettingWirelessSecurityClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_WIRELESS_SECURITY,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_WIRELESS_SECURITY,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-wireless.c b/src/libnm-core-impl/nm-setting-wireless.c
index 5bdedf9bfb..83f8afc158 100644
--- a/src/libnm-core-impl/nm-setting-wireless.c
+++ b/src/libnm-core-impl/nm-setting-wireless.c
@@ -63,7 +63,7 @@ typedef struct {
guint32 mtu;
guint32 powersave;
guint32 wowl;
- bool hidden : 1;
+ bool hidden;
} NMSettingWirelessPrivate;
/**
@@ -1833,13 +1833,14 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
* description: Whether the network hides the SSID.
* ---end---
*/
- _nm_setting_property_define_boolean(properties_override,
- obj_properties,
- NM_SETTING_WIRELESS_HIDDEN,
- PROP_HIDDEN,
- FALSE,
- NM_SETTING_PARAM_NONE,
- nm_setting_wireless_get_hidden);
+ _nm_setting_property_define_direct_boolean(properties_override,
+ obj_properties,
+ NM_SETTING_WIRELESS_HIDDEN,
+ PROP_HIDDEN,
+ FALSE,
+ NM_SETTING_PARAM_NONE,
+ NMSettingWirelessPrivate,
+ hidden);
/**
* NMSettingWireless:powersave:
@@ -1985,8 +1986,9 @@ nm_setting_wireless_class_init(NMSettingWirelessClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit_full(setting_class,
- NM_META_SETTING_TYPE_WIRELESS,
- NULL,
- properties_override);
+ _nm_setting_class_commit(setting_class,
+ NM_META_SETTING_TYPE_WIRELESS,
+ NULL,
+ properties_override,
+ NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
}
diff --git a/src/libnm-core-impl/nm-setting-wpan.c b/src/libnm-core-impl/nm-setting-wpan.c
index f1d532af8e..30d81890c8 100644
--- a/src/libnm-core-impl/nm-setting-wpan.c
+++ b/src/libnm-core-impl/nm-setting-wpan.c
@@ -389,5 +389,5 @@ nm_setting_wpan_class_init(NMSettingWpanClass *klass)
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
- _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_WPAN);
+ _nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_WPAN, NULL, NULL, 0);
}
diff --git a/src/libnm-core-impl/nm-setting.c b/src/libnm-core-impl/nm-setting.c
index 3f32e181d8..f6ef8c74ba 100644
--- a/src/libnm-core-impl/nm-setting.c
+++ b/src/libnm-core-impl/nm-setting.c
@@ -227,11 +227,11 @@ _property_infos_sort_cmp_setting_connection(gconstpointer p_a,
static const NMSettInfoProperty *const *
_property_infos_sort(const NMSettInfoProperty *property_infos,
- guint property_infos_len,
+ guint16 property_infos_len,
NMSettingClass * setting_class)
{
const NMSettInfoProperty **arr;
- guint i;
+ guint16 i;
#if NM_MORE_ASSERTS > 5
/* assert that the property names are all unique and sorted. */
@@ -263,17 +263,30 @@ _property_infos_sort(const NMSettInfoProperty *property_infos,
return arr;
}
+static int
+_property_lookup_by_param_spec_sort(gconstpointer p_a, gconstpointer p_b, gpointer user_data)
+{
+ const NMSettInfoPropertLookupByParamSpec *a = p_a;
+ const NMSettInfoPropertLookupByParamSpec *b = p_b;
+
+ NM_CMP_DIRECT(a->param_spec_as_uint, b->param_spec_as_uint);
+ return 0;
+}
+
void
-_nm_setting_class_commit_full(NMSettingClass * setting_class,
- NMMetaSettingType meta_type,
- const NMSettInfoSettDetail *detail,
- GArray * properties_override)
+_nm_setting_class_commit(NMSettingClass * setting_class,
+ NMMetaSettingType meta_type,
+ const NMSettInfoSettDetail *detail,
+ GArray * properties_override,
+ gint16 private_offset)
{
NMSettInfoSetting *sett_info;
- gs_free GParamSpec **property_specs = NULL;
- guint n_property_specs;
- guint override_len;
- guint i;
+ gs_free GParamSpec ** property_specs = NULL;
+ guint n_property_specs;
+ NMSettInfoPropertLookupByParamSpec *lookup_by_iter;
+ guint override_len;
+ guint i;
+ guint16 j;
nm_assert(NM_IS_SETTING_CLASS(setting_class));
nm_assert(!setting_class->setting_info);
@@ -313,18 +326,18 @@ _nm_setting_class_commit_full(NMSettingClass * setting_class,
for (i = 0; i < override_len; i++) {
const NMSettInfoProperty *p = &g_array_index(properties_override, NMSettInfoProperty, i);
gboolean found = FALSE;
- guint j;
+ guint k;
nm_assert(
!_nm_sett_info_property_find_in_array((NMSettInfoProperty *) properties_override->data,
i,
p->name));
- for (j = 0; j < n_property_specs; j++) {
- if (!nm_streq(property_specs[j]->name, p->name))
+ for (k = 0; k < n_property_specs; k++) {
+ if (!nm_streq(property_specs[k]->name, p->name))
continue;
nm_assert(!found);
found = TRUE;
- nm_assert(p->param_spec == property_specs[j]);
+ nm_assert(p->param_spec == property_specs[k]);
}
nm_assert(found == (p->param_spec != NULL));
}
@@ -400,9 +413,22 @@ has_property_type:
setting_class->setting_info = &nm_meta_setting_infos[meta_type];
sett_info->setting_class = setting_class;
+
+ if (private_offset == NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS) {
+ int o;
+
+ o = g_type_class_get_instance_private_offset(setting_class);
+ nm_assert(o != NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
+ nm_assert(o > G_MININT16);
+ nm_assert(o < 0);
+ private_offset = o;
+ }
+ sett_info->private_offset = private_offset;
+
if (detail)
sett_info->detail = *detail;
nm_assert(properties_override->len > 0);
+ nm_assert(properties_override->len < G_MAXUINT16);
sett_info->property_infos_len = properties_override->len;
sett_info->property_infos =
nm_memdup(properties_override->data, sizeof(NMSettInfoProperty) * properties_override->len);
@@ -411,6 +437,33 @@ has_property_type:
sett_info->property_infos_len,
setting_class);
+ nm_assert(sett_info->property_infos_len < G_MAXUINT16);
+ sett_info->property_lookup_by_param_spec_len = 0;
+ for (j = 0; j < sett_info->property_infos_len; j++) {
+ if (sett_info->property_infos[j].param_spec) {
+ sett_info->property_lookup_by_param_spec_len++;
+ }
+ }
+ sett_info->property_lookup_by_param_spec =
+ g_new(NMSettInfoPropertLookupByParamSpec, sett_info->property_lookup_by_param_spec_len);
+ lookup_by_iter =
+ (NMSettInfoPropertLookupByParamSpec *) sett_info->property_lookup_by_param_spec;
+ for (j = 0; j < sett_info->property_infos_len; j++) {
+ const NMSettInfoProperty *property_info = &sett_info->property_infos[j];
+
+ if (property_info->param_spec) {
+ *(lookup_by_iter++) = (NMSettInfoPropertLookupByParamSpec){
+ .param_spec_as_uint = (uintptr_t) ((gpointer) property_info->param_spec),
+ .property_info = property_info,
+ };
+ }
+ }
+ g_qsort_with_data(sett_info->property_lookup_by_param_spec,
+ sett_info->property_lookup_by_param_spec_len,
+ sizeof(NMSettInfoPropertLookupByParamSpec),
+ _property_lookup_by_param_spec_sort,
+ NULL);
+
g_array_free(properties_override, TRUE);
}
@@ -460,6 +513,47 @@ _nm_setting_class_get_sett_info(NMSettingClass *setting_class)
return sett_info;
}
+const NMSettInfoProperty *
+_nm_sett_info_property_lookup_by_param_spec(const NMSettInfoSetting *sett_info,
+ const GParamSpec * param_spec)
+{
+ NMSettInfoPropertLookupByParamSpec needle;
+ int imin;
+ int imax;
+ int imid;
+ int cmp;
+
+ nm_assert(sett_info);
+ nm_assert(param_spec);
+
+ /* ensure that "int" is large enough to contain the index variables. */
+ G_STATIC_ASSERT_EXPR(sizeof(int) > sizeof(sett_info->property_lookup_by_param_spec_len));
+
+ if (sett_info->property_lookup_by_param_spec_len == 0)
+ return NULL;
+
+ needle.param_spec_as_uint = (uintptr_t) ((gpointer) param_spec);
+
+ imin = 0;
+ imax = sett_info->property_lookup_by_param_spec_len - 1;
+ while (imin <= imax) {
+ imid = imin + (imax - imin) / 2;
+
+ cmp = _property_lookup_by_param_spec_sort(&sett_info->property_lookup_by_param_spec[imid],
+ &needle,
+ NULL);
+ if (cmp == 0)
+ return sett_info->property_lookup_by_param_spec[imid].property_info;
+
+ if (cmp < 0)
+ imin = imid + 1;
+ else
+ imax = imid - 1;
+ }
+
+ return NULL;
+}
+
/*****************************************************************************/
void
@@ -531,49 +625,286 @@ _nm_setting_use_legacy_property(NMSetting * setting,
/*****************************************************************************/
-GVariant *
-_nm_setting_property_to_dbus_fcn_get_boolean(const NMSettInfoSetting * sett_info,
- guint property_idx,
- NMConnection * connection,
- NMSetting * setting,
- NMConnectionSerializationFlags flags,
- const NMConnectionSerializationOptions *options)
+void
+_nm_setting_property_get_property_direct(GObject * object,
+ guint prop_id,
+ GValue * value,
+ GParamSpec *pspec)
{
- const NMSettInfoProperty *property_info = &sett_info->property_infos[property_idx];
- gboolean val;
+ NMSetting * setting = NM_SETTING(object);
+ const NMSettInfoSetting * sett_info;
+ const NMSettInfoProperty *property_info;
- val = !!property_info->to_dbus_data.get_boolean(setting);
- if (!property_info->to_dbus_data.including_default
- && val == NM_G_PARAM_SPEC_GET_DEFAULT_BOOLEAN(property_info->param_spec))
- return NULL;
- return g_variant_ref(nm_g_variant_singleton_b(val));
+ sett_info = _nm_setting_class_get_sett_info(NM_SETTING_GET_CLASS(setting));
+ nm_assert(sett_info);
+
+ property_info = _nm_sett_info_property_lookup_by_param_spec(sett_info, pspec);
+ if (!property_info)
+ goto out_fail;
+
+ nm_assert(property_info->param_spec == pspec);
+
+ switch (property_info->property_type->direct_type) {
+ case NM_VALUE_TYPE_BOOL:
+ {
+ const bool *p_val =
+ _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
+
+ g_value_set_boolean(value, *p_val);
+ return;
+ }
+ case NM_VALUE_TYPE_UINT32:
+ {
+ const guint32 *p_val =
+ _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
+
+ g_value_set_uint(value, *p_val);
+ return;
+ }
+ case NM_VALUE_TYPE_STRING:
+ {
+ const char *const *p_val =
+ _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
+
+ g_value_set_string(value, *p_val);
+ return;
+ }
+ default:
+ goto out_fail;
+ }
+
+ return;
+
+out_fail:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
+void
+_nm_setting_property_set_property_direct(GObject * object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec * pspec)
+{
+ NMSetting * setting = NM_SETTING(object);
+ const NMSettInfoSetting * sett_info;
+ const NMSettInfoProperty *property_info;
+
+ sett_info = _nm_setting_class_get_sett_info(NM_SETTING_GET_CLASS(setting));
+ nm_assert(sett_info);
+
+ property_info = _nm_sett_info_property_lookup_by_param_spec(sett_info, pspec);
+ if (!property_info)
+ goto out_fail;
+
+ nm_assert(property_info->param_spec == pspec);
+
+ /* properties with special setters are not yet implemented! */
+ nm_assert(!property_info->direct_has_special_setter);
+
+ switch (property_info->property_type->direct_type) {
+ case NM_VALUE_TYPE_BOOL:
+ {
+ bool * p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
+ gboolean v;
+
+ v = g_value_get_boolean(value);
+ if (*p_val == v)
+ return;
+ *p_val = v;
+ goto out_notify;
+ }
+ case NM_VALUE_TYPE_UINT32:
+ {
+ guint32 *p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
+ guint v;
+
+ v = g_value_get_uint(value);
+ if (*p_val == v)
+ return;
+ *p_val = v;
+
+ /* truncation cannot happen, because the param_spec is supposed to have suitable
+ * minimum/maximum values so that we are in range for uint32. */
+ nm_assert(*p_val == v);
+ goto out_notify;
+ }
+ case NM_VALUE_TYPE_STRING:
+ {
+ char **p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
+
+ if (!nm_utils_strdup_reset(p_val, g_value_get_string(value)))
+ return;
+ goto out_notify;
+ }
+ default:
+ goto out_fail;
+ }
+
+ return;
+
+out_notify:
+ /* If explicit-notify would be set, we would need to emit g_object_notify_by_pspec().
+ *
+ * Currently we never set that, also because we still support glib 2.40. */
+ nm_assert(!NM_FLAGS_HAS(pspec->flags, 1 << 30 /* G_PARAM_EXPLICIT_NOTIFY */));
+ return;
+
+out_fail:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+}
+
+/*****************************************************************************/
+
+static void
+_init_direct(NMSetting *setting)
+{
+ const NMSettInfoSetting *sett_info;
+ guint16 i;
+
+ sett_info = _nm_setting_class_get_sett_info(NM_SETTING_GET_CLASS(setting));
+ nm_assert(sett_info);
+
+ for (i = 0; i < sett_info->property_infos_len; i++) {
+ const NMSettInfoProperty *property_info = &sett_info->property_infos[i];
+
+ /* We don't emit any g_object_notify_by_pspec(), because this is
+ * only supposed to be called during initialization of the GObject
+ * instance. */
+
+ switch (property_info->property_type->direct_type) {
+ case NM_VALUE_TYPE_NONE:
+ break;
+ case NM_VALUE_TYPE_BOOL:
+ {
+ bool *p_val = _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
+ gboolean def_val;
+
+ def_val = NM_G_PARAM_SPEC_GET_DEFAULT_BOOLEAN(property_info->param_spec);
+ nm_assert(*p_val == FALSE);
+ *p_val = def_val;
+ break;
+ }
+ case NM_VALUE_TYPE_UINT32:
+ {
+ guint32 *p_val =
+ _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
+ guint def_val;
+
+ def_val = NM_G_PARAM_SPEC_GET_DEFAULT_UINT(property_info->param_spec);
+ nm_assert(*p_val == 0);
+ *p_val = def_val;
+ break;
+ }
+ case NM_VALUE_TYPE_STRING:
+ nm_assert(!NM_G_PARAM_SPEC_GET_DEFAULT_STRING(property_info->param_spec));
+ nm_assert(!(
+ *((const char *const *)
+ _nm_setting_get_private(setting, sett_info, property_info->direct_offset))));
+ break;
+ default:
+ nm_assert_not_reached();
+ break;
+ }
+ }
+}
+
+static void
+_finalize_direct(NMSetting *setting)
+{
+ const NMSettInfoSetting *sett_info;
+ guint16 i;
+
+ sett_info = _nm_setting_class_get_sett_info(NM_SETTING_GET_CLASS(setting));
+ nm_assert(sett_info);
+
+ for (i = 0; i < sett_info->property_infos_len; i++) {
+ const NMSettInfoProperty *property_info = &sett_info->property_infos[i];
+
+ /* We only:
+ *
+ * - reset fields where there is something to free. E.g. boolean
+ * properties are not reset to their default.
+ * - clear/free properties, without emitting g_object_notify_by_pspec(),
+ * because this is called only during finalization. */
+
+ switch (property_info->property_type->direct_type) {
+ case NM_VALUE_TYPE_NONE:
+ case NM_VALUE_TYPE_BOOL:
+ case NM_VALUE_TYPE_UINT32:
+ break;
+ case NM_VALUE_TYPE_STRING:
+ {
+ char **p_val =
+ _nm_setting_get_private(setting, sett_info, property_info->direct_offset);
+
+ nm_clear_g_free(p_val);
+ break;
+ }
+ default:
+ nm_assert_not_reached();
+ break;
+ }
+ }
+}
+
+/*****************************************************************************/
+
GVariant *
-_nm_setting_property_to_dbus_fcn_get_string(const NMSettInfoSetting * sett_info,
- guint property_idx,
- NMConnection * connection,
- NMSetting * setting,
- NMConnectionSerializationFlags flags,
- const NMConnectionSerializationOptions *options)
+_nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting * sett_info,
+ guint property_idx,
+ NMConnection * connection,
+ NMSetting * setting,
+ NMConnectionSerializationFlags flags,
+ const NMConnectionSerializationOptions *options)
{
const NMSettInfoProperty *property_info = &sett_info->property_infos[property_idx];
- const char * val;
- /* For string properties that are implemented via this function, the default is always NULL.
- * In general, having strings default to NULL is most advisable.
- *
- * Setting "including_default" for a string makes no sense because a
- * GVariant of type "s" cannot express NULL. */
- nm_assert(!NM_G_PARAM_SPEC_GET_DEFAULT_STRING(property_info->param_spec));
- nm_assert(!property_info->to_dbus_data.including_default);
+ switch (property_info->property_type->direct_type) {
+ case NM_VALUE_TYPE_BOOL:
+ {
+ gboolean val;
- val = property_info->to_dbus_data.get_string(setting);
- if (!val)
- return NULL;
- if (!val[0])
- return g_variant_ref(nm_g_variant_singleton_s_empty());
- return g_variant_new_string(val);
+ val = *((bool *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset));
+ if (!property_info->to_dbus_data.including_default
+ && val == NM_G_PARAM_SPEC_GET_DEFAULT_BOOLEAN(property_info->param_spec))
+ return NULL;
+ return g_variant_ref(nm_g_variant_singleton_b(val));
+ }
+ case NM_VALUE_TYPE_UINT32:
+ {
+ guint32 val;
+
+ val = *(
+ (guint32 *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset));
+ if (!property_info->to_dbus_data.including_default
+ && val == NM_G_PARAM_SPEC_GET_DEFAULT_UINT(property_info->param_spec))
+ return NULL;
+ return g_variant_new_uint32(val);
+ }
+ case NM_VALUE_TYPE_STRING:
+ {
+ const char *val;
+
+ /* For string properties that are implemented via this function, the default is always NULL.
+ * In general, having strings default to NULL is most advisable.
+ *
+ * Setting "including_default" for a string makes no sense because a
+ * GVariant of type "s" cannot express NULL. */
+ nm_assert(!NM_G_PARAM_SPEC_GET_DEFAULT_STRING(property_info->param_spec));
+ nm_assert(!property_info->to_dbus_data.including_default);
+
+ val = *((const char *const *) _nm_setting_get_private(setting,
+ sett_info,
+ property_info->direct_offset));
+ if (!val)
+ return NULL;
+ if (!val[0])
+ return g_variant_ref(nm_g_variant_singleton_s_empty());
+ return g_variant_new_string(val);
+ }
+ default:
+ return nm_assert_unreachable_val(NULL);
+ }
}
GVariant *
@@ -750,7 +1081,9 @@ _nm_setting_to_dbus(NMSetting * setting,
NMSettingPrivate * priv;
GVariantBuilder builder;
const NMSettInfoSetting *sett_info;
- guint n_properties, i;
+ guint n_properties;
+ guint i;
+ guint16 j;
const char *const * gendata_keys;
g_return_val_if_fail(NM_IS_SETTING(setting), NULL);
@@ -768,12 +1101,12 @@ _nm_setting_to_dbus(NMSetting * 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 (j = 0; j < sett_info->property_infos_len; j++) {
gs_unref_variant GVariant *dbus_value = NULL;
- dbus_value = property_to_dbus(sett_info, i, connection, setting, flags, options, FALSE);
+ dbus_value = property_to_dbus(sett_info, j, connection, setting, flags, options, FALSE);
if (dbus_value) {
- g_variant_builder_add(&builder, "{sv}", sett_info->property_infos[i].name, dbus_value);
+ g_variant_builder_add(&builder, "{sv}", sett_info->property_infos[j].name, dbus_value);
}
}
@@ -889,8 +1222,7 @@ init_from_dbus(NMSetting * setting,
GError ** error)
{
const NMSettInfoSetting *sett_info;
-
- guint i;
+ guint16 i;
nm_assert(NM_IS_SETTING(setting));
nm_assert(!NM_FLAGS_ANY(parse_flags, ~NM_SETTING_PARSE_FLAGS_ALL));
@@ -1120,6 +1452,9 @@ _gobject_copy_property(GObject *src, GObject *dst, const char *property_name, GT
static void
duplicate_copy_properties(const NMSettInfoSetting *sett_info, NMSetting *src, NMSetting *dst)
{
+ gboolean frozen = FALSE;
+ guint16 i;
+
if (sett_info->detail.gendata_info) {
GenData *gendata = _gendata_hash(src, FALSE);
@@ -1138,33 +1473,28 @@ duplicate_copy_properties(const NMSettInfoSetting *sett_info, NMSetting *src, NM
}
}
- if (sett_info->property_infos_len > 0) {
- gboolean frozen = FALSE;
- guint i;
-
- for (i = 0; i < sett_info->property_infos_len; i++) {
- const NMSettInfoProperty *property_info = &sett_info->property_infos[i];
-
- if (property_info->param_spec) {
- if ((property_info->param_spec->flags & (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY))
- != G_PARAM_WRITABLE)
- continue;
+ for (i = 0; i < sett_info->property_infos_len; i++) {
+ const NMSettInfoProperty *property_info = &sett_info->property_infos[i];
- if (!frozen) {
- g_object_freeze_notify(G_OBJECT(dst));
- frozen = TRUE;
- }
- _gobject_copy_property(G_OBJECT(src),
- G_OBJECT(dst),
- property_info->param_spec->name,
- G_PARAM_SPEC_VALUE_TYPE(property_info->param_spec));
+ if (property_info->param_spec) {
+ if ((property_info->param_spec->flags & (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY))
+ != G_PARAM_WRITABLE)
continue;
+
+ if (!frozen) {
+ g_object_freeze_notify(G_OBJECT(dst));
+ frozen = TRUE;
}
+ _gobject_copy_property(G_OBJECT(src),
+ G_OBJECT(dst),
+ property_info->param_spec->name,
+ G_PARAM_SPEC_VALUE_TYPE(property_info->param_spec));
+ continue;
}
-
- if (frozen)
- g_object_thaw_notify(G_OBJECT(dst));
}
+
+ if (frozen)
+ g_object_thaw_notify(G_OBJECT(dst));
}
/**
@@ -1494,7 +1824,7 @@ _nm_setting_compare(NMConnection * con_a,
NMSettingCompareFlags flags)
{
const NMSettInfoSetting *sett_info;
- guint i;
+ guint16 i;
g_return_val_if_fail(NM_IS_SETTING(a), FALSE);
g_return_val_if_fail(NM_IS_SETTING(b), FALSE);
@@ -1584,7 +1914,6 @@ _nm_setting_diff(NMConnection * con_a,
GHashTable ** results)
{
const NMSettInfoSetting *sett_info;
- guint i;
NMSettingDiffResult a_result = NM_SETTING_DIFF_RESULT_IN_A;
NMSettingDiffResult b_result = NM_SETTING_DIFF_RESULT_IN_B;
NMSettingDiffResult a_result_default = NM_SETTING_DIFF_RESULT_IN_A_DEFAULT;
@@ -1592,6 +1921,7 @@ _nm_setting_diff(NMConnection * con_a,
gboolean results_created = FALSE;
gboolean compared_any = FALSE;
gboolean diff_found = FALSE;
+ guint16 i;
g_return_val_if_fail(results != NULL, FALSE);
g_return_val_if_fail(NM_IS_SETTING(a), FALSE);
@@ -1829,6 +2159,7 @@ nm_setting_enumerate_values(NMSetting *setting, NMSettingValueIterFn func, gpoin
{
const NMSettInfoSetting *sett_info;
guint i;
+ guint16 j;
g_return_if_fail(NM_IS_SETTING(setting));
g_return_if_fail(func != NULL);
@@ -1867,9 +2198,9 @@ nm_setting_enumerate_values(NMSetting *setting, NMSettingValueIterFn func, gpoin
return;
}
- for (i = 0; i < sett_info->property_infos_len; i++) {
+ for (j = 0; j < sett_info->property_infos_len; j++) {
NM_SETTING_GET_CLASS(setting)->enumerate_values(
- _nm_sett_info_property_info_get_sorted(sett_info, i),
+ _nm_sett_info_property_info_get_sorted(sett_info, j),
setting,
func,
user_data);
@@ -1881,7 +2212,7 @@ aggregate(NMSetting *setting, int type_i, gpointer arg)
{
NMConnectionAggregateType type = type_i;
const NMSettInfoSetting * sett_info;
- guint i;
+ guint16 i;
nm_assert(NM_IN_SET(type,
NM_CONNECTION_AGGREGATE_ANY_SECRETS,
@@ -2011,7 +2342,7 @@ _nm_setting_clear_secrets(NMSetting * setting,
{
const NMSettInfoSetting *sett_info;
gboolean changed = FALSE;
- guint i;
+ guint16 i;
gboolean (*my_clear_secrets)(const struct _NMSettInfoSetting *sett_info,
guint property_idx,
NMSetting * setting,
@@ -2402,13 +2733,20 @@ const NMSettInfoPropertType nm_sett_info_propert_type_plain_i =
const NMSettInfoPropertType nm_sett_info_propert_type_plain_u =
NM_SETT_INFO_PROPERT_TYPE_GPROP_INIT(G_VARIANT_TYPE_UINT32);
-const NMSettInfoPropertType nm_sett_info_propert_type_boolean = NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(
- G_VARIANT_TYPE_BOOLEAN,
- .to_dbus_fcn = _nm_setting_property_to_dbus_fcn_get_boolean);
+const NMSettInfoPropertType nm_sett_info_propert_type_direct_boolean =
+ NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(G_VARIANT_TYPE_BOOLEAN,
+ .direct_type = NM_VALUE_TYPE_BOOL,
+ .to_dbus_fcn = _nm_setting_property_to_dbus_fcn_direct);
+
+const NMSettInfoPropertType nm_sett_info_propert_type_direct_uint32 =
+ NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(G_VARIANT_TYPE_UINT32,
+ .direct_type = NM_VALUE_TYPE_UINT32,
+ .to_dbus_fcn = _nm_setting_property_to_dbus_fcn_direct);
-const NMSettInfoPropertType nm_sett_info_propert_type_string =
+const NMSettInfoPropertType nm_sett_info_propert_type_direct_string =
NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(G_VARIANT_TYPE_STRING,
- .to_dbus_fcn = _nm_setting_property_to_dbus_fcn_get_string);
+ .direct_type = NM_VALUE_TYPE_STRING,
+ .to_dbus_fcn = _nm_setting_property_to_dbus_fcn_direct);
/*****************************************************************************/
@@ -2847,9 +3185,37 @@ nm_setting_init(NMSetting *setting)
{}
static void
+constructed(GObject *object)
+{
+ NMSetting * self = NM_SETTING(object);
+ NMSettingClass *klass = NM_SETTING_GET_CLASS(self);
+
+ /* we don't support that NMSetting subclasses override constructed.
+ * They all must have no G_PARAM_CONSTRUCT/G_PARAM_CONSTRUCT_ONLY
+ * properties, otherwise the automatism of _init_direct() needs
+ * careful adjustment. */
+ nm_assert(G_OBJECT_CLASS(klass)->constructed == constructed);
+
+ /* we always initialize the defaults of the (direct) properties. Note that:
+ *
+ * - we don't use CONSTRUCT properties, because they have an overhead during
+ * each object creation. Via _init_direct() we can do it more efficiently.
+ *
+ * - we always call this, because we want to get all default values right.
+ * We even call this for NMSetting subclasses that (historically) are not
+ * yet aware of this happening.
+ */
+ _init_direct(self);
+
+ G_OBJECT_CLASS(nm_setting_parent_class)->constructed(object);
+}
+
+static void
finalize(GObject *object)
{
- NMSettingPrivate *priv = NM_SETTING_GET_PRIVATE(object);
+ NMSetting * self = NM_SETTING(object);
+ NMSettingPrivate *priv = NM_SETTING_GET_PRIVATE(self);
+ NMSettingClass * klass = NM_SETTING_GET_CLASS(self);
if (priv->gendata) {
g_free(priv->gendata->names);
@@ -2859,6 +3225,9 @@ finalize(GObject *object)
}
G_OBJECT_CLASS(nm_setting_parent_class)->finalize(object);
+
+ if (klass->finalize_direct)
+ _finalize_direct(self);
}
static void
@@ -2868,6 +3237,7 @@ nm_setting_class_init(NMSettingClass *setting_class)
g_type_class_add_private(setting_class, sizeof(NMSettingPrivate));
+ object_class->constructed = constructed;
object_class->get_property = get_property;
object_class->finalize = finalize;
diff --git a/src/libnm-core-impl/tests/test-setting.c b/src/libnm-core-impl/tests/test-setting.c
index f29cd6a8c1..51077e2360 100644
--- a/src/libnm-core-impl/tests/test-setting.c
+++ b/src/libnm-core-impl/tests/test-setting.c
@@ -4388,6 +4388,9 @@ test_setting_metadata(void)
guint prop_idx;
gs_free GParamSpec **property_specs = NULL;
guint n_property_specs;
+ guint n_param_spec;
+ guint i;
+ guint j;
g_assert(sis);
@@ -4404,8 +4407,22 @@ test_setting_metadata(void)
g_assert_cmpint(sis->property_infos_len, >, 0);
g_assert(sis->property_infos);
+ {
+ int offset;
+
+ if (sis->private_offset < 0) {
+ offset = g_type_class_get_instance_private_offset(sis->setting_class);
+ g_assert_cmpint(sis->private_offset, ==, offset);
+ } else {
+ /* it would be nice to assert that this class has no private data.
+ * But we cannot. */
+ }
+ }
+
h_properties = g_hash_table_new(nm_str_hash, g_str_equal);
+ n_param_spec = 0;
+
for (prop_idx = 0; prop_idx < sis->property_infos_len; prop_idx++) {
const NMSettInfoProperty *sip = &sis->property_infos[prop_idx];
GArray * property_types_data;
@@ -4414,6 +4431,9 @@ test_setting_metadata(void)
g_assert(sip->name);
+ if (sip->param_spec)
+ n_param_spec++;
+
if (prop_idx > 0)
g_assert_cmpint(strcmp(sis->property_infos[prop_idx - 1].name, sip->name), <, 0);
@@ -4421,6 +4441,43 @@ test_setting_metadata(void)
g_assert(sip->property_type->dbus_type);
g_assert(g_variant_type_string_is_valid((const char *) sip->property_type->dbus_type));
+ if (sip->property_type->direct_type == NM_VALUE_TYPE_NONE) {
+ g_assert_cmpint(sip->direct_offset, ==, 0);
+ } else if (sip->property_type->direct_type == NM_VALUE_TYPE_BOOL) {
+ g_assert(sip->property_type == &nm_sett_info_propert_type_direct_boolean);
+ g_assert(g_variant_type_equal(sip->property_type->dbus_type, "b"));
+ g_assert(sip->property_type->to_dbus_fcn
+ == _nm_setting_property_to_dbus_fcn_direct);
+ g_assert(sip->param_spec);
+ g_assert(sip->param_spec->value_type == G_TYPE_BOOLEAN);
+ can_set_including_default = TRUE;
+ } else if (sip->property_type->direct_type == NM_VALUE_TYPE_UINT32) {
+ const GParamSpecUInt *pspec;
+
+ g_assert(sip->property_type == &nm_sett_info_propert_type_direct_uint32);
+ g_assert(g_variant_type_equal(sip->property_type->dbus_type, "u"));
+ g_assert(sip->property_type->to_dbus_fcn
+ == _nm_setting_property_to_dbus_fcn_direct);
+ g_assert(sip->param_spec);
+ g_assert(sip->param_spec->value_type == G_TYPE_UINT);
+
+ pspec = NM_G_PARAM_SPEC_CAST_UINT(sip->param_spec);
+ g_assert_cmpint(pspec->minimum, <=, pspec->maximum);
+ g_assert_cmpint(pspec->default_value, >=, pspec->minimum);
+ g_assert_cmpint(pspec->default_value, <=, pspec->maximum);
+
+ g_assert_cmpint(pspec->maximum, <=, (guint64) G_MAXUINT32);
+
+ can_set_including_default = TRUE;
+ } else if (sip->property_type->direct_type == NM_VALUE_TYPE_STRING) {
+ 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);
+ g_assert(sip->param_spec);
+ g_assert(sip->param_spec->value_type == G_TYPE_STRING);
+ } else
+ g_assert_not_reached();
+
if (!sip->property_type->to_dbus_fcn) {
/* it's allowed to have no to_dbus_fcn(), to ignore a property. But such
* properties must not have a param_spec and no gprop_to_dbus_fcn. */
@@ -4456,17 +4513,6 @@ check_done:;
!= NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_DEFAULT)
g_assert(!sip->to_dbus_data.gprop_to_dbus_fcn);
can_set_including_default = TRUE;
- } else if (sip->property_type->to_dbus_fcn
- == _nm_setting_property_to_dbus_fcn_get_boolean) {
- g_assert(sip->param_spec);
- g_assert(sip->param_spec->value_type == G_TYPE_BOOLEAN);
- g_assert(sip->to_dbus_data.get_boolean);
- can_set_including_default = TRUE;
- } else if (sip->property_type->to_dbus_fcn
- == _nm_setting_property_to_dbus_fcn_get_string) {
- g_assert(sip->param_spec);
- g_assert(sip->param_spec->value_type == G_TYPE_STRING);
- g_assert(sip->to_dbus_data.get_string);
}
if (!can_set_including_default)
@@ -4520,6 +4566,9 @@ check_done:;
if (NM_FLAGS_HAS(sip->param_spec->flags, NM_SETTING_PARAM_TO_DBUS_IGNORE_FLAGS))
g_assert(sip->property_type->to_dbus_fcn);
+
+ g_assert(!NM_FLAGS_HAS(sip->param_spec->flags, G_PARAM_CONSTRUCT));
+ g_assert(!NM_FLAGS_HAS(sip->param_spec->flags, G_PARAM_CONSTRUCT_ONLY));
}
}
@@ -4567,6 +4616,44 @@ check_done:;
g_assert_cmpstr(sis->property_infos[0].name, ==, NM_SETTING_NAME);
} else
g_assert_cmpint(meta_type, !=, NM_META_SETTING_TYPE_ETHTOOL);
+
+ g_assert_cmpint(n_param_spec, >, 0);
+ g_assert_cmpint(n_param_spec, ==, sis->property_lookup_by_param_spec_len);
+ g_assert(sis->property_lookup_by_param_spec);
+ for (i = 0; i < sis->property_lookup_by_param_spec_len; i++) {
+ const NMSettInfoPropertLookupByParamSpec *p = &sis->property_lookup_by_param_spec[i];
+ guint n_found;
+
+ if (i > 0) {
+ g_assert_cmpint(sis->property_lookup_by_param_spec[i - 1].param_spec_as_uint,
+ <,
+ p->param_spec_as_uint);
+ }
+ g_assert(p->property_info);
+ g_assert(p->property_info >= sis->property_infos);
+ g_assert(p->property_info < &sis->property_infos[sis->property_infos_len]);
+ g_assert(p->property_info
+ == &sis->property_infos[p->property_info - sis->property_infos]);
+
+ g_assert(p->property_info->param_spec);
+ g_assert(p->param_spec_as_uint
+ == ((uintptr_t) ((gpointer) p->property_info->param_spec)));
+
+ g_assert(_nm_sett_info_property_lookup_by_param_spec(sis, p->property_info->param_spec)
+ == p->property_info);
+
+ n_found = 0;
+ for (j = 0; j < sis->property_infos_len; j++) {
+ const NMSettInfoProperty *pip2 = &sis->property_infos[j];
+
+ if (pip2->param_spec
+ && p->param_spec_as_uint == ((uintptr_t) ((gpointer) pip2->param_spec))) {
+ g_assert(pip2 == p->property_info);
+ n_found++;
+ }
+ }
+ g_assert(n_found == 1);
+ }
}
{
@@ -4586,7 +4673,7 @@ check_done:;
const NMSettInfoPropertType *pt_2 = a_property_types[prop_idx_2];
if (!g_variant_type_equal(pt->dbus_type, pt_2->dbus_type)
- || pt->to_dbus_fcn != pt_2->to_dbus_fcn
+ || pt->direct_type != pt_2->direct_type || pt->to_dbus_fcn != pt_2->to_dbus_fcn
|| pt->from_dbus_fcn != pt_2->from_dbus_fcn
|| pt->missing_from_dbus_fcn != pt_2->missing_from_dbus_fcn
|| pt->gprop_from_dbus_fcn != pt_2->gprop_from_dbus_fcn
@@ -4747,6 +4834,38 @@ test_setting_connection_secondaries_verify(void)
/*****************************************************************************/
+static void
+test_6lowpan_1(void)
+{
+ gs_unref_object NMConnection *con = NULL;
+ NMSetting6Lowpan * s_6low;
+ gs_free char * value = NULL;
+
+ con = nmtst_create_minimal_connection("test-sec", NULL, NM_SETTING_6LOWPAN_SETTING_NAME, NULL);
+
+ s_6low = NM_SETTING_6LOWPAN(nm_connection_get_setting(con, NM_TYPE_SETTING_6LOWPAN));
+ g_assert(s_6low);
+
+ g_assert_cmpstr(nm_setting_6lowpan_get_parent(s_6low), ==, NULL);
+ g_object_get(s_6low, NM_SETTING_6LOWPAN_PARENT, &value, NULL);
+ g_assert_cmpstr(value, ==, NULL);
+ nm_clear_g_free(&value);
+
+ g_object_set(s_6low, NM_SETTING_6LOWPAN_PARENT, "hello", NULL);
+ g_assert_cmpstr(nm_setting_6lowpan_get_parent(s_6low), ==, "hello");
+ g_object_get(s_6low, NM_SETTING_6LOWPAN_PARENT, &value, NULL);
+ g_assert_cmpstr(value, ==, "hello");
+ nm_clear_g_free(&value);
+
+ g_object_set(s_6low, NM_SETTING_6LOWPAN_PARENT, "world", NULL);
+ g_assert_cmpstr(nm_setting_6lowpan_get_parent(s_6low), ==, "world");
+ g_object_get(s_6low, NM_SETTING_6LOWPAN_PARENT, &value, NULL);
+ g_assert_cmpstr(value, ==, "world");
+ nm_clear_g_free(&value);
+}
+
+/*****************************************************************************/
+
NMTST_DEFINE();
int
@@ -4788,6 +4907,8 @@ main(int argc, char **argv)
g_test_add_func("/libnm/settings/ethtool/ring", test_ethtool_ring);
g_test_add_func("/libnm/settings/ethtool/pause", test_ethtool_pause);
+ g_test_add_func("/libnm/settings/6lowpan/1", test_6lowpan_1);
+
g_test_add_func("/libnm/settings/sriov/vf", test_sriov_vf);
g_test_add_func("/libnm/settings/sriov/vf-dup", test_sriov_vf_dup);
g_test_add_func("/libnm/settings/sriov/vf-vlan", test_sriov_vf_vlan);
diff --git a/src/libnm-core-intern/nm-core-internal.h b/src/libnm-core-intern/nm-core-internal.h
index 9ffaa05fd9..98fc0509ae 100644
--- a/src/libnm-core-intern/nm-core-internal.h
+++ b/src/libnm-core-intern/nm-core-internal.h
@@ -78,6 +78,7 @@
#include "nm-vpn-dbus-interface.h"
#include "nm-vpn-editor-plugin.h"
#include "libnm-core-aux-intern/nm-libnm-core-utils.h"
+#include "libnm-glib-aux/nm-value-type.h"
/* NM_SETTING_COMPARE_FLAG_INFERRABLE: check whether a device-generated
* connection can be replaced by a already-defined connection. This flag only
@@ -684,6 +685,14 @@ typedef enum _nm_packed {
typedef struct {
const GVariantType *dbus_type;
+ /* If this is not NM_VALUE_TYPE_UNSPEC, then this is a "direct" property,
+ * meaning that _nm_setting_get_private() at NMSettInfoProperty.direct_offset
+ * gives direct access to the field.
+ *
+ * Direct properties can use this information to generically implement access
+ * to the property value. */
+ NMValueType direct_type;
+
NMSettInfoPropToDBusFcn to_dbus_fcn;
NMSettInfoPropFromDBusFcn from_dbus_fcn;
NMSettInfoPropMissingFromDBusFcn missing_from_dbus_fcn;
@@ -707,12 +716,25 @@ struct _NMSettInfoProperty {
const NMSettInfoPropertType *property_type;
+ /* 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
+ * the direct location. */
+ guint16 direct_offset;
+
+ /* Currently, properties that set property_type->direct_type only have to_dbus_fcn()
+ * implemented "the direct way". For the property setter, they still call g_object_set().
+ * In the future, also other operations, like from_dbus_fcn() should be implemented
+ * by direct access (thereby, bypassing g_object_set()).
+ *
+ * A "direct_has_special_setter" property does something unusual, that will require special attention
+ * in the future, when we implement more functionality regarding the setter. It has no effect,
+ * except of marking those properties and serve as a reminder that special care needs to be taken. */
+ bool direct_has_special_setter : 1;
+
struct {
union {
gpointer none;
NMSettInfoPropGPropToDBusFcn gprop_to_dbus_fcn;
- gboolean (*get_boolean)(NMSetting *);
- const char *(*get_string)(NMSetting *);
};
/* Usually, properties that are set to the default value for the GParamSpec
@@ -724,6 +746,15 @@ struct _NMSettInfoProperty {
};
typedef struct {
+ /* we want to do binary search by "GParamSpec *", but unrelated pointers
+ * are not directly comparable in C. No problem, we convert them to
+ * uintptr_t for the search, that is guaranteed to work. */
+ uintptr_t param_spec_as_uint;
+
+ const NMSettInfoProperty *property_info;
+} NMSettInfoPropertLookupByParamSpec;
+
+typedef struct {
const GVariantType *(*get_variant_type)(const struct _NMSettInfoSetting *sett_info,
const char * name,
GError ** error);
@@ -762,12 +793,32 @@ struct _NMSettInfoSetting {
*/
const NMSettInfoProperty *const *property_infos_sorted;
- guint property_infos_len;
+ const NMSettInfoPropertLookupByParamSpec *property_lookup_by_param_spec;
+
+ guint16 property_infos_len;
+
+ guint16 property_lookup_by_param_spec_len;
+
+ /* the offset in bytes to get the private data from the @self pointer. */
+ gint16 private_offset;
+
NMSettInfoSettDetail detail;
};
+#define NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS ((gint16) G_MININT16)
+
+static inline gpointer
+_nm_setting_get_private(NMSetting *self, const NMSettInfoSetting *sett_info, guint16 offset)
+{
+ nm_assert(NM_IS_SETTING(self));
+ nm_assert(sett_info);
+ nm_assert(NM_SETTING_GET_CLASS(self) == sett_info->setting_class);
+
+ return ((((char *) ((gpointer) self)) + sett_info->private_offset) + offset);
+}
+
static inline const NMSettInfoProperty *
-_nm_sett_info_property_info_get_sorted(const NMSettInfoSetting *sett_info, guint idx)
+_nm_sett_info_property_info_get_sorted(const NMSettInfoSetting *sett_info, guint16 idx)
{
nm_assert(sett_info);
nm_assert(idx < sett_info->property_infos_len);
diff --git a/src/libnm-glib-aux/nm-json-aux.h b/src/libnm-glib-aux/nm-json-aux.h
index 936e914641..ba2b35d27c 100644
--- a/src/libnm-glib-aux/nm-json-aux.h
+++ b/src/libnm-glib-aux/nm-json-aux.h
@@ -271,6 +271,49 @@ nm_jansson_json_as_int64(const NMJsonVt *vt, const nm_json_t *elem, gint64 *out_
}
static inline int
+nm_jansson_json_as_uint32(const NMJsonVt *vt, const nm_json_t *elem, guint32 *out_val)
+{
+ nm_json_int_t v;
+
+ if (!elem)
+ return 0;
+
+ if (!nm_json_is_integer(elem))
+ return -EINVAL;
+
+ v = vt->nm_json_integer_value(elem);
+ if (v < 0)
+ return -ERANGE;
+ if (v > (guint64) G_MAXUINT32)
+ return -ERANGE;
+
+ NM_SET_OUT(out_val, v);
+ return 1;
+}
+
+static inline int
+nm_jansson_json_as_uint(const NMJsonVt *vt, const nm_json_t *elem, guint *out_val)
+{
+ nm_json_int_t v;
+
+ if (!elem)
+ return 0;
+
+ if (!nm_json_is_integer(elem))
+ return -EINVAL;
+
+ v = vt->nm_json_integer_value(elem);
+ if (v < 0)
+ return -ERANGE;
+
+ if (v > (guint64) G_MAXUINT)
+ return -ERANGE;
+
+ NM_SET_OUT(out_val, v);
+ return 1;
+}
+
+static inline int
nm_jansson_json_as_uint64(const NMJsonVt *vt, const nm_json_t *elem, guint64 *out_val)
{
nm_json_int_t v;
@@ -333,12 +376,19 @@ nm_value_type_to_json(NMValueType value_type, GString *gstr, gconstpointer p_fie
case NM_VALUE_TYPE_INT64:
nm_json_gstr_append_int64(gstr, *((const gint64 *) p_field));
return;
+ case NM_VALUE_TYPE_UINT32:
+ nm_json_gstr_append_uint64(gstr, *((const guint32 *) p_field));
+ return;
+ case NM_VALUE_TYPE_UINT:
+ nm_json_gstr_append_uint64(gstr, *((const guint *) p_field));
+ return;
case NM_VALUE_TYPE_UINT64:
nm_json_gstr_append_uint64(gstr, *((const guint64 *) p_field));
return;
case NM_VALUE_TYPE_STRING:
nm_json_gstr_append_string(gstr, *((const char *const *) p_field));
return;
+ case NM_VALUE_TYPE_NONE:
case NM_VALUE_TYPE_UNSPEC:
break;
}
@@ -360,6 +410,10 @@ nm_value_type_from_json(const NMJsonVt * vt,
return (nm_jansson_json_as_int(vt, elem, out_val) > 0);
case NM_VALUE_TYPE_INT64:
return (nm_jansson_json_as_int64(vt, elem, out_val) > 0);
+ case NM_VALUE_TYPE_UINT32:
+ return (nm_jansson_json_as_uint32(vt, elem, out_val) > 0);
+ case NM_VALUE_TYPE_UINT:
+ return (nm_jansson_json_as_uint(vt, elem, out_val) > 0);
case NM_VALUE_TYPE_UINT64:
return (nm_jansson_json_as_uint64(vt, elem, out_val) > 0);
@@ -368,6 +422,7 @@ nm_value_type_from_json(const NMJsonVt * vt,
case NM_VALUE_TYPE_STRING:
return (nm_jansson_json_as_string(vt, elem, out_val) > 0);
+ case NM_VALUE_TYPE_NONE:
case NM_VALUE_TYPE_UNSPEC:
break;
}
diff --git a/src/libnm-glib-aux/nm-value-type.h b/src/libnm-glib-aux/nm-value-type.h
index 6156896c14..4e54ad463c 100644
--- a/src/libnm-glib-aux/nm-value-type.h
+++ b/src/libnm-glib-aux/nm-value-type.h
@@ -7,13 +7,16 @@
#define __NM_VALUE_TYPE_H__
typedef enum _nm_packed {
+ NM_VALUE_TYPE_NONE = 0,
NM_VALUE_TYPE_UNSPEC = 1,
NM_VALUE_TYPE_BOOL = 2,
NM_VALUE_TYPE_INT32 = 3,
NM_VALUE_TYPE_INT = 4,
NM_VALUE_TYPE_INT64 = 5,
- NM_VALUE_TYPE_UINT64 = 6,
- NM_VALUE_TYPE_STRING = 7,
+ NM_VALUE_TYPE_UINT32 = 6,
+ NM_VALUE_TYPE_UINT = 7,
+ NM_VALUE_TYPE_UINT64 = 8,
+ NM_VALUE_TYPE_STRING = 9,
} NMValueType;
/*****************************************************************************/
@@ -85,11 +88,18 @@ nm_value_type_cmp(NMValueType value_type, gconstpointer p_a, gconstpointer p_b)
case NM_VALUE_TYPE_INT64:
NM_CMP_DIRECT(*((const gint64 *) p_a), *((const gint64 *) p_b));
return 0;
+ case NM_VALUE_TYPE_UINT32:
+ NM_CMP_DIRECT(*((const guint32 *) p_a), *((const guint32 *) p_b));
+ return 0;
+ case NM_VALUE_TYPE_UINT:
+ NM_CMP_DIRECT(*((const guint *) p_a), *((const guint *) p_b));
+ return 0;
case NM_VALUE_TYPE_UINT64:
NM_CMP_DIRECT(*((const guint64 *) p_a), *((const guint64 *) p_b));
return 0;
case NM_VALUE_TYPE_STRING:
return nm_strcmp0(*((const char *const *) p_a), *((const char *const *) p_b));
+ case NM_VALUE_TYPE_NONE:
case NM_VALUE_TYPE_UNSPEC:
break;
}
@@ -119,6 +129,12 @@ nm_value_type_copy(NMValueType value_type, gpointer dst, gconstpointer src)
case NM_VALUE_TYPE_INT64:
(*((gint64 *) dst) = *((const gint64 *) src));
return;
+ case NM_VALUE_TYPE_UINT32:
+ (*((guint32 *) dst) = *((const guint32 *) src));
+ return;
+ case NM_VALUE_TYPE_UINT:
+ (*((guint *) dst) = *((const guint *) src));
+ return;
case NM_VALUE_TYPE_UINT64:
(*((guint64 *) dst) = *((const guint64 *) src));
return;
@@ -129,6 +145,7 @@ nm_value_type_copy(NMValueType value_type, gpointer dst, gconstpointer src)
*((char **) dst) = g_strdup(*((const char *const *) src));
}
return;
+ case NM_VALUE_TYPE_NONE:
case NM_VALUE_TYPE_UNSPEC:
break;
}
@@ -151,6 +168,9 @@ nm_value_type_get_from_variant(NMValueType value_type,
case NM_VALUE_TYPE_INT64:
*((gint64 *) dst) = g_variant_get_int64(variant);
return;
+ case NM_VALUE_TYPE_UINT32:
+ *((guint32 *) dst) = g_variant_get_uint32(variant);
+ return;
case NM_VALUE_TYPE_UINT64:
*((guint64 *) dst) = g_variant_get_uint64(variant);
return;
@@ -165,10 +185,12 @@ nm_value_type_get_from_variant(NMValueType value_type,
return;
case NM_VALUE_TYPE_INT:
- /* "int" also does not have a define variant type, because it's not
+ case NM_VALUE_TYPE_UINT:
+ /* "int" and "uint" also does not have a defined variant type, because it's not
* clear how many bits we would need. */
/* fall-through */
+ case NM_VALUE_TYPE_NONE:
case NM_VALUE_TYPE_UNSPEC:
break;
}
@@ -187,6 +209,8 @@ nm_value_type_to_variant(NMValueType value_type, gconstpointer src)
return g_variant_new_int32(*((const gint32 *) src));
case NM_VALUE_TYPE_INT64:
return g_variant_new_int64(*((const gint64 *) src));
+ case NM_VALUE_TYPE_UINT32:
+ return g_variant_new_uint32(*((const guint32 *) src));
case NM_VALUE_TYPE_UINT64:
return g_variant_new_uint64(*((const guint64 *) src));
case NM_VALUE_TYPE_STRING:
@@ -194,10 +218,12 @@ nm_value_type_to_variant(NMValueType value_type, gconstpointer src)
return v_string ? g_variant_new_string(v_string) : NULL;
case NM_VALUE_TYPE_INT:
- /* "int" also does not have a define variant type, because it's not
+ case NM_VALUE_TYPE_UINT:
+ /* "int" and "uint" also does not have a defined variant type, because it's not
* clear how many bits we would need. */
/* fall-through */
+ case NM_VALUE_TYPE_NONE:
case NM_VALUE_TYPE_UNSPEC:
break;
}
@@ -215,16 +241,20 @@ nm_value_type_get_variant_type(NMValueType value_type)
return G_VARIANT_TYPE_INT32;
case NM_VALUE_TYPE_INT64:
return G_VARIANT_TYPE_INT64;
+ case NM_VALUE_TYPE_UINT32:
+ return G_VARIANT_TYPE_UINT32;
case NM_VALUE_TYPE_UINT64:
return G_VARIANT_TYPE_UINT64;
case NM_VALUE_TYPE_STRING:
return G_VARIANT_TYPE_STRING;
case NM_VALUE_TYPE_INT:
- /* "int" also does not have a define variant type, because it's not
+ case NM_VALUE_TYPE_UINT:
+ /* "int" and "uint" also does not have a defined variant type, because it's not
* clear how many bits we would need. */
/* fall-through */
+ case NM_VALUE_TYPE_NONE:
case NM_VALUE_TYPE_UNSPEC:
break;
}