43 lines
1.1 KiB
Diff
43 lines
1.1 KiB
Diff
Index: xen-unstable/tools/examples/block
|
|
===================================================================
|
|
--- xen-unstable.orig/tools/examples/block
|
|
+++ xen-unstable/tools/examples/block
|
|
@@ -42,6 +42,20 @@ canonicalise_mode()
|
|
fi
|
|
}
|
|
|
|
+##
|
|
+# sync_flags mode
|
|
+#
|
|
+sync_flags()
|
|
+{
|
|
+ local mode="$1"
|
|
+ if expr index "$mode" 'S' >/dev/null
|
|
+ then
|
|
+ echo "-y"
|
|
+ else
|
|
+ echo ""
|
|
+ fi
|
|
+}
|
|
+
|
|
|
|
##
|
|
# check_sharing device mode
|
|
@@ -262,6 +276,7 @@ case "$command" in
|
|
# Canonicalise the file, for sharing check comparison, and the mode
|
|
# for ease of use here.
|
|
file=$(readlink -f "$p") || fatal "$p does not exist."
|
|
+ sync=$(sync_flags "$mode")
|
|
mode=$(canonicalise_mode "$mode")
|
|
|
|
claim_lock "block"
|
|
@@ -367,7 +382,7 @@ mount it read-write in a guest domain."
|
|
fatal 'Failed to find an unused loop device'
|
|
fi
|
|
|
|
- do_or_die losetup "$loopdev" "$file"
|
|
+ do_or_die losetup $sync "$loopdev" "$file"
|
|
xenstore_write "$XENBUS_PATH/node" "$loopdev"
|
|
write_dev "$loopdev"
|
|
release_lock "block"
|