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-devel

[Xen-devel] [PATCH] add count-only option to DOM0_GETDOMAININFOLIST hype

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] add count-only option to DOM0_GETDOMAININFOLIST hypercall
From: "Mike D. Day" <ncmike@xxxxxxxxxx>
Date: Wed, 22 Mar 2006 19:48:47 -0500
Delivery-date: Thu, 23 Mar 2006 00:42:07 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: ncmike@xxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
signed-off-by: Mike D. Day <ncmike@xxxxxxxxxx>

When retreiving a list of domain info structs it would be helpful
to know the current domain count prior to making the hcall. This 
would make it simpler to allocate a return buffer of the 
appropriate size. 

Adding the six lines to the case for the GETDOMAININFOLIST dom0 op
allows the caller to retrieve only the count of the domains. The 
use model is as follows: 

    int number_domains;
    struct dom0_op info;
    info.cmd = DOM0_GETDOMAININFOLIST;
    info.u.getdomaininfolist.max_domains = 0;

    HYPERCALL_dom0_op(&info);

    number_domains = info.u.getdomaininfolist.max_domains;

Having the number of domains, the caller can now allocate
a buffer of the correct size to get the actual domain 
information.    

# HG changeset patch
# User mdday@xxxxxxxxxxxxxxxxxxxx
# Node ID cd6869742400411fdaf295cc4e0167361e967619
# Parent  5d3c2cb42ec41984cb1e586d3e47a8692eb8b132
modify domain infolist hypercall to optionally return only a count of domains

diff -r 5d3c2cb42ec4 -r cd6869742400 xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c     Wed Mar 22 19:05:50 2006 +0100
+++ b/xen/common/dom0_ops.c     Wed Mar 22 19:30:28 2006 -0500
@@ -416,6 +416,12 @@ long do_dom0_op(GUEST_HANDLE(dom0_op_t) 
 
         for_each_domain ( d )
         {
+            if (op->u.getdomaininfolist.max_domains == 0) 
+            {
+                num_domains++;
+                continue;
+            }
+                
             if ( d->domain_id < op->u.getdomaininfolist.first_domain )
                 continue;
             if ( num_domains == op->u.getdomaininfolist.max_domains )

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

<Prev in Thread] Current Thread [Next in Thread>