Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aio-bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ license = "MIT"
[dependencies]

[build-dependencies]
bindgen = "0.37.0"
bindgen = "0.47.1"
18 changes: 13 additions & 5 deletions aio-bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@ use std::env;
use std::path::PathBuf;

fn main() {
// Tell cargo to tell rustc to link the system bzip2
// shared library.
println!("cargo:rustc-link-lib=bz2");
let target = env::var("TARGET").expect("Cargo build scripts always have TARGET");

// The bindgen::Builder is the main entry point
// to bindgen, and lets you build up options for
// the resulting bindings.
let bindings = bindgen::Builder::default()
let mut bindings = bindgen::Builder::default()
.trust_clang_mangling(false)
// The input header we would like to generate
.clang_arg("-target")
.clang_arg(target);

if let Ok(sysroot) = env::var("SYSROOT") {
bindings = bindings
.clang_arg("--sysroot")
.clang_arg(sysroot);
}

let bindings = bindings
// The input header we would like to generate
// bindings for.
.header("wrapper.h")
// Finish the builder and generate the bindings.
Expand Down
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ struct RequestState {
request: aio::iocb,

// Concurrency primitive to notify completion to the associated future
completed_receiver: futures::sync::oneshot::Receiver<c_long>,
completed_receiver: futures::sync::oneshot::Receiver<aio_bindings::__s64>,

// We have both sides of a oneshot channel here
completed_sender: Option<futures::sync::oneshot::Sender<c_long>>,
completed_sender: Option<futures::sync::oneshot::Sender<aio_bindings::__s64>>,
}

// Common data structures for futures returned by `AioContext`.
Expand Down Expand Up @@ -170,7 +170,7 @@ impl AioBaseFuture {
let state_addr = state.deref().deref() as *const RequestState;

// Fill in the iocb data structure to be submitted to the kernel
state.request.aio_data = unsafe { mem::transmute(state_addr) };
state.request.aio_data = unsafe { mem::transmute::<_, usize>(state_addr) } as u64;
state.request.aio_resfd = self.context.completed_fd as u32;
state.request.aio_flags = aio::IOCB_FLAG_RESFD | self.iocb_info.flags;
state.request.aio_fildes = self.iocb_info.fd as u32;
Expand Down Expand Up @@ -411,7 +411,7 @@ impl futures::Future for AioPollFuture {

// dispatch the retrieved events to the associated futures
for ref event in &self.events {
let request_state: &mut RequestState = unsafe { mem::transmute(event.data) };
let request_state: &mut RequestState = unsafe { mem::transmute(event.data as usize) } ;
request_state
.completed_sender
.take()
Expand Down Expand Up @@ -572,7 +572,7 @@ impl AioContext {
let (ptr, len) = {
let buffer = buffer_obj.as_mut();
let len = buffer.len() as u64;
let ptr = unsafe { mem::transmute(buffer.as_ptr()) };
let ptr = unsafe { mem::transmute::<_, usize>(buffer.as_ptr()) } as u64;
(ptr, len)
};

Expand Down Expand Up @@ -639,7 +639,7 @@ impl AioContext {
let (ptr, len) = {
let buffer = buffer_obj.as_ref();
let len = buffer.len() as u64;
let ptr = unsafe { mem::transmute(buffer.as_ptr()) };
let ptr = unsafe { mem::transmute::<_, usize>(buffer.as_ptr()) } as c_long;
(ptr, len)
};

Expand All @@ -652,7 +652,7 @@ impl AioContext {
fd,
offset,
len,
buf: ptr,
buf: ptr as u64,
flags: sync_level as u32,
},
state: None,
Expand Down