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
6 changes: 3 additions & 3 deletions fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@

fd = open(raw, O_CREAT | O_RDWR | O_TRUNC, 0600);
if (fd < 0) {
fprintf(stderr, "failed to open %s: %s\n", raw, strerror(errno));
fprintf(stderr, "failed to open %s: %s\n", raw, nvme_strerror(errno));

Check failure on line 155 in fabrics.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 86 exceeds 80 columns
return;
}

Expand All @@ -161,7 +161,7 @@
ret = write(fd, log, len);
if (ret < 0)
fprintf(stderr, "failed to write to %s: %s\n",
raw, strerror(errno));
raw, nvme_strerror(errno));
else
printf("Discovery log is saved to %s\n", raw);

Expand All @@ -183,7 +183,7 @@
void *user_data)
{
if (err == -EAGAIN || (err == -EINTR && !nvme_sigint_received)) {
print_debug("nvmf_add_ctrl returned '%s'\n", strerror(-err));
print_debug("nvmf_add_ctrl returned '%s'\n", nvme_strerror(-err));

Check failure on line 186 in fabrics.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 82 exceeds 80 columns
return true;
}

Expand Down
17 changes: 10 additions & 7 deletions libnvme/src/nvme/fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ static int __nvmf_supported_options(struct nvme_global_ctx *ctx)
fd = open(nvmf_dev, O_RDONLY);
if (fd < 0) {
nvme_msg(ctx, LOG_ERR, "Failed to open %s: %s\n",
nvmf_dev, strerror(errno));
nvmf_dev, nvme_strerror(errno));
return -ENVME_CONNECT_OPEN;
}

Expand All @@ -866,7 +866,7 @@ static int __nvmf_supported_options(struct nvme_global_ctx *ctx)
}

nvme_msg(ctx, LOG_ERR, "Failed to read from %s: %s\n",
nvmf_dev, strerror(errno));
nvmf_dev, nvme_strerror(errno));
return -ENVME_CONNECT_READ;
}

Expand Down Expand Up @@ -927,7 +927,7 @@ static int __nvmf_add_ctrl(struct nvme_global_ctx *ctx, const char *argstr)
fd = open(nvmf_dev, O_RDWR);
if (fd < 0) {
nvme_msg(ctx, LOG_ERR, "Failed to open %s: %s\n",
nvmf_dev, strerror(errno));
nvmf_dev, nvme_strerror(errno));
return -ENVME_CONNECT_OPEN;
}

Expand All @@ -936,7 +936,7 @@ static int __nvmf_add_ctrl(struct nvme_global_ctx *ctx, const char *argstr)
ret = write(fd, argstr, len);
if (ret != len) {
nvme_msg(ctx, LOG_INFO, "Failed to write to %s: %s\n",
nvmf_dev, strerror(errno));
nvmf_dev, nvme_strerror(errno));
switch (errno) {
case EALREADY:
return -ENVME_CONNECT_ALREADY;
Expand All @@ -963,7 +963,7 @@ static int __nvmf_add_ctrl(struct nvme_global_ctx *ctx, const char *argstr)
len = read(fd, buf, sizeof(buf) - 1);
if (len < 0) {
nvme_msg(ctx, LOG_ERR, "Failed to read from %s: %s\n",
nvmf_dev, strerror(errno));
nvmf_dev, nvme_strerror(errno));
return -ENVME_CONNECT_READ;
}
nvme_msg(ctx, LOG_DEBUG, "connect ctrl, response '%.*s'\n",
Expand Down Expand Up @@ -1793,9 +1793,12 @@ static int nvmf_dim(nvme_ctrl_t c, enum nvmf_dim_tas tas, __u8 trtype,
MIN(sizeof(dim->eid), strlen(c->s->h->hostnqn)));

ret = get_entity_name(dim->ename, sizeof(dim->ename));
if (ret <= 0)
if (ret < 0)
nvme_msg(ctx, LOG_INFO, "%s: Failed to retrieve ENAME. %s.\n",
c->name, strerror(ret));
c->name, nvme_strerror(-ret));
else if (ret == 0)
nvme_msg(ctx, LOG_INFO, "%s: Failed to retrieve ENAME.\n",
c->name);

ret = get_entity_version(dim->ever, sizeof(dim->ever));
if (ret <= 0)
Expand Down
2 changes: 1 addition & 1 deletion libnvme/src/nvme/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ int json_read_config(struct nvme_global_ctx *ctx, const char *config_file)
fd = open(config_file, O_RDONLY);
if (fd < 0) {
nvme_msg(ctx, LOG_DEBUG, "Error opening %s, %s\n",
config_file, strerror(errno));
config_file, nvme_strerror(errno));
return fd;
}
json_root = parse_json(ctx, fd);
Expand Down
6 changes: 3 additions & 3 deletions libnvme/src/nvme/nbft.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,14 +750,14 @@ int nvme_nbft_read(struct nvme_global_ctx *ctx, struct nbft_info **nbft,
raw_nbft_fp = fopen(filename, "rb");
if (raw_nbft_fp == NULL) {
nvme_msg(ctx, LOG_ERR, "Failed to open %s: %s\n",
filename, strerror(errno));
filename, nvme_strerror(errno));
return -EINVAL;
}

