On Thu, Oct 06, 2022 at 05:34:58PM -0400, Stefan Hajnoczi wrote:
The only implementor of bdrv_register_buf() is block/nvme.c, where the
size is not needed when unregistering a buffer. This is because
util/vfio-helpers.c can look up mappings by address.

Future block drivers that implement bdrv_register_buf() may not be able
to do their job given only the buffer address. Add a size argument to
bdrv_unregister_buf().

Also document the assumptions about
bdrv_register_buf()/bdrv_unregister_buf() calls. The same <host, size>
values that were given to bdrv_register_buf() must be given to
bdrv_unregister_buf().

gcc 11.2.1 emits a spurious warning that img_bench()'s buf_size local
variable might be uninitialized, so it's necessary to silence the
compiler.

Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com>
---
include/block/block-global-state.h          | 5 ++++-
include/block/block_int-common.h            | 2 +-
include/sysemu/block-backend-global-state.h | 2 +-
block/block-backend.c                       | 4 ++--
block/io.c                                  | 6 +++---
block/nvme.c                                | 2 +-
qemu-img.c                                  | 4 ++--
7 files changed, 14 insertions(+), 11 deletions(-)

Reviewed-by: Stefano Garzarella <sgarz...@redhat.com>


Reply via email to