]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
Changed save variable from bool to int
authorroot <slw26c@gmail.com>
Mon, 27 Jun 2016 16:28:33 +0000 (09:28 -0700)
committerroot <slw26c@gmail.com>
Mon, 27 Jun 2016 16:28:33 +0000 (09:28 -0700)
Added "--save/-s" option to man page and documentation
Modified set-feature documentation (Removed invalid command line options, removed references to get-feature, and corrected examples to use set-feature instead of get-feature

Documentation/nvme-set-feature.1
Documentation/nvme-set-feature.html
Documentation/nvme-set-feature.txt
nvme.c

index 3cf3bdf2f2b968d7d847d5057406431e19592703..cbe6bab78424d334c99914cca98518d5e192d673 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: nvme-set-feature
 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
 .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 05/16/2016
+.\"      Date: 06/27/2016
 .\"    Manual: NVMe Manual
 .\"    Source: NVMe
 .\"  Language: English
 .\"
-.TH "NVME\-SET\-FEATURE" "1" "05/16/2016" "NVMe" "NVMe Manual"
+.TH "NVME\-SET\-FEATURE" "1" "06/27/2016" "NVMe" "NVMe Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -33,23 +33,23 @@ nvme-set-feature \- Sets an NVMe feature, returns applicable results
 .sp
 .nf
 \fInvme set\-feature\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>]
-                          [\-\-feature\-id=<fid> | \-f <fid>] [\-\-value=<value>]
+                          [\-\-feature\-id=<fid> | \-f <fid>] [\-\-value=<value> | \-v <value>]
                           [\-\-data\-len=<data\-len> | \-l <data\-len>]
                           [\-\-data=<data\-file> | \-d <data\-file>]
-                          [\-\-raw\-binary | \-b]
+                          [\-\-save| \-s]
 .fi
 .SH "DESCRIPTION"
 .sp
