From 3acafe65eb043939753e682c2881bcde292ca5c5 Mon Sep 17 00:00:00 2001 From: Max Orok Date: Tue, 22 Dec 2020 13:19:02 -0500 Subject: [PATCH 1/3] Add io_uring_prep_tee --- rusturing.c | 8 ++++++++ src/lib.rs | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/rusturing.c b/rusturing.c index 0b5e98d..5c10daa 100644 --- a/rusturing.c +++ b/rusturing.c @@ -49,6 +49,14 @@ extern inline void rust_io_uring_prep_splice(struct io_uring_sqe *sqe, io_uring_prep_splice(sqe, fd_in, fd_out, off_in, off_out, nbytes, splice_flags); } +extern inline void rust_io_uring_prep_tee(struct io_uring_sqe *sqe, + int fd_in, int fd_out, + unsigned int nbytes, + unsigned int splice_flags) +{ + io_uring_prep_tee(sqe, fd_in, fd_out, nbytes, splice_flags); +} + extern inline void rust_io_uring_prep_readv(struct io_uring_sqe *sqe, int fd, const struct iovec *iovecs, diff --git a/src/lib.rs b/src/lib.rs index a9bb200..8991150 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -409,6 +409,15 @@ extern { splice_flags: libc::c_uint, ); + #[link_name = "rust_io_uring_prep_tee"] + pub fn io_uring_prep_tee( + sqe: *mut io_uring_sqe, + fd_in: libc::c_int, + fd_out: libc::c_int, + nbytes: libc::c_uint, + splice_flags: libc::c_uint, + ); + #[link_name = "rust_io_uring_prep_readv"] pub fn io_uring_prep_readv( sqe: *mut io_uring_sqe, From 92bc6bdc8e7fc4ed01972b4205adef180679a66a Mon Sep 17 00:00:00 2001 From: Max Orok Date: Tue, 22 Dec 2020 13:27:13 -0500 Subject: [PATCH 2/3] Add io_uring_prep_shutdown --- rusturing.c | 6 ++++++ src/lib.rs | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/rusturing.c b/rusturing.c index 5c10daa..d634fe6 100644 --- a/rusturing.c +++ b/rusturing.c @@ -279,6 +279,12 @@ extern inline void rust_io_uring_prep_remove_buffers(struct io_uring_sqe *sqe, io_uring_prep_remove_buffers(sqe, nr, bgid); } +extern inline void rust_io_uring_prep_shutdown(struct io_uring_sqe *sqe, int fd, + int how) +{ + io_uring_prep_shutdown(sqe, fd, how); +} + extern inline unsigned rust_io_uring_sq_ready(struct io_uring *ring) { return io_uring_sq_ready(ring); diff --git a/src/lib.rs b/src/lib.rs index 8991150..31961da 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -42,6 +42,7 @@ pub enum IoRingOp { IORING_OP_PROVIDE_BUFFERS, IORING_OP_REMOVE_BUFFERS, IORING_OP_TEE, + IORING_OP_SHUTDOWN, } // sqe.flags @@ -660,6 +661,13 @@ extern { bgid: libc::c_int ); + #[link_name = "rust_io_uring_prep_shutdown"] + pub fn io_uring_prep_shutdown( + sqe: *mut io_uring_sqe, + fd: libc::c_int, + how: libc::c_int + ); + #[link_name = "rust_io_uring_sq_ready"] pub fn io_uring_sq_ready(ring: *mut io_uring) -> libc::c_uint; From 24157629e1b716081b26832729b235881f591901 Mon Sep 17 00:00:00 2001 From: Max Orok Date: Tue, 22 Dec 2020 14:00:19 -0500 Subject: [PATCH 3/3] Add io_uring_prep_renameat and unlinkat --- rusturing.c | 13 +++++++++++++ src/lib.rs | 22 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/rusturing.c b/rusturing.c index d634fe6..f92f807 100644 --- a/rusturing.c +++ b/rusturing.c @@ -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); diff --git a/src/lib.rs b/src/lib.rs index 31961da..ea6f560 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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;