Skip to content

Commit

Permalink
vendor aarch64 sys.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
quininer committed Sep 21, 2024
1 parent 5e332f3 commit 6c66bb6
Show file tree
Hide file tree
Showing 9 changed files with 5,991 additions and 2,988 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Bench
run: cargo bench --package io-uring-bench

check-x86_64:
check-vendor:
runs-on: ubuntu-latest

strategy:
Expand All @@ -44,6 +44,7 @@ jobs:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-gnu

steps:
- uses: actions/checkout@v4
Expand All @@ -68,7 +69,6 @@ jobs:
- "1.63"
target:
- i686-unknown-linux-gnu
- aarch64-unknown-linux-gnu

steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ io_safety = []

[dependencies]
bitflags = "2"
cfg-if = "1"

libc = { version = "0.2.98", default-features = false }
sc = { version = "0.2", optional = true }
Expand Down
6 changes: 5 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ fn build() {
#[cfg(feature = "overwrite")]
let outdir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("src/sys");

let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();

let mut builder = bindgen::Builder::default();

if let Some(path) = env::var("BUILD_IO_URING_INCLUDE_FILE")
Expand All @@ -37,6 +39,8 @@ fn build() {
builder = builder.header_contents("include-file.h", INCLUDE);
}

let target_file = outdir.join(format!("sys_{}.rs", target_arch));

builder
.ctypes_prefix("libc")
.prepend_enum_name(false)
Expand All @@ -47,6 +51,6 @@ fn build() {
.allowlist_var("__NR_io_uring.*|IOSQE_.*|IORING_.*|IO_URING_.*|SPLICE_F_FD_IN_FIXED")
.generate()
.unwrap()
.write_to_file(outdir.join("sys.rs"))
.write_to_file(target_file)
.unwrap();
}
2 changes: 2 additions & 0 deletions io-uring-test/src/tests/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,8 @@ pub fn test_file_direct_write_read<S: squeue::EntryMarker, C: cqueue::EntryMarke

assert_eq!(cqes.len(), 1);
assert_eq!(cqes[0].user_data(), 0x03);

// when fs does not support Direct IO, it may fallback to buffered IO.
assert_eq_warn!(cqes[0].result(), -libc::EINVAL);

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn to_result(ret: c_int) -> io::Result<c_int> {

#[cfg(all(
not(feature = "bindgen"),
not(target_arch = "x86_64"),
not(any(target_arch = "x86_64", target_arch = "aarch64")),
not(io_uring_skip_arch_check)
))]
compile_error!(
Expand Down
Loading

0 comments on commit 6c66bb6

Please sign in to comment.