WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] linux-2.6.18/backends: use xenbus_be.ko interfaces i

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] linux-2.6.18/backends: use xenbus_be.ko interfaces instead of open-coding them
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Mon, 04 Apr 2011 16:38:14 +0100
Delivery-date: Mon, 04 Apr 2011 08:39:01 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Also remove unused xenbus_{,un}map_ring(), adjust types, and clean up
header inclusion.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- a/drivers/xen/blkback/blkback.c
+++ b/drivers/xen/blkback/blkback.c
@@ -41,6 +41,8 @@
 #include <linux/list.h>
 #include <linux/delay.h>
 #include <xen/balloon.h>
+#include <xen/evtchn.h>
+#include <xen/gnttab.h>
 #include <asm/hypervisor.h>
 #include "common.h"
 
--- a/drivers/xen/blkback/common.h
+++ b/drivers/xen/blkback/common.h
@@ -32,17 +32,12 @@
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/blkdev.h>
-#include <linux/vmalloc.h>
 #include <linux/wait.h>
-#include <asm/io.h>
-#include <asm/setup.h>
-#include <asm/pgalloc.h>
-#include <xen/evtchn.h>
 #include <asm/hypervisor.h>
 #include <xen/blkif.h>
-#include <xen/gnttab.h>
 #include <xen/driver_util.h>
 #include <xen/xenbus.h>
+#include <xen/interface/event_channel.h>
 #include "blkback-pagemap.h"
 
 
@@ -93,9 +88,6 @@ typedef struct blkif_st {
        int                 st_wr_sect;
 
        wait_queue_head_t waiting_to_free;
-
-       grant_handle_t shmem_handle;
-       grant_ref_t    shmem_ref;
 } blkif_t;
 
 struct backend_info
@@ -111,7 +103,7 @@ struct backend_info
 blkif_t *blkif_alloc(domid_t domid);
 void blkif_disconnect(blkif_t *blkif);
 void blkif_free(blkif_t *blkif);
-int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn);
+int blkif_map(blkif_t *blkif, grant_ref_t, evtchn_port_t);
 void vbd_resize(blkif_t *blkif);
 
 #define blkif_get(_b) (atomic_inc(&(_b)->refcnt))
--- a/drivers/xen/blkback/interface.c
+++ b/drivers/xen/blkback/interface.c
@@ -33,7 +33,7 @@
 #include "common.h"
 #include <xen/evtchn.h>
 #include <linux/kthread.h>
-#include <linux/delay.h>
+#include <linux/vmalloc.h>
 
 static kmem_cache_t *blkif_cachep;
 
@@ -55,75 +55,39 @@ blkif_t *blkif_alloc(domid_t domid)
        return blkif;
 }
 
-static int map_frontend_page(blkif_t *blkif, unsigned long shared_page)
-{
-       struct gnttab_map_grant_ref op;
-       int ret;
-
-       gnttab_set_map_op(&op, (unsigned long)blkif->blk_ring_area->addr,
-                         GNTMAP_host_map, shared_page, blkif->domid);
-
-       gnttab_check_GNTST_eagain_do_while(GNTTABOP_map_grant_ref, &op);
-
-       if (op.status == GNTST_okay) {
-               blkif->shmem_ref = shared_page;
-               blkif->shmem_handle = op.handle;
-               ret = 0;
-       } else {
-               DPRINTK(" Grant table operation failure %d!\n", (int)op.status);
-               ret = -EINVAL;
-       }
-
-       return ret;
-}
-
-static void unmap_frontend_page(blkif_t *blkif)
-{
-       struct gnttab_unmap_grant_ref op;
-
-       gnttab_set_unmap_op(&op, (unsigned long)blkif->blk_ring_area->addr,
-                           GNTMAP_host_map, blkif->shmem_handle);
-
-       if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
-               BUG();
-}
-
-int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn)
+int blkif_map(blkif_t *blkif, grant_ref_t ring_ref, evtchn_port_t evtchn)
 {
+       struct vm_struct *area;
        int err;
 
        /* Already connected through? */
        if (blkif->irq)
                return 0;
 
-       if ( (blkif->blk_ring_area = alloc_vm_area(PAGE_SIZE)) == NULL )
-               return -ENOMEM;
-
-       err = map_frontend_page(blkif, shared_page);
-       if (err) {
-               free_vm_area(blkif->blk_ring_area);
-               return err;
-       }
+       area = xenbus_map_ring_valloc(blkif->be->dev, ring_ref);
+       if (IS_ERR(area))
+               return PTR_ERR(area);
+       blkif->blk_ring_area = area;
 
        switch (blkif->blk_protocol) {
        case BLKIF_PROTOCOL_NATIVE:
        {
                blkif_sring_t *sring;
-               sring = (blkif_sring_t *)blkif->blk_ring_area->addr;
+               sring = (blkif_sring_t *)area->addr;
                BACK_RING_INIT(&blkif->blk_rings.native, sring, PAGE_SIZE);
                break;
        }
        case BLKIF_PROTOCOL_X86_32:
        {
                blkif_x86_32_sring_t *sring_x86_32;
-               sring_x86_32 = (blkif_x86_32_sring_t 
*)blkif->blk_ring_area->addr;
+               sring_x86_32 = (blkif_x86_32_sring_t *)area->addr;
                BACK_RING_INIT(&blkif->blk_rings.x86_32, sring_x86_32, 
PAGE_SIZE);
                break;
        }
        case BLKIF_PROTOCOL_X86_64:
        {
                blkif_x86_64_sring_t *sring_x86_64;
-               sring_x86_64 = (blkif_x86_64_sring_t 
*)blkif->blk_ring_area->addr;
+               sring_x86_64 = (blkif_x86_64_sring_t *)area->addr;
                BACK_RING_INIT(&blkif->blk_rings.x86_64, sring_x86_64, 
PAGE_SIZE);
                break;
        }
@@ -135,8 +99,7 @@ int blkif_map(blkif_t *blkif, unsigned l
                blkif->domid, evtchn, blkif_be_int, 0, "blkif-backend", blkif);
        if (err < 0)
        {
-               unmap_frontend_page(blkif);
-               free_vm_area(blkif->blk_ring_area);
+               xenbus_unmap_ring_vfree(blkif->be->dev, area);
                blkif->blk_rings.common.sring = NULL;
                return err;
        }
@@ -162,8 +125,7 @@ void blkif_disconnect(blkif_t *blkif)
        }
 
        if (blkif->blk_rings.common.sring) {
-               unmap_frontend_page(blkif);
-               free_vm_area(blkif->blk_ring_area);
+               xenbus_unmap_ring_vfree(blkif->be->dev, blkif->blk_ring_area);
                blkif->blk_rings.common.sring = NULL;
        }
 }
