[patch NetworkManager 2/4] nm-setting-bond: implement set_virtual_iface_name()



Signed-off-by: Jiri Pirko <jiri resnulli us>
---
 libnm-util/nm-setting-bond.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/libnm-util/nm-setting-bond.c b/libnm-util/nm-setting-bond.c
index 005bf89..e0b53c7 100644
--- a/libnm-util/nm-setting-bond.c
+++ b/libnm-util/nm-setting-bond.c
@@ -558,6 +558,25 @@ get_virtual_iface_name (NMSetting *setting)
 }
 
 static void
+set_interface_name (NMSettingBond *setting, const char *iface_name)
+{
+       NMSettingBondPrivate *priv = NM_SETTING_BOND_GET_PRIVATE (setting);
+
+       g_free (priv->interface_name);
+       priv->interface_name = g_strdup (iface_name);
+}
+
+static gboolean
+set_virtual_iface_name (NMSetting *setting, const char *iface_name)
+{
+       NMSettingBond *self = NM_SETTING_BOND (setting);
+
+       set_interface_name (self, iface_name);
+
+       return TRUE;
+}
+
+static void
 nm_setting_bond_init (NMSettingBond *setting)
 {
        NMSettingBondPrivate *priv = NM_SETTING_BOND_GET_PRIVATE (setting);
@@ -594,11 +613,12 @@ set_property (GObject *object, guint prop_id,
               const GValue *value, GParamSpec *pspec)
 {
        NMSettingBondPrivate *priv = NM_SETTING_BOND_GET_PRIVATE (object);
+       NMSettingBond *setting = NM_SETTING_BOND (object);
        GHashTable *new_hash;
 
        switch (prop_id) {
        case PROP_INTERFACE_NAME:
-               priv->interface_name = g_value_dup_string (value);
+               set_interface_name (setting, g_value_get_string (value));
                break;
        case PROP_OPTIONS:
                /* Must make a deep copy of the hash table here... */
@@ -647,6 +667,7 @@ nm_setting_bond_class_init (NMSettingBondClass *setting_class)
        object_class->finalize     = finalize;
        parent_class->verify       = verify;
        parent_class->get_virtual_iface_name = get_virtual_iface_name;
+       parent_class->set_virtual_iface_name = set_virtual_iface_name;
 
        /* Properties */
        /**
-- 
1.8.3.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]