Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ jobs:
which git
git --version
git config --global --add safe.directory "$GITHUB_WORKSPACE"
scripts/build.sh -b release -c gcc
scripts/build.sh -b release -c /ucrt64/bin/gcc

- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: failure()
with:
name: windows-msys2-ucrt64-logs
path: |
.build-ci/meson-logs/*.txt
.build-ci/meson-logs/*.txt
3 changes: 0 additions & 3 deletions fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,9 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <time.h>
#include <unistd.h>

#include <linux/types.h>

#include <sys/stat.h>
#include <sys/types.h>

Expand Down
3 changes: 2 additions & 1 deletion libnvme/doc/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ api_files = [
'linux.h',
'mi.h',
'nbft.h',
'nvme-cmds.h',
'nvme-types.h',
'tree.h',
'types.h',
'util.h'
]

Expand Down
2 changes: 1 addition & 1 deletion libnvme/examples/discover-loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main()

libnvmf_default_config(&cfg);

ctx = libnvme_create_global_ctx(stdout, DEFAULT_LOGLEVEL);
ctx = libnvme_create_global_ctx(stdout, LIBNVME_DEFAULT_LOGLEVEL);
if (!ctx)
return 1;

Expand Down
2 changes: 1 addition & 1 deletion libnvme/examples/display-columnar.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main()
libnvme_ns_t n;
int err;

ctx = libnvme_create_global_ctx(stdout, DEFAULT_LOGLEVEL);
ctx = libnvme_create_global_ctx(stdout, LIBNVME_DEFAULT_LOGLEVEL);
if (!ctx)
return 1;

Expand Down
2 changes: 1 addition & 1 deletion libnvme/examples/display-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int main()
libnvme_ns_t n, _n;
int err;

ctx = libnvme_create_global_ctx(stdout, DEFAULT_LOGLEVEL);
ctx = libnvme_create_global_ctx(stdout, LIBNVME_DEFAULT_LOGLEVEL);
if (!ctx)
return 1;

Expand Down
68 changes: 35 additions & 33 deletions libnvme/examples/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -47,46 +47,48 @@ if want_fabrics
)
endif

executable(
'mi-mctp',
['mi-mctp.c'],
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
],
)

executable(
'mi-mctp-csi-test',
['mi-mctp-csi-test.c'],
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
threads_dep,
],
)
if want_mi
executable(
'mi-mctp',
['mi-mctp.c'],
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
],
)

executable(
'mi-mctp-ae',
['mi-mctp-ae.c'],
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
],
)
executable(
'mi-mctp-csi-test',
['mi-mctp-csi-test.c'],
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
threads_dep,
],
)

if libdbus_dep.found()
executable(
'mi-conf',
['mi-conf.c'],
'mi-mctp-ae',
['mi-mctp-ae.c'],
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
libdbus_dep,
],
)

if libdbus_dep.found()
executable(
'mi-conf',
['mi-conf.c'],
dependencies: [
config_dep,
ccan_dep,
libnvme_dep,
libdbus_dep,
],
)
endif
endif
2 changes: 1 addition & 1 deletion libnvme/examples/mi-conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ int main(int argc, char **argv)
if (rc)
errx(EXIT_FAILURE, "can't parse MI device string '%s'", devstr);

ctx = libnvme_create_global_ctx(stderr, DEFAULT_LOGLEVEL);
ctx = libnvme_create_global_ctx(stderr, LIBNVME_DEFAULT_LOGLEVEL);
if (!ctx)
err(EXIT_FAILURE, "can't create global context");

Expand Down
2 changes: 1 addition & 1 deletion libnvme/examples/mi-mctp-ae.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}

ctx = libnvme_create_global_ctx(stderr, DEFAULT_LOGLEVEL);
ctx = libnvme_create_global_ctx(stderr, LIBNVME_DEFAULT_LOGLEVEL);
if (!ctx)
err(EXIT_FAILURE, "can't create NVMe root");

Expand Down
2 changes: 1 addition & 1 deletion libnvme/examples/mi-mctp-csi-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}

ctx = libnvme_create_global_ctx(stderr, DEFAULT_LOGLEVEL);
ctx = libnvme_create_global_ctx(stderr, LIBNVME_DEFAULT_LOGLEVEL);
if (!ctx)
err(EXIT_FAILURE, "can't create NVMe root");

Expand Down
2 changes: 1 addition & 1 deletion libnvme/examples/mi-mctp.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ int main(int argc, char **argv)
}
libnvme_free_global_ctx(ctx);
} else {
ctx = libnvme_create_global_ctx(stderr, DEFAULT_LOGLEVEL);
ctx = libnvme_create_global_ctx(stderr, LIBNVME_DEFAULT_LOGLEVEL);
if (!ctx)
err(EXIT_FAILURE, "can't create NVMe root");

Expand Down
2 changes: 1 addition & 1 deletion libnvme/examples/telemetry-listen.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ int main()
libnvme_ctrl_t c;
libnvme_host_t h;

ctx = libnvme_create_global_ctx(stdout, DEFAULT_LOGLEVEL);
ctx = libnvme_create_global_ctx(stdout, LIBNVME_DEFAULT_LOGLEVEL);
if (!ctx)
return 1;

Expand Down
20 changes: 8 additions & 12 deletions libnvme/libnvme/nvme.i
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ struct libnvme_ns {
libnvme_global_ctx(const char *config_file = NULL) {
struct libnvme_global_ctx *ctx;

ctx = libnvme_create_global_ctx(stdout, DEFAULT_LOGLEVEL);
ctx = libnvme_create_global_ctx(stdout, LIBNVME_DEFAULT_LOGLEVEL);
if (!ctx)
return NULL;

Expand All @@ -507,15 +507,11 @@ struct libnvme_ns {
return $self;
}
void log_level(const char *level) {
int log_level = DEFAULT_LOGLEVEL;
if (!strcmp(level, "debug")) log_level = LOG_DEBUG;
else if (!strcmp(level, "info")) log_level = LOG_INFO;
else if (!strcmp(level, "notice")) log_level = LOG_NOTICE;
else if (!strcmp(level, "warning")) log_level = LOG_WARNING;
else if (!strcmp(level, "err")) log_level = LOG_ERR;
else if (!strcmp(level, "crit")) log_level = LOG_CRIT;
else if (!strcmp(level, "alert")) log_level = LOG_ALERT;
else if (!strcmp(level, "emerg")) log_level = LOG_EMERG;
int log_level = LIBNVME_DEFAULT_LOGLEVEL;
if (!strcmp(level, "debug")) log_level = LIBNVME_LOG_DEBUG;
else if (!strcmp(level, "info")) log_level = LIBNVME_LOG_INFO;
else if (!strcmp(level, "warning")) log_level = LIBNVME_LOG_WARN;
else if (!strcmp(level, "err")) log_level = LIBNVME_LOG_ERR;
libnvme_set_logging_level($self, log_level, false, false);
}
%pythoncode %{
Expand Down Expand Up @@ -1242,12 +1238,12 @@ struct libnvme_ns {
"@param filename: file to read") nbft_get;
PyObject *nbft_get(struct libnvme_global_ctx *ctx, const char * filename);

// We want to swig all the #define and enum from types.h, but none of the structs.
// We want to swig all the #define and enum from nvme-types.h, but none of the structs.
#pragma SWIG nowarn=503 // Supress warnings about unnamed struct
#define __attribute__(x)
%rename($ignore, %$isclass) ""; // ignore all classes/structs
%rename($ignore, %$isfunction) ""; // ignore all functions
%rename($ignore, %$isunion) ""; // ignore all unions
%rename($ignore, %$isvariable) ""; // ignore all variables

%include "../src/nvme/types.h"
%include "../src/nvme/nvme-types.h"
2 changes: 1 addition & 1 deletion libnvme/libnvme/tests/test-objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_refresh_topology_does_not_raise(self):

def test_log_level_all_valid_levels(self):
ctx = nvme.global_ctx()
for level in ('debug', 'info', 'notice', 'warning', 'err', 'crit', 'alert', 'emerg'):
for level in ('debug', 'info', 'warning', 'err'):
with self.subTest(level=level):
ctx.log_level(level)

Expand Down
4 changes: 2 additions & 2 deletions libnvme/src/libnvme-mi.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ extern "C" {
#endif

#include <nvme/lib.h>
#include <nvme/types.h>
#include <nvme/cmds.h>
#include <nvme/mi.h>
#include <nvme/nvme-types.h>
#include <nvme/nvme-cmds.h>

#ifdef __cplusplus
}
Expand Down
7 changes: 4 additions & 3 deletions libnvme/src/libnvme.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@
extern "C" {
#endif

#include <nvme/cmds.h>
@FABRICS_INCLUDE@
#include <nvme/accessors.h>
#include <nvme/filters.h>
#include <nvme/ioctl.h>
#include <nvme/lib-types.h>
#include <nvme/lib.h>
#include <nvme/linux.h>
#include <nvme/nvme-cmds.h>
#include <nvme/nvme-types.h>
#include <nvme/tree.h>
#include <nvme/types.h>
#include <nvme/util.h>
#include <nvme/accessors.h>
@FABRICS_INCLUDE@

#ifdef __cplusplus
}
Expand Down
42 changes: 30 additions & 12 deletions libnvme/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,28 @@ else
sources += [
'nvme/accessors.c',
'nvme/base64.c',
'nvme/cmds.c',
'nvme/crc32.c',
'nvme/filters.c',
'nvme/ioctl.c',
'nvme/lib.c',
'nvme/linux.c',
'nvme/log.c',
'nvme/mi-mctp.c',
'nvme/mi.c',
'nvme/nvme-cmds.c',
'nvme/sysfs.c',
'nvme/tree.c',
'nvme/util.c',
]
endif
headers = [
'nvme/accessors.h',
'nvme/cmds.h',
'nvme/endian.h',
'nvme/filters.h',
'nvme/ioctl.h',
'nvme/lib-types.h',
'nvme/lib.h',
'nvme/linux.h',
'nvme/mi-types.h',
'nvme/mi.h',
'nvme/nvme-cmds.h',
'nvme/nvme-types.h',
'nvme/tree.h',
'nvme/types.h',
'nvme/util.h',
Expand All @@ -54,8 +52,25 @@ if want_fabrics
]
endif

if want_mi
sources += [
'nvme/mi-mctp.c',
'nvme/mi.c',
]
headers += [
'nvme/mi-types.h',
'nvme/mi.h',
]
else
sources += [
'nvme/no-mi.c'
]
endif

if liburing_dep.found()
sources += 'nvme/uring.c'
else
sources += 'nvme/no-uring.c'
endif

if host_system != 'windows'
Expand Down Expand Up @@ -156,14 +171,17 @@ libnvme_test_dep = declare_dependency(
)

mode = 'rw-r--r--'
install_headers(
[
'libnvme-mi.h',
],
install_mode: mode,
)
install_headers(
headers,
subdir: 'nvme',
install_mode: mode,
)
if want_mi
install_headers(
[
'libnvme-mi.h',
],
install_mode: mode,
)
endif

2 changes: 1 addition & 1 deletion libnvme/src/nvme/accessors-fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "accessors-fabrics.h"

#include "private-fabrics.h"
#include "compiler_attributes.h"
#include "compiler-attributes.h"

/****************************************************************************
* Accessors for: struct libnvmf_discovery_args
Expand Down
3 changes: 2 additions & 1 deletion libnvme/src/nvme/accessors-fabrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <linux/types.h> /* __u32, __u64, etc. */

#include <nvme/types.h>

/* Forward declarations. These are internal (opaque) structs. */
struct libnvmf_discovery_args;
Expand Down
2 changes: 1 addition & 1 deletion libnvme/src/nvme/accessors.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "accessors.h"

#include "private.h"
#include "compiler_attributes.h"
#include "compiler-attributes.h"

/****************************************************************************
* Accessors for: struct libnvme_path
Expand Down
Loading
Loading