-Submits an NVMe Get Feature admin command and returns the applicable results\&. This may be the feature\(cqs value, or may also include a feature structure if the feature requires it (ex: LBA Range Type)\&.
+Submits an NVMe Set Feature admin command and returns the applicable results\&. This may be the feature\(cqs value, or may also include a feature structure if the feature requires it (ex: LBA Range Type)\&.
 .sp
 The <device> parameter is mandatory and may be either the NVMe character device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1)\&.
 .sp
-On success, the returned feature\(cqs structure (if applicable) may be returned in one of several ways depending on the option flags; the structure may parsed by the program and printed in a readable format if it is a known structure, displayed in hex, or the raw buffer may be printed to stdout for another program to parse\&.
+On success, the value sent to the device is displayed
 .SH "OPTIONS"
 .PP
 \-n <nsid>, \-\-namespace\-id=<nsid>
 .RS 4
-Retrieve the feature for the given nsid\&. This is optional and most features do not use this value\&.
+Sets the feature for the given nsid\&. This is optional and most features do not use this value\&.
 .RE
 .PP
 \-f <fid>, \-\-feature\-id=<fid>
@@ -67,53 +67,16 @@ The data length for the buffer submitted for this feature\&. Most known features
 The data file for the buffer submitted for this feature\&. Most known features do not use this value\&. The exceptions is LBA Range Type and host identifier\&. This defaults to STDIN so files and echo can be piped\&.
 .RE
 .PP
-\-\-value=<value>
+\-v <value>, \-\-value=<value>
 .RS 4
 The value for command dword 11, the value you want to set the feature to\&.
 .RE
-.SH "EXAMPLES"
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Retrieves the feature for Number of Queues, or feature id 7:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-# nvme set\-feature /dev/nvme0 \-f 7
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-The following retrieves the feature for the LBA Range Type, which implicitly requires a buffer and will be printed to the screen in human readable format:
-.sp
-.if n \{\
+.PP
+\-s, \-\-save
 .RS 4
-.\}
-.nf
-# nvme set\-feature /dev/nvme0 \-f 3
-.fi
-.if n \{\
-.RE
-.\}
+Save the attribute so that it persists through all power states and resets\&.
 .RE
+.SH "EXAMPLES"
 .sp
 .RS 4
 .ie n \{\
@@ -123,13 +86,13 @@ The following retrieves the feature for the LBA Range Type, which implicitly req
 .sp -1
 .IP \(bu 2.3
 .\}
-Retrieves the feature for the some vendor specific feature and specifically requesting a buffer be allocate for this feature, which will be displayed to the user in as a hex dump:
+Sets the Power State (PS) to 1 in feature id 2:
 .sp
 .if n \{\
 .RS 4
 .\}
 .nf
-# nvme set\-feature /dev/nvme0 \-f 0xc0 \-l 512
+# nvme set\-feature /dev/nvme0 \-f 2 /dev/nvme0n1 \-v 0x1
 .fi
 .if n \{\
 .RE
@@ -156,29 +119,6 @@ Sets the host id to the ascii string\&.
 .RE
 .\}
 .RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-The following retrieves the feature for the LBA Range Type, which implicitly requires a buffer and will be saved to a file in its raw format:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-# nvme set\-feature /dev/nvme0 \-f 3 \-\-raw\-binary > lba_range\&.raw
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-It is probably a bad idea to not redirect stdout when using this mode\&.
-.RE
 .SH "NVME"
 .sp
 Part of the nvme\-user suite
index 2f507fab212a57dd96dd7827caac3b3bcaf107af..31857158680b5d35136e8023cb1c3fa208f29226 100644 (file)
@@ -3,7 +3,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
 <head>\r
 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />\r
-<meta name="generator" content="AsciiDoc 8.6.7" />\r
+<meta name="generator" content="AsciiDoc 8.6.9" />\r
 <title>nvme-set-feature(1)</title>\r
 <style type="text/css">\r
 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */\r
@@ -87,10 +87,16 @@ ul, ol, li > p {
 ul > li     { color: #aaa; }\r
 ul > li > * { color: black; }\r
 \r
-pre {\r
+.monospaced, code, pre {\r
+  font-family: "Courier New", Courier, monospace;\r
+  font-size: inherit;\r
+  color: navy;\r
   padding: 0;\r
   margin: 0;\r
 }\r
+pre {\r
+  white-space: pre-wrap;\r
+}\r
 \r
 #author {\r
   color: #527bbd;\r
@@ -219,7 +225,7 @@ div.exampleblock > div.content {
 }\r
 \r
 div.imageblock div.content { padding-left: 0; }\r
-span.image img { border-style: none; }\r
+span.image img { border-style: none; vertical-align: text-bottom; }\r
 a.image:visited { color: white; }\r
 \r
 dl {\r
@@ -415,12 +421,6 @@ div.unbreakable { page-break-inside: avoid; }
  *\r
  * */\r
 \r
-tt {\r
-  font-family: "Courier New", Courier, monospace;\r
-  font-size: inherit;\r
-  color: navy;\r
-}\r
-\r
 div.tableblock {\r
   margin-top: 1.0em;\r
   margin-bottom: 1.5em;\r
@@ -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
@@ -454,12 +454,6 @@ div.tableblock > table[frame="vsides"] {
  *\r
  * */\r
 \r
-.monospaced {\r
-  font-family: "Courier New", Courier, monospace;\r
-  font-size: inherit;\r
-  color: navy;\r
-}\r
-\r
 table.tableblock {\r
   margin-top: 1.0em;\r
   margin-bottom: 1.5em;\r
@@ -539,6 +533,8 @@ body.manpage div.sectionbody {
 @media print {\r
   body.manpage div#toc { display: none; }\r
 }\r
+\r
+\r
 </style>\r
 <script type="text/javascript">\r
 /*<![CDATA[*/\r
@@ -753,10 +749,10 @@ nvme-set-feature(1) Manual Page
 <div class="sectionbody">\r
 <div class="verseblock">\r
 <pre class="content"><em>nvme set-feature</em> &lt;device&gt; [--namespace-id=&lt;nsid&gt; | -n &lt;nsid&gt;]\r
-                          [--feature-id=&lt;fid&gt; | -f &lt;fid&gt;] [--value=&lt;value&gt;]\r
+                          [--feature-id=&lt;fid&gt; | -f &lt;fid&gt;] [--value=&lt;value&gt; | -v &lt;value&gt;]\r
                           [--data-len=&lt;data-len&gt; | -l &lt;data-len&gt;]\r
                           [--data=&lt;data-file&gt; | -d &lt;data-file&gt;]\r
-                          [--raw-binary | -b]</pre>\r
+                          [--save| -s]</pre>\r
 <div class="attribution">\r
 </div></div>\r
 </div>\r
@@ -764,16 +760,12 @@ nvme-set-feature(1) Manual Page
 <div class="sect1">\r
 <h2 id="_description">DESCRIPTION</h2>\r
 <div class="sectionbody">\r
-<div class="paragraph"><p>Submits an NVMe Get Feature admin command and returns the applicable\r
+<div class="paragraph"><p>Submits an NVMe Set Feature admin command and returns the applicable\r
 results. This may be the feature&#8217;s value, or may also include a feature\r
 structure if the feature requires it (ex: LBA Range Type).</p></div>\r
 <div class="paragraph"><p>The &lt;device&gt; parameter is mandatory and may be either the NVMe character\r
 device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></div>\r
-<div class="paragraph"><p>On success, the returned feature&#8217;s structure (if applicable) may be\r
-returned in one of several ways depending on the option flags; the\r
-structure may parsed by the program and printed in a readable format\r
-if it is a known structure, displayed in hex, or the raw buffer may be\r
-printed to stdout for another program to parse.</p></div>\r
+<div class="paragraph"><p>On success, the value sent to the device is displayed</p></div>\r
 </div>\r
 </div>\r
 <div class="sect1">\r
@@ -788,7 +780,7 @@ printed to stdout for another program to parse.</p></div>
 </dt>\r
 <dd>\r
 <p>\r
-        Retrieve the feature for the given nsid. This is optional and\r
+        Sets the feature for the given nsid. This is optional and\r
         most features do not use this value.\r
 </p>\r
 </dd>\r
@@ -832,6 +824,9 @@ printed to stdout for another program to parse.</p></div>
 </p>\r
 </dd>\r
 <dt class="hdlist1">\r
+-v &lt;value&gt;\r
+</dt>\r
+<dt class="hdlist1">\r
 --value=&lt;value&gt;\r
 </dt>\r
 <dd>\r
@@ -840,6 +835,17 @@ printed to stdout for another program to parse.</p></div>
         feature to.\r
 </p>\r
 </dd>\r
+<dt class="hdlist1">\r
+-s\r
+</dt>\r
+<dt class="hdlist1">\r
+--save\r
+</dt>\r
+<dd>\r
+<p>\r
+        Save the attribute so that it persists through all power states and resets.\r
+</p>\r
+</dd>\r
 </dl></div>\r
 </div>\r
 </div>\r
@@ -849,33 +855,11 @@ printed to stdout for another program to parse.</p></div>
 <div class="ulist"><ul>\r
 <li>\r
 <p>\r
-Retrieves the feature for Number of Queues, or feature id 7:\r
-</p>\r
-<div class="listingblock">\r
-<div class="content">\r
-<pre><tt># nvme set-feature /dev/nvme0 -f 7</tt></pre>\r
-</div></div>\r
-</li>\r
-<li>\r
-<p>\r
-The following retrieves the feature for the LBA Range Type, which\r
-implicitly requires a buffer and will be printed to the screen in human\r
-readable format:\r
-</p>\r
-<div class="listingblock">\r
-<div class="content">\r
-<pre><tt># nvme set-feature /dev/nvme0 -f 3</tt></pre>\r
-</div></div>\r
-</li>\r
-<li>\r
-<p>\r
-Retrieves the feature for the some vendor specific feature and\r
-specifically requesting a buffer be allocate for this feature, which\r
-will be displayed to the user in as a hex dump:\r
+Sets the Power State (PS) to 1  in feature id 2:\r
 </p>\r
 <div class="listingblock">\r
 <div class="content">\r
-<pre><tt># nvme set-feature /dev/nvme0 -f 0xc0 -l 512</tt></pre>\r
+<pre><code># nvme set-feature /dev/nvme0 -f 2 /dev/nvme0n1 -v 0x1</code></pre>\r
 </div></div>\r
 </li>\r
 <li>\r
@@ -884,20 +868,8 @@ Sets the host id to the ascii string.
 </p>\r
 <div class="listingblock">\r
 <div class="content">\r
-<pre><tt># echo "abcdefgh" | nvme set-feature /dev/nvme0 -f 0x81 -l 8</tt></pre>\r
-</div></div>\r
-</li>\r
-<li>\r
-<p>\r
-The following retrieves the feature for the LBA Range Type, which\r
-implicitly requires a buffer and will be saved to a file in its raw\r
-format:\r
-</p>\r
-<div class="listingblock">\r
-<div class="content">\r
-<pre><tt># nvme set-feature /dev/nvme0 -f 3 --raw-binary &gt; lba_range.raw</tt></pre>\r
+<pre><code># echo "abcdefgh" | nvme set-feature /dev/nvme0 -f 0x81 -l 8</code></pre>\r
 </div></div>\r
-<div class="paragraph"><p>It is probably a bad idea to not redirect stdout when using this mode.</p></div>\r
 </li>\r
 </ul></div>\r
 </div>\r
@@ -912,7 +884,7 @@ format:
 <div id="footnotes"><hr /></div>\r
 <div id="footer">\r
 <div id="footer-text">\r
-Last updated 2016-02-26 08:29:25 MST\r
+Last updated 2016-06-27 09:18:46 PDT\r
 </div>\r
 </div>\r
 </body>\r
index 50a5856dd47fe6b3bdc03da10e2e6fe1c675f9e5..ca1874d40f08ed139434a393975011a5b0ebc7ee 100644 (file)
@@ -9,31 +9,27 @@ SYNOPSIS
 --------
 [verse]
 'nvme set-feature' <device> [--namespace-id=<nsid> | -n <nsid>]
-                         [--feature-id=<fid> | -f <fid>] [--value=<value>]
+                         [--feature-id=<fid> | -f <fid>] [--value=<value> | -v <value>]
                          [--data-len=<data-len> | -l <data-len>]
                          [--data=<data-file> | -d <data-file>]
-                         [--raw-binary | -b]
+                         [--save| -s]
 
 DESCRIPTION
 -----------
-Submits an NVMe Get Feature admin command and returns the applicable
+Submits an NVMe Set Feature admin command and returns the applicable
 results. This may be the feature's value, or may also include a feature
 structure if the feature requires it (ex: LBA Range Type).
 
 The <device> parameter is mandatory and may be either the NVMe character
 device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).
 
-On success, the returned feature's structure (if applicable) may be
-returned in one of several ways depending on the option flags; the
-structure may parsed by the program and printed in a readable format
-if it is a known structure, displayed in hex, or the raw buffer may be
-printed to stdout for another program to parse.
+On success, the value sent to the device is displayed
 
 OPTIONS
 -------
 -n <nsid>::
 --namespace-id=<nsid>::
-       Retrieve the feature for the given nsid. This is optional and
+       Sets the feature for the given nsid. This is optional and
        most features do not use this value.
 
 -f <fid>::
@@ -54,35 +50,21 @@ OPTIONS
        Range Type and host identifier. This defaults to STDIN so files
        and echo can be piped.
 
+-v <value>::
 --value=<value>::
        The value for command dword 11, the value you want to set the
        feature to.
 
+-s::
+--save::
+       Save the attribute so that it persists through all power states and resets.     
 
 EXAMPLES
 --------
-* Retrieves the feature for Number of Queues, or feature id 7:
+* Sets the Power State (PS) to 1  in feature id 2:
 +
 ------------
-# nvme set-feature /dev/nvme0 -f 7
-------------
-+
-
-* The following retrieves the feature for the LBA Range Type, which
-implicitly requires a buffer and will be printed to the screen in human
-readable format:
-+
-------------
-# nvme set-feature /dev/nvme0 -f 3
-------------
-+
-
-* Retrieves the feature for the some vendor specific feature and
-specifically requesting a buffer be allocate for this feature, which
-will be displayed to the user in as a hex dump:
-+
-------------
-# nvme set-feature /dev/nvme0 -f 0xc0 -l 512
+# nvme set-feature /dev/nvme0 -f 2 /dev/nvme0n1 -v 0x1
 ------------
 +
 
@@ -91,17 +73,6 @@ will be displayed to the user in as a hex dump:
 ------------
 # echo "abcdefgh" | nvme set-feature /dev/nvme0 -f 0x81 -l 8
 ------------
-+
-
-* The following retrieves the feature for the LBA Range Type, which
-implicitly requires a buffer and will be saved to a file in its raw
-format:
-+
-------------
-# nvme set-feature /dev/nvme0 -f 3 --raw-binary > lba_range.raw
-------------
-+
-It is probably a bad idea to not redirect stdout when using this mode.
 
 NVME
 ----
diff --git a/nvme.c b/nvme.c
index 3a30d174409d5012463728ed648cee9db9af9a2b..2bd194c4d54f3ca8b9a38c3515a8430c3f3f6245 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -1450,7 +1450,7 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin
                __u32 feature_id;
                __u32 value;
                __u32 data_len;
-               bool  save;
+               int   save;
        };
 
        struct config cfg = {
@@ -1459,7 +1459,7 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin
                .feature_id   = 0,
                .value        = 0,
                .data_len     = 0,
-               .save         = false,
+               .save         = 0,
        };
 
        const struct argconfig_commandline_options command_line_options[] = {