mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-29 21:33:53 -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
19
rust/qemu-api/src/chardev.rs
Normal file
19
rust/qemu-api/src/chardev.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2024 Red Hat, Inc.
|
||||
// Author(s): Paolo Bonzini <pbonzini@redhat.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
//! Bindings for character devices
|
||||
|
||||
use std::ffi::CStr;
|
||||
|
||||
use crate::{bindings, prelude::*};
|
||||
|
||||
pub type Chardev = bindings::Chardev;
|
||||
pub type ChardevClass = bindings::ChardevClass;
|
||||
|
||||
unsafe impl ObjectType for Chardev {
|
||||
type Class = ChardevClass;
|
||||
const TYPE_NAME: &'static CStr =
|
||||
unsafe { CStr::from_bytes_with_nul_unchecked(bindings::TYPE_CHARDEV) };
|
||||
}
|
||||
qom_isa!(Chardev: Object);
|
Loading…
Add table
Add a link
Reference in a new issue