bool latency;
};
-#define NVME_ARGS(n, c, ...) \
- struct argconfig_commandline_options n[] = { \
- OPT_FLAG("verbose", 'v', NULL, verbose), \
- ##__VA_ARGS__, \
- OPT_END() \
+#define NVME_ARGS(n, c, ...) \
+ struct argconfig_commandline_options n[] = { \
+ OPT_FLAG("verbose", 'v', NULL, verbose), \
+ OPT_FMT("output-format", 'o', &output_format_val, output_format), \
+ ##__VA_ARGS__, \
+ OPT_END() \
}
static const char nvme_version_string[] = NVME_VERSION;
};
const char *output_format = "Output format: normal|json|binary";
-static const char *output_format_no_binary = "Output format: normal|json";
-
static const char *app_tag = "app tag for end-to-end PI";
static const char *app_tag_mask = "app tag mask for end-to-end PI";
static const char *block_count = "number of blocks (zeroes based) on device to access";
static const char dash[51] = {[0 ... 49] = '=', '\0'};
static const char space[51] = {[0 ... 49] = ' ', '\0'};
+static char *output_format_val = "normal";
+
static void *mmap_registers(nvme_root_t r, struct nvme_dev *dev);
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
return -EINVAL;
}
+bool nvme_is_output_format_json(void)
+{
+ return validate_output_format(output_format_val) == JSON;
+}
+
void dev_close(struct nvme_dev *dev)
{
switch (dev->type) {
struct config {
__u32 namespace_id;
- char *output_format;
bool raw_binary;
bool human_readable;
};
struct config cfg = {
.namespace_id = NVME_NSID_ALL,
- .output_format = "normal",
.raw_binary = false,
.human_readable = false,
};
NVME_ARGS(opts, cfg,
OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_output),
OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_info));
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
bool groups;
- char *output_format;
};
struct config cfg = {
.groups = false,
- .output_format = "normal",
};
NVME_ARGS(opts, cfg,
- OPT_FLAG("groups", 'g', &cfg.groups, groups),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ OPT_FLAG("groups", 'g', &cfg.groups, groups));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
OPT_UINT("host-generate", 'g', &cfg.host_gen, hgen),
OPT_FLAG("controller-init", 'c', &cfg.ctrl_init, cgen),
OPT_UINT("data-area", 'd', &cfg.data_area, dgen),
- OPT_FLAG("rae", 'r', &cfg.rae, rae));
+ OPT_FLAG("rae", 'r', &cfg.rae, rae));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
int err;
struct config {
- char *output_format;
__u16 group_id;
};
struct config cfg = {
- .output_format = "normal",
.group_id = 0,
};
NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_SHRT("group-id", 'g', &cfg.group_id, group_id));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
enum nvme_print_flags flags;
struct config {
- char *output_format;
bool human_readable;
bool raw_binary;
int csi;
};
struct config cfg = {
- .output_format = "normal",
.human_readable = false,
.raw_binary = false,
.csi = -1,
};
NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_log),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_log),
OPT_INT("csi", 'c', &cfg.csi, csi));
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
enum nvme_print_flags flags;
int err = -1;
- struct config {
- char *output_format;
- };
-
- struct config cfg = {
- .output_format = "normal",
- };
-
- NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ NVME_ARGS(opts, cfg);
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u32 log_entries;
- char *output_format;
bool raw_binary;
};
struct config cfg = {
.log_entries = 64,
- .output_format = "normal",
.raw_binary = false,
};
NVME_ARGS(opts, cfg,
OPT_UINT("log-entries", 'e', &cfg.log_entries, log_entries),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
int err;
struct config {
- char *output_format;
bool raw_binary;
};
struct config cfg = {
- .output_format = "normal",
.raw_binary = false,
};
NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
int err;
struct config {
- char *output_format;
bool raw_binary;
};
struct config cfg = {
- .output_format = "normal",
.raw_binary = false,
};
NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_output));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u16 nvmset_id;
- char *output_format;
bool raw_binary;
};
struct config cfg = {
.nvmset_id = 1,
- .output_format = "normal",
.raw_binary = false,
};
NVME_ARGS(opts, cfg,
- OPT_SHRT("nvmset-id", 'i', &cfg.nvmset_id, nvmset_id),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
- OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use));
+ OPT_SHRT("nvmset-id", 'i', &cfg.nvmset_id, nvmset_id),
+ OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u64 log_entries;
bool rae;
- char *output_format;
bool raw_binary;
};
struct config cfg = {
.log_entries = 2044,
.rae = false,
- .output_format = "normal",
.raw_binary = false,
};
NVME_ARGS(opts, cfg,
OPT_UINT("log-entries", 'e', &cfg.log_entries, log_entries),
OPT_FLAG("rae", 'r', &cfg.rae, rae),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u8 action;
__u32 log_len;
- char *output_format;
bool raw_binary;
};
struct config cfg = {
.action = 0xff,
.log_len = 0,
- .output_format = "normal",
.raw_binary = false,
};
NVME_ARGS(opts, cfg,
OPT_BYTE("action", 'a', &cfg.action, action),
OPT_UINT("log_len", 'l', &cfg.log_len, log_len),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u64 log_entries;
bool rae;
- char *output_format;
bool raw_binary;
};
struct config cfg = {
.log_entries = 2044,
.rae = false,
- .output_format = "normal",
.raw_binary = false,
};
NVME_ARGS(opts, cfg,
OPT_UINT("log-entries", 'e', &cfg.log_entries, log_entries),
OPT_FLAG("rae", 'r', &cfg.rae, rae),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
bool rae;
- char *output_format;
};
struct config cfg = {
.rae = false,
- .output_format = "normal",
};
NVME_ARGS(opts, cfg,
- OPT_FLAG("rae", 'r', &cfg.rae, rae),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ OPT_FLAG("rae", 'r', &cfg.rae, rae));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
enum nvme_print_flags flags;
int err;
- struct config {
- char *output_format;
- };
-
- struct config cfg = {
- .output_format = "normal",
- };
-
- NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ NVME_ARGS(opts, cfg);
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u8 lsp;
char *file_name;
- char *output_format;
};
struct config cfg = {
.lsp = 0,
- .output_format = "normal",
.file_name = NULL,
};
NVME_ARGS(opts, cfg,
OPT_BYTE("lsp", 's', &cfg.lsp, lsp),
- OPT_FILE("output-file", 'f', &cfg.file_name, fname),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ OPT_FILE("output-file", 'f', &cfg.file_name, fname));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u16 domainid;
- char *output_format;
bool raw_binary;
};
struct config cfg = {
.domainid = 0,
- .output_format = "normal",
.raw_binary = false,
};
NVME_ARGS(opts, cfg,
OPT_UINT("domain-id", 'd', &cfg.domainid, domainid),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u16 domainid;
- char *output_format;
bool raw_binary;
};
struct config cfg = {
.domainid = 0,
- .output_format = "normal",
.raw_binary = false,
};
NVME_ARGS(opts, cfg,
OPT_UINT("domain-id", 'd', &cfg.domainid, domainid),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
bool rae;
- char *output_format;
bool human_readable;
bool raw_binary;
};
struct config cfg = {
.rae = false,
- .output_format = "normal",
.human_readable = false,
.raw_binary = false,
};
NVME_ARGS(opts, cfg,
OPT_FLAG("rae", 'r', &cfg.rae, rae),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_log),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_log));
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
int err = -1;
struct config {
- char *output_format;
bool human_readable;
};
struct config cfg = {
- .output_format = "normal",
.human_readable = false,
};
NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_log));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
int err = -1;
struct config {
- char *output_format;
bool human_readable;
};
struct config cfg = {
- .output_format = "normal",
.human_readable = false,
};
NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_log));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u16 cntid;
__u32 namespace_id;
- char *output_format;
};
struct config cfg = {
.cntid = 0,
.namespace_id = NVME_NSID_NONE,
- .output_format = "normal",
};
NVME_ARGS(opts, cfg,
OPT_SHRT("cntid", 'c', &cfg.cntid, controller),
- OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_optional),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_optional));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
__u32 namespace_id;
int csi;
bool all;
- char *output_format;
};
struct config cfg = {
.namespace_id = 1,
.csi = -1,
.all = false,
- .output_format = "normal",
};
NVME_ARGS(opts, cfg,
OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id),
OPT_INT("csi", 'y', &cfg.csi, csi),
- OPT_FLAG("all", 'a', &cfg.all, all),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format_no_binary));
+ OPT_FLAG("all", 'a', &cfg.all, all));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (flags != JSON && flags != NORMAL) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u16 lba_format_index;
__u8 uuid_index;
- char *output_format;
};
struct config cfg = {
.lba_format_index = 0,
.uuid_index = NVME_UUID_NONE,
- .output_format = "normal",
};
NVME_ARGS(opts, cfg,
OPT_UINT("lba-format-index", 'i', &cfg.lba_format_index, lba_format_index),
- OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u16 endgrp_id;
- char *output_format;
};
struct config cfg = {
.endgrp_id = 0,
- .output_format = "normal",
};
NVME_ARGS(opts, cfg,
- OPT_SHRT("endgrp-id", 'i', &cfg.endgrp_id, endurance_grp_id),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ OPT_SHRT("endgrp-id", 'i', &cfg.endgrp_id, endurance_grp_id));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (flags != JSON && flags != NORMAL) {
nvme_show_error("invalid output format");
return err;
int err;
int nsid = NVME_NSID_ALL;
- struct config {
- char *output_format;
- };
-
- struct config cfg = {
- .output_format = "normal",
- };
-
- NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format_no_binary));
+ NVME_ARGS(opts, cfg);
err = argconfig_parse(argc, argv, desc, opts);
if (err < 0)
if (optind < argc)
devname = basename(argv[optind++]);
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (flags != JSON && flags != NORMAL) {
nvme_show_error("Invalid output format");
goto ret;
nvme_root_t r;
int err = 0;
- struct config {
- char *output_format;
- };
-
- struct config cfg = {
- .output_format = "normal",
- };
-
- NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format_no_binary));
+ NVME_ARGS(opts, cfg);
err = argconfig_parse(argc, argv, desc, opts);
if (err < 0)
return err;
- flags = validate_output_format(cfg.output_format);
+ flags = validate_output_format(output_format_val);
if (flags != JSON && flags != NORMAL) {
nvme_show_error("Invalid output format");
return -EINVAL;
struct config {
bool vendor_specific;
- char *output_format;
bool raw_binary;
bool human_readable;
};
struct config cfg = {
.vendor_specific = false,
- .output_format = "normal",
.raw_binary = false,
.human_readable = false,
};
NVME_ARGS(opts, cfg,
OPT_FLAG("vendor-specific", 'v', &cfg.vendor_specific, vendor_specific),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_identify),
OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_identify));
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
enum nvme_print_flags flags;
int err = -1;
- struct config {
- char *output_format;
- };
-
- struct config cfg = {
- .output_format = "normal",
- };
-
- NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ NVME_ARGS(opts, cfg);
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u32 namespace_id;
__u8 uuid_index;
- char *output_format;
};
struct config cfg = {
.namespace_id = 0,
.uuid_index = NVME_UUID_NONE,
- .output_format = "normal",
};
NVME_ARGS(opts, cfg,
OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),
- OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u16 lba_format_index;
__u8 uuid_index;
- char *output_format;
};
struct config cfg = {
.lba_format_index = 0,
.uuid_index = NVME_UUID_NONE,
- .output_format = "normal",
};
NVME_ARGS(opts, cfg,
OPT_UINT("lba-format-index", 'i', &cfg.lba_format_index, lba_format_index),
- OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u32 namespace_id;
- char *output_format;
bool raw_binary;
};
struct config cfg = {
.namespace_id = 0,
- .output_format = "normal",
.raw_binary = false,
};
NVME_ARGS(opts, cfg,
OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
bool force;
bool vendor_specific;
bool raw_binary;
- char *output_format;
bool human_readable;
};
.force = false,
.vendor_specific = false,
.raw_binary = false,
- .output_format = "normal",
.human_readable = false,
};
OPT_FLAG("force", 0, &cfg.force, force),
OPT_FLAG("vendor-specific", 'v', &cfg.vendor_specific, vendor_specific),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_identify),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_identify));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u32 namespace_id;
bool raw_binary;
- char *output_format;
bool human_readable;
};
struct config cfg = {
.namespace_id = 0,
.raw_binary = false,
- .output_format = "normal",
.human_readable = false,
};
NVME_ARGS(opts, cfg,
OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_identify),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_identify));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
enum nvme_print_flags flags;
int err;
- struct config {
- char *output_format;
- };
-
- struct config cfg = {
- .output_format = "normal",
- };
-
- NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ NVME_ARGS(opts, cfg);
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u16 nvmset_id;
- char *output_format;
};
struct config cfg = {
.nvmset_id = 0,
- .output_format = "normal",
};
NVME_ARGS(opts, cfg,
- OPT_SHRT("nvmset_id", 'i', &cfg.nvmset_id, nvmset_id),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ OPT_SHRT("nvmset_id", 'i', &cfg.nvmset_id, nvmset_id));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
int err;
struct config {
- char *output_format;
bool raw_binary;
bool human_readable;
};
struct config cfg = {
- .output_format = "normal",
.raw_binary = false,
.human_readable = false,
};
NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw),
OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable));
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u16 dom_id;
- char *output_format;
};
struct config cfg = {
.dom_id = 0xffff,
- .output_format = "normal",
};
NVME_ARGS(opts, cfg,
- OPT_SHRT("dom-id", 'd', &cfg.dom_id, domain_id),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ OPT_SHRT("dom-id", 'd', &cfg.dom_id, domain_id));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u16 cntlid;
- char *output_format;
bool human_readable;
};
struct config cfg = {
.cntlid = 0,
- .output_format = "normal",
.human_readable = false,
};
NVME_ARGS(opts, cfg,
OPT_UINT("cntlid", 'c', &cfg.cntlid, cntlid),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_info));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u16 cntid;
__u32 num_entries;
- char *output_format;
};
struct config cfg = {
.cntid = 0,
.num_entries = ARRAY_SIZE(sc_list->sc_entry),
- .output_format = "normal",
};
NVME_ARGS(opts, cfg,
OPT_SHRT("cntid", 'c', &cfg.cntid, controller),
- OPT_UINT("num-entries", 'e', &cfg.num_entries, num_entries),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ OPT_UINT("num-entries", 'e', &cfg.num_entries, num_entries));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
struct config {
__u8 dst_entries;
- char *output_format;
};
struct config cfg = {
.dst_entries = NVME_LOG_ST_MAX_RESULTS,
- .output_format = "normal",
};
NVME_ARGS(opts, cfg,
- OPT_BYTE("dst-entries", 'e', &cfg.dst_entries, dst_entries),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ OPT_BYTE("dst-entries", 'e', &cfg.dst_entries, dst_entries));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
int err;
struct config {
- char *output_format;
bool human_readable;
};
struct config cfg = {
- .output_format = "normal",
.human_readable = false,
};
NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable));
err = parse_and_open(&dev, argc, argv, desc, opts);
return err;
r = nvme_scan(NULL);
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
goto free_tree;
OPT_SHRT("endir", 'e', &cfg.endir, endir),
OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_directive),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_directive),
- OPT_FILE("input-file", 'i', &cfg.file, input));
+ OPT_FILE("input-file", 'i', &cfg.file, input));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
NVME_ARGS(opts, cfg,
OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),
OPT_LIST("ctx-attrs", 'a', &cfg.ctx_attrs, context_attrs),
- OPT_LIST("blocks", 'b', &cfg.blocks, blocks),
- OPT_LIST("slbs", 's', &cfg.slbas, starting_blocks),
- OPT_FLAG("ad", 'd', &cfg.ad, ad),
- OPT_FLAG("idw", 'w', &cfg.idw, idw),
- OPT_FLAG("idr", 'r', &cfg.idr, idr),
+ OPT_LIST("blocks", 'b', &cfg.blocks, blocks),
+ OPT_LIST("slbs", 's', &cfg.slbas, starting_blocks),
+ OPT_FLAG("ad", 'd', &cfg.ad, ad),
+ OPT_FLAG("idw", 'w', &cfg.idw, idw),
+ OPT_FLAG("idr", 'r', &cfg.idr, idr),
OPT_UINT("cdw11", 'c', &cfg.cdw11, cdw11));
err = parse_and_open(&dev, argc, argv, desc, opts);
};
NVME_ARGS(opts, cfg,
- OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),
+ OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),
OPT_SUFFIX("sdlba", 'd', &cfg.sdlba, d_sdlba),
OPT_LIST("slbs", 's', &cfg.slbas, d_slbas),
OPT_LIST("blocks", 'b', &cfg.nlbs, d_nlbs),
__u32 namespace_id;
__u32 numd;
__u8 eds;
- char *output_format;
bool raw_binary;
};
.namespace_id = 0,
.numd = 0,
.eds = false,
- .output_format = "normal",
.raw_binary = false,
};
OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired),
OPT_UINT("numd", 'd', &cfg.numd, numd),
OPT_FLAG("eds", 'e', &cfg.eds, eds),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_dump));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
OPT_FLAG("show-command", 'v', &cfg.show, show),
OPT_FLAG("dry-run", 'w', &cfg.dry_run, dry),
OPT_FLAG("latency", 't', &cfg.latency, latency),
- OPT_FLAG("force", 0, &cfg.force, force));
+ OPT_FLAG("force", 0, &cfg.force, force));
if (opcode != nvme_cmd_write) {
err = parse_and_open(&dev, argc, argv, desc, opts);
__u8 atype;
__u16 rl;
__u32 timeout;
- char *output_format;
};
struct config cfg = {
.atype = 0,
.rl = 0,
.timeout = 0,
- .output_format = "normal",
};
NVME_ARGS(opts, cfg,
OPT_UINT("max-dw", 'm', &cfg.mndw, mndw),
OPT_BYTE("action", 'a', &cfg.atype, atype),
OPT_SHRT("range-len", 'l', &cfg.rl, rl),
- OPT_UINT("timeout", 't', &cfg.timeout, timeout),
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format));
+ OPT_UINT("timeout", 't', &cfg.timeout, timeout));
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;
NVME_ARGS(opts, cfg,
OPT_BYTE("operation", 'o', &cfg.operation, operation),
OPT_SHRT("element-id", 'i', &cfg.element_id, element_id),
- OPT_UINT("cap-lower", 'l', &cfg.dw11, cap_lower),
+ OPT_UINT("cap-lower", 'l', &cfg.dw11, cap_lower),
OPT_UINT("cap-upper", 'u', &cfg.dw12, cap_upper));
err = parse_and_open(&dev, argc, argv, desc, opts);
};
NVME_ARGS(opts, cfg,
- OPT_BYTE("ofi", 'o', &cfg.ofi, ofi_desc),
- OPT_BYTE("ifc", 'f', &cfg.ifc, ifc_desc),
+ OPT_BYTE("ofi", 'o', &cfg.ofi, ofi_desc),
+ OPT_BYTE("ifc", 'f', &cfg.ifc, ifc_desc),
OPT_BYTE("prhbt", 'p', &cfg.prhbt, prhbt_desc),
- OPT_BYTE("scp", 's', &cfg.scp, scp_desc),
+ OPT_BYTE("scp", 's', &cfg.scp, scp_desc),
OPT_BYTE("uuid", 'U', &cfg.uuid, uuid_desc));
err = parse_and_open(&dev, argc, argv, desc, opts);
};
NVME_ARGS(opts, cfg,
- OPT_STR("secret", 's', &cfg.secret, secret),
+ OPT_STR("secret", 's', &cfg.secret, secret),
OPT_UINT("key-length", 'l', &cfg.key_len, key_len),
OPT_STR("nqn", 'n', &cfg.nqn, nqn),
- OPT_UINT("hmac", 'm', &cfg.hmac, hmac));
+ OPT_UINT("hmac", 'm', &cfg.hmac, hmac));
err = argconfig_parse(argc, argv, desc, opts);
if (err)
int err;
struct config {
- char *output_format;
char *ranking;
};
struct config cfg = {
- .output_format = "normal",
.ranking = "namespace",
};
NVME_ARGS(opts, cfg,
- OPT_FMT("output-format", 'o', &cfg.output_format, output_format),
OPT_FMT("ranking", 'r', &cfg.ranking, ranking));
err = argconfig_parse(argc, argv, desc, opts);
if (err)
return err;
- err = flags = validate_output_format(cfg.output_format);
+ err = flags = validate_output_format(output_format_val);
if (err < 0) {
nvme_show_error("Invalid output format");
return err;