Skip to content

Commit

Permalink
Hide io_uring_get_sqe symbol
Browse files Browse the repository at this point in the history
The user-facing API for liburing has the user interface with
io_uring_get_sqe via a static inline function. However, this function
is also defined in the plain liburing archive, which can potential lead
to ODR violations.

We instead define it properly only for the liburing-ffi case and keep
it hidden when the liburing archive itself is built.

Signed-off-by: Christian Mazakas <[email protected]>
  • Loading branch information
cmazakas committed Jan 27, 2025
1 parent 6c509e2 commit 659c390
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion debian/liburing2.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ liburing.so.2 liburing2 #MINVER#
io_uring_get_events@LIBURING_2.3 0.7-1
io_uring_get_probe@LIBURING_2.0 0.7-1
io_uring_get_probe_ring@LIBURING_2.0 0.7-1
io_uring_get_sqe@LIBURING_2.0 0.7-1
io_uring_mlock_size@LIBURING_2.1 0.7-1
io_uring_mlock_size_params@LIBURING_2.1 0.7-1
io_uring_peek_batch_cqe@LIBURING_2.0 0.7-1
Expand Down
5 changes: 5 additions & 0 deletions src/ffi.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

#include "liburing.h"

struct io_uring_sqe *io_uring_get_sqe(struct io_uring *ring)
{
return _io_uring_get_sqe(ring);
}

#ifdef __clang__
#pragma clang diagnostic pop
#endif
2 changes: 0 additions & 2 deletions src/include/liburing.h
Original file line number Diff line number Diff line change
Expand Up @@ -1624,8 +1624,6 @@ IOURINGINLINE struct io_uring_sqe *io_uring_get_sqe(struct io_uring *ring)
{
return _io_uring_get_sqe(ring);
}
#else
struct io_uring_sqe *io_uring_get_sqe(struct io_uring *ring);
#endif

ssize_t io_uring_mlock_size(unsigned entries, unsigned flags);
Expand Down
1 change: 0 additions & 1 deletion src/liburing.map
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ LIBURING_2.0 {
io_uring_get_probe;
io_uring_get_probe_ring;
io_uring_free_probe;
io_uring_get_sqe;
io_uring_peek_batch_cqe;
io_uring_queue_exit;
io_uring_queue_init;
Expand Down
4 changes: 3 additions & 1 deletion src/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "liburing/sanitize.h"
#include "liburing/io_uring.h"

static struct io_uring_sqe *io_uring_get_sqe(struct io_uring *ring);

/*
* Returns true if we're not using SQ thread (thus nobody submits but us)
* or if IORING_SQ_NEED_WAKEUP is set, so submit thread must be explicitly
Expand Down Expand Up @@ -468,7 +470,7 @@ int io_uring_submit_and_get_events(struct io_uring *ring)
}

#ifdef LIBURING_INTERNAL
struct io_uring_sqe *io_uring_get_sqe(struct io_uring *ring)
static struct io_uring_sqe *io_uring_get_sqe(struct io_uring *ring)
{
return _io_uring_get_sqe(ring);
}
Expand Down

0 comments on commit 659c390

Please sign in to comment.