mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 20:33:54 -06:00
rust: chardev, qdev: add bindings to qdev_prop_set_chr
Because the argument to the function is an Owned<Chardev>, this also adds an ObjectType implementation to Chardev. Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
61faf6ac7b
commit
a22bd55ffd
5 changed files with 32 additions and 1 deletions
|
@ -16,6 +16,7 @@ use crate::{
|
|||
bindings::{self, Error, ResettableClass},
|
||||
callbacks::FnCall,
|
||||
cell::bql_locked,
|
||||
chardev::Chardev,
|
||||
prelude::*,
|
||||
qom::{ClassInitImpl, ObjectClass, ObjectImpl, Owned},
|
||||
vmstate::VMStateDescription,
|
||||
|
@ -297,6 +298,14 @@ where
|
|||
Owned::from(&*clk)
|
||||
}
|
||||
}
|
||||
|
||||
fn prop_set_chr(&self, propname: &str, chr: &Owned<Chardev>) {
|
||||
assert!(bql_locked());
|
||||
let c_propname = CString::new(propname).unwrap();
|
||||
unsafe {
|
||||
bindings::qdev_prop_set_chr(self.as_mut_ptr(), c_propname.as_ptr(), chr.as_mut_ptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: ObjectDeref> DeviceMethods for R where R::Target: IsA<DeviceState> {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue