diff options
author | Thomas Haller <thaller@redhat.com> | 2019-01-11 08:32:54 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-01-15 09:55:24 +0100 |
commit | 19141ef770f3064383b97f29a22440d58bdf7bc8 (patch) | |
tree | 00ecb5d9955ef8c334a2077cd294a31bb7285c55 /libnm-core/nm-setting-infiniband.c | |
parent | a3d6976efcb0b05fe304643c466df12b5ee56f9d (diff) | |
download | NetworkManager-19141ef770f3064383b97f29a22440d58bdf7bc8.tar.gz |
libnm-core: reorder code in settings
Order the code in our common way. No other changes.
- ensure to include the main header first (directly after
"nm-default.h").
- reorder function definitions: get_property(), set_property(),
*_init(), *_new(), finalize(), *_class_init().
Diffstat (limited to 'libnm-core/nm-setting-infiniband.c')
-rw-r--r-- | libnm-core/nm-setting-infiniband.c | 125 |
1 files changed, 67 insertions, 58 deletions
diff --git a/libnm-core/nm-setting-infiniband.c b/libnm-core/nm-setting-infiniband.c index 1bb2ca6985..9348fa2be0 100644 --- a/libnm-core/nm-setting-infiniband.c +++ b/libnm-core/nm-setting-infiniband.c @@ -21,9 +21,10 @@ #include "nm-default.h" +#include "nm-setting-infiniband.h" + #include <stdlib.h> -#include "nm-setting-infiniband.h" #include "nm-utils.h" #include "nm-utils-private.h" #include "nm-setting-private.h" @@ -37,9 +38,15 @@ * necessary for connection to IP-over-InfiniBand networks. **/ -G_DEFINE_TYPE (NMSettingInfiniband, nm_setting_infiniband, NM_TYPE_SETTING) +/*****************************************************************************/ -#define NM_SETTING_INFINIBAND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_INFINIBAND, NMSettingInfinibandPrivate)) +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( + PROP_MAC_ADDRESS, + PROP_MTU, + PROP_TRANSPORT_MODE, + PROP_P_KEY, + PROP_PARENT, +); typedef struct { char *mac_address; @@ -49,26 +56,11 @@ typedef struct { char *parent, *virtual_iface_name; } NMSettingInfinibandPrivate; -NM_GOBJECT_PROPERTIES_DEFINE_BASE ( - PROP_MAC_ADDRESS, - PROP_MTU, - PROP_TRANSPORT_MODE, - PROP_P_KEY, - PROP_PARENT, -); +G_DEFINE_TYPE (NMSettingInfiniband, nm_setting_infiniband, NM_TYPE_SETTING) -/** - * nm_setting_infiniband_new: - * - * Creates a new #NMSettingInfiniband object with default values. - * - * Returns: (transfer full): the new empty #NMSettingInfiniband object - **/ -NMSetting * -nm_setting_infiniband_new (void) -{ - return (NMSetting *) g_object_new (NM_TYPE_SETTING_INFINIBAND, NULL); -} +#define NM_SETTING_INFINIBAND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_INFINIBAND, NMSettingInfinibandPrivate)) + +/*****************************************************************************/ /** * nm_setting_infiniband_get_mac_address: @@ -292,22 +284,34 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) return TRUE; } -static void -nm_setting_infiniband_init (NMSettingInfiniband *setting) -{ -} +/*****************************************************************************/ static void -finalize (GObject *object) +get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) { - NMSettingInfinibandPrivate *priv = NM_SETTING_INFINIBAND_GET_PRIVATE (object); - - g_free (priv->transport_mode); - g_free (priv->mac_address); - g_free (priv->parent); - g_free (priv->virtual_iface_name); + NMSettingInfiniband *setting = NM_SETTING_INFINIBAND (object); - G_OBJECT_CLASS (nm_setting_infiniband_parent_class)->finalize (object); + switch (prop_id) { + case PROP_MAC_ADDRESS: + g_value_set_string (value, nm_setting_infiniband_get_mac_address (setting)); + break; + case PROP_MTU: + g_value_set_uint (value, nm_setting_infiniband_get_mtu (setting)); + break; + case PROP_TRANSPORT_MODE: + g_value_set_string (value, nm_setting_infiniband_get_transport_mode (setting)); + break; + case PROP_P_KEY: + g_value_set_int (value, nm_setting_infiniband_get_p_key (setting)); + break; + case PROP_PARENT: + g_value_set_string (value, nm_setting_infiniband_get_parent (setting)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } } static void @@ -344,32 +348,37 @@ set_property (GObject *object, guint prop_id, } } +/*****************************************************************************/ + static void -get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) +nm_setting_infiniband_init (NMSettingInfiniband *setting) { - NMSettingInfiniband *setting = NM_SETTING_INFINIBAND (object); +} - switch (prop_id) { - case PROP_MAC_ADDRESS: - g_value_set_string (value, nm_setting_infiniband_get_mac_address (setting)); - break; - case PROP_MTU: - g_value_set_uint (value, nm_setting_infiniband_get_mtu (setting)); - break; - case PROP_TRANSPORT_MODE: - g_value_set_string (value, nm_setting_infiniband_get_transport_mode (setting)); - break; - case PROP_P_KEY: - g_value_set_int (value, nm_setting_infiniband_get_p_key (setting)); - break; - case PROP_PARENT: - g_value_set_string (value, nm_setting_infiniband_get_parent (setting)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } +/** + * nm_setting_infiniband_new: + * + * Creates a new #NMSettingInfiniband object with default values. + * + * Returns: (transfer full): the new empty #NMSettingInfiniband object + **/ +NMSetting * +nm_setting_infiniband_new (void) +{ + return (NMSetting *) g_object_new (NM_TYPE_SETTING_INFINIBAND, NULL); +} + +static void +finalize (GObject *object) +{ + NMSettingInfinibandPrivate *priv = NM_SETTING_INFINIBAND_GET_PRIVATE (object); + + g_free (priv->transport_mode); + g_free (priv->mac_address); + g_free (priv->parent); + g_free (priv->virtual_iface_name); + + G_OBJECT_CLASS (nm_setting_infiniband_parent_class)->finalize (object); } static void @@ -381,8 +390,8 @@ nm_setting_infiniband_class_init (NMSettingInfinibandClass *klass) g_type_class_add_private (klass, sizeof (NMSettingInfinibandPrivate)); - object_class->set_property = set_property; object_class->get_property = get_property; + object_class->set_property = set_property; object_class->finalize = finalize; setting_class->verify = verify; |