This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2006-01-03 14:36:56 +01:00
commit 8f5424c6bb
5 files changed
+44 -63

No files matched your search

@@ -540,6 +540,9 @@ static int __init blkif_init(void)
pending_vaddrs = kmalloc(sizeof(pending_vaddrs[0]) *
mmap_pages, GFP_KERNEL);
if (!pending_reqs || !pending_grant_handles || !pending_vaddrs) {
kfree(pending_reqs);
kfree(pending_grant_handles);
kfree(pending_vaddrs);
printk("%s: out of memory\n", __FUNCTION__);
return -1;
}
@@ -225,7 +225,7 @@ static int blktap_open(struct inode *inode, struct file *filp)
/* Allocate the fe ring. */
sring = (blkif_sring_t *)get_zeroed_page(GFP_KERNEL);
if (sring == NULL)
goto fail_nomem;
return -ENOMEM;
SetPageReserved(virt_to_page(sring));
@@ -233,9 +233,6 @@ static int blktap_open(struct inode *inode, struct file *filp)
FRONT_RING_INIT(&blktap_ufe_ring, sring, PAGE_SIZE);
return 0;
fail_nomem:
return -ENOMEM;
}
static int blktap_release(struct inode *inode, struct file *filp)
@@ -391,12 +388,12 @@ void blktap_kick_user(void)
}
static struct file_operations blktap_fops = {
owner: THIS_MODULE,
poll: blktap_poll,
ioctl: blktap_ioctl,
open: blktap_open,
release: blktap_release,
mmap: blktap_mmap,
.owner = THIS_MODULE,
.poll = blktap_poll,
.ioctl = blktap_ioctl,
.open = blktap_open,
.release = blktap_release,
.mmap = blktap_mmap,
};
@@ -314,39 +314,31 @@ static void __xencons_tx_flush(void)
{
int sent, sz, work_done = 0;
if (xen_start_info->flags & SIF_INITDOMAIN) {
if (x_char) {
if (x_char) {
if (xen_start_info->flags & SIF_INITDOMAIN)
kcons_write_dom0(NULL, &x_char, 1);
x_char = 0;
work_done = 1;
}
else
while (x_char)
if (xencons_ring_send(&x_char, 1) == 1)
break;
x_char = 0;
work_done = 1;
}
while (wc != wp) {
sz = wp - wc;
if (sz > (wbuf_size - WBUF_MASK(wc)))
sz = wbuf_size - WBUF_MASK(wc);
while (wc != wp) {
sz = wp - wc;
if (sz > (wbuf_size - WBUF_MASK(wc)))
sz = wbuf_size - WBUF_MASK(wc);
if (xen_start_info->flags & SIF_INITDOMAIN) {
kcons_write_dom0(NULL, &wbuf[WBUF_MASK(wc)], sz);
wc += sz;
work_done = 1;
}
} else {
while (x_char) {
if (xencons_ring_send(&x_char, 1) == 1) {
x_char = 0;
work_done = 1;
}
}
while (wc != wp) {
sz = wp - wc;
if (sz > (wbuf_size - WBUF_MASK(wc)))
sz = wbuf_size - WBUF_MASK(wc);
} else {
sent = xencons_ring_send(&wbuf[WBUF_MASK(wc)], sz);
if (sent == 0)
break;
wc += sent;
work_done = 1;
}
work_done = 1;
}
if (work_done && (xencons_tty != NULL)) {
@@ -183,7 +183,7 @@ static void unmap_frontend_pages(netif_t *netif)
int netif_map(netif_t *netif, unsigned long tx_ring_ref,
unsigned long rx_ring_ref, unsigned int evtchn)
{
int err;
int err = -ENOMEM;
netif_tx_sring_t *txs;
netif_rx_sring_t *rxs;
evtchn_op_t op = {
@@ -199,25 +199,16 @@ int netif_map(netif_t *netif, unsigned long tx_ring_ref,
if (netif->tx_comms_area == NULL)
return -ENOMEM;
netif->rx_comms_area = alloc_vm_area(PAGE_SIZE);
if (netif->rx_comms_area == NULL) {
free_vm_area(netif->tx_comms_area);
return -ENOMEM;
}
if (netif->rx_comms_area == NULL)
goto err_rx;
err = map_frontend_pages(netif, tx_ring_ref, rx_ring_ref);
if (err) {
free_vm_area(netif->tx_comms_area);
free_vm_area(netif->rx_comms_area);
return err;
}
if (err)
goto err_map;
err = HYPERVISOR_event_channel_op(&op);
if (err) {
unmap_frontend_pages(netif);
free_vm_area(netif->tx_comms_area);
free_vm_area(netif->rx_comms_area);
return err;
}
if (err)
goto err_hypervisor;
netif->evtchn = op.u.bind_interdomain.local_port;
@@ -245,6 +236,13 @@ int netif_map(netif_t *netif, unsigned long tx_ring_ref,
rtnl_unlock();
return 0;
err_hypervisor:
unmap_frontend_pages(netif);
err_map:
free_vm_area(netif->rx_comms_area);
err_rx:
free_vm_area(netif->tx_comms_area);
return err;
}
static void free_netif_callback(void *arg)
@@ -542,14 +542,6 @@ static int xenbus_probe_node(struct xen_bus_type *bus,
const char *type,
const char *nodename)
{
#define CHECK_FAIL \
do { \
if (err) \
goto fail; \
} \
while (0) \
int err;
struct xenbus_device *xendev;
size_t stringlen;
@@ -584,19 +576,18 @@ static int xenbus_probe_node(struct xen_bus_type *bus,
xendev->dev.release = xenbus_dev_release;
err = bus->get_bus_id(xendev->dev.bus_id, xendev->nodename);
CHECK_FAIL;
if (err)
goto fail;
/* Register with generic device framework. */
err = device_register(&xendev->dev);
CHECK_FAIL;
if (err)
goto fail;
device_create_file(&xendev->dev, &dev_attr_nodename);
device_create_file(&xendev->dev, &dev_attr_devtype);
return 0;
#undef CHECK_FAIL
fail:
xenbus_dev_free(xendev);
return err;
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.