Patchwork [1/5] dma-helpers: rename is_write to to_dev

login
register
mail settings
Submitter Paolo Bonzini
Date Sept. 7, 2011, 3:20 p.m.
Message ID <1315408862-15178-2-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/113776/
State New
Headers show

Comments

Paolo Bonzini - Sept. 7, 2011, 3:20 p.m.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 dma-helpers.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
Kevin Wolf - Sept. 9, 2011, 11:31 a.m.
Am 07.09.2011 17:20, schrieb Paolo Bonzini:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  dma-helpers.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/dma-helpers.c b/dma-helpers.c
> index 4610ea0..ca97e14 100644
> --- a/dma-helpers.c
> +++ b/dma-helpers.c
> @@ -42,7 +42,7 @@ typedef struct {
>      BlockDriverAIOCB *acb;
>      QEMUSGList *sg;
>      uint64_t sector_num;
> -    int is_write;
> +    int to_dev;
>      int sg_cur_index;
>      target_phys_addr_t sg_cur_byte;
>      QEMUIOVector iov;

Should we take the opportunity to make it a bool? I think it would make
the purpose easier to understand.

Kevin

Patch

diff --git a/dma-helpers.c b/dma-helpers.c
index 4610ea0..ca97e14 100644
--- a/dma-helpers.c
+++ b/dma-helpers.c
@@ -42,7 +42,7 @@  typedef struct {
     BlockDriverAIOCB *acb;
     QEMUSGList *sg;
     uint64_t sector_num;
-    int is_write;
+    int to_dev;
     int sg_cur_index;
     target_phys_addr_t sg_cur_byte;
     QEMUIOVector iov;
@@ -75,7 +75,7 @@  static void dma_bdrv_unmap(DMAAIOCB *dbs)
 
     for (i = 0; i < dbs->iov.niov; ++i) {
         cpu_physical_memory_unmap(dbs->iov.iov[i].iov_base,
-                                  dbs->iov.iov[i].iov_len, !dbs->is_write,
+                                  dbs->iov.iov[i].iov_len, !dbs->to_dev,
                                   dbs->iov.iov[i].iov_len);
     }
 }
@@ -101,7 +101,7 @@  static void dma_bdrv_cb(void *opaque, int ret)
     while (dbs->sg_cur_index < dbs->sg->nsg) {
         cur_addr = dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byte;
         cur_len = dbs->sg->sg[dbs->sg_cur_index].len - dbs->sg_cur_byte;
-        mem = cpu_physical_memory_map(cur_addr, &cur_len, !dbs->is_write);
+        mem = cpu_physical_memory_map(cur_addr, &cur_len, !dbs->to_dev);
         if (!mem)
             break;
         qemu_iovec_add(&dbs->iov, mem, cur_len);
@@ -143,7 +143,7 @@  static AIOPool dma_aio_pool = {
 BlockDriverAIOCB *dma_bdrv_io(
     BlockDriverState *bs, QEMUSGList *sg, uint64_t sector_num,
     DMAIOFunc *io_func, BlockDriverCompletionFunc *cb,
-    void *opaque, int is_write)
+    void *opaque, int to_dev)
 {
     DMAAIOCB *dbs = qemu_aio_get(&dma_aio_pool, bs, cb, opaque);
 
@@ -153,7 +153,7 @@  BlockDriverAIOCB *dma_bdrv_io(
     dbs->sector_num = sector_num;
     dbs->sg_cur_index = 0;
     dbs->sg_cur_byte = 0;
-    dbs->is_write = is_write;
+    dbs->to_dev = to_dev;
     dbs->io_func = io_func;
     dbs->bh = NULL;
     qemu_iovec_init(&dbs->iov, sg->nsg);