Skip to content

Commit a1b498f

Browse files
bgoing-micron-ossigaw
authored andcommitted
mi: fix build with MI support disabled
MI support was made optional, but building with mi=disabled currently fails. Fixed build issues and made inclusion of Linux-specific code in private-mi.h conditional on CONFIG_MI. Signed-off-by: Broc Going <[email protected]>
1 parent 6d68ddc commit a1b498f

3 files changed

Lines changed: 29 additions & 21 deletions

File tree

libnvme/src/nvme/no-mi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
#include <libnvme.h>
1212

13-
const char *libnvme_mi_status_to_string(int status)
13+
#include "compiler-attributes.h"
14+
15+
__public const char *libnvme_mi_status_to_string(int status)
1416
{
1517
return "MI support disabled";
1618
}

libnvme/src/nvme/private-mi.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#pragma once
1010

11+
#ifdef CONFIG_MI
12+
1113
#include <poll.h>
1214
#include <stdbool.h>
1315
#include <stddef.h>
@@ -116,6 +118,8 @@ void __libnvme_mi_mctp_set_ops(const struct __mi_mctp_socket_ops *newops);
116118
*/
117119
#define LIBNVME_QUIRK_CSI_1_NOT_SUPPORTED (1 << 1)
118120

121+
#endif
122+
119123
int __libnvme_transport_handle_open_mi(struct libnvme_transport_handle *hdl,
120124
const char *devname);
121125
int __libnvme_transport_handle_init_mi(struct libnvme_transport_handle *hdl);

libnvme/test/meson.build

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -77,29 +77,31 @@ zns = executable(
7777
],
7878
)
7979

80-
mi = executable(
81-
'test-mi',
82-
['mi.c', 'utils.c'],
83-
dependencies: [
84-
config_dep,
85-
ccan_dep,
86-
libnvme_test_dep,
87-
],
88-
)
80+
if want_mi
81+
mi = executable(
82+
'test-mi',
83+
['mi.c', 'utils.c'],
84+
dependencies: [
85+
config_dep,
86+
ccan_dep,
87+
libnvme_test_dep,
88+
],
89+
)
8990

90-
test('libnvme - mi', mi)
91+
test('libnvme - mi', mi)
9192

92-
mi_mctp = executable(
93-
'test-mi-mctp',
94-
['mi-mctp.c', 'utils.c'],
95-
dependencies: [
96-
config_dep,
97-
ccan_dep,
98-
libnvme_test_dep,
99-
],
100-
)
93+
mi_mctp = executable(
94+
'test-mi-mctp',
95+
['mi-mctp.c', 'utils.c'],
96+
dependencies: [
97+
config_dep,
98+
ccan_dep,
99+
libnvme_test_dep,
100+
],
101+
)
101102

102-
test('libnvme - mi-mctp', mi_mctp)
103+
test('libnvme - mi-mctp', mi_mctp)
104+
endif
103105

104106
uuid = executable(
105107
'test-uuid',

0 commit comments

Comments
 (0)