xen-vtx-unstable

view tools/examples/block-file @ 6796:0d8c0db04258

Don't return failure when trying to delete a non-existent node.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Sep 13 21:52:24 2005 +0000 (2005-09-13)
parents 72e4e2aab342
children
line source
1 #!/bin/sh
3 # Usage: block_loop [bind file|unbind node]
4 #
5 # The file argument to the bind command is the file we are to bind to a
6 # loop device.
7 #
8 # The node argument to unbind is the name of the device node we are to
9 # unbind.
11 set -e
13 case $1 in
14 bind)
15 for dev in /dev/loop*; do
16 if losetup $dev $2; then
17 major=$(stat -L -c %t "$dev")
18 minor=$(stat -L -c %T "$dev")
19 pdev=$(printf "0x%02x%02x" 0x$major 0x$minor)
20 xenstore-write "$XENBUS_PATH"/physical-device $pdev \
21 "$XENBUS_PATH"/node $dev
22 exit 0
23 fi
24 done
25 exit 1
26 ;;
27 unbind)
28 losetup -d $2
29 exit 0
30 ;;
31 esac