Skip to content

Commit 52f9cf0

Browse files
RuoqingHeShadowCurse
authored andcommitted
build: Bump zerocopy to 0.8.23
Signed-off-by: Ruoqing He <[email protected]>
1 parent 68fff54 commit 52f9cf0

File tree

10 files changed

+90
-68
lines changed

10 files changed

+90
-68
lines changed

kvm-bindings/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ derive should be present:
7878
```rs
7979
#[cfg_attr(
8080
feature = "serde",
81-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
81+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
8282
)]
8383
```
8484

kvm-bindings/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ serde = ["dep:serde", "serde/derive", "dep:zerocopy"]
2222
[dependencies]
2323
vmm-sys-util = { version = "0.12.1", optional = true }
2424
serde = { version = "1.0.0", optional = true, features = ["derive"] }
25-
zerocopy = { version = "0.7.32", optional = true, features = ["derive"] }
25+
zerocopy = { version = "0.8.23", optional = true, features = ["derive"] }
2626

2727
[dev-dependencies]
2828
bincode = "1.3.3"

kvm-bindings/src/arm64/bindings.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ pub type __poll_t = ::std::os::raw::c_uint;
866866
#[derive(Debug, Default, Copy, Clone, PartialEq)]
867867
#[cfg_attr(
868868
feature = "serde",
869-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
869+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
870870
)]
871871
pub struct user_pt_regs {
872872
pub regs: [__u64; 31usize],
@@ -889,7 +889,7 @@ const _: () = {
889889
#[derive(Debug, Default, Copy, Clone, PartialEq)]
890890
#[cfg_attr(
891891
feature = "serde",
892-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
892+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
893893
)]
894894
pub struct user_fpsimd_state {
895895
pub vregs: [__uint128_t; 32usize],
@@ -1057,7 +1057,7 @@ const _: () = {
10571057
#[derive(Debug, Default, Copy, Clone, PartialEq)]
10581058
#[cfg_attr(
10591059
feature = "serde",
1060-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
1060+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
10611061
)]
10621062
pub struct kvm_regs {
10631063
pub regs: user_pt_regs,
@@ -1081,7 +1081,7 @@ const _: () = {
10811081
#[derive(Debug, Default, Copy, Clone, PartialEq)]
10821082
#[cfg_attr(
10831083
feature = "serde",
1084-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
1084+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
10851085
)]
10861086
pub struct kvm_vcpu_init {
10871087
pub target: __u32,
@@ -3042,7 +3042,7 @@ const _: () = {
30423042
#[derive(Debug, Default, Copy, Clone, PartialEq)]
30433043
#[cfg_attr(
30443044
feature = "serde",
3045-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
3045+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
30463046
)]
30473047
pub struct kvm_mp_state {
30483048
pub mp_state: __u32,
@@ -3500,7 +3500,7 @@ const _: () = {
35003500
#[derive(Debug, Default, Copy, Clone, PartialEq)]
35013501
#[cfg_attr(
35023502
feature = "serde",
3503-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
3503+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
35043504
)]
35053505
pub struct kvm_one_reg {
35063506
pub id: __u64,

kvm-bindings/src/arm64/serialize.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use bindings::{
22
kvm_mp_state, kvm_one_reg, kvm_regs, kvm_vcpu_init, user_fpsimd_state, user_pt_regs,
33
};
44
use serde::{Deserialize, Deserializer, Serialize, Serializer};
5-
use zerocopy::{transmute, AsBytes};
5+
use zerocopy::{transmute, IntoBytes};
66

77
serde_impls! {
88
user_pt_regs,
@@ -36,12 +36,12 @@ mod tests {
3636
//
3737
// #[cfg_attr(
3838
// feature = "serde",
39-
// derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
39+
// derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
4040
// )]
4141
//
4242
// to all structures causing compilation errors (we need the zerocopy traits, as the
4343
// `Serialize` and `Deserialize` implementations are provided by the `serde_impls!` macro
44-
// above, which implements serialization based on zerocopy's `FromBytes` and `AsBytes`
44+
// above, which implements serialization based on zerocopy's `FromBytes` and `IntoBytes`
4545
// traits that it expects to be derived).
4646
//
4747
// NOTE: This only include "top-level" items, and does not list out bindgen-anonymous types

kvm-bindings/src/riscv64/bindings.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ pub type __poll_t = ::std::os::raw::c_uint;
596596
#[derive(Debug, Default, Copy, Clone, PartialEq)]
597597
#[cfg_attr(
598598
feature = "serde",
599-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
599+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
600600
)]
601601
pub struct user_regs_struct {
602602
pub pc: ::std::os::raw::c_ulong,
@@ -950,7 +950,7 @@ const _: () = {
950950
#[derive(Debug, Default, Copy, Clone, PartialEq)]
951951
#[cfg_attr(
952952
feature = "serde",
953-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
953+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
954954
)]
955955
pub struct kvm_riscv_config {
956956
pub isa: ::std::os::raw::c_ulong,
@@ -984,7 +984,7 @@ const _: () = {
984984
#[derive(Debug, Default, Copy, Clone, PartialEq)]
985985
#[cfg_attr(
986986
feature = "serde",
987-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
987+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
988988
)]
989989
pub struct kvm_riscv_core {
990990
pub regs: user_regs_struct,
@@ -1003,7 +1003,7 @@ const _: () = {
10031003
#[derive(Debug, Default, Copy, Clone, PartialEq)]
10041004
#[cfg_attr(
10051005
feature = "serde",
1006-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
1006+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
10071007
)]
10081008
pub struct kvm_riscv_csr {
10091009
pub sstatus: ::std::os::raw::c_ulong,
@@ -1045,7 +1045,7 @@ const _: () = {
10451045
#[derive(Debug, Default, Copy, Clone, PartialEq)]
10461046
#[cfg_attr(
10471047
feature = "serde",
1048-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
1048+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
10491049
)]
10501050
pub struct kvm_riscv_aia_csr {
10511051
pub siselect: ::std::os::raw::c_ulong,
@@ -1079,7 +1079,7 @@ const _: () = {
10791079
#[derive(Debug, Default, Copy, Clone, PartialEq)]
10801080
#[cfg_attr(
10811081
feature = "serde",
1082-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
1082+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
10831083
)]
10841084
pub struct kvm_riscv_smstateen_csr {
10851085
pub sstateen0: ::std::os::raw::c_ulong,
@@ -1096,7 +1096,7 @@ const _: () = {
10961096
#[derive(Debug, Default, Copy, Clone, PartialEq)]
10971097
#[cfg_attr(
10981098
feature = "serde",
1099-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
1099+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
11001100
)]
11011101
pub struct kvm_riscv_timer {
11021102
pub frequency: __u64,
@@ -1190,7 +1190,7 @@ pub type KVM_RISCV_SBI_EXT_ID = ::std::os::raw::c_uint;
11901190
#[derive(Debug, Default, Copy, Clone, PartialEq)]
11911191
#[cfg_attr(
11921192
feature = "serde",
1193-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
1193+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
11941194
)]
11951195
pub struct kvm_riscv_sbi_sta {
11961196
pub shmem_lo: ::std::os::raw::c_ulong,
@@ -2922,7 +2922,7 @@ const _: () = {
29222922
#[derive(Debug, Default, Copy, Clone, PartialEq)]
29232923
#[cfg_attr(
29242924
feature = "serde",
2925-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
2925+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
29262926
)]
29272927
pub struct kvm_mp_state {
29282928
pub mp_state: __u32,
@@ -3380,7 +3380,7 @@ const _: () = {
33803380
#[derive(Debug, Default, Copy, Clone, PartialEq)]
33813381
#[cfg_attr(
33823382
feature = "serde",
3383-
derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
3383+
derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
33843384
)]
33853385
pub struct kvm_one_reg {
33863386
pub id: __u64,

kvm-bindings/src/riscv64/serialize.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use bindings::{
77
kvm_riscv_sbi_sta, kvm_riscv_smstateen_csr, kvm_riscv_timer, user_regs_struct,
88
};
99
use serde::{Deserialize, Deserializer, Serialize, Serializer};
10-
use zerocopy::{transmute, AsBytes};
10+
use zerocopy::{transmute, IntoBytes};
1111

1212
serde_impls! {
1313
kvm_mp_state,
@@ -45,12 +45,12 @@ mod tests {
4545
//
4646
// #[cfg_attr(
4747
// feature = "serde",
48-
// derive(zerocopy::AsBytes, zerocopy::FromBytes, zerocopy::FromZeroes)
48+
// derive(zerocopy::IntoBytes, zerocopy::Immutable, zerocopy::FromBytes)
4949
// )]
5050
//
5151
// to all structures causing compilation errors (we need the zerocopy traits, as the
5252
// `Serialize` and `Deserialize` implementations are provided by the `serde_impls!` macro
53-
// above, which implements serialization based on zerocopy's `FromBytes` and `AsBytes`
53+
// above, which implements serialization based on zerocopy's `FromBytes` and `IntoBytes`
5454
// traits that it expects to be derived).
5555
//
5656
// NOTE: This only include "top-level" items, and does not list out bindgen-anonymous types

kvm-bindings/src/serialize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Module containing serialization utilities
44
55
/// Macro that generates serde::Serialize and serde::Deserialize implementations for the given types.
6-
/// This macro assumes that the types implement zerocopy::FromBytes and zerocopy::AsBytes, and uses
6+
/// This macro assumes that the types implement zerocopy::FromBytes and zerocopy::IntoBytes, and uses
77
/// these implementations to serialize as opaque byte arrays. During deserialization, it will
88
/// try to deserialize as a `Vec`. If this deserialized `Vec` has a length that equals `size_of::<T>`,
99
/// it will transmute to `T` (using zerocopy), otherwise the `Vec` will either be zero-padded, or truncated.

0 commit comments

Comments
 (0)