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-3.1-testing] tools/examples/block better use of los

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.1-testing] tools/examples/block better use of losetup -r
From: "Xen patchbot-3.1-testing" <patchbot-3.1-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 24 Jan 2008 07:10:37 -0800
Delivery-date: Thu, 24 Jan 2008 07:13:30 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1201186705 0
# Node ID f3a62e21b666b3ca553ac38e0cecee71e6a60220
# Parent  8fae9e400c4e156f2f216f338365dc053ddf58e7
tools/examples/block better use of losetup -r

Use losetup -r when the vbd is specified to be readonly, but only if
-r is supported (rather than always creating a writeable losetup
mapping if possible).

This was inspired by (but not derived from) a diff from the Fedora 8
patchset which uses -r iff the vbd is specified as readonly.  We need
to be cleverer upstream because not all systems have losetup -r.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
xen-unstable changeset:   16642:643ab64d12d5ce57e5f1e08f85ab4bb7fbc136ae
xen-unstable date:        Wed Dec 19 15:05:15 2007 +0000
---
 tools/examples/block |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff -r 8fae9e400c4e -r f3a62e21b666 tools/examples/block
--- a/tools/examples/block      Thu Jan 24 14:57:57 2008 +0000
+++ b/tools/examples/block      Thu Jan 24 14:58:25 2008 +0000
@@ -367,10 +367,13 @@ mount it read-write in a guest domain."
           fatal 'Failed to find an unused loop device'
         fi
 
-        status=$(losetup "$loopdev" "$file" || echo "failed")
-        if [ -n "$status" ]; then
-          do_or_die losetup -r "$loopdev" "$file"
+        if LANG=C losetup -h 2>&1 | grep read-only >/dev/null
+        then
+          roflag="-$mode"; roflag="${roflag#-w}"
+        else
+          roflag=''
         fi
+        do_or_die losetup $roflag "$loopdev" "$file"
         xenstore_write "$XENBUS_PATH/node" "$loopdev"
         write_dev "$loopdev"
         release_lock "block"

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.1-testing] tools/examples/block better use of losetup -r, Xen patchbot-3.1-testing <=