]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
rust: use std::ffi instead of std::os::raw
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 2 May 2025 08:18:35 +0000 (10:18 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 6 May 2025 14:02:04 +0000 (16:02 +0200)
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>
12 files changed:
docs/devel/rust.rst
rust/hw/char/pl011/src/device_class.rs
rust/hw/timer/hpet/src/hpet.rs
rust/qemu-api/src/chardev.rs
rust/qemu-api/src/irq.rs
rust/qemu-api/src/lib.rs
rust/qemu-api/src/memory.rs
rust/qemu-api/src/qdev.rs
rust/qemu-api/src/qom.rs
rust/qemu-api/src/timer.rs
rust/qemu-api/src/vmstate.rs
rust/qemu-api/tests/vmstate_tests.rs

index 3cc2841d4d1f37a326843a3939855159e7a06616..c7dfba98de173426489b71e414d04125a709ce26 100644 (file)
@@ -74,8 +74,6 @@ Supported tools
 QEMU supports rustc version 1.63.0 and newer.  Notably, the following features
 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.
 
 * "let ... else" (1.65.0).  Use ``if let`` instead.  This is currently patched
index b4d4a7eb432d7d4d48461afc733071188055dddf..cd2dc33c20727e6dbd89311177d4844eb4526f96 100644 (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},
     ptr::NonNull,
 };
 
index 12de2ba59a1330ef2c14eacfa209ad078fcb51c9..d4364f2f2f76a0940c71ac8e80d2487c1a415f7e 100644 (file)
@@ -3,8 +3,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 
 use std::{
-    ffi::CStr,
-    os::raw::{c_int, c_void},
+    ffi::{c_int, c_void, CStr},
     pin::Pin,
     ptr::{addr_of_mut, null_mut, NonNull},
     slice::from_ref,
index 11e6c45afaf1b6ba858fdad8a075cbbd72df190c..146a4852da3cec1c3eb195b14f26e0fcaba1e1a9 100644 (file)
 //! 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,
 };
index 1222d4fde30c97bbe80170f037b382e1777cdf7e..1526e6f63a1788bd9715973cc1a5817c01121527 100644 (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},
index 05f38b51d304f2b7d9891775f64cc33fcf40b35d..c3641e893b7d2381358cfd2473585d035c6bf78a 100644 (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)]
index fdb1ea11fcf9660e9167b0f8fefdecfb49ac4934..9ef2694bd6232a0803681d61badaf25fcc0b5c0d 100644 (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};
index 18b4a9ba687d9f80e47b557aee64533517a0f0bd..17c7fecabebaed75d2bed41123bf32ad1cf062ad 100644 (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,
 };
 
index f1b4022157b812706b7d24ec2465777e6c6d35b2..6929e4d33ae8ac80706602c79746e3a457fecedc 100644 (file)
 //! 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,
 };
 
index e769f8bc910d81718093b1a5ddfa610ab61e4ff9..d697fd742bc2769b1edde1d1f05017dcdd14b246 100644 (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,
 };
 
index 9ae97c389c120c44e1232a84eb01e09d100582f9..c0f29f74188bdf89fa5006578aebbf826aeba1dd 100644 (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::{
index f7a93117e1a094125c5bcb75497f014d7f469714..9a56ffd2385cbab78a921db0300ace09446d9ca6 100644 (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::{