From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v2 1/4] libxenstat: reuse xc_handle open in xenstat_init Date: Wed, 8 Apr 2015 17:11:19 +0100 Message-ID: <55255327.2020006@citrix.com> References: <1428509302-10081-1-git-send-email-wei.liu2@citrix.com> <1428509302-10081-2-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1428509302-10081-2-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu , xen-devel@lists.xen.org Cc: Charles Arnold , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org On 08/04/15 17:08, Wei Liu wrote: > Signed-off-by: Wei Liu > Cc: Ian Campbell > Cc: Ian Jackson > Cc: Charles Arnold Reviewed-by: Andrew Cooper > --- > tools/xenstat/libxenstat/src/xenstat_qmp.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/tools/xenstat/libxenstat/src/xenstat_qmp.c b/tools/xenstat/libxenstat/src/xenstat_qmp.c > index 2cb99e9..10ae104 100644 > --- a/tools/xenstat/libxenstat/src/xenstat_qmp.c > +++ b/tools/xenstat/libxenstat/src/xenstat_qmp.c > @@ -357,17 +357,14 @@ static int qmp_connect(char *path) > } > > /* Get up to 1024 active domains */ > -static xc_domaininfo_t *get_domain_ids(int *num_doms) > +static xc_domaininfo_t *get_domain_ids(xc_interface *xc_handle, int *num_doms) > { > xc_domaininfo_t *dominfo; > - xc_interface *xc_handle; > > dominfo = calloc(1024, sizeof(xc_domaininfo_t)); > if (dominfo == NULL) > return NULL; > - xc_handle = xc_interface_open(0,0,0); > *num_doms = xc_domain_getinfolist(xc_handle, 0, 1024, dominfo); > - xc_interface_close(xc_handle); > return dominfo; > } > > @@ -406,7 +403,7 @@ void read_attributes_qdisk(xenstat_node * node) > char path[80]; > int i, qfd, num_doms; > > - dominfo = get_domain_ids(&num_doms); > + dominfo = get_domain_ids(node->handle->xc_handle, &num_doms); > if (dominfo == NULL) > return; >