mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
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:
parent
e0b2b74f70
commit
e4fb0be1d1
12 changed files with 20 additions and 18 deletions
|
@ -74,8 +74,6 @@ Supported tools
|
||||||
QEMU supports rustc version 1.63.0 and newer. Notably, the following features
|
QEMU supports rustc version 1.63.0 and newer. Notably, the following features
|
||||||
are missing:
|
are missing:
|
||||||
|
|
||||||
* ``core::ffi`` (1.64.0). Use ``std::os::raw`` and ``std::ffi`` instead.
|
|
||||||
|
|
||||||
* ``cast_mut()``/``cast_const()`` (1.65.0). Use ``as`` instead.
|
* ``cast_mut()``/``cast_const()`` (1.65.0). Use ``as`` instead.
|
||||||
|
|
||||||
* "let ... else" (1.65.0). Use ``if let`` instead. This is currently patched
|
* "let ... else" (1.65.0). Use ``if let`` instead. This is currently patched
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
os::raw::{c_int, c_void},
|
ffi::{c_int, c_void},
|
||||||
ptr::NonNull,
|
ptr::NonNull,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
ffi::CStr,
|
ffi::{c_int, c_void, CStr},
|
||||||
os::raw::{c_int, c_void},
|
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
ptr::{addr_of_mut, null_mut, NonNull},
|
ptr::{addr_of_mut, null_mut, NonNull},
|
||||||
slice::from_ref,
|
slice::from_ref,
|
||||||
|
|
|
@ -10,11 +10,10 @@
|
||||||
//! called.
|
//! called.
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
ffi::CStr,
|
ffi::{c_int, c_void, CStr},
|
||||||
fmt::{self, Debug},
|
fmt::{self, Debug},
|
||||||
io::{self, ErrorKind, Write},
|
io::{self, ErrorKind, Write},
|
||||||
marker::PhantomPinned,
|
marker::PhantomPinned,
|
||||||
os::raw::{c_int, c_void},
|
|
||||||
ptr::addr_of_mut,
|
ptr::addr_of_mut,
|
||||||
slice,
|
slice,
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
|
|
||||||
//! Bindings for interrupt sources
|
//! 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::{
|
use crate::{
|
||||||
bindings::{self, qemu_set_irq},
|
bindings::{self, qemu_set_irq},
|
||||||
|
|
|
@ -33,7 +33,7 @@ pub mod zeroable;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
alloc::{GlobalAlloc, Layout},
|
alloc::{GlobalAlloc, Layout},
|
||||||
os::raw::c_void,
|
ffi::c_void,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(HAVE_GLIB_WITH_ALIGNED_ALLOC)]
|
#[cfg(HAVE_GLIB_WITH_ALIGNED_ALLOC)]
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
//! Bindings for `MemoryRegion`, `MemoryRegionOps` and `MemTxAttrs`
|
//! Bindings for `MemoryRegion`, `MemoryRegionOps` and `MemTxAttrs`
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
ffi::{CStr, CString},
|
ffi::{c_uint, c_void, CStr, CString},
|
||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
os::raw::{c_uint, c_void},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use bindings::{hwaddr, MemTxAttrs};
|
pub use bindings::{hwaddr, MemTxAttrs};
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
//! Bindings to create devices and access device functionality from Rust.
|
//! Bindings to create devices and access device functionality from Rust.
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
ffi::{CStr, CString},
|
ffi::{c_int, c_void, CStr, CString},
|
||||||
os::raw::{c_int, c_void},
|
|
||||||
ptr::NonNull,
|
ptr::NonNull,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -93,11 +93,10 @@
|
||||||
//! without incurring into violations of orphan rules for traits.
|
//! without incurring into violations of orphan rules for traits.
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
ffi::CStr,
|
ffi::{c_void, CStr},
|
||||||
fmt,
|
fmt,
|
||||||
mem::ManuallyDrop,
|
mem::ManuallyDrop,
|
||||||
ops::{Deref, DerefMut},
|
ops::{Deref, DerefMut},
|
||||||
os::raw::c_void,
|
|
||||||
ptr::NonNull,
|
ptr::NonNull,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
os::raw::{c_int, c_void},
|
ffi::{c_int, c_void},
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
//! functionality that is missing from `vmstate_of!`.
|
//! functionality that is missing from `vmstate_of!`.
|
||||||
|
|
||||||
use core::{marker::PhantomData, mem, ptr::NonNull};
|
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};
|
pub use crate::bindings::{VMStateDescription, VMStateField};
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
@ -2,7 +2,12 @@
|
||||||
// Author(s): Zhao Liu <zhai1.liu@intel.com>
|
// Author(s): Zhao Liu <zhai1.liu@intel.com>
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// 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::{
|
use qemu_api::{
|
||||||
bindings::{
|
bindings::{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue