public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH liburing] liburing.h: Only use `IOURINGINLINE` macro for FFI functions
@ 2025-06-30 20:36 Ammar Faizi
  2025-06-30 20:41 ` Alviro Iskandar Setiawan
  2025-06-30 21:39 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Ammar Faizi @ 2025-06-30 20:36 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Ammar Faizi, io-uring Mailing List, GNU/Weeb Mailing List,
	Linux Kernel Mailing List, Christian Mazakas,
	Alviro Iskandar Setiawan

From: Ammar Faizi <ammarfaizi2@gnuweeb.org>

These 3 inline functions are for liburing internal use, it does not
make much sense to export them:

  uring_ptr_to_u64
  io_uring_cqe_iter_init
  io_uring_cqe_iter_next

Don't use IOURINGINLINE on them. Also, add a comment on the
IOURINGINLINE macro definition explaining when to use IOURINGINLINE
and remind the reader to add the exported function to liburing-ffi.map
if they introduce a function marked with IOURINGINLINE.

Cc: Christian Mazakas <christian.mazakas@gmail.com>
Cc: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
---
 src/include/liburing.h | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/include/liburing.h b/src/include/liburing.h
index 35d2b271b546..3948a5a6ed47 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -28,6 +28,13 @@
 #define uring_likely(cond)	__builtin_expect(!!(cond), 1)
 #endif
 
+/*
+ * NOTE: Only use IOURINGINLINE macro for 'static inline' functions
+ *       that are expected to be available in the FFI bindings.
+ *
+ *       Functions that are marked as IOURINGINLINE should be
+ *       included in the liburing-ffi.map file.
+ */
 #ifndef IOURINGINLINE
 #define IOURINGINLINE static inline
 #endif
@@ -146,7 +153,7 @@ struct io_uring_zcrx_rq {
  * Library interface
  */
 
-IOURINGINLINE __u64 uring_ptr_to_u64(const void *ptr)
+static inline __u64 uring_ptr_to_u64(const void *ptr)
 {
 	return (__u64) (unsigned long) ptr;
 }
@@ -360,7 +367,7 @@ struct io_uring_cqe_iter {
 	unsigned tail;
 };
 
-IOURINGINLINE struct io_uring_cqe_iter
+static inline struct io_uring_cqe_iter
 io_uring_cqe_iter_init(const struct io_uring *ring)
 {
 	return (struct io_uring_cqe_iter) {
@@ -373,7 +380,7 @@ io_uring_cqe_iter_init(const struct io_uring *ring)
 	};
 }
 
-IOURINGINLINE bool io_uring_cqe_iter_next(struct io_uring_cqe_iter *iter,
+static inline bool io_uring_cqe_iter_next(struct io_uring_cqe_iter *iter,
 					  struct io_uring_cqe **cqe)
 {
 	if (iter->head == iter->tail)
-- 
Ammar Faizi


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH liburing] liburing.h: Only use `IOURINGINLINE` macro for FFI functions
  2025-06-30 20:36 [PATCH liburing] liburing.h: Only use `IOURINGINLINE` macro for FFI functions Ammar Faizi
@ 2025-06-30 20:41 ` Alviro Iskandar Setiawan
  2025-06-30 21:39 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Alviro Iskandar Setiawan @ 2025-06-30 20:41 UTC (permalink / raw)
  To: Ammar Faizi
  Cc: Jens Axboe, io-uring Mailing List, GNU/Weeb Mailing List,
	Linux Kernel Mailing List, Christian Mazakas

On Tue, Jul 1, 2025 at 3:36 AM Ammar Faizi wrote:
> These 3 inline functions are for liburing internal use, it does not
> make much sense to export them:
>
>   uring_ptr_to_u64
>   io_uring_cqe_iter_init
>   io_uring_cqe_iter_next
>
> Don't use IOURINGINLINE on them. Also, add a comment on the
> IOURINGINLINE macro definition explaining when to use IOURINGINLINE
> and remind the reader to add the exported function to liburing-ffi.map
> if they introduce a function marked with IOURINGINLINE.
>
> Cc: Christian Mazakas <christian.mazakas@gmail.com>
> Cc: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
> Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>

Reviewed-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH liburing] liburing.h: Only use `IOURINGINLINE` macro for FFI functions
  2025-06-30 20:36 [PATCH liburing] liburing.h: Only use `IOURINGINLINE` macro for FFI functions Ammar Faizi
  2025-06-30 20:41 ` Alviro Iskandar Setiawan
@ 2025-06-30 21:39 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2025-06-30 21:39 UTC (permalink / raw)
  To: Ammar Faizi
  Cc: io-uring Mailing List, GNU/Weeb Mailing List,
	Linux Kernel Mailing List, Christian Mazakas,
	Alviro Iskandar Setiawan


On Tue, 01 Jul 2025 03:36:40 +0700, Ammar Faizi wrote:
> These 3 inline functions are for liburing internal use, it does not
> make much sense to export them:
> 
>   uring_ptr_to_u64
>   io_uring_cqe_iter_init
>   io_uring_cqe_iter_next
> 
> [...]

Applied, thanks!

[1/1] liburing.h: Only use `IOURINGINLINE` macro for FFI functions
      commit: fe1fc8c0516954d345ee5f7613b8e4740b69b9c1

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-30 21:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-30 20:36 [PATCH liburing] liburing.h: Only use `IOURINGINLINE` macro for FFI functions Ammar Faizi
2025-06-30 20:41 ` Alviro Iskandar Setiawan
2025-06-30 21:39 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox