This commit is contained in:
emellor@ewan committed 2005-10-07 13:34:45 +01:00
commit 7dc4ee7c76
14 files changed
+117 -101

No files matched your search

@@ -67,12 +67,6 @@ void unbind_evtchn_from_irqhandler(unsigned int evtchn, void *dev_id)
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)
{
u32 l1, l2;
@@ -296,7 +296,7 @@ void unbind_ipi_from_irq(int ipi)
}
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 @@ int bind_evtchn_to_irq(unsigned int evtchn)
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 @@ void unbind_evtchn_from_irq(unsigned int irq)
spin_unlock(&irq_mapping_update_lock);
}
EXPORT_SYMBOL(unbind_evtchn_from_irq);
int bind_evtchn_to_irqhandler(
unsigned int evtchn,
@@ -347,8 +345,10 @@ int bind_evtchn_to_irqhandler(
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;
}
@@ -74,6 +74,10 @@ int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn)
.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 @@ static void free_blkif(void *arg)
{
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);
@@ -183,6 +183,10 @@ int netif_map(netif_t *netif, unsigned long tx_ring_ref,
.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 @@ static void free_netif_callback(void *arg)
{
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);
@@ -51,14 +51,6 @@ extern void unbind_virq_from_irq(int virq);
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.
* On some platforms this may not be implemented via the Linux IRQ subsystem.
+1 -2
View File
@@ -22,8 +22,7 @@ XEN_SCRIPT_DIR = /etc/xen/scripts
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
+82
View File
@@ -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
-31
View File
@@ -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
-30
View File
@@ -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
+1
View File
@@ -33,6 +33,7 @@
# Exit if anything goes wrong
set -e
export PATH=/sbin:/bin:/usr/bin:/usr/sbin:$PATH
echo "*vif-bridge $*" >&2
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+2 -8
View File
@@ -11,20 +11,14 @@ case "$ACTION" in
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
+4
View File
@@ -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}"
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.