From c88af333ea2e12a8bdc88565e9b305fe4bafae90 Mon Sep 17 00:00:00 2001 From: "suzhi.yt" Date: Wed, 20 Oct 2021 10:34:04 +0800 Subject: [PATCH] nvme: use the 'eds' command line option replace the 'cdw11' command line option in resv-report Signed-off-by: suzhi.yt --- Documentation/nvme-resv-report.1 | 7 ++++--- Documentation/nvme-resv-report.html | 8 ++++---- Documentation/nvme-resv-report.txt | 8 ++++---- completions/_nvme | 2 ++ completions/bash-nvme-completion.sh | 4 ++-- nvme-print.c | 10 +++++----- nvme-print.h | 2 +- nvme.c | 12 ++++++------ 8 files changed, 28 insertions(+), 25 deletions(-) diff --git a/Documentation/nvme-resv-report.1 b/Documentation/nvme-resv-report.1 index f9f1fa8e..7a57ecee 100644 --- a/Documentation/nvme-resv-report.1 +++ b/Documentation/nvme-resv-report.1 @@ -34,7 +34,7 @@ nvme-resv-report \- Send NVMe Reservation Report, parse the result .nf \fInvme resv\-report\fR [\-\-namespace\-id= | \-n ] [\-\-numd= | \-d ] - [\-\-cdw11= | \-c ] + [\-\-eds | \-e] [\-\-raw\-binary | \-b] [\-\-output\-format= | \-o ] .fi @@ -55,9 +55,10 @@ Retrieve the reservation report structure for the given nsid\&. This is required Specify the number of Dwords of the Reservation Status structure to transfer\&. Defaults to 4k\&. .RE .PP -\-c , \-\-cdw11= +\-e, \-\-eds .RS 4 -The value for command dword 11\&. Setting bit 0 specifies that the controller returns the Extended Data Structure\&. +Request extended Data Structure: If this bit is set to a +\fI1\fR, then the controller returns the Extended Data Structure\&. .RE .PP \-b, \-\-raw\-binary diff --git a/Documentation/nvme-resv-report.html b/Documentation/nvme-resv-report.html index 83655ae2..6fb35f62 100644 --- a/Documentation/nvme-resv-report.html +++ b/Documentation/nvme-resv-report.html @@ -751,7 +751,7 @@ nvme-resv-report(1) Manual Page
nvme resv-report <device> [--namespace-id=<nsid> | -n <nsid>]
                         [--numd=<num-dwords> | -d <num-dwords>]
-                        [--cdw11=<cdw11> | -c <cdw11>]
+                        [--eds | -e]
                         [--raw-binary | -b]
                         [--output-format=<fmt> | -o <fmt>]
@@ -800,14 +800,14 @@ Controller data structure for each such controller).

--c <cdw11> +-e
---cdw11=<cdw11> +--eds

- The value for command dword 11. Setting bit 0 specifies that the + Request extended Data Structure: If this bit is set to a '1', then the controller returns the Extended Data Structure.

