Skip to content

Commit

Permalink
nvme: validate output format split status from flag return value
Browse files Browse the repository at this point in the history
Just return the status via the return value and return the flag value
via the arguments.

Signed-off-by: Daniel Wagner <[email protected]>
  • Loading branch information
igaw committed Dec 5, 2023
1 parent 99cacfc commit 7799dfd
Show file tree
Hide file tree
Showing 15 changed files with 291 additions and 245 deletions.
18 changes: 13 additions & 5 deletions fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,11 @@ static int discover_from_conf_file(nvme_root_t r, nvme_host_t h,

nvmf_default_config(&cfg);

ret = flags = validate_output_format(format);
if (ret < 0)
ret = validate_output_format(format, &flags);
if (ret < 0) {
nvme_show_error("Invalid output format");
return ret;
}

f = fopen(PATH_NVMF_DISC, "r");
if (f == NULL) {
Expand Down Expand Up @@ -697,9 +699,11 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
if (ret)
return ret;

ret = flags = validate_output_format(format);
if (ret < 0)
ret = validate_output_format(format, &flags);
if (ret < 0) {
nvme_show_error("Invalid output format");
return ret;
}

if (!strcmp(config_file, "none"))
config_file = NULL;
Expand Down Expand Up @@ -900,7 +904,11 @@ int nvmf_connect(const char *desc, int argc, char **argv)
if (ret)
return ret;

flags = validate_output_format(format);
ret = validate_output_format(format, &flags);
if (ret < 0) {
nvme_show_error("Invalid output format");
return ret;
}

if (!subsysnqn) {
fprintf(stderr,
Expand Down
Loading

0 comments on commit 7799dfd

Please sign in to comment.