public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Jens Axboe <[email protected]>
Cc: io-uring Mailing List <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>,
	Tea Inside Mailing List <[email protected]>,
	Alviro Iskandar Setiawan <[email protected]>,
	Alviro Iskandar Setiawan <[email protected]>,
	Ammar Faizi <[email protected]>,
	Nugra <[email protected]>
Subject: [PATCH liburing v1 4/4] Change all syscall function name prefix to __sys
Date: Fri, 11 Feb 2022 22:57:53 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Instead of using uring_mmap, uring_close, uring_madvise, etc. Let's
use __sys_mmap, __sys_close, __sys_madvise, etc. That looks better
convention for syscall function name like what we do with
__sys_io_uring* functions.

Cc: Nugra <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---
 src/arch/generic/syscall.h | 12 ++++++------
 src/arch/x86/syscall.h     | 12 ++++++------
 src/nolibc.c               |  4 ++--
 src/register.c             |  4 ++--
 src/setup.c                | 22 +++++++++++-----------
 5 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/arch/generic/syscall.h b/src/arch/generic/syscall.h
index 6b10fe3..fa93064 100644
--- a/src/arch/generic/syscall.h
+++ b/src/arch/generic/syscall.h
@@ -41,7 +41,7 @@ static inline int ____sys_io_uring_enter(int fd, unsigned to_submit,
 				       _NSIG / 8);
 }
 
