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

[Xen-changelog] [xen-unstable] libxl: return raw disk and partition numb

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: return raw disk and partition number from libxl__device_disk_dev_number
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Wed, 06 Apr 2011 00:30:15 +0100
Delivery-date: Tue, 05 Apr 2011 16:31:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1302020631 -3600
# Node ID e83b98175f34a881fa1d95b3e9563f1239804812
# Parent  b0a7aa13cbc6d8c9933cb2ac38c91a806fa1c312
libxl: return raw disk and partition number from libxl__device_disk_dev_number

Optional parameters, caller to follow.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r b0a7aa13cbc6 -r e83b98175f34 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Apr 05 17:21:36 2011 +0100
+++ b/tools/libxl/libxl.c       Tue Apr 05 17:23:51 2011 +0100
@@ -602,7 +602,8 @@
     for (i = 0; i < num_disks; i++) {
         if (asprintf(&(waiter[i].path), "%s/device/vbd/%d/eject",
                      libxl__xs_get_dompath(&gc, domid),
-                     libxl__device_disk_dev_number(disks[i].vdev)) < 0)
+                     libxl__device_disk_dev_number(disks[i].vdev,
+                                                   NULL, NULL)) < 0)
             goto out;
         if (asprintf(&(waiter[i].token), "%d", LIBXL_EVENT_DISK_EJECT) < 0)
             goto out;
@@ -956,7 +957,7 @@
     }
 
     backend_type = libxl__device_disk_string_of_backend(disk->backend);
-    devid = libxl__device_disk_dev_number(disk->vdev);
+    devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
     if (devid==-1) {
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Invalid or unsupported"
                " virtual disk identifier %s", disk->vdev);
@@ -1072,7 +1073,7 @@
     libxl__device device;
     int devid, rc;
 
-    devid = libxl__device_disk_dev_number(disk->vdev);
+    devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
     device.backend_domid    = disk->backend_domid;
     device.backend_devid    = devid;
     device.backend_kind     =
@@ -1807,7 +1808,7 @@
     char *val;
 
     dompath = libxl__xs_get_dompath(&gc, domid);
-    diskinfo->devid = libxl__device_disk_dev_number(disk->vdev);
+    diskinfo->devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
 
     /* tap devices entries in xenstore are written as vbd devices. */
     diskpath = libxl__sprintf(&gc, "%s/device/vbd/%d", dompath, 
diskinfo->devid);
diff -r b0a7aa13cbc6 -r e83b98175f34 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Tue Apr 05 17:21:36 2011 +0100
+++ b/tools/libxl/libxl_device.c        Tue Apr 05 17:23:51 2011 +0100
@@ -200,7 +200,7 @@
     return 1;
 }
 
-int libxl__device_disk_dev_number(char *virtpath)
+int libxl__device_disk_dev_number(char *virtpath, int *pdisk, int *ppartition)
 {
     int disk, partition;
     char *ep;
@@ -214,6 +214,8 @@
         device_virtdisk_matches(virtpath, "xvd",
                                 &disk, (1<<20)-1,
                                 &partition, 255)) {
+        if (pdisk) *pdisk = disk;
+        if (ppartition) *ppartition = partition;
         if (disk <= 15 && partition <= 15)
             return (202 << 8) | (disk << 4) | partition;
         else
@@ -228,11 +230,15 @@
     if (device_virtdisk_matches(virtpath, "hd",
                                 &disk, 3,
                                 &partition, 63)) {
+        if (pdisk) *pdisk = disk;
+        if (ppartition) *ppartition = partition;
         return ((disk<2 ? 3 : 22) << 8) | ((disk & 1) << 6) | partition;
     }
     if (device_virtdisk_matches(virtpath, "sd",
                                 &disk, 15,
                                 &partition, 15)) {
+        if (pdisk) *pdisk = disk;
+        if (ppartition) *ppartition = partition;
         return (8 << 8) | (disk << 4) | partition;
     }
     return -1;
diff -r b0a7aa13cbc6 -r e83b98175f34 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Tue Apr 05 17:21:36 2011 +0100
+++ b/tools/libxl/libxl_internal.h      Tue Apr 05 17:23:51 2011 +0100
@@ -186,7 +186,8 @@
 _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(char *virtpath,
+                                          int *pdisk, int *ppartition);
 
 _hidden int libxl__device_generic_add(libxl__gc *gc, libxl__device *device,
                              char **bents, char **fents);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: return raw disk and partition number from libxl__device_disk_dev_number, Xen patchbot-unstable <=