[Libguestfs] [libnbd PATCH v9 4/7] rust: async: Use the modifies_fd flag to exclude calls

2023-08-26 Thread Tage Johansson
All handle calls which has the modifies_fd flag set to true will be excluded from AsyncHandle (the asynchronous handle in the rust bindings). This is a better approach then listing all calls that should be excluded in Rust.ml explicetly. --- generator/Rust.ml | 29 - 1

[Libguestfs] [libnbd PATCH v9 3/7] generator: Add `modifies_fd` flag to the [call] structure

2023-08-26 Thread Tage Johansson
Add a flag (modifies_fd) to the call structure in generator/API.ml which is set to true if the handle call may do something with the file descriptor. That is, it is true for all calls which are or may call aio_notify_*, including all synchronous commands like nbd_connect or nbd_opt_go. The

[Libguestfs] [libnbd PATCH v9 5/7] rust: async: Add a couple of integration tests

2023-08-26 Thread Tage Johansson
Add a couple of integration tests as rust/tests/test_async_*.rs. They are very similar to the tests for the synchronous API. --- rust/Cargo.toml | 1 + rust/tests/test_async_100_handle.rs | 25 +++ rust/tests/test_async_200_connect_command.rs | 26 +++

[Libguestfs] [libnbd PATCH v9 6/7] rust: async: Add an example

2023-08-26 Thread Tage Johansson
This patch adds an example using the asynchronous Rust bindings. --- rust/Cargo.toml| 1 + rust/examples/concurrent-read-write.rs | 149 + rust/run-tests.sh.in | 2 + 3 files changed, 152 insertions(+) create mode 100644

[Libguestfs] [libnbd PATCH v9 0/7] Rust Bindings for Libnbd

2023-08-26 Thread Tage Johansson
Compared to v8, this patch series corrects some grammatical errors in patch 1 and 2. Some unrelated formatting has also been removed from patch 2. Finally, a patch has been added wich extends the Rust test suite by checking that the Rust crate compiles even with all features disabled. -- Best

[Libguestfs] [libnbd PATCH v9 1/7] generator: Add information about asynchronous handle calls

2023-08-26 Thread Tage Johansson
A new field (async_kind) is added to the call data type in generator/API.ml*. The purpose is to tell if a certain handle call is an asynchronous command and if so how one can know when it is completed. The motivation for this is that all asynchronous commands on the AsyncHandle in the Rust

[Libguestfs] [libnbd PATCH v9 2/7] rust: async: Create an async friendly handle type

2023-08-26 Thread Tage Johansson
Create another handle type: AsyncHandle, which makes use of Rust's builtin asynchronous functions (see ) and runs on top of the Tokio runtime (see ). For every asynchronous command, like aio_connect(), a corresponding `async`

[Libguestfs] [libnbd PATCH v9 7/7] rust: Check that compilation works with default features disabled

2023-08-26 Thread Tage Johansson
The Rust crate has some default features, (tokio and log), to enable the asynchronous API and logging facilities. This patch extends the test suite to check that the crate compiles even with these features disabled. The crate did in fact not compile without those features, so the patch adds a

Re: [Libguestfs] [libnbd PATCH v8 06/10] rust: async: Create an async friendly handle type

2023-08-26 Thread Tage Johansson
On 8/24/2023 11:55 PM, Eric Blake wrote: On Sun, Aug 20, 2023 at 02:16:25PM +, Tage Johansson wrote: Create another handle type: AsyncHandle, which makes use of Rust's builtin asynchronous functions (see ) and runs on top of the Tokio