xen-vtx-unstable

view tools/examples/block-enbd @ 4952:3b25e1de5efb

bitkeeper revision 1.1429 (4289ccd8fb0eTpyK6vZqNWsrHJLttA)

Merge firebug.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
into firebug.cl.cam.ac.uk:/local/scratch/cl349/xen-unstable.bk
author cl349@firebug.cl.cam.ac.uk
date Tue May 17 10:52:08 2005 +0000 (2005-05-17)
parents 0a4b76b6b5a0 98d34d775063
children e9d01c5dc7b4 219d96d545fc 4d899a738d59 e7c7196fa329
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 >&2
31 echo 'Valid commands are: bind, unbind' >&2
32 exit 1
33 esac