From: Minwoo Im Date: Wed, 10 Jan 2018 11:04:45 +0000 (+0900) Subject: nvme-cli: Remove unnecessary nsid field in error-log X-Git-Tag: v1.6~129^2~1 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=307929b2641ee974e71f6b14d80da5ebed21e507;p=users%2Fhch%2Fnvme-cli.git nvme-cli: Remove unnecessary nsid field in error-log Error information log page is global to controller. Signed-off-by: Minwoo Im --- diff --git a/nvme-ioctl.c b/nvme-ioctl.c index c0d7775..259fa20 100644 --- a/nvme-ioctl.c +++ b/nvme-ioctl.c @@ -403,10 +403,9 @@ int nvme_fw_log(int fd, struct nvme_firmware_log_page *fw_log) return nvme_get_log(fd, NVME_NSID_ALL, NVME_LOG_FW_SLOT, sizeof(*fw_log), fw_log); } -int nvme_error_log(int fd, __u32 nsid, int entries, - struct nvme_error_log_page *err_log) +int nvme_error_log(int fd, int entries, struct nvme_error_log_page *err_log) { - return nvme_get_log(fd, nsid, NVME_LOG_ERROR, entries * sizeof(*err_log), err_log); + return nvme_get_log(fd, 0, NVME_LOG_ERROR, entries * sizeof(*err_log), err_log); } int nvme_smart_log(int fd, __u32 nsid, struct nvme_smart_log *smart_log) diff --git a/nvme-ioctl.h b/nvme-ioctl.h index 6a3b52b..cfafe58 100644 --- a/nvme-ioctl.h +++ b/nvme-ioctl.h @@ -81,8 +81,7 @@ int nvme_identify_ns_descs(int fd, __u32 nsid, void *data); int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u32 data_len, void *data); int nvme_fw_log(int fd, struct nvme_firmware_log_page *fw_log); -int nvme_error_log(int fd, __u32 nsid, int entries, - struct nvme_error_log_page *err_log); +int nvme_error_log(int fd, int entries, struct nvme_error_log_page *err_log); int nvme_smart_log(int fd, __u32 nsid, struct nvme_smart_log *smart_log); int nvme_discovery_log(int fd, struct nvmf_disc_rsp_page_hdr *log, __u32 size); diff --git a/nvme.c b/nvme.c index c968781..e5a85c1 100644 --- a/nvme.c +++ b/nvme.c @@ -258,29 +258,25 @@ static int get_effects_log(int argc, char **argv, struct command *cmd, struct pl static int get_error_log(int argc, char **argv, struct command *cmd, struct plugin *plugin) { const char *desc = "Retrieve specified number of "\ - "error log entries from a given device (or "\ - "namespace) in either decoded format (default) or binary."; - const char *namespace_id = "desired namespace"; + "error log entries from a given device "\ + "in either decoded format (default) or binary."; const char *log_entries = "number of entries to retrieve"; const char *raw_binary = "dump in binary format"; struct nvme_id_ctrl ctrl; int err, fmt, fd; struct config { - __u32 namespace_id; __u32 log_entries; int raw_binary; char *output_format; }; struct config cfg = { - .namespace_id = NVME_NSID_ALL, .log_entries = 64, .output_format = "normal", }; const struct argconfig_commandline_options command_line_options[] = { - {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id, required_argument, namespace_id}, {"log-entries", 'e', "NUM", CFG_POSITIVE, &cfg.log_entries, required_argument, log_entries}, {"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary}, {"output-format", 'o', "FMT", CFG_STRING, &cfg.output_format, required_argument, output_format }, @@ -318,7 +314,7 @@ static int get_error_log(int argc, char **argv, struct command *cmd, struct plug return ENOMEM; } - err = nvme_error_log(fd, cfg.namespace_id, cfg.log_entries, err_log); + err = nvme_error_log(fd, cfg.log_entries, err_log); if (!err) { if (fmt == BINARY) d_raw((unsigned char *)err_log, sizeof(err_log));