Closed withoutboats closed 5 years ago
In doing this I think it would also be good to rename them to match the liburing names. To do this the extern declaration would change to use the link_name
attribute like so:
#[link(name = "rusturing")]
extern {
#[link_name = "rust_io_uring_cq_advance"] // the name of the function in `rusturing.c`
pub fn io_uring_cq_advance(ring: *mut io_uring, nr: libc::c_uint);
// etc
}
liburing contains a number of header-only functions. Because they are header-only, they cannot be called from Rust.
One of these,
io_uring_cq_advance
in particular, contains atomic operations necessary to coordinate with the kernel. Since one of the goals of binding to liburing is to let the authors of liburing handle that sort of thing for us, we "re-export" that function throughrusturing.c
, hence exposing arust_io_uring_cq_advance
function. We don't do this for any other header-only functions.Maybe we should do this re-export for all header only functions, so uring-sys will be more API-equivalent to liburing.