# HG changeset patch
# User emellor@ewan
# Node ID e9e10e783ccd7f7dfaf5443fcdaf8394c5c2a65e
# Parent b5c5360a61d01912ccd71c0d07b03d424024d14f
# Parent 99532f6b2ae37ed5bf103e07b1e2bf7c29e5ce1d
Merged.
diff -r b5c5360a61d0 -r e9e10e783ccd
linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c Fri Oct 7
12:34:10 2005
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c Fri Oct 7
12:34:45 2005
@@ -65,12 +65,6 @@
mask_evtchn(evtchn);
evtchns[evtchn].handler = NULL;
-}
-
-void unbind_evtchn_from_irq(unsigned int evtchn)
-{
- printk("unbind_evtchn_from_irq called... FIXME??\n");
- while(1);
}
irqreturn_t evtchn_interrupt(int irq, void *dev_id, struct pt_regs *regs)
diff -r b5c5360a61d0 -r e9e10e783ccd
linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Fri Oct 7 12:34:10 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Fri Oct 7 12:34:45 2005
@@ -296,7 +296,7 @@
}
EXPORT_SYMBOL(unbind_ipi_from_irq);
-int bind_evtchn_to_irq(unsigned int evtchn)
+static int bind_evtchn_to_irq(unsigned int evtchn)
{
int irq;
@@ -314,9 +314,8 @@
return irq;
}
-EXPORT_SYMBOL(bind_evtchn_to_irq);
-
-void unbind_evtchn_from_irq(unsigned int irq)
+
+static void unbind_evtchn_from_irq(unsigned int irq)
{
evtchn_op_t op = { .cmd = EVTCHNOP_close };
int evtchn = irq_to_evtchn[irq];
@@ -333,7 +332,6 @@
spin_unlock(&irq_mapping_update_lock);
}
-EXPORT_SYMBOL(unbind_evtchn_from_irq);
int bind_evtchn_to_irqhandler(
unsigned int evtchn,
@@ -347,8 +345,10 @@
irq = bind_evtchn_to_irq(evtchn);
retval = request_irq(irq, handler, irqflags, devname, dev_id);
- if (retval != 0)
+ if (retval != 0) {
unbind_evtchn_from_irq(irq);
+ return retval;
+ }
return irq;
}
diff -r b5c5360a61d0 -r e9e10e783ccd
linux-2.6-xen-sparse/drivers/xen/blkback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Fri Oct 7
12:34:10 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Fri Oct 7
12:34:45 2005
@@ -74,6 +74,10 @@
.u.bind_interdomain.remote_dom = blkif->domid,
.u.bind_interdomain.remote_port = evtchn };
+ /* Already connected through? */
+ if (blkif->irq)
+ return 0;
+
if ( (blkif->blk_ring_area = alloc_vm_area(PAGE_SIZE)) == NULL )
return -ENOMEM;
@@ -107,8 +111,12 @@
{
blkif_t *blkif = (blkif_t *)arg;
- if (blkif->irq)
- unbind_evtchn_from_irqhandler(blkif->irq, blkif);
+ /* Already disconnected? */
+ if (!blkif->irq)
+ return;
+
+ unbind_evtchn_from_irqhandler(blkif->irq, blkif);
+ blkif->irq = 0;
vbd_free(&blkif->vbd);
diff -r b5c5360a61d0 -r e9e10e783ccd
linux-2.6-xen-sparse/drivers/xen/netback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Fri Oct 7
12:34:10 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Fri Oct 7
12:34:45 2005
@@ -183,6 +183,10 @@
.u.bind_interdomain.remote_dom = netif->domid,
.u.bind_interdomain.remote_port = evtchn };
+ /* Already connected through? */
+ if (netif->irq)
+ return 0;
+
netif->comms_area = alloc_vm_area(2*PAGE_SIZE);
if (netif->comms_area == NULL)
return -ENOMEM;
@@ -227,13 +231,12 @@
{
netif_t *netif = (netif_t *)arg;
- /*
- * This can't be done in netif_disconnect() because at that point
- * there may be outstanding requests in the network stack whose
- * asynchronous responses must still be notified to the remote driver.
- */
- if (netif->irq)
- unbind_evtchn_from_irqhandler(netif->irq, netif);
+ /* Already disconnected? */
+ if (!netif->irq)
+ return;
+
+ unbind_evtchn_from_irqhandler(netif->irq, netif);
+ netif->irq = 0;
unregister_netdev(netif->dev);
diff -r b5c5360a61d0 -r e9e10e783ccd
linux-2.6-xen-sparse/include/asm-xen/evtchn.h
--- a/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Fri Oct 7 12:34:10 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Fri Oct 7 12:34:45 2005
@@ -50,14 +50,6 @@
/* Dynamically bind an IPI source to Linux IRQ space. */
extern int bind_ipi_to_irq(int ipi);
extern void unbind_ipi_from_irq(int ipi);
-
-/*
- * Dynamically bind an event-channel port to Linux IRQ space.
- * BIND: Returns IRQ or error.
- * UNBIND: Takes IRQ to unbind from; automatically closes the event channel.
- */
-extern int bind_evtchn_to_irq(unsigned int evtchn);
-extern void unbind_evtchn_from_irq(unsigned int irq);
/*
* Dynamically bind an event-channel port to an IRQ-like callback handler.
diff -r b5c5360a61d0 -r e9e10e783ccd tools/examples/Makefile
--- a/tools/examples/Makefile Fri Oct 7 12:34:10 2005
+++ b/tools/examples/Makefile Fri Oct 7 12:34:45 2005
@@ -22,8 +22,7 @@
XEN_SCRIPTS = network-bridge vif-bridge
XEN_SCRIPTS += network-route vif-route
XEN_SCRIPTS += network-nat vif-nat
-XEN_SCRIPTS += block-phy
-XEN_SCRIPTS += block-file
+XEN_SCRIPTS += block
XEN_SCRIPTS += block-enbd
XEN_HOTPLUG_DIR = /etc/hotplug
diff -r b5c5360a61d0 -r e9e10e783ccd tools/examples/vif-bridge
--- a/tools/examples/vif-bridge Fri Oct 7 12:34:10 2005
+++ b/tools/examples/vif-bridge Fri Oct 7 12:34:45 2005
@@ -33,6 +33,7 @@
# Exit if anything goes wrong
set -e
+export PATH=/sbin:/bin:/usr/bin:/usr/sbin:$PATH
echo "*vif-bridge $*" >&2
diff -r b5c5360a61d0 -r e9e10e783ccd tools/examples/vif-nat
--- a/tools/examples/vif-nat Fri Oct 7 12:34:10 2005
+++ b/tools/examples/vif-nat Fri Oct 7 12:34:45 2005
@@ -22,7 +22,7 @@
# Exit if anything goes wrong
set -e
-
+export PATH=/sbin:/bin:/usr/bin:/usr/sbin:$PATH
echo "*vif-nat $*" >&2
# Operation name.
diff -r b5c5360a61d0 -r e9e10e783ccd tools/examples/vif-route
--- a/tools/examples/vif-route Fri Oct 7 12:34:10 2005
+++ b/tools/examples/vif-route Fri Oct 7 12:34:45 2005
@@ -23,7 +23,7 @@
# Exit if anything goes wrong
set -e
-
+export PATH=/sbin:/bin:/usr/bin:/usr/sbin:$PATH
echo "*vif-route $*" >&2
# Operation name.
diff -r b5c5360a61d0 -r e9e10e783ccd tools/examples/xen-backend.agent
--- a/tools/examples/xen-backend.agent Fri Oct 7 12:34:10 2005
+++ b/tools/examples/xen-backend.agent Fri Oct 7 12:34:45 2005
@@ -11,20 +11,14 @@
add)
case "$XENBUS_TYPE" in
vbd)
- t=$(xenstore-read "$XENBUS_PATH"/type)
- params=$(xenstore-read "$XENBUS_PATH"/params)
- [ -x /etc/xen/scripts/block-"$t" ] && \
- /etc/xen/scripts/block-"$t" bind $params
+ /etc/xen/scripts/block bind
;;
esac
;;
remove)
case "$XENBUS_TYPE" in
vbd)
- t=$(xenstore-read "$XENBUS_PATH"/type)
- node=$(xenstore-read "$XENBUS_PATH"/node)
- [ -x /etc/xen/scripts/block-"$t" ] && \
- /etc/xen/scripts/block-"$t" unbind $node
+ /etc/xen/scripts/block unbind
;;
esac
# remove device backend store entries
diff -r b5c5360a61d0 -r e9e10e783ccd tools/examples/block
--- /dev/null Fri Oct 7 12:34:10 2005
+++ b/tools/examples/block Fri Oct 7 12:34:45 2005
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+set -e
+
+export PATH=/sbin:/bin:/usr/bin:/usr/sbin:$PATH
+
+expand_dev() {
+ local dev
+ case $1 in
+ /*)
+ dev=$1
+ ;;
+ *)
+ dev=/dev/$1
+ ;;
+ esac
+ echo -n $dev
+}
+
+write_dev() {
+ local major
+ local minor
+ local pdev
+
+ major=$(stat -L -c %t "$1")
+ minor=$(stat -L -c %T "$1")
+ pdev=$(printf "0x%02x%02x" 0x$major 0x$minor)
+ xenstore-write "$XENBUS_PATH"/physical-device $pdev \
+ "$XENBUS_PATH"/node $1
+}
+
+t=$(xenstore-read "$XENBUS_PATH"/type)
+
+case $1 in
+ bind)
+ p=$(xenstore-read "$XENBUS_PATH"/params)
+ case $t in
+ phy)
+ dev=$(expand_dev $p)
+ write_dev "$dev"
+ exit 0
+ ;;
+
+ file)
+ for dev in /dev/loop* ; do
+ echo "dev is $dev, p is $p"
+ if losetup $dev $p; then
+ write_dev "$dev"
+ exit 0
+ fi
+ done
+ exit 1
+ ;;
+
+ *)
+ [ -x /etc/xen/scripts/block-"$t" ] && \
+ /etc/xen/scripts/block-"$t" bind $p
+ ;;
+ esac
+ ;;
+
+ unbind)
+ node=$(xenstore-read "$XENBUS_PATH"/node)
+ case $t in
+ phy)
+ exit 0
+ ;;
+
+ file)
+ losetup -d $node
+ exit 0
+ ;;
+
+ *)
+ [ -x /etc/xen/scripts/block-"$t" ] && \
+ /etc/xen/scripts/block-"$t" unbind $node
+ ;;
+
+ esac
+ ;;
+
+esac
diff -r b5c5360a61d0 -r e9e10e783ccd tools/examples/xen-backend.rules
--- /dev/null Fri Oct 7 12:34:10 2005
+++ b/tools/examples/xen-backend.rules Fri Oct 7 12:34:45 2005
@@ -0,0 +1,4 @@
+SUBSYSTEM=="xen-backend", KERNEL=="vbd*", ACTION=="add",
RUN+="/etc/xen/scripts/block bind"
+SUBSYSTEM=="xen-backend", KERNEL=="vbd*", ACTION=="remove",
RUN+="/etc/xen/scripts/block unbind"
+SUBSYSTEM=="xen-backend", KERNEL=="vif*", ENV{PHYSDEVDRIVER}=="vif",
ACTION=="online", RUN+="$env{script} up"
+SUBSYSTEM=="xen-backend", ACTION=="remove", RUN+="/usr/bin/xenstore-rm
$env{XENBUS_PATH}"
diff -r b5c5360a61d0 -r e9e10e783ccd tools/examples/block-file
--- a/tools/examples/block-file Fri Oct 7 12:34:10 2005
+++ /dev/null Fri Oct 7 12:34:45 2005
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-# Usage: block_loop [bind file|unbind node]
-#
-# The file argument to the bind command is the file we are to bind to a
-# loop device.
-#
-# The node argument to unbind is the name of the device node we are to
-# unbind.
-
-set -e
-
-case $1 in
- bind)
- for dev in /dev/loop*; do
- if losetup $dev $2; then
- 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
- fi
- done
- exit 1
- ;;
- unbind)
- losetup -d $2
- exit 0
- ;;
-esac
diff -r b5c5360a61d0 -r e9e10e783ccd tools/examples/block-phy
--- a/tools/examples/block-phy Fri Oct 7 12:34:10 2005
+++ /dev/null Fri Oct 7 12:34:45 2005
@@ -1,30 +0,0 @@
-#! /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
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|