ia64/xen-unstable

view tools/examples/block-enbd @ 2799:3f929065a1d1

bitkeeper revision 1.1159.1.316 (418580d5gYF87eBU_ebP1s7cMleu3g)

Merge ssh://srg//auto/groups/xeno/BK/xeno.bk
into anvil.research:/home/irchomes/mwilli2/xen-dmesg-clear.bk
author mwilli2@anvil.research
date Mon Nov 01 00:18:29 2004 +0000 (2004-11-01)
parents 3eebdef21285
children 0a4b76b6b5a0
line source
1 #!/bin/sh
3 # Usage: block-enbd [bind server ctl_port |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.
10 #
11 # This assumes you're running a correctly configured server at the other end!
13 case $1 in
14 bind)
15 for dev in /dev/nd*; do
16 if nbd-client $2:$3 $dev; then
17 echo $dev
18 exit 0
19 fi
20 done
21 exit 1
22 ;;
24 unbind)
25 nbd-client -d $2
26 exit 0
27 ;;
29 *)
30 echo 'Unknown command: ' $1
31 echo 'Valid commands are: bind, unbind'
32 exit 1
33 esac