diff --git a/Documentation/nvme-resv-report.txt b/Documentation/nvme-resv-report.txt index b53c1410..32012fed 100644 --- a/Documentation/nvme-resv-report.txt +++ b/Documentation/nvme-resv-report.txt @@ -10,7 +10,7 @@ SYNOPSIS [verse] 'nvme resv-report' [--namespace-id= | -n ] [--numd= | -d ] - [--cdw11= | -c ] + [--eds | -e] [--raw-binary | -b] [--output-format= | -o ] @@ -38,9 +38,9 @@ OPTIONS Specify the number of Dwords of the Reservation Status structure to transfer. Defaults to 4k. --c :: ---cdw11=:: - The value for command dword 11. Setting bit 0 specifies that the +-e:: +--eds:: + Request extended Data Structure: If this bit is set to a '1', then the controller returns the Extended Data Structure. -b:: diff --git a/completions/_nvme b/completions/_nvme index 4b388d8c..db96baa3 100644 --- a/completions/_nvme +++ b/completions/_nvme @@ -596,6 +596,8 @@ _nvme () { -n':alias of --namespace-id' --numd=':number of dwords of reservation status to xfer' -d':alias of --numd' + --eds':request extended data structure' + -e':alias of --eds' --raw-binary':dump output in binary format' -b':alias of --raw-binary' ) diff --git a/completions/bash-nvme-completion.sh b/completions/bash-nvme-completion.sh index 9eed8e8c..19fd876b 100644 --- a/completions/bash-nvme-completion.sh +++ b/completions/bash-nvme-completion.sh @@ -167,8 +167,8 @@ nvme_list_opts () { --rrela= -a --iekey -i" ;; "resv-report") - opts+=" --namespace-id= -n --numd= -d --raw-binary= -b \ - --output-format= -o" + opts+=" --namespace-id= -n --numd= -d --eds -e \ + --raw-binary= -b --output-format= -o" ;; "dsm") opts+=" --namespace-id= -n --ctx-attrs= -a --blocks= -b\ diff --git a/nvme-print.c b/nvme-print.c index 6c330d89..08674761 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -416,7 +416,7 @@ static void json_error_log(struct nvme_error_log_page *err_log, int entries) } static void json_nvme_resv_report(struct nvme_resv_status *status, - int bytes, __u32 cdw11) + int bytes, bool eds) { struct json_object *root; struct json_object *rcs; @@ -433,7 +433,7 @@ static void json_nvme_resv_report(struct nvme_resv_status *status, rcs = json_create_array(); /* check Extended Data Structure bit */ - if ((cdw11 & 0x1) == 0) { + if (!eds) { /* * if status buffer was too small, don't loop past the end of * the buffer @@ -4613,14 +4613,14 @@ void nvme_show_error_log(struct nvme_error_log_page *err_log, int entries, } void nvme_show_resv_report(struct nvme_resv_status *status, int bytes, - __u32 cdw11, enum nvme_print_flags flags) + bool eds, enum nvme_print_flags flags) { int i, j, regctl, entries; if (flags & BINARY) return d_raw((unsigned char *)status, bytes); else if (flags & JSON) - return json_nvme_resv_report(status, bytes, cdw11); + return json_nvme_resv_report(status, bytes, eds); regctl = status->regctl[0] | (status->regctl[1] << 8); @@ -4631,7 +4631,7 @@ void nvme_show_resv_report(struct nvme_resv_status *status, int bytes, printf("ptpls : %d\n", status->ptpls); /* check Extended Data Structure bit */ - if ((cdw11 & 0x1) == 0) { + if (!eds) { /* * if status buffer was too small, don't loop past the end of * the buffer diff --git a/nvme-print.h b/nvme-print.h index 7bc8a84d..33ab3f97 100644 --- a/nvme-print.h +++ b/nvme-print.h @@ -23,7 +23,7 @@ void __nvme_show_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void nvme_show_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode); void nvme_show_id_ns(struct nvme_id_ns *ns, unsigned int nsid, enum nvme_print_flags flags); -void nvme_show_resv_report(struct nvme_resv_status *status, int bytes, __u32 cdw11, +void nvme_show_resv_report(struct nvme_resv_status *status, int bytes, bool eds, enum nvme_print_flags flags); void nvme_show_lba_range(struct nvme_lba_range_type *lbrt, int nr_ranges); void nvme_show_error_log(struct nvme_error_log_page *err_log, int entries, diff --git a/nvme.c b/nvme.c index 04de3935..611e920b 100644 --- a/nvme.c +++ b/nvme.c @@ -4739,7 +4739,7 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin "namespace."; const char *namespace_id = "identifier of desired namespace"; const char *numd = "number of dwords to transfer"; - const char *cdw11 = "command dword 11 value"; + const char *eds = "request extended data structure"; const char *raw = "dump output in binary format"; struct nvme_resv_status *status; @@ -4749,7 +4749,7 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin struct config { __u32 namespace_id; __u32 numd; - __u32 cdw11; + __u8 eds; int raw_binary; char *output_format; }; @@ -4757,14 +4757,14 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin struct config cfg = { .namespace_id = 0, .numd = 0, - .cdw11 = 0, + .eds = 0, .output_format = "normal", }; OPT_ARGS(opts) = { OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id), OPT_UINT("numd", 'd', &cfg.numd, numd), - OPT_UINT("cdw11", 'c', &cfg.cdw11, cdw11), + 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), OPT_END() @@ -4802,9 +4802,9 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin } memset(status, 0, size); - err = nvme_resv_report(fd, cfg.namespace_id, cfg.cdw11, size, status); + err = nvme_resv_report(fd, cfg.namespace_id, cfg.eds, size, status); if (!err) - nvme_show_resv_report(status, size, cfg.cdw11, flags); + nvme_show_resv_report(status, size, cfg.eds, flags); else if (err > 0) nvme_show_status(err); else -- 2.50.1