Skip to content

Commit 6f48f7a

Browse files
committed
workspace: update to Rust edition 2024
Signed-off-by: Philipp Schuster <[email protected]> On-behalf-of: SAP [email protected]
1 parent b17cd0f commit 6f48f7a

24 files changed

+94
-69
lines changed

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[workspace]
2-
resolver = "2"
2+
package.edition = "2024"
3+
package.rust-version = "1.85"
4+
resolver = "3"
35
members = [
46
"kvm-bindings",
57
"kvm-ioctls",

kvm-bindings/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Upcoming Release
44

5+
### Changed
6+
- Rust edition 2024
7+
58
## v0.13.0
69

710
### Added

kvm-bindings/CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
### Bindgen
66
The bindings are currently generated using
7-
[bindgen](https://crates.io/crates/bindgen) version 0.70.1:
7+
[bindgen](https://crates.io/crates/bindgen) version 0.72.0:
88
```bash
9-
cargo install bindgen-cli --vers 0.70.1
9+
cargo install bindgen-cli --vers 0.72.0
1010
```
1111

1212
### Linux Kernel
1313
Generating bindings depends on the Linux kernel, so you need to have the
14-
repository on your machine. Replace `v6.9` with the kernel release for
14+
repository on your machine. Replace `v6.16` with the kernel release for
1515
which you wish to generate bindings:
1616

1717
```bash
@@ -23,7 +23,7 @@ git clone https://github.com/torvalds/linux.git --branch v6.9 --depth 1
2323
When adding a new architecture, the bindings must be generated for all existing
2424
versions for consistency reasons.
2525

26-
### Example for arm64 and kernel version 6.9
26+
### Example for arm64 and kernel version 6.16
2727

2828
For this example we assume that you have both linux and kvm-bindings
2929
repositories in your root.
@@ -44,7 +44,7 @@ export ARCH=arm64
4444
make headers_install ARCH=$ARCH INSTALL_HDR_PATH="$ARCH"_headers
4545
pushd "$ARCH"_headers
4646
bindgen include/linux/kvm.h -o bindings.rs \
47-
--impl-debug --with-derive-default \
47+
--impl-debug --with-derive-default --rust-edition 2024 \
4848
--with-derive-partialeq --impl-partialeq \
4949
-- -Iinclude
5050
popd

kvm-bindings/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ repository = "https://github.com/rust-vmm/kvm"
77
readme = "README.md"
88
keywords = ["kvm"]
99
license = "Apache-2.0"
10+
edition.workspace = true
11+
rust-version.workspace = true
1012

1113
[package.metadata.docs.rs]
1214
all-features = true

kvm-bindings/src/arm64/bindings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ impl<T> __IncompleteArrayField<T> {
2222
}
2323
#[inline]
2424
pub unsafe fn as_slice(&self, len: usize) -> &[T] {
25-
::std::slice::from_raw_parts(self.as_ptr(), len)
25+
unsafe { ::std::slice::from_raw_parts(self.as_ptr(), len) }
2626
}
2727
#[inline]
2828
pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
29-
::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
29+
unsafe { ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) }
3030
}
3131
}
3232
impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {

kvm-bindings/src/arm64/fam_wrappers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use vmm_sys_util::fam::{FamStruct, FamStructWrapper};
55

6-
use arm64::bindings::*;
6+
use super::bindings::*;
77

88
// There is no constant in the kernel as far as the maximum number
99
// of registers on arm, but KVM_GET_REG_LIST usually returns around 450.

kvm-bindings/src/arm64/serialize.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use bindings::{
1+
use super::bindings::{
22
kvm_irq_routing, kvm_irq_routing_entry, kvm_irq_routing_entry__bindgen_ty_1,
33
kvm_irq_routing_msi__bindgen_ty_1, kvm_mp_state, kvm_one_reg, kvm_regs, kvm_vcpu_init,
44
user_fpsimd_state, user_pt_regs,
55
};
66
use serde::{Deserialize, Deserializer, Serialize, Serializer};
7-
use zerocopy::{transmute, IntoBytes};
7+
use zerocopy::{IntoBytes, transmute};
88

99
serde_impls! {
1010
user_pt_regs,
@@ -43,7 +43,7 @@ unsafe impl IntoBytes for kvm_irq_routing_entry__bindgen_ty_1 {
4343

4444
#[cfg(test)]
4545
mod tests {
46-
use bindings::*;
46+
use super::*;
4747
use serde::{Deserialize, Serialize};
4848

4949
fn is_serde<T: Serialize + for<'de> Deserialize<'de> + Default>() {

kvm-bindings/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#![allow(non_upper_case_globals)]
77
#![allow(non_camel_case_types)]
88
#![allow(non_snake_case)]
9+
#![deny(clippy::undocumented_unsafe_blocks)]
910
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
1011

1112
#[cfg(feature = "fam-wrappers")]

kvm-bindings/src/riscv64/bindings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ impl<T> __IncompleteArrayField<T> {
2222
}
2323
#[inline]
2424
pub unsafe fn as_slice(&self, len: usize) -> &[T] {
25-
::std::slice::from_raw_parts(self.as_ptr(), len)
25+
unsafe { ::std::slice::from_raw_parts(self.as_ptr(), len) }
2626
}
2727
#[inline]
2828
pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
29-
::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
29+
unsafe { ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) }
3030
}
3131
}
3232
impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {

kvm-bindings/src/riscv64/fam_wrappers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use vmm_sys_util::fam::{FamStruct, FamStructWrapper};
66

7-
use riscv64::bindings::*;
7+
use super::bindings::*;
88

99
// There is no constant in the kernel as far as the maximum number
1010
// of registers on RISC-V, but KVM_GET_REG_LIST usually returns around 160.

0 commit comments

Comments
 (0)