35 lines
1.2 KiB
Diff
35 lines
1.2 KiB
Diff
Index: xen-3.3.0-testing/tools/examples/block
|
|
===================================================================
|
|
--- xen-3.3.0-testing.orig/tools/examples/block
|
|
+++ xen-3.3.0-testing/tools/examples/block
|
|
@@ -225,11 +225,14 @@ 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."
|
|
test -f "$file" || fatal "$file does not exist."
|
|
mode=$(canonicalise_mode "$mode")
|
|
+ [ "$mode" = "r" ] && lo_flags="$lo_flags -r"
|
|
|
|
claim_lock "block"
|
|
|
|
@@ -338,12 +341,12 @@ 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"
|