diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2024-10-25 09:20:16 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-11-05 14:18:17 +0100 |
commit | ce4a144cf817d401592918faa86f4903d3c78c3e (patch) | |
tree | 8993b0d734316ea31f41b44c1752f5004bc0ca38 /rust/qemu-api/src | |
parent | 4fe146926fd50a9a2f5591fedc46c7aef7b4bd32 (diff) | |
download | qemu-ce4a144cf817d401592918faa86f4903d3c78c3e.zip qemu-ce4a144cf817d401592918faa86f4903d3c78c3e.tar.gz qemu-ce4a144cf817d401592918faa86f4903d3c78c3e.tar.bz2 |
rust: do not use --generate-cstr
--generate-cstr is a good idea and generally the right thing to do,
but it is not available in Debian 12 and Ubuntu 22.04. Work around
the absence.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/qemu-api/src')
-rw-r--r-- | rust/qemu-api/src/device_class.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/rust/qemu-api/src/device_class.rs b/rust/qemu-api/src/device_class.rs index 56608c7..0ba798d 100644 --- a/rust/qemu-api/src/device_class.rs +++ b/rust/qemu-api/src/device_class.rs @@ -2,6 +2,10 @@ // Author(s): Manos Pitsidianakis <manos.pitsidianakis@linaro.org> // SPDX-License-Identifier: GPL-2.0-or-later +use std::ffi::CStr; + +use crate::bindings; + #[macro_export] macro_rules! device_class_init { ($func:ident, props => $props:ident, realize_fn => $realize_fn:expr, legacy_reset_fn => $legacy_reset_fn:expr, vmsd => $vmsd:ident$(,)*) => { @@ -62,3 +66,9 @@ macro_rules! declare_properties { ]; }; } + +// workaround until we can use --generate-cstr in bindgen. +pub const TYPE_DEVICE: &CStr = + unsafe { CStr::from_bytes_with_nul_unchecked(bindings::TYPE_DEVICE) }; +pub const TYPE_SYS_BUS_DEVICE: &CStr = + unsafe { CStr::from_bytes_with_nul_unchecked(bindings::TYPE_SYS_BUS_DEVICE) }; |