xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Marek Marczykowski <marmarek@mimuw.edu.pl>
To: xen-devel@lists.xensource.com
Cc: marmarek@mimuw.edu.pl
Subject: [PATCH 2 of 5] libxl: Accept disk name in libxl_devid_to_device_disk
Date: Thu, 25 Aug 2011 19:13:46 +0200	[thread overview]
Message-ID: <8080606fb87a751f7cde.1314292426@devel14> (raw)
In-Reply-To: <patchbomb.1314292424@devel14>

# HG changeset patch
# User Marek Marczykowski <marmarek@mimuw.edu.pl>
# Date 1307285297 -7200
# Node ID 8080606fb87a751f7cde4c6a08e3945a21d397b0
# Parent  969051f07ee813d2a556f50d37cf59d4e509bf67
libxl: Accept disk name in libxl_devid_to_device_disk

Accept disk name in xl block-detach.

Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>

diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -201,7 +201,7 @@ static int device_virtdisk_matches(const
     return 1;
 }
 
-int libxl__device_disk_dev_number(char *virtpath)
+int libxl__device_disk_dev_number(const char *virtpath)
 {
     int disk, partition;
     char *ep;
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -182,7 +182,7 @@ _hidden char *libxl__device_disk_string_
 _hidden char *libxl__device_disk_string_of_format(libxl_disk_format format);
 
 _hidden int libxl__device_physdisk_major_minor(const char *physpath, int *major, int *minor);
-_hidden int libxl__device_disk_dev_number(char *virtpath);
+_hidden int libxl__device_disk_dev_number(const char *virtpath);
 
 _hidden int libxl__device_generic_add(libxl_ctx *ctx, libxl__device *device,
                              char **bents, char **fents);
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 @@ int libxl_devid_to_device_disk(libxl_ctx
                                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(devid);
+    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;
     }

  parent reply	other threads:[~2011-08-25 17:13 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-05 16:50 [PATCH 0 of 6 RESENT] A bunch of fixes for libxl Marek Marczykowski
2011-06-05 16:50 ` [PATCH 1 of 6 RESENT] libxl: Remove frontend and backend devices from xenstore after destroy Marek Marczykowski
2011-06-06 10:00   ` Ian Campbell
2011-06-27 16:29     ` Ian Jackson
2011-06-05 16:50 ` [PATCH 2 of 6 RESENT] libxl: Accept disk name in libxl_devid_to_device_disk Marek Marczykowski
2011-06-06 11:24   ` Ian Campbell
2011-06-06 11:31     ` Ian Campbell
2011-06-27 16:28     ` [PATCH 2 of 6 RESENT] libxl: Accept disk name in libxl_devid_to_device_disk [and 1 more messages] Ian Jackson
2011-06-05 16:50 ` [PATCH 3 of 6 RESENT] libxl: Allocate memory for strings in libxl_device_disk Marek Marczykowski
2011-06-06 11:24   ` Ian Campbell
2011-06-27 16:25   ` Ian Jackson
2011-06-05 16:50 ` [PATCH 4 of 6 RESENT] xl: Use macros for param parsing in network-attach, to prevent use explicit sizeof("param") Marek Marczykowski
2011-06-07 12:02   ` Stefano Stabellini
2011-06-05 16:50 ` [PATCH 5 of 6 RESENT] xen.lowlevel.xl: Return None on empty domain name Marek Marczykowski
2011-06-27 16:34   ` Ian Jackson
     [not found]   ` <19976.45675.438028.965156@mariner.uk.xensource.com>
2011-06-28 21:37     ` Backport libxl bugfixes to 4.1 (was: Re: [PATCH 5 of 6 RESENT] xen.lowlevel.xl: Return None on empty domain name) Marek Marczykowski
2011-06-28 21:57       ` Keir Fraser
2011-06-30 16:47       ` Ian Jackson
2011-08-25 11:05         ` Ian Jackson
2011-08-25 11:12           ` Backport libxl bugfixes to 4.1 Marek Marczykowski
2011-08-25 17:13             ` [PATCH 0 of 5] A bunch of fixes for libxl Marek Marczykowski
2011-08-25 17:13               ` [PATCH 1 of 5] libxl: Remove frontend and backend devices from xenstore after destroy Marek Marczykowski
2011-08-25 17:13               ` Marek Marczykowski [this message]
2011-08-25 17:13               ` [PATCH 3 of 5] libxl: Allocate memory for strings in libxl_device_disk Marek Marczykowski
2011-08-25 17:13               ` [PATCH 4 of 5] xen.lowlevel.xl: Return None on empty domain name Marek Marczykowski
2011-08-25 17:13               ` [PATCH 5 of 5] libxl: Do not SEGV when no 'removable' disk parameter in xenstore Marek Marczykowski
2011-08-30 17:19               ` [PATCH 0 of 5] A bunch of fixes for libxl Ian Jackson
2011-06-05 16:50 ` [PATCH 6 of 6 RESENT] libxl: Do not SEGV when no 'removable' disk parameter in xenstore Marek Marczykowski
2011-06-07 11:57   ` Stefano Stabellini
2011-06-07 12:00     ` Marek Marczykowski
2011-06-08 10:41       ` [PATCH] " Marek Marczykowski
2011-06-08 10:50         ` Stefano Stabellini
2011-06-27 16:37           ` [PATCH] libxl: Do not SEGV when no 'removable' disk parameter in xenstore [and 1 more messages] Ian Jackson
2011-06-08 10:42       ` [PATCH RESENTv2] libxl: Do not SEGV when no 'removable' disk parameter in xenstore Marek Marczykowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8080606fb87a751f7cde.1314292426@devel14 \
    --to=marmarek@mimuw.edu.pl \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).