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] Re: [PATCH, v2]: xl: Check domain existance when doing domai

To: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH, v2]: xl: Check domain existance when doing domain identifier lookups
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Mon, 24 Jan 2011 19:05:26 +0000
Cc: Christoph Egger <Christoph.Egger@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Mon, 24 Jan 2011 11:05:17 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1295895194.28333.34.camel@xxxxxxxxxxxxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <A24AE1FFE7AEC5489F83450EE98351BF2BF2EC4C9D@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <1295888759.28333.14.camel@xxxxxxxxxxxxxxxxxxxxxx> <201101241827.46797.Christoph.Egger@xxxxxxx> <1295891031.28333.25.camel@xxxxxxxxxxxxxxxxxxxxxx> <1295893129.28333.31.camel@xxxxxxxxxxxxxxxxxxxxxx> <alpine.DEB.2.00.1101241838500.7277@kaball-desktop> <1295895194.28333.34.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Mon, 24 Jan 2011, Gianni Tedesco wrote:
> Only if was_name is true... If they pass a number then we need to check
> explicitly. Perhaps it would be better to put that check in an else {}
> statement though.
> 

Good point.
Apart from the inconsistent code style:

Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

> 
> --
> xl: Check domain existance when doing domain identifier lookups
> 
> Also fix a mis-formatted error message in xl destroy command.
> 
> Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
> 
> diff -r b59f04eb8978 tools/libxl/xl_cmdimpl.c
> --- a/tools/libxl/xl_cmdimpl.c        Fri Jan 21 18:06:23 2011 +0000
> +++ b/tools/libxl/xl_cmdimpl.c        Mon Jan 24 18:50:32 2011 +0000
> @@ -143,11 +143,24 @@ static int qualifier_to_id(const char *p
>  static int domain_qualifier_to_domid(const char *p, uint32_t *domid_r,
>                                       int *was_name_r)
>  {
> -    int was_name;
> +    int was_name, rc;
>  
>      was_name = qualifier_to_id(p, domid_r);
> -    if (was_name_r) *was_name_r = was_name;
> -    return was_name ? libxl_name_to_domid(&ctx, p, domid_r) : 0;
> +    if (was_name_r)
> +        *was_name_r = was_name;
> +
> +    if ( was_name ) {
> +        rc = libxl_name_to_domid(&ctx, p, domid_r);
> +        if ( rc )
> +            return rc;
> +    }else{
> +        libxl_dominfo dominfo;
> +        rc = libxl_domain_info(&ctx, &dominfo, *domid_r);
> +        if ( rc )
> +            return rc;
> +    }
> +
> +    return 0;
>  }
>  
>  static int cpupool_qualifier_to_cpupoolid(const char *p, uint32_t *poolid_r,
> @@ -2176,7 +2189,7 @@ static void destroy_domain(const char *p
>          exit(-1);
>      }
>      rc = libxl_domain_destroy(&ctx, domid, 0);
> -    if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n.",rc); exit(-1); }
> +    if (rc) { fprintf(stderr,"destroy failed (rc=%d).\n",rc); exit(-1); }
>  }
>  
>  static void shutdown_domain(const char *p, int wait)
> 
> 
> 

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

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