WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxl: remove useless smac in the nic_inf

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: remove useless smac in the nic_info structure
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 30 Dec 2009 05:40:13 -0800
Delivery-date: Wed, 30 Dec 2009 05:40:17 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1262176921 0
# Node ID 1604ad5c529f1a011985bd2c9de31b1bc3435ce6
# Parent  9417aa2c73800e32d1d025761e0294a44eb72bc2
libxl: remove useless smac in the nic_info structure

the string representing the mac is easily recomputed from the mac
array

Signed-off-by: Vincent Hanquez <vincent.hanquez@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c |    6 ++++--
 tools/libxl/libxl.h |    1 -
 tools/libxl/xl.c    |    3 ---
 3 files changed, 4 insertions(+), 6 deletions(-)

diff -r 9417aa2c7380 -r 1604ad5c529f tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed Dec 30 12:41:22 2009 +0000
+++ b/tools/libxl/libxl.c       Wed Dec 30 12:42:01 2009 +0000
@@ -748,9 +748,12 @@ static char ** libxl_build_device_model_
         }
         for (i = 0; i < num_vifs; i++) {
             if (vifs[i].nictype == NICTYPE_IOEMU) {
+                char *smac = libxl_sprintf(ctx, 
"%02x:%02x:%02x:%02x:%02x:%02x",
+                                           vifs[i].mac[0], vifs[i].mac[1], 
vifs[i].mac[2],
+                                           vifs[i].mac[3], vifs[i].mac[4], 
vifs[i].mac[5]);
                 flexarray_set(dm_args, num++, "-net");
                 flexarray_set(dm_args, num++, libxl_sprintf(ctx, 
"nic,vlan=%d,macaddr=%s,model=%s",
-                            vifs[i].devid, vifs[i].smac, vifs[i].model));
+                            vifs[i].devid, smac, vifs[i].model));
                 flexarray_set(dm_args, num++, "-net");
                 flexarray_set(dm_args, num++, libxl_sprintf(ctx, 
"tap,vlan=%d,ifname=%s,bridge=%s",
                             vifs[i].devid, vifs[i].ifname, vifs[i].bridge));
@@ -2303,7 +2306,6 @@ void init_nic_info(libxl_device_nic *nic
     nic_info->mac[3] = 1 + (int) (0x7f * (rand() / (RAND_MAX + 1.0)));
     nic_info->mac[4] = 1 + (int) (0xff * (rand() / (RAND_MAX + 1.0)));
     nic_info->mac[5] = 1 + (int) (0xff * (rand() / (RAND_MAX + 1.0)));
-    asprintf(&(nic_info->smac), "%02x:%02x:%02x:%02x:%02x:%02x", 
nic_info->mac[0], nic_info->mac[1], nic_info->mac[2], nic_info->mac[3], 
nic_info->mac[4], nic_info->mac[5]);
     nic_info->ifname = NULL;
     nic_info->bridge = "xenbr0";
     nic_info->script = "/etc/xen/scripts/vif-bridge";
diff -r 9417aa2c7380 -r 1604ad5c529f tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Wed Dec 30 12:41:22 2009 +0000
+++ b/tools/libxl/libxl.h       Wed Dec 30 12:42:01 2009 +0000
@@ -199,7 +199,6 @@ typedef struct {
     int mtu;
     char *model;
     uint8_t mac[6];
-    char *smac;
     struct in_addr ip;
     char *bridge;
     char *ifname;
diff -r 9417aa2c7380 -r 1604ad5c529f tools/libxl/xl.c
--- a/tools/libxl/xl.c  Wed Dec 30 12:41:22 2009 +0000
+++ b/tools/libxl/xl.c  Wed Dec 30 12:42:01 2009 +0000
@@ -122,7 +122,6 @@ static void printf_info(libxl_domain_cre
         printf("mtu %d\n", vifs[i].mtu);
         printf("model %s\n", vifs[i].model);
         printf("mac %02x:%02x:%02x:%02x:%02x:%02x\n", vifs[i].mac[0], 
vifs[i].mac[1], vifs[i].mac[2], vifs[i].mac[3], vifs[i].mac[4], vifs[i].mac[5]);
-        printf("smac %s\n", vifs[i].mac);
     }
 
     for (i = 0; i < num_pcidevs; i++) {
@@ -399,7 +398,6 @@ static void parse_config_file(const char
                     (*vifs)[*num_vifs].model = strdup(p2 + 1);
                 } else if (!strcmp(p, "mac")) {
                     char *p3 = p2 + 1;
-                    (*vifs)[*num_vifs].smac = strdup(p3);
                     *(p3 + 2) = '\0';
                     (*vifs)[*num_vifs].mac[0] = strtol(p3, NULL, 16);
                     p3 = p3 + 3;
@@ -732,7 +730,6 @@ start:
 
     close(logfile);
     for (i = 0; i < num_vifs; i++) {
-        free(vifs[i].smac);
         free(vifs[i].ifname);
     }
     free(disks);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: remove useless smac in the nic_info structure, Xen patchbot-unstable <=