-static inline void *uring_mmap(void *addr, size_t length, int prot, int flags,
+static inline void *__sys_mmap(void *addr, size_t length, int prot, int flags,
 			       int fd, off_t offset)
 {
 	void *ret;
@@ -49,35 +49,35 @@ static inline void *uring_mmap(void *addr, size_t length, int prot, int flags,
 	return (ret == MAP_FAILED) ? ERR_PTR(-errno) : ret;
 }
 
-static inline int uring_munmap(void *addr, size_t length)
+static inline int __sys_munmap(void *addr, size_t length)
 {
 	int ret;
 	ret = munmap(addr, length);
 	return (ret < 0) ? -errno : ret;
 }
 
-static inline int uring_madvise(void *addr, size_t length, int advice)
+static inline int __sys_madvise(void *addr, size_t length, int advice)
 {
 	int ret;
 	ret = madvise(addr, length, advice);
 	return (ret < 0) ? -errno : ret;
 }
 
-static inline int uring_getrlimit(int resource, struct rlimit *rlim)
+static inline int __sys_getrlimit(int resource, struct rlimit *rlim)
 {
 	int ret;
 	ret = getrlimit(resource, rlim);
 	return (ret < 0) ? -errno : ret;
 }
 
-static inline int uring_setrlimit(int resource, const struct rlimit *rlim)
+static inline int __sys_setrlimit(int resource, const struct rlimit *rlim)
 {
 	int ret;
 	ret = setrlimit(resource, rlim);
 	return (ret < 0) ? -errno : ret;
 }
 
-static inline int uring_close(int fd)
+static inline int __sys_close(int fd)
 {
 	int ret;
 	ret = close(fd);
diff --git a/src/arch/x86/syscall.h b/src/arch/x86/syscall.h
index 2d5642c..02677f2 100644
--- a/src/arch/x86/syscall.h
+++ b/src/arch/x86/syscall.h
@@ -29,7 +29,7 @@
  *   %r11 == %rflags and %rcx == %rip.
  */
 
-static inline void *uring_mmap(void *addr, size_t length, int prot, int flags,
+static inline void *__sys_mmap(void *addr, size_t length, int prot, int flags,
 			       int fd, off_t offset)
 {
 	void *rax;
@@ -52,7 +52,7 @@ static inline void *uring_mmap(void *addr, size_t length, int prot, int flags,
 	return rax;
 }
 
-static inline int uring_munmap(void *addr, size_t length)
+static inline int __sys_munmap(void *addr, size_t length)
 {
 	long rax;
 
@@ -67,7 +67,7 @@ static inline int uring_munmap(void *addr, size_t length)
 	return (int) rax;
 }
 
-static inline int uring_madvise(void *addr, size_t length, int advice)
+static inline int __sys_madvise(void *addr, size_t length, int advice)
 {
 	long rax;
 
@@ -83,7 +83,7 @@ static inline int uring_madvise(void *addr, size_t length, int advice)
 	return (int) rax;
 }
 
-static inline int uring_getrlimit(int resource, struct rlimit *rlim)
+static inline int __sys_getrlimit(int resource, struct rlimit *rlim)
 {
 	long rax;
 
@@ -98,7 +98,7 @@ static inline int uring_getrlimit(int resource, struct rlimit *rlim)
 	return (int) rax;
 }
 
-static inline int uring_setrlimit(int resource, const struct rlimit *rlim)
+static inline int __sys_setrlimit(int resource, const struct rlimit *rlim)
 {
 	long rax;
 
@@ -113,7 +113,7 @@ static inline int uring_setrlimit(int resource, const struct rlimit *rlim)
 	return (int) rax;
 }
 
-static inline int uring_close(int fd)
+static inline int __sys_close(int fd)
 {
 	long rax;
 
diff --git a/src/nolibc.c b/src/nolibc.c
index f7848d3..1e17d22 100644
--- a/src/nolibc.c
+++ b/src/nolibc.c
@@ -27,7 +27,7 @@ void *__uring_malloc(size_t len)
 {
 	struct uring_heap *heap;
 
-	heap = uring_mmap(NULL, sizeof(*heap) + len, PROT_READ | PROT_WRITE,
+	heap = __sys_mmap(NULL, sizeof(*heap) + len, PROT_READ | PROT_WRITE,
 			  MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
 	if (IS_ERR(heap))
 		return NULL;
@@ -44,5 +44,5 @@ void __uring_free(void *p)
 		return;
 
 	heap = container_of(p, struct uring_heap, user_p);
-	uring_munmap(heap, heap->len);
+	__sys_munmap(heap, heap->len);
 }
diff --git a/src/register.c b/src/register.c
index a1b1a22..cd73fce 100644
--- a/src/register.c
+++ b/src/register.c
@@ -100,13 +100,13 @@ static int increase_rlimit_nofile(unsigned nr)
 	int ret;
 	struct rlimit rlim;
 
-	ret = uring_getrlimit(RLIMIT_NOFILE, &rlim);
+	ret = __sys_getrlimit(RLIMIT_NOFILE, &rlim);
 	if (ret < 0)
 		return ret;
 
 	if (rlim.rlim_cur < nr) {
 		rlim.rlim_cur += nr;
-		uring_setrlimit(RLIMIT_NOFILE, &rlim);
+		__sys_setrlimit(RLIMIT_NOFILE, &rlim);
 	}
 
 	return 0;
diff --git a/src/setup.c b/src/setup.c
index 1e4dbf4..544adaf 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -10,9 +10,9 @@
 
 static void io_uring_unmap_rings(struct io_uring_sq *sq, struct io_uring_cq *cq)
 {
-	uring_munmap(sq->ring_ptr, sq->ring_sz);
+	__sys_munmap(sq->ring_ptr, sq->ring_sz);
 	if (cq->ring_ptr && cq->ring_ptr != sq->ring_ptr)
-		uring_munmap(cq->ring_ptr, cq->ring_sz);
+		__sys_munmap(cq->ring_ptr, cq->ring_sz);
 }
 
 static int io_uring_mmap(int fd, struct io_uring_params *p,
@@ -29,7 +29,7 @@ static int io_uring_mmap(int fd, struct io_uring_params *p,
 			sq->ring_sz = cq->ring_sz;
 		cq->ring_sz = sq->ring_sz;
 	}
-	sq->ring_ptr = uring_mmap(0, sq->ring_sz, PROT_READ | PROT_WRITE,
+	sq->ring_ptr = __sys_mmap(0, sq->ring_sz, PROT_READ | PROT_WRITE,
 				  MAP_SHARED | MAP_POPULATE, fd,
 				  IORING_OFF_SQ_RING);
 	if (IS_ERR(sq->ring_ptr))
@@ -38,7 +38,7 @@ static int io_uring_mmap(int fd, struct io_uring_params *p,
 	if (p->features & IORING_FEAT_SINGLE_MMAP) {
 		cq->ring_ptr = sq->ring_ptr;
 	} else {
-		cq->ring_ptr = uring_mmap(0, cq->ring_sz, PROT_READ | PROT_WRITE,
+		cq->ring_ptr = __sys_mmap(0, cq->ring_sz, PROT_READ | PROT_WRITE,
 					  MAP_SHARED | MAP_POPULATE, fd,
 					  IORING_OFF_CQ_RING);
 		if (IS_ERR(cq->ring_ptr)) {
@@ -57,7 +57,7 @@ static int io_uring_mmap(int fd, struct io_uring_params *p,
 	sq->array = sq->ring_ptr + p->sq_off.array;
 
 	size = p->sq_entries * sizeof(struct io_uring_sqe);
-	sq->sqes = uring_mmap(0, size, PROT_READ | PROT_WRITE,
+	sq->sqes = __sys_mmap(0, size, PROT_READ | PROT_WRITE,
 			      MAP_SHARED | MAP_POPULATE, fd, IORING_OFF_SQES);
 	if (IS_ERR(sq->sqes)) {
 		ret = PTR_ERR(sq->sqes);
@@ -109,18 +109,18 @@ int io_uring_ring_dontfork(struct io_uring *ring)
 		return -EINVAL;
 
 	len = *ring->sq.kring_entries * sizeof(struct io_uring_sqe);
-	ret = uring_madvise(ring->sq.sqes, len, MADV_DONTFORK);
+	ret = __sys_madvise(ring->sq.sqes, len, MADV_DONTFORK);
 	if (ret < 0)
 		return ret;
 
 	len = ring->sq.ring_sz;
-	ret = uring_madvise(ring->sq.ring_ptr, len, MADV_DONTFORK);
+	ret = __sys_madvise(ring->sq.ring_ptr, len, MADV_DONTFORK);
 	if (ret < 0)
 		return ret;
 
 	if (ring->cq.ring_ptr != ring->sq.ring_ptr) {
 		len = ring->cq.ring_sz;
-		ret = uring_madvise(ring->cq.ring_ptr, len, MADV_DONTFORK);
+		ret = __sys_madvise(ring->cq.ring_ptr, len, MADV_DONTFORK);
 		if (ret < 0)
 			return ret;
 	}
@@ -139,7 +139,7 @@ int io_uring_queue_init_params(unsigned entries, struct io_uring *ring,
 
 	ret = io_uring_queue_mmap(fd, p, ring);
 	if (ret) {
-		uring_close(fd);
+		__sys_close(fd);
 		return ret;
 	}
 
@@ -166,9 +166,9 @@ void io_uring_queue_exit(struct io_uring *ring)
 	struct io_uring_sq *sq = &ring->sq;
 	struct io_uring_cq *cq = &ring->cq;
 
-	uring_munmap(sq->sqes, *sq->kring_entries * sizeof(struct io_uring_sqe));
+	__sys_munmap(sq->sqes, *sq->kring_entries * sizeof(struct io_uring_sqe));
 	io_uring_unmap_rings(sq, cq);
-	uring_close(ring->ring_fd);
+	__sys_close(ring->ring_fd);
 }
 
 struct io_uring_probe *io_uring_get_probe_ring(struct io_uring *ring)
-- 
2.32.0


  parent reply	other threads:[~2022-02-11 15:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 15:57 [PATCH liburing v1 0/4] Refactor arch dependent code and x86-64 improvement Ammar Faizi
2022-02-11 15:57 ` [PATCH liburing v1 1/4] arch/generic: Create arch generic syscall wrappers Ammar Faizi
2022-02-11 15:57 ` [PATCH liburing v1 2/4] arch/x86, syscall: Refactor arch specific and " Ammar Faizi
2022-02-11 15:57 ` [PATCH liburing v1 3/4] lib.h: Split off lib header for arch specific and generic Ammar Faizi
2022-02-11 15:57 ` Ammar Faizi [this message]
2022-02-11 16:39 ` [PATCH liburing v1 0/4] Refactor arch dependent code and x86-64 improvement Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox