]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
Add data-set management command
authorKeith Busch <keith.busch@intel.com>
Fri, 23 Oct 2015 22:56:07 +0000 (16:56 -0600)
committerKeith Busch <keith.busch@intel.com>
Fri, 23 Oct 2015 22:56:07 +0000 (16:56 -0600)
By popular demand...

Signed-off-by: Keith Busch <keith.busch@intel.com>
Documentation/cmds-main.txt
Documentation/nvme-dsm.1 [new file with mode: 0644]
Documentation/nvme-dsm.html [new file with mode: 0644]
Documentation/nvme-dsm.txt [new file with mode: 0644]
nvme.c
src/argconfig.c
src/argconfig.h

index e05b35de888cece2fb4b2d93737687ade9438604..ed0312697e4667c19d8b03fee5544ae368914094 100644 (file)
@@ -10,6 +10,9 @@ linknvme:nvme-error-log[1]::
 linknvme:nvme-flush[1]::
        Submit flush
 
+linknvme:nvme-dms[1]::
+       Submit Data Set Management
+
 linknvme:nvme-format[1]::
        Format namespace(s)
 
diff --git a/Documentation/nvme-dsm.1 b/Documentation/nvme-dsm.1
new file mode 100644 (file)
index 0000000..e29f0d5
--- /dev/null
@@ -0,0 +1,97 @@
+'\" t
+.\"     Title: nvme-dsm
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\"      Date: 10/23/2015
+.\"    Manual: NVMe Manual
+.\"    Source: NVMe
+.\"  Language: English
+.\"
+.TH "NVME\-DSM" "1" "10/23/2015" "NVMe" "NVMe Manual"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el       .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+nvme-dsm \- Send NVMe Data Set Management, return results
+.SH "SYNOPSIS"
+.sp
+.nf
+\fInvme dsm\fR <device>  [ \-\-namespace\-id=<nsid> | \-n <nsid> ]
+                        [ \-\-ctx\-attrs=<attribute\-list,> | \-a <attribute\-list,> ]
+                        [ \-\-blocks=<nlb\-list,> | \-b <nlb\-list,> ]
+                        [ \-\-slbs=<slba\-list,> | \-s <slba\-list,> ]
+                        [ \-\-ad | \-d ] [ \-\-idw | \-w ] [ \-\-idr | \-r ]
+                        [ \-\-cdw11=<cdw11> | \-c <cdw11> ]
+.fi
+.SH "DESCRIPTION"
+.sp
+For the NVMe device given, sends an Data Set Management command and provides the result and returned structure\&.
+.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)\&. If the character device is given, the \*(Aq\-\-namespace\-id\*(Aq option is mandatory, otherwise it will use the ns\-id of the namespace for the block device you opened\&. For block devices, the ns\-id used can be overridden with the same option\&.
+.sp
+You must specify at least one of the values for range list\&. If the range lists provided do not list the same number of elements, the default values for the remaining in the range will be set to 0\&.
+.sp
+The command dword 11 may be provided at the command line\&. For convenience, the current defined attributes (discard, integral read/write) for a data\-set management have flags\&. If cdw11 is specified, this will override any settings from the flags may have provided\&.
+.SH "OPTIONS"
+.PP
+\-n <nsid>, \-\-namespace\-id=<nsid>
+.RS 4
+Sends the command with the requested nsid\&. This is required for the character devices, or overrides the block nsid if given\&.
+.RE
+.PP
+\-a <attribute\-list,>, \-\-ctx\-attrs=<attribute\-list>
+.RS 4
+Comma separated list of the context attributes in each range
+.RE
+.PP
+\-b <nlb\-list,>, \-\-blocks=<nlb\-list,>
+.RS 4
+Comma separated list of the number of blocks in each range
+.RE
+.PP
+\-s <slba\-list,>, \-\-slbs=<slba\-list,>
+.RS 4
+Comma separated list of the starting block in each range
+.RE
+.PP
+\-d <deallocate>, \-\-ad=<deallocate>
+.RS 4
+Attribute Deallocate\&.
+.RE
+.PP
+\-w <write>, \-\-idw=<write>
+.RS 4
+Attribute Integral Dataset for Write\&.
+.RE
+.PP
+\-r <read>, \-\-idr=<read>
+.RS 4
+Attribute Integral Dataset for Read\&.
+.RE
+.PP
+\-c <cdw11>, \-\-cdw11=<cdw11>
+.RS 4
+All the command command dword 11 attribuets\&. Use exclusive from speficying individual attributes
+.RE
+.SH "EXAMPLES"
+.sp
+No examples yet
+.SH "NVME"
+.sp
+Part of the nvme\-user suite
diff --git a/Documentation/nvme-dsm.html b/Documentation/nvme-dsm.html
new file mode 100644 (file)
index 0000000..9c6d42f
--- /dev/null
@@ -0,0 +1,902 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"\r
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
+<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
+<title>nvme-dsm(1)</title>\r
+<style type="text/css">\r
+/* Shared CSS for AsciiDoc xhtml11 and html5 backends */\r
+\r
+/* Default font. */\r
+body {\r
+  font-family: Georgia,serif;\r
+}\r
+\r
+/* Title font. */\r
+h1, h2, h3, h4, h5, h6,\r
+div.title, caption.title,\r
+thead, p.table.header,\r
+#toctitle,\r
+#author, #revnumber, #revdate, #revremark,\r
+#footer {\r
+  font-family: Arial,Helvetica,sans-serif;\r
+}\r
+\r
+body {\r
+  margin: 1em 5% 1em 5%;\r
+}\r
+\r
+a {\r
+  color: blue;\r
+  text-decoration: underline;\r
+}\r
+a:visited {\r
+  color: fuchsia;\r
+}\r
+\r
+em {\r
+  font-style: italic;\r
+  color: navy;\r
+}\r
+\r
+strong {\r
+  font-weight: bold;\r
+  color: #083194;\r
+}\r
+\r
+h1, h2, h3, h4, h5, h6 {\r
+  color: #527bbd;\r
+  margin-top: 1.2em;\r
+  margin-bottom: 0.5em;\r
+  line-height: 1.3;\r
+}\r
+\r
+h1, h2, h3 {\r
+  border-bottom: 2px solid silver;\r
+}\r
+h2 {\r
+  padding-top: 0.5em;\r
+}\r
+h3 {\r
+  float: left;\r
+}\r
+h3 + * {\r
+  clear: left;\r
+}\r
+h5 {\r
+  font-size: 1.0em;\r
+}\r
+\r
+div.sectionbody {\r
+  margin-left: 0;\r
+}\r
+\r
+hr {\r
+  border: 1px solid silver;\r
+}\r
+\r
+p {\r
+  margin-top: 0.5em;\r
+  margin-bottom: 0.5em;\r
+}\r
+\r
+ul, ol, li > p {\r
+  margin-top: 0;\r
+}\r
+ul > li     { color: #aaa; }\r
+ul > li > * { color: black; }\r
+\r
+pre {\r
+  padding: 0;\r
+  margin: 0;\r
+}\r
+\r
+#author {\r
+  color: #527bbd;\r
+  font-weight: bold;\r
+  font-size: 1.1em;\r
+}\r
+#email {\r
+}\r
+#revnumber, #revdate, #revremark {\r
+}\r
+\r
+#footer {\r
+  font-size: small;\r
+  border-top: 2px solid silver;\r
+  padding-top: 0.5em;\r
+  margin-top: 4.0em;\r
+}\r
+#footer-text {\r
+  float: left;\r
+  padding-bottom: 0.5em;\r
+}\r
+#footer-badges {\r
+  float: right;\r
+  padding-bottom: 0.5em;\r
+}\r
+\r
+#preamble {\r
+  margin-top: 1.5em;\r
+  margin-bottom: 1.5em;\r
+}\r
+div.imageblock, div.exampleblock, div.verseblock,\r
+div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,\r
+div.admonitionblock {\r
+  margin-top: 1.0em;\r
+  margin-bottom: 1.5em;\r
+}\r
+div.admonitionblock {\r
+  margin-top: 2.0em;\r
+  margin-bottom: 2.0em;\r
+  margin-right: 10%;\r
+  color: #606060;\r
+}\r
+\r
+div.content { /* Block element content. */\r
+  padding: 0;\r
+}\r
+\r
+/* Block element titles. */\r
+div.title, caption.title {\r
+  color: #527bbd;\r
+  font-weight: bold;\r
+  text-align: left;\r
+  margin-top: 1.0em;\r
+  margin-bottom: 0.5em;\r
+}\r
+div.title + * {\r
+  margin-top: 0;\r
+}\r
+\r
+td div.title:first-child {\r
+  margin-top: 0.0em;\r
+}\r
+div.content div.title:first-child {\r
+  margin-top: 0.0em;\r
+}\r
+div.content + div.title {\r
+  margin-top: 0.0em;\r
+}\r
+\r
+div.sidebarblock > div.content {\r
+  background: #ffffee;\r
+  border: 1px solid #dddddd;\r
+  border-left: 4px solid #f0f0f0;\r
+  padding: 0.5em;\r
+}\r
+\r
+div.listingblock > div.content {\r
+  border: 1px solid #dddddd;\r
+  border-left: 5px solid #f0f0f0;\r
+  background: #f8f8f8;\r
+  padding: 0.5em;\r
+}\r
+\r
+div.quoteblock, div.verseblock {\r
+  padding-left: 1.0em;\r
+  margin-left: 1.0em;\r
+  margin-right: 10%;\r
+  border-left: 5px solid #f0f0f0;\r
+  color: #888;\r
+}\r
+\r
+div.quoteblock > div.attribution {\r
+  padding-top: 0.5em;\r
+  text-align: right;\r
+}\r
+\r
+div.verseblock > pre.content {\r
+  font-family: inherit;\r
+  font-size: inherit;\r
+}\r
+div.verseblock > div.attribution {\r
+  padding-top: 0.75em;\r
+  text-align: left;\r
+}\r
+/* DEPRECATED: Pre version 8.2.7 verse style literal block. */\r
+div.verseblock + div.attribution {\r
+  text-align: left;\r
+}\r
+\r
+div.admonitionblock .icon {\r
+  vertical-align: top;\r
+  font-size: 1.1em;\r
+  font-weight: bold;\r
+  text-decoration: underline;\r
+  color: #527bbd;\r
+  padding-right: 0.5em;\r
+}\r
+div.admonitionblock td.content {\r
+  padding-left: 0.5em;\r
+  border-left: 3px solid #dddddd;\r
+}\r
+\r
+div.exampleblock > div.content {\r
+  border-left: 3px solid #dddddd;\r
+  padding-left: 0.5em;\r
+}\r
+\r
+div.imageblock div.content { padding-left: 0; }\r
+span.image img { border-style: none; }\r
+a.image:visited { color: white; }\r
+\r
+dl {\r
+  margin-top: 0.8em;\r
+  margin-bottom: 0.8em;\r
+}\r
+dt {\r
+  margin-top: 0.5em;\r
+  margin-bottom: 0;\r
+  font-style: normal;\r
+  color: navy;\r
+}\r
+dd > *:first-child {\r
+  margin-top: 0.1em;\r
+}\r
+\r
+ul, ol {\r
+    list-style-position: outside;\r
+}\r
+ol.arabic {\r
+  list-style-type: decimal;\r
+}\r
+ol.loweralpha {\r
+  list-style-type: lower-alpha;\r
+}\r
+ol.upperalpha {\r
+  list-style-type: upper-alpha;\r
+}\r
+ol.lowerroman {\r
+  list-style-type: lower-roman;\r
+}\r
+ol.upperroman {\r
+  list-style-type: upper-roman;\r
+}\r
+\r
+div.compact ul, div.compact ol,\r
+div.compact p, div.compact p,\r
+div.compact div, div.compact div {\r
+  margin-top: 0.1em;\r
+  margin-bottom: 0.1em;\r
+}\r
+\r
+tfoot {\r
+  font-weight: bold;\r
+}\r
+td > div.verse {\r
+  white-space: pre;\r
+}\r
+\r
+div.hdlist {\r
+  margin-top: 0.8em;\r
+  margin-bottom: 0.8em;\r
+}\r
+div.hdlist tr {\r
+  padding-bottom: 15px;\r
+}\r
+dt.hdlist1.strong, td.hdlist1.strong {\r
+  font-weight: bold;\r
+}\r
+td.hdlist1 {\r
+  vertical-align: top;\r
+  font-style: normal;\r
+  padding-right: 0.8em;\r
+  color: navy;\r
+}\r
+td.hdlist2 {\r
+  vertical-align: top;\r
+}\r
+div.hdlist.compact tr {\r
+  margin: 0;\r
+  padding-bottom: 0;\r
+}\r
+\r
+.comment {\r
+  background: yellow;\r
+}\r
+\r
+.footnote, .footnoteref {\r
+  font-size: 0.8em;\r
+}\r
+\r
+span.footnote, span.footnoteref {\r
+  vertical-align: super;\r
+}\r
+\r
+#footnotes {\r
+  margin: 20px 0 20px 0;\r
+  padding: 7px 0 0 0;\r
+}\r
+\r
+#footnotes div.footnote {\r
+  margin: 0 0 5px 0;\r
+}\r
+\r
+#footnotes hr {\r
+  border: none;\r
+  border-top: 1px solid silver;\r
+  height: 1px;\r
+  text-align: left;\r
+  margin-left: 0;\r
+  width: 20%;\r
+  min-width: 100px;\r
+}\r
+\r
+div.colist td {\r
+  padding-right: 0.5em;\r
+  padding-bottom: 0.3em;\r
+  vertical-align: top;\r
+}\r
+div.colist td img {\r
+  margin-top: 0.3em;\r
+}\r
+\r
+@media print {\r
+  #footer-badges { display: none; }\r
+}\r
+\r
+#toc {\r
+  margin-bottom: 2.5em;\r
+}\r
+\r
+#toctitle {\r
+  color: #527bbd;\r
+  font-size: 1.1em;\r
+  font-weight: bold;\r
+  margin-top: 1.0em;\r
+  margin-bottom: 0.1em;\r
+}\r
+\r
+div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {\r
+  margin-top: 0;\r
+  margin-bottom: 0;\r
+}\r
+div.toclevel2 {\r
+  margin-left: 2em;\r
+  font-size: 0.9em;\r
+}\r
+div.toclevel3 {\r
+  margin-left: 4em;\r
+  font-size: 0.9em;\r
+}\r
+div.toclevel4 {\r
+  margin-left: 6em;\r
+  font-size: 0.9em;\r
+}\r
+\r
+span.aqua { color: aqua; }\r
+span.black { color: black; }\r
+span.blue { color: blue; }\r
+span.fuchsia { color: fuchsia; }\r
+span.gray { color: gray; }\r
+span.green { color: green; }\r
+span.lime { color: lime; }\r
+span.maroon { color: maroon; }\r
+span.navy { color: navy; }\r
+span.olive { color: olive; }\r
+span.purple { color: purple; }\r
+span.red { color: red; }\r
+span.silver { color: silver; }\r
+span.teal { color: teal; }\r
+span.white { color: white; }\r
+span.yellow { color: yellow; }\r
+\r
+span.aqua-background { background: aqua; }\r
+span.black-background { background: black; }\r
+span.blue-background { background: blue; }\r
+span.fuchsia-background { background: fuchsia; }\r
+span.gray-background { background: gray; }\r
+span.green-background { background: green; }\r
+span.lime-background { background: lime; }\r
+span.maroon-background { background: maroon; }\r
+span.navy-background { background: navy; }\r
+span.olive-background { background: olive; }\r
+span.purple-background { background: purple; }\r
+span.red-background { background: red; }\r
+span.silver-background { background: silver; }\r
+span.teal-background { background: teal; }\r
+span.white-background { background: white; }\r
+span.yellow-background { background: yellow; }\r
+\r
+span.big { font-size: 2em; }\r
+span.small { font-size: 0.6em; }\r
+\r
+span.underline { text-decoration: underline; }\r
+span.overline { text-decoration: overline; }\r
+span.line-through { text-decoration: line-through; }\r
+\r
+div.unbreakable { page-break-inside: avoid; }\r
+\r
+\r
+/*\r
+ * xhtml11 specific\r
+ *\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
+}\r
+div.tableblock > table {\r
+  border: 3px solid #527bbd;\r
+}\r
+thead, p.table.header {\r
+  font-weight: bold;\r
+  color: #527bbd;\r
+}\r
+p.table {\r
+  margin-top: 0;\r
+}\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
+div.tableblock > table[frame="hsides"] {\r
+  border-left-style: none;\r
+  border-right-style: none;\r
+}\r
+div.tableblock > table[frame="vsides"] {\r
+  border-top-style: none;\r
+  border-bottom-style: none;\r
+}\r
+\r
+\r
+/*\r
+ * html5 specific\r
+ *\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
+}\r
+thead, p.tableblock.header {\r
+  font-weight: bold;\r
+  color: #527bbd;\r
+}\r
+p.tableblock {\r
+  margin-top: 0;\r
+}\r
+table.tableblock {\r
+  border-width: 3px;\r
+  border-spacing: 0px;\r
+  border-style: solid;\r
+  border-color: #527bbd;\r
+  border-collapse: collapse;\r
+}\r
+th.tableblock, td.tableblock {\r
+  border-width: 1px;\r
+  padding: 4px;\r
+  border-style: solid;\r
+  border-color: #527bbd;\r
+}\r
+\r
+table.tableblock.frame-topbot {\r
+  border-left-style: hidden;\r
+  border-right-style: hidden;\r
+}\r
+table.tableblock.frame-sides {\r
+  border-top-style: hidden;\r
+  border-bottom-style: hidden;\r
+}\r
+table.tableblock.frame-none {\r
+  border-style: hidden;\r
+}\r
+\r
+th.tableblock.halign-left, td.tableblock.halign-left {\r
+  text-align: left;\r
+}\r
+th.tableblock.halign-center, td.tableblock.halign-center {\r
+  text-align: center;\r
+}\r
+th.tableblock.halign-right, td.tableblock.halign-right {\r
+  text-align: right;\r
+}\r
+\r
+th.tableblock.valign-top, td.tableblock.valign-top {\r
+  vertical-align: top;\r
+}\r
+th.tableblock.valign-middle, td.tableblock.valign-middle {\r
+  vertical-align: middle;\r
+}\r
+th.tableblock.valign-bottom, td.tableblock.valign-bottom {\r
+  vertical-align: bottom;\r
+}\r
+\r
+\r
+/*\r
+ * manpage specific\r
+ *\r
+ * */\r
+\r
+body.manpage h1 {\r
+  padding-top: 0.5em;\r
+  padding-bottom: 0.5em;\r
+  border-top: 2px solid silver;\r
+  border-bottom: 2px solid silver;\r
+}\r
+body.manpage h2 {\r
+  border-style: none;\r
+}\r
+body.manpage div.sectionbody {\r
+  margin-left: 3em;\r
+}\r
+\r
+@media print {\r
+  body.manpage div#toc { display: none; }\r
+}\r
+</style>\r
+<script type="text/javascript">\r
+/*<![CDATA[*/\r
+var asciidoc = {  // Namespace.\r
+\r
+/////////////////////////////////////////////////////////////////////\r
+// Table Of Contents generator\r
+/////////////////////////////////////////////////////////////////////\r
+\r
+/* Author: Mihai Bazon, September 2002\r
+ * http://students.infoiasi.ro/~mishoo\r
+ *\r
+ * Table Of Content generator\r
+ * Version: 0.4\r
+ *\r
+ * Feel free to use this script under the terms of the GNU General Public\r
+ * License, as long as you do not remove or alter this notice.\r
+ */\r
+\r
+ /* modified by Troy D. Hanson, September 2006. License: GPL */\r
+ /* modified by Stuart Rackham, 2006, 2009. License: GPL */\r
+\r
+// toclevels = 1..4.\r
+toc: function (toclevels) {\r
+\r
+  function getText(el) {\r
+    var text = "";\r
+    for (var i = el.firstChild; i != null; i = i.nextSibling) {\r
+      if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.\r
+        text += i.data;\r
+      else if (i.firstChild != null)\r
+        text += getText(i);\r
+    }\r
+    return text;\r
+  }\r
+\r
+  function TocEntry(el, text, toclevel) {\r
+    this.element = el;\r
+    this.text = text;\r
+    this.toclevel = toclevel;\r
+  }\r
+\r
+  function tocEntries(el, toclevels) {\r
+    var result = new Array;\r
+    var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');\r
+    // Function that scans the DOM tree for header elements (the DOM2\r
+    // nodeIterator API would be a better technique but not supported by all\r
+    // browsers).\r
+    var iterate = function (el) {\r
+      for (var i = el.firstChild; i != null; i = i.nextSibling) {\r
+        if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {\r
+          var mo = re.exec(i.tagName);\r
+          if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {\r
+            result[result.length] = new TocEntry(i, getText(i), mo[1]-1);\r
+          }\r
+          iterate(i);\r
+        }\r
+      }\r
+    }\r
+    iterate(el);\r
+    return result;\r
+  }\r
+\r
+  var toc = document.getElementById("toc");\r
+  if (!toc) {\r
+    return;\r
+  }\r
+\r
+  // Delete existing TOC entries in case we're reloading the TOC.\r
+  var tocEntriesToRemove = [];\r
+  var i;\r
+  for (i = 0; i < toc.childNodes.length; i++) {\r
+    var entry = toc.childNodes[i];\r
+    if (entry.nodeName.toLowerCase() == 'div'\r
+     && entry.getAttribute("class")\r
+     && entry.getAttribute("class").match(/^toclevel/))\r
+      tocEntriesToRemove.push(entry);\r
+  }\r
+  for (i = 0; i < tocEntriesToRemove.length; i++) {\r
+    toc.removeChild(tocEntriesToRemove[i]);\r
+  }\r
+\r
+  // Rebuild TOC entries.\r
+  var entries = tocEntries(document.getElementById("content"), toclevels);\r
+  for (var i = 0; i < entries.length; ++i) {\r
+    var entry = entries[i];\r
+    if (entry.element.id == "")\r
+      entry.element.id = "_toc_" + i;\r
+    var a = document.createElement("a");\r
+    a.href = "#" + entry.element.id;\r
+    a.appendChild(document.createTextNode(entry.text));\r
+    var div = document.createElement("div");\r
+    div.appendChild(a);\r
+    div.className = "toclevel" + entry.toclevel;\r
+    toc.appendChild(div);\r
+  }\r
+  if (entries.length == 0)\r
+    toc.parentNode.removeChild(toc);\r
+},\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////\r
+// Footnotes generator\r
+/////////////////////////////////////////////////////////////////////\r
+\r
+/* Based on footnote generation code from:\r
+ * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html\r
+ */\r
+\r
+footnotes: function () {\r
+  // Delete existing footnote entries in case we're reloading the footnodes.\r
+  var i;\r
+  var noteholder = document.getElementById("footnotes");\r
+  if (!noteholder) {\r
+    return;\r
+  }\r
+  var entriesToRemove = [];\r
+  for (i = 0; i < noteholder.childNodes.length; i++) {\r
+    var entry = noteholder.childNodes[i];\r
+    if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")\r
+      entriesToRemove.push(entry);\r
+  }\r
+  for (i = 0; i < entriesToRemove.length; i++) {\r
+    noteholder.removeChild(entriesToRemove[i]);\r
+  }\r
+\r
+  // Rebuild footnote entries.\r
+  var cont = document.getElementById("content");\r
+  var spans = cont.getElementsByTagName("span");\r
+  var refs = {};\r
+  var n = 0;\r
+  for (i=0; i<spans.length; i++) {\r
+    if (spans[i].className == "footnote") {\r
+      n++;\r
+      var note = spans[i].getAttribute("data-note");\r
+      if (!note) {\r
+        // Use [\s\S] in place of . so multi-line matches work.\r
+        // Because JavaScript has no s (dotall) regex flag.\r
+        note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];\r
+        spans[i].innerHTML =\r
+          "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +\r
+          "' title='View footnote' class='footnote'>" + n + "</a>]";\r
+        spans[i].setAttribute("data-note", note);\r
+      }\r
+      noteholder.innerHTML +=\r
+        "<div class='footnote' id='_footnote_" + n + "'>" +\r
+        "<a href='#_footnoteref_" + n + "' title='Return to text'>" +\r
+        n + "</a>. " + note + "</div>";\r
+      var id =spans[i].getAttribute("id");\r
+      if (id != null) refs["#"+id] = n;\r
+    }\r
+  }\r
+  if (n == 0)\r
+    noteholder.parentNode.removeChild(noteholder);\r
+  else {\r
+    // Process footnoterefs.\r
+    for (i=0; i<spans.length; i++) {\r
+      if (spans[i].className == "footnoteref") {\r
+        var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");\r
+        href = href.match(/#.*/)[0];  // Because IE return full URL.\r
+        n = refs[href];\r
+        spans[i].innerHTML =\r
+          "[<a href='#_footnote_" + n +\r
+          "' title='View footnote' class='footnote'>" + n + "</a>]";\r
+      }\r
+    }\r
+  }\r
+},\r
+\r
+install: function(toclevels) {\r
+  var timerId;\r
+\r
+  function reinstall() {\r
+    asciidoc.footnotes();\r
+    if (toclevels) {\r
+      asciidoc.toc(toclevels);\r
+    }\r
+  }\r
+\r
+  function reinstallAndRemoveTimer() {\r
+    clearInterval(timerId);\r
+    reinstall();\r
+  }\r
+\r
+  timerId = setInterval(reinstall, 500);\r
+  if (document.addEventListener)\r
+    document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);\r
+  else\r
+    window.onload = reinstallAndRemoveTimer;\r
+}\r
+\r
+}\r
+asciidoc.install();\r
+/*]]>*/\r
+</script>\r
+</head>\r
+<body class="manpage">\r
+<div id="header">\r
+<h1>\r
+nvme-dsm(1) Manual Page\r
+</h1>\r
+<h2>NAME</h2>\r
+<div class="sectionbody">\r
+<p>nvme-dsm -\r
+   Send NVMe Data Set Management, return results\r
+</p>\r
+</div>\r
+</div>\r
+<div id="content">\r
+<div class="sect1">\r
+<h2 id="_synopsis">SYNOPSIS</h2>\r
+<div class="sectionbody">\r
+<div class="verseblock">\r
+<pre class="content"><em>nvme dsm</em> &lt;device&gt;  [ --namespace-id=&lt;nsid&gt; | -n &lt;nsid&gt; ]\r
+                        [ --ctx-attrs=&lt;attribute-list,&gt; | -a &lt;attribute-list,&gt; ]\r
+                        [ --blocks=&lt;nlb-list,&gt; | -b &lt;nlb-list,&gt; ]\r
+                        [ --slbs=&lt;slba-list,&gt; | -s &lt;slba-list,&gt; ]\r
+                        [ --ad | -d ] [ --idw | -w ] [ --idr | -r ]\r
+                        [ --cdw11=&lt;cdw11&gt; | -c &lt;cdw11&gt; ]</pre>\r
+<div class="attribution">\r
+</div></div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
+<h2 id="_description">DESCRIPTION</h2>\r
+<div class="sectionbody">\r
+<div class="paragraph"><p>For the NVMe device given, sends an Data Set Management command and\r
+provides the result and returned structure.</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).\r
+If the character device is given, the <tt>'--namespace-id'</tt> option is\r
+mandatory, otherwise it will use the ns-id of the namespace for the block\r
+device you opened. For block devices, the ns-id used can be overridden\r
+with the same option.</p></div>\r
+<div class="paragraph"><p>You must specify at least one of the values for range list. If the range\r
+lists provided do not list the same number of elements, the default\r
+values for the remaining in the range will be set to 0.</p></div>\r
+<div class="paragraph"><p>The command dword 11 may be provided at the command line. For convenience,\r
+the current defined attributes (discard, integral read/write) for a\r
+data-set management have flags. If cdw11 is specified, this will override\r
+any settings from the flags may have provided.</p></div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
+<h2 id="_options">OPTIONS</h2>\r
+<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
+        Sends the command with the requested nsid. This is required for the\r
+        character devices, or overrides the block nsid if given.\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
+-a &lt;attribute-list,&gt;\r
+</dt>\r
+<dt class="hdlist1">\r
+--ctx-attrs=&lt;attribute-list&gt;\r
+</dt>\r
+<dd>\r
+<p>\r
+        Comma separated list of the context attributes in each range\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
+-b &lt;nlb-list,&gt;\r
+</dt>\r
+<dt class="hdlist1">\r
+--blocks=&lt;nlb-list,&gt;\r
+</dt>\r
+<dd>\r
+<p>\r
+        Comma separated list of the number of blocks in each range\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
+-s &lt;slba-list,&gt;\r
+</dt>\r
+<dt class="hdlist1">\r
+--slbs=&lt;slba-list,&gt;\r
+</dt>\r
+<dd>\r
+<p>\r
+        Comma separated list of the starting block in each range\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
+-d &lt;deallocate&gt;\r
+</dt>\r
+<dt class="hdlist1">\r
+--ad=&lt;deallocate&gt;\r
+</dt>\r
+<dd>\r
+<p>\r
+        Attribute Deallocate.\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
+-w &lt;write&gt;\r
+</dt>\r
+<dt class="hdlist1">\r
+--idw=&lt;write&gt;\r
+</dt>\r
+<dd>\r
+<p>\r
+        Attribute Integral Dataset for Write.\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
+-r &lt;read&gt;\r
+</dt>\r
+<dt class="hdlist1">\r
+--idr=&lt;read&gt;\r
+</dt>\r
+<dd>\r
+<p>\r
+        Attribute Integral Dataset for Read.\r
+</p>\r
+</dd>\r
+<dt class="hdlist1">\r
+-c &lt;cdw11&gt;\r
+</dt>\r
+<dt class="hdlist1">\r
+--cdw11=&lt;cdw11&gt;\r
+</dt>\r
+<dd>\r
+<p>\r
+        All the command command dword 11 attribuets. Use exclusive from\r
+        speficying individual attributes\r
+</p>\r
+</dd>\r
+</dl></div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
+<h2 id="_examples">EXAMPLES</h2>\r
+<div class="sectionbody">\r
+<div class="paragraph"><p>No examples yet</p></div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
+<h2 id="_nvme">NVME</h2>\r
+<div class="sectionbody">\r
+<div class="paragraph"><p>Part of the nvme-user suite</p></div>\r
+</div>\r
+</div>\r
+</div>\r
+<div id="footnotes"><hr /></div>\r
+<div id="footer">\r
+<div id="footer-text">\r
+Last updated 2015-10-23 16:50:00 MDT\r
+</div>\r
+</div>\r
+</body>\r
+</html>\r
diff --git a/Documentation/nvme-dsm.txt b/Documentation/nvme-dsm.txt
new file mode 100644 (file)
index 0000000..9afedc6
--- /dev/null
@@ -0,0 +1,82 @@
+nvme-dsm(1)
+===========
+
+NAME
+----
+nvme-dsm - Send NVMe Data Set Management, return results
+
+SYNOPSIS
+--------
+[verse]
+'nvme dsm' <device>  [ --namespace-id=<nsid> | -n <nsid> ]
+                       [ --ctx-attrs=<attribute-list,> | -a <attribute-list,> ]
+                       [ --blocks=<nlb-list,> | -b <nlb-list,> ]
+                       [ --slbs=<slba-list,> | -s <slba-list,> ]
+                       [ --ad | -d ] [ --idw | -w ] [ --idr | -r ]
+                       [ --cdw11=<cdw11> | -c <cdw11> ]
+
+
+DESCRIPTION
+-----------
+For the NVMe device given, sends an Data Set Management command and
+provides the result and returned structure.
+
+The <device> parameter is mandatory and may be either the NVMe character
+device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).
+If the character device is given, the `'--namespace-id'` option is
+mandatory, otherwise it will use the ns-id of the namespace for the block
+device you opened. For block devices, the ns-id used can be overridden
+with the same option.
+
+You must specify at least one of the values for range list. If the range
+lists provided do not list the same number of elements, the default
+values for the remaining in the range will be set to 0.
+
+The command dword 11 may be provided at the command line. For convenience,
+the current defined attributes (discard, integral read/write) for a
+data-set management have flags. If cdw11 is specified, this will override
+any settings from the flags may have provided.
+
+OPTIONS
+-------
+-n <nsid>::
+--namespace-id=<nsid>::
+       Sends the command with the requested nsid. This is required for the
+       character devices, or overrides the block nsid if given.
+
+-a <attribute-list,>::
+--ctx-attrs=<attribute-list>::
+       Comma separated list of the context attributes in each range
+
+-b <nlb-list,>::
+--blocks=<nlb-list,>::
+       Comma separated list of the number of blocks in each range
+
+-s <slba-list,>::
+--slbs=<slba-list,>::
+       Comma separated list of the starting block in each range
+
+-d <deallocate>::
+--ad=<deallocate>::
+       Attribute Deallocate.
+
+-w <write>::
+--idw=<write>::
+       Attribute Integral Dataset for Write.
+
+-r <read>::
+--idr=<read>::
+       Attribute Integral Dataset for Read.
+
+-c <cdw11>::
+--cdw11=<cdw11>::
+       All the command command dword 11 attribuets. Use exclusive from
+       speficying individual attributes
+
+EXAMPLES
+--------
+No examples yet
+
+NVME
+----
+Part of the nvme-user suite
diff --git a/nvme.c b/nvme.c
index 60a9a24b8095321ff84961f3c9d2230452e3c449..97d9f960adb2791dd9f4ecdaaef6fc3aa76b320a 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -52,6 +52,7 @@
 #include "src/suffix.h"
 
 #define min(x, y) (x) > (y) ? (y) : (x)