i = fseek(raw_nbft_fp, 0L, SEEK_END);
if (i) {
nvme_msg(ctx, LOG_ERR, "Failed to read from %s: %s\n",
filename, strerror(errno));
filename, nvme_strerror(errno));
fclose(raw_nbft_fp);
return -EINVAL;
}
Expand All @@ -776,7 +776,7 @@ int nvme_nbft_read(struct nvme_global_ctx *ctx, struct nbft_info **nbft,
i = fread(raw_nbft, sizeof(*raw_nbft), raw_nbft_size, raw_nbft_fp);
if (i != raw_nbft_size) {
nvme_msg(ctx, LOG_ERR, "Failed to read from %s: %s\n",
filename, strerror(errno));
filename, nvme_strerror(errno));
fclose(raw_nbft_fp);
free(raw_nbft);
return -EINVAL;
Expand Down
14 changes: 7 additions & 7 deletions libnvme/src/nvme/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,25 +289,25 @@
ctrls.num = nvme_scan_ctrls(&ctrls.ents);
if (ctrls.num < 0) {
nvme_msg(ctx, LOG_DEBUG, "failed to scan ctrls: %s\n",
strerror(-ctrls.num));
nvme_strerror(-ctrls.num));
return ctrls.num;
}

for (i = 0; i < ctrls.num; i++) {
nvme_ctrl_t c;

ret = nvme_scan_ctrl(ctx, ctrls.ents[i]->d_name, &c);
if (!ret) {
if (ret < 0) {
nvme_msg(ctx, LOG_DEBUG, "failed to scan ctrl %s: %s\n",
ctrls.ents[i]->d_name, strerror(ret));
ctrls.ents[i]->d_name, nvme_strerror(-ret));
continue;
Comment thread
martin-gpy marked this conversation as resolved.
}
}

subsys.num = nvme_scan_subsystems(&subsys.ents);
if (subsys.num < 0) {
nvme_msg(ctx, LOG_DEBUG, "failed to scan subsystems: %s\n",
strerror(-subsys.num));
nvme_strerror(-subsys.num));
return subsys.num;
}

Expand All @@ -316,7 +316,7 @@
if (ret < 0) {
nvme_msg(ctx, LOG_DEBUG,
"failed to scan subsystem %s: %s\n",
subsys.ents[i]->d_name, strerror(-ret));
subsys.ents[i]->d_name, nvme_strerror(-ret));
}
}

Expand Down Expand Up @@ -843,7 +843,7 @@
if (namespaces.num < 0) {
nvme_msg(ctx, LOG_DEBUG,
"failed to scan namespaces for subsys %s: %s\n",
s->subsysnqn, strerror(-namespaces.num));
s->subsysnqn, nvme_strerror(-namespaces.num));
return namespaces.num;
}

Expand All @@ -853,7 +853,7 @@
if (ret < 0)
nvme_msg(ctx, LOG_DEBUG,
"failed to scan namespace %s: %s\n",
namespaces.ents[i]->d_name, strerror(-ret));
namespaces.ents[i]->d_name, nvme_strerror(-ret));

Check failure on line 856 in libnvme/src/nvme/tree.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 82 exceeds 80 columns
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static void nvme_log_retry(int errnum)
if (log_level < LOG_DEBUG)
return;

printf("passthru command returned '%s'\n", strerror(errnum));
printf("passthru command returned '%s'\n", nvme_strerror(errnum));
}

void *nvme_submit_entry(struct nvme_transport_handle *hdl,
Expand Down
5 changes: 3 additions & 2 deletions nvme-models.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <unistd.h>
#include <errno.h>
#include "nvme-models.h"
#include "nvme.h"

static char *_fmt1 = "/sys/class/nvme/nvme%d/device/subsystem_vendor";
static char *_fmt2 = "/sys/class/nvme/nvme%d/device/subsystem_device";
Expand Down Expand Up @@ -244,7 +245,7 @@ static int read_sys_node(char *where, char *save, size_t savesz)
fd = open(where, O_RDONLY);
if (fd < 0) {
fprintf(stderr, "Failed to open %s with errno %s\n",
where, strerror(errno));
where, nvme_strerror(errno));
return 1;
}
/* -1 so we can safely use strstr below */
Expand Down Expand Up @@ -327,7 +328,7 @@ char *nvme_product_name(int id)

line = malloc(1024);
if (!line) {
fprintf(stderr, "malloc: %s\n", strerror(errno));
fprintf(stderr, "malloc: %s\n", nvme_strerror(errno));
goto error0;
}

Expand Down
2 changes: 1 addition & 1 deletion nvme-print-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -5344,7 +5344,7 @@ static void json_output_perror(const char *msg, va_list ap)
if (vasprintf(&error, msg, ap) < 0)
error = alloc_error;

obj_add_key(r, "error", "%s: %s", error, strerror(errno));
obj_add_key(r, "error", "%s: %s", error, nvme_strerror(errno));

json_output_object(r);
}
Expand Down
4 changes: 2 additions & 2 deletions nvme-rpmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
if (file == NULL) return err;

if ((fd = open(file, O_RDONLY)) < 0) {
fprintf(stderr, "Failed to open %s: %s\n", file, strerror(errno));
fprintf(stderr, "Failed to open %s: %s\n", file, nvme_strerror(errno));

Check failure on line 171 in nvme-rpmb.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 87 exceeds 80 columns
return fd;
}

Expand All @@ -189,7 +189,7 @@
if (err < 0) {
err = -errno;
fprintf(stderr, "Failed to read data from file"
" %s with %s\n", file, strerror(errno));
" %s with %s\n", file, nvme_strerror(errno));

Check failure on line 192 in nvme-rpmb.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: quoted string split across lines
free(buf);
goto out;
}
Expand Down
Loading