]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
Add namespace id param for security commands
authorKeith Busch <keith.busch@intel.com>
Thu, 3 Mar 2016 18:14:25 +0000 (11:14 -0700)
committerKeith Busch <keith.busch@intel.com>
Fri, 4 Mar 2016 22:35:40 +0000 (15:35 -0700)
Signed-off-by: Keith Busch <keith.busch@intel.com>
Documentation/nvme-security-recv.1
Documentation/nvme-security-recv.html
Documentation/nvme-security-recv.txt
Documentation/nvme-security-send.1
Documentation/nvme-security-send.html
Documentation/nvme-security-send.txt
nvme.c

index ede4d6b243f728e4d70efc584d99adcabdf3ae0e..1355bd59d805b75f86e089931788881d86ca9324 100644 (file)
@@ -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 <http://docbook.sf.net/>
-.\"      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=<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]
 .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 <nsid>, \-\-namespace\-id=<nsid>
+.RS 4
+Target a specific namespace for this security command\&.
+.RE
+.PP
 \-x <size>, \-\-size=<size>
 .RS 4
 Size of buffer to allocate\&. One success it will be printed to STDOUT\&.
index 63af749dd4b2661ae130e4685f9d6eb9bcdecd1b..5f681294730e89c652b053e98cbb1930247cc7c0 100644 (file)
@@ -435,7 +435,7 @@ thead, p.table.header {
 p.table {\r
   margin-top: 0;\r
 }\r
-/* Because the table frame attribute is overridden by CSS in most browsers. */\r
+/* Because the table frame attribute is overriden by CSS in most browsers. */\r
 div.tableblock > table[frame="void"] {\r
   border-style: none;\r
 }\r
@@ -756,6 +756,7 @@ nvme-security-recv(1) Manual Page
                     [--secp=&lt;security-protocol&gt; | -p &lt;security-protocol&gt;]\r
                     [--spsp=&lt;protocol-specific&gt; | -s &lt;protocol-specific&gt;]\r
                     [--tl=&lt;transfer-length&gt; | -t &lt;transfer-length&gt;]\r
+                    [--namespace-id=&lt;nsid&gt; | -n &lt;nsid&gt;]\r
                     [-b | --raw-binary]</pre>\r
 <div class="attribution">\r
 </div></div>\r
@@ -783,6 +784,17 @@ controller reset occurs.</p></div>
 <div class="sectionbody">\r
 <div class="dlist"><dl>\r
 <dt class="hdlist1">\r
+-n &lt;nsid&gt;\r
+</dt>\r
+<dt class="hdlist1">\r
+--namespace-id=&lt;nsid&gt;\r
+</dt>\r
+<dd>\r
+<p>\r
+        Target a specific namespace for this security command.\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
 -x &lt;size&gt;\r
 </dt>\r
 <dt class="hdlist1">\r
@@ -862,7 +874,7 @@ controller reset occurs.</p></div>
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Last updated 2015-02-09 08:30:40 MST\r
+Last updated 2016-03-03 11:13:26 MST\r
 </div>\r
 </div>\r
 </body>\r
index 7c055b6cba853197d9fbc179b2ce4ee0a77a25e8..f58872c4578a646e14459223dff95a5c1fbfb2cc 100644 (file)
@@ -12,6 +12,7 @@ SYNOPSIS
                    [--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]
 
 DESCRIPTION
@@ -33,6 +34,10 @@ controller reset occurs.
 
 OPTIONS
 -------
+-n <nsid>::
+--namespace-id=<nsid>::
+       Target a specific namespace for this security command.
+
 -x <size>::
 --size=<size>::
        Size of buffer to allocate. One success it will be printed
index 4081b16a41747a5467976599b6bea76a9f93e3d9..2a968dd179e32c737282a62c9375fcd19b1214ba 100644 (file)
@@ -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 <http://docbook.sf.net/>
-.\"      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=<security\-protocol> | \-p <security\-protocol>]
                     [\-\-spsp=<protocol\-specific> | \-s <protocol\-specific>]
                     [\-\-tl=<transfer\-length> | \-t <transfer\-length>]
+                    [\-\-namespace\-id=<nsid> | \-n <nsid>]
 .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 <nsid>, \-\-namespace\-id=<nsid>
+.RS 4
+Target a specific namespace for this security command\&.
+.RE
+.PP
 \-f <file>, \-\-file=<file>
 .RS 4
 Path to file used as the security protocol\(cqs payload\&. Required argument\&.
index 456f49e75ba48661024ff958d30496cd4217017b..fef597a06f5cb1a0cc3cc2c608994a924658a6c2 100644 (file)
@@ -435,7 +435,7 @@ thead, p.table.header {
 p.table {\r
   margin-top: 0;\r
 }\r
-/* Because the table frame attribute is overridden by CSS in most browsers. */\r
+/* Because the table frame attribute is overriden by CSS in most browsers. */\r
 div.tableblock > table[frame="void"] {\r
   border-style: none;\r
 }\r
@@ -755,7 +755,8 @@ nvme-security-send(1) Manual Page
 <pre class="content"><em>nvme security-send</em> [&lt;device&gt;] [--file=&lt;file&gt; | -f &lt;file&gt;]\r
                     [--secp=&lt;security-protocol&gt; | -p &lt;security-protocol&gt;]\r
                     [--spsp=&lt;protocol-specific&gt; | -s &lt;protocol-specific&gt;]\r
-                    [--tl=&lt;transfer-length&gt; | -t &lt;transfer-length&gt;]</pre>\r
+                    [--tl=&lt;transfer-length&gt; | -t &lt;transfer-length&gt;]\r
+                    [--namespace-id=&lt;nsid&gt; | -n &lt;nsid&gt;]</pre>\r
 <div class="attribution">\r
 </div></div>\r
 </div>\r
@@ -780,6 +781,17 @@ Receive command is Security Protocol field dependent as defined in SPC-4.</p></d
 <div class="sectionbody">\r
 <div class="dlist"><dl>\r
 <dt class="hdlist1">\r
+-n &lt;nsid&gt;\r
+</dt>\r
+<dt class="hdlist1">\r
+--namespace-id=&lt;nsid&gt;\r
+</dt>\r
+<dd>\r
+<p>\r
+        Target a specific namespace for this security command.\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
 -f &lt;file&gt;\r
 </dt>\r
 <dt class="hdlist1">\r
@@ -848,7 +860,7 @@ Receive command is Security Protocol field dependent as defined in SPC-4.</p></d
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Last updated 2015-02-09 08:30:40 MST\r
+Last updated 2016-03-03 11:13:55 MST\r
 </div>\r
 </div>\r
 </body>\r
index 0422eab973c4e5a3b1310ef325e310ebb8328095..6e3f832a0007486fc1aa74b56255ea9d216dc5a5 100644 (file)
@@ -12,6 +12,7 @@ SYNOPSIS
                    [--secp=<security-protocol> | -p <security-protocol>]
                    [--spsp=<protocol-specific> | -s <protocol-specific>]
                    [--tl=<transfer-length> | -t <transfer-length>]
+                   [--namespace-id=<nsid> | -n <nsid>]
 
 DESCRIPTION
 -----------
@@ -29,6 +30,10 @@ Receive command is Security Protocol field dependent as defined in SPC-4.
 
 OPTIONS
 -------
+-n <nsid>::
+--namespace-id=<nsid>::
+       Target a specific namespace for this security command.
+
 -f <file>::
 --file=<file>::
        Path to file used as the security protocol's payload. Required
diff --git a/nvme.c b/nvme.c
index d8406da81119e3c40aefc769e4a91fceb7cf39db..04b6d31be005bb8fd85d4a4322fd05266f79df40 100644 (file)
--- 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)