rust: use std::ffi instead of std::os::raw

This is allowed since Rust 1.64.0.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2025-05-02 10:18:35 +02:00
parent e0b2b74f70
commit e4fb0be1d1
12 changed files with 20 additions and 18 deletions

View file

@ -10,11 +10,10 @@
//! called.
use std::{
ffi::CStr,
ffi::{c_int, c_void, CStr},
fmt::{self, Debug},
io::{self, ErrorKind, Write},
marker::PhantomPinned,
os::raw::{c_int, c_void},
ptr::addr_of_mut,
slice,
};

View file

@ -4,7 +4,11 @@
//! Bindings for interrupt sources
use std::{ffi::CStr, marker::PhantomData, os::raw::c_int, ptr};
use std::{
ffi::{c_int, CStr},
marker::PhantomData,
ptr,
};
use crate::{
bindings::{self, qemu_set_irq},

View file

@ -33,7 +33,7 @@ pub mod zeroable;
use std::{
alloc::{GlobalAlloc, Layout},
os::raw::c_void,
ffi::c_void,
};
#[cfg(HAVE_GLIB_WITH_ALIGNED_ALLOC)]

View file

@ -5,9 +5,8 @@
//! Bindings for `MemoryRegion`, `MemoryRegionOps` and `MemTxAttrs`
use std::{
ffi::{CStr, CString},
ffi::{c_uint, c_void, CStr, CString},
marker::PhantomData,
os::raw::{c_uint, c_void},
};
pub use bindings::{hwaddr, MemTxAttrs};

View file

@ -5,8 +5,7 @@
//! Bindings to create devices and access device functionality from Rust.
use std::{
ffi::{CStr, CString},
os::raw::{c_int, c_void},
ffi::{c_int, c_void, CStr, CString},
ptr::NonNull,
};

View file

@ -93,11 +93,10 @@
//! without incurring into violations of orphan rules for traits.
use std::{
ffi::CStr,
ffi::{c_void, CStr},
fmt,
mem::ManuallyDrop,
ops::{Deref, DerefMut},
os::raw::c_void,
ptr::NonNull,
};

View file

@ -3,7 +3,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
use std::{
os::raw::{c_int, c_void},
ffi::{c_int, c_void},
pin::Pin,
};

View file

@ -25,7 +25,7 @@
//! functionality that is missing from `vmstate_of!`.
use core::{marker::PhantomData, mem, ptr::NonNull};
use std::os::raw::{c_int, c_void};
use std::ffi::{c_int, c_void};
pub use crate::bindings::{VMStateDescription, VMStateField};
use crate::{

View file

@ -2,7 +2,12 @@
// Author(s): Zhao Liu <zhai1.liu@intel.com>
// SPDX-License-Identifier: GPL-2.0-or-later
use std::{ffi::CStr, mem::size_of, os::raw::c_void, ptr::NonNull, slice};
use std::{
ffi::{c_void, CStr},
mem::size_of,
ptr::NonNull,
slice,
};
use qemu_api::{
bindings::{