33 lines
1.1 KiB
Diff
33 lines
1.1 KiB
Diff
|
Index: xen-unstable/tools/examples/block
|
||
|
===================================================================
|
||
|
--- xen-unstable.orig/tools/examples/block
|
||
|
+++ xen-unstable/tools/examples/block
|
||
|
@@ -259,10 +259,13 @@ case "$command" in
|
||
|
;;
|
||
|
|
||
|
file)
|
||
|
+ lo_flags=""
|
||
|
+ [ "${mode/S}" = "$mode" ] || lo_flags="-y"
|
||
|
# Canonicalise the file, for sharing check comparison, and the mode
|
||
|
# for ease of use here.
|
||
|
file=$(readlink -f "$p") || fatal "$p does not exist."
|
||
|
mode=$(canonicalise_mode "$mode")
|
||
|
+ [ "$mode" = "r" ] && lo_flags="$lo_flags -r"
|
||
|
|
||
|
claim_lock "block"
|
||
|
|
||
|
@@ -370,11 +373,11 @@ mount it read-write in a guest domain."
|
||
|
fatal 'Failed to find an unused loop device'
|
||
|
fi
|
||
|
|
||
|
- losetup "$loopdev" "$file" && losetup_failure="" && break
|
||
|
+ losetup $lo_flags "$loopdev" "$file" && losetup_failure="" && break
|
||
|
done
|
||
|
if [ "$losetup_failure" ]
|
||
|
then
|
||
|
- fatal 'losetup $loopdev $file'
|
||
|
+ fatal 'losetup $lo_flags $loopdev $file'
|
||
|
fi
|
||
|
|
||
|
xenstore_write "$XENBUS_PATH/node" "$loopdev"
|