Home
last modified time | relevance | path

Searched hist:"6 f8e6aed81277ec14d5a5dcafdd00dadf7ac465c" (Results 1 – 1 of 1) sorted by relevance

/qemu/rust/qemu-api/src/
H A Dvmstate.rs6f8e6aed81277ec14d5a5dcafdd00dadf7ac465c Mon Apr 14 14:49:35 UTC 2025 Zhao Liu <zhao1.liu@intel.com> rust/vmstate: Add support for field_exists checks

Unfortunately, at present it's not possible to have a const
"with_exist_check" method to append test_fn after vmstate_struct (due
to error on "constant functions cannot evaluate destructors" for `F`).

Before the vmstate builder, the only way to support "test_fn" is to
extend vmstate_struct macro to add the such new optional member (and
fortunately, Rust can still parse the current expansion!).

Abstract the previous callback implementation of vmstate_validate into
a separate macro, and moves it before vmstate_struct for vmstate_struct
to call.

Note that there's no need to add any extra flag for a new test_fn added
in the VMStateField.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20250414144943.1112885-2-zhao1.liu@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>