+#define max(x, y) (x) > (y) ? (x) : (y)
 
 static int fd;
 static struct stat nvme_stat;
@@ -88,6 +89,7 @@ static const char nvme_version_string[] = NVME_VERSION;
        ENTRY(RESV_REGISTER, "resv-register", "Submit a Reservation Register, return results", resv_register) \
        ENTRY(RESV_RELEASE, "resv-release", "Submit a Reservation Release, return results", resv_release) \
        ENTRY(RESV_REPORT, "resv-report", "Submit a Reservation Report, return results", resv_report) \
+       ENTRY(DSM, "dsm", "Submit a Data Set Management command, return results", dsm) \
        ENTRY(FLUSH, "flush", "Submit a Flush command, return results", flush) \
        ENTRY(COMPARE, "compare", "Submit a Comapre command, return results", compare) \
        ENTRY(READ_CMD, "read", "Submit a read command, return results", read_cmd) \
@@ -360,7 +362,7 @@ char* nvme_feature_to_string(int feature)
        case NVME_FEAT_AUTO_PST:        return "Autonomous Power State Transition";
        case NVME_FEAT_HOST_MEM_BUF:    return "Host Memory Buffer";
        case NVME_FEAT_SW_PROGRESS:     return "Software Progress";
-       case NVME_FEAT_HOST_ID: return "Host Identifier";
+       case NVME_FEAT_HOST_ID:         return "Host Identifier";
        case NVME_FEAT_RESV_MASK:       return "Reservation Notification Mask";
        case NVME_FEAT_RESV_PERSIST:    return "Reservation Persistence";
        default:                        return "Unknown";