--- a/drivers/xen/blktap/blktap.c
+++ b/drivers/xen/blktap/blktap.c
@@ -46,6 +46,8 @@
 #include "common.h"
 #include <xen/balloon.h>
 #include <xen/driver_util.h>
+#include <xen/evtchn.h>
+#include <xen/gnttab.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/mm.h>
--- a/drivers/xen/blktap/common.h
+++ b/drivers/xen/blktap/common.h
@@ -32,15 +32,11 @@
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/blkdev.h>
-#include <linux/vmalloc.h>
-#include <asm/io.h>
-#include <asm/setup.h>
-#include <asm/pgalloc.h>
-#include <xen/evtchn.h>
 #include <asm/hypervisor.h>
 #include <xen/blkif.h>
-#include <xen/gnttab.h>
 #include <xen/driver_util.h>
+#include <xen/xenbus.h>
+#include <xen/interface/event_channel.h>
 
 #define DPRINTK(_f, _a...) pr_debug("(file=%s, line=%d) " _f, \
                                     __FILE__ , __LINE__ , ## _a )
@@ -79,19 +75,15 @@ typedef struct blkif_st {
 
        wait_queue_head_t waiting_to_free;
 
-       grant_handle_t shmem_handle;
-       grant_ref_t    shmem_ref;
-       
        int             dev_num;
        uint64_t        sectors;
 } blkif_t;
 
 blkif_t *tap_alloc_blkif(domid_t domid);
-void tap_blkif_free(blkif_t *blkif);
+void tap_blkif_free(blkif_t *, struct xenbus_device *);
 void tap_blkif_kmem_cache_free(blkif_t *blkif);
-int tap_blkif_map(blkif_t *blkif, unsigned long shared_page, 
-                 unsigned int evtchn);
-void tap_blkif_unmap(blkif_t *blkif);
+int tap_blkif_map(blkif_t *, struct xenbus_device *, grant_ref_t,
+                 evtchn_port_t);
 
 #define blkif_get(_b) (atomic_inc(&(_b)->refcnt))
 #define blkif_put(_b)                                  \
--- a/drivers/xen/blktap/interface.c
+++ b/drivers/xen/blktap/interface.c
@@ -33,7 +33,7 @@
 
 #include "common.h"
 #include <xen/evtchn.h>
-#include <linux/delay.h>
+#include <linux/vmalloc.h>
 
 static kmem_cache_t *blkif_cachep;
 
@@ -55,76 +55,40 @@ blkif_t *tap_alloc_blkif(domid_t domid)
        return blkif;
 }
 
