mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
Fixes file: devices since unbind now runs after the backend driver closes the loopback device. Also moves name -> node translation into the backend domain. Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
31 lines
430 B
Bash
31 lines
430 B
Bash
#! /bin/sh
|
|
|
|
set -e
|
|
|
|
expand_dev() {
|
|
local dev
|
|
case $1 in
|
|
/*)
|
|
dev=$1
|
|
;;
|
|
*)
|
|
dev=/dev/$1
|
|
;;
|
|
esac
|
|
echo -n $dev
|
|
}
|
|
|
|
case $1 in
|
|
bind)
|
|
dev=$(expand_dev $2)
|
|
major=$(stat -L -c %t "$dev")
|
|
minor=$(stat -L -c %T "$dev")
|
|
pdev=$(printf "0x%02x%02x" 0x$major 0x$minor)
|
|
xenstore-write "$XENBUS_PATH"/physical-device $pdev \
|
|
"$XENBUS_PATH"/node $dev
|
|
exit 0
|
|
;;
|
|
unbind)
|
|
;;
|
|
esac
|