Manos Pitsidianakis <manos.pitsidiana...@linaro.org> writes: > Add rust/qemu-api, which exposes rust-bindgen generated FFI bindings and > provides some declaration macros for symbols visible to the rest of > QEMU. > > Co-authored-by: Junjie Mao <junjie....@intel.com> > Co-authored-by: Paolo Bonzini <pbonz...@redhat.com> > Signed-off-by: Junjie Mao <junjie....@intel.com> > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > Signed-off-by: Manos Pitsidianakis <manos.pitsidiana...@linaro.org> > --- [snip] > diff --git a/rust/qemu-api/src/device_class.rs > b/rust/qemu-api/src/device_class.rs > new file mode 100644 > index > 0000000000000000000000000000000000000000..69ee912c333c3dce8bc127a286acaadd57ca20b3 > --- /dev/null > +++ b/rust/qemu-api/src/device_class.rs > @@ -0,0 +1,128 @@ > +// Copyright 2024, Linaro Limited > +// Author(s): Manos Pitsidianakis <manos.pitsidiana...@linaro.org> > +// SPDX-License-Identifier: GPL-2.0-or-later > + > +use std::sync::OnceLock; > + > +use crate::bindings::Property; > + > +#[macro_export] > +macro_rules! device_class_init { > + ($func:ident, props => $props:ident, realize_fn => $realize_fn:expr, > reset_fn => $reset_fn:expr, vmsd => $vmsd:ident$(,)*) => { > + #[no_mangle] > + pub unsafe extern "C" fn $func( > + klass: *mut $crate::bindings::ObjectClass, > + _: *mut ::core::ffi::c_void, > + ) { > + let mut dc = > + > ::core::ptr::NonNull::new(klass.cast::<$crate::bindings::DeviceClass>()).unwrap(); > + dc.as_mut().realize = $realize_fn; > + dc.as_mut().reset = $reset_fn;
A recent change to qdev-core.h [1] renames reset to legacy_reset. You may want to rebase the series and update this to dc.as_mut().legacy_reset accordingly. [1] https://lore.kernel.org/qemu-devel/20240913151411.2167922-9-peter.mayd...@linaro.org/ -- Best Regards Junjie Mao