[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 5 of 6] libxl: add support for NetBSD to use disk images as a PHY backend



# HG changeset patch
# User Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
# Date 1316692503 -7200
# Node ID a5c9a6083bef9d4789a0194389db234740cd6005
# Parent  d5cca9e3b5d3576073a543d0305e8f0d9dc9beeb
libxl: add support for NetBSD to use disk images as a PHY backend

Add a NetBSD special case to use images as PHY disk devices, which can be 
attached using the regular block hotplug script.

Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>

diff -r d5cca9e3b5d3 -r a5c9a6083bef tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Thu Sep 22 13:54:55 2011 +0200
+++ b/tools/libxl/libxl_device.c        Thu Sep 22 13:55:03 2011 +0200
@@ -136,15 +136,20 @@ static int disk_try_backend(disk_try_bac
               a->disk->format == LIBXL_DISK_FORMAT_EMPTY)) {
             goto bad_format;
         }
-        if (a->disk->format != LIBXL_DISK_FORMAT_EMPTY &&
-            !S_ISBLK(a->stab.st_mode)) {
-            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Disk vdev=%s, backend phy"
-                       " unsuitable as phys path not a block device",
-                       a->disk->vdev);
-            return 0;
-        }
-
-        return backend;
+        if (S_ISBLK(a->stab.st_mode))
+            return backend;
+#ifdef HAVE_PHY_BACKEND_FILE_SUPPORT
+        if (S_ISREG(a->stab.st_mode))
+            return backend;
+        LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Disk vdev=%s, backend phy"
+            " unsuitable as phys path not a block device or"
+            " raw image", a->disk->vdev);
+#else
+        LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Disk vdev=%s, backend phy"
+            " unsuitable as phys path not a block device",
+            a->disk->vdev);
+#endif
+        return 0;
 
     case LIBXL_DISK_BACKEND_TAP:
         if (!libxl__blktap_enabled(a->gc)) {
diff -r d5cca9e3b5d3 -r a5c9a6083bef tools/libxl/libxl_osdeps.h
--- a/tools/libxl/libxl_osdeps.h        Thu Sep 22 13:54:55 2011 +0200
+++ b/tools/libxl/libxl_osdeps.h        Thu Sep 22 13:55:03 2011 +0200
@@ -25,6 +25,7 @@
 
 #if defined(__NetBSD__) || defined(__OpenBSD__)
 #include <util.h>
+#define HAVE_PHY_BACKEND_FILE_SUPPORT
 #elif defined(__linux__)
 #include <pty.h>
 #elif defined(__sun__)

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.