From: Keith Busch Date: Thu, 3 Mar 2016 18:14:25 +0000 (-0700) Subject: Add namespace id param for security commands X-Git-Tag: v0.5~12 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=49ea518feb58d1d3713edc15e024bb06147ea780;p=users%2Fsagi%2Fnvme-cli.git Add namespace id param for security commands Signed-off-by: Keith Busch --- diff --git a/Documentation/nvme-security-recv.1 b/Documentation/nvme-security-recv.1 index ede4d6b2..1355bd59 100644 --- a/Documentation/nvme-security-recv.1 +++ b/Documentation/nvme-security-recv.1 @@ -2,12 +2,12 @@ .\" Title: nvme-security-recv .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 06/08/2015 +.\" Date: 03/03/2016 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SECURITY\-RECV" "1" "06/08/2015" "NVMe" "NVMe Manual" +.TH "NVME\-SECURITY\-RECV" "1" "03/03/2016" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,6 +36,7 @@ nvme-security-recv \- Security Recv command [\-\-secp= | \-p ] [\-\-spsp= | \-s ] [\-\-tl= | \-t ] + [\-\-namespace\-id= | \-n ] [\-b | \-\-raw\-binary] .fi .SH "DESCRIPTION" @@ -47,6 +48,11 @@ The association between a Security Receive command and previous Security Send co Each Security Receive command returns the appropriate data corresponding to a Security Send command as defined by the rules of the Security Protocol\&. The Security Receive command data may not be retained if there is a loss of communication between the controller and host, or if a controller reset occurs\&. .SH "OPTIONS" .PP +\-n , \-\-namespace\-id= +.RS 4 +Target a specific namespace for this security command\&. +.RE +.PP \-x , \-\-size= .RS 4 Size of buffer to allocate\&. One success it will be printed to STDOUT\&. diff --git a/Documentation/nvme-security-recv.html b/Documentation/nvme-security-recv.html index 63af749d..5f681294 100644 --- a/Documentation/nvme-security-recv.html +++ b/Documentation/nvme-security-recv.html @@ -435,7 +435,7 @@ thead, p.table.header { p.table { margin-top: 0; } -/* Because the table frame attribute is overridden by CSS in most browsers. */ +/* Because the table frame attribute is overriden by CSS in most browsers. */ div.tableblock > table[frame="void"] { border-style: none; } @@ -756,6 +756,7 @@ nvme-security-recv(1) Manual Page [--secp=<security-protocol> | -p <security-protocol>] [--spsp=<protocol-specific> | -s <protocol-specific>] [--tl=<transfer-length> | -t <transfer-length>] + [--namespace-id=<nsid> | -n <nsid>] [-b | --raw-binary]
@@ -783,6 +784,17 @@ controller reset occurs.

+-n <nsid> +
+
+--namespace-id=<nsid> +
+
+

+ Target a specific namespace for this security command. +

+
+
-x <size>
@@ -862,7 +874,7 @@ controller reset occurs.


diff --git a/Documentation/nvme-security-recv.txt b/Documentation/nvme-security-recv.txt index 7c055b6c..f58872c4 100644 --- a/Documentation/nvme-security-recv.txt +++ b/Documentation/nvme-security-recv.txt @@ -12,6 +12,7 @@ SYNOPSIS [--secp= | -p ] [--spsp= | -s ] [--tl= | -t ] + [--namespace-id= | -n ] [-b | --raw-binary] DESCRIPTION @@ -33,6 +34,10 @@ controller reset occurs. OPTIONS ------- +-n :: +--namespace-id=:: + Target a specific namespace for this security command. + -x :: --size=:: Size of buffer to allocate. One success it will be printed diff --git a/Documentation/nvme-security-send.1 b/Documentation/nvme-security-send.1 index 4081b16a..2a968dd1 100644 --- a/Documentation/nvme-security-send.1 +++ b/Documentation/nvme-security-send.1 @@ -2,12 +2,12 @@ .\" Title: nvme-security-send .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 06/08/2015 +.\" Date: 03/03/2016 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SECURITY\-SEND" "1" "06/08/2015" "NVMe" "NVMe Manual" +.TH "NVME\-SECURITY\-SEND" "1" "03/03/2016" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,6 +36,7 @@ nvme-security-send \- Security Send command [\-\-secp= | \-p ] [\-\-spsp= | \-s ] [\-\-tl= | \-t ] + [\-\-namespace\-id= | \-n ] .fi .SH "DESCRIPTION" .sp @@ -44,6 +45,11 @@ The Security Send command is used to transfer security protocol data to the cont The association between a Security Send command and subsequent Security Receive command is Security Protocol field dependent as defined in SPC\-4\&. .SH "OPTIONS" .PP +\-n , \-\-namespace\-id= +.RS 4 +Target a specific namespace for this security command\&. +.RE +.PP \-f , \-\-file= .RS 4 Path to file used as the security protocol\(cqs payload\&. Required argument\&. diff --git a/Documentation/nvme-security-send.html b/Documentation/nvme-security-send.html index 456f49e7..fef597a0 100644 --- a/Documentation/nvme-security-send.html +++ b/Documentation/nvme-security-send.html @@ -435,7 +435,7 @@ thead, p.table.header { p.table { margin-top: 0; } -/* Because the table frame attribute is overridden by CSS in most browsers. */ +/* Because the table frame attribute is overriden by CSS in most browsers. */ div.tableblock > table[frame="void"] { border-style: none; } @@ -755,7 +755,8 @@ nvme-security-send(1) Manual Page
nvme security-send [<device>] [--file=<file> | -f <file>]
                     [--secp=<security-protocol> | -p <security-protocol>]
                     [--spsp=<protocol-specific> | -s <protocol-specific>]
-                    [--tl=<transfer-length> | -t <transfer-length>]
+ [--tl=<transfer-length> | -t <transfer-length>] + [--namespace-id=<nsid> | -n <nsid>]
@@ -780,6 +781,17 @@ Receive command is Security Protocol field dependent as defined in SPC-4.

+-n <nsid> +
+
+--namespace-id=<nsid> +
+
+

+ Target a specific namespace for this security command. +

+
+
-f <file>
@@ -848,7 +860,7 @@ Receive command is Security Protocol field dependent as defined in SPC-4.


diff --git a/Documentation/nvme-security-send.txt b/Documentation/nvme-security-send.txt index 0422eab9..6e3f832a 100644 --- a/Documentation/nvme-security-send.txt +++ b/Documentation/nvme-security-send.txt @@ -12,6 +12,7 @@ SYNOPSIS [--secp= | -p ] [--spsp= | -s ] [--tl= | -t ] + [--namespace-id= | -n ] DESCRIPTION ----------- @@ -29,6 +30,10 @@ Receive command is Security Protocol field dependent as defined in SPC-4. OPTIONS ------- +-n :: +--namespace-id=:: + Target a specific namespace for this security command. + -f :: --file=:: Path to file used as the security protocol's payload. Required diff --git a/nvme.c b/nvme.c index d8406da8..04b6d31b 100644 --- a/nvme.c +++ b/nvme.c @@ -1484,12 +1484,14 @@ static int sec_send(int argc, char **argv) const char *secp = "security protocol (cf. SPC-4)"; const char *spsp = "security-protocol-specific (cf. SPC-4)"; const char *tl = "transfer length (cf. SPC-4)"; + const char *namespace_id = "desired namespace"; int err, sec_fd = -1; void *sec_buf; unsigned int sec_size; __u32 result; struct config { + __u32 namespace_id; char *file; __u8 secp; __u16 spsp; @@ -1504,16 +1506,16 @@ static int sec_send(int argc, char **argv) }; const struct argconfig_commandline_options command_line_options[] = { - {"file", 'f', "FILE", CFG_STRING, &cfg.file, required_argument, file}, - {"secp", 'p', "NUM", CFG_BYTE, &cfg.secp, required_argument, secp}, - {"spsp", 's', "NUM", CFG_SHORT, &cfg.spsp, required_argument, spsp}, - {"tl", 't', "NUM", CFG_POSITIVE, &cfg.tl, required_argument, tl}, + {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id, required_argument, namespace_id}, + {"file", 'f', "FILE", CFG_STRING, &cfg.file, required_argument, file}, + {"secp", 'p', "NUM", CFG_BYTE, &cfg.secp, required_argument, secp}, + {"spsp", 's', "NUM", CFG_SHORT, &cfg.spsp, required_argument, spsp}, + {"tl", 't', "NUM", CFG_POSITIVE, &cfg.tl, required_argument, tl}, {0} }; argconfig_parse(argc, argv, desc, command_line_options, &cfg, sizeof(cfg)); - get_dev(1, argc, argv); sec_fd = open(cfg.file, O_RDONLY); @@ -1535,7 +1537,7 @@ static int sec_send(int argc, char **argv) } err = nvme_sec_send(fd, - 0 /* FIXME: add nsid param */, + cfg.namespace_id, 0 /* FIXME: add nssf */, cfg.spsp, cfg.secp, cfg.tl, sec_size, sec_buf, &result); if (err < 0) @@ -2325,11 +2327,13 @@ static int sec_recv(int argc, char **argv) const char *spsp = "security-protocol-specific (cf. SPC-4)"; const char *al = "allocation length (cf. SPC-4)"; const char *raw_binary = "dump output in binary format"; + const char *namespace_id = "desired namespace"; int err; void *sec_buf = NULL; __u32 result; struct config { + __u32 namespace_id; __u32 size; __u8 secp; __u16 spsp; @@ -2345,11 +2349,12 @@ static int sec_recv(int argc, char **argv) }; const struct argconfig_commandline_options command_line_options[] = { - {"size", 'x', "NUM", CFG_POSITIVE, &cfg.size, required_argument, size}, - {"secp", 'p', "NUM", CFG_BYTE, &cfg.secp, required_argument, secp}, - {"spsp", 's', "NUM", CFG_SHORT, &cfg.spsp, required_argument, spsp}, - {"al", 't', "NUM", CFG_POSITIVE, &cfg.al, required_argument, al}, - {"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary}, + {"namespace-id", 'n', "NUM", CFG_POSITIVE, &cfg.namespace_id, required_argument, namespace_id}, + {"size", 'x', "NUM", CFG_POSITIVE, &cfg.size, required_argument, size}, + {"secp", 'p', "NUM", CFG_BYTE, &cfg.secp, required_argument, secp}, + {"spsp", 's', "NUM", CFG_SHORT, &cfg.spsp, required_argument, spsp}, + {"al", 't', "NUM", CFG_POSITIVE, &cfg.al, required_argument, al}, + {"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw_binary}, {0} }; @@ -2367,7 +2372,7 @@ static int sec_recv(int argc, char **argv) } err = nvme_sec_recv(fd, - 0 /* FIXME: namespace_id */, + cfg.namespace_id, 0 /* FIXME: nssf */, cfg.spsp, cfg.secp, cfg.al, cfg.size, sec_buf, &result); if (err < 0)