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] libxenlight: simplify the logic of domain

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxenlight: simplify the logic of domain_list to just return 1024 domains maximum
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 08 Jan 2010 04:00:39 -0800
Delivery-date: Fri, 08 Jan 2010 04:01:53 -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 1262951248 0
# Node ID 9a49e6a66bf0572d003ff68c621a8e7c04008171
# Parent  dd9250567d18e8d0bfe5149692f22fb849952647
libxenlight: simplify the logic of domain_list to just return 1024 domains 
maximum

Signed-off-by: Vincent Hanquez <vincent.hanquez@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c |   24 +++++-------------------
 1 files changed, 5 insertions(+), 19 deletions(-)

diff -r dd9250567d18 -r 9a49e6a66bf0 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Fri Jan 08 11:46:52 2010 +0000
+++ b/tools/libxl/libxl.c       Fri Jan 08 11:47:28 2010 +0000
@@ -273,32 +273,20 @@ struct libxl_dominfo * libxl_domain_list
 {
     struct libxl_dominfo *ptr;
     int index, i, ret, first_domain;
-    xc_domaininfo_t info[16];
-    int size = 16;
+    xc_domaininfo_t info[1024];
+    int size = 1024;
 
     first_domain = 1;
     index = 0;
     ptr = calloc(size, sizeof(struct libxl_dominfo));
     if (!ptr)
         return NULL;
-redo:
-    ret = xc_domain_getinfolist(ctx->xch, first_domain, 16, info);
+
+    ret = xc_domain_getinfolist(ctx->xch, first_domain, 1024, info);
     for (i = 0; i < ret; i++) {
-        if (index == size) {
-            struct libxl_dominfo *ptr2;
-
-            ptr2 = calloc(size * 2, sizeof(struct libxl_dominfo));
-            if (!ptr2) {
-                free(ptr);
-                return NULL;
-            }
-            memcpy(ptr2, ptr, sizeof(struct libxl_dominfo) * size);
-            free(ptr);
-            ptr = ptr2;
-            size *= 2;
-        }
         memcpy(&(ptr[index].uuid), info[i].handle, 
sizeof(xen_domain_handle_t));
         ptr[index].domid = info[i].domain;
+           printf("domain %d [ret %d]\n", ptr[index].domid, ret);
 
         if (info[i].flags & XEN_DOMINF_dying)
             ptr[index].dying = 1;
@@ -310,8 +298,6 @@ redo:
         first_domain = info[i].domain + 1;
         index++;
     }
-    if (ret == 16)
-        goto redo;
     *nb_domain = index;
     return ptr;
 }

_______________________________________________
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] libxenlight: simplify the logic of domain_list to just return 1024 domains maximum, Xen patchbot-unstable <=