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 1/1] qemu-xen/blkif: Move read/write/barrier specific

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 1/1] qemu-xen/blkif: Move read/write/barrier specific fields into a union
From: <owen.smith@xxxxxxxxxx>
Date: Fri, 14 Jan 2011 16:44:24 +0000
Cc: Owen Smith <owen.smith@xxxxxxxxxx>
Delivery-date: Fri, 14 Jan 2011 08:49:59 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1295023467-27129-1-git-send-email-owen.smith@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>
References: <1295023467-27129-1-git-send-email-owen.smith@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
From: Owen Smith <owen.smith@xxxxxxxxxx>

Patches qemu-xen.git, on branch dummy as part of building xen-unstable.hg

Modifies the blkif ring interface by placing the request specific
fields into a union in order to support additional operation types.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 hw/xen_blkif.h  |    8 ++++----
 hw/xen_blktap.c |   10 +++++-----
 hw/xen_disk.c   |   14 +++++++-------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/hw/xen_blkif.h b/hw/xen_blkif.h
index ca3a65b..de3e103 100644
--- a/hw/xen_blkif.h
+++ b/hw/xen_blkif.h
@@ -78,11 +78,11 @@ static inline void blkif_get_x86_32_req(blkif_request_t 
*dst, blkif_x86_32_reque
        dst->nr_segments = src->nr_segments;
        dst->handle = src->handle;
        dst->id = src->id;
-       dst->sector_number = src->sector_number;
+       dst->u.rw.sector_number = src->sector_number;
        if (n > src->nr_segments)
                n = src->nr_segments;
        for (i = 0; i < n; i++)
-               dst->seg[i] = src->seg[i];
+               dst->u.rw.seg[i] = src->seg[i];
 }
 
 static inline void blkif_get_x86_64_req(blkif_request_t *dst, 
blkif_x86_64_request_t *src)
@@ -93,11 +93,11 @@ static inline void blkif_get_x86_64_req(blkif_request_t 
*dst, blkif_x86_64_reque
        dst->nr_segments = src->nr_segments;
        dst->handle = src->handle;
        dst->id = src->id;
-       dst->sector_number = src->sector_number;
+       dst->u.rw.sector_number = src->sector_number;
        if (n > src->nr_segments)
                n = src->nr_segments;
        for (i = 0; i < n; i++)
-               dst->seg[i] = src->seg[i];
+               dst->u.rw.seg[i] = src->seg[i];
 }
 
 #endif /* __XEN_BLKIF_H__ */
diff --git a/hw/xen_blktap.c b/hw/xen_blktap.c
index 24d10a3..ab3210a 100644
--- a/hw/xen_blktap.c
+++ b/hw/xen_blktap.c
@@ -383,7 +383,7 @@ static void handle_blktap_iomsg(void* private)
                memcpy(&blkif->pending_list[idx].req, req, sizeof(*req));
                blkif->pending_list[idx].status = BLKIF_RSP_OKAY;
                blkif->pending_list[idx].submitting = 1;
-               sector_nr = req->sector_number;
+               sector_nr = req->u.rw.sector_number;
 
                /* Don't allow writes on readonly devices */
                if ((s->flags & TD_RDONLY) && 
@@ -393,16 +393,16 @@ static void handle_blktap_iomsg(void* private)
                }
 
                for (i = start_seg; i < req->nr_segments; i++) {
-                       nsects = req->seg[i].last_sect - 
-                                req->seg[i].first_sect + 1;
+                       nsects = req->u.rw.seg[i].last_sect -
+                                req->u.rw.seg[i].first_sect + 1;
        
-                       if ((req->seg[i].last_sect >= page_size >> 9) ||
+                       if ((req->u.rw.seg[i].last_sect >= page_size >> 9) ||
                                        (nsects <= 0))
                                continue;
 
                        page  = (uint8_t*) MMAP_VADDR(info->vstart, 
                                                   (unsigned long)req->id, i);
-                       page += (req->seg[i].first_sect << SECTOR_SHIFT);
+                       page += (req->u.rw.seg[i].first_sect << SECTOR_SHIFT);
 
                        if (sector_nr >= s->size) {
                                DPRINTF("Sector request failed:\n");
diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 218f654..b427409 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -176,7 +176,7 @@ static int ioreq_parse(struct ioreq *ioreq)
     xen_be_printf(&blkdev->xendev, 3,
                  "op %d, nr %d, handle %d, id %" PRId64 ", sector %" PRId64 
"\n",
                  ioreq->req.operation, ioreq->req.nr_segments,
-                 ioreq->req.handle, ioreq->req.id, ioreq->req.sector_number);
+                 ioreq->req.handle, ioreq->req.id, 
ioreq->req.u.rw.sector_number);
     switch (ioreq->req.operation) {
     case BLKIF_OP_READ:
        ioreq->prot = PROT_WRITE; /* to memory */
@@ -205,26 +205,26 @@ static int ioreq_parse(struct ioreq *ioreq)
         goto err;
     }
 
-    ioreq->start = ioreq->req.sector_number * blkdev->file_blk;
+    ioreq->start = ioreq->req.u.rw.sector_number * blkdev->file_blk;
     for (i = 0; i < ioreq->req.nr_segments; i++) {
        if (i == BLKIF_MAX_SEGMENTS_PER_REQUEST) {
            xen_be_printf(&blkdev->xendev, 0, "error: nr_segments too big\n");
            goto err;
        }
-       if (ioreq->req.seg[i].first_sect > ioreq->req.seg[i].last_sect) {
+       if (ioreq->req.u.rw.seg[i].first_sect > 
ioreq->req.u.rw.seg[i].last_sect) {
            xen_be_printf(&blkdev->xendev, 0, "error: first > last sector\n");
            goto err;
        }
-       if (ioreq->req.seg[i].last_sect * BLOCK_SIZE >= XC_PAGE_SIZE) {
+       if (ioreq->req.u.rw.seg[i].last_sect * BLOCK_SIZE >= XC_PAGE_SIZE) {
            xen_be_printf(&blkdev->xendev, 0, "error: page crossing\n");
            goto err;
        }
 
        ioreq->domids[i] = blkdev->xendev.dom;
-       ioreq->refs[i]   = ioreq->req.seg[i].gref;
+       ioreq->refs[i]   = ioreq->req.u.rw.seg[i].gref;
 
-       mem = ioreq->req.seg[i].first_sect * blkdev->file_blk;
-       len = (ioreq->req.seg[i].last_sect - ioreq->req.seg[i].first_sect + 1) 
* blkdev->file_blk;
+       mem = ioreq->req.u.rw.seg[i].first_sect * blkdev->file_blk;
+       len = (ioreq->req.u.rw.seg[i].last_sect - 
ioreq->req.u.rw.seg[i].first_sect + 1) * blkdev->file_blk;
         qemu_iovec_add(&ioreq->v, (void*)mem, len);
     }
     if (ioreq->start + ioreq->v.size > blkdev->file_size) {
-- 
1.5.6.5


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