1
0
Fork 0

Merging upstream version 2.9.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-16 12:26:52 +01:00
parent bb95f41000
commit 698d985f9d
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
451 changed files with 5896 additions and 2734 deletions

View file

@ -4,11 +4,12 @@
#include <stdio.h>
#include <fnmatch.h>
#include <libnvme.h>
#include "nvme-print.h"
#include "nvme.h"
#include "nbft.h"
#include "libnvme.h"
#include "fabrics.h"
#include "util/logging.h"
#define CREATE_CMD
#include "nbft-plugin.h"
@ -168,7 +169,11 @@ static json_object *ssns_to_json(struct nbft_info_subsystem_ns *ss)
|| json_object_add_value_int(ss_json, "pdu_header_digest_required",
ss->pdu_header_digest_required)
|| json_object_add_value_int(ss_json, "data_digest_required",
ss->data_digest_required))
ss->data_digest_required)
|| json_object_add_value_int(ss_json, "discovered",
ss->discovered)
|| json_object_add_value_int(ss_json, "unavailable",
ss->unavailable))
goto fail;
return ss_json;
@ -319,7 +324,7 @@ static int json_show_nbfts(struct list_head *nbft_list, bool show_subsys,
bool show_hfi, bool show_discovery)
{
struct json_object *nbft_json_array, *nbft_json;
struct nbft_file_entry *entry;
struct nbft_file_entry *entry = NULL;
nbft_json_array = json_create_array();
if (!nbft_json_array)
@ -510,7 +515,7 @@ static void normal_show_nbfts(struct list_head *nbft_list, bool show_subsys,
bool show_hfi, bool show_discovery)
{
bool not_first = false;
struct nbft_file_entry *entry;
struct nbft_file_entry *entry = NULL;
list_for_each(nbft_list, entry, node) {
if (not_first)
@ -529,6 +534,8 @@ int show_nbft(int argc, char **argv, struct command *cmd, struct plugin *plugin)
enum nvme_print_flags flags;
int ret;
bool show_subsys = false, show_hfi = false, show_discovery = false;
unsigned int verbose = 0;
nvme_root_t r;
OPT_ARGS(opts) = {
OPT_FMT("output-format", 'o', &format, "Output format: normal|json"),
@ -536,6 +543,7 @@ int show_nbft(int argc, char **argv, struct command *cmd, struct plugin *plugin)
OPT_FLAG("hfi", 'H', &show_hfi, "show NBFT HFIs"),
OPT_FLAG("discovery", 'd', &show_discovery, "show NBFT discovery controllers"),
OPT_STRING("nbft-path", 0, "STR", &nbft_path, "user-defined path for NBFT tables"),
OPT_INCR("verbose", 'v', &verbose, "Increase logging verbosity"),
OPT_END()
};
@ -543,10 +551,15 @@ int show_nbft(int argc, char **argv, struct command *cmd, struct plugin *plugin)
if (ret)
return ret;
log_level = map_log_level(verbose, false /* quiet */);
ret = validate_output_format(format, &flags);
if (ret < 0)
return ret;
/* initialize libnvme logging */
r = nvme_create_root(stderr, log_level);
if (!(show_subsys || show_hfi || show_discovery))
show_subsys = show_hfi = show_discovery = true;
@ -559,5 +572,6 @@ int show_nbft(int argc, char **argv, struct command *cmd, struct plugin *plugin)
ret = json_show_nbfts(&nbft_list, show_subsys, show_hfi, show_discovery);
free_nbfts(&nbft_list);
}
nvme_free_tree(r);
return ret;
}