Skip to content

Commit 3b13071

Browse files
maryxCQ Bot
authored and
CQ Bot
committed
[starnix] Update generate.py and remove __bindgen_padding_0
This CL 1) updates the outputs of generate.py so that they match what the script does at ToT (outputs such as arm.rs at ToT haven't been updated/synced), and 2) makes sure fx build works after the update. Steps: 1. Run `./src/starnix/lib/linux_uapi/generate.py` (no edits) This results in some changes, notably, io_uring_sqe__bindgen_ty_6 updating to a struct and having 5 params. 2. Run `fx build`. This fails due to: ``` error[E0080]: evaluation of `std::mem::size_of::<io_uring_sqe>` failed --> /b/s/w/ir/x/w/fuchsia-third_party-rust/library/core/src/mem/mod.rs:1229:26 | = note: values of the type `[u8; 18446744073709551608]` are too big for the target architecture ``` This is rust-lang/rust-bindgen#3068. 3. Patch in the generate.py edit. Run `./src/starnix/lib/linux_uapi/generate.py` (with edit). Note that generated files now do not have the `pub __bindgen_padding_0` line. 4. `fx build` completes. Once's qsr's fix at rust-lang/rust-bindgen#3173 is merged and rolled in, we shouldn't need to do the regex replace. Bug: 398914504 Change-Id: Ic6be5a14f4f00477795588a5ed52e5770c64955e Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1235157 Reviewed-by: Benjamin Lerman <[email protected]> Commit-Queue: Mary Xia <[email protected]>
1 parent a27a699 commit 3b13071

File tree

5 files changed

+22
-24
lines changed

5 files changed

+22
-24
lines changed

src/starnix/lib/linux_uapi/generate.py

+2
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@
294294
(r": StdAtomic([UI])(8|16|32|64)", ": std::sync::atomic::Atomic\\1\\2"),
295295
# Remove __bindgen_missing from the start of constants defined in missing_includes.h
296296
(r"const __bindgen_missing_([a-zA-Z_0-9]+)", "const \\1"),
297+
# Workaround for https://github.com/rust-lang/rust-bindgen/issues/3068.
298+
(r"pub __bindgen_padding_0: \[u8; 1844[0-9]+usize\],\n", ""),
297299
]
298300

