.zns_id_ctrl = binary_zns_id_ctrl,
.zns_id_ns = binary_zns_id_ns,
.zns_report_zones = binary_zns_report_zones,
+ .show_feature = NULL,
.show_feature_fields = NULL,
.id_ctrl_rpmbs = NULL,
.lba_range = NULL,
json_print(root);
}
+static void json_feature_show(enum nvme_features_id fid, int sel, unsigned int result)
+{
+ struct json_object *root = json_create_object();
+ char json_str[STR_LEN];
+
+ sprintf(json_str, "%#0*x", fid ? 4 : 2, fid);
+ json_object_add_value_string(root, "feature", json_str);
+
+ json_object_add_value_string(root, "name", nvme_feature_to_string(fid));
+
+ sprintf(json_str, "%#0*x", result ? 10 : 8, result);
+ json_object_add_value_string(root, nvme_select_to_string(sel), json_str);
+
+ json_print(root);
+}
+
+
static void json_feature_show_fields(enum nvme_features_id fid, unsigned int result,
unsigned char *buf)
{
.zns_id_ctrl = json_nvme_zns_id_ctrl,
.zns_id_ns = json_nvme_zns_id_ns,
.zns_report_zones = json_nvme_zns_report_zones,
+ .show_feature = json_feature_show,
.show_feature_fields = json_feature_show_fields,
.id_ctrl_rpmbs = NULL,
.lba_range = NULL,
}
}
+static void stdout_feature_show(enum nvme_features_id fid, int sel, unsigned int result)
+{
+ printf("get-feature:%#0*x (%s), %s value:%#0*x\n", fid ? 4 : 2, fid,
+ nvme_feature_to_string(fid), nvme_select_to_string(sel), result ? 10 : 8, result);
+}
+
static void stdout_feature_show_fields(enum nvme_features_id fid,
unsigned int result,
unsigned char *buf)
.zns_id_ctrl = stdout_zns_id_ctrl,
.zns_id_ns = stdout_zns_id_ns,
.zns_report_zones = stdout_zns_report_zones,
+ .show_feature = stdout_feature_show,
.show_feature_fields = stdout_feature_show_fields,
.id_ctrl_rpmbs = stdout_id_ctrl_rpmbs,
.lba_range = stdout_lba_range,
}
}
+void nvme_feature_show(enum nvme_features_id fid, int sel, unsigned int result)
+{
+ nvme_print(show_feature, 0, fid, sel, result);
+}
+
void nvme_feature_show_fields(enum nvme_features_id fid, unsigned int result, unsigned char *buf)
{
nvme_print(show_feature_fields, 0, fid, result, buf);
void (*zns_id_ctrl)(struct nvme_zns_id_ctrl *ctrl);
void (*zns_id_ns)(struct nvme_zns_id_ns *ns, struct nvme_id_ns *id_ns);
void (*zns_report_zones)(void *report, __u32 descs, __u8 ext_size, __u32 report_size, struct json_object *zone_list);
+ void (*show_feature)(enum nvme_features_id id, int sel, unsigned int result);
void (*show_feature_fields)(enum nvme_features_id id, unsigned int result, unsigned char *buf);
void (*id_ctrl_rpmbs)(__le32 ctrl_rpmbs);
void (*lba_range)(struct nvme_lba_range_type *lbrt, int nr_ranges);
enum nvme_cli_topo_ranking ranking,
enum nvme_print_flags flags);
+void nvme_feature_show(enum nvme_features_id fid, int sel, unsigned int result);
void nvme_feature_show_fields(enum nvme_features_id fid, unsigned int result, unsigned char *buf);
void nvme_directive_show(__u8 type, __u8 oper, __u16 spec, __u32 nsid, __u32 result,
void *buf, __u32 len, enum nvme_print_flags flags);
if (!err) {
if (!cfg.raw_binary || !buf) {
- printf("get-feature:%#0*x (%s), %s value:%#0*x\n",
- cfg.feature_id ? 4 : 2, cfg.feature_id,
- nvme_feature_to_string(cfg.feature_id),
- nvme_select_to_string(cfg.sel), result ? 10 : 8,
- result);
+ nvme_feature_show(cfg.feature_id, cfg.sel, result);
if (cfg.sel == 3)
nvme_show_select_result(result);
else if (cfg.human_readable)