Diff for /qemu/dma-helpers.c between versions 1.1.1.3 and 1.1.1.4

version 1.1.1.3, 2018/04/24 17:16:48 version 1.1.1.4, 2018/04/24 17:21:06
Line 10 Line 10
 #include "dma.h"  #include "dma.h"
 #include "block_int.h"  #include "block_int.h"
   
 static AIOPool dma_aio_pool;  
   
 void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint)  void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint)
 {  {
     qsg->sg = qemu_malloc(alloc_hint * sizeof(ScatterGatherEntry));      qsg->sg = qemu_malloc(alloc_hint * sizeof(ScatterGatherEntry));
Line 81  static void dma_bdrv_unmap(DMAAIOCB *dbs Line 79  static void dma_bdrv_unmap(DMAAIOCB *dbs
     }      }
 }  }
   
 void dma_bdrv_cb(void *opaque, int ret)  static void dma_bdrv_cb(void *opaque, int ret)
 {  {
     DMAAIOCB *dbs = (DMAAIOCB *)opaque;      DMAAIOCB *dbs = (DMAAIOCB *)opaque;
     target_phys_addr_t cur_addr, cur_len;      target_phys_addr_t cur_addr, cur_len;
Line 132  void dma_bdrv_cb(void *opaque, int ret) Line 130  void dma_bdrv_cb(void *opaque, int ret)
     }      }
 }  }
   
   static void dma_aio_cancel(BlockDriverAIOCB *acb)
   {
       DMAAIOCB *dbs = container_of(acb, DMAAIOCB, common);
   
       if (dbs->acb) {
           bdrv_aio_cancel(dbs->acb);
       }
   }
   
   static AIOPool dma_aio_pool = {
       .aiocb_size         = sizeof(DMAAIOCB),
       .cancel             = dma_aio_cancel,
   };
   
 static BlockDriverAIOCB *dma_bdrv_io(  static BlockDriverAIOCB *dma_bdrv_io(
     BlockDriverState *bs, QEMUSGList *sg, uint64_t sector_num,      BlockDriverState *bs, QEMUSGList *sg, uint64_t sector_num,
     BlockDriverCompletionFunc *cb, void *opaque,      BlockDriverCompletionFunc *cb, void *opaque,
     int is_write)      int is_write)
 {  {
     DMAAIOCB *dbs =  qemu_aio_get_pool(&dma_aio_pool, bs, cb, opaque);      DMAAIOCB *dbs =  qemu_aio_get(&dma_aio_pool, bs, cb, opaque);
   
     dbs->acb = NULL;      dbs->acb = NULL;
     dbs->bs = bs;      dbs->bs = bs;
Line 170  BlockDriverAIOCB *dma_bdrv_write(BlockDr Line 182  BlockDriverAIOCB *dma_bdrv_write(BlockDr
 {  {
     return dma_bdrv_io(bs, sg, sector, cb, opaque, 1);      return dma_bdrv_io(bs, sg, sector, cb, opaque, 1);
 }  }
   
 static void dma_aio_cancel(BlockDriverAIOCB *acb)  
 {  
     DMAAIOCB *dbs = container_of(acb, DMAAIOCB, common);  
   
     if (dbs->acb) {  
         bdrv_aio_cancel(dbs->acb);  
     }  
 }  
   
 void dma_helper_init(void)  
 {  
     aio_pool_init(&dma_aio_pool, sizeof(DMAAIOCB), dma_aio_cancel);  
 }  

Removed from v.1.1.1.3  
changed lines
  Added in v.1.1.1.4


unix.superglobalmegacorp.com