]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
rename struct lxc_netdev fields to match reality
authorMichael Tokarev <mjt@tls.msk.ru>
Thu, 19 Nov 2009 14:06:02 +0000 (15:06 +0100)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Thu, 19 Nov 2009 14:06:02 +0000 (15:06 +0100)
struct lxc_netdev is used to hold information from cnfig file
about a network device/configuration.  Make the fields of this
structure to be named similarily with the config file keywords,
namely:
 s/ifname/link/ - host-side link for the device (bridge or eth0)
 s/newname/name/ - container-side ifname
It is insane to have completely different names in config file
and in structure/variable names :)

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/conf.c
src/lxc/conf.h
src/lxc/confile.c

index b4e3a3e49059c237bd4d68ef06e60c12bcd8acf3..a930f85f14f4ac76f5827dbe098053c1c3754473 100644 (file)
@@ -709,11 +709,11 @@ static int setup_netdev(struct lxc_netdev *netdev)
        }
 
        /* default: let the system to choose one interface name */
-       if (!netdev->newname)
-               netdev->newname = "eth%d";
+       if (!netdev->name)
+               netdev->name = "eth%d";
 
        /* rename the interface name */
-       if (lxc_device_rename(ifname, netdev->newname)) {
+       if (lxc_device_rename(ifname, netdev->name)) {
                ERROR("failed to rename %s->%s", ifname, current_ifname);
                return -1;
        }
@@ -846,7 +846,7 @@ static int instanciate_veth(struct lxc_netdev *netdev)
 
        if (lxc_veth_create(veth1, veth2)) {
                ERROR("failed to create %s-%s/%s",
-                     veth1, veth2, netdev->ifname);
+                     veth1, veth2, netdev->link);
                goto out;
        }
 
@@ -864,9 +864,9 @@ static int instanciate_veth(struct lxc_netdev *netdev)
                }
        }
 
-       if (lxc_bridge_attach(netdev->ifname, veth1)) {
+       if (lxc_bridge_attach(netdev->link, veth1)) {
                ERROR("failed to attach '%s' to the bridge '%s'",
-                             veth1, netdev->ifname);
+                             veth1, netdev->link);
                goto out_delete;
        }
 
@@ -908,9 +908,9 @@ static int instanciate_macvlan(struct lxc_netdev *netdev)
                return -1;
        }
 
-       if (lxc_macvlan_create(netdev->ifname, peer)) {
+       if (lxc_macvlan_create(netdev->link, peer)) {
                ERROR("failed to create macvlan interface '%s' on '%s'",
-                     peer, netdev->ifname);
+                     peer, netdev->link);
                goto out;
        }
 
@@ -933,9 +933,9 @@ out_delete:
 
 static int instanciate_phys(struct lxc_netdev *netdev)
 {
-       netdev->ifindex = if_nametoindex(netdev->ifname);
+       netdev->ifindex = if_nametoindex(netdev->link);
        if (!netdev->ifindex) {
-               ERROR("failed to retrieve the index for %s", netdev->ifname);
+               ERROR("failed to retrieve the index for %s", netdev->link);
                return -1;
        }
 
@@ -983,11 +983,11 @@ int lxc_assign_network(struct lxc_list *network, pid_t pid)
 
                if (lxc_device_move(netdev->ifindex, pid)) {
                        ERROR("failed to move '%s' to the container",
-                             netdev->ifname);
+                             netdev->link);
                        return -1;
                }
 
-               DEBUG("move '%s' to '%d'", netdev->ifname, pid);
+               DEBUG("move '%s' to '%d'", netdev->link, pid);
        }
 
        return 0;
index 215f1e5108f06be22db5356912e7113801288913..0b8d732823a6497b2201bbc731a605131eb85ff3 100644 (file)
@@ -71,7 +71,8 @@ struct lxc_route6 {
 };
 /*
  * Defines a structure to configure a network device
- * @ifname : network device name
+ * @link   : lxc.network.link, name of bridge or host iface to attach if any
+ * @name   : lxc.network.name, name of iface on the container side
  * @flags  : flag of the network device (IFF_UP, ... )
  * @ipv4   : a list of ipv4 addresses to be set on the network device
  * @ipv6   : a list of ipv6 addresses to be set on the network device
@@ -80,8 +81,8 @@ struct lxc_netdev {
        int type;
        int flags;
        int ifindex;
-       char *ifname;
-       char *newname;
+       char *link;
+       char *name;
        char *hwaddr;
        char *mtu;
        struct lxc_list ipv4;
index 43bede4d72a09377797003fd6f529dfb2010d107..699eafe9ece2e245a644c4d0b1349e85d931f677 100644 (file)
@@ -187,7 +187,7 @@ static int config_network_link(const char *key, char *value, struct lxc_conf *lx
                return -1;
        }
 
-       netdev->ifname = strdup(value);
+       netdev->link = strdup(value);
        return 0;
 }
 
@@ -212,7 +212,7 @@ static int config_network_name(const char *key, char *value, struct lxc_conf *lx
                return -1;
        }
 
-       netdev->newname = strdup(value);
+       netdev->name = strdup(value);
        return 0;
 }