Skip to content

Commit 6dbd8e2

Browse files
committed
uring: move no-uring implementation into C file
Keep header files readable by avoiding static inline dummy function implementations. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 27df50a commit 6dbd8e2

3 files changed

Lines changed: 41 additions & 30 deletions

File tree

libnvme/src/meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ endif
5656

5757
if liburing_dep.found()
5858
sources += 'nvme/uring.c'
59+
else
60+
sources += 'nvme/no-uring.c'
5961
endif
6062

6163
if host_system != 'windows'

libnvme/src/nvme/no-uring.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// SPDX-License-Identifier: LGPL-2.1-or-later
2+
/*
3+
* This file is part of libnvme.
4+
* Copyright (c) 2026 SUSE Software Solutions
5+
*
6+
* Authors: Daniel Wagner <[email protected]>
7+
*/
8+
9+
10+
#include <errno.h>
11+
12+
#include <libnvme.h>
13+
14+
#include "private.h"
15+
16+
int libnvme_open_uring(struct libnvme_global_ctx *ctx)
17+
{
18+
return -ENOTSUP;
19+
}
20+
void libnvme_close_uring(struct libnvme_global_ctx *ctx)
21+
{
22+
}
23+
24+
int __libnvme_transport_handle_open_uring(struct libnvme_transport_handle *hdl)
25+
{
26+
hdl->ctx->uring_state = LIBNVME_IO_URING_STATE_NOT_AVAILABLE;
27+
return -ENOTSUP;
28+
}
29+
30+
int libnvme_submit_admin_passthru_async(struct libnvme_transport_handle *hdl,
31+
struct libnvme_passthru_cmd *cmd)
32+
{
33+
return -ENOTSUP;
34+
}
35+
36+
int libnvme_wait_complete_passthru(struct libnvme_transport_handle *hdl)
37+
{
38+
return -ENOTSUP;
39+
}

libnvme/src/nvme/private.h

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88
#pragma once
99

10-
#include <errno.h>
1110
#include <ifaddrs.h>
1211
#include <poll.h>
1312

@@ -743,39 +742,10 @@ void libnvme_ns_release_transport_handle(libnvme_ns_t n);
743742
int libnvme_mi_admin_admin_passthru(struct libnvme_transport_handle *hdl,
744743
struct libnvme_passthru_cmd *cmd);
745744

746-
#ifdef CONFIG_LIBURING
747745
int libnvme_open_uring(struct libnvme_global_ctx *ctx);
748746
void libnvme_close_uring(struct libnvme_global_ctx *ctx);
749747
int __libnvme_transport_handle_open_uring(struct libnvme_transport_handle *hdl);
750748
int libnvme_submit_admin_passthru_async(struct libnvme_transport_handle *hdl,
751749
struct libnvme_passthru_cmd *cmd);
752750
int libnvme_wait_complete_passthru(struct libnvme_transport_handle *hdl);
753-
#else
754-
static inline int
755-
libnvme_open_uring(struct libnvme_global_ctx *ctx)
756-
{
757-
return -ENOTSUP;
758-
}
759-
static inline void
760-
libnvme_close_uring(struct libnvme_global_ctx *ctx)
761-
{
762-
}
763-
static inline int
764-
__libnvme_transport_handle_open_uring(struct libnvme_transport_handle *hdl)
765-
{
766-
hdl->ctx->uring_state = LIBNVME_IO_URING_STATE_NOT_AVAILABLE;
767-
return -ENOTSUP;
768-
}
769-
static inline int
770-
libnvme_submit_admin_passthru_async(struct libnvme_transport_handle *hdl,
771-
struct libnvme_passthru_cmd *cmd)
772-
{
773-
return -ENOTSUP;
774-
}
775-
static inline int
776-
libnvme_wait_complete_passthru(struct libnvme_transport_handle *hdl)
777-
{
778-
return -ENOTSUP;
779-
}
780-
#endif
781751

0 commit comments

Comments
 (0)