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: Drop internal DEVICE_TAP backend t

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: Drop internal DEVICE_TAP backend type
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Sat, 09 Apr 2011 09:20:29 +0100
Delivery-date: Sat, 09 Apr 2011 01:27:56 -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 1302277258 -3600
# Node ID e917931a698b84293e94971209db62e37d7fcff8
# Parent  17d39055197100ec981dd284b9d74f80800caf4d
libxl: Drop internal DEVICE_TAP backend type

There is no such thing with blktap2, the backend in that case is PHY.

libxl_device_disk_del was just plain wrong in this regard, fix it to
select the appropriate backend_kind.

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


diff -r 17d390551971 -r e917931a698b tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Fri Apr 08 16:40:19 2011 +0100
+++ b/tools/libxl/libxl.c       Fri Apr 08 16:40:58 2011 +0100
@@ -950,7 +950,6 @@
     flexarray_t *front;
     flexarray_t *back;
     char *dev;
-    char *backend_type;
     int devid;
     libxl__device device;
     int major, minor, rc;
@@ -970,7 +969,6 @@
         goto out_free;
     }
 
-    backend_type = libxl__device_disk_string_of_backend(disk->backend);
     devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
     if (devid==-1) {
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Invalid or unsupported"
@@ -1021,8 +1019,6 @@
                 libxl__device_disk_string_of_format(disk->format),
                 disk->pdev_path));
 
-            backend_type = "phy";
-
             /* now create a phy device to export the device to the guest */
             goto do_backend_phy;
 
@@ -1051,7 +1047,7 @@
     flexarray_append(back, "dev");
     flexarray_append(back, disk->vdev);
     flexarray_append(back, "type");
-    flexarray_append(back, backend_type);
+    flexarray_append(back, 
libxl__device_disk_string_of_backend(disk->backend));
     flexarray_append(back, "mode");
     flexarray_append(back, disk->readwrite ? "w" : "r");
 
@@ -1093,14 +1089,30 @@
     devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
     device.backend_domid    = disk->backend_domid;
     device.backend_devid    = devid;
-    device.backend_kind     =
-        (disk->backend == DISK_BACKEND_PHY) ? DEVICE_VBD : DEVICE_TAP;
+
+    switch (disk->backend) {
+        case DISK_BACKEND_PHY:
+            device.backend_kind = DEVICE_VBD;
+            break;
+        case DISK_BACKEND_TAP:
+            device.backend_kind = DEVICE_VBD;
+            break;
+        case DISK_BACKEND_QDISK:
+            device.backend_kind = DEVICE_QDISK;
+            break;
+        default:
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk backend type: 
%d\n",
+                       disk->backend);
+            rc = ERROR_INVAL;
+            goto out_free;
+    }
     device.domid            = domid;
     device.devid            = devid;
     device.kind             = DEVICE_VBD;
     rc = libxl__device_del(&gc, &device, wait);
     xs_rm(ctx->xsh, XBT_NULL, libxl__device_backend_path(&gc, &device));
     xs_rm(ctx->xsh, XBT_NULL, libxl__device_frontend_path(&gc, &device));
+out_free:
     libxl__free_all(&gc);
     return rc;
 }
diff -r 17d390551971 -r e917931a698b tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Fri Apr 08 16:40:19 2011 +0100
+++ b/tools/libxl/libxl_device.c        Fri Apr 08 16:40:58 2011 +0100
@@ -31,7 +31,6 @@
 static const char *string_of_kinds[] = {
     [DEVICE_VIF] = "vif",
     [DEVICE_VBD] = "vbd",
-    [DEVICE_TAP] = "tap",
     [DEVICE_QDISK] = "qdisk",
     [DEVICE_PCI] = "pci",
     [DEVICE_VFB] = "vfb",
@@ -135,7 +134,7 @@
 {
     switch (backend) {
         case DISK_BACKEND_QDISK: return "qdisk";
-        case DISK_BACKEND_TAP: return "tap";
+        case DISK_BACKEND_TAP: return "phy";
         case DISK_BACKEND_PHY: return "phy";
         default: return NULL;
     }
diff -r 17d390551971 -r e917931a698b tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Fri Apr 08 16:40:19 2011 +0100
+++ b/tools/libxl/libxl_internal.h      Fri Apr 08 16:40:58 2011 +0100
@@ -97,7 +97,6 @@
 typedef enum {
     DEVICE_VIF = 1,
     DEVICE_VBD,
-    DEVICE_TAP,
     DEVICE_QDISK,
     DEVICE_PCI,
     DEVICE_VFB,

_______________________________________________
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: Drop internal DEVICE_TAP backend type, Xen patchbot-unstable <=