summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-10-11 18:41:59 +0200
committerThomas Haller <thaller@redhat.com>2017-10-11 18:42:00 +0200
commit379b5c6255b77ab2a7ad18965fef2871760f2ce4 (patch)
tree2c3bc94d63a5e3de6833d3946e0e9bc763c50524
parentc2b8f8c293f401af7c5987b47217d62c287f48e9 (diff)
downloadNetworkManager-379b5c6255b77ab2a7ad18965fef2871760f2ce4.tar.gz
fixup! libnm-core: add ovs-interface setting
Reorder code
-rw-r--r--libnm-core/nm-setting-ovs-interface.c107
1 files changed, 58 insertions, 49 deletions
diff --git a/libnm-core/nm-setting-ovs-interface.c b/libnm-core/nm-setting-ovs-interface.c
index 757b30ab28..8dd2232974 100644
--- a/libnm-core/nm-setting-ovs-interface.c
+++ b/libnm-core/nm-setting-ovs-interface.c
@@ -33,6 +33,12 @@
* necessary for OpenVSwitch interfaces.
**/
+enum {
+ PROP_0,
+ PROP_TYPE,
+ LAST_PROP
+};
+
/**
* NMSettingOvsInterface:
*
@@ -52,26 +58,7 @@ G_DEFINE_TYPE_WITH_CODE (NMSettingOvsInterface, nm_setting_ovs_interface, NM_TYP
_nm_register_setting (OVS_INTERFACE, NM_SETTING_PRIORITY_HW_BASE))
NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_OVS_INTERFACE)
-enum {
- PROP_0,
- PROP_TYPE,
- LAST_PROP
-};
-
-/**
- * nm_setting_ovs_interface_new:
- *
- * Creates a new #NMSettingOvsInterface object with default values.
- *
- * Returns: (transfer full): the new empty #NMSettingOvsInterface object
- *
- * Since: 1.10
- **/
-NMSetting *
-nm_setting_ovs_interface_new (void)
-{
- return (NMSetting *) g_object_new (NM_TYPE_SETTING_OVS_INTERFACE, NULL);
-}
+/*****************************************************************************/
/**
* nm_setting_ovs_interface_get_interface_type:
@@ -88,16 +75,41 @@ nm_setting_ovs_interface_get_interface_type (NMSettingOvsInterface *s_ovs_interf
return s_ovs_interface->type;
}
+
+/*****************************************************************************/
+
+static int
+verify (NMSetting *setting, NMConnection *connection, GError **error)
+{
+ NMSettingOvsInterface *s_ovs_interface = NM_SETTING_OVS_INTERFACE (setting);
+
+ if (!_nm_connection_verify_required_interface_name (connection, error))
+ return FALSE;
+
+ if (!NM_IN_STRSET (s_ovs_interface->type, "internal", "system", "", NULL)) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("'%s' is not allowed in type"),
+ s_ovs_interface->type);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_OVS_INTERFACE_SETTING_NAME, NM_SETTING_OVS_INTERFACE_TYPE);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/*****************************************************************************/
+
static void
-set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
+get_property (GObject *object, guint prop_id,
+ GValue *value, GParamSpec *pspec)
{
NMSettingOvsInterface *s_ovs_interface = NM_SETTING_OVS_INTERFACE (object);
switch (prop_id) {
case PROP_TYPE:
- g_free (s_ovs_interface->type);
- s_ovs_interface->type = g_value_dup_string (value);
+ g_value_set_string (value, s_ovs_interface->type);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -106,14 +118,15 @@ set_property (GObject *object, guint prop_id,
}
static void
-get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
+set_property (GObject *object, guint prop_id,
+ const GValue *value, GParamSpec *pspec)
{
NMSettingOvsInterface *s_ovs_interface = NM_SETTING_OVS_INTERFACE (object);
switch (prop_id) {
case PROP_TYPE:
- g_value_set_string (value, s_ovs_interface->type);
+ g_free (s_ovs_interface->type);
+ s_ovs_interface->type = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -121,25 +134,26 @@ get_property (GObject *object, guint prop_id,
}
}
-static int
-verify (NMSetting *setting, NMConnection *connection, GError **error)
-{
- NMSettingOvsInterface *s_ovs_interface = NM_SETTING_OVS_INTERFACE (setting);
-
- if (!_nm_connection_verify_required_interface_name (connection, error))
- return FALSE;
+/*****************************************************************************/
- if (!NM_IN_STRSET (s_ovs_interface->type, "internal", "system", "", NULL)) {
- g_set_error (error,
- NM_CONNECTION_ERROR,
- NM_CONNECTION_ERROR_INVALID_PROPERTY,
- _("'%s' is not allowed in type"),
- s_ovs_interface->type);
- g_prefix_error (error, "%s.%s: ", NM_SETTING_OVS_INTERFACE_SETTING_NAME, NM_SETTING_OVS_INTERFACE_TYPE);
- return FALSE;
- }
+static void
+nm_setting_ovs_interface_init (NMSettingOvsInterface *s_ovs_interface)
+{
+}
- return TRUE;
+/**
+ * nm_setting_ovs_interface_new:
+ *
+ * Creates a new #NMSettingOvsInterface object with default values.
+ *
+ * Returns: (transfer full): the new empty #NMSettingOvsInterface object
+ *
+ * Since: 1.10
+ **/
+NMSetting *
+nm_setting_ovs_interface_new (void)
+{
+ return (NMSetting *) g_object_new (NM_TYPE_SETTING_OVS_INTERFACE, NULL);
}
static void
@@ -153,11 +167,6 @@ finalize (GObject *object)
}
static void
-nm_setting_ovs_interface_init (NMSettingOvsInterface *s_ovs_interface)
-{
-}
-
-static void
nm_setting_ovs_interface_class_init (NMSettingOvsInterfaceClass *setting_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (setting_class);