-static int map_frontend_page(blkif_t *blkif, unsigned long shared_page)
-{
-       struct gnttab_map_grant_ref op;
-       int ret;
-
-       gnttab_set_map_op(&op, (unsigned long)blkif->blk_ring_area->addr,
-                         GNTMAP_host_map, shared_page, blkif->domid);
-
-       gnttab_check_GNTST_eagain_do_while(GNTTABOP_map_grant_ref, &op);
-
-       if (op.status == GNTST_okay) {
-               blkif->shmem_ref = shared_page;
-               blkif->shmem_handle = op.handle;
-               ret = 0;
-       } else {
-               DPRINTK("Grant table operation failure %d!\n", (int)op.status);
-               ret = -EINVAL;
-       }
-
-       return ret;
-}
-
-static void unmap_frontend_page(blkif_t *blkif)
-{
-       struct gnttab_unmap_grant_ref op;
-
-       gnttab_set_unmap_op(&op, (unsigned long)blkif->blk_ring_area->addr,
-                           GNTMAP_host_map, blkif->shmem_handle);
-
-       if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
-               BUG();
-}
-
-int tap_blkif_map(blkif_t *blkif, unsigned long shared_page, 
-                 unsigned int evtchn)
+int tap_blkif_map(blkif_t *blkif, struct xenbus_device *dev,
+                 grant_ref_t ring_ref, evtchn_port_t evtchn)
 {
+       struct vm_struct *area;
        int err;
 
        /* Already connected through? */
        if (blkif->irq)
                return 0;
 
-       if ( (blkif->blk_ring_area = alloc_vm_area(PAGE_SIZE)) == NULL )
-               return -ENOMEM;
-
-       err = map_frontend_page(blkif, shared_page);
-       if (err) {
-               free_vm_area(blkif->blk_ring_area);
-               return err;
-       }
+       area = xenbus_map_ring_valloc(dev, ring_ref);
+       if (IS_ERR(area))
+               return PTR_ERR(area);
+       blkif->blk_ring_area = area;
 
        switch (blkif->blk_protocol) {
        case BLKIF_PROTOCOL_NATIVE:
        {
                blkif_sring_t *sring;
-               sring = (blkif_sring_t *)blkif->blk_ring_area->addr;
+               sring = (blkif_sring_t *)area->addr;
                BACK_RING_INIT(&blkif->blk_rings.native, sring, PAGE_SIZE);
                break;
        }
        case BLKIF_PROTOCOL_X86_32:
        {
                blkif_x86_32_sring_t *sring_x86_32;
-               sring_x86_32 = (blkif_x86_32_sring_t 
*)blkif->blk_ring_area->addr;
+               sring_x86_32 = (blkif_x86_32_sring_t *)area->addr;
                BACK_RING_INIT(&blkif->blk_rings.x86_32, sring_x86_32, 
PAGE_SIZE);
                break;
        }
        case BLKIF_PROTOCOL_X86_64:
        {
                blkif_x86_64_sring_t *sring_x86_64;
-               sring_x86_64 = (blkif_x86_64_sring_t 
*)blkif->blk_ring_area->addr;
+               sring_x86_64 = (blkif_x86_64_sring_t *)area->addr;
                BACK_RING_INIT(&blkif->blk_rings.x86_64, sring_x86_64, 
PAGE_SIZE);
                break;
        }
@@ -136,8 +100,7 @@ int tap_blkif_map(blkif_t *blkif, unsign
                blkif->domid, evtchn, tap_blkif_be_int,
                0, "blkif-backend", blkif);
        if (err < 0) {
-               unmap_frontend_page(blkif);
-               free_vm_area(blkif->blk_ring_area);
+               xenbus_unmap_ring_vfree(dev, area);
                blkif->blk_rings.common.sring = NULL;
                return err;
        }
@@ -146,28 +109,23 @@ int tap_blkif_map(blkif_t *blkif, unsign
        return 0;
 }
 
-void tap_blkif_unmap(blkif_t *blkif)
+void tap_blkif_free(blkif_t *blkif, struct xenbus_device *dev)
 {
+       atomic_dec(&blkif->refcnt);
+       wait_event(blkif->waiting_to_free, atomic_read(&blkif->refcnt) == 0);
+       atomic_inc(&blkif->refcnt);
+
        if (blkif->irq) {
                unbind_from_irqhandler(blkif->irq, blkif);
                blkif->irq = 0;
        }
+
        if (blkif->blk_rings.common.sring) {
-               unmap_frontend_page(blkif);
-               free_vm_area(blkif->blk_ring_area);
+               xenbus_unmap_ring_vfree(dev, blkif->blk_ring_area);
                blkif->blk_rings.common.sring = NULL;
        }
 }
 
-void tap_blkif_free(blkif_t *blkif)
-{
-       atomic_dec(&blkif->refcnt);
-       wait_event(blkif->waiting_to_free, atomic_read(&blkif->refcnt) == 0);
-       atomic_inc(&blkif->refcnt);
-
-       tap_blkif_unmap(blkif);
-}
-
 void tap_blkif_kmem_cache_free(blkif_t *blkif)
 {
        if (!atomic_dec_and_test(&blkif->refcnt))
--- a/drivers/xen/blktap/xenbus.c
+++ b/drivers/xen/blktap/xenbus.c
@@ -187,7 +187,7 @@ static int blktap_remove(struct xenbus_d
                if (be->blkif->xenblkd)
                        kthread_stop(be->blkif->xenblkd);
                signal_tapdisk(be->blkif->dev_num);
-               tap_blkif_free(be->blkif);
+               tap_blkif_free(be->blkif, dev);
                tap_blkif_kmem_cache_free(be->blkif);
                be->blkif = NULL;
        }
@@ -342,7 +342,7 @@ static void blkif_disconnect(blkif_t *bl
        }
 
        /* idempotent */
-       tap_blkif_free(blkif);
+       tap_blkif_free(blkif, blkif->be->dev);
 }
 
 /**
@@ -465,7 +465,7 @@ static int connect_ring(struct backend_i
               ring_ref, evtchn, be->blkif->blk_protocol, protocol);
 
        /* Map the shared frame, irq etc. */
-       err = tap_blkif_map(be->blkif, ring_ref, evtchn);
+       err = tap_blkif_map(be->blkif, dev, ring_ref, evtchn);
        if (err) {
                xenbus_dev_fatal(dev, err, "mapping ring-ref %lu port %u",
                                 ring_ref, evtchn);
--- a/drivers/xen/netback/common.h
+++ b/drivers/xen/netback/common.h
@@ -38,14 +38,10 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/wait.h>
-#include <xen/evtchn.h>
 #include <xen/interface/io/netif.h>
-#include <asm/io.h>
-#include <asm/pgalloc.h>
-#include <xen/interface/grant_table.h>
-#include <xen/gnttab.h>
 #include <xen/driver_util.h>
 #include <xen/xenbus.h>
+#include <xen/interface/event_channel.h>
 
 #define DPRINTK(_f, _a...)                     \
        pr_debug("(file=%s, line=%d) " _f,      \
@@ -59,11 +55,6 @@ typedef struct netif_st {
 
        u8               fe_dev_addr[6];
 
-       /* Physical parameters of the comms window. */
-       grant_handle_t   tx_shmem_handle;
-       grant_ref_t      tx_shmem_ref;
-       grant_handle_t   rx_shmem_handle;
-       grant_ref_t      rx_shmem_ref;
        unsigned int     irq;
 
        /* The shared rings and indexes. */
@@ -182,12 +173,12 @@ void netif_accel_init(void);
 #define NET_TX_RING_SIZE __CONST_RING_SIZE(netif_tx, PAGE_SIZE)
 #define NET_RX_RING_SIZE __CONST_RING_SIZE(netif_rx, PAGE_SIZE)
 
-void netif_disconnect(netif_t *netif);
+void netif_disconnect(struct backend_info *be);
 
 void netif_set_features(netif_t *netif);
 netif_t *netif_alloc(struct device *parent, domid_t domid, unsigned int 
handle);
-int netif_map(netif_t *netif, unsigned long tx_ring_ref,
-             unsigned long rx_ring_ref, unsigned int evtchn);
+int netif_map(struct backend_info *be, grant_ref_t tx_ring_ref,
+             grant_ref_t rx_ring_ref, evtchn_port_t evtchn);
 
 #define netif_get(_b) (atomic_inc(&(_b)->refcnt))
 #define netif_put(_b)                                          \
--- a/drivers/xen/netback/interface.c
+++ b/drivers/xen/netback/interface.c
@@ -34,6 +34,8 @@
 #include <linux/ethtool.h>
 #include <linux/rtnetlink.h>
 #include <linux/delay.h>
+#include <linux/vmalloc.h>
+#include <xen/evtchn.h>
 
 /*
  * Module parameter 'queue_length':
@@ -298,65 +300,11 @@ netif_t *netif_alloc(struct device *pare
        return netif;
 }
 
-static int map_frontend_pages(
-       netif_t *netif, grant_ref_t tx_ring_ref, grant_ref_t rx_ring_ref)
-{
-       struct gnttab_map_grant_ref op;
-
-       gnttab_set_map_op(&op, (unsigned long)netif->tx_comms_area->addr,
-                         GNTMAP_host_map, tx_ring_ref, netif->domid);
-       gnttab_check_GNTST_eagain_do_while(GNTTABOP_map_grant_ref, &op);
-
-       if (op.status != GNTST_okay) {
-               DPRINTK(" Gnttab failure mapping tx_ring_ref %d!\n", 
(int)op.status);
-               return -EINVAL;
-       }
-
-       netif->tx_shmem_ref    = tx_ring_ref;
-       netif->tx_shmem_handle = op.handle;
-
-       gnttab_set_map_op(&op, (unsigned long)netif->rx_comms_area->addr,
-                         GNTMAP_host_map, rx_ring_ref, netif->domid);
-       gnttab_check_GNTST_eagain_do_while(GNTTABOP_map_grant_ref, &op);
-
-       if (op.status != GNTST_okay) {
-               struct gnttab_unmap_grant_ref unop;
-
-               gnttab_set_unmap_op(&unop,
-                                   (unsigned long)netif->tx_comms_area->addr,
-                                   GNTMAP_host_map, netif->tx_shmem_handle);
-               VOID(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref,
-                                              &unop, 1));
-               DPRINTK(" Gnttab failure mapping rx_ring_ref %d!\n", 
(int)op.status);
-               return -EINVAL;
-       }
-
-       netif->rx_shmem_ref    = rx_ring_ref;
-       netif->rx_shmem_handle = op.handle;
-
-       return 0;
-}
-
-static void unmap_frontend_pages(netif_t *netif)
-{
-       struct gnttab_unmap_grant_ref op;
-
-       gnttab_set_unmap_op(&op, (unsigned long)netif->tx_comms_area->addr,
-                           GNTMAP_host_map, netif->tx_shmem_handle);
-
-       if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
-               BUG();
-
-       gnttab_set_unmap_op(&op, (unsigned long)netif->rx_comms_area->addr,
-                           GNTMAP_host_map, netif->rx_shmem_handle);
-
-       if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
-               BUG();
-}
-
-int netif_map(netif_t *netif, unsigned long tx_ring_ref,
-             unsigned long rx_ring_ref, unsigned int evtchn)
+int netif_map(struct backend_info *be, grant_ref_t tx_ring_ref,
+             grant_ref_t rx_ring_ref, evtchn_port_t evtchn)
 {
+       netif_t *netif = be->netif;
+       struct vm_struct *area;
        int err = -ENOMEM;
        netif_tx_sring_t *txs;
        netif_rx_sring_t *rxs;
@@ -365,16 +313,16 @@ int netif_map(netif_t *netif, unsigned l
        if (netif->irq)
                return 0;
 
-       netif->tx_comms_area = alloc_vm_area(PAGE_SIZE);
-       if (netif->tx_comms_area == NULL)
-               return -ENOMEM;
-       netif->rx_comms_area = alloc_vm_area(PAGE_SIZE);
-       if (netif->rx_comms_area == NULL)
+       area = xenbus_map_ring_valloc(be->dev, tx_ring_ref);
+       if (IS_ERR(area))
+               return PTR_ERR(area);
+       netif->tx_comms_area = area;
+       area = xenbus_map_ring_valloc(be->dev, rx_ring_ref);
+       if (IS_ERR(area)) {
+               err = PTR_ERR(area);
                goto err_rx;
-
-       err = map_frontend_pages(netif, tx_ring_ref, rx_ring_ref);
-       if (err)
-               goto err_map;
+       }
+       netif->rx_comms_area = area;
 
        err = bind_interdomain_evtchn_to_irqhandler(
                netif->domid, evtchn, netif_be_int, 0,
@@ -403,16 +351,16 @@ int netif_map(netif_t *netif, unsigned l
 
        return 0;
 err_hypervisor:
-       unmap_frontend_pages(netif);
-err_map:
-       free_vm_area(netif->rx_comms_area);
+       xenbus_unmap_ring_vfree(be->dev, netif->rx_comms_area);
 err_rx:
-       free_vm_area(netif->tx_comms_area);
+       xenbus_unmap_ring_vfree(be->dev, netif->tx_comms_area);
        return err;
 }
 
-void netif_disconnect(netif_t *netif)
+void netif_disconnect(struct backend_info *be)
 {
+       netif_t *netif = be->netif;
+
        if (netback_carrier_ok(netif)) {
                rtnl_lock();
                netback_carrier_off(netif);
@@ -435,9 +383,8 @@ void netif_disconnect(netif_t *netif)
        unregister_netdev(netif->dev);
 
        if (netif->tx.sring) {
-               unmap_frontend_pages(netif);
-               free_vm_area(netif->tx_comms_area);
-               free_vm_area(netif->rx_comms_area);
+               xenbus_unmap_ring_vfree(be->dev, netif->tx_comms_area);
+               xenbus_unmap_ring_vfree(be->dev, netif->rx_comms_area);
        }
 
        free_netdev(netif->dev);
--- a/drivers/xen/netback/netback.c
+++ b/drivers/xen/netback/netback.c
@@ -38,6 +38,8 @@
 #include <linux/if_vlan.h>
 #include <linux/tcp.h>
 #include <xen/balloon.h>
+#include <xen/evtchn.h>
+#include <xen/gnttab.h>
 #include <xen/interface/memory.h>
 
 /*define NETBE_DEBUG_INTERRUPT*/
--- a/drivers/xen/netback/xenbus.c
+++ b/drivers/xen/netback/xenbus.c
@@ -56,7 +56,7 @@ static void netback_disconnect(struct de
 
        if (be->netif) {
                kobject_uevent(&xbdev_dev->kobj, KOBJ_OFFLINE);
-               netif_disconnect(be->netif);
+               netif_disconnect(be);
                be->netif = NULL;
        }
 }
@@ -422,7 +422,7 @@ static int connect_rings(struct backend_
        netif_set_features(netif);
 
        /* Map the shared frame, irq etc. */
-       err = netif_map(netif, tx_ring_ref, rx_ring_ref, evtchn);
+       err = netif_map(be, tx_ring_ref, rx_ring_ref, evtchn);
        if (err) {
                xenbus_dev_fatal(dev, err,
                                 "mapping shared-frames %lu/%lu port %u",
--- a/drivers/xen/scsiback/common.h
+++ b/drivers/xen/scsiback/common.h
@@ -48,17 +48,10 @@
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_dbg.h>
 #include <scsi/scsi_eh.h>
-#include <asm/io.h>
-#include <asm/setup.h>
-#include <asm/pgalloc.h>
-#include <asm/delay.h>
-#include <xen/evtchn.h>
 #include <asm/hypervisor.h>
-#include <xen/gnttab.h>
 #include <xen/driver_util.h>
 #include <xen/xenbus.h>
 #include <xen/interface/io/ring.h>
-#include <xen/interface/grant_table.h>
 #include <xen/interface/io/vscsiif.h>
 
 
@@ -89,8 +82,6 @@ struct vscsibk_info {
 
        struct vscsiif_back_ring  ring;
        struct vm_struct *ring_area;
-       grant_handle_t shmem_handle;
-       grant_ref_t shmem_ref;
 
        spinlock_t ring_lock;
        atomic_t nr_unreplied_reqs;
@@ -147,14 +138,13 @@ typedef struct {
 #define VSCSI_TYPE_HOST                1
 
 irqreturn_t scsiback_intr(int, void *, struct pt_regs *);
-int scsiback_init_sring(struct vscsibk_info *info,
-               unsigned long ring_ref, unsigned int evtchn);
+int scsiback_init_sring(struct vscsibk_info *, grant_ref_t, evtchn_port_t);
 int scsiback_schedule(void *data);
 
 
 struct vscsibk_info *vscsibk_info_alloc(domid_t domid);
 void scsiback_free(struct vscsibk_info *info);
-void scsiback_disconnect(struct vscsibk_info *info);
+void scsiback_disconnect(struct vscsibk_info *);
 int __init scsiback_interface_init(void);
 void scsiback_interface_exit(void);
 int scsiback_xenbus_init(void);
--- a/drivers/xen/scsiback/interface.c
+++ b/drivers/xen/scsiback/interface.c
@@ -38,6 +38,7 @@
 #include <xen/evtchn.h>
 #include <linux/kthread.h>
 #include <linux/delay.h>
+#include <linux/vmalloc.h>
 
 
 static kmem_cache_t *scsiback_cachep;
@@ -59,45 +60,10 @@ struct vscsibk_info *vscsibk_info_alloc(
        return info;
 }
 
-static int map_frontend_page( struct vscsibk_info *info,
-                               unsigned long ring_ref)
-{
-       struct gnttab_map_grant_ref op;
-       int ret;
-
-       gnttab_set_map_op(&op, (unsigned long)info->ring_area->addr,
-                               GNTMAP_host_map, ring_ref,
-                               info->domid);
-       gnttab_check_GNTST_eagain_do_while(GNTTABOP_map_grant_ref, &op);
-
-       if (op.status != GNTST_okay) {
-               printk(KERN_ERR "scsiback: Grant table operation failure 
%d!\n", (int)op.status);
-               ret = -EINVAL;
-       } else {
-               info->shmem_ref    = ring_ref;
-               info->shmem_handle = op.handle;
-               ret = 0;
-       }
-
-       return ret;
-}
-
-static void unmap_frontend_page(struct vscsibk_info *info)
-{
-       struct gnttab_unmap_grant_ref op;
-       int err;
-
-       gnttab_set_unmap_op(&op, (unsigned long)info->ring_area->addr,
-                               GNTMAP_host_map, info->shmem_handle);
-
-       err = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1);
-       BUG_ON(err);
-
-}
-
-int scsiback_init_sring(struct vscsibk_info *info,
-               unsigned long ring_ref, unsigned int evtchn)
+int scsiback_init_sring(struct vscsibk_info *info, grant_ref_t ring_ref,
+                       evtchn_port_t evtchn)
 {
+       struct vm_struct *area;
        struct vscsiif_sring *sring;
        int err;
 
@@ -107,15 +72,12 @@ int scsiback_init_sring(struct vscsibk_i
                return -1;
        }
 
-       info->ring_area = alloc_vm_area(PAGE_SIZE);
-       if (!info)
-               return -ENOMEM;
-
-       err = map_frontend_page(info, ring_ref);
-       if (err)
-               goto free_vm;
+       area = xenbus_map_ring_valloc(info->dev, ring_ref);
+       if (IS_ERR(area))
+               return PTR_ERR(area);
+       info->ring_area = area;
 
-       sring = (struct vscsiif_sring *) info->ring_area->addr;
+       sring = (struct vscsiif_sring *)area->addr;
        BACK_RING_INIT(&info->ring, sring, PAGE_SIZE);
 
        err = bind_interdomain_evtchn_to_irqhandler(
@@ -130,9 +92,7 @@ int scsiback_init_sring(struct vscsibk_i
        return 0;
 
 unmap_page:
-       unmap_frontend_page(info);
-free_vm:
-       free_vm_area(info->ring_area);
+       xenbus_unmap_ring_vfree(info->dev, area);
 
        return err;
 }
@@ -153,8 +113,7 @@ void scsiback_disconnect(struct vscsibk_
        }
 
        if (info->ring.sring) {
-               unmap_frontend_page(info);
-               free_vm_area(info->ring_area);
+               xenbus_unmap_ring_vfree(info->dev, info->ring_area);
                info->ring.sring = NULL;
        }
 }
--- a/drivers/xen/scsiback/scsiback.c
+++ b/drivers/xen/scsiback/scsiback.c
@@ -35,6 +35,8 @@
 #include <linux/list.h>
 #include <linux/delay.h>
 #include <xen/balloon.h>
+#include <xen/evtchn.h>
+#include <xen/gnttab.h>
 #include <asm/hypervisor.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
--- a/drivers/xen/tpmback/common.h
+++ b/drivers/xen/tpmback/common.h
@@ -8,19 +8,31 @@
 #include <linux/version.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
+#include <linux/mm.h>
 #include <linux/slab.h>
-#include <xen/evtchn.h>
 #include <xen/driver_util.h>
-#include <xen/interface/grant_table.h>
+#include <xen/xenbus.h>
+#include <xen/interface/event_channel.h>
 #include <xen/interface/io/tpmif.h>
-#include <asm/io.h>
-#include <asm/pgalloc.h>
 
 #define DPRINTK(_f, _a...)                     \
        pr_debug("(file=%s, line=%d) " _f,      \
                 __FILE__ , __LINE__ , ## _a )
 
-struct backend_info;
+struct backend_info
+{
+       struct xenbus_device *dev;
+
+       /* our communications channel */
+       struct tpmif_st *tpmif;
+
+       long int frontend_id;
+       long int instance; // instance of TPM
+       u8 is_instance_set;// whether instance number has been set
+
+       /* watch front end for changes */
+       struct xenbus_watch backend_watch;
+};
 
 typedef struct tpmif_st {
        struct list_head tpmif_list;
@@ -44,8 +55,6 @@ typedef struct tpmif_st {
 
        struct backend_info *bi;
 
-       grant_handle_t shmem_handle;
-       grant_ref_t shmem_ref;
        struct page **mmap_pages;
 
        char devname[20];
@@ -59,7 +68,7 @@ void tpmif_schedule_work(tpmif_t * tpmif
 void tpmif_deschedule_work(tpmif_t * tpmif);
 void tpmif_xenbus_init(void);
 void tpmif_xenbus_exit(void);
-int tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn);
+int tpmif_map(tpmif_t *, grant_ref_t, evtchn_port_t);
 irqreturn_t tpmif_be_int(int irq, void *dev_id, struct pt_regs *regs);
 
 long int tpmback_get_instance(struct backend_info *bi);
--- a/drivers/xen/tpmback/interface.c
+++ b/drivers/xen/tpmback/interface.c
@@ -14,7 +14,9 @@
 
 #include "common.h"
 #include <linux/delay.h>
+#include <linux/vmalloc.h>
 #include <xen/balloon.h>
+#include <xen/evtchn.h>
 #include <xen/gnttab.h>
 
 static kmem_cache_t *tpmif_cachep;
@@ -78,68 +80,30 @@ tpmif_t *tpmif_find(domid_t domid, struc
        return alloc_tpmif(domid, bi);
 }
 
-static int map_frontend_page(tpmif_t *tpmif, unsigned long shared_page)
-{
-       struct gnttab_map_grant_ref op;
-       int ret;
-
-       gnttab_set_map_op(&op, (unsigned long)tpmif->tx_area->addr,
-                         GNTMAP_host_map, shared_page, tpmif->domid);
-
-       gnttab_check_GNTST_eagain_do_while(GNTTABOP_map_grant_ref, &op);
-
-       if (op.status != GNTST_okay) {
-               DPRINTK(" Grant table operation failure %d!\n", (int)op.status);
-               ret = -EINVAL;
-       } else {
-               tpmif->shmem_ref = shared_page;
-               tpmif->shmem_handle = op.handle;
-               ret = 0;
-       }
-
-       return ret;
-}
-
-static void unmap_frontend_page(tpmif_t *tpmif)
-{
-       struct gnttab_unmap_grant_ref op;
-
-       gnttab_set_unmap_op(&op, (unsigned long)tpmif->tx_area->addr,
-                           GNTMAP_host_map, tpmif->shmem_handle);
-
-       if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
-               BUG();
-}
-
-int tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn)
+int tpmif_map(tpmif_t *tpmif, grant_ref_t ring_ref, evtchn_port_t evtchn)
 {
+       struct vm_struct *area;
        int err;
 
        if (tpmif->irq)
                return 0;
 
-       if ((tpmif->tx_area = alloc_vm_area(PAGE_SIZE)) == NULL)
-               return -ENOMEM;
+       area = xenbus_map_ring_valloc(tpmif->bi->dev, ring_ref);
+       if (IS_ERR(area))
+               return PTR_ERR(area);
+       tpmif->tx_area = area;
 
-       err = map_frontend_page(tpmif, shared_page);
-       if (err) {
-               free_vm_area(tpmif->tx_area);
-               return err;
-       }
-
-       tpmif->tx = (tpmif_tx_interface_t *)tpmif->tx_area->addr;
+       tpmif->tx = (tpmif_tx_interface_t *)area->addr;
        memset(tpmif->tx, 0, PAGE_SIZE);
 
        err = bind_interdomain_evtchn_to_irqhandler(
                tpmif->domid, evtchn, tpmif_be_int, 0, tpmif->devname, tpmif);
        if (err < 0) {
-               unmap_frontend_page(tpmif);
-               free_vm_area(tpmif->tx_area);
+               xenbus_unmap_ring_vfree(tpmif->bi->dev, area);
                return err;
        }
        tpmif->irq = err;
 
-       tpmif->shmem_ref = shared_page;
        tpmif->active = 1;
 
        return 0;
@@ -150,10 +114,8 @@ void tpmif_disconnect_complete(tpmif_t *
        if (tpmif->irq)
                unbind_from_irqhandler(tpmif->irq, tpmif);
 
-       if (tpmif->tx) {
-               unmap_frontend_page(tpmif);
-               free_vm_area(tpmif->tx_area);
-       }
+       if (tpmif->tx)
+               xenbus_unmap_ring_vfree(tpmif->bi->dev, tpmif->tx_area);
 
        free_tpmif(tpmif);
 }
--- a/drivers/xen/tpmback/xenbus.c
+++ b/drivers/xen/tpmback/xenbus.c
@@ -21,21 +21,6 @@
 #include <xen/xenbus.h>
 #include "common.h"
 
-struct backend_info
-{
-       struct xenbus_device *dev;
-
-       /* our communications channel */
-       tpmif_t *tpmif;
-
-       long int frontend_id;
-       long int instance; // instance of TPM
-       u8 is_instance_set;// whether instance number has been set
-
-       /* watch front end for changes */
-       struct xenbus_watch backend_watch;
-};
-
 static void maybe_connect(struct backend_info *be);
 static void connect(struct backend_info *be);
 static int connect_ring(struct backend_info *be);
--- a/drivers/xen/usbback/interface.c
+++ b/drivers/xen/usbback/interface.c
@@ -43,8 +43,9 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include <linux/delay.h>
+#include <linux/vmalloc.h>
 #include "usbback.h"
+#include <xen/evtchn.h>
 
 static LIST_HEAD(usbif_list);
 static DEFINE_SPINLOCK(usbif_list_lock);
@@ -101,83 +102,27 @@ usbif_t *usbif_alloc(domid_t domid, unsi
        return usbif;
 }
 
-static int map_frontend_pages(usbif_t *usbif,
-                               grant_ref_t urb_ring_ref,
-                               grant_ref_t conn_ring_ref)
-{
-       struct gnttab_map_grant_ref op;
-
-       gnttab_set_map_op(&op, (unsigned long)usbif->urb_ring_area->addr,
-                         GNTMAP_host_map, urb_ring_ref, usbif->domid);
-
-       gnttab_check_GNTST_eagain_do_while(GNTTABOP_map_grant_ref, &op);
-
-       if (op.status != GNTST_okay) {
-               printk(KERN_ERR "grant table failure mapping urb_ring_ref 
%d\n", (int)op.status);
-               return -EINVAL;
-       }
-
-       usbif->urb_shmem_ref = urb_ring_ref;
-       usbif->urb_shmem_handle = op.handle;
-
-       gnttab_set_map_op(&op, (unsigned long)usbif->conn_ring_area->addr,
-                         GNTMAP_host_map, conn_ring_ref, usbif->domid);
-
-       gnttab_check_GNTST_eagain_do_while(GNTTABOP_map_grant_ref, &op);
-
-       if (op.status != GNTST_okay) {
-               struct gnttab_unmap_grant_ref unop;
-               gnttab_set_unmap_op(&unop,
-                               (unsigned long) usbif->urb_ring_area->addr,
-                               GNTMAP_host_map, usbif->urb_shmem_handle);
-               VOID(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &unop,
-                               1));
-               printk(KERN_ERR "grant table failure mapping conn_ring_ref 
%d\n", (int)op.status);
-               return -EINVAL;
-       }
-
-       usbif->conn_shmem_ref = conn_ring_ref;
-       usbif->conn_shmem_handle = op.handle;
-
-       return 0;
-}
-
-static void unmap_frontend_pages(usbif_t *usbif)
-{
-       struct gnttab_unmap_grant_ref op;
-
-       gnttab_set_unmap_op(&op, (unsigned long)usbif->urb_ring_area->addr,
-                           GNTMAP_host_map, usbif->urb_shmem_handle);
-
-       if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
-               BUG();
-
-       gnttab_set_unmap_op(&op, (unsigned long)usbif->conn_ring_area->addr,
-                           GNTMAP_host_map, usbif->conn_shmem_handle);
-
-       if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
-               BUG();
-}
-
-int usbif_map(usbif_t *usbif, unsigned long urb_ring_ref,
-               unsigned long conn_ring_ref, unsigned int evtchn)
+int usbif_map(usbif_t *usbif, grant_ref_t urb_ring_ref,
+             grant_ref_t conn_ring_ref, evtchn_port_t evtchn)
 {
        int err = -ENOMEM;
-
+       struct vm_struct *area;
        usbif_urb_sring_t *urb_sring;
        usbif_conn_sring_t *conn_sring;
 
        if (usbif->irq)
                return 0;
 
-       if ((usbif->urb_ring_area = alloc_vm_area(PAGE_SIZE)) == NULL)
-               return err;
-       if ((usbif->conn_ring_area = alloc_vm_area(PAGE_SIZE)) == NULL)
+       area = xenbus_map_ring_valloc(usbif->xbdev, urb_ring_ref);
+       if (IS_ERR(area))
+               return PTR_ERR(area);
+       usbif->urb_ring_area = area;
+       area = xenbus_map_ring_valloc(usbif->xbdev, conn_ring_ref);
+       if (IS_ERR(area)) {
+               err = PTR_ERR(area);
                goto fail_alloc;
-
-       err = map_frontend_pages(usbif, urb_ring_ref, conn_ring_ref);
-       if (err)
-               goto fail_map;
+       }
+       usbif->conn_ring_area = area;
 
        err = bind_interdomain_evtchn_to_irqhandler(
                        usbif->domid, evtchn, usbbk_be_int, 0,
@@ -197,11 +140,9 @@ int usbif_map(usbif_t *usbif, unsigned l
        return 0;
 
 fail_evtchn:
-       unmap_frontend_pages(usbif);
-fail_map:
-       free_vm_area(usbif->conn_ring_area);
+       xenbus_unmap_ring_vfree(usbif->xbdev, usbif->conn_ring_area);
 fail_alloc:
-       free_vm_area(usbif->urb_ring_area);
+       xenbus_unmap_ring_vfree(usbif->xbdev, usbif->urb_ring_area);
 
        return err;
 }
@@ -231,9 +172,8 @@ void usbif_disconnect(usbif_t *usbif)
        }
 
        if (usbif->urb_ring.sring) {
-               unmap_frontend_pages(usbif);
-               free_vm_area(usbif->urb_ring_area);
-               free_vm_area(usbif->conn_ring_area);
+               xenbus_unmap_ring_vfree(usbif->xbdev, usbif->urb_ring_area);
+               xenbus_unmap_ring_vfree(usbif->xbdev, usbif->conn_ring_area);
                usbif->urb_ring.sring = NULL;
                usbif->conn_ring.sring = NULL;
        }
--- a/drivers/xen/usbback/usbback.c
+++ b/drivers/xen/usbback/usbback.c
@@ -45,6 +45,8 @@
 
 #include <linux/mm.h>
 #include <xen/balloon.h>
+#include <xen/evtchn.h>
+#include <xen/gnttab.h>
 #include "usbback.h"
 
 #if 0
--- a/drivers/xen/usbback/usbback.h
+++ b/drivers/xen/usbback/usbback.h
@@ -55,11 +55,9 @@
 #include <linux/wait.h>
 #include <linux/list.h>
 #include <linux/kref.h>
-#include <xen/evtchn.h>
-#include <xen/gnttab.h>
 #include <xen/driver_util.h>
-#include <xen/interface/xen.h>
 #include <xen/xenbus.h>
+#include <xen/interface/event_channel.h>
 #include <xen/interface/io/usbif.h>
 
 struct usbstub;
@@ -91,11 +89,6 @@ typedef struct usbif_st {
        spinlock_t conn_ring_lock;
        atomic_t refcnt;
 
-       grant_handle_t urb_shmem_handle;
-       grant_ref_t urb_shmem_ref;
-       grant_handle_t conn_shmem_handle;
-       grant_ref_t conn_shmem_ref;
-
        struct xenbus_watch backend_watch;
 
        /* device address lookup table */
@@ -139,8 +132,8 @@ struct usbstub {
 usbif_t *usbif_alloc(domid_t domid, unsigned int handle);
 void usbif_disconnect(usbif_t *usbif);
 void usbif_free(usbif_t *usbif);
-int usbif_map(usbif_t *usbif, unsigned long urb_ring_ref,
-               unsigned long conn_ring_ref, unsigned int evtchn);
+int usbif_map(usbif_t *usbif, grant_ref_t urb_ring_ref,
+             grant_ref_t conn_ring_ref, evtchn_port_t);
 
 #define usbif_get(_b) (atomic_inc(&(_b)->refcnt))
 #define usbif_put(_b) \
--- a/drivers/xen/xenbus/xenbus_backend_client.c
+++ b/drivers/xen/xenbus/xenbus_backend_client.c
@@ -37,7 +37,7 @@
 #include <xen/driver_util.h>
 
 /* Based on Rusty Russell's skeleton driver's map_page */
-struct vm_struct *xenbus_map_ring_valloc(struct xenbus_device *dev, int 
gnt_ref)
+struct vm_struct *xenbus_map_ring_valloc(struct xenbus_device *dev, 
grant_ref_t gnt_ref)
 {
        struct gnttab_map_grant_ref op;
        struct vm_struct *area;
@@ -68,32 +68,6 @@ struct vm_struct *xenbus_map_ring_valloc
 EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc);
 
 
-int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref,
-                  grant_handle_t *handle, void *vaddr)
-{
-       struct gnttab_map_grant_ref op;
-       int ret;
-       
-       gnttab_set_map_op(&op, (unsigned long)vaddr, GNTMAP_host_map,
-                         gnt_ref, dev->otherend_id);
-
-       gnttab_check_GNTST_eagain_do_while(GNTTABOP_map_grant_ref, &op);
-
-       if (op.status != GNTST_okay) {
-               xenbus_dev_fatal(dev, op.status,
-                                "mapping in shared page %d from domain %d",
-                                gnt_ref, dev->otherend_id);
-               ret = -EINVAL;
-       } else {
-               *handle = op.handle;
-               ret = 0;
-       }
-
-       return ret;
-}
-EXPORT_SYMBOL_GPL(xenbus_map_ring);
-
-
 /* Based on Rusty Russell's skeleton driver's unmap_page */
 int xenbus_unmap_ring_vfree(struct xenbus_device *dev, struct vm_struct *area)
 {
@@ -117,25 +91,6 @@ int xenbus_unmap_ring_vfree(struct xenbu
 EXPORT_SYMBOL_GPL(xenbus_unmap_ring_vfree);
 
 
-int xenbus_unmap_ring(struct xenbus_device *dev,
-                    grant_handle_t handle, void *vaddr)
-{
-       struct gnttab_unmap_grant_ref op;
-
-       gnttab_set_unmap_op(&op, (unsigned long)vaddr, GNTMAP_host_map,
-                           handle);
-       if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1))
-               BUG();
-
-       if (op.status != GNTST_okay)
-               xenbus_dev_error(dev, op.status,
-                                "unmapping page at handle %d error %d",
-                                handle, op.status);
-
-       return op.status == GNTST_okay ? 0 : -EINVAL;
-}
-EXPORT_SYMBOL_GPL(xenbus_unmap_ring);
-
 int xenbus_dev_is_online(struct xenbus_device *dev)
 {
        int rc, val;
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -238,28 +238,20 @@ int xenbus_grant_ring(struct xenbus_devi
  * Map a page of memory into this domain from another domain's grant table.
  * xenbus_map_ring_valloc allocates a page of virtual address space, maps the
  * page to that address, and sets *vaddr to that address.
- * xenbus_map_ring does not allocate the virtual address space (you must do
- * this yourself!). It only maps in the page to the specified address.
  * Returns 0 on success, and GNTST_* (see xen/include/interface/grant_table.h)
  * or -ENOMEM on error. If an error is returned, device will switch to
  * XenbusStateClosing and the error message will be saved in XenStore.
  */
 struct vm_struct *xenbus_map_ring_valloc(struct xenbus_device *dev,
-                                        int gnt_ref);
-int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref,
-                          grant_handle_t *handle, void *vaddr);
-
+                                        grant_ref_t ref);
 
 /**
- * Unmap a page of memory in this domain that was imported from another domain.
- * Use xenbus_unmap_ring_vfree if you mapped in your memory with
- * xenbus_map_ring_valloc (it will free the virtual address space).
+ * Unmap a page of memory in this domain that was imported from another domain
+ * and free the virtual address space.
  * Returns 0 on success and returns GNTST_* on error
  * (see xen/include/interface/grant_table.h).
  */
 int xenbus_unmap_ring_vfree(struct xenbus_device *dev, struct vm_struct *);
-int xenbus_unmap_ring(struct xenbus_device *dev,
-                     grant_handle_t handle, void *vaddr);
 
 
 /**


Attachment: xen-backends-use-xenbus_be.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] linux-2.6.18/backends: use xenbus_be.ko interfaces instead of open-coding them, Jan Beulich <=