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

Re: [Xen-devel] [PATCH 01/10] blktap: Add include/linux/blktap.h

To: Daniel Stodden <Daniel.Stodden@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 01/10] blktap: Add include/linux/blktap.h
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Wed, 9 Mar 2011 10:18:08 +0000
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, Xen <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 09 Mar 2011 02:20:17 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1299631377-7853-2-git-send-email-daniel.stodden@xxxxxxxxxx>
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>
Organization: Citrix Systems, Inc.
References: <1299631377-7853-1-git-send-email-daniel.stodden@xxxxxxxxxx> <1299631377-7853-2-git-send-email-daniel.stodden@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Wed, 2011-03-09 at 00:42 +0000, Daniel Stodden wrote:
> Moves blktap2 definitions into a common header file.
> 
> Includes xen/interface/io/ring.h and new ring definitions. Makes
> blktap build independently from xen-devel headers.
> 
> New blktap_ring structs are fully congrent to blkif rings, for binary
> compat.
> 
> Signed-off-by: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
> ---
>  drivers/xen/blktap/blktap.h  |   66 ++++----------------------------
>  drivers/xen/blktap/control.c |   14 +++---
>  drivers/xen/blktap/device.c  |   12 +++---
>  drivers/xen/blktap/request.c |    8 ++--
>  drivers/xen/blktap/ring.c    |   51 ++++++++++++++-----------
>  drivers/xen/blktap/sysfs.c   |    6 +-
>  include/linux/blktap.h       |   85 
> ++++++++++++++++++++++++++++++++++++++++++

This new file defines the kernel<->user (tapdisk process) ring protocol,
right?

I think its proper home would be under include/xen somewhere, which is
where the gntdev and evtchn etc driver interfaces are defined.

Where is the canonical definition of this interface stored? In the
kernel tree or the hypervisor tree?

Ian.

