On Fri, Jun 26, 2026 at 01:19:23AM +0400, Marc-André Lureau wrote:
> Convert the qemu-io command infrastructure to use QEMU's Error API
> (Error **errp) for error propagation instead of printing directly to
> stdout/stderr via printf/fprintf.
>
> The cfunc_t typedef, all ~35 command functions, the dispatcher chain
> (command/init_check_command/qemuio_command), and helper functions
> (parse_pattern, create_iovec, qemu_io_alloc_from_file) all gain an
> Error **errp parameter. Async completion callbacks (aio_read_done,
> aio_write_done, aio_discard_done) use error_report() since they have
> no Error path back to the caller.
>
> Update tests:
> - error_report_err() prepends qemu-io: prefix
> - copy-before-write: check the HMP return value, rather than stdio
> - other tests: update to check JSON {"return": "Error: error text"}
>
> Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
> Signed-off-by: Marc-André Lureau <[email protected]>
> ---
> include/qemu-io.h | 4 +-
> block/monitor/block-hmp-cmds.c | 2 +-
> qemu-io-cmds.c | 414
> +++++++++++++------------
> qemu-io.c | 17 +-
> tests/qemu-iotests/004.out | 20 +-
> tests/qemu-iotests/021.out | 60 ++--
> tests/qemu-iotests/026.out | 228 +++++++-------
> tests/qemu-iotests/060.out | 44 ++-
> tests/qemu-iotests/071.out | 10 +-
> tests/qemu-iotests/072.out | 2 +-
> tests/qemu-iotests/080.out | 4 +-
> tests/qemu-iotests/081.out | 2 +-
> tests/qemu-iotests/083.out | 36 +--
> tests/qemu-iotests/089.out | 4 +-
> tests/qemu-iotests/114.out | 2 +-
> tests/qemu-iotests/134.out | 2 +-
> tests/qemu-iotests/137.out | 2 +-
> tests/qemu-iotests/153.out | 12 +-
> tests/qemu-iotests/171 | 2 +-
> tests/qemu-iotests/171.out | 68 ++--
> tests/qemu-iotests/205 | 2 +-
> tests/qemu-iotests/214.out | 2 +-
> tests/qemu-iotests/220.out | 2 +-
> tests/qemu-iotests/225.out | 4 +-
> tests/qemu-iotests/244.out | 12 +-
> tests/qemu-iotests/249.out | 6 +-
> tests/qemu-iotests/271.out | 14 +-
> tests/qemu-iotests/289.out | 2 +-
> tests/qemu-iotests/305.out | 2 +-
> tests/qemu-iotests/307.out | 2 +-
> tests/qemu-iotests/tests/backup-discard-source | 4 +-
> tests/qemu-iotests/tests/copy-before-write | 66 ++--
> tests/qemu-iotests/tests/file-io-error.out | 2 +-
> tests/qemu-iotests/tests/image-fleecing.out | 12 +-
> tests/qemu-iotests/tests/inactive-node-nbd.out | 8 +-
> 35 files changed, 552 insertions(+), 523 deletions(-)
Reviewed-by: Daniel P. Berrangé <[email protected]>
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|