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

[Xen-changelog] [xen-unstable] libxenlight: simplify the logic of domain_list to just return 1024 domains maximum



# 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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.