299301
REPLACEMENTS_PTR = [

src/starnix/lib/linux_uapi/src/arm.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -10230,7 +10230,6 @@ impl Default for ff_effect {
1023010230
}
1023110231
}
1023210232
#[repr(C)]
10233-
#[derive(Copy, Clone)]
1023410233
pub struct io_uring_sqe {
1023510234
pub opcode: __u8,
1023610235
pub flags: __u8,
@@ -10365,11 +10364,11 @@ impl Default for io_uring_sqe__bindgen_ty_5 {
1036510364
}
1036610365
}
1036710366
#[repr(C)]
10368-
#[derive(Copy, Clone)]
10369-
pub union io_uring_sqe__bindgen_ty_6 {
10370-
pub __bindgen_anon_1: io_uring_sqe__bindgen_ty_6__bindgen_ty_1,
10371-
pub optval: __u64,
10372-
pub cmd: [__u8; 8usize],
10367+
pub struct io_uring_sqe__bindgen_ty_6 {
10368+
pub __bindgen_anon_1: __BindgenUnionField<io_uring_sqe__bindgen_ty_6__bindgen_ty_1>,
10369+
pub optval: __BindgenUnionField<__u64>,
10370+
pub cmd: __BindgenUnionField<[__u8; 0usize]>,
10371+
pub bindgen_union_field: [u64; 2usize],
1037310372
}
1037410373
#[repr(C)]
1037510374
#[derive(Debug, Default, Copy, Clone, IntoBytes, FromBytes, KnownLayout, Immutable)]

src/starnix/lib/linux_uapi/src/arm64.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -10511,7 +10511,6 @@ impl Default for ff_effect {
1051110511
}
1051210512
}
1051310513
#[repr(C)]
10514-
#[derive(Copy, Clone)]
1051510514
pub struct io_uring_sqe {
1051610515
pub opcode: __u8,
1051710516
pub flags: __u8,
@@ -10646,11 +10645,11 @@ impl Default for io_uring_sqe__bindgen_ty_5 {
1064610645
}
1064710646
}
1064810647
#[repr(C)]
10649-
#[derive(Copy, Clone)]
10650-
pub union io_uring_sqe__bindgen_ty_6 {
10651-
pub __bindgen_anon_1: io_uring_sqe__bindgen_ty_6__bindgen_ty_1,
10652-
pub optval: __u64,
10653-
pub cmd: [__u8; 8usize],
10648+
pub struct io_uring_sqe__bindgen_ty_6 {
10649+
pub __bindgen_anon_1: __BindgenUnionField<io_uring_sqe__bindgen_ty_6__bindgen_ty_1>,
10650+
pub optval: __BindgenUnionField<__u64>,
10651+
pub cmd: __BindgenUnionField<[__u8; 0usize]>,
10652+
pub bindgen_union_field: [u64; 2usize],
1065410653
}
1065510654
#[repr(C)]
1065610655
#[derive(Debug, Default, Copy, Clone, IntoBytes, FromBytes, KnownLayout, Immutable)]

src/starnix/lib/linux_uapi/src/riscv64.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -10445,7 +10445,6 @@ impl Default for ff_effect {
1044510445
}
1044610446
}
1044710447
#[repr(C)]
10448-
#[derive(Copy, Clone)]
1044910448
pub struct io_uring_sqe {
1045010449
pub opcode: __u8,
1045110450
pub flags: __u8,
@@ -10580,11 +10579,11 @@ impl Default for io_uring_sqe__bindgen_ty_5 {
1058010579
}
1058110580
}
1058210581
#[repr(C)]
10583-
#[derive(Copy, Clone)]
10584-
pub union io_uring_sqe__bindgen_ty_6 {
10585-
pub __bindgen_anon_1: io_uring_sqe__bindgen_ty_6__bindgen_ty_1,
10586-
pub optval: __u64,
10587-
pub cmd: [__u8; 8usize],
10582+
pub struct io_uring_sqe__bindgen_ty_6 {
10583+
pub __bindgen_anon_1: __BindgenUnionField<io_uring_sqe__bindgen_ty_6__bindgen_ty_1>,
10584+
pub optval: __BindgenUnionField<__u64>,
10585+
pub cmd: __BindgenUnionField<[__u8; 0usize]>,
10586+
pub bindgen_union_field: [u64; 2usize],
1058810587
}
1058910588
#[repr(C)]
1059010589
#[derive(Debug, Default, Copy, Clone, IntoBytes, FromBytes, KnownLayout, Immutable)]

src/starnix/lib/linux_uapi/src/x86_64.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -10721,7 +10721,6 @@ impl Default for ff_effect {
1072110721
}
1072210722
}
1072310723
#[repr(C)]
10724-
#[derive(Copy, Clone)]
1072510724
pub struct io_uring_sqe {
1072610725
pub opcode: __u8,
1072710726
pub flags: __u8,
@@ -10856,11 +10855,11 @@ impl Default for io_uring_sqe__bindgen_ty_5 {
1085610855
}
1085710856
}
1085810857
#[repr(C)]
10859-
#[derive(Copy, Clone)]
10860-
pub union io_uring_sqe__bindgen_ty_6 {
10861-
pub __bindgen_anon_1: io_uring_sqe__bindgen_ty_6__bindgen_ty_1,
10862-
pub optval: __u64,
10863-
pub cmd: [__u8; 8usize],
10858+
pub struct io_uring_sqe__bindgen_ty_6 {
10859+
pub __bindgen_anon_1: __BindgenUnionField<io_uring_sqe__bindgen_ty_6__bindgen_ty_1>,
10860+
pub optval: __BindgenUnionField<__u64>,
10861+
pub cmd: __BindgenUnionField<[__u8; 0usize]>,
10862+
pub bindgen_union_field: [u64; 2usize],
1086410863
}
1086510864
#[repr(C)]
1086610865
#[derive(Debug, Default, Copy, Clone, IntoBytes, FromBytes, KnownLayout, Immutable)]

0 commit comments

Comments
 (0)