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

Re: [Xen-devel] [PATCH 03 of 10] libxl: Accept disk name in libxl_devid_

To: Marek Marczykowski <marmarek@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 03 of 10] libxl: Accept disk name in libxl_devid_to_device_disk
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Fri, 3 Jun 2011 09:08:20 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 03 Jun 2011 01:09:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <81df382694fd6e208255.1307054133@devel14>
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>
Organization: Citrix Systems, Inc.
References: <patchbomb.1307054130@devel14> <81df382694fd6e208255.1307054133@devel14>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, 2011-06-02 at 23:35 +0100, Marek Marczykowski wrote:
> # HG changeset patch
> # User Marek Marczykowski <marmarek@xxxxxxxxxxxx>
> # Date 1306962929 -7200
> # Node ID 81df382694fd6e208255197d8da19bfe435a2cbd
> # Parent  59cff6b471f3f0c1e91349ed6653a47a40d4fd55
> libxl: Accept disk name in libxl_devid_to_device_disk
> 
> Accept disk name in xl block-detach.
> 
> Signed-off-by: Marek Marczykowski <marmarek@xxxxxxxxxxxx>
> 
> diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
> --- a/tools/libxl/libxl_utils.c
> +++ b/tools/libxl/libxl_utils.c
> @@ -529,18 +529,18 @@
>                                 const char *devid, libxl_device_disk *disk)
>  {
>      libxl__gc gc = LIBXL_INIT_GC(ctx);
> -    char *endptr, *val;
> +    char *val;
>      char *dompath, *diskpath, *be_path;
>      unsigned int devid_n;
>      int rc = ERROR_INVAL;
>  
> -    devid_n = strtoul(devid, &endptr, 10);
> -    if (devid == endptr) {
> +    devid_n = libxl__device_disk_dev_number((char *)devid);

This function takes 3 parameters in xen-unstable.hg so this won't work.
Please can you rebase.

Also casting away the const like that is probably unsafe (it's likely a
const for a reason) and should have raised alarm bells.

libxl__device_disk_dev_number should take a const, it looks like that
would be a trivial change since the function doesn't appear to actually
modify the string, although I could be mistaken, in which case
libxl__device_disk_dev_number needs fixing to not modify the string.

Cheers,
Ian.


> +    if (devid_n < 0) {
>          goto out;
>      }
>      rc = ERROR_FAIL;
>      dompath = libxl__xs_get_dompath(&gc, domid);
> -    diskpath = libxl__sprintf(&gc, "%s/device/vbd/%s", dompath, devid);
> +    diskpath = libxl__sprintf(&gc, "%s/device/vbd/%d", dompath, devid_n);
>      if (!diskpath) {
>          goto out;
>      }
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



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

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