From 88cf78e9172850c786d24d298adfadd09ec43a80 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Mon, 8 Sep 2025 12:49:45 +0200 Subject: rust: move vmstate_clock!() to qdev module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will allow to split vmstate to a standalone crate next. Signed-off-by: Marc-André Lureau Link: https://lore.kernel.org/r/20250827104147.717203-8-marcandre.lureau@redhat.com Reviewed-by: Zhao Liu Signed-off-by: Paolo Bonzini --- rust/qemu-api/src/vmstate.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'rust/qemu-api/src/vmstate.rs') diff --git a/rust/qemu-api/src/vmstate.rs b/rust/qemu-api/src/vmstate.rs index b5c6b764fb..59c7950a5a 100644 --- a/rust/qemu-api/src/vmstate.rs +++ b/rust/qemu-api/src/vmstate.rs @@ -41,7 +41,6 @@ use crate::{ callbacks::FnCall, errno::{into_neg_errno, Errno}, prelude::*, - qdev, qom::Owned, zeroable::Zeroable, }; @@ -318,21 +317,20 @@ impl_vmstate_scalar!(vmstate_info_uint32, u32, VMS_VARRAY_UINT32); impl_vmstate_scalar!(vmstate_info_uint64, u64); impl_vmstate_scalar!(vmstate_info_timer, crate::timer::Timer); +#[macro_export] macro_rules! impl_vmstate_c_struct { ($type:ty, $vmsd:expr) => { unsafe impl VMState for $type { - const BASE: VMStateField = $crate::bindings::VMStateField { - vmsd: addr_of!($vmsd), - size: mem::size_of::<$type>(), - flags: VMStateFlags::VMS_STRUCT, - ..Zeroable::ZERO + const BASE: $crate::bindings::VMStateField = $crate::bindings::VMStateField { + vmsd: ::std::ptr::addr_of!($vmsd), + size: ::std::mem::size_of::<$type>(), + flags: $crate::bindings::VMStateFlags::VMS_STRUCT, + ..$crate::zeroable::Zeroable::ZERO }; } }; } -impl_vmstate_c_struct!(qdev::Clock, bindings::vmstate_clock); - // Pointer types using the underlying type's VMState plus VMS_POINTER // Note that references are not supported, though references to cells // could be allowed. -- cgit 1.4.1