Skip to content

Commit 404b1d2

Browse files
jhk16igaw
authored andcommitted
Documentation: Add man page for mangoboost command
man pages for MangoBoost plugin commands Signed-off-by: Jonghyeon Kim <[email protected]>
1 parent 5a1553e commit 404b1d2

File tree

3 files changed

+124
-0
lines changed

3 files changed

+124
-0
lines changed

Documentation/cmd-plugins.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,3 +339,6 @@ linknvme:nvme-sed-unlock[1]::
339339

340340
linknvme:nvme-sed-password[1]::
341341
Change the SED Opal Device password
342+
343+
linknvme:nvme-mangoboost-id-ctrl[1]::
344+
MangoBoost - NVMe Identify Controller

Documentation/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ adoc_sources = [
255255
'nvme-sed-password',
256256
'nvme-sed-revert',
257257
'nvme-sed-unlock',
258+
'nvme-mangoboost-id-ctrl',
258259
]
259260

260261
adoc_includes = [
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
nvme-mangoboost-id-ctrl(1)
2+
==========================
3+
4+
NAME
5+
----
6+
nvme-mangoboost-id-ctrl - Send NVMe Identify Controller, return result and structure
7+
8+
SYNOPSIS
9+
--------
10+
[verse]
11+
'nvme mangoboost id-ctrl' <device> [--vendor-specific | -V] [--raw-binary | -b]
12+
[--output-format=<fmt> | -o <fmt>] [--verbose | -v]
13+
14+
DESCRIPTION
15+
-----------
16+
For the NVMe device given, sends an identify controller command and
17+
provides the result and returned structure.
18+
19+
The <device> parameter is mandatory and may be either the NVMe character
20+
device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).
21+
22+
On success, the structure may be returned in one of several ways depending
23+
on the option flags; the structure may be parsed by the program or the
24+
raw buffer may be printed to stdout.
25+
26+
If having the program decode the output for readability, this version
27+
will decode MangoBoost vendor unique portions of the structure.
28+
29+
OPTIONS
30+
-------
31+
-b::
32+
--raw-binary::
33+
Print the raw buffer to stdout. Structure is not parsed by
34+
program. This overrides the vendor specific and human readable options.
35+
36+
-V::
37+
--vendor-specific::
38+
In addition to parsing known fields, this option will dump
39+
the vendor specific region of the structure in hex with ascii
40+
interpretation.
41+
42+
-H::
43+
--human-readable::
44+
This option will parse and format many of the bit fields
45+
into human-readable formats.
46+
47+
-o <fmt>::
48+
--output-format=<fmt>::
49+
Set the reporting format to 'normal', 'json' or 'binary'. Only one
50+
output format can be used at a time.
51+
52+
-v::
53+
--verbose::
54+
Increase the information detail in the output.
55+
56+
EXAMPLES
57+
--------
58+
* Has the program interpret the returned buffer and display the known
59+
fields in a human readable format:
60+
+
61+
------------
62+
# nvme mangoboost id-ctrl /dev/nvme0
63+
------------
64+
+
65+
66+
* In addition to showing the known fields, has the program to display
67+
the vendor unique field:
68+
+
69+
------------
70+
# nvme mangoboost id-ctrl /dev/nvme0 --vendor-specific
71+
# nvme mangoboost id-ctrl /dev/nvme0 -V
72+
------------
73+
+
74+
The above will dump the 'vs' buffer in hex since it doesn't know how to
75+
interpret it.
76+
77+
* Have the program return the raw structure in binary:
78+
+
79+
------------
80+
# nvme mangoboost id-ctrl /dev/nvme0 --raw-binary > id_ctrl.raw
81+
# nvme mangoboost id-ctrl /dev/nvme0 -b > id_ctrl.raw
82+
------------
83+
+
84+
It is probably a bad idea to not redirect stdout when using this mode.
85+
86+
* Alternatively you may want to send the data to another program that
87+
can parse the raw buffer.
88+
+
89+
------------
90+
# nvme mangoboost id-ctrl /dev/nvme0 --raw-binary | nvme_parse_id_ctrl
91+
------------
92+
+
93+
The parse program in the above example can be a program that shows the
94+
structure in a way you like. The following program is such an example
95+
that will parse it and can accept the output through a pipe, `'|'`,
96+
as shown in the above example, or you can `'cat'` a saved output buffer to it.
97+
------------
98+
/* File: nvme_parse_id_ctrl.c */
99+
100+
#include <linux/nvme.h>
101+
#include <stdio.h>
102+
#include <unistd.h>
103+
104+
int main(int argc, char **argv)
105+
{
106+
unsigned char buf[sizeof(struct nvme_id_ctrl)];
107+
struct nvme_id_ctrl *ctrl = (struct nvme_id_ctrl *)buf;
108+
109+
if (read(STDIN_FILENO, buf, sizeof(buf)))
110+
return 1;
111+
112+
printf("vid : %#x\n", ctrl->vid);
113+
printf("ssvid : %#x\n", ctrl->ssvid);
114+
return 0;
115+
}
116+
------------
117+
118+
NVME
119+
----
120+
Part of the nvme-user suite

0 commit comments

Comments
 (0)