ia64/xen-unstable
view tools/examples/block-file @ 4895:24dfd18ea63e
bitkeeper revision 1.1159.258.120 (42848bfe8kMyWWcBA64rq7h7l7AyoA)
Shadow code bug fix (found by Ian) that was breaking refcounts, and subsequently
causing migration problems.
Shadow code bug fix (found by Ian) that was breaking refcounts, and subsequently
causing migration problems.
author | mafetter@fleming.research |
---|---|
date | Fri May 13 11:14:06 2005 +0000 (2005-05-13) |
parents | 3eebdef21285 |
children | 0a4b76b6b5a0 |
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. We print the path to the loop device node to stdout.
7 #
8 # The node argument to unbind is the name of the device node we are to
9 # unbind.
11 case $1 in
12 bind)
13 for dev in /dev/loop*; do
14 if losetup $dev $2; then
15 echo $dev
16 exit 0
17 fi
18 done
19 exit 1
20 ;;
22 unbind)
23 losetup -d $2
24 exit 0
25 ;;
27 *)
28 echo 'Unknown command: ' $1
29 echo 'Valid commands are: bind, unbind'
30 exit 1
31 esac