On 12/16/21 13:35, Philippe Mathieu-Daudé wrote: > Since the previous commit, dma_buf_rw() returns a MemTxResult > type. Do not discard it, return it to the caller. > > Since both dma_buf_read/dma_buf_write functions were previously > returning the QEMUSGList size not consumed, add an extra argument > where the unconsummed size can be stored. > > Update the few callers. > > Signed-off-by: Philippe Mathieu-Daudé <phi...@redhat.com> > --- > include/sysemu/dma.h | 6 ++++-- > hw/ide/ahci.c | 8 ++++---- > hw/nvme/ctrl.c | 4 ++-- > hw/scsi/megasas.c | 48 ++++++++++++++++++++++++++++++------------- > hw/scsi/scsi-bus.c | 4 ++-- > softmmu/dma-helpers.c | 18 ++++++---------- > 6 files changed, 52 insertions(+), 36 deletions(-) > > diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h > index cdf379fecad..9f998edbea4 100644 > --- a/include/sysemu/dma.h > +++ b/include/sysemu/dma.h > @@ -303,8 +303,10 @@ BlockAIOCB *dma_blk_read(BlockBackend *blk, > BlockAIOCB *dma_blk_write(BlockBackend *blk, > QEMUSGList *sg, uint64_t offset, uint32_t align, > BlockCompletionFunc *cb, void *opaque); > -uint64_t dma_buf_read(void *ptr, int32_t len, QEMUSGList *sg, MemTxAttrs > attrs); > -uint64_t dma_buf_write(void *ptr, int32_t len, QEMUSGList *sg, MemTxAttrs > attrs); > +MemTxResult dma_buf_read(void *ptr, int32_t len, uint64_t *residp, > + QEMUSGList *sg, MemTxAttrs attrs); > +MemTxResult dma_buf_write(void *ptr, int32_t len, uint64_t *residp, > + QEMUSGList *sg, MemTxAttrs attrs);
Side note, ideally all functions returning the MemTxResult type should use the warn_unused_result attribute.