mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-17 23:22:12 -06:00
rust: qdev: move device_class_init! body to generic function, ClassInitImpl implementation to macro
Use a trait to access the former parameters to device_class_init!. This allows hiding the details of the class_init implementation behind a generic function and makes higher-level functionality available from qemu_api. The implementation of ClassInitImpl is then the same for all devices and is easily macroized. Later on, we can remove the need to implement ClassInitImpl by hand for all device types, and stop making rust_device_class_init<>() public. While at it, document the members of DeviceImpl. Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
c6c4f3e0d9
commit
8c80c472da
4 changed files with 103 additions and 56 deletions
|
@ -93,14 +93,6 @@ qemu_api::declare_properties! {
|
|||
),
|
||||
}
|
||||
|
||||
qemu_api::device_class_init! {
|
||||
pl011_class_init,
|
||||
props => PL011_PROPERTIES,
|
||||
realize_fn => Some(pl011_realize),
|
||||
legacy_reset_fn => Some(pl011_reset),
|
||||
vmsd => VMSTATE_PL011,
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// We expect the FFI user of this function to pass a valid pointer, that has
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue