summaryrefslogtreecommitdiffstats
path: root/nbft.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-19 10:45:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-19 10:45:45 +0000
commit476d0b41d27c48140ec2284a5a5f505e8423fe65 (patch)
tree369a4a0f5ba4b1e66dc22bcb107b1825fa15c247 /nbft.c
parentReleasing debian version 2.7.1-1. (diff)
downloadnvme-cli-476d0b41d27c48140ec2284a5a5f505e8423fe65.tar.xz
nvme-cli-476d0b41d27c48140ec2284a5a5f505e8423fe65.zip
Merging upstream version 2.8.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'nbft.c')
-rw-r--r--nbft.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/nbft.c b/nbft.c
index e46e9d3..ff36119 100644
--- a/nbft.c
+++ b/nbft.c
@@ -5,10 +5,12 @@
#include <fnmatch.h>
#include <stdlib.h>
+#include <libnvme.h>
+
#include "nvme.h"
#include "nbft.h"
-#include "libnvme.h"
#include "fabrics.h"
+#include "nvme-print.h"
#include "util/types.h"
@@ -47,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);
@@ -97,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++)
@@ -164,7 +167,7 @@ int discover_from_nbft(nvme_root_t r, char *hostnqn_arg, char *hostid_arg,
* obtains a different local IP address than the
* firmware had. Retry without host_traddr.
*/
- if (ret == -1 && errno == ENVME_CONNECT_WRITE &&
+ if (ret == -1 && errno == ENVME_CONNECT_ADDRNOTAVAIL &&
!strcmp((*ss)->transport, "tcp") &&
strlen(hfi->tcp_info.dhcp_server_ipaddr) > 0) {
nvme_free_ctrl(c);