lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211230174548.178641-4-ammar.faizi@intel.com>
Date:   Fri, 31 Dec 2021 00:50:17 +0700
From:   Ammar Faizi <ammarfaizi2@...il.com>
To:     Jens Axboe <axboe@...nel.dk>
Cc:     io-uring Mailing List <io-uring@...r.kernel.org>,
        Pavel Begunkov <asml.silence@...il.com>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, Ammar Faizi <ammarfaizi2@...il.com>,
        Nugra <richiisei@...il.com>
Subject: [RFC PATCH liburing v1 3/5] liburing.h: Add `io_uring_prep_{sendto,sendto}` helper

This adds IORING_OP_SENDTO and IORING_OP_RECVFROM prep helper.

Signed-off-by: Ammar Faizi <ammarfaizi2@...il.com>
---
 src/include/liburing.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/include/liburing.h b/src/include/liburing.h
index a36d3f6..c22e69c 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -750,6 +750,28 @@ static inline void io_uring_prep_fsetxattr(struct io_uring_sqe *sqe,
 	sqe->xattr_flags = flags;
 }
 
+static inline void io_uring_prep_sendto(struct io_uring_sqe *sqe, int sockfd,
+				      const void *buf, size_t len, int flags,
+				      const struct sockaddr *dest_addr,
+				      socklen_t addrlen)
+{
+	io_uring_prep_rw(IORING_OP_SENDTO, sqe, sockfd, buf, (__u32) len, 0);
+	sqe->msg_flags = (__u32) flags;
+	sqe->addr2 = (__u64) (uintptr_t) dest_addr;
+	sqe->addr3 = (__u64) addrlen;
+}
+
+static inline void io_uring_prep_recvfrom(struct io_uring_sqe *sqe, int sockfd,
+					  void *buf, size_t len, int flags,
+					  struct sockaddr *src_addr,
+					  socklen_t *addrlen)
+{
+	io_uring_prep_rw(IORING_OP_RECVFROM, sqe, sockfd, buf, (__u32) len, 0);
+	sqe->msg_flags = (__u32) flags;
+	sqe->addr2 = (__u64) (uintptr_t) src_addr;
+	sqe->addr3 = (__u64) (uintptr_t) addrlen;
+}
+
 /*
  * Returns number of unconsumed (if SQPOLL) or unsubmitted entries exist in
  * the SQ ring
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