|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] [xen-unstable] tools/examples/block better use of losetu
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1198076715 0
# Node ID 643ab64d12d5ce57e5f1e08f85ab4bb7fbc136ae
# Parent b0c85bc56f9ef08a354499afea584c4b048068a3
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>
---
tools/examples/block | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff -r b0c85bc56f9e -r 643ab64d12d5 tools/examples/block
--- a/tools/examples/block Wed Dec 19 15:02:05 2007 +0000
+++ b/tools/examples/block Wed Dec 19 15:05:15 2007 +0000
@@ -327,10 +327,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"
- fi
+ 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-unstable] tools/examples/block better use of losetup -r,
Xen patchbot-unstable <=
|
|
|
|
|