From d4873c5d4fdd11f484df183e01c0825fe347fd8b Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 15 Nov 2024 12:08:43 +0100 Subject: bql: add a "mock" BQL for Rust unit tests Right now, the stub BQL in stubs/iothread-lock.c always reports itself as unlocked. However, Rust would like to run its tests in an environment where the BQL *is* locked. Provide an extremely dirty function that flips the return value of bql_is_locked() to true. Signed-off-by: Paolo Bonzini --- include/qemu/main-loop.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h index 646306c..3935a57 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -248,6 +248,14 @@ GSource *iohandler_get_g_source(void); AioContext *iohandler_get_aio_context(void); /** + * rust_bql_mock_lock: + * + * Called from Rust doctests to make bql_lock() return true. + * Do not touch. + */ +void rust_bql_mock_lock(void); + +/** * bql_locked: Return lock status of the Big QEMU Lock (BQL) * * The Big QEMU Lock (BQL) is the coarsest lock in QEMU, and as such it -- cgit v1.1