Mailing List Archive

[PATCH 06 of 15 v5] hotplug NetBSD: pass an action instead of a state to hotplug scripts
# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1323864490 -3600
# Node ID 7b68b9415745c8bff5d0148bbf3953f6f083e655
# Parent 08a9f86b79dfe5db150392c916a72bafc3f05137
hotplug NetBSD: pass an action instead of a state to hotplug scripts

change second parameter of NetBSD hotplug scripts to take an action
(CONNECT/DISCONNECT) instead of a xenbus state. This patch also
changes the behaviour of xenbackend to pass an action instead of a
state.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>

diff -r 08a9f86b79df -r 7b68b9415745 tools/hotplug/NetBSD/block
--- a/tools/hotplug/NetBSD/block Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/hotplug/NetBSD/block Wed Dec 14 13:08:10 2011 +0100
@@ -18,7 +18,7 @@ error() {


xpath=$1
-xstatus=$2
+xaction=$2
xparams=$(xenstore-read "$xpath/params")

if [ -f $xparams ]; then
@@ -27,8 +27,8 @@ else
xtype="phy"
fi

-case $xstatus in
-6)
+case $xaction in
+2)
# device removed
case $xtype in
file)
@@ -46,7 +46,7 @@ 6)
xenstore-rm $xpath
exit 0
;;
-2)
+1)
case $xtype in
file)
# Store the list of available vnd(4) devices in
diff -r 08a9f86b79df -r 7b68b9415745 tools/hotplug/NetBSD/vif-bridge
--- a/tools/hotplug/NetBSD/vif-bridge Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/hotplug/NetBSD/vif-bridge Wed Dec 14 13:08:10 2011 +0100
@@ -11,15 +11,15 @@ PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${P
export PATH

xpath=$1
-xstatus=$2
+xaction=$2

-case $xstatus in
-6)
+case $xaction in
+2)
# device removed
xenstore-rm $xpath
exit 0
;;
-2)
+1)
xbridge=$(xenstore-read "$xpath/bridge")
xfid=$(xenstore-read "$xpath/frontend-id")
xhandle=$(xenstore-read "$xpath/handle")
diff -r 08a9f86b79df -r 7b68b9415745 tools/hotplug/NetBSD/vif-ip
--- a/tools/hotplug/NetBSD/vif-ip Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/hotplug/NetBSD/vif-ip Wed Dec 14 13:08:10 2011 +0100
@@ -11,15 +11,15 @@ PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${P
export PATH

xpath=$1
-xstatus=$2
+xaction=$2

-case $xstatus in
-6)
+case $xaction in
+2)
# device removed
xenstore-rm $xpath
exit 0
;;
-2)
+1)
xip=$(xenstore-read "$xpath/ip")
xfid=$(xenstore-read "$xpath/frontend-id")
xhandle=$(xenstore-read "$xpath/handle")
diff -r 08a9f86b79df -r 7b68b9415745 tools/xenbackendd/xenbackendd.c
--- a/tools/xenbackendd/xenbackendd.c Wed Dec 14 13:08:10 2011 +0100
+++ b/tools/xenbackendd/xenbackendd.c Wed Dec 14 13:08:10 2011 +0100
@@ -34,6 +34,9 @@
#define DEVTYPE_VIF 1
#define DEVTYPE_VBD 2

+#define CONNECT "1"
+#define DISCONNECT "2"
+
#define DOMAIN_PATH "/local/domain/0"

#ifndef XEN_SCRIPT_DIR
@@ -149,6 +152,7 @@ main(int argc, char * const argv[])
unsigned int num;
char *s;
int state;
+ char *action;
char *sstate;
char *p;
char buf[80];
@@ -297,11 +301,13 @@ main(int argc, char * const argv[])
strerror(errno));
goto next2;
}
- doexec(s, vec[XS_WATCH_PATH], sstate);
+ action = (state == 6 ? DISCONNECT : CONNECT);
+ doexec(s, vec[XS_WATCH_PATH], action);
break;

case DEVTYPE_VBD:
- doexec(vbd_script, vec[XS_WATCH_PATH], sstate);
+ action = (state == 6 ? DISCONNECT : CONNECT);
+ doexec(vbd_script, vec[XS_WATCH_PATH], action);
break;

default:

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel