Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
36a2097
src: use standard lookup for libnvme include
igaw Feb 27, 2026
747030b
ioctl: use correct defines for set_features field encode
igaw Feb 25, 2026
960c1bc
test: add header include test
igaw Mar 3, 2026
2a1fb44
libnvme: include main headers where possible
igaw Feb 25, 2026
6794c3c
libnvme: drop a few unused headers
igaw Feb 25, 2026
d3a745a
nvme: use nvme_ns_rescan instead open coding
igaw Feb 27, 2026
e7d0340
ioctl: make IOCTL defines private
igaw Feb 27, 2026
156651d
ioctl: always define the passthru data structs
igaw Feb 27, 2026
dd0a2ee
cmds: move command function to their own header
igaw Feb 27, 2026
94a0cab
build: sort install_headers alphabetically
igaw Mar 3, 2026
fe92102
cmds: move nvme commands to cmds header
igaw Mar 3, 2026
7eed503
linux: reduce the number of includes
igaw Mar 3, 2026
f42773a
cmds: move nvme cmds from util to cmds.h or types.h
igaw Mar 3, 2026
1be23ca
tree: reduce the number of includes
igaw Mar 3, 2026
765a0b0
nbft: include nvme/types.h instead nvme/util.h
igaw Mar 3, 2026
32e92c0
crc32: add spdx license tag
igaw Mar 3, 2026
d19ada7
base64: update spdx tag
igaw Mar 3, 2026
c871d9c
log: drop the tree.h header include
igaw Mar 4, 2026
7109dd3
mi: drop the types.h include
igaw Mar 4, 2026
09e5401
lib: move library definition into new headers
igaw Mar 4, 2026
5ccb672
util: move functions into private header
igaw Mar 4, 2026
0a22a79
log: move logging definition to lib.h
igaw Mar 4, 2026
42c9c1f
tree: move nvme_ns_*_transport_handle to private header
igaw Mar 4, 2026
2bdc5e8
mi: replace nvme_mi_*global_context with nvme_*_global_context
igaw Mar 4, 2026
6cff1af
mi: make nvme_mi_admin_admin_passthru private
igaw Mar 4, 2026
6678fd6
lib-types: move struct nvme_passthrue_cmd up
igaw Mar 4, 2026
d65a794
fabrics: rename nvme_free_uri to nvmf_free_uri
igaw Mar 4, 2026
cd87fad
cmds: avoid possible infinite loop
igaw Mar 4, 2026
c79a59d
cmds: free id_ctrl after use in nvme_get_telemetry_max
igaw Mar 4, 2026
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
1 change: 0 additions & 1 deletion libnvme/doc/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ api_files = [
'filters.h',
'ioctl.h',
'linux.h',
'log.h',
'mi.h',
'nbft.h',
'tree.h',
Expand Down
4 changes: 2 additions & 2 deletions libnvme/examples/mi-mctp-ae.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}

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

Expand Down Expand Up @@ -173,7 +173,7 @@ int main(int argc, char **argv)
//Cleanup
nvme_mi_aem_disable(ep);
nvme_mi_close(ep);
nvme_mi_free_global_ctx(ctx);
nvme_free_global_ctx(ctx);

return rc ? EXIT_FAILURE : EXIT_SUCCESS;
}
Expand Down
4 changes: 2 additions & 2 deletions libnvme/examples/mi-mctp-csi-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}

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

rc = do_action_endpoint(action, ctx, net, eid, argc, argv);
nvme_mi_free_global_ctx(ctx);
nvme_free_global_ctx(ctx);

return rc ? EXIT_FAILURE : EXIT_SUCCESS;
}
Expand Down
6 changes: 3 additions & 3 deletions libnvme/examples/mi-mctp.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,9 +846,9 @@ int main(int argc, char **argv)
printf("---\n");
free(desc);
}
nvme_mi_free_global_ctx(ctx);
nvme_free_global_ctx(ctx);
} else {
ctx = nvme_mi_create_global_ctx(stderr, DEFAULT_LOGLEVEL);
ctx = nvme_create_global_ctx(stderr, DEFAULT_LOGLEVEL);
if (!ctx)
err(EXIT_FAILURE, "can't create NVMe root");

Expand All @@ -857,7 +857,7 @@ int main(int argc, char **argv)
errx(EXIT_FAILURE, "can't open MCTP endpoint %d:%d", net, eid);
rc = do_action_endpoint(action, ep, argc, argv);
nvme_mi_close(ep);
nvme_mi_free_global_ctx(ctx);
nvme_free_global_ctx(ctx);
}