>  7 files changed, 142 insertions(+), 100 deletions(-)
>  create mode 100644 include/linux/blktap.h
> 
> diff --git a/drivers/xen/blktap/blktap.h b/drivers/xen/blktap/blktap.h
> index fe63fc9..1318cad 100644
> --- a/drivers/xen/blktap/blktap.h
> +++ b/drivers/xen/blktap/blktap.h
> @@ -6,7 +6,7 @@
>  #include <linux/cdev.h>
>  #include <linux/init.h>
>  #include <linux/scatterlist.h>
> -#include <xen/blkif.h>
> +#include <linux/blktap.h>
> 
>  extern int blktap_debug_level;
>  extern int blktap_ring_major;
> @@ -30,74 +30,26 @@ extern int blktap_device_major;
>  #define BLKTAP_DEVICE_CLOSED         5
>  #define BLKTAP_SHUTDOWN_REQUESTED    8
> 
> -/* blktap IOCTLs: */
> -#define BLKTAP2_IOCTL_KICK_FE        1
> -#define BLKTAP2_IOCTL_ALLOC_TAP      200
> -#define BLKTAP2_IOCTL_FREE_TAP       201
> -#define BLKTAP2_IOCTL_CREATE_DEVICE  202
> -#define BLKTAP2_IOCTL_REMOVE_DEVICE  207
> -
> -#define BLKTAP2_MAX_MESSAGE_LEN      256
> -
> -#define BLKTAP2_RING_MESSAGE_CLOSE   3
> -
>  #define BLKTAP_REQUEST_FREE          0
>  #define BLKTAP_REQUEST_PENDING       1
> 
> -/*
> - * The maximum number of requests that can be outstanding at any time
> - * is determined by
> - *
> - *   [mmap_alloc * MAX_PENDING_REQS * BLKIF_MAX_SEGMENTS_PER_REQUEST]
> - *
> - * where mmap_alloc < MAX_DYNAMIC_MEM.
> - *
> - * TODO:
> - * mmap_alloc is initialised to 2 and should be adjustable on the fly via
> - * sysfs.
> - */
> -#define BLK_RING_SIZE          __RING_SIZE((struct blkif_sring *)0, 
> PAGE_SIZE)
> -#define MAX_DYNAMIC_MEM                BLK_RING_SIZE
> -#define MAX_PENDING_REQS       BLK_RING_SIZE
> -#define MMAP_PAGES (MAX_PENDING_REQS * BLKIF_MAX_SEGMENTS_PER_REQUEST)
> -#define MMAP_VADDR(_start, _req, _seg)                                 \
> -        (_start +                                                       \
> -         ((_req) * BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE) +        \
> -         ((_seg) * PAGE_SIZE))
> -
> -struct grant_handle_pair {
> -       grant_handle_t                 kernel;
> -       grant_handle_t                 user;
> -};
> -#define INVALID_GRANT_HANDLE           0xFFFF
> -
> -struct blktap_handle {
> -       unsigned int                   ring;
> -       unsigned int                   device;
> -       unsigned int                   minor;
> -};
> -
> -struct blktap_params {
> -       char                           name[BLKTAP2_MAX_MESSAGE_LEN];
> -       unsigned long long             capacity;
> -       unsigned long                  sector_size;
> -};
> -
>  struct blktap_device {
>         spinlock_t                     lock;
>         struct gendisk                *gd;
>  };
> 
> +struct blktap_request;
> +
>  struct blktap_ring {
>         struct task_struct            *task;
> 
>         struct vm_area_struct         *vma;
> -       struct blkif_front_ring        ring;
> +       blktap_front_ring_t            ring;
>         unsigned long                  ring_vstart;
>         unsigned long                  user_vstart;
> 
>         int                            n_pending;
> -       struct blktap_request         *pending[MAX_PENDING_REQS];
> +       struct blktap_request         *pending[BLKTAP_RING_SIZE];
> 
>         wait_queue_head_t              poll_wait;
> 
> @@ -128,8 +80,8 @@ struct blktap_request {
>         int                            operation;
>         struct timeval                 time;
> 
> -       struct scatterlist             
> sg_table[BLKIF_MAX_SEGMENTS_PER_REQUEST];
> -       struct page                   *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST];
> +       struct scatterlist             sg_table[BLKTAP_SEGMENT_MAX];
> +       struct page                   *pages[BLKTAP_SEGMENT_MAX];
>         int                            nr_pages;
>  };
> 
> @@ -148,7 +100,7 @@ struct blktap {
> 
>         wait_queue_head_t              remove_wait;
>         struct work_struct             remove_work;
> -       char                           name[BLKTAP2_MAX_MESSAGE_LEN];
> +       char                           name[BLKTAP_NAME_MAX];
> 
>         struct blktap_statistics       stats;
>  };
> @@ -189,7 +141,7 @@ void blktap_sysfs_destroy(struct blktap *);
>  int blktap_device_init(void);
>  void blktap_device_exit(void);
>  size_t blktap_device_debug(struct blktap *, char *, size_t);
> -int blktap_device_create(struct blktap *, struct blktap_params *);
> +int blktap_device_create(struct blktap *, struct blktap_device_info *);
>  int blktap_device_destroy(struct blktap *);
>  void blktap_device_destroy_sync(struct blktap *);
>  void blktap_device_run_queue(struct blktap *);
> diff --git a/drivers/xen/blktap/control.c b/drivers/xen/blktap/control.c
> index f339bba..57b1a10 100644
> --- a/drivers/xen/blktap/control.c
> +++ b/drivers/xen/blktap/control.c
> @@ -127,19 +127,19 @@ blktap_control_ioctl(struct inode *inode, struct file 
> *filp,
>         struct blktap *tap;
> 
>         switch (cmd) {
> -       case BLKTAP2_IOCTL_ALLOC_TAP: {
> -               struct blktap_handle h;
> +       case BLKTAP_IOCTL_ALLOC_TAP: {
> +               struct blktap_info info;
>                 void __user *ptr = (void __user*)arg;
> 
>                 tap = blktap_control_create_tap();
>                 if (!tap)
>                         return -ENOMEM;
> 
> -               h.ring   = blktap_ring_major;
> -               h.device = blktap_device_major;
> -               h.minor  = tap->minor;
> +               info.ring_major = blktap_ring_major;
> +               info.bdev_major = blktap_device_major;
> +               info.ring_minor = tap->minor;
> 
> -               if (copy_to_user(ptr, &h, sizeof(h))) {
> +               if (copy_to_user(ptr, &info, sizeof(info))) {
>                         blktap_control_destroy_tap(tap);
>                         return -EFAULT;
>                 }
> @@ -147,7 +147,7 @@ blktap_control_ioctl(struct inode *inode, struct file 
> *filp,
>                 return 0;
>         }
> 
> -       case BLKTAP2_IOCTL_FREE_TAP: {
> +       case BLKTAP_IOCTL_FREE_TAP: {
>                 int minor = arg;
> 
>                 if (minor > MAX_BLKTAP_DEVICE)
> diff --git a/drivers/xen/blktap/device.c b/drivers/xen/blktap/device.c
> index fce2769..6bb04bd 100644
> --- a/drivers/xen/blktap/device.c
> +++ b/drivers/xen/blktap/device.c
> @@ -186,7 +186,7 @@ blktap_device_make_request(struct blktap *tap, struct 
> request *rq)
>                 write ? 'w' : 'r', blk_rq_bytes(rq), nsegs);
> 
>         request->rq = rq;
> -       request->operation = write ? BLKIF_OP_WRITE : BLKIF_OP_READ;
> +       request->operation = write ? BLKTAP_OP_WRITE : BLKTAP_OP_READ;
> 
>         err = blktap_request_get_pages(tap, request, nsegs);
>         if (err)
> @@ -276,7 +276,7 @@ blktap_device_do_request(struct request_queue *rq)
> 
>  static void
>  blktap_device_configure(struct blktap *tap,
> -                       struct blktap_params *params)
> +                       struct blktap_device_info *params)
>  {
>         struct request_queue *rq;
>         struct blktap_device *dev = &tap->device;
> @@ -297,8 +297,8 @@ blktap_device_configure(struct blktap *tap,
>         blk_queue_max_segment_size(rq, PAGE_SIZE);
> 
>         /* Ensure a merged request will fit in a single I/O ring slot. */
> -       blk_queue_max_phys_segments(rq, BLKIF_MAX_SEGMENTS_PER_REQUEST);
> -       blk_queue_max_hw_segments(rq, BLKIF_MAX_SEGMENTS_PER_REQUEST);
> +       blk_queue_max_phys_segments(rq, BLKTAP_SEGMENT_MAX);
> +       blk_queue_max_hw_segments(rq, BLKTAP_SEGMENT_MAX);
> 
>         /* Make sure buffer addresses are sector-aligned. */
>         blk_queue_dma_alignment(rq, 511);
> @@ -311,7 +311,7 @@ blktap_device_configure(struct blktap *tap,
> 
>  static int
>  blktap_device_validate_params(struct blktap *tap,
> -                             struct blktap_params *params)
> +                             struct blktap_device_info *params)
>  {
>         struct device *dev = tap->ring.dev;
>         int sector_order, name_sz;
> @@ -425,7 +425,7 @@ blktap_device_destroy_sync(struct blktap *tap)
>  }
> 
>  int
> -blktap_device_create(struct blktap *tap, struct blktap_params *params)
> +blktap_device_create(struct blktap *tap, struct blktap_device_info *params)
>  {
>         int minor, err;
>         struct gendisk *gd;
> diff --git a/drivers/xen/blktap/request.c b/drivers/xen/blktap/request.c
> index 9bef48c..8cfd6c9 100644
> --- a/drivers/xen/blktap/request.c
> +++ b/drivers/xen/blktap/request.c
> @@ -7,18 +7,18 @@
>  #include "blktap.h"
> 
>  /* max pages per shared pool. just to prevent accidental dos. */
> -#define POOL_MAX_PAGES           (256*BLKIF_MAX_SEGMENTS_PER_REQUEST)
> +#define POOL_MAX_PAGES           (256*BLKTAP_SEGMENT_MAX)
> 
>  /* default page pool size. when considering to shrink a shared pool,
>   * note that paused tapdisks may grab a whole lot of pages for a long
>   * time. */
> -#define POOL_DEFAULT_PAGES       (2 * MMAP_PAGES)
> +#define POOL_DEFAULT_PAGES       (2 * BLKTAP_RING_SIZE * BLKTAP_SEGMENT_MAX)
> 
>  /* max number of pages allocatable per request. */
> -#define POOL_MAX_REQUEST_PAGES   BLKIF_MAX_SEGMENTS_PER_REQUEST
> +#define POOL_MAX_REQUEST_PAGES   BLKTAP_SEGMENT_MAX
> 
>  /* min request structs per pool. These grow dynamically. */
> -#define POOL_MIN_REQS            BLK_RING_SIZE
> +#define POOL_MIN_REQS            BLKTAP_RING_SIZE
> 
>  static struct kset *pool_set;
> 
> diff --git a/drivers/xen/blktap/ring.c b/drivers/xen/blktap/ring.c
> index 6b86be5..9442a64 100644
> --- a/drivers/xen/blktap/ring.c
> +++ b/drivers/xen/blktap/ring.c
> @@ -18,7 +18,7 @@ static struct cdev blktap_ring_cdev;
> 
>  static void
>  blktap_ring_read_response(struct blktap *tap,
> -                    const struct blkif_response *rsp)
> +                         const blktap_ring_rsp_t *rsp)
>  {
>         struct blktap_ring *ring = &tap->ring;
>         struct blktap_request *request;
> @@ -27,7 +27,7 @@ blktap_ring_read_response(struct blktap *tap,
>         request = NULL;
> 
>         usr_idx = rsp->id;
> -       if (usr_idx < 0 || usr_idx >= MAX_PENDING_REQS) {
> +       if (usr_idx < 0 || usr_idx >= BLKTAP_RING_SIZE) {
>                 err = -ERANGE;
>                 goto invalid;
>         }
> @@ -48,7 +48,7 @@ blktap_ring_read_response(struct blktap *tap,
>                 "request %d [%p] response: %d\n",
>                 request->usr_idx, request, rsp->status);
> 
> -       err = rsp->status == BLKIF_RSP_OKAY ? 0 : -EIO;
> +       err = rsp->status == BLKTAP_RSP_OKAY ? 0 : -EIO;
>  end_request:
>         blktap_device_end_request(tap, request, err);
>         return;
> @@ -67,7 +67,7 @@ static void
>  blktap_read_ring(struct blktap *tap)
>  {
>         struct blktap_ring *ring = &tap->ring;
> -       struct blkif_response rsp;
> +       blktap_ring_rsp_t rsp;
>         RING_IDX rc, rp;
> 
>         down_read(&current->mm->mmap_sem);
> @@ -90,6 +90,11 @@ blktap_read_ring(struct blktap *tap)
>         up_read(&current->mm->mmap_sem);
>  }
> 
> +#define MMAP_VADDR(_start, _req, _seg)                         \
> +       ((_start) +                                             \
> +        ((_req) * BLKTAP_SEGMENT_MAX * BLKTAP_PAGE_SIZE) +     \
> +        ((_seg) * BLKTAP_PAGE_SIZE))
> +
>  static int blktap_ring_fault(struct vm_area_struct *vma, struct vm_fault 
> *vmf)
>  {
>         return VM_FAULT_SIGBUS;
> @@ -102,7 +107,7 @@ blktap_ring_fail_pending(struct blktap *tap)
>         struct blktap_request *request;
>         int usr_idx;
> 
> -       for (usr_idx = 0; usr_idx < MAX_PENDING_REQS; usr_idx++) {
> +       for (usr_idx = 0; usr_idx < BLKTAP_RING_SIZE; usr_idx++) {
>                 request = ring->pending[usr_idx];
>                 if (!request)
>                         continue;
> @@ -154,7 +159,7 @@ blktap_ring_map_request(struct blktap *tap,
>         int seg, err = 0;
>         int write;
> 
> -       write = request->operation == BLKIF_OP_WRITE;
> +       write = request->operation == BLKTAP_OP_WRITE;
> 
>         for (seg = 0; seg < request->nr_pages; seg++) {
>                 if (write)
> @@ -182,7 +187,7 @@ blktap_ring_unmap_request(struct blktap *tap,
> 
>         uaddr = MMAP_VADDR(ring->user_vstart, request->usr_idx, 0);
>         size  = request->nr_pages << PAGE_SHIFT;
> -       read  = request->operation == BLKIF_OP_READ;
> +       read  = request->operation == BLKTAP_OP_READ;
> 
>         if (read)
>                 for (seg = 0; seg < request->nr_pages; seg++)
> @@ -217,11 +222,11 @@ blktap_ring_make_request(struct blktap *tap)
>         if (!request)
>                 return ERR_PTR(-ENOMEM);
> 
> -       for (usr_idx = 0; usr_idx < BLK_RING_SIZE; usr_idx++)
> +       for (usr_idx = 0; usr_idx < BLKTAP_RING_SIZE; usr_idx++)
>                 if (!ring->pending[usr_idx])
>                         break;
> 
> -       BUG_ON(usr_idx >= BLK_RING_SIZE);
> +       BUG_ON(usr_idx >= BLKTAP_RING_SIZE);
> 
>         request->tap     = tap;
>         request->usr_idx = usr_idx;
> @@ -237,7 +242,7 @@ blktap_ring_submit_request(struct blktap *tap,
>                            struct blktap_request *request)
>  {
>         struct blktap_ring *ring = &tap->ring;
> -       struct blkif_request *breq;
> +       blktap_ring_req_t *breq;
>         struct scatterlist *sg;
>         int i, nsecs = 0;
> 
> @@ -248,12 +253,12 @@ blktap_ring_submit_request(struct blktap *tap,
> 
>         breq->id            = request->usr_idx;
>         breq->sector_number = blk_rq_pos(request->rq);
> -       breq->handle        = 0;
> +       breq->__pad         = 0;
>         breq->operation     = request->operation;
>         breq->nr_segments   = request->nr_pages;
> 
>         blktap_for_each_sg(sg, request, i) {
> -               struct blkif_request_segment *seg = &breq->seg[i];
> +               struct blktap_segment *seg = &breq->seg[i];
>                 int first, count;
> 
>                 count = sg->length >> 9;
> @@ -270,12 +275,12 @@ blktap_ring_submit_request(struct blktap *tap,
>         do_gettimeofday(&request->time);
> 
> 
> -       if (request->operation == BLKIF_OP_WRITE) {
> +       if (request->operation == BLKTAP_OP_WRITE) {
>                 tap->stats.st_wr_sect += nsecs;
>                 tap->stats.st_wr_req++;
>         }
> 
> -       if (request->operation == BLKIF_OP_READ) {
> +       if (request->operation == BLKTAP_OP_READ) {
>                 tap->stats.st_rd_sect += nsecs;
>                 tap->stats.st_rd_req++;
>         }
> @@ -327,7 +332,7 @@ blktap_ring_mmap(struct file *filp, struct vm_area_struct 
> *vma)
>  {
>         struct blktap *tap = filp->private_data;
>         struct blktap_ring *ring = &tap->ring;
> -       struct blkif_sring *sring;
> +       blktap_sring_t *sring;
>         struct page *page = NULL;
>         int err;
> 
> @@ -384,25 +389,25 @@ blktap_ring_ioctl(struct inode *inode, struct file 
> *filp,
>                 return -EACCES;
> 
>         switch(cmd) {
> -       case BLKTAP2_IOCTL_KICK_FE:
> +       case BLKTAP_IOCTL_RESPOND:
> 
>                 blktap_read_ring(tap);
>                 return 0;
> 
> -       case BLKTAP2_IOCTL_CREATE_DEVICE: {
> -               struct blktap_params params;
> +       case BLKTAP_IOCTL_CREATE_DEVICE: {
> +               struct blktap_device_info info;
>                 void __user *ptr = (void *)arg;
> 
>                 if (!arg)
>                         return -EINVAL;
> 
> -               if (copy_from_user(&params, ptr, sizeof(params)))
> +               if (copy_from_user(&info, ptr, sizeof(info)))
>                         return -EFAULT;
> 
> -               return blktap_device_create(tap, &params);
> +               return blktap_device_create(tap, &info);
>         }
> 
> -       case BLKTAP2_IOCTL_REMOVE_DEVICE:
> +       case BLKTAP_IOCTL_REMOVE_DEVICE:
> 
>                 return blktap_device_destroy(tap);
>         }
> @@ -482,7 +487,7 @@ blktap_ring_debug(struct blktap *tap, char *buf, size_t 
> size)
>         s += snprintf(s, end - s,
>                       "begin pending:%d\n", ring->n_pending);
> 
> -       for (usr_idx = 0; usr_idx < MAX_PENDING_REQS; usr_idx++) {
> +       for (usr_idx = 0; usr_idx < BLKTAP_RING_SIZE; usr_idx++) {
>                 struct blktap_request *request;
>                 struct timeval *time;
>                 int write;
> @@ -491,7 +496,7 @@ blktap_ring_debug(struct blktap *tap, char *buf, size_t 
> size)
>                 if (!request)
>                         continue;
> 
> -               write = request->operation == BLKIF_OP_WRITE;
> +               write = request->operation == BLKTAP_OP_WRITE;
>                 time  = &request->time;
> 
>                 s += snprintf(s, end - s,
> diff --git a/drivers/xen/blktap/sysfs.c b/drivers/xen/blktap/sysfs.c
> index 7bbfea8..182de9a 100644
> --- a/drivers/xen/blktap/sysfs.c
> +++ b/drivers/xen/blktap/sysfs.c
> @@ -20,7 +20,7 @@ blktap_sysfs_set_name(struct device *dev, struct 
> device_attribute *attr, const c
>         if (!tap)
>                 return 0;
> 
> -       if (size >= BLKTAP2_MAX_MESSAGE_LEN)
> +       if (size >= BLKTAP_NAME_MAX)
>                 return -ENAMETOOLONG;
> 
>         if (strnlen(buf, size) != size)
> @@ -75,8 +75,8 @@ blktap_sysfs_remove_device(struct device *dev,
>                 goto wait;
> 
>         if (tap->ring.vma) {
> -               blkif_sring_t *sring = tap->ring.ring.sring;
> -               sring->private.tapif_user.msg = BLKTAP2_RING_MESSAGE_CLOSE;
> +               blktap_sring_t *sring = tap->ring.ring.sring;
> +               sring->private.tapif_user.msg = BLKTAP_RING_MESSAGE_CLOSE;
>                 blktap_ring_kick_user(tap);
>         } else {
>                 INIT_WORK(&tap->remove_work, blktap_sysfs_remove_work);
> diff --git a/include/linux/blktap.h b/include/linux/blktap.h
> new file mode 100644
> index 0000000..ec33429
> --- /dev/null
> +++ b/include/linux/blktap.h
> @@ -0,0 +1,85 @@
> +/*
> + * Copyright (c) 2011, XenSource Inc.
> + * All rights reserved.
> + */
> +
> +#ifndef _LINUX_BLKTAP_H
> +#define _LINUX_BLKTAP_H
> +
> +/*
> + * Control
> + */
> +
> +#define BLKTAP_IOCTL_RESPOND        1
> +#define BLKTAP_IOCTL_ALLOC_TAP      200
> +#define BLKTAP_IOCTL_FREE_TAP       201
> +#define BLKTAP_IOCTL_CREATE_DEVICE  202
> +#define BLKTAP_IOCTL_REMOVE_DEVICE  207
> +
> +#define BLKTAP_NAME_MAX             256
> +
> +struct blktap_info {
> +       unsigned int            ring_major;
> +       unsigned int            bdev_major;
> +       unsigned int            ring_minor;
> +};
> +
> +struct blktap_device_info {
> +       char                    name[BLKTAP_NAME_MAX];
> +       unsigned long long      capacity;
> +       unsigned long           sector_size;
> +};
> +
> +/*
> + * I/O ring
> + */
> +
> +#ifdef __KERNEL__
> +#define BLKTAP_PAGE_SIZE PAGE_SIZE
> +#endif
> +
> +#include <xen/interface/io/ring.h>
> +
> +typedef struct blktap_ring_request  blktap_ring_req_t;
> +typedef struct blktap_ring_response blktap_ring_rsp_t;
> +
> +struct blktap_segment {
> +       uint32_t                __pad;
> +       uint8_t                 first_sect;
> +       uint8_t                 last_sect;
> +};
> +
> +#define BLKTAP_OP_READ          0
> +#define BLKTAP_OP_WRITE         1
> +
> +#define BLKTAP_SEGMENT_MAX      11
> +
> +struct blktap_ring_request {
> +       uint8_t                 operation;
> +       uint8_t                 nr_segments;
> +       uint16_t                __pad;
> +       uint64_t                id;
> +       uint64_t                sector_number;
> +       struct blktap_segment   seg[BLKTAP_SEGMENT_MAX];
> +};
> +
> +#define BLKTAP_RSP_EOPNOTSUPP  -2
> +#define BLKTAP_RSP_ERROR       -1
> +#define BLKTAP_RSP_OKAY         0
> +
> +struct blktap_ring_response {
> +       uint64_t                id;
> +       uint8_t                 operation;
> +       int16_t                 status;
> +};
> +
> +DEFINE_RING_TYPES(blktap, struct blktap_ring_request, struct 
> blktap_ring_response);
> +#define BLKTAP_RING_SIZE __CONST_RING_SIZE(blktap, BLKTAP_PAGE_SIZE)
> +
> +/*
> + * Ring messages (DEPRECATED)
> + */
> +
> +#define BLKTAP_RING_MESSAGE_CLOSE   3
> +
> +#endif /* _LINUX_BLKTAP_H */
> --
> 1.7.0.4
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



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