[PULL 1/2] qemu-nbd: Allow users to adjust handshake limit

2025-02-11 Thread Eric Blake
Although defaulting the handshake limit to 10 seconds was a nice QoI change to weed out intentionally slow clients, it can interfere with integration testing done with manual NBD_OPT commands over 'nbdsh --opt-mode'. Expose a command line option to allow the user to alter the timeout away from the

[PATCH 07/11] block: Add bdrv_open_blockdev_ref_file()

2025-02-11 Thread Kevin Wolf
This is the equivalent of bdrv_open_file_child() to be used in cases where the caller is QAPI based and has a BlockdevRef rather than a filename and an options QDict. Signed-off-by: Kevin Wolf --- include/block/block-global-state.h | 4 block.c| 30 +

[PULL 2/2] nbd/server: Allow users to adjust handshake limit in QMP

2025-02-11 Thread Eric Blake
Although defaulting the handshake limit to 10 seconds was a nice QoI change to weed out intentionally slow clients, it can interfere with integration testing done with manual NBD_OPT commands over 'nbdsh --opt-mode'. Expose a QMP knob 'handshake-max-secs' to allow the user to alter the timeout awa

[PATCH 01/11] rust: Build separate qemu_api_tools and qemu_api_system

2025-02-11 Thread Kevin Wolf
The existing qemu_api library can't be linked into tools because it contains a few bindings for things that only exist in the system emulator. This adds a new "system" feature to the qemu_api crate that enables the system emulator parts in it, and build the crate twice: qemu_api_tools is the core

[PATCH 00/11] rust/block: Add minimal block driver bindings

2025-02-11 Thread Kevin Wolf
This series adds minimal bindings for writing block drivers in Rust and converts the bochs block driver as an example. Some parts (such as the open functions) are still essentially C written in Rust syntax, while other parts already try to provide somewhat idiomatic abstractions. The main purpose

[PATCH 05/11] rust/block: Add empty crate

2025-02-11 Thread Kevin Wolf
Signed-off-by: Kevin Wolf --- rust/Cargo.lock| 7 +++ rust/Cargo.toml| 1 + rust/block/Cargo.toml | 15 +++ rust/block/README.md | 3 +++ rust/block/meson.build | 19 +++ rust/block/src/lib.rs | 1 + rust/meson.build | 1 + 7 files ch

[PATCH 09/11] rust/block: Add read support for block drivers

2025-02-11 Thread Kevin Wolf
This adds a map() function to the BlockDriver trait and makes use of it to implement reading from an image. Signed-off-by: Kevin Wolf --- rust/block/src/driver.rs | 100 +++ 1 file changed, 100 insertions(+) diff --git a/rust/block/src/driver.rs b/rust/block/

[PATCH 03/11] rust: Add some block layer bindings

2025-02-11 Thread Kevin Wolf
Signed-off-by: Kevin Wolf --- rust/wrapper.h| 4 meson.build | 1 + rust/qemu-api/src/zeroable.rs | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/rust/wrapper.h b/rust/wrapper.h index 41be87adcf..c3e1e6f9cf 100644 --- a/rust/wrapper

[PATCH 10/11] bochs-rs: Add bochs block driver reimplementation in Rust

2025-02-11 Thread Kevin Wolf
This adds a separate block driver for the bochs image format called 'bochs-rs' so that for the moment both the C implementation and the Rust implementation can be present in the same build. The intention is to remove the C implementation eventually and rename this one into 'bochs'. This can only ha

[PATCH 06/11] rust/block: Add I/O buffer traits

2025-02-11 Thread Kevin Wolf
Types that implement IoBuffer can be used with safe I/O functions. Signed-off-by: Kevin Wolf --- rust/block/src/iobuffer.rs | 94 ++ rust/block/src/lib.rs | 2 + 2 files changed, 96 insertions(+) create mode 100644 rust/block/src/iobuffer.rs diff --git

[PATCH 08/11] rust/block: Add driver module

2025-02-11 Thread Kevin Wolf
This adds a barebones module for a block driver interface. Because there is no native QAPI support for Rust yet, opening images takes a few unsafe functions to call into C visitor functions. This should be cleaned up later. Signed-off-by: Kevin Wolf --- rust/block/src/driver.rs | 190 +++

[PATCH 04/11] rust/qemu-api: Add wrappers to run futures in QEMU

2025-02-11 Thread Kevin Wolf
This adds helper functions that allow running Rust futures to completion using QEMU's event loops. Signed-off-by: Kevin Wolf --- include/qemu/coroutine-rust.h | 24 +++ rust/wrapper.h| 1 + util/qemu-co-rust-async.c | 55 rust/qemu-api/meson.

[PATCH 02/11] meson: Add rust_block_ss and link tools with it

2025-02-11 Thread Kevin Wolf
Signed-off-by: Kevin Wolf --- meson.build| 36 storage-daemon/meson.build | 2 +- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 1f26801b69..30aae6b3c3 100644 --- a/meson.build +++ b/meson.build

[PATCH 11/11] rust/block: Add format probing

2025-02-11 Thread Kevin Wolf
This adds format probing both to the BlockDriver trait and the bochs-rs block driver. With this, bochs-rs achieves feature parity with its C counterpart. Its probe function returns a higher priority so that it is preferred when both drivers are available. Signed-off-by: Kevin Wolf --- rust/block

Re: [PATCH 02/11] meson: Add rust_block_ss and link tools with it

2025-02-11 Thread Philippe Mathieu-Daudé
On 11/2/25 22:43, Kevin Wolf wrote: Signed-off-by: Kevin Wolf --- meson.build| 36 storage-daemon/meson.build | 2 +- 2 files changed, 33 insertions(+), 5 deletions(-) if have_rust and target_type == 'system' -target_rust = ru

Re: [PATCH 07/11] block: Add bdrv_open_blockdev_ref_file()

2025-02-11 Thread Philippe Mathieu-Daudé
On 11/2/25 22:43, Kevin Wolf wrote: This is the equivalent of bdrv_open_file_child() to be used in cases where the caller is QAPI based and has a BlockdevRef rather than a filename and an options QDict. Signed-off-by: Kevin Wolf --- include/block/block-global-state.h | 4 block.c

Re: [PATCH 10/11] bochs-rs: Add bochs block driver reimplementation in Rust

2025-02-11 Thread Philippe Mathieu-Daudé
On 11/2/25 22:43, Kevin Wolf wrote: This adds a separate block driver for the bochs image format called 'bochs-rs' so that for the moment both the C implementation and the Rust implementation can be present in the same build. The intention is to remove the C implementation eventually and rename t