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

[Xen-devel] [PATCH 5 of 6] libxl: add support for NetBSD to use disk ima

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 5 of 6] libxl: add support for NetBSD to use disk images as a PHY backend
From: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
Date: Thu, 22 Sep 2011 14:01:12 +0200
Delivery-date: Thu, 22 Sep 2011 05:12:14 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:content-type:mime-version:content-transfer-encoding:subject :x-mercurial-node:message-id:in-reply-to:references:user-agent:date :from:to; bh=tg0cwG+u6FHOfMhskWMz5C81OJI5wjlJ2BtChWI3Ydg=; b=eXPPvwJxWsTd+yM2dt2g2F+Xq+oHK/Kt250vR2J0xOj8gDY/fyyDg0CsvejfxTJhaU ffgqmywXtCBZxocZvAUtId6PKxQ6Dfulof7eS3InAyMm5xiv7yjuaxjcBn7Jac3WMCFB 1Ap6lJkeUaTfGncvdbEEW9t3eJ++KpOkP+XRg=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1316692867@loki>
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>
References: <patchbomb.1316692867@loki>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.8.4
# 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

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