@@ -2178,8 +2180,8 @@ static int get_feature(int argc, char **argv)
                {"raw-binary",   "",     CFG_NONE,     &defaults.raw_binary,   no_argument,       raw_binary},
                {"b",            "",     CFG_NONE,     &defaults.raw_binary,   no_argument,       raw_binary},
                {"cdw11",        "NUM",  CFG_POSITIVE, &defaults.cdw11,        required_argument, cdw11},
-               {"human-readable",  "",    CFG_NONE,     &defaults.human_readable,  no_argument,       human_readable},         
-               {"H",               "", CFG_NONE, &defaults.human_readable,  no_argument, human_readable},
+               {"human-readable",  "",  CFG_NONE,     &defaults.human_readable,  no_argument,    human_readable},
+               {"H",               "",  CFG_NONE,     &defaults.human_readable,  no_argument, human_readable},
                {0}
        };
 
@@ -2721,6 +2723,140 @@ static int sec_send(int argc, char **argv)
        return err;
 }
 
+static int dsm(int argc, char **argv)
+{
+       struct nvme_passthru_cmd cmd;
+       const char *desc = "dsm: The Dataset Management command is used by the host to "\
+               "indicate attributes for ranges of logical blocks. This includes attributes "\
+               "like frequency that data is read or written, access size, and other "\
+               "information that may be used to optimize performance and reliability.";
+       const char *namespace_id = "name of desired namespace";
+       const char *blocks = "Comma separated list of the number of blocks in each range";
+       const char *starting_blocks = "Comma separated list of the starting block in each range";
+       const char *context_attrs = "Comma separated list of the context attributes in each range";
+       const char *ad = "Attribute Deallocate";
+       const char *idw = "Attribute Integral Dataset for Write";
+       const char *idr = "Attribute Integral Dataset for Read";
+       const char *cdw11 = "All the command command dword 11 attribuets. Use instead of specifying individual attributes";
+
+       int i, err;
+       uint8_t nr, nc, nb, ns;
+       __u32 ctx_attrs[256];
+       __u32 nlbs[256];
+       __u64 slbas[256];
+       void *buffer;
+       struct nvme_dsm_range *dsm;
+
+       struct config {
+               char  *ctx_attrs;
+               char  *blocks;
+               char  *slbas;
+               int  ad;
+               int  idw;
+               int  idr;
+               __u32 cdw11;
+               __u32 namespace_id;
+       };
+       struct config cfg;
+
+       const struct config defaults = {
+               .ctx_attrs = "",
+               .blocks = "",
+               .slbas = "",
+               .namespace_id = 0,
+               .ad = 0,
+               .idw = 0,
+               .idr = 0,
+               .cdw11 = 0,
+       };
+
+       const struct argconfig_commandline_options command_line_options[] = {
+               {"namespace-id", "NUM",  CFG_POSITIVE,  &defaults.namespace_id, required_argument, namespace_id},
+               {"n",            "NUM",  CFG_POSITIVE,  &defaults.namespace_id, required_argument, namespace_id},
+               {"ctx-attrs",    "LIST", CFG_STRING,    &defaults.ctx_attrs,    required_argument, context_attrs},
+               {"a",            "LIST", CFG_STRING,    &defaults.ctx_attrs,    required_argument, context_attrs},
+               {"blocks",       "LIST", CFG_STRING,    &defaults.blocks,       required_argument, blocks},
+               {"b",            "LIST", CFG_STRING,    &defaults.blocks,       required_argument, blocks},
+               {"slbs",         "LIST", CFG_STRING,    &defaults.slbas,        required_argument, starting_blocks},
+               {"s",            "LIST", CFG_STRING,    &defaults.slbas,        required_argument, starting_blocks},
+               {"ad",           "FLAG", CFG_NONE,      &defaults.ad,           no_argument,       ad},
+               {"d",            "FLAG", CFG_NONE,      &defaults.ad,           no_argument,       ad},
+               {"idw",          "FLAG", CFG_NONE,      &defaults.idw,          no_argument,       idw},
+               {"w",            "FLAG", CFG_NONE,      &defaults.idw,          no_argument,       idw},
+               {"idr",          "FLAG", CFG_NONE,      &defaults.idr,          no_argument,       idr},
+               {"r",            "FLAG", CFG_NONE,      &defaults.idr,          no_argument,       idr},
+               {"cdw11",        "NUM",  CFG_POSITIVE,  &defaults.namespace_id, required_argument, cdw11},
+               {"c",            "NUM",  CFG_POSITIVE,  &defaults.namespace_id, required_argument, cdw11},
+               {0}
+       };
+
+       memset(ctx_attrs, 0, sizeof(ctx_attrs));
+       memset(slbas, 0, sizeof(slbas));
+       memset(nlbs, 0, sizeof(nlbs));
+
+       argconfig_parse(argc, argv, desc, command_line_options,
+                       &defaults, &cfg, sizeof(cfg));
+       get_dev(1, argc, argv);
+
+       nc = argconfig_parse_comma_sep_array(cfg.ctx_attrs, (int *)ctx_attrs, 256);
+       nb = argconfig_parse_comma_sep_array(cfg.blocks, (int *)nlbs, 256);
+       ns = argconfig_parse_comma_sep_array_long(cfg.slbas, slbas, 256);
+       nr = max(nc, max(nb, ns));
+       if (!nr) {
+               fprintf(stderr, "No range definition provided\n");
+               return EINVAL;
+       }
+
+       if (!cfg.namespace_id) {
+               if (!S_ISBLK(nvme_stat.st_mode)) {
+                       fprintf(stderr,
+                               "%s: non-block device requires namespace-id param\n",
+                               devicename);
+                       exit(ENOTBLK);
+               }
+               cfg.namespace_id = ioctl(fd, NVME_IOCTL_ID);
+               if (cfg.namespace_id <= 0) {
+                       fprintf(stderr,
+                               "%s: failed to return namespace id\n",
+                               devicename);
+                       return errno;
+               }
+       }
+
+       if (!cfg.cdw11)
+               cfg.cdw11 = (cfg.ad << 2) | (cfg.idw << 1) | (cfg.idr << 0);
+
+       buffer = malloc(nr * sizeof (struct nvme_dsm_range));
+       if (!buffer)
+               return ENOMEM;
+
+       dsm = buffer;
+       for (i = 0; i < nr; i++) {
+               dsm[i].cattr = htole32(ctx_attrs[i]);
+               dsm[i].nlb = htole32(nlbs[i]);
+               dsm[i].slba = htole64(slbas[i]);
+       }
+
+       memset(&cmd, 0, sizeof(cmd));
+       cmd.nsid = cfg.namespace_id;
+       cmd.opcode = nvme_cmd_dsm;
+       cmd.addr = (__u64)((unsigned long)buffer);
+       cmd.data_len = nr * sizeof(struct nvme_dsm_range);
+       cmd.cdw10 = nr;
+       cmd.cdw11 = cfg.cdw11;
+
+       err = ioctl(fd, NVME_IOCTL_IO_CMD, &cmd);
+       if (err < 0) {
+               fprintf(stderr, "error:%x\n", err);
+               return errno;
+       } else if (err != 0)
+               fprintf(stderr, "NVME IO command error:%s(%x)\n",
+                               nvme_status_to_string(err), err);
+       else
+               printf("NVMe DSM: success\n");
+       return 0;
+}
+
 static int flush(int argc, char **argv)
 {
        struct nvme_passthru_cmd cmd;
index a9d883fb703c30bd8e34b4d0f664688ca6696df3..3641d7152d010942df4dafca3aeb44c8603cb6ac 100644 (file)
@@ -491,13 +491,12 @@ unsigned argconfig_parse_comma_sep_array(char *string, int *val,
   char *p;
 
   if (!strlen(string) || string == NULL)
-         exit(1);
+         return 0;
 
-  tmp = malloc(strlen(string) + 1);
   tmp = strtok(string, ",");
+  if (!tmp)
+      return 0;
 
-  if (tmp==NULL)
-         exit(1);
 
   val[ret] = strtol(tmp, &p, 0);
 
@@ -527,6 +526,40 @@ unsigned argconfig_parse_comma_sep_array(char *string, int *val,
 
 }
 
+unsigned argconfig_parse_comma_sep_array_long(char *string, unsigned long long *val,
+                                     unsigned max_length)
+{
+  unsigned ret = 0;
+  char *tmp;
+  char *p;
+
+  if (!strlen(string) || string == NULL)
+         return 0;
+
+  tmp = strtok(string, ",");
+  if (tmp==NULL)
+         return 0;
+
+  val[ret] = strtoll(tmp, &p, 0);
+  if (*p != 0)
+         exit(1);
+  ret++;
+  while(1) {
+         tmp = strtok(NULL, ",");
+
+         if (tmp == NULL)
+               return ret;
+
+         if (ret >= max_length)
+                 exit(1);
+
+         val[ret] = strtoll(tmp, &p, 0);
+         if (*p != 0)
+                 exit(1);
+         ret++;
+    }
+}
+
 void argconfig_register_help_func(argconfig_help_func *f) {
     int i;
     for (i = 0; i < MAX_HELP_FUNC; i++) {
index 6e779311435501ef87d00e5f985b917052f3647a..a6af2fd9b6a113591178f7ae6cb638f928cbebd1 100644 (file)
@@ -103,6 +103,8 @@ int argconfig_parse_subopt_string (char *string, char **options,
                                 size_t max_options);
 unsigned argconfig_parse_comma_sep_array(char *string,int *ret,
                                      unsigned max_length);
+unsigned argconfig_parse_comma_sep_array_long(char *string, unsigned long long *ret,
+                                     unsigned max_length);
 void argconfig_register_help_func(argconfig_help_func * f);
 
 void argconfig_print_subopt_help(const struct argconfig_sub_options * options,