mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
rust: chardev: wrap Chardev with Opaque<>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
af0868cba3
commit
48627510a7
3 changed files with 7 additions and 5 deletions
|
@ -31,9 +31,6 @@ unsafe impl Sync for BusState {}
|
|||
unsafe impl Send for CharBackend {}
|
||||
unsafe impl Sync for CharBackend {}
|
||||
|
||||
unsafe impl Send for Chardev {}
|
||||
unsafe impl Sync for Chardev {}
|
||||
|
||||
unsafe impl Send for ObjectClass {}
|
||||
unsafe impl Sync for ObjectClass {}
|
||||
|
||||
|
|
|
@ -6,9 +6,13 @@
|
|||
|
||||
use std::ffi::CStr;
|
||||
|
||||
use crate::{bindings, prelude::*};
|
||||
use crate::{bindings, cell::Opaque, prelude::*};
|
||||
|
||||
/// A safe wrapper around [`bindings::Chardev`].
|
||||
#[repr(transparent)]
|
||||
#[derive(qemu_api_macros::Wrapper)]
|
||||
pub struct Chardev(Opaque<bindings::Chardev>);
|
||||
|
||||
pub type Chardev = bindings::Chardev;
|
||||
pub type ChardevClass = bindings::ChardevClass;
|
||||
|
||||
unsafe impl ObjectType for Chardev {
|
||||
|
|
|
@ -334,6 +334,7 @@ where
|
|||
fn prop_set_chr(&self, propname: &str, chr: &Owned<Chardev>) {
|
||||
assert!(bql_locked());
|
||||
let c_propname = CString::new(propname).unwrap();
|
||||
let chr: &Chardev = chr;
|
||||
unsafe {
|
||||
bindings::qdev_prop_set_chr(
|
||||
self.upcast().as_mut_ptr(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue