From bcc0c48e12cd604e918afc7d260bc8938d8778b0 Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Fri, 2 Feb 2024 08:47:14 +0100 Subject: [PATCH 1/2] nbft: fixup include for libnvme libnvme.h is from an external source, so use the correct include grammar. Signed-off-by: Daniel Wagner --- nbft.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nbft.c b/nbft.c index eb4c0a7ad4..f2201d8ab3 100644 --- a/nbft.c +++ b/nbft.c @@ -5,9 +5,10 @@ #include #include +#include + #include "nvme.h" #include "nbft.h" -#include "libnvme.h" #include "fabrics.h" #include "util/types.h" From 0560211a80cb640dbbcaa8b20dd2b289b3434486 Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Fri, 2 Feb 2024 08:48:21 +0100 Subject: [PATCH 2/2] nbft: do not issue an error if ACPI tables are missing Not all architectures have ACPI tables, e.g. riscv64. Thus the nbft code should fail gracefully if it's not present. Signed-off-by: Daniel Wagner --- nbft.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nbft.c b/nbft.c index f2201d8ab3..ff36119d22 100644 --- a/nbft.c +++ b/nbft.c @@ -10,6 +10,7 @@ #include "nvme.h" #include "nbft.h" #include "fabrics.h" +#include "nvme-print.h" #include "util/types.h" @@ -48,10 +49,8 @@ int read_nbft_files(struct list_head *nbft_list, char *path) struct nbft_info *nbft; count = scandir(path, &dent, nbft_filter, NULL); - if (count < 0) { - fprintf(stderr, "Failed to open %s.\n", path); - return -1; - } + if (count < 0) + return -errno; for (i = 0; i < count; i++) { snprintf(filename, sizeof(filename), "%s/%s", path, dent[i]->d_name); @@ -98,8 +97,11 @@ int discover_from_nbft(nvme_root_t r, char *hostnqn_arg, char *hostid_arg, list_head_init(&nbft_list); ret = read_nbft_files(&nbft_list, nbft_path); - if (ret) + if (ret) { + if (ret != ENOENT) + nvme_show_perror("Failed to access ACPI tables directory"); goto out_free_2; + } list_for_each(&nbft_list, entry, node) for (ss = entry->nbft->subsystem_ns_list; ss && *ss; ss++)