return rc ? EXIT_FAILURE : EXIT_SUCCESS;
Expand Down
9 changes: 2 additions & 7 deletions libnvme/libnvme/nvme.i
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,8 @@
%{
#include <ccan/list/list.h>
#include <ccan/endian/endian.h>
#include "nvme/tree.h"
#include "nvme/fabrics.h"
#include <libnvme.h>
#include "nvme/private.h"
#include "nvme/log.h"
#include "nvme/ioctl.h"
#include "nvme/types.h"
#include "nvme/nbft.h"

static int connect_err = 0;
static int discover_err = 0;
Expand Down Expand Up @@ -515,7 +510,7 @@ struct nvme_ns {
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;
nvme_init_logging($self, log_level, false, false);
nvme_set_logging_level($self, log_level, false, false);
}
%pythoncode %{
def hosts(self):
Expand Down
3 changes: 2 additions & 1 deletion libnvme/src/libnvme-mi.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
extern "C" {
#endif

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

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

#include <nvme/types.h>
#include <nvme/linux.h>
#include <nvme/ioctl.h>
#include <nvme/nbft.h>
#include <nvme/cmds.h>
#include <nvme/fabrics.h>
#include <nvme/filters.h>
#include <nvme/ioctl.h>
#include <nvme/lib-types.h>
#include <nvme/lib.h>
#include <nvme/linux.h>
#include <nvme/nbft.h>
#include <nvme/tree.h>
#include <nvme/types.h>
#include <nvme/util.h>
#include <nvme/log.h>

#ifdef __cplusplus
}
Expand Down
11 changes: 4 additions & 7 deletions libnvme/src/libnvme.ld
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ LIBNVME_2_0 {
nvme_free_host;
nvme_free_ns;
nvme_free_subsystem;
nvme_free_uri;
nvme_fw_download_seq;
nvme_gen_dhchap_key;
nvme_generate_tls_key_identity;
Expand All @@ -85,6 +84,7 @@ LIBNVME_2_0 {
nvme_get_feature_length;
nvme_get_host_telemetry;
nvme_get_log;
nvme_get_logging_level;
nvme_get_logical_block_size;
nvme_get_new_host_telemetry;
nvme_get_ns_attr;
Expand Down Expand Up @@ -117,14 +117,11 @@ LIBNVME_2_0 {
nvme_init_ctrl;
nvme_init_ctrl_list;
nvme_init_dsm_range;
nvme_init_logging;
nvme_insert_tls_key;
nvme_insert_tls_key_compat;
nvme_insert_tls_key_versioned;
nvme_ipaddrs_eq;
nvme_lookup_key;
nvme_lookup_keyring;
nvme_mi_admin_admin_passthru;
nvme_mi_admin_xfer;
nvme_mi_aem_disable;
nvme_mi_aem_enable;
Expand Down Expand Up @@ -158,7 +155,6 @@ LIBNVME_2_0 {
nvme_mi_scan_ep;
nvme_mi_scan_mctp;
nvme_mi_set_csi;
nvme_mi_set_probe_enabled;
nvme_mi_status_to_string;
nvme_mi_submit_entry;
nvme_mi_submit_exit;
Expand Down Expand Up @@ -190,11 +186,9 @@ LIBNVME_2_0 {
nvme_ns_get_serial;
nvme_ns_get_subsystem;
nvme_ns_get_sysfs_dir;
nvme_ns_get_transport_handle;
nvme_ns_get_uuid;
nvme_ns_identify;
nvme_ns_read;
nvme_ns_release_transport_handle;
nvme_ns_rescan;
nvme_ns_verify;
nvme_ns_write;
Expand Down Expand Up @@ -231,6 +225,8 @@ LIBNVME_2_0 {
nvme_set_etdas;
nvme_set_ioctl_probing;
nvme_set_keyring;
nvme_set_logging_level;
nvme_set_probe_enabled;
nvme_set_property;
nvme_set_root;
nvme_skip_namespaces;
Expand Down Expand Up @@ -323,6 +319,7 @@ LIBNVME_2_0 {
nvmf_discovery_nbft;
nvmf_eflags_str;
nvmf_exat_ptr_next;
nvmf_free_uri;
nvmf_get_default_trsvcid;
nvmf_get_discovery_log;
nvmf_get_discovery_wargs;
Expand Down
8 changes: 6 additions & 2 deletions libnvme/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
#
sources = [
'nvme/base64.c',
'nvme/cmds.c',
'nvme/crc32.c',
'nvme/fabrics.c',
'nvme/filters.c',
'nvme/ioctl.c',
'nvme/lib.c',
'nvme/linux.c',
'nvme/log.c',
'nvme/mi-mctp.c',
Expand Down Expand Up @@ -96,16 +98,18 @@ install_headers(
)
install_headers(
[
'nvme/cmds.h',
'nvme/fabrics.h',
'nvme/filters.h',
'nvme/ioctl.h',
'nvme/lib-types.h',
'nvme/lib.h',
'nvme/linux.h',
'nvme/log.h',
'nvme/mi.h',
'nvme/nbft.h',
'nvme/tree.h',
'nvme/types.h',
'nvme/util.h',
'nvme/mi.h',
],
subdir: 'nvme',
install_mode: mode,
Expand Down
3 changes: 1 addition & 2 deletions libnvme/src/nvme/base64.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-License-Identifier: LGPL-2.1-or-later
/*
* base64.c - RFC4648-compliant base64 encoding
*
Expand All @@ -8,7 +8,6 @@
*/

#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
Expand Down
10 changes: 5 additions & 5 deletions libnvme/src/nvme/base64.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef _BASE64_H
#define _BASE64_H
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* This file is part of libnvme.
*/
#pragma once

int base64_encode(const unsigned char *src, int len, char *dst);
int base64_decode(const char *src, int len, unsigned char *dst);

#endif /* _BASE64_H */
2 changes: 1 addition & 1 deletion libnvme/src/nvme/cleanup.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static inline DEFINE_CLEANUP_FUNC(cleanup_addrinfo, struct addrinfo *, freeaddri
static inline void free_uri(struct nvme_fabrics_uri **uri)
{
if (*uri)
nvme_free_uri(*uri);
nvmf_free_uri(*uri);
}
#define _cleanup_uri_ __cleanup__(free_uri)

Expand Down
Loading