Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tee up future liburing 0.8 sqe_prep functions #26

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Add io_uring_prep_renameat and unlinkat
  • Loading branch information
mxxo committed Dec 22, 2020
commit 24157629e1b716081b26832729b235881f591901
13 changes: 13 additions & 0 deletions rusturing.c
Original file line number Diff line number Diff line change
@@ -285,6 +285,19 @@ extern inline void rust_io_uring_prep_shutdown(struct io_uring_sqe *sqe, int fd,
io_uring_prep_shutdown(sqe, fd, how);
}

extern inline void rust_io_uring_prep_unlinkat(struct io_uring_sqe *sqe, int dfd,
const char *path, int flags)
{
io_uring_prep_unlinkat(sqe, dfd, path, flags);
}

extern inline void rust_io_uring_prep_renameat(struct io_uring_sqe *sqe, int olddfd,
const char *oldpath, int newdfd,
const char *newpath, int flags)
{
io_uring_prep_renameat(sqe, olddfd, oldpath, newdfd, newpath, flags);
}

extern inline unsigned rust_io_uring_sq_ready(struct io_uring *ring)
{
return io_uring_sq_ready(ring);
22 changes: 22 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -43,6 +43,8 @@ pub enum IoRingOp {
IORING_OP_REMOVE_BUFFERS,
IORING_OP_TEE,
IORING_OP_SHUTDOWN,
IORING_OP_RENAMEAT,
IORING_OP_UNLINKAT,
}

// sqe.flags
@@ -188,6 +190,8 @@ pub union cmd_flags {
pub statx_flags: libc::__u32,
pub fadvise_advice: libc::__u32,
pub splice_flags: libc::__u32,
pub rename_flags: libc::__u32,
pub unlink_flags: libc::__u32,
}

#[allow(non_camel_case_types)]
@@ -668,6 +672,24 @@ extern {
how: libc::c_int
);

#[link_name = "rust_io_uring_prep_unlinkat"]
pub fn io_uring_prep_unlinkat(
sqe: *mut io_uring_sqe,
dfd: libc::c_int,
path: *const libc::c_char,
flags: libc::c_int,
);

#[link_name = "rust_io_uring_prep_renameat"]
pub fn io_uring_prep_renameat(
sqe: *mut io_uring_sqe,
olddfd: libc::c_int,
oldpath: *const libc::c_char,
newdfd: libc::c_int,
newpath: *const libc::c_char,
flags: libc::c_int,
);

#[link_name = "rust_io_uring_sq_ready"]
pub fn io_uring_sq_ready(ring: *mut io_uring) -> libc::c_uint;