--- /dev/null
+nvme-id-ns(1)
+=============
+
+NAME
+----
+nvme-list-ns - Send NVMe Identify List Namespaces, return result and structure
+
+SYNOPSIS
+--------
+[verse]
+'nvme list-ns' <device> [--namespace-id=<nsid> | -n <nsid>]
+
+DESCRIPTION
+-----------
+For the NVMe device given, sends an identify command for namespace list
+and provides the result and returned structure.
+
+The <device> parameter is mandatory and may be either the NVMe character
+device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).
+If the starting namespace in the list always begins with 0 unless the
+`'--namespace-id'` option is given to override.
+
+On success, the namespace array is printed for each index and nsid for
+a valid nsid.
+
+OPTIONS
+-------
+-n <nsid>::
+--namespace-id=<nsid>::
+ Retrieve the identify list structure starting with the given nsid.
+
+EXAMPLES
+--------
+No examples yet.
+
+NVME
+----
+Part of the nvme-user suite
#define COMMAND_LIST \
ENTRY(ID_CTRL, "id-ctrl", "Send NVMe Identify Controller", id_ctrl) \
ENTRY(ID_NS, "id-ns", "Send NVMe Identify Namespace, disaply structure", id_ns) \
+ ENTRY(LIST_NS, "list-ns", "Send NVMe Identify List, disaply structure", list_ns) \
ENTRY(GET_NS_ID, "get-ns-id", "Retrieve the namespace ID of opend block device", get_ns_id) \
ENTRY(GET_LOG, "get-log", "Generic NVMe get log, returns log in raw format", get_log) \
ENTRY(GET_FW_LOG, "fw-log", "Retrieve FW Log, show it", get_fw_log) \
}
}
+static int list_ns(int argc, char **argv)
+{
+ int opt, err, i, long_index = 0;
+ unsigned int nsid = 0;
+ static struct option opts[] = {
+ {"namespace-id", required_argument, 0, 'n'},
+ {0, 0, 0, 0 }
+ };
+ __u32 ns_list[1024];
+
+ while ((opt = getopt_long(argc, (char **)argv, "n:", opts,
+ &long_index)) != -1) {
+ switch (opt) {
+ case 'n':
+ get_int(optarg, &nsid);
+ break;
+ default:
+ return EINVAL;
+ }
+ }
+ get_dev(optind, argc, argv);
+ err = identify(nsid, ns_list, 2);
+ if (!err) {
+ for (i = 0; i < 1024; i++)
+ if (ns_list[i])
+ printf("[%4u]:%#x\n", i, ns_list[i]);
+ }
+ else if (err > 0)
+ fprintf(stderr, "NVMe Status: %s NSID:%d\n",
+ nvme_status_to_string(err), nsid);
+ return err;
+}
+
static int id_ctrl(int argc, char **argv)
{
int opt, err, raw = 0, vs = 0, long_index = 0;
printf("NVME Reservation Report success\n");
show_nvme_resv_report(status);
} else
- d_raw(status, numd << 2);
+ d_raw((unsigned char *)status, numd << 2);
}
return 0;
}