diff options
703 files changed, 22567 insertions, 9452 deletions
diff --git a/.github/AppImageBuilder.yml b/.github/AppImageBuilder.yml index 67b215c..cce4689 100644 --- a/.github/AppImageBuilder.yml +++ b/.github/AppImageBuilder.yml @@ -27,7 +27,6 @@ AppDir: - sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse include: - libjson-c5 - - libhugetlbfs0 - libssl3 files: include: diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml new file mode 100644 index 0000000..d9079fd --- /dev/null +++ b/.github/codeql/codeql-config.yml @@ -0,0 +1,3 @@ +name: "CodeQL Config"
+paths-ignore:
+ - subprojects/**
diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index f7b7ae0..6c0d3e5 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -13,41 +13,31 @@ jobs: build-appimage: name: build AppImage runs-on: ubuntu-latest + container: + image: ghcr.io/igaw/linux-nvme/debian:latest steps: - - uses: actions/checkout@v3 - - name: install dependencies - run: sudo apt-get install libjson-c-dev libssl-dev libdbus-1-dev libhugetlbfs-dev - - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - uses: BSFishy/meson-build@v1.0.3 - with: - setup-options: > - --werror - --buildtype=release - --prefix=/usr - --force-fallback-for=libnvme - -Dlibnvme:werror=false - action: install - meson-version: 0.61.2 - - name: build AppImage - uses: AppImageCrafters/build-appimage@v1.3 - with: - recipe: .github/AppImageBuilder.yml - - uses: actions/upload-artifact@v3 - name: upload artifacts to github - with: - name: AppImage - path: '*.AppImage*' + - uses: actions/checkout@v4 + - name: build + run: | + scripts/build.sh appimage + - name: build AppImage + uses: AppImageCrafters/build-appimage@v1.3 + with: + recipe: .github/AppImageBuilder.yml + - uses: actions/upload-artifact@v4 + name: upload artifacts to github + with: + name: AppImage + path: '*.AppImage*' deploy-appimage: name: deploy AppImage runs-on: ubuntu-latest needs: build-appimage - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'linux-nvme/nvme-cli' }} steps: - name: Download artifact - uses: dawidd6/action-download-artifact@v2 + uses: dawidd6/action-download-artifact@v3 with: workflow: ${{ github.event.workflow_run.workflow_id }} workflow_conclusion: success diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3e2fd4..0b12517 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,16 +17,13 @@ jobs: compiler: [gcc, clang] buildtype: [debug, release] container: - image: ghcr.io/igaw/linux-nvme/debian:0.30 + image: ghcr.io/igaw/linux-nvme/debian.python:latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.x' + - uses: actions/checkout@v4 - name: build run: | scripts/build.sh -b ${{ matrix.buildtype }} -c ${{ matrix.compiler }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 name: upload logs if: failure() with: @@ -40,34 +37,23 @@ jobs: matrix: include: - arch: armhf - port: armhf - compiler: gcc-arm-linux-gnueabihf - packages: - arch: s390x - port: s390x - compiler: gcc-s390x-linux-gnu - packages: libgcc-s1:s390x - arch: ppc64le - port: ppc64el - compiler: gcc-powerpc64le-linux-gnu - packges: steps: - - uses: actions/checkout@v3 - - name: set up arm architecture - run: | - export release=$(lsb_release -c -s) - sudo dpkg --add-architecture ${{ matrix.port }} - sudo sed -i -e 's/deb http/deb [arch=amd64] http/g' /etc/apt/sources.list - sudo dd of=/etc/apt/sources.list.d/${{ matrix.arch }}.list <<EOF - deb [arch=${{ matrix.port }}] http://ports.ubuntu.com/ $release main universe restricted" - deb [arch=${{ matrix.port }}] http://ports.ubuntu.com/ $release-updates main universe restricted" - EOF - sudo apt update - sudo apt install -y meson pkg-config qemu-user-static ${{ matrix.compiler}} libjson-c-dev:${{ matrix.port }} ${{ matrix.packages }} - - name: build - run: | - scripts/build.sh -b release -c gcc -t ${{ matrix.arch }} cross - - uses: actions/upload-artifact@v3 + - uses: actions/checkout@v4 + - name: enable foreign arch + uses: dbhi/qus/action@main + - name: compile and run unit tests + uses: mosteo-actions/docker-run@v1 + with: + image: ghcr.io/igaw/linux-nvme/ubuntu-cross-${{ matrix.arch }}:latest + guest-dir: /build + host-dir: ${{ github.workspace }} + command: | + scripts/build.sh -b release -c gcc -t ${{ matrix.arch }} cross + params: "--platform linux/amd64" + pull-params: "--platform linux/amd64" + - uses: actions/upload-artifact@v4 name: upload logs if: failure() with: @@ -79,17 +65,14 @@ jobs: name: fallback shared libraries runs-on: ubuntu-latest container: - image: ghcr.io/igaw/linux-nvme/debian:0.30 + image: ghcr.io/igaw/linux-nvme/debian:latest if: github.ref == 'refs/heads/master' steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.x' + - uses: actions/checkout@v4 - name: build run: | scripts/build.sh -b release -c gcc fallback - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: failure() with: name: log files @@ -100,9 +83,19 @@ jobs: name: muon minimal static runs-on: ubuntu-latest container: - image: ghcr.io/igaw/linux-nvme/debian:0.30 + image: ghcr.io/igaw/linux-nvme/debian:latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: build run: | scripts/build.sh -m muon + build-make-static: + name: make static + runs-on: ubuntu-latest + container: + image: ghcr.io/igaw/linux-nvme/debian:latest + steps: + - uses: actions/checkout@v4 + - name: build + run: | + make static diff --git a/.github/workflows/checkpatch.yml b/.github/workflows/checkpatch.yml new file mode 100644 index 0000000..c0a09b7 --- /dev/null +++ b/.github/workflows/checkpatch.yml @@ -0,0 +1,15 @@ +name: checkpatch review +on: [pull_request] +jobs: + checkpatch: + name: checkpatch review + runs-on: ubuntu-latest + steps: + - name: 'Calculate PR commits + 1' + run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + - name: Run checkpatch review + uses: webispy/checkpatch-action@v9 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..d57e17a --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,71 @@ +# CodeQL build configuration for nvme-cli +# Mostly based on auto-configuration with additions and tweaks for: +# * meson install +# * language detection +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '24 2 * * 5' + +jobs: + analyze: + name: Analyze + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners + # Consider using larger runners for possible analysis time improvements. + runs-on: 'ubuntu-latest' + timeout-minutes: 360 + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'c-cpp', 'python' ] + # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] + # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install build tools + run: | + sudo apt-get update + sudo apt-get install meson + + # Initializes the CodeQL tools for scanning. + - if: matrix.language == 'c-cpp' + name: Initialize CodeQL C + uses: github/codeql-action/init@v3 + with: + languages: 'c-cpp' + + - if: matrix.language == 'python' + name: Initialize CodeQL Python + uses: github/codeql-action/init@v3 + with: + languages: 'python' + config-file: ./.github/codeql/codeql-config.yml + + - name: meson build + run: | + meson setup --force-fallback-for=libnvme,json-c .build + ninja -C .build + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..d272d0f --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,22 @@ +--- +name: coverage + +on: + push: + branches: [master] + +jobs: + code-coverage: + if: github.repository == 'linux-nvme/nvme-cli' + name: code coverage + runs-on: ubuntu-latest + container: + image: ghcr.io/igaw/linux-nvme/debian.python:latest + steps: + - uses: actions/checkout@v4 + - name: build + run: | + scripts/build.sh coverage + - uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c88be9e..8a5651c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,11 +10,11 @@ on: jobs: build: runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/v') + if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'linux-nvme/nvme-cli' permissions: contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ncipollo/release-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..b506f85 --- /dev/null +++ b/.mailmap @@ -0,0 +1 @@ +Vigneshwaran Saravanan <s.vignesh@samsung.com> diff --git a/Documentation/nvme-admin-passthru.1 b/Documentation/nvme-admin-passthru.1 index 4929a23..38fbba7 100644 --- a/Documentation/nvme-admin-passthru.1 +++ b/Documentation/nvme-admin-passthru.1 @@ -2,12 +2,12 @@ .\" Title: nvme-admin-passthru .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ADMIN\-PASSTHR" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ADMIN\-PASSTHR" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,23 +32,24 @@ nvme-admin-passthru \- Submit an arbitrary admin command, return results .SH "SYNOPSIS" .sp .nf -\fInvme\-admin\-passthru\fR <device> [\-\-opcode=<opcode> | \-o <opcode>] - [\-\-flags=<flags> | \-f <flags>] [\-rsvd=<rsvd> | \-R <rsvd>] - [\-\-namespace\-id=<nsid> | \-n <nsid>] [\-\-cdw2=<cdw2> | \-2 <cdw2>] - [\-\-cdw3=<cdw3> | \-3 <cdw3>] [\-\-cdw10=<cdw10> | \-4 <cdw4>] - [\-\-cdw11=<cdw11> | \-5 <cdw5>] [\-\-cdw12=<cdw12> | \-6 <cdw6>] - [\-\-cdw13=<cdw13> | \-7 <cdw7>] [\-\-cdw14=<cdw14> | \-8 <cdw8>] - [\-\-cdw15=<cdw15> | \-9 <cdw9>] - [\-\-data\-len=<data\-len> | \-l <data\-len>] - [\-\-metadata\-len=<len> | \-m <len>] - [\-\-input\-file=<file> | \-i <file>] - [\-\-read | \-r ] [\-\-write | \-w] - [\-\-timeout=<to> | \-t <to>] - [\-\-show\-command | \-s] - [\-\-dry\-run | \-d] - [\-\-raw\-binary | \-b] - [\-\-prefill=<prefill> | \-p <prefill>] - [\-\-latency | \-T] +\fInvme\-admin\-passthru\fR <device> [\-\-opcode=<opcode> | \-O <opcode>] + [\-\-flags=<flags> | \-f <flags>] [\-rsvd=<rsvd> | \-R <rsvd>] + [\-\-namespace\-id=<nsid> | \-n <nsid>] [\-\-cdw2=<cdw2> | \-2 <cdw2>] + [\-\-cdw3=<cdw3> | \-3 <cdw3>] [\-\-cdw10=<cdw10> | \-4 <cdw4>] + [\-\-cdw11=<cdw11> | \-5 <cdw5>] [\-\-cdw12=<cdw12> | \-6 <cdw6>] + [\-\-cdw13=<cdw13> | \-7 <cdw7>] [\-\-cdw14=<cdw14> | \-8 <cdw8>] + [\-\-cdw15=<cdw15> | \-9 <cdw9>] + [\-\-data\-len=<data\-len> | \-l <data\-len>] + [\-\-metadata\-len=<len> | \-m <len>] + [\-\-input\-file=<file> | \-i <file>] + [\-\-read | \-r] [\-\-write | \-w] + [\-\-timeout=<to> | \-t <to>] + [\-\-show\-command | \-s] + [\-\-dry\-run | \-d] + [\-\-raw\-binary | \-b] + [\-\-prefill=<prefill> | \-p <prefill>] + [\-\-latency | \-T] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -59,7 +60,7 @@ The <device> parameter is mandatory and may be either the NVMe character device On success, the returned structure (if applicable) may be returned in one of several ways depending on the option flags; the structure may printed by the program as a hex dump, or may be returned as a raw buffer printed to stdout for another program to parse\&. .SH "OPTIONS" .PP -\-o <opcode>, \-\-opcode=<opcode> +\-O <opcode>, \-\-opcode=<opcode> .RS 4 The NVMe opcode to send to the device in the command .RE @@ -131,6 +132,20 @@ Prefill the buffer with a predetermined byte value\&. Defaults to 0\&. This may .RS 4 Print out the latency the IOCTL took (in us)\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-admin-passthru.html b/Documentation/nvme-admin-passthru.html index 065f553..b5ba02a 100644 --- a/Documentation/nvme-admin-passthru.html +++ b/Documentation/nvme-admin-passthru.html @@ -749,23 +749,24 @@ nvme-admin-passthru(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme-admin-passthru</em> <device> [--opcode=<opcode> | -o <opcode>]
- [--flags=<flags> | -f <flags>] [-rsvd=<rsvd> | -R <rsvd>]
- [--namespace-id=<nsid> | -n <nsid>] [--cdw2=<cdw2> | -2 <cdw2>]
- [--cdw3=<cdw3> | -3 <cdw3>] [--cdw10=<cdw10> | -4 <cdw4>]
- [--cdw11=<cdw11> | -5 <cdw5>] [--cdw12=<cdw12> | -6 <cdw6>]
- [--cdw13=<cdw13> | -7 <cdw7>] [--cdw14=<cdw14> | -8 <cdw8>]
- [--cdw15=<cdw15> | -9 <cdw9>]
- [--data-len=<data-len> | -l <data-len>]
- [--metadata-len=<len> | -m <len>]
- [--input-file=<file> | -i <file>]
- [--read | -r ] [--write | -w]
- [--timeout=<to> | -t <to>]
- [--show-command | -s]
- [--dry-run | -d]
- [--raw-binary | -b]
- [--prefill=<prefill> | -p <prefill>]
- [--latency | -T]</pre>
+<pre class="content"><em>nvme-admin-passthru</em> <device> [--opcode=<opcode> | -O <opcode>]
+ [--flags=<flags> | -f <flags>] [-rsvd=<rsvd> | -R <rsvd>]
+ [--namespace-id=<nsid> | -n <nsid>] [--cdw2=<cdw2> | -2 <cdw2>]
+ [--cdw3=<cdw3> | -3 <cdw3>] [--cdw10=<cdw10> | -4 <cdw4>]
+ [--cdw11=<cdw11> | -5 <cdw5>] [--cdw12=<cdw12> | -6 <cdw6>]
+ [--cdw13=<cdw13> | -7 <cdw7>] [--cdw14=<cdw14> | -8 <cdw8>]
+ [--cdw15=<cdw15> | -9 <cdw9>]
+ [--data-len=<data-len> | -l <data-len>]
+ [--metadata-len=<len> | -m <len>]
+ [--input-file=<file> | -i <file>]
+ [--read | -r] [--write | -w]
+ [--timeout=<to> | -t <to>]
+ [--show-command | -s]
+ [--dry-run | -d]
+ [--raw-binary | -b]
+ [--prefill=<prefill> | -p <prefill>]
+ [--latency | -T]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -790,7 +791,7 @@ printed to stdout for another program to parse.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <opcode>
+-O <opcode>
</dt>
<dt class="hdlist1">
--opcode=<opcode>
@@ -961,6 +962,29 @@ printed to stdout for another program to parse.</p></div> Print out the latency the IOCTL took (in us).
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -1003,7 +1027,7 @@ Or if you want to save that structure to a file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-admin-passthru.txt b/Documentation/nvme-admin-passthru.txt index 5a20ff8..22559db 100644 --- a/Documentation/nvme-admin-passthru.txt +++ b/Documentation/nvme-admin-passthru.txt @@ -8,23 +8,24 @@ nvme-admin-passthru - Submit an arbitrary admin command, return results SYNOPSIS -------- [verse] -'nvme-admin-passthru' <device> [--opcode=<opcode> | -o <opcode>] - [--flags=<flags> | -f <flags>] [-rsvd=<rsvd> | -R <rsvd>] - [--namespace-id=<nsid> | -n <nsid>] [--cdw2=<cdw2> | -2 <cdw2>] - [--cdw3=<cdw3> | -3 <cdw3>] [--cdw10=<cdw10> | -4 <cdw4>] - [--cdw11=<cdw11> | -5 <cdw5>] [--cdw12=<cdw12> | -6 <cdw6>] - [--cdw13=<cdw13> | -7 <cdw7>] [--cdw14=<cdw14> | -8 <cdw8>] - [--cdw15=<cdw15> | -9 <cdw9>] - [--data-len=<data-len> | -l <data-len>] - [--metadata-len=<len> | -m <len>] - [--input-file=<file> | -i <file>] - [--read | -r ] [--write | -w] - [--timeout=<to> | -t <to>] - [--show-command | -s] - [--dry-run | -d] - [--raw-binary | -b] - [--prefill=<prefill> | -p <prefill>] - [--latency | -T] +'nvme-admin-passthru' <device> [--opcode=<opcode> | -O <opcode>] + [--flags=<flags> | -f <flags>] [-rsvd=<rsvd> | -R <rsvd>] + [--namespace-id=<nsid> | -n <nsid>] [--cdw2=<cdw2> | -2 <cdw2>] + [--cdw3=<cdw3> | -3 <cdw3>] [--cdw10=<cdw10> | -4 <cdw4>] + [--cdw11=<cdw11> | -5 <cdw5>] [--cdw12=<cdw12> | -6 <cdw6>] + [--cdw13=<cdw13> | -7 <cdw7>] [--cdw14=<cdw14> | -8 <cdw8>] + [--cdw15=<cdw15> | -9 <cdw9>] + [--data-len=<data-len> | -l <data-len>] + [--metadata-len=<len> | -m <len>] + [--input-file=<file> | -i <file>] + [--read | -r] [--write | -w] + [--timeout=<to> | -t <to>] + [--show-command | -s] + [--dry-run | -d] + [--raw-binary | -b] + [--prefill=<prefill> | -p <prefill>] + [--latency | -T] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -43,7 +44,7 @@ printed to stdout for another program to parse. OPTIONS ------- --o <opcode>:: +-O <opcode>:: --opcode=<opcode>:: The NVMe opcode to send to the device in the command @@ -113,6 +114,15 @@ OPTIONS --latency:: Print out the latency the IOCTL took (in us). +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * The following will run the admin command with opcode=6 and cdw10=1, which diff --git a/Documentation/nvme-ana-log.1 b/Documentation/nvme-ana-log.1 index 28cbf41..cbddd88 100644 --- a/Documentation/nvme-ana-log.1 +++ b/Documentation/nvme-ana-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-ana-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ANA\-LOG" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ANA\-LOG" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,7 +32,8 @@ nvme-ana-log \- Send NVMe ANA log page request, returns result and log .SH "SYNOPSIS" .sp .nf -\fInvme ana\-log\fR <device> [\-o <fmt> | \-\-output\-format=<fmt>] +\fInvme ana\-log\fR <device> [\-\-groups | \-g] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -48,13 +49,19 @@ On success, the returned ANA log structure may be returned in one of several way Return the list of ANA groups without the namespace listing\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-ana-log.html b/Documentation/nvme-ana-log.html index b3d2ef5..be72490 100644 --- a/Documentation/nvme-ana-log.html +++ b/Documentation/nvme-ana-log.html @@ -749,7 +749,8 @@ nvme-ana-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme ana-log</em> <device> [-o <fmt> | --output-format=<fmt>]</pre>
+<pre class="content"><em>nvme ana-log</em> <device> [--groups | -g]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -778,19 +779,30 @@ printed to stdout for another program to parse.</p></div> </dt>
<dd>
<p>
- Return the list of ANA groups without the namespace listing.
+ Return the list of ANA groups without the namespace listing.
</p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -823,7 +835,7 @@ Print the ANA log page in a human readable format: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-ana-log.txt b/Documentation/nvme-ana-log.txt index b6dc9c5..92dc12a 100644 --- a/Documentation/nvme-ana-log.txt +++ b/Documentation/nvme-ana-log.txt @@ -8,7 +8,8 @@ nvme-ana-log - Send NVMe ANA log page request, returns result and log SYNOPSIS -------- [verse] -'nvme ana-log' <device> [-o <fmt> | --output-format=<fmt>] +'nvme ana-log' <device> [--groups | -g] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -26,12 +27,16 @@ OPTIONS ------- -g:: --groups:: - Return the list of ANA groups without the namespace listing. + Return the list of ANA groups without the namespace listing. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-attach-ns.1 b/Documentation/nvme-attach-ns.1 index 6864869..95bacce 100644 --- a/Documentation/nvme-attach-ns.1 +++ b/Documentation/nvme-attach-ns.1 @@ -2,12 +2,12 @@ .\" Title: nvme-attach-ns .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ATTACH\-NS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ATTACH\-NS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,6 +34,7 @@ nvme-attach-ns \- Send NVMe attach namespace, return result\&. .nf \fInvme attach\-ns\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] [\-\-controllers=<ctrl\-list,> | \-c <ctrl\-list,>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -49,6 +50,20 @@ The namespace identifier to attach\&. .RS 4 The comma separated list of controller identifiers to attach the namespace too\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .if n \{\ @@ -65,7 +80,7 @@ Attach namespace to the controller: .RS 4 .\} .nf -# nvme attach\-ns /dev/nvme1 \-n 0x2 \-c 0x21 +# nvme attach\-ns /dev/nvme1 \-n 0x2 \-c 0x21 .fi .if n \{\ .RE diff --git a/Documentation/nvme-attach-ns.html b/Documentation/nvme-attach-ns.html index a90e3dd..6fb6183 100644 --- a/Documentation/nvme-attach-ns.html +++ b/Documentation/nvme-attach-ns.html @@ -750,7 +750,8 @@ nvme-attach-ns(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme attach-ns</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--controllers=<ctrl-list,> | -c <ctrl-list,>]</pre>
+ [--controllers=<ctrl-list,> | -c <ctrl-list,>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -790,6 +791,29 @@ controller identifiers.</p></div> the namespace too.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -802,7 +826,7 @@ controller identifiers.</p></div> </div></div>
<div class="literalblock">
<div class="content">
-<pre><code># nvme attach-ns /dev/nvme1 -n 0x2 -c 0x21</code></pre>
+<pre><code># nvme attach-ns /dev/nvme1 -n 0x2 -c 0x21</code></pre>
</div></div>
</div>
</div>
@@ -817,7 +841,7 @@ controller identifiers.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-attach-ns.txt b/Documentation/nvme-attach-ns.txt index 64ab9d1..601c20d 100644 --- a/Documentation/nvme-attach-ns.txt +++ b/Documentation/nvme-attach-ns.txt @@ -10,6 +10,7 @@ SYNOPSIS [verse] 'nvme attach-ns' <device> [--namespace-id=<nsid> | -n <nsid>] [--controllers=<ctrl-list,> | -c <ctrl-list,>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -28,11 +29,20 @@ OPTIONS The comma separated list of controller identifiers to attach the namespace too. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- Attach namespace to the controller: - # nvme attach-ns /dev/nvme1 -n 0x2 -c 0x21 + # nvme attach-ns /dev/nvme1 -n 0x2 -c 0x21 NVME ---- diff --git a/Documentation/nvme-boot-part-log.1 b/Documentation/nvme-boot-part-log.1 index 53b6dad..0596416 100644 --- a/Documentation/nvme-boot-part-log.1 +++ b/Documentation/nvme-boot-part-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-boot-part-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-BOOT\-PART\-LO" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-BOOT\-PART\-LO" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,8 +33,8 @@ nvme-boot-part-log \- Retrieves a Boot Partition log page from an NVMe device .sp .nf \fInvme boot\-part\-log\fR <device> [\-\-lsp=<field> | \-s <field>] - [\-\-output\-file=<file> | \-o <file>] - [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-output\-file=<file> | \-f <file>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -50,18 +50,24 @@ On success, the returned log structure will be in raw binary format \fIonly\fR w The log specified field of LID\&. .RE .PP -\-o <file>, \-\-output\-file=<file> +\-f <file>, \-\-output\-file=<file> .RS 4 File name to which raw binary data will be saved to\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-boot-part-log.html b/Documentation/nvme-boot-part-log.html index b327078..28fce1d 100644 --- a/Documentation/nvme-boot-part-log.html +++ b/Documentation/nvme-boot-part-log.html @@ -750,8 +750,8 @@ nvme-boot-part-log(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme boot-part-log</em> <device> [--lsp=<field> | -s <field>]
- [--output-file=<file> | -o <file>]
- [--output-format=<fmt> | -o <fmt>]</pre>
+ [--output-file=<file> | -f <file>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -783,7 +783,7 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di </p>
</dd>
<dt class="hdlist1">
--o <file>
+-f <file>
</dt>
<dt class="hdlist1">
--output-file=<file>
@@ -794,15 +794,26 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -835,7 +846,7 @@ Retrieve Boot Partition data to boot_part_log.bin <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-boot-part-log.txt b/Documentation/nvme-boot-part-log.txt index 2dd32a6..0999071 100644 --- a/Documentation/nvme-boot-part-log.txt +++ b/Documentation/nvme-boot-part-log.txt @@ -9,8 +9,8 @@ SYNOPSIS -------- [verse] 'nvme boot-part-log' <device> [--lsp=<field> | -s <field>] - [--output-file=<file> | -o <file>] - [--output-format=<fmt> | -o <fmt>] + [--output-file=<file> | -f <file>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -29,14 +29,18 @@ OPTIONS --lsp=<field>:: The log specified field of LID. --o <file>:: +-f <file>:: --output-file=<file>:: File name to which raw binary data will be saved to. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-capacity-mgmt.1 b/Documentation/nvme-capacity-mgmt.1 index c96ee58..ac995fe 100644 --- a/Documentation/nvme-capacity-mgmt.1 +++ b/Documentation/nvme-capacity-mgmt.1 @@ -2,12 +2,12 @@ .\" Title: nvme-capacity-mgmt .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-CAPACITY\-MGMT" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-CAPACITY\-MGMT" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,10 +32,11 @@ nvme-capacity-mgmt \- Send capacity management command to configure/create/delet .SH "SYNOPSIS" .sp .nf -\fInvme capacity\-mgmt\fR <device> [\-\-operation=<operation> | \-o <operation>] +\fInvme capacity\-mgmt\fR <device> [\-\-operation=<operation> | \-O <operation>] [\-\-element\-id=<element\-id> | \-i <element\-id>] [\-\-cap\-lower=<cap\-lower> | \-l <cap\-lower>] [\-\-cap\-upper=<cap\-upper> | \-u <cap\-upper>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -44,7 +45,7 @@ For the NVMe device given, sends a capacity management command to configure/crea The <device> parameter is mandatory and may be either the NVMe character device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1)\&. .SH "OPTIONS" .PP -\-o <operation>, \-\-operation=<operation> +\-O <operation>, \-\-operation=<operation> .RS 4 Operation to be performed by the controller .RE @@ -63,6 +64,20 @@ Least significant 32 bits of the capacity in bytes of the Endurance Group or NVM .RS 4 Most significant 32 bits of the capacity in bytes of the Endurance Group or NVM Set to be created .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples provided yet\&. diff --git a/Documentation/nvme-capacity-mgmt.html b/Documentation/nvme-capacity-mgmt.html index e0fdc4a..4892aba 100644 --- a/Documentation/nvme-capacity-mgmt.html +++ b/Documentation/nvme-capacity-mgmt.html @@ -740,7 +740,7 @@ nvme-capacity-mgmt(1) Manual Page <h2>NAME</h2>
<div class="sectionbody">
<p>nvme-capacity-mgmt -
- Send capacity management command to configure/create/delete Endurance Groups or NVM Sets, returns results.
+ Send capacity management command to configure/create/delete Endurance Groups or NVM Sets, returns results.
</p>
</div>
</div>
@@ -749,10 +749,11 @@ nvme-capacity-mgmt(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme capacity-mgmt</em> <device> [--operation=<operation> | -o <operation>]
+<pre class="content"><em>nvme capacity-mgmt</em> <device> [--operation=<operation> | -O <operation>]
[--element-id=<element-id> | -i <element-id>]
[--cap-lower=<cap-lower> | -l <cap-lower>]
- [--cap-upper=<cap-upper> | -u <cap-upper>]</pre>
+ [--cap-upper=<cap-upper> | -u <cap-upper>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -774,14 +775,14 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <operation>
+-O <operation>
</dt>
<dt class="hdlist1">
--operation=<operation>
</dt>
<dd>
<p>
- Operation to be performed by the controller
+ Operation to be performed by the controller
</p>
</dd>
<dt class="hdlist1">
@@ -792,7 +793,7 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di </dt>
<dd>
<p>
- Value specific to the value of the Operation field.
+ Value specific to the value of the Operation field.
</p>
</dd>
<dt class="hdlist1">
@@ -804,7 +805,7 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di <dd>
<p>
Least significant 32 bits of the capacity in bytes of the Endurance Group or
- NVM Set to be created
+ NVM Set to be created
</p>
</dd>
<dt class="hdlist1">
@@ -816,7 +817,30 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di <dd>
<p>
Most significant 32 bits of the capacity in bytes of the Endurance Group or
- NVM Set to be created
+ NVM Set to be created
+</p>
+</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -839,7 +863,7 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-capacity-mgmt.txt b/Documentation/nvme-capacity-mgmt.txt index 96274cf..a20561f 100644 --- a/Documentation/nvme-capacity-mgmt.txt +++ b/Documentation/nvme-capacity-mgmt.txt @@ -4,15 +4,16 @@ nvme-capacity-mgmt(1) NAME ---- nvme-capacity-mgmt - Send capacity management command to configure/create/delete - Endurance Groups or NVM Sets, returns results. +Endurance Groups or NVM Sets, returns results. SYNOPSIS -------- [verse] -'nvme capacity-mgmt' <device> [--operation=<operation> | -o <operation>] +'nvme capacity-mgmt' <device> [--operation=<operation> | -O <operation>] [--element-id=<element-id> | -i <element-id>] [--cap-lower=<cap-lower> | -l <cap-lower>] [--cap-upper=<cap-upper> | -u <cap-upper>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -27,23 +28,32 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1). OPTIONS ------- --o <operation>:: +-O <operation>:: --operation=<operation>:: - Operation to be performed by the controller + Operation to be performed by the controller -i <element-id>:: --element-id=<element-id>:: - Value specific to the value of the Operation field. + Value specific to the value of the Operation field. -l <cap-lower>:: --cap-lower=<cap-lower>:: Least significant 32 bits of the capacity in bytes of the Endurance Group or - NVM Set to be created + NVM Set to be created -u <cap-upper>:: --cap-upper=<cap-upper>:: Most significant 32 bits of the capacity in bytes of the Endurance Group or - NVM Set to be created + NVM Set to be created + +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-changed-ns-list-log.1 b/Documentation/nvme-changed-ns-list-log.1 index 5e39559..017de32 100644 --- a/Documentation/nvme-changed-ns-list-log.1 +++ b/Documentation/nvme-changed-ns-list-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-changed-ns-list-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-CHANGED\-NS\-L" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-CHANGED\-NS\-L" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,7 +33,7 @@ nvme-changed-ns-list-log \- Send NVMe Changed Namespace List log page request, r .sp .nf \fInvme changed\-ns\-list\-log\fR <device> [\-\-raw\-binary | \-b] - [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -49,13 +49,19 @@ On success, the returned Changed Namespace List log structure may be returned in Print the raw Changed Namespace List log buffer to stdout\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-changed-ns-list-log.html b/Documentation/nvme-changed-ns-list-log.html index 13b9f37..6c7f5fb 100644 --- a/Documentation/nvme-changed-ns-list-log.html +++ b/Documentation/nvme-changed-ns-list-log.html @@ -740,7 +740,7 @@ nvme-changed-ns-list-log(1) Manual Page <h2>NAME</h2>
<div class="sectionbody">
<p>nvme-changed-ns-list-log -
- Send NVMe Changed Namespace List log page request, returns result and log.
+ Send NVMe Changed Namespace List log page request, returns result and log.
</p>
</div>
</div>
@@ -750,7 +750,7 @@ nvme-changed-ns-list-log(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme changed-ns-list-log</em> <device> [--raw-binary | -b]
- [--output-format=<fmt> | -o <fmt>]</pre>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -784,15 +784,26 @@ the raw buffer may be printed to stdout for another program to parse.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -835,7 +846,7 @@ Print the raw Changed Namespace List log to a file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-changed-ns-list-log.txt b/Documentation/nvme-changed-ns-list-log.txt index 4cfd065..22e552f 100644 --- a/Documentation/nvme-changed-ns-list-log.txt +++ b/Documentation/nvme-changed-ns-list-log.txt @@ -4,13 +4,13 @@ nvme-changed-ns-list-log(1) NAME ---- nvme-changed-ns-list-log - Send NVMe Changed Namespace List log page - request, returns result and log. +request, returns result and log. SYNOPSIS -------- [verse] 'nvme changed-ns-list-log' <device> [--raw-binary | -b] - [--output-format=<fmt> | -o <fmt>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -31,10 +31,14 @@ OPTIONS --raw-binary:: Print the raw Changed Namespace List log buffer to stdout. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-check-dhchap-key.txt b/Documentation/nvme-check-dhchap-key.txt index 9cfa1f7..b131afe 100644 --- a/Documentation/nvme-check-dhchap-key.txt +++ b/Documentation/nvme-check-dhchap-key.txt @@ -8,7 +8,8 @@ nvme-check-dhchap-key - Check a generated host DH-HMAC-CHAP key SYNOPSIS -------- [verse] -'nvme check-dhchap-key' [--key=<key> ] +'nvme check-dhchap-key' [--key=<key>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -22,6 +23,15 @@ OPTIONS --key=<key>:: Key to be checked. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No Examples diff --git a/Documentation/nvme-check-tls-key.txt b/Documentation/nvme-check-tls-key.txt index a676f04..2df4fca 100644 --- a/Documentation/nvme-check-tls-key.txt +++ b/Documentation/nvme-check-tls-key.txt @@ -8,17 +8,22 @@ nvme-check-tls-key - Check a generated NVMe TLS PSK SYNOPSIS -------- [verse] -'nvme check-tls-key' [--keyring=<name> | -k <name> ] - [--keytype=<type> | -t <type> ] - [--hostnqn=<nqn> | -n <nqn> ] - [--subsysnqn=<nqn> | -c <nqn> ] - [--keydata=<key> | -d <key> ] +'nvme check-tls-key' [--keyring=<name> | -k <name>] + [--keytype=<type> | -t <type>] + [--hostnqn=<nqn> | -n <nqn>] + [--subsysnqn=<nqn> | -c <nqn>] + [--keydata=<key> | -d <key>] + [--output-format=<fmt> | -o <fmt>] + [--identity=<id-vers> | -I <id-vers>] + [--insert | -i ] + [--verbose | -v] DESCRIPTION ----------- Checks if the key is a valid NVMe TLS PSK in the PSK interchange format -'NVMeTLSkey-1:01:<base64-encoded data>:', and stores the derived 'retained' -TLS key in the keyring if the subsystem NQN is specified. +'NVMeTLSkey-1:01:<base64-encoded data>:'. If '--insert' is specified the +the derived 'retained' TLS key is stored in the keyring, otherwise the +TLS identity of the key is printed out. OPTIONS ------- @@ -46,6 +51,25 @@ OPTIONS --keydata=<key>:: Key to be checked. +-I <id-vers>:: +--identity=<id-vers>:: + NVMe TLS key identity version to be used; '0' for the default + identity, and '1' for the TLS identity suffixed by the PSK hash + as specified in TP8018. + +-i: +--insert: + Insert the derived 'retained' key in the keyring. + +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No Examples diff --git a/Documentation/nvme-cmdset-ind-id-ns.1 b/Documentation/nvme-cmdset-ind-id-ns.1 index 09a2858..5790734 100644 --- a/Documentation/nvme-cmdset-ind-id-ns.1 +++ b/Documentation/nvme-cmdset-ind-id-ns.1 @@ -2,12 +2,12 @@ .\" Title: nvme-cmdset-ind-id-ns .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-CMDSET\-IND\-I" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-CMDSET\-IND\-I" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,9 +33,8 @@ nvme-cmdset-ind-id-ns \- Send NVMe I/O Command Set Independent Identify Namespac .sp .nf \fInvme cmdset\-ind\-id\-ns\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-b | \-\-raw\-binary] - [\-\-human\-readable | \-H] - [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-raw\-binary | \-b] [\-\-human\-readable | \-H] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -61,13 +60,19 @@ Print the raw buffer to stdout\&. Structure is not parsed by program\&. This ove This option will parse and format many of the bit fields into human\-readable formats\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-cmdset-ind-id-ns.html b/Documentation/nvme-cmdset-ind-id-ns.html index c4459b9..6635308 100644 --- a/Documentation/nvme-cmdset-ind-id-ns.html +++ b/Documentation/nvme-cmdset-ind-id-ns.html @@ -750,9 +750,8 @@ nvme-cmdset-ind-id-ns(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme cmdset-ind-id-ns</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [-b | --raw-binary]
- [--human-readable | -H]
- [--output-format=<fmt> | -o <fmt>]</pre>
+ [--raw-binary | -b] [--human-readable | -H]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -815,15 +814,26 @@ raw buffer may be printed to stdout.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -879,7 +889,7 @@ Have the program return the raw structure in binary: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-cmdset-ind-id-ns.txt b/Documentation/nvme-cmdset-ind-id-ns.txt index fa55c83..5bf3862 100644 --- a/Documentation/nvme-cmdset-ind-id-ns.txt +++ b/Documentation/nvme-cmdset-ind-id-ns.txt @@ -9,9 +9,8 @@ SYNOPSIS -------- [verse] 'nvme cmdset-ind-id-ns' <device> [--namespace-id=<nsid> | -n <nsid>] - [-b | --raw-binary] - [--human-readable | -H] - [--output-format=<fmt> | -o <fmt>] + [--raw-binary | -b] [--human-readable | -H] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -47,11 +46,14 @@ OPTIONS This option will parse and format many of the bit fields into human-readable formats. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-compare.1 b/Documentation/nvme-compare.1 index da550ce..b7f82b5 100644 --- a/Documentation/nvme-compare.1 +++ b/Documentation/nvme-compare.1 @@ -2,12 +2,12 @@ .\" Title: nvme-compare .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-COMPARE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-COMPARE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -47,12 +47,13 @@ nvme-compare \- Send an NVMe Compare command, provide results [\-\-dir\-type=<type> | \-T <type>] [\-\-dir\-spec=<spec> | \-S <spec>] [\-\-dsm=<dsm> | \-D <dsm>] - [\-\-show\-command | \-v] + [\-\-show\-command | \-V] [\-\-dry\-run | \-w] [\-\-latency | \-t] [\-\-storage\-tag<storage\-tag> | \-g <storage\-tag>] [\-\-storage\-tag\-check | \-C] [\-\-force] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -97,9 +98,6 @@ Metadata file\&. \-p <prinfo>, \-\-prinfo=<prinfo> .RS 4 Protection Information and check field\&. -.RE -.sp -+ .TS allbox tab(:); lt lt @@ -109,49 +107,38 @@ lt lt lt lt lt lt. T{ -.sp Bit T}:T{ -.sp Description T} T{ -.sp 3 T}:T{ -.sp PRACT: Protection Information Action\&. When set to 1, PI is stripped/inserted on read/write when the block format\(cqs metadata size is 8\&. When set to 0, metadata is passes\&. T} T{ -.sp 2:0 T}:T{ -.sp PRCHK: Protection Information Check: T} T{ -.sp 2 T}:T{ -.sp Set to 1 enables checking the guard tag T} T{ -.sp 1 T}:T{ -.sp Set to 1 enables checking the application tag T} T{ -.sp 0 T}:T{ -.sp Set to 1 enables checking the reference tag T} .TE .sp 1 +.RE .PP \-m <appmask>, \-\-app\-tag\-mask=<appmask> .RS 4 @@ -188,7 +175,7 @@ Optional field for directive specifics\&. When used with write streams, this val The optional data set management attributes for this command\&. The argument for this is the least significant 8 bits of the DSM field in a write command; the most significant 16 bits of the field come from the directive specific field, if used\&. This may be used to set attributes for the LBAs being written, like access frequency, type, latency, among other things, as well as yet to be defined types\&. Please consult the NVMe specification for detailed breakdown of how to use this field\&. .RE .PP -\-v, \-\-show\-cmd +\-V, \-\-show\-cmd .RS 4 Print out the command to be sent\&. .RE @@ -220,6 +207,20 @@ This flag enables Storage Tag field checking as part of end\-to\-end data protec .RS 4 Ignore namespace is currently busy and performed the operation even though\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet\&. diff --git a/Documentation/nvme-compare.html b/Documentation/nvme-compare.html index 4adf97e..7334107 100644 --- a/Documentation/nvme-compare.html +++ b/Documentation/nvme-compare.html @@ -764,12 +764,13 @@ nvme-compare(1) Manual Page [--dir-type=<type> | -T <type>]
[--dir-spec=<spec> | -S <spec>]
[--dsm=<dsm> | -D <dsm>]
- [--show-command | -v]
+ [--show-command | -V]
[--dry-run | -w]
[--latency | -t]
[--storage-tag<storage-tag> | -g <storage-tag>]
[--storage-tag-check | -C]
- [--force]</pre>
+ [--force]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -877,9 +878,6 @@ provided, then a comparison is also performed for the metadata.</p></div> <p>
Protection Information and check field.
</p>
-</dd>
-</dl></div>
-<div class="paragraph"><p>+</p></div>
<div class="tableblock">
<table rules="all"
width="100%"
@@ -917,7 +915,7 @@ metadata is passes.</p></td> </tbody>
</table>
</div>
-<div class="dlist"><dl>
+</dd>
<dt class="hdlist1">
-m <appmask>
</dt>
@@ -1009,7 +1007,7 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
--v
+-V
</dt>
<dt class="hdlist1">
--show-cmd
@@ -1071,8 +1069,31 @@ metadata is passes.</p></td> </dt>
<dd>
<p>
- Ignore namespace is currently busy and performed the operation
- even though.
+ Ignore namespace is currently busy and performed the operation
+ even though.
+</p>
+</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -1095,7 +1116,7 @@ metadata is passes.</p></td> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-compare.txt b/Documentation/nvme-compare.txt index 12121ab..59d1ea9 100644 --- a/Documentation/nvme-compare.txt +++ b/Documentation/nvme-compare.txt @@ -23,12 +23,13 @@ SYNOPSIS [--dir-type=<type> | -T <type>] [--dir-spec=<spec> | -S <spec>] [--dsm=<dsm> | -D <dsm>] - [--show-command | -v] + [--show-command | -V] [--dry-run | -w] [--latency | -t] [--storage-tag<storage-tag> | -g <storage-tag>] [--storage-tag-check | -C] [--force] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -73,7 +74,6 @@ OPTIONS -p <prinfo>:: --prinfo=<prinfo>:: Protection Information and check field. - + [] |================= @@ -127,7 +127,7 @@ metadata is passes. among other things, as well as yet to be defined types. Please consult the NVMe specification for detailed breakdown of how to use this field. --v:: +-V:: --show-cmd:: Print out the command to be sent. @@ -151,8 +151,17 @@ metadata is passes. data protection processing. --force:: - Ignore namespace is currently busy and performed the operation - even though. + Ignore namespace is currently busy and performed the operation + even though. + +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-config.txt b/Documentation/nvme-config.txt index 5b76925..aea6f6a 100644 --- a/Documentation/nvme-config.txt +++ b/Documentation/nvme-config.txt @@ -8,33 +8,28 @@ nvme-config - NVMe-over-Fabrics configuration. SYNOPSIS -------- [verse] -'nvme config' - [--scan | -R] - [--modify | -M] - [--update | -U] - [--dump | -O] - [--config=<cfg> | -J <cfg> ] - [--transport=<trtype> | -t <trtype>] - [--nqn=<subnqn> | -n <subnqn>] - [--traddr=<traddr> | -a <traddr>] - [--trsvcid=<trsvcid> | -s <trsvcid>] - [--host-traddr=<traddr> | -w <traddr>] - [--host-iface=<iface> | -f <iface>] - [--hostnqn=<hostnqn> | -q <hostnqn>] - [--hostid=<hostid> | -I <hostid>] - [--dhchap-secret=<secret> | -S <secret>] - [--dhchap-ctrl-secret=<secret> | -C <secret>] - [--nr-io-queues=<#> | -i <#>] - [--nr-write-queues=<#> | -W <#>] - [--nr-poll-queues=<#> | -P <#>] - [--queue-size=<#> | -Q <#>] - [--keep-alive-tmo=<#> | -k <#>] - [--reconnect-delay=<#> | -c <#>] - [--ctrl-loss-tmo=<#> | -l <#>] - [--duplicate-connect | -D] - [--disable-sqflow | -d] - [--hdr-digest | -g] - [--data-digest | -G] +'nvme config' [--scan | -R] [--modify | -M] [--update | -U] [--dump | -O] + [--config=<cfg> | -J <cfg>] + [--transport=<trtype> | -t <trtype>] + [--nqn=<subnqn> | -n <subnqn>] + [--traddr=<traddr> | -a <traddr>] + [--trsvcid=<trsvcid> | -s <trsvcid>] + [--host-traddr=<traddr> | -w <traddr>] + [--host-iface=<iface> | -f <iface>] + [--hostnqn=<hostnqn> | -q <hostnqn>] + [--hostid=<hostid> | -I <hostid>] + [--dhchap-secret=<secret> | -S <secret>] + [--dhchap-ctrl-secret=<secret> | -C <secret>] + [--nr-io-queues=<#> | -i <#>] + [--nr-write-queues=<#> | -W <#>] + [--nr-poll-queues=<#> | -P <#>] + [--queue-size=<#> | -Q <#>] + [--keep-alive-tmo=<#> | -k <#>] + [--reconnect-delay=<#> | -c <#>] + [--ctrl-loss-tmo=<#> | -l <#>] + [--duplicate-connect | -D] [--disable-sqflow | -d] + [--hdr-digest | -g] [--data-digest | -G] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -52,7 +47,7 @@ OPTIONS -M:: --modify:: Add or modify entries in the configuration based on the values from - the commandline. + the commandline. -U:: --update:: @@ -71,7 +66,7 @@ OPTIONS -t <trtype>:: --transport=<trtype>:: This field specifies the network fabric being used for - a NVMe-over-Fabrics network. Current string values include: + a NVMe-over-Fabrics network. Current string values include: + [] |================= @@ -94,7 +89,7 @@ OPTIONS -s <trsvcid>:: --trsvcid=<trsvcid>:: - This field specifies the transport service id. For transports using IP + This field specifies the transport service id. For transports using IP addressing (e.g. rdma) this field is the port number. By default, the IP port number for the RDMA transport is 4420. @@ -186,6 +181,15 @@ OPTIONS --data-digest:: Generates/verifies data digest (TCP). +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Read the current system configuration and write the contents to /tmp/config.json: @@ -200,7 +204,6 @@ nvme-discover(1) nvme-connect(1) https://github.com/linux-nvme/libnvme/doc/config-schema.json - AUTHORS ------- This was written by mailto:hare@suse.com[Hannes Reinecke] diff --git a/Documentation/nvme-connect-all.1 b/Documentation/nvme-connect-all.1 index 9e795f5..4f37956 100644 --- a/Documentation/nvme-connect-all.1 +++ b/Documentation/nvme-connect-all.1 @@ -2,12 +2,12 @@ .\" Title: nvme-connect-all .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-CONNECT\-ALL" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-CONNECT\-ALL" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,37 +32,29 @@ nvme-connect-all \- Discover and Connect to Fabrics controllers\&. .SH "SYNOPSIS" .sp .nf -\fInvme connect\-all\fR - [\-\-transport=<trtype> | \-t <trtype>] - [\-\-nqn=<subnqn> | \-n <subnqn>] - [\-\-traddr=<traddr> | \-a <traddr>] - [\-\-trsvcid=<trsvcid> | \-s <trsvcid>] - [\-\-host\-traddr=<traddr> | \-w <traddr>] - [\-\-host\-iface=<iface> | \-f <iface>] - [\-\-hostnqn=<hostnqn> | \-q <hostnqn>] - [\-\-hostid=<hostid> | \-I <hostid>] - [\-\-raw=<filename> | \-r <filename>] - [\-\-device=<device> | \-d <device>] - [\-\-cfg\-file=<cfg> | \-C <cfg>] - [\-\-keep\-alive\-tmo=<sec> | \-k <sec>] - [\-\-reconnect\-delay=<#> | \-c <#>] - [\-\-ctrl\-loss\-tmo=<#> | \-l <#>] - [\-\-nr\-io\-queues=<#> | \-i <#>] - [\-\-nr\-write\-queues=<#> | \-W <#>] - [\-\-nr\-poll\-queues=<#> | \-P <#>] - [\-\-queue\-size=<#> | \-Q <#>] - [\-\-keyring=<#> ] - [\-\-tls_key=<#> ] - [\-\-hdr\-digest | \-g] - [\-\-data\-digest | \-G] - [\-\-persistent | \-p] - [\-\-tls ] - [\-\-quiet | \-S] - [\-\-dump\-config | \-O] - [\-\-nbft] - [\-\-no\-nbft] - [\-\-nbft\-path=<STR>] - [\-\-context=<STR>] +\fInvme connect\-all\fR [\-\-transport=<trtype> | \-t <trtype>] + [\-\-nqn=<subnqn> | \-n <subnqn>] + [\-\-traddr=<traddr> | \-a <traddr>] + [\-\-trsvcid=<trsvcid> | \-s <trsvcid>] + [\-\-host\-traddr=<traddr> | \-w <traddr>] + [\-\-host\-iface=<iface> | \-f <iface>] + [\-\-hostnqn=<hostnqn> | \-q <hostnqn>] + [\-\-hostid=<hostid> | \-I <hostid>] + [\-\-raw=<filename> | \-r <filename>] + [\-\-device=<device> | \-d <device>] + [\-\-cfg\-file=<cfg> | \-C <cfg>] + [\-\-keep\-alive\-tmo=<sec> | \-k <sec>] + [\-\-reconnect\-delay=<#> | \-c <#>] + [\-\-ctrl\-loss\-tmo=<#> | \-l <#>] + [\-\-nr\-io\-queues=<#> | \-i <#>] + [\-\-nr\-write\-queues=<#> | \-W <#>] + [\-\-nr\-poll\-queues=<#> | \-P <#>] + [\-\-queue\-size=<#> | \-Q <#>] [\-\-keyring=<#>] + [\-\-tls_key=<#>] [\-\-hdr\-digest | \-g] [\-\-data\-digest | \-G] + [\-\-persistent | \-p] [\-\-tls] [\-\-quiet | \-S] + [\-\-dump\-config | \-O] [\-\-nbft] [\-\-no\-nbft] + [\-\-nbft\-path=<STR>] [\-\-context=<STR>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -266,6 +258,20 @@ Use a user\-defined path to the NBFT tables .RS 4 Set the execution context to <STR>\&. This allows to coordinate the management of the global resources\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 @@ -352,9 +358,9 @@ command using a /usr/local/etc/nvme/discovery\&.conf file: .RS 4 .\} .nf -# Machine default \*(Aqnvme discover\*(Aq commands\&. Query the +# Machine default \*(Aqnvme discover\*(Aq commands\&. Query the # Discovery Controller\*(Aqs two ports (some resources may only -# be accessible on a single port)\&. Note an official +# be accessible on a single port)\&. Note an official # nqn (Host) name defined in the NVMe specification is being used # in this example\&. \-t rdma \-a 192\&.168\&.69\&.33 \-s 4420 \-q nqn\&.2014\-08\&.com\&.example:nvme:nvm\-subsystem\-sn\-d78432 diff --git a/Documentation/nvme-connect-all.html b/Documentation/nvme-connect-all.html index 4124714..d579c1f 100644 --- a/Documentation/nvme-connect-all.html +++ b/Documentation/nvme-connect-all.html @@ -749,37 +749,29 @@ nvme-connect-all(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme connect-all</em>
- [--transport=<trtype> | -t <trtype>]
- [--nqn=<subnqn> | -n <subnqn>]
- [--traddr=<traddr> | -a <traddr>]
- [--trsvcid=<trsvcid> | -s <trsvcid>]
- [--host-traddr=<traddr> | -w <traddr>]
- [--host-iface=<iface> | -f <iface>]
- [--hostnqn=<hostnqn> | -q <hostnqn>]
- [--hostid=<hostid> | -I <hostid>]
- [--raw=<filename> | -r <filename>]
- [--device=<device> | -d <device>]
- [--cfg-file=<cfg> | -C <cfg>]
- [--keep-alive-tmo=<sec> | -k <sec>]
- [--reconnect-delay=<#> | -c <#>]
- [--ctrl-loss-tmo=<#> | -l <#>]
- [--nr-io-queues=<#> | -i <#>]
- [--nr-write-queues=<#> | -W <#>]
- [--nr-poll-queues=<#> | -P <#>]
- [--queue-size=<#> | -Q <#>]
- [--keyring=<#> ]
- [--tls_key=<#> ]
- [--hdr-digest | -g]
- [--data-digest | -G]
- [--persistent | -p]
- [--tls ]
- [--quiet | -S]
- [--dump-config | -O]
- [--nbft]
- [--no-nbft]
- [--nbft-path=<STR>]
- [--context=<STR>]</pre>
+<pre class="content"><em>nvme connect-all</em> [--transport=<trtype> | -t <trtype>]
+ [--nqn=<subnqn> | -n <subnqn>]
+ [--traddr=<traddr> | -a <traddr>]
+ [--trsvcid=<trsvcid> | -s <trsvcid>]
+ [--host-traddr=<traddr> | -w <traddr>]
+ [--host-iface=<iface> | -f <iface>]
+ [--hostnqn=<hostnqn> | -q <hostnqn>]
+ [--hostid=<hostid> | -I <hostid>]
+ [--raw=<filename> | -r <filename>]
+ [--device=<device> | -d <device>]
+ [--cfg-file=<cfg> | -C <cfg>]
+ [--keep-alive-tmo=<sec> | -k <sec>]
+ [--reconnect-delay=<#> | -c <#>]
+ [--ctrl-loss-tmo=<#> | -l <#>]
+ [--nr-io-queues=<#> | -i <#>]
+ [--nr-write-queues=<#> | -W <#>]
+ [--nr-poll-queues=<#> | -P <#>]
+ [--queue-size=<#> | -Q <#>] [--keyring=<#>]
+ [--tls_key=<#>] [--hdr-digest | -g] [--data-digest | -G]
+ [--persistent | -p] [--tls] [--quiet | -S]
+ [--dump-config | -O] [--nbft] [--no-nbft]
+ [--nbft-path=<STR>] [--context=<STR>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -813,7 +805,7 @@ background.</p></div> <dd>
<p>
This field specifies the network fabric being used for
- a NVMe-over-Fabrics network. Current string values include:
+ a NVMe-over-Fabrics network. Current string values include:
</p>
<div class="tableblock">
<table rules="all"
@@ -879,7 +871,7 @@ cellspacing="0" cellpadding="4"> </dt>
<dd>
<p>
- This field specifies the transport service id. For transports using IP
+ This field specifies the transport service id. For transports using IP
addressing (e.g. rdma) this field is the port number. By default, the IP
port number for the RDMA transport is 4420.
</p>
@@ -1178,6 +1170,29 @@ cellspacing="0" cellpadding="4"> the management of the global resources.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -1221,9 +1236,9 @@ Issue a <em>nvme connect-all</em> command using a /usr/local/etc/nvme/discovery. </p>
<div class="listingblock">
<div class="content">
-<pre><code># Machine default 'nvme discover' commands. Query the
+<pre><code># Machine default 'nvme discover' commands. Query the
# Discovery Controller's two ports (some resources may only
-# be accessible on a single port). Note an official
+# be accessible on a single port). Note an official
# nqn (Host) name defined in the NVMe specification is being used
# in this example.
-t rdma -a 192.168.69.33 -s 4420 -q nqn.2014-08.com.example:nvme:nvm-subsystem-sn-d78432
@@ -1253,7 +1268,7 @@ nvme-connect(1)</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-connect-all.txt b/Documentation/nvme-connect-all.txt index 46b0911..faa2cf8 100644 --- a/Documentation/nvme-connect-all.txt +++ b/Documentation/nvme-connect-all.txt @@ -8,37 +8,29 @@ nvme-connect-all - Discover and Connect to Fabrics controllers. SYNOPSIS -------- [verse] -'nvme connect-all' - [--transport=<trtype> | -t <trtype>] - [--nqn=<subnqn> | -n <subnqn>] - [--traddr=<traddr> | -a <traddr>] - [--trsvcid=<trsvcid> | -s <trsvcid>] - [--host-traddr=<traddr> | -w <traddr>] - [--host-iface=<iface> | -f <iface>] - [--hostnqn=<hostnqn> | -q <hostnqn>] - [--hostid=<hostid> | -I <hostid>] - [--raw=<filename> | -r <filename>] - [--device=<device> | -d <device>] - [--cfg-file=<cfg> | -C <cfg>] - [--keep-alive-tmo=<sec> | -k <sec>] - [--reconnect-delay=<#> | -c <#>] - [--ctrl-loss-tmo=<#> | -l <#>] - [--nr-io-queues=<#> | -i <#>] - [--nr-write-queues=<#> | -W <#>] - [--nr-poll-queues=<#> | -P <#>] - [--queue-size=<#> | -Q <#>] - [--keyring=<#> ] - [--tls_key=<#> ] - [--hdr-digest | -g] - [--data-digest | -G] - [--persistent | -p] - [--tls ] - [--quiet | -S] - [--dump-config | -O] - [--nbft] - [--no-nbft] - [--nbft-path=<STR>] - [--context=<STR>] +'nvme connect-all' [--transport=<trtype> | -t <trtype>] + [--nqn=<subnqn> | -n <subnqn>] + [--traddr=<traddr> | -a <traddr>] + [--trsvcid=<trsvcid> | -s <trsvcid>] + [--host-traddr=<traddr> | -w <traddr>] + [--host-iface=<iface> | -f <iface>] + [--hostnqn=<hostnqn> | -q <hostnqn>] + [--hostid=<hostid> | -I <hostid>] + [--raw=<filename> | -r <filename>] + [--device=<device> | -d <device>] + [--cfg-file=<cfg> | -C <cfg>] + [--keep-alive-tmo=<sec> | -k <sec>] + [--reconnect-delay=<#> | -c <#>] + [--ctrl-loss-tmo=<#> | -l <#>] + [--nr-io-queues=<#> | -i <#>] + [--nr-write-queues=<#> | -W <#>] + [--nr-poll-queues=<#> | -P <#>] + [--queue-size=<#> | -Q <#>] [--keyring=<#>] + [--tls_key=<#>] [--hdr-digest | -g] [--data-digest | -G] + [--persistent | -p] [--tls] [--quiet | -S] + [--dump-config | -O] [--nbft] [--no-nbft] + [--nbft-path=<STR>] [--context=<STR>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -62,13 +54,13 @@ OPTIONS -t <trtype>:: --transport=<trtype>:: This field specifies the network fabric being used for - a NVMe-over-Fabrics network. Current string values include: + a NVMe-over-Fabrics network. Current string values include: + [] |================= |Value|Definition |rdma|The network fabric is an rdma network (RoCE, iWARP, Infiniband, basic rdma, etc) -|fc |*WIP* The network fabric is a Fibre Channel network. +|fc |*WIP* The network fabric is a Fibre Channel network. |tcp |The network fabric is a TCP/IP network. |loop|Connect to a NVMe over Fabrics target on the local host |================= @@ -85,7 +77,7 @@ OPTIONS -s <trsvcid>:: --trsvcid=<trsvcid>:: - This field specifies the transport service id. For transports using IP + This field specifies the transport service id. For transports using IP addressing (e.g. rdma) this field is the port number. By default, the IP port number for the RDMA transport is 4420. @@ -203,18 +195,27 @@ OPTIONS Print out resulting JSON configuration file to stdout. --nbft:: - Only look at NBFT tables + Only look at NBFT tables --no-nbft:: - Do not look at NBFT tables + Do not look at NBFT tables --nbft-path=<STR>:: - Use a user-defined path to the NBFT tables + Use a user-defined path to the NBFT tables --context <STR>:: Set the execution context to <STR>. This allows to coordinate the management of the global resources. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Connect to all records returned by the Discover Controller with IP4 address @@ -241,9 +242,9 @@ the RDMA network. Port 4420 is used by default: * Issue a 'nvme connect-all' command using a @SYSCONFDIR@/nvme/discovery.conf file: + ----------- -# Machine default 'nvme discover' commands. Query the +# Machine default 'nvme discover' commands. Query the # Discovery Controller's two ports (some resources may only -# be accessible on a single port). Note an official +# be accessible on a single port). Note an official # nqn (Host) name defined in the NVMe specification is being used # in this example. -t rdma -a 192.168.69.33 -s 4420 -q nqn.2014-08.com.example:nvme:nvm-subsystem-sn-d78432 diff --git a/Documentation/nvme-connect.1 b/Documentation/nvme-connect.1 index b27680a..4eb8bb6 100644 --- a/Documentation/nvme-connect.1 +++ b/Documentation/nvme-connect.1 @@ -2,12 +2,12 @@ .\" Title: nvme-connect .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-CONNECT" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-CONNECT" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,36 +32,29 @@ nvme-connect \- Connect to a Fabrics controller\&. .SH "SYNOPSIS" .sp .nf -\fInvme connect\fR - [\-\-transport=<trtype> | \-t <trtype>] - [\-\-nqn=<subnqn> | \-n <subnqn>] - [\-\-traddr=<traddr> | \-a <traddr>] - [\-\-trsvcid=<trsvcid> | \-s <trsvcid>] - [\-\-host\-traddr=<traddr> | \-w <traddr>] - [\-\-host\-iface=<iface> | \-f <iface>] - [\-\-hostnqn=<hostnqn> | \-q <hostnqn>] - [\-\-hostid=<hostid> | \-I <hostid>] - [\-\-config\-file=<cfg> | \-J <cfg> ] - [\-\-dhchap\-secret=<secret> | \-S <secret>] - [\-\-dhchap\-ctrl\-secret=<secret> | \-C <secret>] - [\-\-nr\-io\-queues=<#> | \-i <#>] - [\-\-nr\-write\-queues=<#> | \-W <#>] - [\-\-nr\-poll\-queues=<#> | \-P <#>] - [\-\-queue\-size=<#> | \-Q <#>] - [\-\-keep\-alive\-tmo=<#> | \-k <#>] - [\-\-reconnect\-delay=<#> | \-c <#>] - [\-\-ctrl\-loss\-tmo=<#> | \-l <#>] - [\-\-tos=<#> | \-T <#>] - [\-\-keyring=<#> ] - [\-\-tls_key=<#> ] - [\-\-duplicate\-connect | \-D] - [\-\-disable\-sqflow | \-d] - [\-\-hdr\-digest | \-g] - [\-\-data\-digest | \-G] - [\-\-tls ] - [\-\-dump\-config | \-O] - [\-\-output\-format=<fmt> | \-o <fmt>] - [\-\-application=<id> ] +\fInvme connect\fR [\-\-transport=<trtype> | \-t <trtype>] + [\-\-nqn=<subnqn> | \-n <subnqn>] + [\-\-traddr=<traddr> | \-a <traddr>] + [\-\-trsvcid=<trsvcid> | \-s <trsvcid>] + [\-\-host\-traddr=<traddr> | \-w <traddr>] + [\-\-host\-iface=<iface> | \-f <iface>] + [\-\-hostnqn=<hostnqn> | \-q <hostnqn>] + [\-\-hostid=<hostid> | \-I <hostid>] + [\-\-config\-file=<cfg> | \-J <cfg>] + [\-\-dhchap\-secret=<secret> | \-S <secret>] + [\-\-dhchap\-ctrl\-secret=<secret> | \-C <secret>] + [\-\-nr\-io\-queues=<#> | \-i <#>] + [\-\-nr\-write\-queues=<#> | \-W <#>] + [\-\-nr\-poll\-queues=<#> | \-P <#>] + [\-\-queue\-size=<#> | \-Q <#>] + [\-\-keep\-alive\-tmo=<#> | \-k <#>] + [\-\-reconnect\-delay=<#> | \-c <#>] + [\-\-ctrl\-loss\-tmo=<#> | \-l <#>] [\-\-tos=<#> | \-T <#>] + [\-\-keyring=<#>] [\-\-tls_key=<#>] + [\-\-duplicate\-connect | \-D] [\-\-disable\-sqflow | \-d] + [\-\-hdr\-digest | \-g] [\-\-data\-digest | \-G] [\-\-tls] + [\-\-dump\-config | \-O] [\-\-application=<id>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -154,7 +147,7 @@ to not read in an existing configuration file\&. The JSON configuration file for \-S <secret>, \-\-dhchap\-secret=<secret> .RS 4 NVMe In\-band authentication secret; needs to be in ASCII format as specified in NVMe 2\&.0 section 8\&.13\&.5\&.8 -\fISecret representation\fR\&. If this option is not specified, the default is read from /usr/local/etc/nvme/hostkey\&. If that does not exist no in\-band authentication is attempted\&. +\fISecret representation\fR\&. .RE .PP \-C <secret>, \-\-dhchap\-ctrl\-secret=<secret> @@ -243,17 +236,23 @@ Enable TLS encryption (TCP)\&. Print out resulting JSON configuration file to stdout\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-\-context <STR> +.RS 4 +Set the execution context to <STR>\&. This allows to coordinate the management of the global resources\&. +.RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to -\fInormal\fR +\fInormal\fR, +\fIjson\fR or -\fIjson\fR\&. Only one output format can be used at a time\&. When this option is specified, the device associated with the connection will be printed\&. Nothing is printed otherwise\&. +\fIbinary\fR\&. Only one output format can be used at a time\&. .RE .PP -\-\-context <STR> +\-v, \-\-verbose .RS 4 -Set the execution context to <STR>\&. This allows to coordinate the management of the global resources\&. +Increase the information detail in the output\&. .RE .SH "EXAMPLES" .sp diff --git a/Documentation/nvme-connect.html b/Documentation/nvme-connect.html index 4007df2..4282f24 100644 --- a/Documentation/nvme-connect.html +++ b/Documentation/nvme-connect.html @@ -749,36 +749,29 @@ nvme-connect(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme connect</em>
- [--transport=<trtype> | -t <trtype>]
- [--nqn=<subnqn> | -n <subnqn>]
- [--traddr=<traddr> | -a <traddr>]
- [--trsvcid=<trsvcid> | -s <trsvcid>]
- [--host-traddr=<traddr> | -w <traddr>]
- [--host-iface=<iface> | -f <iface>]
- [--hostnqn=<hostnqn> | -q <hostnqn>]
- [--hostid=<hostid> | -I <hostid>]
- [--config-file=<cfg> | -J <cfg> ]
- [--dhchap-secret=<secret> | -S <secret>]
- [--dhchap-ctrl-secret=<secret> | -C <secret>]
- [--nr-io-queues=<#> | -i <#>]
- [--nr-write-queues=<#> | -W <#>]
- [--nr-poll-queues=<#> | -P <#>]
- [--queue-size=<#> | -Q <#>]
- [--keep-alive-tmo=<#> | -k <#>]
- [--reconnect-delay=<#> | -c <#>]
- [--ctrl-loss-tmo=<#> | -l <#>]
- [--tos=<#> | -T <#>]
- [--keyring=<#> ]
- [--tls_key=<#> ]
- [--duplicate-connect | -D]
- [--disable-sqflow | -d]
- [--hdr-digest | -g]
- [--data-digest | -G]
- [--tls ]
- [--dump-config | -O]
- [--output-format=<fmt> | -o <fmt>]
- [--application=<id> ]</pre>
+<pre class="content"><em>nvme connect</em> [--transport=<trtype> | -t <trtype>]
+ [--nqn=<subnqn> | -n <subnqn>]
+ [--traddr=<traddr> | -a <traddr>]
+ [--trsvcid=<trsvcid> | -s <trsvcid>]
+ [--host-traddr=<traddr> | -w <traddr>]
+ [--host-iface=<iface> | -f <iface>]
+ [--hostnqn=<hostnqn> | -q <hostnqn>]
+ [--hostid=<hostid> | -I <hostid>]
+ [--config-file=<cfg> | -J <cfg>]
+ [--dhchap-secret=<secret> | -S <secret>]
+ [--dhchap-ctrl-secret=<secret> | -C <secret>]
+ [--nr-io-queues=<#> | -i <#>]
+ [--nr-write-queues=<#> | -W <#>]
+ [--nr-poll-queues=<#> | -P <#>]
+ [--queue-size=<#> | -Q <#>]
+ [--keep-alive-tmo=<#> | -k <#>]
+ [--reconnect-delay=<#> | -c <#>]
+ [--ctrl-loss-tmo=<#> | -l <#>] [--tos=<#> | -T <#>]
+ [--keyring=<#>] [--tls_key=<#>]
+ [--duplicate-connect | -D] [--disable-sqflow | -d]
+ [--hdr-digest | -g] [--data-digest | -G] [--tls]
+ [--dump-config | -O] [--application=<id>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -804,7 +797,7 @@ specified by the --nqn option.</p></div> <dd>
<p>
This field specifies the network fabric being used for
- a NVMe-over-Fabrics network. Current string values include:
+ a NVMe-over-Fabrics network. Current string values include:
</p>
<div class="tableblock">
<table rules="all"
@@ -870,7 +863,7 @@ cellspacing="0" cellpadding="4"> </dt>
<dd>
<p>
- This field specifies the transport service id. For transports using IP
+ This field specifies the transport service id. For transports using IP
addressing (e.g. rdma) this field is the port number. By default, the IP
port number for the RDMA transport is 4420.
</p>
@@ -953,9 +946,6 @@ cellspacing="0" cellpadding="4"> <p>
NVMe In-band authentication secret; needs to be in ASCII format as
specified in NVMe 2.0 section 8.13.5.8 <em>Secret representation</em>.
- If this option is not specified, the default is read from
- /usr/local/etc/nvme/hostkey. If that does not exist no in-band authentication
- is attempted.
</p>
</dd>
<dt class="hdlist1">
@@ -1144,25 +1134,35 @@ cellspacing="0" cellpadding="4"> </p>
</dd>
<dt class="hdlist1">
--o <format>
+--context <STR>
</dt>
+<dd>
+<p>
+ Set the execution context to <STR>. This allows to coordinate
+ the management of the global resources.
+</p>
+</dd>
<dt class="hdlist1">
---output-format=<format>
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em> or <em>json</em>. Only one output format can
- be used at a time. When this option is specified, the device associated with
- the connection will be printed. Nothing is printed otherwise.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
</p>
</dd>
<dt class="hdlist1">
---context <STR>
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
</dt>
<dd>
<p>
- Set the execution context to <STR>. This allows to coordinate
- the management of the global resources.
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -1211,7 +1211,7 @@ and <a href="mailto:hch@lst.de">Christoph Hellwig</a></p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-connect.txt b/Documentation/nvme-connect.txt index a6effaf..af3e7d3 100644 --- a/Documentation/nvme-connect.txt +++ b/Documentation/nvme-connect.txt @@ -8,36 +8,29 @@ nvme-connect - Connect to a Fabrics controller. SYNOPSIS -------- [verse] -'nvme connect' - [--transport=<trtype> | -t <trtype>] - [--nqn=<subnqn> | -n <subnqn>] - [--traddr=<traddr> | -a <traddr>] - [--trsvcid=<trsvcid> | -s <trsvcid>] - [--host-traddr=<traddr> | -w <traddr>] - [--host-iface=<iface> | -f <iface>] - [--hostnqn=<hostnqn> | -q <hostnqn>] - [--hostid=<hostid> | -I <hostid>] - [--config-file=<cfg> | -J <cfg> ] - [--dhchap-secret=<secret> | -S <secret>] - [--dhchap-ctrl-secret=<secret> | -C <secret>] - [--nr-io-queues=<#> | -i <#>] - [--nr-write-queues=<#> | -W <#>] - [--nr-poll-queues=<#> | -P <#>] - [--queue-size=<#> | -Q <#>] - [--keep-alive-tmo=<#> | -k <#>] - [--reconnect-delay=<#> | -c <#>] - [--ctrl-loss-tmo=<#> | -l <#>] - [--tos=<#> | -T <#>] - [--keyring=<#> ] - [--tls_key=<#> ] - [--duplicate-connect | -D] - [--disable-sqflow | -d] - [--hdr-digest | -g] - [--data-digest | -G] - [--tls ] - [--dump-config | -O] - [--output-format=<fmt> | -o <fmt>] - [--application=<id> ] +'nvme connect' [--transport=<trtype> | -t <trtype>] + [--nqn=<subnqn> | -n <subnqn>] + [--traddr=<traddr> | -a <traddr>] + [--trsvcid=<trsvcid> | -s <trsvcid>] + [--host-traddr=<traddr> | -w <traddr>] + [--host-iface=<iface> | -f <iface>] + [--hostnqn=<hostnqn> | -q <hostnqn>] + [--hostid=<hostid> | -I <hostid>] + [--config-file=<cfg> | -J <cfg>] + [--dhchap-secret=<secret> | -S <secret>] + [--dhchap-ctrl-secret=<secret> | -C <secret>] + [--nr-io-queues=<#> | -i <#>] + [--nr-write-queues=<#> | -W <#>] + [--nr-poll-queues=<#> | -P <#>] + [--queue-size=<#> | -Q <#>] + [--keep-alive-tmo=<#> | -k <#>] + [--reconnect-delay=<#> | -c <#>] + [--ctrl-loss-tmo=<#> | -l <#>] [--tos=<#> | -T <#>] + [--keyring=<#>] [--tls_key=<#>] + [--duplicate-connect | -D] [--disable-sqflow | -d] + [--hdr-digest | -g] [--data-digest | -G] [--tls] + [--dump-config | -O] [--application=<id>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -50,7 +43,7 @@ OPTIONS -t <trtype>:: --transport=<trtype>:: This field specifies the network fabric being used for - a NVMe-over-Fabrics network. Current string values include: + a NVMe-over-Fabrics network. Current string values include: + [] |================= @@ -73,7 +66,7 @@ OPTIONS -s <trsvcid>:: --trsvcid=<trsvcid>:: - This field specifies the transport service id. For transports using IP + This field specifies the transport service id. For transports using IP addressing (e.g. rdma) this field is the port number. By default, the IP port number for the RDMA transport is 4420. @@ -114,9 +107,6 @@ OPTIONS --dhchap-secret=<secret>:: NVMe In-band authentication secret; needs to be in ASCII format as specified in NVMe 2.0 section 8.13.5.8 'Secret representation'. - If this option is not specified, the default is read from - @SYSCONFDIR@/nvme/hostkey. If that does not exist no in-band authentication - is attempted. -C <secret>:: --dhchap-ctrl-secret=<secret>:: @@ -190,16 +180,19 @@ OPTIONS --dump-config:: Print out resulting JSON configuration file to stdout. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal' or 'json'. Only one output format can - be used at a time. When this option is specified, the device associated with - the connection will be printed. Nothing is printed otherwise. - --context <STR>:: Set the execution context to <STR>. This allows to coordinate the management of the global resources. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Connect to a subsystem named nqn.2014-08.com.example:nvme:nvm-subsystem-sn-d78432 @@ -215,7 +208,6 @@ SEE ALSO nvme-discover(1) nvme-connect-all(1) - AUTHORS ------- This was co-written by mailto:james.p.freyensee@intel.com[Jay Freyensee] diff --git a/Documentation/nvme-copy.1 b/Documentation/nvme-copy.1 index 4228451..b3fe795 100644 --- a/Documentation/nvme-copy.1 +++ b/Documentation/nvme-copy.1 @@ -2,12 +2,12 @@ .\" Title: nvme-copy .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-COPY" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-COPY" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -35,6 +35,8 @@ nvme-copy \- Send an NVMe Simple Copy command, provide results \fInvme\-copy\fR <device> [\-\-sdlba=<sdlba> | \-d <sdlba>] [\-\-blocks=<nlb\-list,> | \-b <nlb\-list,>] [\-\-slbs=<slbas,> | \-s <slbas,>] + [\-\-snsids=<snsids,> | \-N <snsids,>] + [\-\-sopts=<sopts,> | \-O <sopts,>] [\-\-limited\-retry | \-l] [\-\-force\-unit\-access | \-f] [\-\-prinfow=<prinfow> | \-p <prinfow>] @@ -48,91 +50,116 @@ nvme-copy \- Send an NVMe Simple Copy command, provide results [\-\-dir\-type=<type> | \-T <type>] [\-\-dir\-spec=<spec> | \-S <spec>] [\-\-format=<entry\-format> | \-F <entry\-format>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp The Copy command is used by the host to copy data from one or more source logical block ranges to a single consecutive destination logical block range\&. .SH "OPTIONS" .PP -\-\-sdlba=<sdlba>, \-d <sdlba> +\-d <sdlba>, \-\-sdlba=<sdlba> .RS 4 64\-bit addr of first destination logical block .RE .PP -\-\-blocks=<nlb\-list,>, \-b <nlb\-list,> +\-b <nlb\-list,>, \-\-blocks=<nlb\-list,> .RS 4 Comma separated list of the number of blocks in each range .RE .PP -\-\-slbs=<slbas,>, \-s <slbas,> +\-s <slbas,>, \-\-slbs=<slbas,> .RS 4 Comma separated list of the starting blocks in each range .RE .PP -\-\-limited\-retry, \-l +\-\-snsids=<snsids,>, \-N <snsids,> +.RS 4 +Comma separated list of the source namespace identifiers in each range +.RE +.PP +\-\-sopts=<sopts,>, \-O <sopts,> +.RS 4 +Comma separated list of the source options in each range +.RE +.PP +\-l, \-\-limited\-retry .RS 4 Sets the limited retry flag\&. .RE .PP -\-\-force\-unit\-access, \-f +\-f, \-\-force\-unit\-access .RS 4 Set the force\-unit access flag\&. .RE .PP -\-\-prinfow=<prinfow>, \-p <prinfow> +\-p <prinfow>, \-\-prinfow=<prinfow> .RS 4 Protection Information field write definition\&. .RE .PP -\-\-prinfor=<prinfor>, \-P <prinfor> +\-P <prinfor>, \-\-prinfor=<prinfor> .RS 4 Protection Information field read definition\&. .RE .PP -\-\-ref\-tag=<reftag>, \-r <reftag> +\-r <reftag>, \-\-ref\-tag=<reftag> .RS 4 initial lba reference tag\&. .RE .PP -\-\-expected\-ref\-tags=<reftag,>, \-R <reftag,> +\-R <reftag,>, \-\-expected\-ref\-tags=<reftag,> .RS 4 expected lba reference tags (comma\-separated list)\&. .RE .PP -\-\-app\-tag=<apptag>, \-a <apptag> +\-a <apptag>, \-\-app\-tag=<apptag> .RS 4 lba app tag .RE .PP -\-\-expected\-app\-tags=<apptag,>, \-A <apptag,> +\-A <apptag,>, \-\-expected\-app\-tags=<apptag,> .RS 4 expected lba app tags (comma\-separated list) .RE .PP -\-\-app\-mask=<appmask>, \-m <appmask> +\-m <appmask>, \-\-app\-mask=<appmask> .RS 4 lba tag mask .RE .PP -\-\-expected\-app\-masks=<appmask,>, \-M <appmask,> +\-M <appmask,>, \-\-expected\-app\-masks=<appmask,> .RS 4 expected lba tag masks (comma\-separated list) .RE .PP -\-\-dir\-type=<type>, \-T <type> +\-T <type>, \-\-dir\-type=<type> .RS 4 Optional directive type\&. The nvme\-cli only enforces the value be in the defined range for the directive type, though the NVMe specification (1\&.3a) defines only one directive, 01h, for write stream identifiers\&. .RE .PP -\-\-dir\-spec=<spec>, \-S <spec> +\-S <spec>, \-\-dir\-spec=<spec> .RS 4 Optional field for directive specifics\&. When used with write streams, this value is defined to be the write stream identifier\&. The nvme\-cli will not validate the stream requested is within the controller\(cqs capabilities\&. .RE .PP -\-\-format=<entry\-format>, \-F <entry\-format> +\-F <entry\-format>, \-\-format=<entry\-format> .RS 4 source range entry format .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet\&. diff --git a/Documentation/nvme-copy.html b/Documentation/nvme-copy.html index 875304c..010361e 100644 --- a/Documentation/nvme-copy.html +++ b/Documentation/nvme-copy.html @@ -752,6 +752,8 @@ nvme-copy(1) Manual Page <pre class="content"><em>nvme-copy</em> <device> [--sdlba=<sdlba> | -d <sdlba>]
[--blocks=<nlb-list,> | -b <nlb-list,>]
[--slbs=<slbas,> | -s <slbas,>]
+ [--snsids=<snsids,> | -N <snsids,>]
+ [--sopts=<sopts,> | -O <sopts,>]
[--limited-retry | -l]
[--force-unit-access | -f]
[--prinfow=<prinfow> | -p <prinfow>]
@@ -764,7 +766,8 @@ nvme-copy(1) Manual Page [--expected-app-masks=<appmask,> | -M <appmask,>]
[--dir-type=<type> | -T <type>]
[--dir-spec=<spec> | -S <spec>]
- [--format=<entry-format> | -F <entry-format>]</pre>
+ [--format=<entry-format> | -F <entry-format>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -781,10 +784,10 @@ logical block ranges to a single consecutive destination logical block range.</p <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
---sdlba=<sdlba>
+-d <sdlba>
</dt>
<dt class="hdlist1">
--d <sdlba>
+--sdlba=<sdlba>
</dt>
<dd>
<p>
@@ -792,10 +795,10 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---blocks=<nlb-list,>
+-b <nlb-list,>
</dt>
<dt class="hdlist1">
--b <nlb-list,>
+--blocks=<nlb-list,>
</dt>
<dd>
<p>
@@ -803,10 +806,10 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---slbs=<slbas,>
+-s <slbas,>
</dt>
<dt class="hdlist1">
--s <slbas,>
+--slbs=<slbas,>
</dt>
<dd>
<p>
@@ -814,21 +817,43 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---limited-retry
+--snsids=<snsids,>
+</dt>
+<dt class="hdlist1">
+-N <snsids,>
+</dt>
+<dd>
+<p>
+ Comma separated list of the source namespace identifiers in each range
+</p>
+</dd>
+<dt class="hdlist1">
+--sopts=<sopts,>
</dt>
<dt class="hdlist1">
+-O <sopts,>
+</dt>
+<dd>
+<p>
+ Comma separated list of the source options in each range
+</p>
+</dd>
+<dt class="hdlist1">
-l
</dt>
+<dt class="hdlist1">
+--limited-retry
+</dt>
<dd>
<p>
Sets the limited retry flag.
</p>
</dd>
<dt class="hdlist1">
---force-unit-access
+-f
</dt>
<dt class="hdlist1">
--f
+--force-unit-access
</dt>
<dd>
<p>
@@ -836,10 +861,10 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---prinfow=<prinfow>
+-p <prinfow>
</dt>
<dt class="hdlist1">
--p <prinfow>
+--prinfow=<prinfow>
</dt>
<dd>
<p>
@@ -847,10 +872,10 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---prinfor=<prinfor>
+-P <prinfor>
</dt>
<dt class="hdlist1">
--P <prinfor>
+--prinfor=<prinfor>
</dt>
<dd>
<p>
@@ -858,10 +883,10 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---ref-tag=<reftag>
+-r <reftag>
</dt>
<dt class="hdlist1">
--r <reftag>
+--ref-tag=<reftag>
</dt>
<dd>
<p>
@@ -869,10 +894,10 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---expected-ref-tags=<reftag,>
+-R <reftag,>
</dt>
<dt class="hdlist1">
--R <reftag,>
+--expected-ref-tags=<reftag,>
</dt>
<dd>
<p>
@@ -880,10 +905,10 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---app-tag=<apptag>
+-a <apptag>
</dt>
<dt class="hdlist1">
--a <apptag>
+--app-tag=<apptag>
</dt>
<dd>
<p>
@@ -891,10 +916,10 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---expected-app-tags=<apptag,>
+-A <apptag,>
</dt>
<dt class="hdlist1">
--A <apptag,>
+--expected-app-tags=<apptag,>
</dt>
<dd>
<p>
@@ -902,10 +927,10 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---app-mask=<appmask>
+-m <appmask>
</dt>
<dt class="hdlist1">
--m <appmask>
+--app-mask=<appmask>
</dt>
<dd>
<p>
@@ -913,10 +938,10 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---expected-app-masks=<appmask,>
+-M <appmask,>
</dt>
<dt class="hdlist1">
--M <appmask,>
+--expected-app-masks=<appmask,>
</dt>
<dd>
<p>
@@ -924,10 +949,10 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---dir-type=<type>
+-T <type>
</dt>
<dt class="hdlist1">
--T <type>
+--dir-type=<type>
</dt>
<dd>
<p>
@@ -938,10 +963,10 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---dir-spec=<spec>
+-S <spec>
</dt>
<dt class="hdlist1">
--S <spec>
+--dir-spec=<spec>
</dt>
<dd>
<p>
@@ -952,16 +977,39 @@ logical block ranges to a single consecutive destination logical block range.</p </p>
</dd>
<dt class="hdlist1">
---format=<entry-format>
+-F <entry-format>
</dt>
<dt class="hdlist1">
--F <entry-format>
+--format=<entry-format>
</dt>
<dd>
<p>
source range entry format
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -982,7 +1030,7 @@ logical block ranges to a single consecutive destination logical block range.</p <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-copy.txt b/Documentation/nvme-copy.txt index 1fad952..7c5fb0e 100644 --- a/Documentation/nvme-copy.txt +++ b/Documentation/nvme-copy.txt @@ -11,6 +11,8 @@ SYNOPSIS 'nvme-copy' <device> [--sdlba=<sdlba> | -d <sdlba>] [--blocks=<nlb-list,> | -b <nlb-list,>] [--slbs=<slbas,> | -s <slbas,>] + [--snsids=<snsids,> | -N <snsids,>] + [--sopts=<sopts,> | -O <sopts,>] [--limited-retry | -l] [--force-unit-access | -f] [--prinfow=<prinfow> | -p <prinfow>] @@ -24,6 +26,7 @@ SYNOPSIS [--dir-type=<type> | -T <type>] [--dir-spec=<spec> | -S <spec>] [--format=<entry-format> | -F <entry-format>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -32,76 +35,93 @@ logical block ranges to a single consecutive destination logical block range. OPTIONS ------- ---sdlba=<sdlba>:: -d <sdlba>:: +--sdlba=<sdlba>:: 64-bit addr of first destination logical block ---blocks=<nlb-list,>:: -b <nlb-list,>:: +--blocks=<nlb-list,>:: Comma separated list of the number of blocks in each range ---slbs=<slbas,>:: -s <slbas,>:: +--slbs=<slbas,>:: Comma separated list of the starting blocks in each range ---limited-retry:: +--snsids=<snsids,>:: +-N <snsids,>:: + Comma separated list of the source namespace identifiers in each range + +--sopts=<sopts,>:: +-O <sopts,>:: + Comma separated list of the source options in each range + -l:: +--limited-retry:: Sets the limited retry flag. ---force-unit-access:: -f:: +--force-unit-access:: Set the force-unit access flag. ---prinfow=<prinfow>:: -p <prinfow>:: +--prinfow=<prinfow>:: Protection Information field write definition. ---prinfor=<prinfor>:: -P <prinfor>:: +--prinfor=<prinfor>:: Protection Information field read definition. ---ref-tag=<reftag>:: -r <reftag>:: +--ref-tag=<reftag>:: initial lba reference tag. ---expected-ref-tags=<reftag,>:: -R <reftag,>:: +--expected-ref-tags=<reftag,>:: expected lba reference tags (comma-separated list). ---app-tag=<apptag>:: -a <apptag>:: +--app-tag=<apptag>:: lba app tag ---expected-app-tags=<apptag,>:: -A <apptag,>:: +--expected-app-tags=<apptag,>:: expected lba app tags (comma-separated list) ---app-mask=<appmask>:: -m <appmask>:: +--app-mask=<appmask>:: lba tag mask ---expected-app-masks=<appmask,>:: -M <appmask,>:: +--expected-app-masks=<appmask,>:: expected lba tag masks (comma-separated list) ---dir-type=<type>:: -T <type>:: +--dir-type=<type>:: Optional directive type. The nvme-cli only enforces the value be in the defined range for the directive type, though the NVMe specification (1.3a) defines only one directive, 01h, for write stream identifiers. ---dir-spec=<spec>:: -S <spec>:: +--dir-spec=<spec>:: Optional field for directive specifics. When used with write streams, this value is defined to be the write stream identifier. The nvme-cli will not validate the stream requested is within the controller's capabilities. ---format=<entry-format>:: -F <entry-format>:: +--format=<entry-format>:: source range entry format +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet. diff --git a/Documentation/nvme-create-ns.1 b/Documentation/nvme-create-ns.1 index a63aaad..89cf2a9 100644 --- a/Documentation/nvme-create-ns.1 +++ b/Documentation/nvme-create-ns.1 @@ -2,12 +2,12 @@ .\" Title: nvme-create-ns .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-CREATE\-NS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-CREATE\-NS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -39,6 +39,7 @@ nvme-create-ns \- Send NVMe Namespace management command to create namespace, re [\-\-nmic=<nmic> | \-m <nmic>] [\-\-anagrp\-id=<anagrpid> | \-a <anagrpid>] [\-\-nvmset\-id=<nvmsetid> | \-i <nvmsetid>] + [\-\-endg\-id=<endgid> | \-e <endgid>] [\-\-csi=<command_set_identifier> | \-y <command_set_identifier>] [\-\-lbstm=<lbstm> | \-l <lbstm>] [\-\-nphndls=<nphndls> | \-n <nphndls>] @@ -48,9 +49,10 @@ nvme-create-ns \- Send NVMe Namespace management command to create namespace, re [\-\-ncap\-si=<ncap\-si> | \-C <ncap\-si>] [\-\-azr | \-z] [\-\-rar=<rar> | \-r <rar>] - [\-\-ror=<ror> | \-o <ror>] + [\-\-ror=<ror> | \-O <ror>] [\-\-rnumzrwa=<rnumzrwa> | \-u <rnumzrwa>] [\-\-phndls=<placement\-handle\-list,> | \-p <placement\-handle\-list,>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -94,6 +96,11 @@ ANA Group Identifier\&. If this value is 0h specifies that the controller determ This field specifies the identifier of the NVM Set\&. .RE .PP +\-e <endgid>, \-\-endg\-id=<endgid> +.RS 4 +This field specifies the identifier of the endurance group\&. +.RE +.PP \-y <command_set_identifier>, \-\-csi=<command_set_identifier> .RS 4 This field specifies the identifier of command set\&. if not issued, NVM Command Set will be selected\&. @@ -134,7 +141,7 @@ Allocate ZRWA Resources\&. If set to 1, then the namespace is to be created with Requested Active Resources\&. This field specifies the number of active resources to be allocated to the created namespace\&. .RE .PP -\-o <ror>, \-\-ror=<ror> +\-O <ror>, \-\-ror=<ror> .RS 4 Requested Open Resources\&. This field specifies the number of open resources to be allocated to the created namespace\&. .RE @@ -148,6 +155,20 @@ Requested Number of ZRWA Resources\&. This field specifies the number of ZRWA re .RS 4 The comma separated list of Reclaim Unit Handle Identifier to be associated with each Placement Handle\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-create-ns.html b/Documentation/nvme-create-ns.html index fe15e74..1ff077a 100644 --- a/Documentation/nvme-create-ns.html +++ b/Documentation/nvme-create-ns.html @@ -756,6 +756,7 @@ nvme-create-ns(1) Manual Page [--nmic=<nmic> | -m <nmic>]
[--anagrp-id=<anagrpid> | -a <anagrpid>]
[--nvmset-id=<nvmsetid> | -i <nvmsetid>]
+ [--endg-id=<endgid> | -e <endgid>]
[--csi=<command_set_identifier> | -y <command_set_identifier>]
[--lbstm=<lbstm> | -l <lbstm>]
[--nphndls=<nphndls> | -n <nphndls>]
@@ -765,9 +766,10 @@ nvme-create-ns(1) Manual Page [--ncap-si=<ncap-si> | -C <ncap-si>]
[--azr | -z]
[--rar=<rar> | -r <rar>]
- [--ror=<ror> | -o <ror>]
+ [--ror=<ror> | -O <ror>]
[--rnumzrwa=<rnumzrwa> | -u <rnumzrwa>]
- [--phndls=<placement-handle-list,> | -p <placement-handle-list,>]</pre>
+ [--phndls=<placement-handle-list,> | -p <placement-handle-list,>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -866,6 +868,17 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di </p>
</dd>
<dt class="hdlist1">
+-e <endgid>
+</dt>
+<dt class="hdlist1">
+--endg-id=<endgid>
+</dt>
+<dd>
+<p>
+ This field specifies the identifier of the endurance group.
+</p>
+</dd>
+<dt class="hdlist1">
-y <command_set_identifier>
</dt>
<dt class="hdlist1">
@@ -910,8 +923,8 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di <dd>
<p>
Target block size the new namespace should be formatted as. Potential FLBAS
- values will be values will be scanned and the lowest numbered will be
- selected for the create-ns operation. Conflicts with --flbas argument.
+ values will be values will be scanned and the lowest numbered will be
+ selected for the create-ns operation. Conflicts with --flbas argument.
</p>
</dd>
<dt class="hdlist1">
@@ -967,7 +980,7 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di </p>
</dd>
<dt class="hdlist1">
--o <ror>
+-O <ror>
</dt>
<dt class="hdlist1">
--ror=<ror>
@@ -1002,6 +1015,29 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di with each Placement Handle.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -1033,7 +1069,7 @@ Create a namespace: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-create-ns.txt b/Documentation/nvme-create-ns.txt index 5d1355d..740d05b 100644 --- a/Documentation/nvme-create-ns.txt +++ b/Documentation/nvme-create-ns.txt @@ -15,6 +15,7 @@ SYNOPSIS [--nmic=<nmic> | -m <nmic>] [--anagrp-id=<anagrpid> | -a <anagrpid>] [--nvmset-id=<nvmsetid> | -i <nvmsetid>] + [--endg-id=<endgid> | -e <endgid>] [--csi=<command_set_identifier> | -y <command_set_identifier>] [--lbstm=<lbstm> | -l <lbstm>] [--nphndls=<nphndls> | -n <nphndls>] @@ -24,9 +25,10 @@ SYNOPSIS [--ncap-si=<ncap-si> | -C <ncap-si>] [--azr | -z] [--rar=<rar> | -r <rar>] - [--ror=<ror> | -o <ror>] + [--ror=<ror> | -O <ror>] [--rnumzrwa=<rnumzrwa> | -u <rnumzrwa>] [--phndls=<placement-handle-list,> | -p <placement-handle-list,>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -69,6 +71,10 @@ OPTIONS --nvmset-id=<nvmsetid>:: This field specifies the identifier of the NVM Set. +-e <endgid>:: +--endg-id=<endgid>:: + This field specifies the identifier of the endurance group. + -y <command_set_identifier>:: --csi=<command_set_identifier>:: This field specifies the identifier of command set. @@ -87,8 +93,8 @@ OPTIONS -b:: --block-size:: Target block size the new namespace should be formatted as. Potential FLBAS - values will be values will be scanned and the lowest numbered will be - selected for the create-ns operation. Conflicts with --flbas argument. + values will be values will be scanned and the lowest numbered will be + selected for the create-ns operation. Conflicts with --flbas argument. -S:: --nsze-si:: @@ -114,7 +120,7 @@ OPTIONS Requested Active Resources. This field specifies the number of active resources to be allocated to the created namespace. --o <ror>:: +-O <ror>:: --ror=<ror>:: Requested Open Resources. This field specifies the number of open resources to be allocated to the created namespace. @@ -129,6 +135,15 @@ OPTIONS The comma separated list of Reclaim Unit Handle Identifier to be associated with each Placement Handle. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Create a namespace: diff --git a/Documentation/nvme-delete-ns.1 b/Documentation/nvme-delete-ns.1 index d50ed5d..c9d8a0f 100644 --- a/Documentation/nvme-delete-ns.1 +++ b/Documentation/nvme-delete-ns.1 @@ -2,12 +2,12 @@ .\" Title: nvme-id-ns .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ID\-NS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ID\-NS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,6 +33,7 @@ nvme-delete-ns \- Send NVMe Namespace Management delete namespace command, retur .sp .nf \fInvme delete\-ns\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -45,6 +46,20 @@ The <device> parameter is mandatory and may be either the NVMe character device .RS 4 The namespace identifier to delete\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet\&. diff --git a/Documentation/nvme-delete-ns.html b/Documentation/nvme-delete-ns.html index 7004e10..057d0bf 100644 --- a/Documentation/nvme-delete-ns.html +++ b/Documentation/nvme-delete-ns.html @@ -749,7 +749,8 @@ nvme-id-ns(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme delete-ns</em> <device> [--namespace-id=<nsid> | -n <nsid>]</pre>
+<pre class="content"><em>nvme delete-ns</em> <device> [--namespace-id=<nsid> | -n <nsid>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -779,6 +780,29 @@ The <code>'--namespace-id'</code> option is mandatory.</p></div> The namespace identifier to delete.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -799,7 +823,7 @@ The <code>'--namespace-id'</code> option is mandatory.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-delete-ns.txt b/Documentation/nvme-delete-ns.txt index 62301b4..1b306b2 100644 --- a/Documentation/nvme-delete-ns.txt +++ b/Documentation/nvme-delete-ns.txt @@ -9,6 +9,7 @@ SYNOPSIS -------- [verse] 'nvme delete-ns' <device> [--namespace-id=<nsid> | -n <nsid>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -25,6 +26,15 @@ OPTIONS --namespace-id=<nsid>:: The namespace identifier to delete. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet. diff --git a/Documentation/nvme-dera-stat.1 b/Documentation/nvme-dera-stat.1 index 8a206ed..02c6e73 100644 --- a/Documentation/nvme-dera-stat.1 +++ b/Documentation/nvme-dera-stat.1 @@ -2,12 +2,12 @@ .\" Title: nvme-dera-stat .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-DERA\-STAT" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-DERA\-STAT" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-dera-stat.html b/Documentation/nvme-dera-stat.html index 41946f7..13b9f84 100644 --- a/Documentation/nvme-dera-stat.html +++ b/Documentation/nvme-dera-stat.html @@ -797,7 +797,7 @@ Print the Dera Device status and Additional SMART log page in a human readable f <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-dera-stat.txt b/Documentation/nvme-dera-stat.txt index 512e584..f3a87ae 100644 --- a/Documentation/nvme-dera-stat.txt +++ b/Documentation/nvme-dera-stat.txt @@ -24,7 +24,6 @@ OPTIONS ------- none - EXAMPLES -------- * Print the Dera Device status and Additional SMART log page in a human readable format: diff --git a/Documentation/nvme-detach-ns.1 b/Documentation/nvme-detach-ns.1 index 824166b..70d895d 100644 --- a/Documentation/nvme-detach-ns.1 +++ b/Documentation/nvme-detach-ns.1 @@ -2,12 +2,12 @@ .\" Title: nvme-detach-ns .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-DETACH\-NS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-DETACH\-NS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,6 +34,7 @@ nvme-detach-ns \- Send NVMe detach namespace, return result\&. .nf \fInvme detach\-ns\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] [\-\-controllers=<ctrl\-list,> | \-c <ctrl\-list,> + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -45,10 +46,24 @@ For the NVMe device given, sends the nvme namespace detach command for the provi The namespace identifier to detach\&. .RE .PP -\-c <ctrl\-list,>, \-controllers=<ctrl\-list,> +\-c <ctrl\-list,>, \-\-controllers=<ctrl\-list,> .RS 4 The comma separated list of controller identifiers to detach the namespace from\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet\&. diff --git a/Documentation/nvme-detach-ns.html b/Documentation/nvme-detach-ns.html index 2e8bcc1..469f5ed 100644 --- a/Documentation/nvme-detach-ns.html +++ b/Documentation/nvme-detach-ns.html @@ -750,7 +750,8 @@ nvme-detach-ns(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme detach-ns</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--controllers=<ctrl-list,> | -c <ctrl-list,></pre>
+ [--controllers=<ctrl-list,> | -c <ctrl-list,>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -782,7 +783,7 @@ controller identifiers.</p></div> -c <ctrl-list,>
</dt>
<dt class="hdlist1">
--controllers=<ctrl-list,>
+--controllers=<ctrl-list,>
</dt>
<dd>
<p>
@@ -790,6 +791,29 @@ controller identifiers.</p></div> the namespace from.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -810,7 +834,7 @@ controller identifiers.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-detach-ns.txt b/Documentation/nvme-detach-ns.txt index ed23c15..842889c 100644 --- a/Documentation/nvme-detach-ns.txt +++ b/Documentation/nvme-detach-ns.txt @@ -10,6 +10,7 @@ SYNOPSIS [verse] 'nvme detach-ns' <device> [--namespace-id=<nsid> | -n <nsid>] [--controllers=<ctrl-list,> | -c <ctrl-list,> + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -24,10 +25,19 @@ OPTIONS The namespace identifier to detach. -c <ctrl-list,>:: --controllers=<ctrl-list,>:: +--controllers=<ctrl-list,>:: The comma separated list of controller identifiers to detach the namespace from. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet. diff --git a/Documentation/nvme-device-self-test.1 b/Documentation/nvme-device-self-test.1 index 393bd02..f37be3f 100644 --- a/Documentation/nvme-device-self-test.1 +++ b/Documentation/nvme-device-self-test.1 @@ -2,12 +2,12 @@ .\" Title: nvme-device-self-test .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-DEVICE\-SELF\-" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-DEVICE\-SELF\-" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,7 +33,8 @@ nvme-device-self-test \- Perform the necessary tests to observe the performance .sp .nf \fInvme device\-self\-test\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] - [\-\-self\-test\-code=<NUM> | \-s <NUM>] [\-\-wait | \-w] + [\-\-self\-test\-code=<NUM> | \-s <NUM>] [\-\-wait | \-w] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -58,6 +59,20 @@ This field specifies the action taken by the device self\-test command : 0h: Sho .RS 4 Wait for the device self test to complete before exiting The device self\-test is aborted by SIGINT signal interrupt for the wait The option is ignored if the abort self\-test code option specified\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-device-self-test.html b/Documentation/nvme-device-self-test.html index e5dfb38..ce0251e 100644 --- a/Documentation/nvme-device-self-test.html +++ b/Documentation/nvme-device-self-test.html @@ -750,7 +750,8 @@ nvme-device-self-test(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme device-self-test</em> <device> [--namespace-id=<NUM> | -n <NUM>]
- [--self-test-code=<NUM> | -s <NUM>] [--wait | -w]</pre>
+ [--self-test-code=<NUM> | -s <NUM>] [--wait | -w]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -809,6 +810,29 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di The option is ignored if the abort self-test code option specified.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -848,7 +872,7 @@ Abort the device self-test operation in the namespace-id 1: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-device-self-test.txt b/Documentation/nvme-device-self-test.txt index d098277..17fe875 100644 --- a/Documentation/nvme-device-self-test.txt +++ b/Documentation/nvme-device-self-test.txt @@ -9,7 +9,8 @@ SYNOPSIS -------- [verse] 'nvme device-self-test' <device> [--namespace-id=<NUM> | -n <NUM>] - [--self-test-code=<NUM> | -s <NUM>] [--wait | -w] + [--self-test-code=<NUM> | -s <NUM>] [--wait | -w] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -28,12 +29,12 @@ OPTIONS -s <NUM>:: --self-test-code=<NUM>:: - This field specifies the action taken by the device self-test command : - 0h: Show current state of device self-test operation - 1h: Start a short device self-test operation - 2h: Start a extended device self-test operation - eh: Start a vendor specific device self-test operation - fh: Abort the device self-test operation + This field specifies the action taken by the device self-test command : + 0h: Show current state of device self-test operation + 1h: Start a short device self-test operation + 2h: Start a extended device self-test operation + eh: Start a vendor specific device self-test operation + fh: Abort the device self-test operation Default is 0h. -w:: @@ -42,6 +43,15 @@ OPTIONS The device self-test is aborted by SIGINT signal interrupt for the wait The option is ignored if the abort self-test code option specified. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Start a short device self-test in the namespace-id 1: diff --git a/Documentation/nvme-dim.1 b/Documentation/nvme-dim.1 index c417d2e..c944163 100644 --- a/Documentation/nvme-dim.1 +++ b/Documentation/nvme-dim.1 @@ -2,12 +2,12 @@ .\" Title: nvme-dim .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-DIM" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-DIM" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,10 +32,9 @@ nvme-dim \- Send Discovery Information Management command to one or more Discove .SH "SYNOPSIS" .sp .nf -\fInvme dim\fR - [\-\-task=<task> | \-t <task>] - [\-\-nqn=<nqn> | \-n <nqn>] - [\-\-device=<device> | \-d <device>] +\fInvme dim\fR [\-\-task=<task> | \-t <task>] [\-\-nqn=<nqn> | \-n <nqn>] + [\-\-device=<device> | \-d <device>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -62,6 +61,20 @@ The DIM command will be sent to the Discovery Controller (DC) matching this NQN\ .RS 4 The DIM command will be sent to the Discovery Controllers (DC) associated with this NVMe device handle\&. A list of comma\-separated device handles can be supplied to apply the command to more than one DC\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-dim.html b/Documentation/nvme-dim.html index f5eb82c..d88df34 100644 --- a/Documentation/nvme-dim.html +++ b/Documentation/nvme-dim.html @@ -749,10 +749,9 @@ nvme-dim(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme dim</em>
- [--task=<task> | -t <task>]
- [--nqn=<nqn> | -n <nqn>]
- [--device=<device> | -d <device>]</pre>
+<pre class="content"><em>nvme dim</em> [--task=<task> | -t <task>] [--nqn=<nqn> | -n <nqn>]
+ [--device=<device> | -d <device>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -817,6 +816,29 @@ with the nvme-discover(1) command using the --persistent option.</p></div> be supplied to apply the command to more than one DC.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -863,7 +885,7 @@ Deregister from Central Discovery Controller (CDC) associated with nvme4 <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-dim.txt b/Documentation/nvme-dim.txt index 52df256..fcfc9b8 100644 --- a/Documentation/nvme-dim.txt +++ b/Documentation/nvme-dim.txt @@ -3,15 +3,15 @@ nvme-dim(1) NAME ---- -nvme-dim - Send Discovery Information Management command to one or more Discovery Controllers. +nvme-dim - Send Discovery Information Management command to one or more +Discovery Controllers. SYNOPSIS -------- [verse] -'nvme dim' - [--task=<task> | -t <task>] - [--nqn=<nqn> | -n <nqn>] - [--device=<device> | -d <device>] +'nvme dim' [--task=<task> | -t <task>] [--nqn=<nqn> | -n <nqn>] + [--device=<device> | -d <device>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -51,6 +51,15 @@ OPTIONS with this NVMe device handle. A list of comma-separated device handles can be supplied to apply the command to more than one DC. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Register with the Central Discovery Controller (CDC) named diff --git a/Documentation/nvme-dir-receive.1 b/Documentation/nvme-dir-receive.1 index f34b23e..fce97d6 100644 --- a/Documentation/nvme-dir-receive.1 +++ b/Documentation/nvme-dir-receive.1 @@ -2,12 +2,12 @@ .\" Title: nvme-dir-receive .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-DIR\-RECEIVE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-DIR\-RECEIVE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,13 +33,13 @@ nvme-dir-receive \- Send a directive receive command, returns applicable results .sp .nf \fInvme dir\-receive\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-data\-len=<data\-len> | \-l <data\-len>] - [\-\-dir\-type=<dtype> | \-D <dtype>] - [\-\-dir\-spec=<dspec> | \-S <dspec>] - [\-\-dir\-oper=<doper> | \-O <doper>] - [\-\-req\-resource=<nsr> | \-r <nsr>] - [\-\-human\-readable | \-H] - [\-\-raw\-binary | \-b] + [\-\-data\-len=<data\-len> | \-l <data\-len>] + [\-\-dir\-type=<dtype> | \-D <dtype>] + [\-\-dir\-spec=<dspec> | \-S <dspec>] + [\-\-dir\-oper=<doper> | \-O <doper>] + [\-\-req\-resource=<nsr> | \-r <nsr>] + [\-\-human\-readable | \-H] [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -73,9 +73,6 @@ Directive operation \-r <nsr>, \-\-req\-resource=<nsr> .RS 4 Directive requested resource count -.RE -.sp -+ .TS allbox tab(:); lt lt @@ -85,49 +82,38 @@ lt lt lt lt lt lt. T{ -.sp Select T}:T{ -.sp Description T} T{ -.sp 0 T}:T{ -.sp Current T} T{ -.sp 1 T}:T{ -.sp Default T} T{ -.sp 2 T}:T{ -.sp Saved T} T{ -.sp 3 T}:T{ -.sp Supported capabilities T} T{ -.sp 4\(en7 T}:T{ -.sp Reserved T} .TE .sp 1 +.RE .PP \-l <data\-len>, \-\-data\-len=<data\-len> .RS 4 @@ -143,6 +129,20 @@ Print the raw receive buffer to stdout if the command returns a structure\&. .RS 4 Print the decoded receive buffer to stdout if the command returns a structure\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-dir-receive.html b/Documentation/nvme-dir-receive.html index e73882f..112a3f4 100644 --- a/Documentation/nvme-dir-receive.html +++ b/Documentation/nvme-dir-receive.html @@ -750,13 +750,13 @@ nvme-dir-receive(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme dir-receive</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--data-len=<data-len> | -l <data-len>]
- [--dir-type=<dtype> | -D <dtype>]
- [--dir-spec=<dspec> | -S <dspec>]
- [--dir-oper=<doper> | -O <doper>]
- [--req-resource=<nsr> | -r <nsr>]
- [--human-readable | -H]
- [--raw-binary | -b]</pre>
+ [--data-len=<data-len> | -l <data-len>]
+ [--dir-type=<dtype> | -D <dtype>]
+ [--dir-spec=<dspec> | -S <dspec>]
+ [--dir-oper=<doper> | -O <doper>]
+ [--req-resource=<nsr> | -r <nsr>]
+ [--human-readable | -H] [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -835,9 +835,6 @@ printed to stdout for another program to parse.</p></div> <p>
Directive requested resource count
</p>
-</dd>
-</dl></div>
-<div class="paragraph"><p>+</p></div>
<div class="tableblock">
<table rules="all"
width="100%"
@@ -873,7 +870,7 @@ cellspacing="0" cellpadding="4"> </tbody>
</table>
</div>
-<div class="dlist"><dl>
+</dd>
<dt class="hdlist1">
-l <data-len>
</dt>
@@ -911,6 +908,29 @@ cellspacing="0" cellpadding="4"> a structure.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -969,7 +989,7 @@ Get streams directive status : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-dir-receive.txt b/Documentation/nvme-dir-receive.txt index b412c0b..f3f31ba 100644 --- a/Documentation/nvme-dir-receive.txt +++ b/Documentation/nvme-dir-receive.txt @@ -9,13 +9,13 @@ SYNOPSIS -------- [verse] 'nvme dir-receive' <device> [--namespace-id=<nsid> | -n <nsid>] - [--data-len=<data-len> | -l <data-len>] - [--dir-type=<dtype> | -D <dtype>] - [--dir-spec=<dspec> | -S <dspec>] - [--dir-oper=<doper> | -O <doper>] - [--req-resource=<nsr> | -r <nsr>] - [--human-readable | -H] - [--raw-binary | -b] + [--data-len=<data-len> | -l <data-len>] + [--dir-type=<dtype> | -D <dtype>] + [--dir-spec=<dspec> | -S <dspec>] + [--dir-oper=<doper> | -O <doper>] + [--req-resource=<nsr> | -r <nsr>] + [--human-readable | -H] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -41,20 +41,19 @@ OPTIONS -D <dtype>:: --dir-type=<dtype>:: - Directive type + Directive type -S <dspec>:: --dir-spec=<dspec>:: - Directive specific + Directive specific -O <doper>:: --dir-oper=<doper>:: - Directive operation + Directive operation -r <nsr>:: --req-resource=<nsr>:: Directive requested resource count - + [] |================== @@ -82,6 +81,15 @@ OPTIONS Print the decoded receive buffer to stdout if the command returns a structure. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Identify directive type supported : diff --git a/Documentation/nvme-dir-send.1 b/Documentation/nvme-dir-send.1 index 7476e8b..cfb2087 100644 --- a/Documentation/nvme-dir-send.1 +++ b/Documentation/nvme-dir-send.1 @@ -2,12 +2,12 @@ .\" Title: nvme-dir-send .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-DIR\-SEND" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-DIR\-SEND" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,14 +33,14 @@ nvme-dir-send \- Issue a directive send command, returns applicable results .sp .nf \fInvme dir\-send\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-data\-len=<data\-len> | \-l <data\-len>] - [\-\-dir\-type=<dtype> | \-D <dtype>] - [\-\-dir\-spec=<dspec> | \-S <dspec>] - [\-\-dir\-oper=<doper> | \-O <doper>] - [\-\-endir=<endir> | \-e <endir>] - [\-\-target\-dir=<tdir> | \-T <tdir>] - [\-\-human\-readable | \-H] - [\-\-raw\-binary | \-b] + [\-\-data\-len=<data\-len> | \-l <data\-len>] + [\-\-dir\-type=<dtype> | \-D <dtype>] + [\-\-dir\-spec=<dspec> | \-S <dspec>] + [\-\-dir\-oper=<doper> | \-O <doper>] + [\-\-endir=<endir> | \-e <endir>] + [\-\-target\-dir=<tdir> | \-T <tdir>] + [\-\-human\-readable | \-H] [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -79,9 +79,6 @@ Target directive of the operation \-e <endir>, \-\-endir=<endir> .RS 4 Target directive enable(1) or disable (0) operation -.RE -.sp -+ .TS allbox tab(:); lt lt @@ -91,49 +88,38 @@ lt lt lt lt lt lt. T{ -.sp Select T}:T{ -.sp Description T} T{ -.sp 0 T}:T{ -.sp Current T} T{ -.sp 1 T}:T{ -.sp Default T} T{ -.sp 2 T}:T{ -.sp Saved T} T{ -.sp 3 T}:T{ -.sp Supported capabilities T} T{ -.sp 4\(en7 T}:T{ -.sp Reserved T} .TE .sp 1 +.RE .PP \-l <data\-len>, \-\-data\-len=<data\-len> .RS 4 @@ -149,6 +135,20 @@ Print the raw receive buffer to stdout if the command returns a structure\&. .RS 4 Print the decoded receive buffer to stdout if the command returns a structure\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-dir-send.html b/Documentation/nvme-dir-send.html index c2acdb3..8ffbf30 100644 --- a/Documentation/nvme-dir-send.html +++ b/Documentation/nvme-dir-send.html @@ -750,14 +750,14 @@ nvme-dir-send(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme dir-send</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--data-len=<data-len> | -l <data-len>]
- [--dir-type=<dtype> | -D <dtype>]
- [--dir-spec=<dspec> | -S <dspec>]
- [--dir-oper=<doper> | -O <doper>]
- [--endir=<endir> | -e <endir>]
- [--target-dir=<tdir> | -T <tdir>]
- [--human-readable | -H]
- [--raw-binary | -b]</pre>
+ [--data-len=<data-len> | -l <data-len>]
+ [--dir-type=<dtype> | -D <dtype>]
+ [--dir-spec=<dspec> | -S <dspec>]
+ [--dir-oper=<doper> | -O <doper>]
+ [--endir=<endir> | -e <endir>]
+ [--target-dir=<tdir> | -T <tdir>]
+ [--human-readable | -H] [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -848,9 +848,6 @@ printed to stdout for another program to parse.</p></div> <p>
Target directive enable(1) or disable (0) operation
</p>
-</dd>
-</dl></div>
-<div class="paragraph"><p>+</p></div>
<div class="tableblock">
<table rules="all"
width="100%"
@@ -886,7 +883,7 @@ cellspacing="0" cellpadding="4"> </tbody>
</table>
</div>
-<div class="dlist"><dl>
+</dd>
<dt class="hdlist1">
-l <data-len>
</dt>
@@ -924,6 +921,29 @@ cellspacing="0" cellpadding="4"> a structure.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -982,7 +1002,7 @@ Release stream ID 3 : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-dir-send.txt b/Documentation/nvme-dir-send.txt index eb5dad0..1e3743d 100644 --- a/Documentation/nvme-dir-send.txt +++ b/Documentation/nvme-dir-send.txt @@ -9,14 +9,14 @@ SYNOPSIS -------- [verse] 'nvme dir-send' <device> [--namespace-id=<nsid> | -n <nsid>] - [--data-len=<data-len> | -l <data-len>] - [--dir-type=<dtype> | -D <dtype>] - [--dir-spec=<dspec> | -S <dspec>] - [--dir-oper=<doper> | -O <doper>] - [--endir=<endir> | -e <endir>] - [--target-dir=<tdir> | -T <tdir>] - [--human-readable | -H] - [--raw-binary | -b] + [--data-len=<data-len> | -l <data-len>] + [--dir-type=<dtype> | -D <dtype>] + [--dir-spec=<dspec> | -S <dspec>] + [--dir-oper=<doper> | -O <doper>] + [--endir=<endir> | -e <endir>] + [--target-dir=<tdir> | -T <tdir>] + [--human-readable | -H] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -43,15 +43,15 @@ OPTIONS -D <dtype>:: --dir-type=<dtype>:: - Directive type + Directive type -S <dspec>:: --dir-spec=<dspec>:: - Directive specific + Directive specific -O <doper>:: --dir-oper=<doper>:: - Directive operation + Directive operation -T <tdir>:: --target-dir=<nsr>:: @@ -60,7 +60,6 @@ OPTIONS -e <endir>:: --endir=<endir>:: Target directive enable(1) or disable (0) operation - + [] |================== @@ -88,6 +87,15 @@ OPTIONS Print the decoded receive buffer to stdout if the command returns a structure. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Enable streams directive : diff --git a/Documentation/nvme-disconnect-all.1 b/Documentation/nvme-disconnect-all.1 index bee5db7..a2cde6a 100644 --- a/Documentation/nvme-disconnect-all.1 +++ b/Documentation/nvme-disconnect-all.1 @@ -2,12 +2,12 @@ .\" Title: nvme-disconnect-all .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-DISCONNECT\-AL" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-DISCONNECT\-AL" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,13 +32,28 @@ nvme-disconnect-all \- Disconnect from all connected Fabrics controllers\&. .SH "SYNOPSIS" .sp .nf -\fInvme disconnect\-all\fR +\fInvme disconnect\-all\fR [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp Disconnects and removes all existing NVMe over Fabrics controllers\&. .sp See the documentation for the nvme\-disconnect(1) command for further background\&. +.SH "OPTIONS" +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-disconnect-all.html b/Documentation/nvme-disconnect-all.html index afc08e0..6bd3efc 100644 --- a/Documentation/nvme-disconnect-all.html +++ b/Documentation/nvme-disconnect-all.html @@ -749,7 +749,7 @@ nvme-disconnect-all(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme disconnect-all</em></pre>
+<pre class="content"><em>nvme disconnect-all</em> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -763,6 +763,36 @@ background.</p></div> </div>
</div>
<div class="sect1">
+<h2 id="_options">OPTIONS</h2>
+<div class="sectionbody">
+<div class="dlist"><dl>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
+</dl></div>
+</div>
+</div>
+<div class="sect1">
<h2 id="_examples">EXAMPLES</h2>
<div class="sectionbody">
<div class="ulist"><ul>
@@ -795,7 +825,7 @@ Disconnect all existing nvme controllers: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-disconnect-all.txt b/Documentation/nvme-disconnect-all.txt index 6be7e41..9f023ea 100644 --- a/Documentation/nvme-disconnect-all.txt +++ b/Documentation/nvme-disconnect-all.txt @@ -8,7 +8,7 @@ nvme-disconnect-all - Disconnect from all connected Fabrics controllers. SYNOPSIS -------- [verse] -'nvme disconnect-all' +'nvme disconnect-all' [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -17,6 +17,17 @@ Disconnects and removes all existing NVMe over Fabrics controllers. See the documentation for the nvme-disconnect(1) command for further background. +OPTIONS +------- +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Disconnect all existing nvme controllers: diff --git a/Documentation/nvme-disconnect.1 b/Documentation/nvme-disconnect.1 index 58120ba..18ae643 100644 --- a/Documentation/nvme-disconnect.1 +++ b/Documentation/nvme-disconnect.1 @@ -2,12 +2,12 @@ .\" Title: nvme-disconnect .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-DISCONNECT" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-DISCONNECT" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,9 @@ nvme-disconnect \- Disconnect one or more Fabrics controller(s)\&. .SH "SYNOPSIS" .sp .nf -\fInvme disconnect\fR - [\-\-nqn=<subnqn> | \-n <subnqn>] - [\-\-device=<device> | \-d <device>] +\fInvme disconnect\fR [\-\-nqn=<subnqn> | \-n <subnqn>] + [\-\-device=<device> | \-d <device>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -50,6 +50,20 @@ Indicates that all controllers for the NVMe subsystems specified should be remov .RS 4 Indicates that the controller with the specified name should be removed\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-disconnect.html b/Documentation/nvme-disconnect.html index 87df800..5ffdd76 100644 --- a/Documentation/nvme-disconnect.html +++ b/Documentation/nvme-disconnect.html @@ -749,9 +749,9 @@ nvme-disconnect(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme disconnect</em>
- [--nqn=<subnqn> | -n <subnqn>]
- [--device=<device> | -d <device>]</pre>
+<pre class="content"><em>nvme disconnect</em> [--nqn=<subnqn> | -n <subnqn>]
+ [--device=<device> | -d <device>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -761,7 +761,7 @@ nvme-disconnect(1) Manual Page <div class="sectionbody">
<div class="paragraph"><p>Disconnects and removes one or more existing NVMe over Fabrics controllers.
If the --nqn option is specified all controllers connecting to the Subsystem
-identified by subnqn will be removed. If the --device option is specified
+identified by subnqn will be removed. If the --device option is specified
the controller specified by the --device option will be removed.</p></div>
</div>
</div>
@@ -793,6 +793,29 @@ the controller specified by the --device option will be removed.</p></div> removed.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -839,7 +862,7 @@ Disconnect the controller nvme4 <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-disconnect.txt b/Documentation/nvme-disconnect.txt index badb86f..d3b8c52 100644 --- a/Documentation/nvme-disconnect.txt +++ b/Documentation/nvme-disconnect.txt @@ -8,15 +8,15 @@ nvme-disconnect - Disconnect one or more Fabrics controller(s). SYNOPSIS -------- [verse] -'nvme disconnect' - [--nqn=<subnqn> | -n <subnqn>] - [--device=<device> | -d <device>] +'nvme disconnect' [--nqn=<subnqn> | -n <subnqn>] + [--device=<device> | -d <device>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- Disconnects and removes one or more existing NVMe over Fabrics controllers. If the --nqn option is specified all controllers connecting to the Subsystem -identified by subnqn will be removed. If the --device option is specified +identified by subnqn will be removed. If the --device option is specified the controller specified by the --device option will be removed. OPTIONS @@ -31,6 +31,15 @@ OPTIONS Indicates that the controller with the specified name should be removed. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Disconnect all controllers for a subsystem named @@ -50,7 +59,6 @@ SEE ALSO -------- nvme-connect(1) - NVME ---- Part of the nvme-user suite diff --git a/Documentation/nvme-discover.1 b/Documentation/nvme-discover.1 index fb940a5..0a5f2bf 100644 --- a/Documentation/nvme-discover.1 +++ b/Documentation/nvme-discover.1 @@ -2,12 +2,12 @@ .\" Title: nvme-discover .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-DISCOVER" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-DISCOVER" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,39 +32,30 @@ nvme-discover \- Send Get Log Page request to Discovery Controller\&. .SH "SYNOPSIS" .sp .nf -\fInvme discover\fR - [\-\-transport=<trtype> | \-t <trtype>] - [\-\-nqn=<subnqn> | \-n <subnqn>] - [\-\-traddr=<traddr> | \-a <traddr>] - [\-\-trsvcid=<trsvcid> | \-s <trsvcid>] - [\-\-host\-traddr=<traddr> | \-w <traddr>] - [\-\-host\-iface=<iface> | \-f <iface>] - [\-\-hostnqn=<hostnqn> | \-q <hostnqn>] - [\-\-hostid=<hostid> | \-I <hostid>] - [\-\-raw=<filename> | \-r <filename>] - [\-\-device=<device> | \-d <device>] - [\-\-cfg\-file=<cfg> | \-C <cfg> ] - [\-\-keep\-alive\-tmo=<sec> | \-k <sec>] - [\-\-reconnect\-delay=<#> | \-c <#>] - [\-\-ctrl\-loss\-tmo=<#> | \-l <#>] - [\-\-nr\-io\-queues=<#> | \-i <#>] - [\-\-nr\-write\-queues=<#> | \-W <#>] - [\-\-nr\-poll\-queues=<#> | \-P <#>] - [\-\-queue\-size=<#> | \-Q <#>] - [\-\-keyring=<#> ] - [\-\-tls_key=<#> ] - [\-\-hdr\-digest | \-g] - [\-\-data\-digest | \-G] - [\-\-persistent | \-p] - [\-\-quiet | \-S] - [\-\-tls ] - [\-\-dump\-config | \-O] - [\-\-output\-format=<fmt> | \-o <fmt>] - [\-\-force] - [\-\-nbft] - [\-\-no\-nbft] - [\-\-nbft\-path=<STR>] - [\-\-context=<STR>] +\fInvme discover\fR [\-\-transport=<trtype> | \-t <trtype>] + [\-\-nqn=<subnqn> | \-n <subnqn>] + [\-\-traddr=<traddr> | \-a <traddr>] + [\-\-trsvcid=<trsvcid> | \-s <trsvcid>] + [\-\-host\-traddr=<traddr> | \-w <traddr>] + [\-\-host\-iface=<iface> | \-f <iface>] + [\-\-hostnqn=<hostnqn> | \-q <hostnqn>] + [\-\-hostid=<hostid> | \-I <hostid>] + [\-\-raw=<filename> | \-r <filename>] + [\-\-device=<device> | \-d <device>] + [\-\-cfg\-file=<cfg> | \-C <cfg>] + [\-\-keep\-alive\-tmo=<sec> | \-k <sec>] + [\-\-reconnect\-delay=<#> | \-c <#>] + [\-\-ctrl\-loss\-tmo=<#> | \-l <#>] + [\-\-nr\-io\-queues=<#> | \-i <#>] + [\-\-nr\-write\-queues=<#> | \-W <#>] + [\-\-nr\-poll\-queues=<#> | \-P <#>] + [\-\-queue\-size=<#> | \-Q <#>] [\-\-keyring=<#>] + [\-\-tls_key=<#>] [\-\-hdr\-digest | \-g] [\-\-data\-digest | \-G] + [\-\-persistent | \-p] [\-\-quiet | \-S] [\-\-tls] + [\-\-dump\-config | \-O] [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-force] [\-\-nbft] [\-\-no\-nbft] [\-\-nbft\-path=<STR>] + [\-\-context=<STR>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -254,11 +245,12 @@ Suppress already connected errors\&. Print out resulting JSON configuration file to stdout\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE .PP @@ -286,6 +278,20 @@ Use a user\-defined path to the NBFT tables .RS 4 Set the execution context to <STR>\&. This allows to coordinate the management of the global resources\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 @@ -372,9 +378,9 @@ command using a /usr/local/etc/nvme/discovery\&.conf file: .RS 4 .\} .nf -# Machine default \*(Aqnvme discover\*(Aq commands\&. Query the +# Machine default \*(Aqnvme discover\*(Aq commands\&. Query the # Discovery Controller\*(Aqs two ports (some resources may only -# be accessible on a single port)\&. Note an official +# be accessible on a single port)\&. Note an official # nqn (Host) name defined in the NVMe specification is being used # in this example\&. \-t rdma \-a 192\&.168\&.69\&.33 \-s 4420 \-q nqn\&.2014\-08\&.com\&.example:nvme:nvm\-subsystem\-sn\-d78432 diff --git a/Documentation/nvme-discover.html b/Documentation/nvme-discover.html index bce1ae8..dc56c6b 100644 --- a/Documentation/nvme-discover.html +++ b/Documentation/nvme-discover.html @@ -749,39 +749,30 @@ nvme-discover(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme discover</em>
- [--transport=<trtype> | -t <trtype>]
- [--nqn=<subnqn> | -n <subnqn>]
- [--traddr=<traddr> | -a <traddr>]
- [--trsvcid=<trsvcid> | -s <trsvcid>]
- [--host-traddr=<traddr> | -w <traddr>]
- [--host-iface=<iface> | -f <iface>]
- [--hostnqn=<hostnqn> | -q <hostnqn>]
- [--hostid=<hostid> | -I <hostid>]
- [--raw=<filename> | -r <filename>]
- [--device=<device> | -d <device>]
- [--cfg-file=<cfg> | -C <cfg> ]
- [--keep-alive-tmo=<sec> | -k <sec>]
- [--reconnect-delay=<#> | -c <#>]
- [--ctrl-loss-tmo=<#> | -l <#>]
- [--nr-io-queues=<#> | -i <#>]
- [--nr-write-queues=<#> | -W <#>]
- [--nr-poll-queues=<#> | -P <#>]
- [--queue-size=<#> | -Q <#>]
- [--keyring=<#> ]
- [--tls_key=<#> ]
- [--hdr-digest | -g]
- [--data-digest | -G]
- [--persistent | -p]
- [--quiet | -S]
- [--tls ]
- [--dump-config | -O]
- [--output-format=<fmt> | -o <fmt>]
- [--force]
- [--nbft]
- [--no-nbft]
- [--nbft-path=<STR>]
- [--context=<STR>]</pre>
+<pre class="content"><em>nvme discover</em> [--transport=<trtype> | -t <trtype>]
+ [--nqn=<subnqn> | -n <subnqn>]
+ [--traddr=<traddr> | -a <traddr>]
+ [--trsvcid=<trsvcid> | -s <trsvcid>]
+ [--host-traddr=<traddr> | -w <traddr>]
+ [--host-iface=<iface> | -f <iface>]
+ [--hostnqn=<hostnqn> | -q <hostnqn>]
+ [--hostid=<hostid> | -I <hostid>]
+ [--raw=<filename> | -r <filename>]
+ [--device=<device> | -d <device>]
+ [--cfg-file=<cfg> | -C <cfg>]
+ [--keep-alive-tmo=<sec> | -k <sec>]
+ [--reconnect-delay=<#> | -c <#>]
+ [--ctrl-loss-tmo=<#> | -l <#>]
+ [--nr-io-queues=<#> | -i <#>]
+ [--nr-write-queues=<#> | -W <#>]
+ [--nr-poll-queues=<#> | -P <#>]
+ [--queue-size=<#> | -Q <#>] [--keyring=<#>]
+ [--tls_key=<#>] [--hdr-digest | -g] [--data-digest | -G]
+ [--persistent | -p] [--quiet | -S] [--tls]
+ [--dump-config | -O] [--output-format=<fmt> | -o <fmt>]
+ [--force] [--nbft] [--no-nbft] [--nbft-path=<STR>]
+ [--context=<STR>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -793,7 +784,7 @@ nvme-discover(1) Manual Page Controller.</p></div>
<div class="paragraph"><p>If no parameters are given, then <em>nvme discover</em> will attempt to
find a /usr/local/etc/nvme/discovery.conf file to use to supply a list of
-Discovery commands to run. If no /usr/local/etc/nvme/discovery.conf file
+Discovery commands to run. If no /usr/local/etc/nvme/discovery.conf file
exists, the command will quit with an error.</p></div>
<div class="paragraph"><p>Otherwise, a specific Discovery Controller should be specified using the
--transport, --traddr, and if necessary the --trsvcid flags. A Discovery
@@ -806,7 +797,7 @@ request will then be sent to the specified Discovery Controller.</p></div> <div class="paragraph"><p>The NVMe-over-Fabrics specification defines the concept of a
Discovery Controller that an NVMe Host can query on a fabric
network to discover NVMe subsystems contained in NVMe Targets
-which it can connect to on the network. The Discovery Controller
+which it can connect to on the network. The Discovery Controller
will return Discovery Log Pages that provide the NVMe Host
with specific information (such as network address and unique
subsystem NQN) the NVMe Host can use to issue an
@@ -819,7 +810,7 @@ In particular, the Host NQN uniquely identifies the NVMe Host, and may be used by the Discovery Controller to control what NVMe Target
resources are allocated to the NVMe Host for a connection.</p></div>
<div class="paragraph"><p>A Discovery Controller has it’s own NQN defined in the NVMe-over-Fabrics
-specification, <strong>nqn.2014-08.org.nvmexpress.discovery</strong>. All Discovery
+specification, <strong>nqn.2014-08.org.nvmexpress.discovery</strong>. All Discovery
Controllers must use this NQN name. This NQN is used by default by
nvme-cli for the <em>discover</em> command.</p></div>
</div>
@@ -837,7 +828,7 @@ nvme-cli for the <em>discover</em> command.</p></div> <dd>
<p>
This field specifies the network fabric being used for
- a NVMe-over-Fabrics network. Current string values include:
+ a NVMe-over-Fabrics network. Current string values include:
</p>
<div class="tableblock">
<table rules="all"
@@ -903,7 +894,7 @@ cellspacing="0" cellpadding="4"> </dt>
<dd>
<p>
- This field specifies the transport service id. For transports using IP
+ This field specifies the transport service id. For transports using IP
addressing (e.g. rdma) this field is the port number. By default, the IP
port number for the RDMA transport is 4420.
</p>
@@ -1168,15 +1159,15 @@ cellspacing="0" cellpadding="4"> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
</p>
</dd>
<dt class="hdlist1">
@@ -1222,6 +1213,29 @@ cellspacing="0" cellpadding="4"> the management of the global resources.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -1265,9 +1279,9 @@ Issue a <em>nvme discover</em> command using a /usr/local/etc/nvme/discovery.con </p>
<div class="listingblock">
<div class="content">
-<pre><code># Machine default 'nvme discover' commands. Query the
+<pre><code># Machine default 'nvme discover' commands. Query the
# Discovery Controller's two ports (some resources may only
-# be accessible on a single port). Note an official
+# be accessible on a single port). Note an official
# nqn (Host) name defined in the NVMe specification is being used
# in this example.
-t rdma -a 192.168.69.33 -s 4420 -q nqn.2014-08.com.example:nvme:nvm-subsystem-sn-d78432
@@ -1303,7 +1317,7 @@ nvme-connect-all(1)</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-discover.txt b/Documentation/nvme-discover.txt index a0ffb36..32f10bc 100644 --- a/Documentation/nvme-discover.txt +++ b/Documentation/nvme-discover.txt @@ -8,39 +8,30 @@ nvme-discover - Send Get Log Page request to Discovery Controller. SYNOPSIS -------- [verse] -'nvme discover' - [--transport=<trtype> | -t <trtype>] - [--nqn=<subnqn> | -n <subnqn>] - [--traddr=<traddr> | -a <traddr>] - [--trsvcid=<trsvcid> | -s <trsvcid>] - [--host-traddr=<traddr> | -w <traddr>] - [--host-iface=<iface> | -f <iface>] - [--hostnqn=<hostnqn> | -q <hostnqn>] - [--hostid=<hostid> | -I <hostid>] - [--raw=<filename> | -r <filename>] - [--device=<device> | -d <device>] - [--cfg-file=<cfg> | -C <cfg> ] - [--keep-alive-tmo=<sec> | -k <sec>] - [--reconnect-delay=<#> | -c <#>] - [--ctrl-loss-tmo=<#> | -l <#>] - [--nr-io-queues=<#> | -i <#>] - [--nr-write-queues=<#> | -W <#>] - [--nr-poll-queues=<#> | -P <#>] - [--queue-size=<#> | -Q <#>] - [--keyring=<#> ] - [--tls_key=<#> ] - [--hdr-digest | -g] - [--data-digest | -G] - [--persistent | -p] - [--quiet | -S] - [--tls ] - [--dump-config | -O] - [--output-format=<fmt> | -o <fmt>] - [--force] - [--nbft] - [--no-nbft] - [--nbft-path=<STR>] - [--context=<STR>] +'nvme discover' [--transport=<trtype> | -t <trtype>] + [--nqn=<subnqn> | -n <subnqn>] + [--traddr=<traddr> | -a <traddr>] + [--trsvcid=<trsvcid> | -s <trsvcid>] + [--host-traddr=<traddr> | -w <traddr>] + [--host-iface=<iface> | -f <iface>] + [--hostnqn=<hostnqn> | -q <hostnqn>] + [--hostid=<hostid> | -I <hostid>] + [--raw=<filename> | -r <filename>] + [--device=<device> | -d <device>] + [--cfg-file=<cfg> | -C <cfg>] + [--keep-alive-tmo=<sec> | -k <sec>] + [--reconnect-delay=<#> | -c <#>] + [--ctrl-loss-tmo=<#> | -l <#>] + [--nr-io-queues=<#> | -i <#>] + [--nr-write-queues=<#> | -W <#>] + [--nr-poll-queues=<#> | -P <#>] + [--queue-size=<#> | -Q <#>] [--keyring=<#>] + [--tls_key=<#>] [--hdr-digest | -g] [--data-digest | -G] + [--persistent | -p] [--quiet | -S] [--tls] + [--dump-config | -O] [--output-format=<fmt> | -o <fmt>] + [--force] [--nbft] [--no-nbft] [--nbft-path=<STR>] + [--context=<STR>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -49,7 +40,7 @@ Controller. If no parameters are given, then 'nvme discover' will attempt to find a @SYSCONFDIR@/nvme/discovery.conf file to use to supply a list of -Discovery commands to run. If no @SYSCONFDIR@/nvme/discovery.conf file +Discovery commands to run. If no @SYSCONFDIR@/nvme/discovery.conf file exists, the command will quit with an error. Otherwise, a specific Discovery Controller should be specified using the @@ -61,7 +52,7 @@ BACKGROUND The NVMe-over-Fabrics specification defines the concept of a Discovery Controller that an NVMe Host can query on a fabric network to discover NVMe subsystems contained in NVMe Targets -which it can connect to on the network. The Discovery Controller +which it can connect to on the network. The Discovery Controller will return Discovery Log Pages that provide the NVMe Host with specific information (such as network address and unique subsystem NQN) the NVMe Host can use to issue an @@ -76,7 +67,7 @@ may be used by the Discovery Controller to control what NVMe Target resources are allocated to the NVMe Host for a connection. A Discovery Controller has it's own NQN defined in the NVMe-over-Fabrics -specification, *nqn.2014-08.org.nvmexpress.discovery*. All Discovery +specification, *nqn.2014-08.org.nvmexpress.discovery*. All Discovery Controllers must use this NQN name. This NQN is used by default by nvme-cli for the 'discover' command. @@ -85,7 +76,7 @@ OPTIONS -t <trtype>:: --transport=<trtype>:: This field specifies the network fabric being used for - a NVMe-over-Fabrics network. Current string values include: + a NVMe-over-Fabrics network. Current string values include: + [] |================= @@ -108,7 +99,7 @@ OPTIONS -s <trsvcid>:: --trsvcid=<trsvcid>:: - This field specifies the transport service id. For transports using IP + This field specifies the transport service id. For transports using IP addressing (e.g. rdma) this field is the port number. By default, the IP port number for the RDMA transport is 4420. @@ -223,10 +214,10 @@ OPTIONS --dump-config:: Print out resulting JSON configuration file to stdout. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. --force:: Disable the built-in persistent discover connection rules. @@ -234,18 +225,27 @@ OPTIONS persistent discovery connection. --nbft:: - Only look at NBFT tables + Only look at NBFT tables --no-nbft:: - Do not look at NBFT tables + Do not look at NBFT tables --nbft-path=<STR>:: - Use a user-defined path to the NBFT tables + Use a user-defined path to the NBFT tables --context <STR>:: Set the execution context to <STR>. This allows to coordinate the management of the global resources. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Query the Discover Controller with IP4 address 192.168.1.3 for all @@ -272,9 +272,9 @@ Port 4420 is used by default: * Issue a 'nvme discover' command using a @SYSCONFDIR@/nvme/discovery.conf file: + ----------- -# Machine default 'nvme discover' commands. Query the +# Machine default 'nvme discover' commands. Query the # Discovery Controller's two ports (some resources may only -# be accessible on a single port). Note an official +# be accessible on a single port). Note an official # nqn (Host) name defined in the NVMe specification is being used # in this example. -t rdma -a 192.168.69.33 -s 4420 -q nqn.2014-08.com.example:nvme:nvm-subsystem-sn-d78432 diff --git a/Documentation/nvme-dsm.1 b/Documentation/nvme-dsm.1 index 1f228e6..d5b3222 100644 --- a/Documentation/nvme-dsm.1 +++ b/Documentation/nvme-dsm.1 @@ -2,12 +2,12 @@ .\" Title: nvme-dsm .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-DSM" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-DSM" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,12 +32,14 @@ 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> ] +\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=<deallocate> | \-d <deallocate>] + [\-\-idw=<write> | \-w <write>] [\-\-idr=<read> | \-r <read>] + [\-\-cdw11=<cdw11> | \-c <cdw11>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -89,6 +91,20 @@ Attribute Integral Dataset for Read\&. .RS 4 All the command command dword 11 attributes\&. Use exclusive from specifying individual attributes .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet diff --git a/Documentation/nvme-dsm.html b/Documentation/nvme-dsm.html index 58c1764..e522e97 100644 --- a/Documentation/nvme-dsm.html +++ b/Documentation/nvme-dsm.html @@ -749,12 +749,14 @@ nvme-dsm(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme dsm</em> <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> ]</pre>
+<pre class="content"><em>nvme dsm</em> <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=<deallocate> | -d <deallocate>]
+ [--idw=<write> | -w <write>] [--idr=<read> | -r <read>]
+ [--cdw11=<cdw11> | -c <cdw11>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -873,6 +875,29 @@ any settings from the flags may have provided.</p></div> specifying individual attributes
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -893,7 +918,7 @@ any settings from the flags may have provided.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-dsm.txt b/Documentation/nvme-dsm.txt index ff658a7..6a2e61a 100644 --- a/Documentation/nvme-dsm.txt +++ b/Documentation/nvme-dsm.txt @@ -8,13 +8,14 @@ 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> ] - +'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=<deallocate> | -d <deallocate>] + [--idw=<write> | -w <write>] [--idr=<read> | -r <read>] + [--cdw11=<cdw11> | -c <cdw11>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -73,6 +74,15 @@ OPTIONS All the command command dword 11 attributes. Use exclusive from specifying individual attributes +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet diff --git a/Documentation/nvme-effects-log.1 b/Documentation/nvme-effects-log.1 index 66741c3..c97df78 100644 --- a/Documentation/nvme-effects-log.1 +++ b/Documentation/nvme-effects-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-effects-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-EFFECTS\-LOG" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-EFFECTS\-LOG" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,8 @@ nvme-effects-log \- Send NVMe Command Effects log page request, returns result a .SH "SYNOPSIS" .sp .nf -\fInvme effects\-log\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] - [\-\-human\-readable | \-H] - [\-\-raw\-binary | \-b] +\fInvme effects\-log\fR <device> [\-\-human\-readable | \-H] [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -45,11 +44,6 @@ The <device> parameter is mandatory and should be the NVMe character device (ex: On success, the returned command effects log structure will be printed for each command that is supported\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> -.RS 4 -This option will set the reporting format to normal, json, or binary\&. Only one output format can be used at a time\&. -.RE -.PP \-H, \-\-human\-readable .RS 4 This option will parse and format many of the bit fields into a human\-readable format\&. @@ -59,6 +53,20 @@ This option will parse and format many of the bit fields into a human\-readable .RS 4 This option will print the raw buffer to stdout\&. Structure is not parsed by program\&. This overrides the human\-readable option\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-effects-log.html b/Documentation/nvme-effects-log.html index 23dc161..17ec867 100644 --- a/Documentation/nvme-effects-log.html +++ b/Documentation/nvme-effects-log.html @@ -749,9 +749,8 @@ nvme-effects-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme effects-log</em> <device> [--output-format=<fmt> | -o <fmt>]
- [--human-readable | -H]
- [--raw-binary | -b]</pre>
+<pre class="content"><em>nvme effects-log</em> <device> [--human-readable | -H] [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -772,39 +771,50 @@ for each command that is supported.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-H
</dt>
<dt class="hdlist1">
---output-format=<format>
+--human-readable
</dt>
<dd>
<p>
- This option will set the reporting format to normal, json, or binary.
- Only one output format can be used at a time.
+ This option will parse and format many of the bit fields into a
+ human-readable format.
</p>
</dd>
<dt class="hdlist1">
--H
+-b
</dt>
<dt class="hdlist1">
---human-readable
+--raw-binary
</dt>
<dd>
<p>
- This option will parse and format many of the bit fields into a
- human-readable format.
+ This option will print the raw buffer to stdout. Structure is not
+ parsed by program. This overrides the human-readable option.
</p>
</dd>
<dt class="hdlist1">
--b
+-o <fmt>
</dt>
<dt class="hdlist1">
---raw-binary
+--output-format=<fmt>
</dt>
<dd>
<p>
- This option will print the raw buffer to stdout. Structure is not
- parsed by program. This overrides the human-readable option.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -847,7 +857,7 @@ Have the program return the raw structure in binary: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-effects-log.txt b/Documentation/nvme-effects-log.txt index f7d0092..57a1369 100644 --- a/Documentation/nvme-effects-log.txt +++ b/Documentation/nvme-effects-log.txt @@ -3,14 +3,14 @@ nvme-effects-log(1) NAME ---- -nvme-effects-log - Send NVMe Command Effects log page request, returns result and log +nvme-effects-log - Send NVMe Command Effects log page request, returns result +and log SYNOPSIS -------- [verse] -'nvme effects-log' <device> [--output-format=<fmt> | -o <fmt>] - [--human-readable | -H] - [--raw-binary | -b] +'nvme effects-log' <device> [--human-readable | -H] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -26,11 +26,6 @@ for each command that is supported. OPTIONS ------- --o <format>:: ---output-format=<format>:: - This option will set the reporting format to normal, json, or binary. - Only one output format can be used at a time. - -H:: --human-readable:: This option will parse and format many of the bit fields into a @@ -39,7 +34,16 @@ OPTIONS -b:: --raw-binary:: This option will print the raw buffer to stdout. Structure is not - parsed by program. This overrides the human-readable option. + parsed by program. This overrides the human-readable option. + +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-endurance-event-agg-log.1 b/Documentation/nvme-endurance-event-agg-log.1 index c908d90..72bf8a6 100644 --- a/Documentation/nvme-endurance-event-agg-log.1 +++ b/Documentation/nvme-endurance-event-agg-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-endurance-event-agg-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ENDURANCE\-EVE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ENDURANCE\-EVE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,7 +34,7 @@ nvme-endurance-event-agg-log \- Send NVMe Endurance log page request, returns re .nf \fInvme endurance\-event\-agg\-log\fR <device> [\-\-log\-entries=<log_entries> | \-e <log_entries>] [\-\-rae | \-r] [\-\-raw\-binary | \-b] - [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -55,13 +55,19 @@ Retrieve the Endurance Group Event Aggregate Log pending entries\&. This argumen Retain an Asynchronous Event\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-endurance-event-agg-log.html b/Documentation/nvme-endurance-event-agg-log.html index 771ce5a..c80cd0d 100644 --- a/Documentation/nvme-endurance-event-agg-log.html +++ b/Documentation/nvme-endurance-event-agg-log.html @@ -751,7 +751,7 @@ nvme-endurance-event-agg-log(1) Manual Page <div class="verseblock">
<pre class="content"><em>nvme endurance-event-agg-log</em> <device> [--log-entries=<log_entries> | -e <log_entries>]
[--rae | -r] [--raw-binary | -b]
- [--output-format=<fmt> | -o <fmt>]</pre>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -781,11 +781,11 @@ printed to stdout for another program to parse, or reported in json format.</p>< </dt>
<dd>
<p>
- Retrieve the Endurance Group Event Aggregate Log pending entries.
- This argument is mandatory and its success may depend on the device’s
- statistics to provide this log For More details see NVM Express 1.4 Spec.
- Section 5.14.1.15. The maximum number of log entries supported is 2044
- for the device.
+ Retrieve the Endurance Group Event Aggregate Log pending entries.
+ This argument is mandatory and its success may depend on the device’s
+ statistics to provide this log For More details see NVM Express 1.4 Spec.
+ Section 5.14.1.15. The maximum number of log entries supported is 2044
+ for the device.
</p>
</dd>
<dt class="hdlist1">
@@ -800,15 +800,26 @@ printed to stdout for another program to parse, or reported in json format.</p>< </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -851,7 +862,7 @@ Print the raw Endurance log to a file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-endurance-event-agg-log.txt b/Documentation/nvme-endurance-event-agg-log.txt index 69701e3..7cbceb1 100644 --- a/Documentation/nvme-endurance-event-agg-log.txt +++ b/Documentation/nvme-endurance-event-agg-log.txt @@ -10,7 +10,7 @@ SYNOPSIS [verse] 'nvme endurance-event-agg-log' <device> [--log-entries=<log_entries> | -e <log_entries>] [--rae | -r] [--raw-binary | -b] - [--output-format=<fmt> | -o <fmt>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -29,20 +29,24 @@ OPTIONS ------- -e <log_entries>:: --log-entries=<log_entries>:: - Retrieve the Endurance Group Event Aggregate Log pending entries. - This argument is mandatory and its success may depend on the device's - statistics to provide this log For More details see NVM Express 1.4 Spec. - Section 5.14.1.15. The maximum number of log entries supported is 2044 - for the device. + Retrieve the Endurance Group Event Aggregate Log pending entries. + This argument is mandatory and its success may depend on the device's + statistics to provide this log For More details see NVM Express 1.4 Spec. + Section 5.14.1.15. The maximum number of log entries supported is 2044 + for the device. -r:: --rae:: Retain an Asynchronous Event. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-endurance-log.1 b/Documentation/nvme-endurance-log.1 index ec34603..5d653e1 100644 --- a/Documentation/nvme-endurance-log.1 +++ b/Documentation/nvme-endurance-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-endurance-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ENDURANCE\-LOG" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ENDURANCE\-LOG" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,7 +33,7 @@ nvme-endurance-log \- Send NVMe Endurance log page request, returns result and l .sp .nf \fInvme endurance\-log\fR <device> [\-\-group\-id=<group> | \-g <group>] - [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -49,13 +49,19 @@ On success, the returned endurance log structure may be returned in one of sever The endurance group identifier\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-endurance-log.html b/Documentation/nvme-endurance-log.html index 109bdf1..1ec51f6 100644 --- a/Documentation/nvme-endurance-log.html +++ b/Documentation/nvme-endurance-log.html @@ -750,7 +750,7 @@ nvme-endurance-log(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme endurance-log</em> <device> [--group-id=<group> | -g <group>]
- [--output-format=<fmt> | -o <fmt>]</pre>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -783,15 +783,26 @@ printed to stdout for another program to parse, or reported in json format.</p>< </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -834,7 +845,7 @@ Print the raw Endurance log to a file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-endurance-log.txt b/Documentation/nvme-endurance-log.txt index 5e18b57..c263834 100644 --- a/Documentation/nvme-endurance-log.txt +++ b/Documentation/nvme-endurance-log.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] 'nvme endurance-log' <device> [--group-id=<group> | -g <group>] - [--output-format=<fmt> | -o <fmt>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -29,10 +29,14 @@ OPTIONS --group-id=<group>:: The endurance group identifier. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-error-log.1 b/Documentation/nvme-error-log.1 index 1666278..3a0d154 100644 --- a/Documentation/nvme-error-log.1 +++ b/Documentation/nvme-error-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-error-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ERROR\-LOG" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ERROR\-LOG" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,9 @@ nvme-error-log \- Send NVME Error log page request, return result and log .SH "SYNOPSIS" .sp .nf -\fInvme error\-log\fR <device> [\-\-log\-entries=<entries> | \-e <entries>] - [\-\-raw\-binary | \-b] - [\-\-output\-format=<fmt> | \-o <fmt>] +\fInvme error\-log\fR <device> [\-\-log\-entries=<entries> | \-e <entries>] + [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -55,13 +55,19 @@ Specifies how many log entries the program should request from the device\&. Thi Print the raw error log buffer to stdout\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-error-log.html b/Documentation/nvme-error-log.html index d83eb97..229b883 100644 --- a/Documentation/nvme-error-log.html +++ b/Documentation/nvme-error-log.html @@ -749,9 +749,9 @@ nvme-error-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme error-log</em> <device> [--log-entries=<entries> | -e <entries>]
- [--raw-binary | -b]
- [--output-format=<fmt> | -o <fmt>]</pre>
+<pre class="content"><em>nvme error-log</em> <device> [--log-entries=<entries> | -e <entries>]
+ [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -798,15 +798,26 @@ printed to stdout for another program to parse.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -849,7 +860,7 @@ Print the raw output to a file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-error-log.txt b/Documentation/nvme-error-log.txt index eebaca7..94442ee 100644 --- a/Documentation/nvme-error-log.txt +++ b/Documentation/nvme-error-log.txt @@ -8,9 +8,9 @@ nvme-error-log - Send NVME Error log page request, return result and log SYNOPSIS -------- [verse] -'nvme error-log' <device> [--log-entries=<entries> | -e <entries>] - [--raw-binary | -b] - [--output-format=<fmt> | -o <fmt>] +'nvme error-log' <device> [--log-entries=<entries> | -e <entries>] + [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -37,11 +37,14 @@ OPTIONS --raw-binary:: Print the raw error log buffer to stdout. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-fdp-configs.1 b/Documentation/nvme-fdp-configs.1 index bafe726..2b7903f 100644 --- a/Documentation/nvme-fdp-configs.1 +++ b/Documentation/nvme-fdp-configs.1 @@ -2,12 +2,12 @@ .\" Title: nvme-fdp-configs .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-FDP\-CONFIGS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-FDP\-CONFIGS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,9 +33,8 @@ nvme-fdp-configs \- Get Flexible Data Placement Configurations .sp .nf \fInvme fdp configs\fR <device> [\-\-endgrp\-id=<NUM> | \-e <NUM>] - [\-\-human\-readable | \-H] - [\-\-raw\-binary | \-b] - [\-\-output\-format=<FMT> | \-o <FMT>] + [\-\-human\-readable | \-H] [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp @@ -57,7 +56,7 @@ Parse, print and describe individual parts of bitfields\&. Print the raw buffer to the standard output stream\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-fdp-configs.html b/Documentation/nvme-fdp-configs.html index 7035659..fe68c4a 100644 --- a/Documentation/nvme-fdp-configs.html +++ b/Documentation/nvme-fdp-configs.html @@ -750,9 +750,8 @@ nvme-fdp-configs(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme fdp configs</em> <device> [--endgrp-id=<NUM> | -e <NUM>]
- [--human-readable | -H]
- [--raw-binary | -b]
- [--output-format=<FMT> | -o <FMT>]</pre>
+ [--human-readable | -H] [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -802,10 +801,10 @@ the possible configurations for Flexible Data Placement.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -827,7 +826,7 @@ the possible configurations for Flexible Data Placement.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-fdp-configs.txt b/Documentation/nvme-fdp-configs.txt index c4311fb..d5cc487 100644 --- a/Documentation/nvme-fdp-configs.txt +++ b/Documentation/nvme-fdp-configs.txt @@ -9,9 +9,8 @@ SYNOPSIS -------- [verse] 'nvme fdp configs' <device> [--endgrp-id=<NUM> | -e <NUM>] - [--human-readable | -H] - [--raw-binary | -b] - [--output-format=<FMT> | -o <FMT>] + [--human-readable | -H] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- @@ -32,8 +31,8 @@ OPTIONS --raw-binary:: Print the raw buffer to the standard output stream. --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', 'json', or 'binary'. Only one output format can be used at a time. diff --git a/Documentation/nvme-fdp-events.1 b/Documentation/nvme-fdp-events.1 index 6a1017a..1949d3d 100644 --- a/Documentation/nvme-fdp-events.1 +++ b/Documentation/nvme-fdp-events.1 @@ -2,12 +2,12 @@ .\" Title: nvme-fdp-events .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-FDP\-EVENTS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-FDP\-EVENTS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,10 +32,8 @@ nvme-fdp-events \- Get Flexible Data Placement Events .SH "SYNOPSIS" .sp .nf -\fInvme fdp events\fR <device> [\-\-endgrp\-id=<NUM> | \-e <NUM>] - [\-\-host\-events | \-E] - [\-\-raw\-binary | \-b] - [\-\-output\-format=<FMT> | \-o <FMT>] +\fInvme fdp events\fR <device> [\-\-endgrp\-id=<NUM> | \-e <NUM>] [\-\-host\-events | \-E] + [\-\-raw\-binary | \-b] [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp @@ -57,7 +55,7 @@ Request the controller to report host events\&. Print the raw buffer to the standard output stream\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-fdp-events.html b/Documentation/nvme-fdp-events.html index 972d185..91f7d2f 100644 --- a/Documentation/nvme-fdp-events.html +++ b/Documentation/nvme-fdp-events.html @@ -749,10 +749,8 @@ nvme-fdp-events(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme fdp events</em> <device> [--endgrp-id=<NUM> | -e <NUM>]
- [--host-events | -E]
- [--raw-binary | -b]
- [--output-format=<FMT> | -o <FMT>]</pre>
+<pre class="content"><em>nvme fdp events</em> <device> [--endgrp-id=<NUM> | -e <NUM>] [--host-events | -E]
+ [--raw-binary | -b] [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -802,10 +800,10 @@ Units and media usage in an Endurance Group.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -827,7 +825,7 @@ Units and media usage in an Endurance Group.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-fdp-events.txt b/Documentation/nvme-fdp-events.txt index 606a163..5602f44 100644 --- a/Documentation/nvme-fdp-events.txt +++ b/Documentation/nvme-fdp-events.txt @@ -8,10 +8,8 @@ nvme-fdp-events - Get Flexible Data Placement Events SYNOPSIS -------- [verse] -'nvme fdp events' <device> [--endgrp-id=<NUM> | -e <NUM>] - [--host-events | -E] - [--raw-binary | -b] - [--output-format=<FMT> | -o <FMT>] +'nvme fdp events' <device> [--endgrp-id=<NUM> | -e <NUM>] [--host-events | -E] + [--raw-binary | -b] [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- @@ -32,8 +30,8 @@ OPTIONS --raw-binary:: Print the raw buffer to the standard output stream. --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', 'json', or 'binary'. Only one output format can be used at a time. diff --git a/Documentation/nvme-fdp-set-events.1 b/Documentation/nvme-fdp-set-events.1 index 82be4a0..860f6e0 100644 --- a/Documentation/nvme-fdp-set-events.1 +++ b/Documentation/nvme-fdp-set-events.1 @@ -2,12 +2,12 @@ .\" Title: nvme-fdp-set-events .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-FDP\-SET\-EVEN" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-FDP\-SET\-EVEN" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,9 +33,8 @@ nvme-fdp-set-events \- Enable or disable FDP events .sp .nf \fInvme fdp set\-events\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] - [\-\-placement\-handle=<NUM> | \-p <NUM>] - [\-\-enable | \-e] - [\-\-event\-types=<NUM,> | \-t <NUM,>] + [\-\-placement\-handle=<NUM> | \-p <NUM>] [\-\-enable | \-e] + [\-\-event\-types=<NUM,> | \-t <NUM,>] .fi .SH "DESCRIPTION" .sp @@ -52,7 +51,7 @@ Namespace identifier\&. Print the raw buffer to the standard output stream\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-fdp-set-events.html b/Documentation/nvme-fdp-set-events.html index 4541a6c..95c3e6e 100644 --- a/Documentation/nvme-fdp-set-events.html +++ b/Documentation/nvme-fdp-set-events.html @@ -750,9 +750,8 @@ nvme-fdp-set-events(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme fdp set-events</em> <device> [--namespace-id=<NUM> | -n <NUM>]
- [--placement-handle=<NUM> | -p <NUM>]
- [--enable | -e]
- [--event-types=<NUM,> | -t <NUM,>]</pre>
+ [--placement-handle=<NUM> | -p <NUM>] [--enable | -e]
+ [--event-types=<NUM,> | -t <NUM,>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -792,10 +791,10 @@ Handle.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -817,7 +816,7 @@ Handle.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-fdp-set-events.txt b/Documentation/nvme-fdp-set-events.txt index b45819b..b93cdc3 100644 --- a/Documentation/nvme-fdp-set-events.txt +++ b/Documentation/nvme-fdp-set-events.txt @@ -9,9 +9,8 @@ SYNOPSIS -------- [verse] 'nvme fdp set-events' <device> [--namespace-id=<NUM> | -n <NUM>] - [--placement-handle=<NUM> | -p <NUM>] - [--enable | -e] - [--event-types=<NUM,> | -t <NUM,>] + [--placement-handle=<NUM> | -p <NUM>] [--enable | -e] + [--event-types=<NUM,> | -t <NUM,>] DESCRIPTION ----------- @@ -29,8 +28,8 @@ OPTIONS --raw-binary:: Print the raw buffer to the standard output stream. --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', 'json', or 'binary'. Only one output format can be used at a time. diff --git a/Documentation/nvme-fdp-stats.1 b/Documentation/nvme-fdp-stats.1 index 703382c..629162d 100644 --- a/Documentation/nvme-fdp-stats.1 +++ b/Documentation/nvme-fdp-stats.1 @@ -2,12 +2,12 @@ .\" Title: nvme-fdp-stats .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-FDP\-STATS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-FDP\-STATS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,8 @@ nvme-fdp-stats \- Get Flexible Data Placement Statistics .SH "SYNOPSIS" .sp .nf -\fInvme fdp stats\fR <device> [\-\-endgrp\-id=<NUM> | \-e <NUM>] - [\-\-raw\-binary | \-b] - [\-\-output\-format=<FMT> | \-o <FMT>] +\fInvme fdp stats\fR <device> [\-\-endgrp\-id=<NUM> | \-e <NUM>] [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp @@ -51,7 +50,7 @@ The endurance group identifier to use when requesting the log page\&. Print the raw buffer to the standard output stream\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-fdp-stats.html b/Documentation/nvme-fdp-stats.html index 892bcf9..8d81eef 100644 --- a/Documentation/nvme-fdp-stats.html +++ b/Documentation/nvme-fdp-stats.html @@ -749,9 +749,8 @@ nvme-fdp-stats(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme fdp stats</em> <device> [--endgrp-id=<NUM> | -e <NUM>]
- [--raw-binary | -b]
- [--output-format=<FMT> | -o <FMT>]</pre>
+<pre class="content"><em>nvme fdp stats</em> <device> [--endgrp-id=<NUM> | -e <NUM>] [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -790,10 +789,10 @@ the life of the FDP configuration in an Endurance Group.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -815,7 +814,7 @@ the life of the FDP configuration in an Endurance Group.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-fdp-stats.txt b/Documentation/nvme-fdp-stats.txt index 7f96065..0b184a9 100644 --- a/Documentation/nvme-fdp-stats.txt +++ b/Documentation/nvme-fdp-stats.txt @@ -8,9 +8,8 @@ nvme-fdp-stats - Get Flexible Data Placement Statistics SYNOPSIS -------- [verse] -'nvme fdp stats' <device> [--endgrp-id=<NUM> | -e <NUM>] - [--raw-binary | -b] - [--output-format=<FMT> | -o <FMT>] +'nvme fdp stats' <device> [--endgrp-id=<NUM> | -e <NUM>] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- @@ -27,8 +26,8 @@ OPTIONS --raw-binary:: Print the raw buffer to the standard output stream. --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', 'json', or 'binary'. Only one output format can be used at a time. diff --git a/Documentation/nvme-fdp-status.1 b/Documentation/nvme-fdp-status.1 index 752b00e..6fefff4 100644 --- a/Documentation/nvme-fdp-status.1 +++ b/Documentation/nvme-fdp-status.1 @@ -2,12 +2,12 @@ .\" Title: nvme-fdp-status .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-FDP\-STATUS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-FDP\-STATUS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,8 @@ nvme-fdp-status \- Get Reclaim Unit Handle Status .SH "SYNOPSIS" .sp .nf -\fInvme fdp status\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] - [\-\-raw\-binary | \-b] - [\-\-output\-format=<FMT> | \-o <FMT>] +\fInvme fdp status\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp @@ -51,7 +50,7 @@ Namespace identifier\&. Print the raw buffer to the standard output stream\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-fdp-status.html b/Documentation/nvme-fdp-status.html index d53f4f9..01a7b60 100644 --- a/Documentation/nvme-fdp-status.html +++ b/Documentation/nvme-fdp-status.html @@ -749,9 +749,8 @@ nvme-fdp-status(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme fdp status</em> <device> [--namespace-id=<NUM> | -n <NUM>]
- [--raw-binary | -b]
- [--output-format=<FMT> | -o <FMT>]</pre>
+<pre class="content"><em>nvme fdp status</em> <device> [--namespace-id=<NUM> | -n <NUM>] [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -790,10 +789,10 @@ are accessible by the specified namespace.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -815,7 +814,7 @@ are accessible by the specified namespace.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-fdp-status.txt b/Documentation/nvme-fdp-status.txt index 263cb4c..78dddae 100644 --- a/Documentation/nvme-fdp-status.txt +++ b/Documentation/nvme-fdp-status.txt @@ -8,9 +8,8 @@ nvme-fdp-status - Get Reclaim Unit Handle Status SYNOPSIS -------- [verse] -'nvme fdp status' <device> [--namespace-id=<NUM> | -n <NUM>] - [--raw-binary | -b] - [--output-format=<FMT> | -o <FMT>] +'nvme fdp status' <device> [--namespace-id=<NUM> | -n <NUM>] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- @@ -27,8 +26,8 @@ OPTIONS --raw-binary:: Print the raw buffer to the standard output stream. --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', 'json', or 'binary'. Only one output format can be used at a time. diff --git a/Documentation/nvme-fdp-update.1 b/Documentation/nvme-fdp-update.1 index 5bb9528..abf36fd 100644 --- a/Documentation/nvme-fdp-update.1 +++ b/Documentation/nvme-fdp-update.1 @@ -2,12 +2,12 @@ .\" Title: nvme-fdp-update .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-FDP\-UPDATE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-FDP\-UPDATE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,7 +33,7 @@ nvme-fdp-update \- Reclaim Unit Handle Update .sp .nf \fInvme fdp update\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] - [\-\-pids=<NUM,> | \-p <NUM,>] + [\-\-pids=<NUM,> | \-p <NUM,>] .fi .SH "DESCRIPTION" .sp diff --git a/Documentation/nvme-fdp-update.html b/Documentation/nvme-fdp-update.html index 63e8042..1fd97c7 100644 --- a/Documentation/nvme-fdp-update.html +++ b/Documentation/nvme-fdp-update.html @@ -750,7 +750,7 @@ nvme-fdp-update(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme fdp update</em> <device> [--namespace-id=<NUM> | -n <NUM>]
- [--pids=<NUM,> | -p <NUM,>]</pre>
+ [--pids=<NUM,> | -p <NUM,>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -802,7 +802,7 @@ a different Reclaim Unit accessible by the specified namespace.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-fdp-update.txt b/Documentation/nvme-fdp-update.txt index 4b70c24..5af83e5 100644 --- a/Documentation/nvme-fdp-update.txt +++ b/Documentation/nvme-fdp-update.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] 'nvme fdp update' <device> [--namespace-id=<NUM> | -n <NUM>] - [--pids=<NUM,> | -p <NUM,>] + [--pids=<NUM,> | -p <NUM,>] DESCRIPTION ----------- diff --git a/Documentation/nvme-fdp-usage.1 b/Documentation/nvme-fdp-usage.1 index 41873e4..b561adb 100644 --- a/Documentation/nvme-fdp-usage.1 +++ b/Documentation/nvme-fdp-usage.1 @@ -2,12 +2,12 @@ .\" Title: nvme-fdp-usage .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-FDP\-USAGE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-FDP\-USAGE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,8 @@ nvme-fdp-usage \- Get Reclaim Unit Handle Usage .SH "SYNOPSIS" .sp .nf -\fInvme fdp usage\fR <device> [\-\-endgrp\-id=<NUM> | \-e <NUM>] - [\-\-raw\-binary | \-b] - [\-\-output\-format=<FMT> | \-o <FMT>] +\fInvme fdp usage\fR <device> [\-\-endgrp\-id=<NUM> | \-e <NUM>] [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp @@ -51,7 +50,7 @@ The endurance group identifier to use when requesting the log page\&. Print the raw buffer to the standard output stream\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-fdp-usage.html b/Documentation/nvme-fdp-usage.html index e789004..a617aa0 100644 --- a/Documentation/nvme-fdp-usage.html +++ b/Documentation/nvme-fdp-usage.html @@ -749,9 +749,8 @@ nvme-fdp-usage(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme fdp usage</em> <device> [--endgrp-id=<NUM> | -e <NUM>]
- [--raw-binary | -b]
- [--output-format=<FMT> | -o <FMT>]</pre>
+<pre class="content"><em>nvme fdp usage</em> <device> [--endgrp-id=<NUM> | -e <NUM>] [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -791,10 +790,10 @@ Endurance Group.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -816,7 +815,7 @@ Endurance Group.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-fdp-usage.txt b/Documentation/nvme-fdp-usage.txt index ad9d1eb..3e0fb98 100644 --- a/Documentation/nvme-fdp-usage.txt +++ b/Documentation/nvme-fdp-usage.txt @@ -8,9 +8,8 @@ nvme-fdp-usage - Get Reclaim Unit Handle Usage SYNOPSIS -------- [verse] -'nvme fdp usage' <device> [--endgrp-id=<NUM> | -e <NUM>] - [--raw-binary | -b] - [--output-format=<FMT> | -o <FMT>] +'nvme fdp usage' <device> [--endgrp-id=<NUM> | -e <NUM>] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- @@ -28,8 +27,8 @@ OPTIONS --raw-binary:: Print the raw buffer to the standard output stream. --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', 'json', or 'binary'. Only one output format can be used at a time. diff --git a/Documentation/nvme-fid-support-effects-log.1 b/Documentation/nvme-fid-support-effects-log.1 index d833b37..8c2ab58 100644 --- a/Documentation/nvme-fid-support-effects-log.1 +++ b/Documentation/nvme-fid-support-effects-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-fid-support-effects-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-FID\-SUPPORT\-" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-FID\-SUPPORT\-" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,7 +32,7 @@ nvme-fid-support-effects-log \- Send NVMe FID Support and Effects log, return re .SH "SYNOPSIS" .sp .nf -\fInvme fid\-support\-effects\-log\fR <device> [\-o <fmt> | \-\-output\-format=<fmt>] +\fInvme fid\-support\-effects\-log\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -43,17 +43,23 @@ The <device> parameter is mandatory and may be either the NVMe character device On success, the structure may be returned in one of several ways depending on the option flags; the structure may be parsed by the program or the raw buffer may be printed to stdout\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-H, \-\-human\-readable +.RS 4 +This option will parse and format many of the bit fields into human\-readable formats\&. +.RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE .PP -\-H, \-\-human\-readable +\-v, \-\-verbose .RS 4 -This option will parse and format many of the bit fields into human\-readable formats\&. +Increase the information detail in the output\&. .RE .SH "EXAMPLES" .sp diff --git a/Documentation/nvme-fid-support-effects-log.html b/Documentation/nvme-fid-support-effects-log.html index ef42d4c..255a1bc 100644 --- a/Documentation/nvme-fid-support-effects-log.html +++ b/Documentation/nvme-fid-support-effects-log.html @@ -749,7 +749,7 @@ nvme-fid-support-effects-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme fid-support-effects-log</em> <device> [-o <fmt> | --output-format=<fmt>]</pre>
+<pre class="content"><em>nvme fid-support-effects-log</em> <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -771,27 +771,38 @@ raw buffer may be printed to stdout.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-H
</dt>
<dt class="hdlist1">
---output-format=<format>
+--human-readable
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ This option will parse and format many of the bit fields
+ into human-readable formats.
</p>
</dd>
<dt class="hdlist1">
--H
+-o <fmt>
</dt>
<dt class="hdlist1">
---human-readable
+--output-format=<fmt>
</dt>
<dd>
<p>
- This option will parse and format many of the bit fields
- into human-readable formats.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -814,7 +825,7 @@ raw buffer may be printed to stdout.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-fid-support-effects-log.txt b/Documentation/nvme-fid-support-effects-log.txt index 5d12b18..9670b88 100644 --- a/Documentation/nvme-fid-support-effects-log.txt +++ b/Documentation/nvme-fid-support-effects-log.txt @@ -8,7 +8,7 @@ nvme-fid-support-effects-log - Send NVMe FID Support and Effects log, return res SYNOPSIS -------- [verse] -'nvme fid-support-effects-log' <device> [-o <fmt> | --output-format=<fmt>] +'nvme fid-support-effects-log' <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -24,16 +24,20 @@ raw buffer may be printed to stdout. OPTIONS ------- --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. - -H:: --human-readable:: This option will parse and format many of the bit fields into human-readable formats. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet. diff --git a/Documentation/nvme-flush.1 b/Documentation/nvme-flush.1 index b21d3fb..4e60728 100644 --- a/Documentation/nvme-flush.1 +++ b/Documentation/nvme-flush.1 @@ -2,12 +2,12 @@ .\" Title: nvme-flush .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-FLUSH" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-FLUSH" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,6 +33,7 @@ nvme-flush \- Flush command\&. .sp .nf \fInvme flush\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -43,6 +44,20 @@ The Flush command shall commit data and metadata associated with the specified n .RS 4 Specify the optional namespace id for this command\&. Defaults to 0xffffffff, indicating flush for all namespaces\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet\&. diff --git a/Documentation/nvme-flush.html b/Documentation/nvme-flush.html index d4f3dd1..d0fefd2 100644 --- a/Documentation/nvme-flush.html +++ b/Documentation/nvme-flush.html @@ -749,7 +749,8 @@ nvme-flush(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme flush</em> <device> [--namespace-id=<nsid> | -n <nsid>]</pre>
+<pre class="content"><em>nvme flush</em> <device> [--namespace-id=<nsid> | -n <nsid>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -780,6 +781,29 @@ any namespace.</p></div> 0xffffffff, indicating flush for all namespaces.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -800,7 +824,7 @@ any namespace.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-flush.txt b/Documentation/nvme-flush.txt index 28cfa63..102cd71 100644 --- a/Documentation/nvme-flush.txt +++ b/Documentation/nvme-flush.txt @@ -9,6 +9,7 @@ SYNOPSIS -------- [verse] 'nvme flush' <device> [--namespace-id=<nsid> | -n <nsid>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -25,6 +26,15 @@ OPTIONS Specify the optional namespace id for this command. Defaults to 0xffffffff, indicating flush for all namespaces. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet. diff --git a/Documentation/nvme-format.1 b/Documentation/nvme-format.1 index 63a099c..8fbcaaf 100644 --- a/Documentation/nvme-format.1 +++ b/Documentation/nvme-format.1 @@ -2,12 +2,12 @@ .\" Title: nvme-format .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-FORMAT" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-FORMAT" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,15 +33,13 @@ nvme-format \- Format an NVMe device .sp .nf \fInvme format\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-lbaf=<lbaf> | \-l <lbaf>] - [\-\-block\-size=<block size | \-b <block size>] - [\-\-ses=<ses> | \-s <ses>] - [\-\-pil=<pil> | \-p <pil>] - [\-\-pi=<pi> | \-i <pi>] - [\-\-ms=<ms> | \-m <ms>] - [\-\-reset | \-r ] - [\-\-force ] - [\-\-timeout=<timeout> | \-t <timeout> ] + [\-\-lbaf=<lbaf> | \-l <lbaf>] + [\-\-block\-size=<block size | \-b <block size>] + [\-\-ses=<ses> | \-s <ses>] [\-\-pil=<pil> | \-p <pil>] + [\-\-pi=<pi> | \-i <pi>] [\-\-ms=<ms> | \-m <ms>] + [\-\-reset | \-r] [\-\-force] + [\-\-timeout=<timeout> | \-t <timeout>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -177,6 +175,20 @@ Just send the command immediately without warning of the implications\&. .RS 4 Override default timeout value\&. In milliseconds\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-format.html b/Documentation/nvme-format.html index b617bb8..cc7f899 100644 --- a/Documentation/nvme-format.html +++ b/Documentation/nvme-format.html @@ -750,15 +750,13 @@ nvme-format(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme format</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--lbaf=<lbaf> | -l <lbaf>]
- [--block-size=<block size | -b <block size>]
- [--ses=<ses> | -s <ses>]
- [--pil=<pil> | -p <pil>]
- [--pi=<pi> | -i <pi>]
- [--ms=<ms> | -m <ms>]
- [--reset | -r ]
- [--force ]
- [--timeout=<timeout> | -t <timeout> ]</pre>
+ [--lbaf=<lbaf> | -l <lbaf>]
+ [--block-size=<block size | -b <block size>]
+ [--ses=<ses> | -s <ses>] [--pil=<pil> | -p <pil>]
+ [--pi=<pi> | -i <pi>] [--ms=<ms> | -m <ms>]
+ [--reset | -r] [--force]
+ [--timeout=<timeout> | -t <timeout>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -995,6 +993,29 @@ cellspacing="0" cellpadding="4"> Override default timeout value. In milliseconds.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -1035,7 +1056,7 @@ information: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-format.txt b/Documentation/nvme-format.txt index cbadd1d..e4623f1 100644 --- a/Documentation/nvme-format.txt +++ b/Documentation/nvme-format.txt @@ -9,15 +9,13 @@ SYNOPSIS -------- [verse] 'nvme format' <device> [--namespace-id=<nsid> | -n <nsid>] - [--lbaf=<lbaf> | -l <lbaf>] - [--block-size=<block size | -b <block size>] - [--ses=<ses> | -s <ses>] - [--pil=<pil> | -p <pil>] - [--pi=<pi> | -i <pi>] - [--ms=<ms> | -m <ms>] - [--reset | -r ] - [--force ] - [--timeout=<timeout> | -t <timeout> ] + [--lbaf=<lbaf> | -l <lbaf>] + [--block-size=<block size | -b <block size>] + [--ses=<ses> | -s <ses>] [--pil=<pil> | -p <pil>] + [--pi=<pi> | -i <pi>] [--ms=<ms> | -m <ms>] + [--reset | -r] [--force] + [--timeout=<timeout> | -t <timeout>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -135,6 +133,15 @@ cryptographically. This is accomplished by deleting the encryption key. --timeout=<timeout>:: Override default timeout value. In milliseconds. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Format the device using all defaults: diff --git a/Documentation/nvme-fw-commit.1 b/Documentation/nvme-fw-commit.1 index 748b9b0..d002b07 100644 --- a/Documentation/nvme-fw-commit.1 +++ b/Documentation/nvme-fw-commit.1 @@ -2,12 +2,12 @@ .\" Title: nvme-fw-commit .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-FW\-COMMIT" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-FW\-COMMIT" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,8 +33,9 @@ nvme-fw-commit \- Used to verify and commit a firmware image\&. .sp .nf \fInvme fw\-commit\fR <device> [\-\-slot=<slot> | \-s <slot>] - [\-\-action=<action> | \-a <action>] - [\-\-bpid=<boot\-partid> | \-b <boot\-partid> ] + [\-\-action=<action> | \-a <action>] + [\-\-bpid=<boot\-partid> | \-b <boot\-partid>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -117,6 +118,20 @@ Firmware Slot: Specifies the firmware slot that shall be used for the Commit Act .RS 4 Specifies the Boot partition that shall be used for the Commit Action, if applicable (default: 0) .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-fw-commit.html b/Documentation/nvme-fw-commit.html index 3b84432..82f1b8e 100644 --- a/Documentation/nvme-fw-commit.html +++ b/Documentation/nvme-fw-commit.html @@ -750,8 +750,9 @@ nvme-fw-commit(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme fw-commit</em> <device> [--slot=<slot> | -s <slot>]
- [--action=<action> | -a <action>]
- [--bpid=<boot-partid> | -b <boot-partid> ]</pre>
+ [--action=<action> | -a <action>]
+ [--bpid=<boot-partid> | -b <boot-partid>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -869,6 +870,29 @@ BPINFO.ABPID.</p></td> if applicable (default: 0)
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -905,7 +929,7 @@ commit the last downloaded fw to slot 1. <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-fw-commit.txt b/Documentation/nvme-fw-commit.txt index 337e783..8e08bd4 100644 --- a/Documentation/nvme-fw-commit.txt +++ b/Documentation/nvme-fw-commit.txt @@ -9,8 +9,9 @@ SYNOPSIS -------- [verse] 'nvme fw-commit' <device> [--slot=<slot> | -s <slot>] - [--action=<action> | -a <action>] - [--bpid=<boot-partid> | -b <boot-partid> ] + [--action=<action> | -a <action>] + [--bpid=<boot-partid> | -b <boot-partid>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -75,6 +76,15 @@ BPINFO.ABPID. Specifies the Boot partition that shall be used for the Commit Action, if applicable (default: 0) +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * commit the last downloaded fw to slot 1. diff --git a/Documentation/nvme-fw-download.1 b/Documentation/nvme-fw-download.1 index 6839e72..39e181b 100644 --- a/Documentation/nvme-fw-download.1 +++ b/Documentation/nvme-fw-download.1 @@ -2,12 +2,12 @@ .\" Title: nvme-fw-download .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-FW\-DOWNLOAD" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-FW\-DOWNLOAD" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,8 +33,9 @@ nvme-fw-download \- Download all or a portion of an nvme firmware image\&. .sp .nf \fInvme fw\-download\fR <device> [\-\-fw=<firmware\-file> | \-f <firmware\-file>] - [\-\-xfer=<transfer\-size> | \-x <transfer\-size>] - [\-\-offset=<offset> | \-o <offset>] + [\-\-xfer=<transfer\-size> | \-x <transfer\-size>] + [\-\-offset=<offset> | \-O <offset>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -55,12 +56,26 @@ Required argument\&. This specifies the path to the device\(cqs firmware file on This specifies the size to split each transfer\&. This is useful if the device has a max transfer size requirement for firmware\&. It defaults to 4k\&. .RE .PP -\-o <offset>, \-\-offset=<offset> +\-O <offset>, \-\-offset=<offset> .RS 4 This specifies the starting offset in dwords\&. This is really only useful if your firmware is split in multiple files; otherwise the offset starts at zero and automatically adjusts based on the \fIxfer\fR size given\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-fw-download.html b/Documentation/nvme-fw-download.html index 2ca7499..d39f1e5 100644 --- a/Documentation/nvme-fw-download.html +++ b/Documentation/nvme-fw-download.html @@ -750,8 +750,9 @@ nvme-fw-download(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme fw-download</em> <device> [--fw=<firmware-file> | -f <firmware-file>]
- [--xfer=<transfer-size> | -x <transfer-size>]
- [--offset=<offset> | -o <offset>]</pre>
+ [--xfer=<transfer-size> | -x <transfer-size>]
+ [--offset=<offset> | -O <offset>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -809,7 +810,7 @@ the Firmware Commit command (nvme fw-commit <args>).</p></div> </p>
</dd>
<dt class="hdlist1">
--o <offset>
+-O <offset>
</dt>
<dt class="hdlist1">
--offset=<offset>
@@ -822,6 +823,29 @@ the Firmware Commit command (nvme fw-commit <args>).</p></div> <em>xfer</em> size given.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -852,7 +876,7 @@ Transfer a firmware size 128KiB at a time: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-fw-download.txt b/Documentation/nvme-fw-download.txt index 84e407e..1ec466f 100644 --- a/Documentation/nvme-fw-download.txt +++ b/Documentation/nvme-fw-download.txt @@ -9,8 +9,9 @@ SYNOPSIS -------- [verse] 'nvme fw-download' <device> [--fw=<firmware-file> | -f <firmware-file>] - [--xfer=<transfer-size> | -x <transfer-size>] - [--offset=<offset> | -o <offset>] + [--xfer=<transfer-size> | -x <transfer-size>] + [--offset=<offset> | -O <offset>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -48,13 +49,22 @@ OPTIONS the device has a max transfer size requirement for firmware. It defaults to 4k. --o <offset>:: +-O <offset>:: --offset=<offset>:: This specifies the starting offset in dwords. This is really only useful if your firmware is split in multiple files; otherwise the offset starts at zero and automatically adjusts based on the 'xfer' size given. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Transfer a firmware size 128KiB at a time: diff --git a/Documentation/nvme-fw-log.1 b/Documentation/nvme-fw-log.1 index 09f9bdd..63fe225 100644 --- a/Documentation/nvme-fw-log.1 +++ b/Documentation/nvme-fw-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-fw-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-FW\-LOG" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-FW\-LOG" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,7 +33,7 @@ nvme-fw-log \- Send NVMe Firmware log page request, returns result and log .sp .nf \fInvme fw\-log\fR <device> [\-\-raw\-binary | \-b] - [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -49,13 +49,19 @@ On success, the returned f/w log structure may be returned in one of several way Print the raw fw log buffer to stdout\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-fw-log.html b/Documentation/nvme-fw-log.html index 37d313d..627d5d9 100644 --- a/Documentation/nvme-fw-log.html +++ b/Documentation/nvme-fw-log.html @@ -750,7 +750,7 @@ nvme-fw-log(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme fw-log</em> <device> [--raw-binary | -b]
- [--output-format=<fmt> | -o <fmt>]</pre>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -784,15 +784,26 @@ printed to stdout for another program to parse.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -835,7 +846,7 @@ Print the log firmware to a file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-fw-log.txt b/Documentation/nvme-fw-log.txt index 4b73577..d957548 100644 --- a/Documentation/nvme-fw-log.txt +++ b/Documentation/nvme-fw-log.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] 'nvme fw-log' <device> [--raw-binary | -b] - [--output-format=<fmt> | -o <fmt>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -30,11 +30,14 @@ OPTIONS --raw-binary:: Print the raw fw log buffer to stdout. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-gen-dhchap-key.txt b/Documentation/nvme-gen-dhchap-key.txt index 79e8ed5..1e5f969 100644 --- a/Documentation/nvme-gen-dhchap-key.txt +++ b/Documentation/nvme-gen-dhchap-key.txt @@ -9,9 +9,10 @@ SYNOPSIS -------- [verse] 'nvme gen-dhchap-key' [--hmac=<hmac-id> | -h <hmac-id>] - [--secret=<secret> | -s <secret> ] - [--key-length=<len> | -l <len> ] - [--nqn=<host-nqn> | -n <host-nqn> ] + [--secret=<secret> | -s <secret>] + [--key-length=<len> | -l <len>] + [--nqn=<host-nqn> | -n <host-nqn>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -43,6 +44,15 @@ OPTIONS Host-NQN to be used for the transformation. This parameter is only valid if a non-zero HMAC function has been specified. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No Examples diff --git a/Documentation/nvme-gen-hostnqn.1 b/Documentation/nvme-gen-hostnqn.1 index 37e9229..abdba4c 100644 --- a/Documentation/nvme-gen-hostnqn.1 +++ b/Documentation/nvme-gen-hostnqn.1 @@ -2,12 +2,12 @@ .\" Title: nvme-gen-hostnqn .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-GEN\-HOSTNQN" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-GEN\-HOSTNQN" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,14 +32,26 @@ nvme-gen-hostnqn \- Generate a host NVMe Qualified Name .SH "SYNOPSIS" .sp .nf -\fInvme gen\-hostnqn\fR +\fInvme gen\-hostnqn\fR [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp Generate a random host NQN in the form: nqn\&.2014\-08\&.org\&.nvmexpress:uuid:1b4e28ba\-2fa1\-11d2\-883f\-0016d3cca427 and prints it to stdout\&. .SH "OPTIONS" -.sp -No options needed +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp nvme gen\-hostnqn diff --git a/Documentation/nvme-gen-hostnqn.html b/Documentation/nvme-gen-hostnqn.html index 4ae8da7..c4ee073 100644 --- a/Documentation/nvme-gen-hostnqn.html +++ b/Documentation/nvme-gen-hostnqn.html @@ -749,7 +749,7 @@ nvme-gen-hostnqn(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme gen-hostnqn</em></pre>
+<pre class="content"><em>nvme gen-hostnqn</em> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -765,7 +765,31 @@ and prints it to stdout.</p></div> <div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
-<div class="paragraph"><p>No options needed</p></div>
+<div class="dlist"><dl>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
+</dl></div>
</div>
</div>
<div class="sect1">
@@ -785,7 +809,7 @@ and prints it to stdout.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-gen-hostnqn.txt b/Documentation/nvme-gen-hostnqn.txt index 9efefb5..7b7d776 100644 --- a/Documentation/nvme-gen-hostnqn.txt +++ b/Documentation/nvme-gen-hostnqn.txt @@ -8,7 +8,7 @@ nvme-gen-hostnqn - Generate a host NVMe Qualified Name SYNOPSIS -------- [verse] -'nvme gen-hostnqn' +'nvme gen-hostnqn' [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -18,7 +18,14 @@ and prints it to stdout. OPTIONS ------- -No options needed +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-gen-tls-key.txt b/Documentation/nvme-gen-tls-key.txt index 9a03e3a..772c7bc 100644 --- a/Documentation/nvme-gen-tls-key.txt +++ b/Documentation/nvme-gen-tls-key.txt @@ -9,24 +9,29 @@ SYNOPSIS -------- [verse] 'nvme gen-tls-key' [--keyring=<name> | -k <name>] - [--keytype=<type> | -t <type> ] - [--hostnqn=<nqn> | -n <nqn>] - [--subsysnqn=<nqn> | -c <nqn>] - [--hmac=<hmac-id> | -h <hmac-id>] - [--secret=<secret> | -s <secret> ] - [--insert | -i ] + [--keytype=<type> | -t <type>] + [--hostnqn=<nqn> | -n <nqn>] + [--subsysnqn=<nqn> | -c <nqn>] + [--hmac=<hmac-id> | -h <hmac-id>] + [--identity=<id-vers> | -I <id-vers>] + [--secret=<secret> | -s <secret>] + [--insert | -i] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- Generate a base64-encoded NVMe TLS pre-shared key (PSK). The resulting key is either printed in the PSK interchange format -'NVMeTLSkey-1:01:<base64 encoded data>:', -inserted as a 'retained' key into the specified keyring, or both. +'NVMeTLSkey-1:01:<base64 encoded data>:' or inserted as a +'retained' key into the specified keyring if the '--insert' option +is given. When the PSK should be inserted into the keyring a 'retained' key -is derived from the secret key material, and the resulting 'retained' +is derived from the secret key material. The resulting 'retained' key is stored with the identity 'NVMe0R0<hmac> <host NQN> <subsystem NQN>' -in the keyring. +(for identity version '0') or +'NVMe1R0<hmac> <host NQN> <subsystem NQN> <PSK hash>' +(for identity version '1') in the keyring. The 'retained' key is derived from the secret key material, the specified subsystem NQN, and the host NQN. Once the 'retained' key is stored in the keyring the original @@ -60,6 +65,12 @@ OPTIONS 1 - SHA-256 (default) 2 - SHA-384 +-I <vers>:: +--identity=<id-vers>:: + Select the TLS identity to use. Possible values are: + 0 - Original NVMe TLS 1.0c identity + 1 - NVMe TLS 2.0 (TP8018) identity + -s <secret>:: --secret=<secret>:: Secret value (in hexadecimal) to be used for the key. If none are @@ -70,6 +81,15 @@ OPTIONS Insert the resulting TLS key into the keyring without printing out the key in PSK interchange format. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No Examples diff --git a/Documentation/nvme-get-feature.1 b/Documentation/nvme-get-feature.1 index 015d5c2..ea7653a 100644 --- a/Documentation/nvme-get-feature.1 +++ b/Documentation/nvme-get-feature.1 @@ -2,12 +2,12 @@ .\" Title: nvme-get-feature .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-GET\-FEATURE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-GET\-FEATURE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,12 +33,13 @@ nvme-get-feature \- Gets an NVMe feature, returns applicable results .sp .nf \fInvme get\-feature\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-feature\-id=<fid> | \-f <fid>] [\-\-cdw11=<cdw11>] - [\-\-uuid\-index=<uuid\-index> | \-U <uuid_index>] - [\-\-data\-len=<data\-len> | \-l <data\-len>] - [\-\-sel=<select> | \-s <select>] - [\-\-raw\-binary | \-b] - [\-\-human\-readable | \-H] + [\-\-feature\-id=<fid> | \-f <fid>] [\-\-cdw11=<cdw11>] + [\-\-uuid\-index=<uuid\-index> | \-U <uuid_index>] + [\-\-data\-len=<data\-len> | \-l <data\-len>] + [\-\-sel=<select> | \-s <select>] + [\-\-raw\-binary | \-b] + [\-\-human\-readable | \-H] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -128,6 +129,20 @@ Print the raw feature buffer to stdout if the feature returns a structure\&. .RS 4 This option will parse and format many of the bit fields into human\-readable formats\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-get-feature.html b/Documentation/nvme-get-feature.html index 7752e56..6ee42ae 100644 --- a/Documentation/nvme-get-feature.html +++ b/Documentation/nvme-get-feature.html @@ -750,12 +750,13 @@ nvme-get-feature(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme get-feature</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--feature-id=<fid> | -f <fid>] [--cdw11=<cdw11>]
- [--uuid-index=<uuid-index> | -U <uuid_index>]
- [--data-len=<data-len> | -l <data-len>]
- [--sel=<select> | -s <select>]
- [--raw-binary | -b]
- [--human-readable | -H]</pre>
+ [--feature-id=<fid> | -f <fid>] [--cdw11=<cdw11>]
+ [--uuid-index=<uuid-index> | -U <uuid_index>]
+ [--data-len=<data-len> | -l <data-len>]
+ [--sel=<select> | -s <select>]
+ [--raw-binary | -b]
+ [--human-readable | -H]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -906,6 +907,29 @@ cellspacing="0" cellpadding="4"> into human-readable formats.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -977,7 +1001,7 @@ format: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-get-feature.txt b/Documentation/nvme-get-feature.txt index 34df0c3..6477bc6 100644 --- a/Documentation/nvme-get-feature.txt +++ b/Documentation/nvme-get-feature.txt @@ -9,12 +9,13 @@ SYNOPSIS -------- [verse] 'nvme get-feature' <device> [--namespace-id=<nsid> | -n <nsid>] - [--feature-id=<fid> | -f <fid>] [--cdw11=<cdw11>] - [--uuid-index=<uuid-index> | -U <uuid_index>] - [--data-len=<data-len> | -l <data-len>] - [--sel=<select> | -s <select>] - [--raw-binary | -b] - [--human-readable | -H] + [--feature-id=<fid> | -f <fid>] [--cdw11=<cdw11>] + [--uuid-index=<uuid-index> | -U <uuid_index>] + [--data-len=<data-len> | -l <data-len>] + [--sel=<select> | -s <select>] + [--raw-binary | -b] + [--human-readable | -H] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -81,6 +82,15 @@ OPTIONS This option will parse and format many of the bit fields into human-readable formats. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Retrieves the feature for Number of Queues, or feature id 7: diff --git a/Documentation/nvme-get-lba-status.1 b/Documentation/nvme-get-lba-status.1 index b42f2e5..97efab3 100644 --- a/Documentation/nvme-get-lba-status.1 +++ b/Documentation/nvme-get-lba-status.1 @@ -2,12 +2,12 @@ .\" Title: nvme-get-lba-status .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-GET\-LBA\-STAT" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-GET\-LBA\-STAT" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,12 +33,12 @@ nvme-get-lba-status \- Get LBA Status from NVMe device .sp .nf \fInvme get\-lba\-status\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-start\-lba=<slba> | \-s <slba>] - [\-\-max\-dw=<max\-dw> | \-m <max\-dw>] - [\-\-action=<action\-type> | \-a <action\-type>] - [\-\-range\-len=<range\-len> | \-l <range\-len>] - [\-\-timeout=<timeout> | \-t <timeout> ] - [\-\-output\-format=<format> | \-o <format>] + [\-\-start\-lba=<slba> | \-s <slba>] + [\-\-max\-dw=<max\-dw> | \-m <max\-dw>] + [\-\-action=<action\-type> | \-a <action\-type>] + [\-\-range\-len=<range\-len> | \-l <range\-len>] + [\-\-timeout=<timeout> | \-t <timeout>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -79,13 +79,19 @@ Range Length(RL) specifies the length of the range of contiguous LBAs beginning Override default timeout value\&. In milliseconds\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-get-lba-status.html b/Documentation/nvme-get-lba-status.html index c1a03a4..e739871 100644 --- a/Documentation/nvme-get-lba-status.html +++ b/Documentation/nvme-get-lba-status.html @@ -750,12 +750,12 @@ nvme-get-lba-status(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme get-lba-status</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--start-lba=<slba> | -s <slba>]
- [--max-dw=<max-dw> | -m <max-dw>]
- [--action=<action-type> | -a <action-type>]
- [--range-len=<range-len> | -l <range-len>]
- [--timeout=<timeout> | -t <timeout> ]
- [--output-format=<format> | -o <format>]</pre>
+ [--start-lba=<slba> | -s <slba>]
+ [--max-dw=<max-dw> | -m <max-dw>]
+ [--action=<action-type> | -a <action-type>]
+ [--range-len=<range-len> | -l <range-len>]
+ [--timeout=<timeout> | -t <timeout>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -846,15 +846,26 @@ printed to stdout for another program to parse.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -896,7 +907,7 @@ Get LBA Status of the namespace 1 from SLBA 10 for the max Dwords of 0x1000 <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-get-lba-status.txt b/Documentation/nvme-get-lba-status.txt index 157dc41..9ef9d59 100644 --- a/Documentation/nvme-get-lba-status.txt +++ b/Documentation/nvme-get-lba-status.txt @@ -9,12 +9,12 @@ SYNOPSIS -------- [verse] 'nvme get-lba-status' <device> [--namespace-id=<nsid> | -n <nsid>] - [--start-lba=<slba> | -s <slba>] - [--max-dw=<max-dw> | -m <max-dw>] - [--action=<action-type> | -a <action-type>] - [--range-len=<range-len> | -l <range-len>] - [--timeout=<timeout> | -t <timeout> ] - [--output-format=<format> | -o <format>] + [--start-lba=<slba> | -s <slba>] + [--max-dw=<max-dw> | -m <max-dw>] + [--action=<action-type> | -a <action-type>] + [--range-len=<range-len> | -l <range-len>] + [--timeout=<timeout> | -t <timeout>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -57,10 +57,14 @@ OPTIONS --timeout=<timeout>:: Override default timeout value. In milliseconds. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-get-log.1 b/Documentation/nvme-get-log.1 index 804e18c..66a3573 100644 --- a/Documentation/nvme-get-log.1 +++ b/Documentation/nvme-get-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-get-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-GET\-LOG" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-GET\-LOG" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,17 +33,18 @@ nvme-get-log \- Retrieves a log page from an NVMe device .sp .nf \fInvme get\-log\fR <device> [\-\-log\-id=<log\-id> | \-i <log\-id>] - [\-\-log\-len=<log\-len> | \-l <log\-len>] - [\-\-aen=<aen> | \-a <aen>] - [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-raw\-binary | \-b] - [\-\-lpo=<offset> | \-o <offset>] - [\-\-lsp=<field> | \-s <field>] - [\-\-lsi=<field> | \-S <field>] - [\-\-rae | \-r] - [\-\-csi=<command_set_identifier> | \-y <command_set_identifier>] - [\-\-ot=<offset_type> | \-O <offset_type>] - [\-\-xfer\-len=<length> | \-x <length>] + [\-\-log\-len=<log\-len> | \-l <log\-len>] + [\-\-aen=<aen> | \-a <aen>] + [\-\-namespace\-id=<nsid> | \-n <nsid>] + [\-\-raw\-binary | \-b] + [\-\-lpo=<offset> | \-L <offset>] + [\-\-lsp=<field> | \-s <field>] + [\-\-lsi=<field> | \-S <field>] + [\-\-rae | \-r] + [\-\-csi=<command_set_identifier> | \-y <command_set_identifier>] + [\-\-ot=<offset_type> | \-O <offset_type>] + [\-\-xfer\-len=<length> | \-x <length>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -79,7 +80,7 @@ Sets the command\(cqs nsid value to the given nsid\&. Defaults to 0xffffffff if Print the raw log buffer to stdout\&. .RE .PP -\-o <offset>, \-\-lpo=<offset> +\-L <offset>, \-\-lpo=<offset> .RS 4 The log page offset specifies the location within a log page to start returning data from\&. It\(cqs Dword\-aligned and 64\-bits\&. .RE @@ -113,6 +114,20 @@ This field specifies the offset type\&. If set to false, the Log Page Offset Low .RS 4 \-\-xfer\-len <length>: Specify the read chunk size\&. The length argument is expected to be a multiple of 4096\&. The default size is 4096\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-get-log.html b/Documentation/nvme-get-log.html index 6480f1b..2c25c2b 100644 --- a/Documentation/nvme-get-log.html +++ b/Documentation/nvme-get-log.html @@ -750,17 +750,18 @@ nvme-get-log(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme get-log</em> <device> [--log-id=<log-id> | -i <log-id>]
- [--log-len=<log-len> | -l <log-len>]
- [--aen=<aen> | -a <aen>]
- [--namespace-id=<nsid> | -n <nsid>]
- [--raw-binary | -b]
- [--lpo=<offset> | -o <offset>]
- [--lsp=<field> | -s <field>]
- [--lsi=<field> | -S <field>]
- [--rae | -r]
- [--csi=<command_set_identifier> | -y <command_set_identifier>]
- [--ot=<offset_type> | -O <offset_type>]
- [--xfer-len=<length> | -x <length>]</pre>
+ [--log-len=<log-len> | -l <log-len>]
+ [--aen=<aen> | -a <aen>]
+ [--namespace-id=<nsid> | -n <nsid>]
+ [--raw-binary | -b]
+ [--lpo=<offset> | -L <offset>]
+ [--lsp=<field> | -s <field>]
+ [--lsi=<field> | -S <field>]
+ [--rae | -r]
+ [--csi=<command_set_identifier> | -y <command_set_identifier>]
+ [--ot=<offset_type> | -O <offset_type>]
+ [--xfer-len=<length> | -x <length>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -845,7 +846,7 @@ program to parse.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <offset>
+-L <offset>
</dt>
<dt class="hdlist1">
--lpo=<offset>
@@ -929,6 +930,29 @@ program to parse.</p></div> a multiple of 4096. The default size is 4096.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -973,7 +997,7 @@ Have the program return the raw log page in binary: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-get-log.txt b/Documentation/nvme-get-log.txt index a51c435..98b1f9c 100644 --- a/Documentation/nvme-get-log.txt +++ b/Documentation/nvme-get-log.txt @@ -9,17 +9,18 @@ SYNOPSIS -------- [verse] 'nvme get-log' <device> [--log-id=<log-id> | -i <log-id>] - [--log-len=<log-len> | -l <log-len>] - [--aen=<aen> | -a <aen>] - [--namespace-id=<nsid> | -n <nsid>] - [--raw-binary | -b] - [--lpo=<offset> | -o <offset>] - [--lsp=<field> | -s <field>] - [--lsi=<field> | -S <field>] - [--rae | -r] - [--csi=<command_set_identifier> | -y <command_set_identifier>] - [--ot=<offset_type> | -O <offset_type>] - [--xfer-len=<length> | -x <length>] + [--log-len=<log-len> | -l <log-len>] + [--aen=<aen> | -a <aen>] + [--namespace-id=<nsid> | -n <nsid>] + [--raw-binary | -b] + [--lpo=<offset> | -L <offset>] + [--lsp=<field> | -s <field>] + [--lsi=<field> | -S <field>] + [--rae | -r] + [--csi=<command_set_identifier> | -y <command_set_identifier>] + [--ot=<offset_type> | -O <offset_type>] + [--xfer-len=<length> | -x <length>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -63,7 +64,7 @@ OPTIONS --raw-binary:: Print the raw log buffer to stdout. --o <offset>:: +-L <offset>:: --lpo=<offset>:: The log page offset specifies the location within a log page to start returning data from. It's Dword-aligned and 64-bits. @@ -101,6 +102,15 @@ OPTIONS Specify the read chunk size. The length argument is expected to be a multiple of 4096. The default size is 4096. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Get 512 bytes from log page 2 diff --git a/Documentation/nvme-get-ns-id.1 b/Documentation/nvme-get-ns-id.1 index e42c26e..f317c17 100644 --- a/Documentation/nvme-get-ns-id.1 +++ b/Documentation/nvme-get-ns-id.1 @@ -2,12 +2,12 @@ .\" Title: nvme-get-ns-id .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-GET\-NS\-ID" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-GET\-NS\-ID" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,14 +32,26 @@ nvme-get-ns-id \- Retrieves the namespace ID for an NVMe block device .SH "SYNOPSIS" .sp .nf -\fInvme get\-ns\-id\fR <device> +\fInvme get\-ns\-id\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp Retrieves the namespace ID for an NVMe block device\&. The <device> param is mandatory and must be an NVMe block device (ex: /dev/nvme0n1)\&. .SH "OPTIONS" -.sp -None +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-get-ns-id.html b/Documentation/nvme-get-ns-id.html index e4f0838..dcdc39e 100644 --- a/Documentation/nvme-get-ns-id.html +++ b/Documentation/nvme-get-ns-id.html @@ -749,7 +749,7 @@ nvme-get-ns-id(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme get-ns-id</em> <device></pre>
+<pre class="content"><em>nvme get-ns-id</em> <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -764,7 +764,31 @@ is mandatory and must be an NVMe block device (ex: /dev/nvme0n1).</p></div> <div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
-<div class="paragraph"><p>None</p></div>
+<div class="dlist"><dl>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
+</dl></div>
</div>
</div>
<div class="sect1">
@@ -794,7 +818,7 @@ Shows the namespace id for the given block device: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-get-ns-id.txt b/Documentation/nvme-get-ns-id.txt index 5dcdc6d..8516cb8 100644 --- a/Documentation/nvme-get-ns-id.txt +++ b/Documentation/nvme-get-ns-id.txt @@ -8,7 +8,7 @@ nvme-get-ns-id - Retrieves the namespace ID for an NVMe block device SYNOPSIS -------- [verse] -'nvme get-ns-id' <device> +'nvme get-ns-id' <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -17,7 +17,14 @@ is mandatory and must be an NVMe block device (ex: /dev/nvme0n1). OPTIONS ------- -None +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-get-property.1 b/Documentation/nvme-get-property.1 index 6735f12..79ed8c6 100644 --- a/Documentation/nvme-get-property.1 +++ b/Documentation/nvme-get-property.1 @@ -2,12 +2,12 @@ .\" Title: nvme-get-property .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-GET\-PROPERTY" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-GET\-PROPERTY" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,15 +32,16 @@ nvme-get-property \- Reads and shows the defined NVMe controller property for NV .SH "SYNOPSIS" .sp .nf -\fInvme get\-property\fR <device> [\-\-offset=<offset> | \-o <offset>] - [\-\-human\-readable | \-H ] +\fInvme get\-property\fR <device> [\-\-offset=<offset> | \-O <offset>] + [\-\-human\-readable | \-H] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp Reads and shows the defined NVMe controller property for NVMe over Fabric\&. .SH "OPTIONS" .PP -\-o, \-\-offset +\-O, \-\-offset .RS 4 The offset of the property\&. One of CAP=0x0, VS=0x8, CC=0x14, CSTS=0x1c, NSSR=0x20 .RE @@ -49,6 +50,20 @@ The offset of the property\&. One of CAP=0x0, VS=0x8, CC=0x14, CSTS=0x1c, NSSR=0 .RS 4 \-\-human\-readable: Show the fields packed in the property .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-get-property.html b/Documentation/nvme-get-property.html index f6ebe4f..9b2a793 100644 --- a/Documentation/nvme-get-property.html +++ b/Documentation/nvme-get-property.html @@ -749,8 +749,9 @@ nvme-get-property(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme get-property</em> <device> [--offset=<offset> | -o <offset>]
- [--human-readable | -H ]</pre>
+<pre class="content"><em>nvme get-property</em> <device> [--offset=<offset> | -O <offset>]
+ [--human-readable | -H]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -766,7 +767,7 @@ nvme-get-property(1) Manual Page <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o
+-O
</dt>
<dt class="hdlist1">
--offset
@@ -785,6 +786,29 @@ nvme-get-property(1) Manual Page Show the fields packed in the property
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -843,7 +867,7 @@ Then look for NVMe Fabrics command (0x7f) at trace <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-get-property.txt b/Documentation/nvme-get-property.txt index b2b7d29..601b8a4 100644 --- a/Documentation/nvme-get-property.txt +++ b/Documentation/nvme-get-property.txt @@ -9,25 +9,32 @@ for NVMe over Fabric SYNOPSIS -------- [verse] -'nvme get-property' <device> [--offset=<offset> | -o <offset>] - [--human-readable | -H ] - +'nvme get-property' <device> [--offset=<offset> | -O <offset>] + [--human-readable | -H] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- Reads and shows the defined NVMe controller property for NVMe over Fabric. - OPTIONS ------- --o:: +-O:: --offset:: - The offset of the property. One of CAP=0x0, VS=0x8, CC=0x14, CSTS=0x1c, NSSR=0x20 + The offset of the property. One of CAP=0x0, VS=0x8, CC=0x14, CSTS=0x1c, NSSR=0x20 -H:: --human-readable: Show the fields packed in the property +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- @@ -37,7 +44,6 @@ EXAMPLES # nvme get-property /dev/nvme0 --offset=0x0 --human-readable ------------ - BUGS ---- Currently the CAP value is truncated to 32 bits due to a limitation in diff --git a/Documentation/nvme-help.1 b/Documentation/nvme-help.1 index 4b68960..e22061a 100644 --- a/Documentation/nvme-help.1 +++ b/Documentation/nvme-help.1 @@ -2,12 +2,12 @@ .\" Title: nvme-help .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-HELP" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-HELP" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-help.html b/Documentation/nvme-help.html index 102d647..3091633 100644 --- a/Documentation/nvme-help.html +++ b/Documentation/nvme-help.html @@ -794,7 +794,7 @@ Show help for nvme smart log: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-huawei-id-ctrl.1 b/Documentation/nvme-huawei-id-ctrl.1 index 2d11b8b..570bb01 100644 --- a/Documentation/nvme-huawei-id-ctrl.1 +++ b/Documentation/nvme-huawei-id-ctrl.1 @@ -2,12 +2,12 @@ .\" Title: nvme-huawei-id-ctrl .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-HUAWEI\-ID\-CT" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-HUAWEI\-ID\-CT" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,8 +32,8 @@ nvme-huawei-id-ctrl \- Send NVMe Identify Controller, return result and structur .SH "SYNOPSIS" .sp .nf -\fInvme huawei id\-ctrl\fR <device> [\-v | \-\-vendor\-specific] [\-b | \-\-raw\-binary] - [\-o <fmt> | \-\-output\-format=<fmt>] +\fInvme huawei id\-ctrl\fR <device> [\-\-vendor\-specific | \-v] [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp @@ -63,7 +63,7 @@ In addition to parsing known fields, this option will dump the vendor specific r This option will parse and format many of the bit fields into human\-readable formats\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-huawei-id-ctrl.html b/Documentation/nvme-huawei-id-ctrl.html index 608a2ac..2bbd642 100644 --- a/Documentation/nvme-huawei-id-ctrl.html +++ b/Documentation/nvme-huawei-id-ctrl.html @@ -749,8 +749,8 @@ nvme-huawei-id-ctrl(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme huawei id-ctrl</em> <device> [-v | --vendor-specific] [-b | --raw-binary]
- [-o <fmt> | --output-format=<fmt>]</pre>
+<pre class="content"><em>nvme huawei id-ctrl</em> <device> [--vendor-specific | -v] [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -813,15 +813,15 @@ will decode Huawei vendor unique portions of the structure.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em>, or
+ <em>binary</em>. Only one output format can be used at a time.
</p>
</dd>
</dl></div>
@@ -855,7 +855,7 @@ fields in a human readable format: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-huawei-id-ctrl.txt b/Documentation/nvme-huawei-id-ctrl.txt index f4d2f80..47225d1 100644 --- a/Documentation/nvme-huawei-id-ctrl.txt +++ b/Documentation/nvme-huawei-id-ctrl.txt @@ -8,8 +8,8 @@ nvme-huawei-id-ctrl - Send NVMe Identify Controller, return result and structure SYNOPSIS -------- [verse] -'nvme huawei id-ctrl' <device> [-v | --vendor-specific] [-b | --raw-binary] - [-o <fmt> | --output-format=<fmt>] +'nvme huawei id-ctrl' <device> [--vendor-specific | -v] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- @@ -47,10 +47,10 @@ OPTIONS This option will parse and format many of the bit fields into human-readable formats. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json', or + 'binary'. Only one output format can be used at a time. EXAMPLES -------- diff --git a/Documentation/nvme-huawei-list.1 b/Documentation/nvme-huawei-list.1 index f093e7e..70a1da9 100644 --- a/Documentation/nvme-huawei-list.1 +++ b/Documentation/nvme-huawei-list.1 @@ -2,12 +2,12 @@ .\" Title: nvme-list .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-LIST" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-LIST" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,14 +32,14 @@ nvme-huawei-list \- List all recognized Huawei NVMe devices .SH "SYNOPSIS" .sp .nf -\fInvme huawei list\fR [\-o <fmt> | \-\-output\-format=<fmt>] +\fInvme huawei list\fR [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp Scan the sysfs tree for NVM Express devices and return the /dev node for those Huawei devices as well as some pertinent information about them\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR diff --git a/Documentation/nvme-huawei-list.html b/Documentation/nvme-huawei-list.html index ef99034..c4e865f 100644 --- a/Documentation/nvme-huawei-list.html +++ b/Documentation/nvme-huawei-list.html @@ -749,7 +749,7 @@ nvme-list(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme huawei list</em> [-o <fmt> | --output-format=<fmt>]</pre>
+<pre class="content"><em>nvme huawei list</em> [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -766,10 +766,10 @@ for those Huawei devices as well as some pertinent information about them.</p></ <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -797,7 +797,7 @@ for those Huawei devices as well as some pertinent information about them.</p></ <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-huawei-list.txt b/Documentation/nvme-huawei-list.txt index 65a6c21..95f1099 100644 --- a/Documentation/nvme-huawei-list.txt +++ b/Documentation/nvme-huawei-list.txt @@ -8,7 +8,7 @@ nvme-huawei-list - List all recognized Huawei NVMe devices SYNOPSIS -------- [verse] -'nvme huawei list' [-o <fmt> | --output-format=<fmt>] +'nvme huawei list' [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- @@ -17,8 +17,8 @@ for those Huawei devices as well as some pertinent information about them. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal' or 'json'. Only one output format can be used at a time. diff --git a/Documentation/nvme-id-ctrl.1 b/Documentation/nvme-id-ctrl.1 index 0e4c7bc..f8acb1c 100644 --- a/Documentation/nvme-id-ctrl.1 +++ b/Documentation/nvme-id-ctrl.1 @@ -2,12 +2,12 @@ .\" Title: nvme-id-ctrl .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ID\-CTRL" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ID\-CTRL" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,8 +32,8 @@ nvme-id-ctrl \- Send NVMe Identify Controller, return result and structure .SH "SYNOPSIS" .sp .nf -\fInvme id\-ctrl\fR <device> [\-v | \-\-vendor\-specific] [\-b | \-\-raw\-binary] - [\-o <fmt> | \-\-output\-format=<fmt>] +\fInvme id\-ctrl\fR <device> [\-\-vendor\-specific | \-V] [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -49,7 +49,7 @@ On success, the structure may be returned in one of several ways depending on th Print the raw buffer to stdout\&. Structure is not parsed by program\&. This overrides the vendor specific and human readable options\&. .RE .PP -\-v, \-\-vendor\-specific +\-V, \-\-vendor\-specific .RS 4 In addition to parsing known fields, this option will dump the vendor specific region of the structure in hex with ascii interpretation\&. .RE @@ -59,13 +59,19 @@ In addition to parsing known fields, this option will dump the vendor specific r This option will parse and format many of the bit fields into human\-readable formats\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 @@ -104,7 +110,7 @@ In addition to showing the known fields, has the program to display the vendor u .\} .nf # nvme id\-ctrl /dev/nvme0 \-\-vendor\-specific -# nvme id\-ctrl /dev/nvme0 \-v +# nvme id\-ctrl /dev/nvme0 \-V .fi .if n \{\ .RE diff --git a/Documentation/nvme-id-ctrl.html b/Documentation/nvme-id-ctrl.html index 5de0ca2..40040e6 100644 --- a/Documentation/nvme-id-ctrl.html +++ b/Documentation/nvme-id-ctrl.html @@ -749,8 +749,8 @@ nvme-id-ctrl(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme id-ctrl</em> <device> [-v | --vendor-specific] [-b | --raw-binary]
- [-o <fmt> | --output-format=<fmt>]</pre>
+<pre class="content"><em>nvme id-ctrl</em> <device> [--vendor-specific | -V] [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -784,7 +784,7 @@ raw buffer may be printed to stdout.</p></div> </p>
</dd>
<dt class="hdlist1">
--v
+-V
</dt>
<dt class="hdlist1">
--vendor-specific
@@ -809,15 +809,26 @@ raw buffer may be printed to stdout.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
</dt>
<dt class="hdlist1">
---output-format=<format>
+--verbose
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -845,7 +856,7 @@ the vendor unique field: <div class="listingblock">
<div class="content">
<pre><code># nvme id-ctrl /dev/nvme0 --vendor-specific
-# nvme id-ctrl /dev/nvme0 -v</code></pre>
+# nvme id-ctrl /dev/nvme0 -V</code></pre>
</div></div>
<div class="paragraph"><p>The above will dump the <em>vs</em> buffer in hex since it doesn’t know how to
interpret it.</p></div>
@@ -910,7 +921,7 @@ int main(int argc, char **argv) <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-id-ctrl.txt b/Documentation/nvme-id-ctrl.txt index b9fcffc..3667c63 100644 --- a/Documentation/nvme-id-ctrl.txt +++ b/Documentation/nvme-id-ctrl.txt @@ -8,8 +8,8 @@ nvme-id-ctrl - Send NVMe Identify Controller, return result and structure SYNOPSIS -------- [verse] -'nvme id-ctrl' <device> [-v | --vendor-specific] [-b | --raw-binary] - [-o <fmt> | --output-format=<fmt>] +'nvme id-ctrl' <device> [--vendor-specific | -V] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -30,7 +30,7 @@ OPTIONS Print the raw buffer to stdout. Structure is not parsed by program. This overrides the vendor specific and human readable options. --v:: +-V:: --vendor-specific:: In addition to parsing known fields, this option will dump the vendor specific region of the structure in hex with ascii @@ -41,10 +41,14 @@ OPTIONS This option will parse and format many of the bit fields into human-readable formats. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- @@ -61,7 +65,7 @@ the vendor unique field: + ------------ # nvme id-ctrl /dev/nvme0 --vendor-specific -# nvme id-ctrl /dev/nvme0 -v +# nvme id-ctrl /dev/nvme0 -V ------------ + The above will dump the 'vs' buffer in hex since it doesn't know how to diff --git a/Documentation/nvme-id-domain.1 b/Documentation/nvme-id-domain.1 index 67304a1..b260dc0 100644 --- a/Documentation/nvme-id-domain.1 +++ b/Documentation/nvme-id-domain.1 @@ -2,12 +2,12 @@ .\" Title: nvme-id-domain .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ID\-DOMAIN" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ID\-DOMAIN" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,7 +33,7 @@ nvme-id-domain \- Send NVMe Identify Domain List, return result and structure .sp .nf \fInvme id\-domain\fR <device> [\-\-dom\-id=<domian_id> | \-d <domian_id>] - [\-o <fmt> | \-\-output\-format=<fmt>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -47,13 +47,19 @@ The <device> parameter is mandatory and may be either the NVMe character device Retrieve the identify domain list data structure for the given domain id\&. If this value is not given, domain id will be 0xffff\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet\&. diff --git a/Documentation/nvme-id-domain.html b/Documentation/nvme-id-domain.html index 02dfee8..6a22d19 100644 --- a/Documentation/nvme-id-domain.html +++ b/Documentation/nvme-id-domain.html @@ -750,7 +750,7 @@ nvme-id-domain(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme id-domain</em> <device> [--dom-id=<domian_id> | -d <domian_id>]
- [-o <fmt> | --output-format=<fmt>]</pre>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -781,15 +781,26 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -812,7 +823,7 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-id-domain.txt b/Documentation/nvme-id-domain.txt index 87883c5..1d6ec48 100644 --- a/Documentation/nvme-id-domain.txt +++ b/Documentation/nvme-id-domain.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] 'nvme id-domain' <device> [--dom-id=<domian_id> | -d <domian_id>] - [-o <fmt> | --output-format=<fmt>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -26,10 +26,14 @@ OPTIONS Retrieve the identify domain list data structure for the given domain id. If this value is not given, domain id will be 0xffff. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-id-iocs.1 b/Documentation/nvme-id-iocs.1 index 58ae111..942fe4e 100644 --- a/Documentation/nvme-id-iocs.1 +++ b/Documentation/nvme-id-iocs.1 @@ -2,12 +2,12 @@ .\" Title: nvme-id-iocs .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ID\-IOCS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ID\-IOCS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,7 +33,7 @@ nvme-id-iocs \- Send NVMe Identify I/O Command Set, return result and structure .sp .nf \fInvme id\-iocs\fR <device> [\-\-controller\-id=<cntid> | \-c <cntid>] - [\-o <fmt> | \-\-output\-format=<fmt>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -52,13 +52,19 @@ Retrieve the identify I/O Command set data structure for the given cntid\&. If t This option will parse and format many of the bit fields into human\-readable formats\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-id-iocs.html b/Documentation/nvme-id-iocs.html index f03b979..c823d1a 100644 --- a/Documentation/nvme-id-iocs.html +++ b/Documentation/nvme-id-iocs.html @@ -750,7 +750,7 @@ nvme-id-iocs(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme id-iocs</em> <device> [--controller-id=<cntid> | -c <cntid>]
- [-o <fmt> | --output-format=<fmt>]</pre>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -793,15 +793,26 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -844,7 +855,7 @@ show the fields in human readable format <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-id-iocs.txt b/Documentation/nvme-id-iocs.txt index a35217e..bb85aef 100644 --- a/Documentation/nvme-id-iocs.txt +++ b/Documentation/nvme-id-iocs.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] 'nvme id-iocs' <device> [--controller-id=<cntid> | -c <cntid>] - [-o <fmt> | --output-format=<fmt>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -30,10 +30,14 @@ OPTIONS This option will parse and format many of the bit fields into human-readable formats. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-id-ns-granularity.txt b/Documentation/nvme-id-ns-granularity.txt new file mode 100755 index 0000000..67006c3 --- /dev/null +++ b/Documentation/nvme-id-ns-granularity.txt @@ -0,0 +1,46 @@ +nvme-id-ns-granularity(1) +========================= + +NAME +---- +nvme-id-ns-granularity - Send a Identify Namespace Granularity List command to +the specified device + +SYNOPSIS +-------- +[verse] +'nvme id-ns-granularity' <device> + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] + +DESCRIPTION +----------- +Send a Identify Namespace Granularity List command command to the specified +device, return results. + +The <device> parameter is mandatory and may be either the NVMe character +device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1). + +On success it returns 0, error code otherwise. + +OPTIONS +------- +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + +EXAMPLES +-------- +* Has the program issue a id-ns-granularity to display structure. ++ +------------ +# nvme id-ns-granularity /dev/nvme0 +------------ + +NVME +---- +Part of the nvme-user suite. diff --git a/Documentation/nvme-id-ns-lba-format.txt b/Documentation/nvme-id-ns-lba-format.txt index 32df2f6..514ba48 100644 --- a/Documentation/nvme-id-ns-lba-format.txt +++ b/Documentation/nvme-id-ns-lba-format.txt @@ -9,9 +9,9 @@ SYNOPSIS -------- [verse] 'nvme id-ns' <device> [--uuid-index=<uuid-index> | -U <uuid_index>] - [--lba-format-index=<lba_format_index> | -i <lba_format_index>] - [-v | --verbose] - [--output-format=<fmt> | -o <fmt>] + [--lba-format-index=<lba_format_index> | -i <lba_format_index>] + [--verbose | -v] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -31,7 +31,7 @@ OPTIONS -U <uuid-index>:: --uuid-index=<uuid-index>:: UUID Index of the feature - + -i <lba_format_index>:: --lba-format-index=<lba_format_index>:: This field specifies the index into the LBA Format list identifying @@ -41,10 +41,10 @@ OPTIONS --verbose:: Increase the information detail in the output. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. EXAMPLES -------- diff --git a/Documentation/nvme-id-ns.1 b/Documentation/nvme-id-ns.1 index 4bac15e..be219cc 100644 --- a/Documentation/nvme-id-ns.1 +++ b/Documentation/nvme-id-ns.1 @@ -2,12 +2,12 @@ .\" Title: nvme-id-ns .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ID\-NS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ID\-NS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,10 +32,10 @@ nvme-id-ns \- Send NVMe Identify Namespace, return result and structure .SH "SYNOPSIS" .sp .nf -\fInvme id\-ns\fR <device> [\-v | \-\-vendor\-specific] [\-b | \-\-raw\-binary] - [\-\-namespace\-id=<nsid> | \-n <nsid>] [\-\-force] - [\-\-human\-readable | \-H] - [\-\-output\-format=<fmt> | \-o <fmt>] +\fInvme id\-ns\fR <device> [\-\-vendor\-specific | \-v] [\-\-raw\-binary | \-b] + [\-\-namespace\-id=<nsid> | \-n <nsid>] [\-\-force] + [\-\-human\-readable | \-H] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -61,7 +61,7 @@ Request controller return the identify namespace structure even if the namespace Print the raw buffer to stdout\&. Structure is not parsed by program\&. This overrides the vendor specific and human readable options\&. .RE .PP -\-v, \-\-vendor\-specific +\-V, \-\-vendor\-specific .RS 4 In addition to parsing known fields, this option will dump the vendor specific region of the structure in hex with ascii interpretation\&. .RE @@ -71,13 +71,19 @@ In addition to parsing known fields, this option will dump the vendor specific r This option will parse and format many of the bit fields into human\-readable formats\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 @@ -139,7 +145,7 @@ In addition to showing the known fields, have the program to display the vendor .\} .nf # nvme id\-ns /dev/nvme0n1 \-\-vendor\-specific -# nvme id\-ns /dev/nvme0n1 \-v +# nvme id\-ns /dev/nvme0n1 \-V .fi .if n \{\ .RE diff --git a/Documentation/nvme-id-ns.html b/Documentation/nvme-id-ns.html index 5ada031..48ac22b 100644 --- a/Documentation/nvme-id-ns.html +++ b/Documentation/nvme-id-ns.html @@ -749,10 +749,10 @@ nvme-id-ns(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme id-ns</em> <device> [-v | --vendor-specific] [-b | --raw-binary]
- [--namespace-id=<nsid> | -n <nsid>] [--force]
- [--human-readable | -H]
- [--output-format=<fmt> | -o <fmt>]</pre>
+<pre class="content"><em>nvme id-ns</em> <device> [--vendor-specific | -v] [--raw-binary | -b]
+ [--namespace-id=<nsid> | -n <nsid>] [--force]
+ [--human-readable | -H]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -817,7 +817,7 @@ raw buffer may be printed to stdout.</p></div> </p>
</dd>
<dt class="hdlist1">
--v
+-V
</dt>
<dt class="hdlist1">
--vendor-specific
@@ -842,15 +842,26 @@ raw buffer may be printed to stdout.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
</dt>
<dt class="hdlist1">
---output-format=<format>
+--verbose
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -889,7 +900,7 @@ the vendor unique field: <div class="listingblock">
<div class="content">
<pre><code># nvme id-ns /dev/nvme0n1 --vendor-specific
-# nvme id-ns /dev/nvme0n1 -v</code></pre>
+# nvme id-ns /dev/nvme0n1 -V</code></pre>
</div></div>
<div class="paragraph"><p>The above will dump the 'vs' buffer in hex since it doesn’t know how to
interpret it.</p></div>
@@ -955,7 +966,7 @@ int main(int argc, char **argv) <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-id-ns.txt b/Documentation/nvme-id-ns.txt index a2ac155..0791250 100644 --- a/Documentation/nvme-id-ns.txt +++ b/Documentation/nvme-id-ns.txt @@ -8,10 +8,10 @@ nvme-id-ns - Send NVMe Identify Namespace, return result and structure SYNOPSIS -------- [verse] -'nvme id-ns' <device> [-v | --vendor-specific] [-b | --raw-binary] - [--namespace-id=<nsid> | -n <nsid>] [--force] - [--human-readable | -H] - [--output-format=<fmt> | -o <fmt>] +'nvme id-ns' <device> [--vendor-specific | -v] [--raw-binary | -b] + [--namespace-id=<nsid> | -n <nsid>] [--force] + [--human-readable | -H] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -51,7 +51,7 @@ OPTIONS Print the raw buffer to stdout. Structure is not parsed by program. This overrides the vendor specific and human readable options. --v:: +-V:: --vendor-specific:: In addition to parsing known fields, this option will dump the vendor specific region of the structure in hex with ascii @@ -62,12 +62,14 @@ OPTIONS This option will parse and format many of the bit fields into human-readable formats. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. - +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- @@ -93,7 +95,7 @@ the vendor unique field: + ------------ # nvme id-ns /dev/nvme0n1 --vendor-specific -# nvme id-ns /dev/nvme0n1 -v +# nvme id-ns /dev/nvme0n1 -V ------------ + The above will dump the \'vs' buffer in hex since it doesn't know how to diff --git a/Documentation/nvme-id-nvmset.1 b/Documentation/nvme-id-nvmset.1 index fe06cc6..3ce9705 100644 --- a/Documentation/nvme-id-nvmset.1 +++ b/Documentation/nvme-id-nvmset.1 @@ -2,12 +2,12 @@ .\" Title: nvme-id-nvmset .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ID\-NVMSET" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ID\-NVMSET" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,8 +32,8 @@ nvme-id-nvmset \- Send NVMe Identify NVM Set List, return result and structure .SH "SYNOPSIS" .sp .nf -\fInvme id\-nvmset\fR <device> [\-i <id> | \-\-nvmset_id=<id> ] - [\-o <fmt> | \-\-output\-format=<fmt>] +\fInvme id\-nvmset\fR <device> [\-\-nvmset_id=<id> | \-i <id>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -49,13 +49,19 @@ On success, the structure may be returned in one of several ways depending on th This field specifies the identifier of the NVM Set\&. If given, NVM set identifier whose entry is to be in result data will be greater than or equal to this value\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-id-nvmset.html b/Documentation/nvme-id-nvmset.html index 7c75fc2..96c5382 100644 --- a/Documentation/nvme-id-nvmset.html +++ b/Documentation/nvme-id-nvmset.html @@ -749,8 +749,8 @@ nvme-id-nvmset(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme id-nvmset</em> <device> [-i <id> | --nvmset_id=<id> ]
- [-o <fmt> | --output-format=<fmt>]</pre>
+<pre class="content"><em>nvme id-nvmset</em> <device> [--nvmset_id=<id> | -i <id>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -779,21 +779,32 @@ raw buffer may be printed to stdout.</p></div> </dt>
<dd>
<p>
- This field specifies the identifier of the NVM Set. If given, NVM set
+ This field specifies the identifier of the NVM Set. If given, NVM set
identifier whose entry is to be in result data will be greater than or
equal to this value.
</p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -851,7 +862,7 @@ as shown in the above example, or you can <code>'cat'</code> a saved output buff <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-id-nvmset.txt b/Documentation/nvme-id-nvmset.txt index c331410..e2894e3 100644 --- a/Documentation/nvme-id-nvmset.txt +++ b/Documentation/nvme-id-nvmset.txt @@ -8,8 +8,8 @@ nvme-id-nvmset - Send NVMe Identify NVM Set List, return result and structure SYNOPSIS -------- [verse] -'nvme id-nvmset' <device> [-i <id> | --nvmset_id=<id> ] - [-o <fmt> | --output-format=<fmt>] +'nvme id-nvmset' <device> [--nvmset_id=<id> | -i <id>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -27,14 +27,18 @@ OPTIONS ------- -i <id>:: --nvmset_id=<id>:: - This field specifies the identifier of the NVM Set. If given, NVM set + This field specifies the identifier of the NVM Set. If given, NVM set identifier whose entry is to be in result data will be greater than or equal to this value. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-id-uuid.txt b/Documentation/nvme-id-uuid.txt new file mode 100755 index 0000000..f7cc1c0 --- /dev/null +++ b/Documentation/nvme-id-uuid.txt @@ -0,0 +1,55 @@ +nvme-id-uuid(1) +=============== + +NAME +---- +nvme-id-uuid - Send a Identify UUID List command to the specified device + +SYNOPSIS +-------- +[verse] +'nvme id-uuid' <device> [--raw-binary | -b] [--human-readable | -H] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] + +DESCRIPTION +----------- +Send a Identify UUID List command command to the specified device, return +results. + +The <device> parameter is mandatory and may be either the NVMe character +device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1). + +On success it returns 0, error code otherwise. + +OPTIONS +------- +-b:: +--raw-binary:: + Print the raw buffer to stdout. Structure is not parsed by + program. This overrides the vendor specific and human readable options. + +-H:: +--human-readable:: + This option will parse and format many of the bit fields + into human-readable formats. + +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + +EXAMPLES +-------- +* Has the program issue a id-uuid to display structure. ++ +------------ +# nvme id-uuid /dev/nvme0 +------------ + +NVME +---- +Part of the nvme-user suite. diff --git a/Documentation/nvme-inspur-nvme-vendor-log.1 b/Documentation/nvme-inspur-nvme-vendor-log.1 index 63f338e..e3905b6 100644 --- a/Documentation/nvme-inspur-nvme-vendor-log.1 +++ b/Documentation/nvme-inspur-nvme-vendor-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-inspur-nvme-vendor-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-INSPUR\-NVME\-" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-INSPUR\-NVME\-" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-inspur-nvme-vendor-log.html b/Documentation/nvme-inspur-nvme-vendor-log.html index ccc8e9d..0eec2c2 100644 --- a/Documentation/nvme-inspur-nvme-vendor-log.html +++ b/Documentation/nvme-inspur-nvme-vendor-log.html @@ -796,7 +796,7 @@ Print the Inspur Device Vendor log page in a human readable format: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-inspur-nvme-vendor-log.txt b/Documentation/nvme-inspur-nvme-vendor-log.txt index cd0266b..c860497 100644 --- a/Documentation/nvme-inspur-nvme-vendor-log.txt +++ b/Documentation/nvme-inspur-nvme-vendor-log.txt @@ -23,7 +23,6 @@ OPTIONS ------- none - EXAMPLES -------- * Print the Inspur Device Vendor log page in a human readable format: diff --git a/Documentation/nvme-intel-id-ctrl.1 b/Documentation/nvme-intel-id-ctrl.1 index ab2c374..63f2915 100644 --- a/Documentation/nvme-intel-id-ctrl.1 +++ b/Documentation/nvme-intel-id-ctrl.1 @@ -2,12 +2,12 @@ .\" Title: nvme-intel-id-ctrl .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-INTEL\-ID\-CTR" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-INTEL\-ID\-CTR" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,8 +32,8 @@ nvme-intel-id-ctrl \- Send NVMe Identify Controller, return result and structure .SH "SYNOPSIS" .sp .nf -\fInvme intel id\-ctrl\fR <device> [\-v | \-\-vendor\-specific] [\-b | \-\-raw\-binary] - [\-o <fmt> | \-\-output\-format=<fmt>] +\fInvme intel id\-ctrl\fR <device> [\-\-vendor\-specific | \-v] [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp @@ -61,7 +61,7 @@ In addition to parsing known fields, this option will dump the vendor specific r This option will parse and format many of the bit fields into human\-readable formats\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-intel-id-ctrl.html b/Documentation/nvme-intel-id-ctrl.html index 32a720d..10c0645 100644 --- a/Documentation/nvme-intel-id-ctrl.html +++ b/Documentation/nvme-intel-id-ctrl.html @@ -749,8 +749,8 @@ nvme-intel-id-ctrl(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme intel id-ctrl</em> <device> [-v | --vendor-specific] [-b | --raw-binary]
- [-o <fmt> | --output-format=<fmt>]</pre>
+<pre class="content"><em>nvme intel id-ctrl</em> <device> [--vendor-specific | -v] [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -811,15 +811,15 @@ will decode Intel vendor unique portions of the structure.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em>, or
+ <em>binary</em>. Only one output format can be used at a time.
</p>
</dd>
</dl></div>
@@ -853,7 +853,7 @@ fields in a human readable format: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-intel-id-ctrl.txt b/Documentation/nvme-intel-id-ctrl.txt index 1a6369c..469d60e 100644 --- a/Documentation/nvme-intel-id-ctrl.txt +++ b/Documentation/nvme-intel-id-ctrl.txt @@ -8,8 +8,8 @@ nvme-intel-id-ctrl - Send NVMe Identify Controller, return result and structure SYNOPSIS -------- [verse] -'nvme intel id-ctrl' <device> [-v | --vendor-specific] [-b | --raw-binary] - [-o <fmt> | --output-format=<fmt>] +'nvme intel id-ctrl' <device> [--vendor-specific | -v] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- @@ -44,10 +44,10 @@ OPTIONS This option will parse and format many of the bit fields into human-readable formats. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json', or + 'binary'. Only one output format can be used at a time. EXAMPLES -------- diff --git a/Documentation/nvme-intel-internal-log.1 b/Documentation/nvme-intel-internal-log.1 index 9649a14..ff324dd 100644 --- a/Documentation/nvme-intel-internal-log.1 +++ b/Documentation/nvme-intel-internal-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-intel-internal-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-INTEL\-INTERNA" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-INTEL\-INTERNA" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-intel-internal-log.html b/Documentation/nvme-intel-internal-log.html index 34bbcfe..6f5d120 100644 --- a/Documentation/nvme-intel-internal-log.html +++ b/Documentation/nvme-intel-internal-log.html @@ -873,7 +873,7 @@ Gets the event log from the device and saves to defined file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-intel-internal-log.txt b/Documentation/nvme-intel-internal-log.txt index 2f00313..a1e1792 100644 --- a/Documentation/nvme-intel-internal-log.txt +++ b/Documentation/nvme-intel-internal-log.txt @@ -53,7 +53,6 @@ OPTIONS When used with 'nlog', this specifies which nlog to read. -1 for all, if supported by the device. - EXAMPLES -------- * Gets the nlog from the device and saves to default file: diff --git a/Documentation/nvme-intel-lat-stats.1 b/Documentation/nvme-intel-lat-stats.1 index 7e52cbb..6cf57e7 100644 --- a/Documentation/nvme-intel-lat-stats.1 +++ b/Documentation/nvme-intel-lat-stats.1 @@ -2,12 +2,12 @@ .\" Title: nvme-intel-lat-stats .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-INTEL\-LAT\-ST" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-INTEL\-LAT\-ST" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-intel-lat-stats.html b/Documentation/nvme-intel-lat-stats.html index ee9c0df..dfb4582 100644 --- a/Documentation/nvme-intel-lat-stats.html +++ b/Documentation/nvme-intel-lat-stats.html @@ -832,7 +832,7 @@ Get the write statistics <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-intel-market-name.1 b/Documentation/nvme-intel-market-name.1 index a7c45d4..d46eb33 100644 --- a/Documentation/nvme-intel-market-name.1 +++ b/Documentation/nvme-intel-market-name.1 @@ -2,12 +2,12 @@ .\" Title: nvme-intel-market-name .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-INTEL\-MARKET\" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-INTEL\-MARKET\" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-intel-market-name.html b/Documentation/nvme-intel-market-name.html index e29a60d..ee06f92 100644 --- a/Documentation/nvme-intel-market-name.html +++ b/Documentation/nvme-intel-market-name.html @@ -813,7 +813,7 @@ Get the marketing name <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-intel-smart-log-add.1 b/Documentation/nvme-intel-smart-log-add.1 index cdcdaf3..91fe4eb 100644 --- a/Documentation/nvme-intel-smart-log-add.1 +++ b/Documentation/nvme-intel-smart-log-add.1 @@ -2,12 +2,12 @@ .\" Title: nvme-intel-smart-log-add .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-INTEL\-SMART\-" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-INTEL\-SMART\-" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,8 +33,7 @@ nvme-intel-smart-log-add \- Send NVMe Intel Additional SMART log page request, r .sp .nf \fInvme intel smart\-log\-add\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-raw\-binary | \-b] - [\-\-json | \-j] + [\-\-raw\-binary | \-b] [\-\-json | \-j] .fi .SH "DESCRIPTION" .sp diff --git a/Documentation/nvme-intel-smart-log-add.html b/Documentation/nvme-intel-smart-log-add.html index af356af..6895f39 100644 --- a/Documentation/nvme-intel-smart-log-add.html +++ b/Documentation/nvme-intel-smart-log-add.html @@ -750,8 +750,7 @@ nvme-intel-smart-log-add(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme intel smart-log-add</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--raw-binary | -b]
- [--json | -j]</pre>
+ [--raw-binary | -b] [--json | -j]</pre>
<div class="attribution">
</div></div>
</div>
@@ -807,7 +806,7 @@ printed to stdout for another program to parse.</p></div> </dt>
<dd>
<p>
- Dump output in json format.
+ Dump output in json format.
</p>
</dd>
</dl></div>
@@ -850,7 +849,7 @@ Print the raw Intel Additional SMART log to a file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-intel-smart-log-add.txt b/Documentation/nvme-intel-smart-log-add.txt index 7cfe794..0ed1f10 100644 --- a/Documentation/nvme-intel-smart-log-add.txt +++ b/Documentation/nvme-intel-smart-log-add.txt @@ -3,14 +3,14 @@ nvme-intel-smart-log-add(1) NAME ---- -nvme-intel-smart-log-add - Send NVMe Intel Additional SMART log page request, returns result and log +nvme-intel-smart-log-add - Send NVMe Intel Additional SMART log page request, +returns result and log SYNOPSIS -------- [verse] 'nvme intel smart-log-add' <device> [--namespace-id=<nsid> | -n <nsid>] - [--raw-binary | -b] - [--json | -j] + [--raw-binary | -b] [--json | -j] DESCRIPTION ----------- @@ -41,7 +41,7 @@ OPTIONS -j:: --json:: - Dump output in json format. + Dump output in json format. EXAMPLES -------- diff --git a/Documentation/nvme-intel-temp-stats.1 b/Documentation/nvme-intel-temp-stats.1 index b47065c..234c6eb 100644 --- a/Documentation/nvme-intel-temp-stats.1 +++ b/Documentation/nvme-intel-temp-stats.1 @@ -2,12 +2,12 @@ .\" Title: nvme-intel-temp-stats .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-INTEL\-TEMP\-S" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-INTEL\-TEMP\-S" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-intel-temp-stats.html b/Documentation/nvme-intel-temp-stats.html index 04de67b..1269805 100644 --- a/Documentation/nvme-intel-temp-stats.html +++ b/Documentation/nvme-intel-temp-stats.html @@ -822,7 +822,7 @@ Print the raw SMART log to a file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-io-mgmt-recv.1 b/Documentation/nvme-io-mgmt-recv.1 index 2251125..93f0fea 100644 --- a/Documentation/nvme-io-mgmt-recv.1 +++ b/Documentation/nvme-io-mgmt-recv.1 @@ -2,12 +2,12 @@ .\" Title: nvme-io-mgmt-recv .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-IO\-MGMT\-RECV" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-IO\-MGMT\-RECV" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,10 +33,10 @@ nvme-io-mgmt-recv \- I/O Management Receive command .sp .nf \fInvme io\-mgmt\-recv\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] - [\-\-mos=<NUM> | \-s <NUM>] - [\-\-mo=<NUM> | \-m <NUM>] - [\-\-data=<FILE> | \-d <FILE>] - [\-\-data\-len=<NUM> | \-l <NUM>] + [\-\-mos=<NUM> | \-s <NUM>] [\-\-mo=<NUM> | \-m <NUM>] + [\-\-data=<FILE> | \-d <FILE>] + [\-\-data\-len=<NUM> | \-l <NUM>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -67,6 +67,20 @@ Management Operation to perform\&. .RS 4 Management Operation Specific parameter\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "NVME" .sp Part of nvme\-cli diff --git a/Documentation/nvme-io-mgmt-recv.html b/Documentation/nvme-io-mgmt-recv.html index 3c00355..795d64a 100644 --- a/Documentation/nvme-io-mgmt-recv.html +++ b/Documentation/nvme-io-mgmt-recv.html @@ -750,10 +750,10 @@ nvme-io-mgmt-recv(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme io-mgmt-recv</em> <device> [--namespace-id=<NUM> | -n <NUM>]
- [--mos=<NUM> | -s <NUM>]
- [--mo=<NUM> | -m <NUM>]
- [--data=<FILE> | -d <FILE>]
- [--data-len=<NUM> | -l <NUM>]</pre>
+ [--mos=<NUM> | -s <NUM>] [--mo=<NUM> | -m <NUM>]
+ [--data=<FILE> | -d <FILE>]
+ [--data-len=<NUM> | -l <NUM>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -832,6 +832,29 @@ a hex dump, or binary.</p></div> Management Operation Specific parameter.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -846,7 +869,7 @@ a hex dump, or binary.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-io-mgmt-recv.txt b/Documentation/nvme-io-mgmt-recv.txt index e611c15..332d0bb 100644 --- a/Documentation/nvme-io-mgmt-recv.txt +++ b/Documentation/nvme-io-mgmt-recv.txt @@ -9,10 +9,10 @@ SYNOPSIS -------- [verse] 'nvme io-mgmt-recv' <device> [--namespace-id=<NUM> | -n <NUM>] - [--mos=<NUM> | -s <NUM>] - [--mo=<NUM> | -m <NUM>] - [--data=<FILE> | -d <FILE>] - [--data-len=<NUM> | -l <NUM>] + [--mos=<NUM> | -s <NUM>] [--mo=<NUM> | -m <NUM>] + [--data=<FILE> | -d <FILE>] + [--data-len=<NUM> | -l <NUM>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -49,6 +49,14 @@ OPTIONS --mos=<NUM>:: Management Operation Specific parameter. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. NVME ---- diff --git a/Documentation/nvme-io-mgmt-send.1 b/Documentation/nvme-io-mgmt-send.1 index 044cb77..47e869e 100644 --- a/Documentation/nvme-io-mgmt-send.1 +++ b/Documentation/nvme-io-mgmt-send.1 @@ -2,12 +2,12 @@ .\" Title: nvme-io-mgmt-send .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-IO\-MGMT\-SEND" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-IO\-MGMT\-SEND" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,10 +33,10 @@ nvme-io-mgmt-send \- I/O Management Send command .sp .nf \fInvme io\-mgmt\-send\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] - [\-\-mos=<NUM> | \-s <NUM>] - [\-\-mo=<NUM> | \-m <NUM>] - [\-\-data=<FILE> | \-d <FILE>] - [\-\-data\-len=<NUM> | \-l <NUM>] + [\-\-mos=<NUM> | \-s <NUM>] [\-\-mo=<NUM> | \-m <NUM>] + [\-\-data=<FILE> | \-d <FILE>] + [\-\-data\-len=<NUM> | \-l <NUM>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -67,6 +67,20 @@ Management Operation to perform\&. .RS 4 Management Operation Specific parameter\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "NVME" .sp Part of nvme\-cli diff --git a/Documentation/nvme-io-mgmt-send.html b/Documentation/nvme-io-mgmt-send.html index a625024..a0df7b0 100644 --- a/Documentation/nvme-io-mgmt-send.html +++ b/Documentation/nvme-io-mgmt-send.html @@ -750,10 +750,10 @@ nvme-io-mgmt-send(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme io-mgmt-send</em> <device> [--namespace-id=<NUM> | -n <NUM>]
- [--mos=<NUM> | -s <NUM>]
- [--mo=<NUM> | -m <NUM>]
- [--data=<FILE> | -d <FILE>]
- [--data-len=<NUM> | -l <NUM>]</pre>
+ [--mos=<NUM> | -s <NUM>] [--mo=<NUM> | -m <NUM>]
+ [--data=<FILE> | -d <FILE>]
+ [--data-len=<NUM> | -l <NUM>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -831,6 +831,29 @@ convenience parameters to produce the binary payload.</p></div> Management Operation Specific parameter.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -845,7 +868,7 @@ convenience parameters to produce the binary payload.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-io-mgmt-send.txt b/Documentation/nvme-io-mgmt-send.txt index ce8d8d2..f7e8f6d 100644 --- a/Documentation/nvme-io-mgmt-send.txt +++ b/Documentation/nvme-io-mgmt-send.txt @@ -9,10 +9,10 @@ SYNOPSIS -------- [verse] 'nvme io-mgmt-send' <device> [--namespace-id=<NUM> | -n <NUM>] - [--mos=<NUM> | -s <NUM>] - [--mo=<NUM> | -m <NUM>] - [--data=<FILE> | -d <FILE>] - [--data-len=<NUM> | -l <NUM>] + [--mos=<NUM> | -s <NUM>] [--mo=<NUM> | -m <NUM>] + [--data=<FILE> | -d <FILE>] + [--data-len=<NUM> | -l <NUM>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -48,6 +48,14 @@ OPTIONS --mos=<NUM>:: Management Operation Specific parameter. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. NVME ---- diff --git a/Documentation/nvme-io-passthru.1 b/Documentation/nvme-io-passthru.1 index da0e301..102da64 100644 --- a/Documentation/nvme-io-passthru.1 +++ b/Documentation/nvme-io-passthru.1 @@ -2,12 +2,12 @@ .\" Title: nvme-io-passthru .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-IO\-PASSTHRU" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-IO\-PASSTHRU" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,23 +32,22 @@ nvme-io-passthru \- Submit an arbitrary io command, return results .SH "SYNOPSIS" .sp .nf -\fInvme\-io\-passthru\fR <device> [\-\-opcode=<opcode> | \-o <opcode>] - [\-\-flags=<flags> | \-f <flags>] [\-rsvd=<rsvd> | \-R <rsvd>] - [\-\-namespace\-id=<nsid> | \-nsid <nsid>] - [\-\-cdw2=<cdw2>] [\-\-cdw3=<cdw3>] [\-\-cdw10=<cdw10>] - [\-\-cdw11=<cdw11>] [\-\-cdw12=<cdw12>] [\-\-cdw13=<cdw13>] - [\-\-cdw14=<cdw14>] [\-\-cdw15=<cdw15>] - [\-\-data\-len=<data\-len> | \-l <data\-len>] - [\-\-metadata\-len=<len> | \-m <len>] - [\-\-read | \-r ] [\-\-write | \-w] - [\-\-input\-file=<file> | \-i <file>] - [\-\-metadata=<file> | \-M <file>] - [\-\-timeout=<to> | \-t <to>] - [\-\-show\-command | \-s] - [\-\-dry\-run | \-d] - [\-\-raw\-binary | \-b] - [\-\-prefill=<prefill> | \-p <prefill>] - [\-\-latency | \-T] +\fInvme\-io\-passthru\fR <device> [\-\-opcode=<opcode> | \-O <opcode>] + [\-\-flags=<flags> | \-f <flags>] [\-rsvd=<rsvd> | \-R <rsvd>] + [\-\-namespace\-id=<nsid> | \-nsid <nsid>] + [\-\-cdw2=<cdw2>] [\-\-cdw3=<cdw3>] [\-\-cdw10=<cdw10>] + [\-\-cdw11=<cdw11>] [\-\-cdw12=<cdw12>] [\-\-cdw13=<cdw13>] + [\-\-cdw14=<cdw14>] [\-\-cdw15=<cdw15>] + [\-\-data\-len=<data\-len> | \-l <data\-len>] + [\-\-metadata\-len=<len> | \-m <len>] + [\-\-read | \-r] [\-\-write | \-w] + [\-\-input\-file=<file> | \-i <file>] + [\-\-metadata=<file> | \-M <file>] + [\-\-timeout=<to> | \-t <to>] [\-\-show\-command | \-s] + [\-\-dry\-run | \-d] [\-\-raw\-binary | \-b] + [\-\-prefill=<prefill> | \-p <prefill>] + [\-\-latency | \-T] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -59,7 +58,7 @@ The <device> parameter is mandatory and may be either the NVMe character device On success, the returned structure (if applicable) may be returned in one of several ways depending on the option flags; the structure may printed by the program as a hex dump, or may be returned as a raw buffer printed to stdout for another program to parse\&. .SH "OPTIONS" .PP -\-o <opcode>, \-\-opcode=<opcode> +\-O <opcode>, \-\-opcode=<opcode> .RS 4 The NVMe opcode to send to the device in the command .RE @@ -137,6 +136,20 @@ Prefill the buffer with a predetermined byte value\&. Defaults to 0\&. This may .RS 4 Print out the latency the IOCTL took (in us)\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp nvme io\-passthru /dev/nvme0n1 \-\-opcode=2 \-\-namespace\-id=1 \-\-data\-len=4096 \-\-read \-\-cdw10=0 \-\-cdw11=0 \-\-cdw12=0x70000 \-\-raw\-binary diff --git a/Documentation/nvme-io-passthru.html b/Documentation/nvme-io-passthru.html index f65a513..4de9587 100644 --- a/Documentation/nvme-io-passthru.html +++ b/Documentation/nvme-io-passthru.html @@ -749,23 +749,22 @@ nvme-io-passthru(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme-io-passthru</em> <device> [--opcode=<opcode> | -o <opcode>]
- [--flags=<flags> | -f <flags>] [-rsvd=<rsvd> | -R <rsvd>]
- [--namespace-id=<nsid> | -nsid <nsid>]
- [--cdw2=<cdw2>] [--cdw3=<cdw3>] [--cdw10=<cdw10>]
- [--cdw11=<cdw11>] [--cdw12=<cdw12>] [--cdw13=<cdw13>]
- [--cdw14=<cdw14>] [--cdw15=<cdw15>]
- [--data-len=<data-len> | -l <data-len>]
- [--metadata-len=<len> | -m <len>]
- [--read | -r ] [--write | -w]
- [--input-file=<file> | -i <file>]
- [--metadata=<file> | -M <file>]
- [--timeout=<to> | -t <to>]
- [--show-command | -s]
- [--dry-run | -d]
- [--raw-binary | -b]
- [--prefill=<prefill> | -p <prefill>]
- [--latency | -T]</pre>
+<pre class="content"><em>nvme-io-passthru</em> <device> [--opcode=<opcode> | -O <opcode>]
+ [--flags=<flags> | -f <flags>] [-rsvd=<rsvd> | -R <rsvd>]
+ [--namespace-id=<nsid> | -nsid <nsid>]
+ [--cdw2=<cdw2>] [--cdw3=<cdw3>] [--cdw10=<cdw10>]
+ [--cdw11=<cdw11>] [--cdw12=<cdw12>] [--cdw13=<cdw13>]
+ [--cdw14=<cdw14>] [--cdw15=<cdw15>]
+ [--data-len=<data-len> | -l <data-len>]
+ [--metadata-len=<len> | -m <len>]
+ [--read | -r] [--write | -w]
+ [--input-file=<file> | -i <file>]
+ [--metadata=<file> | -M <file>]
+ [--timeout=<to> | -t <to>] [--show-command | -s]
+ [--dry-run | -d] [--raw-binary | -b]
+ [--prefill=<prefill> | -p <prefill>]
+ [--latency | -T]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -790,7 +789,7 @@ printed to stdout for another program to parse.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <opcode>
+-O <opcode>
</dt>
<dt class="hdlist1">
--opcode=<opcode>
@@ -973,6 +972,29 @@ printed to stdout for another program to parse.</p></div> Print out the latency the IOCTL took (in us).
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -993,7 +1015,7 @@ printed to stdout for another program to parse.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-io-passthru.txt b/Documentation/nvme-io-passthru.txt index ba0904c..3ad5231 100644 --- a/Documentation/nvme-io-passthru.txt +++ b/Documentation/nvme-io-passthru.txt @@ -8,23 +8,22 @@ nvme-io-passthru - Submit an arbitrary io command, return results SYNOPSIS -------- [verse] -'nvme-io-passthru' <device> [--opcode=<opcode> | -o <opcode>] - [--flags=<flags> | -f <flags>] [-rsvd=<rsvd> | -R <rsvd>] - [--namespace-id=<nsid> | -nsid <nsid>] - [--cdw2=<cdw2>] [--cdw3=<cdw3>] [--cdw10=<cdw10>] - [--cdw11=<cdw11>] [--cdw12=<cdw12>] [--cdw13=<cdw13>] - [--cdw14=<cdw14>] [--cdw15=<cdw15>] - [--data-len=<data-len> | -l <data-len>] - [--metadata-len=<len> | -m <len>] - [--read | -r ] [--write | -w] - [--input-file=<file> | -i <file>] - [--metadata=<file> | -M <file>] - [--timeout=<to> | -t <to>] - [--show-command | -s] - [--dry-run | -d] - [--raw-binary | -b] - [--prefill=<prefill> | -p <prefill>] - [--latency | -T] +'nvme-io-passthru' <device> [--opcode=<opcode> | -O <opcode>] + [--flags=<flags> | -f <flags>] [-rsvd=<rsvd> | -R <rsvd>] + [--namespace-id=<nsid> | -nsid <nsid>] + [--cdw2=<cdw2>] [--cdw3=<cdw3>] [--cdw10=<cdw10>] + [--cdw11=<cdw11>] [--cdw12=<cdw12>] [--cdw13=<cdw13>] + [--cdw14=<cdw14>] [--cdw15=<cdw15>] + [--data-len=<data-len> | -l <data-len>] + [--metadata-len=<len> | -m <len>] + [--read | -r] [--write | -w] + [--input-file=<file> | -i <file>] + [--metadata=<file> | -M <file>] + [--timeout=<to> | -t <to>] [--show-command | -s] + [--dry-run | -d] [--raw-binary | -b] + [--prefill=<prefill> | -p <prefill>] + [--latency | -T] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -43,7 +42,7 @@ printed to stdout for another program to parse. OPTIONS ------- --o <opcode>:: +-O <opcode>:: --opcode=<opcode>:: The NVMe opcode to send to the device in the command @@ -120,6 +119,15 @@ OPTIONS --latency:: Print out the latency the IOCTL took (in us). +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- diff --git a/Documentation/nvme-lba-status-log.1 b/Documentation/nvme-lba-status-log.1 index 2b273f7..d083039 100644 --- a/Documentation/nvme-lba-status-log.1 +++ b/Documentation/nvme-lba-status-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-lba-status-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-LBA\-STATUS\-L" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-LBA\-STATUS\-L" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,7 +32,8 @@ nvme-lba-status-log \- Send LBA Status Log Page request returns result and log .SH "SYNOPSIS" .sp .nf -\fInvme lba\-status\-log\fR <device> [\-\-rae | \-r] [\-\-output\-format=<fmt> | \-o <fmt>] +\fInvme lba\-status\-log\fR <device> [\-\-rae | \-r] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -48,13 +49,19 @@ On success, the returned LBA Status Log Page structure may be returned in one of Retain an Asynchronous Event\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-lba-status-log.html b/Documentation/nvme-lba-status-log.html index 76ef5c7..1e571bf 100644 --- a/Documentation/nvme-lba-status-log.html +++ b/Documentation/nvme-lba-status-log.html @@ -749,7 +749,8 @@ nvme-lba-status-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme lba-status-log</em> <device> [--rae | -r] [--output-format=<fmt> | -o <fmt>]</pre>
+<pre class="content"><em>nvme lba-status-log</em> <device> [--rae | -r]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -783,15 +784,26 @@ may be printed to stdout for another program to parse.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or <em>binary</em>.
- Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -831,7 +843,7 @@ NVME</code></pre> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-lba-status-log.txt b/Documentation/nvme-lba-status-log.txt index 0d888f7..7d6efbd 100644 --- a/Documentation/nvme-lba-status-log.txt +++ b/Documentation/nvme-lba-status-log.txt @@ -8,7 +8,8 @@ nvme-lba-status-log - Send LBA Status Log Page request returns result and log SYNOPSIS -------- [verse] -'nvme lba-status-log' <device> [--rae | -r] [--output-format=<fmt> | -o <fmt>] +'nvme lba-status-log' <device> [--rae | -r] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -29,10 +30,14 @@ OPTIONS --rae:: Retain an Asynchronous Event. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or 'binary'. - Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-list-ctrl.1 b/Documentation/nvme-list-ctrl.1 index 5d10cfb..1b6134e 100644 --- a/Documentation/nvme-list-ctrl.1 +++ b/Documentation/nvme-list-ctrl.1 @@ -2,12 +2,12 @@ .\" Title: nvme-list-ctrl .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-LIST\-CTRL" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-LIST\-CTRL" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,25 +33,17 @@ nvme-list-ctrl \- Send NVMe Identify List Controllers, return result and structu .sp .nf \fInvme list\-ctrl\fR <device> [\-\-cntid=<cntid> | \-c <cntid>] - [\-\-namespace\-id=<nsid> | \-n <nsid>] [\-o <fmt> | \-\-output\-format=<fmt>] -DESCRIPTION + [\-\-namespace\-id=<nsid> | \-n <nsid>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi +.SH "DESCRIPTION" .sp -.nf -For the NVMe device given, sends an identify command for controller list -and provides the result and returned structure\&. This uses either mode -12h or 13h depending on the requested namespace identifier\&. - -The <device> parameter is mandatory and may be either the NVMe character -device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1)\&. -The starting controller in the list always begins with 0 unless the -`\*(Aq\-\-cntid\*(Aq` option is given to override\&. - -On success, the controller array is printed for each index and controller -identifier\&. - -OPTIONS -.fi +For the NVMe device given, sends an identify command for controller list and provides the result and returned structure\&. This uses either mode 12h or 13h depending on the requested namespace identifier\&. +.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)\&. The starting controller in the list always begins with 0 unless the \*(Aq\-\-cntid\*(Aq option is given to override\&. +.sp +On success, the controller array is printed for each index and controller identifier\&. +.SH "OPTIONS" .PP \-c <cntid>, \-\-cntid=<cntid> .RS 4 @@ -63,12 +55,18 @@ Retrieve the identify list structure starting with the given controller id\&. If provided, will request the controllers attached to the specified namespace\&. If no namespace is given, or set to 0, the command requests the controller list for the entire subsystem, whether or not they are attached to namespace(s)\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to -\fInormal\fR +\fInormal\fR, +\fIjson\fR or -\fIjson\fR\&. Only one output format can be used at a time\&. +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. .RE .SH "EXAMPLES" .sp diff --git a/Documentation/nvme-list-ctrl.html b/Documentation/nvme-list-ctrl.html index 3ad61a4..b58d5ef 100644 --- a/Documentation/nvme-list-ctrl.html +++ b/Documentation/nvme-list-ctrl.html @@ -750,26 +750,29 @@ nvme-list-ctrl(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme list-ctrl</em> <device> [--cntid=<cntid> | -c <cntid>]
- [--namespace-id=<nsid> | -n <nsid>] [-o <fmt> | --output-format=<fmt>]
-DESCRIPTION</pre>
+ [--namespace-id=<nsid> | -n <nsid>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
-<div class="listingblock">
-<div class="content">
-<pre><code>For the NVMe device given, sends an identify command for controller list
+</div>
+</div>
+<div class="sect1">
+<h2 id="_description">DESCRIPTION</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>For the NVMe device given, sends an identify command for controller list
and provides the result and returned structure. This uses either mode
-12h or 13h depending on the requested namespace identifier.
-
-The <device> parameter is mandatory and may be either the NVMe character
+12h or 13h depending on the requested namespace identifier.</p></div>
+<div class="paragraph"><p>The <device> parameter is mandatory and may be either the NVMe character
device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).
The starting controller in the list always begins with 0 unless the
-`'--cntid'` option is given to override.
-
-On success, the controller array is printed for each index and controller
-identifier.
-
-OPTIONS</code></pre>
-</div></div>
+<code>'--cntid'</code> option is given to override.</p></div>
+<div class="paragraph"><p>On success, the controller array is printed for each index and controller
+identifier.</p></div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_options">OPTIONS</h2>
+<div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
-c <cntid>
@@ -797,15 +800,26 @@ OPTIONS</code></pre> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
</dt>
<dt class="hdlist1">
---output-format=<format>
+--verbose
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em> or <em>json</em>. Only one output
- format can be used at a time.
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -828,7 +842,7 @@ OPTIONS</code></pre> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-list-ctrl.txt b/Documentation/nvme-list-ctrl.txt index f1bb52d..6cd5c01 100644 --- a/Documentation/nvme-list-ctrl.txt +++ b/Documentation/nvme-list-ctrl.txt @@ -9,7 +9,9 @@ SYNOPSIS -------- [verse] 'nvme list-ctrl' <device> [--cntid=<cntid> | -c <cntid>] - [--namespace-id=<nsid> | -n <nsid>] [-o <fmt> | --output-format=<fmt>] + [--namespace-id=<nsid> | -n <nsid>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] + DESCRIPTION ----------- For the NVMe device given, sends an identify command for controller list @@ -37,10 +39,14 @@ OPTIONS command requests the controller list for the entire subsystem, whether or not they are attached to namespace(s). --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal' or 'json'. Only one output - format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-list-endgrp.1 b/Documentation/nvme-list-endgrp.1 index be623ae..1d62e03 100644 --- a/Documentation/nvme-list-endgrp.1 +++ b/Documentation/nvme-list-endgrp.1 @@ -2,12 +2,12 @@ .\" Title: nvme-list-endgrp .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-LIST\-ENDGRP" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-LIST\-ENDGRP" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,7 +33,7 @@ nvme-list-endgrp \- Send NVMe Identify Endurance Group List, return result and s .sp .nf \fInvme list\-endgrp\fR <device> [\-\-endgrp\-id=<endgrp\-id> | \-i <endgrp\-id>] - [\-o <fmt> | \-\-output\-format=<fmt>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -47,12 +47,18 @@ The <device> parameter is mandatory and may be either the NVMe character device Retrieve the identify endurance group list structure starting for the given endurance group id\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to -\fInormal\fR +\fInormal\fR, +\fIjson\fR or -\fIjson\fR\&. Only one output format can be used at a time\&. +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. .RE .SH "EXAMPLES" .sp diff --git a/Documentation/nvme-list-endgrp.html b/Documentation/nvme-list-endgrp.html index c377757..97db7ae 100644 --- a/Documentation/nvme-list-endgrp.html +++ b/Documentation/nvme-list-endgrp.html @@ -750,7 +750,7 @@ nvme-list-endgrp(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme list-endgrp</em> <device> [--endgrp-id=<endgrp-id> | -i <endgrp-id>]
- [-o <fmt> | --output-format=<fmt>]</pre>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -779,20 +779,31 @@ than or equal to the value specified in the CDW11.ENDGID field.</p></div> </dt>
<dd>
<p>
- Retrieve the identify endurance group list structure starting for the given
- endurance group id.
+ Retrieve the identify endurance group list structure starting for the
+ given endurance group id.
</p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em> or <em>json</em>. Only one output
- format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -815,7 +826,7 @@ than or equal to the value specified in the CDW11.ENDGID field.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-list-endgrp.txt b/Documentation/nvme-list-endgrp.txt index 157dca9..2d7724d 100644 --- a/Documentation/nvme-list-endgrp.txt +++ b/Documentation/nvme-list-endgrp.txt @@ -3,14 +3,15 @@ nvme-list-endgrp(1) NAME ---- -nvme-list-endgrp - Send NVMe Identify Endurance Group List, return result and structure +nvme-list-endgrp - Send NVMe Identify Endurance Group List, return result and +structure SYNOPSIS -------- [verse] 'nvme list-endgrp' <device> [--endgrp-id=<endgrp-id> | -i <endgrp-id>] - [-o <fmt> | --output-format=<fmt>] - + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] + DESCRIPTION ----------- For the NVMe device given, sends an identify command for endurance group list @@ -26,13 +27,17 @@ OPTIONS ------- -i <endgrp-id>:: --endgrp-id=<endgrp-id>:: - Retrieve the identify endurance group list structure starting for the given - endurance group id. + Retrieve the identify endurance group list structure starting for the + given endurance group id. + +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal' or 'json'. Only one output - format can be used at a time. +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-list-ns.1 b/Documentation/nvme-list-ns.1 index da5f1cc..ebb3800 100644 --- a/Documentation/nvme-list-ns.1 +++ b/Documentation/nvme-list-ns.1 @@ -2,12 +2,12 @@ .\" Title: nvme-id-ns .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ID\-NS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ID\-NS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,7 +34,8 @@ nvme-list-ns \- Send NVMe Identify List Namespaces, return result and structure .nf \fInvme list\-ns\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] [\-\-csi=<command_set_identifier> | \-y <command_set_identifier>] - [\-\-all | \-a] [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-all | \-a] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -60,11 +61,18 @@ If this value is given, retrieve the identify list structure associated with the Retrieve the identify list structure for all namespaces in the subsystem, whether attached or inactive\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to -\fInormal\fR, or -\fIjson\fR\&. Only one output format can be used at a time\&. +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. .RE .SH "EXAMPLES" .sp diff --git a/Documentation/nvme-list-ns.html b/Documentation/nvme-list-ns.html index b06c669..d73ee5e 100644 --- a/Documentation/nvme-list-ns.html +++ b/Documentation/nvme-list-ns.html @@ -751,7 +751,8 @@ nvme-id-ns(1) Manual Page <div class="verseblock">
<pre class="content"><em>nvme list-ns</em> <device> [--namespace-id=<nsid> | -n <nsid>]
[--csi=<command_set_identifier> | -y <command_set_identifier>]
- [--all | -a] [--output-format=<fmt> | -o <fmt>]</pre>
+ [--all | -a]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -809,15 +810,26 @@ a valid nsid.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, or <em>json</em>.
- Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -859,7 +871,7 @@ Print the namespaces present for NVM Command Set in normal format <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-list-ns.txt b/Documentation/nvme-list-ns.txt index 753a959..d241287 100644 --- a/Documentation/nvme-list-ns.txt +++ b/Documentation/nvme-list-ns.txt @@ -10,7 +10,8 @@ SYNOPSIS [verse] 'nvme list-ns' <device> [--namespace-id=<nsid> | -n <nsid>] [--csi=<command_set_identifier> | -y <command_set_identifier>] - [--all | -a] [--output-format=<fmt> | -o <fmt>] + [--all | -a] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -41,10 +42,14 @@ OPTIONS Retrieve the identify list structure for all namespaces in the subsystem, whether attached or inactive. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', or 'json'. - Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-list-secondary.txt b/Documentation/nvme-list-secondary.txt new file mode 100755 index 0000000..88fbf42 --- /dev/null +++ b/Documentation/nvme-list-secondary.txt @@ -0,0 +1,54 @@ +nvme-list-secondary(1) +====================== + +NAME +---- +nvme-list-secondary - Show secondary controller list associated with the primary +controller of the given device + +SYNOPSIS +-------- +[verse] +'nvme list-secondary' <device> [--cntid=<cntid> | -c <cntid>] + [--num-entries=<entries> | -e <entries>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] + +DESCRIPTION +----------- +Show secondary controller list associated with the primary of the given device + +The <device> parameter is mandatory and may be either the NVMe character +device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1). + +On success, the secondary controller list is printed. + +OPTIONS +------- +-c <cntid>:: +--cntid=<cntid>:: + Lowest controller identifier to display. + +-e <entries>:: +--num-entries=<entries>:: + Number of entries to retrieve. + +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + +EXAMPLES +-------- +* Has the program issue a list-secondary to display list. ++ +------------ +# nvme list-secondary /dev/nvme0 +------------ + +NVME +---- +Part of the nvme-user suite. diff --git a/Documentation/nvme-list-subsys.1 b/Documentation/nvme-list-subsys.1 index 225740e..d81d35a 100644 --- a/Documentation/nvme-list-subsys.1 +++ b/Documentation/nvme-list-subsys.1 @@ -2,12 +2,12 @@ .\" Title: nvme-list-subsys .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-LIST\-SUBSYS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-LIST\-SUBSYS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,19 +32,25 @@ nvme-list-subsys \- List all NVMe subsystems .SH "SYNOPSIS" .sp .nf -\fInvme list\-subsys\fR [\-o <fmt> | \-\-output\-format=<fmt>] <device> +\fInvme list\-subsys\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp Scan the sysfs tree for NVM Express subsystems and return the controllers for those subsystems as well as some pertinent information about them\&. If a device is given, print out only the values for the controllers and subsystems leading to the device\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to -\fInormal\fR +\fInormal\fR, +\fIjson\fR or -\fIjson\fR\&. Only one output format can be used at a time\&. +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. .RE .SH "EXAMPLES" .sp diff --git a/Documentation/nvme-list-subsys.html b/Documentation/nvme-list-subsys.html index 0b82591..289e515 100644 --- a/Documentation/nvme-list-subsys.html +++ b/Documentation/nvme-list-subsys.html @@ -749,7 +749,7 @@ nvme-list-subsys(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme list-subsys</em> [-o <fmt> | --output-format=<fmt>] <device></pre>
+<pre class="content"><em>nvme list-subsys</em> <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -768,15 +768,26 @@ and subsystems leading to the device.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em> or <em>json</em>. Only one output
- format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -854,7 +865,7 @@ nvme-subsys1 - NQN=nvmf-test2 <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-list-subsys.txt b/Documentation/nvme-list-subsys.txt index 6650bbe..a5d2d48 100644 --- a/Documentation/nvme-list-subsys.txt +++ b/Documentation/nvme-list-subsys.txt @@ -8,7 +8,7 @@ nvme-list-subsys - List all NVMe subsystems SYNOPSIS -------- [verse] -'nvme list-subsys' [-o <fmt> | --output-format=<fmt>] <device> +'nvme list-subsys' <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -19,10 +19,14 @@ and subsystems leading to the device. OPTIONS ------- --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal' or 'json'. Only one output - format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-list.1 b/Documentation/nvme-list.1 index 463cf78..63f2de7 100644 --- a/Documentation/nvme-list.1 +++ b/Documentation/nvme-list.1 @@ -2,12 +2,12 @@ .\" Title: nvme-list .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-LIST" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-LIST" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,19 +32,20 @@ nvme-list \- List all recognized NVMe devices .SH "SYNOPSIS" .sp .nf -\fInvme list\fR [\-o <fmt> | \-\-output\-format=<fmt>] +\fInvme list\fR [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp Scan the sysfs tree for NVM Express devices and return the /dev node for those devices as well as some pertinent information about them\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to -\fInormal\fR +\fInormal\fR, +\fIjson\fR or -\fIjson\fR\&. Only one output format can be used at a time\&. +\fIbinary\fR\&. Only one output format can be used at a time\&. .RE .PP \-v, \-\-verbose diff --git a/Documentation/nvme-list.html b/Documentation/nvme-list.html index 976c90d..9d09113 100644 --- a/Documentation/nvme-list.html +++ b/Documentation/nvme-list.html @@ -749,7 +749,7 @@ nvme-list(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme list</em> [-o <fmt> | --output-format=<fmt>]</pre>
+<pre class="content"><em>nvme list</em> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -766,15 +766,15 @@ for those devices as well as some pertinent information about them.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em> or <em>json</em>. Only one output
- format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
</p>
</dd>
<dt class="hdlist1">
@@ -816,7 +816,7 @@ for those devices as well as some pertinent information about them.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-list.txt b/Documentation/nvme-list.txt index 7cc333b..a8c5428 100644 --- a/Documentation/nvme-list.txt +++ b/Documentation/nvme-list.txt @@ -8,7 +8,7 @@ nvme-list - List all recognized NVMe devices SYNOPSIS -------- [verse] -'nvme list' [-o <fmt> | --output-format=<fmt>] +'nvme list' [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -17,10 +17,10 @@ for those devices as well as some pertinent information about them. OPTIONS ------- --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal' or 'json'. Only one output - format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. -v:: --verbose:: @@ -32,7 +32,6 @@ ENVIRONMENT ----------- PCI_IDS_PATH - Full path of pci.ids file in case nvme could not find it in common locations. - EXAMPLES -------- No examples yet. diff --git a/Documentation/nvme-lockdown.1 b/Documentation/nvme-lockdown.1 index cd38210..8779819 100644 --- a/Documentation/nvme-lockdown.1 +++ b/Documentation/nvme-lockdown.1 @@ -2,12 +2,12 @@ .\" Title: nvme-lockdown .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-LOCKDOWN" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-LOCKDOWN" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,41 +32,56 @@ nvme-lockdown \- Send an NVMe Lockdown command to prohibit or allow the executio .SH "SYNOPSIS" .sp .nf -\fInvme\-lockdown\fR <device> [\-\-ofi=<ofi> | \-o <ofi>] +\fInvme\-lockdown\fR <device> [\-\-ofi=<ofi> | \-O <ofi>] [\-\-ifc=<ifc> | \-f <ifc>] [\-\-prhbt=<prhbt> | \-p <prhbt>] [\-\-scp=<scp> | \-s <scp>] [\-\-uuid=<UUID_Index> | \-U <UUID_Index>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp The Lockdown command is used to control the Command and Feature Lockdown capability which configures the prohibition or allowance of execution of the specified command or Set Features command targeting a specific Feature Identifier\&. .SH "OPTIONS" .PP -\-\-ofi=<ofi>, \-o <ofi> +\-O <ofi>, \-\-ofi=<ofi> .RS 4 Opcode or Feature Identifier(OFI) specifies the command opcode or Set Features Feature Identifier identified by the Scope field\&. .RE .PP -\-\-ifc=<ifc>, \-f <ifc> +\-f <ifc>, \-\-ifc=<ifc> .RS 4 Interface (INF) field identifies the interfaces affected by this command\&. .RE .PP -\-\-prhbt=<prhbt>, \-p <prhbt> +\-p <prhbt>, \-\-prhbt=<prhbt> .RS 4 Prohibit (PRHBT) bit specifies whether to prohibit or allow the command opcode or Set Features Feature Identifier specified by this command\&. .RE .PP -\-\-scp=<scp>, \-s <scp> +\-s <scp>, \-\-scp=<scp> .RS 4 Scope (SCP) field specifies the contents of the Opcode or Feature Identifier field\&. .RE .PP -\-\-uuid=<UUID_Index>, \-U <UUID_Index> +\-U <UUID_Index>, \-\-uuid=<UUID_Index> .RS 4 UUID Index \- If this field is set to a non\-zero value, then the value of this field is the index of a UUID in the UUID List that is used by the command\&. If this field is cleared to 0h,then no UUID index is specified\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet\&. diff --git a/Documentation/nvme-lockdown.html b/Documentation/nvme-lockdown.html index f572ee1..06b7967 100644 --- a/Documentation/nvme-lockdown.html +++ b/Documentation/nvme-lockdown.html @@ -749,11 +749,12 @@ nvme-lockdown(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme-lockdown</em> <device> [--ofi=<ofi> | -o <ofi>]
+<pre class="content"><em>nvme-lockdown</em> <device> [--ofi=<ofi> | -O <ofi>]
[--ifc=<ifc> | -f <ifc>]
[--prhbt=<prhbt> | -p <prhbt>]
[--scp=<scp> | -s <scp>]
- [--uuid=<UUID_Index> | -U <UUID_Index>]</pre>
+ [--uuid=<UUID_Index> | -U <UUID_Index>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -772,10 +773,10 @@ Identifier.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
---ofi=<ofi>
+-O <ofi>
</dt>
<dt class="hdlist1">
--o <ofi>
+--ofi=<ofi>
</dt>
<dd>
<p>
@@ -784,10 +785,10 @@ Identifier.</p></div> </p>
</dd>
<dt class="hdlist1">
---ifc=<ifc>
+-f <ifc>
</dt>
<dt class="hdlist1">
--f <ifc>
+--ifc=<ifc>
</dt>
<dd>
<p>
@@ -795,10 +796,10 @@ Identifier.</p></div> </p>
</dd>
<dt class="hdlist1">
---prhbt=<prhbt>
+-p <prhbt>
</dt>
<dt class="hdlist1">
--p <prhbt>
+--prhbt=<prhbt>
</dt>
<dd>
<p>
@@ -807,10 +808,10 @@ Identifier.</p></div> </p>
</dd>
<dt class="hdlist1">
---scp=<scp>
+-s <scp>
</dt>
<dt class="hdlist1">
--s <scp>
+--scp=<scp>
</dt>
<dd>
<p>
@@ -818,10 +819,10 @@ Identifier.</p></div> </p>
</dd>
<dt class="hdlist1">
---uuid=<UUID_Index>
+-U <UUID_Index>
</dt>
<dt class="hdlist1">
--U <UUID_Index>
+--uuid=<UUID_Index>
</dt>
<dd>
<p>
@@ -830,6 +831,29 @@ Identifier.</p></div> If this field is cleared to 0h,then no UUID index is specified.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -850,7 +874,7 @@ Identifier.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-lockdown.txt b/Documentation/nvme-lockdown.txt index cf8a48f..e17ac70 100644 --- a/Documentation/nvme-lockdown.txt +++ b/Documentation/nvme-lockdown.txt @@ -8,11 +8,12 @@ nvme-lockdown - Send an NVMe Lockdown command to prohibit or allow the execution SYNOPSIS -------- [verse] -'nvme-lockdown' <device> [--ofi=<ofi> | -o <ofi>] +'nvme-lockdown' <device> [--ofi=<ofi> | -O <ofi>] [--ifc=<ifc> | -f <ifc>] [--prhbt=<prhbt> | -p <prhbt>] [--scp=<scp> | -s <scp>] [--uuid=<UUID_Index> | -U <UUID_Index>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -23,34 +24,42 @@ Identifier. OPTIONS ------- +-O <ofi>:: --ofi=<ofi>:: --o <ofi>:: Opcode or Feature Identifier(OFI) specifies the command opcode or Set Features Feature Identifier identified by the Scope field. ---ifc=<ifc>:: -f <ifc>:: +--ifc=<ifc>:: Interface (INF) field identifies the interfaces affected by this command. ---prhbt=<prhbt>:: -p <prhbt>:: +--prhbt=<prhbt>:: Prohibit (PRHBT) bit specifies whether to prohibit or allow the command opcode or Set Features Feature Identifier specified by this command. ---scp=<scp>:: -s <scp>:: +--scp=<scp>:: Scope (SCP) field specifies the contents of the Opcode or Feature Identifier field. - ---uuid=<UUID_Index>:: -U <UUID_Index>:: +--uuid=<UUID_Index>:: UUID Index - If this field is set to a non-zero value, then the value of this field is the index of a UUID in the UUID List that is used by the command. If this field is cleared to 0h,then no UUID index is specified. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet. NVME ---- -Part of the nvme-user suite
\ No newline at end of file +Part of the nvme-user suite diff --git a/Documentation/nvme-media-unit-stat-log.txt b/Documentation/nvme-media-unit-stat-log.txt index 427b77c..997a497 100644 --- a/Documentation/nvme-media-unit-stat-log.txt +++ b/Documentation/nvme-media-unit-stat-log.txt @@ -9,9 +9,8 @@ request, returns result and log. SYNOPSIS -------- [verse] -'nvme media-unit-stat-log' <device> [--dom-id | -d ] - [--output-format=<fmt> | -o <fmt>] - [--raw-binary | -b] +'nvme media-unit-stat-log' <device> [--dom-id | -d] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -26,17 +25,18 @@ On success, the returned Media unit status log pages log structure will be print OPTIONS ------- --o <format>:: ---output-format=<format>:: - This option will set the reporting format to normal, json, or binary. - Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + This option will set the reporting format to normal, json, or binary. + Only one output format can be used at a time. -d:: --dom-id:: - To get the domain ID. + To get the domain ID. + -b:: --raw-binary:: - To show raw binary data. + To show raw binary data. EXAMPLES -------- diff --git a/Documentation/nvme-mi-cmd-support-effects-log.1 b/Documentation/nvme-mi-cmd-support-effects-log.1 index a47a7eb..7163a17 100644 --- a/Documentation/nvme-mi-cmd-support-effects-log.1 +++ b/Documentation/nvme-mi-cmd-support-effects-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-mi-cmd-support-effects-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-MI\-CMD\-SUPPO" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-MI\-CMD\-SUPPO" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,8 +32,8 @@ nvme-mi-cmd-support-effects-log \- Send NVMe MI Command Support and Effects log, .SH "SYNOPSIS" .sp .nf -\fInvme\-mi\-cmd\-support\-effects\-log\fR <device> [\-o <fmt> | \-\-output\-format=<fmt>] - [\-H | \-\-human\-readable] +\fInvme\-mi\-cmd\-support\-effects\-log\fR <device> [\-\-human\-readable | \-H] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -44,17 +44,23 @@ The <device> parameter is mandatory and may be either the NVMe character device On success, the structure may be returned in one of several ways depending on the option flags; the structure may be parsed by the program or the raw buffer may be printed to stdout\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-H, \-\-human\-readable +.RS 4 +This option will parse and format many of the bit fields into human\-readable formats\&. +.RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE .PP -\-H, \-\-human\-readable +\-v, \-\-verbose .RS 4 -This option will parse and format many of the bit fields into human\-readable formats\&. +Increase the information detail in the output\&. .RE .SH "EXAMPLES" .sp diff --git a/Documentation/nvme-mi-cmd-support-effects-log.html b/Documentation/nvme-mi-cmd-support-effects-log.html index ef4846b..f923ad0 100644 --- a/Documentation/nvme-mi-cmd-support-effects-log.html +++ b/Documentation/nvme-mi-cmd-support-effects-log.html @@ -740,7 +740,7 @@ nvme-mi-cmd-support-effects-log(1) Manual Page <h2>NAME</h2>
<div class="sectionbody">
<p>nvme-mi-cmd-support-effects-log -
- Send NVMe MI Command Support and Effects log, returns results and structure
+ Send NVMe MI Command Support and Effects log, returns results and structure
</p>
</div>
</div>
@@ -749,8 +749,8 @@ nvme-mi-cmd-support-effects-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme-mi-cmd-support-effects-log</em> <device> [-o <fmt> | --output-format=<fmt>]
- [-H | --human-readable]</pre>
+<pre class="content"><em>nvme-mi-cmd-support-effects-log</em> <device> [--human-readable | -H]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -772,27 +772,38 @@ raw buffer may be printed to stdout.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-H
</dt>
<dt class="hdlist1">
---output-format=<format>
+--human-readable
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ This option will parse and format many of the bit fields
+ into human-readable formats.
</p>
</dd>
<dt class="hdlist1">
--H
+-o <fmt>
</dt>
<dt class="hdlist1">
---human-readable
+--output-format=<fmt>
</dt>
<dd>
<p>
- This option will parse and format many of the bit fields
- into human-readable formats.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -815,7 +826,7 @@ raw buffer may be printed to stdout.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-mi-cmd-support-effects-log.txt b/Documentation/nvme-mi-cmd-support-effects-log.txt index 67b8355..2221804 100644 --- a/Documentation/nvme-mi-cmd-support-effects-log.txt +++ b/Documentation/nvme-mi-cmd-support-effects-log.txt @@ -4,13 +4,13 @@ nvme-mi-cmd-support-effects-log(1) NAME ---- nvme-mi-cmd-support-effects-log - Send NVMe MI Command Support and Effects log, - returns results and structure +returns results and structure SYNOPSIS -------- [verse] -'nvme-mi-cmd-support-effects-log' <device> [-o <fmt> | --output-format=<fmt>] - [-H | --human-readable] +'nvme-mi-cmd-support-effects-log' <device> [--human-readable | -H] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -26,16 +26,20 @@ raw buffer may be printed to stdout. OPTIONS ------- --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. - -H:: --human-readable:: This option will parse and format many of the bit fields into human-readable formats. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- nvme mi-cmd-support-effects-log /dev/nvme0 -H diff --git a/Documentation/nvme-micron-clear-pcie-errors.1 b/Documentation/nvme-micron-clear-pcie-errors.1 index 326f37e..b4dc9ad 100644 --- a/Documentation/nvme-micron-clear-pcie-errors.1 +++ b/Documentation/nvme-micron-clear-pcie-errors.1 @@ -2,12 +2,12 @@ .\" Title: nvme-micron-clear-pcie-errors .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-MICRON\-CLEAR\" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-MICRON\-CLEAR\" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-micron-clear-pcie-errors.html b/Documentation/nvme-micron-clear-pcie-errors.html index 8458851..e2218e2 100644 --- a/Documentation/nvme-micron-clear-pcie-errors.html +++ b/Documentation/nvme-micron-clear-pcie-errors.html @@ -798,7 +798,7 @@ Retrieve NAND statistics information <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-micron-internal-log.1 b/Documentation/nvme-micron-internal-log.1 index df7d736..5d70916 100644 --- a/Documentation/nvme-micron-internal-log.1 +++ b/Documentation/nvme-micron-internal-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-micron-internal-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-MICRON\-INTERN" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-MICRON\-INTERN" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,7 +36,7 @@ nvme-micron-internal-log \- Retrieve Micron device\*(Aqs internal logs and save .fi .SH "DESCRIPTION" .sp -For the given NVMe device, sends the Micron vendor specific device commands to retrieve various logs (in binary format) and compresses them and saves into specified zip file\&. These vendor unique logs can be analyzed with Micron Technical support team for any device specific issues +For the given NVMe device, sends the Micron vendor specific device commands to retrieve various logs (in binary format) and compresses them and saves into specified zip file\&. These vendor unique logs can be analyzed with Micron Technical support team for any device specific issues\&. .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 diff --git a/Documentation/nvme-micron-internal-log.html b/Documentation/nvme-micron-internal-log.html index 02a1985..da3e119 100644 --- a/Documentation/nvme-micron-internal-log.html +++ b/Documentation/nvme-micron-internal-log.html @@ -757,15 +757,16 @@ nvme-micron-internal-log(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>For the given NVMe device, sends the Micron vendor specific device commands to retrieve
-various logs (in binary format) and compresses them and saves into specified zip file.
-These vendor unique logs can be analyzed with Micron Technical support team for any device
-specific issues</p></div>
+<div class="paragraph"><p>For the given NVMe device, sends the Micron vendor specific device commands to
+retrieve various logs (in binary format) and compresses them and saves into
+specified zip file. These vendor unique logs can be analyzed with Micron
+Technical support team for any device specific issues.</p></div>
<div class="paragraph"><p>The <device> parameter is mandatory and may be either the NVMe
character device (ex: /dev/nvme0), or a namespace block device (ex:
/dev/nvme0n1).</p></div>
-<div class="paragraph"><p>This will only work on Micron devices devices of model numbers 9200 and 54XX. Support
-for new devices may be added subsequently. Results for any other device are undefined.</p></div>
+<div class="paragraph"><p>This will only work on Micron devices devices of model numbers 9200 and 54XX.
+Support for new devices may be added subsequently. Results for any other device
+are undefined.</p></div>
</div>
</div>
<div class="sect1">
@@ -813,7 +814,7 @@ Gets the logs from the device and saves to micron_logs.zip file <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-micron-internal-log.txt b/Documentation/nvme-micron-internal-log.txt index 37a50ad..b8e9228 100644 --- a/Documentation/nvme-micron-internal-log.txt +++ b/Documentation/nvme-micron-internal-log.txt @@ -3,7 +3,8 @@ nvme-micron-internal-log(1) NAME ---- -nvme-micron-internal-log - Retrieve Micron device's internal logs and save to given zip file. +nvme-micron-internal-log - Retrieve Micron device's internal logs and save to +given zip file. SYNOPSIS -------- @@ -12,23 +13,24 @@ SYNOPSIS DESCRIPTION ----------- -For the given NVMe device, sends the Micron vendor specific device commands to retrieve -various logs (in binary format) and compresses them and saves into specified zip file. -These vendor unique logs can be analyzed with Micron Technical support team for any device -specific issues +For the given NVMe device, sends the Micron vendor specific device commands to +retrieve various logs (in binary format) and compresses them and saves into +specified zip file. These vendor unique logs can be analyzed with Micron +Technical support team for any device specific issues. The <device> parameter is mandatory and may be either the NVMe character device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1). -This will only work on Micron devices devices of model numbers 9200 and 54XX. Support -for new devices may be added subsequently. Results for any other device are undefined. +This will only work on Micron devices devices of model numbers 9200 and 54XX. +Support for new devices may be added subsequently. Results for any other device +are undefined. OPTIONS ------- -l <FILE>:: --package=<FILE>:: - name of the file (with .zip extension) to save the device logs + name of the file (with .zip extension) to save the device logs EXAMPLES -------- diff --git a/Documentation/nvme-micron-nand-stats.1 b/Documentation/nvme-micron-nand-stats.1 index 02f4764..b5e2711 100644 --- a/Documentation/nvme-micron-nand-stats.1 +++ b/Documentation/nvme-micron-nand-stats.1 @@ -2,12 +2,12 @@ .\" Title: nvme-micron-nand-stats .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-MICRON\-NAND\-" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-MICRON\-NAND\-" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-micron-nand-stats.html b/Documentation/nvme-micron-nand-stats.html index 919b86f..5a0bcdd 100644 --- a/Documentation/nvme-micron-nand-stats.html +++ b/Documentation/nvme-micron-nand-stats.html @@ -799,7 +799,7 @@ Retrieve NAND statistics information <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-micron-pcie-stats.1 b/Documentation/nvme-micron-pcie-stats.1 index f99df4a..ba2c81c 100644 --- a/Documentation/nvme-micron-pcie-stats.1 +++ b/Documentation/nvme-micron-pcie-stats.1 @@ -2,12 +2,12 @@ .\" Title: nvme-micron-pcie-stats .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-MICRON\-PCIE\-" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-MICRON\-PCIE\-" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-micron-pcie-stats.html b/Documentation/nvme-micron-pcie-stats.html index 9efb712..dfcfcfd 100644 --- a/Documentation/nvme-micron-pcie-stats.html +++ b/Documentation/nvme-micron-pcie-stats.html @@ -799,7 +799,7 @@ Retrieve PCIe error information <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-micron-selective-download.1 b/Documentation/nvme-micron-selective-download.1 index 99a364d..77d8e99 100644 --- a/Documentation/nvme-micron-selective-download.1 +++ b/Documentation/nvme-micron-selective-download.1 @@ -2,12 +2,12 @@ .\" Title: nvme-micron-selective-download .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-MICRON\-SELECT" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-MICRON\-SELECT" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -28,19 +28,20 @@ .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" -nvme-micron-selective-download \- Performs selective firmware download that allows user to select which firmware binary to update for 9200 devices\&. This requires power cycle once the update completes\&. +nvme-micron-selective-download \- Performs selective firmware download that allows user select which firmware binary to update for 9200 devices\&. This requires power cycle the update completes\&. .SH "SYNOPSIS" .sp .nf -\fInvme micron selective\-download\fR <device> [\-\-fw=<FILE>, \-f <FILE>] [\-\-select=<flag>, \-s <flag>] +\fInvme micron selective\-download\fR <device> [\-\-fw=<FILE>, \-f <FILE>] + [\-\-select=<flag>, \-s <flag>] .fi .SH "DESCRIPTION" .sp -This command uses micron vendor specific nvme commands to download given firmware image to the specified 9200 device to update selected or all portions of firmware image\&. +This command uses micron vendor specific nvme commands to download given firmware image to the 9200 device to update selected or all portions of firmware image\&. .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 -This will only work on Micron devices devices of model number 9200\&. Support for new devices may be added subsequently\&. Results for any other device are undefined\&. +This will only work on Micron devices devices of model number 9200\&. Support for new devices be added subsequently\&. Results for any other device are undefined\&. .SH "OPTIONS" .PP \-f <FILE>, \-\-fw=<FILE> diff --git a/Documentation/nvme-micron-selective-download.html b/Documentation/nvme-micron-selective-download.html index d041cb0..0ae4c13 100644 --- a/Documentation/nvme-micron-selective-download.html +++ b/Documentation/nvme-micron-selective-download.html @@ -740,7 +740,7 @@ nvme-micron-selective-download(1) Manual Page <h2>NAME</h2>
<div class="sectionbody">
<p>nvme-micron-selective-download -
- Performs selective firmware download that allows user to select which firmware binary to update for 9200 devices. This requires power cycle once the update completes.
+ Performs selective firmware download that allows user select which firmware binary to update for 9200 devices. This requires power cycle the update completes.
</p>
</div>
</div>
@@ -749,7 +749,8 @@ nvme-micron-selective-download(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme micron selective-download</em> <device> [--fw=<FILE>, -f <FILE>] [--select=<flag>, -s <flag>]</pre>
+<pre class="content"><em>nvme micron selective-download</em> <device> [--fw=<FILE>, -f <FILE>]
+ [--select=<flag>, -s <flag>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -757,13 +758,14 @@ nvme-micron-selective-download(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>This command uses micron vendor specific nvme commands to download given firmware image to the
-specified 9200 device to update selected or all portions of firmware image.</p></div>
+<div class="paragraph"><p>This command uses micron vendor specific nvme commands to download given
+firmware image to the 9200 device to update selected or all portions of firmware
+image.</p></div>
<div class="paragraph"><p>The <device> parameter is mandatory and may be either the NVMe
character device (ex: /dev/nvme0), or a namespace block device (ex:
/dev/nvme0n1).</p></div>
-<div class="paragraph"><p>This will only work on Micron devices devices of model number 9200. Support for new devices
-may be added subsequently. Results for any other device are undefined.</p></div>
+<div class="paragraph"><p>This will only work on Micron devices devices of model number 9200. Support for
+new devices be added subsequently. Results for any other device are undefined.</p></div>
</div>
</div>
<div class="sect1">
@@ -867,7 +869,7 @@ Update eeprom, OOB and main firmware <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-micron-selective-download.txt b/Documentation/nvme-micron-selective-download.txt index 5fb11d7..c20af74 100644 --- a/Documentation/nvme-micron-selective-download.txt +++ b/Documentation/nvme-micron-selective-download.txt @@ -3,38 +3,41 @@ nvme-micron-selective-download(1) NAME ---- -nvme-micron-selective-download - Performs selective firmware download that allows user -to select which firmware binary to update for 9200 devices. This requires power cycle -once the update completes. +nvme-micron-selective-download - Performs selective firmware download that +allows user select which firmware binary to update for 9200 devices. This +requires power cycle the update completes. SYNOPSIS -------- [verse] -'nvme micron selective-download' <device> [--fw=<FILE>, -f <FILE>] [--select=<flag>, -s <flag>] +'nvme micron selective-download' <device> [--fw=<FILE>, -f <FILE>] + [--select=<flag>, -s <flag>] DESCRIPTION ----------- -This command uses micron vendor specific nvme commands to download given firmware image to the -specified 9200 device to update selected or all portions of firmware image. +This command uses micron vendor specific nvme commands to download given +firmware image to the 9200 device to update selected or all portions of firmware +image. The <device> parameter is mandatory and may be either the NVMe character device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1). -This will only work on Micron devices devices of model number 9200. Support for new devices -may be added subsequently. Results for any other device are undefined. +This will only work on Micron devices devices of model number 9200. Support for +new devices be added subsequently. Results for any other device are undefined. OPTIONS ------- -f <FILE>:: --fw=<FILE>:: - name of the firmware image file + name of the firmware image file + -s <flag>:: --select=<flag>:: - flag that has following values - OOB:: This updates the OOB and main firmware\n" - EEP:: This updates the eeprom and main firmware\n" - ALL:: This updates the eeprom, OOB, and main firmware"; + flag that has following values + OOB:: This updates the OOB and main firmware\n" + EEP:: This updates the eeprom and main firmware\n" + ALL:: This updates the eeprom, OOB, and main firmware"; EXAMPLES -------- @@ -42,7 +45,7 @@ EXAMPLES + ------------ # nvme micron selective-download /dev/nvme0 --fw=firmware_bin --select=OOB -# nvme micron selective-download /dev/nvme0 -f firmware_bin -s OOB +# nvme micron selective-download /dev/nvme0 -f firmware_bin -s OOB ------------ * Update OOB and main firmware diff --git a/Documentation/nvme-micron-smart-add-log.1 b/Documentation/nvme-micron-smart-add-log.1 index c514bed..c388df2 100644 --- a/Documentation/nvme-micron-smart-add-log.1 +++ b/Documentation/nvme-micron-smart-add-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-micron-smart-add-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-MICRON\-SMART\" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-MICRON\-SMART\" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,7 +32,7 @@ nvme-micron-smart-add-log \- Retrieves NAND statistics (2200 model drives) or Ex .SH "SYNOPSIS" .sp .nf -\fInvme micron vs\-smart\-add\-log\fR <device> \-f <json|normal> +\fInvme micron vs\-smart\-add\-log\fR <device> \-f <json|normal> .fi .SH "DESCRIPTION" .sp @@ -44,8 +44,11 @@ The \fI\-f\fR option controls the displayed output data format based on the opti .sp This will only work on Micron devices devices of model numbers 54XX and OCP complaint controllers\&. Support for new devices may be added subsequently\&. .SH "OPTIONS" -.sp -\-f <json|normal> controls the format of displayed output\&. +.PP +\-f <json|normal> +.RS 4 +Controls the format of displayed output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-micron-smart-add-log.html b/Documentation/nvme-micron-smart-add-log.html index c87e321..068edce 100644 --- a/Documentation/nvme-micron-smart-add-log.html +++ b/Documentation/nvme-micron-smart-add-log.html @@ -749,7 +749,7 @@ nvme-micron-smart-add-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme micron vs-smart-add-log</em> <device> -f <json|normal></pre>
+<pre class="content"><em>nvme micron vs-smart-add-log</em> <device> -f <json|normal></pre>
<div class="attribution">
</div></div>
</div>
@@ -775,7 +775,16 @@ complaint controllers. Support for new devices may be added subsequently.</p></d <div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
-<div class="paragraph"><p>-f <json|normal> controls the format of displayed output.</p></div>
+<div class="dlist"><dl>
+<dt class="hdlist1">
+-f <json|normal>
+</dt>
+<dd>
+<p>
+ Controls the format of displayed output.
+</p>
+</dd>
+</dl></div>
</div>
</div>
<div class="sect1">
@@ -808,7 +817,7 @@ Retrieve NAND/extended SMART data and display in json format <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-micron-smart-add-log.txt b/Documentation/nvme-micron-smart-add-log.txt index 1fd74ba..13e0d96 100644 --- a/Documentation/nvme-micron-smart-add-log.txt +++ b/Documentation/nvme-micron-smart-add-log.txt @@ -9,7 +9,7 @@ or Extended SMART information (OCP complaint models) of given micron device SYNOPSIS -------- [verse] -'nvme micron vs-smart-add-log' <device> -f <json|normal> +'nvme micron vs-smart-add-log' <device> -f <json|normal> DESCRIPTION ----------- @@ -32,8 +32,8 @@ complaint controllers. Support for new devices may be added subsequently. OPTIONS ------- --f <json|normal> controls the format of displayed output. - +-f <json|normal>:: + Controls the format of displayed output. EXAMPLES -------- diff --git a/Documentation/nvme-micron-temperature-stats.1 b/Documentation/nvme-micron-temperature-stats.1 index 419f619..21eb5cf 100644 --- a/Documentation/nvme-micron-temperature-stats.1 +++ b/Documentation/nvme-micron-temperature-stats.1 @@ -2,12 +2,12 @@ .\" Title: nvme-micron-temperature-stats .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-MICRON\-TEMPER" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-MICRON\-TEMPER" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-micron-temperature-stats.html b/Documentation/nvme-micron-temperature-stats.html index 061aad0..66d3149 100644 --- a/Documentation/nvme-micron-temperature-stats.html +++ b/Documentation/nvme-micron-temperature-stats.html @@ -799,7 +799,7 @@ Retrieve temperature information <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-netapp-ontapdevices.1 b/Documentation/nvme-netapp-ontapdevices.1 index 233e183..507a554 100644 --- a/Documentation/nvme-netapp-ontapdevices.1 +++ b/Documentation/nvme-netapp-ontapdevices.1 @@ -2,12 +2,12 @@ .\" Title: nvme-netapp-ontapdevices .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-NETAPP\-ONTAPD" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-NETAPP\-ONTAPD" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,7 +32,7 @@ nvme-netapp-ontapdevices \- Display information about ONTAP devices .SH "SYNOPSIS" .sp .nf -\fInvme netapp ontapdevices\fR [\-o <fmt> | \-\-output\-format=<fmt>] +\fInvme netapp ontapdevices\fR [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp diff --git a/Documentation/nvme-netapp-ontapdevices.html b/Documentation/nvme-netapp-ontapdevices.html index 6292259..02d30ca 100644 --- a/Documentation/nvme-netapp-ontapdevices.html +++ b/Documentation/nvme-netapp-ontapdevices.html @@ -749,7 +749,7 @@ nvme-netapp-ontapdevices(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme netapp ontapdevices</em> [-o <fmt> | --output-format=<fmt>]</pre>
+<pre class="content"><em>nvme netapp ontapdevices</em> [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -773,8 +773,8 @@ identified using the Identify Controller data.</p></div> </dt>
<dd>
<p>
- Set the reporting format to <em>normal</em> (default), <em>column</em>, or
- <em>json</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em> (default), <em>column</em>, or
+ <em>json</em>. Only one output format can be used at a time.
</p>
</dd>
</dl></div>
@@ -807,7 +807,7 @@ Display information, in a column-based format, for ONTAP devices. <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-netapp-ontapdevices.txt b/Documentation/nvme-netapp-ontapdevices.txt index c292758..fc28947 100644 --- a/Documentation/nvme-netapp-ontapdevices.txt +++ b/Documentation/nvme-netapp-ontapdevices.txt @@ -8,7 +8,7 @@ nvme-netapp-ontapdevices - Display information about ONTAP devices SYNOPSIS -------- [verse] -'nvme netapp ontapdevices' [-o <fmt> | --output-format=<fmt>] +'nvme netapp ontapdevices' [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- @@ -19,8 +19,8 @@ OPTIONS ------- -o <fmt>:: --output-format=<fmt>:: - Set the reporting format to 'normal' (default), 'column', or - 'json'. Only one output format can be used at a time. + Set the reporting format to 'normal' (default), 'column', or + 'json'. Only one output format can be used at a time. EXAMPLES -------- diff --git a/Documentation/nvme-netapp-smdevices.1 b/Documentation/nvme-netapp-smdevices.1 index a86c54d..017489e 100644 --- a/Documentation/nvme-netapp-smdevices.1 +++ b/Documentation/nvme-netapp-smdevices.1 @@ -2,12 +2,12 @@ .\" Title: nvme-netapp-smdevices .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-NETAPP\-SMDEVI" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-NETAPP\-SMDEVI" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,7 +32,7 @@ nvme-netapp-smdevices \- Display information for each NVMe path to an E\-Series .SH "SYNOPSIS" .sp .nf -\fInvme netapp smdevices\fR [\-o <fmt> | \-\-output\-format=<fmt>] +\fInvme netapp smdevices\fR [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp diff --git a/Documentation/nvme-netapp-smdevices.html b/Documentation/nvme-netapp-smdevices.html index b8e896d..39aac53 100644 --- a/Documentation/nvme-netapp-smdevices.html +++ b/Documentation/nvme-netapp-smdevices.html @@ -749,7 +749,7 @@ nvme-netapp-smdevices(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme netapp smdevices</em> [-o <fmt> | --output-format=<fmt>]</pre>
+<pre class="content"><em>nvme netapp smdevices</em> [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -809,7 +809,7 @@ namespace. <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-netapp-smdevices.txt b/Documentation/nvme-netapp-smdevices.txt index b66b98d..cb68acf 100644 --- a/Documentation/nvme-netapp-smdevices.txt +++ b/Documentation/nvme-netapp-smdevices.txt @@ -8,7 +8,7 @@ nvme-netapp-smdevices - Display information for each NVMe path to an E-Series vo SYNOPSIS -------- [verse] -'nvme netapp smdevices' [-o <fmt> | --output-format=<fmt>] +'nvme netapp smdevices' [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- diff --git a/Documentation/nvme-ns-descs.1 b/Documentation/nvme-ns-descs.1 index 034669f..8a18840 100644 --- a/Documentation/nvme-ns-descs.1 +++ b/Documentation/nvme-ns-descs.1 @@ -2,12 +2,12 @@ .\" Title: nvme-ns-descs .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-NS\-DESCS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-NS\-DESCS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,8 @@ nvme-ns-descs \- Send NVMe Identify for a list of Namespace Identification Descr .SH "SYNOPSIS" .sp .nf -\fInvme ns\-descs\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-raw\-binary | \-b] - [\-\-output\-format=<fmt> | \-o <fmt>] +\fInvme ns\-descs\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -55,13 +54,19 @@ Retrieve the identify namespace identification descriptor structure for the give Print the raw buffer to stdout\&. Structure is not parsed by program\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-ns-descs.html b/Documentation/nvme-ns-descs.html index 192432b..19a5a29 100644 --- a/Documentation/nvme-ns-descs.html +++ b/Documentation/nvme-ns-descs.html @@ -749,9 +749,8 @@ nvme-ns-descs(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme ns-descs</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--raw-binary | -b]
- [--output-format=<fmt> | -o <fmt>]</pre>
+<pre class="content"><em>nvme ns-descs</em> <device> [--namespace-id=<nsid> | -n <nsid>] [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -803,15 +802,26 @@ raw buffer may be printed to stdout.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or <em>binary</em>.
- Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -857,7 +867,7 @@ Have the program return the raw structure in binary: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-ns-descs.txt b/Documentation/nvme-ns-descs.txt index 8afeba5..04c6e51 100644 --- a/Documentation/nvme-ns-descs.txt +++ b/Documentation/nvme-ns-descs.txt @@ -9,9 +9,8 @@ nvme-ns-descs - Send NVMe Identify for a list of Namespace Identification SYNOPSIS -------- [verse] -'nvme ns-descs' <device> [--namespace-id=<nsid> | -n <nsid>] - [--raw-binary | -b] - [--output-format=<fmt> | -o <fmt>] +'nvme ns-descs' <device> [--namespace-id=<nsid> | -n <nsid>] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -43,11 +42,14 @@ OPTIONS Print the raw buffer to stdout. Structure is not parsed by program. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or 'binary'. - Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-ns-rescan.1 b/Documentation/nvme-ns-rescan.1 index 35b5285..866fe49 100644 --- a/Documentation/nvme-ns-rescan.1 +++ b/Documentation/nvme-ns-rescan.1 @@ -2,12 +2,12 @@ .\" Title: nvme-ns-rescan .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-NS\-RESCAN" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-NS\-RESCAN" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,14 +32,26 @@ nvme-ns-rescan \- Rescans the nvme namespaces\&. .SH "SYNOPSIS" .sp .nf -\fInvme ns\-rescan\fR <device> +\fInvme ns\-rescan\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp Requests NVMe controller rescans the namespaces\&. The <device> param is mandatory and must be an NVMe character device (ex: /dev/nvme0)\&. .SH "OPTIONS" -.sp -None +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-ns-rescan.html b/Documentation/nvme-ns-rescan.html index 7202c4b..a640801 100644 --- a/Documentation/nvme-ns-rescan.html +++ b/Documentation/nvme-ns-rescan.html @@ -749,7 +749,7 @@ nvme-ns-rescan(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme ns-rescan</em> <device></pre>
+<pre class="content"><em>nvme ns-rescan</em> <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -764,7 +764,31 @@ be an NVMe character device (ex: /dev/nvme0).</p></div> <div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
-<div class="paragraph"><p>None</p></div>
+<div class="dlist"><dl>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
+</dl></div>
</div>
</div>
<div class="sect1">
@@ -794,7 +818,7 @@ Rescans the nvme namespaces. <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-ns-rescan.txt b/Documentation/nvme-ns-rescan.txt index cd41870..5681eab 100644 --- a/Documentation/nvme-ns-rescan.txt +++ b/Documentation/nvme-ns-rescan.txt @@ -8,7 +8,7 @@ nvme-ns-rescan - Rescans the nvme namespaces. SYNOPSIS -------- [verse] -'nvme ns-rescan' <device> +'nvme ns-rescan' <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -17,7 +17,14 @@ be an NVMe character device (ex: /dev/nvme0). OPTIONS ------- -None +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-nvm-id-ctrl.1 b/Documentation/nvme-nvm-id-ctrl.1 index 83cc4fe..e168328 100644 --- a/Documentation/nvme-nvm-id-ctrl.1 +++ b/Documentation/nvme-nvm-id-ctrl.1 @@ -2,12 +2,12 @@ .\" Title: nvme-nvm-id-ctrl .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-NVM\-ID\-CTRL" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-NVM\-ID\-CTRL" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,7 +32,7 @@ nvme-nvm-id-ctrl \- Send NVMe Identify Controller, return NVM command set struct .SH "SYNOPSIS" .sp .nf -\fInvme nvm\-id\-ctrl\fR <device> [\-o <fmt> | \-\-output\-format=<fmt>] +\fInvme nvm\-id\-ctrl\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -43,13 +43,19 @@ The <device> parameter is mandatory and may be either the NVMe character device On success, the data structure returned by the device will be decoded and displayed in one of several ways\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-nvm-id-ctrl.html b/Documentation/nvme-nvm-id-ctrl.html index 25be91a..04438bd 100644 --- a/Documentation/nvme-nvm-id-ctrl.html +++ b/Documentation/nvme-nvm-id-ctrl.html @@ -749,7 +749,7 @@ nvme-nvm-id-ctrl(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme nvm-id-ctrl</em> <device> [-o <fmt> | --output-format=<fmt>]</pre>
+<pre class="content"><em>nvme nvm-id-ctrl</em> <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -770,15 +770,26 @@ displayed in one of several ways.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -821,7 +832,7 @@ Show the output in json format <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-nvm-id-ctrl.txt b/Documentation/nvme-nvm-id-ctrl.txt index fb4a237..eabc4b1 100644 --- a/Documentation/nvme-nvm-id-ctrl.txt +++ b/Documentation/nvme-nvm-id-ctrl.txt @@ -8,7 +8,7 @@ nvme-nvm-id-ctrl - Send NVMe Identify Controller, return NVM command set structu SYNOPSIS -------- [verse] -'nvme nvm-id-ctrl' <device> [-o <fmt> | --output-format=<fmt>] +'nvme nvm-id-ctrl' <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -23,10 +23,14 @@ displayed in one of several ways. OPTIONS ------- --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-nvm-id-ns-lba-format.txt b/Documentation/nvme-nvm-id-ns-lba-format.txt index 638e2fb..1048995 100644 --- a/Documentation/nvme-nvm-id-ns-lba-format.txt +++ b/Documentation/nvme-nvm-id-ns-lba-format.txt @@ -11,8 +11,7 @@ SYNOPSIS [verse] 'nvme nvm-id-ns-lba-format' <device> [--uuid-index=<uuid-index> | -U <uuid_index>] [--lba-format-index=<lba_format_index> | -i <lba_format_index>] - [-v | --verbose] - [--output-format=<fmt> | -o <fmt>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -37,15 +36,15 @@ OPTIONS This field specifies the index into the LBA Format list identifying the LBA Format capabilities that are to be returned +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + -v:: --verbose:: Increase the information detail in the output. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. - EXAMPLES -------- * Has the program interpret the returned buffer and display the known diff --git a/Documentation/nvme-nvm-id-ns.txt b/Documentation/nvme-nvm-id-ns.txt index dfbbfaa..5a8cb09 100644 --- a/Documentation/nvme-nvm-id-ns.txt +++ b/Documentation/nvme-nvm-id-ns.txt @@ -10,8 +10,7 @@ SYNOPSIS [verse] 'nvme nvm-id-ns' <device> [--uuid-index=<uuid-index> | -U <uuid_index>] [--namespace-id=<NUM> | -n <NUM>] - [-v | --verbose] - [--output-format=<fmt> | -o <fmt>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -37,15 +36,15 @@ OPTIONS --uuid-index=<uuid-index>:: UUID Index of the feature +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + -v:: --verbose:: Increase the information detail in the output. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. - EXAMPLES -------- * Has the program interpret the returned buffer and display the known diff --git a/Documentation/nvme-nvme-mi-recv.1 b/Documentation/nvme-nvme-mi-recv.1 index ffa43c7..0926527 100644 --- a/Documentation/nvme-nvme-mi-recv.1 +++ b/Documentation/nvme-nvme-mi-recv.1 @@ -2,12 +2,12 @@ .\" Title: nvme-nvme-mi-recv .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-NVME\-MI\-RECV" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-NVME\-MI\-RECV" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,13 +32,13 @@ nvme-nvme-mi-recv \- Send a NVMe\-MI Receive command to the specified device .SH "SYNOPSIS" .sp .nf -\fInvme nvme\-mi\-recv\fR <device> [\-\-opcode=<opcode> | \-o <opcode>] - [\-\-namespace\-id=<nsid>] - [\-\-data\-len=<data\-len> | \-l <data\-len>] - [\-\-nmimt=<nmimt> | \-m <nmimt>] - [\-\-nmd0=<nmd0> | \-0 <nmd0>] - [\-\-nmd1=<nmd1> | \-1 <nmd1>] - [\-\-input\-file=<file> | \-i <file>] +\fInvme nvme\-mi\-recv\fR <device> [\-\-opcode=<opcode> | \-O <opcode>] + [\-\-namespace\-id=<nsid> | \-n <nsid>] + [\-\-data\-len=<data\-len> | \-l <data\-len>] + [\-\-nmimt=<nmimt> | \-m <nmimt>] + [\-\-nmd0=<nmd0> | \-0 <nmd0>] [\-\-nmd1=<nmd1> | \-1 <nmd1>] + [\-\-input\-file=<file> | \-i <file>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -49,7 +49,7 @@ The <device> parameter is mandatory and may be either the NVMe character device On success it returns 0, error code otherwise\&. .SH "OPTIONS" .PP -\-o <opcode>, \-\-opcode=<opcode> +\-O <opcode>, \-\-opcode=<opcode> .RS 4 The NVMe\-MI opcode to send to the device in the command .RE @@ -83,6 +83,20 @@ The value for the NVMe management request dword 1 in the command\&. .RS 4 If the command is a data\-out (write) command, use this file to fill the buffer sent to the device\&. If no file is given, assumed to use STDIN\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 @@ -99,7 +113,7 @@ Has the program issue a nvme\-mi\-recv to execute the VPD read\&. .RS 4 .\} .nf -# nvme nvme\-mi\-recv /dev/nvme0n1 \-o 5 \-m 1 \-0 0 \-1 0x100 \-l 256 +# nvme nvme\-mi\-recv /dev/nvme0n1 \-O 5 \-m 1 \-0 0 \-1 0x100 \-l 256 .fi .if n \{\ .RE diff --git a/Documentation/nvme-nvme-mi-recv.html b/Documentation/nvme-nvme-mi-recv.html index 7c8ce29..b3e44f9 100644 --- a/Documentation/nvme-nvme-mi-recv.html +++ b/Documentation/nvme-nvme-mi-recv.html @@ -749,13 +749,13 @@ nvme-nvme-mi-recv(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme nvme-mi-recv</em> <device> [--opcode=<opcode> | -o <opcode>]
- [--namespace-id=<nsid>]
- [--data-len=<data-len> | -l <data-len>]
- [--nmimt=<nmimt> | -m <nmimt>]
- [--nmd0=<nmd0> | -0 <nmd0>]
- [--nmd1=<nmd1> | -1 <nmd1>]
- [--input-file=<file> | -i <file>]</pre>
+<pre class="content"><em>nvme nvme-mi-recv</em> <device> [--opcode=<opcode> | -O <opcode>]
+ [--namespace-id=<nsid> | -n <nsid>]
+ [--data-len=<data-len> | -l <data-len>]
+ [--nmimt=<nmimt> | -m <nmimt>]
+ [--nmd0=<nmd0> | -0 <nmd0>] [--nmd1=<nmd1> | -1 <nmd1>]
+ [--input-file=<file> | -i <file>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -774,7 +774,7 @@ device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1).</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <opcode>
+-O <opcode>
</dt>
<dt class="hdlist1">
--opcode=<opcode>
@@ -852,6 +852,29 @@ device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1).</p></div> assumed to use STDIN.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -865,7 +888,7 @@ Has the program issue a nvme-mi-recv to execute the VPD read. </p>
<div class="listingblock">
<div class="content">
-<pre><code># nvme nvme-mi-recv /dev/nvme0n1 -o 5 -m 1 -0 0 -1 0x100 -l 256</code></pre>
+<pre><code># nvme nvme-mi-recv /dev/nvme0n1 -O 5 -m 1 -0 0 -1 0x100 -l 256</code></pre>
</div></div>
</li>
</ul></div>
@@ -882,7 +905,7 @@ Has the program issue a nvme-mi-recv to execute the VPD read. <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-nvme-mi-recv.txt b/Documentation/nvme-nvme-mi-recv.txt index e5130ed..152bbe6 100644..100755 --- a/Documentation/nvme-nvme-mi-recv.txt +++ b/Documentation/nvme-nvme-mi-recv.txt @@ -8,13 +8,13 @@ nvme-nvme-mi-recv - Send a NVMe-MI Receive command to the specified device SYNOPSIS -------- [verse] -'nvme nvme-mi-recv' <device> [--opcode=<opcode> | -o <opcode>] - [--namespace-id=<nsid>] - [--data-len=<data-len> | -l <data-len>] - [--nmimt=<nmimt> | -m <nmimt>] - [--nmd0=<nmd0> | -0 <nmd0>] - [--nmd1=<nmd1> | -1 <nmd1>] - [--input-file=<file> | -i <file>] +'nvme nvme-mi-recv' <device> [--opcode=<opcode> | -O <opcode>] + [--namespace-id=<nsid> | -n <nsid>] + [--data-len=<data-len> | -l <data-len>] + [--nmimt=<nmimt> | -m <nmimt>] + [--nmd0=<nmd0> | -0 <nmd0>] [--nmd1=<nmd1> | -1 <nmd1>] + [--input-file=<file> | -i <file>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -27,7 +27,7 @@ On success it returns 0, error code otherwise. OPTIONS ------- --o <opcode>:: +-O <opcode>:: --opcode=<opcode>:: The NVMe-MI opcode to send to the device in the command @@ -57,12 +57,21 @@ OPTIONS to fill the buffer sent to the device. If no file is given, assumed to use STDIN. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Has the program issue a nvme-mi-recv to execute the VPD read. + ------------ -# nvme nvme-mi-recv /dev/nvme0n1 -o 5 -m 1 -0 0 -1 0x100 -l 256 +# nvme nvme-mi-recv /dev/nvme0n1 -O 5 -m 1 -0 0 -1 0x100 -l 256 ------------ NVME diff --git a/Documentation/nvme-nvme-mi-send.1 b/Documentation/nvme-nvme-mi-send.1 index 9a7df99..7608df8 100644 --- a/Documentation/nvme-nvme-mi-send.1 +++ b/Documentation/nvme-nvme-mi-send.1 @@ -2,12 +2,12 @@ .\" Title: nvme-nvme-mi-send .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-NVME\-MI\-SEND" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-NVME\-MI\-SEND" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,13 +32,13 @@ nvme-nvme-mi-send \- Send a NVMe\-MI Send command to the specified device .SH "SYNOPSIS" .sp .nf -\fInvme nvme\-mi\-send\fR <device> [\-\-opcode=<opcode> | \-o <opcode>] - [\-\-namespace\-id=<nsid>] - [\-\-data\-len=<data\-len> | \-l <data\-len>] - [\-\-nmimt=<nmimt> | \-m <nmimt>] - [\-\-nmd0=<nmd0> | \-0 <nmd0>] - [\-\-nmd1=<nmd1> | \-1 <nmd1>] - [\-\-input\-file=<file> | \-i <file>] +\fInvme nvme\-mi\-send\fR <device> [\-\-opcode=<opcode> | \-O <opcode>] + [\-\-namespace\-id=<nsid> | \-n <nsid>] + [\-\-data\-len=<data\-len> | \-l <data\-len>] + [\-\-nmimt=<nmimt> | \-m <nmimt>] + [\-\-nmd0=<nmd0> | \-0 <nmd0>] [\-\-nmd1=<nmd1> | \-1 <nmd1>] + [\-\-input\-file=<file> | \-i <file>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -49,7 +49,7 @@ The <device> parameter is mandatory and may be either the NVMe character device On success it returns 0, error code otherwise\&. .SH "OPTIONS" .PP -\-o <opcode>, \-\-opcode=<opcode> +\-O <opcode>, \-\-opcode=<opcode> .RS 4 The NVMe\-MI opcode to send to the device in the command .RE @@ -83,6 +83,20 @@ The value for the NVMe management request dword 1 in the command\&. .RS 4 If the command is a data\-out (write) command, use this file to fill the buffer sent to the device\&. If no file is given, assumed to use STDIN\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 @@ -99,7 +113,7 @@ Has the program issue a nvme\-mi\-send to execute the VPD write\&. .RS 4 .\} .nf -# nvme nvme\-mi\-send /dev/nvme0n1 \-o 6 \-m 1 \-0 0 \-1 0x100 \-l 256 \-i vpd\&.bin +# nvme nvme\-mi\-send /dev/nvme0n1 \-O 6 \-m 1 \-0 0 \-1 0x100 \-l 256 \-i vpd\&.bin .fi .if n \{\ .RE diff --git a/Documentation/nvme-nvme-mi-send.html b/Documentation/nvme-nvme-mi-send.html index 00a6e26..203d938 100644 --- a/Documentation/nvme-nvme-mi-send.html +++ b/Documentation/nvme-nvme-mi-send.html @@ -749,13 +749,13 @@ nvme-nvme-mi-send(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme nvme-mi-send</em> <device> [--opcode=<opcode> | -o <opcode>]
- [--namespace-id=<nsid>]
- [--data-len=<data-len> | -l <data-len>]
- [--nmimt=<nmimt> | -m <nmimt>]
- [--nmd0=<nmd0> | -0 <nmd0>]
- [--nmd1=<nmd1> | -1 <nmd1>]
- [--input-file=<file> | -i <file>]</pre>
+<pre class="content"><em>nvme nvme-mi-send</em> <device> [--opcode=<opcode> | -O <opcode>]
+ [--namespace-id=<nsid> | -n <nsid>]
+ [--data-len=<data-len> | -l <data-len>]
+ [--nmimt=<nmimt> | -m <nmimt>]
+ [--nmd0=<nmd0> | -0 <nmd0>] [--nmd1=<nmd1> | -1 <nmd1>]
+ [--input-file=<file> | -i <file>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -774,7 +774,7 @@ device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1).</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <opcode>
+-O <opcode>
</dt>
<dt class="hdlist1">
--opcode=<opcode>
@@ -852,6 +852,29 @@ device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1).</p></div> assumed to use STDIN.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -865,7 +888,7 @@ Has the program issue a nvme-mi-send to execute the VPD write. </p>
<div class="listingblock">
<div class="content">
-<pre><code># nvme nvme-mi-send /dev/nvme0n1 -o 6 -m 1 -0 0 -1 0x100 -l 256 -i vpd.bin</code></pre>
+<pre><code># nvme nvme-mi-send /dev/nvme0n1 -O 6 -m 1 -0 0 -1 0x100 -l 256 -i vpd.bin</code></pre>
</div></div>
</li>
</ul></div>
@@ -882,7 +905,7 @@ Has the program issue a nvme-mi-send to execute the VPD write. <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-nvme-mi-send.txt b/Documentation/nvme-nvme-mi-send.txt index 5139a86..0e80fe7 100644..100755 --- a/Documentation/nvme-nvme-mi-send.txt +++ b/Documentation/nvme-nvme-mi-send.txt @@ -8,13 +8,13 @@ nvme-nvme-mi-send - Send a NVMe-MI Send command to the specified device SYNOPSIS -------- [verse] -'nvme nvme-mi-send' <device> [--opcode=<opcode> | -o <opcode>] - [--namespace-id=<nsid>] - [--data-len=<data-len> | -l <data-len>] - [--nmimt=<nmimt> | -m <nmimt>] - [--nmd0=<nmd0> | -0 <nmd0>] - [--nmd1=<nmd1> | -1 <nmd1>] - [--input-file=<file> | -i <file>] +'nvme nvme-mi-send' <device> [--opcode=<opcode> | -O <opcode>] + [--namespace-id=<nsid> | -n <nsid>] + [--data-len=<data-len> | -l <data-len>] + [--nmimt=<nmimt> | -m <nmimt>] + [--nmd0=<nmd0> | -0 <nmd0>] [--nmd1=<nmd1> | -1 <nmd1>] + [--input-file=<file> | -i <file>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -27,7 +27,7 @@ On success it returns 0, error code otherwise. OPTIONS ------- --o <opcode>:: +-O <opcode>:: --opcode=<opcode>:: The NVMe-MI opcode to send to the device in the command @@ -57,12 +57,21 @@ OPTIONS to fill the buffer sent to the device. If no file is given, assumed to use STDIN. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Has the program issue a nvme-mi-send to execute the VPD write. + ------------ -# nvme nvme-mi-send /dev/nvme0n1 -o 6 -m 1 -0 0 -1 0x100 -l 256 -i vpd.bin +# nvme nvme-mi-send /dev/nvme0n1 -O 6 -m 1 -0 0 -1 0x100 -l 256 -i vpd.bin ------------ NVME diff --git a/Documentation/nvme-ocp-clear-fw-activate-history.1 b/Documentation/nvme-ocp-clear-fw-activate-history.1 index 9d794bf..f0da3cd 100644 --- a/Documentation/nvme-ocp-clear-fw-activate-history.1 +++ b/Documentation/nvme-ocp-clear-fw-activate-history.1 @@ -2,12 +2,12 @@ .\" Title: nvme-ocp-clear-fw-activate-history .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-OCP\-CLEAR\-FW" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-OCP\-CLEAR\-FW" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-ocp-clear-fw-activate-history.html b/Documentation/nvme-ocp-clear-fw-activate-history.html index 24825f8..8eeea64 100644 --- a/Documentation/nvme-ocp-clear-fw-activate-history.html +++ b/Documentation/nvme-ocp-clear-fw-activate-history.html @@ -817,7 +817,7 @@ Clears OCP Firmware Activation History Log for the device: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-ocp-clear-fw-activate-history.txt b/Documentation/nvme-ocp-clear-fw-activate-history.txt index 20ec724..335a228 100644 --- a/Documentation/nvme-ocp-clear-fw-activate-history.txt +++ b/Documentation/nvme-ocp-clear-fw-activate-history.txt @@ -34,7 +34,7 @@ OPTIONS -n:: --no-uuid:: Do not try to automatically detect UUID index for this command (required - for old OCP 1.0 support) + for old OCP 1.0 support) EXAMPLES -------- diff --git a/Documentation/nvme-ocp-clear-pcie-correctable-error-counters.1 b/Documentation/nvme-ocp-clear-pcie-correctable-error-counters.1 index 090fec2..749f58c 100644 --- a/Documentation/nvme-ocp-clear-pcie-correctable-error-counters.1 +++ b/Documentation/nvme-ocp-clear-pcie-correctable-error-counters.1 @@ -2,12 +2,12 @@ .\" Title: nvme-ocp-clear-pcie-correctable-error-counters .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-OCP\-CLEAR\-PC" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-OCP\-CLEAR\-PC" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-ocp-clear-pcie-correctable-error-counters.html b/Documentation/nvme-ocp-clear-pcie-correctable-error-counters.html index 48d3b9a..adec4fa 100644 --- a/Documentation/nvme-ocp-clear-pcie-correctable-error-counters.html +++ b/Documentation/nvme-ocp-clear-pcie-correctable-error-counters.html @@ -817,7 +817,7 @@ Clears PCIe correctable error counters Log for the device: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-ocp-clear-pcie-correctable-error-counters.txt b/Documentation/nvme-ocp-clear-pcie-correctable-error-counters.txt index 92cd148..3d5706d 100644 --- a/Documentation/nvme-ocp-clear-pcie-correctable-error-counters.txt +++ b/Documentation/nvme-ocp-clear-pcie-correctable-error-counters.txt @@ -34,7 +34,7 @@ OPTIONS -n:: --no-uuid:: Do not try to automatically detect UUID index for this command (required - for old OCP 1.0 support) + for old OCP 1.0 support) EXAMPLES -------- diff --git a/Documentation/nvme-ocp-device-capability-log.txt b/Documentation/nvme-ocp-device-capability-log.txt index 7789531..d2f0761 100644 --- a/Documentation/nvme-ocp-device-capability-log.txt +++ b/Documentation/nvme-ocp-device-capability-log.txt @@ -24,8 +24,8 @@ On success it returns 0, error code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal' or 'json' or 'binary'. Only one output format can be used at a time. The default is normal. diff --git a/Documentation/nvme-ocp-eol-plp-failure-mode.1 b/Documentation/nvme-ocp-eol-plp-failure-mode.1 index 87effa5..be65967 100644 --- a/Documentation/nvme-ocp-eol-plp-failure-mode.1 +++ b/Documentation/nvme-ocp-eol-plp-failure-mode.1 @@ -2,12 +2,12 @@ .\" Title: nvme-ocp-eol-plp-failure-mode .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-OCP\-EOL\-PLP\" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-OCP\-EOL\-PLP\" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,8 +32,9 @@ nvme-ocp-eol-plp-failure-mode \- Define and print EOL or PLP circuitry failure m .SH "SYNOPSIS" .sp .nf -\fInvme ocp eol\-plp\-failure\-mode\fR <device> [\-\-mode=<mode> | \-m <mode>] [\-\-no\-uuid | \-n] [\-\-save | \-s] - [\-\-sel=<select> | \-s <select>] +\fInvme ocp eol\-plp\-failure\-mode\fR <device> [\-\-mode=<mode> | \-m <mode>] + [\-\-no\-uuid | \-n] [\-\-save | \-s] + [\-\-sel=<select> | \-s <select>] .fi .SH "DESCRIPTION" .sp diff --git a/Documentation/nvme-ocp-eol-plp-failure-mode.html b/Documentation/nvme-ocp-eol-plp-failure-mode.html index 8b43ad7..8618b20 100644 --- a/Documentation/nvme-ocp-eol-plp-failure-mode.html +++ b/Documentation/nvme-ocp-eol-plp-failure-mode.html @@ -749,8 +749,9 @@ nvme-ocp-eol-plp-failure-mode(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme ocp eol-plp-failure-mode</em> <device> [--mode=<mode> | -m <mode>] [--no-uuid | -n] [--save | -s]
- [--sel=<select> | -s <select>]</pre>
+<pre class="content"><em>nvme ocp eol-plp-failure-mode</em> <device> [--mode=<mode> | -m <mode>]
+ [--no-uuid | -n] [--save | -s]
+ [--sel=<select> | -s <select>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -804,7 +805,8 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Save the attribute so that it persists through all power states and resets.
+ Save the attribute so that it persists through all power states and
+ resets.
</p>
</dd>
<dt class="hdlist1">
@@ -884,7 +886,7 @@ Has the program issue a eol-plp-failure-mode to retrieve the 0xC2 get features. <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-ocp-eol-plp-failure-mode.txt b/Documentation/nvme-ocp-eol-plp-failure-mode.txt index 9a47375..0ebc4ab 100644 --- a/Documentation/nvme-ocp-eol-plp-failure-mode.txt +++ b/Documentation/nvme-ocp-eol-plp-failure-mode.txt @@ -3,13 +3,15 @@ nvme-ocp-eol-plp-failure-mode(1) NAME ---- -nvme-ocp-eol-plp-failure-mode - Define and print EOL or PLP circuitry failure mode +nvme-ocp-eol-plp-failure-mode - Define and print EOL or PLP circuitry failure +mode SYNOPSIS -------- [verse] -'nvme ocp eol-plp-failure-mode' <device> [--mode=<mode> | -m <mode>] [--no-uuid | -n] [--save | -s] - [--sel=<select> | -s <select>] +'nvme ocp eol-plp-failure-mode' <device> [--mode=<mode> | -m <mode>] + [--no-uuid | -n] [--save | -s] + [--sel=<select> | -s <select>] DESCRIPTION ----------- @@ -29,17 +31,18 @@ OPTIONS -m <mode>:: --mode=<mode>:: Set the EOL or PLP circuitry failure mode to [0-3] ('0: default', - '1: rom', '2: wtm' or '3: normal'). Only one mode + '1: rom', '2: wtm' or '3: normal'). Only one mode can be used at a time. The default is rom. -n:: --no-uuid:: Do not try to automatically detect UUID index for this command (required - for old OCP 1.0 support) + for old OCP 1.0 support) -s:: --save:: - Save the attribute so that it persists through all power states and resets. + Save the attribute so that it persists through all power states and + resets. -s <select>:: --sel=<select>:: diff --git a/Documentation/nvme-ocp-error-recovery-log.txt b/Documentation/nvme-ocp-error-recovery-log.txt index edbf4e6..7a26150 100644 --- a/Documentation/nvme-ocp-error-recovery-log.txt +++ b/Documentation/nvme-ocp-error-recovery-log.txt @@ -24,8 +24,8 @@ On success it returns 0, error code otherwise. OPTIONS
-------
--o <format>::
---output-format=<format>::
+-o <fmt>::
+--output-format=<fmt>::
Set the reporting format to 'normal' or 'json' or 'binary'.
Only one output format can be used at a time. The default is normal.
@@ -34,7 +34,7 @@ EXAMPLES * Has the program issue a error-recovery-log command to retrieve the 0xC1 log page.
+
------------
-# nvme ocp unsupported-reqs-log /dev/nvme0 -o normal
+# nvme ocp error-recovery-log /dev/nvme0 -o normal
------------
NVME
diff --git a/Documentation/nvme-ocp-get-plp-health-check-interval.txt b/Documentation/nvme-ocp-get-plp-health-check-interval.txt new file mode 100644 index 0000000..7ecd5d5 --- /dev/null +++ b/Documentation/nvme-ocp-get-plp-health-check-interval.txt @@ -0,0 +1,54 @@ +nvme-ocp-get-plp-health-check-interval(1) +================================ + +NAME +---- +nvme-ocp-get-plp-health-check-interval - Define and print plp-health-check-interval value + +SYNOPSIS +-------- +[verse] +'nvme ocp get-plp-health-check-interval' <device> [--sel=<select> | -s <select>] + +DESCRIPTION +----------- +Define plp-health-check-interval. +No argument prints current mode. + +The <device> parameter is mandatory and may be either the NVMe character +device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1). + +This will only work on OCP compliant devices supporting this feature. +Results for any other device are undefined. + +On success it returns 0, error code otherwise. + +OPTIONS +------- + +-s <select>:: +--sel=<select>:: + Select (SEL): This field specifies which value of the attributes + to return in the provided data: ++ +[] +|================== +|Select|Description +|0|Current +|1|Default +|2|Saved +|3|Supported capabilities +|4-7|Reserved +|================== + +EXAMPLES +-------- +* Has the program issue a get-plp-health-check-interval to retrieve the 0xC6 get features. ++ +------------ +# nvme ocp get-plp-health-check-interval /dev/nvme0 +------------ + +NVME +---- +Part of the nvme-user suite. diff --git a/Documentation/nvme-ocp-latency-monitor-log.1 b/Documentation/nvme-ocp-latency-monitor-log.1 index 3fc507d..10b9743 100644 --- a/Documentation/nvme-ocp-latency-monitor-log.1 +++ b/Documentation/nvme-ocp-latency-monitor-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-ocp-latency-monitor-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-OCP\-LATENCY\-" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-OCP\-LATENCY\-" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -45,7 +45,7 @@ This will only work on OCP compliant devices supporting this log page\&. Results On success it returns 0, error code otherwise\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR diff --git a/Documentation/nvme-ocp-latency-monitor-log.html b/Documentation/nvme-ocp-latency-monitor-log.html index 88282ad..a49acdb 100644 --- a/Documentation/nvme-ocp-latency-monitor-log.html +++ b/Documentation/nvme-ocp-latency-monitor-log.html @@ -770,10 +770,10 @@ Results for any other device are undefined.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -811,7 +811,7 @@ Displays the get latency monitor log for the device: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-ocp-latency-monitor-log.txt b/Documentation/nvme-ocp-latency-monitor-log.txt index 66f760c..a67c523 100644 --- a/Documentation/nvme-ocp-latency-monitor-log.txt +++ b/Documentation/nvme-ocp-latency-monitor-log.txt @@ -26,8 +26,8 @@ On success it returns 0, error code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal' or 'json'. Only one output format can be used at a time. The default is normal. diff --git a/Documentation/nvme-ocp-set-dssd-power-state-feature.txt b/Documentation/nvme-ocp-set-dssd-power-state-feature.txt new file mode 100644 index 0000000..c9ae578 --- /dev/null +++ b/Documentation/nvme-ocp-set-dssd-power-state-feature.txt @@ -0,0 +1,43 @@ +set-dssd-power-state-feature(1) +=============================== + +NAME +---- +nvme-ocp-set-dssd-power-state-feature - Set DSSD Power State + +SYNOPSIS +-------- +[verse] +'nvme ocp set-dssd-power-state-feature' <device> + [--power-state=<fmt> | -p <fmt>] [--no-uuid | -n] + [--save | -s] + +DESCRIPTION +----------- +For the NVMe device given, retrieves OCP DSSD Power state Feature + +The <device> parameter is mandatory and may be either the NVMe character +device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1). + +This will only work on OCP compliant devices supporting this feature. +Results for any other device are undefined. + +On success it returns 0, error code otherwise. + +OPTIONS +------- +-p <fmt>:: +--power-state=<fmt>:: + DSSD Power State to set in watts. + +EXAMPLES +-------- +* Has the program issue a set-dssd-power-state-feature command to set DSSD Power State to set in watts. ++ +------------ +# nvme ocp set-dssd-power-state-feature /dev/nvme0 -p <value> -s <value> -n <value> +------------ + +NVME +---- +Part of the nvme-user suite. diff --git a/Documentation/nvme-ocp-set-plp-health-check-interval.txt b/Documentation/nvme-ocp-set-plp-health-check-interval.txt new file mode 100644 index 0000000..ac3acb3 --- /dev/null +++ b/Documentation/nvme-ocp-set-plp-health-check-interval.txt @@ -0,0 +1,53 @@ +nvme-ocp-set-plp-health-check-interval(1) +================================ + +NAME +---- +nvme-ocp-set-plp-health-check-interval - Define and set PLP health check interval + +SYNOPSIS +-------- +[verse] +'nvme ocp set-plp-health-check-interval' <device> [--plp_health_interval=<plp_health_interval> | -p <plp_health_interval>] [--save | -s] [--no-uuid | -n] + + +DESCRIPTION +----------- +Define Set PLP health check interval. +No argument prints current mode. + +The <device> parameter is mandatory and may be either the NVMe character +device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1). + +This will only work on OCP compliant devices supporting this feature. +Results for any other device are undefined. + +On success it returns 0, error code otherwise. + +OPTIONS +------- +-p <plp_health_interval>:: +--plp_health_interval=<plp_health_interval>:: + Set the plp health check interval [31:16] + +-n:: +--no-uuid:: + Do not try to automatically detect UUID index for this command (required + for old OCP 1.0 support) + +-s:: +--save:: + Save the attribute so that it persists through all power states and resets. + + +EXAMPLES +-------- +* Has the program issue a set-plp-health-check-interval to retrieve the 0xC6 set features. ++ +------------ +# nvme ocp eol-plp-failure-mode /dev/nvme0 +------------ + +NVME +---- +Part of the nvme-user suite. diff --git a/Documentation/nvme-ocp-smart-add-log.1 b/Documentation/nvme-ocp-smart-add-log.1 index 1cbdfb7..d433d84 100644 --- a/Documentation/nvme-ocp-smart-add-log.1 +++ b/Documentation/nvme-ocp-smart-add-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-ocp-smart-add-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-OCP\-SMART\-AD" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-OCP\-SMART\-AD" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -45,7 +45,7 @@ This will only work on OCP compliant devices supporting this feature\&. Results On success it returns 0, error code otherwise\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR diff --git a/Documentation/nvme-ocp-smart-add-log.html b/Documentation/nvme-ocp-smart-add-log.html index 9757c3d..4333149 100644 --- a/Documentation/nvme-ocp-smart-add-log.html +++ b/Documentation/nvme-ocp-smart-add-log.html @@ -771,10 +771,10 @@ Results for any other device are undefined.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -812,7 +812,7 @@ Has the program issue a smart-add-log command to retrieve the 0xC0 log page. <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-ocp-smart-add-log.txt b/Documentation/nvme-ocp-smart-add-log.txt index 3a25822..66a55a9 100644 --- a/Documentation/nvme-ocp-smart-add-log.txt +++ b/Documentation/nvme-ocp-smart-add-log.txt @@ -26,8 +26,8 @@ On success it returns 0, error code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal' or 'json'. Only one output format can be used at a time. The default is normal. diff --git a/Documentation/nvme-ocp-telemetry-string-log-page.txt b/Documentation/nvme-ocp-telemetry-string-log-page.txt new file mode 100644 index 0000000..76349ed --- /dev/null +++ b/Documentation/nvme-ocp-telemetry-string-log-page.txt @@ -0,0 +1,43 @@ +nvme-ocp-telemetry-string-log-page(1) +===================================== + +NAME +---- +nvme-ocp-telemetry-string-log-page - Retrieve OCP Telemetry String Log page + +SYNOPSIS +-------- +[verse] +'nvme ocp telemetry-str-log' <device> [--output-format=<fmt> | -o <fmt>] + +DESCRIPTION +----------- +For the NVMe device given, Retrieve OCP Telemetry String Log page + +The <device> parameter is mandatory and may be either the NVMe character +device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1). + +This will only work on OCP compliant devices supporting this feature. +Results for any other device are undefined. + +On success it returns 0, error code otherwise. + +OPTIONS +------- +-o <fmt>:: +--output-format=<fmt>:: + This option will set the reporting format to normal, json, or binary. + Only one output format can be used at a time. + + +EXAMPLES +-------- +* Has the program issue a telemetry-string-log command to get the log page data from bin file. ++ +------------ +# nvme ocp telemetry-string-log /dev/nvme0n1 +------------ + +NVME +---- +Part of the nvme-user suite. diff --git a/Documentation/nvme-ocp-unsupported-reqs-log-pages.txt b/Documentation/nvme-ocp-unsupported-reqs-log-pages.txt index 65818d3..1657f6a 100644 --- a/Documentation/nvme-ocp-unsupported-reqs-log-pages.txt +++ b/Documentation/nvme-ocp-unsupported-reqs-log-pages.txt @@ -27,8 +27,8 @@ On success it returns 0, error code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: This option will set the reporting format to normal, json, or binary. Only one output format can be used at a time. diff --git a/Documentation/nvme-persistent-event-log.1 b/Documentation/nvme-persistent-event-log.1 index bb5cbda..a8ca1df 100644 --- a/Documentation/nvme-persistent-event-log.1 +++ b/Documentation/nvme-persistent-event-log.1 @@ -2,12 +2,12 @@ .\" Title: persistent-event-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "PERSISTENT\-EVENT\-L" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "PERSISTENT\-EVENT\-L" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,9 +33,8 @@ nvme-persistent-event-log \- Send NVMe persistent event log page request, return .sp .nf \fInvme persistent\-event\-log\fR <device> [\-\-action=<action> | \-a <action>] - [\-\-log\-len=<log\-len> | \-l <log\-len>] - [\-\-raw\-binary | \-b] - [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-log\-len=<log\-len> | \-l <log\-len>] [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -61,13 +60,19 @@ Allocates a buffer of <log\-len> bytes size and requests this many bytes be retu Print the raw persistent event log buffer to stdout\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-persistent-event-log.html b/Documentation/nvme-persistent-event-log.html index f960bea..618a192 100644 --- a/Documentation/nvme-persistent-event-log.html +++ b/Documentation/nvme-persistent-event-log.html @@ -750,9 +750,8 @@ persistent-event-log(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme persistent-event-log</em> <device> [--action=<action> | -a <action>]
- [--log-len=<log-len> | -l <log-len>]
- [--raw-binary | -b]
- [--output-format=<fmt> | -o <fmt>]</pre>
+ [--log-len=<log-len> | -l <log-len>] [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -782,12 +781,12 @@ may be printed to stdout for another program to parse.</p></div> </dt>
<dd>
<p>
- While try to retrieve this log action the controller shall take
- during processing this persistent log page command. This mandatory
- field, based on the value issued it may Read Log Data, Establish
- Context and Read Log Data or Release Context can occur. For More
- details see NVM Express 1.4 Spec. Section 5.14.1.13 Persistent
- Event Log (Log Identifier 0Dh)
+ While try to retrieve this log action the controller shall take
+ during processing this persistent log page command. This mandatory
+ field, based on the value issued it may Read Log Data, Establish
+ Context and Read Log Data or Release Context can occur. For More
+ details see NVM Express 1.4 Spec. Section 5.14.1.13 Persistent
+ Event Log (Log Identifier 0Dh)
</p>
</dd>
<dt class="hdlist1">
@@ -798,10 +797,10 @@ may be printed to stdout for another program to parse.</p></div> </dt>
<dd>
<p>
- Allocates a buffer of <log-len> bytes size and requests this
- many bytes be returned in the constructed NVMe command. This
- param is mandatory. If <log-len> given is 0 and action is 0,
- it will read the Total Log Length(TLL) of the page.
+ Allocates a buffer of <log-len> bytes size and requests this
+ many bytes be returned in the constructed NVMe command. This
+ param is mandatory. If <log-len> given is 0 and action is 0,
+ it will read the Total Log Length(TLL) of the page.
</p>
</dd>
<dt class="hdlist1">
@@ -812,19 +811,30 @@ may be printed to stdout for another program to parse.</p></div> </dt>
<dd>
<p>
- Print the raw persistent event log buffer to stdout.
+ Print the raw persistent event log buffer to stdout.
</p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or <em>binary</em>.
- Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -867,7 +877,7 @@ Print the raw persistent event log to a file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-persistent-event-log.txt b/Documentation/nvme-persistent-event-log.txt index 833491f..cf1cbad 100644 --- a/Documentation/nvme-persistent-event-log.txt +++ b/Documentation/nvme-persistent-event-log.txt @@ -10,9 +10,8 @@ SYNOPSIS -------- [verse] 'nvme persistent-event-log' <device> [--action=<action> | -a <action>] - [--log-len=<log-len> | -l <log-len>] - [--raw-binary | -b] - [--output-format=<fmt> | -o <fmt>] + [--log-len=<log-len> | -l <log-len>] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -31,28 +30,32 @@ OPTIONS ------- -a <action>:: --action=<action>:: - While try to retrieve this log action the controller shall take - during processing this persistent log page command. This mandatory - field, based on the value issued it may Read Log Data, Establish - Context and Read Log Data or Release Context can occur. For More - details see NVM Express 1.4 Spec. Section 5.14.1.13 Persistent - Event Log (Log Identifier 0Dh) + While try to retrieve this log action the controller shall take + during processing this persistent log page command. This mandatory + field, based on the value issued it may Read Log Data, Establish + Context and Read Log Data or Release Context can occur. For More + details see NVM Express 1.4 Spec. Section 5.14.1.13 Persistent + Event Log (Log Identifier 0Dh) -l <log-len>:: --log-len=<log-len>:: - Allocates a buffer of <log-len> bytes size and requests this - many bytes be returned in the constructed NVMe command. This - param is mandatory. If <log-len> given is 0 and action is 0, - it will read the Total Log Length(TLL) of the page. + Allocates a buffer of <log-len> bytes size and requests this + many bytes be returned in the constructed NVMe command. This + param is mandatory. If <log-len> given is 0 and action is 0, + it will read the Total Log Length(TLL) of the page. -b:: --raw-binary:: - Print the raw persistent event log buffer to stdout. + Print the raw persistent event log buffer to stdout. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or 'binary'. - Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-phy-rx-eom-log.txt b/Documentation/nvme-phy-rx-eom-log.txt new file mode 100644 index 0000000..8a31131 --- /dev/null +++ b/Documentation/nvme-phy-rx-eom-log.txt @@ -0,0 +1,68 @@ +nvme-phy-rx-eom-log(1) +====================== + +NAME +---- +nvme-phy-rx-eom-log - Retrieves a Physical Interface Receiver Eye Opening +Measurement log page from an NVMe device + +SYNOPSIS +-------- +[verse] +'nvme phy-rx-eom-log' <device> [--lsp=<field> | -s <field>] + [--controller=<id> | -c <id>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] + +DESCRIPTION +----------- +Retrieves a Physical Interface Receiver Eye Opening Measurement log page from +an NVMe device and provides the 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). + +On success it returns 0, error code otherwise. + +OPTIONS +------- +-s <field>:: +--lsp=<field>:: + The log specified field configuring the controller's action to take + during processing of the command and the measurement quality. + +-c <id>:: +--controller=<id>:: + Controller ID of the controller associated with the PCIe port to be + measured. + +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json', or + 'binary'. Only one output format can be used at a time. + +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + +EXAMPLES +-------- +* Start a best quality measurement and retrieve the log page header ++ +------------ +# nvme phy-rx-eom-log /dev/nvme0 --lsp=10 +------------ + +* Retrieve a finished best quality measurement on controller with ID 3 ++ +------------ +# nvme phy-rx-eom-log /dev/nvme0 --lsp=2 --controller=3 +------------ + +NVME +---- +Part of the nvme-user suite diff --git a/Documentation/nvme-pred-lat-event-agg-log.1 b/Documentation/nvme-pred-lat-event-agg-log.1 index 8636904..b3416bf 100644 --- a/Documentation/nvme-pred-lat-event-agg-log.1 +++ b/Documentation/nvme-pred-lat-event-agg-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-pred-lat-event-agg-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-PRED\-LAT\-EVE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-PRED\-LAT\-EVE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,10 @@ nvme-pred-lat-event-agg-log \- Send Predictable Latency Event Aggregate Log Page .SH "SYNOPSIS" .sp .nf -\fInvme pred\-lat\-event\-agg\-log\fR <device> [\-\-log\-entries=<log_entries> | \-e <log_entries>] +\fInvme pred\-lat\-event\-agg\-log\fR <device> + [\-\-log\-entries=<log_entries> | \-e <log_entries>] [\-\-rae | \-r] [\-\-raw\-binary | \-b] - [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -60,7 +61,7 @@ Retain an Asynchronous Event\&. Print the raw Predictable Latency Event Aggregate log buffer to stdout\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-pred-lat-event-agg-log.html b/Documentation/nvme-pred-lat-event-agg-log.html index bead028..9acd37a 100644 --- a/Documentation/nvme-pred-lat-event-agg-log.html +++ b/Documentation/nvme-pred-lat-event-agg-log.html @@ -749,9 +749,10 @@ nvme-pred-lat-event-agg-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme pred-lat-event-agg-log</em> <device> [--log-entries=<log_entries> | -e <log_entries>]
+<pre class="content"><em>nvme pred-lat-event-agg-log</em> <device>
+ [--log-entries=<log_entries> | -e <log_entries>]
[--rae | -r] [--raw-binary | -b]
- [--output-format=<fmt> | -o <fmt>]</pre>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -782,11 +783,11 @@ another program to parse.</p></div> </dt>
<dd>
<p>
- Retrieve the Predictable Latency Event Aggregate Log pending entries.
- This argument is mandatory and its success may depend on the device’s
- statistics to provide this log For More details see NVM Express 1.4 Spec.
- Section 5.14.1.11. The maximum number of log entries supported is 2044
- for the device.
+ Retrieve the Predictable Latency Event Aggregate Log pending entries.
+ This argument is mandatory and its success may depend on the device’s
+ statistics to provide this log For More details see NVM Express 1.4 Spec.
+ Section 5.14.1.11. The maximum number of log entries supported is 2044
+ for the device.
</p>
</dd>
<dt class="hdlist1">
@@ -812,15 +813,15 @@ another program to parse.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or <em>binary</em>.
- Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em>, or <em>binary</em>.
+ Only one output format can be used at a time.
</p>
</dd>
</dl></div>
@@ -863,7 +864,7 @@ Print the raw Predictable Latency Event Aggregate log to a file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-pred-lat-event-agg-log.txt b/Documentation/nvme-pred-lat-event-agg-log.txt index b01c9bb..6fb8acc 100644 --- a/Documentation/nvme-pred-lat-event-agg-log.txt +++ b/Documentation/nvme-pred-lat-event-agg-log.txt @@ -9,9 +9,10 @@ Page request, returns result and log SYNOPSIS -------- [verse] -'nvme pred-lat-event-agg-log' <device> [--log-entries=<log_entries> | -e <log_entries>] +'nvme pred-lat-event-agg-log' <device> + [--log-entries=<log_entries> | -e <log_entries>] [--rae | -r] [--raw-binary | -b] - [--output-format=<fmt> | -o <fmt>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -31,11 +32,11 @@ OPTIONS ------- -e <log_entries>:: --log-entries=<log_entries>:: - Retrieve the Predictable Latency Event Aggregate Log pending entries. - This argument is mandatory and its success may depend on the device's - statistics to provide this log For More details see NVM Express 1.4 Spec. - Section 5.14.1.11. The maximum number of log entries supported is 2044 - for the device. + Retrieve the Predictable Latency Event Aggregate Log pending entries. + This argument is mandatory and its success may depend on the device's + statistics to provide this log For More details see NVM Express 1.4 Spec. + Section 5.14.1.11. The maximum number of log entries supported is 2044 + for the device. -r:: --rae:: @@ -45,10 +46,10 @@ OPTIONS --raw-binary:: Print the raw Predictable Latency Event Aggregate log buffer to stdout. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or 'binary'. - Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json', or 'binary'. + Only one output format can be used at a time. EXAMPLES -------- diff --git a/Documentation/nvme-predictable-lat-log.1 b/Documentation/nvme-predictable-lat-log.1 index e96b0e6..932646a 100644 --- a/Documentation/nvme-predictable-lat-log.1 +++ b/Documentation/nvme-predictable-lat-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-predictable-lat-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-PREDICTABLE\-L" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-PREDICTABLE\-L" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,7 +34,7 @@ nvme-predictable-lat-log \- Send Predictable latency per NVM set log page reques .nf \fInvme predictable\-lat\-log\fR <device> [\-\-nvmset\-id=<nvmset_id> | \-i <nvmset_id>] [\-\-raw\-binary | \-b] - [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -55,13 +55,19 @@ Retrieve the Predictable latency per NVM set log for the given nvmset id\&. This Print the raw Predictable latency per NVM set log buffer to stdout\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-predictable-lat-log.html b/Documentation/nvme-predictable-lat-log.html index 5419947..4a8fec3 100644 --- a/Documentation/nvme-predictable-lat-log.html +++ b/Documentation/nvme-predictable-lat-log.html @@ -751,7 +751,7 @@ nvme-predictable-lat-log(1) Manual Page <div class="verseblock">
<pre class="content"><em>nvme predictable-lat-log</em> <device> [--nvmset-id=<nvmset_id> | -i <nvmset_id>]
[--raw-binary | -b]
- [--output-format=<fmt> | -o <fmt>]</pre>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -781,10 +781,10 @@ the raw buffer may be printed to stdout for another program to parse.</p></div> </dt>
<dd>
<p>
- Retrieve the Predictable latency per NVM set log for the given nvmset id.
- This argument is mandatory and its success may depend on the device’s
- statistics to provide this log For More details see NVM Express 1.4 Spec.
- Section 5.14.1.10. The default nvmset id to use is 1 for the device.
+ Retrieve the Predictable latency per NVM set log for the given nvmset id.
+ This argument is mandatory and its success may depend on the device’s
+ statistics to provide this log For More details see NVM Express 1.4 Spec.
+ Section 5.14.1.10. The default nvmset id to use is 1 for the device.
</p>
</dd>
<dt class="hdlist1">
@@ -799,15 +799,26 @@ the raw buffer may be printed to stdout for another program to parse.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -850,7 +861,7 @@ Print the raw Predictable latency per NVM set log to a file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-predictable-lat-log.txt b/Documentation/nvme-predictable-lat-log.txt index d1dde80..f0b2ad3 100644 --- a/Documentation/nvme-predictable-lat-log.txt +++ b/Documentation/nvme-predictable-lat-log.txt @@ -11,7 +11,7 @@ SYNOPSIS [verse] 'nvme predictable-lat-log' <device> [--nvmset-id=<nvmset_id> | -i <nvmset_id>] [--raw-binary | -b] - [--output-format=<fmt> | -o <fmt>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -30,19 +30,23 @@ OPTIONS ------- -i <nvmset_id>:: --nvmset-id=<nvmset_id>:: - Retrieve the Predictable latency per NVM set log for the given nvmset id. - This argument is mandatory and its success may depend on the device's - statistics to provide this log For More details see NVM Express 1.4 Spec. - Section 5.14.1.10. The default nvmset id to use is 1 for the device. + Retrieve the Predictable latency per NVM set log for the given nvmset id. + This argument is mandatory and its success may depend on the device's + statistics to provide this log For More details see NVM Express 1.4 Spec. + Section 5.14.1.10. The default nvmset id to use is 1 for the device. -b:: --raw-binary:: Print the raw Predictable latency per NVM set log buffer to stdout. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-primary-ctrl-caps.1 b/Documentation/nvme-primary-ctrl-caps.1 index 74c9884..238716b 100644 --- a/Documentation/nvme-primary-ctrl-caps.1 +++ b/Documentation/nvme-primary-ctrl-caps.1 @@ -2,12 +2,12 @@ .\" Title: nvme-primary-ctrl-caps .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-PRIMARY\-CTRL\" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-PRIMARY\-CTRL\" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,7 +32,7 @@ nvme-primary-ctrl-caps \- Send identify Primary Controller Caps, return result a .SH "SYNOPSIS" .sp .nf -\fInvme primary\-ctrl\-caps\fR <device> [\-o <format> | \-\-output\-format=<format>] +\fInvme primary\-ctrl\-caps\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -43,17 +43,23 @@ The <device> parameter is mandatory and may be either the NVMe character device On success, the structure may be returned in one of several ways depending on the option flags; the structure may be parsed by the program or the raw buffer may be printed to stdout\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-H, \-\-human\-readable +.RS 4 +This option will parse and format many of the bit fields into human\-readable formats\&. +.RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE .PP -\-H, \-\-human\-readable +\-v, \-\-verbose .RS 4 -This option will parse and format many of the bit fields into human\-readable formats\&. +Increase the information detail in the output\&. .RE .SH "EXAMPLES" .sp diff --git a/Documentation/nvme-primary-ctrl-caps.html b/Documentation/nvme-primary-ctrl-caps.html index dfeec00..91f1ae2 100644 --- a/Documentation/nvme-primary-ctrl-caps.html +++ b/Documentation/nvme-primary-ctrl-caps.html @@ -749,7 +749,7 @@ nvme-primary-ctrl-caps(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme primary-ctrl-caps</em> <device> [-o <format> | --output-format=<format>]</pre>
+<pre class="content"><em>nvme primary-ctrl-caps</em> <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -771,27 +771,38 @@ raw buffer may be printed to stdout.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-H
</dt>
<dt class="hdlist1">
---output-format=<format>
+--human-readable
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ This option will parse and format many of the bit fields
+ into human-readable formats.
</p>
</dd>
<dt class="hdlist1">
--H
+-o <fmt>
</dt>
<dt class="hdlist1">
---human-readable
+--output-format=<fmt>
</dt>
<dd>
<p>
- This option will parse and format many of the bit fields
- into human-readable formats.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -835,7 +846,7 @@ fields in a human readable format: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-primary-ctrl-caps.txt b/Documentation/nvme-primary-ctrl-caps.txt index 3edf5c1..0300383 100644 --- a/Documentation/nvme-primary-ctrl-caps.txt +++ b/Documentation/nvme-primary-ctrl-caps.txt @@ -8,7 +8,7 @@ nvme-primary-ctrl-caps - Send identify Primary Controller Caps, return result an SYNOPSIS -------- [verse] -'nvme primary-ctrl-caps' <device> [-o <format> | --output-format=<format>] +'nvme primary-ctrl-caps' <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -24,16 +24,20 @@ raw buffer may be printed to stdout. OPTIONS ------- --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. - -H:: --human-readable:: This option will parse and format many of the bit fields into human-readable formats. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Get Primary Ctrl Caps of the device in default format diff --git a/Documentation/nvme-read.1 b/Documentation/nvme-read.1 index 4d9d9f7..338c904 100644 --- a/Documentation/nvme-read.1 +++ b/Documentation/nvme-read.1 @@ -2,12 +2,12 @@ .\" Title: nvme-read .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-READ" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-READ" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -42,54 +42,50 @@ nvme-read \- Send an NVMe Read command, provide results [\-\-prinfo=<prinfo> | \-p <prinfo>] [\-\-app\-tag\-mask=<appmask> | \-m <appmask>] [\-\-app\-tag=<apptag> | \-a <apptag>] - [\-\-limited\-retry | \-l] - [\-\-force\-unit\-access | \-f] + [\-\-limited\-retry | \-l] [\-\-force\-unit\-access | \-f] [\-\-dir\-type=<type> | \-T <type>] - [\-\-dir\-spec=<spec> | \-S <spec>] - [\-\-dsm=<dsm> | \-D <dsm>] - [\-\-show\-command | \-v] - [\-\-dry\-run | \-w] - [\-\-latency | \-t] + [\-\-dir\-spec=<spec> | \-S <spec>] [\-\-dsm=<dsm> | \-D <dsm>] + [\-\-show\-command | \-V] [\-\-dry\-run | \-w] [\-\-latency | \-t] [\-\-storage\-tag<storage\-tag> | \-g <storage\-tag>] - [\-\-storage\-tag\-check | \-C ] - [\-\-force] + [\-\-storage\-tag\-check | \-C] [\-\-force] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp The Read command reads the logical blocks specified by the command from the medium and copies to the data data buffer provided\&. Will use stdout by default if you don\(cqt provide a file\&. .SH "OPTIONS" .PP -\-\-start\-block=<slba>, \-s <slba> +\-s <slba>, \-\-start\-block=<slba> .RS 4 Start block\&. .RE .PP -\-\-block\-count, \-c +\-c, \-\-block\-count .RS 4 The number of blocks to transfer\&. This is a zeroes based value to align with the kernel\(cqs use of this field\&. (ie\&. 0 means transfer 1 block)\&. .RE .PP -\-\-data\-size=<size>, \-z <size> +\-z <size>, \-\-data\-size=<size> .RS 4 Size of data, in bytes\&. .RE .PP -\-\-metadata\-size=<size>, \-y <size> +\-y <size>, \-\-metadata\-size=<size> .RS 4 Size of metadata in bytes\&. .RE .PP -\-\-data=<data\-file>, \-d <data\-file> +\-d <data\-file>, \-\-data=<data\-file> .RS 4 Data file\&. If none provided, contents are sent to STDOUT\&. .RE .PP -\-\-metadata=<metadata\-file>, \-M <metadata\-file> +\-M <metadata\-file>, \-\-metadata=<metadata\-file> .RS 4 Metadata file, if necessary\&. .RE .PP -\-\-prinfo=<prinfo>, \-p <prinfo> +\-p <prinfo>, \-\-prinfo=<prinfo> .RS 4 Protection Information field definition\&. .TS @@ -134,17 +130,17 @@ T} .sp 1 .RE .PP -\-\-ref\-tag=<reftag>, \-r <reftag> +\-r <reftag>, \-\-ref\-tag=<reftag> .RS 4 Optional reftag when used with protection information\&. .RE .PP -\-\-app\-tag\-mask=<appmask>, \-m <appmask> +\-m <appmask>, \-\-app\-tag\-mask=<appmask> .RS 4 Optional application tag mask when used with protection information\&. .RE .PP -\-\-force\-unit\-access, \-f +\-f, \-\-force\-unit\-access .RS 4 Set the force\-unit access flag\&. .RE @@ -164,7 +160,7 @@ Optional field for directive specifics\&. When used with write streams, this val The optional data set management attributes for this command\&. The argument for this is the least significant 8 bits of the DSM field in a write command; the most significant 16 bits of the field come from the directive specific field, if used\&. This may be used to set attributes for the LBAs being written, like access frequency, type, latency, among other things, as well as yet to be defined types\&. Please consult the NVMe specification for detailed breakdown of how to use this field\&. .RE .PP -\-v, \-\-show\-cmd +\-V, \-\-show\-cmd .RS 4 Print out the command to be sent\&. .RE @@ -196,6 +192,20 @@ This flag enables Storage Tag field checking as part of end\-to\-end data protec .RS 4 Ignore namespace is currently busy and performed the operation even though\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet\&. diff --git a/Documentation/nvme-read.html b/Documentation/nvme-read.html index a881ec2..74b1c64 100644 --- a/Documentation/nvme-read.html +++ b/Documentation/nvme-read.html @@ -759,17 +759,13 @@ nvme-read(1) Manual Page [--prinfo=<prinfo> | -p <prinfo>]
[--app-tag-mask=<appmask> | -m <appmask>]
[--app-tag=<apptag> | -a <apptag>]
- [--limited-retry | -l]
- [--force-unit-access | -f]
+ [--limited-retry | -l] [--force-unit-access | -f]
[--dir-type=<type> | -T <type>]
- [--dir-spec=<spec> | -S <spec>]
- [--dsm=<dsm> | -D <dsm>]
- [--show-command | -v]
- [--dry-run | -w]
- [--latency | -t]
+ [--dir-spec=<spec> | -S <spec>] [--dsm=<dsm> | -D <dsm>]
+ [--show-command | -V] [--dry-run | -w] [--latency | -t]
[--storage-tag<storage-tag> | -g <storage-tag>]
- [--storage-tag-check | -C ]
- [--force]</pre>
+ [--storage-tag-check | -C] [--force]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -787,10 +783,10 @@ by default if you don’t provide a file.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
---start-block=<slba>
+-s <slba>
</dt>
<dt class="hdlist1">
--s <slba>
+--start-block=<slba>
</dt>
<dd>
<p>
@@ -798,10 +794,10 @@ by default if you don’t provide a file.</p></div> </p>
</dd>
<dt class="hdlist1">
---block-count
+-c
</dt>
<dt class="hdlist1">
--c
+--block-count
</dt>
<dd>
<p>
@@ -811,10 +807,10 @@ by default if you don’t provide a file.</p></div> </p>
</dd>
<dt class="hdlist1">
---data-size=<size>
+-z <size>
</dt>
<dt class="hdlist1">
--z <size>
+--data-size=<size>
</dt>
<dd>
<p>
@@ -822,10 +818,10 @@ by default if you don’t provide a file.</p></div> </p>
</dd>
<dt class="hdlist1">
---metadata-size=<size>
+-y <size>
</dt>
<dt class="hdlist1">
--y <size>
+--metadata-size=<size>
</dt>
<dd>
<p>
@@ -833,10 +829,10 @@ by default if you don’t provide a file.</p></div> </p>
</dd>
<dt class="hdlist1">
---data=<data-file>
+-d <data-file>
</dt>
<dt class="hdlist1">
--d <data-file>
+--data=<data-file>
</dt>
<dd>
<p>
@@ -844,10 +840,10 @@ by default if you don’t provide a file.</p></div> </p>
</dd>
<dt class="hdlist1">
---metadata=<metadata-file>
+-M <metadata-file>
</dt>
<dt class="hdlist1">
--M <metadata-file>
+--metadata=<metadata-file>
</dt>
<dd>
<p>
@@ -855,10 +851,10 @@ by default if you don’t provide a file.</p></div> </p>
</dd>
<dt class="hdlist1">
---prinfo=<prinfo>
+-p <prinfo>
</dt>
<dt class="hdlist1">
--p <prinfo>
+--prinfo=<prinfo>
</dt>
<dd>
<p>
@@ -903,10 +899,10 @@ metadata is passes.</p></td> </div>
</dd>
<dt class="hdlist1">
---ref-tag=<reftag>
+-r <reftag>
</dt>
<dt class="hdlist1">
--r <reftag>
+--ref-tag=<reftag>
</dt>
<dd>
<p>
@@ -914,10 +910,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---app-tag-mask=<appmask>
+-m <appmask>
</dt>
<dt class="hdlist1">
--m <appmask>
+--app-tag-mask=<appmask>
</dt>
<dd>
<p>
@@ -925,10 +921,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---force-unit-access
+-f
</dt>
<dt class="hdlist1">
--f
+--force-unit-access
</dt>
<dd>
<p>
@@ -982,7 +978,7 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
--v
+-V
</dt>
<dt class="hdlist1">
--show-cmd
@@ -1048,6 +1044,29 @@ metadata is passes.</p></td> even though.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -1068,7 +1087,7 @@ metadata is passes.</p></td> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-read.txt b/Documentation/nvme-read.txt index 3ceeba1..cecaa71 100644 --- a/Documentation/nvme-read.txt +++ b/Documentation/nvme-read.txt @@ -18,17 +18,13 @@ SYNOPSIS [--prinfo=<prinfo> | -p <prinfo>] [--app-tag-mask=<appmask> | -m <appmask>] [--app-tag=<apptag> | -a <apptag>] - [--limited-retry | -l] - [--force-unit-access | -f] + [--limited-retry | -l] [--force-unit-access | -f] [--dir-type=<type> | -T <type>] - [--dir-spec=<spec> | -S <spec>] - [--dsm=<dsm> | -D <dsm>] - [--show-command | -v] - [--dry-run | -w] - [--latency | -t] + [--dir-spec=<spec> | -S <spec>] [--dsm=<dsm> | -D <dsm>] + [--show-command | -V] [--dry-run | -w] [--latency | -t] [--storage-tag<storage-tag> | -g <storage-tag>] - [--storage-tag-check | -C ] - [--force] + [--storage-tag-check | -C] [--force] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -38,34 +34,34 @@ by default if you don't provide a file. OPTIONS ------- ---start-block=<slba>:: -s <slba>:: +--start-block=<slba>:: Start block. ---block-count:: -c:: +--block-count:: The number of blocks to transfer. This is a zeroes based value to align with the kernel's use of this field. (ie. 0 means transfer 1 block). ---data-size=<size>:: -z <size>:: +--data-size=<size>:: Size of data, in bytes. ---metadata-size=<size>:: -y <size>:: +--metadata-size=<size>:: Size of metadata in bytes. ---data=<data-file>:: -d <data-file>:: +--data=<data-file>:: Data file. If none provided, contents are sent to STDOUT. ---metadata=<metadata-file>:: -M <metadata-file>:: +--metadata=<metadata-file>:: Metadata file, if necessary. ---prinfo=<prinfo>:: -p <prinfo>:: +--prinfo=<prinfo>:: Protection Information field definition. + [] @@ -80,16 +76,16 @@ metadata is passes. |0|Set to 1 enables checking the reference tag |================= ---ref-tag=<reftag>:: -r <reftag>:: +--ref-tag=<reftag>:: Optional reftag when used with protection information. ---app-tag-mask=<appmask>:: -m <appmask>:: +--app-tag-mask=<appmask>:: Optional application tag mask when used with protection information. ---force-unit-access:: -f:: +--force-unit-access:: Set the force-unit access flag. -T <type>:: @@ -117,7 +113,7 @@ metadata is passes. consult the NVMe specification for detailed breakdown of how to use this field. --v:: +-V:: --show-cmd:: Print out the command to be sent. @@ -144,6 +140,15 @@ metadata is passes. Ignore namespace is currently busy and performed the operation even though. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet. diff --git a/Documentation/nvme-reset.1 b/Documentation/nvme-reset.1 index 0ef0b7e..506cbea 100644 --- a/Documentation/nvme-reset.1 +++ b/Documentation/nvme-reset.1 @@ -2,12 +2,12 @@ .\" Title: nvme-reset .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-RESET" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-RESET" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,14 +32,26 @@ nvme-reset \- Reset the nvme controller\&. .SH "SYNOPSIS" .sp .nf -\fInvme reset\fR <device> +\fInvme reset\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp Requests NVMe controller reset\&. The <device> param is mandatory and must be an NVMe character device (ex: /dev/nvme0)\&. .SH "OPTIONS" -.sp -None +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-reset.html b/Documentation/nvme-reset.html index 1296dc7..0bac21c 100644 --- a/Documentation/nvme-reset.html +++ b/Documentation/nvme-reset.html @@ -749,7 +749,7 @@ nvme-reset(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme reset</em> <device></pre>
+<pre class="content"><em>nvme reset</em> <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -764,7 +764,31 @@ be an NVMe character device (ex: /dev/nvme0).</p></div> <div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
-<div class="paragraph"><p>None</p></div>
+<div class="dlist"><dl>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
+</dl></div>
</div>
</div>
<div class="sect1">
@@ -794,7 +818,7 @@ Resets the controller. <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-reset.txt b/Documentation/nvme-reset.txt index d1a282b..20fcbb1 100644 --- a/Documentation/nvme-reset.txt +++ b/Documentation/nvme-reset.txt @@ -8,7 +8,7 @@ nvme-reset - Reset the nvme controller. SYNOPSIS -------- [verse] -'nvme reset' <device> +'nvme reset' <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -17,7 +17,14 @@ be an NVMe character device (ex: /dev/nvme0). OPTIONS ------- -None +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-resv-acquire.1 b/Documentation/nvme-resv-acquire.1 index 14dfff4..2066508 100644 --- a/Documentation/nvme-resv-acquire.1 +++ b/Documentation/nvme-resv-acquire.1 @@ -2,12 +2,12 @@ .\" Title: nvme-resv-acquire .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-RESV\-ACQUIRE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-RESV\-ACQUIRE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,11 +33,11 @@ nvme-resv-acquire \- Acquire an nvme reservation .sp .nf \fInvme resv\-acquire\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-crkey=<crkey> | \-c <crkey>] - [\-\-prkey=<prkey> | \-p <prkey>] - [\-\-rtype=<rtype> | \-t <rtype>] - [\-\-racqa=<racqa> | \-a <racqa>] - [\-\-iekey | \-i] + [\-\-crkey=<crkey> | \-c <crkey>] + [\-\-prkey=<prkey> | \-p <prkey>] + [\-\-rtype=<rtype> | \-t <rtype>] + [\-\-racqa=<racqa> | \-a <racqa>] [\-\-iekey | \-i] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -169,6 +169,20 @@ Ignore Existing Key: If this bit is set to a Indicator option, defaults to \fI0\fR\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet diff --git a/Documentation/nvme-resv-acquire.html b/Documentation/nvme-resv-acquire.html index fbbd31d..3d8e876 100644 --- a/Documentation/nvme-resv-acquire.html +++ b/Documentation/nvme-resv-acquire.html @@ -750,11 +750,11 @@ nvme-resv-acquire(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme resv-acquire</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--crkey=<crkey> | -c <crkey>]
- [--prkey=<prkey> | -p <prkey>]
- [--rtype=<rtype> | -t <rtype>]
- [--racqa=<racqa> | -a <racqa>]
- [--iekey | -i]</pre>
+ [--crkey=<crkey> | -c <crkey>]
+ [--prkey=<prkey> | -p <prkey>]
+ [--rtype=<rtype> | -t <rtype>]
+ [--racqa=<racqa> | -a <racqa>] [--iekey | -i]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -924,10 +924,33 @@ cellspacing="0" cellpadding="4"> <p>
Ignore Existing Key: If this bit is set to a <em>1</em>, then the
Current Reservation Key (CRKEY) check is disabled and the command
- shall succeed regardless of the CRKEY field value.
+ shall succeed regardless of the CRKEY field value.
</p>
<div class="paragraph"><p>Indicator option, defaults to <em>0</em>.</p></div>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -948,7 +971,7 @@ cellspacing="0" cellpadding="4"> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-resv-acquire.txt b/Documentation/nvme-resv-acquire.txt index 1b6e110..19282c6 100644 --- a/Documentation/nvme-resv-acquire.txt +++ b/Documentation/nvme-resv-acquire.txt @@ -9,11 +9,11 @@ SYNOPSIS -------- [verse] 'nvme resv-acquire' <device> [--namespace-id=<nsid> | -n <nsid>] - [--crkey=<crkey> | -c <crkey>] - [--prkey=<prkey> | -p <prkey>] - [--rtype=<rtype> | -t <rtype>] - [--racqa=<racqa> | -a <racqa>] - [--iekey | -i] + [--crkey=<crkey> | -c <crkey>] + [--prkey=<prkey> | -p <prkey>] + [--rtype=<rtype> | -t <rtype>] + [--racqa=<racqa> | -a <racqa>] [--iekey | -i] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -79,10 +79,19 @@ OPTIONS --iekey:: Ignore Existing Key: If this bit is set to a '1', then the Current Reservation Key (CRKEY) check is disabled and the command - shall succeed regardless of the CRKEY field value. + shall succeed regardless of the CRKEY field value. + Indicator option, defaults to '0'. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet diff --git a/Documentation/nvme-resv-notif-log.1 b/Documentation/nvme-resv-notif-log.1 index 3daff9e..1f0a6d4 100644 --- a/Documentation/nvme-resv-notif-log.1 +++ b/Documentation/nvme-resv-notif-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-resv-notif-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-RESV\-NOTIF\-L" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-RESV\-NOTIF\-L" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,7 +32,7 @@ nvme-resv-notif-log \- Send NVMe Reservation Notification log page request, retu .SH "SYNOPSIS" .sp .nf -\fInvme resv\-notif\-log\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] +\fInvme resv\-notif\-log\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -43,13 +43,19 @@ The <device> parameter is mandatory and may be either the NVMe character device On success, the returned Reservation Notification log structure 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 or the raw buffer may be printed to stdout for another program to parse\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-resv-notif-log.html b/Documentation/nvme-resv-notif-log.html index 05775f5..6809559 100644 --- a/Documentation/nvme-resv-notif-log.html +++ b/Documentation/nvme-resv-notif-log.html @@ -740,7 +740,7 @@ nvme-resv-notif-log(1) Manual Page <h2>NAME</h2>
<div class="sectionbody">
<p>nvme-resv-notif-log -
- Send NVMe Reservation Notification log page request, return result and log
+ Send NVMe Reservation Notification log page request, return result and log
</p>
</div>
</div>
@@ -749,7 +749,7 @@ nvme-resv-notif-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme resv-notif-log</em> <device> [--output-format=<fmt> | -o <fmt>]</pre>
+<pre class="content"><em>nvme resv-notif-log</em> <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -772,15 +772,26 @@ may be printed to stdout for another program to parse.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -822,7 +833,7 @@ Print the output in json format: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-resv-notif-log.txt b/Documentation/nvme-resv-notif-log.txt index a9c5cdd..f8d828b 100644 --- a/Documentation/nvme-resv-notif-log.txt +++ b/Documentation/nvme-resv-notif-log.txt @@ -4,12 +4,12 @@ nvme-resv-notif-log(1) NAME ---- nvme-resv-notif-log - Send NVMe Reservation Notification log page request, - return result and log +return result and log SYNOPSIS -------- [verse] -'nvme resv-notif-log' <device> [--output-format=<fmt> | -o <fmt>] +'nvme resv-notif-log' <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -26,10 +26,14 @@ may be printed to stdout for another program to parse. OPTIONS ------- --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-resv-register.1 b/Documentation/nvme-resv-register.1 index 05029fa..383cad0 100644 --- a/Documentation/nvme-resv-register.1 +++ b/Documentation/nvme-resv-register.1 @@ -2,12 +2,12 @@ .\" Title: nvme-resv-register .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-RESV\-REGISTER" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-RESV\-REGISTER" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,11 +33,11 @@ nvme-resv-register \- Register an nvme reservation .sp .nf \fInvme resv\-register\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-crkey=<crkey> | \-c <crkey>] - [\-\-nrkey=<nrkey> | \-k <nrkey>] - [\-\-rrega=<rrega> | \-r <rrega>] - [\-\-cptpl=<cptpl> | \-p <cptpl>] - [\-\-iekey | \-i] + [\-\-crkey=<crkey> | \-c <crkey>] + [\-\-nrkey=<nrkey> | \-k <nrkey>] + [\-\-rrega=<rrega> | \-r <rrega>] + [\-\-cptpl=<cptpl> | \-p <cptpl>] [\-\-iekey | \-i] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -145,6 +145,20 @@ Ignore Existing Key: If this bit is set to a Indicator option, defaults to \fI0\fR\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet diff --git a/Documentation/nvme-resv-register.html b/Documentation/nvme-resv-register.html index ed2481e..c4875dc 100644 --- a/Documentation/nvme-resv-register.html +++ b/Documentation/nvme-resv-register.html @@ -750,11 +750,11 @@ nvme-resv-register(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme resv-register</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--crkey=<crkey> | -c <crkey>]
- [--nrkey=<nrkey> | -k <nrkey>]
- [--rrega=<rrega> | -r <rrega>]
- [--cptpl=<cptpl> | -p <cptpl>]
- [--iekey | -i]</pre>
+ [--crkey=<crkey> | -c <crkey>]
+ [--nrkey=<nrkey> | -k <nrkey>]
+ [--rrega=<rrega> | -r <rrega>]
+ [--cptpl=<cptpl> | -p <cptpl>] [--iekey | -i]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -917,6 +917,29 @@ cellspacing="0" cellpadding="4"> </p>
<div class="paragraph"><p>Indicator option, defaults to <em>0</em>.</p></div>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -937,7 +960,7 @@ cellspacing="0" cellpadding="4"> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-resv-register.txt b/Documentation/nvme-resv-register.txt index e0553f4..4a83050 100644 --- a/Documentation/nvme-resv-register.txt +++ b/Documentation/nvme-resv-register.txt @@ -9,11 +9,11 @@ SYNOPSIS -------- [verse] 'nvme resv-register' <device> [--namespace-id=<nsid> | -n <nsid>] - [--crkey=<crkey> | -c <crkey>] - [--nrkey=<nrkey> | -k <nrkey>] - [--rrega=<rrega> | -r <rrega>] - [--cptpl=<cptpl> | -p <cptpl>] - [--iekey | -i] + [--crkey=<crkey> | -c <crkey>] + [--nrkey=<nrkey> | -k <nrkey>] + [--rrega=<rrega> | -r <rrega>] + [--cptpl=<cptpl> | -p <cptpl>] [--iekey | -i] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -84,6 +84,15 @@ a power loss. + Indicator option, defaults to '0'. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet diff --git a/Documentation/nvme-resv-release.1 b/Documentation/nvme-resv-release.1 index 8f1e158..f10293e 100644 --- a/Documentation/nvme-resv-release.1 +++ b/Documentation/nvme-resv-release.1 @@ -2,12 +2,12 @@ .\" Title: nvme-resv-release .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-RESV\-RELEASE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-RESV\-RELEASE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,10 +33,10 @@ nvme-resv-release \- Release an nvme reservation .sp .nf \fInvme resv\-release\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-crkey=<crkey> | \-c <crkey>] - [\-\-rtype=<rtype> | \-t <rtype>] - [\-\-rrela=<rrela> | \-a <rrela>] - [\-\-iekey | \-i] + [\-\-crkey=<crkey> | \-c <crkey>] + [\-\-rtype=<rtype> | \-t <rtype>] + [\-\-rrela=<rrela> | \-a <rrela>] [\-\-iekey | \-i] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -157,6 +157,20 @@ Ignore Existing Key: If this bit is set to a Indicator option, defaults to \fI0\fR\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet diff --git a/Documentation/nvme-resv-release.html b/Documentation/nvme-resv-release.html index c02dd1b..496f8e8 100644 --- a/Documentation/nvme-resv-release.html +++ b/Documentation/nvme-resv-release.html @@ -750,10 +750,10 @@ nvme-resv-release(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme resv-release</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--crkey=<crkey> | -c <crkey>]
- [--rtype=<rtype> | -t <rtype>]
- [--rrela=<rrela> | -a <rrela>]
- [--iekey | -i]</pre>
+ [--crkey=<crkey> | -c <crkey>]
+ [--rtype=<rtype> | -t <rtype>]
+ [--rrela=<rrela> | -a <rrela>] [--iekey | -i]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -910,6 +910,29 @@ cellspacing="0" cellpadding="4"> </p>
<div class="paragraph"><p>Indicator option, defaults to <em>0</em>.</p></div>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -930,7 +953,7 @@ cellspacing="0" cellpadding="4"> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-resv-release.txt b/Documentation/nvme-resv-release.txt index 6eb0b43..c3dc90d 100644 --- a/Documentation/nvme-resv-release.txt +++ b/Documentation/nvme-resv-release.txt @@ -9,10 +9,10 @@ SYNOPSIS -------- [verse] 'nvme resv-release' <device> [--namespace-id=<nsid> | -n <nsid>] - [--crkey=<crkey> | -c <crkey>] - [--rtype=<rtype> | -t <rtype>] - [--rrela=<rrela> | -a <rrela>] - [--iekey | -i] + [--crkey=<crkey> | -c <crkey>] + [--rtype=<rtype> | -t <rtype>] + [--rrela=<rrela> | -a <rrela>] [--iekey | -i] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -75,6 +75,15 @@ OPTIONS + Indicator option, defaults to '0'. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet diff --git a/Documentation/nvme-resv-report.1 b/Documentation/nvme-resv-report.1 index aee6c8a..c38280b 100644 --- a/Documentation/nvme-resv-report.1 +++ b/Documentation/nvme-resv-report.1 @@ -2,12 +2,12 @@ .\" Title: nvme-resv-report .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-RESV\-REPORT" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-RESV\-REPORT" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,10 +33,9 @@ nvme-resv-report \- Send NVMe Reservation Report, parse the result .sp .nf \fInvme resv\-report\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-numd=<num\-dwords> | \-d <num\-dwords>] - [\-\-eds | \-e] + [\-\-numd=<num\-dwords> | \-d <num\-dwords>] [\-\-eds | \-e] [\-\-raw\-binary | \-b] - [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -66,13 +65,19 @@ Request extended Data Structure: If this bit is set to a Print the raw buffer to stdout\&. Structure is not parsed by program\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet\&. diff --git a/Documentation/nvme-resv-report.html b/Documentation/nvme-resv-report.html index 0a0e33b..fc96975 100644 --- a/Documentation/nvme-resv-report.html +++ b/Documentation/nvme-resv-report.html @@ -750,10 +750,9 @@ nvme-resv-report(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme resv-report</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--numd=<num-dwords> | -d <num-dwords>]
- [--eds | -e]
+ [--numd=<num-dwords> | -d <num-dwords>] [--eds | -e]
[--raw-binary | -b]
- [--output-format=<fmt> | -o <fmt>]</pre>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -824,15 +823,26 @@ Controller data structure for each such controller).</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -855,7 +865,7 @@ Controller data structure for each such controller).</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-resv-report.txt b/Documentation/nvme-resv-report.txt index 32012fe..2e12826 100644 --- a/Documentation/nvme-resv-report.txt +++ b/Documentation/nvme-resv-report.txt @@ -9,10 +9,9 @@ SYNOPSIS -------- [verse] 'nvme resv-report' <device> [--namespace-id=<nsid> | -n <nsid>] - [--numd=<num-dwords> | -d <num-dwords>] - [--eds | -e] + [--numd=<num-dwords> | -d <num-dwords>] [--eds | -e] [--raw-binary | -b] - [--output-format=<fmt> | -o <fmt>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -48,11 +47,14 @@ OPTIONS Print the raw buffer to stdout. Structure is not parsed by program. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-rpmb.1 b/Documentation/nvme-rpmb.1 index 52aed1c..5c6325e 100644 --- a/Documentation/nvme-rpmb.1 +++ b/Documentation/nvme-rpmb.1 @@ -2,12 +2,12 @@ .\" Title: nvme-rpmb .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-RPMB" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-RPMB" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,13 +33,13 @@ nvme-rpmb \- Send RPMB commands to an NVMe device .sp .nf \fInvme rpmb\fR <device> [\-\-cmd=<command> | \-c <command>] - [\-\-msgfile=<data\-file> | \-f <data\-file>] - [\-\-keyfile=<key\-file> | \-g <key\-file>] - [\-\-key=<key> | \-k <key>] - [\-\-msg=<data> | \-d <data>] - [\-\-address=<offset> | \-o <offset>] - [\-\-blocks=<512 byte sectors> | \-b <sectors> ] - [\-\-target=<target\-id> | \-t <id> ] + [\-\-msgfile=<data\-file> | \-f <data\-file>] + [\-\-keyfile=<key\-file> | \-g <key\-file>] + [\-\-key=<key> | \-k <key>] [\-\-msg=<data> | \-d <data>] + [\-\-address=<offset> | \-o <offset>] + [\-\-blocks=<512 byte sectors> | \-b <sectors>] + [\-\-target=<target\-id> | \-t <id>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -181,6 +181,20 @@ The address (in 512 byte sector offset from 0) to be used for data transfer comm .RS 4 The size in 512 byte sectors to be used for data transfer commands (read or write) for a specified RPMB target\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-rpmb.html b/Documentation/nvme-rpmb.html index 490fd07..76addf4 100644 --- a/Documentation/nvme-rpmb.html +++ b/Documentation/nvme-rpmb.html @@ -750,13 +750,13 @@ nvme-rpmb(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme rpmb</em> <device> [--cmd=<command> | -c <command>]
- [--msgfile=<data-file> | -f <data-file>]
- [--keyfile=<key-file> | -g <key-file>]
- [--key=<key> | -k <key>]
- [--msg=<data> | -d <data>]
- [--address=<offset> | -o <offset>]
- [--blocks=<512 byte sectors> | -b <sectors> ]
- [--target=<target-id> | -t <id> ]</pre>
+ [--msgfile=<data-file> | -f <data-file>]
+ [--keyfile=<key-file> | -g <key-file>]
+ [--key=<key> | -k <key>] [--msg=<data> | -d <data>]
+ [--address=<offset> | -o <offset>]
+ [--blocks=<512 byte sectors> | -b <sectors>]
+ [--target=<target-id> | -t <id>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -921,6 +921,29 @@ default address if no -address or -o option is specified,</code></pre> (read or write) for a specified RPMB target.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -1001,7 +1024,7 @@ data onto output.bin <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-rpmb.txt b/Documentation/nvme-rpmb.txt index c30c83d..9dc954d 100644 --- a/Documentation/nvme-rpmb.txt +++ b/Documentation/nvme-rpmb.txt @@ -9,13 +9,13 @@ SYNOPSIS -------- [verse] 'nvme rpmb' <device> [--cmd=<command> | -c <command>] - [--msgfile=<data-file> | -f <data-file>] - [--keyfile=<key-file> | -g <key-file>] - [--key=<key> | -k <key>] - [--msg=<data> | -d <data>] - [--address=<offset> | -o <offset>] - [--blocks=<512 byte sectors> | -b <sectors> ] - [--target=<target-id> | -t <id> ] + [--msgfile=<data-file> | -f <data-file>] + [--keyfile=<key-file> | -g <key-file>] + [--key=<key> | -k <key>] [--msg=<data> | -d <data>] + [--address=<offset> | -o <offset>] + [--blocks=<512 byte sectors> | -b <sectors>] + [--target=<target-id> | -t <id>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -71,7 +71,7 @@ OPTIONS nvme-rpmb without sending it to device. RPMB target 0 is used as the default target if --target or -t is not specified. 0x0 is used as the default address if no -address or -o option is specified, - + -t <target>:: --target=<target>:: RPMB target id. This should be one of the supported RPMB targets as @@ -105,6 +105,15 @@ OPTIONS The size in 512 byte sectors to be used for data transfer commands (read or write) for a specified RPMB target. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Print RPMB support information of an NVMe device @@ -147,4 +156,3 @@ EXAMPLES NVME ---- Part of the nvme-user suite - diff --git a/Documentation/nvme-sanitize-log.1 b/Documentation/nvme-sanitize-log.1 index 143a1aa..7bf1cfb 100644 --- a/Documentation/nvme-sanitize-log.1 +++ b/Documentation/nvme-sanitize-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-sanitize-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SANITIZE\-LOG" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SANITIZE\-LOG" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,9 @@ nvme-sanitize-log \- Send NVMe sanitize\-log Command, return result .SH "SYNOPSIS" .sp .nf -\fInvme sanitize\-log\fR <device> [\-\-rae | \-r] [\-\-output\-format=<fmt> | \-o <fmt>] - [\-\-human\-readable | \-H] - [\-\-raw\-binary | \-b] +\fInvme sanitize\-log\fR <device> [\-\-rae | \-r] [\-\-human\-readable | \-H] + [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -105,14 +105,6 @@ On success it returns 0, error code otherwise\&. Retain an Asynchronous Event\&. .RE .PP -\-o <format>, \-\-output\-format=<format> -.RS 4 -Set the reporting format to -\fInormal\fR, -\fIjson\fR, or -\fIbinary\fR\&. Only one output format can be used at a time\&. -.RE -.PP \-H, \-\-human\-readable .RS 4 This option will parse and format many of the bit fields into human\-readable formats\&. @@ -122,6 +114,20 @@ This option will parse and format many of the bit fields into human\-readable fo .RS 4 Print the raw buffer to stdout\&. Structure is not parsed by program\&. This overrides the vendor specific and human readable options\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-sanitize-log.html b/Documentation/nvme-sanitize-log.html index d421e62..f6e0c2a 100644 --- a/Documentation/nvme-sanitize-log.html +++ b/Documentation/nvme-sanitize-log.html @@ -749,9 +749,9 @@ nvme-sanitize-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme sanitize-log</em> <device> [--rae | -r] [--output-format=<fmt> | -o <fmt>]
- [--human-readable | -H]
- [--raw-binary | -b]</pre>
+<pre class="content"><em>nvme sanitize-log</em> <device> [--rae | -r] [--human-readable | -H]
+ [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -798,11 +798,11 @@ cellspacing="0" cellpadding="4"> <td align="left" valign="top"><p class="table">Global Data Erased bit
If set to 1 then non-volatile storage in the NVM subsystem has
not been written to:
- a) since being manufactured and the NVM subsystem has never been sanitized; or
- b) since the most recent successful sanitize operation.
+ a) since being manufactured and the NVM subsystem has never been sanitized; or
+ b) since the most recent successful sanitize operation.
If cleared to 0, then non-volatile storage in the NVM subsystem has been written to:
- a) since being manufactured and the NVM subsystem has never been sanitized; or
- b) since the most recent successful sanitize operation of the NVM subsystem.</p></td>
+ a) since being manufactured and the NVM subsystem has never been sanitized; or
+ b) since the most recent successful sanitize operation of the NVM subsystem.</p></td>
</tr>
</tbody>
</table>
@@ -827,18 +827,6 @@ If cleared to 0, then non-volatile storage in the NVM subsystem has been written </p>
</dd>
<dt class="hdlist1">
--o <format>
-</dt>
-<dt class="hdlist1">
---output-format=<format>
-</dt>
-<dd>
-<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
-</p>
-</dd>
-<dt class="hdlist1">
-H
</dt>
<dt class="hdlist1">
@@ -862,6 +850,29 @@ If cleared to 0, then non-volatile storage in the NVM subsystem has been written program. This overrides the vendor specific and human readable options.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -892,7 +903,7 @@ Has the program issue Sanitize-log Command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-sanitize-log.txt b/Documentation/nvme-sanitize-log.txt index 3c2d43e..af45e9f 100644 --- a/Documentation/nvme-sanitize-log.txt +++ b/Documentation/nvme-sanitize-log.txt @@ -8,9 +8,9 @@ nvme-sanitize-log - Send NVMe sanitize-log Command, return result SYNOPSIS -------- [verse] -'nvme sanitize-log' <device> [--rae | -r] [--output-format=<fmt> | -o <fmt>] - [--human-readable | -H] - [--raw-binary | -b] +'nvme sanitize-log' <device> [--rae | -r] [--human-readable | -H] + [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -41,11 +41,11 @@ Expected status and description :- |Global Data Erased bit If set to 1 then non-volatile storage in the NVM subsystem has not been written to: - a) since being manufactured and the NVM subsystem has never been sanitized; or - b) since the most recent successful sanitize operation. + a) since being manufactured and the NVM subsystem has never been sanitized; or + b) since the most recent successful sanitize operation. If cleared to 0, then non-volatile storage in the NVM subsystem has been written to: - a) since being manufactured and the NVM subsystem has never been sanitized; or - b) since the most recent successful sanitize operation of the NVM subsystem. + a) since being manufactured and the NVM subsystem has never been sanitized; or + b) since the most recent successful sanitize operation of the NVM subsystem. |=== Sanitize Progress - percentage complete @@ -58,11 +58,6 @@ OPTIONS --rae:: Retain an Asynchronous Event. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. - -H:: --human-readable:: This option will parse and format many of the bit fields @@ -73,6 +68,15 @@ OPTIONS Print the raw buffer to stdout. Structure is not parsed by program. This overrides the vendor specific and human readable options. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Has the program issue Sanitize-log Command : diff --git a/Documentation/nvme-sanitize.1 b/Documentation/nvme-sanitize.1 index 7a71f4f..793f2d1 100644 --- a/Documentation/nvme-sanitize.1 +++ b/Documentation/nvme-sanitize.1 @@ -2,12 +2,12 @@ .\" Title: nvme-sanitize .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SANITIZE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SANITIZE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,13 +32,12 @@ nvme-sanitize \- Send NVMe Sanitize Command, return result .SH "SYNOPSIS" .sp .nf -\fInvme sanitize\fR <device> [\-\-no\-dealloc | \-d] - [\-\-oipbp | \-i] - [\-\-owpass=<overwrite\-pass\-count> | \-n <overwrite\-pass\-count>] - [\-\-ause | \-u] - [\-\-sanact=<action> | \-a <action>] - [\-\-ovrpat=<overwrite\-pattern> | \-p <overwrite\-pattern>] - [\-\-force] +\fInvme sanitize\fR <device> [\-\-no\-dealloc | \-d] [\-\-oipbp | \-i] + [\-\-owpass=<overwrite\-pass\-count> | \-n <overwrite\-pass\-count>] + [\-\-ause | \-u] [\-\-sanact=<action> | \-a <action>] + [\-\-ovrpat=<overwrite\-pattern> | \-p <overwrite\-pattern>] + [\-\-force] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -127,6 +126,20 @@ Overwrite Pattern: This field is ignored unless the Sanitize Action field in Com .RS 4 Ignore namespace is currently busy and performed the operation even though\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-sanitize.html b/Documentation/nvme-sanitize.html index a9f3e99..de92545 100644 --- a/Documentation/nvme-sanitize.html +++ b/Documentation/nvme-sanitize.html @@ -749,13 +749,12 @@ nvme-sanitize(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme sanitize</em> <device> [--no-dealloc | -d]
- [--oipbp | -i]
- [--owpass=<overwrite-pass-count> | -n <overwrite-pass-count>]
- [--ause | -u]
- [--sanact=<action> | -a <action>]
- [--ovrpat=<overwrite-pattern> | -p <overwrite-pattern>]
- [--force]</pre>
+<pre class="content"><em>nvme sanitize</em> <device> [--no-dealloc | -d] [--oipbp | -i]
+ [--owpass=<overwrite-pass-count> | -n <overwrite-pass-count>]
+ [--ause | -u] [--sanact=<action> | -a <action>]
+ [--ovrpat=<overwrite-pattern> | -p <overwrite-pattern>]
+ [--force]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -781,13 +780,13 @@ provides the result.</p></div> </dt>
<dd>
<p>
- No Deallocate After Sanitize:
- If set, then the controller shall not deallocate any logical
- blocks as a result of successfully completing the sanitize
- operation. If cleared, then the controller should deallocate
- logical blocks as a result of successfully completing the
- sanitize operation. This bit shall be ignored if the Sanitize
- Action field is set to 001b (i.e., Exit Failure Mode).
+ No Deallocate After Sanitize:
+ If set, then the controller shall not deallocate any logical
+ blocks as a result of successfully completing the sanitize
+ operation. If cleared, then the controller should deallocate
+ logical blocks as a result of successfully completing the
+ sanitize operation. This bit shall be ignored if the Sanitize
+ Action field is set to 001b (i.e., Exit Failure Mode).
</p>
</dd>
<dt class="hdlist1">
@@ -798,11 +797,11 @@ provides the result.</p></div> </dt>
<dd>
<p>
- Overwrite Invert Pattern Between Passes:
- If set, then the Overwrite Pattern shall be inverted between
- passes. If cleared, then the overwrite pattern shall not be
- inverted between passes. This bit shall be ignored unless the
- Sanitize Action field is set to 011b (i.e., Overwrite).
+ Overwrite Invert Pattern Between Passes:
+ If set, then the Overwrite Pattern shall be inverted between
+ passes. If cleared, then the overwrite pattern shall not be
+ inverted between passes. This bit shall be ignored unless the
+ Sanitize Action field is set to 011b (i.e., Overwrite).
</p>
</dd>
<dt class="hdlist1">
@@ -813,12 +812,12 @@ provides the result.</p></div> </dt>
<dd>
<p>
- Overwrite Pass Count:
- This field specifies the number of overwrite passes (i.e.,
- how many times the media is to be overwritten) using the data
- from the Overwrite Pattern field of this command. A value of 0
- specifies 16 overwrite passes. This field shall be ignored
- unless the Sanitize Action field is set to 011b (i.e., Overwrite).
+ Overwrite Pass Count:
+ This field specifies the number of overwrite passes (i.e.,
+ how many times the media is to be overwritten) using the data
+ from the Overwrite Pattern field of this command. A value of 0
+ specifies 16 overwrite passes. This field shall be ignored
+ unless the Sanitize Action field is set to 011b (i.e., Overwrite).
</p>
</dd>
<dt class="hdlist1">
@@ -829,11 +828,11 @@ provides the result.</p></div> </dt>
<dd>
<p>
- Allow Unrestricted Sanitize Exit:
- If set, then the sanitize operation is performed in unrestricted
- completion mode. If cleared then the sanitize operation is
- performed in restricted completion mode. This bit shall be ignored
- if the Sanitize Action field is set to 001b (i.e., Exit Failure Mode).
+ Allow Unrestricted Sanitize Exit:
+ If set, then the sanitize operation is performed in unrestricted
+ completion mode. If cleared then the sanitize operation is
+ performed in restricted completion mode. This bit shall be ignored
+ if the Sanitize Action field is set to 001b (i.e., Exit Failure Mode).
</p>
</dd>
<dt class="hdlist1">
@@ -844,7 +843,7 @@ provides the result.</p></div> </dt>
<dd>
<p>
- Sanitize Action:
+ Sanitize Action:
</p>
<div class="tableblock">
<table rules="all"
@@ -890,11 +889,11 @@ cellspacing="0" cellpadding="4"> </dt>
<dd>
<p>
- Overwrite Pattern:
- This field is ignored unless the Sanitize Action field in
- Command Dword 10 is set to 011b (i.e., Overwrite). This field
- specifies a 32-bit pattern that is used for the Overwrite
- sanitize operation.
+ Overwrite Pattern:
+ This field is ignored unless the Sanitize Action field in
+ Command Dword 10 is set to 011b (i.e., Overwrite). This field
+ specifies a 32-bit pattern that is used for the Overwrite
+ sanitize operation.
</p>
</dd>
<dt class="hdlist1">
@@ -902,8 +901,31 @@ cellspacing="0" cellpadding="4"> </dt>
<dd>
<p>
- Ignore namespace is currently busy and performed the operation
- even though.
+ Ignore namespace is currently busy and performed the operation
+ even though.
+</p>
+</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -938,7 +960,7 @@ Has the program issue Sanitize Command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-sanitize.txt b/Documentation/nvme-sanitize.txt index c3b9af2..1e43463 100644 --- a/Documentation/nvme-sanitize.txt +++ b/Documentation/nvme-sanitize.txt @@ -8,13 +8,12 @@ nvme-sanitize - Send NVMe Sanitize Command, return result SYNOPSIS -------- [verse] -'nvme sanitize' <device> [--no-dealloc | -d] - [--oipbp | -i] - [--owpass=<overwrite-pass-count> | -n <overwrite-pass-count>] - [--ause | -u] - [--sanact=<action> | -a <action>] - [--ovrpat=<overwrite-pattern> | -p <overwrite-pattern>] - [--force] +'nvme sanitize' <device> [--no-dealloc | -d] [--oipbp | -i] + [--owpass=<overwrite-pass-count> | -n <overwrite-pass-count>] + [--ause | -u] [--sanact=<action> | -a <action>] + [--ovrpat=<overwrite-pattern> | -p <overwrite-pattern>] + [--force] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -29,42 +28,42 @@ OPTIONS ------- -d:: --no-dealloc:: - No Deallocate After Sanitize: - If set, then the controller shall not deallocate any logical - blocks as a result of successfully completing the sanitize - operation. If cleared, then the controller should deallocate - logical blocks as a result of successfully completing the - sanitize operation. This bit shall be ignored if the Sanitize - Action field is set to 001b (i.e., Exit Failure Mode). + No Deallocate After Sanitize: + If set, then the controller shall not deallocate any logical + blocks as a result of successfully completing the sanitize + operation. If cleared, then the controller should deallocate + logical blocks as a result of successfully completing the + sanitize operation. This bit shall be ignored if the Sanitize + Action field is set to 001b (i.e., Exit Failure Mode). -i:: --oipbp:: - Overwrite Invert Pattern Between Passes: - If set, then the Overwrite Pattern shall be inverted between - passes. If cleared, then the overwrite pattern shall not be - inverted between passes. This bit shall be ignored unless the - Sanitize Action field is set to 011b (i.e., Overwrite). + Overwrite Invert Pattern Between Passes: + If set, then the Overwrite Pattern shall be inverted between + passes. If cleared, then the overwrite pattern shall not be + inverted between passes. This bit shall be ignored unless the + Sanitize Action field is set to 011b (i.e., Overwrite). -n <overwrite-pass-count>:: --owpass=<overwrite-pass-count>:: - Overwrite Pass Count: - This field specifies the number of overwrite passes (i.e., - how many times the media is to be overwritten) using the data - from the Overwrite Pattern field of this command. A value of 0 - specifies 16 overwrite passes. This field shall be ignored - unless the Sanitize Action field is set to 011b (i.e., Overwrite). + Overwrite Pass Count: + This field specifies the number of overwrite passes (i.e., + how many times the media is to be overwritten) using the data + from the Overwrite Pattern field of this command. A value of 0 + specifies 16 overwrite passes. This field shall be ignored + unless the Sanitize Action field is set to 011b (i.e., Overwrite). -u:: --ause:: - Allow Unrestricted Sanitize Exit: - If set, then the sanitize operation is performed in unrestricted - completion mode. If cleared then the sanitize operation is - performed in restricted completion mode. This bit shall be ignored - if the Sanitize Action field is set to 001b (i.e., Exit Failure Mode). + Allow Unrestricted Sanitize Exit: + If set, then the sanitize operation is performed in unrestricted + completion mode. If cleared then the sanitize operation is + performed in restricted completion mode. This bit shall be ignored + if the Sanitize Action field is set to 001b (i.e., Exit Failure Mode). -a <action>:: --sanact=<action>:: - Sanitize Action: + Sanitize Action: + [] |================= @@ -78,15 +77,24 @@ OPTIONS -p <overwrite-pattern>:: --ovrpat=<overwrite-pattern>:: - Overwrite Pattern: - This field is ignored unless the Sanitize Action field in - Command Dword 10 is set to 011b (i.e., Overwrite). This field - specifies a 32-bit pattern that is used for the Overwrite - sanitize operation. + Overwrite Pattern: + This field is ignored unless the Sanitize Action field in + Command Dword 10 is set to 011b (i.e., Overwrite). This field + specifies a 32-bit pattern that is used for the Overwrite + sanitize operation. --force:: - Ignore namespace is currently busy and performed the operation - even though. + Ignore namespace is currently busy and performed the operation + even though. + +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-seagate-clear-fw-activate-history.1 b/Documentation/nvme-seagate-clear-fw-activate-history.1 index cb605ba..68a943d 100644 --- a/Documentation/nvme-seagate-clear-fw-activate-history.1 +++ b/Documentation/nvme-seagate-clear-fw-activate-history.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-clear-fw-activate-history .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-CLEAR" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-CLEAR" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-seagate-clear-fw-activate-history.html b/Documentation/nvme-seagate-clear-fw-activate-history.html index dbba892..a395267 100644 --- a/Documentation/nvme-seagate-clear-fw-activate-history.html +++ b/Documentation/nvme-seagate-clear-fw-activate-history.html @@ -757,7 +757,7 @@ nvme-seagate-clear-fw-activate-history (1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
+<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
all commands work across all product families.</p></div>
<div class="paragraph"><p>The <em><device></em> may be either an NVMe character device (ex: /dev/nvme0) or an
nvme block device (ex: /dev/nvme0n1).</p></div>
@@ -792,7 +792,7 @@ nvme block device (ex: /dev/nvme0n1).</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-clear-fw-activate-history.txt b/Documentation/nvme-seagate-clear-fw-activate-history.txt index 2b17222..01f018b 100644 --- a/Documentation/nvme-seagate-clear-fw-activate-history.txt +++ b/Documentation/nvme-seagate-clear-fw-activate-history.txt @@ -12,7 +12,7 @@ SYNOPSIS DESCRIPTION ----------- -This command will only work on Seagate devices supporting this feature. Not +This command will only work on Seagate devices supporting this feature. Not all commands work across all product families. The '<device>' may be either an NVMe character device (ex: /dev/nvme0) or an @@ -22,7 +22,7 @@ OPTIONS ------- -s --save:: - specifies that the controller shall save the attribute. + specifies that the controller shall save the attribute. EXAMPLES -------- diff --git a/Documentation/nvme-seagate-clear-pcie-correctable-errors.1 b/Documentation/nvme-seagate-clear-pcie-correctable-errors.1 index d8c9a90..beebd42 100644 --- a/Documentation/nvme-seagate-clear-pcie-correctable-errors.1 +++ b/Documentation/nvme-seagate-clear-pcie-correctable-errors.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-clear-pcie-correctable-errors .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-CLEAR" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-CLEAR" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,7 +32,7 @@ nvme-seagate-clear-pcie-correctable-errors \- Clear Seagate PCIe error statistic .SH "SYNOPSIS" .sp .nf -\fInvme seagate clear\-pcie\-correctable\-errors [<device>] [OPTIONS]\fR +\fInvme seagate clear\-pcie\-correctable\-errors [<device>] [OPTIONS]\fR .fi .SH "DESCRIPTION" .sp diff --git a/Documentation/nvme-seagate-clear-pcie-correctable-errors.html b/Documentation/nvme-seagate-clear-pcie-correctable-errors.html index 32cde9c..cd71dc5 100644 --- a/Documentation/nvme-seagate-clear-pcie-correctable-errors.html +++ b/Documentation/nvme-seagate-clear-pcie-correctable-errors.html @@ -749,7 +749,7 @@ nvme-seagate-clear-pcie-correctable-errors(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme seagate clear-pcie-correctable-errors [<device>] [OPTIONS]</em></pre>
+<pre class="content"><em>nvme seagate clear-pcie-correctable-errors [<device>] [OPTIONS]</em></pre>
<div class="attribution">
</div></div>
</div>
@@ -757,7 +757,7 @@ nvme-seagate-clear-pcie-correctable-errors(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
+<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
all commands work across all product families.</p></div>
<div class="paragraph"><p>The <em><device></em> parameter is mandatory and may be either an NVMe character device (ex: /dev/nvme0), or an
nvme block device (ex: /dev/nvme0n1).</p></div>
@@ -802,7 +802,7 @@ nvme block device (ex: /dev/nvme0n1).</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-clear-pcie-correctable-errors.txt b/Documentation/nvme-seagate-clear-pcie-correctable-errors.txt index 33952d3..1239f83 100644 --- a/Documentation/nvme-seagate-clear-pcie-correctable-errors.txt +++ b/Documentation/nvme-seagate-clear-pcie-correctable-errors.txt @@ -8,12 +8,12 @@ nvme-seagate-clear-pcie-correctable-errors - Clear Seagate PCIe error statistics SYNOPSIS -------- [verse] -'nvme seagate clear-pcie-correctable-errors [<device>] [OPTIONS]' +'nvme seagate clear-pcie-correctable-errors [<device>] [OPTIONS]' DESCRIPTION ----------- -This command will only work on Seagate devices supporting this feature. Not +This command will only work on Seagate devices supporting this feature. Not all commands work across all product families. The '<device>' parameter is mandatory and may be either an NVMe character device (ex: /dev/nvme0), or an @@ -23,7 +23,7 @@ OPTIONS ------- -s:: --save:: - Specifies that the controller shall save the attribute + Specifies that the controller shall save the attribute EXAMPLES -------- diff --git a/Documentation/nvme-seagate-cloud-SSD-plugin-version.1 b/Documentation/nvme-seagate-cloud-SSD-plugin-version.1 index 1989f20..24dddf5 100644 --- a/Documentation/nvme-seagate-cloud-SSD-plugin-version.1 +++ b/Documentation/nvme-seagate-cloud-SSD-plugin-version.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-cloud-SSD-plugin-version .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-CLOUD" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-CLOUD" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-seagate-cloud-SSD-plugin-version.html b/Documentation/nvme-seagate-cloud-SSD-plugin-version.html index a70616a..ac4ab82 100644 --- a/Documentation/nvme-seagate-cloud-SSD-plugin-version.html +++ b/Documentation/nvme-seagate-cloud-SSD-plugin-version.html @@ -787,7 +787,7 @@ nvme-seagate-cloud-SSD-plugin-version (1) Manual Page <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-get-ctrl-tele.1 b/Documentation/nvme-seagate-get-ctrl-tele.1 index 60f20be..c7dce50 100644 --- a/Documentation/nvme-seagate-get-ctrl-tele.1 +++ b/Documentation/nvme-seagate-get-ctrl-tele.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-get-ctrl-tele .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-GET\-" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-GET\-" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-seagate-get-ctrl-tele.html b/Documentation/nvme-seagate-get-ctrl-tele.html index 9455a72..980b051 100644 --- a/Documentation/nvme-seagate-get-ctrl-tele.html +++ b/Documentation/nvme-seagate-get-ctrl-tele.html @@ -757,7 +757,7 @@ nvme-seagate-get-ctrl-tele(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
+<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
all commands work across all product families.</p></div>
<div class="paragraph"><p>The '<device>'parameter is mandatory and may be either an NVMe character device (ex: /dev/nvme0) or an
nvme block device (ex: /dev/nvme0n1).</p></div>
@@ -813,7 +813,7 @@ nvme block device (ex: /dev/nvme0n1).</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-get-ctrl-tele.txt b/Documentation/nvme-seagate-get-ctrl-tele.txt index e170548..4bb7362 100644 --- a/Documentation/nvme-seagate-get-ctrl-tele.txt +++ b/Documentation/nvme-seagate-get-ctrl-tele.txt @@ -13,7 +13,7 @@ SYNOPSIS DESCRIPTION ----------- -This command will only work on Seagate devices supporting this feature. Not +This command will only work on Seagate devices supporting this feature. Not all commands work across all product families. The '<device>'parameter is mandatory and may be either an NVMe character device (ex: /dev/nvme0) or an @@ -23,11 +23,11 @@ OPTIONS ------- -n <NUM>:: --namespace-id=<NUM>:: - Desired namespace + Desired namespace -b:: --raw-binary:: - Output in raw format + Output in raw format EXAMPLES -------- diff --git a/Documentation/nvme-seagate-get-host-tele.1 b/Documentation/nvme-seagate-get-host-tele.1 index 2090581..0ff7d52 100644 --- a/Documentation/nvme-seagate-get-host-tele.1 +++ b/Documentation/nvme-seagate-get-host-tele.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-get-host-tele .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-GET\-" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-GET\-" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -38,7 +38,7 @@ nvme-seagate-get-host-tele \- Retrieve Seagate Host\-Initiated Telemetry in eith .sp This will only work on Seagate devices supporting this feature\&. Not all commands work across all product families\&. .sp -The \fI<device>\fR parameter is mandatory and may be either an NVMe character device (ex: /dev/nvme0) or an nvme block device (ex: /dev/nvme0n1)\&. +The \fI<device>\fR parameter is mandatory and may be either an NVMe character device (ex: /dev/nvme0) or an block device (ex: /dev/nvme0n1)\&. .SH "OPTIONS" .PP \-n <NUM>, \-\-namespace\-id=<NUM> diff --git a/Documentation/nvme-seagate-get-host-tele.html b/Documentation/nvme-seagate-get-host-tele.html index 84d5a36..7882d91 100644 --- a/Documentation/nvme-seagate-get-host-tele.html +++ b/Documentation/nvme-seagate-get-host-tele.html @@ -757,10 +757,10 @@ nvme-seagate-get-host-tele(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>This will only work on Seagate devices supporting this feature. Not all
+<div class="paragraph"><p>This will only work on Seagate devices supporting this feature. Not all
commands work across all product families.</p></div>
-<div class="paragraph"><p>The <em><device></em> parameter is mandatory and may be either an NVMe character device (ex: /dev/nvme0) or an
-nvme block device (ex: /dev/nvme0n1).</p></div>
+<div class="paragraph"><p>The <em><device></em> parameter is mandatory and may be either an NVMe character device
+(ex: /dev/nvme0) or an block device (ex: /dev/nvme0n1).</p></div>
</div>
</div>
<div class="sect1">
@@ -786,7 +786,8 @@ nvme block device (ex: /dev/nvme0n1).</p></div> </dt>
<dd>
<p>
- 1 - controller shall capture Data representing the internal state of the controller at the time the command is processed.
+ 1 - controller shall capture Data representing the internal state of the
+ controller at the time the command is processed.
0 - controller shall not update the Telemetry Host Initiated Data.
</p>
</dd>
@@ -825,7 +826,7 @@ nvme block device (ex: /dev/nvme0n1).</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-get-host-tele.txt b/Documentation/nvme-seagate-get-host-tele.txt index 2863c12..83cdefc 100644 --- a/Documentation/nvme-seagate-get-host-tele.txt +++ b/Documentation/nvme-seagate-get-host-tele.txt @@ -13,26 +13,27 @@ SYNOPSIS DESCRIPTION ----------- -This will only work on Seagate devices supporting this feature. Not all +This will only work on Seagate devices supporting this feature. Not all commands work across all product families. -The '<device>' parameter is mandatory and may be either an NVMe character device (ex: /dev/nvme0) or an -nvme block device (ex: /dev/nvme0n1). +The '<device>' parameter is mandatory and may be either an NVMe character device +(ex: /dev/nvme0) or an block device (ex: /dev/nvme0n1). OPTIONS ------- -n <NUM>:: --namespace-id=<NUM>:: - desired namespace + desired namespace -i <NUM>:: --log_specific=<NUM>:: - 1 - controller shall capture Data representing the internal state of the controller at the time the command is processed. - 0 - controller shall not update the Telemetry Host Initiated Data. + 1 - controller shall capture Data representing the internal state of the + controller at the time the command is processed. + 0 - controller shall not update the Telemetry Host Initiated Data. -b:: --raw-binary:: - output in raw format + output in raw format EXAMPLES -------- diff --git a/Documentation/nvme-seagate-help.1 b/Documentation/nvme-seagate-help.1 index bdfcfb2..003fd21 100644 --- a/Documentation/nvme-seagate-help.1 +++ b/Documentation/nvme-seagate-help.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-help .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-HELP" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-HELP" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-seagate-help.html b/Documentation/nvme-seagate-help.html index eb24703..91791da 100644 --- a/Documentation/nvme-seagate-help.html +++ b/Documentation/nvme-seagate-help.html @@ -812,7 +812,7 @@ help Display this help</code></pre> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-plugin-version.1 b/Documentation/nvme-seagate-plugin-version.1 index 94d3985..b0c24da 100644 --- a/Documentation/nvme-seagate-plugin-version.1 +++ b/Documentation/nvme-seagate-plugin-version.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-plugin-version .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-PLUGI" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-PLUGI" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-seagate-plugin-version.html b/Documentation/nvme-seagate-plugin-version.html index 2e188e3..110efe8 100644 --- a/Documentation/nvme-seagate-plugin-version.html +++ b/Documentation/nvme-seagate-plugin-version.html @@ -787,7 +787,7 @@ nvme-seagate-plugin-version(1) Manual Page <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-version.1 b/Documentation/nvme-seagate-version.1 index abf2b34..b1faf83 100644 --- a/Documentation/nvme-seagate-version.1 +++ b/Documentation/nvme-seagate-version.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-version .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-VERSI" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-VERSI" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-seagate-version.html b/Documentation/nvme-seagate-version.html index e8bee0d..dbeb82a 100644 --- a/Documentation/nvme-seagate-version.html +++ b/Documentation/nvme-seagate-version.html @@ -787,7 +787,7 @@ nvme-seagate-version(1) Manual Page <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-vs-fw-activate-history.1 b/Documentation/nvme-seagate-vs-fw-activate-history.1 index 260c947..6d7be65 100644 --- a/Documentation/nvme-seagate-vs-fw-activate-history.1 +++ b/Documentation/nvme-seagate-vs-fw-activate-history.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-vs-fw-activate-history .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-VS\-F" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-VS\-F" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-seagate-vs-fw-activate-history.html b/Documentation/nvme-seagate-vs-fw-activate-history.html index bfc9572..47934c7 100644 --- a/Documentation/nvme-seagate-vs-fw-activate-history.html +++ b/Documentation/nvme-seagate-vs-fw-activate-history.html @@ -757,7 +757,7 @@ nvme-seagate-vs-fw-activate-history (1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
+<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
all commands work across all product families.</p></div>
<div class="paragraph"><p>The <em><device></em> may be either an NVMe character device (ex: /dev/nvme0) or an
nvme block device (ex: /dev/nvme0n1).</p></div>
@@ -813,7 +813,7 @@ nvme block device (ex: /dev/nvme0n1).</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-vs-fw-activate-history.txt b/Documentation/nvme-seagate-vs-fw-activate-history.txt index e6b030d..8df58b4 100644 --- a/Documentation/nvme-seagate-vs-fw-activate-history.txt +++ b/Documentation/nvme-seagate-vs-fw-activate-history.txt @@ -13,7 +13,7 @@ SYNOPSIS DESCRIPTION ----------- -This command will only work on Seagate devices supporting this feature. Not +This command will only work on Seagate devices supporting this feature. Not all commands work across all product families. The '<device>' may be either an NVMe character device (ex: /dev/nvme0) or an @@ -23,11 +23,11 @@ OPTIONS ------- -n <NUM>:: --namespace-id=<NUM>:: - Desired namespace + Desired namespace -f <FILE>:: --dump-file=<FILE>:: - Dump file + Dump file EXAMPLES -------- diff --git a/Documentation/nvme-seagate-vs-internal-log.1 b/Documentation/nvme-seagate-vs-internal-log.1 index e39f348..2d16e16 100644 --- a/Documentation/nvme-seagate-vs-internal-log.1 +++ b/Documentation/nvme-seagate-vs-internal-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-vs-internal-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-VS\-I" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-VS\-I" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-seagate-vs-internal-log.html b/Documentation/nvme-seagate-vs-internal-log.html index 19283d1..a78d5b2 100644 --- a/Documentation/nvme-seagate-vs-internal-log.html +++ b/Documentation/nvme-seagate-vs-internal-log.html @@ -757,10 +757,10 @@ nvme-seagate-vs-internal-log(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
+<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
all commands work across all product families.</p></div>
-<div class="paragraph"><p>The <em><device></em> parameter is mandatory and may be either an NVMe character device (ex: /dev/nvme0) or an
-nvme block device (ex: /dev/nvme0n1).</p></div>
+<div class="paragraph"><p>The <em><device></em> parameter is mandatory and may be either an NVMe character device
+(ex: /dev/nvme0) or an nvme block device (ex: /dev/nvme0n1).</p></div>
</div>
</div>
<div class="sect1">
@@ -795,7 +795,8 @@ nvme block device (ex: /dev/nvme0n1).</p></div> <div class="sect1">
<h2 id="_examples">EXAMPLES</h2>
<div class="sectionbody">
-<div class="paragraph"><p>Get the Seagate vendor specific Controller-Initiated telemetry log for the specified device.</p></div>
+<div class="paragraph"><p>Get the Seagate vendor specific Controller-Initiated telemetry log for the
+specified device.</p></div>
<div class="listingblock">
<div class="content">
<pre><code># nvme seagate vs-internal-log /dev/nvme0</code></pre>
@@ -813,7 +814,7 @@ nvme block device (ex: /dev/nvme0n1).</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-vs-internal-log.txt b/Documentation/nvme-seagate-vs-internal-log.txt index 3284020..4a895bc 100644 --- a/Documentation/nvme-seagate-vs-internal-log.txt +++ b/Documentation/nvme-seagate-vs-internal-log.txt @@ -13,25 +13,26 @@ SYNOPSIS DESCRIPTION ----------- -This command will only work on Seagate devices supporting this feature. Not +This command will only work on Seagate devices supporting this feature. Not all commands work across all product families. -The '<device>' parameter is mandatory and may be either an NVMe character device (ex: /dev/nvme0) or an -nvme block device (ex: /dev/nvme0n1). +The '<device>' parameter is mandatory and may be either an NVMe character device +(ex: /dev/nvme0) or an nvme block device (ex: /dev/nvme0n1). OPTIONS ------- -n <NUM>:: --namespace-id=<NUM>:: - Desired namespace + Desired namespace -f <FILE>:: --dump-file=<FILE>:: - Dump file + Dump file EXAMPLES -------- -Get the Seagate vendor specific Controller-Initiated telemetry log for the specified device. +Get the Seagate vendor specific Controller-Initiated telemetry log for the +specified device. ------------ # nvme seagate vs-internal-log /dev/nvme0 diff --git a/Documentation/nvme-seagate-vs-log-page-sup.1 b/Documentation/nvme-seagate-vs-log-page-sup.1 index 6b7bac1..59d1436 100644 --- a/Documentation/nvme-seagate-vs-log-page-sup.1 +++ b/Documentation/nvme-seagate-vs-log-page-sup.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-vs-log-page-sup .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-VS\-L" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-VS\-L" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -41,7 +41,7 @@ This command will only work on Seagate devices supporting this feature\&. Not al The \fI<device>\fR may be either an NVMe character device (ex: /dev/nvme0) or an NVMe block device (ex: /dev/nvme0n1)\&. .SH "OPTIONS" .PP -\-o <FMT>, \-\-output\-format=<FMT> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Output in binary format .RE diff --git a/Documentation/nvme-seagate-vs-log-page-sup.html b/Documentation/nvme-seagate-vs-log-page-sup.html index e8be1aa..055665d 100644 --- a/Documentation/nvme-seagate-vs-log-page-sup.html +++ b/Documentation/nvme-seagate-vs-log-page-sup.html @@ -757,7 +757,7 @@ nvme-seagate-vs-log-page-sup(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
+<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
all commands work across all product families.</p></div>
<div class="paragraph"><p>The <em><device></em> may be either an NVMe character device (ex: /dev/nvme0) or an
NVMe block device (ex: /dev/nvme0n1).</p></div>
@@ -768,10 +768,10 @@ NVMe block device (ex: /dev/nvme0n1).</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <FMT>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<FMT>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -814,7 +814,7 @@ LogPage-Id LogPage-Name <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-vs-log-page-sup.txt b/Documentation/nvme-seagate-vs-log-page-sup.txt index a5d1488..55c65fd 100644 --- a/Documentation/nvme-seagate-vs-log-page-sup.txt +++ b/Documentation/nvme-seagate-vs-log-page-sup.txt @@ -13,7 +13,7 @@ SYNOPSIS DESCRIPTION ----------- -This command will only work on Seagate devices supporting this feature. Not +This command will only work on Seagate devices supporting this feature. Not all commands work across all product families. The '<device>' may be either an NVMe character device (ex: /dev/nvme0) or an @@ -21,9 +21,9 @@ NVMe block device (ex: /dev/nvme0n1). OPTIONS ------- --o <FMT>:: ---output-format=<FMT>:: - Output in binary format +-o <fmt>:: +--output-format=<fmt>:: + Output in binary format EXAMPLES -------- diff --git a/Documentation/nvme-seagate-vs-pcie-stats.1 b/Documentation/nvme-seagate-vs-pcie-stats.1 index afe83e5..9722029 100644 --- a/Documentation/nvme-seagate-vs-pcie-stats.1 +++ b/Documentation/nvme-seagate-vs-pcie-stats.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-vs-pcie-stats .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-VS\-P" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-VS\-P" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -41,7 +41,7 @@ This command will only work on Seagate devices supporting this feature\&. Not al The \fI<device>\fR parameter is mandatory and it may be either an NVMe character device (ex: /dev/nvme0) or an nvme block device (ex: /dev/nvme0n1)\&. .SH "OPTIONS" .PP -\-o <FMT>, \-\-output\-format=<FMT> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Output in binary format .RE diff --git a/Documentation/nvme-seagate-vs-pcie-stats.html b/Documentation/nvme-seagate-vs-pcie-stats.html index c85cf25..d0b935e 100644 --- a/Documentation/nvme-seagate-vs-pcie-stats.html +++ b/Documentation/nvme-seagate-vs-pcie-stats.html @@ -757,7 +757,7 @@ nvme-seagate-vs-pcie-stats(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
+<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
all commands work across all product families.</p></div>
<div class="paragraph"><p>The <em><device></em> parameter is mandatory and it may be either an NVMe character device (ex: /dev/nvme0) or an
nvme block device (ex: /dev/nvme0n1).</p></div>
@@ -768,10 +768,10 @@ nvme block device (ex: /dev/nvme0n1).</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <FMT>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<FMT>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -802,7 +802,7 @@ nvme block device (ex: /dev/nvme0n1).</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-vs-pcie-stats.txt b/Documentation/nvme-seagate-vs-pcie-stats.txt index 74599bf..86f87a3 100644 --- a/Documentation/nvme-seagate-vs-pcie-stats.txt +++ b/Documentation/nvme-seagate-vs-pcie-stats.txt @@ -13,7 +13,7 @@ SYNOPSIS DESCRIPTION ----------- -This command will only work on Seagate devices supporting this feature. Not +This command will only work on Seagate devices supporting this feature. Not all commands work across all product families. The '<device>' parameter is mandatory and it may be either an NVMe character device (ex: /dev/nvme0) or an @@ -21,9 +21,9 @@ nvme block device (ex: /dev/nvme0n1). OPTIONS ------- --o <FMT>:: ---output-format=<FMT>:: - Output in binary format +-o <fmt>:: +--output-format=<fmt>:: + Output in binary format EXAMPLES -------- diff --git a/Documentation/nvme-seagate-vs-smart-add-log.1 b/Documentation/nvme-seagate-vs-smart-add-log.1 index 799c101..19730ff 100644 --- a/Documentation/nvme-seagate-vs-smart-add-log.1 +++ b/Documentation/nvme-seagate-vs-smart-add-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-vs-smart-add-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-VS\-S" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-VS\-S" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-seagate-vs-smart-add-log.html b/Documentation/nvme-seagate-vs-smart-add-log.html index e34c938..5d189cb 100644 --- a/Documentation/nvme-seagate-vs-smart-add-log.html +++ b/Documentation/nvme-seagate-vs-smart-add-log.html @@ -764,7 +764,7 @@ character device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></div>
<div class="paragraph"><p>The log contents may be associated with the controller, in which case the namespace parameter is ignored.</p></div>
<div class="paragraph"><p>Two logs exist, page 0xC4 (Extended SMART log page) and page 0xCF (DRAM Supercap SMART log page)</p></div>
-<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
+<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
all commands work across all product families.</p></div>
</div>
</div>
@@ -830,7 +830,7 @@ all commands work across all product families.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-vs-smart-add-log.txt b/Documentation/nvme-seagate-vs-smart-add-log.txt index 962a109..836220a 100644 --- a/Documentation/nvme-seagate-vs-smart-add-log.txt +++ b/Documentation/nvme-seagate-vs-smart-add-log.txt @@ -24,23 +24,23 @@ The log contents may be associated with the controller, in which case the namesp Two logs exist, page 0xC4 (Extended SMART log page) and page 0xCF (DRAM Supercap SMART log page) -This command will only work on Seagate devices supporting this feature. Not +This command will only work on Seagate devices supporting this feature. Not all commands work across all product families. OPTIONS ------- -l <NUM>:: --log=<NUM>:: - Log number, page 0xC4 (Extended SMART log page) and page 0xCF (DRAM - Supercap SMART log page) + Log number, page 0xC4 (Extended SMART log page) and page 0xCF (DRAM + Supercap SMART log page) -n <NUM>:: --namespace-id=<NUM>:: - Namespace number + Namespace number -o <FILE>:: --output-file=<FILE>:: - Output in binary format. Defaults to text-formatted dump to stdout + Output in binary format. Defaults to text-formatted dump to stdout EXAMPLES -------- diff --git a/Documentation/nvme-seagate-vs-temperature-stats.1 b/Documentation/nvme-seagate-vs-temperature-stats.1 index d933def..075dd28 100644 --- a/Documentation/nvme-seagate-vs-temperature-stats.1 +++ b/Documentation/nvme-seagate-vs-temperature-stats.1 @@ -2,12 +2,12 @@ .\" Title: nvme-seagate-vs-temperature-stats .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SEAGATE\-VS\-T" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SEAGATE\-VS\-T" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -41,7 +41,7 @@ This command will only work on Seagate devices supporting this feature\&. Not al The \*(Aq<device>\*(Aqparameter is mandatory and it may be either an NVMe character device (ex: /dev/nvme0) or an nvme block device (ex: /dev/nvme0n1)\&. .SH "OPTIONS" .PP -\-o <FMT>, \-\-output\-format=<FMT> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Output in binary format .RE diff --git a/Documentation/nvme-seagate-vs-temperature-stats.html b/Documentation/nvme-seagate-vs-temperature-stats.html index 2b3ab2a..2046e49 100644 --- a/Documentation/nvme-seagate-vs-temperature-stats.html +++ b/Documentation/nvme-seagate-vs-temperature-stats.html @@ -757,7 +757,7 @@ nvme-seagate-vs-temperature-stats(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
+<div class="paragraph"><p>This command will only work on Seagate devices supporting this feature. Not
all commands work across all product families.</p></div>
<div class="paragraph"><p>The '<device>'parameter is mandatory and it may be either an NVMe character device (ex: /dev/nvme0) or an
nvme block device (ex: /dev/nvme0n1).</p></div>
@@ -768,10 +768,10 @@ nvme block device (ex: /dev/nvme0n1).</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <FMT>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<FMT>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -802,7 +802,7 @@ nvme block device (ex: /dev/nvme0n1).</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-seagate-vs-temperature-stats.txt b/Documentation/nvme-seagate-vs-temperature-stats.txt index 2691e30..58a9f11 100644 --- a/Documentation/nvme-seagate-vs-temperature-stats.txt +++ b/Documentation/nvme-seagate-vs-temperature-stats.txt @@ -13,7 +13,7 @@ SYNOPSIS DESCRIPTION ----------- -This command will only work on Seagate devices supporting this feature. Not +This command will only work on Seagate devices supporting this feature. Not all commands work across all product families. The '<device>'parameter is mandatory and it may be either an NVMe character device (ex: /dev/nvme0) or an @@ -21,9 +21,9 @@ nvme block device (ex: /dev/nvme0n1). OPTIONS ------- --o <FMT>:: ---output-format=<FMT>:: - Output in binary format +-o <fmt>:: +--output-format=<fmt>:: + Output in binary format EXAMPLES -------- diff --git a/Documentation/nvme-security-recv.1 b/Documentation/nvme-security-recv.1 index 262720f..1dcf782 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://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SECURITY\-RECV" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SECURITY\-RECV" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,12 +33,12 @@ nvme-security-recv \- Security Recv command .sp .nf \fInvme security\-recv\fR <device> [\-\-size=<size> | \-x <size>] - [\-\-secp=<security\-protocol> | \-p <security\-protocol>] - [\-\-spsp=<protocol\-specific> | \-s <protocol\-specific>] - [\-\-nssf=<nvme\-specific> | \-N <nvme\-specific>] - [\-\-al=<allocation\-length> | \-t <allocation\-length>] - [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-raw\-binary | \-b] + [\-\-secp=<security\-protocol> | \-p <security\-protocol>] + [\-\-spsp=<protocol\-specific> | \-s <protocol\-specific>] + [\-\-nssf=<nvme\-specific> | \-N <nvme\-specific>] + [\-\-al=<allocation\-length> | \-t <allocation\-length>] + [\-\-namespace\-id=<nsid> | \-n <nsid>] [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -83,6 +83,20 @@ Allocation Length: The value of this field is specific to the Security Protocol .RS 4 Print the raw buffer to stdout\&. Defaults to print in hex\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No Examples diff --git a/Documentation/nvme-security-recv.html b/Documentation/nvme-security-recv.html index 34f1982..f2d0074 100644 --- a/Documentation/nvme-security-recv.html +++ b/Documentation/nvme-security-recv.html @@ -750,12 +750,12 @@ nvme-security-recv(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme security-recv</em> <device> [--size=<size> | -x <size>]
- [--secp=<security-protocol> | -p <security-protocol>]
- [--spsp=<protocol-specific> | -s <protocol-specific>]
- [--nssf=<nvme-specific> | -N <nvme-specific>]
- [--al=<allocation-length> | -t <allocation-length>]
- [--namespace-id=<nsid> | -n <nsid>]
- [--raw-binary | -b]</pre>
+ [--secp=<security-protocol> | -p <security-protocol>]
+ [--spsp=<protocol-specific> | -s <protocol-specific>]
+ [--nssf=<nvme-specific> | -N <nvme-specific>]
+ [--al=<allocation-length> | -t <allocation-length>]
+ [--namespace-id=<nsid> | -n <nsid>] [--raw-binary | -b]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -866,6 +866,29 @@ controller reset occurs.</p></div> Print the raw buffer to stdout. Defaults to print in hex.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -886,7 +909,7 @@ controller reset occurs.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-security-recv.txt b/Documentation/nvme-security-recv.txt index 0b9fe99..ef77531 100644 --- a/Documentation/nvme-security-recv.txt +++ b/Documentation/nvme-security-recv.txt @@ -9,12 +9,12 @@ SYNOPSIS -------- [verse] 'nvme security-recv' <device> [--size=<size> | -x <size>] - [--secp=<security-protocol> | -p <security-protocol>] - [--spsp=<protocol-specific> | -s <protocol-specific>] - [--nssf=<nvme-specific> | -N <nvme-specific>] - [--al=<allocation-length> | -t <allocation-length>] - [--namespace-id=<nsid> | -n <nsid>] - [--raw-binary | -b] + [--secp=<security-protocol> | -p <security-protocol>] + [--spsp=<protocol-specific> | -s <protocol-specific>] + [--nssf=<nvme-specific> | -N <nvme-specific>] + [--al=<allocation-length> | -t <allocation-length>] + [--namespace-id=<nsid> | -n <nsid>] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -71,6 +71,15 @@ OPTIONS --raw-binary:: Print the raw buffer to stdout. Defaults to print in hex. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No Examples diff --git a/Documentation/nvme-security-send.1 b/Documentation/nvme-security-send.1 index 187b7fa..236348a 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://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SECURITY\-SEND" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SECURITY\-SEND" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,11 +33,12 @@ nvme-security-send \- Security Send command .sp .nf \fInvme security\-send\fR <device> [\-\-file=<file> | \-f <file>] - [\-\-secp=<security\-protocol> | \-p <security\-protocol>] - [\-\-spsp=<protocol\-specific> | \-s <protocol\-specific>] - [\-\-tl=<transfer\-length> | \-t <transfer\-length>] - [\-\-nssf=<nvme\-specific> | \-N <nvme\-specific>] - [\-\-namespace\-id=<nsid> | \-n <nsid>] + [\-\-secp=<security\-protocol> | \-p <security\-protocol>] + [\-\-spsp=<protocol\-specific> | \-s <protocol\-specific>] + [\-\-tl=<transfer\-length> | \-t <transfer\-length>] + [\-\-nssf=<nvme\-specific> | \-N <nvme\-specific>] + [\-\-namespace\-id=<nsid> | \-n <nsid>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -75,6 +76,20 @@ SP Specific: The value of this field is specific to the Security Protocol as def .RS 4 Transfer Length: The value of this field is specific to the Security Protocol as defined in SPC\-4\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No Examples diff --git a/Documentation/nvme-security-send.html b/Documentation/nvme-security-send.html index a345ded..8058ba3 100644 --- a/Documentation/nvme-security-send.html +++ b/Documentation/nvme-security-send.html @@ -750,11 +750,12 @@ nvme-security-send(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme security-send</em> <device> [--file=<file> | -f <file>]
- [--secp=<security-protocol> | -p <security-protocol>]
- [--spsp=<protocol-specific> | -s <protocol-specific>]
- [--tl=<transfer-length> | -t <transfer-length>]
- [--nssf=<nvme-specific> | -N <nvme-specific>]
- [--namespace-id=<nsid> | -n <nsid>]</pre>
+ [--secp=<security-protocol> | -p <security-protocol>]
+ [--spsp=<protocol-specific> | -s <protocol-specific>]
+ [--tl=<transfer-length> | -t <transfer-length>]
+ [--nssf=<nvme-specific> | -N <nvme-specific>]
+ [--namespace-id=<nsid> | -n <nsid>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -852,6 +853,29 @@ Receive command is Security Protocol field dependent as defined in SPC-4.</p></d Security Protocol as defined in SPC-4.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -872,7 +896,7 @@ Receive command is Security Protocol field dependent as defined in SPC-4.</p></d <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-security-send.txt b/Documentation/nvme-security-send.txt index ae22628..347b970 100644 --- a/Documentation/nvme-security-send.txt +++ b/Documentation/nvme-security-send.txt @@ -9,11 +9,12 @@ SYNOPSIS -------- [verse] '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>] - [--nssf=<nvme-specific> | -N <nvme-specific>] - [--namespace-id=<nsid> | -n <nsid>] + [--secp=<security-protocol> | -p <security-protocol>] + [--spsp=<protocol-specific> | -s <protocol-specific>] + [--tl=<transfer-length> | -t <transfer-length>] + [--nssf=<nvme-specific> | -N <nvme-specific>] + [--namespace-id=<nsid> | -n <nsid>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -63,6 +64,15 @@ OPTIONS Transfer Length: The value of this field is specific to the Security Protocol as defined in SPC-4. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No Examples diff --git a/Documentation/nvme-self-test-log.1 b/Documentation/nvme-self-test-log.1 index 9be513d..395cf51 100644 --- a/Documentation/nvme-self-test-log.1 +++ b/Documentation/nvme-self-test-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-self-test-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SELF\-TEST\-LO" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SELF\-TEST\-LO" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,7 +33,7 @@ nvme-self-test-log \- Retrieve the log information initiated by device\-self\-te .sp .nf \fInvme self\-test\fR\-log <device> [\-\-log\-entries=<entries> | \-e <entries>] - [\-\-output\-format=<FMT> | \-o <FMT>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -51,13 +51,19 @@ By default the log is printed out in the normal readable format\&. Specifies how many DST log entries the program should request from the device\&. This must be at least one, and shouldn\(cqt exceed the 20 entries\&. Defaults to 20 DST log entries\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-self-test-log.html b/Documentation/nvme-self-test-log.html index 00c0490..a58677b 100644 --- a/Documentation/nvme-self-test-log.html +++ b/Documentation/nvme-self-test-log.html @@ -750,7 +750,7 @@ nvme-self-test-log(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme self-test</em>-log <device> [--log-entries=<entries> | -e <entries>]
- [--output-format=<FMT> | -o <FMT>]</pre>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -788,15 +788,26 @@ json format.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -847,7 +858,7 @@ Get the self-test-log and print it in a json format: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-self-test-log.txt b/Documentation/nvme-self-test-log.txt index 56a3c4a..d4600e8 100644 --- a/Documentation/nvme-self-test-log.txt +++ b/Documentation/nvme-self-test-log.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] 'nvme self-test'-log <device> [--log-entries=<entries> | -e <entries>] - [--output-format=<FMT> | -o <FMT>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -35,11 +35,14 @@ OPTION the device. This must be at least one, and shouldn't exceed the 20 entries. Defaults to 20 DST log entries. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-set-feature.1 b/Documentation/nvme-set-feature.1 index 0ab78b9..40e8a07 100644 --- a/Documentation/nvme-set-feature.1 +++ b/Documentation/nvme-set-feature.1 @@ -2,12 +2,12 @@ .\" Title: nvme-set-feature .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SET\-FEATURE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SET\-FEATURE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,11 +33,11 @@ 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> | \-v <value>] - [\-\-uuid\-index=<uuid\-index> | \-U <uuid_index>] - [\-\-data\-len=<data\-len> | \-l <data\-len>] - [\-\-data=<data\-file> | \-d <data\-file>] - [\-\-save | \-s] + [\-\-feature\-id=<fid> | \-f <fid>] [\-\-value=<value> | \-V <value>] + [\-\-uuid\-index=<uuid\-index> | \-U <uuid_index>] + [\-\-data\-len=<data\-len> | \-l <data\-len>] + [\-\-data=<data\-file> | \-d <data\-file>] [\-\-save | \-s] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -68,7 +68,7 @@ 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 -\-v <value>, \-\-value=<value> +\-V <value>, \-\-value=<value> .RS 4 The value for command dword 11, the value you want to set the feature to\&. .RE @@ -82,6 +82,20 @@ Save the attribute so that it persists through all power states and resets\&. .RS 4 UUID Index of the feature .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 @@ -98,7 +112,7 @@ Sets the Power State (PS) to 1 in feature id 2: .RS 4 .\} .nf -# nvme set\-feature /dev/nvme0 \-f 2 /dev/nvme0n1 \-v 0x1 +# nvme set\-feature /dev/nvme0 \-f 2 /dev/nvme0n1 \-V 0x1 .fi .if n \{\ .RE diff --git a/Documentation/nvme-set-feature.html b/Documentation/nvme-set-feature.html index 41d8018..912a97f 100644 --- a/Documentation/nvme-set-feature.html +++ b/Documentation/nvme-set-feature.html @@ -750,11 +750,11 @@ nvme-set-feature(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme set-feature</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--feature-id=<fid> | -f <fid>] [--value=<value> | -v <value>]
- [--uuid-index=<uuid-index> | -U <uuid_index>]
- [--data-len=<data-len> | -l <data-len>]
- [--data=<data-file> | -d <data-file>]
- [--save | -s]</pre>
+ [--feature-id=<fid> | -f <fid>] [--value=<value> | -V <value>]
+ [--uuid-index=<uuid-index> | -U <uuid_index>]
+ [--data-len=<data-len> | -l <data-len>]
+ [--data=<data-file> | -d <data-file>] [--save | -s]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -826,7 +826,7 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di </p>
</dd>
<dt class="hdlist1">
--v <value>
+-V <value>
</dt>
<dt class="hdlist1">
--value=<value>
@@ -859,6 +859,29 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di UUID Index of the feature
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -868,11 +891,11 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di <div class="ulist"><ul>
<li>
<p>
-Sets the Power State (PS) to 1 in feature id 2:
+Sets the Power State (PS) to 1 in feature id 2:
</p>
<div class="listingblock">
<div class="content">
-<pre><code># nvme set-feature /dev/nvme0 -f 2 /dev/nvme0n1 -v 0x1</code></pre>
+<pre><code># nvme set-feature /dev/nvme0 -f 2 /dev/nvme0n1 -V 0x1</code></pre>
</div></div>
</li>
<li>
@@ -899,7 +922,7 @@ Sets the host id to the ascii string. <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-set-feature.txt b/Documentation/nvme-set-feature.txt index 08b38f4..05c2210 100644 --- a/Documentation/nvme-set-feature.txt +++ b/Documentation/nvme-set-feature.txt @@ -9,11 +9,11 @@ SYNOPSIS -------- [verse] 'nvme set-feature' <device> [--namespace-id=<nsid> | -n <nsid>] - [--feature-id=<fid> | -f <fid>] [--value=<value> | -v <value>] - [--uuid-index=<uuid-index> | -U <uuid_index>] - [--data-len=<data-len> | -l <data-len>] - [--data=<data-file> | -d <data-file>] - [--save | -s] + [--feature-id=<fid> | -f <fid>] [--value=<value> | -V <value>] + [--uuid-index=<uuid-index> | -U <uuid_index>] + [--data-len=<data-len> | -l <data-len>] + [--data=<data-file> | -d <data-file>] [--save | -s] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -51,7 +51,7 @@ OPTIONS Range Type and host identifier. This defaults to STDIN so files and echo can be piped. --v <value>:: +-V <value>:: --value=<value>:: The value for command dword 11, the value you want to set the feature to. @@ -64,12 +64,21 @@ OPTIONS --uuid-index=<uuid-index>:: UUID Index of the feature +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- -* Sets the Power State (PS) to 1 in feature id 2: +* Sets the Power State (PS) to 1 in feature id 2: + ------------ -# nvme set-feature /dev/nvme0 -f 2 /dev/nvme0n1 -v 0x1 +# nvme set-feature /dev/nvme0 -f 2 /dev/nvme0n1 -V 0x1 ------------ + diff --git a/Documentation/nvme-set-property.1 b/Documentation/nvme-set-property.1 index ef5d1f4..a18ac85 100644 --- a/Documentation/nvme-set-property.1 +++ b/Documentation/nvme-set-property.1 @@ -2,12 +2,12 @@ .\" Title: nvme-set-property .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SET\-PROPERTY" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SET\-PROPERTY" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,23 +32,38 @@ nvme-set-property \- Writes and shows the defined NVMe controller property for N .SH "SYNOPSIS" .sp .nf -\fInvme set\-property\fR <device> [\-\-offset=<offset> | \-o <offset>] - [\-\-value=<val> | \-v <val>] +\fInvme set\-property\fR <device> [\-\-offset=<offset> | \-O <offset>] + [\-\-value=<val> | \-V <val>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp Writes and shows the defined NVMe controller property for NVMe over Fabric\&. .SH "OPTIONS" .PP -\-o, \-\-offset +\-O, \-\-offset .RS 4 The offset of the property\&. .RE .PP -\-v +\-V .RS 4 \-\-value: The value of the property to be set\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples (yet)\&. diff --git a/Documentation/nvme-set-property.html b/Documentation/nvme-set-property.html index 873b83b..c35b4ff 100644 --- a/Documentation/nvme-set-property.html +++ b/Documentation/nvme-set-property.html @@ -749,8 +749,9 @@ nvme-set-property(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme set-property</em> <device> [--offset=<offset> | -o <offset>]
- [--value=<val> | -v <val>]</pre>
+<pre class="content"><em>nvme set-property</em> <device> [--offset=<offset> | -O <offset>]
+ [--value=<val> | -V <val>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -766,18 +767,18 @@ nvme-set-property(1) Manual Page <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o
+-O
</dt>
<dt class="hdlist1">
--offset
</dt>
<dd>
<p>
- The offset of the property.
+ The offset of the property.
</p>
</dd>
<dt class="hdlist1">
--v
+-V
</dt>
<dd>
<p>
@@ -785,6 +786,29 @@ nvme-set-property(1) Manual Page The value of the property to be set.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -805,7 +829,7 @@ nvme-set-property(1) Manual Page <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-set-property.txt b/Documentation/nvme-set-property.txt index ba90fd3..22a513c 100644 --- a/Documentation/nvme-set-property.txt +++ b/Documentation/nvme-set-property.txt @@ -9,9 +9,9 @@ for NVMe over Fabric SYNOPSIS -------- [verse] -'nvme set-property' <device> [--offset=<offset> | -o <offset>] - [--value=<val> | -v <val>] - +'nvme set-property' <device> [--offset=<offset> | -O <offset>] + [--value=<val> | -V <val>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -19,14 +19,23 @@ Writes and shows the defined NVMe controller property for NVMe over Fabric. OPTIONS ------- --o:: +-O:: --offset:: - The offset of the property. + The offset of the property. --v:: +-V:: --value: The value of the property to be set. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples (yet). diff --git a/Documentation/nvme-show-hostnqn.1 b/Documentation/nvme-show-hostnqn.1 index 0411ebd..7ecddf5 100644 --- a/Documentation/nvme-show-hostnqn.1 +++ b/Documentation/nvme-show-hostnqn.1 @@ -2,12 +2,12 @@ .\" Title: nvme-show-hostnqn .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SHOW\-HOSTNQN" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SHOW\-HOSTNQN" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,14 +32,26 @@ nvme-show-hostnqn \- Show the host NQN configured for the system .SH "SYNOPSIS" .sp .nf -\fInvme show\-hostnqn\fR +\fInvme show\-hostnqn\fR [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp Show the host NQN configured for the system\&. If /usr/local/etc/nvme/hostnqn is not present and systemd application\-specific machine IDs are available, this will show the systemd\-generated host NQN for the system\&. .SH "OPTIONS" -.sp -No options needed +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp nvme show\-hostnqn diff --git a/Documentation/nvme-show-hostnqn.html b/Documentation/nvme-show-hostnqn.html index 19ee45e..e395b37 100644 --- a/Documentation/nvme-show-hostnqn.html +++ b/Documentation/nvme-show-hostnqn.html @@ -749,7 +749,7 @@ nvme-show-hostnqn(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme show-hostnqn</em></pre>
+<pre class="content"><em>nvme show-hostnqn</em> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -757,7 +757,7 @@ nvme-show-hostnqn(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>Show the host NQN configured for the system. If /usr/local/etc/nvme/hostnqn is
+<div class="paragraph"><p>Show the host NQN configured for the system. If /usr/local/etc/nvme/hostnqn is
not present and systemd application-specific machine IDs are available,
this will show the systemd-generated host NQN for the system.</p></div>
</div>
@@ -765,7 +765,31 @@ this will show the systemd-generated host NQN for the system.</p></div> <div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
-<div class="paragraph"><p>No options needed</p></div>
+<div class="dlist"><dl>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
+</dl></div>
</div>
</div>
<div class="sect1">
@@ -785,7 +809,7 @@ this will show the systemd-generated host NQN for the system.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-show-hostnqn.txt b/Documentation/nvme-show-hostnqn.txt index 047e291..5074e2c 100644 --- a/Documentation/nvme-show-hostnqn.txt +++ b/Documentation/nvme-show-hostnqn.txt @@ -8,17 +8,24 @@ nvme-show-hostnqn - Show the host NQN configured for the system SYNOPSIS -------- [verse] -'nvme show-hostnqn' +'nvme show-hostnqn' [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- -Show the host NQN configured for the system. If @SYSCONFDIR@/nvme/hostnqn is +Show the host NQN configured for the system. If @SYSCONFDIR@/nvme/hostnqn is not present and systemd application-specific machine IDs are available, this will show the systemd-generated host NQN for the system. OPTIONS ------- -No options needed +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-show-regs.1 b/Documentation/nvme-show-regs.1 index a7ea5ac..e47d913 100644 --- a/Documentation/nvme-show-regs.1 +++ b/Documentation/nvme-show-regs.1 @@ -2,12 +2,12 @@ .\" Title: nvme-id-ns .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ID\-NS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ID\-NS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,8 +32,8 @@ nvme-show-regs \- Reads and shows the defined NVMe controller registers for NVMe .SH "SYNOPSIS" .sp .nf -\fInvme show\-regs\fR <device> [\-\-human\-readable | \-H] - [\-\-output\-format=<FMT> | \-o <FMT>] +\fInvme show\-regs\fR <device> [\-\-human\-readable | \-H] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -47,13 +47,19 @@ The <device> parameter is mandatory and must be the nvme admin character device Display registers or supported properties in human readable format\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-show-regs.html b/Documentation/nvme-show-regs.html index 79ed622..96941b9 100644 --- a/Documentation/nvme-show-regs.html +++ b/Documentation/nvme-show-regs.html @@ -749,8 +749,8 @@ nvme-id-ns(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme show-regs</em> <device> [--human-readable | -H]
- [--output-format=<FMT> | -o <FMT>]</pre>
+<pre class="content"><em>nvme show-regs</em> <device> [--human-readable | -H]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -782,19 +782,30 @@ Only the supported properties are displayed.</p></div> </dt>
<dd>
<p>
- Display registers or supported properties in human readable format.
+ Display registers or supported properties in human readable format.
</p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -848,7 +859,7 @@ in a json format: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-show-regs.txt b/Documentation/nvme-show-regs.txt index 892b394..0460365 100644 --- a/Documentation/nvme-show-regs.txt +++ b/Documentation/nvme-show-regs.txt @@ -9,8 +9,8 @@ NVMe over PCIe or the controller properties for NVMe over Fabrics. SYNOPSIS -------- [verse] -'nvme show-regs' <device> [--human-readable | -H] - [--output-format=<FMT> | -o <FMT>] +'nvme show-regs' <device> [--human-readable | -H] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -30,12 +30,16 @@ OPTIONS ------- -H:: --human-readable:: - Display registers or supported properties in human readable format. + Display registers or supported properties in human readable format. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-show-topology.1 b/Documentation/nvme-show-topology.1 index 1f56e19..4885936 100644 --- a/Documentation/nvme-show-topology.1 +++ b/Documentation/nvme-show-topology.1 @@ -2,12 +2,12 @@ .\" Title: nvme-show-topology .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SHOW\-TOPOLOGY" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SHOW\-TOPOLOGY" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,14 +32,14 @@ nvme-show-topology \- Show topology of all NVMe subsystems .SH "SYNOPSIS" .sp .nf -\fInvme show\-topology\fR +\fInvme show\-topology\fR [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp Show the topology of all NVMe subsystems\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR @@ -62,6 +62,20 @@ Set the ranking orer to \fInamespace\fR ordered\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp nvme show\-topology diff --git a/Documentation/nvme-show-topology.html b/Documentation/nvme-show-topology.html index 7675a6b..ca90b74 100644 --- a/Documentation/nvme-show-topology.html +++ b/Documentation/nvme-show-topology.html @@ -749,7 +749,7 @@ nvme-show-topology(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme show-topology</em></pre>
+<pre class="content"><em>nvme show-topology</em> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -765,10 +765,10 @@ nvme-show-topology(1) Manual Page <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -802,6 +802,29 @@ nvme-show-topology(1) Manual Page always <em>namespace</em> ordered.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -822,7 +845,7 @@ nvme-show-topology(1) Manual Page <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-show-topology.txt b/Documentation/nvme-show-topology.txt index f0583fb..32ffad1 100644 --- a/Documentation/nvme-show-topology.txt +++ b/Documentation/nvme-show-topology.txt @@ -8,7 +8,7 @@ nvme-show-topology - Show topology of all NVMe subsystems SYNOPSIS -------- [verse] -'nvme show-topology' +'nvme show-topology' [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -16,8 +16,8 @@ Show the topology of all NVMe subsystems. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal' or 'json'. Only one output format can be used at a time. @@ -33,6 +33,15 @@ OPTIONS has only an effect for output format 'normal'. The JSON output is always 'namespace' ordered. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- nvme show-topology diff --git a/Documentation/nvme-smart-log.1 b/Documentation/nvme-smart-log.1 index 6c95ab5..2fa623b 100644 --- a/Documentation/nvme-smart-log.1 +++ b/Documentation/nvme-smart-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-smart-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SMART\-LOG" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SMART\-LOG" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,7 +34,7 @@ nvme-smart-log \- Send NVMe SMART log page request, returns result and log .nf \fInvme smart\-log\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] [\-\-raw\-binary | \-b] - [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -55,13 +55,19 @@ Retrieve the SMART log for the given nsid\&. This is optional and its success ma Print the raw SMART log buffer to stdout\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, -\fIjson\fR, or +\fIjson\fR +or \fIbinary\fR\&. Only one output format can be used at a time\&. .RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-smart-log.html b/Documentation/nvme-smart-log.html index 5c62ef2..31e7615 100644 --- a/Documentation/nvme-smart-log.html +++ b/Documentation/nvme-smart-log.html @@ -751,7 +751,7 @@ nvme-smart-log(1) Manual Page <div class="verseblock">
<pre class="content"><em>nvme smart-log</em> <device> [--namespace-id=<nsid> | -n <nsid>]
[--raw-binary | -b]
- [--output-format=<fmt> | -o <fmt>]</pre>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -799,15 +799,26 @@ printed to stdout for another program to parse.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -850,7 +861,7 @@ Print the raw SMART log to a file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-smart-log.txt b/Documentation/nvme-smart-log.txt index 77d0015..c08f523 100644 --- a/Documentation/nvme-smart-log.txt +++ b/Documentation/nvme-smart-log.txt @@ -10,7 +10,7 @@ SYNOPSIS [verse] 'nvme smart-log' <device> [--namespace-id=<nsid> | -n <nsid>] [--raw-binary | -b] - [--output-format=<fmt> | -o <fmt>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -38,10 +38,14 @@ OPTIONS --raw-binary:: Print the raw SMART log buffer to stdout. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-subsystem-reset.1 b/Documentation/nvme-subsystem-reset.1 index 6a7ee6b..a5c3cd6 100644 --- a/Documentation/nvme-subsystem-reset.1 +++ b/Documentation/nvme-subsystem-reset.1 @@ -2,12 +2,12 @@ .\" Title: nvme-subsystem-reset .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SUBSYSTEM\-RES" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SUBSYSTEM\-RES" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,13 +33,26 @@ nvme-subsystem-reset \- Reset the nvme subsystem\&. .sp .nf \fInvme subsystem\-reset\fR <device> + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp Requests NVMe subsystem reset\&. The <device> param is mandatory and must be an NVMe character device (ex: /dev/nvme0)\&. .SH "OPTIONS" -.sp -None +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-subsystem-reset.html b/Documentation/nvme-subsystem-reset.html index 51e27cc..c4f769c 100644 --- a/Documentation/nvme-subsystem-reset.html +++ b/Documentation/nvme-subsystem-reset.html @@ -749,7 +749,8 @@ nvme-subsystem-reset(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme subsystem-reset</em> <device></pre>
+<pre class="content"><em>nvme subsystem-reset</em> <device>
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -764,7 +765,31 @@ be an NVMe character device (ex: /dev/nvme0).</p></div> <div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
-<div class="paragraph"><p>None</p></div>
+<div class="dlist"><dl>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
+</dl></div>
</div>
</div>
<div class="sect1">
@@ -794,7 +819,7 @@ Resets the subsystem. <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-subsystem-reset.txt b/Documentation/nvme-subsystem-reset.txt index 2267acd..cc3a139 100644 --- a/Documentation/nvme-subsystem-reset.txt +++ b/Documentation/nvme-subsystem-reset.txt @@ -9,6 +9,7 @@ SYNOPSIS -------- [verse] 'nvme subsystem-reset' <device> + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -17,7 +18,14 @@ be an NVMe character device (ex: /dev/nvme0). OPTIONS ------- -None +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-supported-cap-config-log.txt b/Documentation/nvme-supported-cap-config-log.txt index 0050634..b60303b 100644 --- a/Documentation/nvme-supported-cap-config-log.txt +++ b/Documentation/nvme-supported-cap-config-log.txt @@ -9,9 +9,8 @@ Configuration List Log pages request, returns result and log. SYNOPSIS -------- [verse] -'nvme supported-cap-config-log' <device> [--dom-id | -d ] - [--output-format=<fmt> | -o <fmt>] - [--raw-binary | -b] +'nvme supported-cap-config-log' <device> [--dom-id | -d] [--raw-binary | -b] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -27,19 +26,23 @@ pages log structure will be printed. OPTIONS ------- - --o <format>:: ---output-format=<format>:: - This option will set the reporting format to normal, json, or binary. - Only one output format can be used at a time. - -d:: --dom-id:: - To get the domain ID. + To get the domain ID. + -b:: --raw-binary:: To show raw binary data. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples provided yet. diff --git a/Documentation/nvme-supported-log-pages.1 b/Documentation/nvme-supported-log-pages.1 index 5a41133..1b84d03 100644 --- a/Documentation/nvme-supported-log-pages.1 +++ b/Documentation/nvme-supported-log-pages.1 @@ -2,12 +2,12 @@ .\" Title: nvme-supported-log-pages .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-SUPPORTED\-LOG" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-SUPPORTED\-LOG" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,8 +32,7 @@ nvme-supported-log-pages \- Send NVMe Supported Log pages request, returns resul .SH "SYNOPSIS" .sp .nf -\fInvme supported\-log\-pages\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] - [\-\-verbose | \-v] +\fInvme supported\-log\-pages\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -44,14 +43,18 @@ The <device> parameter is mandatory and should be the NVMe character device (ex: On success, the returned supported log pages log structure will be printed for each command that is supported\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 -This option will set the reporting format to normal, json, or binary\&. Only one output format can be used at a time\&. +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. .RE .PP \-v, \-\-verbose .RS 4 -Show more information including LID Supported (LSUPP) and Index Offset Supported (IOP) details\&. +Increase the information detail in the output\&. Show more information including LID Supported (LSUPP) and Index Offset Supported (IOP) details\&. .RE .SH "EXAMPLES" .sp diff --git a/Documentation/nvme-supported-log-pages.html b/Documentation/nvme-supported-log-pages.html index 228ee9a..3f811d7 100644 --- a/Documentation/nvme-supported-log-pages.html +++ b/Documentation/nvme-supported-log-pages.html @@ -749,8 +749,7 @@ nvme-supported-log-pages(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme supported-log-pages</em> <device> [--output-format=<fmt> | -o <fmt>]
- [--verbose | -v]</pre>
+<pre class="content"><em>nvme supported-log-pages</em> <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -771,15 +770,15 @@ for each command that is supported.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- This option will set the reporting format to normal, json, or binary.
- Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
</p>
</dd>
<dt class="hdlist1">
@@ -790,7 +789,8 @@ for each command that is supported.</p></div> </dt>
<dd>
<p>
- Show more information including LID Supported (LSUPP) and Index Offset Supported (IOP) details.
+ Increase the information detail in the output. Show more information
+ including LID Supported (LSUPP) and Index Offset Supported (IOP) details.
</p>
</dd>
</dl></div>
@@ -813,7 +813,7 @@ for each command that is supported.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-supported-log-pages.txt b/Documentation/nvme-supported-log-pages.txt index f80aa5f..bd17fdf 100644 --- a/Documentation/nvme-supported-log-pages.txt +++ b/Documentation/nvme-supported-log-pages.txt @@ -8,8 +8,7 @@ nvme-supported-log-pages - Send NVMe Supported Log pages request, returns result SYNOPSIS -------- [verse] -'nvme supported-log-pages' <device> [--output-format=<fmt> | -o <fmt>] - [--verbose | -v] +'nvme supported-log-pages' <device> [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -25,14 +24,15 @@ for each command that is supported. OPTIONS ------- --o <format>:: ---output-format=<format>:: - This option will set the reporting format to normal, json, or binary. - Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. -v:: --verbose:: - Show more information including LID Supported (LSUPP) and Index Offset Supported (IOP) details. + Increase the information detail in the output. Show more information + including LID Supported (LSUPP) and Index Offset Supported (IOP) details. EXAMPLES -------- diff --git a/Documentation/nvme-telemetry-log.1 b/Documentation/nvme-telemetry-log.1 index 9f68cd9..16be54c 100644 --- a/Documentation/nvme-telemetry-log.1 +++ b/Documentation/nvme-telemetry-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-telemetry-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-TELEMETRY\-LOG" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-TELEMETRY\-LOG" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,8 +32,9 @@ nvme-telemetry-log \- Retrieves a Telemetry Host\-Initiated log page from an NVM .SH "SYNOPSIS" .sp .nf -\fInvme telemetry\-log\fR <device> [\-\-output\-file=<file> | \-o <file>] - [\-\-host\-generate=<gen> | \-g <gen>] +\fInvme telemetry\-log\fR <device> [\-\-output\-file=<file> | \-O <file>] + [\-\-host\-generate=<gen> | \-g <gen>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -44,7 +45,7 @@ The <device> parameter is mandatory and may be either the NVMe character device On success, the returned log structure will be in raw binary format \fIonly\fR with \-\-output\-file option which is mandatory\&. .SH "OPTIONS" .PP -\-o <file>, \-\-output\-file=<file> +\-O <file>, \-\-output\-file=<file> .RS 4 File name to which raw binary data will be saved to\&. .RE @@ -60,6 +61,20 @@ update this data\&. .RS 4 Retrieves the specific data area requested\&. Valid inputs are 1,2,3,4\&. If this option is not specified, the default value is 3, since data area 4 may not be supported\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp .RS 4 diff --git a/Documentation/nvme-telemetry-log.html b/Documentation/nvme-telemetry-log.html index bcd352e..9dd19a6 100644 --- a/Documentation/nvme-telemetry-log.html +++ b/Documentation/nvme-telemetry-log.html @@ -749,8 +749,9 @@ nvme-telemetry-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme telemetry-log</em> <device> [--output-file=<file> | -o <file>]
- [--host-generate=<gen> | -g <gen>]</pre>
+<pre class="content"><em>nvme telemetry-log</em> <device> [--output-file=<file> | -O <file>]
+ [--host-generate=<gen> | -g <gen>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -771,7 +772,7 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <file>
+-O <file>
</dt>
<dt class="hdlist1">
--output-file=<file>
@@ -808,6 +809,29 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di 4 may not be supported.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -838,7 +862,7 @@ Retrieve Telemetry Host-Initiated data to telemetry_log.bin <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-telemetry-log.txt b/Documentation/nvme-telemetry-log.txt index cf126d9..4d2a494 100644 --- a/Documentation/nvme-telemetry-log.txt +++ b/Documentation/nvme-telemetry-log.txt @@ -8,8 +8,9 @@ nvme-telemetry-log - Retrieves a Telemetry Host-Initiated log page from an NVMe SYNOPSIS -------- [verse] -'nvme telemetry-log' <device> [--output-file=<file> | -o <file>] - [--host-generate=<gen> | -g <gen>] +'nvme telemetry-log' <device> [--output-file=<file> | -O <file>] + [--host-generate=<gen> | -g <gen>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -24,7 +25,7 @@ On success, the returned log structure will be in raw binary format _only_ with OPTIONS ------- --o <file>:: +-O <file>:: --output-file=<file>:: File name to which raw binary data will be saved to. @@ -41,6 +42,15 @@ OPTIONS this option is not specified, the default value is 3, since data area 4 may not be supported. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- * Retrieve Telemetry Host-Initiated data to telemetry_log.bin diff --git a/Documentation/nvme-toshiba-clear-pcie-correctable-errors.1 b/Documentation/nvme-toshiba-clear-pcie-correctable-errors.1 index ad49454..55d427d 100644 --- a/Documentation/nvme-toshiba-clear-pcie-correctable-errors.1 +++ b/Documentation/nvme-toshiba-clear-pcie-correctable-errors.1 @@ -2,12 +2,12 @@ .\" Title: nvme-toshiba-clear-pcie-correctable-errors .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-TOSHIBA\-CLEAR" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-TOSHIBA\-CLEAR" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-toshiba-clear-pcie-correctable-errors.html b/Documentation/nvme-toshiba-clear-pcie-correctable-errors.html index 88b176d..0446e41 100644 --- a/Documentation/nvme-toshiba-clear-pcie-correctable-errors.html +++ b/Documentation/nvme-toshiba-clear-pcie-correctable-errors.html @@ -791,7 +791,7 @@ Clear the PCIe correctable errors count: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-toshiba-clear-pcie-correctable-errors.txt b/Documentation/nvme-toshiba-clear-pcie-correctable-errors.txt index 5871900..862c860 100644 --- a/Documentation/nvme-toshiba-clear-pcie-correctable-errors.txt +++ b/Documentation/nvme-toshiba-clear-pcie-correctable-errors.txt @@ -10,7 +10,6 @@ SYNOPSIS [verse] 'nvme toshiba clear-pcie-correctable-errors ' <device> - DESCRIPTION ----------- For the NVMe device given, sends the Toshiba clear PCIe correctable errors @@ -20,7 +19,6 @@ The <device> parameter is mandatory and may be either the NVMe character device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1). - EXAMPLES -------- * Clear the PCIe correctable errors count: diff --git a/Documentation/nvme-toshiba-vs-internal-log.1 b/Documentation/nvme-toshiba-vs-internal-log.1 index 08ee01b..a229fd9 100644 --- a/Documentation/nvme-toshiba-vs-internal-log.1 +++ b/Documentation/nvme-toshiba-vs-internal-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-toshiba-vs-internal-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-TOSHIBA\-VS\-I" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-TOSHIBA\-VS\-I" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-toshiba-vs-internal-log.html b/Documentation/nvme-toshiba-vs-internal-log.html index e520bfc..9ef7959 100644 --- a/Documentation/nvme-toshiba-vs-internal-log.html +++ b/Documentation/nvme-toshiba-vs-internal-log.html @@ -837,7 +837,7 @@ Get the previous log from the device and save to a binary file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-toshiba-vs-internal-log.txt b/Documentation/nvme-toshiba-vs-internal-log.txt index d3c0104..3cfb917 100644 --- a/Documentation/nvme-toshiba-vs-internal-log.txt +++ b/Documentation/nvme-toshiba-vs-internal-log.txt @@ -34,12 +34,10 @@ A progress runner is included when data is written to file and a page count is i OPTIONS ------- - -o <FILE>:: --output-file=<FILE>:: Output binary file. Defaults to text-formatted dump to stdout - -p:: --prev-log:: Use previous log contents. Defaults to the current log contents. diff --git a/Documentation/nvme-toshiba-vs-smart-add-log.1 b/Documentation/nvme-toshiba-vs-smart-add-log.1 index 1703e52..2a43f9f 100644 --- a/Documentation/nvme-toshiba-vs-smart-add-log.1 +++ b/Documentation/nvme-toshiba-vs-smart-add-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-toshiba-vs-smart-add-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-TOSHIBA\-VS\-S" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-TOSHIBA\-VS\-S" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-toshiba-vs-smart-add-log.html b/Documentation/nvme-toshiba-vs-smart-add-log.html index f9ff173..1ef222f 100644 --- a/Documentation/nvme-toshiba-vs-smart-add-log.html +++ b/Documentation/nvme-toshiba-vs-smart-add-log.html @@ -764,7 +764,8 @@ request and either saves the result to a file or dumps the content to stdout.</p <div class="paragraph"><p>The <device> parameter is mandatory and may be either the NVMe
character device (ex: /dev/nvme0), or a namespace block device (ex:
/dev/nvme0n1).</p></div>
-<div class="paragraph"><p>The log contents may be associated with the controller, in which case the namespace parameter is ignored.</p></div>
+<div class="paragraph"><p>The log contents may be associated with the controller, in which case the
+namespace parameter is ignored.</p></div>
<div class="paragraph"><p>Two logs exist, page 0xC0 (log page directory) and page 0xCA (vendor log page)</p></div>
<div class="paragraph"><p>This will only work on Toshiba devices supporting this feature.</p></div>
</div>
@@ -781,7 +782,7 @@ character device (ex: /dev/nvme0), or a namespace block device (ex: </dt>
<dd>
<p>
- Log page: 0xC0 or 0xCA (defaults to 0xCA)
+ Log page: 0xC0 or 0xCA (defaults to 0xCA)
</p>
</dd>
<dt class="hdlist1">
@@ -840,7 +841,7 @@ Get the contents of log page 0xC0 from the device and save to a binary file: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-toshiba-vs-smart-add-log.txt b/Documentation/nvme-toshiba-vs-smart-add-log.txt index 8ea4d3e..96a13ca 100644 --- a/Documentation/nvme-toshiba-vs-smart-add-log.txt +++ b/Documentation/nvme-toshiba-vs-smart-add-log.txt @@ -3,7 +3,8 @@ nvme-toshiba-vs-smart-add-log(1) NAME ---- -nvme-toshiba-vs-smart-add-log - Retrieve a Toshiba device's vendor specific extended SMART log page contents and either save to file or dump the contents. +nvme-toshiba-vs-smart-add-log - Retrieve a Toshiba device's vendor specific +extended SMART log page contents and either save to file or dump the contents. SYNOPSIS -------- @@ -12,7 +13,6 @@ SYNOPSIS [--namespace-id=<NUM>, -n <NUM>] [--output-file=<FILE>, -o <FILE>] - DESCRIPTION ----------- For the NVMe device given, sends the Toshiba vendor log @@ -22,7 +22,8 @@ The <device> parameter is mandatory and may be either the NVMe character device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1). -The log contents may be associated with the controller, in which case the namespace parameter is ignored. +The log contents may be associated with the controller, in which case the +namespace parameter is ignored. Two logs exist, page 0xC0 (log page directory) and page 0xCA (vendor log page) @@ -33,7 +34,7 @@ OPTIONS -l <NUM>:: --log=<NUM>:: - Log page: 0xC0 or 0xCA (defaults to 0xCA) + Log page: 0xC0 or 0xCA (defaults to 0xCA) -n <NUM>:: --namespace-id=<NUM>:: @@ -42,8 +43,6 @@ OPTIONS --output-file=<FILE>:: Output binary file. Defaults to text-formatted dump to stdout - - EXAMPLES -------- * Get the current log from the device and dumps it to stdout: diff --git a/Documentation/nvme-transcend-badblock.1 b/Documentation/nvme-transcend-badblock.1 index 4daf67d..affdaa3 100644 --- a/Documentation/nvme-transcend-badblock.1 +++ b/Documentation/nvme-transcend-badblock.1 @@ -2,12 +2,12 @@ .\" Title: nvme-transcend-badblock .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-TRANSCEND\-BAD" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-TRANSCEND\-BAD" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-transcend-badblock.html b/Documentation/nvme-transcend-badblock.html index f8df9fa..276080f 100644 --- a/Documentation/nvme-transcend-badblock.html +++ b/Documentation/nvme-transcend-badblock.html @@ -796,7 +796,7 @@ Print the Transcend device’s bad blocks in a human readable format: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-transcend-badblock.txt b/Documentation/nvme-transcend-badblock.txt index 888076c..9b6f671 100644 --- a/Documentation/nvme-transcend-badblock.txt +++ b/Documentation/nvme-transcend-badblock.txt @@ -23,7 +23,6 @@ OPTIONS ------- none - EXAMPLES -------- * Print the Transcend device's bad blocks in a human readable format: diff --git a/Documentation/nvme-transcend-healthvalue.1 b/Documentation/nvme-transcend-healthvalue.1 index 9da212c..e69b1c8 100644 --- a/Documentation/nvme-transcend-healthvalue.1 +++ b/Documentation/nvme-transcend-healthvalue.1 @@ -2,12 +2,12 @@ .\" Title: nvme-transcend-healthvalue .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-TRANSCEND\-HEA" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-TRANSCEND\-HEA" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-transcend-healthvalue.html b/Documentation/nvme-transcend-healthvalue.html index 51668ee..5c1e541 100644 --- a/Documentation/nvme-transcend-healthvalue.html +++ b/Documentation/nvme-transcend-healthvalue.html @@ -757,7 +757,8 @@ nvme-transcend-healthvalue(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>Retrieves the NVMe Device SMART log page from the Transcend device and evaluate health status of Transcend device.</p></div>
+<div class="paragraph"><p>Retrieves the NVMe Device SMART log page from the Transcend device and evaluate
+health status of Transcend device.</p></div>
<div class="paragraph"><p>The <device> parameter is mandatory and may be either the NVMe character
device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></div>
<div class="paragraph"><p>On success, the returned value would print health percentage value.</p></div>
@@ -796,7 +797,7 @@ Print the Transcend Device health value in a human readable format: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-transcend-healthvalue.txt b/Documentation/nvme-transcend-healthvalue.txt index 4a7d52f..90340ce 100644 --- a/Documentation/nvme-transcend-healthvalue.txt +++ b/Documentation/nvme-transcend-healthvalue.txt @@ -3,7 +3,8 @@ nvme-transcend-healthvalue(1) NAME ---- -nvme-transcend-healthvalue - Use NVMe SMART table to analyze the health value of Transcend device. +nvme-transcend-healthvalue - Use NVMe SMART table to analyze the health value of +Transcend device. SYNOPSIS -------- @@ -12,7 +13,8 @@ SYNOPSIS DESCRIPTION ----------- -Retrieves the NVMe Device SMART log page from the Transcend device and evaluate health status of Transcend device. +Retrieves the NVMe Device SMART log page from the Transcend device and evaluate +health status of Transcend device. The <device> parameter is mandatory and may be either the NVMe character device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1). @@ -23,7 +25,6 @@ OPTIONS ------- none - EXAMPLES -------- * Print the Transcend Device health value in a human readable format: diff --git a/Documentation/nvme-verify.1 b/Documentation/nvme-verify.1 index 1fbdd36..858e432 100644 --- a/Documentation/nvme-verify.1 +++ b/Documentation/nvme-verify.1 @@ -2,12 +2,12 @@ .\" Title: nvme-verify .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-VERIFY" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-VERIFY" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,48 +33,48 @@ nvme-verify \- Send an NVMe Verify command, return results .sp .nf \fInvme\-verify\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>] - [\-\-start\-block=<slba> | \-s <slba>] - [\-\-block\-count=<nlb> | \-c <nlb>] - [\-\-limited\-retry | \-l] - [\-\-force\-unit\-access | \-f] - [\-\-prinfo=<prinfo> | \-p <prinfo>] - [\-\-ref\-tag=<reftag> | \-r <reftag>] - [\-\-app\-tag\-mask=<appmask> | \-m <appmask>] - [\-\-app\-tag=<apptag> | \-a <apptag>] - [\-\-storage\-tag<storage\-tag> | \-S <storage\-tag>] - [\-\-storage\-tag\-check | \-C] + [\-\-start\-block=<slba> | \-s <slba>] + [\-\-block\-count=<nlb> | \-c <nlb>] [\-\-limited\-retry | \-l] + [\-\-force\-unit\-access | \-f] + [\-\-prinfo=<prinfo> | \-p <prinfo>] + [\-\-ref\-tag=<reftag> | \-r <reftag>] + [\-\-app\-tag\-mask=<appmask> | \-m <appmask>] + [\-\-app\-tag=<apptag> | \-a <apptag>] + [\-\-storage\-tag<storage\-tag> | \-S <storage\-tag>] + [\-\-storage\-tag\-check | \-C] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp The Verify command verifies the integrity of the stored information by reading data and metadata\&. .SH "OPTIONS" .PP -\-\-namespace\-id=<nsid>, \-n <nsid> +\-n <nsid>, \-\-namespace\-id=<nsid> .RS 4 Namespace ID use in the command\&. .RE .PP -\-\-start\-block=<slba>, \-s <slba> +\-s <slba>, \-\-start\-block=<slba> .RS 4 Start block address\&. .RE .PP -\-\-block\-count=<nlb>, \-c <nlb> +\-c <nlb>, \-\-block\-count=<nlb> .RS 4 Number of logical blocks to Verify\&. .RE .PP -\-\-limited\-retry, \-l +\-l, \-\-limited\-retry .RS 4 Sets the limited retry flag\&. .RE .PP -\-\-force\-unit\-access, \-f +\-f, \-\-force\-unit\-access .RS 4 Set the force\-unit access flag\&. .RE .PP -\-\-prinfo=<prinfo>, \-p <prinfo> +\-p <prinfo>, \-\-prinfo=<prinfo> .RS 4 Protection Information field definition\&. .TS @@ -119,17 +119,17 @@ T} .sp 1 .RE .PP -\-\-ref\-tag=<reftag>, \-r <reftag> +\-r <reftag>, \-\-ref\-tag=<reftag> .RS 4 Optional reftag when used with protection information\&. .RE .PP -\-\-app\-tag\-mask=<appmask>, \-m <appmask> +\-m <appmask>, \-\-app\-tag\-mask=<appmask> .RS 4 Optional application tag mask when used with protection information\&. .RE .PP -\-\-app\-tag=<apptag>, \-a <apptag> +\-a <apptag>, \-\-app\-tag=<apptag> .RS 4 Optional application tag when used with protection information\&. .RE @@ -143,6 +143,20 @@ Variable Sized Expected Logical Block Storage Tag(ELBST)\&. .RS 4 This flag enables Storage Tag field checking as part of Verify operation\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet\&. diff --git a/Documentation/nvme-verify.html b/Documentation/nvme-verify.html index 5616b77..a21984e 100644 --- a/Documentation/nvme-verify.html +++ b/Documentation/nvme-verify.html @@ -750,16 +750,16 @@ nvme-verify(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme-verify</em> <device> [--namespace-id=<nsid> | -n <nsid>]
- [--start-block=<slba> | -s <slba>]
- [--block-count=<nlb> | -c <nlb>]
- [--limited-retry | -l]
- [--force-unit-access | -f]
- [--prinfo=<prinfo> | -p <prinfo>]
- [--ref-tag=<reftag> | -r <reftag>]
- [--app-tag-mask=<appmask> | -m <appmask>]
- [--app-tag=<apptag> | -a <apptag>]
- [--storage-tag<storage-tag> | -S <storage-tag>]
- [--storage-tag-check | -C]</pre>
+ [--start-block=<slba> | -s <slba>]
+ [--block-count=<nlb> | -c <nlb>] [--limited-retry | -l]
+ [--force-unit-access | -f]
+ [--prinfo=<prinfo> | -p <prinfo>]
+ [--ref-tag=<reftag> | -r <reftag>]
+ [--app-tag-mask=<appmask> | -m <appmask>]
+ [--app-tag=<apptag> | -a <apptag>]
+ [--storage-tag<storage-tag> | -S <storage-tag>]
+ [--storage-tag-check | -C]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -776,10 +776,10 @@ reading data and metadata.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
---namespace-id=<nsid>
+-n <nsid>
</dt>
<dt class="hdlist1">
--n <nsid>
+--namespace-id=<nsid>
</dt>
<dd>
<p>
@@ -787,10 +787,10 @@ reading data and metadata.</p></div> </p>
</dd>
<dt class="hdlist1">
---start-block=<slba>
+-s <slba>
</dt>
<dt class="hdlist1">
--s <slba>
+--start-block=<slba>
</dt>
<dd>
<p>
@@ -798,10 +798,10 @@ reading data and metadata.</p></div> </p>
</dd>
<dt class="hdlist1">
---block-count=<nlb>
+-c <nlb>
</dt>
<dt class="hdlist1">
--c <nlb>
+--block-count=<nlb>
</dt>
<dd>
<p>
@@ -809,10 +809,10 @@ reading data and metadata.</p></div> </p>
</dd>
<dt class="hdlist1">
---limited-retry
+-l
</dt>
<dt class="hdlist1">
--l
+--limited-retry
</dt>
<dd>
<p>
@@ -820,10 +820,10 @@ reading data and metadata.</p></div> </p>
</dd>
<dt class="hdlist1">
---force-unit-access
+-f
</dt>
<dt class="hdlist1">
--f
+--force-unit-access
</dt>
<dd>
<p>
@@ -831,10 +831,10 @@ reading data and metadata.</p></div> </p>
</dd>
<dt class="hdlist1">
---prinfo=<prinfo>
+-p <prinfo>
</dt>
<dt class="hdlist1">
--p <prinfo>
+--prinfo=<prinfo>
</dt>
<dd>
<p>
@@ -879,10 +879,10 @@ metadata is passes.</p></td> </div>
</dd>
<dt class="hdlist1">
---ref-tag=<reftag>
+-r <reftag>
</dt>
<dt class="hdlist1">
--r <reftag>
+--ref-tag=<reftag>
</dt>
<dd>
<p>
@@ -890,10 +890,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---app-tag-mask=<appmask>
+-m <appmask>
</dt>
<dt class="hdlist1">
--m <appmask>
+--app-tag-mask=<appmask>
</dt>
<dd>
<p>
@@ -901,10 +901,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---app-tag=<apptag>
+-a <apptag>
</dt>
<dt class="hdlist1">
--a <apptag>
+--app-tag=<apptag>
</dt>
<dd>
<p>
@@ -933,6 +933,29 @@ metadata is passes.</p></td> This flag enables Storage Tag field checking as part of Verify operation.
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -953,7 +976,7 @@ metadata is passes.</p></td> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-verify.txt b/Documentation/nvme-verify.txt index 3c8039a..01dabbf 100644 --- a/Documentation/nvme-verify.txt +++ b/Documentation/nvme-verify.txt @@ -9,16 +9,16 @@ SYNOPSIS -------- [verse] 'nvme-verify' <device> [--namespace-id=<nsid> | -n <nsid>] - [--start-block=<slba> | -s <slba>] - [--block-count=<nlb> | -c <nlb>] - [--limited-retry | -l] - [--force-unit-access | -f] - [--prinfo=<prinfo> | -p <prinfo>] - [--ref-tag=<reftag> | -r <reftag>] - [--app-tag-mask=<appmask> | -m <appmask>] - [--app-tag=<apptag> | -a <apptag>] - [--storage-tag<storage-tag> | -S <storage-tag>] - [--storage-tag-check | -C] + [--start-block=<slba> | -s <slba>] + [--block-count=<nlb> | -c <nlb>] [--limited-retry | -l] + [--force-unit-access | -f] + [--prinfo=<prinfo> | -p <prinfo>] + [--ref-tag=<reftag> | -r <reftag>] + [--app-tag-mask=<appmask> | -m <appmask>] + [--app-tag=<apptag> | -a <apptag>] + [--storage-tag<storage-tag> | -S <storage-tag>] + [--storage-tag-check | -C] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -27,28 +27,28 @@ reading data and metadata. OPTIONS ------- ---namespace-id=<nsid>:: -n <nsid>:: +--namespace-id=<nsid>:: Namespace ID use in the command. ---start-block=<slba>:: -s <slba>:: +--start-block=<slba>:: Start block address. ---block-count=<nlb>:: -c <nlb>:: +--block-count=<nlb>:: Number of logical blocks to Verify. ---limited-retry:: -l:: +--limited-retry:: Sets the limited retry flag. ---force-unit-access:: -f:: +--force-unit-access:: Set the force-unit access flag. ---prinfo=<prinfo>:: -p <prinfo>:: +--prinfo=<prinfo>:: Protection Information field definition. + [] @@ -63,16 +63,16 @@ metadata is passes. |0|Set to 1 enables checking the reference tag |================= ---ref-tag=<reftag>:: -r <reftag>:: +--ref-tag=<reftag>:: Optional reftag when used with protection information. ---app-tag-mask=<appmask>:: -m <appmask>:: +--app-tag-mask=<appmask>:: Optional application tag mask when used with protection information. ---app-tag=<apptag>:: -a <apptag>:: +--app-tag=<apptag>:: Optional application tag when used with protection information. -S <storage-tag>:: @@ -83,6 +83,15 @@ metadata is passes. --storage-tag-check:: This flag enables Storage Tag field checking as part of Verify operation. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet. diff --git a/Documentation/nvme-virt-mgmt.txt b/Documentation/nvme-virt-mgmt.txt new file mode 100755 index 0000000..5eede14 --- /dev/null +++ b/Documentation/nvme-virt-mgmt.txt @@ -0,0 +1,70 @@ +nvme-virt-mgmt(1) +================= + +NAME +---- +nvme-virt-mgmt - Manage flexible resources between primary and secondary +controller + +SYNOPSIS +-------- +[verse] +'nvme virt-mgmt' <device> [--cntlid=<cntlid> | -c <cntlid>] + [--rt=<rt> | -r <rt>] [--act=<act> | -a <act>] + [--nr=<nr> | -n <nr>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] + +DESCRIPTION +----------- +Manage flexible resources between primary and secondary controller, return +results. + +The <device> parameter is mandatory and may be either the NVMe character +device (ex: /dev/nvme0) or block device (ex: /dev/nvme0n1). + +On success it returns 0, error code otherwise. + +OPTIONS +------- +-c <cntlid>:: +--cntlid=<cntlid>:: + Controller identifier (CNTLID) + +-r <rt>:: +--rt=<rt>:: + Resource Type (RT): [0,1] + 0h: VQ Resources + 1h: VI Resources + +-a <act>:: +--act=<act>:: + Action(ACT): [1,7,8,9] + 1h: Primary Flexible + 7h: Secondary Offline + 8h: Secondary Assign + 9h: Secondary Online + +-n <nr>:: +--nr=<nr>:: + Number of controller resources (NR) + +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + +EXAMPLES +-------- +* Has the program issue a virt-mgmt to manage flexible resources. ++ +------------ +# nvme virt-mgmt /dev/nvme0 -c 0 -r 1 -a 1 -n 0 +------------ + +NVME +---- +Part of the nvme-user suite. diff --git a/Documentation/nvme-virtium-save-smart-to-vtview-log.1 b/Documentation/nvme-virtium-save-smart-to-vtview-log.1 index 292c91b..b21beba 100644 --- a/Documentation/nvme-virtium-save-smart-to-vtview-log.1 +++ b/Documentation/nvme-virtium-save-smart-to-vtview-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-virtium-save-smart-to-vtview-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-VIRTIUM\-SAVE\" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-VIRTIUM\-SAVE\" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -39,7 +39,7 @@ nvme-virtium-save-smart-to-vtview-log \- Periodically save smart attributes into .fi .SH "DESCRIPTION" .sp -This command automates the process of collecting SMART data periodically and saving the data in a ready\-to\-analyze format\&. Each entry is saved with timestamp and in csv format\&. Users can use excel to analyze the data\&. Some examples of use cases are collecting SMART data for temperature characterization, collecting data to calculate endurance, or collecting SMART data during a test or during normal operation\&. +This command automates the process of collecting SMART data periodically and saving the data in a ready\-to\-analyze format\&. Each entry is saved with timestamp and in csv format\&. Users can use excel to analyze the data\&. Some examples of use cases are collecting SMART data for temperature characterization, data to calculate endurance, or collecting SMART data during a test or during normal operation\&. .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 @@ -57,7 +57,7 @@ If the test\-name option is specified, it will be recorded in the log file and b .PP \-f <NUM>, \-\-freq=<NUM> .RS 4 -(optional) How often you want to log SMART data (0\&.25 = 15\*(Aq , 0\&.5 = 30\*(Aq , 1 = 1 hour, 2 = 2 hours, etc\&.)\&. Default = 10 hours\&. +(optional) How often you want to log SMART data (0\&.25 = 15\*(Aq, 0\&.5 = 30\*(Aq, 1 = 1 hour, 2 = 2 hours, etc\&.)\&. Default = 10 hours\&. .RE .PP \-o <FILE>, \-\-output\-file=<FILE> diff --git a/Documentation/nvme-virtium-save-smart-to-vtview-log.html b/Documentation/nvme-virtium-save-smart-to-vtview-log.html index 7140680..4f84716 100644 --- a/Documentation/nvme-virtium-save-smart-to-vtview-log.html +++ b/Documentation/nvme-virtium-save-smart-to-vtview-log.html @@ -763,18 +763,19 @@ nvme-virtium-save-smart-to-vtview-log(1) Manual Page <div class="paragraph"><p>This command automates the process of collecting SMART data periodically and
saving the data in a ready-to-analyze format. Each entry is saved
with timestamp and in csv format. Users can use excel to analyze the data.
-Some examples of use cases are collecting SMART data for temperature characterization,
-collecting data to calculate endurance, or collecting SMART data during a test
-or during normal operation.</p></div>
+Some examples of use cases are collecting SMART data for temperature
+characterization, data to calculate endurance, or collecting SMART data during a
+test or during normal operation.</p></div>
<div class="paragraph"><p>The <device> parameter is mandatory and may be either the NVMe character
device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></div>
-<div class="paragraph"><p>On success, the command generates a log file, which contains an entry for identify device
-(current features & settings) and periodic entries of SMART data.</p></div>
-<div class="paragraph"><p>This command runs for the time specified by the option <run-time>, and collects SMART data
-at the frequency specified by the option <freq>. If the output file name is not specified,
-this command will generate a file name that include model string and serial number of the device.</p></div>
-<div class="paragraph"><p>If the test-name option is specified, it will be recorded in the log file and be used as part
-of the log file name.</p></div>
+<div class="paragraph"><p>On success, the command generates a log file, which contains an entry for
+identify device (current features & settings) and periodic entries of SMART data.</p></div>
+<div class="paragraph"><p>This command runs for the time specified by the option <run-time>, and collects
+SMART data at the frequency specified by the option <freq>. If the output file
+name is not specified, this command will generate a file name that include model
+string and serial number of the device.</p></div>
+<div class="paragraph"><p>If the test-name option is specified, it will be recorded in the log file and be
+used as part of the log file name.</p></div>
</div>
</div>
<div class="sect1">
@@ -800,8 +801,8 @@ of the log file name.</p></div> </dt>
<dd>
<p>
- (optional) How often you want to log SMART data
- (0.25 = 15' , 0.5 = 30' , 1 = 1 hour, 2 = 2 hours, etc.). Default = 10 hours.
+ (optional) How often you want to log SMART data (0.25 = 15', 0.5 = 30',
+ 1 = 1 hour, 2 = 2 hours, etc.). Default = 10 hours.
</p>
</dd>
<dt class="hdlist1">
@@ -812,9 +813,9 @@ of the log file name.</p></div> </dt>
<dd>
<p>
- (optional) Name of the log file (give it a name that easy for you to remember
- what the test is). You can leave it blank too, the file name will be generated
- as <model string>-<serial number>-<test name>.txt.
+ (optional) Name of the log file (give it a name that easy for you to
+ remember what the test is). You can leave it blank too, the file name
+ will be generated as <model string>-<serial number>-<test name>.txt.
</p>
</dd>
<dt class="hdlist1">
@@ -825,7 +826,8 @@ of the log file name.</p></div> </dt>
<dd>
<p>
- (optional) Name of the test you are doing. We use this string as part of the name of the log file.
+ (optional) Name of the test you are doing. We use this string as part of
+ the name of the log file.
</p>
</dd>
</dl></div>
@@ -876,7 +878,7 @@ Just logging: Default logging is run for 20 hours and log every 10 hours. <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-virtium-save-smart-to-vtview-log.txt b/Documentation/nvme-virtium-save-smart-to-vtview-log.txt index 313ac35..72090c0 100644 --- a/Documentation/nvme-virtium-save-smart-to-vtview-log.txt +++ b/Documentation/nvme-virtium-save-smart-to-vtview-log.txt @@ -3,7 +3,8 @@ nvme-virtium-save-smart-to-vtview-log(1) NAME ---- -nvme-virtium-save-smart-to-vtview-log - Periodically save smart attributes into a log file (csv format). +nvme-virtium-save-smart-to-vtview-log - Periodically save smart attributes into +a log file (csv format). SYNOPSIS -------- @@ -12,28 +13,29 @@ SYNOPSIS [--freq=<NUM> | -f <NUM>] [--output-file=<FILE> | -o <FILE>] [--test-name=<NAME> | -n <NAME>] - + DESCRIPTION ----------- This command automates the process of collecting SMART data periodically and saving the data in a ready-to-analyze format. Each entry is saved with timestamp and in csv format. Users can use excel to analyze the data. -Some examples of use cases are collecting SMART data for temperature characterization, -collecting data to calculate endurance, or collecting SMART data during a test -or during normal operation. +Some examples of use cases are collecting SMART data for temperature +characterization, data to calculate endurance, or collecting SMART data during a +test or during normal operation. 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 command generates a log file, which contains an entry for identify device -(current features & settings) and periodic entries of SMART data. +On success, the command generates a log file, which contains an entry for +identify device (current features & settings) and periodic entries of SMART data. -This command runs for the time specified by the option <run-time>, and collects SMART data -at the frequency specified by the option <freq>. If the output file name is not specified, -this command will generate a file name that include model string and serial number of the device. +This command runs for the time specified by the option <run-time>, and collects +SMART data at the frequency specified by the option <freq>. If the output file +name is not specified, this command will generate a file name that include model +string and serial number of the device. -If the test-name option is specified, it will be recorded in the log file and be used as part -of the log file name. +If the test-name option is specified, it will be recorded in the log file and be +used as part of the log file name. OPTIONS ------- @@ -43,20 +45,20 @@ OPTIONS -f <NUM>:: --freq=<NUM>:: - (optional) How often you want to log SMART data - (0.25 = 15' , 0.5 = 30' , 1 = 1 hour, 2 = 2 hours, etc.). Default = 10 hours. + (optional) How often you want to log SMART data (0.25 = 15', 0.5 = 30', + 1 = 1 hour, 2 = 2 hours, etc.). Default = 10 hours. -o <FILE>:: --output-file=<FILE>:: - (optional) Name of the log file (give it a name that easy for you to remember - what the test is). You can leave it blank too, the file name will be generated - as <model string>-<serial number>-<test name>.txt. + (optional) Name of the log file (give it a name that easy for you to + remember what the test is). You can leave it blank too, the file name + will be generated as <model string>-<serial number>-<test name>.txt. -n <NAME>:: --test-name=<NAME>:: - (optional) Name of the test you are doing. We use this string as part of the name of the log file. - - + (optional) Name of the test you are doing. We use this string as part of + the name of the log file. + EXAMPLES -------- * Temperature characterization: diff --git a/Documentation/nvme-virtium-show-identify.1 b/Documentation/nvme-virtium-show-identify.1 index 8b445cb..6e4192a 100644 --- a/Documentation/nvme-virtium-show-identify.1 +++ b/Documentation/nvme-virtium-show-identify.1 @@ -2,12 +2,12 @@ .\" Title: nvme-virtium-show-identify .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-VIRTIUM\-SHOW\" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-VIRTIUM\-SHOW\" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-virtium-show-identify.html b/Documentation/nvme-virtium-show-identify.html index ab4cb8e..ae82003 100644 --- a/Documentation/nvme-virtium-show-identify.html +++ b/Documentation/nvme-virtium-show-identify.html @@ -798,7 +798,7 @@ Show Identify Device: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-virtium-show-identify.txt b/Documentation/nvme-virtium-show-identify.txt index 5ce1933..881824c 100644 --- a/Documentation/nvme-virtium-show-identify.txt +++ b/Documentation/nvme-virtium-show-identify.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] 'nvme virtium show-identify' <device> - + DESCRIPTION ----------- This command prints complete detail of the identify device information. The @@ -24,8 +24,7 @@ On success, the command prints identify device in human readable format. OPTIONS ------- none - - + EXAMPLES -------- * Show Identify Device: diff --git a/Documentation/nvme-wdc-cap-diag.1 b/Documentation/nvme-wdc-cap-diag.1 index edb93b2..6ce52a3 100644 --- a/Documentation/nvme-wdc-cap-diag.1 +++ b/Documentation/nvme-wdc-cap-diag.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-cap-diag .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-CAP\-DIAG" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-CAP\-DIAG" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-cap-diag.html b/Documentation/nvme-wdc-cap-diag.html index 29a0cd6..1df78bc 100644 --- a/Documentation/nvme-wdc-cap-diag.html +++ b/Documentation/nvme-wdc-cap-diag.html @@ -787,7 +787,7 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Transfer size; defaults to 0x10000 (65536 decimal) bytes
+ Transfer size; defaults to 0x10000 (65536 decimal) bytes
</p>
</dd>
</dl></div>
@@ -856,7 +856,7 @@ Gets the capture diagnostics log from the device transferring the data in 16k ch <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-cap-diag.txt b/Documentation/nvme-wdc-cap-diag.txt index 9439eaa..bfcde9a 100644 --- a/Documentation/nvme-wdc-cap-diag.txt +++ b/Documentation/nvme-wdc-cap-diag.txt @@ -29,7 +29,7 @@ OPTIONS -s <SIZE>:: --transfer-size=<SIZE>:: - Transfer size; defaults to 0x10000 (65536 decimal) bytes + Transfer size; defaults to 0x10000 (65536 decimal) bytes EXAMPLES -------- diff --git a/Documentation/nvme-wdc-capabilities.1 b/Documentation/nvme-wdc-capabilities.1 index 348702a..c0c2a69 100644 --- a/Documentation/nvme-wdc-capabilities.1 +++ b/Documentation/nvme-wdc-capabilities.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-capabilities .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-CAPABILIT" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-CAPABILIT" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-capabilities.html b/Documentation/nvme-wdc-capabilities.html index 3109d51..d89304e 100644 --- a/Documentation/nvme-wdc-capabilities.html +++ b/Documentation/nvme-wdc-capabilities.html @@ -789,7 +789,7 @@ Displays the capabilities for the device: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-clear-assert-dump.1 b/Documentation/nvme-wdc-clear-assert-dump.1 index 6b4c887..6176d1f 100644 --- a/Documentation/nvme-wdc-clear-assert-dump.1 +++ b/Documentation/nvme-wdc-clear-assert-dump.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-clear-assert-dump .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-CLEAR\-AS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-CLEAR\-AS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-clear-assert-dump.html b/Documentation/nvme-wdc-clear-assert-dump.html index a8eed74..0a3c3c9 100644 --- a/Documentation/nvme-wdc-clear-assert-dump.html +++ b/Documentation/nvme-wdc-clear-assert-dump.html @@ -798,7 +798,7 @@ Clears the assert dump (if present): <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-clear-assert-dump.txt b/Documentation/nvme-wdc-clear-assert-dump.txt index a575089..60493df 100644 --- a/Documentation/nvme-wdc-clear-assert-dump.txt +++ b/Documentation/nvme-wdc-clear-assert-dump.txt @@ -33,7 +33,6 @@ EXAMPLES # nvme wdc clear-assert-dump /dev/nvme0 ------------ - NVME ---- Part of the nvme-user suite diff --git a/Documentation/nvme-wdc-clear-fw-activate-history.1 b/Documentation/nvme-wdc-clear-fw-activate-history.1 index 92998b9..f8f4e39 100644 --- a/Documentation/nvme-wdc-clear-fw-activate-history.1 +++ b/Documentation/nvme-wdc-clear-fw-activate-history.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-clear-fw-activate-history .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-CLEAR\-FW" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-CLEAR\-FW" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-clear-fw-activate-history.html b/Documentation/nvme-wdc-clear-fw-activate-history.html index ed34302..99ab9a5 100644 --- a/Documentation/nvme-wdc-clear-fw-activate-history.html +++ b/Documentation/nvme-wdc-clear-fw-activate-history.html @@ -797,7 +797,7 @@ Clears the firmware activate history table: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-clear-fw-activate-history.txt b/Documentation/nvme-wdc-clear-fw-activate-history.txt index 50be1e9..ddb6c26 100644 --- a/Documentation/nvme-wdc-clear-fw-activate-history.txt +++ b/Documentation/nvme-wdc-clear-fw-activate-history.txt @@ -32,7 +32,6 @@ EXAMPLES # nvme wdc clear-fw-activate-history /dev/nvme0 ------------ - NVME ---- Part of the nvme-user suite diff --git a/Documentation/nvme-wdc-clear-pcie-correctable-errors.1 b/Documentation/nvme-wdc-clear-pcie-correctable-errors.1 index e979185..5f9e7e5 100644 --- a/Documentation/nvme-wdc-clear-pcie-correctable-errors.1 +++ b/Documentation/nvme-wdc-clear-pcie-correctable-errors.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-clear-pcie-correctable-errors .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-CLEAR\-PC" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-CLEAR\-PC" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-clear-pcie-correctable-errors.html b/Documentation/nvme-wdc-clear-pcie-correctable-errors.html index bbbc8d4..cbe996f 100644 --- a/Documentation/nvme-wdc-clear-pcie-correctable-errors.html +++ b/Documentation/nvme-wdc-clear-pcie-correctable-errors.html @@ -799,7 +799,7 @@ Clears the PCIe Correctable Error Count field returned in the smart-log-add comm <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-clear-pcie-correctable-errors.txt b/Documentation/nvme-wdc-clear-pcie-correctable-errors.txt index 4788f1f..cecc52e 100644 --- a/Documentation/nvme-wdc-clear-pcie-correctable-errors.txt +++ b/Documentation/nvme-wdc-clear-pcie-correctable-errors.txt @@ -34,7 +34,6 @@ EXAMPLES # nvme wdc clear-pcie-correctable-errors /dev/nvme0 ------------ - NVME ---- Part of the nvme-user suite diff --git a/Documentation/nvme-wdc-cloud-SSD-plugin-version.1 b/Documentation/nvme-wdc-cloud-SSD-plugin-version.1 index c714776..5c5e541 100644 --- a/Documentation/nvme-wdc-cloud-SSD-plugin-version.1 +++ b/Documentation/nvme-wdc-cloud-SSD-plugin-version.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-cloud-SSD-plugin-version .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-CLOUD\-SS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-CLOUD\-SS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-cloud-SSD-plugin-version.html b/Documentation/nvme-wdc-cloud-SSD-plugin-version.html index c94e7a5..b6cc4c8 100644 --- a/Documentation/nvme-wdc-cloud-SSD-plugin-version.html +++ b/Documentation/nvme-wdc-cloud-SSD-plugin-version.html @@ -790,7 +790,7 @@ Displays the cloud ssd plugin version for the device: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-cloud-boot-SSD-version.1 b/Documentation/nvme-wdc-cloud-boot-SSD-version.1 index 34b6289..7be90e1 100644 --- a/Documentation/nvme-wdc-cloud-boot-SSD-version.1 +++ b/Documentation/nvme-wdc-cloud-boot-SSD-version.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-cloud-boot-SSD-version .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-CLOUD\-BO" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-CLOUD\-BO" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-cloud-boot-SSD-version.html b/Documentation/nvme-wdc-cloud-boot-SSD-version.html index b536657..d781c18 100644 --- a/Documentation/nvme-wdc-cloud-boot-SSD-version.html +++ b/Documentation/nvme-wdc-cloud-boot-SSD-version.html @@ -790,7 +790,7 @@ Displays the cloud boot ssd version for the device: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-drive-essentials.1 b/Documentation/nvme-wdc-drive-essentials.1 index 9c5d70f..4783608 100644 --- a/Documentation/nvme-wdc-drive-essentials.1 +++ b/Documentation/nvme-wdc-drive-essentials.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-drive-essentials .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-DRIVE\-ES" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-DRIVE\-ES" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-drive-essentials.html b/Documentation/nvme-wdc-drive-essentials.html index 48c4a83..a9bbc3c 100644 --- a/Documentation/nvme-wdc-drive-essentials.html +++ b/Documentation/nvme-wdc-drive-essentials.html @@ -757,9 +757,10 @@ nvme-wdc-drive-essentials(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>For the NVMe device given, captures the drive essential bin files and saves them into a tar file.
-The tar file will be in the following format: DRIVE_ESSENTIALS_<Serial Num>_<FW Revision>_<Date>_<Time>.tar.gz
- e.g. DRIVE_ESSENTIALS_A00FD8CA_1048_20170713_091731.tar.gz</p></div>
+<div class="paragraph"><p>For the NVMe device given, captures the drive essential bin files and saves them
+into a tar file. The tar file will be in the following format:
+DRIVE_ESSENTIALS_<Serial Num>_<FW Revision>_<Date>_<Time>.tar.gz
+ e.g. DRIVE_ESSENTIALS_A00FD8CA_1048_20170713_091731.tar.gz</p></div>
<div class="paragraph"><p>The <device> parameter is mandatory; NVMe character device (ex: /dev/nvme0).</p></div>
<div class="paragraph"><p>This will only work on WDC devices supporting this feature.
Results for any other device are undefined.</p></div>
@@ -821,7 +822,7 @@ Gets the drive essentials data files from the device and saves the tar file to s <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-drive-essentials.txt b/Documentation/nvme-wdc-drive-essentials.txt index 59b2787..7f06040 100644 --- a/Documentation/nvme-wdc-drive-essentials.txt +++ b/Documentation/nvme-wdc-drive-essentials.txt @@ -3,7 +3,8 @@ nvme-wdc-drive-essentials(1) NAME ---- -nvme-wdc-drive-essentials - Retrieve WDC device's drive essentials bin files and save to a tar file. +nvme-wdc-drive-essentials - Retrieve WDC device's drive essentials bin files and +save to a tar file. SYNOPSIS -------- @@ -13,9 +14,10 @@ SYNOPSIS DESCRIPTION ----------- -For the NVMe device given, captures the drive essential bin files and saves them into a tar file. -The tar file will be in the following format: DRIVE_ESSENTIALS_<Serial Num>_<FW Revision>_<Date>_<Time>.tar.gz - e.g. DRIVE_ESSENTIALS_A00FD8CA_1048_20170713_091731.tar.gz +For the NVMe device given, captures the drive essential bin files and saves them +into a tar file. The tar file will be in the following format: +DRIVE_ESSENTIALS_<Serial Num>_<FW Revision>_<Date>_<Time>.tar.gz + e.g. DRIVE_ESSENTIALS_A00FD8CA_1048_20170713_091731.tar.gz The <device> parameter is mandatory; NVMe character device (ex: /dev/nvme0). diff --git a/Documentation/nvme-wdc-drive-log.1 b/Documentation/nvme-wdc-drive-log.1 index 0fca516..91cd4d1 100644 --- a/Documentation/nvme-wdc-drive-log.1 +++ b/Documentation/nvme-wdc-drive-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-drive-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-DRIVE\-LO" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-DRIVE\-LO" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-drive-log.html b/Documentation/nvme-wdc-drive-log.html index 4c442be..80a8981 100644 --- a/Documentation/nvme-wdc-drive-log.html +++ b/Documentation/nvme-wdc-drive-log.html @@ -829,7 +829,7 @@ Gets the drive log from the device and saves to defined file with pathname (e.g. <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-drive-log.txt b/Documentation/nvme-wdc-drive-log.txt index 3c6a589..0587df9 100644 --- a/Documentation/nvme-wdc-drive-log.txt +++ b/Documentation/nvme-wdc-drive-log.txt @@ -28,7 +28,6 @@ OPTIONS --output-file=<FILE>:: Output file; defaults to device serial number followed by "drive_log" suffix - EXAMPLES -------- * Gets the drive log from the device and saves to default file in current directory (e.g. STM00019F3F9drive_log.bin): diff --git a/Documentation/nvme-wdc-drive-resize.1 b/Documentation/nvme-wdc-drive-resize.1 index 7fe9e5e..ac0955f 100644 --- a/Documentation/nvme-wdc-drive-resize.1 +++ b/Documentation/nvme-wdc-drive-resize.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-drive-resize .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-DRIVE\-RE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-DRIVE\-RE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-drive-resize.html b/Documentation/nvme-wdc-drive-resize.html index f1a952f..e1d5cf0 100644 --- a/Documentation/nvme-wdc-drive-resize.html +++ b/Documentation/nvme-wdc-drive-resize.html @@ -810,7 +810,7 @@ Has the program issue WDC Resize Vendor Unique Command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-enc-get-log.1 b/Documentation/nvme-wdc-enc-get-log.1 index 02110aa..c4d8ef6 100644 --- a/Documentation/nvme-wdc-enc-get-log.1 +++ b/Documentation/nvme-wdc-enc-get-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-enc-get-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-ENC\-GET\" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-ENC\-GET\" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,7 +32,9 @@ nvme-wdc-enc-get-log \- Send NVMe WDC enc\-get\-log Vendor Unique Command, retur .SH "SYNOPSIS" .sp .nf -\fInvme wdc enc\-get\-log\fR <device> [\-\-log\-id=<NUM>, \-l <NUM>] [\-\-output\-file=<FILE>, \-o <FILE>] [\-\-transfer\-size=<SIZE>, \-s <SIZE>] +\fInvme wdc enc\-get\-log\fR <device> [\-\-log\-id=<NUM>, \-l <NUM>] + [\-\-output\-file=<FILE>, \-o <FILE>] + [\-\-transfer\-size=<SIZE>, \-s <SIZE>] .fi .SH "DESCRIPTION" .sp diff --git a/Documentation/nvme-wdc-enc-get-log.html b/Documentation/nvme-wdc-enc-get-log.html index 7ff9cdd..59f37ff 100644 --- a/Documentation/nvme-wdc-enc-get-log.html +++ b/Documentation/nvme-wdc-enc-get-log.html @@ -749,7 +749,9 @@ nvme-wdc-enc-get-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme wdc enc-get-log</em> <device> [--log-id=<NUM>, -l <NUM>] [--output-file=<FILE>, -o <FILE>] [--transfer-size=<SIZE>, -s <SIZE>]</pre>
+<pre class="content"><em>nvme wdc enc-get-log</em> <device> [--log-id=<NUM>, -l <NUM>]
+ [--output-file=<FILE>, -o <FILE>]
+ [--transfer-size=<SIZE>, -s <SIZE>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -761,7 +763,8 @@ nvme-wdc-enc-get-log(1) Manual Page output the Enclosure logs.</p></div>
<div class="paragraph"><p>The <device> parameter is mandatory and may be either the NVMe character
device (ex: /dev/nvme0).</p></div>
-<div class="paragraph"><p>The --log-id=<NUM>, -l <NUM> parameter is mandatory and may be either 0xd1, 0xd2, 0xd3, 0xd4, 0xe2 and 0xe4.</p></div>
+<div class="paragraph"><p>The --log-id=<NUM>, -l <NUM> parameter is mandatory and may be either 0xd1, 0xd2,
+0xd3, 0xd4, 0xe2 and 0xe4.</p></div>
<div class="paragraph"><p>This will only work on WDC devices supporting this feature.
Results for any other device are undefined.</p></div>
<div class="paragraph"><p>On success it returns the enclosure log data, error code otherwise.</p></div>
@@ -779,7 +782,7 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Output file pathname
+ Output file pathname
</p>
</dd>
<dt class="hdlist1">
@@ -790,7 +793,8 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Data retrieval transfer size, maximum transfer size should be 0x2000 (decimal 8192)
+ Data retrieval transfer size, maximum transfer size should be 0x2000
+ (decimal 8192)
</p>
</dd>
</dl></div>
@@ -802,7 +806,8 @@ Results for any other device are undefined.</p></div> <div class="ulist"><ul>
<li>
<p>
-Gets the enclosure log from the device based on the log id(0xd1) with transfer size(0x2000) and saves to defined file in current directory:
+Gets the enclosure log from the device based on the log id(0xd1) with transfer
+ size(0x2000) and saves to defined file in current directory:
</p>
<div class="listingblock">
<div class="content">
@@ -832,7 +837,7 @@ Gets the enclosure log from the device based on the log id(0xd2) with default tr <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-enc-get-log.txt b/Documentation/nvme-wdc-enc-get-log.txt index ae93a7a..bcff83f 100644 --- a/Documentation/nvme-wdc-enc-get-log.txt +++ b/Documentation/nvme-wdc-enc-get-log.txt @@ -3,12 +3,15 @@ nvme-wdc-enc-get-log(1) NAME ---- -nvme-wdc-enc-get-log - Send NVMe WDC enc-get-log Vendor Unique Command, return result. +nvme-wdc-enc-get-log - Send NVMe WDC enc-get-log Vendor Unique Command, return +result. SYNOPSIS -------- [verse] -'nvme wdc enc-get-log' <device> [--log-id=<NUM>, -l <NUM>] [--output-file=<FILE>, -o <FILE>] [--transfer-size=<SIZE>, -s <SIZE>] +'nvme wdc enc-get-log' <device> [--log-id=<NUM>, -l <NUM>] + [--output-file=<FILE>, -o <FILE>] + [--transfer-size=<SIZE>, -s <SIZE>] DESCRIPTION ----------- @@ -19,7 +22,8 @@ output the Enclosure logs. The <device> parameter is mandatory and may be either the NVMe character device (ex: /dev/nvme0). -The --log-id=<NUM>, -l <NUM> parameter is mandatory and may be either 0xd1, 0xd2, 0xd3, 0xd4, 0xe2 and 0xe4. +The --log-id=<NUM>, -l <NUM> parameter is mandatory and may be either 0xd1, 0xd2, +0xd3, 0xd4, 0xe2 and 0xe4. This will only work on WDC devices supporting this feature. Results for any other device are undefined. @@ -30,15 +34,17 @@ OPTIONS ------- -o <FILE>:: --output-file=<FILE>:: - Output file pathname + Output file pathname -s <SIZE>:: --transfer-size=<NUM>:: - Data retrieval transfer size, maximum transfer size should be 0x2000 (decimal 8192) + Data retrieval transfer size, maximum transfer size should be 0x2000 + (decimal 8192) EXAMPLES -------- -* Gets the enclosure log from the device based on the log id(0xd1) with transfer size(0x2000) and saves to defined file in current directory: +* Gets the enclosure log from the device based on the log id(0xd1) with transfer + size(0x2000) and saves to defined file in current directory: + ------------ # nvme wdc enc-get-log /dev/nvme0 -l 0xd1 -o d1_log.bin -s 0x2000 diff --git a/Documentation/nvme-wdc-get-crash-dump.1 b/Documentation/nvme-wdc-get-crash-dump.1 index 6959dc1..7313533 100644 --- a/Documentation/nvme-wdc-get-crash-dump.1 +++ b/Documentation/nvme-wdc-get-crash-dump.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-get-crash-dump .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-GET\-CRAS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-GET\-CRAS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-get-crash-dump.html b/Documentation/nvme-wdc-get-crash-dump.html index 639d665..f3ded31 100644 --- a/Documentation/nvme-wdc-get-crash-dump.html +++ b/Documentation/nvme-wdc-get-crash-dump.html @@ -830,7 +830,7 @@ Gets the crash dump from the device and saves to defined file with pathname (e.g <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-get-dev-capabilities-log.1 b/Documentation/nvme-wdc-get-dev-capabilities-log.1 index 3ad7d99..38c5373 100644 --- a/Documentation/nvme-wdc-get-dev-capabilities-log.1 +++ b/Documentation/nvme-wdc-get-dev-capabilities-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-get-dev-capabilities-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-GET\-DEV\" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-GET\-DEV\" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,8 +32,7 @@ nvme-wdc-get-dev-capabilities-log \- Send NVMe WDC get\-dev\-capabilities\-log p .SH "SYNOPSIS" .sp .nf -\fInvme wdc get\-dev\-capabilities\-log\fR <device> [\-\-output\-format=<normal|json> -\-o <normal|json>] +\fInvme wdc get\-dev\-capabilities\-log\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp @@ -46,7 +45,7 @@ This will only work on WDC devices supporting this log page\&. Results for any o On success it returns the parsed device capabilities log page data, error code otherwise\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, or diff --git a/Documentation/nvme-wdc-get-dev-capabilities-log.html b/Documentation/nvme-wdc-get-dev-capabilities-log.html index d2627dd..424d77d 100644 --- a/Documentation/nvme-wdc-get-dev-capabilities-log.html +++ b/Documentation/nvme-wdc-get-dev-capabilities-log.html @@ -740,7 +740,7 @@ nvme-wdc-get-dev-capabilities-log(1) Manual Page <h2>NAME</h2>
<div class="sectionbody">
<p>nvme-wdc-get-dev-capabilities-log -
- Send NVMe WDC get-dev-capabilities-log plugin command, return parsed log output
+ Send NVMe WDC get-dev-capabilities-log plugin command, return parsed log output
</p>
</div>
</div>
@@ -749,8 +749,7 @@ nvme-wdc-get-dev-capabilities-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme wdc get-dev-capabilities-log</em> <device> [--output-format=<normal|json>
--o <normal|json>]</pre>
+<pre class="content"><em>nvme wdc get-dev-capabilities-log</em> <device> [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -774,10 +773,10 @@ code otherwise.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -816,7 +815,7 @@ Has the program issue WDC get-dev-capabilities-log plugin command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-get-dev-capabilities-log.txt b/Documentation/nvme-wdc-get-dev-capabilities-log.txt index 0621881..cf8606a 100644 --- a/Documentation/nvme-wdc-get-dev-capabilities-log.txt +++ b/Documentation/nvme-wdc-get-dev-capabilities-log.txt @@ -4,13 +4,12 @@ nvme-wdc-get-dev-capabilities-log(1) NAME ---- nvme-wdc-get-dev-capabilities-log - Send NVMe WDC get-dev-capabilities-log - plugin command, return parsed log output +plugin command, return parsed log output SYNOPSIS -------- [verse] -'nvme wdc get-dev-capabilities-log' <device> [--output-format=<normal|json> --o <normal|json>] +'nvme wdc get-dev-capabilities-log' <device> [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- @@ -29,8 +28,8 @@ code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', or 'json'. Only one output format can be used at a time. Default is normal. diff --git a/Documentation/nvme-wdc-get-drive-status.1 b/Documentation/nvme-wdc-get-drive-status.1 index 3119b40..c397041 100644 --- a/Documentation/nvme-wdc-get-drive-status.1 +++ b/Documentation/nvme-wdc-get-drive-status.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-get-drive-status .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-GET\-DRIV" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-GET\-DRIV" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-get-drive-status.html b/Documentation/nvme-wdc-get-drive-status.html index c3d5735..b9377c0 100644 --- a/Documentation/nvme-wdc-get-drive-status.html +++ b/Documentation/nvme-wdc-get-drive-status.html @@ -790,19 +790,19 @@ cellspacing="0" cellpadding="4"> </tr>
<tr>
<td align="left" valign="top"><p class="table"><strong>EOL (End of Life) Status</strong></p></td>
-<td align="left" valign="top"><p class="table">The 3 possible states are : Normal, Read Only, or End of Life.</p></td>
+<td align="left" valign="top"><p class="table">The 3 possible states are : Normal, Read Only, or End of Life.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p class="table"><strong>Assert Dump Status</strong></p></td>
-<td align="left" valign="top"><p class="table">The 2 possible states are : Present or Not Present.</p></td>
+<td align="left" valign="top"><p class="table">The 2 possible states are : Present or Not Present.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p class="table"><strong>Thermal Throttling Status</strong></p></td>
-<td align="left" valign="top"><p class="table">The 3 possible states are : Off, On, or Unavailable.</p></td>
+<td align="left" valign="top"><p class="table">The 3 possible states are : Off, On, or Unavailable.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p class="table"><strong>Format Corrupt Reason</strong></p></td>
-<td align="left" valign="top"><p class="table">The 3 possible states are : Not Corrupted, Corrupt due to FW Assert, or Corrupt for Unknown Reason.</p></td>
+<td align="left" valign="top"><p class="table">The 3 possible states are : Not Corrupted, Corrupt due to FW Assert, or Corrupt for Unknown Reason.</p></td>
</tr>
</tbody>
</table>
@@ -836,7 +836,7 @@ Has the program issue WDC get-drive-status command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-get-drive-status.txt b/Documentation/nvme-wdc-get-drive-status.txt index 10e212b..b1b4de4 100644 --- a/Documentation/nvme-wdc-get-drive-status.txt +++ b/Documentation/nvme-wdc-get-drive-status.txt @@ -3,7 +3,8 @@ nvme-wdc-get-drive-status(1) NAME ---- -nvme-wdc-get-drive-status - Send the NVMe WDC get-drive-status command, return result +nvme-wdc-get-drive-status - Send the NVMe WDC get-drive-status command, return +result SYNOPSIS -------- @@ -33,20 +34,19 @@ Output Explanation |The percentage of drive function used. |*EOL (End of Life) Status* -|The 3 possible states are : Normal, Read Only, or End of Life. +|The 3 possible states are : Normal, Read Only, or End of Life. |*Assert Dump Status* -|The 2 possible states are : Present or Not Present. +|The 2 possible states are : Present or Not Present. |*Thermal Throttling Status* -|The 3 possible states are : Off, On, or Unavailable. +|The 3 possible states are : Off, On, or Unavailable. |*Format Corrupt Reason* -|The 3 possible states are : Not Corrupted, Corrupt due to FW Assert, or Corrupt for Unknown Reason. +|The 3 possible states are : Not Corrupted, Corrupt due to FW Assert, or Corrupt for Unknown Reason. |=== - EXAMPLES -------- * Has the program issue WDC get-drive-status command : diff --git a/Documentation/nvme-wdc-get-error-recovery-log.1 b/Documentation/nvme-wdc-get-error-recovery-log.1 index 1d00fae..ced322f 100644 --- a/Documentation/nvme-wdc-get-error-recovery-log.1 +++ b/Documentation/nvme-wdc-get-error-recovery-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-get-error-recovery-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-GET\-ERRO" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-GET\-ERRO" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -46,7 +46,7 @@ This will only work on WDC devices supporting this log page\&. Results for any o On success it returns the parsed error recovery log page data, error code otherwise\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, or diff --git a/Documentation/nvme-wdc-get-error-recovery-log.html b/Documentation/nvme-wdc-get-error-recovery-log.html index 9d2352c..c7c20d8 100644 --- a/Documentation/nvme-wdc-get-error-recovery-log.html +++ b/Documentation/nvme-wdc-get-error-recovery-log.html @@ -740,7 +740,7 @@ nvme-wdc-get-error-recovery-log(1) Manual Page <h2>NAME</h2>
<div class="sectionbody">
<p>nvme-wdc-get-error-recovery-log -
- Send NVMe WDC get-error-recovery-log plugin command, return parsed log output
+ Send NVMe WDC get-error-recovery-log plugin command, return parsed log output
</p>
</div>
</div>
@@ -774,10 +774,10 @@ code otherwise.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -816,7 +816,7 @@ Has the program issue WDC get-error-recovery-log plugin command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-get-error-recovery-log.txt b/Documentation/nvme-wdc-get-error-recovery-log.txt index 2ad3605..4998390 100644 --- a/Documentation/nvme-wdc-get-error-recovery-log.txt +++ b/Documentation/nvme-wdc-get-error-recovery-log.txt @@ -4,7 +4,7 @@ nvme-wdc-get-error-recovery-log(1) NAME ---- nvme-wdc-get-error-recovery-log - Send NVMe WDC get-error-recovery-log plugin - command, return parsed log output +command, return parsed log output SYNOPSIS -------- @@ -29,8 +29,8 @@ code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', or 'json'. Only one output format can be used at a time. Default is normal. diff --git a/Documentation/nvme-wdc-get-latency-monitor-log.1 b/Documentation/nvme-wdc-get-latency-monitor-log.1 index c6425b6..72cd24b 100644 --- a/Documentation/nvme-wdc-get-latency-monitor-log.1 +++ b/Documentation/nvme-wdc-get-latency-monitor-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-get-latency-monitor-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-GET\-LATE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-GET\-LATE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -45,7 +45,7 @@ This will only work on WDC devices supporting this log page\&. Results for any o On success it returns 0, error code otherwise\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR diff --git a/Documentation/nvme-wdc-get-latency-monitor-log.html b/Documentation/nvme-wdc-get-latency-monitor-log.html index 438217a..12fab08 100644 --- a/Documentation/nvme-wdc-get-latency-monitor-log.html +++ b/Documentation/nvme-wdc-get-latency-monitor-log.html @@ -769,10 +769,10 @@ Results for any other device are undefined.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -810,7 +810,7 @@ Displays the get latency monitor log for the device: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-get-latency-monitor-log.txt b/Documentation/nvme-wdc-get-latency-monitor-log.txt index 19fda4a..abab8e8 100644 --- a/Documentation/nvme-wdc-get-latency-monitor-log.txt +++ b/Documentation/nvme-wdc-get-latency-monitor-log.txt @@ -24,8 +24,8 @@ On success it returns 0, error code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal' or 'json'. Only one output format can be used at a time. The default is normal. diff --git a/Documentation/nvme-wdc-get-pfail-dump.1 b/Documentation/nvme-wdc-get-pfail-dump.1 index 054a0c5..177a4a7 100644 --- a/Documentation/nvme-wdc-get-pfail-dump.1 +++ b/Documentation/nvme-wdc-get-pfail-dump.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-get-pfail-dump .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-GET\-PFAI" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-GET\-PFAI" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-get-pfail-dump.html b/Documentation/nvme-wdc-get-pfail-dump.html index 20f55a9..b000c32 100644 --- a/Documentation/nvme-wdc-get-pfail-dump.html +++ b/Documentation/nvme-wdc-get-pfail-dump.html @@ -832,7 +832,7 @@ Gets the pfail crash dump from the device and saves to defined file with pathnam <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-get-unsupported-reqs-log.1 b/Documentation/nvme-wdc-get-unsupported-reqs-log.1 index c9dfaef..0e71282 100644 --- a/Documentation/nvme-wdc-get-unsupported-reqs-log.1 +++ b/Documentation/nvme-wdc-get-unsupported-reqs-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-get-unsupported-reqs-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-GET\-UNSU" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-GET\-UNSU" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -46,7 +46,7 @@ This will only work on WDC devices supporting this log page\&. Results for any o On success it returns the parsed unsupported requirements log page data, error code otherwise\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, or diff --git a/Documentation/nvme-wdc-get-unsupported-reqs-log.html b/Documentation/nvme-wdc-get-unsupported-reqs-log.html index 8645c49..7610f60 100644 --- a/Documentation/nvme-wdc-get-unsupported-reqs-log.html +++ b/Documentation/nvme-wdc-get-unsupported-reqs-log.html @@ -774,10 +774,10 @@ code otherwise.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -816,7 +816,7 @@ Has the program issue WDC get-unsupported-reqs-log plugin command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-get-unsupported-reqs-log.txt b/Documentation/nvme-wdc-get-unsupported-reqs-log.txt index f028665..61f09aa 100644 --- a/Documentation/nvme-wdc-get-unsupported-reqs-log.txt +++ b/Documentation/nvme-wdc-get-unsupported-reqs-log.txt @@ -29,8 +29,8 @@ code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', or 'json'. Only one output format can be used at a time. Default is normal. diff --git a/Documentation/nvme-wdc-id-ctrl.1 b/Documentation/nvme-wdc-id-ctrl.1 index 17ecc42..94a9f3c 100644 --- a/Documentation/nvme-wdc-id-ctrl.1 +++ b/Documentation/nvme-wdc-id-ctrl.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-id-ctrl .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-ID\-CTRL" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-ID\-CTRL" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,9 @@ nvme-wdc-id-ctrl \- Send NVMe Identify Controller, return result and structure .SH "SYNOPSIS" .sp .nf -\fInvme wdc id\-ctrl\fR <device> [\-v | \-\-vendor\-specific] [\-b | \-\-raw\-binary] - [\-H | \-\-human\-readable] - [\-o <fmt> | \-\-output\-format=<fmt>] +\fInvme wdc id\-ctrl\fR <device> [\-\-vendor\-specific | \-v] [\-\-raw\-binary | \-b] + [\-\-human\-readable | \-H] + [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp @@ -64,7 +64,7 @@ In addition to parsing known fields, this option will dump the vendor specific r This option will parse and format many of the bit fields into human\-readable formats\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-wdc-id-ctrl.html b/Documentation/nvme-wdc-id-ctrl.html index 1ce9fa3..ae00b92 100644 --- a/Documentation/nvme-wdc-id-ctrl.html +++ b/Documentation/nvme-wdc-id-ctrl.html @@ -749,9 +749,9 @@ nvme-wdc-id-ctrl(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme wdc id-ctrl</em> <device> [-v | --vendor-specific] [-b | --raw-binary]
- [-H | --human-readable]
- [-o <fmt> | --output-format=<fmt>]</pre>
+<pre class="content"><em>nvme wdc id-ctrl</em> <device> [--vendor-specific | -v] [--raw-binary | -b]
+ [--human-readable | -H]
+ [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -814,15 +814,15 @@ will decode WDC vendor unique portions of the structure.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em>, or
+ <em>binary</em>. Only one output format can be used at a time.
</p>
</dd>
</dl></div>
@@ -856,7 +856,7 @@ fields in a human readable format: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-id-ctrl.txt b/Documentation/nvme-wdc-id-ctrl.txt index a9c6afe..b62eb60 100644 --- a/Documentation/nvme-wdc-id-ctrl.txt +++ b/Documentation/nvme-wdc-id-ctrl.txt @@ -8,9 +8,9 @@ nvme-wdc-id-ctrl - Send NVMe Identify Controller, return result and structure SYNOPSIS -------- [verse] -'nvme wdc id-ctrl' <device> [-v | --vendor-specific] [-b | --raw-binary] - [-H | --human-readable] - [-o <fmt> | --output-format=<fmt>] +'nvme wdc id-ctrl' <device> [--vendor-specific | -v] [--raw-binary | -b] + [--human-readable | -H] + [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- @@ -48,10 +48,10 @@ OPTIONS This option will parse and format many of the bit fields into human-readable formats. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json', or + 'binary'. Only one output format can be used at a time. EXAMPLES -------- diff --git a/Documentation/nvme-wdc-log-page-directory.1 b/Documentation/nvme-wdc-log-page-directory.1 index a81fd04..6b468fe 100644 --- a/Documentation/nvme-wdc-log-page-directory.1 +++ b/Documentation/nvme-wdc-log-page-directory.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-log-page-directory .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-LOG\-PAGE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-LOG\-PAGE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -45,7 +45,7 @@ This will only work on WDC devices supporting this feature\&. Results for any ot On success it returns the log page directory information, error code otherwise\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-wdc-log-page-directory.html b/Documentation/nvme-wdc-log-page-directory.html index 03769b7..011087d 100644 --- a/Documentation/nvme-wdc-log-page-directory.html +++ b/Documentation/nvme-wdc-log-page-directory.html @@ -758,7 +758,7 @@ nvme-wdc-log-page-directory(1) Manual Page <h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="paragraph"><p>For the NVMe device given, retrieves the log page directory which contains the list of
-log page IDs supported by the drive. The --output-format option will format the output as
+log page IDs supported by the drive. The --output-format option will format the output as
specified.</p></div>
<div class="paragraph"><p>The <device> parameter is mandatory and must be the NVMe character device (ex: /dev/nvme0).</p></div>
<div class="paragraph"><p>This will only work on WDC devices supporting this feature.
@@ -771,10 +771,10 @@ Results for any other device are undefined.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -812,7 +812,7 @@ WDC log-page-directory example command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-log-page-directory.txt b/Documentation/nvme-wdc-log-page-directory.txt index 4d6192f..27b5d9e 100644 --- a/Documentation/nvme-wdc-log-page-directory.txt +++ b/Documentation/nvme-wdc-log-page-directory.txt @@ -13,7 +13,7 @@ SYNOPSIS DESCRIPTION ----------- For the NVMe device given, retrieves the log page directory which contains the list of -log page IDs supported by the drive. The --output-format option will format the output as +log page IDs supported by the drive. The --output-format option will format the output as specified. The <device> parameter is mandatory and must be the NVMe character device (ex: /dev/nvme0). @@ -25,8 +25,8 @@ On success it returns the log page directory information, error code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', 'json', or 'binary'. Only one output format can be used at a time. The default is normal. diff --git a/Documentation/nvme-wdc-namespace-resize.1 b/Documentation/nvme-wdc-namespace-resize.1 index 02468ee..501112d 100644 --- a/Documentation/nvme-wdc-namespace-resize.1 +++ b/Documentation/nvme-wdc-namespace-resize.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-namespace-resize .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-NAMESPACE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-NAMESPACE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,40 +32,26 @@ nvme-wdc-namespace-resize \- Resizes the device\*(Aqs namespace\&. .SH "SYNOPSIS" .sp .nf -\fInvme wdc namespace\-resize\fR <device> [\-\-nsid=<NAMSPACE ID>, \-n <NAMSPACE ID>] [\-\-op_option=<OP OPTION>, \-o <OP OPTION>] +\fInvme wdc namespace\-resize\fR <device> [\-\-nsid=<NAMESPACE ID>, \-n <NAMSPACE ID>] + [\-\-op_option=<OP OPTION>, \-o <OP OPTION>] .fi .SH "DESCRIPTION" .sp -For the NVMe device given, sends the WDC Vendor Specific Command that modifies the namespace size reported by the device\&. +For the NVMe device given, sends the WDC Vendor Specific Command that modifies the namespace size reported the device\&. .sp The <device> parameter is mandatory NVMe character device (ex: /dev/nvme0)\&. .sp This will only work on WDC devices supporting this feature\&. Results for any other device are undefined\&. .SH "OPTIONS" .PP -\-n <NAMSPACE ID>, \-\-namespace\-id=<NAMSPACE_ID> +\-n <NAMESPACE ID>, \-\-namespace\-id=<NAMESPACE_ID> .RS 4 Namespace ID; ID of the namespace to resize .RE .PP \-o <OP OPTION>, \-\-op\-option=<OP OPTION> .RS 4 -Overprovisioning Option; defaults to 0xF -.sp -.if n \{\ -.RS 4 -.\} -.nf -Valid Values: -0x1 \- 7% of Original TNVMCAP reported value -0x2 \- 28% of Original TNVMCAP reported value -0x3 \- 50% of Original TNVMCAP reported value -0xF \- 0% of Original TNVMCAP reported value (original config) -All other values \- reserved -.fi -.if n \{\ -.RE -.\} +Overprovisioning Option; defaults to 0xF Valid Values: 0x1 \- 7% of Original TNVMCAP reported value 0x2 \- 28% of Original TNVMCAP reported value 0x3 \- 50% of Original TNVMCAP reported value 0xF \- 0% of Original TNVMCAP reported value (original config) All other values \- reserved .RE .SH "EXAMPLES" .sp diff --git a/Documentation/nvme-wdc-namespace-resize.html b/Documentation/nvme-wdc-namespace-resize.html index 419acc4..d8088b8 100644 --- a/Documentation/nvme-wdc-namespace-resize.html +++ b/Documentation/nvme-wdc-namespace-resize.html @@ -749,7 +749,8 @@ nvme-wdc-namespace-resize(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme wdc namespace-resize</em> <device> [--nsid=<NAMSPACE ID>, -n <NAMSPACE ID>] [--op_option=<OP OPTION>, -o <OP OPTION>]</pre>
+<pre class="content"><em>nvme wdc namespace-resize</em> <device> [--nsid=<NAMESPACE ID>, -n <NAMSPACE ID>]
+ [--op_option=<OP OPTION>, -o <OP OPTION>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -757,8 +758,8 @@ nvme-wdc-namespace-resize(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>For the NVMe device given, sends the WDC Vendor Specific Command that modifies the namespace size reported
-by the device.</p></div>
+<div class="paragraph"><p>For the NVMe device given, sends the WDC Vendor Specific Command that modifies
+the namespace size reported the device.</p></div>
<div class="paragraph"><p>The <device> parameter is mandatory NVMe character device (ex: /dev/nvme0).</p></div>
<div class="paragraph"><p>This will only work on WDC devices supporting this feature.
Results for any other device are undefined.</p></div>
@@ -769,10 +770,10 @@ Results for any other device are undefined.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--n <NAMSPACE ID>
+-n <NAMESPACE ID>
</dt>
<dt class="hdlist1">
---namespace-id=<NAMSPACE_ID>
+--namespace-id=<NAMESPACE_ID>
</dt>
<dd>
<p>
@@ -787,17 +788,14 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Overprovisioning Option; defaults to 0xF
+ Overprovisioning Option; defaults to 0xF
+ Valid Values:
+ 0x1 - 7% of Original TNVMCAP reported value
+ 0x2 - 28% of Original TNVMCAP reported value
+ 0x3 - 50% of Original TNVMCAP reported value
+ 0xF - 0% of Original TNVMCAP reported value (original config)
+ All other values - reserved
</p>
-<div class="literalblock">
-<div class="content">
-<pre><code>Valid Values:
-0x1 - 7% of Original TNVMCAP reported value
-0x2 - 28% of Original TNVMCAP reported value
-0x3 - 50% of Original TNVMCAP reported value
-0xF - 0% of Original TNVMCAP reported value (original config)
-All other values - reserved</code></pre>
-</div></div>
</dd>
</dl></div>
</div>
@@ -838,7 +836,7 @@ Resizes namespace 2 to 7% of the original TNVMCAP reported value: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-namespace-resize.txt b/Documentation/nvme-wdc-namespace-resize.txt index 71fc781..42994ad 100644 --- a/Documentation/nvme-wdc-namespace-resize.txt +++ b/Documentation/nvme-wdc-namespace-resize.txt @@ -8,13 +8,14 @@ nvme-wdc-namespace-resize - Resizes the device's namespace. SYNOPSIS -------- [verse] -'nvme wdc namespace-resize' <device> [--nsid=<NAMSPACE ID>, -n <NAMSPACE ID>] [--op_option=<OP OPTION>, -o <OP OPTION>] +'nvme wdc namespace-resize' <device> [--nsid=<NAMESPACE ID>, -n <NAMSPACE ID>] + [--op_option=<OP OPTION>, -o <OP OPTION>] DESCRIPTION ----------- -For the NVMe device given, sends the WDC Vendor Specific Command that modifies the namespace size reported -by the device. +For the NVMe device given, sends the WDC Vendor Specific Command that modifies +the namespace size reported the device. The <device> parameter is mandatory NVMe character device (ex: /dev/nvme0). @@ -23,20 +24,19 @@ Results for any other device are undefined. OPTIONS ------- --n <NAMSPACE ID>:: ---namespace-id=<NAMSPACE_ID>:: +-n <NAMESPACE ID>:: +--namespace-id=<NAMESPACE_ID>:: Namespace ID; ID of the namespace to resize -o <OP OPTION>:: --op-option=<OP OPTION>:: - Overprovisioning Option; defaults to 0xF - - Valid Values: - 0x1 - 7% of Original TNVMCAP reported value - 0x2 - 28% of Original TNVMCAP reported value - 0x3 - 50% of Original TNVMCAP reported value - 0xF - 0% of Original TNVMCAP reported value (original config) - All other values - reserved + Overprovisioning Option; defaults to 0xF + Valid Values: + 0x1 - 7% of Original TNVMCAP reported value + 0x2 - 28% of Original TNVMCAP reported value + 0x3 - 50% of Original TNVMCAP reported value + 0xF - 0% of Original TNVMCAP reported value (original config) + All other values - reserved EXAMPLES -------- diff --git a/Documentation/nvme-wdc-purge-monitor.1 b/Documentation/nvme-wdc-purge-monitor.1 index dc8612b..2a4bafe 100644 --- a/Documentation/nvme-wdc-purge-monitor.1 +++ b/Documentation/nvme-wdc-purge-monitor.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-purge-monitor .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-PURGE\-MO" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-PURGE\-MO" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-purge-monitor.html b/Documentation/nvme-wdc-purge-monitor.html index a96def6..94e0f1d 100644 --- a/Documentation/nvme-wdc-purge-monitor.html +++ b/Documentation/nvme-wdc-purge-monitor.html @@ -837,7 +837,7 @@ Has the program issue WDC Purge-Monitor Vendor Unique Command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-purge-monitor.txt b/Documentation/nvme-wdc-purge-monitor.txt index 313c8db..5d44183 100644 --- a/Documentation/nvme-wdc-purge-monitor.txt +++ b/Documentation/nvme-wdc-purge-monitor.txt @@ -37,7 +37,6 @@ Expected status and description :- |Purge State Error : Purge operation interrupted by power cycle or reset. |=== - The <device> parameter is mandatory and may be either the NVMe character device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1). diff --git a/Documentation/nvme-wdc-purge.1 b/Documentation/nvme-wdc-purge.1 index 5a79047..5806ea8 100644 --- a/Documentation/nvme-wdc-purge.1 +++ b/Documentation/nvme-wdc-purge.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-purge .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-PURGE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-PURGE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-purge.html b/Documentation/nvme-wdc-purge.html index 710914d..1d9bb9f 100644 --- a/Documentation/nvme-wdc-purge.html +++ b/Documentation/nvme-wdc-purge.html @@ -799,7 +799,7 @@ Has the program issue WDC Purge Vendor Unique Command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-set-latency-monitor-feature.txt b/Documentation/nvme-wdc-set-latency-monitor-feature.txt new file mode 100644 index 0000000..60b3e26 --- /dev/null +++ b/Documentation/nvme-wdc-set-latency-monitor-feature.txt @@ -0,0 +1,118 @@ +nvme-wdc-set-latency-monitor-feature(1) +======================================= + +NAME +---- +nvme-wdc-set-latency-monitor-feature - Set NVMe WDC latency monitor feature options + +SYNOPSIS +-------- +[verse] +'nvme wdc set-latency-monitor-feature' <device> + [--active_bucket_timer_threshold=<NUM> | -t <NUM>] + [--active_threshold_a=<NUM> | -a <NUM>] + [--active_threshold_b=<NUM> | -b <NUM>] + [--active_threshold_c=<NUM> | -c <NUM>] + [--active_threshold_d=<NUM> | -d <NUM>] + [--active_latency_config=<NUM> | -f <NUM>] + [--active_latency_minimum_window=<NUM> | -w <NUM>] + [--debug_log_trigger_enable=<NUM> | -r <NUM>] + [--discard_debug_log=<NUM> | -l <NUM>] + [--latency_monitor_feature_enable=<NUM> | -e <NUM>] + +DESCRIPTION +----------- +For the NVMe device given, this command set the +latency monitor feature options (if supported by the device). + +The <device> parameter is mandatory NVMe character device (ex: /dev/nvme0). + +Setting results can be checked with 'get-latency-monitor-log' command. + +On success it returns 0, error code otherwise. + +OPTIONS +------- +-t <NUM>:: +--active_bucket_timer_threshold=<NUM>:: + The value that loads the Active Bucket Timer Threshold; default value is 07E0h. + +-a <NUM>:: +--active_threshold_a=<NUM>:: + The value that loads into the Active Threshold A; default value is 05h. + +-b <NUM>:: +--active_threshold_b=<NUM>:: + The value that loads into the Active Threshold B; default value is 13h. + +-c <NUM>:: +--active_threshold_c=<NUM>:: + The value that loads into the Active Threshold C; default value is 1Eh. + +-d <NUM>:: +--active_threshold_d=<NUM>:: + The value that loads into the Active Threshold D; default value is 2Eh. + +-f <NUM>:: +--active_latency_config=<NUM>:: + The value that loads into the Active Latency Configuration. This + configures how both the Active Latency Stamp, and the Active Measured + Latency Fields are updated on a per I/O command (Read, Write, Deallocate) + counter basis; default value is 0FFFh. + +-w <NUM>:: +--active_latency_minimum_window=<NUM>:: + The value that loads into the Active Latency Minimum Window; default value is 0Ah. + +-r <NUM>:: +--debug_log_trigger_enable=<NUM>:: + The value that loads into the Debug Log Trigger Enable; When set to 1b + the first time the bucket/counter combination is incremented a debug log + is triggered. When cleared to 0b a debug log will not be triggered when + the bucket/counter combination is incremented. + +-l <NUM>:: +--discard_debug_log=<NUM>:: + Discard Debug Log. When cleared to 00h the debug log, if it exists, will + not be cleared. When set to 01h the debug log will be discarded so + another log can be triggered. All the fields in the Set Features Data + structure are valid. When set to 02h the debug log will be discarded so + another log can be triggered. None of the other fields of the Set + Features Data structure are valid. + +-e <NUM>:: +--latency_monitor_feature_enable=<NUM>:: + Latency Monitor Feature Enable; When set to 01h the Latency Monitor + Feature is enabled. When cleared to 00h the Latency Monitor Feature is + disabled. + +EXAMPLES +-------- +* Set NVMe WDC latency monitor feature options enabled with default value values: ++ +------------ +# nvme wdc set-latency-monitor-feature /dev/nvme0 -e 1 +------------ +* Set NVMe WDC latency monitor feature options disabled with default value values: ++ +------------ +# nvme wdc set-latency-monitor-feature /dev/nvme0 -e 0 +------------ +* Set NVMe WDC latency monitor feature options enabled with specific values: ++ +------------ +# nvme wdc set-latency-monitor-feature /dev/nvme0 --active_bucket_timer_threshold=1 \ + --active_threshold_a=0x0 \ + --active_threshold_b=0x1 \ + --active_threshold_c=0x2 \ + --active_threshold_d=0x3 \ + --active_latency_config=0xfff \ + --active_latency_minimum_window=0 \ + --debug_log_trigger_enable=0 \ + --discard_debug_log=0 \ + --latency_monitor_feature_enable=0x1 +------------ + +NVME +---- +Part of the nvme-user suite. diff --git a/Documentation/nvme-wdc-vs-cloud-log.1 b/Documentation/nvme-wdc-vs-cloud-log.1 index df71f00..c12f92e 100644 --- a/Documentation/nvme-wdc-vs-cloud-log.1 +++ b/Documentation/nvme-wdc-vs-cloud-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-vs-cloud-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-VS\-CLOUD" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-VS\-CLOUD" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -46,7 +46,7 @@ This will only work on WDC devices supporting this feature\&. Results for any ot On success it returns 0, error code otherwise\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, or diff --git a/Documentation/nvme-wdc-vs-cloud-log.html b/Documentation/nvme-wdc-vs-cloud-log.html index 337ea65..55b5ac4 100644 --- a/Documentation/nvme-wdc-vs-cloud-log.html +++ b/Documentation/nvme-wdc-vs-cloud-log.html @@ -772,10 +772,10 @@ Results for any other device are undefined.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -828,7 +828,7 @@ Has the program issue WDC vs-cloud-log Vendor Unique Command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-vs-cloud-log.txt b/Documentation/nvme-wdc-vs-cloud-log.txt index 9eeee42..9739295 100644 --- a/Documentation/nvme-wdc-vs-cloud-log.txt +++ b/Documentation/nvme-wdc-vs-cloud-log.txt @@ -26,8 +26,8 @@ On success it returns 0, error code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', or 'json'. Only one output format can be used at a time. Default is normal. diff --git a/Documentation/nvme-wdc-vs-device-waf.1 b/Documentation/nvme-wdc-vs-device-waf.1 index 4e898a2..6e9e184 100644 --- a/Documentation/nvme-wdc-vs-device-waf.1 +++ b/Documentation/nvme-wdc-vs-device-waf.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-vs-device-waf .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-VS\-DEVIC" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-VS\-DEVIC" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -46,7 +46,7 @@ This will only work on WDC devices supporting this feature\&. Results for any ot On success it returns 0, error code otherwise\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, or diff --git a/Documentation/nvme-wdc-vs-device-waf.html b/Documentation/nvme-wdc-vs-device-waf.html index d62dd6c..00689b9 100644 --- a/Documentation/nvme-wdc-vs-device-waf.html +++ b/Documentation/nvme-wdc-vs-device-waf.html @@ -772,10 +772,10 @@ Results for any other device are undefined.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -828,7 +828,7 @@ Has the program issue WDC vs-device-waf plugin Command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-vs-device-waf.txt b/Documentation/nvme-wdc-vs-device-waf.txt index 55095a4..f25618d 100644 --- a/Documentation/nvme-wdc-vs-device-waf.txt +++ b/Documentation/nvme-wdc-vs-device-waf.txt @@ -27,8 +27,8 @@ On success it returns 0, error code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', or 'json'. Only one output format can be used at a time. Default is normal. diff --git a/Documentation/nvme-wdc-vs-drive-info.1 b/Documentation/nvme-wdc-vs-drive-info.1 index 08ae9c7..3c53fd6 100644 --- a/Documentation/nvme-wdc-vs-drive-info.1 +++ b/Documentation/nvme-wdc-vs-drive-info.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-vs-drive-info .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-VS\-DRIVE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-VS\-DRIVE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-vs-drive-info.html b/Documentation/nvme-wdc-vs-drive-info.html index fe6b5d8..e8f8412 100644 --- a/Documentation/nvme-wdc-vs-drive-info.html +++ b/Documentation/nvme-wdc-vs-drive-info.html @@ -795,7 +795,7 @@ on the drive:</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-vs-drive-info.txt b/Documentation/nvme-wdc-vs-drive-info.txt index 0cfdd7a..bc18b17 100644 --- a/Documentation/nvme-wdc-vs-drive-info.txt +++ b/Documentation/nvme-wdc-vs-drive-info.txt @@ -38,12 +38,10 @@ HyperScale Boot Version TCG Device Ownership - EXAMPLE -------- # nvme wdc vs-drive-info /dev/nvme0 - NVME ---- Part of the nvme-user suite. diff --git a/Documentation/nvme-wdc-vs-error-reason-identifier.1 b/Documentation/nvme-wdc-vs-error-reason-identifier.1 index 33ed0ae..785fe76 100644 --- a/Documentation/nvme-wdc-vs-error-reason-identifier.1 +++ b/Documentation/nvme-wdc-vs-error-reason-identifier.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-vs-error-reason-identifier .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-VS\-ERROR" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-VS\-ERROR" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-vs-error-reason-identifier.html b/Documentation/nvme-wdc-vs-error-reason-identifier.html index d107c8a..8f13214 100644 --- a/Documentation/nvme-wdc-vs-error-reason-identifier.html +++ b/Documentation/nvme-wdc-vs-error-reason-identifier.html @@ -758,7 +758,7 @@ nvme-wdc-vs-error-reason-identifier(1) Manual Page <h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="paragraph"><p>For the NVMe device given, retrieve the telemetry log error reason id field for either the host generated or
-controller initiated log. The controller initiated telemetry log page option must be enabled to retrieve the
+controller initiated log. The controller initiated telemetry log page option must be enabled to retrieve the
error reason id for that log page id.</p></div>
<div class="paragraph"><p>The <device> parameter is mandatory and must be the NVMe character device (ex: /dev/nvme0).</p></div>
<div class="paragraph"><p>This will only work on WDC devices supporting this feature.
@@ -836,7 +836,7 @@ Retrieves the controller initiated error reason identifier field and save it in <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-vs-error-reason-identifier.txt b/Documentation/nvme-wdc-vs-error-reason-identifier.txt index 054d675..0c7f397 100644 --- a/Documentation/nvme-wdc-vs-error-reason-identifier.txt +++ b/Documentation/nvme-wdc-vs-error-reason-identifier.txt @@ -13,8 +13,8 @@ SYNOPSIS DESCRIPTION ----------- For the NVMe device given, retrieve the telemetry log error reason id field for either the host generated or -controller initiated log. The controller initiated telemetry log page option must be enabled to retrieve the -error reason id for that log page id. +controller initiated log. The controller initiated telemetry log page option must be enabled to retrieve the +error reason id for that log page id. The <device> parameter is mandatory and must be the NVMe character device (ex: /dev/nvme0). @@ -27,7 +27,7 @@ OPTIONS ------- -i <id>:: --log-id=<id>:: - Specifies the telemetry log id of the error reason identifier to retrieve. + Specifies the telemetry log id of the error reason identifier to retrieve. Use id 7 for the host generated log page. Use id 8 for the controller initiated log page. The default is 7/host generated diff --git a/Documentation/nvme-wdc-vs-fw-activate-history.1 b/Documentation/nvme-wdc-vs-fw-activate-history.1 index 305f5ba..28a1952 100644 --- a/Documentation/nvme-wdc-vs-fw-activate-history.1 +++ b/Documentation/nvme-wdc-vs-fw-activate-history.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-vs-fw-activate-history .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-VS\-FW\-A" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-VS\-FW\-A" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -45,7 +45,7 @@ This will only work on WDC devices supporting this feature\&. Results for any ot On success it returns 0, error code otherwise\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, or diff --git a/Documentation/nvme-wdc-vs-fw-activate-history.html b/Documentation/nvme-wdc-vs-fw-activate-history.html index 53d3478..f1842a8 100644 --- a/Documentation/nvme-wdc-vs-fw-activate-history.html +++ b/Documentation/nvme-wdc-vs-fw-activate-history.html @@ -770,10 +770,10 @@ Results for any other device are undefined.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -805,7 +805,7 @@ cellspacing="0" cellpadding="4"> <tbody>
<tr>
<td align="left" valign="top"><p class="table"><strong>Entry Number</strong></p></td>
-<td align="left" valign="top"><p class="table">The number of fw activate entry. The most recent 20 entries will be displayed.</p></td>
+<td align="left" valign="top"><p class="table">The number of fw activate entry. The most recent 20 entries will be displayed.</p></td>
</tr>
<tr>
<td align="left" valign="top"><p class="table"><strong>Power on Hour</strong></p></td>
@@ -833,7 +833,7 @@ cellspacing="0" cellpadding="4"> </tr>
<tr>
<td align="left" valign="top"><p class="table"><strong>Result</strong></p></td>
-<td align="left" valign="top"><p class="table">The result of the firmware activation event. The output shall be in the format:
+<td align="left" valign="top"><p class="table">The result of the firmware activation event. The output shall be in the format:
Pass or Failed + error code</p></td>
</tr>
</tbody>
@@ -868,7 +868,7 @@ Has the program issue WDC vs-fw-activate-history Vendor Unique Command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-vs-fw-activate-history.txt b/Documentation/nvme-wdc-vs-fw-activate-history.txt index 30c6ede..923ff0a 100644 --- a/Documentation/nvme-wdc-vs-fw-activate-history.txt +++ b/Documentation/nvme-wdc-vs-fw-activate-history.txt @@ -24,13 +24,12 @@ On success it returns 0, error code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', or 'json'. Only one output format can be used at a time. Default is normal. - Firmware Activate History Log Page Data Output Explanation ----------------------------------------------------------- [cols="2*", frame="topbot", align="center", options="header"] @@ -38,7 +37,7 @@ Firmware Activate History Log Page Data Output Explanation |Field |Description |*Entry Number* -|The number of fw activate entry. The most recent 20 entries will be displayed. +|The number of fw activate entry. The most recent 20 entries will be displayed. |*Power on Hour* |The time since the power on in hours:minutes:seconds. @@ -59,7 +58,7 @@ Firmware Activate History Log Page Data Output Explanation |The commit action type associated with the firmware activation event |*Result* -|The result of the firmware activation event. The output shall be in the format: +|The result of the firmware activation event. The output shall be in the format: Pass or Failed + error code |=== diff --git a/Documentation/nvme-wdc-vs-hw-rev-log.1 b/Documentation/nvme-wdc-vs-hw-rev-log.1 index 1ea7cbd..0b9bab0 100644 --- a/Documentation/nvme-wdc-vs-hw-rev-log.1 +++ b/Documentation/nvme-wdc-vs-hw-rev-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-vs-hw-rev-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-VS\-HW\-R" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-VS\-HW\-R" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -46,7 +46,7 @@ This will only work on WDC devices supporting this feature\&. Results for any ot On success it returns 0, error code otherwise\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, or diff --git a/Documentation/nvme-wdc-vs-hw-rev-log.html b/Documentation/nvme-wdc-vs-hw-rev-log.html index 06dcc28..3fd4b56 100644 --- a/Documentation/nvme-wdc-vs-hw-rev-log.html +++ b/Documentation/nvme-wdc-vs-hw-rev-log.html @@ -771,10 +771,10 @@ Results for any other device are undefined.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -827,7 +827,7 @@ Has the program issue WDC vs-hw-rev-log plugin Command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-vs-hw-rev-log.txt b/Documentation/nvme-wdc-vs-hw-rev-log.txt index c5335d9..b4eb4dd 100644 --- a/Documentation/nvme-wdc-vs-hw-rev-log.txt +++ b/Documentation/nvme-wdc-vs-hw-rev-log.txt @@ -25,8 +25,8 @@ On success it returns 0, error code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', or 'json'. Only one output format can be used at a time. Default is normal. diff --git a/Documentation/nvme-wdc-vs-internal-log.1 b/Documentation/nvme-wdc-vs-internal-log.1 index 138064d..45e8466 100644 --- a/Documentation/nvme-wdc-vs-internal-log.1 +++ b/Documentation/nvme-wdc-vs-internal-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-vs-internal-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-VS\-INTER" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-VS\-INTER" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,12 @@ nvme-wdc-vs-internal-log \- Retrieve WDC device\*(Aqs internal firmware log and .SH "SYNOPSIS" .sp .nf -\fInvme wdc vs\-internal\-log\fR <device> [\-\-output\-file=<FILE>, \-o <FILE>] [\-\-transfer\-size=<SIZE>, \-s <SIZE>] - [\-\-data\-area=<DATA AREA>, \-d <DATA_AREA>] [\-\-file\-size=<FILE SIZE>, \-f <FILE SIZE>] [\-\-offset=<OFFSET>, \-e <OFFSET>] - [\-\-type=<TYPE>, \-t <type>] [\-\-verbose, \-v] +\fInvme wdc vs\-internal\-log\fR <device> [\-\-output\-file=<FILE>, \-o <FILE>] + [\-\-transfer\-size=<SIZE>, \-s <SIZE>] + [\-\-data\-area=<DATA AREA>, \-d <DATA_AREA>] + [\-\-file\-size=<FILE SIZE>, \-f <FILE SIZE>] + [\-\-offset=<OFFSET>, \-e <OFFSET>] + [\-\-type=<TYPE>, \-t <type>] [\-\-verbose, \-v] .fi .SH "DESCRIPTION" .sp diff --git a/Documentation/nvme-wdc-vs-internal-log.html b/Documentation/nvme-wdc-vs-internal-log.html index 2c9a34a..b8bc8fd 100644 --- a/Documentation/nvme-wdc-vs-internal-log.html +++ b/Documentation/nvme-wdc-vs-internal-log.html @@ -749,9 +749,12 @@ nvme-wdc-vs-internal-log(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme wdc vs-internal-log</em> <device> [--output-file=<FILE>, -o <FILE>] [--transfer-size=<SIZE>, -s <SIZE>]
- [--data-area=<DATA AREA>, -d <DATA_AREA>] [--file-size=<FILE SIZE>, -f <FILE SIZE>] [--offset=<OFFSET>, -e <OFFSET>]
- [--type=<TYPE>, -t <type>] [--verbose, -v]</pre>
+<pre class="content"><em>nvme wdc vs-internal-log</em> <device> [--output-file=<FILE>, -o <FILE>]
+ [--transfer-size=<SIZE>, -s <SIZE>]
+ [--data-area=<DATA AREA>, -d <DATA_AREA>]
+ [--file-size=<FILE SIZE>, -f <FILE SIZE>]
+ [--offset=<OFFSET>, -e <OFFSET>]
+ [--type=<TYPE>, -t <type>] [--verbose, -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -759,8 +762,8 @@ nvme-wdc-vs-internal-log(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>For the NVMe device given, sends the WDC Vendor Specific Internal Log request and saves
-the result to a file.</p></div>
+<div class="paragraph"><p>For the NVMe device given, sends the WDC Vendor Specific Internal Log request
+and saves the result to a file.</p></div>
<div class="paragraph"><p>The <device> parameter is mandatory NVMe character device (ex: /dev/nvme0).</p></div>
<div class="paragraph"><p>This will only work on WDC devices supporting this feature.
Results for any other device are undefined.</p></div>
@@ -778,7 +781,8 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Output file; defaults to device serial number followed by "<em>internal_fw_log</em><date>_<time>.bin" suffix
+ Output file; defaults to device serial number followed by
+ "<em>internal_fw_log</em><date>_<time>.bin" suffix
</p>
</dd>
<dt class="hdlist1">
@@ -789,7 +793,7 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Transfer size; defaults to 0x10000 (65536 decimal) bytes
+ Transfer size; defaults to 0x10000 (65536 decimal) bytes
</p>
</dd>
<dt class="hdlist1">
@@ -800,8 +804,9 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- DUI data area to retrieve. The DUI data areas from 1 to <DATA AREA> will be retrieved. This parameter
- is currently only supported on the SN340, SN640, SN730, and SN840 devices.
+ DUI data area to retrieve. The DUI data areas from 1 to <DATA AREA> will
+ be retrieved. This parameter is currently only supported on the SN340,
+ SN640, SN730, and SN840 devices.
</p>
</dd>
<dt class="hdlist1">
@@ -812,9 +817,10 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Specifies the desired size of the data file starting at the passed in offset. This allows the user to
- retrieve the data in several smaller files of the passed in size. This parameter is currently only
- supported on the SN340 device.
+ Specifies the desired size of the data file starting at the passed in
+ offset. This allows the user to retrieve the data in several smaller
+ files of the passed in size. This parameter is currently only supported
+ on the SN340 device.
</p>
</dd>
<dt class="hdlist1">
@@ -825,9 +831,10 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Specifies the data offset at which to start retrieving the data. This parameter is used in combination
- with the file size parameter to retrieve the data in several smaller files. This parameter is currently
- only supported on the SN340 device.
+ Specifies the data offset at which to start retrieving the data. This
+ parameter is used in combination with the file size parameter to
+ retrieve the data in several smaller files. This parameter is currently
+ only supported on the SN340 device.
</p>
</dd>
<dt class="hdlist1">
@@ -838,10 +845,11 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Specifies the telemetry type - NONE, HOST, or CONTROLLER. This parameter is used to get either the host
- generated or controller initiated telemetry log page. If not specified or none is specified, the command
- will return the default E6 log data. This parameter is currently only supported on the SN640 and SN840
- devices.
+ Specifies the telemetry type - NONE, HOST, or CONTROLLER. This parameter
+ is used to get either the host generated or controller initiated
+ telemetry log page. If not specified or none is specified, the command
+ will return the default E6 log data. This parameter is currently only
+ supported on the SN640 and SN840 devices.
</p>
</dd>
<dt class="hdlist1">
@@ -950,7 +958,7 @@ Gets the controller telemetry log page to data area 3 from the device and stores <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-vs-internal-log.txt b/Documentation/nvme-wdc-vs-internal-log.txt index 4fbde38..08f585b 100644 --- a/Documentation/nvme-wdc-vs-internal-log.txt +++ b/Documentation/nvme-wdc-vs-internal-log.txt @@ -8,15 +8,18 @@ nvme-wdc-vs-internal-log - Retrieve WDC device's internal firmware log and save SYNOPSIS -------- [verse] -'nvme wdc vs-internal-log' <device> [--output-file=<FILE>, -o <FILE>] [--transfer-size=<SIZE>, -s <SIZE>] - [--data-area=<DATA AREA>, -d <DATA_AREA>] [--file-size=<FILE SIZE>, -f <FILE SIZE>] [--offset=<OFFSET>, -e <OFFSET>] - [--type=<TYPE>, -t <type>] [--verbose, -v] +'nvme wdc vs-internal-log' <device> [--output-file=<FILE>, -o <FILE>] + [--transfer-size=<SIZE>, -s <SIZE>] + [--data-area=<DATA AREA>, -d <DATA_AREA>] + [--file-size=<FILE SIZE>, -f <FILE SIZE>] + [--offset=<OFFSET>, -e <OFFSET>] + [--type=<TYPE>, -t <type>] [--verbose, -v] DESCRIPTION ----------- -For the NVMe device given, sends the WDC Vendor Specific Internal Log request and saves -the result to a file. +For the NVMe device given, sends the WDC Vendor Specific Internal Log request +and saves the result to a file. The <device> parameter is mandatory NVMe character device (ex: /dev/nvme0). @@ -27,35 +30,40 @@ OPTIONS ------- -o <FILE>:: --output-file=<FILE>:: - Output file; defaults to device serial number followed by "_internal_fw_log_<date>_<time>.bin" suffix + Output file; defaults to device serial number followed by + "_internal_fw_log_<date>_<time>.bin" suffix -s <SIZE>:: --transfer-size=<SIZE>:: - Transfer size; defaults to 0x10000 (65536 decimal) bytes + Transfer size; defaults to 0x10000 (65536 decimal) bytes -d <DATA AREA>:: --data-area=<DATA AREA>:: - DUI data area to retrieve. The DUI data areas from 1 to <DATA AREA> will be retrieved. This parameter - is currently only supported on the SN340, SN640, SN730, and SN840 devices. + DUI data area to retrieve. The DUI data areas from 1 to <DATA AREA> will + be retrieved. This parameter is currently only supported on the SN340, + SN640, SN730, and SN840 devices. -f <FILE SIZE>:: --file-size=<FILE SIZE>:: - Specifies the desired size of the data file starting at the passed in offset. This allows the user to - retrieve the data in several smaller files of the passed in size. This parameter is currently only - supported on the SN340 device. + Specifies the desired size of the data file starting at the passed in + offset. This allows the user to retrieve the data in several smaller + files of the passed in size. This parameter is currently only supported + on the SN340 device. -e <OFFSET>:: --offset=<OFFSET>:: - Specifies the data offset at which to start retrieving the data. This parameter is used in combination - with the file size parameter to retrieve the data in several smaller files. This parameter is currently - only supported on the SN340 device. + Specifies the data offset at which to start retrieving the data. This + parameter is used in combination with the file size parameter to + retrieve the data in several smaller files. This parameter is currently + only supported on the SN340 device. -t <TYPE>:: --type=<TYPE>:: - Specifies the telemetry type - NONE, HOST, or CONTROLLER. This parameter is used to get either the host - generated or controller initiated telemetry log page. If not specified or none is specified, the command - will return the default E6 log data. This parameter is currently only supported on the SN640 and SN840 - devices. + Specifies the telemetry type - NONE, HOST, or CONTROLLER. This parameter + is used to get either the host generated or controller initiated + telemetry log page. If not specified or none is specified, the command + will return the default E6 log data. This parameter is currently only + supported on the SN640 and SN840 devices. -v <VERBOSE>:: --verbose=<VERBOSE>:: diff --git a/Documentation/nvme-wdc-vs-nand-stats.1 b/Documentation/nvme-wdc-vs-nand-stats.1 index a16f9a2..fa00962 100644 --- a/Documentation/nvme-wdc-vs-nand-stats.1 +++ b/Documentation/nvme-wdc-vs-nand-stats.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-vs-nand-stats .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-VS\-NAND\" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-VS\-NAND\" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -45,7 +45,7 @@ This will only work on WDC devices supporting this feature\&. Results for any ot On success it returns the NAND statistics, error code otherwise\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, or diff --git a/Documentation/nvme-wdc-vs-nand-stats.html b/Documentation/nvme-wdc-vs-nand-stats.html index 1ea9f8f..0f7625d 100644 --- a/Documentation/nvme-wdc-vs-nand-stats.html +++ b/Documentation/nvme-wdc-vs-nand-stats.html @@ -772,10 +772,10 @@ Results for any other device are undefined.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -814,7 +814,7 @@ Has the program issue WDC vs-nand-stats Vendor Unique Command : <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-vs-nand-stats.txt b/Documentation/nvme-wdc-vs-nand-stats.txt index cc1f422..1b16daa 100644 --- a/Documentation/nvme-wdc-vs-nand-stats.txt +++ b/Documentation/nvme-wdc-vs-nand-stats.txt @@ -26,8 +26,8 @@ On success it returns the NAND statistics, error code otherwise. OPTIONS ------- --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', or 'json'. Only one output format can be used at a time. Default is normal. diff --git a/Documentation/nvme-wdc-vs-smart-add-log.1 b/Documentation/nvme-wdc-vs-smart-add-log.1 index e955162..7fe4900 100644 --- a/Documentation/nvme-wdc-vs-smart-add-log.1 +++ b/Documentation/nvme-wdc-vs-smart-add-log.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-vs-smart-add-log .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-VS\-SMART" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-VS\-SMART" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -54,7 +54,7 @@ On success it returns 0, error code otherwise\&. Return the statistics from specific interval, defaults to 14\&. This parameter is only valid for the 0xC1 log page and ignored for all other log pages\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, or diff --git a/Documentation/nvme-wdc-vs-smart-add-log.html b/Documentation/nvme-wdc-vs-smart-add-log.html index 6abbe25..00d6ce7 100644 --- a/Documentation/nvme-wdc-vs-smart-add-log.html +++ b/Documentation/nvme-wdc-vs-smart-add-log.html @@ -782,15 +782,16 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Return the statistics from specific interval, defaults to 14. This parameter is only valid for the 0xC1 log page
- and ignored for all other log pages.
+ Return the statistics from specific interval, defaults to 14. This
+ parameter is only valid for the 0xC1 log page and ignored for all other
+ log pages.
</p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -807,8 +808,8 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Log Page Version: 0 = vendor, 1 = WDC. This parameter is only valid for the 0xC0 log page and ignored for all
- other log pages.
+ Log Page Version: 0 = vendor, 1 = WDC. This parameter is only valid for
+ the 0xC0 log page and ignored for all other log pages.
</p>
</dd>
<dt class="hdlist1">
@@ -819,10 +820,10 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Supply a comma separated list of desired log pages to display.
- The possible values are 0xc0, 0xc1, 0xca, 0xd0.
- Note: Not all pages are supported on all drives.
- The default is to display all supported log pages.
+ Supply a comma separated list of desired log pages to display.
+ The possible values are 0xc0, 0xc1, 0xca, 0xd0.
+ Note: Not all pages are supported on all drives.
+ The default is to display all supported log pages.
</p>
</dd>
<dt class="hdlist1">
@@ -927,7 +928,7 @@ Has the program issue WDC vs-smart-add-log Vendor Unique Command for 0xC0 and 0x <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-vs-smart-add-log.txt b/Documentation/nvme-wdc-vs-smart-add-log.txt index 7de1ac8..925287f 100644 --- a/Documentation/nvme-wdc-vs-smart-add-log.txt +++ b/Documentation/nvme-wdc-vs-smart-add-log.txt @@ -3,7 +3,8 @@ nvme-wdc-vs-smart-add-log(1) NAME ---- -nvme-wdc-vs-smart-add-log - Send NVMe WDC vs-smart-add-log Vendor Unique Command, return result +nvme-wdc-vs-smart-add-log - Send NVMe WDC vs-smart-add-log Vendor Unique Command, +return result SYNOPSIS -------- @@ -31,26 +32,27 @@ OPTIONS ------- -i <NUM>:: --interval=<NUM>:: - Return the statistics from specific interval, defaults to 14. This parameter is only valid for the 0xC1 log page - and ignored for all other log pages. + Return the statistics from specific interval, defaults to 14. This + parameter is only valid for the 0xC1 log page and ignored for all other + log pages. --o <format>:: ---output-format=<format>:: +-o <fmt>:: +--output-format=<fmt>:: Set the reporting format to 'normal', or 'json'. Only one output format can be used at a time. Default is normal. -l <NUM>:: --log-page-version=<NUM>:: - Log Page Version: 0 = vendor, 1 = WDC. This parameter is only valid for the 0xC0 log page and ignored for all - other log pages. + Log Page Version: 0 = vendor, 1 = WDC. This parameter is only valid for + the 0xC0 log page and ignored for all other log pages. -p <LIST>:: --log-page-mask=<LIST>:: - Supply a comma separated list of desired log pages to display. - The possible values are 0xc0, 0xc1, 0xca, 0xd0. - Note: Not all pages are supported on all drives. - The default is to display all supported log pages. + Supply a comma separated list of desired log pages to display. + The possible values are 0xc0, 0xc1, 0xca, 0xd0. + Note: Not all pages are supported on all drives. + The default is to display all supported log pages. -n <nsid>:: --namespace-id=<nsid>:: @@ -82,7 +84,6 @@ accumulated statistics. |The statistical set accumulated during the entire lifetime of the device. |=== - EXAMPLES -------- * Has the program issue WDC vs-smart-add-log Vendor Unique Command with default interval (14) : diff --git a/Documentation/nvme-wdc-vs-telemetry-controller-option.1 b/Documentation/nvme-wdc-vs-telemetry-controller-option.1 index e5f4dcc..5176f93 100644 --- a/Documentation/nvme-wdc-vs-telemetry-controller-option.1 +++ b/Documentation/nvme-wdc-vs-telemetry-controller-option.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-vs-telemetry-controller-option .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-VS\-TELEM" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-VS\-TELEM" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,12 +32,12 @@ nvme-wdc-vs-telemetry-controller-option \- Disable/Enable the controller initiat .SH "SYNOPSIS" .sp .nf -\fInvme wdc vs\-telemetry\-controller\-option\fR <device> [\-\-disable, \-d] [\-\-enable, \-e] - [\-\-status, \-s] +\fInvme wdc vs\-telemetry\-controller\-option\fR <device> + [\-\-disable, \-d] [\-\-enable, \-e] [\-\-status, \-s] .fi .SH "DESCRIPTION" .sp -For the NVMe device given, sends the WDC Vendor Specific set feature command to disable, enable or get current status of the controller initiated option of the telemetry log page\&. +For the NVMe device given, sends the WDC Vendor Specific set feature command to disable, enable or get current status the controller initiated option of the telemetry log page\&. .sp The <device> parameter is mandatory NVMe character device (ex: /dev/nvme0)\&. .sp diff --git a/Documentation/nvme-wdc-vs-telemetry-controller-option.html b/Documentation/nvme-wdc-vs-telemetry-controller-option.html index 8599741..4b8b0c8 100644 --- a/Documentation/nvme-wdc-vs-telemetry-controller-option.html +++ b/Documentation/nvme-wdc-vs-telemetry-controller-option.html @@ -749,8 +749,8 @@ nvme-wdc-vs-telemetry-controller-option(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme wdc vs-telemetry-controller-option</em> <device> [--disable, -d] [--enable, -e]
- [--status, -s]</pre>
+<pre class="content"><em>nvme wdc vs-telemetry-controller-option</em> <device>
+ [--disable, -d] [--enable, -e] [--status, -s]</pre>
<div class="attribution">
</div></div>
</div>
@@ -758,8 +758,9 @@ nvme-wdc-vs-telemetry-controller-option(1) Manual Page <div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
-<div class="paragraph"><p>For the NVMe device given, sends the WDC Vendor Specific set feature command to disable, enable or get current status
-of the controller initiated option of the telemetry log page.</p></div>
+<div class="paragraph"><p>For the NVMe device given, sends the WDC Vendor Specific set feature command to
+disable, enable or get current status the controller initiated option of the
+telemetry log page.</p></div>
<div class="paragraph"><p>The <device> parameter is mandatory NVMe character device (ex: /dev/nvme0).</p></div>
<div class="paragraph"><p>This will only work on WDC devices supporting this feature.
Results for any other device are undefined.</p></div>
@@ -799,7 +800,8 @@ Results for any other device are undefined.</p></div> </dt>
<dd>
<p>
- Returns the current status (enabled or disabled) of the controller initiated option of the telemetry log page.
+ Returns the current status (enabled or disabled) of the controller
+ initiated option of the telemetry log page.
</p>
</dd>
</dl></div>
@@ -853,7 +855,7 @@ Gets the current status (enabled or disabled) of the controller initiated option <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-vs-telemetry-controller-option.txt b/Documentation/nvme-wdc-vs-telemetry-controller-option.txt index 8c1a7e7..2353e7c 100644 --- a/Documentation/nvme-wdc-vs-telemetry-controller-option.txt +++ b/Documentation/nvme-wdc-vs-telemetry-controller-option.txt @@ -3,19 +3,21 @@ nvme-wdc-vs-telemetry-controller-option(1) NAME ---- -nvme-wdc-vs-telemetry-controller-option - Disable/Enable the controller initiated option of the telemetry log page. +nvme-wdc-vs-telemetry-controller-option - Disable/Enable the controller +initiated option of the telemetry log page. SYNOPSIS -------- [verse] -'nvme wdc vs-telemetry-controller-option' <device> [--disable, -d] [--enable, -e] - [--status, -s] +'nvme wdc vs-telemetry-controller-option' <device> + [--disable, -d] [--enable, -e] [--status, -s] DESCRIPTION ----------- -For the NVMe device given, sends the WDC Vendor Specific set feature command to disable, enable or get current status -of the controller initiated option of the telemetry log page. +For the NVMe device given, sends the WDC Vendor Specific set feature command to +disable, enable or get current status the controller initiated option of the +telemetry log page. The <device> parameter is mandatory NVMe character device (ex: /dev/nvme0). @@ -34,8 +36,8 @@ OPTIONS -s:: --status:: - Returns the current status (enabled or disabled) of the controller initiated option of the telemetry log page. - + Returns the current status (enabled or disabled) of the controller + initiated option of the telemetry log page. EXAMPLES -------- diff --git a/Documentation/nvme-wdc-vs-temperature-stats.1 b/Documentation/nvme-wdc-vs-temperature-stats.1 index 4a3ffc3..b5c2370 100644 --- a/Documentation/nvme-wdc-vs-temperature-stats.1 +++ b/Documentation/nvme-wdc-vs-temperature-stats.1 @@ -2,12 +2,12 @@ .\" Title: nvme-wdc-vs-temperature-stats .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WDC\-VS\-TEMPE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WDC\-VS\-TEMPE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-wdc-vs-temperature-stats.html b/Documentation/nvme-wdc-vs-temperature-stats.html index 6ba4aa1..f76c0e3 100644 --- a/Documentation/nvme-wdc-vs-temperature-stats.html +++ b/Documentation/nvme-wdc-vs-temperature-stats.html @@ -857,7 +857,7 @@ Displays the temperature stats for the device: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-write-uncor.1 b/Documentation/nvme-write-uncor.1 index b7e0efe..148e7c8 100644 --- a/Documentation/nvme-write-uncor.1 +++ b/Documentation/nvme-write-uncor.1 @@ -2,12 +2,12 @@ .\" Title: nvme-uncor .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-UNCOR" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-UNCOR" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -37,23 +37,24 @@ nvme-write-uncor \- Send an NVMe write uncorrectable command, return results [\-\-namespace\-id=<nsid> | \-n <nsid>] [\-\-dir\-type=<dtype> | \-T <dtype>] [\-\-dir\-spec=<dspec> | \-S <dspec>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp The Write Uncorrectable command is used to invalidate a range of logical blocks\&. .SH "OPTIONS" .PP -\-\-start\-block=<slba>, \-s <slba> +\-s <slba>, \-\-start\-block=<slba> .RS 4 Start block\&. .RE .PP -\-\-block\-count=<nlb>, \-c +\-c, \-\-block\-count=<nlb> .RS 4 Number of logical blocks to write uncorrectable\&. .RE .PP -\-\-namespace\-id=<nsid>, \-n <nsid> +\-n <nsid>, \-\-namespace\-id=<nsid> .RS 4 Namespace ID use in the command\&. .RE @@ -67,6 +68,20 @@ Directive type .RS 4 Directive specific .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet\&. diff --git a/Documentation/nvme-write-uncor.html b/Documentation/nvme-write-uncor.html index 4c69628..6f9c038 100644 --- a/Documentation/nvme-write-uncor.html +++ b/Documentation/nvme-write-uncor.html @@ -753,7 +753,8 @@ nvme-uncor(1) Manual Page [--block-count=<nlb> | -c <nlb>]
[--namespace-id=<nsid> | -n <nsid>]
[--dir-type=<dtype> | -T <dtype>]
- [--dir-spec=<dspec> | -S <dspec>]</pre>
+ [--dir-spec=<dspec> | -S <dspec>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -770,10 +771,10 @@ blocks.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
---start-block=<slba>
+-s <slba>
</dt>
<dt class="hdlist1">
--s <slba>
+--start-block=<slba>
</dt>
<dd>
<p>
@@ -781,10 +782,10 @@ blocks.</p></div> </p>
</dd>
<dt class="hdlist1">
---block-count=<nlb>
+-c
</dt>
<dt class="hdlist1">
--c
+--block-count=<nlb>
</dt>
<dd>
<p>
@@ -792,10 +793,10 @@ blocks.</p></div> </p>
</dd>
<dt class="hdlist1">
---namespace-id=<nsid>
+-n <nsid>
</dt>
<dt class="hdlist1">
--n <nsid>
+--namespace-id=<nsid>
</dt>
<dd>
<p>
@@ -824,6 +825,29 @@ blocks.</p></div> Directive specific
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -844,7 +868,7 @@ blocks.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-write-uncor.txt b/Documentation/nvme-write-uncor.txt index 19415c2..6e49c61 100644 --- a/Documentation/nvme-write-uncor.txt +++ b/Documentation/nvme-write-uncor.txt @@ -13,6 +13,7 @@ SYNOPSIS [--namespace-id=<nsid> | -n <nsid>] [--dir-type=<dtype> | -T <dtype>] [--dir-spec=<dspec> | -S <dspec>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -21,16 +22,16 @@ blocks. OPTIONS ------- ---start-block=<slba>:: -s <slba>:: +--start-block=<slba>:: Start block. ---block-count=<nlb>:: -c:: +--block-count=<nlb>:: Number of logical blocks to write uncorrectable. ---namespace-id=<nsid>:: -n <nsid>:: +--namespace-id=<nsid>:: Namespace ID use in the command. -T <dtype>:: @@ -41,6 +42,15 @@ OPTIONS --dir-spec=<dspec>:: Directive specific +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet. diff --git a/Documentation/nvme-write-zeroes.1 b/Documentation/nvme-write-zeroes.1 index 0ec2964..6c8f5c4 100644 --- a/Documentation/nvme-write-zeroes.1 +++ b/Documentation/nvme-write-zeroes.1 @@ -2,12 +2,12 @@ .\" Title: nvme-write-zeroes .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WRITE\-ZEROES" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WRITE\-ZEROES" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -37,32 +37,31 @@ nvme-write-zeroes \- Send an NVMe write zeroes command, return results [\-\-ref\-tag=<reftag> | \-r <reftag>] [\-\-prinfo=<prinfo> | \-p <prinfo>] [\-\-app\-tag\-mask=<appmask> | \-m <appmask>] - [\-\-app\-tag=<apptag> | \-a <apptag>] - [\-\-deac | \-d] - [\-\-limited\-retry | \-l] - [\-\-force\-unit\-access | \-f] + [\-\-app\-tag=<apptag> | \-a <apptag>] [\-\-deac | \-d] + [\-\-limited\-retry | \-l] [\-\-force\-unit\-access | \-f] [\-\-namespace\-id=<nsid> | \-n <nsid>] [\-\-storage\-tag<storage\-tag> | \-S <storage\-tag>] [\-\-storage\-tag\-check<storage\-tag\-check> | \-C <storage\-tag\-check>] [\-\-dir\-type=<dtype> | \-T <dtype>] [\-\-dir\-spec=<dspec> | \-D <dspec>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp The Write Zeroes command is used to set a range of logical blocks to 0\&. .SH "OPTIONS" .PP -\-\-start\-block=<slba>, \-s <slba> +\-s <slba>, \-\-start\-block=<slba> .RS 4 Start block\&. .RE .PP -\-\-block\-count=<nlb>, \-c <nlb> +\-c <nlb>, \-\-block\-count=<nlb> .RS 4 Number of logical blocks to write zeroes\&. .RE .PP -\-\-prinfo=<prinfo>, \-p <prinfo> +\-p <prinfo>, \-\-prinfo=<prinfo> .RS 4 Protection Information field definition\&. .TS @@ -107,47 +106,47 @@ T} .sp 1 .RE .PP -\-\-ref\-tag=<reftag>, \-r <reftag> +\-r <reftag>, \-\-ref\-tag=<reftag> .RS 4 Optional reftag when used with protection information\&. .RE .PP -\-\-app\-tag\-mask=<appmask>, \-m <appmask> +\-m <appmask>, \-\-app\-tag\-mask=<appmask> .RS 4 Optional application tag mask when used with protection information\&. .RE .PP -\-\-app\-tag=<apptag>, \-a <apptag> +\-a <apptag>, \-\-app\-tag=<apptag> .RS 4 Optional application tag when used with protection information\&. .RE .PP -\-\-limited\-retry, \-l +\-l, \-\-limited\-retry .RS 4 Sets the limited retry flag\&. .RE .PP -\-\-deac, \-d +\-d, \-\-deac .RS 4 Sets the DEAC bit, requesting controller deallocate the logical blocks\&. .RE .PP -\-\-force\-unit\-access, \-f +\-f, \-\-force\-unit\-access .RS 4 Set the force\-unit access flag\&. .RE .PP -\-\-namespace\-id=<nsid>, \-n <nsid> +\-n <nsid>, \-\-namespace\-id=<nsid> .RS 4 Namespace ID use in the command\&. .RE .PP -\-\-storage\-tag=<storage\-tag>, \-S <storage\-tag> +\-S <storage\-tag>, \-\-storage\-tag=<storage\-tag> .RS 4 Variable Sized Logical Block Storage Tag(LBST)\&. .RE .PP -\-\-storage\-tag\-check=<storage\-tag\-check>, \-C <storage\-tag\-check> +\-C <storage\-tag\-check>, \-\-storage\-tag\-check=<storage\-tag\-check> .RS 4 This bit specifies the Storage Tag field shall be checked as part of end\-to\-end data protection processing\&. .RE @@ -161,6 +160,20 @@ Directive type .RS 4 Directive specific .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet\&. diff --git a/Documentation/nvme-write-zeroes.html b/Documentation/nvme-write-zeroes.html index a596cd5..ac0cf70 100644 --- a/Documentation/nvme-write-zeroes.html +++ b/Documentation/nvme-write-zeroes.html @@ -754,15 +754,14 @@ nvme-write-zeroes(1) Manual Page [--ref-tag=<reftag> | -r <reftag>]
[--prinfo=<prinfo> | -p <prinfo>]
[--app-tag-mask=<appmask> | -m <appmask>]
- [--app-tag=<apptag> | -a <apptag>]
- [--deac | -d]
- [--limited-retry | -l]
- [--force-unit-access | -f]
+ [--app-tag=<apptag> | -a <apptag>] [--deac | -d]
+ [--limited-retry | -l] [--force-unit-access | -f]
[--namespace-id=<nsid> | -n <nsid>]
[--storage-tag<storage-tag> | -S <storage-tag>]
[--storage-tag-check<storage-tag-check> | -C <storage-tag-check>]
[--dir-type=<dtype> | -T <dtype>]
- [--dir-spec=<dspec> | -D <dspec>]</pre>
+ [--dir-spec=<dspec> | -D <dspec>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -778,10 +777,10 @@ nvme-write-zeroes(1) Manual Page <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
---start-block=<slba>
+-s <slba>
</dt>
<dt class="hdlist1">
--s <slba>
+--start-block=<slba>
</dt>
<dd>
<p>
@@ -789,10 +788,10 @@ nvme-write-zeroes(1) Manual Page </p>
</dd>
<dt class="hdlist1">
---block-count=<nlb>
+-c <nlb>
</dt>
<dt class="hdlist1">
--c <nlb>
+--block-count=<nlb>
</dt>
<dd>
<p>
@@ -800,10 +799,10 @@ nvme-write-zeroes(1) Manual Page </p>
</dd>
<dt class="hdlist1">
---prinfo=<prinfo>
+-p <prinfo>
</dt>
<dt class="hdlist1">
--p <prinfo>
+--prinfo=<prinfo>
</dt>
<dd>
<p>
@@ -848,10 +847,10 @@ metadata is passes.</p></td> </div>
</dd>
<dt class="hdlist1">
---ref-tag=<reftag>
+-r <reftag>
</dt>
<dt class="hdlist1">
--r <reftag>
+--ref-tag=<reftag>
</dt>
<dd>
<p>
@@ -859,10 +858,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---app-tag-mask=<appmask>
+-m <appmask>
</dt>
<dt class="hdlist1">
--m <appmask>
+--app-tag-mask=<appmask>
</dt>
<dd>
<p>
@@ -870,10 +869,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---app-tag=<apptag>
+-a <apptag>
</dt>
<dt class="hdlist1">
--a <apptag>
+--app-tag=<apptag>
</dt>
<dd>
<p>
@@ -881,10 +880,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---limited-retry
+-l
</dt>
<dt class="hdlist1">
--l
+--limited-retry
</dt>
<dd>
<p>
@@ -892,10 +891,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---deac
+-d
</dt>
<dt class="hdlist1">
--d
+--deac
</dt>
<dd>
<p>
@@ -903,10 +902,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---force-unit-access
+-f
</dt>
<dt class="hdlist1">
--f
+--force-unit-access
</dt>
<dd>
<p>
@@ -914,10 +913,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---namespace-id=<nsid>
+-n <nsid>
</dt>
<dt class="hdlist1">
--n <nsid>
+--namespace-id=<nsid>
</dt>
<dd>
<p>
@@ -925,10 +924,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---storage-tag=<storage-tag>
+-S <storage-tag>
</dt>
<dt class="hdlist1">
--S <storage-tag>
+--storage-tag=<storage-tag>
</dt>
<dd>
<p>
@@ -936,10 +935,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---storage-tag-check=<storage-tag-check>
+-C <storage-tag-check>
</dt>
<dt class="hdlist1">
--C <storage-tag-check>
+--storage-tag-check=<storage-tag-check>
</dt>
<dd>
<p>
@@ -969,6 +968,29 @@ metadata is passes.</p></td> Directive specific
</p>
</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -989,7 +1011,7 @@ metadata is passes.</p></td> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-write-zeroes.txt b/Documentation/nvme-write-zeroes.txt index 7e936e5..0daf320 100644 --- a/Documentation/nvme-write-zeroes.txt +++ b/Documentation/nvme-write-zeroes.txt @@ -13,15 +13,14 @@ SYNOPSIS [--ref-tag=<reftag> | -r <reftag>] [--prinfo=<prinfo> | -p <prinfo>] [--app-tag-mask=<appmask> | -m <appmask>] - [--app-tag=<apptag> | -a <apptag>] - [--deac | -d] - [--limited-retry | -l] - [--force-unit-access | -f] + [--app-tag=<apptag> | -a <apptag>] [--deac | -d] + [--limited-retry | -l] [--force-unit-access | -f] [--namespace-id=<nsid> | -n <nsid>] [--storage-tag<storage-tag> | -S <storage-tag>] [--storage-tag-check<storage-tag-check> | -C <storage-tag-check>] [--dir-type=<dtype> | -T <dtype>] [--dir-spec=<dspec> | -D <dspec>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -29,16 +28,16 @@ The Write Zeroes command is used to set a range of logical blocks to 0. OPTIONS ------- ---start-block=<slba>:: -s <slba>:: +--start-block=<slba>:: Start block. ---block-count=<nlb>:: -c <nlb>:: +--block-count=<nlb>:: Number of logical blocks to write zeroes. ---prinfo=<prinfo>:: -p <prinfo>:: +--prinfo=<prinfo>:: Protection Information field definition. + [] @@ -53,40 +52,40 @@ metadata is passes. |0|Set to 1 enables checking the reference tag |================= ---ref-tag=<reftag>:: -r <reftag>:: +--ref-tag=<reftag>:: Optional reftag when used with protection information. ---app-tag-mask=<appmask>:: -m <appmask>:: +--app-tag-mask=<appmask>:: Optional application tag mask when used with protection information. ---app-tag=<apptag>:: -a <apptag>:: +--app-tag=<apptag>:: Optional application tag when used with protection information. ---limited-retry:: -l:: +--limited-retry:: Sets the limited retry flag. ---deac:: -d:: +--deac:: Sets the DEAC bit, requesting controller deallocate the logical blocks. ---force-unit-access:: -f:: +--force-unit-access:: Set the force-unit access flag. ---namespace-id=<nsid>:: -n <nsid>:: +--namespace-id=<nsid>:: Namespace ID use in the command. ---storage-tag=<storage-tag>:: -S <storage-tag>:: +--storage-tag=<storage-tag>:: Variable Sized Logical Block Storage Tag(LBST). ---storage-tag-check=<storage-tag-check>:: -C <storage-tag-check>:: +--storage-tag-check=<storage-tag-check>:: This bit specifies the Storage Tag field shall be checked as part of end-to-end data protection processing. @@ -98,6 +97,15 @@ metadata is passes. --dir-spec=<dspec>:: Directive specific +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. + EXAMPLES -------- No examples yet. diff --git a/Documentation/nvme-write.1 b/Documentation/nvme-write.1 index 867524e..66b6994 100644 --- a/Documentation/nvme-write.1 +++ b/Documentation/nvme-write.1 @@ -2,12 +2,12 @@ .\" Title: nvme-write .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-WRITE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-WRITE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -42,54 +42,50 @@ nvme-write \- Send an NVMe write command, provide results [\-\-prinfo=<prinfo> | \-p <prinfo>] [\-\-app\-tag\-mask=<appmask> | \-m <appmask>] [\-\-app\-tag=<apptag> | \-a <apptag>] - [\-\-limited\-retry | \-l] - [\-\-force\-unit\-access | \-f] + [\-\-limited\-retry | \-l] [\-\-force\-unit\-access | \-f] [\-\-dir\-type=<type> | \-T <type>] - [\-\-dir\-spec=<spec> | \-S <spec>] - [\-\-dsm=<dsm> | \-D <dsm>] - [\-\-show\-command | \-v] - [\-\-dry\-run | \-w] - [\-\-latency | \-t] + [\-\-dir\-spec=<spec> | \-S <spec>] [\-\-dsm=<dsm> | \-D <dsm>] + [\-\-show\-command | \-V] [\-\-dry\-run | \-w] [\-\-latency | \-t] [\-\-storage\-tag<storage\-tag> | \-g <storage\-tag>] - [\-\-storage\-tag\-check | \-C] - [\-\-force] + [\-\-storage\-tag\-check | \-C] [\-\-force] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp The Write command writes the logical blocks specified by the command to the medium from the data data buffer provided\&. Will use stdin by default if you don\(cqt provide a file\&. .SH "OPTIONS" .PP -\-\-start\-block=<slba>, \-s <slba> +\-s <slba>, \-\-start\-block=<slba> .RS 4 Start block\&. .RE .PP -\-\-block\-count, \-c +\-c, \-\-block\-count .RS 4 The number of blocks to transfer\&. This is a zeroes based value to align with the kernel\(cqs use of this field\&. (ie\&. 0 means transfer 1 block)\&. .RE .PP -\-\-data\-size=<size>, \-z <size> +\-z <size>, \-\-data\-size=<size> .RS 4 Size of data, in bytes\&. .RE .PP -\-\-metadata\-size=<size>, \-y <size> +\-y <size>, \-\-metadata\-size=<size> .RS 4 Size of metadata in bytes\&. .RE .PP -\-\-data=<data\-file>, \-d <data\-file> +\-d <data\-file>, \-\-data=<data\-file> .RS 4 Data file\&. If none provided, contents are sent from STDIN\&. .RE .PP -\-\-metadata=<metadata\-file>, \-M <metadata\-file> +\-M <metadata\-file>, \-\-metadata=<metadata\-file> .RS 4 Metadata file, if necessary\&. .RE .PP -\-\-prinfo=<prinfo>, \-p <prinfo> +\-p <prinfo>, \-\-prinfo=<prinfo> .RS 4 Protection Information field definition\&. .TS @@ -134,27 +130,27 @@ T} .sp 1 .RE .PP -\-\-ref\-tag=<reftag>, \-r <reftag> +\-r <reftag>, \-\-ref\-tag=<reftag> .RS 4 Optional reftag when used with protection information\&. .RE .PP -\-\-app\-tag\-mask=<appmask>, \-m <appmask> +\-m <appmask>, \-\-app\-tag\-mask=<appmask> .RS 4 Optional application tag mask when used with protection information\&. .RE .PP -\-\-app\-tag=<apptag>, \-a <apptag> +\-a <apptag>, \-\-app\-tag=<apptag> .RS 4 Optional application tag when used with protection information\&. .RE .PP -\-\-limited\-retry, \-l +\-l, \-\-limited\-retry .RS 4 Sets the limited retry flag\&. .RE .PP -\-\-force\-unit\-access, \-f +\-f, \-\-force\-unit\-access .RS 4 Set the force\-unit access flag\&. .RE @@ -174,7 +170,7 @@ Optional field for directive specifics\&. When used with write streams, this val The optional data set management attributes for this command\&. The argument for this is the least significant 8 bits of the DSM field in a write command; the most significant 16 bits of the field come from the directive specific field, if used\&. This may be used to set attributes for the LBAs being written, like access frequency, type, latency, among other things, as well as yet to be defined types\&. Please consult the NVMe specification for detailed breakdown of how to use this field\&. .RE .PP -\-v, \-\-show\-cmd +\-V, \-\-show\-cmd .RS 4 Print out the command to be sent\&. .RE @@ -206,6 +202,20 @@ This flag enables Storage Tag field checking as part of end\-to\-end data protec .RS 4 Ignore namespace is currently busy and performed the operation even though\&. .RE +.PP +\-o <fmt>, \-\-output\-format=<fmt> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR +or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.PP +\-v, \-\-verbose +.RS 4 +Increase the information detail in the output\&. +.RE .SH "EXAMPLES" .sp No examples yet\&. diff --git a/Documentation/nvme-write.html b/Documentation/nvme-write.html index c268201..9fe4df9 100644 --- a/Documentation/nvme-write.html +++ b/Documentation/nvme-write.html @@ -759,17 +759,13 @@ nvme-write(1) Manual Page [--prinfo=<prinfo> | -p <prinfo>]
[--app-tag-mask=<appmask> | -m <appmask>]
[--app-tag=<apptag> | -a <apptag>]
- [--limited-retry | -l]
- [--force-unit-access | -f]
+ [--limited-retry | -l] [--force-unit-access | -f]
[--dir-type=<type> | -T <type>]
- [--dir-spec=<spec> | -S <spec>]
- [--dsm=<dsm> | -D <dsm>]
- [--show-command | -v]
- [--dry-run | -w]
- [--latency | -t]
+ [--dir-spec=<spec> | -S <spec>] [--dsm=<dsm> | -D <dsm>]
+ [--show-command | -V] [--dry-run | -w] [--latency | -t]
[--storage-tag<storage-tag> | -g <storage-tag>]
- [--storage-tag-check | -C]
- [--force]</pre>
+ [--storage-tag-check | -C] [--force]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -787,10 +783,10 @@ if you don’t provide a file.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
---start-block=<slba>
+-s <slba>
</dt>
<dt class="hdlist1">
--s <slba>
+--start-block=<slba>
</dt>
<dd>
<p>
@@ -798,10 +794,10 @@ if you don’t provide a file.</p></div> </p>
</dd>
<dt class="hdlist1">
---block-count
+-c
</dt>
<dt class="hdlist1">
--c
+--block-count
</dt>
<dd>
<p>
@@ -811,10 +807,10 @@ if you don’t provide a file.</p></div> </p>
</dd>
<dt class="hdlist1">
---data-size=<size>
+-z <size>
</dt>
<dt class="hdlist1">
--z <size>
+--data-size=<size>
</dt>
<dd>
<p>
@@ -822,10 +818,10 @@ if you don’t provide a file.</p></div> </p>
</dd>
<dt class="hdlist1">
---metadata-size=<size>
+-y <size>
</dt>
<dt class="hdlist1">
--y <size>
+--metadata-size=<size>
</dt>
<dd>
<p>
@@ -833,10 +829,10 @@ if you don’t provide a file.</p></div> </p>
</dd>
<dt class="hdlist1">
---data=<data-file>
+-d <data-file>
</dt>
<dt class="hdlist1">
--d <data-file>
+--data=<data-file>
</dt>
<dd>
<p>
@@ -844,10 +840,10 @@ if you don’t provide a file.</p></div> </p>
</dd>
<dt class="hdlist1">
---metadata=<metadata-file>
+-M <metadata-file>
</dt>
<dt class="hdlist1">
--M <metadata-file>
+--metadata=<metadata-file>
</dt>
<dd>
<p>
@@ -855,10 +851,10 @@ if you don’t provide a file.</p></div> </p>
</dd>
<dt class="hdlist1">
---prinfo=<prinfo>
+-p <prinfo>
</dt>
<dt class="hdlist1">
--p <prinfo>
+--prinfo=<prinfo>
</dt>
<dd>
<p>
@@ -903,10 +899,10 @@ metadata is passes.</p></td> </div>
</dd>
<dt class="hdlist1">
---ref-tag=<reftag>
+-r <reftag>
</dt>
<dt class="hdlist1">
--r <reftag>
+--ref-tag=<reftag>
</dt>
<dd>
<p>
@@ -914,10 +910,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---app-tag-mask=<appmask>
+-m <appmask>
</dt>
<dt class="hdlist1">
--m <appmask>
+--app-tag-mask=<appmask>
</dt>
<dd>
<p>
@@ -925,10 +921,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---app-tag=<apptag>
+-a <apptag>
</dt>
<dt class="hdlist1">
--a <apptag>
+--app-tag=<apptag>
</dt>
<dd>
<p>
@@ -936,10 +932,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---limited-retry
+-l
</dt>
<dt class="hdlist1">
--l
+--limited-retry
</dt>
<dd>
<p>
@@ -947,10 +943,10 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
---force-unit-access
+-f
</dt>
<dt class="hdlist1">
--f
+--force-unit-access
</dt>
<dd>
<p>
@@ -1004,7 +1000,7 @@ metadata is passes.</p></td> </p>
</dd>
<dt class="hdlist1">
--v
+-V
</dt>
<dt class="hdlist1">
--show-cmd
@@ -1066,8 +1062,31 @@ metadata is passes.</p></td> </dt>
<dd>
<p>
- Ignore namespace is currently busy and performed the operation
- even though.
+ Ignore namespace is currently busy and performed the operation
+ even though.
+</p>
+</dd>
+<dt class="hdlist1">
+-o <fmt>
+</dt>
+<dt class="hdlist1">
+--output-format=<fmt>
+</dt>
+<dd>
+<p>
+ Set the reporting format to <em>normal</em>, <em>json</em> or <em>binary</em>. Only one
+ output format can be used at a time.
+</p>
+</dd>
+<dt class="hdlist1">
+-v
+</dt>
+<dt class="hdlist1">
+--verbose
+</dt>
+<dd>
+<p>
+ Increase the information detail in the output.
</p>
</dd>
</dl></div>
@@ -1090,7 +1109,7 @@ metadata is passes.</p></td> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-write.txt b/Documentation/nvme-write.txt index 76cbd7a..af5340e 100644 --- a/Documentation/nvme-write.txt +++ b/Documentation/nvme-write.txt @@ -18,17 +18,13 @@ SYNOPSIS [--prinfo=<prinfo> | -p <prinfo>] [--app-tag-mask=<appmask> | -m <appmask>] [--app-tag=<apptag> | -a <apptag>] - [--limited-retry | -l] - [--force-unit-access | -f] + [--limited-retry | -l] [--force-unit-access | -f] [--dir-type=<type> | -T <type>] - [--dir-spec=<spec> | -S <spec>] - [--dsm=<dsm> | -D <dsm>] - [--show-command | -v] - [--dry-run | -w] - [--latency | -t] + [--dir-spec=<spec> | -S <spec>] [--dsm=<dsm> | -D <dsm>] + [--show-command | -V] [--dry-run | -w] [--latency | -t] [--storage-tag<storage-tag> | -g <storage-tag>] - [--storage-tag-check | -C] - [--force] + [--storage-tag-check | -C] [--force] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -38,34 +34,34 @@ if you don't provide a file. OPTIONS ------- ---start-block=<slba>:: -s <slba>:: +--start-block=<slba>:: Start block. ---block-count:: -c:: +--block-count:: The number of blocks to transfer. This is a zeroes based value to align with the kernel's use of this field. (ie. 0 means transfer 1 block). ---data-size=<size>:: -z <size>:: +--data-size=<size>:: Size of data, in bytes. ---metadata-size=<size>:: -y <size>:: +--metadata-size=<size>:: Size of metadata in bytes. ---data=<data-file>:: -d <data-file>:: +--data=<data-file>:: Data file. If none provided, contents are sent from STDIN. ---metadata=<metadata-file>:: -M <metadata-file>:: +--metadata=<metadata-file>:: Metadata file, if necessary. ---prinfo=<prinfo>:: -p <prinfo>:: +--prinfo=<prinfo>:: Protection Information field definition. + [] @@ -80,24 +76,24 @@ metadata is passes. |0|Set to 1 enables checking the reference tag |================= ---ref-tag=<reftag>:: -r <reftag>:: +--ref-tag=<reftag>:: Optional reftag when used with protection information. ---app-tag-mask=<appmask>:: -m <appmask>:: +--app-tag-mask=<appmask>:: Optional application tag mask when used with protection information. ---app-tag=<apptag>:: -a <apptag>:: +--app-tag=<apptag>:: Optional application tag when used with protection information. ---limited-retry:: -l:: +--limited-retry:: Sets the limited retry flag. ---force-unit-access:: -f:: +--force-unit-access:: Set the force-unit access flag. -T <type>:: @@ -125,7 +121,7 @@ metadata is passes. consult the NVMe specification for detailed breakdown of how to use this field. --v:: +-V:: --show-cmd:: Print out the command to be sent. @@ -149,8 +145,17 @@ metadata is passes. data protection processing. --force:: - Ignore namespace is currently busy and performed the operation - even though. + Ignore namespace is currently busy and performed the operation + even though. + +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json' or 'binary'. Only one + output format can be used at a time. + +-v:: +--verbose:: + Increase the information detail in the output. EXAMPLES -------- diff --git a/Documentation/nvme-zns-changed-zone-list.1 b/Documentation/nvme-zns-changed-zone-list.1 index 1aaec89..183c4d5 100644 --- a/Documentation/nvme-zns-changed-zone-list.1 +++ b/Documentation/nvme-zns-changed-zone-list.1 @@ -2,12 +2,12 @@ .\" Title: nvme-zns-changed-zone-list .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ZNS\-CHANGED\-" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ZNS\-CHANGED\-" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,8 @@ nvme-zns-changed-zone-list \- Retrieve Changed Zone log for the given device .SH "SYNOPSIS" .sp .nf -\fInvme zns changed\-zone\-list\fR <device> [\-o <fmt> | \-\-output\-format=<fmt>] - [\-\-namespace\-id=<NUM> | \-n <NUM>] - [\-\-rae | \-r] +\fInvme zns changed\-zone\-list\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] + [\-\-namespace\-id=<NUM> | \-n <NUM>] [\-\-rae | \-r] .fi .SH "DESCRIPTION" .sp @@ -45,7 +44,7 @@ The <device> parameter is mandatory and may be either the NVMe character device On success, the returned list may be decoded and displayed in one of several ways\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-zns-changed-zone-list.html b/Documentation/nvme-zns-changed-zone-list.html index a2a48c4..d97df21 100644 --- a/Documentation/nvme-zns-changed-zone-list.html +++ b/Documentation/nvme-zns-changed-zone-list.html @@ -749,9 +749,8 @@ nvme-zns-changed-zone-list(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme zns changed-zone-list</em> <device> [-o <fmt> | --output-format=<fmt>]
- [--namespace-id=<NUM> | -n <NUM>]
- [--rae | -r]</pre>
+<pre class="content"><em>nvme zns changed-zone-list</em> <device> [--output-format=<fmt> | -o <fmt>]
+ [--namespace-id=<NUM> | -n <NUM>] [--rae | -r]</pre>
<div class="attribution">
</div></div>
</div>
@@ -772,15 +771,15 @@ ways.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em>, or
+ <em>binary</em>. Only one output format can be used at a time.
</p>
</dd>
<dt class="hdlist1">
@@ -833,7 +832,7 @@ Show the output in json format <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-zns-changed-zone-list.txt b/Documentation/nvme-zns-changed-zone-list.txt index 9626c05..ad447ce 100644 --- a/Documentation/nvme-zns-changed-zone-list.txt +++ b/Documentation/nvme-zns-changed-zone-list.txt @@ -8,9 +8,8 @@ nvme-zns-changed-zone-list - Retrieve Changed Zone log for the given device SYNOPSIS -------- [verse] -'nvme zns changed-zone-list' <device> [-o <fmt> | --output-format=<fmt>] - [--namespace-id=<NUM> | -n <NUM>] - [--rae | -r] +'nvme zns changed-zone-list' <device> [--output-format=<fmt> | -o <fmt>] + [--namespace-id=<NUM> | -n <NUM>] [--rae | -r] DESCRIPTION ----------- @@ -25,10 +24,10 @@ ways. OPTIONS ------- --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json', or + 'binary'. Only one output format can be used at a time. -r:: --rae:: diff --git a/Documentation/nvme-zns-close-zone.1 b/Documentation/nvme-zns-close-zone.1 index 9b939d9..cba967f 100644 --- a/Documentation/nvme-zns-close-zone.1 +++ b/Documentation/nvme-zns-close-zone.1 @@ -2,12 +2,12 @@ .\" Title: nvme-zns-close-zone .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ZNS\-CLOSE\-ZO" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ZNS\-CLOSE\-ZO" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-zns-close-zone.html b/Documentation/nvme-zns-close-zone.html index 8212189..503e3b7 100644 --- a/Documentation/nvme-zns-close-zone.html +++ b/Documentation/nvme-zns-close-zone.html @@ -846,7 +846,7 @@ Close all zones on namespace 1: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-zns-finish-zone.1 b/Documentation/nvme-zns-finish-zone.1 index 82e631f..dafb761 100644 --- a/Documentation/nvme-zns-finish-zone.1 +++ b/Documentation/nvme-zns-finish-zone.1 @@ -2,12 +2,12 @@ .\" Title: nvme-zns-finish-zone .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ZNS\-FINISH\-Z" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ZNS\-FINISH\-Z" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-zns-finish-zone.html b/Documentation/nvme-zns-finish-zone.html index fe8fbfc..c0a1fac 100644 --- a/Documentation/nvme-zns-finish-zone.html +++ b/Documentation/nvme-zns-finish-zone.html @@ -847,7 +847,7 @@ Finish all zones on namespace 1: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-zns-id-ctrl.1 b/Documentation/nvme-zns-id-ctrl.1 index 6c230e2..1495993 100644 --- a/Documentation/nvme-zns-id-ctrl.1 +++ b/Documentation/nvme-zns-id-ctrl.1 @@ -2,12 +2,12 @@ .\" Title: nvme-zns-id-ctrl .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ZNS\-ID\-CTRL" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ZNS\-ID\-CTRL" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,7 +32,7 @@ nvme-zns-id-ctrl \- Send NVMe Zoned Command Set Identify Controller, return resu .SH "SYNOPSIS" .sp .nf -\fInvme zns id\-ctrl\fR <device> [\-o <fmt> | \-\-output\-format=<fmt>] +\fInvme zns id\-ctrl\fR <device> [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp @@ -43,7 +43,7 @@ The <device> parameter is mandatory and may be either the NVMe character device On success, the data structure returned by the device will be decoded and displayed in one of several ways\&. .SH "OPTIONS" .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-zns-id-ctrl.html b/Documentation/nvme-zns-id-ctrl.html index 7279c65..0e06efe 100644 --- a/Documentation/nvme-zns-id-ctrl.html +++ b/Documentation/nvme-zns-id-ctrl.html @@ -740,7 +740,7 @@ nvme-zns-id-ctrl(1) Manual Page <h2>NAME</h2>
<div class="sectionbody">
<p>nvme-zns-id-ctrl -
- Send NVMe Zoned Command Set Identify Controller, return result and structure
+ Send NVMe Zoned Command Set Identify Controller, return result and structure
</p>
</div>
</div>
@@ -749,7 +749,7 @@ nvme-zns-id-ctrl(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme zns id-ctrl</em> <device> [-o <fmt> | --output-format=<fmt>]</pre>
+<pre class="content"><em>nvme zns id-ctrl</em> <device> [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -770,15 +770,15 @@ displayed in one of several ways.</p></div> <div class="sectionbody">
<div class="dlist"><dl>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em>, or
+ <em>binary</em>. Only one output format can be used at a time.
</p>
</dd>
</dl></div>
@@ -821,7 +821,7 @@ Show the output in json format <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-zns-id-ctrl.txt b/Documentation/nvme-zns-id-ctrl.txt index e7bd5ba..0057159 100644 --- a/Documentation/nvme-zns-id-ctrl.txt +++ b/Documentation/nvme-zns-id-ctrl.txt @@ -4,12 +4,12 @@ nvme-zns-id-ctrl(1) NAME ---- nvme-zns-id-ctrl - Send NVMe Zoned Command Set Identify Controller, return - result and structure +result and structure SYNOPSIS -------- [verse] -'nvme zns id-ctrl' <device> [-o <fmt> | --output-format=<fmt>] +'nvme zns id-ctrl' <device> [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- @@ -24,10 +24,10 @@ displayed in one of several ways. OPTIONS ------- --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json', or + 'binary'. Only one output format can be used at a time. EXAMPLES -------- diff --git a/Documentation/nvme-zns-id-ns.1 b/Documentation/nvme-zns-id-ns.1 index d7829bb..89f44e8 100644 --- a/Documentation/nvme-zns-id-ns.1 +++ b/Documentation/nvme-zns-id-ns.1 @@ -2,12 +2,12 @@ .\" Title: nvme-zns-id-ns .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ZNS\-ID\-NS" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ZNS\-ID\-NS" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,8 @@ nvme-zns-id-ns \- Send NVMe Zoned Command Set Identify namespace, return result .SH "SYNOPSIS" .sp .nf -\fInvme zns id\-ns\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] - [\-o <fmt> | \-\-output\-format=<fmt>] - [\-v | \-\-verbose] +\fInvme zns id\-ns\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] + [\-\-output\-format=<fmt> | \-o <fmt>] [\-\-verbose | \-v] .fi .SH "DESCRIPTION" .sp @@ -55,7 +54,7 @@ Use the provided namespace id for the command\&. If not provided, the namespace Increase the information detail in the output\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-zns-id-ns.html b/Documentation/nvme-zns-id-ns.html index 7f56f7e..38d6f8c 100644 --- a/Documentation/nvme-zns-id-ns.html +++ b/Documentation/nvme-zns-id-ns.html @@ -740,7 +740,7 @@ nvme-zns-id-ns(1) Manual Page <h2>NAME</h2>
<div class="sectionbody">
<p>nvme-zns-id-ns -
- Send NVMe Zoned Command Set Identify namespace, return result and structure
+ Send NVMe Zoned Command Set Identify namespace, return result and structure
</p>
</div>
</div>
@@ -749,9 +749,8 @@ nvme-zns-id-ns(1) Manual Page <h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
-<pre class="content"><em>nvme zns id-ns</em> <device> [--namespace-id=<NUM> | -n <NUM>]
- [-o <fmt> | --output-format=<fmt>]
- [-v | --verbose]</pre>
+<pre class="content"><em>nvme zns id-ns</em> <device> [--namespace-id=<NUM> | -n <NUM>]
+ [--output-format=<fmt> | -o <fmt>] [--verbose | -v]</pre>
<div class="attribution">
</div></div>
</div>
@@ -796,15 +795,15 @@ displayed in one of several ways.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em>, or
+ <em>binary</em>. Only one output format can be used at a time.
</p>
</dd>
</dl></div>
@@ -847,7 +846,7 @@ Show the output in json format with extra details <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-zns-id-ns.txt b/Documentation/nvme-zns-id-ns.txt index 799e3b6..c22b5c7 100644 --- a/Documentation/nvme-zns-id-ns.txt +++ b/Documentation/nvme-zns-id-ns.txt @@ -3,15 +3,14 @@ nvme-zns-id-ns(1) NAME ---- -nvme-zns-id-ns - Send NVMe Zoned Command Set Identify namespace, return - result and structure +nvme-zns-id-ns - Send NVMe Zoned Command Set Identify namespace, return result +and structure SYNOPSIS -------- [verse] -'nvme zns id-ns' <device> [--namespace-id=<NUM> | -n <NUM>] - [-o <fmt> | --output-format=<fmt>] - [-v | --verbose] +'nvme zns id-ns' <device> [--namespace-id=<NUM> | -n <NUM>] + [--output-format=<fmt> | -o <fmt>] [--verbose | -v] DESCRIPTION ----------- @@ -36,10 +35,10 @@ OPTIONS --verbose:: Increase the information detail in the output. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json', or + 'binary'. Only one output format can be used at a time. EXAMPLES -------- diff --git a/Documentation/nvme-zns-offline-zone.1 b/Documentation/nvme-zns-offline-zone.1 index 116817d..18a7638 100644 --- a/Documentation/nvme-zns-offline-zone.1 +++ b/Documentation/nvme-zns-offline-zone.1 @@ -2,12 +2,12 @@ .\" Title: nvme-zns-offline-zone .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ZNS\-OFFLINE\-" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ZNS\-OFFLINE\-" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-zns-offline-zone.html b/Documentation/nvme-zns-offline-zone.html index 9d12c96..c459366 100644 --- a/Documentation/nvme-zns-offline-zone.html +++ b/Documentation/nvme-zns-offline-zone.html @@ -846,7 +846,7 @@ Offline all zones on namespace 1: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-zns-open-zone.1 b/Documentation/nvme-zns-open-zone.1 index 40b0ec9..2f84543 100644 --- a/Documentation/nvme-zns-open-zone.1 +++ b/Documentation/nvme-zns-open-zone.1 @@ -2,12 +2,12 @@ .\" Title: nvme-zns-open-zone .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ZNS\-OPEN\-ZON" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ZNS\-OPEN\-ZON" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,10 +33,8 @@ nvme-zns-open-zone \- Opens one or all zones .sp .nf \fInvme zns open\-zone\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] - [\-\-start\-lba=<LBA> | \-s <LBA>] - [\-\-zrwaa | \-r] - [\-\-select\-all | \-a] - [\-\-timeout=<timeout> | \-t <timeout>] + [\-\-start\-lba=<LBA> | \-s <LBA>] [\-\-zrwaa | \-r] + [\-\-select\-all | \-a] [\-\-timeout=<timeout> | \-t <timeout>] .fi .SH "DESCRIPTION" .sp diff --git a/Documentation/nvme-zns-open-zone.html b/Documentation/nvme-zns-open-zone.html index fda136e..0a18862 100644 --- a/Documentation/nvme-zns-open-zone.html +++ b/Documentation/nvme-zns-open-zone.html @@ -750,10 +750,8 @@ nvme-zns-open-zone(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme zns open-zone</em> <device> [--namespace-id=<NUM> | -n <NUM>]
- [--start-lba=<LBA> | -s <LBA>]
- [--zrwaa | -r]
- [--select-all | -a]
- [--timeout=<timeout> | -t <timeout>]</pre>
+ [--start-lba=<LBA> | -s <LBA>] [--zrwaa | -r]
+ [--select-all | -a] [--timeout=<timeout> | -t <timeout>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -858,7 +856,7 @@ Open the first zone on namespace 1: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-zns-open-zone.txt b/Documentation/nvme-zns-open-zone.txt index 0f2cb35..4639bcc 100644 --- a/Documentation/nvme-zns-open-zone.txt +++ b/Documentation/nvme-zns-open-zone.txt @@ -9,10 +9,8 @@ SYNOPSIS -------- [verse] 'nvme zns open-zone' <device> [--namespace-id=<NUM> | -n <NUM>] - [--start-lba=<LBA> | -s <LBA>] - [--zrwaa | -r] - [--select-all | -a] - [--timeout=<timeout> | -t <timeout>] + [--start-lba=<LBA> | -s <LBA>] [--zrwaa | -r] + [--select-all | -a] [--timeout=<timeout> | -t <timeout>] DESCRIPTION ----------- diff --git a/Documentation/nvme-zns-report-zones.1 b/Documentation/nvme-zns-report-zones.1 index dea48f4..ba89e50 100644 --- a/Documentation/nvme-zns-report-zones.1 +++ b/Documentation/nvme-zns-report-zones.1 @@ -2,12 +2,12 @@ .\" Title: nvme-zns-report-zones .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ZNS\-REPORT\-Z" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ZNS\-REPORT\-Z" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -39,7 +39,7 @@ nvme-zns-report-zones \- Retrieve and display the Report Zones data structure [\-\-extended | \-e] [\-\-partial | \-p] [\-\-verbose | \-v] - [\-\-output\-format=<FMT> | \-o <FMT>] + [\-\-output\-format=<fmt> | \-o <fmt>] .fi .SH "DESCRIPTION" .sp @@ -143,7 +143,7 @@ If set, the device will return the number of zones that match the state rather t Increase the information detail in the output\&. .RE .PP -\-o <format>, \-\-output\-format=<format> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Set the reporting format to \fInormal\fR, diff --git a/Documentation/nvme-zns-report-zones.html b/Documentation/nvme-zns-report-zones.html index 79fdb2a..582b8dd 100644 --- a/Documentation/nvme-zns-report-zones.html +++ b/Documentation/nvme-zns-report-zones.html @@ -756,7 +756,7 @@ nvme-zns-report-zones(1) Manual Page [--extended | -e]
[--partial | -p]
[--verbose | -v]
- [--output-format=<FMT> | -o <FMT>]</pre>
+ [--output-format=<fmt> | -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -906,15 +906,15 @@ cellspacing="0" cellpadding="4"> </p>
</dd>
<dt class="hdlist1">
--o <format>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<format>
+--output-format=<fmt>
</dt>
<dd>
<p>
- Set the reporting format to <em>normal</em>, <em>json</em>, or
- <em>binary</em>. Only one output format can be used at a time.
+ Set the reporting format to <em>normal</em>, <em>json</em>, or
+ <em>binary</em>. Only one output format can be used at a time.
</p>
</dd>
</dl></div>
@@ -957,7 +957,7 @@ Show the output in json format with extra details <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-zns-report-zones.txt b/Documentation/nvme-zns-report-zones.txt index 35d5eda..23dd6b4 100644 --- a/Documentation/nvme-zns-report-zones.txt +++ b/Documentation/nvme-zns-report-zones.txt @@ -15,7 +15,7 @@ SYNOPSIS [--extended | -e] [--partial | -p] [--verbose | -v] - [--output-format=<FMT> | -o <FMT>] + [--output-format=<fmt> | -o <fmt>] DESCRIPTION ----------- @@ -76,10 +76,10 @@ OPTIONS --verbose:: Increase the information detail in the output. --o <format>:: ---output-format=<format>:: - Set the reporting format to 'normal', 'json', or - 'binary'. Only one output format can be used at a time. +-o <fmt>:: +--output-format=<fmt>:: + Set the reporting format to 'normal', 'json', or + 'binary'. Only one output format can be used at a time. EXAMPLES -------- diff --git a/Documentation/nvme-zns-reset-zone.1 b/Documentation/nvme-zns-reset-zone.1 index a834aee..a1cd0b4 100644 --- a/Documentation/nvme-zns-reset-zone.1 +++ b/Documentation/nvme-zns-reset-zone.1 @@ -2,12 +2,12 @@ .\" Title: nvme-zns-reset-zone .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ZNS\-RESET\-ZO" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ZNS\-RESET\-ZO" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,9 +33,9 @@ nvme-zns-reset-zone \- Resets one or all zones .sp .nf \fInvme zns reset\-zone\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] - [\-\-start\-lba=<LBA> | \-s <LBA>] - [\-\-select\-all | \-a] - [\-\-timeout=<timeout> | \-t <timeout>] + [\-\-start\-lba=<LBA> | \-s <LBA>] + [\-\-select\-all | \-a] + [\-\-timeout=<timeout> | \-t <timeout>] .fi .SH "DESCRIPTION" .sp diff --git a/Documentation/nvme-zns-reset-zone.html b/Documentation/nvme-zns-reset-zone.html index 2b3d58c..ec4b484 100644 --- a/Documentation/nvme-zns-reset-zone.html +++ b/Documentation/nvme-zns-reset-zone.html @@ -750,9 +750,9 @@ nvme-zns-reset-zone(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme zns reset-zone</em> <device> [--namespace-id=<NUM> | -n <NUM>]
- [--start-lba=<LBA> | -s <LBA>]
- [--select-all | -a]
- [--timeout=<timeout> | -t <timeout>]</pre>
+ [--start-lba=<LBA> | -s <LBA>]
+ [--select-all | -a]
+ [--timeout=<timeout> | -t <timeout>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -847,7 +847,7 @@ Reset the first zone on namespace 1: <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-zns-reset-zone.txt b/Documentation/nvme-zns-reset-zone.txt index 25d01a1..b58f276 100644 --- a/Documentation/nvme-zns-reset-zone.txt +++ b/Documentation/nvme-zns-reset-zone.txt @@ -9,9 +9,9 @@ SYNOPSIS -------- [verse] 'nvme zns reset-zone' <device> [--namespace-id=<NUM> | -n <NUM>] - [--start-lba=<LBA> | -s <LBA>] - [--select-all | -a] - [--timeout=<timeout> | -t <timeout>] + [--start-lba=<LBA> | -s <LBA>] + [--select-all | -a] + [--timeout=<timeout> | -t <timeout>] DESCRIPTION ----------- diff --git a/Documentation/nvme-zns-set-zone-desc.1 b/Documentation/nvme-zns-set-zone-desc.1 index 0721cb5..934b7ff 100644 --- a/Documentation/nvme-zns-set-zone-desc.1 +++ b/Documentation/nvme-zns-set-zone-desc.1 @@ -2,12 +2,12 @@ .\" Title: nvme-zns-set-zone-desc .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ZNS\-SET\-ZONE" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ZNS\-SET\-ZONE" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,10 +33,10 @@ nvme-zns-set-zone-desc \- Set extended descriptor data for a zone .sp .nf \fInvme zns set\-zone\-desc\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] - [\-\-start\-lba=<IONUM>, \-s <IONUM>] - [\-\-zrwaa | \-r] - [\-data=<FILE>, \-d <FILE>] - [\-\-timeout=<timeout> | \-t <timeout>] + [\-\-start\-lba=<IONUM>, \-s <IONUM>] + [\-\-zrwaa | \-r] + [\-\-data=<FILE>, \-d <FILE>] + [\-\-timeout=<timeout> | \-t <timeout>] .fi .SH "DESCRIPTION" .sp @@ -58,7 +58,7 @@ The starting LBA of the zone to manage send\&. Allocate Zone Random Write Area to zone\&. .RE .PP -\-d <FILE, \-data=<FILE> +\-d <FILE>, \-\-data=<FILE> .RS 4 Optional file for data (default stdin) .RE diff --git a/Documentation/nvme-zns-set-zone-desc.html b/Documentation/nvme-zns-set-zone-desc.html index ddf9779..181809a 100644 --- a/Documentation/nvme-zns-set-zone-desc.html +++ b/Documentation/nvme-zns-set-zone-desc.html @@ -750,10 +750,10 @@ nvme-zns-set-zone-desc(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme zns set-zone-desc</em> <device> [--namespace-id=<NUM> | -n <NUM>]
- [--start-lba=<IONUM>, -s <IONUM>]
- [--zrwaa | -r]
- [-data=<FILE>, -d <FILE>]
- [--timeout=<timeout> | -t <timeout>]</pre>
+ [--start-lba=<IONUM>, -s <IONUM>]
+ [--zrwaa | -r]
+ [--data=<FILE>, -d <FILE>]
+ [--timeout=<timeout> | -t <timeout>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -807,10 +807,10 @@ length will automatically be calculated from the zns identify namespace.</p></di </p>
</dd>
<dt class="hdlist1">
--d <FILE
+-d <FILE>
</dt>
<dt class="hdlist1">
--data=<FILE>
+--data=<FILE>
</dt>
<dd>
<p>
@@ -859,7 +859,7 @@ Write "hello world" into the zone descriptor for namespace 1’s first zone <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-zns-set-zone-desc.txt b/Documentation/nvme-zns-set-zone-desc.txt index dd759a2..3df8c4b 100644 --- a/Documentation/nvme-zns-set-zone-desc.txt +++ b/Documentation/nvme-zns-set-zone-desc.txt @@ -9,10 +9,10 @@ SYNOPSIS -------- [verse] 'nvme zns set-zone-desc' <device> [--namespace-id=<NUM> | -n <NUM>] - [--start-lba=<IONUM>, -s <IONUM>] - [--zrwaa | -r] - [-data=<FILE>, -d <FILE>] - [--timeout=<timeout> | -t <timeout>] + [--start-lba=<IONUM>, -s <IONUM>] + [--zrwaa | -r] + [--data=<FILE>, -d <FILE>] + [--timeout=<timeout> | -t <timeout>] DESCRIPTION ----------- @@ -37,8 +37,8 @@ OPTIONS --zrwaa:: Allocate Zone Random Write Area to zone. --d <FILE:: --data=<FILE>:: +-d <FILE>:: +--data=<FILE>:: Optional file for data (default stdin) -t <timeout>:: diff --git a/Documentation/nvme-zns-zone-append.1 b/Documentation/nvme-zns-zone-append.1 index 8f1a80f..0981fea 100644 --- a/Documentation/nvme-zns-zone-append.1 +++ b/Documentation/nvme-zns-zone-append.1 @@ -2,12 +2,12 @@ .\" Title: nvme-zns-zone-append .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ZNS\-ZONE\-APP" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ZNS\-ZONE\-APP" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme-zns-zone-append.html b/Documentation/nvme-zns-zone-append.html index 2dd499f..1661f6a 100644 --- a/Documentation/nvme-zns-zone-append.html +++ b/Documentation/nvme-zns-zone-append.html @@ -940,7 +940,7 @@ Append the data "hello world" into 4k worth of blocks into the zone starting <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-zns-zone-mgmt-recv.1 b/Documentation/nvme-zns-zone-mgmt-recv.1 index fcf0b65..b4682a0 100644 --- a/Documentation/nvme-zns-zone-mgmt-recv.1 +++ b/Documentation/nvme-zns-zone-mgmt-recv.1 @@ -2,12 +2,12 @@ .\" Title: nvme-zns-zone-mgmt-recv .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ZNS\-ZONE\-MGM" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ZNS\-ZONE\-MGM" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,12 +33,10 @@ nvme-zns-zone-mgmt-recv \- Zone Management Receive command .sp .nf \fInvme zns zone\-mgmt\-recv\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] - [\-\-start\-lba=<LBA> | \-s <LBA>] - [\-\-data\-len=<IONUM>, \-l <IONUM>] - [\-\-zra=<NUM>, \-z <NUM>] - [\-\-zrasf=<NUM>, \-a <NUM>] - [\-\-zra\-spec\-feat, \-f] - [\-\-output\-format=<FMT>, \-o <FMT>] + [\-\-start\-lba=<LBA> | \-s <LBA>] + [\-\-data\-len=<IONUM>, \-l <IONUM>] + [\-\-zra=<NUM>, \-z <NUM>] [\-\-zrasf=<NUM>, \-a <NUM>] + [\-\-zra\-spec\-feat, \-f] [\-\-output\-format=<fmt>, \-o <fmt>] .fi .SH "DESCRIPTION" .sp @@ -55,7 +53,7 @@ Use the provided namespace id for the command\&. If not provided, the namespace The starting LBA of the zone to manage receive\&. .RE .sp -\-\-data\-len=<NUM> \-l <NUM> Received data buffer length +\-l <NUM> \-\-data\-len=<NUM> Received data buffer length .PP \-z <NUM>, \-\-zra=<NUM> .RS 4 @@ -69,7 +67,7 @@ Zone Receive Action Enable Zone Receive Action Specific features .RE .PP -\-o <FMT>, \-\-output\-format=<FMT> +\-o <fmt>, \-\-output\-format=<fmt> .RS 4 Output format: normal|json|binary .RE diff --git a/Documentation/nvme-zns-zone-mgmt-recv.html b/Documentation/nvme-zns-zone-mgmt-recv.html index cebdb7e..e0a8675 100644 --- a/Documentation/nvme-zns-zone-mgmt-recv.html +++ b/Documentation/nvme-zns-zone-mgmt-recv.html @@ -750,12 +750,10 @@ nvme-zns-zone-mgmt-recv(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme zns zone-mgmt-recv</em> <device> [--namespace-id=<NUM> | -n <NUM>]
- [--start-lba=<LBA> | -s <LBA>]
- [--data-len=<IONUM>, -l <IONUM>]
- [--zra=<NUM>, -z <NUM>]
- [--zrasf=<NUM>, -a <NUM>]
- [--zra-spec-feat, -f]
- [--output-format=<FMT>, -o <FMT>]</pre>
+ [--start-lba=<LBA> | -s <LBA>]
+ [--data-len=<IONUM>, -l <IONUM>]
+ [--zra=<NUM>, -z <NUM>] [--zrasf=<NUM>, -a <NUM>]
+ [--zra-spec-feat, -f] [--output-format=<fmt>, -o <fmt>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -801,8 +799,8 @@ binary.</p></div> </p>
</dd>
</dl></div>
-<div class="paragraph"><p>--data-len=<NUM>
--l <NUM>
+<div class="paragraph"><p>-l <NUM>
+--data-len=<NUM>
Received data buffer length</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
@@ -833,10 +831,10 @@ binary.</p></div> </p>
</dd>
<dt class="hdlist1">
--o <FMT>
+-o <fmt>
</dt>
<dt class="hdlist1">
---output-format=<FMT>
+--output-format=<fmt>
</dt>
<dd>
<p>
@@ -882,7 +880,7 @@ Binary dump of a report all zones <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-zns-zone-mgmt-recv.txt b/Documentation/nvme-zns-zone-mgmt-recv.txt index 07cd98e..5a3e2a3 100644 --- a/Documentation/nvme-zns-zone-mgmt-recv.txt +++ b/Documentation/nvme-zns-zone-mgmt-recv.txt @@ -9,12 +9,10 @@ SYNOPSIS -------- [verse] 'nvme zns zone-mgmt-recv' <device> [--namespace-id=<NUM> | -n <NUM>] - [--start-lba=<LBA> | -s <LBA>] - [--data-len=<IONUM>, -l <IONUM>] - [--zra=<NUM>, -z <NUM>] - [--zrasf=<NUM>, -a <NUM>] - [--zra-spec-feat, -f] - [--output-format=<FMT>, -o <FMT>] + [--start-lba=<LBA> | -s <LBA>] + [--data-len=<IONUM>, -l <IONUM>] + [--zra=<NUM>, -z <NUM>] [--zrasf=<NUM>, -a <NUM>] + [--zra-spec-feat, -f] [--output-format=<fmt>, -o <fmt>] DESCRIPTION ----------- @@ -38,8 +36,8 @@ OPTIONS --start-lba=<lba>:: The starting LBA of the zone to manage receive. ---data-len=<NUM> -l <NUM> +--data-len=<NUM> Received data buffer length -z <NUM>:: @@ -54,8 +52,8 @@ OPTIONS --zra-spec-feat:: Enable Zone Receive Action Specific features --o <FMT>:: ---output-format=<FMT>:: +-o <fmt>:: +--output-format=<fmt>:: Output format: normal|json|binary EXAMPLES diff --git a/Documentation/nvme-zns-zone-mgmt-send.1 b/Documentation/nvme-zns-zone-mgmt-send.1 index d67fb06..b152f47 100644 --- a/Documentation/nvme-zns-zone-mgmt-send.1 +++ b/Documentation/nvme-zns-zone-mgmt-send.1 @@ -2,12 +2,12 @@ .\" Title: nvme-zns-zone-mgmt-send .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME\-ZNS\-ZONE\-MGM" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME\-ZNS\-ZONE\-MGM" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,13 +33,11 @@ nvme-zns-zone-mgmt-send \- Zone Management Send command .sp .nf \fInvme zns zone\-mgmt\-send\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>] - [\-\-start\-lba=<IONUM>, \-s <IONUM>] - [\-\-zsaso, \-o] - [\-\-select\-all, \-a] - [\-\-zsa=<NUM>, \-z <NUM>] - [\-\-data\-len=<IONUM>, \-l <IONUM>] - [\-\-data=<FILE>, \-d <FILE>] - [\-\-timeout=<timeout> | \-t <timeout>] + [\-\-start\-lba=<IONUM>, \-s <IONUM>] [\-\-zsaso, \-o] + [\-\-select\-all, \-a] [\-\-zsa=<NUM>, \-z <NUM>] + [\-\-data\-len=<IONUM>, \-l <IONUM>] + [\-\-data=<FILE>, \-d <FILE>] + [\-\-timeout=<timeout> | \-t <timeout>] .fi .SH "DESCRIPTION" .sp @@ -66,7 +64,7 @@ Send data buffer length Zone Send Action Specific Option .RE .PP -\-\-select\-all, \-a +\-a, \-\-select\-all .RS 4 Send command to all zones .RE @@ -81,7 +79,7 @@ Zone send action\&. Buffer length if data required .RE .PP -\-d <FILE, \-\-data=<FILE> +\-d <FILE>, \-\-data=<FILE> .RS 4 Optional file for data (default stdin) .RE diff --git a/Documentation/nvme-zns-zone-mgmt-send.html b/Documentation/nvme-zns-zone-mgmt-send.html index 424c2ff..9b92844 100644 --- a/Documentation/nvme-zns-zone-mgmt-send.html +++ b/Documentation/nvme-zns-zone-mgmt-send.html @@ -750,13 +750,11 @@ nvme-zns-zone-mgmt-send(1) Manual Page <div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>nvme zns zone-mgmt-send</em> <device> [--namespace-id=<NUM> | -n <NUM>]
- [--start-lba=<IONUM>, -s <IONUM>]
- [--zsaso, -o]
- [--select-all, -a]
- [--zsa=<NUM>, -z <NUM>]
- [--data-len=<IONUM>, -l <IONUM>]
- [--data=<FILE>, -d <FILE>]
- [--timeout=<timeout> | -t <timeout>]</pre>
+ [--start-lba=<IONUM>, -s <IONUM>] [--zsaso, -o]
+ [--select-all, -a] [--zsa=<NUM>, -z <NUM>]
+ [--data-len=<IONUM>, -l <IONUM>]
+ [--data=<FILE>, -d <FILE>]
+ [--timeout=<timeout> | -t <timeout>]</pre>
<div class="attribution">
</div></div>
</div>
@@ -821,10 +819,10 @@ Alternatively, the data may come from a file that can be specified.</p></div> </p>
</dd>
<dt class="hdlist1">
---select-all
+-a
</dt>
<dt class="hdlist1">
--a
+--select-all
</dt>
<dd>
<p>
@@ -854,7 +852,7 @@ Alternatively, the data may come from a file that can be specified.</p></div> </p>
</dd>
<dt class="hdlist1">
--d <FILE
+-d <FILE>
</dt>
<dt class="hdlist1">
--data=<FILE>
@@ -916,7 +914,7 @@ Write "hello world" into the zone descriptor for namespace 1’s first zone <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
diff --git a/Documentation/nvme-zns-zone-mgmt-send.txt b/Documentation/nvme-zns-zone-mgmt-send.txt index 8cbb5c0..3803d27 100644 --- a/Documentation/nvme-zns-zone-mgmt-send.txt +++ b/Documentation/nvme-zns-zone-mgmt-send.txt @@ -9,13 +9,11 @@ SYNOPSIS -------- [verse] 'nvme zns zone-mgmt-send' <device> [--namespace-id=<NUM> | -n <NUM>] - [--start-lba=<IONUM>, -s <IONUM>] - [--zsaso, -o] - [--select-all, -a] - [--zsa=<NUM>, -z <NUM>] - [--data-len=<IONUM>, -l <IONUM>] - [--data=<FILE>, -d <FILE>] - [--timeout=<timeout> | -t <timeout>] + [--start-lba=<IONUM>, -s <IONUM>] [--zsaso, -o] + [--select-all, -a] [--zsa=<NUM>, -z <NUM>] + [--data-len=<IONUM>, -l <IONUM>] + [--data=<FILE>, -d <FILE>] + [--timeout=<timeout> | -t <timeout>] DESCRIPTION ----------- @@ -44,8 +42,8 @@ OPTIONS --zsaso:: Zone Send Action Specific Option ---select-all:: -a:: +--select-all:: Send command to all zones -z <NUM>:: @@ -56,7 +54,7 @@ OPTIONS --data-len=<IONUM>:: Buffer length if data required --d <FILE:: +-d <FILE>:: --data=<FILE>:: Optional file for data (default stdin) diff --git a/Documentation/nvme-zns-zrwa-flush-zone.txt b/Documentation/nvme-zns-zrwa-flush-zone.txt index 4f3e72c..e8f61ed 100644 --- a/Documentation/nvme-zns-zrwa-flush-zone.txt +++ b/Documentation/nvme-zns-zrwa-flush-zone.txt @@ -9,8 +9,8 @@ SYNOPSIS -------- [verse] 'nvme zns zrwa-flush-zone' <device> [--namespace-id=<NUM> | -n <NUM>] - [--lba=<LBA> | -l <LBA>] - [--timeout=<timeout> | -t <timeout> ] + [--lba=<LBA> | -l <LBA>] + [--timeout=<timeout> | -t <timeout>] DESCRIPTION ----------- diff --git a/Documentation/nvme.1 b/Documentation/nvme.1 index 3e0043c..b114bf1 100644 --- a/Documentation/nvme.1 +++ b/Documentation/nvme.1 @@ -2,12 +2,12 @@ .\" Title: nvme .\" Author: [see the "Authors" section] .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> -.\" Date: 06/30/2023 +.\" Date: 12/21/2023 .\" Manual: NVMe Manual .\" Source: NVMe .\" Language: English .\" -.TH "NVME" "1" "06/30/2023" "NVMe" "NVMe Manual" +.TH "NVME" "1" "12/21/2023" "NVMe" "NVMe Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/Documentation/nvme.html b/Documentation/nvme.html index 9ab55c8..eaedf0e 100644 --- a/Documentation/nvme.html +++ b/Documentation/nvme.html @@ -2114,7 +2114,7 @@ NVM-Express Site</a>.</p></div> <div id="footer">
<div id="footer-text">
Last updated
- 2023-06-30 15:20:22 CEST
+ 2023-12-21 15:49:29 CET
</div>
</div>
</body>
@@ -54,3 +54,11 @@ rpm: debug: meson ${BUILD-DIR} --buildtype=debug ninja -C ${BUILD-DIR} + +.PHONY: static +static: + meson ${BUILD-DIR} --buildtype=release \ + --default-library=static -Dc_link_args="-static" \ + --wrap-mode=forcefallback \ + -Dlibnvme:tests=false -Dlibnvme:keyutils=disabled + ninja -C ${BUILD-DIR} @@ -1,13 +1,24 @@ # nvme-cli ![Coverity Scan Build Status](https://scan.coverity.com/projects/24883/badge.svg) -![MesonBuild](https://github.com/linux-nvme/nvme-cli/actions/workflows/meson.yml/badge.svg) +![MesonBuild](https://github.com/linux-nvme/nvme-cli/actions/workflows/build.yml/badge.svg) ![GitHub](https://img.shields.io/github/license/linux-nvme/nvme-cli) NVM-Express user space tooling for Linux. ## Build from source -nvme-cli uses meson as build system. +nvme-cli uses meson as build system. There is more than one way to configure and +build the project in order to mitigate meson dependency on the build +environment. + +If you build on a relative modern system, either use meson directly or the +Makefile wrapper. + +Older distros might ship a too old version of meson, in this case it's possible +to build the project using [samurai](https://github.com/michaelforney/samurai) +and [muon](https://github.com/annacrombie/muon). Both build tools have only a +minimal dependency on the build environment. Too easy this step there is a build +script which helps to setup a build environment. ### nvme-cli dependencies: @@ -15,10 +26,11 @@ nvme-cli uses meson as build system. |---------|------------|-------| | libnvme, libnvme-mi| yes | be either installed or included into the build via meson fallback feature | | json-c | optional | recommended, without all plugins are disabled and json-c output format is disabled | - | libhugetblfs | optional | adds support for hugetblfs | -### Configuring +### Build with meson + +#### Configuring In case libnvme is not installed on the system, it possible to use meson's fallback feature to resolve the dependency. @@ -37,15 +49,42 @@ dependencies should also resolved or not. The options are Note for nvme-cli the 'default' is set to nofallback. -### Building +#### Building $ meson compile -C .build -### Installing +#### Installing # meson install -C .build + +### Build with build.sh wrapper + +The `scripts/build.sh` is used for the CI build but can also be used for +configuring and building the project. + +Running `scripts/build.sh` without any argument builds the project in the +default configuration (meson, gcc and defaults) + +It's possible to change the compiler to clang + +`scripts/builds.sh -c clang` + +or enabling all the fallbacks + +`scripts/build.sh fallback` -### Makefile wrapper +### Minimal static build with muon + +`scripts/build.sh -m muon` will download and build `samurai` and `muon` instead +using `meson` to build the project. This reduces the dependency on the build +environment to: +- gcc +- make +- git + +Furthermore, this configuration will produce a static binary. + +### Build with Makefile wrapper There is a Makefile wrapper for meson for backwards compatibility @@ -58,6 +97,10 @@ RPM build support via Makefile that uses meson $ make rpm +Static binary(no dependency) build support via Makefile that uses meson + + $ make static + If not sure how to use, find the top-level documentation with: $ man nvme @@ -65,7 +108,7 @@ If not sure how to use, find the top-level documentation with: Or find a short summary with: $ nvme help - + ## Distro Support Many popular distributions (Alpine, Arch, Debian, Fedora, FreeBSD, Gentoo, @@ -251,7 +294,7 @@ global resources among various components. For example, when executing `blktests` for the FC transport, the `nvme-cli` udev rules can be triggered. To prevent interference with a test, `blktests` can create a JSON configuration file in `/run/nvme` to inform `nvme-cli` that it should not perform any actions -trigged from the udev context. This behavior can be controlled using the +triggered from the udev context. This behavior can be controlled using the `--context` argument. For example a `blktests` volatile configuration could look like: @@ -283,3 +326,10 @@ a an atomic way. For example create a temporary file without the `.json` file extension in `/run/nvme` and write the contents to this file. When finished use `rename` to add the `'.json'` file name extension. This ensures nvme-cli only sees the complete file. + +## Testing + +For testing purposes a x86_64 AppImage is build from the current HEAD and is +available here: + +https://monom.org/linux-nvme/upload/AppImage/nvme-cli-latest-x86_64.AppImage diff --git a/ccan/ccan/build_assert/_info b/ccan/ccan/build_assert/_info deleted file mode 100644 index 97ebe6c..0000000 --- a/ccan/ccan/build_assert/_info +++ /dev/null @@ -1,49 +0,0 @@ -#include "config.h" -#include <stdio.h> -#include <string.h> - -/** - * build_assert - routines for build-time assertions - * - * This code provides routines which will cause compilation to fail should some - * assertion be untrue: such failures are preferable to run-time assertions, - * but much more limited since they can only depends on compile-time constants. - * - * These assertions are most useful when two parts of the code must be kept in - * sync: it is better to avoid such cases if possible, but seconds best is to - * detect invalid changes at build time. - * - * For example, a tricky piece of code might rely on a certain element being at - * the start of the structure. To ensure that future changes don't break it, - * you would catch such changes in your code like so: - * - * Example: - * #include <stddef.h> - * #include <ccan/build_assert/build_assert.h> - * - * struct foo { - * char string[5]; - * int x; - * }; - * - * static char *foo_string(struct foo *foo) - * { - * // This trick requires that the string be first in the structure - * BUILD_ASSERT(offsetof(struct foo, string) == 0); - * return (char *)foo; - * } - * - * License: CC0 (Public domain) - * Author: Rusty Russell <rusty@rustcorp.com.au> - */ -int main(int argc, char *argv[]) -{ - if (argc != 2) - return 1; - - if (strcmp(argv[1], "depends") == 0) - /* Nothing. */ - return 0; - - return 1; -} diff --git a/ccan/ccan/check_type/_info b/ccan/ccan/check_type/_info deleted file mode 100644 index cc42673..0000000 --- a/ccan/ccan/check_type/_info +++ /dev/null @@ -1,33 +0,0 @@ -#include "config.h" -#include <stdio.h> -#include <string.h> - -/** - * check_type - routines for compile time type checking - * - * C has fairly weak typing: ints get automatically converted to longs, signed - * to unsigned, etc. There are some cases where this is best avoided, and - * these macros provide methods for evoking warnings (or build errors) when - * a precise type isn't used. - * - * On compilers which don't support typeof() these routines are less effective, - * since they have to use sizeof() which can only distiguish between types of - * different size. - * - * License: CC0 (Public domain) - * Author: Rusty Russell <rusty@rustcorp.com.au> - */ -int main(int argc, char *argv[]) -{ - if (argc != 2) - return 1; - - if (strcmp(argv[1], "depends") == 0) { -#if !HAVE_TYPEOF - printf("ccan/build_assert\n"); -#endif - return 0; - } - - return 1; -} diff --git a/ccan/ccan/compiler/LICENSE b/ccan/ccan/compiler/LICENSE new file mode 120000 index 0000000..b7951da --- /dev/null +++ b/ccan/ccan/compiler/LICENSE @@ -0,0 +1 @@ +../../licenses/CC0
\ No newline at end of file diff --git a/ccan/ccan/compiler/compiler.h b/ccan/ccan/compiler/compiler.h new file mode 100644 index 0000000..562b29e --- /dev/null +++ b/ccan/ccan/compiler/compiler.h @@ -0,0 +1,317 @@ +/* CC0 (Public domain) - see LICENSE file for details */ +#ifndef CCAN_COMPILER_H +#define CCAN_COMPILER_H +#include "config.h" + +#ifndef COLD +#if HAVE_ATTRIBUTE_COLD +/** + * COLD - a function is unlikely to be called. + * + * Used to mark an unlikely code path and optimize appropriately. + * It is usually used on logging or error routines. + * + * Example: + * static void COLD moan(const char *reason) + * { + * fprintf(stderr, "Error: %s (%s)\n", reason, strerror(errno)); + * } + */ +#define COLD __attribute__((__cold__)) +#else +#define COLD +#endif +#endif + +#ifndef NORETURN +#if HAVE_ATTRIBUTE_NORETURN +/** + * NORETURN - a function does not return + * + * Used to mark a function which exits; useful for suppressing warnings. + * + * Example: + * static void NORETURN fail(const char *reason) + * { + * fprintf(stderr, "Error: %s (%s)\n", reason, strerror(errno)); + * exit(1); + * } + */ +#define NORETURN __attribute__((__noreturn__)) +#else +#define NORETURN +#endif +#endif + +#ifndef PRINTF_FMT +#if HAVE_ATTRIBUTE_PRINTF +/** + * PRINTF_FMT - a function takes printf-style arguments + * @nfmt: the 1-based number of the function's format argument. + * @narg: the 1-based number of the function's first variable argument. + * + * This allows the compiler to check your parameters as it does for printf(). + * + * Example: + * void PRINTF_FMT(2,3) my_printf(const char *prefix, const char *fmt, ...); + */ +#define PRINTF_FMT(nfmt, narg) \ + __attribute__((format(__printf__, nfmt, narg))) +#else +#define PRINTF_FMT(nfmt, narg) +#endif +#endif + +#ifndef CONST_FUNCTION +#if HAVE_ATTRIBUTE_CONST +/** + * CONST_FUNCTION - a function's return depends only on its argument + * + * This allows the compiler to assume that the function will return the exact + * same value for the exact same arguments. This implies that the function + * must not use global variables, or dereference pointer arguments. + */ +#define CONST_FUNCTION __attribute__((__const__)) +#else +#define CONST_FUNCTION +#endif + +#ifndef PURE_FUNCTION +#if HAVE_ATTRIBUTE_PURE +/** + * PURE_FUNCTION - a function is pure + * + * A pure function is one that has no side effects other than it's return value + * and uses no inputs other than it's arguments and global variables. + */ +#define PURE_FUNCTION __attribute__((__pure__)) +#else +#define PURE_FUNCTION +#endif +#endif +#endif + +#if HAVE_ATTRIBUTE_UNUSED +#ifndef UNNEEDED +/** + * UNNEEDED - a variable/function may not be needed + * + * This suppresses warnings about unused variables or functions, but tells + * the compiler that if it is unused it need not emit it into the source code. + * + * Example: + * // With some preprocessor options, this is unnecessary. + * static UNNEEDED int counter; + * + * // With some preprocessor options, this is unnecessary. + * static UNNEEDED void add_to_counter(int add) + * { + * counter += add; + * } + */ +#define UNNEEDED __attribute__((__unused__)) +#endif + +#ifndef NEEDED +#if HAVE_ATTRIBUTE_USED +/** + * NEEDED - a variable/function is needed + * + * This suppresses warnings about unused variables or functions, but tells + * the compiler that it must exist even if it (seems) unused. + * + * Example: + * // Even if this is unused, these are vital for debugging. + * static NEEDED int counter; + * static NEEDED void dump_counter(void) + * { + * printf("Counter is %i\n", counter); + * } + */ +#define NEEDED __attribute__((__used__)) +#else +/* Before used, unused functions and vars were always emitted. */ +#define NEEDED __attribute__((__unused__)) +#endif +#endif + +#ifndef UNUSED +/** + * UNUSED - a parameter is unused + * + * Some compilers (eg. gcc with -W or -Wunused) warn about unused + * function parameters. This suppresses such warnings and indicates + * to the reader that it's deliberate. + * + * Example: + * // This is used as a callback, so needs to have this prototype. + * static int some_callback(void *unused UNUSED) + * { + * return 0; + * } + */ +#define UNUSED __attribute__((__unused__)) +#endif +#else +#ifndef UNNEEDED +#define UNNEEDED +#endif +#ifndef NEEDED +#define NEEDED +#endif +#ifndef UNUSED +#define UNUSED +#endif +#endif + +#ifndef IS_COMPILE_CONSTANT +#if HAVE_BUILTIN_CONSTANT_P +/** + * IS_COMPILE_CONSTANT - does the compiler know the value of this expression? + * @expr: the expression to evaluate + * + * When an expression manipulation is complicated, it is usually better to + * implement it in a function. However, if the expression being manipulated is + * known at compile time, it is better to have the compiler see the entire + * expression so it can simply substitute the result. + * + * This can be done using the IS_COMPILE_CONSTANT() macro. + * + * Example: + * enum greek { ALPHA, BETA, GAMMA, DELTA, EPSILON }; + * + * // Out-of-line version. + * const char *greek_name(enum greek greek); + * + * // Inline version. + * static inline const char *_greek_name(enum greek greek) + * { + * switch (greek) { + * case ALPHA: return "alpha"; + * case BETA: return "beta"; + * case GAMMA: return "gamma"; + * case DELTA: return "delta"; + * case EPSILON: return "epsilon"; + * default: return "**INVALID**"; + * } + * } + * + * // Use inline if compiler knows answer. Otherwise call function + * // to avoid copies of the same code everywhere. + * #define greek_name(g) \ + * (IS_COMPILE_CONSTANT(greek) ? _greek_name(g) : greek_name(g)) + */ +#define IS_COMPILE_CONSTANT(expr) __builtin_constant_p(expr) +#else +/* If we don't know, assume it's not. */ +#define IS_COMPILE_CONSTANT(expr) 0 +#endif +#endif + +#ifndef WARN_UNUSED_RESULT +#if HAVE_WARN_UNUSED_RESULT +/** + * WARN_UNUSED_RESULT - warn if a function return value is unused. + * + * Used to mark a function where it is extremely unlikely that the caller + * can ignore the result, eg realloc(). + * + * Example: + * // buf param may be freed by this; need return value! + * static char *WARN_UNUSED_RESULT enlarge(char *buf, unsigned *size) + * { + * return realloc(buf, (*size) *= 2); + * } + */ +#define WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) +#else +#define WARN_UNUSED_RESULT +#endif +#endif + + +#if HAVE_ATTRIBUTE_DEPRECATED +/** + * WARN_DEPRECATED - warn that a function/type/variable is deprecated when used. + * + * Used to mark a function, type or variable should not be used. + * + * Example: + * WARN_DEPRECATED char *oldfunc(char *buf); + */ +#define WARN_DEPRECATED __attribute__((__deprecated__)) +#else +#define WARN_DEPRECATED +#endif + + +#if HAVE_ATTRIBUTE_NONNULL +/** + * NO_NULL_ARGS - specify that no arguments to this function can be NULL. + * + * The compiler will warn if any pointer args are NULL. + * + * Example: + * NO_NULL_ARGS char *my_copy(char *buf); + */ +#define NO_NULL_ARGS __attribute__((__nonnull__)) + +/** + * NON_NULL_ARGS - specify that some arguments to this function can't be NULL. + * @...: 1-based argument numbers for which args can't be NULL. + * + * The compiler will warn if any of the specified pointer args are NULL. + * + * Example: + * char *my_copy2(char *buf, char *maybenull) NON_NULL_ARGS(1); + */ +#define NON_NULL_ARGS(...) __attribute__((__nonnull__(__VA_ARGS__))) +#else +#define NO_NULL_ARGS +#define NON_NULL_ARGS(...) +#endif + +#if HAVE_ATTRIBUTE_RETURNS_NONNULL +/** + * RETURNS_NONNULL - specify that this function cannot return NULL. + * + * Mainly an optimization opportunity, but can also suppress warnings. + * + * Example: + * RETURNS_NONNULL char *my_copy(char *buf); + */ +#define RETURNS_NONNULL __attribute__((__returns_nonnull__)) +#else +#define RETURNS_NONNULL +#endif + +#if HAVE_ATTRIBUTE_SENTINEL +/** + * LAST_ARG_NULL - specify the last argument of a variadic function must be NULL. + * + * The compiler will warn if the last argument isn't NULL. + * + * Example: + * char *join_string(char *buf, ...) LAST_ARG_NULL; + */ +#define LAST_ARG_NULL __attribute__((__sentinel__)) +#else +#define LAST_ARG_NULL +#endif + +#if HAVE_BUILTIN_CPU_SUPPORTS +/** + * cpu_supports - test if current CPU supports the named feature. + * + * This takes a literal string, and currently only works on glibc platforms. + * + * Example: + * if (cpu_supports("mmx")) + * printf("MMX support engaged!\n"); + */ +#define cpu_supports(x) __builtin_cpu_supports(x) +#else +#define cpu_supports(x) 0 +#endif /* HAVE_BUILTIN_CPU_SUPPORTS */ + +#endif /* CCAN_COMPILER_H */ diff --git a/ccan/ccan/container_of/_info b/ccan/ccan/container_of/_info deleted file mode 100644 index b116052..0000000 --- a/ccan/ccan/container_of/_info +++ /dev/null @@ -1,65 +0,0 @@ -#include "config.h" -#include <stdio.h> -#include <string.h> - -/** - * container_of - routine for upcasting - * - * It is often convenient to create code where the caller registers a pointer - * to a generic structure and a callback. The callback might know that the - * pointer points to within a larger structure, and container_of gives a - * convenient and fairly type-safe way of returning to the enclosing structure. - * - * This idiom is an alternative to providing a void * pointer for every - * callback. - * - * Example: - * #include <stdio.h> - * #include <ccan/container_of/container_of.h> - * - * struct timer { - * void *members; - * }; - * - * struct info { - * int my_stuff; - * struct timer timer; - * }; - * - * static void my_timer_callback(struct timer *timer) - * { - * struct info *info = container_of(timer, struct info, timer); - * printf("my_stuff is %u\n", info->my_stuff); - * } - * - * static void register_timer(struct timer *timer) - * { - * (void)timer; - * (void)my_timer_callback; - * //... - * } - * - * int main(void) - * { - * struct info info = { .my_stuff = 1 }; - * - * register_timer(&info.timer); - * // ... - * return 0; - * } - * - * License: CC0 (Public domain) - * Author: Rusty Russell <rusty@rustcorp.com.au> - */ -int main(int argc, char *argv[]) -{ - if (argc != 2) - return 1; - - if (strcmp(argv[1], "depends") == 0) { - printf("ccan/check_type\n"); - return 0; - } - - return 1; -} diff --git a/ccan/ccan/endian/_info b/ccan/ccan/endian/_info deleted file mode 100644 index efe5a8b..0000000 --- a/ccan/ccan/endian/_info +++ /dev/null @@ -1,55 +0,0 @@ -#include "config.h" -#include <stdio.h> -#include <string.h> - -/** - * endian - endian conversion macros for simple types - * - * Portable protocols (such as on-disk formats, or network protocols) - * are often defined to be a particular endian: little-endian (least - * significant bytes first) or big-endian (most significant bytes - * first). - * - * Similarly, some CPUs lay out values in memory in little-endian - * order (most commonly, Intel's 8086 and derivatives), or big-endian - * order (almost everyone else). - * - * This module provides conversion routines, inspired by the linux kernel. - * It also provides leint32_t, beint32_t etc typedefs, which are annotated for - * the sparse checker. - * - * Example: - * #include <stdio.h> - * #include <err.h> - * #include <ccan/endian/endian.h> - * - * // - * int main(int argc, char *argv[]) - * { - * uint32_t value; - * - * if (argc != 2) - * errx(1, "Usage: %s <value>", argv[0]); - * - * value = atoi(argv[1]); - * printf("native: %08x\n", value); - * printf("little-endian: %08x\n", cpu_to_le32(value)); - * printf("big-endian: %08x\n", cpu_to_be32(value)); - * printf("byte-reversed: %08x\n", bswap_32(value)); - * exit(0); - * } - * - * License: License: CC0 (Public domain) - * Author: Rusty Russell <rusty@rustcorp.com.au> - */ -int main(int argc, char *argv[]) -{ - if (argc != 2) - return 1; - - if (strcmp(argv[1], "depends") == 0) - /* Nothing */ - return 0; - - return 1; -} diff --git a/ccan/ccan/hash/LICENSE b/ccan/ccan/hash/LICENSE new file mode 120000 index 0000000..b7951da --- /dev/null +++ b/ccan/ccan/hash/LICENSE @@ -0,0 +1 @@ +../../licenses/CC0
\ No newline at end of file diff --git a/ccan/ccan/hash/hash.c b/ccan/ccan/hash/hash.c new file mode 100644 index 0000000..88d88fc --- /dev/null +++ b/ccan/ccan/hash/hash.c @@ -0,0 +1,926 @@ +/* CC0 (Public domain) - see LICENSE file for details */ +/* +------------------------------------------------------------------------------- +lookup3.c, by Bob Jenkins, May 2006, Public Domain. + +These are functions for producing 32-bit hashes for hash table lookup. +hash_word(), hashlittle(), hashlittle2(), hashbig(), mix(), and final() +are externally useful functions. Routines to test the hash are included +if SELF_TEST is defined. You can use this free for any purpose. It's in +the public domain. It has no warranty. + +You probably want to use hashlittle(). hashlittle() and hashbig() +hash byte arrays. hashlittle() is is faster than hashbig() on +little-endian machines. Intel and AMD are little-endian machines. +On second thought, you probably want hashlittle2(), which is identical to +hashlittle() except it returns two 32-bit hashes for the price of one. +You could implement hashbig2() if you wanted but I haven't bothered here. + +If you want to find a hash of, say, exactly 7 integers, do + a = i1; b = i2; c = i3; + mix(a,b,c); + a += i4; b += i5; c += i6; + mix(a,b,c); + a += i7; + final(a,b,c); +then use c as the hash value. If you have a variable length array of +4-byte integers to hash, use hash_word(). If you have a byte array (like +a character string), use hashlittle(). If you have several byte arrays, or +a mix of things, see the comments above hashlittle(). + +Why is this so big? I read 12 bytes at a time into 3 4-byte integers, +then mix those integers. This is fast (you can do a lot more thorough +mixing with 12*3 instructions on 3 integers than you can with 3 instructions +on 1 byte), but shoehorning those bytes into integers efficiently is messy. +------------------------------------------------------------------------------- +*/ +//#define SELF_TEST 1 + +#if 0 +#include <stdio.h> /* defines printf for tests */ +#include <time.h> /* defines time_t for timings in the test */ +#include <stdint.h> /* defines uint32_t etc */ +#include <sys/param.h> /* attempt to define endianness */ + +#ifdef linux +# include <endian.h> /* attempt to define endianness */ +#endif + +/* + * My best guess at if you are big-endian or little-endian. This may + * need adjustment. + */ +#if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \ + __BYTE_ORDER == __LITTLE_ENDIAN) || \ + (defined(i386) || defined(__i386__) || defined(__i486__) || \ + defined(__i586__) || defined(__i686__) || defined(__x86_64) || \ + defined(vax) || defined(MIPSEL)) +# define HASH_LITTLE_ENDIAN 1 +# define HASH_BIG_ENDIAN 0 +#elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \ + __BYTE_ORDER == __BIG_ENDIAN) || \ + (defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel)) +# define HASH_LITTLE_ENDIAN 0 +# define HASH_BIG_ENDIAN 1 +#else +# error Unknown endian +#endif +#endif /* old hash.c headers. */ + +#include "hash.h" + +#if HAVE_LITTLE_ENDIAN +#define HASH_LITTLE_ENDIAN 1 +#define HASH_BIG_ENDIAN 0 +#elif HAVE_BIG_ENDIAN +#define HASH_LITTLE_ENDIAN 0 +#define HASH_BIG_ENDIAN 1 +#else +#error Unknown endian +#endif + +#define hashsize(n) ((uint32_t)1<<(n)) +#define hashmask(n) (hashsize(n)-1) +#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) + +/* +------------------------------------------------------------------------------- +mix -- mix 3 32-bit values reversibly. + +This is reversible, so any information in (a,b,c) before mix() is +still in (a,b,c) after mix(). + +If four pairs of (a,b,c) inputs are run through mix(), or through +mix() in reverse, there are at least 32 bits of the output that +are sometimes the same for one pair and different for another pair. +This was tested for: +* pairs that differed by one bit, by two bits, in any combination + of top bits of (a,b,c), or in any combination of bottom bits of + (a,b,c). +* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed + the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + is commonly produced by subtraction) look like a single 1-bit + difference. +* the base values were pseudorandom, all zero but one bit set, or + all zero plus a counter that starts at zero. + +Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that +satisfy this are + 4 6 8 16 19 4 + 9 15 3 18 27 15 + 14 9 3 7 17 3 +Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing +for "differ" defined as + with a one-bit base and a two-bit delta. I +used http://burtleburtle.net/bob/hash/avalanche.html to choose +the operations, constants, and arrangements of the variables. + +This does not achieve avalanche. There are input bits of (a,b,c) +that fail to affect some output bits of (a,b,c), especially of a. The +most thoroughly mixed value is c, but it doesn't really even achieve +avalanche in c. + +This allows some parallelism. Read-after-writes are good at doubling +the number of bits affected, so the goal of mixing pulls in the opposite +direction as the goal of parallelism. I did what I could. Rotates +seem to cost as much as shifts on every machine I could lay my hands +on, and rotates are much kinder to the top and bottom bits, so I used +rotates. +------------------------------------------------------------------------------- +*/ +#define mix(a,b,c) \ +{ \ + a -= c; a ^= rot(c, 4); c += b; \ + b -= a; b ^= rot(a, 6); a += c; \ + c -= b; c ^= rot(b, 8); b += a; \ + a -= c; a ^= rot(c,16); c += b; \ + b -= a; b ^= rot(a,19); a += c; \ + c -= b; c ^= rot(b, 4); b += a; \ +} + +/* +------------------------------------------------------------------------------- +final -- final mixing of 3 32-bit values (a,b,c) into c + +Pairs of (a,b,c) values differing in only a few bits will usually +produce values of c that look totally different. This was tested for +* pairs that differed by one bit, by two bits, in any combination + of top bits of (a,b,c), or in any combination of bottom bits of + (a,b,c). +* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed + the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + is commonly produced by subtraction) look like a single 1-bit + difference. +* the base values were pseudorandom, all zero but one bit set, or + all zero plus a counter that starts at zero. + +These constants passed: + 14 11 25 16 4 14 24 + 12 14 25 16 4 14 24 +and these came close: + 4 8 15 26 3 22 24 + 10 8 15 26 3 22 24 + 11 8 15 26 3 22 24 +------------------------------------------------------------------------------- +*/ +#define final(a,b,c) \ +{ \ + c ^= b; c -= rot(b,14); \ + a ^= c; a -= rot(c,11); \ + b ^= a; b -= rot(a,25); \ + c ^= b; c -= rot(b,16); \ + a ^= c; a -= rot(c,4); \ + b ^= a; b -= rot(a,14); \ + c ^= b; c -= rot(b,24); \ +} + +/* +-------------------------------------------------------------------- + This works on all machines. To be useful, it requires + -- that the key be an array of uint32_t's, and + -- that the length be the number of uint32_t's in the key + + The function hash_word() is identical to hashlittle() on little-endian + machines, and identical to hashbig() on big-endian machines, + except that the length has to be measured in uint32_ts rather than in + bytes. hashlittle() is more complicated than hash_word() only because + hashlittle() has to dance around fitting the key bytes into registers. +-------------------------------------------------------------------- +*/ +uint32_t hash_u32( +const uint32_t *k, /* the key, an array of uint32_t values */ +size_t length, /* the length of the key, in uint32_ts */ +uint32_t initval) /* the previous hash, or an arbitrary value */ +{ + uint32_t a,b,c; + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + (((uint32_t)length)<<2) + initval; + + /*------------------------------------------------- handle most of the key */ + while (length > 3) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 3; + k += 3; + } + + /*------------------------------------------- handle the last 3 uint32_t's */ + switch(length) /* all the case statements fall through */ + { + case 3 : c+=k[2]; + case 2 : b+=k[1]; + case 1 : a+=k[0]; + final(a,b,c); + case 0: /* case 0: nothing left to add */ + break; + } + /*------------------------------------------------------ report the result */ + return c; +} + +/* +------------------------------------------------------------------------------- +hashlittle() -- hash a variable-length key into a 32-bit value + k : the key (the unaligned variable-length array of bytes) + length : the length of the key, counting by bytes + val2 : IN: can be any 4-byte value OUT: second 32 bit hash. +Returns a 32-bit value. Every bit of the key affects every bit of +the return value. Two keys differing by one or two bits will have +totally different hash values. Note that the return value is better +mixed than val2, so use that first. + +The best hash table sizes are powers of 2. There is no need to do +mod a prime (mod is sooo slow!). If you need less than 32 bits, +use a bitmask. For example, if you need only 10 bits, do + h = (h & hashmask(10)); +In which case, the hash table should have hashsize(10) elements. + +If you are hashing n strings (uint8_t **)k, do it like this: + for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h); + +By Bob Jenkins, 2006. bob_jenkins@burtleburtle.net. You may use this +code any way you wish, private, educational, or commercial. It's free. + +Use for hash table lookup, or anything where one collision in 2^^32 is +acceptable. Do NOT use for cryptographic purposes. +------------------------------------------------------------------------------- +*/ + +static uint32_t hashlittle( const void *key, size_t length, uint32_t *val2 ) +{ + uint32_t a,b,c; /* internal state */ + union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */ + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + ((uint32_t)length) + *val2; + + u.ptr = key; + if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) { + const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ + const uint8_t *k8; + + /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ + while (length > 12) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 12; + k += 3; + } + + /*----------------------------- handle the last (probably partial) block */ + /* + * "k[2]&0xffffff" actually reads beyond the end of the string, but + * then masks off the part it's not allowed to read. Because the + * string is aligned, the masked-off tail is in the same word as the + * rest of the string. Every machine with memory protection I've seen + * does it on word boundaries, so is OK with this. But VALGRIND will + * still catch it and complain. The masking trick does make the hash + * noticeably faster for short strings (like English words). + * + * Not on my testing with gcc 4.5 on an intel i5 CPU, at least --RR. + */ +#if 0 + switch(length) + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; + case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; + case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=k[1]&0xffffff; a+=k[0]; break; + case 6 : b+=k[1]&0xffff; a+=k[0]; break; + case 5 : b+=k[1]&0xff; a+=k[0]; break; + case 4 : a+=k[0]; break; + case 3 : a+=k[0]&0xffffff; break; + case 2 : a+=k[0]&0xffff; break; + case 1 : a+=k[0]&0xff; break; + case 0 : return c; /* zero length strings require no mixing */ + } + +#else /* make valgrind happy */ + + k8 = (const uint8_t *)k; + switch(length) + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ + case 10: c+=((uint32_t)k8[9])<<8; /* fall through */ + case 9 : c+=k8[8]; /* fall through */ + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ + case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */ + case 5 : b+=k8[4]; /* fall through */ + case 4 : a+=k[0]; break; + case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ + case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */ + case 1 : a+=k8[0]; break; + case 0 : return c; + } + +#endif /* !valgrind */ + + } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { + const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ + const uint8_t *k8; + + /*--------------- all but last block: aligned reads and different mixing */ + while (length > 12) + { + a += k[0] + (((uint32_t)k[1])<<16); + b += k[2] + (((uint32_t)k[3])<<16); + c += k[4] + (((uint32_t)k[5])<<16); + mix(a,b,c); + length -= 12; + k += 6; + } + + /*----------------------------- handle the last (probably partial) block */ + k8 = (const uint8_t *)k; + switch(length) + { + case 12: c+=k[4]+(((uint32_t)k[5])<<16); + b+=k[2]+(((uint32_t)k[3])<<16); + a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ + case 10: c+=k[4]; + b+=k[2]+(((uint32_t)k[3])<<16); + a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 9 : c+=k8[8]; /* fall through */ + case 8 : b+=k[2]+(((uint32_t)k[3])<<16); + a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ + case 6 : b+=k[2]; + a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 5 : b+=k8[4]; /* fall through */ + case 4 : a+=k[0]+(((uint32_t)k[1])<<16); + break; + case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ + case 2 : a+=k[0]; + break; + case 1 : a+=k8[0]; + break; + case 0 : return c; /* zero length requires no mixing */ + } + + } else { /* need to read the key one byte at a time */ + const uint8_t *k = (const uint8_t *)key; + + /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ + while (length > 12) + { + a += k[0]; + a += ((uint32_t)k[1])<<8; + a += ((uint32_t)k[2])<<16; + a += ((uint32_t)k[3])<<24; + b += k[4]; + b += ((uint32_t)k[5])<<8; + b += ((uint32_t)k[6])<<16; + b += ((uint32_t)k[7])<<24; + c += k[8]; + c += ((uint32_t)k[9])<<8; + c += ((uint32_t)k[10])<<16; + c += ((uint32_t)k[11])<<24; + mix(a,b,c); + length -= 12; + k += 12; + } + + /*-------------------------------- last block: affect all 32 bits of (c) */ + switch(length) /* all the case statements fall through */ + { + case 12: c+=((uint32_t)k[11])<<24; + case 11: c+=((uint32_t)k[10])<<16; + case 10: c+=((uint32_t)k[9])<<8; + case 9 : c+=k[8]; + case 8 : b+=((uint32_t)k[7])<<24; + case 7 : b+=((uint32_t)k[6])<<16; + case 6 : b+=((uint32_t)k[5])<<8; + case 5 : b+=k[4]; + case 4 : a+=((uint32_t)k[3])<<24; + case 3 : a+=((uint32_t)k[2])<<16; + case 2 : a+=((uint32_t)k[1])<<8; + case 1 : a+=k[0]; + break; + case 0 : return c; + } + } + + final(a,b,c); + *val2 = b; + return c; +} + +/* + * hashbig(): + * This is the same as hash_word() on big-endian machines. It is different + * from hashlittle() on all machines. hashbig() takes advantage of + * big-endian byte ordering. + */ +static uint32_t hashbig( const void *key, size_t length, uint32_t *val2) +{ + uint32_t a,b,c; + union { const void *ptr; size_t i; } u; /* to cast key to (size_t) happily */ + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + ((uint32_t)length) + *val2; + + u.ptr = key; + if (HASH_BIG_ENDIAN && ((u.i & 0x3) == 0)) { + const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ + const uint8_t *k8; + + /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ + while (length > 12) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 12; + k += 3; + } + + /*----------------------------- handle the last (probably partial) block */ + /* + * "k[2]<<8" actually reads beyond the end of the string, but + * then shifts out the part it's not allowed to read. Because the + * string is aligned, the illegal read is in the same word as the + * rest of the string. Every machine with memory protection I've seen + * does it on word boundaries, so is OK with this. But VALGRIND will + * still catch it and complain. The masking trick does make the hash + * noticeably faster for short strings (like English words). + * + * Not on my testing with gcc 4.5 on an intel i5 CPU, at least --RR. + */ +#if 0 + switch(length) + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=k[2]&0xffffff00; b+=k[1]; a+=k[0]; break; + case 10: c+=k[2]&0xffff0000; b+=k[1]; a+=k[0]; break; + case 9 : c+=k[2]&0xff000000; b+=k[1]; a+=k[0]; break; + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=k[1]&0xffffff00; a+=k[0]; break; + case 6 : b+=k[1]&0xffff0000; a+=k[0]; break; + case 5 : b+=k[1]&0xff000000; a+=k[0]; break; + case 4 : a+=k[0]; break; + case 3 : a+=k[0]&0xffffff00; break; + case 2 : a+=k[0]&0xffff0000; break; + case 1 : a+=k[0]&0xff000000; break; + case 0 : return c; /* zero length strings require no mixing */ + } + +#else /* make valgrind happy */ + + k8 = (const uint8_t *)k; + switch(length) /* all the case statements fall through */ + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=((uint32_t)k8[10])<<8; /* fall through */ + case 10: c+=((uint32_t)k8[9])<<16; /* fall through */ + case 9 : c+=((uint32_t)k8[8])<<24; /* fall through */ + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=((uint32_t)k8[6])<<8; /* fall through */ + case 6 : b+=((uint32_t)k8[5])<<16; /* fall through */ + case 5 : b+=((uint32_t)k8[4])<<24; /* fall through */ + case 4 : a+=k[0]; break; + case 3 : a+=((uint32_t)k8[2])<<8; /* fall through */ + case 2 : a+=((uint32_t)k8[1])<<16; /* fall through */ + case 1 : a+=((uint32_t)k8[0])<<24; break; + case 0 : return c; + } + +#endif /* !VALGRIND */ + + } else { /* need to read the key one byte at a time */ + const uint8_t *k = (const uint8_t *)key; + + /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ + while (length > 12) + { + a += ((uint32_t)k[0])<<24; + a += ((uint32_t)k[1])<<16; + a += ((uint32_t)k[2])<<8; + a += ((uint32_t)k[3]); + b += ((uint32_t)k[4])<<24; + b += ((uint32_t)k[5])<<16; + b += ((uint32_t)k[6])<<8; + b += ((uint32_t)k[7]); + c += ((uint32_t)k[8])<<24; + c += ((uint32_t)k[9])<<16; + c += ((uint32_t)k[10])<<8; + c += ((uint32_t)k[11]); + mix(a,b,c); + length -= 12; + k += 12; + } + + /*-------------------------------- last block: affect all 32 bits of (c) */ + switch(length) /* all the case statements fall through */ + { + case 12: c+=k[11]; + case 11: c+=((uint32_t)k[10])<<8; + case 10: c+=((uint32_t)k[9])<<16; + case 9 : c+=((uint32_t)k[8])<<24; + case 8 : b+=k[7]; + case 7 : b+=((uint32_t)k[6])<<8; + case 6 : b+=((uint32_t)k[5])<<16; + case 5 : b+=((uint32_t)k[4])<<24; + case 4 : a+=k[3]; + case 3 : a+=((uint32_t)k[2])<<8; + case 2 : a+=((uint32_t)k[1])<<16; + case 1 : a+=((uint32_t)k[0])<<24; + break; + case 0 : return c; + } + } + + final(a,b,c); + *val2 = b; + return c; +} + +/* I basically use hashlittle here, but use native endian within each + * element. This delivers least-surprise: hash such as "int arr[] = { + * 1, 2 }; hash_stable(arr, 2, 0);" will be the same on big and little + * endian machines, even though a bytewise hash wouldn't be. */ +uint64_t hash64_stable_64(const void *key, size_t n, uint64_t base) +{ + const uint64_t *k = key; + uint32_t a,b,c; + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + ((uint32_t)n*8) + (base >> 32) + base; + + while (n > 3) { + a += (uint32_t)k[0]; + b += (uint32_t)(k[0] >> 32); + c += (uint32_t)k[1]; + mix(a,b,c); + a += (uint32_t)(k[1] >> 32); + b += (uint32_t)k[2]; + c += (uint32_t)(k[2] >> 32); + mix(a,b,c); + n -= 3; + k += 3; + } + switch (n) { + case 2: + a += (uint32_t)k[0]; + b += (uint32_t)(k[0] >> 32); + c += (uint32_t)k[1]; + mix(a,b,c); + a += (uint32_t)(k[1] >> 32); + break; + case 1: + a += (uint32_t)k[0]; + b += (uint32_t)(k[0] >> 32); + break; + case 0: + return c; + } + final(a,b,c); + return ((uint64_t)b << 32) | c; +} + +uint64_t hash64_stable_32(const void *key, size_t n, uint64_t base) +{ + const uint32_t *k = key; + uint32_t a,b,c; + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + ((uint32_t)n*4) + (base >> 32) + base; + + while (n > 3) { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + + n -= 3; + k += 3; + } + switch (n) { + case 2: + b += (uint32_t)k[1]; + case 1: + a += (uint32_t)k[0]; + break; + case 0: + return c; + } + final(a,b,c); + return ((uint64_t)b << 32) | c; +} + +uint64_t hash64_stable_16(const void *key, size_t n, uint64_t base) +{ + const uint16_t *k = key; + uint32_t a,b,c; + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + ((uint32_t)n*2) + (base >> 32) + base; + + while (n > 6) { + a += (uint32_t)k[0] + ((uint32_t)k[1] << 16); + b += (uint32_t)k[2] + ((uint32_t)k[3] << 16); + c += (uint32_t)k[4] + ((uint32_t)k[5] << 16); + mix(a,b,c); + + n -= 6; + k += 6; + } + + switch (n) { + case 5: + c += (uint32_t)k[4]; + case 4: + b += ((uint32_t)k[3] << 16); + case 3: + b += (uint32_t)k[2]; + case 2: + a += ((uint32_t)k[1] << 16); + case 1: + a += (uint32_t)k[0]; + break; + case 0: + return c; + } + final(a,b,c); + return ((uint64_t)b << 32) | c; +} + +uint64_t hash64_stable_8(const void *key, size_t n, uint64_t base) +{ + uint32_t b32 = base + (base >> 32); + uint32_t lower = hashlittle(key, n, &b32); + + return ((uint64_t)b32 << 32) | lower; +} + +uint32_t hash_any(const void *key, size_t length, uint32_t base) +{ + if (HASH_BIG_ENDIAN) + return hashbig(key, length, &base); + else + return hashlittle(key, length, &base); +} + +uint32_t hash_stable_64(const void *key, size_t n, uint32_t base) +{ + return hash64_stable_64(key, n, base); +} + +uint32_t hash_stable_32(const void *key, size_t n, uint32_t base) +{ + return hash64_stable_32(key, n, base); +} + +uint32_t hash_stable_16(const void *key, size_t n, uint32_t base) +{ + return hash64_stable_16(key, n, base); +} + +uint32_t hash_stable_8(const void *key, size_t n, uint32_t base) +{ + return hashlittle(key, n, &base); +} + +/* Jenkins' lookup8 is a 64 bit hash, but he says it's obsolete. Use + * the plain one and recombine into 64 bits. */ +uint64_t hash64_any(const void *key, size_t length, uint64_t base) +{ + uint32_t b32 = base + (base >> 32); + uint32_t lower; + + if (HASH_BIG_ENDIAN) + lower = hashbig(key, length, &b32); + else + lower = hashlittle(key, length, &b32); + + return ((uint64_t)b32 << 32) | lower; +} + +#ifdef SELF_TEST + +/* used for timings */ +void driver1() +{ + uint8_t buf[256]; + uint32_t i; + uint32_t h=0; + time_t a,z; + + time(&a); + for (i=0; i<256; ++i) buf[i] = 'x'; + for (i=0; i<1; ++i) + { + h = hashlittle(&buf[0],1,h); + } + time(&z); + if (z-a > 0) printf("time %d %.8x\n", z-a, h); +} + +/* check that every input bit changes every output bit half the time */ +#define HASHSTATE 1 +#define HASHLEN 1 +#define MAXPAIR 60 +#define MAXLEN 70 +void driver2() +{ + uint8_t qa[MAXLEN+1], qb[MAXLEN+2], *a = &qa[0], *b = &qb[1]; + uint32_t c[HASHSTATE], d[HASHSTATE], i=0, j=0, k, l, m=0, z; + uint32_t e[HASHSTATE],f[HASHSTATE],g[HASHSTATE],h[HASHSTATE]; + uint32_t x[HASHSTATE],y[HASHSTATE]; + uint32_t hlen; + + printf("No more than %d trials should ever be needed \n",MAXPAIR/2); + for (hlen=0; hlen < MAXLEN; ++hlen) + { + z=0; + for (i=0; i<hlen; ++i) /*----------------------- for each input byte, */ + { + for (j=0; j<8; ++j) /*------------------------ for each input bit, */ + { + for (m=1; m<8; ++m) /*------------ for several possible initvals, */ + { + for (l=0; l<HASHSTATE; ++l) + e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((uint32_t)0); + + /*---- check that every output bit is affected by that input bit */ + for (k=0; k<MAXPAIR; k+=2) + { + uint32_t finished=1; + /* keys have one bit different */ + for (l=0; l<hlen+1; ++l) {a[l] = b[l] = (uint8_t)0;} + /* have a and b be two keys differing in only one bit */ + a[i] ^= (k<<j); + a[i] ^= (k>>(8-j)); + c[0] = hashlittle(a, hlen, m); + b[i] ^= ((k+1)<<j); + b[i] ^= ((k+1)>>(8-j)); + d[0] = hashlittle(b, hlen, m); + /* check every bit is 1, 0, set, and not set at least once */ + for (l=0; l<HASHSTATE; ++l) + { + e[l] &= (c[l]^d[l]); + f[l] &= ~(c[l]^d[l]); + g[l] &= c[l]; + h[l] &= ~c[l]; + x[l] &= d[l]; + y[l] &= ~d[l]; + if (e[l]|f[l]|g[l]|h[l]|x[l]|y[l]) finished=0; + } + if (finished) break; + } + if (k>z) z=k; + if (k==MAXPAIR) + { + printf("Some bit didn't change: "); + printf("%.8x %.8x %.8x %.8x %.8x %.8x ", + e[0],f[0],g[0],h[0],x[0],y[0]); + printf("i %d j %d m %d len %d\n", i, j, m, hlen); + } + if (z==MAXPAIR) goto done; + } + } + } + done: + if (z < MAXPAIR) + { + printf("Mix success %2d bytes %2d initvals ",i,m); + printf("required %d trials\n", z/2); + } + } + printf("\n"); +} + +/* Check for reading beyond the end of the buffer and alignment problems */ +void driver3() +{ + uint8_t buf[MAXLEN+20], *b; + uint32_t len; + uint8_t q[] = "This is the time for all good men to come to the aid of their country..."; + uint32_t h; + uint8_t qq[] = "xThis is the time for all good men to come to the aid of their country..."; + uint32_t i; + uint8_t qqq[] = "xxThis is the time for all good men to come to the aid of their country..."; + uint32_t j; + uint8_t qqqq[] = "xxxThis is the time for all good men to come to the aid of their country..."; + uint32_t ref,x,y; + uint8_t *p; + + printf("Endianness. These lines should all be the same (for values filled in):\n"); + printf("%.8x %.8x %.8x\n", + hash_word((const uint32_t *)q, (sizeof(q)-1)/4, 13), + hash_word((const uint32_t *)q, (sizeof(q)-5)/4, 13), + hash_word((const uint32_t *)q, (sizeof(q)-9)/4, 13)); + p = q; + printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", + hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), + hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), + hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), + hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), + hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), + hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); + p = &qq[1]; + printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", + hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), + hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), + hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), + hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), + hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), + hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); + p = &qqq[2]; + printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", + hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), + hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), + hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), + hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), + hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), + hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); + p = &qqqq[3]; + printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", + hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), + hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), + hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), + hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), + hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), + hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); + printf("\n"); + + /* check that hashlittle2 and hashlittle produce the same results */ + i=47; j=0; + hashlittle2(q, sizeof(q), &i, &j); + if (hashlittle(q, sizeof(q), 47) != i) + printf("hashlittle2 and hashlittle mismatch\n"); + + /* check that hash_word2 and hash_word produce the same results */ + len = 0xdeadbeef; + i=47, j=0; + hash_word2(&len, 1, &i, &j); + if (hash_word(&len, 1, 47) != i) + printf("hash_word2 and hash_word mismatch %x %x\n", + i, hash_word(&len, 1, 47)); + + /* check hashlittle doesn't read before or after the ends of the string */ + for (h=0, b=buf+1; h<8; ++h, ++b) + { + for (i=0; i<MAXLEN; ++i) + { + len = i; + for (j=0; j<i; ++j) *(b+j)=0; + + /* these should all be equal */ + ref = hashlittle(b, len, (uint32_t)1); + *(b+i)=(uint8_t)~0; + *(b-1)=(uint8_t)~0; + x = hashlittle(b, len, (uint32_t)1); + y = hashlittle(b, len, (uint32_t)1); + if ((ref != x) || (ref != y)) + { + printf("alignment error: %.8x %.8x %.8x %d %d\n",ref,x,y, + h, i); + } + } + } +} + +/* check for problems with nulls */ + void driver4() +{ + uint8_t buf[1]; + uint32_t h,i,state[HASHSTATE]; + + + buf[0] = ~0; + for (i=0; i<HASHSTATE; ++i) state[i] = 1; + printf("These should all be different\n"); + for (i=0, h=0; i<8; ++i) + { + h = hashlittle(buf, 0, h); + printf("%2ld 0-byte strings, hash is %.8x\n", i, h); + } +} + + +int main() +{ + driver1(); /* test that the key is hashed: used for timings */ + driver2(); /* test that whole key is hashed thoroughly */ + driver3(); /* test that nothing but the key is hashed */ + driver4(); /* test hashing multiple buffers (all buffers are null) */ + return 1; +} + +#endif /* SELF_TEST */ diff --git a/ccan/ccan/hash/hash.h b/ccan/ccan/hash/hash.h new file mode 100644 index 0000000..2170684 --- /dev/null +++ b/ccan/ccan/hash/hash.h @@ -0,0 +1,313 @@ +/* CC0 (Public domain) - see LICENSE file for details */ +#ifndef CCAN_HASH_H +#define CCAN_HASH_H +#include "config.h" +#include <stdint.h> +#include <stdlib.h> +#include <ccan/build_assert/build_assert.h> + +/* Stolen mostly from: lookup3.c, by Bob Jenkins, May 2006, Public Domain. + * + * http://burtleburtle.net/bob/c/lookup3.c + */ + +/** + * hash - fast hash of an array for internal use + * @p: the array or pointer to first element + * @num: the number of elements to hash + * @base: the base number to roll into the hash (usually 0) + * + * The memory region pointed to by p is combined with the base to form + * a 32-bit hash. + * + * This hash will have different results on different machines, so is + * only useful for internal hashes (ie. not hashes sent across the + * network or saved to disk). + * + * It may also change with future versions: it could even detect at runtime + * what the fastest hash to use is. + * + * See also: hash64, hash_stable. + * + * Example: + * #include <ccan/hash/hash.h> + * #include <err.h> + * #include <stdio.h> + * #include <string.h> + * + * // Simple demonstration: idential strings will have the same hash, but + * // two different strings will probably not. + * int main(int argc, char *argv[]) + * { + * uint32_t hash1, hash2; + * + * if (argc != 3) + * err(1, "Usage: %s <string1> <string2>", argv[0]); + * + * hash1 = hash(argv[1], strlen(argv[1]), 0); + * hash2 = hash(argv[2], strlen(argv[2]), 0); + * printf("Hash is %s\n", hash1 == hash2 ? "same" : "different"); + * return 0; + * } + */ +#define hash(p, num, base) hash_any((p), (num)*sizeof(*(p)), (base)) + +/** + * hash_stable - hash of an array for external use + * @p: the array or pointer to first element + * @num: the number of elements to hash + * @base: the base number to roll into the hash (usually 0) + * + * The array of simple integer types pointed to by p is combined with + * the base to form a 32-bit hash. + * + * This hash will have the same results on different machines, so can + * be used for external hashes (ie. hashes sent across the network or + * saved to disk). The results will not change in future versions of + * this module. + * + * Note that it is only legal to hand an array of simple integer types + * to this hash (ie. char, uint16_t, int64_t, etc). In these cases, + * the same values will have the same hash result, even though the + * memory representations of integers depend on the machine + * endianness. + * + * See also: + * hash64_stable + * + * Example: + * #include <ccan/hash/hash.h> + * #include <err.h> + * #include <stdio.h> + * #include <string.h> + * + * int main(int argc, char *argv[]) + * { + * if (argc != 2) + * err(1, "Usage: %s <string-to-hash>", argv[0]); + * + * printf("Hash stable result is %u\n", + * hash_stable(argv[1], strlen(argv[1]), 0)); + * return 0; + * } + */ +#define hash_stable(p, num, base) \ + (BUILD_ASSERT_OR_ZERO(sizeof(*(p)) == 8 || sizeof(*(p)) == 4 \ + || sizeof(*(p)) == 2 || sizeof(*(p)) == 1) + \ + sizeof(*(p)) == 8 ? hash_stable_64((p), (num), (base)) \ + : sizeof(*(p)) == 4 ? hash_stable_32((p), (num), (base)) \ + : sizeof(*(p)) == 2 ? hash_stable_16((p), (num), (base)) \ + : hash_stable_8((p), (num), (base))) + +/** + * hash_u32 - fast hash an array of 32-bit values for internal use + * @key: the array of uint32_t + * @num: the number of elements to hash + * @base: the base number to roll into the hash (usually 0) + * + * The array of uint32_t pointed to by @key is combined with the base + * to form a 32-bit hash. This is 2-3 times faster than hash() on small + * arrays, but the advantage vanishes over large hashes. + * + * This hash will have different results on different machines, so is + * only useful for internal hashes (ie. not hashes sent across the + * network or saved to disk). + */ +uint32_t hash_u32(const uint32_t *key, size_t num, uint32_t base); + +/** + * hash_string - very fast hash of an ascii string + * @str: the nul-terminated string + * + * The string is hashed, using a hash function optimized for ASCII and + * similar strings. It's weaker than the other hash functions. + * + * This hash may have different results on different machines, so is + * only useful for internal hashes (ie. not hashes sent across the + * network or saved to disk). The results will be different from the + * other hash functions in this module, too. + */ +static inline uint32_t hash_string(const char *string) +{ + /* This is Karl Nelson <kenelson@ece.ucdavis.edu>'s X31 hash. + * It's a little faster than the (much better) lookup3 hash(): 56ns vs + * 84ns on my 2GHz Intel Core Duo 2 laptop for a 10 char string. */ + uint32_t ret; + + for (ret = 0; *string; string++) + ret = (ret << 5) - ret + *string; + + return ret; +} + +/** + * hash64 - fast 64-bit hash of an array for internal use + * @p: the array or pointer to first element + * @num: the number of elements to hash + * @base: the 64-bit base number to roll into the hash (usually 0) + * + * The memory region pointed to by p is combined with the base to form + * a 64-bit hash. + * + * This hash will have different results on different machines, so is + * only useful for internal hashes (ie. not hashes sent across the + * network or saved to disk). + * + * It may also change with future versions: it could even detect at runtime + * what the fastest hash to use is. + * + * See also: hash. + * + * Example: + * #include <ccan/hash/hash.h> + * #include <err.h> + * #include <stdio.h> + * #include <string.h> + * + * // Simple demonstration: idential strings will have the same hash, but + * // two different strings will probably not. + * int main(int argc, char *argv[]) + * { + * uint64_t hash1, hash2; + * + * if (argc != 3) + * err(1, "Usage: %s <string1> <string2>", argv[0]); + * + * hash1 = hash64(argv[1], strlen(argv[1]), 0); + * hash2 = hash64(argv[2], strlen(argv[2]), 0); + * printf("Hash is %s\n", hash1 == hash2 ? "same" : "different"); + * return 0; + * } + */ +#define hash64(p, num, base) hash64_any((p), (num)*sizeof(*(p)), (base)) + +/** + * hash64_stable - 64 bit hash of an array for external use + * @p: the array or pointer to first element + * @num: the number of elements to hash + * @base: the base number to roll into the hash (usually 0) + * + * The array of simple integer types pointed to by p is combined with + * the base to form a 64-bit hash. + * + * This hash will have the same results on different machines, so can + * be used for external hashes (ie. hashes sent across the network or + * saved to disk). The results will not change in future versions of + * this module. + * + * Note that it is only legal to hand an array of simple integer types + * to this hash (ie. char, uint16_t, int64_t, etc). In these cases, + * the same values will have the same hash result, even though the + * memory representations of integers depend on the machine + * endianness. + * + * See also: + * hash_stable + * + * Example: + * #include <ccan/hash/hash.h> + * #include <err.h> + * #include <stdio.h> + * #include <string.h> + * + * int main(int argc, char *argv[]) + * { + * if (argc != 2) + * err(1, "Usage: %s <string-to-hash>", argv[0]); + * + * printf("Hash stable result is %llu\n", + * (long long)hash64_stable(argv[1], strlen(argv[1]), 0)); + * return 0; + * } + */ +#define hash64_stable(p, num, base) \ + (BUILD_ASSERT_OR_ZERO(sizeof(*(p)) == 8 || sizeof(*(p)) == 4 \ + || sizeof(*(p)) == 2 || sizeof(*(p)) == 1) + \ + sizeof(*(p)) == 8 ? hash64_stable_64((p), (num), (base)) \ + : sizeof(*(p)) == 4 ? hash64_stable_32((p), (num), (base)) \ + : sizeof(*(p)) == 2 ? hash64_stable_16((p), (num), (base)) \ + : hash64_stable_8((p), (num), (base))) + + +/** + * hashl - fast 32/64-bit hash of an array for internal use + * @p: the array or pointer to first element + * @num: the number of elements to hash + * @base: the base number to roll into the hash (usually 0) + * + * This is either hash() or hash64(), on 32/64 bit long machines. + */ +#define hashl(p, num, base) \ + (BUILD_ASSERT_OR_ZERO(sizeof(long) == sizeof(uint32_t) \ + || sizeof(long) == sizeof(uint64_t)) + \ + (sizeof(long) == sizeof(uint64_t) \ + ? hash64((p), (num), (base)) : hash((p), (num), (base)))) + +/* Our underlying operations. */ +uint32_t hash_any(const void *key, size_t length, uint32_t base); +uint32_t hash_stable_64(const void *key, size_t n, uint32_t base); +uint32_t hash_stable_32(const void *key, size_t n, uint32_t base); +uint32_t hash_stable_16(const void *key, size_t n, uint32_t base); +uint32_t hash_stable_8(const void *key, size_t n, uint32_t base); +uint64_t hash64_any(const void *key, size_t length, uint64_t base); +uint64_t hash64_stable_64(const void *key, size_t n, uint64_t base); +uint64_t hash64_stable_32(const void *key, size_t n, uint64_t base); +uint64_t hash64_stable_16(const void *key, size_t n, uint64_t base); +uint64_t hash64_stable_8(const void *key, size_t n, uint64_t base); + +/** + * hash_pointer - hash a pointer for internal use + * @p: the pointer value to hash + * @base: the base number to roll into the hash (usually 0) + * + * The pointer p (not what p points to!) is combined with the base to form + * a 32-bit hash. + * + * This hash will have different results on different machines, so is + * only useful for internal hashes (ie. not hashes sent across the + * network or saved to disk). + * + * Example: + * #include <ccan/hash/hash.h> + * + * // Code to keep track of memory regions. + * struct region { + * struct region *chain; + * void *start; + * unsigned int size; + * }; + * // We keep a simple hash table. + * static struct region *region_hash[128]; + * + * static void add_region(struct region *r) + * { + * unsigned int h = hash_pointer(r->start, 0); + * + * r->chain = region_hash[h]; + * region_hash[h] = r->chain; + * } + * + * static struct region *find_region(const void *start) + * { + * struct region *r; + * + * for (r = region_hash[hash_pointer(start, 0)]; r; r = r->chain) + * if (r->start == start) + * return r; + * return NULL; + * } + */ +static inline uint32_t hash_pointer(const void *p, uint32_t base) +{ + if (sizeof(p) % sizeof(uint32_t) == 0) { + /* This convoluted union is the right way of aliasing. */ + union { + uint32_t a[sizeof(p) / sizeof(uint32_t)]; + const void *p; + } u; + u.p = p; + return hash_u32(u.a, sizeof(p) / sizeof(uint32_t), base); + } else + return hash(&p, 1, base); +} +#endif /* HASH_H */ diff --git a/ccan/ccan/htable/LICENSE b/ccan/ccan/htable/LICENSE new file mode 120000 index 0000000..dc314ec --- /dev/null +++ b/ccan/ccan/htable/LICENSE @@ -0,0 +1 @@ +../../licenses/LGPL-2.1
\ No newline at end of file diff --git a/ccan/ccan/htable/htable.c b/ccan/ccan/htable/htable.c new file mode 100644 index 0000000..f631ffe --- /dev/null +++ b/ccan/ccan/htable/htable.c @@ -0,0 +1,491 @@ +/* Licensed under LGPLv2+ - see LICENSE file for details */ +#include <ccan/htable/htable.h> +#include <ccan/compiler/compiler.h> +#include <stdlib.h> +#include <stdio.h> +#include <limits.h> +#include <stdbool.h> +#include <assert.h> +#include <string.h> + +/* We use 0x1 as deleted marker. */ +#define HTABLE_DELETED (0x1) + +/* perfect_bitnum 63 means there's no perfect bitnum */ +#define NO_PERFECT_BIT (sizeof(uintptr_t) * CHAR_BIT - 1) + +static void *htable_default_alloc(struct htable *ht, size_t len) +{ + return calloc(len, 1); +} + +static void htable_default_free(struct htable *ht, void *p) +{ + free(p); +} + +static void *(*htable_alloc)(struct htable *, size_t) = htable_default_alloc; +static void (*htable_free)(struct htable *, void *) = htable_default_free; + +void htable_set_allocator(void *(*alloc)(struct htable *, size_t len), + void (*free)(struct htable *, void *p)) +{ + if (!alloc) + alloc = htable_default_alloc; + if (!free) + free = htable_default_free; + htable_alloc = alloc; + htable_free = free; +} + +/* We clear out the bits which are always the same, and put metadata there. */ +static inline uintptr_t get_extra_ptr_bits(const struct htable *ht, + uintptr_t e) +{ + return e & ht->common_mask; +} + +static inline void *get_raw_ptr(const struct htable *ht, uintptr_t e) +{ + return (void *)((e & ~ht->common_mask) | ht->common_bits); +} + +static inline uintptr_t make_hval(const struct htable *ht, + const void *p, uintptr_t bits) +{ + return ((uintptr_t)p & ~ht->common_mask) | bits; +} + +static inline bool entry_is_valid(uintptr_t e) +{ + return e > HTABLE_DELETED; +} + +static inline uintptr_t ht_perfect_mask(const struct htable *ht) +{ + return (uintptr_t)2 << ht->perfect_bitnum; +} + +static inline uintptr_t get_hash_ptr_bits(const struct htable *ht, + size_t hash) +{ + /* Shuffling the extra bits (as specified in mask) down the + * end is quite expensive. But the lower bits are redundant, so + * we fold the value first. */ + return (hash ^ (hash >> ht->bits)) + & ht->common_mask & ~ht_perfect_mask(ht); +} + +void htable_init(struct htable *ht, + size_t (*rehash)(const void *elem, void *priv), void *priv) +{ + struct htable empty = HTABLE_INITIALIZER(empty, NULL, NULL); + *ht = empty; + ht->rehash = rehash; + ht->priv = priv; + ht->table = &ht->common_bits; +} + +/* Fill to 87.5% */ +static inline size_t ht_max(const struct htable *ht) +{ + return ((size_t)7 << ht->bits) / 8; +} + +/* Clean deleted if we're full, and more than 12.5% deleted */ +static inline size_t ht_max_deleted(const struct htable *ht) +{ + return ((size_t)1 << ht->bits) / 8; +} + +bool htable_init_sized(struct htable *ht, + size_t (*rehash)(const void *, void *), + void *priv, size_t expect) +{ + htable_init(ht, rehash, priv); + + /* Don't go insane with sizing. */ + for (ht->bits = 1; ht_max(ht) < expect; ht->bits++) { + if (ht->bits == 30) + break; + } + + ht->table = htable_alloc(ht, sizeof(size_t) << ht->bits); + if (!ht->table) { + ht->table = &ht->common_bits; + return false; + } + (void)htable_debug(ht, HTABLE_LOC); + return true; +} + +void htable_clear(struct htable *ht) +{ + if (ht->table != &ht->common_bits) + htable_free(ht, (void *)ht->table); + htable_init(ht, ht->rehash, ht->priv); +} + +bool htable_copy_(struct htable *dst, const struct htable *src) +{ + uintptr_t *htable = htable_alloc(dst, sizeof(size_t) << src->bits); + + if (!htable) + return false; + + *dst = *src; + dst->table = htable; + memcpy(dst->table, src->table, sizeof(size_t) << src->bits); + return true; +} + +static size_t hash_bucket(const struct htable *ht, size_t h) +{ + return h & ((1 << ht->bits)-1); +} + +static void *htable_val(const struct htable *ht, + struct htable_iter *i, size_t hash, uintptr_t perfect) +{ + uintptr_t h2 = get_hash_ptr_bits(ht, hash) | perfect; + + while (ht->table[i->off]) { + if (ht->table[i->off] != HTABLE_DELETED) { + if (get_extra_ptr_bits(ht, ht->table[i->off]) == h2) + return get_raw_ptr(ht, ht->table[i->off]); + } + i->off = (i->off + 1) & ((1 << ht->bits)-1); + h2 &= ~perfect; + } + return NULL; +} + +void *htable_firstval_(const struct htable *ht, + struct htable_iter *i, size_t hash) +{ + i->off = hash_bucket(ht, hash); + return htable_val(ht, i, hash, ht_perfect_mask(ht)); +} + +void *htable_nextval_(const struct htable *ht, + struct htable_iter *i, size_t hash) +{ + i->off = (i->off + 1) & ((1 << ht->bits)-1); + return htable_val(ht, i, hash, 0); +} + +void *htable_first_(const struct htable *ht, struct htable_iter *i) +{ + for (i->off = 0; i->off < (size_t)1 << ht->bits; i->off++) { + if (entry_is_valid(ht->table[i->off])) + return get_raw_ptr(ht, ht->table[i->off]); + } + return NULL; +} + +void *htable_next_(const struct htable *ht, struct htable_iter *i) +{ + for (i->off++; i->off < (size_t)1 << ht->bits; i->off++) { + if (entry_is_valid(ht->table[i->off])) + return get_raw_ptr(ht, ht->table[i->off]); + } + return NULL; +} + +void *htable_prev_(const struct htable *ht, struct htable_iter *i) +{ + for (;;) { + if (!i->off) + return NULL; + i->off--; + if (entry_is_valid(ht->table[i->off])) + return get_raw_ptr(ht, ht->table[i->off]); + } +} + +/* Another bit currently in mask needs to be exposed, so that a bucket with p in + * it won't appear invalid */ +static COLD void unset_another_common_bit(struct htable *ht, + uintptr_t *maskdiff, + const void *p) +{ + size_t i; + + for (i = sizeof(uintptr_t) * CHAR_BIT - 1; i > 0; i--) { + if (((uintptr_t)p & ((uintptr_t)1 << i)) + && ht->common_mask & ~*maskdiff & ((uintptr_t)1 << i)) + break; + } + /* There must have been one, right? */ + assert(i > 0); + + *maskdiff |= ((uintptr_t)1 << i); +} + +/* We want to change the common mask: this fixes up the table */ +static COLD void fixup_table_common(struct htable *ht, uintptr_t maskdiff) +{ + size_t i; + uintptr_t bitsdiff; + +again: + bitsdiff = ht->common_bits & maskdiff; + + for (i = 0; i < (size_t)1 << ht->bits; i++) { + uintptr_t e; + if (!entry_is_valid(e = ht->table[i])) + continue; + + /* Clear the bits no longer in the mask, set them as + * expected. */ + e &= ~maskdiff; + e |= bitsdiff; + /* If this made it invalid, restart with more exposed */ + if (!entry_is_valid(e)) { + unset_another_common_bit(ht, &maskdiff, get_raw_ptr(ht, e)); + goto again; + } + ht->table[i] = e; + } + + /* Take away those bits from our mask, bits and perfect bit. */ + ht->common_mask &= ~maskdiff; + ht->common_bits &= ~maskdiff; + if (ht_perfect_mask(ht) & maskdiff) + ht->perfect_bitnum = NO_PERFECT_BIT; +} + +/* Limited recursion */ +static void ht_add(struct htable *ht, const void *new, size_t h); + +/* We tried to add this entry, but it looked invalid! We need to + * let another pointer bit through mask */ +static COLD void update_common_fix_invalid(struct htable *ht, const void *p, size_t h) +{ + uintptr_t maskdiff; + + assert(ht->elems != 0); + + maskdiff = 0; + unset_another_common_bit(ht, &maskdiff, p); + fixup_table_common(ht, maskdiff); + + /* Now won't recurse */ + ht_add(ht, p, h); +} + +/* This does not expand the hash table, that's up to caller. */ +static void ht_add(struct htable *ht, const void *new, size_t h) +{ + size_t i; + uintptr_t perfect = ht_perfect_mask(ht); + + i = hash_bucket(ht, h); + + while (entry_is_valid(ht->table[i])) { + perfect = 0; + i = (i + 1) & ((1 << ht->bits)-1); + } + ht->table[i] = make_hval(ht, new, get_hash_ptr_bits(ht, h)|perfect); + if (!entry_is_valid(ht->table[i])) + update_common_fix_invalid(ht, new, h); +} + +static COLD bool double_table(struct htable *ht) +{ + unsigned int i; + size_t oldnum = (size_t)1 << ht->bits; + uintptr_t *oldtable, e; + + oldtable = ht->table; + ht->table = htable_alloc(ht, sizeof(size_t) << (ht->bits+1)); + if (!ht->table) { + ht->table = oldtable; + return false; + } + ht->bits++; + + /* If we lost our "perfect bit", get it back now. */ + if (ht->perfect_bitnum == NO_PERFECT_BIT && ht->common_mask) { + for (i = 0; i < sizeof(ht->common_mask) * CHAR_BIT; i++) { + if (ht->common_mask & ((size_t)2 << i)) { + ht->perfect_bitnum = i; + break; + } + } + } + + if (oldtable != &ht->common_bits) { + for (i = 0; i < oldnum; i++) { + if (entry_is_valid(e = oldtable[i])) { + void *p = get_raw_ptr(ht, e); + ht_add(ht, p, ht->rehash(p, ht->priv)); + } + } + htable_free(ht, oldtable); + } + ht->deleted = 0; + + (void)htable_debug(ht, HTABLE_LOC); + return true; +} + +static COLD void rehash_table(struct htable *ht) +{ + size_t start, i; + uintptr_t e, perfect = ht_perfect_mask(ht); + + /* Beware wrap cases: we need to start from first empty bucket. */ + for (start = 0; ht->table[start]; start++); + + for (i = 0; i < (size_t)1 << ht->bits; i++) { + size_t h = (i + start) & ((1 << ht->bits)-1); + e = ht->table[h]; + if (!e) + continue; + if (e == HTABLE_DELETED) + ht->table[h] = 0; + else if (!(e & perfect)) { + void *p = get_raw_ptr(ht, e); + ht->table[h] = 0; + ht_add(ht, p, ht->rehash(p, ht->priv)); + } + } + ht->deleted = 0; + (void)htable_debug(ht, HTABLE_LOC); +} + +/* We stole some bits, now we need to put them back... */ +static COLD void update_common(struct htable *ht, const void *p) +{ + uintptr_t maskdiff; + + if (ht->elems == 0) { + ht->common_mask = -1; + ht->common_bits = ((uintptr_t)p & ht->common_mask); + ht->perfect_bitnum = 0; + (void)htable_debug(ht, HTABLE_LOC); + return; + } + + /* Find bits which are unequal to old common set. */ + maskdiff = ht->common_bits ^ ((uintptr_t)p & ht->common_mask); + + fixup_table_common(ht, maskdiff); + (void)htable_debug(ht, HTABLE_LOC); +} + +bool htable_add_(struct htable *ht, size_t hash, const void *p) +{ + /* Cannot insert NULL, or (void *)1. */ + assert(p); + assert(entry_is_valid((uintptr_t)p)); + + /* Getting too full? */ + if (ht->elems+1 + ht->deleted > ht_max(ht)) { + /* If we're more than 1/8 deleted, clean those, + * otherwise double table size. */ + if (ht->deleted > ht_max_deleted(ht)) + rehash_table(ht); + else if (!double_table(ht)) + return false; + } + if (((uintptr_t)p & ht->common_mask) != ht->common_bits) + update_common(ht, p); + + ht_add(ht, p, hash); + ht->elems++; + return true; +} + +bool htable_del_(struct htable *ht, size_t h, const void *p) +{ + struct htable_iter i; + void *c; + + for (c = htable_firstval(ht,&i,h); c; c = htable_nextval(ht,&i,h)) { + if (c == p) { + htable_delval(ht, &i); + return true; + } + } + return false; +} + +void htable_delval_(struct htable *ht, struct htable_iter *i) +{ + assert(i->off < (size_t)1 << ht->bits); + assert(entry_is_valid(ht->table[i->off])); + + ht->elems--; + /* Cheap test: if the next bucket is empty, don't need delete marker */ + if (ht->table[hash_bucket(ht, i->off+1)] != 0) { + ht->table[i->off] = HTABLE_DELETED; + ht->deleted++; + } else + ht->table[i->off] = 0; +} + +void *htable_pick_(const struct htable *ht, size_t seed, struct htable_iter *i) +{ + void *e; + struct htable_iter unwanted; + + if (!i) + i = &unwanted; + i->off = seed % ((size_t)1 << ht->bits); + e = htable_next(ht, i); + if (!e) + e = htable_first(ht, i); + return e; +} + +struct htable *htable_check(const struct htable *ht, const char *abortstr) +{ + void *p; + struct htable_iter i; + size_t n = 0; + + /* Use non-DEBUG versions here, to avoid infinite recursion with + * CCAN_HTABLE_DEBUG! */ + for (p = htable_first_(ht, &i); p; p = htable_next_(ht, &i)) { + struct htable_iter i2; + void *c; + size_t h = ht->rehash(p, ht->priv); + bool found = false; + + n++; + + /* Open-code htable_get to avoid CCAN_HTABLE_DEBUG */ + for (c = htable_firstval_(ht, &i2, h); + c; + c = htable_nextval_(ht, &i2, h)) { + if (c == p) { + found = true; + break; + } + } + + if (!found) { + if (abortstr) { + fprintf(stderr, + "%s: element %p in position %zu" + " cannot find itself\n", + abortstr, p, i.off); + abort(); + } + return NULL; + } + } + if (n != ht->elems) { + if (abortstr) { + fprintf(stderr, + "%s: found %zu elems, expected %zu\n", + abortstr, n, ht->elems); + abort(); + } + return NULL; + } + + return (struct htable *)ht; +} diff --git a/ccan/ccan/htable/htable.h b/ccan/ccan/htable/htable.h new file mode 100644 index 0000000..faaf541 --- /dev/null +++ b/ccan/ccan/htable/htable.h @@ -0,0 +1,290 @@ +/* Licensed under LGPLv2+ - see LICENSE file for details */ +#ifndef CCAN_HTABLE_H +#define CCAN_HTABLE_H +#include "config.h" +#include <ccan/str/str.h> +#include <stdint.h> +#include <stdbool.h> +#include <stdlib.h> + +/* Define CCAN_HTABLE_DEBUG for expensive debugging checks on each call. */ +#define HTABLE_LOC __FILE__ ":" stringify(__LINE__) +#ifdef CCAN_HTABLE_DEBUG +#define htable_debug(h, loc) htable_check((h), loc) +#else +#define htable_debug(h, loc) ((void)loc, h) +#endif + +/** + * struct htable - private definition of a htable. + * + * It's exposed here so you can put it in your structures and so we can + * supply inline functions. + */ +struct htable { + size_t (*rehash)(const void *elem, void *priv); + void *priv; + unsigned int bits, perfect_bitnum; + size_t elems, deleted; + /* These are the bits which are the same in all pointers. */ + uintptr_t common_mask, common_bits; + uintptr_t *table; +}; + +/** + * HTABLE_INITIALIZER - static initialization for a hash table. + * @name: name of this htable. + * @rehash: hash function to use for rehashing. + * @priv: private argument to @rehash function. + * + * This is useful for setting up static and global hash tables. + * + * Example: + * // For simplicity's sake, say hash value is contents of elem. + * static size_t rehash(const void *elem, void *unused) + * { + * (void)unused; + * return *(size_t *)elem; + * } + * static struct htable ht = HTABLE_INITIALIZER(ht, rehash, NULL); + */ +#define HTABLE_INITIALIZER(name, rehash, priv) \ + { rehash, priv, 0, 0, 0, 0, -1, 0, &name.common_bits } + +/** + * htable_init - initialize an empty hash table. + * @ht: the hash table to initialize + * @rehash: hash function to use for rehashing. + * @priv: private argument to @rehash function. + */ +void htable_init(struct htable *ht, + size_t (*rehash)(const void *elem, void *priv), void *priv); + +/** + * htable_init_sized - initialize an empty hash table of given size. + * @ht: the hash table to initialize + * @rehash: hash function to use for rehashing. + * @priv: private argument to @rehash function. + * @size: the number of element. + * + * If this returns false, @ht is still usable, but may need to do reallocation + * upon an add. If this returns true, it will not need to reallocate within + * @size htable_adds. + */ +bool htable_init_sized(struct htable *ht, + size_t (*rehash)(const void *elem, void *priv), + void *priv, size_t size); + +/** + * htable_count - count number of entries in a hash table. + * @ht: the hash table + */ +static inline size_t htable_count(const struct htable *ht) +{ + return ht->elems; +} + +/** + * htable_clear - empty a hash table. + * @ht: the hash table to clear + * + * This doesn't do anything to any pointers left in it. + */ +void htable_clear(struct htable *ht); + + +/** + * htable_check - check hash table for consistency + * @ht: the htable + * @abortstr: the location to print on aborting, or NULL. + * + * Because hash tables have redundant information, consistency checking that + * each element is in the correct location can be done. This is useful as a + * debugging check. If @abortstr is non-NULL, that will be printed in a + * diagnostic if the htable is inconsistent, and the function will abort. + * + * Returns the htable if it is consistent, NULL if not (it can never return + * NULL if @abortstr is set). + */ +struct htable *htable_check(const struct htable *ht, const char *abortstr); + +/** + * htable_copy - duplicate a hash table. + * @dst: the hash table to overwrite + * @src: the hash table to copy + * + * Only fails on out-of-memory. + * + * Equivalent to (but faster than): + * if (!htable_init_sized(dst, src->rehash, src->priv, 1U << src->bits)) + * return false; + * v = htable_first(src, &i); + * while (v) { + * htable_add(dst, v); + * v = htable_next(src, i); + * } + * return true; + */ +#define htable_copy(dst, src) htable_copy_(dst, htable_debug(src, HTABLE_LOC)) +bool htable_copy_(struct htable *dst, const struct htable *src); + +/** + * htable_add - add a pointer into a hash table. + * @ht: the htable + * @hash: the hash value of the object + * @p: the non-NULL pointer (also cannot be (void *)1). + * + * Also note that this can only fail due to allocation failure. Otherwise, it + * returns true. + */ +#define htable_add(ht, hash, p) \ + htable_add_(htable_debug(ht, HTABLE_LOC), hash, p) +bool htable_add_(struct htable *ht, size_t hash, const void *p); + +/** + * htable_del - remove a pointer from a hash table + * @ht: the htable + * @hash: the hash value of the object + * @p: the pointer + * + * Returns true if the pointer was found (and deleted). + */ +#define htable_del(ht, hash, p) \ + htable_del_(htable_debug(ht, HTABLE_LOC), hash, p) +bool htable_del_(struct htable *ht, size_t hash, const void *p); + +/** + * struct htable_iter - iterator or htable_first or htable_firstval etc. + * + * This refers to a location inside the hashtable. + */ +struct htable_iter { + size_t off; +}; + +/** + * htable_firstval - find a candidate for a given hash value + * @htable: the hashtable + * @i: the struct htable_iter to initialize + * @hash: the hash value + * + * You'll need to check the value is what you want; returns NULL if none. + * See Also: + * htable_delval() + */ +#define htable_firstval(htable, i, hash) \ + htable_firstval_(htable_debug(htable, HTABLE_LOC), i, hash) + +void *htable_firstval_(const struct htable *htable, + struct htable_iter *i, size_t hash); + +/** + * htable_nextval - find another candidate for a given hash value + * @htable: the hashtable + * @i: the struct htable_iter to initialize + * @hash: the hash value + * + * You'll need to check the value is what you want; returns NULL if no more. + */ +#define htable_nextval(htable, i, hash) \ + htable_nextval_(htable_debug(htable, HTABLE_LOC), i, hash) +void *htable_nextval_(const struct htable *htable, + struct htable_iter *i, size_t hash); + +/** + * htable_get - find an entry in the hash table + * @ht: the hashtable + * @h: the hash value of the entry + * @cmp: the comparison function + * @ptr: the pointer to hand to the comparison function. + * + * Convenient inline wrapper for htable_firstval/htable_nextval loop. + */ +static inline void *htable_get(const struct htable *ht, + size_t h, + bool (*cmp)(const void *candidate, void *ptr), + const void *ptr) +{ + struct htable_iter i; + void *c; + + for (c = htable_firstval(ht,&i,h); c; c = htable_nextval(ht,&i,h)) { + if (cmp(c, (void *)ptr)) + return c; + } + return NULL; +} + +/** + * htable_first - find an entry in the hash table + * @ht: the hashtable + * @i: the struct htable_iter to initialize + * + * Get an entry in the hashtable; NULL if empty. + */ +#define htable_first(htable, i) \ + htable_first_(htable_debug(htable, HTABLE_LOC), i) +void *htable_first_(const struct htable *htable, struct htable_iter *i); + +/** + * htable_next - find another entry in the hash table + * @ht: the hashtable + * @i: the struct htable_iter to use + * + * Get another entry in the hashtable; NULL if all done. + * This is usually used after htable_first or prior non-NULL htable_next. + */ +#define htable_next(htable, i) \ + htable_next_(htable_debug(htable, HTABLE_LOC), i) +void *htable_next_(const struct htable *htable, struct htable_iter *i); + +/** + * htable_prev - find the previous entry in the hash table + * @ht: the hashtable + * @i: the struct htable_iter to use + * + * Get previous entry in the hashtable; NULL if all done. + * + * "previous" here only means the item that would have been returned by + * htable_next() before the item it returned most recently. + * + * This is usually used in the middle of (or after) a htable_next iteration and + * to "unwind" actions taken. + */ +#define htable_prev(htable, i) \ + htable_prev_(htable_debug(htable, HTABLE_LOC), i) +void *htable_prev_(const struct htable *htable, struct htable_iter *i); + +/** + * htable_delval - remove an iterated pointer from a hash table + * @ht: the htable + * @i: the htable_iter + * + * Usually used to delete a hash entry after it has been found with + * htable_firstval etc. + */ +#define htable_delval(htable, i) \ + htable_delval_(htable_debug(htable, HTABLE_LOC), i) +void htable_delval_(struct htable *ht, struct htable_iter *i); + +/** + * htable_pick - set iterator to a random valid entry. + * @ht: the htable + * @seed: a random number to use. + * @i: the htable_iter which is output (or NULL). + * + * Usually used with htable_delval to delete a random entry. Returns + * NULL iff the table is empty, otherwise a random entry. + */ +#define htable_pick(htable, seed, i) \ + htable_pick_(htable_debug(htable, HTABLE_LOC), seed, i) +void *htable_pick_(const struct htable *ht, size_t seed, struct htable_iter *i); + +/** + * htable_set_allocator - set calloc/free functions. + * @alloc: allocator to use, must zero memory! + * @free: unallocator to use (@p is NULL or a return from @alloc) + */ +void htable_set_allocator(void *(*alloc)(struct htable *, size_t len), + void (*free)(struct htable *, void *p)); +#endif /* CCAN_HTABLE_H */ diff --git a/ccan/ccan/htable/htable_type.h b/ccan/ccan/htable/htable_type.h new file mode 100644 index 0000000..0aacb7f --- /dev/null +++ b/ccan/ccan/htable/htable_type.h @@ -0,0 +1,188 @@ +/* Licensed under LGPLv2+ - see LICENSE file for details */ +#ifndef CCAN_HTABLE_TYPE_H +#define CCAN_HTABLE_TYPE_H +#include <ccan/htable/htable.h> +#include <ccan/compiler/compiler.h> +#include "config.h" + +/** + * HTABLE_DEFINE_TYPE - create a set of htable ops for a type + * @type: a type whose pointers will be values in the hash. + * @keyof: a function/macro to extract a key: <keytype> @keyof(const type *elem) + * @hashfn: a hash function for a @key: size_t @hashfn(const <keytype> *) + * @eqfn: an equality function keys: bool @eqfn(const type *, const <keytype> *) + * @prefix: a prefix for all the functions to define (of form <name>_*) + * + * NULL values may not be placed into the hash table. + * + * This defines the type hashtable type and an iterator type: + * struct <name>; + * struct <name>_iter; + * + * It also defines initialization and freeing functions: + * void <name>_init(struct <name> *); + * bool <name>_init_sized(struct <name> *, size_t); + * void <name>_clear(struct <name> *); + * bool <name>_copy(struct <name> *dst, const struct <name> *src); + * + * Count entries: + * size_t <name>_count(const struct <name> *ht); + * + * Add function only fails if we run out of memory: + * bool <name>_add(struct <name> *ht, const <type> *e); + * + * Delete and delete-by key return true if it was in the set: + * bool <name>_del(struct <name> *ht, const <type> *e); + * bool <name>_delkey(struct <name> *ht, const <keytype> *k); + * + * Delete by iterator: + * bool <name>_delval(struct <name> *ht, struct <name>_iter *i); + * + * Find and return the (first) matching element, or NULL: + * type *<name>_get(const struct @name *ht, const <keytype> *k); + * + * Find and return all matching elements, or NULL: + * type *<name>_getfirst(const struct @name *ht, const <keytype> *k, + * struct <name>_iter *i); + * type *<name>_getnext(const struct @name *ht, const <keytype> *k, + * struct <name>_iter *i); + * + * Iteration over hashtable is also supported: + * type *<name>_first(const struct <name> *ht, struct <name>_iter *i); + * type *<name>_next(const struct <name> *ht, struct <name>_iter *i); + * type *<name>_prev(const struct <name> *ht, struct <name>_iter *i); + * type *<name>_pick(const struct <name> *ht, size_t seed, + * struct <name>_iter *i); + * It's currently safe to iterate over a changing hashtable, but you might + * miss an element. Iteration isn't very efficient, either. + * + * You can use HTABLE_INITIALIZER like so: + * struct <name> ht = { HTABLE_INITIALIZER(ht.raw, <name>_hash, NULL) }; + */ +#define HTABLE_DEFINE_TYPE(type, keyof, hashfn, eqfn, name) \ + struct name { struct htable raw; }; \ + struct name##_iter { struct htable_iter i; }; \ + static inline size_t name##_hash(const void *elem, void *priv) \ + { \ + (void)priv; \ + return hashfn(keyof((const type *)elem)); \ + } \ + static inline UNNEEDED void name##_init(struct name *ht) \ + { \ + htable_init(&ht->raw, name##_hash, NULL); \ + } \ + static inline UNNEEDED bool name##_init_sized(struct name *ht, \ + size_t s) \ + { \ + return htable_init_sized(&ht->raw, name##_hash, NULL, s); \ + } \ + static inline UNNEEDED size_t name##_count(const struct name *ht) \ + { \ + return htable_count(&ht->raw); \ + } \ + static inline UNNEEDED void name##_clear(struct name *ht) \ + { \ + htable_clear(&ht->raw); \ + } \ + static inline UNNEEDED bool name##_copy(struct name *dst, \ + const struct name *src) \ + { \ + return htable_copy(&dst->raw, &src->raw); \ + } \ + static inline bool name##_add(struct name *ht, const type *elem) \ + { \ + return htable_add(&ht->raw, hashfn(keyof(elem)), elem); \ + } \ + static inline UNNEEDED bool name##_del(struct name *ht, \ + const type *elem) \ + { \ + return htable_del(&ht->raw, hashfn(keyof(elem)), elem); \ + } \ + static inline UNNEEDED type *name##_get(const struct name *ht, \ + const HTABLE_KTYPE(keyof, type) k) \ + { \ + struct htable_iter i; \ + size_t h = hashfn(k); \ + void *c; \ + \ + for (c = htable_firstval(&ht->raw,&i,h); \ + c; \ + c = htable_nextval(&ht->raw,&i,h)) { \ + if (eqfn(c, k)) \ + return c; \ + } \ + return NULL; \ + } \ + static inline UNNEEDED type *name##_getmatch_(const struct name *ht, \ + const HTABLE_KTYPE(keyof, type) k, \ + size_t h, \ + type *v, \ + struct name##_iter *iter) \ + { \ + while (v) { \ + if (eqfn(v, k)) \ + break; \ + v = htable_nextval(&ht->raw, &iter->i, h); \ + } \ + return v; \ + } \ + static inline UNNEEDED type *name##_getfirst(const struct name *ht, \ + const HTABLE_KTYPE(keyof, type) k, \ + struct name##_iter *iter) \ + { \ + size_t h = hashfn(k); \ + type *v = htable_firstval(&ht->raw, &iter->i, h); \ + return name##_getmatch_(ht, k, h, v, iter); \ + } \ + static inline UNNEEDED type *name##_getnext(const struct name *ht, \ + const HTABLE_KTYPE(keyof, type) k, \ + struct name##_iter *iter) \ + { \ + size_t h = hashfn(k); \ + type *v = htable_nextval(&ht->raw, &iter->i, h); \ + return name##_getmatch_(ht, k, h, v, iter); \ + } \ + static inline UNNEEDED bool name##_delkey(struct name *ht, \ + const HTABLE_KTYPE(keyof, type) k) \ + { \ + type *elem = name##_get(ht, k); \ + if (elem) \ + return name##_del(ht, elem); \ + return false; \ + } \ + static inline UNNEEDED void name##_delval(struct name *ht, \ + struct name##_iter *iter) \ + { \ + htable_delval(&ht->raw, &iter->i); \ + } \ + static inline UNNEEDED type *name##_pick(const struct name *ht, \ + size_t seed, \ + struct name##_iter *iter) \ + { \ + return htable_pick(&ht->raw, seed, iter ? &iter->i : NULL); \ + } \ + static inline UNNEEDED type *name##_first(const struct name *ht, \ + struct name##_iter *iter) \ + { \ + return htable_first(&ht->raw, &iter->i); \ + } \ + static inline UNNEEDED type *name##_next(const struct name *ht, \ + struct name##_iter *iter) \ + { \ + return htable_next(&ht->raw, &iter->i); \ + } \ + static inline UNNEEDED type *name##_prev(const struct name *ht, \ + struct name##_iter *iter) \ + { \ + return htable_prev(&ht->raw, &iter->i); \ + } + +#if HAVE_TYPEOF +#define HTABLE_KTYPE(keyof, type) typeof(keyof((const type *)NULL)) +#else +/* Assumes keys are a pointer: if not, override. */ +#ifndef HTABLE_KTYPE +#define HTABLE_KTYPE(keyof, type) void * +#endif +#endif +#endif /* CCAN_HTABLE_TYPE_H */ diff --git a/ccan/ccan/ilog/LICENSE b/ccan/ccan/ilog/LICENSE new file mode 120000 index 0000000..b7951da --- /dev/null +++ b/ccan/ccan/ilog/LICENSE @@ -0,0 +1 @@ +../../licenses/CC0
\ No newline at end of file diff --git a/ccan/ccan/ilog/ilog.c b/ccan/ccan/ilog/ilog.c new file mode 100644 index 0000000..5f5122d --- /dev/null +++ b/ccan/ccan/ilog/ilog.c @@ -0,0 +1,141 @@ +/*(C) Timothy B. Terriberry (tterribe@xiph.org) 2001-2009 CC0 (Public domain). + * See LICENSE file for details. */ +#include "ilog.h" +#include <limits.h> + +/*The fastest fallback strategy for platforms with fast multiplication appears + to be based on de Bruijn sequences~\cite{LP98}. + Tests confirmed this to be true even on an ARM11, where it is actually faster + than using the native clz instruction. + Define ILOG_NODEBRUIJN to use a simpler fallback on platforms where + multiplication or table lookups are too expensive. + + @UNPUBLISHED{LP98, + author="Charles E. Leiserson and Harald Prokop", + title="Using de {Bruijn} Sequences to Index a 1 in a Computer Word", + month=Jun, + year=1998, + note="\url{http://supertech.csail.mit.edu/papers/debruijn.pdf}" + }*/ +static UNNEEDED const unsigned char DEBRUIJN_IDX32[32]={ + 0, 1,28, 2,29,14,24, 3,30,22,20,15,25,17, 4, 8, + 31,27,13,23,21,19,16, 7,26,12,18, 6,11, 5,10, 9 +}; + +/* We always compile these in, in case someone takes address of function. */ +#undef ilog32_nz +#undef ilog32 +#undef ilog64_nz +#undef ilog64 + +int ilog32(uint32_t _v){ +/*On a Pentium M, this branchless version tested as the fastest version without + multiplications on 1,000,000,000 random 32-bit integers, edging out a + similar version with branches, and a 256-entry LUT version.*/ +# if defined(ILOG_NODEBRUIJN) + int ret; + int m; + ret=_v>0; + m=(_v>0xFFFFU)<<4; + _v>>=m; + ret|=m; + m=(_v>0xFFU)<<3; + _v>>=m; + ret|=m; + m=(_v>0xFU)<<2; + _v>>=m; + ret|=m; + m=(_v>3)<<1; + _v>>=m; + ret|=m; + ret+=_v>1; + return ret; +/*This de Bruijn sequence version is faster if you have a fast multiplier.*/ +# else + int ret; + ret=_v>0; + _v|=_v>>1; + _v|=_v>>2; + _v|=_v>>4; + _v|=_v>>8; + _v|=_v>>16; + _v=(_v>>1)+1; + ret+=DEBRUIJN_IDX32[_v*0x77CB531U>>27&0x1F]; + return ret; +# endif +} + +int ilog32_nz(uint32_t _v) +{ + return ilog32(_v); +} + +int ilog64(uint64_t _v){ +# if defined(ILOG_NODEBRUIJN) + uint32_t v; + int ret; + int m; + ret=_v>0; + m=(_v>0xFFFFFFFFU)<<5; + v=(uint32_t)(_v>>m); + ret|=m; + m=(v>0xFFFFU)<<4; + v>>=m; + ret|=m; + m=(v>0xFFU)<<3; + v>>=m; + ret|=m; + m=(v>0xFU)<<2; + v>>=m; + ret|=m; + m=(v>3)<<1; + v>>=m; + ret|=m; + ret+=v>1; + return ret; +# else +/*If we don't have a 64-bit word, split it into two 32-bit halves.*/ +# if LONG_MAX<9223372036854775807LL + uint32_t v; + int ret; + int m; + ret=_v>0; + m=(_v>0xFFFFFFFFU)<<5; + v=(uint32_t)(_v>>m); + ret|=m; + v|=v>>1; + v|=v>>2; + v|=v>>4; + v|=v>>8; + v|=v>>16; + v=(v>>1)+1; + ret+=DEBRUIJN_IDX32[v*0x77CB531U>>27&0x1F]; + return ret; +/*Otherwise do it in one 64-bit operation.*/ +# else + static const unsigned char DEBRUIJN_IDX64[64]={ + 0, 1, 2, 7, 3,13, 8,19, 4,25,14,28, 9,34,20,40, + 5,17,26,38,15,46,29,48,10,31,35,54,21,50,41,57, + 63, 6,12,18,24,27,33,39,16,37,45,47,30,53,49,56, + 62,11,23,32,36,44,52,55,61,22,43,51,60,42,59,58 + }; + int ret; + ret=_v>0; + _v|=_v>>1; + _v|=_v>>2; + _v|=_v>>4; + _v|=_v>>8; + _v|=_v>>16; + _v|=_v>>32; + _v=(_v>>1)+1; + ret+=DEBRUIJN_IDX64[_v*0x218A392CD3D5DBF>>58&0x3F]; + return ret; +# endif +# endif +} + +int ilog64_nz(uint64_t _v) +{ + return ilog64(_v); +} + diff --git a/ccan/ccan/ilog/ilog.h b/ccan/ccan/ilog/ilog.h new file mode 100644 index 0000000..32702b1 --- /dev/null +++ b/ccan/ccan/ilog/ilog.h @@ -0,0 +1,154 @@ +/* CC0 (Public domain) - see LICENSE file for details */ +#if !defined(_ilog_H) +# define _ilog_H (1) +# include "config.h" +# include <stdint.h> +# include <limits.h> +# include <ccan/compiler/compiler.h> + +/** + * ilog32 - Integer binary logarithm of a 32-bit value. + * @_v: A 32-bit value. + * Returns floor(log2(_v))+1, or 0 if _v==0. + * This is the number of bits that would be required to represent _v in two's + * complement notation with all of the leading zeros stripped. + * Note that many uses will resolve to the fast macro version instead. + * + * See Also: + * ilog32_nz(), ilog64() + * + * Example: + * // Rounds up to next power of 2 (if not a power of 2). + * static uint32_t round_up32(uint32_t i) + * { + * assert(i != 0); + * return 1U << ilog32(i-1); + * } + */ +int ilog32(uint32_t _v) CONST_FUNCTION; + +/** + * ilog32_nz - Integer binary logarithm of a non-zero 32-bit value. + * @_v: A 32-bit value. + * Returns floor(log2(_v))+1, or undefined if _v==0. + * This is the number of bits that would be required to represent _v in two's + * complement notation with all of the leading zeros stripped. + * Note that many uses will resolve to the fast macro version instead. + * See Also: + * ilog32(), ilog64_nz() + * Example: + * // Find Last Set (ie. highest bit set, 0 to 31). + * static uint32_t fls32(uint32_t i) + * { + * assert(i != 0); + * return ilog32_nz(i) - 1; + * } + */ +int ilog32_nz(uint32_t _v) CONST_FUNCTION; + +/** + * ilog64 - Integer binary logarithm of a 64-bit value. + * @_v: A 64-bit value. + * Returns floor(log2(_v))+1, or 0 if _v==0. + * This is the number of bits that would be required to represent _v in two's + * complement notation with all of the leading zeros stripped. + * Note that many uses will resolve to the fast macro version instead. + * See Also: + * ilog64_nz(), ilog32() + */ +int ilog64(uint64_t _v) CONST_FUNCTION; + +/** + * ilog64_nz - Integer binary logarithm of a non-zero 64-bit value. + * @_v: A 64-bit value. + * Returns floor(log2(_v))+1, or undefined if _v==0. + * This is the number of bits that would be required to represent _v in two's + * complement notation with all of the leading zeros stripped. + * Note that many uses will resolve to the fast macro version instead. + * See Also: + * ilog64(), ilog32_nz() + */ +int ilog64_nz(uint64_t _v) CONST_FUNCTION; + +/** + * STATIC_ILOG_32 - The integer logarithm of an (unsigned, 32-bit) constant. + * @_v: A non-negative 32-bit constant. + * Returns floor(log2(_v))+1, or 0 if _v==0. + * This is the number of bits that would be required to represent _v in two's + * complement notation with all of the leading zeros stripped. + * This macro should only be used when you need a compile-time constant, + * otherwise ilog32 or ilog32_nz are just as fast and more flexible. + * + * Example: + * #define MY_PAGE_SIZE 4096 + * #define MY_PAGE_BITS (STATIC_ILOG_32(PAGE_SIZE) - 1) + */ +#define STATIC_ILOG_32(_v) (STATIC_ILOG5((uint32_t)(_v))) + +/** + * STATIC_ILOG_64 - The integer logarithm of an (unsigned, 64-bit) constant. + * @_v: A non-negative 64-bit constant. + * Returns floor(log2(_v))+1, or 0 if _v==0. + * This is the number of bits that would be required to represent _v in two's + * complement notation with all of the leading zeros stripped. + * This macro should only be used when you need a compile-time constant, + * otherwise ilog64 or ilog64_nz are just as fast and more flexible. + */ +#define STATIC_ILOG_64(_v) (STATIC_ILOG6((uint64_t)(_v))) + +/* Private implementation details */ + +/*Note the casts to (int) below: this prevents "upgrading" + the type of an entire expression to an (unsigned) size_t.*/ +#if INT_MAX>=2147483647 && HAVE_BUILTIN_CLZ +#define builtin_ilog32_nz(v) \ + (((int)sizeof(unsigned)*CHAR_BIT) - __builtin_clz(v)) +#elif LONG_MAX>=2147483647L && HAVE_BUILTIN_CLZL +#define builtin_ilog32_nz(v) \ + (((int)sizeof(unsigned)*CHAR_BIT) - __builtin_clzl(v)) +#endif + +#if INT_MAX>=9223372036854775807LL && HAVE_BUILTIN_CLZ +#define builtin_ilog64_nz(v) \ + (((int)sizeof(unsigned)*CHAR_BIT) - __builtin_clz(v)) +#elif LONG_MAX>=9223372036854775807LL && HAVE_BUILTIN_CLZL +#define builtin_ilog64_nz(v) \ + (((int)sizeof(unsigned long)*CHAR_BIT) - __builtin_clzl(v)) +#elif HAVE_BUILTIN_CLZLL +#define builtin_ilog64_nz(v) \ + (((int)sizeof(unsigned long long)*CHAR_BIT) - __builtin_clzll(v)) +#endif + +#ifdef builtin_ilog32_nz +/* This used to be builtin_ilog32_nz(_v)&-!!(_v), which means it zeroes out + * the undefined builtin_ilog32_nz(0) return. But clang UndefinedBehaviorSantizer + * complains, so do the branch: */ +#define ilog32(_v) ((_v) ? builtin_ilog32_nz(_v) : 0) +#define ilog32_nz(_v) builtin_ilog32_nz(_v) +#else +#define ilog32_nz(_v) ilog32(_v) +#define ilog32(_v) (IS_COMPILE_CONSTANT(_v) ? STATIC_ILOG_32(_v) : ilog32(_v)) +#endif /* builtin_ilog32_nz */ + +#ifdef builtin_ilog64_nz +#define ilog32(_v) ((_v) ? builtin_ilog32_nz(_v) : 0) +#define ilog64_nz(_v) builtin_ilog64_nz(_v) +#else +#define ilog64_nz(_v) ilog64(_v) +#define ilog64(_v) (IS_COMPILE_CONSTANT(_v) ? STATIC_ILOG_64(_v) : ilog64(_v)) +#endif /* builtin_ilog64_nz */ + +/* Macros for evaluating compile-time constant ilog. */ +# define STATIC_ILOG0(_v) (!!(_v)) +# define STATIC_ILOG1(_v) (((_v)&0x2)?2:STATIC_ILOG0(_v)) +# define STATIC_ILOG2(_v) (((_v)&0xC)?2+STATIC_ILOG1((_v)>>2):STATIC_ILOG1(_v)) +# define STATIC_ILOG3(_v) \ + (((_v)&0xF0)?4+STATIC_ILOG2((_v)>>4):STATIC_ILOG2(_v)) +# define STATIC_ILOG4(_v) \ + (((_v)&0xFF00)?8+STATIC_ILOG3((_v)>>8):STATIC_ILOG3(_v)) +# define STATIC_ILOG5(_v) \ + (((_v)&0xFFFF0000)?16+STATIC_ILOG4((_v)>>16):STATIC_ILOG4(_v)) +# define STATIC_ILOG6(_v) \ + (((_v)&0xFFFFFFFF00000000ULL)?32+STATIC_ILOG5((_v)>>32):STATIC_ILOG5(_v)) + +#endif /* _ilog_H */ diff --git a/ccan/ccan/likely/LICENSE b/ccan/ccan/likely/LICENSE new file mode 120000 index 0000000..b7951da --- /dev/null +++ b/ccan/ccan/likely/LICENSE @@ -0,0 +1 @@ +../../licenses/CC0
\ No newline at end of file diff --git a/ccan/ccan/likely/likely.c b/ccan/ccan/likely/likely.c new file mode 100644 index 0000000..83e8d6f --- /dev/null +++ b/ccan/ccan/likely/likely.c @@ -0,0 +1,136 @@ +/* CC0 (Public domain) - see LICENSE file for details. */ +#ifdef CCAN_LIKELY_DEBUG +#include <ccan/likely/likely.h> +#include <ccan/hash/hash.h> +#include <ccan/htable/htable_type.h> +#include <stdlib.h> +#include <stdio.h> +struct trace { + const char *condstr; + const char *file; + unsigned int line; + bool expect; + unsigned long count, right; +}; + +static size_t hash_trace(const struct trace *trace) +{ + return hash(trace->condstr, strlen(trace->condstr), + hash(trace->file, strlen(trace->file), + trace->line + trace->expect)); +} + +static bool trace_eq(const struct trace *t1, const struct trace *t2) +{ + return t1->condstr == t2->condstr + && t1->file == t2->file + && t1->line == t2->line + && t1->expect == t2->expect; +} + +/* struct thash */ +HTABLE_DEFINE_TYPE(struct trace, (const struct trace *), hash_trace, trace_eq, + thash); + +static struct thash htable += { HTABLE_INITIALIZER(htable.raw, thash_hash, NULL) }; + +static void init_trace(struct trace *trace, + const char *condstr, const char *file, unsigned int line, + bool expect) +{ + trace->condstr = condstr; + trace->file = file; + trace->line = line; + trace->expect = expect; + trace->count = trace->right = 0; +} + +static struct trace *add_trace(const struct trace *t) +{ + struct trace *trace = malloc(sizeof(*trace)); + *trace = *t; + thash_add(&htable, trace); + return trace; +} + +long _likely_trace(bool cond, bool expect, + const char *condstr, + const char *file, unsigned int line) +{ + struct trace *p, trace; + + init_trace(&trace, condstr, file, line, expect); + p = thash_get(&htable, &trace); + if (!p) + p = add_trace(&trace); + + p->count++; + if (cond == expect) + p->right++; + + return cond; +} + +static double right_ratio(const struct trace *t) +{ + return (double)t->right / t->count; +} + +char *likely_stats(unsigned int min_hits, unsigned int percent) +{ + struct trace *worst; + double worst_ratio; + struct thash_iter i; + char *ret; + struct trace *t; + + worst = NULL; + worst_ratio = 2; + + /* This is O(n), but it's not likely called that often. */ + for (t = thash_first(&htable, &i); t; t = thash_next(&htable, &i)) { + if (t->count >= min_hits) { + if (right_ratio(t) < worst_ratio) { + worst = t; + worst_ratio = right_ratio(t); + } + } + } + + if (worst_ratio * 100 > percent) + return NULL; + + ret = malloc(strlen(worst->condstr) + + strlen(worst->file) + + sizeof(long int) * 8 + + sizeof("%s:%u:%slikely(%s) correct %u%% (%lu/%lu)")); + sprintf(ret, "%s:%u:%slikely(%s) correct %u%% (%lu/%lu)", + worst->file, worst->line, + worst->expect ? "" : "un", worst->condstr, + (unsigned)(worst_ratio * 100), + worst->right, worst->count); + + thash_del(&htable, worst); + free(worst); + + return ret; +} + +void likely_stats_reset(void) +{ + struct thash_iter i; + struct trace *t; + + /* This is a bit better than O(n^2), but we have to loop since + * first/next during delete is unreliable. */ + while ((t = thash_first(&htable, &i)) != NULL) { + for (; t; t = thash_next(&htable, &i)) { + thash_del(&htable, t); + free(t); + } + } + + thash_clear(&htable); +} +#endif /*CCAN_LIKELY_DEBUG*/ diff --git a/ccan/ccan/likely/likely.h b/ccan/ccan/likely/likely.h new file mode 100644 index 0000000..a8f003d --- /dev/null +++ b/ccan/ccan/likely/likely.h @@ -0,0 +1,111 @@ +/* CC0 (Public domain) - see LICENSE file for details */ +#ifndef CCAN_LIKELY_H +#define CCAN_LIKELY_H +#include "config.h" +#include <stdbool.h> + +#ifndef CCAN_LIKELY_DEBUG +#if HAVE_BUILTIN_EXPECT +/** + * likely - indicate that a condition is likely to be true. + * @cond: the condition + * + * This uses a compiler extension where available to indicate a likely + * code path and optimize appropriately; it's also useful for readers + * to quickly identify exceptional paths through functions. The + * threshold for "likely" is usually considered to be between 90 and + * 99%; marginal cases should not be marked either way. + * + * See Also: + * unlikely(), likely_stats() + * + * Example: + * // Returns false if we overflow. + * static inline bool inc_int(unsigned int *val) + * { + * (*val)++; + * if (likely(*val)) + * return true; + * return false; + * } + */ +#define likely(cond) __builtin_expect(!!(cond), 1) + +/** + * unlikely - indicate that a condition is unlikely to be true. + * @cond: the condition + * + * This uses a compiler extension where available to indicate an unlikely + * code path and optimize appropriately; see likely() above. + * + * See Also: + * likely(), likely_stats(), COLD (compiler.h) + * + * Example: + * // Prints a warning if we overflow. + * static inline void inc_int(unsigned int *val) + * { + * (*val)++; + * if (unlikely(*val == 0)) + * fprintf(stderr, "Overflow!"); + * } + */ +#define unlikely(cond) __builtin_expect(!!(cond), 0) +#else +#define likely(cond) (!!(cond)) +#define unlikely(cond) (!!(cond)) +#endif +#else /* CCAN_LIKELY_DEBUG versions */ +#include <ccan/str/str.h> + +#define likely(cond) \ + (_likely_trace(!!(cond), 1, stringify(cond), __FILE__, __LINE__)) +#define unlikely(cond) \ + (_likely_trace(!!(cond), 0, stringify(cond), __FILE__, __LINE__)) + +long _likely_trace(bool cond, bool expect, + const char *condstr, + const char *file, unsigned int line); +/** + * likely_stats - return description of abused likely()/unlikely() + * @min_hits: minimum number of hits + * @percent: maximum percentage correct + * + * When CCAN_LIKELY_DEBUG is defined, likely() and unlikely() trace their + * results: this causes a significant slowdown, but allows analysis of + * whether the branches are labelled correctly. + * + * This function returns a malloc'ed description of the least-correct + * usage of likely() or unlikely(). It ignores places which have been + * called less than @min_hits times, and those which were predicted + * correctly more than @percent of the time. It returns NULL when + * nothing meets those criteria. + * + * Note that this call is destructive; the returned offender is + * removed from the trace so that the next call to likely_stats() will + * return the next-worst likely()/unlikely() usage. + * + * Example: + * // Print every place hit more than twice which was wrong > 5%. + * static void report_stats(void) + * { + * #ifdef CCAN_LIKELY_DEBUG + * const char *bad; + * + * while ((bad = likely_stats(2, 95)) != NULL) { + * printf("Suspicious likely: %s", bad); + * free(bad); + * } + * #endif + * } + */ +char *likely_stats(unsigned int min_hits, unsigned int percent); + +/** + * likely_stats_reset - free up memory of likely()/unlikely() branches. + * + * This can also plug memory leaks. + */ +void likely_stats_reset(void); +#endif /* CCAN_LIKELY_DEBUG */ +#endif /* CCAN_LIKELY_H */ diff --git a/ccan/ccan/list/_info b/ccan/ccan/list/_info deleted file mode 100644 index c4f3e2a..0000000 --- a/ccan/ccan/list/_info +++ /dev/null @@ -1,72 +0,0 @@ -#include "config.h" -#include <stdio.h> -#include <string.h> - -/** - * list - double linked list routines - * - * The list header contains routines for manipulating double linked lists. - * It defines two types: struct list_head used for anchoring lists, and - * struct list_node which is usually embedded in the structure which is placed - * in the list. - * - * Example: - * #include <err.h> - * #include <stdio.h> - * #include <stdlib.h> - * #include <ccan/list/list.h> - * - * struct parent { - * const char *name; - * struct list_head children; - * unsigned int num_children; - * }; - * - * struct child { - * const char *name; - * struct list_node list; - * }; - * - * int main(int argc, char *argv[]) - * { - * struct parent p; - * struct child *c; - * int i; - * - * if (argc < 2) - * errx(1, "Usage: %s parent children...", argv[0]); - * - * p.name = argv[1]; - * list_head_init(&p.children); - * p.num_children = 0; - * for (i = 2; i < argc; i++) { - * c = malloc(sizeof(*c)); - * c->name = argv[i]; - * list_add(&p.children, &c->list); - * p.num_children++; - * } - * - * printf("%s has %u children:", p.name, p.num_children); - * list_for_each(&p.children, c, list) - * printf("%s ", c->name); - * printf("\n"); - * return 0; - * } - * - * License: BSD-MIT - * Author: Rusty Russell <rusty@rustcorp.com.au> - */ -int main(int argc, char *argv[]) -{ - if (argc != 2) - return 1; - - if (strcmp(argv[1], "depends") == 0) { - printf("ccan/str\n"); - printf("ccan/container_of\n"); - printf("ccan/check_type\n"); - return 0; - } - - return 1; -} diff --git a/ccan/ccan/short_types/LICENSE b/ccan/ccan/short_types/LICENSE new file mode 120000 index 0000000..b7951da --- /dev/null +++ b/ccan/ccan/short_types/LICENSE @@ -0,0 +1 @@ +../../licenses/CC0
\ No newline at end of file diff --git a/ccan/ccan/short_types/short_types.h b/ccan/ccan/short_types/short_types.h new file mode 100644 index 0000000..175377e --- /dev/null +++ b/ccan/ccan/short_types/short_types.h @@ -0,0 +1,35 @@ +/* CC0 (Public domain) - see LICENSE file for details */ +#ifndef CCAN_SHORT_TYPES_H +#define CCAN_SHORT_TYPES_H +#include <stdint.h> + +/** + * u64/s64/u32/s32/u16/s16/u8/s8 - short names for explicitly-sized types. + */ +typedef uint64_t u64; +typedef int64_t s64; +typedef uint32_t u32; +typedef int32_t s32; +typedef uint16_t u16; +typedef int16_t s16; +typedef uint8_t u8; +typedef int8_t s8; + +/* Whichever they include first, they get these definitions. */ +#ifdef CCAN_ENDIAN_H +/** + * be64/be32/be16 - 64/32/16 bit big-endian representation. + */ +typedef beint64_t be64; +typedef beint32_t be32; +typedef beint16_t be16; + +/** + * le64/le32/le16 - 64/32/16 bit little-endian representation. + */ +typedef leint64_t le64; +typedef leint32_t le32; +typedef leint16_t le16; +#endif + +#endif /* CCAN_SHORT_TYPES_H */ diff --git a/ccan/ccan/str/_info b/ccan/ccan/str/_info deleted file mode 100644 index b579525..0000000 --- a/ccan/ccan/str/_info +++ /dev/null @@ -1,52 +0,0 @@ -#include "config.h" -#include <stdio.h> -#include <string.h> - -/** - * str - string helper routines - * - * This is a grab bag of functions for string operations, designed to enhance - * the standard string.h. - * - * Note that if you define CCAN_STR_DEBUG, you will get extra compile - * checks on common misuses of the following functions (they will now - * be out-of-line, so there is a runtime penalty!). - * - * strstr, strchr, strrchr: - * Return const char * if first argument is const (gcc only). - * - * isalnum, isalpha, isascii, isblank, iscntrl, isdigit, isgraph, - * islower, isprint, ispunct, isspace, isupper, isxdigit: - * Static and runtime check that input is EOF or an *unsigned* - * char, as per C standard (really!). - * - * Example: - * #include <stdio.h> - * #include <ccan/str/str.h> - * - * int main(int argc, char *argv[]) - * { - * if (argc > 1 && streq(argv[1], "--verbose")) - * printf("verbose set\n"); - * if (argc > 1 && strstarts(argv[1], "--")) - * printf("Some option set\n"); - * if (argc > 1 && strends(argv[1], "cow-powers")) - * printf("Magic option set\n"); - * return 0; - * } - * - * License: CC0 (Public domain) - * Author: Rusty Russell <rusty@rustcorp.com.au> - */ -int main(int argc, char *argv[]) -{ - if (argc != 2) - return 1; - - if (strcmp(argv[1], "depends") == 0) { - printf("ccan/build_assert\n"); - return 0; - } - - return 1; -} diff --git a/ccan/ccan/strset/strset.c b/ccan/ccan/strset/strset.c new file mode 100644 index 0000000..06b0d7a --- /dev/null +++ b/ccan/ccan/strset/strset.c @@ -0,0 +1,309 @@ +/* This code is based on the public domain code at + * http://github.com/agl/critbit writtem by Adam Langley + * <agl@imperialviolet.org>. + * + * Here are the main implementation differences: + * (1) We don't strdup the string on insert; we use the pointer we're given. + * (2) We use a straight bit number rather than a mask; it's simpler. + * (3) We don't use the bottom bit of the pointer, but instead use a leading + * zero to distinguish nodes from strings. + * (4) The empty string (which would look like a node) is handled + * using a special "empty node". + * (5) Delete returns the string, so you can free it if you want to. + * (6) Unions instead of void *, bool instead of int. + */ +#include <ccan/strset/strset.h> +#include <ccan/short_types/short_types.h> +#include <ccan/likely/likely.h> +#include <ccan/str/str.h> +#include <ccan/ilog/ilog.h> +#include <assert.h> +#include <stdlib.h> +#include <errno.h> + +struct node { + /* To differentiate us from strings. */ + char nul_byte; + /* The bit where these children differ. */ + u8 bit_num; + /* The byte number where first bit differs (-1 == empty string node). */ + size_t byte_num; + /* These point to strings or nodes. */ + struct strset child[2]; +}; + +/* Closest member to this in a non-empty set. */ +static const char *closest(struct strset n, const char *member) +{ + size_t len = strlen(member); + const u8 *bytes = (const u8 *)member; + + /* Anything with first byte 0 is a node. */ + while (!n.u.s[0]) { + u8 direction = 0; + + /* Special node which represents the empty string. */ + if (unlikely(n.u.n->byte_num == (size_t)-1)) { + n = n.u.n->child[0]; + break; + } + + if (n.u.n->byte_num < len) { + u8 c = bytes[n.u.n->byte_num]; + direction = (c >> n.u.n->bit_num) & 1; + } + n = n.u.n->child[direction]; + } + return n.u.s; +} + +char *strset_get(const struct strset *set, const char *member) +{ + const char *str; + + /* Non-empty set? */ + if (set->u.n) { + str = closest(*set, member); + if (streq(member, str)) + return (char *)str; + } + errno = ENOENT; + return NULL; +} + +static bool set_string(struct strset *set, + struct strset *n, const char *member) +{ + /* Substitute magic empty node if this is the empty string */ + if (unlikely(!member[0])) { + n->u.n = malloc(sizeof(*n->u.n)); + if (unlikely(!n->u.n)) { + errno = ENOMEM; + return false; + } + n->u.n->nul_byte = '\0'; + n->u.n->byte_num = (size_t)-1; + /* Attach the string to child[0] */ + n = &n->u.n->child[0]; + } + n->u.s = member; + return true; +} + +bool strset_add(struct strset *set, const char *member) +{ + size_t len = strlen(member); + const u8 *bytes = (const u8 *)member; + struct strset *np; + const char *str; + struct node *newn; + size_t byte_num; + u8 bit_num, new_dir; + + /* Empty set? */ + if (!set->u.n) { + return set_string(set, set, member); + } + + /* Find closest existing member. */ + str = closest(*set, member); + + /* Find where they differ. */ + for (byte_num = 0; str[byte_num] == member[byte_num]; byte_num++) { + if (member[byte_num] == '\0') { + /* All identical! */ + errno = EEXIST; + return false; + } + } + + /* Find which bit differs (if we had ilog8, we'd use it) */ + bit_num = ilog32_nz((u8)str[byte_num] ^ bytes[byte_num]) - 1; + assert(bit_num < CHAR_BIT); + + /* Which direction do we go at this bit? */ + new_dir = ((bytes[byte_num]) >> bit_num) & 1; + + /* Allocate new node. */ + newn = malloc(sizeof(*newn)); + if (!newn) { + errno = ENOMEM; + return false; + } + newn->nul_byte = '\0'; + newn->byte_num = byte_num; + newn->bit_num = bit_num; + if (unlikely(!set_string(set, &newn->child[new_dir], member))) { + free(newn); + return false; + } + + /* Find where to insert: not closest, but first which differs! */ + np = set; + while (!np->u.s[0]) { + u8 direction = 0; + + /* Special node which represents the empty string will + * break here too! */ + if (np->u.n->byte_num > byte_num) + break; + /* Subtle: bit numbers are "backwards" for comparison */ + if (np->u.n->byte_num == byte_num && np->u.n->bit_num < bit_num) + break; + + if (np->u.n->byte_num < len) { + u8 c = bytes[np->u.n->byte_num]; + direction = (c >> np->u.n->bit_num) & 1; + } + np = &np->u.n->child[direction]; + } + + newn->child[!new_dir]= *np; + np->u.n = newn; + return true; +} + +char *strset_del(struct strset *set, const char *member) +{ + size_t len = strlen(member); + const u8 *bytes = (const u8 *)member; + struct strset *parent = NULL, *n; + const char *ret = NULL; + u8 direction = 0; /* prevent bogus gcc warning. */ + + /* Empty set? */ + if (!set->u.n) { + errno = ENOENT; + return NULL; + } + + /* Find closest, but keep track of parent. */ + n = set; + /* Anything with first byte 0 is a node. */ + while (!n->u.s[0]) { + u8 c = 0; + + /* Special node which represents the empty string. */ + if (unlikely(n->u.n->byte_num == (size_t)-1)) { + const char *empty_str = n->u.n->child[0].u.s; + + if (member[0]) { + errno = ENOENT; + return NULL; + } + + /* Sew empty string back so remaining logic works */ + free(n->u.n); + n->u.s = empty_str; + break; + } + + parent = n; + if (n->u.n->byte_num < len) { + c = bytes[n->u.n->byte_num]; + direction = (c >> n->u.n->bit_num) & 1; + } else + direction = 0; + n = &n->u.n->child[direction]; + } + + /* Did we find it? */ + if (!streq(member, n->u.s)) { + errno = ENOENT; + return NULL; + } + + ret = n->u.s; + + if (!parent) { + /* We deleted last node. */ + set->u.n = NULL; + } else { + struct node *old = parent->u.n; + /* Raise other node to parent. */ + *parent = old->child[!direction]; + free(old); + } + + return (char *)ret; +} + +static bool iterate(struct strset n, + bool (*handle)(const char *, void *), const void *data) +{ + if (n.u.s[0]) + return handle(n.u.s, (void *)data); + if (unlikely(n.u.n->byte_num == (size_t)-1)) + return handle(n.u.n->child[0].u.s, (void *)data); + + return iterate(n.u.n->child[0], handle, data) + && iterate(n.u.n->child[1], handle, data); +} + +void strset_iterate_(const struct strset *set, + bool (*handle)(const char *, void *), const void *data) +{ + /* Empty set? */ + if (!set->u.n) + return; + + iterate(*set, handle, data); +} + +const struct strset *strset_prefix(const struct strset *set, const char *prefix) +{ + const struct strset *n, *top; + size_t len = strlen(prefix); + const u8 *bytes = (const u8 *)prefix; + + /* Empty set -> return empty set. */ + if (!set->u.n) + return set; + + top = n = set; + + /* We walk to find the top, but keep going to check prefix matches. */ + while (!n->u.s[0]) { + u8 c = 0, direction; + + /* Special node which represents the empty string. */ + if (unlikely(n->u.n->byte_num == (size_t)-1)) { + n = &n->u.n->child[0]; + break; + } + + if (n->u.n->byte_num < len) + c = bytes[n->u.n->byte_num]; + + direction = (c >> n->u.n->bit_num) & 1; + n = &n->u.n->child[direction]; + if (c) + top = n; + } + + if (!strstarts(n->u.s, prefix)) { + /* Convenient return for prefixes which do not appear in set. */ + static const struct strset empty_set; + return &empty_set; + } + + return top; +} + +static void clear(struct strset n) +{ + if (!n.u.s[0]) { + if (likely(n.u.n->byte_num != (size_t)-1)) { + clear(n.u.n->child[0]); + clear(n.u.n->child[1]); + } + free(n.u.n); + } +} + +void strset_clear(struct strset *set) +{ + if (set->u.n) + clear(*set); + set->u.n = NULL; +} diff --git a/ccan/ccan/strset/strset.h b/ccan/ccan/strset/strset.h new file mode 100644 index 0000000..9d6f1ae --- /dev/null +++ b/ccan/ccan/strset/strset.h @@ -0,0 +1,167 @@ +#ifndef CCAN_STRSET_H +#define CCAN_STRSET_H +#include "config.h" +#include <ccan/typesafe_cb/typesafe_cb.h> +#include <stdlib.h> +#include <stdbool.h> + +/** + * struct strset - representation of a string set + * + * It's exposed here to allow you to embed it and so we can inline the + * trivial functions. + */ +struct strset { + union { + struct node *n; + const char *s; + } u; +}; + +/** + * strset_init - initialize a string set (empty) + * + * For completeness; if you've arranged for it to be NULL already you don't + * need this. + * + * Example: + * struct strset set; + * + * strset_init(&set); + */ +static inline void strset_init(struct strset *set) +{ + set->u.n = NULL; +} + +/** + * strset_empty - is this string set empty? + * @set: the set. + * + * Example: + * if (!strset_empty(&set)) + * abort(); + */ +static inline bool strset_empty(const struct strset *set) +{ + return set->u.n == NULL; +} + +/** + * strset_get - is this a member of this string set? + * @set: the set. + * @member: the string to search for. + * + * Returns the member, or NULL if it isn't in the set (and sets errno + * = ENOENT). + * + * Example: + * if (strset_get(&set, "hello")) + * printf("hello is in the set\n"); + */ +char *strset_get(const struct strset *set, const char *member); + +/** + * strset_add - place a member in the string set. + * @set: the set. + * @member: the string to place in the set. + * + * This returns false if we run out of memory (errno = ENOMEM), or + * (more normally) if that string already appears in the set (EEXIST). + * + * Note that the pointer is placed in the set, the string is not copied. If + * you want a copy in the set, use strdup(). + * + * Example: + * if (!strset_add(&set, "goodbye")) + * printf("goodbye was already in the set\n"); + */ +bool strset_add(struct strset *set, const char *member); + +/** + * strset_del - remove a member from the string set. + * @set: the set. + * @member: the string to remove from the set. + * + * This returns the string which was passed to strset_add(), or NULL if + * the string was not in the map (in which case it sets errno = ENOENT). + * + * This means that if you allocated a string (eg. using strdup()), you can + * free it here. + * + * Example: + * if (!strset_del(&set, "goodbye")) + * printf("goodbye was not in the set?\n"); + */ +char *strset_del(struct strset *set, const char *member); + +/** + * strset_clear - remove every member from the set. + * @set: the set. + * + * The set will be empty after this. + * + * Example: + * strset_clear(&set); + */ +void strset_clear(struct strset *set); + +/** + * strset_iterate - ordered iteration over a set + * @set: the set. + * @handle: the function to call. + * @arg: the argument for the function (types should match). + * + * You should not alter the set within the @handle function! If it returns + * false, the iteration will stop. + * + * Example: + * static bool dump_some(const char *member, int *num) + * { + * // Only dump out num nodes. + * if (*(num--) == 0) + * return false; + * printf("%s\n", member); + * return true; + * } + * + * static void dump_set(const struct strset *set) + * { + * int max = 100; + * strset_iterate(set, dump_some, &max); + * if (max < 0) + * printf("... (truncated to 100 entries)\n"); + * } + */ +#define strset_iterate(set, handle, arg) \ + strset_iterate_((set), typesafe_cb_preargs(bool, void *, \ + (handle), (arg), \ + const char *), \ + (arg)) +void strset_iterate_(const struct strset *set, + bool (*handle)(const char *, void *), const void *data); + + +/** + * strset_prefix - return a subset matching a prefix + * @set: the set. + * @prefix: the prefix. + * + * This returns a pointer into @set, so don't alter @set while using + * the return value. You can use strset_iterate(), strset_test() or + * strset_empty() on the returned pointer. + * + * Example: + * static void dump_prefix(const struct strset *set, const char *prefix) + * { + * int max = 100; + * printf("Nodes with prefix %s:\n", prefix); + * strset_iterate(strset_prefix(set, prefix), dump_some, &max); + * if (max < 0) + * printf("... (truncated to 100 entries)\n"); + * } + */ +const struct strset *strset_prefix(const struct strset *set, + const char *prefix); + +#endif /* CCAN_STRSET_H */ diff --git a/ccan/ccan/typesafe_cb/LICENSE b/ccan/ccan/typesafe_cb/LICENSE new file mode 120000 index 0000000..b7951da --- /dev/null +++ b/ccan/ccan/typesafe_cb/LICENSE @@ -0,0 +1 @@ +../../licenses/CC0
\ No newline at end of file diff --git a/ccan/ccan/typesafe_cb/typesafe_cb.h b/ccan/ccan/typesafe_cb/typesafe_cb.h new file mode 100644 index 0000000..126d325 --- /dev/null +++ b/ccan/ccan/typesafe_cb/typesafe_cb.h @@ -0,0 +1,134 @@ +/* CC0 (Public domain) - see LICENSE file for details */ +#ifndef CCAN_TYPESAFE_CB_H +#define CCAN_TYPESAFE_CB_H +#include "config.h" + +#if HAVE_TYPEOF && HAVE_BUILTIN_CHOOSE_EXPR && HAVE_BUILTIN_TYPES_COMPATIBLE_P +/** + * typesafe_cb_cast - only cast an expression if it matches a given type + * @desttype: the type to cast to + * @oktype: the type we allow + * @expr: the expression to cast + * + * This macro is used to create functions which allow multiple types. + * The result of this macro is used somewhere that a @desttype type is + * expected: if @expr is exactly of type @oktype, then it will be + * cast to @desttype type, otherwise left alone. + * + * This macro can be used in static initializers. + * + * This is merely useful for warnings: if the compiler does not + * support the primitives required for typesafe_cb_cast(), it becomes an + * unconditional cast, and the @oktype argument is not used. In + * particular, this means that @oktype can be a type which uses the + * "typeof": it will not be evaluated if typeof is not supported. + * + * Example: + * // We can take either an unsigned long or a void *. + * void _set_some_value(void *val); + * #define set_some_value(e) \ + * _set_some_value(typesafe_cb_cast(void *, unsigned long, (e))) + */ +#define typesafe_cb_cast(desttype, oktype, expr) \ + __builtin_choose_expr( \ + __builtin_types_compatible_p(__typeof__(0?(expr):(expr)), \ + oktype), \ + (desttype)(expr), (expr)) +#else +#define typesafe_cb_cast(desttype, oktype, expr) ((desttype)(expr)) +#endif + +/** + * typesafe_cb_cast3 - only cast an expression if it matches given types + * @desttype: the type to cast to + * @ok1: the first type we allow + * @ok2: the second type we allow + * @ok3: the third type we allow + * @expr: the expression to cast + * + * This is a convenient wrapper for multiple typesafe_cb_cast() calls. + * You can chain them inside each other (ie. use typesafe_cb_cast() + * for expr) if you need more than 3 arguments. + * + * Example: + * // We can take either a long, unsigned long, void * or a const void *. + * void _set_some_value(void *val); + * #define set_some_value(expr) \ + * _set_some_value(typesafe_cb_cast3(void *,, \ + * long, unsigned long, const void *,\ + * (expr))) + */ +#define typesafe_cb_cast3(desttype, ok1, ok2, ok3, expr) \ + typesafe_cb_cast(desttype, ok1, \ + typesafe_cb_cast(desttype, ok2, \ + typesafe_cb_cast(desttype, ok3, \ + (expr)))) + +/** + * typesafe_cb - cast a callback function if it matches the arg + * @rtype: the return type of the callback function + * @atype: the (pointer) type which the callback function expects. + * @fn: the callback function to cast + * @arg: the (pointer) argument to hand to the callback function. + * + * If a callback function takes a single argument, this macro does + * appropriate casts to a function which takes a single atype argument if the + * callback provided matches the @arg. + * + * It is assumed that @arg is of pointer type: usually @arg is passed + * or assigned to a void * elsewhere anyway. + * + * Example: + * void _register_callback(void (*fn)(void *arg), void *arg); + * #define register_callback(fn, arg) \ + * _register_callback(typesafe_cb(void, (fn), void*, (arg)), (arg)) + */ +#define typesafe_cb(rtype, atype, fn, arg) \ + typesafe_cb_cast(rtype (*)(atype), \ + rtype (*)(__typeof__(arg)), \ + (fn)) + +/** + * typesafe_cb_preargs - cast a callback function if it matches the arg + * @rtype: the return type of the callback function + * @atype: the (pointer) type which the callback function expects. + * @fn: the callback function to cast + * @arg: the (pointer) argument to hand to the callback function. + * + * This is a version of typesafe_cb() for callbacks that take other arguments + * before the @arg. + * + * Example: + * void _register_callback(void (*fn)(int, void *arg), void *arg); + * #define register_callback(fn, arg) \ + * _register_callback(typesafe_cb_preargs(void, void *, \ + * (fn), (arg), int), \ + * (arg)) + */ +#define typesafe_cb_preargs(rtype, atype, fn, arg, ...) \ + typesafe_cb_cast(rtype (*)(__VA_ARGS__, atype), \ + rtype (*)(__VA_ARGS__, __typeof__(arg)), \ + (fn)) + +/** + * typesafe_cb_postargs - cast a callback function if it matches the arg + * @rtype: the return type of the callback function + * @atype: the (pointer) type which the callback function expects. + * @fn: the callback function to cast + * @arg: the (pointer) argument to hand to the callback function. + * + * This is a version of typesafe_cb() for callbacks that take other arguments + * after the @arg. + * + * Example: + * void _register_callback(void (*fn)(void *arg, int), void *arg); + * #define register_callback(fn, arg) \ + * _register_callback(typesafe_cb_postargs(void, (fn), void *, \ + * (arg), int), \ + * (arg)) + */ +#define typesafe_cb_postargs(rtype, atype, fn, arg, ...) \ + typesafe_cb_cast(rtype (*)(atype, __VA_ARGS__), \ + rtype (*)(__typeof__(arg), __VA_ARGS__), \ + (fn)) +#endif /* CCAN_CAST_IF_TYPE_H */ diff --git a/ccan/licenses/LGPL-2.1 b/ccan/licenses/LGPL-2.1 new file mode 100644 index 0000000..2d2d780 --- /dev/null +++ b/ccan/licenses/LGPL-2.1 @@ -0,0 +1,510 @@ + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations +below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it +becomes a de-facto standard. To achieve this, non-free programs must +be allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control +compilation and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at least + three years, to give the same user the materials specified in + Subsection 6a, above, for a charge no more than the cost of + performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply, and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License +may add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms +of the ordinary General Public License). + + To apply these terms, attach the following notices to the library. +It is safest to attach them to the start of each source file to most +effectively convey the exclusion of warranty; and each file should +have at least the "copyright" line and a pointer to where the full +notice is found. + + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or +your school, if any, to sign a "copyright disclaimer" for the library, +if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James + Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/ccan/meson.build b/ccan/meson.build index 4ba3b5f..35d2b88 100644 --- a/ccan/meson.build +++ b/ccan/meson.build @@ -1,9 +1,14 @@ # SPDX-License-Identifier: GPL-2.0-or-later sources += files([ + 'ccan/hash/hash.c', + 'ccan/htable/htable.c', + 'ccan/ilog/ilog.c', + 'ccan/likely/likely.c', 'ccan/list/list.c', 'ccan/str/debug.c', 'ccan/str/str.c', + 'ccan/strset/strset.c', ]) if get_option('buildtype') == 'debug' diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..b63481a --- /dev/null +++ b/codecov.yml @@ -0,0 +1,6 @@ +--- +ignore: + - 'subprojects' + - 'ccan' + - 'tests' + - 'unit' diff --git a/completions/_nvme b/completions/_nvme index 49736f5..0d28788 100644 --- a/completions/_nvme +++ b/completions/_nvme @@ -36,7 +36,7 @@ _nvme () { 'get-log:retrieve any log in raw format' 'predictable-lat-log:retrieve predictable latency per nvmset log' 'pred-lat-event-agg-log:retrieve predictable latency event aggregate log' - 'persistent-event-log:retrieve presistent event log' + 'persistent-event-log:retrieve persistent event log' 'telemetry-log:retrieve telemetry log' 'fw-log:retrieve fw log' 'changed-ns-list-log:retrieve changed namespaces log' @@ -102,6 +102,8 @@ _nvme () { 'virt-mgmt:submit a Virtualization Management command' 'rpmb:submit an NVMe RPMB command' 'show-topology:show subsystem topology' + 'nvme-mi-recv:send a NVMe-MI receive command' + 'nvme-mi-send:send a NVMe-MI send command' 'version:show the program version' 'ocp:OCP cloud SSD extensions' 'help:print brief descriptions of all nvme commands' @@ -217,15 +219,15 @@ _nvme () { _arguments '*:: :->subcmds' _describe -t commands "nvme ocp clear-pcie-correctable-error-counters options" _clear_pcie_correctable_error_counters ;; - (vs-fw-activate-history) - local _vs_fw_activate_history - _vs_fw_activate_history=( + (fw-activate-history) + local _fw_activate_history + _fw_activate_history=( /dev/nvme':supply a device to use (required)' --output-format=':Output format: normal|json' -o':alias for --output-format' ) _arguments '*:: :->subcmds' - _describe -t commands "nvme ocp vs-fw-activate-history options" _vs_fw_activate_history + _describe -t commands "nvme ocp fw-activate-history options" _fw_activate_history ;; (device-capability-log) local _device_capability_log @@ -237,6 +239,30 @@ _nvme () { _arguments '*:: :->subcmds' _describe -t commands "nvme ocp device-capability-log options" _device_capability_log ;; + (set-dssd-power-state-feature) + local _set_dssd_power_state_feature + _set_dssd_power_state_feature=( + /dev/nvme':supply a device to use (required)' + --power-state=':DSSD Power State to set in watts' + -p':alias for --power-state' + --save':Specifies that the controller shall save the attribute' + -s':alias for --save' + --no-uuid':Skip UUID index search' + -n':alias for --no-uuid' + ) + _arguments '*:: :->subcmds' + _describe -t commands "nvme ocp set-dssd-power-state-feature options" _set_dssd_power_state_feature + ;; + (telemetry-string-log) + local _telemetry_string_log + _telemetry_string_log=( + /dev/nvme':supply a device to use (required)' + --output-file=':Output file name with path' + -o':alias for --output-file' + ) + _arguments '*:: :->subcmds' + _describe -t commands "nvme ocp internal-log options" _internal_log + ;; (*) _files ;; @@ -290,7 +316,7 @@ _nvme () { --human-readable':show infos in readable format' -H':alias of --human-readable' --vendor-specific':also dump binary vendor infos' - -v':alias of --vendor-specific' + -V':alias of --vendor-specific' ) _arguments '*:: :->subcmds' _describe -t commands "nvme id-ctrl options" _idctrl @@ -306,7 +332,7 @@ _nvme () { --human-readable':show infos in readable format' -H':alias of --human-readable' --vendor-specific':also dump binary vendor infos' - -v':alias of --vendor-specific' + -V':alias of --vendor-specific' ) _arguments '*:: :->subcmds' _describe -t commands "nvme id-ns options" _idns @@ -525,6 +551,8 @@ _nvme () { -a':alias of --anagrp-id' --nvmset-id=':NVM Set Identifier' -i':alias of --nvmset-id' + --endg-id=':Endurance Group Identifier' + -e':alias of --endg-id' --block-size=':target block size' -b':alias of --block-size' --timeout=':value for timeout' @@ -537,6 +565,16 @@ _nvme () { -S':alias of --nsze-si' --ncap-si=':capacity of ns (NCAP) in standard SI units' -C':alias of --ncap-si' + --azr=':Allocate ZRWA Resources (AZR) for Zoned Namespace Command Set' + -z':alias of --azr' + --rar=':Requested Active Resources (RAR) for Zoned Namespace Command Set' + -r':alias of --rar' + --ror=':Requested Open Resources (ROR) for Zoned Namespace Command Set' + -O':alias of --ror' + --rnumzrwa=':Requested Number of ZRWA Resources (RNUMZRWA) for Zoned Namespace Command Set' + -u':alias of --rnumzrwa' + --phndls=':Comma separated list of Placement Handle Associated RUH' + -p':alias of --phndls' ) _arguments '*:: :->subcmds' _describe -t commands "nvme create-ns options" _createns @@ -612,7 +650,7 @@ _nvme () { --aen=':result of the aen, use to override log id' -a':alias of --aen' --lpo=':log page offset specifies the location within a log page from where to start returning data' - -o':alias of --lpo' + -L':alias of --lpo' --lsi=':log specific identifier specifies an identifier that is required for a particular log page' -S':alias of --lsi' --rae':Retain an Asynchronous Event' @@ -648,7 +686,7 @@ _nvme () { _telemetry_log=( /dev/nvme':supply a device to use (required)' --output-file=':telemetry data output write' - -o':alias for --output-file' + -O':alias for --output-file' --host-generate=':Have the host tell the controller to generate the report' -g':alias to --host-generate' --controller-init':Gather report generated by the controller' @@ -887,7 +925,7 @@ _nvme () { _lockdown=( /dev/nvme':supply a device to use (required)' --ofi=':Opcode or Feature Identifier(OFI) (required)' - -o':alias of --ofi' + -O':alias of --ofi' --ifc=':Interface (INF) field Information (required)' -f':alias of --ifc' --prhbt=':Prohibit(PRHBT) bit field (required)' @@ -913,7 +951,7 @@ _nvme () { --data=':data file for LBA Type Range or host identifier buffer (defaults to stdin)' -d':alias to --data' --value=':new value of feature (required)' - -v'alias to --value' + -V'alias to --value' --uuid-index=':uuid index' -U':alias for --uuid-index' ) @@ -925,9 +963,9 @@ _nvme () { _set_property=( /dev/nvme':supply a device to use (required)' --offset=':the offset of the property' - -o':alias to --offset' + -O':alias to --offset' --value=':the value of the property to be set' - -v':alias to --value' + -V':alias to --value' ) _arguments '*:: :->subcmds' _describe -t commands "nvme set-property options" _set_property @@ -937,7 +975,7 @@ _nvme () { _get_property=( /dev/nvme':supply a device to use (required)' --offset=':the offset of the property' - -o':alias to --offset' + -O':alias to --offset' --human-readable':show infos in readable format' -H':alias of --human-readable' ) @@ -987,7 +1025,7 @@ _nvme () { --xfer=':limit on chunk-size of transfer (if device has download size limit)' -x':alias of --xfer' --offset=':starting offset, in dwords (defaults to 0, only useful if download is split across multiple files)' - -o':alias of --offset' + -O':alias of --offset' ) _arguments '*:: :->subcmds' _describe -t commands "nvme fw-download options" _fwd @@ -997,7 +1035,7 @@ _nvme () { _fwd=( /dev/nvme':supply a device to use (required)' --operation=':Operation to be performed by the controller' - -o':alias of --operation' + -O':alias of --operation' --element-id=':specific to the value of the Operation field' -i':alias of --element-id' --cap-lower=':Least significant 32 bits of the capacity in bytes' @@ -1191,7 +1229,7 @@ _nvme () { _admin=( /dev/nvme':supply a device to use (required)' --opcode=':hexadecimal opcode to send (required)' - -o':alias of --opcode' + -O':alias of --opcode' --flags=':command flags' -f':alias of --flags' --rsvd=':value for reserved field' @@ -1241,7 +1279,7 @@ _nvme () { _io=( /dev/nvme':supply a device to use (required)' --opcode=':hexadecimal opcode to send (required)' - -o':alias of --opcode' + -O':alias of --opcode' --flags=':command flags' -f':alias of --flags' --rsvd=':value for reserved field' @@ -1513,7 +1551,7 @@ _nvme () { --force-unit-access':if included, the data shall be read from non-volatile media' -f':alias of --force-unit access' --show-command':show command instead of sending to device' - -v':alias of --show-command' + -V':alias of --show-command' --dry-run':show command instead of sending to device' -w':alias of --show-command' ) @@ -1549,7 +1587,7 @@ _nvme () { --force-unit-access':data read shall be returned from nonvolatile media before command completion is indicated' -f':alias of --force-unit-access' --show-command':show command instead of sending to device' - -v':alias of --show-command' + -V':alias of --show-command' --dry-run':show command instead of sending to device' -w':alias of --show-command' ) @@ -1585,7 +1623,7 @@ _nvme () { --force-unit-access':data shall be written to nonvolatile media before command completion is indicated' -f':alias of --force-unit-access' --show-command':show command instead of sending to device' - -v':alias of --show-command' + -V':alias of --show-command' --dry-run':show command instead of sending to device' -w':alias of --show-command' ) @@ -1972,6 +2010,48 @@ _nvme () { _arguments '*:: :->subcmds' _describe -t commands "nvme show-topology options" _showtopology ;; + (nvme-mi-recv) + local _nvme_mi_recv + _nvme_mi_recv=( + --opcode=':NVMe-MI opcode to send' + -O':alias of --opcode' + --namespace-id=':value for nsid' + -n':alias of --namespace-id' + --data-len=':length for data buffer' + -l':alias of --data-len' + --nmimt':value for NVMe-MI message type' + -m':alias of --nmimt' + --nmd0':value for NVMe management request dword 0' + -0':alias of --nmd0' + --nmd1':value for NVMe management request dword 1' + -1':alias of --nmd1' + --input-file=':defaults to stdin; input for write (send direction)' + -i':alias for --input-file' + ) + _arguments '*:: :->subcmds' + _describe -t commands "nvme nvme-mi-recv options" _nvme_mi_recv + ;; + (nvme-mi-send) + local _nvme_mi_send + _nvme_mi_send=( + --opcode=':NVMe-MI opcode to send' + -O':alias of --opcode' + --namespace-id=':value for nsid' + -n':alias of --namespace-id' + --data-len=':length for data buffer' + -l':alias of --data-len' + --nmimt':value for NVMe-MI message type' + -m':alias of --nmimt' + --nmd0':value for NVMe management request dword 0' + -0':alias of --nmd0' + --nmd1':value for NVMe management request dword 1' + -1':alias of --nmd1' + --input-file=':defaults to stdin; input for write (send direction)' + -i':alias for --input-file' + ) + _arguments '*:: :->subcmds' + _describe -t commands "nvme nvme-mi-send options" _nvme_mi_send + ;; (version) local _version _version=( @@ -1991,6 +2071,8 @@ _nvme () { clear-pcie-correctable-error-counters':Clear PCIe correctable error counters' vs-fw-activate-history':Get firmware activation history log' device-capability-log':Get Device capability log' + set-dssd-power-state-feature':Set DSSD Power State' + telemetry-string-log':Retrieve Telemetry string Log Page' ) _arguments '*:: :->subcmds' _describe -t commands "nvme ocp options" _ocp diff --git a/completions/bash-nvme-completion.sh b/completions/bash-nvme-completion.sh index 8f451ff..5d62427 100644 --- a/completions/bash-nvme-completion.sh +++ b/completions/bash-nvme-completion.sh @@ -47,11 +47,11 @@ nvme_list_opts () { ;; "id-ctrl") opts+=" --raw-binary -b --human-readable -H \ - --vendor-specific -v --output-format= -o" + --vendor-specific -V --output-format= -o" ;; "id-ns") opts+=" --namespace-id= -n --raw-binary -b \ - --human-readable -H --vendor-specific -v \ + --human-readable -H --vendor-specific -V \ --force -f --output-format= -o" ;; "id-ns-granularity") @@ -114,7 +114,7 @@ nvme_list_opts () { --dps= -d --nmic= -m --anagrp-id= -a --nvmset-id= -i \ --block-size= -b --timeout= -t --csi= -y --lbstm= -l \ --nphndls= -n --nsze-si= -S --ncap-si= -C --azr -z --rar= -r \ - --ror= -o --rnumzrwa= -u --phndls= -p" + --ror= -O --rnumzrwa= -u --phndls= -p --endg-id= -e" ;; "delete-ns") opts+=" -namespace-id= -n --timeout= -t" @@ -130,7 +130,7 @@ nvme_list_opts () { ;; "get-log") opts+=" --log-id= -i --log-len= -l --namespace-id= -n \ - --aen= -a --lpo= -o --lsp= -s --lsi= -S \ + --aen= -a --lpo= -O --lsp= -s --lsi= -S \ --rae -r --uuid-index= -U --csi= -y --ot -O \ --raw-binary -b" ;; @@ -138,7 +138,7 @@ nvme_list_opts () { opts+=" --output-format= -o --human-readable -H" ;; "telemetry-log") - opts+=" --output-file= -o --host-generate= -g \ + opts+=" --output-file= -O --host-generate= -g \ --controller-init -c --data-area= -d" ;; "fw-log") @@ -220,10 +220,10 @@ nvme_list_opts () { --cdw12= -c" ;; "set-property") - opts+=" --offset= -o --value= -v" + opts+=" --offset= -O --value= -V" ;; "get-property") - opts=+" --offset= -o --human-readable -H" + opts=+" --offset= -O --human-readable -H" ;; "format") opts+=" --namespace-id= -n --timeout= -t --lbaf= -l \ @@ -233,18 +233,17 @@ nvme_list_opts () { opts+=" --slot= -s --action= -a --bpid= -b" ;; "fw-download") - opts+=" --fw= -f --xfer= -x --offset= -o" + opts+=" --fw= -f --xfer= -x --offset= -O" ;; "capacity-mgmt") - opts+=" --operation= -f --element-id= -i --cap-lower= -l \ - --cap-upper= -u" + opts+=" --operation= -O --element-id= -i --cap-lower= -l \ + --cap-upper= -u" ;; "lockdown") - opts+=" --ofi= -O --ifc= -F --prhbt= -P \ - -scp= -S --uuid -U" + opts+=" --ofi= -O --ifc= -f --prhbt= -p --scp= -s --uuid -U" ;; "admin-passthru") - opts+=" --opcode= -o --flags= -f --prefil= -p --rsvd= -R \ + opts+=" --opcode= -O --flags= -f --prefil= -p --rsvd= -R \ --namespace-id= -n --data-len= -l --metadata-len= -m \ --timeout= -t --cdw2= -2 --cdw3= -3 --cdw10= -4 \ --cdw11= -5 --cdw12= -6 --cdw13= -7 --cdw14= -8 \ @@ -253,7 +252,7 @@ nvme_list_opts () { --latency -T" ;; "io-passthru") - opts+=" --opcode= -o --flags= -f --prefill= -p --rsvd= -R \ + opts+=" --opcode= -O --flags= -f --prefill= -p --rsvd= -R \ --namespace-id= -n --data-len= -l --metadata-len= -m \ --timeout= -t --cdw2= -2 --cdw3= -3 --cdw10= -4 \ --cdw11= -5 --cdw12= -6 --cdw13= -7 --cdw14= -8 \ @@ -312,7 +311,7 @@ nvme_list_opts () { --metadata= -M --prinfo= -p --app-tag-mask= -m \ --app-tag= -a --limited-retry -l \ --force-unit-access -f --storage-tag-check -C \ - --dir-type= -T --dir-spec= -S --dsm= -D --show-command -v \ + --dir-type= -T --dir-spec= -S --dsm= -D --show-command -V \ --dry-run -w --latency -t" ;; "read") @@ -321,7 +320,7 @@ nvme_list_opts () { --metadata= -M --prinfo= -p --app-tag-mask= -m \ --app-tag= -a --limited-retry -l \ --force-unit-access -f --storage-tag-check -C \ - --dir-type= -T --dir-spec= -S --dsm= -D --show-command -v \ + --dir-type= -T --dir-spec= -S --dsm= -D --show-command -V \ --dry-run -w --latency -t" ;; "write") @@ -330,7 +329,7 @@ nvme_list_opts () { --metadata= -M --prinfo= -p --app-tag-mask= -m \ --app-tag= -a --limited-retry -l \ --force-unit-access -f --storage-tag-check -C \ - --dir-type= -T --dir-spec= -S --dsm= -D --show-command -v \ + --dir-type= -T --dir-spec= -S --dsm= -D --show-command -V \ --dry-run -w --latency -t" ;; "write-zeroes") @@ -446,6 +445,14 @@ nvme_list_opts () { "show-topology") opts+=" --output-format= -o --verbose -v --ranking= -r" ;; + "nvme-mi-recv") + opts+=" --opcode= -O --namespace-id= -n --data-len= -l \ + --nmimt= -m --nmd0= -0 --nmd1= -1 --input-file= -i" + ;; + "nvme-mi-send") + opts+=" --opcode= -O --namespace-id= -n --data-len= -l \ + --nmimt= -m --nmd0= -0 --nmd1= -1 --input-file= -i" + ;; "version") opts+=$NO_OPTS ;; @@ -983,7 +990,7 @@ plugin_shannon_opts () { --data-len= -l --raw-binary -b --cdw11= -c --human-readable -H" ;; "set-feature-add") - opts+=" --namespace-id= -n --feature-id= -f --value= -v \ + opts+=" --namespace-id= -n --feature-id= -f --value= -V \ --data-len= -l --data= -d --save -s" ;; "id-ctrl") @@ -1342,12 +1349,18 @@ plugin_ocp_opts () { "clear-pcie-correctable-error-counters") opts+=" --no-uuid -n" ;; - "vs-fw-activate-history") + "fw-activate-history") opts+=" --output-format= -o" ;; "device-capability-log") opts+=" --output-format= -o" ;; + "set-dssd-power-state-feature") + opts+=" --power-state= -p --no-uuid -n --save -s" + ;; + "telemetry-string-log") + opts+=" --output-file= -o" + ;; "help") opts+=$NO_OPTS ;; @@ -1416,10 +1429,11 @@ _nvme_subcmds () { set-latency-monitor-feature internal-log \ clear-fw-activate-history eol-plp-failure-mode \ clear-pcie-correctable-error-counters \ - vs-fw-activate-history device-capability-log" + vs-fw-activate-history device-capability-log \ + set-dssd-power-state-feature telemetry-string-log" ) - # Associative array mapping plugins to coresponding option completions + # Associative array mapping plugins to corresponding option completions typeset -Ar _plugin_funcs=( [intel]="plugin_intel_opts" [amzn]="plugin_amzn_opts" @@ -1466,14 +1480,15 @@ _nvme_subcmds () { show-hostnqn dir-receive dir-send virt-mgmt \ rpmb boot-part-log fid-support-effects-log \ supported-log-pages lockdown media-unit-stat-log \ - supported-cap-config-log dim show-topology list-endgrp" + supported-cap-config-log dim show-topology list-endgrp \ + nvme-mi-recv nvme-mi-send" # Add plugins: for plugin in "${!_plugin_subcmds[@]}"; do _cmds+=" $plugin" done - cmds+=" version help" + _cmds+=" version help" if [[ ${#words[*]} -lt 3 ]]; then COMPREPLY+=( $(compgen -W "$_cmds" -- $cur ) ) @@ -88,7 +88,7 @@ static const char *nvmf_config_file = "Use specified JSON configuration file or static const char *nvmf_context = "execution context identification string"; #define NVMF_ARGS(n, c, ...) \ - struct argconfig_commandline_options opts[] = { \ + struct argconfig_commandline_options n[] = { \ OPT_STRING("transport", 't', "STR", &transport, nvmf_tport), \ OPT_STRING("nqn", 'n', "STR", &subsysnqn, nvmf_nqn), \ OPT_STRING("traddr", 'a', "STR", &traddr, nvmf_traddr), \ @@ -117,30 +117,6 @@ static const char *nvmf_context = "execution context identification string"; OPT_END() \ } -/* - * Compare two C strings and handle NULL pointers gracefully. - * If either of the two strings is NULL, return 0 - * to let caller ignore the compare. - */ -static inline int strcmp0(const char *s1, const char *s2) -{ - if (!s1 || !s2) - return 0; - return strcmp(s1, s2); -} - -/* - * Compare two C strings and handle NULL pointers gracefully. - * If either of the two strings is NULL, return 0 - * to let caller ignore the compare. - */ -static inline int strcasecmp0(const char *s1, const char *s2) -{ - if (!s1 || !s2) - return 0; - return strcasecmp(s1, s2); -} - static bool is_persistent_discovery_ctrl(nvme_host_t h, nvme_ctrl_t c) { if (nvme_host_is_pdc_enabled(h, DEFAULT_PDC_ENABLED)) @@ -149,62 +125,26 @@ static bool is_persistent_discovery_ctrl(nvme_host_t h, nvme_ctrl_t c) return false; } -static bool disc_ctrl_config_match(nvme_ctrl_t c, struct tr_config *trcfg) -{ - if (nvme_ctrl_is_discovery_ctrl(c) && - !strcmp0(nvme_ctrl_get_transport(c), trcfg->transport) && - !strcasecmp0(nvme_ctrl_get_traddr(c), trcfg->traddr) && - !strcmp0(nvme_ctrl_get_trsvcid(c), trcfg->trsvcid) && - !strcmp0(nvme_ctrl_get_host_traddr(c), trcfg->host_traddr) && - !strcmp0(nvme_ctrl_get_host_iface(c), trcfg->host_iface)) - return true; - - return false; -} - -static bool ctrl_config_match(nvme_ctrl_t c, struct tr_config *trcfg) -{ - if (!strcmp0(nvme_ctrl_get_subsysnqn(c), trcfg->subsysnqn) && - !strcmp0(nvme_ctrl_get_transport(c), trcfg->transport) && - !strcasecmp0(nvme_ctrl_get_traddr(c), trcfg->traddr) && - !strcmp0(nvme_ctrl_get_trsvcid(c), trcfg->trsvcid) && - !strcmp0(nvme_ctrl_get_host_traddr(c), trcfg->host_traddr) && - !strcmp0(nvme_ctrl_get_host_iface(c), trcfg->host_iface)) - return true; - - return false; -} - -static nvme_ctrl_t __lookup_ctrl(nvme_root_t r, struct tr_config *trcfg, - bool (*filter)(nvme_ctrl_t, struct tr_config *)) +nvme_ctrl_t lookup_ctrl(nvme_host_t h, struct tr_config *trcfg) { - nvme_host_t h; nvme_subsystem_t s; nvme_ctrl_t c; - nvme_for_each_host(r, h) { - nvme_for_each_subsystem(h, s) { - nvme_subsystem_for_each_ctrl(s, c) { - if (!(filter(c, trcfg))) - continue; - return c; - } - } + nvme_for_each_subsystem(h, s) { + c = nvme_ctrl_find(s, + trcfg->transport, + trcfg->traddr, + trcfg->trsvcid, + trcfg->subsysnqn, + trcfg->host_traddr, + trcfg->host_iface); + if (c) + return c; } return NULL; } -static nvme_ctrl_t lookup_discovery_ctrl(nvme_root_t r, struct tr_config *trcfg) -{ - return __lookup_ctrl(r, trcfg, disc_ctrl_config_match); -} - -nvme_ctrl_t lookup_ctrl(nvme_root_t r, struct tr_config *trcfg) -{ - return __lookup_ctrl(r, trcfg, ctrl_config_match); -} - static int set_discovery_kato(struct nvme_fabrics_config *cfg) { int tmo = cfg->keep_alive_tmo; @@ -317,7 +257,6 @@ static int __discover(nvme_ctrl_t c, struct nvme_fabrics_config *defcfg, struct nvmf_discovery_log *log = NULL; nvme_subsystem_t s = nvme_ctrl_get_subsystem(c); nvme_host_t h = nvme_subsystem_get_host(s); - nvme_root_t r = nvme_host_get_root(h); uint64_t numrec; struct nvme_get_discovery_args args = { @@ -362,7 +301,7 @@ static int __discover(nvme_ctrl_t c, struct nvme_fabrics_config *defcfg, }; /* Already connected ? */ - cl = lookup_ctrl(r, &trcfg); + cl = lookup_ctrl(h, &trcfg); if (cl && nvme_ctrl_get_name(cl)) continue; @@ -475,9 +414,11 @@ static int discover_from_conf_file(nvme_root_t r, nvme_host_t h, nvmf_default_config(&cfg); - ret = flags = validate_output_format(format); - if (ret < 0) + ret = validate_output_format(format, &flags); + if (ret < 0) { + nvme_show_error("Invalid output format"); return ret; + } f = fopen(PATH_NVMF_DISC, "r"); if (f == NULL) { @@ -527,7 +468,7 @@ static int discover_from_conf_file(nvme_root_t r, nvme_host_t h, }; if (!force) { - c = lookup_discovery_ctrl(r, &trcfg); + c = lookup_ctrl(h, &trcfg); if (c) { __discover(c, &cfg, raw, connect, true, flags); @@ -621,7 +562,7 @@ static int discover_from_json_config_file(nvme_root_t r, nvme_host_t h, }; if (!force) { - cn = lookup_discovery_ctrl(r, &trcfg); + cn = lookup_ctrl(h, &trcfg); if (cn) { __discover(cn, &cfg, raw, connect, true, flags); @@ -677,6 +618,43 @@ static int nvme_read_volatile_config(nvme_root_t r) return ret; } +char *nvmf_hostid_from_hostnqn(const char *hostnqn) +{ + const char *uuid; + + if (!hostnqn) + return NULL; + + uuid = strstr(hostnqn, "uuid:"); + if (!uuid) + return NULL; + + return strdup(uuid + strlen("uuid:")); +} + +void nvmf_check_hostid_and_hostnqn(const char *hostid, const char *hostnqn) +{ + char *hostid_from_file, *hostid_from_hostnqn; + + if (!hostid) + return; + + hostid_from_file = nvmf_hostid_from_file(); + if (hostid_from_file && strcmp(hostid_from_file, hostid)) { + fprintf(stderr, "warning: use generated hostid instead of hostid file\n"); + free(hostid_from_file); + } + + if (!hostnqn) + return; + + hostid_from_hostnqn = nvmf_hostid_from_hostnqn(hostnqn); + if (hostid_from_hostnqn && strcmp(hostid_from_hostnqn, hostid)) { + fprintf(stderr, "warning: use hostid which does not match uuid in hostnqn\n"); + free(hostid_from_hostnqn); + } +} + int nvmf_discover(const char *desc, int argc, char **argv, bool connect) { char *subsysnqn = NVME_DISC_SUBSYS_NAME; @@ -721,9 +699,11 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect) if (ret) return ret; - ret = flags = validate_output_format(format); - if (ret < 0) + ret = validate_output_format(format, &flags); + if (ret < 0) { + nvme_show_error("Invalid output format"); return ret; + } if (!strcmp(config_file, "none")) config_file = NULL; @@ -753,10 +733,15 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect) hostid_arg = hostid; if (!hostnqn) hostnqn = hnqn = nvmf_hostnqn_from_file(); - if (!hostnqn) + if (!hostnqn) { hostnqn = hnqn = nvmf_hostnqn_generate(); + hostid = hid = nvmf_hostid_from_hostnqn(hostnqn); + } if (!hostid) hostid = hid = nvmf_hostid_from_file(); + if (!hostid && hostnqn) + hostid = hid = nvmf_hostid_from_hostnqn(hostnqn); + nvmf_check_hostid_and_hostnqn(hostid, hostnqn); h = nvme_lookup_host(r, hostnqn, hostid); if (!h) { ret = ENOMEM; @@ -807,7 +792,8 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect) c = nvme_scan_ctrl(r, device); if (c) { /* Check if device matches command-line options */ - if (!ctrl_config_match(c, &trcfg)) { + if (!nvme_ctrl_config_match(c, transport, traddr, trsvcid, subsysnqn, + cfg.host_traddr, cfg.host_iface)) { fprintf(stderr, "ctrl device %s found, ignoring non matching command-line options\n", device); @@ -855,7 +841,7 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect) } } if (!c && !force) { - c = lookup_discovery_ctrl(r, &trcfg); + c = lookup_ctrl(h, &trcfg); if (c) persistent = true; } @@ -903,7 +889,7 @@ int nvmf_connect(const char *desc, int argc, char **argv) int ret; enum nvme_print_flags flags; struct nvme_fabrics_config cfg = { 0 }; - char *format = ""; + char *format = "normal"; NVMF_ARGS(opts, cfg, @@ -920,7 +906,11 @@ int nvmf_connect(const char *desc, int argc, char **argv) if (ret) return ret; - flags = validate_output_format(format); + ret = validate_output_format(format, &flags); + if (ret < 0) { + nvme_show_error("Invalid output format"); + return ret; + } if (!subsysnqn) { fprintf(stderr, @@ -966,10 +956,15 @@ int nvmf_connect(const char *desc, int argc, char **argv) if (!hostnqn) hostnqn = hnqn = nvmf_hostnqn_from_file(); - if (!hostnqn) + if (!hostnqn) { hostnqn = hnqn = nvmf_hostnqn_generate(); + hostid = hid = nvmf_hostid_from_hostnqn(hostnqn); + } if (!hostid) hostid = hid = nvmf_hostid_from_file(); + if (!hostid && hostnqn) + hostid = hid = nvmf_hostid_from_hostnqn(hostnqn); + nvmf_check_hostid_and_hostnqn(hostid, hostnqn); h = nvme_lookup_host(r, hostnqn, hostid); if (!h) { errno = ENOMEM; @@ -989,7 +984,7 @@ int nvmf_connect(const char *desc, int argc, char **argv) .trsvcid = trsvcid, }; - c = lookup_ctrl(r, &trcfg); + c = lookup_ctrl(h, &trcfg); if (c && nvme_ctrl_get_name(c)) { fprintf(stderr, "already connected\n"); errno = EALREADY; @@ -11,7 +11,7 @@ struct tr_config { const char *trsvcid; }; -extern nvme_ctrl_t lookup_ctrl(nvme_root_t r, struct tr_config *trcfg); +extern nvme_ctrl_t lookup_ctrl(nvme_host_t h, struct tr_config *trcfg); extern int nvmf_discover(const char *desc, int argc, char **argv, bool connect); extern int nvmf_connect(const char *desc, int argc, char **argv); extern int nvmf_disconnect(const char *desc, int argc, char **argv); diff --git a/libnvme-wrap.c b/libnvme-wrap.c index 354e7f7..b5b4838 100644 --- a/libnvme-wrap.c +++ b/libnvme-wrap.c @@ -7,19 +7,24 @@ #include <dlfcn.h> #include <errno.h> +#include <stdlib.h> #include <libnvme.h> +#include "nvme-print.h" #define PROTO(args...) args #define ARGS(args...) args -#define VOID_FN(name, proto, args) \ -void __attribute__((weak)) name(proto) \ -{ \ - void (*fn)(proto); \ - fn = dlsym(RTLD_NEXT, #name); \ - if (fn) \ - fn(args); \ +#define VOID_FN(name, proto, args) \ +void __attribute__((weak)) name(proto) \ +{ \ + void (*fn)(proto); \ + fn = dlsym(RTLD_NEXT, #name); \ + if (!fn) { \ + nvme_show_error("libnvme function " #name " not found");\ + exit(EXIT_FAILURE); \ + } \ + fn(args); \ } #define FN(name, rtype, proto, args, defret) \ @@ -42,6 +47,18 @@ VOID_FN(nvme_init_copy_range_f1, __u32 *elbats, __u16 nr), ARGS(copy, nlbs, slbas, eilbrts, elbatms, elbats, nr)) +VOID_FN(nvme_init_copy_range_f2, + PROTO(struct nvme_copy_range_f2 *copy, __u32 *snsids, + __u16 *nlbs, __u64 *slbas, __u16 *sopts, __u32 *eilbrts, + __u32 *elbatms, __u32 *elbats, __u16 nr), + ARGS(copy, snsids, nlbs, slbas, sopts, eilbrts, elbatms, elbats, nr)) + +VOID_FN(nvme_init_copy_range_f3, + PROTO(struct nvme_copy_range_f3 *copy, __u32 *snsids, + __u16 *nlbs, __u64 *slbas, __u16 *sopts, __u64 *eilbrts, + __u32 *elbatms, __u32 *elbats, __u16 nr), + ARGS(copy, snsids, nlbs, slbas, sopts, eilbrts, elbatms, elbats, nr)) + FN(nvme_get_feature_length2, int, PROTO(int fid, __u32 cdw11, enum nvme_data_tfr dir, diff --git a/meson.build b/meson.build index af79bd4..0961c26 100644 --- a/meson.build +++ b/meson.build @@ -4,7 +4,7 @@ project( 'nvme-cli', ['c'], meson_version: '>= 0.50.0', license: 'GPL-2.0-only', - version: '2.5', + version: '2.7.1', default_options: [ 'c_std=gnu99', 'buildtype=debug', @@ -48,7 +48,7 @@ conf.set('SYSCONFDIR', '"@0@"'.format(sysconfdir)) conf.set('RUNDIR', '"@0@"'.format(rundir)) # Check for libnvme availability -libnvme_dep = dependency('libnvme', version: '>=1.5', required: true, +libnvme_dep = dependency('libnvme', version: '>=1.7', required: true, fallback : ['libnvme', 'libnvme_dep']) libnvme_mi_dep = dependency('libnvme-mi', required: true, fallback : ['libnvme', 'libnvme_mi_dep']) @@ -68,15 +68,6 @@ else endif conf.set('CONFIG_JSONC', json_c_dep.found(), description: 'Is json-c available?') -# Check for libhugetlbfs availability (optional) -if cc.has_header('hugetlbfs.h') - libhugetlbfs_dep = cc.find_library('hugetlbfs', - required : false) -else - libhugetlbfs_dep = dependency('', required: false) -endif -conf.set('CONFIG_LIBHUGETLBFS', libhugetlbfs_dep.found(), description: 'Is libhugetlbfs available?') - # Set the nvme-cli version conf.set('NVME_VERSION', '"' + meson.project_version() + '"') @@ -157,6 +148,11 @@ conf.set10( ), description: 'Is sys/random.h(getrandom) include-able?' ) +conf.set10( + 'HAVE_ATTRIBUTE_UNUSED', + cc.get_id() == 'clang', + description: 'Is compiler warning about unused static line function?' +) if cc.has_function_attribute('fallthrough') conf.set('fallthrough', '__attribute__((__fallthrough__))') @@ -217,6 +213,7 @@ endforeach systemd_files = [ 'nvmefc-boot-connections.service', 'nvmf-autoconnect.service', + 'nvmf-connect-nbft.service', 'nvmf-connect.target', 'nvmf-connect@.service', ] @@ -230,8 +227,9 @@ foreach file : systemd_files endforeach udev_files = [ + '65-persistent-net-nbft.rules', '70-nvmf-autoconnect.rules', - '71-nvmf-iopolicy-netapp.rules', + '71-nvmf-netapp.rules', ] foreach file : udev_files @@ -279,8 +277,7 @@ subdir('Documentation') executable( 'nvme', sources, - dependencies: [ libnvme_dep, libnvme_mi_dep, json_c_dep, - libhugetlbfs_dep ], + dependencies: [ libnvme_dep, libnvme_mi_dep, json_c_dep ], link_args: '-ldl', include_directories: incdir, install: true, @@ -329,7 +326,6 @@ if meson.version().version_compare('>=0.53.0') summary(path_dict, section: 'Paths') dep_dict = { 'json-c': json_c_dep.found(), - 'libhugetlbfs': libhugetlbfs_dep.found(), } summary(dep_dict, section: 'Dependencies') conf_dict = { @@ -144,7 +144,7 @@ int discover_from_nbft(nvme_root_t r, char *hostnqn_arg, char *hostid_arg, }; /* Already connected ? */ - cl = lookup_ctrl(r, &trcfg); + cl = lookup_ctrl(h, &trcfg); if (cl && nvme_ctrl_get_name(cl)) continue; @@ -170,7 +170,7 @@ int discover_from_nbft(nvme_root_t r, char *hostnqn_arg, char *hostid_arg, nvme_free_ctrl(c); trcfg.host_traddr = NULL; - cl = lookup_ctrl(r, &trcfg); + cl = lookup_ctrl(h, &trcfg); if (cl && nvme_ctrl_get_name(cl)) continue; diff --git a/nvme-builtin.h b/nvme-builtin.h index 784e19d..2d2bead 100644 --- a/nvme-builtin.h +++ b/nvme-builtin.h @@ -44,11 +44,12 @@ COMMAND_LIST( ENTRY("endurance-log", "Retrieve Endurance Group Log, show it", get_endurance_log) ENTRY("predictable-lat-log", "Retrieve Predictable Latency per Nvmset Log, show it", get_pred_lat_per_nvmset_log) ENTRY("pred-lat-event-agg-log", "Retrieve Predictable Latency Event Aggregate Log, show it", get_pred_lat_event_agg_log) - ENTRY("persistent-event-log", "Retrieve Presistent Event Log, show it", get_persistent_event_log) + ENTRY("persistent-event-log", "Retrieve Persistent Event Log, show it", get_persistent_event_log) ENTRY("endurance-event-agg-log", "Retrieve Endurance Group Event Aggregate Log, show it", get_endurance_event_agg_log) ENTRY("lba-status-log", "Retrieve LBA Status Information Log, show it", get_lba_status_log) ENTRY("resv-notif-log", "Retrieve Reservation Notification Log, show it", get_resv_notif_log) ENTRY("boot-part-log", "Retrieve Boot Partition Log, show it", get_boot_part_log) + ENTRY("phy-rx-eom-log", "Retrieve Physical Interface Receiver Eye Opening Measurement, show it", get_phy_rx_eom_log) ENTRY("get-feature", "Get feature and show the resulting value", get_feature) ENTRY("device-self-test", "Perform the necessary tests to observe the performance", device_self_test) ENTRY("self-test-log", "Retrieve the SELF-TEST Log, show it", self_test_log) @@ -102,7 +103,7 @@ COMMAND_LIST( ENTRY("check-tls-key", "Validate NVMeoF TLS PSK", check_tls_key) ENTRY("dir-receive", "Submit a Directive Receive command, return results", dir_receive) ENTRY("dir-send", "Submit a Directive Send command, return results", dir_send) - ENTRY("virt-mgmt", "Manage Flexible Resources between Primary and Secondary Controller ", virtual_mgmt) + ENTRY("virt-mgmt", "Manage Flexible Resources between Primary and Secondary Controller", virtual_mgmt) ENTRY("rpmb", "Replay Protection Memory Block commands", rpmb_cmd) ENTRY("lockdown", "Submit a Lockdown command,return result", lockdown_cmd) ENTRY("dim", "Send Discovery Information Management command to a Discovery Controller", dim_cmd) \ diff --git a/nvme-print-binary.c b/nvme-print-binary.c index 616d731..e9371e5 100644 --- a/nvme-print-binary.c +++ b/nvme-print-binary.c @@ -63,6 +63,18 @@ static void binary_boot_part_log(void *bp_log, const char *devname, d_raw((unsigned char *)bp_log, size); } +static void binary_phy_rx_eom_log(struct nvme_phy_rx_eom_log *log, + __u16 controller) +{ + size_t len; + if (log->eomip == NVME_PHY_RX_EOM_COMPLETED) + len = log->hsize + log->dsize * log->nd; + else + len = log->hsize; + + d_raw((unsigned char *)log, len); +} + static void binary_media_unit_stat_log(struct nvme_media_unit_stat_log *mus_log) { d_raw((unsigned char *)mus_log, sizeof(*mus_log)); @@ -234,8 +246,8 @@ static void binary_supported_log(struct nvme_supported_log_pages *support_log, d_raw((unsigned char *)support_log, sizeof(*support_log)); } -static void binary_endurance_log(struct nvme_endurance_group_log *endurance_log, - __u16 group_id, const char *devname) +static void binary_endurance_log(struct nvme_endurance_group_log *endurance_log, __u16 group_id, + const char *devname) { return d_raw((unsigned char *)endurance_log, sizeof(*endurance_log)); } @@ -286,13 +298,17 @@ static void binary_discovery_log(struct nvmf_discovery_log *log, int numrec) } static struct print_ops binary_print_ops = { + /* libnvme types.h print functions */ .ana_log = binary_ana_log, .boot_part_log = binary_boot_part_log, + .phy_rx_eom_log = binary_phy_rx_eom_log, .ctrl_list = binary_list_ctrl, .ctrl_registers = binary_ctrl_registers, .directive = binary_directive, .discovery_log = binary_discovery_log, + .effects_log_list = NULL, .endurance_group_event_agg_log = binary_endurance_group_event_agg_log, + .endurance_group_list = NULL, .endurance_log = binary_endurance_log, .error_log = binary_error_log, .fdp_config_log = binary_fdp_configs, @@ -306,6 +322,7 @@ static struct print_ops binary_print_ops = { .id_ctrl_nvm = binary_id_ctrl_nvm, .id_domain_list = binary_id_domain_list, .id_independent_id_ns = binary_cmd_set_independent_id_ns, + .id_iocs = NULL, .id_ns = binary_id_ns, .id_ns_descs = binary_id_ns_descs, .id_ns_granularity_list = binary_id_ns_granularity_list, @@ -315,6 +332,7 @@ static struct print_ops binary_print_ops = { .lba_status_log = binary_lba_status_log, .media_unit_stat_log = binary_media_unit_stat_log, .mi_cmd_support_effects_log = binary_mi_cmd_support_effects_log, + .ns_list = NULL, .ns_list_log = binary_changed_ns_list_log, .nvm_id_ns = binary_nvm_id_ns, .persistent_event_log = binary_persistent_event_log, @@ -325,14 +343,40 @@ static struct print_ops binary_print_ops = { .resv_report = binary_resv_report, .sanitize_log_page = binary_sanitize_log, .secondary_ctrl_list = binary_list_secondary_ctrl, + .select_result = NULL, .self_test_log = binary_self_test_log, + .single_property = NULL, .smart_log = binary_smart_log, .supported_cap_config_list_log = binary_supported_cap_config_log, .supported_log_pages = binary_supported_log, + .zns_start_zone_list = NULL, .zns_changed_zone_log = binary_zns_changed, + .zns_finish_zone_list = NULL, .zns_id_ctrl = binary_zns_id_ctrl, .zns_id_ns = binary_zns_id_ns, .zns_report_zones = binary_zns_report_zones, + .show_feature = NULL, + .show_feature_fields = NULL, + .id_ctrl_rpmbs = NULL, + .lba_range = NULL, + .lba_status_info = NULL, + .d = NULL, + .show_init = NULL, + .show_finish = NULL, + + /* libnvme tree print functions */ + .list_item = NULL, + .list_items = NULL, + .print_nvme_subsystem_list = NULL, + .topology_ctrl = NULL, + .topology_namespace = NULL, + + /* status and error messages */ + .connect_msg = NULL, + .show_message = NULL, + .show_perror = NULL, + .show_status = NULL, + .show_error_status = NULL, }; struct print_ops *nvme_get_binary_print_ops(enum nvme_print_flags flags) diff --git a/nvme-print-json.c b/nvme-print-json.c index 923b28e..5a09b6b 100644 --- a/nvme-print-json.c +++ b/nvme-print-json.c @@ -2,6 +2,7 @@ #include <assert.h> #include <errno.h> +#include <time.h> #include "nvme-print.h" @@ -10,9 +11,194 @@ #include "common.h" #define ERROR_MSG_LEN 100 +#define STR_LEN 100 +#define NAME_LEN 128 +#define BUF_LEN 320 +#define VAL_LEN 4096 +#define BYTE_TO_BIT(byte) ((byte) * 8) +#define POWER_OF_TWO(exponent) (1 << (exponent)) +#define MS_TO_SEC(time) ((time) / 1000) +#define MS500_TO_MS(time) ((time) * 500) +#define MS500_TO_SEC(time) (MS_TO_SEC(MS500_TO_MS(time))) + +#define array_add_obj json_array_add_value_object +#define array_add_str json_array_add_value_string + +#define obj_add_array json_object_add_value_array +#define obj_add_int json_object_add_value_int +#define obj_add_obj json_object_add_value_object +#define obj_add_str json_object_add_value_string +#define obj_add_uint json_object_add_value_uint +#define obj_add_uint128 json_object_add_value_uint128 +#define obj_add_uint64 json_object_add_value_uint64 static const uint8_t zero_uuid[16] = { 0 }; static struct print_ops json_print_ops; +static struct json_object *json_r = NULL; + +static void d_json(unsigned char *buf, int len, int width, int group, struct json_object *array) +{ + int i; + char ascii[32 + 1] = { 0 }; + + assert(width < sizeof(ascii)); + + for (i = 0; i < len; i++) { + ascii[i % width] = (buf[i] >= '!' && buf[i] <= '~') ? buf[i] : '.'; + if (!((i + 1) % width)) { + array_add_str(array, ascii); + memset(ascii, 0, sizeof(ascii)); + } + } + + if (strlen(ascii)) { + ascii[i % width + 1] = '\0'; + array_add_str(array, ascii); + } +} + +static void obj_add_uint_x(struct json_object *o, const char *k, __u32 v) +{ + char str[STR_LEN]; + + sprintf(str, "%x", v); + obj_add_str(o, k, str); +} + +static void obj_add_uint_0x(struct json_object *o, const char *k, __u32 v) +{ + char str[STR_LEN]; + + sprintf(str, "0x%x", v); + obj_add_str(o, k, str); +} + +static void obj_add_uint_02x(struct json_object *o, const char *k, __u32 v) +{ + char str[STR_LEN]; + + sprintf(str, "0x%02x", v); + obj_add_str(o, k, str); +} + +static void obj_add_uint_nx(struct json_object *o, const char *k, __u32 v) +{ + char str[STR_LEN]; + + sprintf(str, "%#x", v); + obj_add_str(o, k, str); +} + +static void obj_add_nprix64(struct json_object *o, const char *k, uint64_t v) +{ + char str[STR_LEN]; + + sprintf(str, "%#"PRIx64"", v); + obj_add_str(o, k, str); +} + +static void obj_add_prix64(struct json_object *o, const char *k, uint64_t v) +{ + char str[STR_LEN]; + + sprintf(str, "%"PRIx64"", v); + obj_add_str(o, k, str); +} + +static void obj_add_int_secs(struct json_object *o, const char *k, int v) +{ + char str[STR_LEN]; + + sprintf(str, "%d secs", v); + obj_add_str(o, k, str); +} + +static void obj_add_result(struct json_object *o, const char *v, ...) +{ + va_list ap; + va_start(ap, v); + char *value; + + if (vasprintf(&value, v, ap) < 0) + value = NULL; + + if (value) + obj_add_str(o, "Result", value); + else + obj_add_str(o, "Result", "Could not allocate string"); + + free(value); +} + +static void obj_add_key(struct json_object *o, const char *k, const char *v, ...) +{ + va_list ap; + va_start(ap, v); + char *value; + + if (vasprintf(&value, v, ap) < 0) + value = NULL; + + if (value) + obj_add_str(o, k, value); + else + obj_add_str(o, k, "Could not allocate string"); + + free(value); +} + +static struct json_object *obj_create_array_obj(struct json_object *o, const char *k) +{ + struct json_object *array = json_create_array(); + struct json_object *obj = json_create_object(); + + obj_add_array(o, k, array); + array_add_obj(array, obj); + + return obj; +} + +static struct json_object *obj_create(const char *k) +{ + struct json_object *array; + struct json_object *obj = json_create_object(); + + if (json_r) { + array = json_create_array(); + obj_add_array(json_r, k, array); + array_add_obj(array, obj); + } + + return obj; +} + +static void json_print(struct json_object *r) +{ + json_print_object(r, NULL); + printf("\n"); + json_free_object(r); +} + +static bool human(void) +{ + return json_print_ops.flags & VERBOSE; +} + +static void json_id_iocs(struct nvme_id_iocs *iocs) +{ + struct json_object *r = json_create_object(); + char json_str[STR_LEN]; + __u16 i; + + for (i = 0; i < ARRAY_SIZE(iocs->iocsc); i++) { + if (iocs->iocsc[i]) { + sprintf(json_str, "I/O Command Set Combination[%u]", i); + obj_add_uint64(r, json_str, le64_to_cpu(iocs->iocsc[i])); + } + } + + json_print(r); +} static void json_nvme_id_ns(struct nvme_id_ns *ns, unsigned int nsid, unsigned int lba_index, bool cap_only) @@ -20,106 +206,107 @@ static void json_nvme_id_ns(struct nvme_id_ns *ns, unsigned int nsid, char nguid_buf[2 * sizeof(ns->nguid) + 1], eui64_buf[2 * sizeof(ns->eui64) + 1]; char *nguid = nguid_buf, *eui64 = eui64_buf; - struct json_object *root; - struct json_object *lbafs; + struct json_object *r = json_create_object(); + struct json_object *lbafs = json_create_array(); + struct json_object *vs = json_create_array(); int i; - nvme_uint128_t nvmcap = le128_to_cpu(ns->nvmcap); - root = json_create_object(); - if (!cap_only) { - json_object_add_value_uint64(root, "nsze", le64_to_cpu(ns->nsze)); - json_object_add_value_uint64(root, "ncap", le64_to_cpu(ns->ncap)); - json_object_add_value_uint64(root, "nuse", le64_to_cpu(ns->nuse)); - json_object_add_value_int(root, "nsfeat", ns->nsfeat); + obj_add_uint64(r, "nsze", le64_to_cpu(ns->nsze)); + obj_add_uint64(r, "ncap", le64_to_cpu(ns->ncap)); + obj_add_uint64(r, "nuse", le64_to_cpu(ns->nuse)); + obj_add_int(r, "nsfeat", ns->nsfeat); } - json_object_add_value_int(root, "nlbaf", ns->nlbaf); + + obj_add_int(r, "nlbaf", ns->nlbaf); + if (!cap_only) - json_object_add_value_int(root, "flbas", ns->flbas); - json_object_add_value_int(root, "mc", ns->mc); - json_object_add_value_int(root, "dpc", ns->dpc); + obj_add_int(r, "flbas", ns->flbas); + + obj_add_int(r, "mc", ns->mc); + obj_add_int(r, "dpc", ns->dpc); + if (!cap_only) { - json_object_add_value_int(root, "dps", ns->dps); - json_object_add_value_int(root, "nmic", ns->nmic); - json_object_add_value_int(root, "rescap", ns->rescap); - json_object_add_value_int(root, "fpi", ns->fpi); - json_object_add_value_int(root, "dlfeat", ns->dlfeat); - json_object_add_value_int(root, "nawun", le16_to_cpu(ns->nawun)); - json_object_add_value_int(root, "nawupf", le16_to_cpu(ns->nawupf)); - json_object_add_value_int(root, "nacwu", le16_to_cpu(ns->nacwu)); - json_object_add_value_int(root, "nabsn", le16_to_cpu(ns->nabsn)); - json_object_add_value_int(root, "nabo", le16_to_cpu(ns->nabo)); - json_object_add_value_int(root, "nabspf", le16_to_cpu(ns->nabspf)); - json_object_add_value_int(root, "noiob", le16_to_cpu(ns->noiob)); - json_object_add_value_uint128(root, "nvmcap", nvmcap); - json_object_add_value_int(root, "nsattr", ns->nsattr); - json_object_add_value_int(root, "nvmsetid", le16_to_cpu(ns->nvmsetid)); + obj_add_int(r, "dps", ns->dps); + obj_add_int(r, "nmic", ns->nmic); + obj_add_int(r, "rescap", ns->rescap); + obj_add_int(r, "fpi", ns->fpi); + obj_add_int(r, "dlfeat", ns->dlfeat); + obj_add_int(r, "nawun", le16_to_cpu(ns->nawun)); + obj_add_int(r, "nawupf", le16_to_cpu(ns->nawupf)); + obj_add_int(r, "nacwu", le16_to_cpu(ns->nacwu)); + obj_add_int(r, "nabsn", le16_to_cpu(ns->nabsn)); + obj_add_int(r, "nabo", le16_to_cpu(ns->nabo)); + obj_add_int(r, "nabspf", le16_to_cpu(ns->nabspf)); + obj_add_int(r, "noiob", le16_to_cpu(ns->noiob)); + obj_add_uint128(r, "nvmcap", nvmcap); + obj_add_int(r, "nsattr", ns->nsattr); + obj_add_int(r, "nvmsetid", le16_to_cpu(ns->nvmsetid)); if (ns->nsfeat & 0x10) { - json_object_add_value_int(root, "npwg", le16_to_cpu(ns->npwg)); - json_object_add_value_int(root, "npwa", le16_to_cpu(ns->npwa)); - json_object_add_value_int(root, "npdg", le16_to_cpu(ns->npdg)); - json_object_add_value_int(root, "npda", le16_to_cpu(ns->npda)); - json_object_add_value_int(root, "nows", le16_to_cpu(ns->nows)); + obj_add_int(r, "npwg", le16_to_cpu(ns->npwg)); + obj_add_int(r, "npwa", le16_to_cpu(ns->npwa)); + obj_add_int(r, "npdg", le16_to_cpu(ns->npdg)); + obj_add_int(r, "npda", le16_to_cpu(ns->npda)); + obj_add_int(r, "nows", le16_to_cpu(ns->nows)); } - json_object_add_value_int(root, "mssrl", le16_to_cpu(ns->mssrl)); - json_object_add_value_uint(root, "mcl", le32_to_cpu(ns->mcl)); - json_object_add_value_int(root, "msrc", ns->msrc); + obj_add_int(r, "mssrl", le16_to_cpu(ns->mssrl)); + obj_add_uint(r, "mcl", le32_to_cpu(ns->mcl)); + obj_add_int(r, "msrc", ns->msrc); } - json_object_add_value_int(root, "nulbaf", ns->nulbaf); + + obj_add_int(r, "nulbaf", ns->nulbaf); if (!cap_only) { - json_object_add_value_uint(root, "anagrpid", le32_to_cpu(ns->anagrpid)); - json_object_add_value_int(root, "endgid", le16_to_cpu(ns->endgid)); + obj_add_uint(r, "anagrpid", le32_to_cpu(ns->anagrpid)); + obj_add_int(r, "endgid", le16_to_cpu(ns->endgid)); memset(eui64, 0, sizeof(eui64_buf)); + for (i = 0; i < sizeof(ns->eui64); i++) eui64 += sprintf(eui64, "%02x", ns->eui64[i]); memset(nguid, 0, sizeof(nguid_buf)); + for (i = 0; i < sizeof(ns->nguid); i++) nguid += sprintf(nguid, "%02x", ns->nguid[i]); - json_object_add_value_string(root, "eui64", eui64_buf); - json_object_add_value_string(root, "nguid", nguid_buf); + obj_add_str(r, "eui64", eui64_buf); + obj_add_str(r, "nguid", nguid_buf); } - lbafs = json_create_array(); - json_object_add_value_array(root, "lbafs", lbafs); + obj_add_array(r, "lbafs", lbafs); for (i = 0; i <= ns->nlbaf; i++) { struct json_object *lbaf = json_create_object(); - json_object_add_value_int(lbaf, "ms", - le16_to_cpu(ns->lbaf[i].ms)); - json_object_add_value_int(lbaf, "ds", ns->lbaf[i].ds); - json_object_add_value_int(lbaf, "rp", ns->lbaf[i].rp); + obj_add_int(lbaf, "ms", le16_to_cpu(ns->lbaf[i].ms)); + obj_add_int(lbaf, "ds", ns->lbaf[i].ds); + obj_add_int(lbaf, "rp", ns->lbaf[i].rp); - json_array_add_value_object(lbafs, lbaf); + array_add_obj(lbafs, lbaf); } - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + d_json(ns->vs, strnlen((const char *)ns->vs, sizeof(ns->vs)), 16, 1, vs); + obj_add_array(r, "vs", vs); + + json_print(r); } void json_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, - void (*vs)(__u8 *vs, struct json_object *root)) + void (*vs)(__u8 *vs, struct json_object *r)) { - struct json_object *root; - struct json_object *psds; - + struct json_object *r = json_create_object(); + struct json_object *psds = json_create_array(); nvme_uint128_t tnvmcap = le128_to_cpu(ctrl->tnvmcap); nvme_uint128_t unvmcap = le128_to_cpu(ctrl->unvmcap); nvme_uint128_t megcap = le128_to_cpu(ctrl->megcap); nvme_uint128_t maxdna = le128_to_cpu(ctrl->maxdna); - char sn[sizeof(ctrl->sn) + 1], mn[sizeof(ctrl->mn) + 1], fr[sizeof(ctrl->fr) + 1], subnqn[sizeof(ctrl->subnqn) + 1]; __u32 ieee = ctrl->ieee[2] << 16 | ctrl->ieee[1] << 8 | ctrl->ieee[0]; - int i; snprintf(sn, sizeof(sn), "%-.*s", (int)sizeof(ctrl->sn), ctrl->sn); @@ -127,204 +314,170 @@ static void json_nvme_id_ns(struct nvme_id_ns *ns, unsigned int nsid, snprintf(fr, sizeof(fr), "%-.*s", (int)sizeof(ctrl->fr), ctrl->fr); snprintf(subnqn, sizeof(subnqn), "%-.*s", (int)sizeof(ctrl->subnqn), ctrl->subnqn); - root = json_create_object(); - - json_object_add_value_int(root, "vid", le16_to_cpu(ctrl->vid)); - json_object_add_value_int(root, "ssvid", le16_to_cpu(ctrl->ssvid)); - json_object_add_value_string(root, "sn", sn); - json_object_add_value_string(root, "mn", mn); - json_object_add_value_string(root, "fr", fr); - json_object_add_value_int(root, "rab", ctrl->rab); - json_object_add_value_int(root, "ieee", ieee); - json_object_add_value_int(root, "cmic", ctrl->cmic); - json_object_add_value_int(root, "mdts", ctrl->mdts); - json_object_add_value_int(root, "cntlid", le16_to_cpu(ctrl->cntlid)); - json_object_add_value_uint(root, "ver", le32_to_cpu(ctrl->ver)); - json_object_add_value_uint(root, "rtd3r", le32_to_cpu(ctrl->rtd3r)); - json_object_add_value_uint(root, "rtd3e", le32_to_cpu(ctrl->rtd3e)); - json_object_add_value_uint(root, "oaes", le32_to_cpu(ctrl->oaes)); - json_object_add_value_uint(root, "ctratt", le32_to_cpu(ctrl->ctratt)); - json_object_add_value_int(root, "rrls", le16_to_cpu(ctrl->rrls)); - json_object_add_value_int(root, "cntrltype", ctrl->cntrltype); - json_object_add_value_string(root, "fguid", util_uuid_to_string(ctrl->fguid)); - json_object_add_value_int(root, "crdt1", le16_to_cpu(ctrl->crdt1)); - json_object_add_value_int(root, "crdt2", le16_to_cpu(ctrl->crdt2)); - json_object_add_value_int(root, "crdt3", le16_to_cpu(ctrl->crdt3)); - json_object_add_value_int(root, "nvmsr", ctrl->nvmsr); - json_object_add_value_int(root, "vwci", ctrl->vwci); - json_object_add_value_int(root, "mec", ctrl->mec); - json_object_add_value_int(root, "oacs", le16_to_cpu(ctrl->oacs)); - json_object_add_value_int(root, "acl", ctrl->acl); - json_object_add_value_int(root, "aerl", ctrl->aerl); - json_object_add_value_int(root, "frmw", ctrl->frmw); - json_object_add_value_int(root, "lpa", ctrl->lpa); - json_object_add_value_int(root, "elpe", ctrl->elpe); - json_object_add_value_int(root, "npss", ctrl->npss); - json_object_add_value_int(root, "avscc", ctrl->avscc); - json_object_add_value_int(root, "apsta", ctrl->apsta); - json_object_add_value_int(root, "wctemp", le16_to_cpu(ctrl->wctemp)); - json_object_add_value_int(root, "cctemp", le16_to_cpu(ctrl->cctemp)); - json_object_add_value_int(root, "mtfa", le16_to_cpu(ctrl->mtfa)); - json_object_add_value_uint(root, "hmpre", le32_to_cpu(ctrl->hmpre)); - json_object_add_value_uint(root, "hmmin", le32_to_cpu(ctrl->hmmin)); - json_object_add_value_uint128(root, "tnvmcap", tnvmcap); - json_object_add_value_uint128(root, "unvmcap", unvmcap); - json_object_add_value_uint(root, "rpmbs", le32_to_cpu(ctrl->rpmbs)); - json_object_add_value_int(root, "edstt", le16_to_cpu(ctrl->edstt)); - json_object_add_value_int(root, "dsto", ctrl->dsto); - json_object_add_value_int(root, "fwug", ctrl->fwug); - json_object_add_value_int(root, "kas", le16_to_cpu(ctrl->kas)); - json_object_add_value_int(root, "hctma", le16_to_cpu(ctrl->hctma)); - json_object_add_value_int(root, "mntmt", le16_to_cpu(ctrl->mntmt)); - json_object_add_value_int(root, "mxtmt", le16_to_cpu(ctrl->mxtmt)); - json_object_add_value_uint(root, "sanicap", le32_to_cpu(ctrl->sanicap)); - json_object_add_value_uint(root, "hmminds", le32_to_cpu(ctrl->hmminds)); - json_object_add_value_int(root, "hmmaxd", le16_to_cpu(ctrl->hmmaxd)); - json_object_add_value_int(root, "nsetidmax", - le16_to_cpu(ctrl->nsetidmax)); - json_object_add_value_int(root, "endgidmax", le16_to_cpu(ctrl->endgidmax)); - json_object_add_value_int(root, "anatt",ctrl->anatt); - json_object_add_value_int(root, "anacap", ctrl->anacap); - json_object_add_value_uint(root, "anagrpmax", - le32_to_cpu(ctrl->anagrpmax)); - json_object_add_value_uint(root, "nanagrpid", - le32_to_cpu(ctrl->nanagrpid)); - json_object_add_value_uint(root, "pels", le32_to_cpu(ctrl->pels)); - json_object_add_value_int(root, "domainid", le16_to_cpu(ctrl->domainid)); - json_object_add_value_uint128(root, "megcap", megcap); - json_object_add_value_int(root, "sqes", ctrl->sqes); - json_object_add_value_int(root, "cqes", ctrl->cqes); - json_object_add_value_int(root, "maxcmd", le16_to_cpu(ctrl->maxcmd)); - json_object_add_value_uint(root, "nn", le32_to_cpu(ctrl->nn)); - json_object_add_value_int(root, "oncs", le16_to_cpu(ctrl->oncs)); - json_object_add_value_int(root, "fuses", le16_to_cpu(ctrl->fuses)); - json_object_add_value_int(root, "fna", ctrl->fna); - json_object_add_value_int(root, "vwc", ctrl->vwc); - json_object_add_value_int(root, "awun", le16_to_cpu(ctrl->awun)); - json_object_add_value_int(root, "awupf", le16_to_cpu(ctrl->awupf)); - json_object_add_value_int(root, "icsvscc", ctrl->icsvscc); - json_object_add_value_int(root, "nwpc", ctrl->nwpc); - json_object_add_value_int(root, "acwu", le16_to_cpu(ctrl->acwu)); - json_object_add_value_int(root, "ocfs", le16_to_cpu(ctrl->ocfs)); - json_object_add_value_uint(root, "sgls", le32_to_cpu(ctrl->sgls)); - json_object_add_value_uint(root, "mnan", le32_to_cpu(ctrl->mnan)); - json_object_add_value_uint128(root, "maxdna", maxdna); - json_object_add_value_uint(root, "maxcna", le32_to_cpu(ctrl->maxcna)); + obj_add_int(r, "vid", le16_to_cpu(ctrl->vid)); + obj_add_int(r, "ssvid", le16_to_cpu(ctrl->ssvid)); + obj_add_str(r, "sn", sn); + obj_add_str(r, "mn", mn); + obj_add_str(r, "fr", fr); + obj_add_int(r, "rab", ctrl->rab); + obj_add_int(r, "ieee", ieee); + obj_add_int(r, "cmic", ctrl->cmic); + obj_add_int(r, "mdts", ctrl->mdts); + obj_add_int(r, "cntlid", le16_to_cpu(ctrl->cntlid)); + obj_add_uint(r, "ver", le32_to_cpu(ctrl->ver)); + obj_add_uint(r, "rtd3r", le32_to_cpu(ctrl->rtd3r)); + obj_add_uint(r, "rtd3e", le32_to_cpu(ctrl->rtd3e)); + obj_add_uint(r, "oaes", le32_to_cpu(ctrl->oaes)); + obj_add_uint(r, "ctratt", le32_to_cpu(ctrl->ctratt)); + obj_add_int(r, "rrls", le16_to_cpu(ctrl->rrls)); + obj_add_int(r, "cntrltype", ctrl->cntrltype); + obj_add_str(r, "fguid", util_uuid_to_string(ctrl->fguid)); + obj_add_int(r, "crdt1", le16_to_cpu(ctrl->crdt1)); + obj_add_int(r, "crdt2", le16_to_cpu(ctrl->crdt2)); + obj_add_int(r, "crdt3", le16_to_cpu(ctrl->crdt3)); + obj_add_int(r, "nvmsr", ctrl->nvmsr); + obj_add_int(r, "vwci", ctrl->vwci); + obj_add_int(r, "mec", ctrl->mec); + obj_add_int(r, "oacs", le16_to_cpu(ctrl->oacs)); + obj_add_int(r, "acl", ctrl->acl); + obj_add_int(r, "aerl", ctrl->aerl); + obj_add_int(r, "frmw", ctrl->frmw); + obj_add_int(r, "lpa", ctrl->lpa); + obj_add_int(r, "elpe", ctrl->elpe); + obj_add_int(r, "npss", ctrl->npss); + obj_add_int(r, "avscc", ctrl->avscc); + obj_add_int(r, "apsta", ctrl->apsta); + obj_add_int(r, "wctemp", le16_to_cpu(ctrl->wctemp)); + obj_add_int(r, "cctemp", le16_to_cpu(ctrl->cctemp)); + obj_add_int(r, "mtfa", le16_to_cpu(ctrl->mtfa)); + obj_add_uint(r, "hmpre", le32_to_cpu(ctrl->hmpre)); + obj_add_uint(r, "hmmin", le32_to_cpu(ctrl->hmmin)); + obj_add_uint128(r, "tnvmcap", tnvmcap); + obj_add_uint128(r, "unvmcap", unvmcap); + obj_add_uint(r, "rpmbs", le32_to_cpu(ctrl->rpmbs)); + obj_add_int(r, "edstt", le16_to_cpu(ctrl->edstt)); + obj_add_int(r, "dsto", ctrl->dsto); + obj_add_int(r, "fwug", ctrl->fwug); + obj_add_int(r, "kas", le16_to_cpu(ctrl->kas)); + obj_add_int(r, "hctma", le16_to_cpu(ctrl->hctma)); + obj_add_int(r, "mntmt", le16_to_cpu(ctrl->mntmt)); + obj_add_int(r, "mxtmt", le16_to_cpu(ctrl->mxtmt)); + obj_add_uint(r, "sanicap", le32_to_cpu(ctrl->sanicap)); + obj_add_uint(r, "hmminds", le32_to_cpu(ctrl->hmminds)); + obj_add_int(r, "hmmaxd", le16_to_cpu(ctrl->hmmaxd)); + obj_add_int(r, "nsetidmax", le16_to_cpu(ctrl->nsetidmax)); + obj_add_int(r, "endgidmax", le16_to_cpu(ctrl->endgidmax)); + obj_add_int(r, "anatt",ctrl->anatt); + obj_add_int(r, "anacap", ctrl->anacap); + obj_add_uint(r, "anagrpmax", le32_to_cpu(ctrl->anagrpmax)); + obj_add_uint(r, "nanagrpid", le32_to_cpu(ctrl->nanagrpid)); + obj_add_uint(r, "pels", le32_to_cpu(ctrl->pels)); + obj_add_int(r, "domainid", le16_to_cpu(ctrl->domainid)); + obj_add_uint128(r, "megcap", megcap); + obj_add_int(r, "sqes", ctrl->sqes); + obj_add_int(r, "cqes", ctrl->cqes); + obj_add_int(r, "maxcmd", le16_to_cpu(ctrl->maxcmd)); + obj_add_uint(r, "nn", le32_to_cpu(ctrl->nn)); + obj_add_int(r, "oncs", le16_to_cpu(ctrl->oncs)); + obj_add_int(r, "fuses", le16_to_cpu(ctrl->fuses)); + obj_add_int(r, "fna", ctrl->fna); + obj_add_int(r, "vwc", ctrl->vwc); + obj_add_int(r, "awun", le16_to_cpu(ctrl->awun)); + obj_add_int(r, "awupf", le16_to_cpu(ctrl->awupf)); + obj_add_int(r, "icsvscc", ctrl->icsvscc); + obj_add_int(r, "nwpc", ctrl->nwpc); + obj_add_int(r, "acwu", le16_to_cpu(ctrl->acwu)); + obj_add_int(r, "ocfs", le16_to_cpu(ctrl->ocfs)); + obj_add_uint(r, "sgls", le32_to_cpu(ctrl->sgls)); + obj_add_uint(r, "mnan", le32_to_cpu(ctrl->mnan)); + obj_add_uint128(r, "maxdna", maxdna); + obj_add_uint(r, "maxcna", le32_to_cpu(ctrl->maxcna)); + obj_add_uint(r, "oaqd", le32_to_cpu(ctrl->oaqd)); if (strlen(subnqn)) - json_object_add_value_string(root, "subnqn", subnqn); + obj_add_str(r, "subnqn", subnqn); - json_object_add_value_uint(root, "ioccsz", le32_to_cpu(ctrl->ioccsz)); - json_object_add_value_uint(root, "iorcsz", le32_to_cpu(ctrl->iorcsz)); - json_object_add_value_int(root, "icdoff", le16_to_cpu(ctrl->icdoff)); - json_object_add_value_int(root, "fcatt", ctrl->fcatt); - json_object_add_value_int(root, "msdbd", ctrl->msdbd); - json_object_add_value_int(root, "ofcs", le16_to_cpu(ctrl->ofcs)); + obj_add_uint(r, "ioccsz", le32_to_cpu(ctrl->ioccsz)); + obj_add_uint(r, "iorcsz", le32_to_cpu(ctrl->iorcsz)); + obj_add_int(r, "icdoff", le16_to_cpu(ctrl->icdoff)); + obj_add_int(r, "fcatt", ctrl->fcatt); + obj_add_int(r, "msdbd", ctrl->msdbd); + obj_add_int(r, "ofcs", le16_to_cpu(ctrl->ofcs)); - psds = json_create_array(); - json_object_add_value_array(root, "psds", psds); + obj_add_array(r, "psds", psds); for (i = 0; i <= ctrl->npss; i++) { struct json_object *psd = json_create_object(); - json_object_add_value_int(psd, "max_power", - le16_to_cpu(ctrl->psd[i].mp)); - json_object_add_value_int(psd, "flags", ctrl->psd[i].flags); - json_object_add_value_uint(psd, "entry_lat", - le32_to_cpu(ctrl->psd[i].enlat)); - json_object_add_value_uint(psd, "exit_lat", - le32_to_cpu(ctrl->psd[i].exlat)); - json_object_add_value_int(psd, "read_tput", - ctrl->psd[i].rrt); - json_object_add_value_int(psd, "read_lat", - ctrl->psd[i].rrl); - json_object_add_value_int(psd, "write_tput", - ctrl->psd[i].rwt); - json_object_add_value_int(psd, "write_lat", - ctrl->psd[i].rwl); - json_object_add_value_int(psd, "idle_power", - le16_to_cpu(ctrl->psd[i].idlp)); - json_object_add_value_int(psd, "idle_scale", - nvme_psd_power_scale(ctrl->psd[i].ips)); - json_object_add_value_int(psd, "active_power", - le16_to_cpu(ctrl->psd[i].actp)); - json_object_add_value_int(psd, "active_power_work", - ctrl->psd[i].apws & 0x7); - json_object_add_value_int(psd, "active_scale", - nvme_psd_power_scale(ctrl->psd[i].apws)); - - json_array_add_value_object(psds, psd); + obj_add_int(psd, "max_power", le16_to_cpu(ctrl->psd[i].mp)); + obj_add_int(psd, "max_power_scale", ctrl->psd[i].flags & 0x1); + obj_add_int(psd, "non-operational_state", (ctrl->psd[i].flags & 2) >> 1); + obj_add_uint(psd, "entry_lat", le32_to_cpu(ctrl->psd[i].enlat)); + obj_add_uint(psd, "exit_lat", le32_to_cpu(ctrl->psd[i].exlat)); + obj_add_int(psd, "read_tput", ctrl->psd[i].rrt); + obj_add_int(psd, "read_lat", ctrl->psd[i].rrl); + obj_add_int(psd, "write_tput", ctrl->psd[i].rwt); + obj_add_int(psd, "write_lat", ctrl->psd[i].rwl); + obj_add_int(psd, "idle_power", le16_to_cpu(ctrl->psd[i].idlp)); + obj_add_int(psd, "idle_scale", nvme_psd_power_scale(ctrl->psd[i].ips)); + obj_add_int(psd, "active_power", le16_to_cpu(ctrl->psd[i].actp)); + obj_add_int(psd, "active_power_work", ctrl->psd[i].apws & 7); + obj_add_int(psd, "active_scale", nvme_psd_power_scale(ctrl->psd[i].apws)); + + array_add_obj(psds, psd); } if(vs) - vs(ctrl->vs, root); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + vs(ctrl->vs, r); + + json_print(r); } static void json_error_log(struct nvme_error_log_page *err_log, int entries, const char *devname) { - struct json_object *root; - struct json_object *errors; + struct json_object *r = json_create_object(); + struct json_object *errors = json_create_array(); int i; - root = json_create_object(); - errors = json_create_array(); - json_object_add_value_array(root, "errors", errors); + obj_add_array(r, "errors", errors); for (i = 0; i < entries; i++) { struct json_object *error = json_create_object(); - json_object_add_value_uint64(error, "error_count", - le64_to_cpu(err_log[i].error_count)); - json_object_add_value_int(error, "sqid", - le16_to_cpu(err_log[i].sqid)); - json_object_add_value_int(error, "cmdid", - le16_to_cpu(err_log[i].cmdid)); - json_object_add_value_int(error, "status_field", - le16_to_cpu(err_log[i].status_field >> 0x1)); - json_object_add_value_int(error, "phase_tag", - le16_to_cpu(err_log[i].status_field & 0x1)); - json_object_add_value_int(error, "parm_error_location", - le16_to_cpu(err_log[i].parm_error_location)); - json_object_add_value_uint64(error, "lba", - le64_to_cpu(err_log[i].lba)); - json_object_add_value_uint(error, "nsid", - le32_to_cpu(err_log[i].nsid)); - json_object_add_value_int(error, "vs", err_log[i].vs); - json_object_add_value_int(error, "trtype", err_log[i].trtype); - json_object_add_value_uint64(error, "cs", - le64_to_cpu(err_log[i].cs)); - json_object_add_value_int(error, "trtype_spec_info", - le16_to_cpu(err_log[i].trtype_spec_info)); - - json_array_add_value_object(errors, error); - } - - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + obj_add_uint64(error, "error_count", le64_to_cpu(err_log[i].error_count)); + obj_add_int(error, "sqid", le16_to_cpu(err_log[i].sqid)); + obj_add_int(error, "cmdid", le16_to_cpu(err_log[i].cmdid)); + obj_add_int(error, "status_field", le16_to_cpu(err_log[i].status_field >> 0x1)); + obj_add_int(error, "phase_tag", le16_to_cpu(err_log[i].status_field & 0x1)); + obj_add_int(error, "parm_error_location", + le16_to_cpu(err_log[i].parm_error_location)); + obj_add_uint64(error, "lba", le64_to_cpu(err_log[i].lba)); + obj_add_uint(error, "nsid", le32_to_cpu(err_log[i].nsid)); + obj_add_int(error, "vs", err_log[i].vs); + obj_add_int(error, "trtype", err_log[i].trtype); + obj_add_uint64(error, "cs", le64_to_cpu(err_log[i].cs)); + obj_add_int(error, "trtype_spec_info", le16_to_cpu(err_log[i].trtype_spec_info)); + + array_add_obj(errors, error); + } + + json_print(r); } void json_nvme_resv_report(struct nvme_resv_status *status, int bytes, bool eds) { - struct json_object *root; - struct json_object *rcs; - int i, j, regctl, entries; + struct json_object *r = json_create_object(); + struct json_object *rcs = json_create_array(); + int i, j, entries; + int regctl = status->regctl[0] | (status->regctl[1] << 8); - regctl = status->regctl[0] | (status->regctl[1] << 8); + obj_add_uint(r, "gen", le32_to_cpu(status->gen)); + obj_add_int(r, "rtype", status->rtype); + obj_add_int(r, "regctl", regctl); + obj_add_int(r, "ptpls", status->ptpls); - root = json_create_object(); - - json_object_add_value_uint(root, "gen", le32_to_cpu(status->gen)); - json_object_add_value_int(root, "rtype", status->rtype); - json_object_add_value_int(root, "regctl", regctl); - json_object_add_value_int(root, "ptpls", status->ptpls); - - rcs = json_create_array(); /* check Extended Data Structure bit */ if (!eds) { /* @@ -335,67 +488,57 @@ void json_nvme_resv_report(struct nvme_resv_status *status, if (entries < regctl) regctl = entries; - json_object_add_value_array(root, "regctls", rcs); + obj_add_array(r, "regctls", rcs); for (i = 0; i < regctl; i++) { struct json_object *rc = json_create_object(); - json_object_add_value_int(rc, "cntlid", - le16_to_cpu(status->regctl_ds[i].cntlid)); - json_object_add_value_int(rc, "rcsts", - status->regctl_ds[i].rcsts); - json_object_add_value_uint64(rc, "hostid", - le64_to_cpu(status->regctl_ds[i].hostid)); - json_object_add_value_uint64(rc, "rkey", - le64_to_cpu(status->regctl_ds[i].rkey)); + obj_add_int(rc, "cntlid", le16_to_cpu(status->regctl_ds[i].cntlid)); + obj_add_int(rc, "rcsts", status->regctl_ds[i].rcsts); + obj_add_uint64(rc, "hostid", le64_to_cpu(status->regctl_ds[i].hostid)); + obj_add_uint64(rc, "rkey", le64_to_cpu(status->regctl_ds[i].rkey)); - json_array_add_value_object(rcs, rc); + array_add_obj(rcs, rc); } } else { char hostid[33]; /* if status buffer was too small, don't loop past the end of the buffer */ entries = (bytes - 64) / 64; + if (entries < regctl) regctl = entries; - json_object_add_value_array(root, "regctlext", rcs); + obj_add_array(r, "regctlext", rcs); + for (i = 0; i < regctl; i++) { struct json_object *rc = json_create_object(); - json_object_add_value_int(rc, "cntlid", - le16_to_cpu(status->regctl_eds[i].cntlid)); - json_object_add_value_int(rc, "rcsts", - status->regctl_eds[i].rcsts); - json_object_add_value_uint64(rc, "rkey", - le64_to_cpu(status->regctl_eds[i].rkey)); + obj_add_int(rc, "cntlid", le16_to_cpu(status->regctl_eds[i].cntlid)); + obj_add_int(rc, "rcsts", status->regctl_eds[i].rcsts); + obj_add_uint64(rc, "rkey", le64_to_cpu(status->regctl_eds[i].rkey)); + for (j = 0; j < 16; j++) - sprintf(hostid + j * 2, "%02x", - status->regctl_eds[i].hostid[j]); + sprintf(hostid + j * 2, "%02x", status->regctl_eds[i].hostid[j]); - json_object_add_value_string(rc, "hostid", hostid); - json_array_add_value_object(rcs, rc); + obj_add_str(rc, "hostid", hostid); + array_add_obj(rcs, rc); } } - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + json_print(r); } void json_fw_log(struct nvme_firmware_slot *fw_log, const char *devname) { - struct json_object *root; - struct json_object *fwsi; + struct json_object *r = json_create_object(); + struct json_object *fwsi = json_create_object(); char fmt[21]; char str[32]; int i; __le64 *frs; - root = json_create_object(); - fwsi = json_create_object(); + obj_add_int(fwsi, "Active Firmware Slot (afi)", fw_log->afi); - json_object_add_value_int(fwsi, "Active Firmware Slot (afi)", - fw_log->afi); for (i = 0; i < 7; i++) { if (fw_log->frs[i][0]) { snprintf(fmt, sizeof(fmt), "Firmware Rev Slot %d", @@ -404,21 +547,20 @@ void json_fw_log(struct nvme_firmware_slot *fw_log, const char *devname) snprintf(str, sizeof(str), "%"PRIu64" (%s)", le64_to_cpu(*frs), util_fw_to_string(fw_log->frs[i])); - json_object_add_value_string(fwsi, fmt, str); + obj_add_str(fwsi, fmt, str); } } - json_object_add_value_object(root, devname, fwsi); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + obj_add_obj(r, devname, fwsi); + + json_print(r); } void json_changed_ns_list_log(struct nvme_ns_list *log, const char *devname) { - struct json_object *root; - struct json_object *nsi; + struct json_object *r = json_create_object(); + struct json_object *nsi = json_create_object(); char fmt[32]; char str[32]; __u32 nsid; @@ -427,11 +569,7 @@ void json_changed_ns_list_log(struct nvme_ns_list *log, if (log->ns[0] == cpu_to_le32(0xffffffff)) return; - root = json_create_object(); - nsi = json_create_object(); - - json_object_add_value_string(root, "Changed Namespace List Log", - devname); + obj_add_str(r, "Changed Namespace List Log", devname); for (i = 0; i < NVME_ID_NS_LIST_MAX; i++) { nsid = le32_to_cpu(log->ns[i]); @@ -441,77 +579,59 @@ void json_changed_ns_list_log(struct nvme_ns_list *log, snprintf(fmt, sizeof(fmt), "[%4u]", i + 1); snprintf(str, sizeof(str), "%#x", nsid); - json_object_add_value_string(nsi, fmt, str); + obj_add_str(nsi, fmt, str); } - json_object_add_value_object(root, devname, nsi); - json_print_object(root, NULL); - printf("\n"); + obj_add_obj(r, devname, nsi); - json_free_object(root); + json_print(r); } -static void json_endurance_log(struct nvme_endurance_group_log *endurance_group, - __u16 group_id, const char *devname) +static void json_endurance_log(struct nvme_endurance_group_log *endurance_group, __u16 group_id, + const char *devname) { - struct json_object *root; - - nvme_uint128_t endurance_estimate = - le128_to_cpu(endurance_group->endurance_estimate); - nvme_uint128_t data_units_read = - le128_to_cpu(endurance_group->data_units_read); - nvme_uint128_t data_units_written = - le128_to_cpu(endurance_group->data_units_written); - nvme_uint128_t media_units_written = - le128_to_cpu(endurance_group->media_units_written); - nvme_uint128_t host_read_cmds = - le128_to_cpu(endurance_group->host_read_cmds); - nvme_uint128_t host_write_cmds = - le128_to_cpu(endurance_group->host_write_cmds); + struct json_object *r = json_create_object(); + nvme_uint128_t endurance_estimate = le128_to_cpu(endurance_group->endurance_estimate); + nvme_uint128_t data_units_read = le128_to_cpu(endurance_group->data_units_read); + nvme_uint128_t data_units_written = le128_to_cpu(endurance_group->data_units_written); + nvme_uint128_t media_units_written = le128_to_cpu(endurance_group->media_units_written); + nvme_uint128_t host_read_cmds = le128_to_cpu(endurance_group->host_read_cmds); + nvme_uint128_t host_write_cmds = le128_to_cpu(endurance_group->host_write_cmds); nvme_uint128_t media_data_integrity_err = - le128_to_cpu(endurance_group->media_data_integrity_err); + le128_to_cpu(endurance_group->media_data_integrity_err); nvme_uint128_t num_err_info_log_entries = - le128_to_cpu(endurance_group->num_err_info_log_entries); - - root = json_create_object(); - - json_object_add_value_int(root, "critical_warning", - endurance_group->critical_warning); - json_object_add_value_int(root, "avl_spare", - endurance_group->avl_spare); - json_object_add_value_int(root, "avl_spare_threshold", - endurance_group->avl_spare_threshold); - json_object_add_value_int(root, "percent_used", - endurance_group->percent_used); - json_object_add_value_uint128(root, "endurance_estimate", - endurance_estimate); - json_object_add_value_uint128(root, "data_units_read", data_units_read); - json_object_add_value_uint128(root, "data_units_written", - data_units_written); - json_object_add_value_uint128(root, "media_units_written", - media_units_written); - json_object_add_value_uint128(root, "host_read_cmds", host_read_cmds); - json_object_add_value_uint128(root, "host_write_cmds", host_write_cmds); - json_object_add_value_uint128(root, "media_data_integrity_err", - media_data_integrity_err); - json_object_add_value_uint128(root, "num_err_info_log_entries", - num_err_info_log_entries); - - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + le128_to_cpu(endurance_group->num_err_info_log_entries); + nvme_uint128_t total_end_grp_cap = le128_to_cpu(endurance_group->total_end_grp_cap); + nvme_uint128_t unalloc_end_grp_cap = le128_to_cpu(endurance_group->unalloc_end_grp_cap); + + obj_add_int(r, "critical_warning", endurance_group->critical_warning); + obj_add_int(r, "endurance_group_features", endurance_group->endurance_group_features); + obj_add_int(r, "avl_spare", endurance_group->avl_spare); + obj_add_int(r, "avl_spare_threshold", endurance_group->avl_spare_threshold); + obj_add_int(r, "percent_used", endurance_group->percent_used); + obj_add_int(r, "domain_identifier", endurance_group->domain_identifier); + obj_add_uint128(r, "endurance_estimate", endurance_estimate); + obj_add_uint128(r, "data_units_read", data_units_read); + obj_add_uint128(r, "data_units_written", data_units_written); + obj_add_uint128(r, "media_units_written", media_units_written); + obj_add_uint128(r, "host_read_cmds", host_read_cmds); + obj_add_uint128(r, "host_write_cmds", host_write_cmds); + obj_add_uint128(r, "media_data_integrity_err", media_data_integrity_err); + obj_add_uint128(r, "num_err_info_log_entries", num_err_info_log_entries); + obj_add_uint128(r, "total_end_grp_cap", total_end_grp_cap); + obj_add_uint128(r, "unalloc_end_grp_cap", unalloc_end_grp_cap); + + json_print(r); } static void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char *devname) { - int c, human = json_print_ops.flags & VERBOSE; - struct json_object *root; + struct json_object *r = json_create_object(); + int c; char key[21]; - unsigned int temperature = ((smart->temperature[1] << 8) | smart->temperature[0]); - nvme_uint128_t data_units_read = le128_to_cpu(smart->data_units_read); nvme_uint128_t data_units_written = le128_to_cpu(smart->data_units_written); nvme_uint128_t host_read_commands = le128_to_cpu(smart->host_reads); @@ -523,71 +643,56 @@ static void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid, nvme_uint128_t media_errors = le128_to_cpu(smart->media_errors); nvme_uint128_t num_err_log_entries = le128_to_cpu(smart->num_err_log_entries); - root = json_create_object(); - - if (human) { + if (human()) { struct json_object *crt = json_create_object(); - json_object_add_value_int(crt, "value", smart->critical_warning); - json_object_add_value_int(crt, "available_spare", smart->critical_warning & 0x01); - json_object_add_value_int(crt, "temp_threshold", (smart->critical_warning & 0x02) >> 1); - json_object_add_value_int(crt, "reliability_degraded", (smart->critical_warning & 0x04) >> 2); - json_object_add_value_int(crt, "ro", (smart->critical_warning & 0x08) >> 3); - json_object_add_value_int(crt, "vmbu_failed", (smart->critical_warning & 0x10) >> 4); - json_object_add_value_int(crt, "pmr_ro", (smart->critical_warning & 0x20) >> 5); - - json_object_add_value_object(root, "critical_warning", crt); - } else - json_object_add_value_int(root, "critical_warning", - smart->critical_warning); - - json_object_add_value_int(root, "temperature", temperature); - json_object_add_value_int(root, "avail_spare", smart->avail_spare); - json_object_add_value_int(root, "spare_thresh", smart->spare_thresh); - json_object_add_value_int(root, "percent_used", smart->percent_used); - json_object_add_value_int(root, "endurance_grp_critical_warning_summary", - smart->endu_grp_crit_warn_sumry); - json_object_add_value_uint128(root, "data_units_read", data_units_read); - json_object_add_value_uint128(root, "data_units_written", - data_units_written); - json_object_add_value_uint128(root, "host_read_commands", - host_read_commands); - json_object_add_value_uint128(root, "host_write_commands", - host_write_commands); - json_object_add_value_uint128(root, "controller_busy_time", - controller_busy_time); - json_object_add_value_uint128(root, "power_cycles", power_cycles); - json_object_add_value_uint128(root, "power_on_hours", power_on_hours); - json_object_add_value_uint128(root, "unsafe_shutdowns", unsafe_shutdowns); - json_object_add_value_uint128(root, "media_errors", media_errors); - json_object_add_value_uint128(root, "num_err_log_entries", - num_err_log_entries); - json_object_add_value_uint(root, "warning_temp_time", - le32_to_cpu(smart->warning_temp_time)); - json_object_add_value_uint(root, "critical_comp_time", - le32_to_cpu(smart->critical_comp_time)); - - for (c=0; c < 8; c++) { + obj_add_int(crt, "value", smart->critical_warning); + obj_add_int(crt, "available_spare", smart->critical_warning & 1); + obj_add_int(crt, "temp_threshold", (smart->critical_warning & 2) >> 1); + obj_add_int(crt, "reliability_degraded", (smart->critical_warning & 4) >> 2); + obj_add_int(crt, "ro", (smart->critical_warning & 8) >> 3); + obj_add_int(crt, "vmbu_failed", (smart->critical_warning & 0x10) >> 4); + obj_add_int(crt, "pmr_ro", (smart->critical_warning & 0x20) >> 5); + + obj_add_obj(r, "critical_warning", crt); + } else { + obj_add_int(r, "critical_warning", smart->critical_warning); + } + + obj_add_int(r, "temperature", temperature); + obj_add_int(r, "avail_spare", smart->avail_spare); + obj_add_int(r, "spare_thresh", smart->spare_thresh); + obj_add_int(r, "percent_used", smart->percent_used); + obj_add_int(r, "endurance_grp_critical_warning_summary", smart->endu_grp_crit_warn_sumry); + obj_add_uint128(r, "data_units_read", data_units_read); + obj_add_uint128(r, "data_units_written", data_units_written); + obj_add_uint128(r, "host_read_commands", host_read_commands); + obj_add_uint128(r, "host_write_commands", host_write_commands); + obj_add_uint128(r, "controller_busy_time", controller_busy_time); + obj_add_uint128(r, "power_cycles", power_cycles); + obj_add_uint128(r, "power_on_hours", power_on_hours); + obj_add_uint128(r, "unsafe_shutdowns", unsafe_shutdowns); + obj_add_uint128(r, "media_errors", media_errors); + obj_add_uint128(r, "num_err_log_entries", num_err_log_entries); + obj_add_uint(r, "warning_temp_time", le32_to_cpu(smart->warning_temp_time)); + obj_add_uint(r, "critical_comp_time", le32_to_cpu(smart->critical_comp_time)); + + for (c = 0; c < 8; c++) { __s32 temp = le16_to_cpu(smart->temp_sensor[c]); if (temp == 0) continue; + sprintf(key, "temperature_sensor_%d",c+1); - json_object_add_value_int(root, key, temp); + obj_add_int(r, key, temp); } - json_object_add_value_uint(root, "thm_temp1_trans_count", - le32_to_cpu(smart->thm_temp1_trans_count)); - json_object_add_value_uint(root, "thm_temp2_trans_count", - le32_to_cpu(smart->thm_temp2_trans_count)); - json_object_add_value_uint(root, "thm_temp1_total_time", - le32_to_cpu(smart->thm_temp1_total_time)); - json_object_add_value_uint(root, "thm_temp2_total_time", - le32_to_cpu(smart->thm_temp2_total_time)); + obj_add_uint(r, "thm_temp1_trans_count", le32_to_cpu(smart->thm_temp1_trans_count)); + obj_add_uint(r, "thm_temp2_trans_count", le32_to_cpu(smart->thm_temp2_trans_count)); + obj_add_uint(r, "thm_temp1_total_time", le32_to_cpu(smart->thm_temp1_total_time)); + obj_add_uint(r, "thm_temp2_total_time", le32_to_cpu(smart->thm_temp2_total_time)); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + json_print(r); } static void json_ana_log(struct nvme_ana_log *ana_log, const char *devname, @@ -596,25 +701,20 @@ static void json_ana_log(struct nvme_ana_log *ana_log, const char *devname, int offset = sizeof(struct nvme_ana_log); struct nvme_ana_log *hdr = ana_log; struct nvme_ana_group_desc *ana_desc; - struct json_object *desc_list; + struct json_object *desc_list = json_create_array(); struct json_object *ns_list; struct json_object *desc; struct json_object *nsid; - struct json_object *root; + struct json_object *r = json_create_object(); size_t nsid_buf_size; void *base = ana_log; __u32 nr_nsids; int i, j; - root = json_create_object(); - json_object_add_value_string(root, - "Asymmetric Namespace Access Log for NVMe device", - devname); - json_object_add_value_uint64(root, "chgcnt", - le64_to_cpu(hdr->chgcnt)); - json_object_add_value_uint(root, "ngrps", le16_to_cpu(hdr->ngrps)); + obj_add_str(r, "Asymmetric Namespace Access Log for NVMe device", devname); + obj_add_uint64(r, "chgcnt", le64_to_cpu(hdr->chgcnt)); + obj_add_uint(r, "ngrps", le16_to_cpu(hdr->ngrps)); - desc_list = json_create_array(); for (i = 0; i < le16_to_cpu(ana_log->ngrps); i++) { desc = json_create_object(); ana_desc = base + offset; @@ -622,261 +722,696 @@ static void json_ana_log(struct nvme_ana_log *ana_log, const char *devname, nsid_buf_size = nr_nsids * sizeof(__le32); offset += sizeof(*ana_desc); - json_object_add_value_uint(desc, "grpid", - le32_to_cpu(ana_desc->grpid)); - json_object_add_value_uint(desc, "nnsids", - le32_to_cpu(ana_desc->nnsids)); - json_object_add_value_uint(desc, "chgcnt", - le64_to_cpu(ana_desc->chgcnt)); - json_object_add_value_string(desc, "state", - nvme_ana_state_to_string(ana_desc->state)); + obj_add_uint(desc, "grpid", le32_to_cpu(ana_desc->grpid)); + obj_add_uint(desc, "nnsids", le32_to_cpu(ana_desc->nnsids)); + obj_add_uint64(desc, "chgcnt", le64_to_cpu(ana_desc->chgcnt)); + obj_add_str(desc, "state", nvme_ana_state_to_string(ana_desc->state)); ns_list = json_create_array(); for (j = 0; j < le32_to_cpu(ana_desc->nnsids); j++) { nsid = json_create_object(); - json_object_add_value_uint(nsid, "nsid", - le32_to_cpu(ana_desc->nsids[j])); - json_array_add_value_object(ns_list, nsid); + obj_add_uint(nsid, "nsid", le32_to_cpu(ana_desc->nsids[j])); + array_add_obj(ns_list, nsid); } - json_object_add_value_array(desc, "NSIDS", ns_list); + obj_add_array(desc, "NSIDS", ns_list); offset += nsid_buf_size; - json_array_add_value_object(desc_list, desc); + array_add_obj(desc_list, desc); } - json_object_add_value_array(root, "ANA DESC LIST ", desc_list); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + obj_add_array(r, "ANA DESC LIST ", desc_list); + + json_print(r); +} + +static void json_select_result(enum nvme_features_id fid, __u32 result) +{ + struct json_object *r = json_r ? json_r : json_create_object(); + char json_str[STR_LEN]; + struct json_object *feature = json_create_array(); + + if (result & 0x1) + array_add_str(feature, "saveable"); + if (result & 0x2) + array_add_str(feature, "per-namespace"); + if (result & 0x4) + array_add_str(feature, "changeable"); + + sprintf(json_str, "Feature: %#0*x: select", fid ? 4 : 2, fid); + obj_add_array(r, json_str, feature); + + json_print(r); } static void json_self_test_log(struct nvme_self_test_log *self_test, __u8 dst_entries, __u32 size, const char *devname) { struct json_object *valid_attrs; - struct json_object *root; - struct json_object *valid; + struct json_object *r = json_create_object(); + struct json_object *valid = json_create_array(); int i; - __u32 num_entries; + __u32 num_entries = min(dst_entries, NVME_LOG_ST_MAX_RESULTS); - root = json_create_object(); - json_object_add_value_int(root, "Current Device Self-Test Operation", - self_test->current_operation); - json_object_add_value_int(root, "Current Device Self-Test Completion", - self_test->completion); - valid = json_create_array(); + obj_add_int(r, "Current Device Self-Test Operation", self_test->current_operation); + obj_add_int(r, "Current Device Self-Test Completion", self_test->completion); - num_entries = min(dst_entries, NVME_LOG_ST_MAX_RESULTS); for (i = 0; i < num_entries; i++) { valid_attrs = json_create_object(); - json_object_add_value_int(valid_attrs, "Self test result", - self_test->result[i].dsts & 0xf); + obj_add_int(valid_attrs, "Self test result", self_test->result[i].dsts & 0xf); + if ((self_test->result[i].dsts & 0xf) == 0xf) goto add; - json_object_add_value_int(valid_attrs, "Self test code", + + obj_add_int(valid_attrs, "Self test code", self_test->result[i].dsts >> 4); - json_object_add_value_int(valid_attrs, "Segment number", + obj_add_int(valid_attrs, "Segment number", self_test->result[i].seg); - json_object_add_value_int(valid_attrs, "Valid Diagnostic Information", + obj_add_int(valid_attrs, "Valid Diagnostic Information", self_test->result[i].vdi); - json_object_add_value_uint64(valid_attrs, "Power on hours", - le64_to_cpu(self_test->result[i].poh)); + obj_add_uint64(valid_attrs, "Power on hours", + le64_to_cpu(self_test->result[i].poh)); + if (self_test->result[i].vdi & NVME_ST_VALID_DIAG_INFO_NSID) - json_object_add_value_uint(valid_attrs, "Namespace Identifier", - le32_to_cpu(self_test->result[i].nsid)); - if (self_test->result[i].vdi & NVME_ST_VALID_DIAG_INFO_FLBA) { - json_object_add_value_uint64(valid_attrs, "Failing LBA", - le64_to_cpu(self_test->result[i].flba)); - } + obj_add_uint(valid_attrs, "Namespace Identifier", + le32_to_cpu(self_test->result[i].nsid)); + + if (self_test->result[i].vdi & NVME_ST_VALID_DIAG_INFO_FLBA) + obj_add_uint64(valid_attrs, "Failing LBA", + le64_to_cpu(self_test->result[i].flba)); + if (self_test->result[i].vdi & NVME_ST_VALID_DIAG_INFO_SCT) - json_object_add_value_int(valid_attrs, "Status Code Type", - self_test->result[i].sct); + obj_add_int(valid_attrs, "Status Code Type", self_test->result[i].sct); + if (self_test->result[i].vdi & NVME_ST_VALID_DIAG_INFO_SC) - json_object_add_value_int(valid_attrs, "Status Code", - self_test->result[i].sc); - json_object_add_value_int(valid_attrs, "Vendor Specific", - (self_test->result[i].vs[1] << 8) | - (self_test->result[i].vs[0])); + obj_add_int(valid_attrs, "Status Code", self_test->result[i].sc); + + obj_add_int(valid_attrs, "Vendor Specific", + self_test->result[i].vs[1] << 8 | self_test->result[i].vs[0]); + add: - json_array_add_value_object(valid, valid_attrs); + array_add_obj(valid, valid_attrs); } - json_object_add_value_array(root, "List of Valid Reports", valid); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + + obj_add_array(r, "List of Valid Reports", valid); + + json_print(r); +} + +static void json_registers_cap(struct nvme_bar_cap *cap, struct json_object *r) +{ + char json_str[STR_LEN]; + struct json_object *cssa = json_create_array(); + struct json_object *csso = json_create_object(); + struct json_object *amsa = json_create_array(); + struct json_object *amso = json_create_object(); + + sprintf(json_str, "%"PRIx64"", *(uint64_t *)cap); + obj_add_str(r, "cap", json_str); + + obj_add_str(r, "Controller Ready With Media Support (CRWMS)", + cap->crwms ? "Supported" : "Not supported"); + obj_add_str(r, "Controller Ready Independent of Media Support (CRIMS)", + cap->crims ? "Supported" : "Not supported"); + obj_add_str(r, "NVM Subsystem Shutdown Supported (NSSS)", + cap->nsss ? "Supported" : "Not supported"); + obj_add_str(r, "Controller Memory Buffer Supported (CMBS):", + cap->cmbs ? "Supported" : "Not supported"); + obj_add_str(r, "Persistent Memory Region Supported (PMRS)", + cap->pmrs ? "Supported" : "Not supported"); + + sprintf(json_str, "%u bytes", 1 << (12 + cap->mpsmax)); + obj_add_str(r, "Memory Page Size Maximum (MPSMAX)", json_str); + + sprintf(json_str, "%u bytes", 1 << (12 + cap->mpsmin)); + obj_add_str(r, "Memory Page Size Minimum (MPSMIN)", json_str); + + obj_add_str(r, "Controller Power Scope (CPS)", !cap->cps ? "Not Reported" : cap->cps == 1 ? + "Controller scope" : cap->cps == 2 ? "Domain scope" : "NVM subsystem scope"); + obj_add_str(r, "Boot Partition Support (BPS)", cap->bps ? "Yes" : "No"); + + obj_add_array(r, "Command Sets Supported (CSS)", cssa); + obj_add_str(csso, "NVM command set", cap->css & 1 ? "Supported" : "Not supported"); + obj_add_str(csso, "One or more I/O Command Sets", + cap->css & 0x40 ? "Supported" : "Not supported"); + obj_add_str(csso, cap->css & 0x80 ? "Only Admin Command Set" : "I/O Command Set", + "Supported"); + array_add_obj(cssa, csso); + + obj_add_str(r, "NVM Subsystem Reset Supported (NSSRS)", cap->nssrs ? "Yes" : "No"); + + sprintf(json_str, "%u bytes", 1 << (2 + cap->dstrd)); + obj_add_str(r, "Doorbell Stride (DSTRD)", json_str); + + sprintf(json_str, "%u ms", MS500_TO_MS(cap->to)); + obj_add_str(r, "Timeout (TO)", json_str); + + obj_add_array(r, "Arbitration Mechanism Supported (AMS)", amsa); + obj_add_str(amso, "Weighted Round Robin with Urgent Priority Class", + cap->ams & 2 ? "Supported" : "Not supported"); + array_add_obj(amsa, amso); + + obj_add_str(r, "Contiguous Queues Required (CQR)", cap->cqr ? "Yes" : "No"); + obj_add_uint(r, "Maximum Queue Entries Supported (MQES)", cap->mqes + 1); +} + +static void json_registers_version(__u32 vs, struct json_object *r) +{ + char json_str[STR_LEN]; + + sprintf(json_str, "%x", vs); + obj_add_str(r, "Version", json_str); + + sprintf(json_str, "%d.%d", (vs & 0xffff0000) >> 16, (vs & 0x0000ff00) >> 8); + obj_add_str(r, "NVMe specification", json_str); +} + +static void json_registers_intms(__u32 intms, struct json_object *r) +{ + obj_add_uint_x(r, "intms", intms); + + obj_add_uint_x(r, "Interrupt Vector Mask Set (IVMS)", intms); +} + +static void json_registers_intmc(__u32 intmc, struct json_object *r) +{ + obj_add_uint_x(r, "intmc", intmc); + + obj_add_uint_x(r, "Interrupt Vector Mask Set (IVMC)", intmc); +} + +static void json_registers_cc_ams(__u8 ams, struct json_object *r) +{ + char json_str[STR_LEN]; + + switch (ams) { + case 0: + sprintf(json_str, "Round Robin"); + break; + case 1: + sprintf(json_str, "Weighted Round Robin with Urgent Priority Class"); + break; + case 7: + sprintf(json_str, "Vendor Specific"); + break; + default: + sprintf(json_str, "%s", "Reserved"); + break; + } + + obj_add_str(r, "Arbitration Mechanism Selected (AMS)", json_str); +} + +static void json_registers_cc_shn(__u8 shn, struct json_object *r) +{ + char json_str[STR_LEN]; + + switch (shn) { + case 0: + sprintf(json_str, "No notification; no effect"); + break; + case 1: + sprintf(json_str, "Normal shutdown notification"); + break; + case 2: + sprintf(json_str, "Abrupt shutdown notification"); + break; + default: + sprintf(json_str, "%s", "Reserved"); + break; + } + + obj_add_str(r, "Shutdown Notification (SHN)", json_str); +} + +static void json_registers_cc(__u32 cc, struct json_object *r) +{ + char json_str[STR_LEN]; + + sprintf(json_str, "%x", cc); + obj_add_str(r, "cc", json_str); + + obj_add_str(r, "Controller Ready Independent of Media Enable (CRIME)", + NVME_CC_CRIME(cc) ? "Enabled" : "Disabled"); + + sprintf(json_str, "%u bytes", POWER_OF_TWO(NVME_GET(cc, CC_IOCQES))); + obj_add_str(r, "I/O Completion Queue Entry Size (IOCQES): ", json_str); + + sprintf(json_str, "%u bytes", POWER_OF_TWO(NVME_GET(cc, CC_IOSQES))); + obj_add_str(r, "I/O Submission Queue Entry Size (IOSQES)", json_str); + + json_registers_cc_shn((cc & 0xc000) >> NVME_CC_SHN_SHIFT, r); + json_registers_cc_ams((cc & 0x3800) >> NVME_CC_AMS_SHIFT, r); + + sprintf(json_str, "%u bytes", POWER_OF_TWO(12 + NVME_GET(cc, CC_MPS))); + obj_add_str(r, "Memory Page Size (MPS)", json_str); + + obj_add_str(r, "I/O Command Set Selected (CSS)", (cc & 0x70) == 0x00 ? "NVM Command Set" : + (cc & 0x70) == 0x60 ? "All supported I/O Command Sets" : + (cc & 0x70) == 0x70 ? "Admin Command Set only" : "Reserved"); + obj_add_str(r, "Enable (EN)", cc & 1 ? "Yes" : "No"); +} + +static void json_registers_csts_shst(__u8 shst, struct json_object *r) +{ + char json_str[STR_LEN]; + + switch (shst) { + case 0: + sprintf(json_str, "Normal operation (no shutdown has been requested)"); + break; + case 1: + sprintf(json_str, "Shutdown processing occurring"); + break; + case 2: + sprintf(json_str, "Shutdown processing complete"); + break; + default: + sprintf(json_str, "%s", "Reserved"); + break; + } + + obj_add_str(r, "Shutdown Status (SHST)", json_str); +} + +static void json_registers_csts(__u32 csts, struct json_object *r) +{ + obj_add_uint_x(r, "csts", csts); + + obj_add_str(r, "Processing Paused (PP)", csts & 0x20 ? "Yes" : "No"); + obj_add_str(r, "NVM Subsystem Reset Occurred (NSSRO)", csts & 0x10 ? "Yes" : "No"); + + json_registers_csts_shst((csts & 0xc) >> 2, r); + + obj_add_str(r, "Controller Fatal Status (CFS)", csts & 2 ? "True" : "False"); + obj_add_str(r, "Ready (RDY)", csts & 1 ? "Yes" : "No"); +} + +static void json_registers_nssr(__u32 nssr, struct json_object *r) +{ + obj_add_uint_x(r, "nssr", nssr); + obj_add_uint(r, "NVM Subsystem Reset Control (NSSRC)", nssr); +} + +static void json_registers_crto(__u32 crto, struct json_object *r) +{ + obj_add_uint_x(r, "crto", crto); + + obj_add_int_secs(r, "CRIMT", MS500_TO_SEC(NVME_CRTO_CRIMT(crto))); + obj_add_int_secs(r, "CRWMT", MS500_TO_SEC(NVME_CRTO_CRWMT(crto))); +} + +static void json_registers_aqa(uint32_t aqa, struct json_object *r) +{ + obj_add_uint_x(r, "aqa", aqa); + obj_add_uint(r, "Admin Completion Queue Size (ACQS)", ((aqa & 0xfff0000) >> 16) + 1); + obj_add_uint(r, "Admin Submission Queue Size (ASQS)", (aqa & 0xfff) + 1); +} + +static void json_registers_asq(uint64_t asq, struct json_object *r) +{ + obj_add_prix64(r, "asq", asq); + obj_add_prix64(r, "Admin Submission Queue Base (ASQB)", asq); +} + +static void json_registers_acq(uint64_t acq, struct json_object *r) +{ + obj_add_prix64(r, "acq", acq); + obj_add_prix64(r, "Admin Completion Queue Base (ACQB)", acq); +} + +static void json_registers_cmbloc(uint32_t cmbloc, void *bar, struct json_object *r) +{ + uint32_t cmbsz = mmio_read32(bar + NVME_REG_CMBSZ); + + obj_add_uint_x(r, "cmbloc", cmbloc); + + if (!cmbsz) { + obj_add_result(r, "Controller Memory Buffer feature is not supported"); + return; + } + + obj_add_uint_0x(r, "Offset (OFST) (See cmbsz.szu for granularity)", + (cmbloc & 0xfffff000) >> 12); + obj_add_int(r, "CMB Queue Dword Alignment (CQDA)", (cmbloc & 0x100) >> 8); + obj_add_str(r, "CMB Data Metadata Mixed Memory Support (CDMMMS)", + (cmbloc & 0x00000080) >> 7 ? "Not enforced" : "Enforced"); + obj_add_str(r, "CMB Data Pointer and Command Independent Locations Support (CDPCILS)", + (cmbloc & 0x00000040) >> 6 ? "Not enforced" : "Enforced"); + obj_add_str(r, "CMB Data Pointer Mixed Locations Support (CDPMLS)", + (cmbloc & 0x00000020) >> 5 ? "Not enforced" : "Enforced"); + obj_add_str(r, "CMB Queue Physically Discontiguous Support (CQPDS)", + (cmbloc & 0x00000010) >> 4 ? "Not enforced" : "Enforced"); + obj_add_str(r, "CMB Queue Mixed Memory Support (CQMMS)", + (cmbloc & 0x00000008) >> 3 ? "Not enforced" : "Enforced"); + obj_add_uint_0x(r, "Base Indicator Register (BIR)", (cmbloc & 0x00000007)); +} + +static void json_registers_cmbsz(uint32_t cmbsz, struct json_object *r) +{ + obj_add_uint_x(r, "cmbsz", cmbsz); + + if (!cmbsz) { + obj_add_result(r, "Controller Memory Buffer feature is not supported"); + return; + } + + obj_add_uint(r, "Size (SZ)", (cmbsz & 0xfffff000) >> 12); + obj_add_str(r, "Size Units (SZU)", nvme_register_szu_to_string((cmbsz & 0xf00) >> 8)); + obj_add_str(r, "Write Data Support (WDS)", cmbsz & 0x10 ? "Supported" : "Not supported"); + obj_add_str(r, "Read Data Support (RDS)", cmbsz & 8 ? "Supported" : "Not supported"); + obj_add_str(r, "PRP SGL List Support (LISTS)", cmbsz & 4 ? "Supported" : "Not supported"); + obj_add_str(r, "Completion Queue Support (CQS)", cmbsz & 2 ? "Supported" : "Not supported"); + obj_add_str(r, "Submission Queue Support (SQS)", cmbsz & 1 ? "Supported" : "Not supported"); +} + +static void json_registers_bpinfo_brs(__u8 brs, struct json_object *r) +{ + char json_str[STR_LEN]; + + switch (brs) { + case 0: + sprintf(json_str, "No Boot Partition read operation requested"); + break; + case 1: + sprintf(json_str, "Boot Partition read in progress"); + break; + case 2: + sprintf(json_str, "Boot Partition read completed successfully"); + break; + case 3: + sprintf(json_str, "Error completing Boot Partition read"); + break; + default: + sprintf(json_str, "%s", "Invalid"); + break; + } + + obj_add_str(r, "Boot Read Status (BRS)", json_str); +} + +static void json_registers_bpinfo(uint32_t bpinfo, struct json_object *r) +{ + obj_add_uint_x(r, "bpinfo", bpinfo); + + obj_add_uint(r, "Active Boot Partition ID (ABPID)", (bpinfo & 0x80000000) >> 31); + json_registers_bpinfo_brs((bpinfo & 0x3000000) >> 24, r); + obj_add_uint(r, "Boot Partition Size (BPSZ)", bpinfo & 0x7fff); +} + +static void json_registers_bprsel(uint32_t bprsel, struct json_object *r) +{ + obj_add_uint_x(r, "bprsel", bprsel); + + obj_add_uint(r, "Boot Partition Identifier (BPID)", (bprsel & 0x80000000) >> 31); + obj_add_uint_x(r, "Boot Partition Read Offset (BPROF)", (bprsel & 0x3ffffc00) >> 10); + obj_add_uint_x(r, "Boot Partition Read Size (BPRSZ)", bprsel & 0x3ff); +} + +static void json_registers_bpmbl(uint64_t bpmbl, struct json_object *r) +{ + obj_add_prix64(r, "bpmbl", bpmbl); + + obj_add_prix64(r, "Boot Partition Memory Buffer Base Address (BMBBA)", bpmbl); +} + +static void json_registers_cmbmsc(uint64_t cmbmsc, struct json_object *r) +{ + obj_add_prix64(r, "cmbmsc", cmbmsc); + + obj_add_prix64(r, "Controller Base Address (CBA)", (cmbmsc & 0xfffffffffffff000) >> 12); + obj_add_prix64(r, "Controller Memory Space Enable (CMSE)", (cmbmsc & 2) >> 1); + obj_add_str(r, "Capabilities Registers Enabled (CRE)", + cmbmsc & 1 ? "Enabled" : "Not enabled"); +} + +static void json_registers_cmbsts(uint32_t cmbsts , struct json_object *r) +{ + obj_add_uint_x(r, "cmbsts", cmbsts); + + obj_add_uint_x(r, "Controller Base Address Invalid (CBAI)", cmbsts & 1); +} + +static void json_registers_pmrcap(uint32_t pmrcap, struct json_object *r) +{ + obj_add_uint_x(r, "pmrcap", pmrcap); + + obj_add_str(r, "Controller Memory Space Supported (CMSS)", + ((pmrcap & 0x01000000) >> 24) ? "Supported" : "Not supported"); + obj_add_uint_x(r, "Persistent Memory Region Timeout (PMRTO)", (pmrcap & 0xff0000) >> 16); + obj_add_uint_x(r, "Persistent Memory Region Write Barrier Mechanisms (PMRWBM)", + (pmrcap & 0x3c00) >> 10); + obj_add_str(r, "Persistent Memory Region Time Units (PMRTU)", + (pmrcap & 0x300) >> 8 ? "minutes" : "500 milliseconds"); + obj_add_uint_x(r, "Base Indicator Register (BIR)", (pmrcap & 0xe0) >> 5); + obj_add_str(r, "Write Data Support (WDS)", pmrcap & 0x10 ? "Supported" : "Not supported"); + obj_add_str(r, "Read Data Support (RDS)", pmrcap & 8 ? "Supported" : "Not supported"); +} + +static void json_registers_pmrctl(uint32_t pmrctl, struct json_object *r) +{ + obj_add_uint_x(r, "pmrctl", pmrctl); + + obj_add_str(r, "Enable (EN)", pmrctl & 1 ? "Ready" : "Disabled"); +} + +static void json_registers_pmrsts(uint32_t pmrsts, void *bar, struct json_object *r) +{ + uint32_t pmrctl = mmio_read32(bar + NVME_REG_PMRCTL); + + obj_add_uint_x(r, "pmrsts", pmrsts); + + obj_add_uint_x(r, "Controller Base Address Invalid (CBAI)", (pmrsts & 0x1000) >> 12); + obj_add_str(r, "Health Status (HSTS)", + nvme_register_pmr_hsts_to_string((pmrsts & 0xe00) >> 9)); + obj_add_str(r, "Not Ready (NRDY)", + !(pmrsts & 0x100) && (pmrctl & 1) ? "Ready" : "Not ready"); + obj_add_uint_x(r, "Error (ERR)", pmrsts & 0xff); +} + +static void json_registers_pmrebs(uint32_t pmrebs, struct json_object *r) +{ + obj_add_uint_x(r, "pmrebs", pmrebs); + + obj_add_uint_x(r, "PMR Elasticity Buffer Size Base (PMRWBZ)", (pmrebs & 0xffffff00) >> 8); + obj_add_str(r, "Read Bypass Behavior", pmrebs & 0x10 ? "Shall" : "May"); + obj_add_str(r, "PMR Elasticity Buffer Size Units (PMRSZU)", + nvme_register_pmr_pmrszu_to_string(pmrebs & 0xf)); +} + +static void json_registers_pmrswtp(uint32_t pmrswtp, struct json_object *r) +{ + obj_add_uint_x(r, "pmrswtp", pmrswtp); + + obj_add_uint_x(r, "PMR Sustained Write Throughput (PMRSWTV)", (pmrswtp & 0xffffff00) >> 8); + obj_add_key(r, "PMR Sustained Write Throughput Units (PMRSWTU)", "%s/second", + nvme_register_pmr_pmrszu_to_string(pmrswtp & 0xf)); +} + +static void json_registers_pmrmscl(uint32_t pmrmscl, struct json_object *r) +{ + obj_add_uint_nx(r, "pmrmscl", pmrmscl); + + obj_add_uint_nx(r, "Controller Base Address (CBA)", (pmrmscl & 0xfffff000) >> 12); + obj_add_uint_nx(r, "Controller Memory Space Enable (CMSE)", (pmrmscl & 2) >> 1); +} + +static void json_registers_pmrmscu(uint32_t pmrmscu, struct json_object *r) +{ + obj_add_uint_nx(r, "pmrmscu", pmrmscu); + + obj_add_uint_nx(r, "Controller Base Address (CBA)", pmrmscu); +} + +static void json_registers_unknown(int offset, uint64_t value64, struct json_object *r) +{ + obj_add_uint_02x(r, "unknown property", offset); + obj_add_str(r, "name", nvme_register_to_string(offset)); + obj_add_prix64(r, "value", value64); +} + +static void json_single_property_human(int offset, uint64_t value64, struct json_object *r) +{ + uint32_t value32 = (uint32_t)value64; + + switch (offset) { + case NVME_REG_CAP: + json_registers_cap((struct nvme_bar_cap *)&value64, r); + break; + case NVME_REG_VS: + json_registers_version(value32, r); + break; + case NVME_REG_CC: + json_registers_cc(value32, r); + break; + case NVME_REG_CSTS: + json_registers_csts(value32, r); + break; + case NVME_REG_NSSR: + json_registers_nssr(value32, r); + break; + case NVME_REG_CRTO: + json_registers_crto(value32, r); + break; + default: + json_registers_unknown(offset, value64, r); + break; + } +} + +static void json_single_property(int offset, uint64_t value64) +{ + struct json_object *r = json_create_object(); + char json_str[STR_LEN]; + uint32_t value32 = (uint32_t)value64; + + if (human()) { + json_single_property_human(offset, value64, r); + } else { + sprintf(json_str, "0x%02x", offset); + obj_add_str(r, "property", json_str); + + obj_add_str(r, "name", nvme_register_to_string(offset)); + + if (nvme_is_64bit_reg(offset)) + sprintf(json_str, "%"PRIx64"", value64); + else + sprintf(json_str, "%x", value32); + + obj_add_str(r, "value", json_str); + } + + json_print(r); } struct json_object* json_effects_log(enum nvme_csi csi, struct nvme_cmd_effects_log *effects_log) { - struct json_object *root; - struct json_object *acs; - struct json_object *iocs; + struct json_object *r = json_create_object(); + struct json_object *acs = json_create_object(); + struct json_object *iocs = json_create_object(); unsigned int opcode; char key[128]; __u32 effect; - root = json_create_object(); - json_object_add_value_uint(root, "command_set_identifier", csi); + obj_add_uint(r, "command_set_identifier", csi); - acs = json_create_object(); for (opcode = 0; opcode < 256; opcode++) { effect = le32_to_cpu(effects_log->acs[opcode]); if (effect & NVME_CMD_EFFECTS_CSUPP) { sprintf(key, "ACS_%u (%s)", opcode, nvme_cmd_to_string(1, opcode)); - json_object_add_value_uint(acs, key, effect); + obj_add_uint(acs, key, effect); } } - json_object_add_value_object(root, "admin_cmd_set", acs); + obj_add_obj(r, "admin_cmd_set", acs); - iocs = json_create_object(); for (opcode = 0; opcode < 256; opcode++) { effect = le32_to_cpu(effects_log->iocs[opcode]); if (effect & NVME_CMD_EFFECTS_CSUPP) { sprintf(key, "IOCS_%u (%s)", opcode, nvme_cmd_to_string(0, opcode)); - json_object_add_value_uint(iocs, key, effect); + obj_add_uint(iocs, key, effect); } } - json_object_add_value_object(root, "io_cmd_set", iocs); - return root; + obj_add_obj(r, "io_cmd_set", iocs); + return r; } static void json_effects_log_list(struct list_head *list) { - struct json_object *json_list; + struct json_object *r = json_create_array(); nvme_effects_log_node_t *node; - json_list = json_create_array(); - list_for_each(list, node, node) { struct json_object *json_page = json_effects_log(node->csi, &node->effects); - json_array_add_value_object(json_list, json_page); + array_add_obj(r, json_page); } - json_print_object(json_list, NULL); - printf("\n"); - json_free_object(json_list); + json_print(r); } static void json_sanitize_log(struct nvme_sanitize_log_page *sanitize_log, const char *devname) { - struct json_object *root; - struct json_object *dev; - struct json_object *sstat; + struct json_object *r = json_create_object(); + struct json_object *dev = json_create_object(); + struct json_object *sstat = json_create_object(); const char *status_str; char str[128]; __u16 status = le16_to_cpu(sanitize_log->sstat); - root = json_create_object(); - dev = json_create_object(); - sstat = json_create_object(); - - json_object_add_value_int(dev, "sprog", - le16_to_cpu(sanitize_log->sprog)); - json_object_add_value_int(sstat, "global_erased", - (status & NVME_SANITIZE_SSTAT_GLOBAL_DATA_ERASED) >> 8); - json_object_add_value_int(sstat, "no_cmplted_passes", - (status >> NVME_SANITIZE_SSTAT_COMPLETED_PASSES_SHIFT) & - NVME_SANITIZE_SSTAT_COMPLETED_PASSES_MASK); + obj_add_int(dev, "sprog", le16_to_cpu(sanitize_log->sprog)); + obj_add_int(sstat, "global_erased", (status & NVME_SANITIZE_SSTAT_GLOBAL_DATA_ERASED) >> 8); + obj_add_int(sstat, "no_cmplted_passes", + (status >> NVME_SANITIZE_SSTAT_COMPLETED_PASSES_SHIFT) & + NVME_SANITIZE_SSTAT_COMPLETED_PASSES_MASK); status_str = nvme_sstat_status_to_string(status); sprintf(str, "(%d) %s", status & NVME_SANITIZE_SSTAT_STATUS_MASK, status_str); - json_object_add_value_string(sstat, "status", str); - - json_object_add_value_object(dev, "sstat", sstat); - json_object_add_value_uint(dev, "cdw10_info", - le32_to_cpu(sanitize_log->scdw10)); - json_object_add_value_uint(dev, "time_over_write", - le32_to_cpu(sanitize_log->eto)); - json_object_add_value_uint(dev, "time_block_erase", - le32_to_cpu(sanitize_log->etbe)); - json_object_add_value_uint(dev, "time_crypto_erase", - le32_to_cpu(sanitize_log->etce)); - - json_object_add_value_uint(dev, "time_over_write_no_dealloc", - le32_to_cpu(sanitize_log->etond)); - json_object_add_value_uint(dev, "time_block_erase_no_dealloc", - le32_to_cpu(sanitize_log->etbend)); - json_object_add_value_uint(dev, "time_crypto_erase_no_dealloc", - le32_to_cpu(sanitize_log->etcend)); - - json_object_add_value_object(root, devname, dev); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + obj_add_str(sstat, status_str, str); + + obj_add_obj(dev, "sstat", sstat); + obj_add_uint(dev, "cdw10_info", le32_to_cpu(sanitize_log->scdw10)); + obj_add_uint(dev, "time_over_write", le32_to_cpu(sanitize_log->eto)); + obj_add_uint(dev, "time_block_erase", le32_to_cpu(sanitize_log->etbe)); + obj_add_uint(dev, "time_crypto_erase", le32_to_cpu(sanitize_log->etce)); + obj_add_uint(dev, "time_over_write_no_dealloc", le32_to_cpu(sanitize_log->etond)); + obj_add_uint(dev, "time_block_erase_no_dealloc", le32_to_cpu(sanitize_log->etbend)); + obj_add_uint(dev, "time_crypto_erase_no_dealloc", le32_to_cpu(sanitize_log->etcend)); + + obj_add_obj(r, devname, dev); + + json_print(r); } static void json_predictable_latency_per_nvmset( struct nvme_nvmset_predictable_lat_log *plpns_log, __u16 nvmset_id, const char *devname) { - struct json_object *root; - - root = json_create_object(); - json_object_add_value_uint(root, "nvmset_id", - le16_to_cpu(nvmset_id)); - json_object_add_value_uint(root, "status", - plpns_log->status); - json_object_add_value_uint(root, "event_type", - le16_to_cpu(plpns_log->event_type)); - json_object_add_value_uint64(root, "dtwin_reads_typical", - le64_to_cpu(plpns_log->dtwin_rt)); - json_object_add_value_uint64(root, "dtwin_writes_typical", - le64_to_cpu(plpns_log->dtwin_wt)); - json_object_add_value_uint64(root, "dtwin_time_maximum", - le64_to_cpu(plpns_log->dtwin_tmax)); - json_object_add_value_uint64(root, "ndwin_time_minimum_high", - le64_to_cpu(plpns_log->ndwin_tmin_hi)); - json_object_add_value_uint64(root, "ndwin_time_minimum_low", - le64_to_cpu(plpns_log->ndwin_tmin_lo)); - json_object_add_value_uint64(root, "dtwin_reads_estimate", - le64_to_cpu(plpns_log->dtwin_re)); - json_object_add_value_uint64(root, "dtwin_writes_estimate", - le64_to_cpu(plpns_log->dtwin_we)); - json_object_add_value_uint64(root, "dtwin_time_estimate", - le64_to_cpu(plpns_log->dtwin_te)); - - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + struct json_object *r = json_create_object(); + + obj_add_uint(r, "nvmset_id", le16_to_cpu(nvmset_id)); + obj_add_uint(r, "status", plpns_log->status); + obj_add_uint(r, "event_type", le16_to_cpu(plpns_log->event_type)); + obj_add_uint64(r, "dtwin_reads_typical", le64_to_cpu(plpns_log->dtwin_rt)); + obj_add_uint64(r, "dtwin_writes_typical", le64_to_cpu(plpns_log->dtwin_wt)); + obj_add_uint64(r, "dtwin_time_maximum", le64_to_cpu(plpns_log->dtwin_tmax)); + obj_add_uint64(r, "ndwin_time_minimum_high", le64_to_cpu(plpns_log->ndwin_tmin_hi)); + obj_add_uint64(r, "ndwin_time_minimum_low", le64_to_cpu(plpns_log->ndwin_tmin_lo)); + obj_add_uint64(r, "dtwin_reads_estimate", le64_to_cpu(plpns_log->dtwin_re)); + obj_add_uint64(r, "dtwin_writes_estimate", le64_to_cpu(plpns_log->dtwin_we)); + obj_add_uint64(r, "dtwin_time_estimate", le64_to_cpu(plpns_log->dtwin_te)); + + json_print(r); } static void json_predictable_latency_event_agg_log( struct nvme_aggregate_predictable_lat_event *pea_log, __u64 log_entries, __u32 size, const char *devname) { - struct json_object *root; + struct json_object *r = json_create_object(); struct json_object *valid_attrs; - struct json_object *valid; - __u64 num_iter; - __u64 num_entries; + struct json_object *valid = json_create_array(); + __u64 num_entries = le64_to_cpu(pea_log->num_entries); + __u64 num_iter = min(num_entries, log_entries); - root = json_create_object(); - num_entries = le64_to_cpu(pea_log->num_entries); - json_object_add_value_uint64(root, "num_entries_avail", - num_entries); - valid = json_create_array(); + obj_add_uint64(r, "num_entries_avail", num_entries); - num_iter = min(num_entries, log_entries); for (int i = 0; i < num_iter; i++) { valid_attrs = json_create_object(); - json_object_add_value_uint(valid_attrs, "entry", - le16_to_cpu(pea_log->entries[i])); - json_array_add_value_object(valid, valid_attrs); + obj_add_uint(valid_attrs, "entry", le16_to_cpu(pea_log->entries[i])); + array_add_obj(valid, valid_attrs); } - json_object_add_value_array(root, "list_of_entries", valid); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + + obj_add_array(r, "list_of_entries", valid); + + json_print(r); } -static void json_add_bitmap(int i, __u8 seb, struct json_object *root) +static void json_add_bitmap(int i, __u8 seb, struct json_object *r) { char evt_str[50]; char key[128]; @@ -887,573 +1422,671 @@ static void json_add_bitmap(int i, __u8 seb, struct json_object *root) if ((seb >> bit) & 0x1) snprintf(evt_str, sizeof(evt_str), "Support %s", nvme_pel_event_to_string(bit + i * 8)); - json_object_add_value_string(root, key, evt_str); + obj_add_str(r, key, evt_str); } } } +static void json_pevent_log_head(struct nvme_persistent_event_log *pevent_log_head, + struct json_object *r) +{ + int i; + char sn[sizeof(pevent_log_head->sn) + 1]; + char mn[sizeof(pevent_log_head->mn) + 1]; + char subnqn[sizeof(pevent_log_head->subnqn) + 1]; + + snprintf(sn, sizeof(sn), "%-.*s", (int)sizeof(pevent_log_head->sn), pevent_log_head->sn); + snprintf(mn, sizeof(mn), "%-.*s", (int)sizeof(pevent_log_head->mn), pevent_log_head->mn); + snprintf(subnqn, sizeof(subnqn), "%-.*s", (int)sizeof(pevent_log_head->subnqn), + pevent_log_head->subnqn); + + obj_add_uint(r, "log_id", pevent_log_head->lid); + obj_add_uint(r, "total_num_of_events", le32_to_cpu(pevent_log_head->tnev)); + obj_add_uint64(r, "total_log_len", le64_to_cpu(pevent_log_head->tll)); + obj_add_uint(r, "log_revision", pevent_log_head->rv); + obj_add_uint(r, "log_header_len", le16_to_cpu(pevent_log_head->lhl)); + obj_add_uint64(r, "timestamp", le64_to_cpu(pevent_log_head->ts)); + obj_add_uint128(r, "power_on_hours", le128_to_cpu(pevent_log_head->poh)); + obj_add_uint64(r, "power_cycle_count", le64_to_cpu(pevent_log_head->pcc)); + obj_add_uint(r, "pci_vid", le16_to_cpu(pevent_log_head->vid)); + obj_add_uint(r, "pci_ssvid", le16_to_cpu(pevent_log_head->ssvid)); + obj_add_str(r, "sn", sn); + obj_add_str(r, "mn", mn); + obj_add_str(r, "subnqn", subnqn); + obj_add_uint(r, "gen_number", le16_to_cpu(pevent_log_head->gen_number)); + obj_add_uint(r, "rci", le32_to_cpu(pevent_log_head->rci)); + + for (i = 0; i < ARRAY_SIZE(pevent_log_head->seb); i++) { + if (!pevent_log_head->seb[i]) + continue; + json_add_bitmap(i, pevent_log_head->seb[i], r); + } +} -static void json_persistent_event_log(void *pevent_log_info, __u8 action, - __u32 size, const char *devname) - +static void json_pel_smart_health(void *pevent_log_info, __u32 offset, + struct json_object *valid_attrs) { - struct json_object *root; - struct json_object *valid_attrs; - struct json_object *valid; - __u32 offset, por_info_len, por_info_list; - __u64 *fw_rev; char key[128]; + struct nvme_smart_log *smart_event = pevent_log_info + offset; + unsigned int temperature = (smart_event->temperature[1] << 8) | smart_event->temperature[0]; + nvme_uint128_t data_units_read = le128_to_cpu(smart_event->data_units_read); + nvme_uint128_t data_units_written = le128_to_cpu(smart_event->data_units_written); + nvme_uint128_t host_read_commands = le128_to_cpu(smart_event->host_reads); + nvme_uint128_t host_write_commands = le128_to_cpu(smart_event->host_writes); + nvme_uint128_t controller_busy_time = le128_to_cpu(smart_event->ctrl_busy_time); + nvme_uint128_t power_cycles = le128_to_cpu(smart_event->power_cycles); + nvme_uint128_t power_on_hours = le128_to_cpu(smart_event->power_on_hours); + nvme_uint128_t unsafe_shutdowns = le128_to_cpu(smart_event->unsafe_shutdowns); + nvme_uint128_t media_errors = le128_to_cpu(smart_event->media_errors); + nvme_uint128_t num_err_log_entries = le128_to_cpu(smart_event->num_err_log_entries); + int c; + __s32 temp; + + obj_add_int(valid_attrs, "critical_warning", smart_event->critical_warning); + obj_add_int(valid_attrs, "temperature", temperature); + obj_add_int(valid_attrs, "avail_spare", smart_event->avail_spare); + obj_add_int(valid_attrs, "spare_thresh", smart_event->spare_thresh); + obj_add_int(valid_attrs, "percent_used", smart_event->percent_used); + obj_add_int(valid_attrs, "endurance_grp_critical_warning_summary", + smart_event->endu_grp_crit_warn_sumry); + obj_add_uint128(valid_attrs, "data_units_read", data_units_read); + obj_add_uint128(valid_attrs, "data_units_written", data_units_written); + obj_add_uint128(valid_attrs, "host_read_commands", host_read_commands); + obj_add_uint128(valid_attrs, "host_write_commands", host_write_commands); + obj_add_uint128(valid_attrs, "controller_busy_time", controller_busy_time); + obj_add_uint128(valid_attrs, "power_cycles", power_cycles); + obj_add_uint128(valid_attrs, "power_on_hours", power_on_hours); + obj_add_uint128(valid_attrs, "unsafe_shutdowns", unsafe_shutdowns); + obj_add_uint128(valid_attrs, "media_errors", media_errors); + obj_add_uint128(valid_attrs, "num_err_log_entries", num_err_log_entries); + obj_add_uint(valid_attrs, "warning_temp_time", le32_to_cpu(smart_event->warning_temp_time)); + obj_add_uint(valid_attrs, "critical_comp_time", + le32_to_cpu(smart_event->critical_comp_time)); + + for (c = 0; c < 8; c++) { + temp = le16_to_cpu(smart_event->temp_sensor[c]); + if (!temp) + continue; + sprintf(key, "temperature_sensor_%d",c + 1); + obj_add_int(valid_attrs, key, temp); + } + + obj_add_uint(valid_attrs, "thm_temp1_trans_count", + le32_to_cpu(smart_event->thm_temp1_trans_count)); + obj_add_uint(valid_attrs, "thm_temp2_trans_count", + le32_to_cpu(smart_event->thm_temp2_trans_count)); + obj_add_uint(valid_attrs, "thm_temp1_total_time", + le32_to_cpu(smart_event->thm_temp1_total_time)); + obj_add_uint(valid_attrs, "thm_temp2_total_time", + le32_to_cpu(smart_event->thm_temp2_total_time)); +} + +static void json_pel_fw_commit(void *pevent_log_info, __u32 offset, struct json_object *valid_attrs) +{ char fw_str[50]; + struct nvme_fw_commit_event *fw_commit_event = pevent_log_info + offset; + + snprintf(fw_str, sizeof(fw_str), "%"PRIu64" (%s)", le64_to_cpu(fw_commit_event->old_fw_rev), + util_fw_to_string((char *)&fw_commit_event->old_fw_rev)); + obj_add_str(valid_attrs, "old_fw_rev", fw_str); + snprintf(fw_str, sizeof(fw_str), "%"PRIu64" (%s)", le64_to_cpu(fw_commit_event->new_fw_rev), + util_fw_to_string((char *)&fw_commit_event->new_fw_rev)); + obj_add_str(valid_attrs, "new_fw_rev", fw_str); + obj_add_uint(valid_attrs, "fw_commit_action", fw_commit_event->fw_commit_action); + obj_add_uint(valid_attrs, "fw_slot", fw_commit_event->fw_slot); + obj_add_uint(valid_attrs, "sct_fw", fw_commit_event->sct_fw); + obj_add_uint(valid_attrs, "sc_fw", fw_commit_event->sc_fw); + obj_add_uint(valid_attrs, "vu_assign_fw_commit_rc", + le16_to_cpu(fw_commit_event->vndr_assign_fw_commit_rc)); +} - struct nvme_smart_log *smart_event; - struct nvme_fw_commit_event *fw_commit_event; - struct nvme_time_stamp_change_event *ts_change_event; - struct nvme_power_on_reset_info_list *por_event; - struct nvme_nss_hw_err_event *nss_hw_err_event; - struct nvme_change_ns_event *ns_event; - struct nvme_format_nvm_start_event *format_start_event; - struct nvme_format_nvm_compln_event *format_cmpln_event; - struct nvme_sanitize_start_event *sanitize_start_event; - struct nvme_sanitize_compln_event *sanitize_cmpln_event; - struct nvme_thermal_exc_event *thermal_exc_event; - struct nvme_persistent_event_log *pevent_log_head; - struct nvme_persistent_event_entry *pevent_entry_head; +static void json_pel_timestamp(void *pevent_log_info, __u32 offset, struct json_object *valid_attrs) +{ + struct nvme_time_stamp_change_event *ts_change_event = pevent_log_info + offset; - root = json_create_object(); - valid = json_create_array(); + obj_add_uint64(valid_attrs, "prev_ts", le64_to_cpu(ts_change_event->previous_timestamp)); + obj_add_uint64(valid_attrs, "ml_secs_since_reset", + le64_to_cpu(ts_change_event->ml_secs_since_reset)); +} - offset = sizeof(*pevent_log_head); - if (size >= offset) { - pevent_log_head = pevent_log_info; - char sn[sizeof(pevent_log_head->sn) + 1], - mn[sizeof(pevent_log_head->mn) + 1], - subnqn[sizeof(pevent_log_head->subnqn) + 1]; - - snprintf(sn, sizeof(sn), "%-.*s", - (int)sizeof(pevent_log_head->sn), pevent_log_head->sn); - snprintf(mn, sizeof(mn), "%-.*s", - (int)sizeof(pevent_log_head->mn), pevent_log_head->mn); - snprintf(subnqn, sizeof(subnqn), "%-.*s", - (int)sizeof(pevent_log_head->subnqn), pevent_log_head->subnqn); - - json_object_add_value_uint(root, "log_id", - pevent_log_head->lid); - json_object_add_value_uint(root, "total_num_of_events", - le32_to_cpu(pevent_log_head->tnev)); - json_object_add_value_uint64(root, "total_log_len", - le64_to_cpu(pevent_log_head->tll)); - json_object_add_value_uint(root, "log_revision", - pevent_log_head->rv); - json_object_add_value_uint(root, "log_header_len", - le16_to_cpu(pevent_log_head->lhl)); - json_object_add_value_uint64(root, "timestamp", - le64_to_cpu(pevent_log_head->ts)); - json_object_add_value_uint128(root, "power_on_hours", - le128_to_cpu(pevent_log_head->poh)); - json_object_add_value_uint64(root, "power_cycle_count", - le64_to_cpu(pevent_log_head->pcc)); - json_object_add_value_uint(root, "pci_vid", - le16_to_cpu(pevent_log_head->vid)); - json_object_add_value_uint(root, "pci_ssvid", - le16_to_cpu(pevent_log_head->ssvid)); - json_object_add_value_string(root, "sn", sn); - json_object_add_value_string(root, "mn", mn); - json_object_add_value_string(root, "subnqn", subnqn); - json_object_add_value_uint(root, "gen_number", - le16_to_cpu(pevent_log_head->gen_number)); - json_object_add_value_uint(root, "rci", - le32_to_cpu(pevent_log_head->rci)); - for (int i = 0; i < 32; i++) { - if (pevent_log_head->seb[i] == 0) - continue; - json_add_bitmap(i, pevent_log_head->seb[i], root); - } - } else { - printf("No log data can be shown with this log len at least " \ - "512 bytes is required or can be 0 to read the complete "\ - "log page after context established\n"); - return; +static void json_pel_power_on_reset(void *pevent_log_info, __u32 offset, + struct json_object *valid_attrs, __le16 vsil, __le16 el) +{ + __u64 *fw_rev; + char fw_str[50]; + struct nvme_power_on_reset_info_list *por_event; + __u32 por_info_len = le16_to_cpu(el) - le16_to_cpu(vsil) - sizeof(*fw_rev); + __u32 por_info_list = por_info_len / sizeof(*por_event); + int i; + + fw_rev = pevent_log_info + offset; + snprintf(fw_str, sizeof(fw_str), "%"PRIu64" (%s)", le64_to_cpu(*fw_rev), + util_fw_to_string((char *)fw_rev)); + obj_add_str(valid_attrs, "fw_rev", fw_str); + + for (i = 0; i < por_info_list; i++) { + por_event = pevent_log_info + offset + sizeof(*fw_rev) + i * sizeof(*por_event); + obj_add_uint(valid_attrs, "ctrl_id", le16_to_cpu(por_event->cid)); + obj_add_uint(valid_attrs, "fw_act", por_event->fw_act); + obj_add_uint(valid_attrs, "op_in_prog", por_event->op_in_prog); + obj_add_uint(valid_attrs, "ctrl_power_cycle", + le32_to_cpu(por_event->ctrl_power_cycle)); + obj_add_uint64(valid_attrs, "power_on_ml_secs", + le64_to_cpu(por_event->power_on_ml_seconds)); + obj_add_uint64(valid_attrs, "ctrl_time_stamp", + le64_to_cpu(por_event->ctrl_time_stamp)); } - for (int i = 0; i < le32_to_cpu(pevent_log_head->tnev); i++) { +} + +static void json_pel_nss_hw_error(void *pevent_log_info, __u32 offset, + struct json_object *valid_attrs) +{ + struct nvme_nss_hw_err_event *nss_hw_err_event = pevent_log_info + offset; + + obj_add_uint(valid_attrs, "nss_hw_err_code", + le16_to_cpu(nss_hw_err_event->nss_hw_err_event_code)); +} + +static void json_pel_change_ns(void *pevent_log_info, __u32 offset, struct json_object *valid_attrs) +{ + struct nvme_change_ns_event *ns_event = pevent_log_info + offset; + + obj_add_uint(valid_attrs, "nsmgt_cdw10", le32_to_cpu(ns_event->nsmgt_cdw10)); + obj_add_uint64(valid_attrs, "nsze", le64_to_cpu(ns_event->nsze)); + obj_add_uint64(valid_attrs, "nscap", le64_to_cpu(ns_event->nscap)); + obj_add_uint(valid_attrs, "flbas", ns_event->flbas); + obj_add_uint(valid_attrs, "dps", ns_event->dps); + obj_add_uint(valid_attrs, "nmic", ns_event->nmic); + obj_add_uint(valid_attrs, "ana_grp_id", le32_to_cpu(ns_event->ana_grp_id)); + obj_add_uint(valid_attrs, "nvmset_id", le16_to_cpu(ns_event->nvmset_id)); + obj_add_uint(valid_attrs, "nsid", le32_to_cpu(ns_event->nsid)); +} + +static void json_pel_format_start(void *pevent_log_info, __u32 offset, + struct json_object *valid_attrs) +{ + struct nvme_format_nvm_start_event *format_start_event = pevent_log_info + offset; + + obj_add_uint(valid_attrs, "nsid", le32_to_cpu(format_start_event->nsid)); + obj_add_uint(valid_attrs, "fna", format_start_event->fna); + obj_add_uint(valid_attrs, "format_nvm_cdw10", + le32_to_cpu(format_start_event->format_nvm_cdw10)); +} + +static void json_pel_format_completion(void *pevent_log_info, __u32 offset, + struct json_object *valid_attrs) +{ + struct nvme_format_nvm_compln_event *format_cmpln_event = pevent_log_info + offset; + + obj_add_uint(valid_attrs, "nsid", le32_to_cpu(format_cmpln_event->nsid)); + obj_add_uint(valid_attrs, "smallest_fpi", format_cmpln_event->smallest_fpi); + obj_add_uint(valid_attrs, "format_nvm_status", format_cmpln_event->format_nvm_status); + obj_add_uint(valid_attrs, "compln_info", le16_to_cpu(format_cmpln_event->compln_info)); + obj_add_uint(valid_attrs, "status_field", le32_to_cpu(format_cmpln_event->status_field)); +} +static void json_pel_sanitize_start(void *pevent_log_info, __u32 offset, + struct json_object *valid_attrs) +{ + struct nvme_sanitize_start_event *sanitize_start_event = pevent_log_info + offset; + + obj_add_uint(valid_attrs, "SANICAP", le32_to_cpu(sanitize_start_event->sani_cap)); + obj_add_uint(valid_attrs, "sani_cdw10", le32_to_cpu(sanitize_start_event->sani_cdw10)); + obj_add_uint(valid_attrs, "sani_cdw11", le32_to_cpu(sanitize_start_event->sani_cdw11)); +} + +static void json_pel_sanitize_completion(void *pevent_log_info, __u32 offset, + struct json_object *valid_attrs) +{ + struct nvme_sanitize_compln_event *sanitize_cmpln_event = pevent_log_info + offset; + + obj_add_uint(valid_attrs, "sani_prog", le16_to_cpu(sanitize_cmpln_event->sani_prog)); + obj_add_uint(valid_attrs, "sani_status", le16_to_cpu(sanitize_cmpln_event->sani_status)); + obj_add_uint(valid_attrs, "cmpln_info", le16_to_cpu(sanitize_cmpln_event->cmpln_info)); +} + +static void json_pel_thermal_excursion(void *pevent_log_info, __u32 offset, + struct json_object *valid_attrs) +{ + struct nvme_thermal_exc_event *thermal_exc_event = pevent_log_info + offset; + + obj_add_uint(valid_attrs, "over_temp", thermal_exc_event->over_temp); + obj_add_uint(valid_attrs, "threshold", thermal_exc_event->threshold); +} + +static void json_pevent_entry(void *pevent_log_info, __u8 action, __u32 size, const char *devname, + __u32 offset, struct json_object *valid) +{ + int i; + struct nvme_persistent_event_log *pevent_log_head = pevent_log_info; + struct nvme_persistent_event_entry *pevent_entry_head; + struct json_object *valid_attrs; + + for (i = 0; i < le32_to_cpu(pevent_log_head->tnev); i++) { if (offset + sizeof(*pevent_entry_head) >= size) break; pevent_entry_head = pevent_log_info + offset; - if ((offset + pevent_entry_head->ehl + 3 + - le16_to_cpu(pevent_entry_head->el)) >= size) + if (offset + pevent_entry_head->ehl + 3 + le16_to_cpu(pevent_entry_head->el) >= + size) break; + valid_attrs = json_create_object(); - json_object_add_value_uint(valid_attrs, "event_number", i); - json_object_add_value_string(valid_attrs, "event_type", - nvme_pel_event_to_string(pevent_entry_head->etype)); - json_object_add_value_uint(valid_attrs, "event_type_rev", - pevent_entry_head->etype_rev); - json_object_add_value_uint(valid_attrs, "event_header_len", - pevent_entry_head->ehl); - json_object_add_value_uint(valid_attrs, "event_header_additional_info", - pevent_entry_head->ehai); - json_object_add_value_uint(valid_attrs, "ctrl_id", - le16_to_cpu(pevent_entry_head->cntlid)); - json_object_add_value_uint64(valid_attrs, "event_time_stamp", - le64_to_cpu(pevent_entry_head->ets)); - json_object_add_value_uint(valid_attrs, "port_id", - le16_to_cpu(pevent_entry_head->pelpid)); - json_object_add_value_uint(valid_attrs, "vu_info_len", - le16_to_cpu(pevent_entry_head->vsil)); - json_object_add_value_uint(valid_attrs, "event_len", - le16_to_cpu(pevent_entry_head->el)); + obj_add_uint(valid_attrs, "event_number", i); + obj_add_str(valid_attrs, "event_type", + nvme_pel_event_to_string(pevent_entry_head->etype)); + obj_add_uint(valid_attrs, "event_type_rev", pevent_entry_head->etype_rev); + obj_add_uint(valid_attrs, "event_header_len", pevent_entry_head->ehl); + obj_add_uint(valid_attrs, "event_header_additional_info", pevent_entry_head->ehai); + obj_add_uint(valid_attrs, "ctrl_id", le16_to_cpu(pevent_entry_head->cntlid)); + obj_add_uint64(valid_attrs, "event_time_stamp", + le64_to_cpu(pevent_entry_head->ets)); + obj_add_uint(valid_attrs, "port_id", le16_to_cpu(pevent_entry_head->pelpid)); + obj_add_uint(valid_attrs, "vu_info_len", le16_to_cpu(pevent_entry_head->vsil)); + obj_add_uint(valid_attrs, "event_len", le16_to_cpu(pevent_entry_head->el)); offset += pevent_entry_head->ehl + 3; switch (pevent_entry_head->etype) { case NVME_PEL_SMART_HEALTH_EVENT: - smart_event = pevent_log_info + offset; - unsigned int temperature = ((smart_event->temperature[1] << 8) | - smart_event->temperature[0]); - - nvme_uint128_t data_units_read = le128_to_cpu(smart_event->data_units_read); - nvme_uint128_t data_units_written = le128_to_cpu(smart_event->data_units_written); - nvme_uint128_t host_read_commands = le128_to_cpu(smart_event->host_reads); - nvme_uint128_t host_write_commands = le128_to_cpu(smart_event->host_writes); - nvme_uint128_t controller_busy_time = le128_to_cpu(smart_event->ctrl_busy_time); - nvme_uint128_t power_cycles = le128_to_cpu(smart_event->power_cycles); - nvme_uint128_t power_on_hours = le128_to_cpu(smart_event->power_on_hours); - nvme_uint128_t unsafe_shutdowns = le128_to_cpu(smart_event->unsafe_shutdowns); - nvme_uint128_t media_errors = le128_to_cpu(smart_event->media_errors); - nvme_uint128_t num_err_log_entries = le128_to_cpu(smart_event->num_err_log_entries); - json_object_add_value_int(valid_attrs, "critical_warning", - smart_event->critical_warning); - - json_object_add_value_int(valid_attrs, "temperature", - temperature); - json_object_add_value_int(valid_attrs, "avail_spare", - smart_event->avail_spare); - json_object_add_value_int(valid_attrs, "spare_thresh", - smart_event->spare_thresh); - json_object_add_value_int(valid_attrs, "percent_used", - smart_event->percent_used); - json_object_add_value_int(valid_attrs, - "endurance_grp_critical_warning_summary", - smart_event->endu_grp_crit_warn_sumry); - json_object_add_value_uint128(valid_attrs, "data_units_read", - data_units_read); - json_object_add_value_uint128(valid_attrs, "data_units_written", - data_units_written); - json_object_add_value_uint128(valid_attrs, "host_read_commands", - host_read_commands); - json_object_add_value_uint128(valid_attrs, "host_write_commands", - host_write_commands); - json_object_add_value_uint128(valid_attrs, "controller_busy_time", - controller_busy_time); - json_object_add_value_uint128(valid_attrs, "power_cycles", - power_cycles); - json_object_add_value_uint128(valid_attrs, "power_on_hours", - power_on_hours); - json_object_add_value_uint128(valid_attrs, "unsafe_shutdowns", - unsafe_shutdowns); - json_object_add_value_uint128(valid_attrs, "media_errors", - media_errors); - json_object_add_value_uint128(valid_attrs, "num_err_log_entries", - num_err_log_entries); - json_object_add_value_uint(valid_attrs, "warning_temp_time", - le32_to_cpu(smart_event->warning_temp_time)); - json_object_add_value_uint(valid_attrs, "critical_comp_time", - le32_to_cpu(smart_event->critical_comp_time)); - - for (int c = 0; c < 8; c++) { - __s32 temp = le16_to_cpu(smart_event->temp_sensor[c]); - if (temp == 0) - continue; - sprintf(key, "temperature_sensor_%d",c + 1); - json_object_add_value_int(valid_attrs, key, temp); - } - - json_object_add_value_uint(valid_attrs, "thm_temp1_trans_count", - le32_to_cpu(smart_event->thm_temp1_trans_count)); - json_object_add_value_uint(valid_attrs, "thm_temp2_trans_count", - le32_to_cpu(smart_event->thm_temp2_trans_count)); - json_object_add_value_uint(valid_attrs, "thm_temp1_total_time", - le32_to_cpu(smart_event->thm_temp1_total_time)); - json_object_add_value_uint(valid_attrs, "thm_temp2_total_time", - le32_to_cpu(smart_event->thm_temp2_total_time)); + json_pel_smart_health(pevent_log_info, offset, valid_attrs); break; case NVME_PEL_FW_COMMIT_EVENT: - fw_commit_event = pevent_log_info + offset; - snprintf(fw_str, sizeof(fw_str), "%"PRIu64" (%s)", - le64_to_cpu(fw_commit_event->old_fw_rev), - util_fw_to_string((char *)&fw_commit_event->old_fw_rev)); - json_object_add_value_string(valid_attrs, "old_fw_rev", fw_str); - snprintf(fw_str, sizeof(fw_str), "%"PRIu64" (%s)", - le64_to_cpu(fw_commit_event->new_fw_rev), - util_fw_to_string((char *)&fw_commit_event->new_fw_rev)); - json_object_add_value_string(valid_attrs, "new_fw_rev", fw_str); - json_object_add_value_uint(valid_attrs, "fw_commit_action", - fw_commit_event->fw_commit_action); - json_object_add_value_uint(valid_attrs, "fw_slot", - fw_commit_event->fw_slot); - json_object_add_value_uint(valid_attrs, "sct_fw", - fw_commit_event->sct_fw); - json_object_add_value_uint(valid_attrs, "sc_fw", - fw_commit_event->sc_fw); - json_object_add_value_uint(valid_attrs, - "vu_assign_fw_commit_rc", - le16_to_cpu(fw_commit_event->vndr_assign_fw_commit_rc)); + json_pel_fw_commit(pevent_log_info, offset, valid_attrs); break; case NVME_PEL_TIMESTAMP_EVENT: - ts_change_event = pevent_log_info + offset; - json_object_add_value_uint64(valid_attrs, "prev_ts", - le64_to_cpu(ts_change_event->previous_timestamp)); - json_object_add_value_uint64(valid_attrs, - "ml_secs_since_reset", - le64_to_cpu(ts_change_event->ml_secs_since_reset)); + json_pel_timestamp(pevent_log_info, offset, valid_attrs); break; case NVME_PEL_POWER_ON_RESET_EVENT: - por_info_len = (le16_to_cpu(pevent_entry_head->el) - - le16_to_cpu(pevent_entry_head->vsil) - sizeof(*fw_rev)); - - por_info_list = por_info_len / sizeof(*por_event); - - fw_rev = pevent_log_info + offset; - snprintf(fw_str, sizeof(fw_str), "%"PRIu64" (%s)", - le64_to_cpu(*fw_rev), - util_fw_to_string((char *)fw_rev)); - json_object_add_value_string(valid_attrs, "fw_rev", fw_str); - for (int i = 0; i < por_info_list; i++) { - por_event = pevent_log_info + offset + - sizeof(*fw_rev) + i * sizeof(*por_event); - json_object_add_value_uint(valid_attrs, "ctrl_id", - le16_to_cpu(por_event->cid)); - json_object_add_value_uint(valid_attrs, "fw_act", - por_event->fw_act); - json_object_add_value_uint(valid_attrs, "op_in_prog", - por_event->op_in_prog); - json_object_add_value_uint(valid_attrs, "ctrl_power_cycle", - le32_to_cpu(por_event->ctrl_power_cycle)); - json_object_add_value_uint64(valid_attrs, "power_on_ml_secs", - le64_to_cpu(por_event->power_on_ml_seconds)); - json_object_add_value_uint64(valid_attrs, "ctrl_time_stamp", - le64_to_cpu(por_event->ctrl_time_stamp)); - } + json_pel_power_on_reset(pevent_log_info, offset, valid_attrs, + pevent_entry_head->el, pevent_entry_head->vsil); break; case NVME_PEL_NSS_HW_ERROR_EVENT: - nss_hw_err_event = pevent_log_info + offset; - json_object_add_value_uint(valid_attrs, "nss_hw_err_code", - le16_to_cpu(nss_hw_err_event->nss_hw_err_event_code)); + json_pel_nss_hw_error(pevent_log_info, offset, valid_attrs); break; case NVME_PEL_CHANGE_NS_EVENT: - ns_event = pevent_log_info + offset; - json_object_add_value_uint(valid_attrs, "nsmgt_cdw10", - le32_to_cpu(ns_event->nsmgt_cdw10)); - json_object_add_value_uint64(valid_attrs, "nsze", - le64_to_cpu(ns_event->nsze)); - json_object_add_value_uint64(valid_attrs, "nscap", - le64_to_cpu(ns_event->nscap)); - json_object_add_value_uint(valid_attrs, "flbas", - ns_event->flbas); - json_object_add_value_uint(valid_attrs, "dps", - ns_event->dps); - json_object_add_value_uint(valid_attrs, "nmic", - ns_event->nmic); - json_object_add_value_uint(valid_attrs, "ana_grp_id", - le32_to_cpu(ns_event->ana_grp_id)); - json_object_add_value_uint(valid_attrs, "nvmset_id", - le16_to_cpu(ns_event->nvmset_id)); - json_object_add_value_uint(valid_attrs, "nsid", - le32_to_cpu(ns_event->nsid)); + json_pel_change_ns(pevent_log_info, offset, valid_attrs); break; case NVME_PEL_FORMAT_START_EVENT: - format_start_event = pevent_log_info + offset; - json_object_add_value_uint(valid_attrs, "nsid", - le32_to_cpu(format_start_event->nsid)); - json_object_add_value_uint(valid_attrs, "fna", - format_start_event->fna); - json_object_add_value_uint(valid_attrs, "format_nvm_cdw10", - le32_to_cpu(format_start_event->format_nvm_cdw10)); + json_pel_format_start(pevent_log_info, offset, valid_attrs); break; case NVME_PEL_FORMAT_COMPLETION_EVENT: - format_cmpln_event = pevent_log_info + offset; - json_object_add_value_uint(valid_attrs, "nsid", - le32_to_cpu(format_cmpln_event->nsid)); - json_object_add_value_uint(valid_attrs, "smallest_fpi", - format_cmpln_event->smallest_fpi); - json_object_add_value_uint(valid_attrs, "format_nvm_status", - format_cmpln_event->format_nvm_status); - json_object_add_value_uint(valid_attrs, "compln_info", - le16_to_cpu(format_cmpln_event->compln_info)); - json_object_add_value_uint(valid_attrs, "status_field", - le32_to_cpu(format_cmpln_event->status_field)); + json_pel_format_completion(pevent_log_info, offset, valid_attrs); break; case NVME_PEL_SANITIZE_START_EVENT: - sanitize_start_event = pevent_log_info + offset; - json_object_add_value_uint(valid_attrs, "SANICAP", - le32_to_cpu(sanitize_start_event->sani_cap)); - json_object_add_value_uint(valid_attrs, "sani_cdw10", - le32_to_cpu(sanitize_start_event->sani_cdw10)); - json_object_add_value_uint(valid_attrs, "sani_cdw11", - le32_to_cpu(sanitize_start_event->sani_cdw11)); + json_pel_sanitize_start(pevent_log_info, offset, valid_attrs); break; case NVME_PEL_SANITIZE_COMPLETION_EVENT: - sanitize_cmpln_event = pevent_log_info + offset; - json_object_add_value_uint(valid_attrs, "sani_prog", - le16_to_cpu(sanitize_cmpln_event->sani_prog)); - json_object_add_value_uint(valid_attrs, "sani_status", - le16_to_cpu(sanitize_cmpln_event->sani_status)); - json_object_add_value_uint(valid_attrs, "cmpln_info", - le16_to_cpu(sanitize_cmpln_event->cmpln_info)); + json_pel_sanitize_completion(pevent_log_info, offset, valid_attrs); break; case NVME_PEL_THERMAL_EXCURSION_EVENT: - thermal_exc_event = pevent_log_info + offset; - json_object_add_value_uint(valid_attrs, "over_temp", - thermal_exc_event->over_temp); - json_object_add_value_uint(valid_attrs, "threshold", - thermal_exc_event->threshold); + json_pel_thermal_excursion(pevent_log_info, offset, valid_attrs); + break; + default: break; } - json_array_add_value_object(valid, valid_attrs); + array_add_obj(valid, valid_attrs); offset += le16_to_cpu(pevent_entry_head->el); } - - json_object_add_value_array(root, "list_of_event_entries", valid); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); } +static void json_persistent_event_log(void *pevent_log_info, __u8 action, + __u32 size, const char *devname) +{ + struct json_object *r = json_create_object(); + struct json_object *valid = json_create_array(); + __u32 offset = sizeof(struct nvme_persistent_event_log); + + if (size >= offset) { + json_pevent_log_head(pevent_log_info, r); + json_pevent_entry(pevent_log_info, action, size, devname, offset, valid); + obj_add_array(r, "list_of_event_entries", valid); + } else { + obj_add_result(r, "No log data can be shown with this log len at least " \ + "512 bytes is required or can be 0 to read the complete "\ + "log page after context established"); + } + + json_print(r); +} static void json_endurance_group_event_agg_log( struct nvme_aggregate_predictable_lat_event *endurance_log, __u64 log_entries, __u32 size, const char *devname) { - struct json_object *root; + struct json_object *r = json_create_object(); struct json_object *valid_attrs; - struct json_object *valid; + struct json_object *valid = json_create_array(); - root = json_create_object(); - json_object_add_value_uint64(root, "num_entries_avail", - le64_to_cpu(endurance_log->num_entries)); - valid = json_create_array(); + obj_add_uint64(r, "num_entries_avail", le64_to_cpu(endurance_log->num_entries)); for (int i = 0; i < log_entries; i++) { valid_attrs = json_create_object(); - json_object_add_value_uint(valid_attrs, "entry", - le16_to_cpu(endurance_log->entries[i])); - json_array_add_value_object(valid, valid_attrs); + obj_add_uint(valid_attrs, "entry", le16_to_cpu(endurance_log->entries[i])); + array_add_obj(valid, valid_attrs); } - json_object_add_value_array(root, "list_of_entries", valid); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + + obj_add_array(r, "list_of_entries", valid); + + json_print(r); } +static void json_lba_status(struct nvme_lba_status *list, + unsigned long len) +{ + struct json_object *r = json_create_object(); + int idx; + struct nvme_lba_status_desc *e; + struct json_object *lsde; + char json_str[STR_LEN]; + + obj_add_uint(r, "Number of LBA Status Descriptors (NLSD)", le32_to_cpu(list->nlsd)); + obj_add_uint(r, "Completion Condition (CMPC)", list->cmpc); + + switch (list->cmpc) { + case 1: + obj_add_str(r, "cmpc-definition", + "Completed due to transferring the amount of data specified in the MNDW field"); + break; + case 2: + obj_add_str(r, "cmpc-definition", + "Completed due to having performed the action specified in the Action Type field over the number of logical blocks specified in the Range Length field"); + break; + default: + break; + } -static void json_lba_status_log(void *lba_status, __u32 size, - const char *devname) + for (idx = 0; idx < list->nlsd; idx++) { + lsde = json_create_array(); + sprintf(json_str, "LSD entry %d", idx); + obj_add_array(r, json_str, lsde); + e = &list->descs[idx]; + sprintf(json_str, "0x%016"PRIu64"", le64_to_cpu(e->dslba)); + obj_add_str(lsde, "DSLBA", json_str); + sprintf(json_str, "0x%08x", le32_to_cpu(e->nlb)); + obj_add_str(lsde, "NLB", json_str); + sprintf(json_str, "0x%02x", e->status); + obj_add_str(lsde, "status", json_str); + } + + json_print(r); +} + +static void json_lba_status_log(void *lba_status, __u32 size, const char *devname) { - struct json_object *root; + struct json_object *r = json_create_object(); struct json_object *desc; struct json_object *element; struct json_object *desc_list; - struct json_object *elements_list; - struct nvme_lba_status_log *hdr; + struct json_object *elements_list = json_create_array(); + struct nvme_lba_status_log *hdr = lba_status; struct nvme_lbas_ns_element *ns_element; struct nvme_lba_rd *range_desc; int offset = sizeof(*hdr); - __u32 num_lba_desc, num_elements; - - root = json_create_object(); - hdr = lba_status; - json_object_add_value_uint(root, "lslplen", le32_to_cpu(hdr->lslplen)); - num_elements = le32_to_cpu(hdr->nlslne); - json_object_add_value_uint(root, "nlslne", num_elements); - json_object_add_value_uint(root, "estulb", le32_to_cpu(hdr->estulb)); - json_object_add_value_uint(root, "lsgc", le16_to_cpu(hdr->lsgc)); - - elements_list = json_create_array(); - for (int ele = 0; ele < num_elements; ele++) { + __u32 num_lba_desc; + __u32 num_elements = le32_to_cpu(hdr->nlslne); + int ele; + int i; + + obj_add_uint(r, "lslplen", le32_to_cpu(hdr->lslplen)); + obj_add_uint(r, "nlslne", num_elements); + obj_add_uint(r, "estulb", le32_to_cpu(hdr->estulb)); + obj_add_uint(r, "lsgc", le16_to_cpu(hdr->lsgc)); + + for (ele = 0; ele < num_elements; ele++) { ns_element = lba_status + offset; element = json_create_object(); - json_object_add_value_uint(element, "neid", - le32_to_cpu(ns_element->neid)); + obj_add_uint(element, "neid", le32_to_cpu(ns_element->neid)); num_lba_desc = le32_to_cpu(ns_element->nlrd); - json_object_add_value_uint(element, "nlrd", num_lba_desc); - json_object_add_value_uint(element, "ratype", ns_element->ratype); + obj_add_uint(element, "nlrd", num_lba_desc); + obj_add_uint(element, "ratype", ns_element->ratype); offset += sizeof(*ns_element); desc_list = json_create_array(); + if (num_lba_desc != 0xffffffff) { - for (int i = 0; i < num_lba_desc; i++) { + for (i = 0; i < num_lba_desc; i++) { range_desc = lba_status + offset; desc = json_create_object(); - json_object_add_value_uint64(desc, "rslba", - le64_to_cpu(range_desc->rslba)); - json_object_add_value_uint(desc, "rnlb", - le32_to_cpu(range_desc->rnlb)); + obj_add_uint64(desc, "rslba", le64_to_cpu(range_desc->rslba)); + obj_add_uint(desc, "rnlb", le32_to_cpu(range_desc->rnlb)); offset += sizeof(*range_desc); - json_array_add_value_object(desc_list, desc); + array_add_obj(desc_list, desc); } } else { - printf("Number of LBA Range Descriptors (NLRD) set to %#x for " \ - "NS element %d", num_lba_desc, ele); + obj_add_result(r, "Number of LBA Range Descriptors (NLRD) set to %#x for NS element %d", + num_lba_desc, ele); } - json_object_add_value_array(element, "descs", desc_list); - json_array_add_value_object(elements_list, element); + obj_add_array(element, "descs", desc_list); + array_add_obj(elements_list, element); } - json_object_add_value_array(root, "ns_elements", elements_list); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); -} + obj_add_array(r, "ns_elements", elements_list); + json_print(r); +} static void json_resv_notif_log(struct nvme_resv_notification_log *resv, const char *devname) { - struct json_object *root; + struct json_object *r = json_create_object(); - root = json_create_object(); - json_object_add_value_uint64(root, "count", - le64_to_cpu(resv->lpc)); - json_object_add_value_uint(root, "rn_log_type", - resv->rnlpt); - json_object_add_value_uint(root, "num_logs", - resv->nalp); - json_object_add_value_uint(root, "nsid", - le32_to_cpu(resv->nsid)); + obj_add_uint64(r, "count", le64_to_cpu(resv->lpc)); + obj_add_uint(r, "rn_log_type", resv->rnlpt); + obj_add_uint(r, "num_logs", resv->nalp); + obj_add_uint(r, "NSID", le32_to_cpu(resv->nsid)); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + json_print(r); } - static void json_fid_support_effects_log( struct nvme_fid_supported_effects_log *fid_log, const char *devname) { - struct json_object *root; + struct json_object *r = json_create_object(); struct json_object *fids; - struct json_object *fids_list; + struct json_object *fids_list = json_create_array(); unsigned int fid; char key[128]; __u32 fid_support; - root = json_create_object(); - fids_list = json_create_array(); - for (fid = 0; fid < 256; fid++) { + for (fid = 0; fid < NVME_LOG_FID_SUPPORTED_EFFECTS_MAX; fid++) { fid_support = le32_to_cpu(fid_log->fid_support[fid]); if (fid_support & NVME_FID_SUPPORTED_EFFECTS_FSUPP) { fids = json_create_object(); sprintf(key, "fid_%u", fid); - json_object_add_value_uint(fids, key, fid_support); - json_array_add_value_object(fids_list, fids); + obj_add_uint(fids, key, fid_support); + array_add_obj(fids_list, fids); } } - json_object_add_value_object(root, "fid_support", fids_list); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); -} + obj_add_obj(r, "fid_support", fids_list); + json_print(r); +} static void json_mi_cmd_support_effects_log( struct nvme_mi_cmd_supported_effects_log *mi_cmd_log, const char *devname) { - struct json_object *root; + struct json_object *r = json_create_object(); struct json_object *mi_cmds; - struct json_object *mi_cmds_list; + struct json_object *mi_cmds_list = json_create_array(); unsigned int mi_cmd; char key[128]; __u32 mi_cmd_support; - root = json_create_object(); - mi_cmds_list = json_create_array(); - for (mi_cmd = 0; mi_cmd < 256; mi_cmd++) { + for (mi_cmd = 0; mi_cmd < NVME_LOG_MI_CMD_SUPPORTED_EFFECTS_MAX; mi_cmd++) { mi_cmd_support = le32_to_cpu(mi_cmd_log->mi_cmd_support[mi_cmd]); if (mi_cmd_support & NVME_MI_CMD_SUPPORTED_EFFECTS_CSUPP) { mi_cmds = json_create_object(); sprintf(key, "mi_cmd_%u", mi_cmd); - json_object_add_value_uint(mi_cmds, key, mi_cmd_support); - json_array_add_value_object(mi_cmds_list, mi_cmds); + obj_add_uint(mi_cmds, key, mi_cmd_support); + array_add_obj(mi_cmds_list, mi_cmds); } } - json_object_add_value_object(root, "mi_command_support", mi_cmds_list); - json_print_object(root, NULL); - printf("\n"); + obj_add_obj(r, "mi_command_support", mi_cmds_list); - json_free_object(root); + json_print(r); } - static void json_boot_part_log(void *bp_log, const char *devname, __u32 size) { - struct nvme_boot_partition *hdr; - struct json_object *root; + struct nvme_boot_partition *hdr = bp_log; + struct json_object *r = json_create_object(); - hdr = bp_log; - root = json_create_object(); + obj_add_uint(r, "count", hdr->lid); + obj_add_uint(r, "abpid", (le32_to_cpu(hdr->bpinfo) >> 31) & 0x1); + obj_add_uint(r, "bpsz", le32_to_cpu(hdr->bpinfo) & 0x7fff); - json_object_add_value_uint(root, "count", hdr->lid); - json_object_add_value_uint(root, "abpid", - (le32_to_cpu(hdr->bpinfo) >> 31) & 0x1); - json_object_add_value_uint(root, "bpsz", - le32_to_cpu(hdr->bpinfo) & 0x7fff); + json_print(r); +} - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); +/* Printable Eye string is allocated and returned, caller must free */ +static char *json_eom_printable_eye(struct nvme_eom_lane_desc *lane, + struct json_object *r) +{ + char *eye = (char *)lane->eye_desc; + char *printable = malloc(lane->nrows * lane->ncols + lane->ncols); + char *printable_start = printable; + int i, j; + + if (!printable) + goto exit; + + for (i = 0; i < lane->nrows; i++) { + for (j = 0; j < lane->ncols; j++, printable++) + sprintf(printable, "%c", eye[i * lane->ncols + j]); + sprintf(printable++, "\n"); + } + + obj_add_str(r, "printable_eye", printable_start); + +exit: + return printable_start; } -static void json_media_unit_stat_log(struct nvme_media_unit_stat_log *mus) +static void json_phy_rx_eom_descs(struct nvme_phy_rx_eom_log *log, + struct json_object *r, char **allocated_eyes) { + void *p = log->descs; + uint16_t num_descs = le16_to_cpu(log->nd); + int i; + struct json_object *descs = json_create_array(); - struct json_object *root; - struct json_object *entries; - struct json_object *entry; + obj_add_array(r, "descs", descs); + + for (i = 0; i < num_descs; i++) { + struct nvme_eom_lane_desc *desc = p; + struct json_object *jdesc = json_create_object(); + + obj_add_uint(jdesc, "lid", desc->mstatus); + obj_add_uint(jdesc, "lane", desc->lane); + obj_add_uint(jdesc, "eye", desc->eye); + obj_add_uint(jdesc, "top", le16_to_cpu(desc->top)); + obj_add_uint(jdesc, "bottom", le16_to_cpu(desc->bottom)); + obj_add_uint(jdesc, "left", le16_to_cpu(desc->left)); + obj_add_uint(jdesc, "right", le16_to_cpu(desc->right)); + obj_add_uint(jdesc, "nrows", le16_to_cpu(desc->nrows)); + obj_add_uint(jdesc, "ncols", le16_to_cpu(desc->ncols)); + obj_add_uint(jdesc, "edlen", le16_to_cpu(desc->edlen)); + + if (log->odp & NVME_EOM_PRINTABLE_EYE_PRESENT) + allocated_eyes[i] = json_eom_printable_eye(desc, r); + + /* Eye Data field is vendor specific, doesn't map to JSON */ + + array_add_obj(descs, jdesc); + + p += log->dsize; + } +} + +static void json_phy_rx_eom_log(struct nvme_phy_rx_eom_log *log, __u16 controller) +{ + char **allocated_eyes = NULL; int i; + struct json_object *r = json_create_object(); + + obj_add_uint(r, "lid", log->lid); + obj_add_uint(r, "eomip", log->eomip); + obj_add_uint(r, "hsize", le16_to_cpu(log->hsize)); + obj_add_uint(r, "rsize", le32_to_cpu(log->rsize)); + obj_add_uint(r, "eomdgn", log->eomdgn); + obj_add_uint(r, "lr", log->lr); + obj_add_uint(r, "lanes", log->lanes); + obj_add_uint(r, "epl", log->epl); + obj_add_uint(r, "lspfc", log->lspfc); + obj_add_uint(r, "li", log->li); + obj_add_uint(r, "lsic", le16_to_cpu(log->lsic)); + obj_add_uint(r, "dsize", le32_to_cpu(log->dsize)); + obj_add_uint(r, "nd", le16_to_cpu(log->nd)); + obj_add_uint(r, "maxtb", le16_to_cpu(log->maxtb)); + obj_add_uint(r, "maxlr", le16_to_cpu(log->maxlr)); + obj_add_uint(r, "etgood", le16_to_cpu(log->etgood)); + obj_add_uint(r, "etbetter", le16_to_cpu(log->etbetter)); + obj_add_uint(r, "etbest", le16_to_cpu(log->etbest)); + + if (log->eomip == NVME_PHY_RX_EOM_COMPLETED) { + /* Save Printable Eye strings allocated to free later */ + allocated_eyes = malloc(log->nd * sizeof(char *)); + if (allocated_eyes) + json_phy_rx_eom_descs(log, r, allocated_eyes); + } - root = json_create_object(); - entries = json_create_array(); + if (allocated_eyes) { + for (i = 0; i < log->nd; i++) { + /* Free any Printable Eye strings allocated */ + if (allocated_eyes[i]) + free(allocated_eyes[i]); + } + free(allocated_eyes); + } - json_object_add_value_uint(root, "nmu", le16_to_cpu(mus->nmu)); - json_object_add_value_uint(root, "cchans", le16_to_cpu(mus->cchans)); - json_object_add_value_uint(root, "sel_config", le16_to_cpu(mus->sel_config)); + json_print(r); +} + +static void json_media_unit_stat_log(struct nvme_media_unit_stat_log *mus) +{ + struct json_object *r = json_create_object(); + struct json_object *entries = json_create_array(); + struct json_object *entry; + int i; + + obj_add_uint(r, "nmu", le16_to_cpu(mus->nmu)); + obj_add_uint(r, "cchans", le16_to_cpu(mus->cchans)); + obj_add_uint(r, "sel_config", le16_to_cpu(mus->sel_config)); for (i = 0; i < mus->nmu; i++) { entry = json_create_object(); - json_object_add_value_uint(entry, "muid", le16_to_cpu(mus->mus_desc[i].muid)); - json_object_add_value_uint(entry, "domainid", le16_to_cpu(mus->mus_desc[i].domainid)); - json_object_add_value_uint(entry, "endgid", le16_to_cpu(mus->mus_desc[i].endgid)); - json_object_add_value_uint(entry, "nvmsetid", le16_to_cpu(mus->mus_desc[i].nvmsetid)); - json_object_add_value_uint(entry, "cap_adj_fctr", le16_to_cpu(mus->mus_desc[i].cap_adj_fctr)); - json_object_add_value_uint(entry, "avl_spare", mus->mus_desc[i].avl_spare); - json_object_add_value_uint(entry, "percent_used", mus->mus_desc[i].percent_used); - json_object_add_value_uint(entry, "mucs", mus->mus_desc[i].mucs); - json_object_add_value_uint(entry, "cio", mus->mus_desc[i].cio); - json_array_add_value_object(entries, entry); - } - - json_object_add_value_array(root, "mus_list", entries); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); -} + obj_add_uint(entry, "muid", le16_to_cpu(mus->mus_desc[i].muid)); + obj_add_uint(entry, "domainid", le16_to_cpu(mus->mus_desc[i].domainid)); + obj_add_uint(entry, "endgid", le16_to_cpu(mus->mus_desc[i].endgid)); + obj_add_uint(entry, "nvmsetid", le16_to_cpu(mus->mus_desc[i].nvmsetid)); + obj_add_uint(entry, "cap_adj_fctr", le16_to_cpu(mus->mus_desc[i].cap_adj_fctr)); + obj_add_uint(entry, "avl_spare", mus->mus_desc[i].avl_spare); + obj_add_uint(entry, "percent_used", mus->mus_desc[i].percent_used); + obj_add_uint(entry, "mucs", mus->mus_desc[i].mucs); + obj_add_uint(entry, "cio", mus->mus_desc[i].cio); + array_add_obj(entries, entry); + } + obj_add_array(r, "mus_list", entries); + + json_print(r); +} static void json_supported_cap_config_log( struct nvme_supported_cap_config_list_log *cap_log) { - struct json_object *root; - struct json_object *cap_list; + struct json_object *r = json_create_object(); + struct json_object *cap_list = json_create_array(); struct json_object *capacity; struct json_object *end_list; struct json_object *set_list; @@ -1464,96 +2097,89 @@ static void json_supported_cap_config_log( struct json_object *media; struct json_object *endurance; struct nvme_end_grp_chan_desc *chan_desc; - int i, j, k, l, m, sccn, egcn, egsets, egchans, chmus; + int i, j, k, l, m, egcn, egsets, egchans, chmus; + int sccn = cap_log->sccn; - root = json_create_object(); - - json_object_add_value_uint(root, "sccn", cap_log->sccn); - cap_list = json_create_array(); - sccn = cap_log->sccn; + obj_add_uint(r, "sccn", cap_log->sccn); for (i = 0; i < sccn; i++) { capacity = json_create_object(); - json_object_add_value_uint(capacity, "cap_config_id", - le16_to_cpu(cap_log->cap_config_desc[i].cap_config_id)); - json_object_add_value_uint(capacity, "domainid", - le16_to_cpu(cap_log->cap_config_desc[i].domainid)); - json_object_add_value_uint(capacity, "egcn", - le16_to_cpu(cap_log->cap_config_desc[i].egcn)); + obj_add_uint(capacity, "cap_config_id", + le16_to_cpu(cap_log->cap_config_desc[i].cap_config_id)); + obj_add_uint(capacity, "domainid", + le16_to_cpu(cap_log->cap_config_desc[i].domainid)); + obj_add_uint(capacity, "egcn", le16_to_cpu(cap_log->cap_config_desc[i].egcn)); end_list = json_create_array(); egcn = le16_to_cpu(cap_log->cap_config_desc[i].egcn); for (j = 0; j < egcn; j++) { endurance = json_create_object(); - json_object_add_value_uint(endurance, "endgid", - le16_to_cpu(cap_log->cap_config_desc[i].egcd[j].endgid)); - json_object_add_value_uint(endurance, "cap_adj_factor", - le16_to_cpu(cap_log->cap_config_desc[i].egcd[j].cap_adj_factor)); - json_object_add_value_uint128(endurance, "tegcap", - le128_to_cpu(cap_log->cap_config_desc[i].egcd[j].tegcap)); - json_object_add_value_uint128(endurance, "segcap", - le128_to_cpu(cap_log->cap_config_desc[i].egcd[j].segcap)); - json_object_add_value_uint(endurance, "egsets", - le16_to_cpu(cap_log->cap_config_desc[i].egcd[j].egsets)); + obj_add_uint(endurance, "endgid", + le16_to_cpu(cap_log->cap_config_desc[i].egcd[j].endgid)); + obj_add_uint(endurance, "cap_adj_factor", + le16_to_cpu(cap_log->cap_config_desc[i].egcd[j].cap_adj_factor)); + obj_add_uint128(endurance, "tegcap", + le128_to_cpu(cap_log->cap_config_desc[i].egcd[j].tegcap)); + obj_add_uint128(endurance, "segcap", + le128_to_cpu(cap_log->cap_config_desc[i].egcd[j].segcap)); + obj_add_uint(endurance, "egsets", + le16_to_cpu(cap_log->cap_config_desc[i].egcd[j].egsets)); egsets = le16_to_cpu(cap_log->cap_config_desc[i].egcd[j].egsets); set_list = json_create_array(); for (k = 0; k < egsets; k++) { set = json_create_object(); - json_object_add_value_uint(set, "nvmsetid", - le16_to_cpu(cap_log->cap_config_desc[i].egcd[j].nvmsetid[k])); - json_array_add_value_object(set_list, set); + obj_add_uint(set, "nvmsetid", + le16_to_cpu(cap_log->cap_config_desc[i].egcd[j].nvmsetid[k])); + array_add_obj(set_list, set); } - chan_desc = (struct nvme_end_grp_chan_desc *) \ - ((cap_log->cap_config_desc[i].egcd[j].nvmsetid[0]) * (sizeof(__u16)*egsets)); + chan_desc = (struct nvme_end_grp_chan_desc *) + (cap_log->cap_config_desc[i].egcd[j].nvmsetid[0] * sizeof(__u16) * egsets); egchans = le16_to_cpu(chan_desc->egchans); - json_object_add_value_uint(endurance, "egchans", - le16_to_cpu(chan_desc->egchans)); + obj_add_uint(endurance, "egchans", le16_to_cpu(chan_desc->egchans)); chan_list = json_create_array(); for (l = 0; l < egchans; l++) { channel = json_create_object(); - json_object_add_value_uint(channel, "chanid", - le16_to_cpu(chan_desc->chan_config_desc[l].chanid)); - json_object_add_value_uint(channel, "chmus", - le16_to_cpu(chan_desc->chan_config_desc[l].chmus)); + obj_add_uint(channel, "chanid", + le16_to_cpu(chan_desc->chan_config_desc[l].chanid)); + obj_add_uint(channel, "chmus", + le16_to_cpu(chan_desc->chan_config_desc[l].chmus)); chmus = le16_to_cpu(chan_desc->chan_config_desc[l].chmus); media_list = json_create_array(); for (m = 0; m < chmus; m++) { media = json_create_object(); - json_object_add_value_uint(media, "chanid", - le16_to_cpu(chan_desc->chan_config_desc[l].mu_config_desc[m].muid)); - json_object_add_value_uint(media, "chmus", - le16_to_cpu(chan_desc->chan_config_desc[l].mu_config_desc[m].mudl)); - json_array_add_value_object(media_list, media); + obj_add_uint(media, "chanid", + le16_to_cpu(chan_desc->chan_config_desc[l].mu_config_desc[m].muid)); + obj_add_uint(media, "chmus", + le16_to_cpu(chan_desc->chan_config_desc[l].mu_config_desc[m].mudl)); + array_add_obj(media_list, media); } - json_object_add_value_array(channel, "Media Descriptor", media_list); - json_array_add_value_object(chan_list, channel); + obj_add_array(channel, "Media Descriptor", media_list); + array_add_obj(chan_list, channel); } - json_object_add_value_array(endurance, "Channel Descriptor", chan_list); - json_object_add_value_array(endurance, "NVM Set IDs", set_list); - json_array_add_value_object(end_list, endurance); + obj_add_array(endurance, "Channel Descriptor", chan_list); + obj_add_array(endurance, "NVM Set IDs", set_list); + array_add_obj(end_list, endurance); } - json_object_add_value_array(capacity, "Endurance Descriptor", end_list); - json_array_add_value_object(cap_list, capacity); + obj_add_array(capacity, "Endurance Descriptor", end_list); + array_add_obj(cap_list, capacity); } - json_object_add_value_array(root, "Capacity Descriptor", cap_list); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); -} + obj_add_array(r, "Capacity Descriptor", cap_list); + json_print(r); +} static void json_nvme_fdp_configs(struct nvme_fdp_config_log *log, size_t len) { - struct json_object *root, *obj_configs; + struct json_object *r, *obj_configs; uint16_t n; void *p = log->configs; - root = json_create_object(); + r = json_create_object(); obj_configs = json_create_array(); n = le16_to_cpu(log->n); - json_object_add_value_uint(root, "n", n); + obj_add_uint(r, "n", n); for (int i = 0; i < n + 1; i++) { struct nvme_fdp_config_desc *config = p; @@ -1561,163 +2187,144 @@ static void json_nvme_fdp_configs(struct nvme_fdp_config_log *log, size_t len) struct json_object *obj_config = json_create_object(); struct json_object *obj_ruhs = json_create_array(); - json_object_add_value_uint(obj_config, "fdpa", config->fdpa); - json_object_add_value_uint(obj_config, "vss", config->vss); - json_object_add_value_uint(obj_config, "nrg", le32_to_cpu(config->nrg)); - json_object_add_value_uint(obj_config, "nruh", le16_to_cpu(config->nruh)); - json_object_add_value_uint(obj_config, "nnss", le32_to_cpu(config->nnss)); - json_object_add_value_uint64(obj_config, "runs", le64_to_cpu(config->runs)); - json_object_add_value_uint(obj_config, "erutl", le32_to_cpu(config->erutl)); + obj_add_uint(obj_config, "fdpa", config->fdpa); + obj_add_uint(obj_config, "vss", config->vss); + obj_add_uint(obj_config, "nrg", le32_to_cpu(config->nrg)); + obj_add_uint(obj_config, "nruh", le16_to_cpu(config->nruh)); + obj_add_uint(obj_config, "nnss", le32_to_cpu(config->nnss)); + obj_add_uint64(obj_config, "runs", le64_to_cpu(config->runs)); + obj_add_uint(obj_config, "erutl", le32_to_cpu(config->erutl)); for (int j = 0; j < le16_to_cpu(config->nruh); j++) { struct nvme_fdp_ruh_desc *ruh = &config->ruhs[j]; struct json_object *obj_ruh = json_create_object(); - json_object_add_value_uint(obj_ruh, "ruht", ruh->ruht); + obj_add_uint(obj_ruh, "ruht", ruh->ruht); - json_array_add_value_object(obj_ruhs, obj_ruh); + array_add_obj(obj_ruhs, obj_ruh); } - json_array_add_value_object(obj_configs, obj_config); + array_add_obj(obj_configs, obj_config); p += config->size; } - json_object_add_value_array(root, "configs", obj_configs); + obj_add_array(r, "configs", obj_configs); - json_print_object(root, NULL); - printf("\n"); - - json_free_object(root); + json_print(r); } - static void json_nvme_fdp_usage(struct nvme_fdp_ruhu_log *log, size_t len) { - struct json_object *root, *obj_ruhus; + struct json_object *r, *obj_ruhus; uint16_t nruh; - root = json_create_object(); + r = json_create_object(); obj_ruhus = json_create_array(); nruh = le16_to_cpu(log->nruh); - json_object_add_value_uint(root, "nruh", nruh); + obj_add_uint(r, "nruh", nruh); for (int i = 0; i < nruh; i++) { struct nvme_fdp_ruhu_desc *ruhu = &log->ruhus[i]; struct json_object *obj_ruhu = json_create_object(); - json_object_add_value_uint(obj_ruhu, "ruha", ruhu->ruha); + obj_add_uint(obj_ruhu, "ruha", ruhu->ruha); - json_array_add_value_object(obj_ruhus, obj_ruhu); + array_add_obj(obj_ruhus, obj_ruhu); } - json_object_add_value_array(root, "ruhus", obj_ruhus); - - json_print_object(root, NULL); - printf("\n"); + obj_add_array(r, "ruhus", obj_ruhus); - json_free_object(root); + json_print(r); } - static void json_nvme_fdp_stats(struct nvme_fdp_stats_log *log) { - struct json_object *root = json_create_object(); - - json_object_add_value_uint128(root, "hbmw", le128_to_cpu(log->hbmw)); - json_object_add_value_uint128(root, "mbmw", le128_to_cpu(log->mbmw)); - json_object_add_value_uint128(root, "mbe", le128_to_cpu(log->mbe)); + struct json_object *r = json_create_object(); - json_print_object(root, NULL); - printf("\n"); + obj_add_uint128(r, "hbmw", le128_to_cpu(log->hbmw)); + obj_add_uint128(r, "mbmw", le128_to_cpu(log->mbmw)); + obj_add_uint128(r, "mbe", le128_to_cpu(log->mbe)); - json_free_object(root); + json_print(r); } - static void json_nvme_fdp_events(struct nvme_fdp_events_log *log) { - struct json_object *root, *obj_events; + struct json_object *r, *obj_events; uint32_t n; - root = json_create_object(); + r = json_create_object(); obj_events = json_create_array(); n = le32_to_cpu(log->n); - json_object_add_value_uint(root, "n", n); + obj_add_uint(r, "n", n); for (unsigned int i = 0; i < n; i++) { struct nvme_fdp_event *event = &log->events[i]; struct json_object *obj_event = json_create_object(); - json_object_add_value_uint(obj_event, "type", event->type); - json_object_add_value_uint(obj_event, "fdpef", event->flags); - json_object_add_value_uint(obj_event, "pid", le16_to_cpu(event->pid)); - json_object_add_value_uint64(obj_event, "timestamp", le64_to_cpu(*(uint64_t *)&event->ts)); - json_object_add_value_uint(obj_event, "nsid", le32_to_cpu(event->nsid)); + obj_add_uint(obj_event, "type", event->type); + obj_add_uint(obj_event, "fdpef", event->flags); + obj_add_uint(obj_event, "pid", le16_to_cpu(event->pid)); + obj_add_uint64(obj_event, "timestamp", le64_to_cpu(*(uint64_t *)&event->ts)); + obj_add_uint(obj_event, "nsid", le32_to_cpu(event->nsid)); if (event->type == NVME_FDP_EVENT_REALLOC) { struct nvme_fdp_event_realloc *mr; mr = (struct nvme_fdp_event_realloc *)&event->type_specific; - json_object_add_value_uint(obj_event, "nlbam", le16_to_cpu(mr->nlbam)); + obj_add_uint(obj_event, "nlbam", le16_to_cpu(mr->nlbam)); if (mr->flags & NVME_FDP_EVENT_REALLOC_F_LBAV) - json_object_add_value_uint64(obj_event, "lba", le64_to_cpu(mr->lba)); + obj_add_uint64(obj_event, "lba", le64_to_cpu(mr->lba)); } - json_array_add_value_object(obj_events, obj_event); + array_add_obj(obj_events, obj_event); } - json_object_add_value_array(root, "events", obj_events); + obj_add_array(r, "events", obj_events); - json_print_object(root, NULL); - printf("\n"); - - json_free_object(root); + json_print(r); } static void json_nvme_fdp_ruh_status(struct nvme_fdp_ruh_status *status, size_t len) { - struct json_object *root, *obj_ruhss; + struct json_object *r, *obj_ruhss; uint16_t nruhsd; - root = json_create_object(); + r = json_create_object(); obj_ruhss = json_create_array(); nruhsd = le16_to_cpu(status->nruhsd); - json_object_add_value_uint(root, "nruhsd", nruhsd); + obj_add_uint(r, "nruhsd", nruhsd); for (unsigned int i = 0; i < nruhsd; i++) { struct nvme_fdp_ruh_status_desc *ruhs = &status->ruhss[i]; struct json_object *obj_ruhs = json_create_object(); - json_object_add_value_uint(obj_ruhs, "pid", le16_to_cpu(ruhs->pid)); - json_object_add_value_uint(obj_ruhs, "ruhid", le16_to_cpu(ruhs->ruhid)); - json_object_add_value_uint(obj_ruhs, "earutr", le32_to_cpu(ruhs->earutr)); - json_object_add_value_uint64(obj_ruhs, "ruamw", le64_to_cpu(ruhs->ruamw)); + obj_add_uint(obj_ruhs, "pid", le16_to_cpu(ruhs->pid)); + obj_add_uint(obj_ruhs, "ruhid", le16_to_cpu(ruhs->ruhid)); + obj_add_uint(obj_ruhs, "earutr", le32_to_cpu(ruhs->earutr)); + obj_add_uint64(obj_ruhs, "ruamw", le64_to_cpu(ruhs->ruamw)); - json_array_add_value_object(obj_ruhss, obj_ruhs); + array_add_obj(obj_ruhss, obj_ruhs); } - json_object_add_value_array(root, "ruhss", obj_ruhss); - - json_print_object(root, NULL); - printf("\n"); + obj_add_array(r, "ruhss", obj_ruhss); - json_free_object(root); + json_print(r); } -static unsigned int json_print_nvme_subsystem_multipath(nvme_subsystem_t s, - json_object *paths) +static unsigned int json_print_nvme_subsystem_multipath(nvme_subsystem_t s, json_object *paths) { nvme_ns_t n; nvme_path_t p; @@ -1732,17 +2339,12 @@ static unsigned int json_print_nvme_subsystem_multipath(nvme_subsystem_t s, nvme_ctrl_t c = nvme_path_get_ctrl(p); path_attrs = json_create_object(); - json_object_add_value_string(path_attrs, "Name", - nvme_ctrl_get_name(c)); - json_object_add_value_string(path_attrs, "Transport", - nvme_ctrl_get_transport(c)); - json_object_add_value_string(path_attrs, "Address", - nvme_ctrl_get_address(c)); - json_object_add_value_string(path_attrs, "State", - nvme_ctrl_get_state(c)); - json_object_add_value_string(path_attrs, "ANAState", - nvme_path_get_ana_state(p)); - json_array_add_value_object(paths, path_attrs); + obj_add_str(path_attrs, "Name", nvme_ctrl_get_name(c)); + obj_add_str(path_attrs, "Transport", nvme_ctrl_get_transport(c)); + obj_add_str(path_attrs, "Address", nvme_ctrl_get_address(c)); + obj_add_str(path_attrs, "State", nvme_ctrl_get_state(c)); + obj_add_str(path_attrs, "ANAState", nvme_path_get_ana_state(p)); + array_add_obj(paths, path_attrs); i++; } @@ -1758,188 +2360,366 @@ static void json_print_nvme_subsystem_ctrls(nvme_subsystem_t s, struct json_object *path_attrs; path_attrs = json_create_object(); - json_object_add_value_string(path_attrs, "Name", - nvme_ctrl_get_name(c)); - json_object_add_value_string(path_attrs, "Transport", - nvme_ctrl_get_transport(c)); - json_object_add_value_string(path_attrs, "Address", - nvme_ctrl_get_address(c)); - json_object_add_value_string(path_attrs, "State", - nvme_ctrl_get_state(c)); - json_array_add_value_object(paths, path_attrs); + obj_add_str(path_attrs, "Name", nvme_ctrl_get_name(c)); + obj_add_str(path_attrs, "Transport", nvme_ctrl_get_transport(c)); + obj_add_str(path_attrs, "Address", nvme_ctrl_get_address(c)); + obj_add_str(path_attrs, "State", nvme_ctrl_get_state(c)); + array_add_obj(paths, path_attrs); } } static void json_print_nvme_subsystem_list(nvme_root_t r, bool show_ana) - { struct json_object *host_attrs, *subsystem_attrs; struct json_object *subsystems, *paths; - struct json_object *root; + struct json_object *a = json_create_array(); nvme_host_t h; - root = json_create_array(); - nvme_for_each_host(r, h) { nvme_subsystem_t s; const char *hostid; host_attrs = json_create_object(); - json_object_add_value_string(host_attrs, "HostNQN", - nvme_host_get_hostnqn(h)); + obj_add_str(host_attrs, "HostNQN", nvme_host_get_hostnqn(h)); hostid = nvme_host_get_hostid(h); if (hostid) - json_object_add_value_string(host_attrs, "HostID", hostid); + obj_add_str(host_attrs, "HostID", hostid); subsystems = json_create_array(); nvme_for_each_subsystem(h, s) { subsystem_attrs = json_create_object(); - json_object_add_value_string(subsystem_attrs, "Name", - nvme_subsystem_get_name(s)); - json_object_add_value_string(subsystem_attrs, "NQN", - nvme_subsystem_get_nqn(s)); + obj_add_str(subsystem_attrs, "Name", nvme_subsystem_get_name(s)); + obj_add_str(subsystem_attrs, "NQN", nvme_subsystem_get_nqn(s)); + obj_add_str(subsystem_attrs, "IOPolicy", nvme_subsystem_get_iopolicy(s)); - json_array_add_value_object(subsystems, subsystem_attrs); + array_add_obj(subsystems, subsystem_attrs); paths = json_create_array(); if (!show_ana || !json_print_nvme_subsystem_multipath(s, paths)) json_print_nvme_subsystem_ctrls(s, paths); - json_object_add_value_array(subsystem_attrs, "Paths", - paths); + obj_add_array(subsystem_attrs, "Paths", paths); } - json_object_add_value_array(host_attrs, "Subsystems", subsystems); - json_array_add_value_object(root, host_attrs); + obj_add_array(host_attrs, "Subsystems", subsystems); + array_add_obj(a, host_attrs); } - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + + json_print(a); } -static void json_ctrl_registers(void *bar, bool fabrics) +static void json_ctrl_registers_cap(void *bar, struct json_object *r) { - uint64_t cap, asq, acq, bpmbl, cmbmsc; - uint32_t vs, intms, intmc, cc, csts, nssr, crto, aqa, cmbsz, cmbloc, - bpinfo, bprsel, cmbsts, pmrcap, pmrctl, pmrsts, pmrebs, pmrswtp, - pmrmscl, pmrmscu; - struct json_object *root; - - cap = mmio_read64(bar + NVME_REG_CAP); - vs = mmio_read32(bar + NVME_REG_VS); - intms = mmio_read32(bar + NVME_REG_INTMS); - intmc = mmio_read32(bar + NVME_REG_INTMC); - cc = mmio_read32(bar + NVME_REG_CC); - csts = mmio_read32(bar + NVME_REG_CSTS); - nssr = mmio_read32(bar + NVME_REG_NSSR); - crto = mmio_read32(bar + NVME_REG_CRTO); - aqa = mmio_read32(bar + NVME_REG_AQA); - asq = mmio_read64(bar + NVME_REG_ASQ); - acq = mmio_read64(bar + NVME_REG_ACQ); - cmbloc = mmio_read32(bar + NVME_REG_CMBLOC); - cmbsz = mmio_read32(bar + NVME_REG_CMBSZ); - bpinfo = mmio_read32(bar + NVME_REG_BPINFO); - bprsel = mmio_read32(bar + NVME_REG_BPRSEL); - bpmbl = mmio_read64(bar + NVME_REG_BPMBL); - cmbmsc = mmio_read64(bar + NVME_REG_CMBMSC); - cmbsts = mmio_read32(bar + NVME_REG_CMBSTS); - pmrcap = mmio_read32(bar + NVME_REG_PMRCAP); - pmrctl = mmio_read32(bar + NVME_REG_PMRCTL); - pmrsts = mmio_read32(bar + NVME_REG_PMRSTS); - pmrebs = mmio_read32(bar + NVME_REG_PMREBS); - pmrswtp = mmio_read32(bar + NVME_REG_PMRSWTP); - pmrmscl = mmio_read32(bar + NVME_REG_PMRMSCL); - pmrmscu = mmio_read32(bar + NVME_REG_PMRMSCU); - - root = json_create_object(); - json_object_add_value_uint64(root, "cap", cap); - json_object_add_value_int(root, "vs", vs); - json_object_add_value_int(root, "intms", intms); - json_object_add_value_int(root, "intmc", intmc); - json_object_add_value_int(root, "cc", cc); - json_object_add_value_int(root, "csts", csts); - json_object_add_value_int(root, "nssr", nssr); - json_object_add_value_int(root, "crto", crto); - json_object_add_value_int(root, "aqa", aqa); - json_object_add_value_uint64(root, "asq", asq); - json_object_add_value_uint64(root, "acq", acq); - json_object_add_value_int(root, "cmbloc", cmbloc); - json_object_add_value_int(root, "cmbsz", cmbsz); - json_object_add_value_int(root, "bpinfo", bpinfo); - json_object_add_value_int(root, "bprsel", bprsel); - json_object_add_value_uint64(root, "bpmbl", bpmbl); - json_object_add_value_uint64(root, "cmbmsc", cmbmsc); - json_object_add_value_int(root, "cmbsts", cmbsts); - json_object_add_value_int(root, "pmrcap", pmrcap); - json_object_add_value_int(root, "pmrctl", pmrctl); - json_object_add_value_int(root, "pmrsts", pmrsts); - json_object_add_value_int(root, "pmrebs", pmrebs); - json_object_add_value_int(root, "pmrswtp", pmrswtp); - json_object_add_value_uint(root, "pmrmscl", pmrmscl); - json_object_add_value_uint(root, "pmrmscu", pmrmscu); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + uint64_t cap = mmio_read64(bar + NVME_REG_CAP); + + if (human()) + json_registers_cap((struct nvme_bar_cap *)&cap, obj_create_array_obj(r, "cap")); + else + obj_add_uint64(r, "cap", cap); } -static void d_json(unsigned char *buf, int len, int width, int group, - struct json_object *array) +static void json_ctrl_registers_vs(void *bar, struct json_object *r) { - int i, line_done = 0; - char ascii[32 + 1]; - assert(width < sizeof(ascii)); + uint32_t vs = mmio_read32(bar + NVME_REG_VS); - for (i = 0; i < len; i++) { - line_done = 0; - ascii[i % width] = (buf[i] >= '!' && buf[i] <= '~') ? buf[i] : '.'; - if (((i + 1) % width) == 0) { - ascii[i % width + 1] = '\0'; - json_array_add_value_string(array, ascii); - line_done = 1; - } - } - if (!line_done) { - ascii[i % width + 1] = '\0'; - json_array_add_value_string(array, ascii); - } + if (human()) + json_registers_version(vs, obj_create_array_obj(r, "vs")); + else + obj_add_int(r, "vs", vs); } -static void json_nvme_cmd_set_independent_id_ns( - struct nvme_id_independent_id_ns *ns, - unsigned int nsid) +static void json_ctrl_registers_intms(void *bar, struct json_object *r) { - struct json_object *root; - root = json_create_object(); + uint32_t intms = mmio_read32(bar + NVME_REG_INTMS); - json_object_add_value_int(root, "nsfeat", ns->nsfeat); - json_object_add_value_int(root, "nmic", ns->nmic); - json_object_add_value_int(root, "rescap", ns->rescap); - json_object_add_value_int(root, "fpi", ns->fpi); - json_object_add_value_uint(root, "anagrpid", le32_to_cpu(ns->anagrpid)); - json_object_add_value_int(root, "nsattr", ns->nsattr); - json_object_add_value_int(root, "nvmsetid", le16_to_cpu(ns->nvmsetid)); - json_object_add_value_int(root, "endgid", le16_to_cpu(ns->endgid)); - json_object_add_value_int(root, "nstat", ns->nstat); + if (human()) + json_registers_intms(intms, obj_create_array_obj(r, "intms")); + else + obj_add_int(r, "intms", intms); +} - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); +static void json_ctrl_registers_intmc(void *bar, struct json_object *r) +{ + uint32_t intmc = mmio_read32(bar + NVME_REG_INTMC); + + if (human()) + json_registers_intmc(intmc, obj_create_array_obj(r, "intmc")); + else + obj_add_int(r, "intmc", intmc); +} + +static void json_ctrl_registers_cc(void *bar, struct json_object *r) +{ + uint32_t cc = mmio_read32(bar + NVME_REG_CC); + + if (human()) + json_registers_cc(cc, obj_create_array_obj(r, "cc")); + else + obj_add_int(r, "cc", cc); +} + +static void json_ctrl_registers_csts(void *bar, struct json_object *r) +{ + uint32_t csts = mmio_read32(bar + NVME_REG_CSTS); + + if (human()) + json_registers_csts(csts, obj_create_array_obj(r, "csts")); + else + obj_add_int(r, "csts", csts); +} + +static void json_ctrl_registers_nssr(void *bar, struct json_object *r) +{ + uint32_t nssr = mmio_read32(bar + NVME_REG_NSSR); + + if (human()) + json_registers_nssr(nssr, obj_create_array_obj(r, "nssr")); + else + obj_add_int(r, "nssr", nssr); +} + +static void json_ctrl_registers_crto(void *bar, struct json_object *r) +{ + uint32_t crto = mmio_read32(bar + NVME_REG_CRTO); + + if (human()) + json_registers_crto(crto, obj_create_array_obj(r, "crto")); + else + obj_add_int(r, "crto", crto); +} + +static void json_ctrl_registers_aqa(void *bar, struct json_object *r) +{ + uint32_t aqa = mmio_read32(bar + NVME_REG_AQA); + + if (human()) + json_registers_aqa(aqa, obj_create_array_obj(r, "aqa")); + else + obj_add_int(r, "aqa", aqa); +} + +static void json_ctrl_registers_asq(void *bar, struct json_object *r) +{ + uint64_t asq = mmio_read64(bar + NVME_REG_ASQ); + + if (human()) + json_registers_asq(asq, obj_create_array_obj(r, "asq")); + else + obj_add_uint64(r, "asq", asq); +} + +static void json_ctrl_registers_acq(void *bar, struct json_object *r) +{ + uint64_t acq = mmio_read64(bar + NVME_REG_ACQ); + + if (human()) + json_registers_acq(acq, obj_create_array_obj(r, "acq")); + else + obj_add_uint64(r, "acq", acq); +} + +static void json_ctrl_registers_cmbloc(void *bar, struct json_object *r) +{ + uint32_t cmbloc = mmio_read32(bar + NVME_REG_CMBLOC); + + if (human()) + json_registers_cmbloc(cmbloc, bar, obj_create_array_obj(r, "cmbloc")); + else + obj_add_int(r, "cmbloc", cmbloc); +} + +static void json_ctrl_registers_cmbsz(void *bar, struct json_object *r) +{ + uint32_t cmbsz = mmio_read32(bar + NVME_REG_CMBSZ); + + if (human()) + json_registers_cmbsz(cmbsz, obj_create_array_obj(r, "cmbsz")); + else + obj_add_int(r, "cmbsz", cmbsz); +} + +static void json_ctrl_registers_bpinfo(void *bar, struct json_object *r) +{ + uint32_t bpinfo = mmio_read32(bar + NVME_REG_BPINFO); + + if (human()) + json_registers_bpinfo(bpinfo, obj_create_array_obj(r, "bpinfo")); + else + obj_add_int(r, "bpinfo", bpinfo); +} + +static void json_ctrl_registers_bprsel(void *bar, struct json_object *r) +{ + uint32_t bprsel = mmio_read32(bar + NVME_REG_BPRSEL); + + if (human()) + json_registers_bprsel(bprsel, obj_create_array_obj(r, "bprsel")); + else + obj_add_int(r, "bprsel", bprsel); +} + +static void json_ctrl_registers_bpmbl(void *bar, struct json_object *r) +{ + uint64_t bpmbl = mmio_read64(bar + NVME_REG_BPMBL); + + if (human()) + json_registers_bpmbl(bpmbl, obj_create_array_obj(r, "bpmbl")); + else + obj_add_uint64(r, "bpmbl", bpmbl); +} + +static void json_ctrl_registers_cmbmsc(void *bar, struct json_object *r) +{ + uint64_t cmbmsc = mmio_read64(bar + NVME_REG_CMBMSC); + + if (human()) + json_registers_cmbmsc(cmbmsc, obj_create_array_obj(r, "cmbmsc")); + else + obj_add_uint64(r, "cmbmsc", cmbmsc); +} + +static void json_ctrl_registers_cmbsts(void *bar, struct json_object *r) +{ + uint32_t cmbsts = mmio_read32(bar + NVME_REG_CMBSTS); + + if (human()) + json_registers_cmbsts(cmbsts, obj_create_array_obj(r, "cmbsts")); + else + obj_add_int(r, "cmbsts", cmbsts); +} + +static void json_ctrl_registers_pmrcap(void *bar, struct json_object *r) +{ + uint32_t pmrcap = mmio_read32(bar + NVME_REG_PMRCAP); + + if (human()) + json_registers_pmrcap(pmrcap, obj_create_array_obj(r, "pmrcap")); + else + obj_add_int(r, "pmrcap", pmrcap); +} + +static void json_ctrl_registers_pmrctl(void *bar, struct json_object *r) +{ + uint32_t pmrctl = mmio_read32(bar + NVME_REG_PMRCTL); + + if (human()) + json_registers_pmrctl(pmrctl, obj_create_array_obj(r, "pmrctl")); + else + obj_add_int(r, "pmrctl", pmrctl); +} + +static void json_ctrl_registers_pmrsts(void *bar, struct json_object *r) +{ + uint32_t pmrsts = mmio_read32(bar + NVME_REG_PMRSTS); + + if (human()) + json_registers_pmrsts(pmrsts, bar, obj_create_array_obj(r, "pmrsts")); + else + obj_add_int(r, "pmrsts", pmrsts); +} + +static void json_ctrl_registers_pmrebs(void *bar, struct json_object *r) +{ + uint32_t pmrebs = mmio_read32(bar + NVME_REG_PMREBS); + + if (human()) + json_registers_pmrebs(pmrebs, obj_create_array_obj(r, "pmrebs")); + else + obj_add_int(r, "pmrebs", pmrebs); +} + +static void json_ctrl_registers_pmrswtp(void *bar, struct json_object *r) +{ + uint32_t pmrswtp = mmio_read32(bar + NVME_REG_PMRSWTP); + + if (human()) + json_registers_pmrswtp(pmrswtp, obj_create_array_obj(r, "pmrswtp")); + else + obj_add_int(r, "pmrswtp", pmrswtp); +} + +static void json_ctrl_registers_pmrmscl(void *bar, struct json_object *r) +{ + uint32_t pmrmscl = mmio_read32(bar + NVME_REG_PMRMSCL); + + if (human()) + json_registers_pmrmscl(pmrmscl, obj_create_array_obj(r, "pmrmscl")); + else + obj_add_uint(r, "pmrmscl", pmrmscl); +} + +static void json_ctrl_registers_pmrmscu(void *bar, struct json_object *r) +{ + uint32_t pmrmscu = mmio_read32(bar + NVME_REG_PMRMSCU); + + if (human()) + json_registers_pmrmscu(pmrmscu, obj_create_array_obj(r, "pmrmscu")); + else + obj_add_uint(r, "pmrmscu", pmrmscu); +} + +static void json_ctrl_registers(void *bar, bool fabrics) +{ + struct json_object *r = json_create_object(); + + json_ctrl_registers_cap(bar, r); + json_ctrl_registers_vs(bar, r); + json_ctrl_registers_intms(bar, r); + json_ctrl_registers_intmc(bar, r); + json_ctrl_registers_cc(bar, r); + json_ctrl_registers_csts(bar, r); + json_ctrl_registers_nssr(bar, r); + json_ctrl_registers_crto(bar, r); + json_ctrl_registers_aqa(bar, r); + json_ctrl_registers_asq(bar, r); + json_ctrl_registers_acq(bar, r); + json_ctrl_registers_cmbloc(bar, r); + json_ctrl_registers_cmbsz(bar, r); + json_ctrl_registers_bpinfo(bar, r); + json_ctrl_registers_bprsel(bar, r); + json_ctrl_registers_bpmbl(bar, r); + json_ctrl_registers_cmbmsc(bar, r); + json_ctrl_registers_cmbsts(bar, r); + json_ctrl_registers_pmrcap(bar, r); + json_ctrl_registers_pmrctl(bar, r); + json_ctrl_registers_pmrsts(bar, r); + json_ctrl_registers_pmrebs(bar, r); + json_ctrl_registers_pmrswtp(bar, r); + json_ctrl_registers_pmrmscl(bar, r); + json_ctrl_registers_pmrmscu(bar, r); + + json_print(r); +} + +static void json_nvme_cmd_set_independent_id_ns(struct nvme_id_independent_id_ns *ns, + unsigned int nsid) +{ + struct json_object *r = json_create_object(); + + obj_add_int(r, "nsfeat", ns->nsfeat); + obj_add_int(r, "nmic", ns->nmic); + obj_add_int(r, "rescap", ns->rescap); + obj_add_int(r, "fpi", ns->fpi); + obj_add_uint(r, "anagrpid", le32_to_cpu(ns->anagrpid)); + obj_add_int(r, "nsattr", ns->nsattr); + obj_add_int(r, "nvmsetid", le16_to_cpu(ns->nvmsetid)); + obj_add_int(r, "endgid", le16_to_cpu(ns->endgid)); + obj_add_int(r, "nstat", ns->nstat); + + json_print(r); } static void json_nvme_id_ns_descs(void *data, unsigned int nsid) { /* large enough to hold uuid str (37) or nguid str (32) + zero byte */ - char json_str[40]; + char json_str[STR_LEN]; char *json_str_p; - union { __u8 eui64[NVME_NIDT_EUI64_LEN]; __u8 nguid[NVME_NIDT_NGUID_LEN]; __u8 uuid[NVME_UUID_LEN]; __u8 csi; } desc; - - struct json_object *root; + struct json_object *r = json_create_object(); struct json_object *json_array = NULL; - off_t off; int pos, len = 0; int i; @@ -1963,7 +2743,6 @@ static void json_nvme_id_ns_descs(void *data, unsigned int nsid) len = sizeof(desc.eui64); nidt_name = "eui64"; break; - case NVME_NIDT_NGUID: memcpy(desc.nguid, data + off, sizeof(desc.nguid)); for (i = 0; i < sizeof(desc.nguid); i++) @@ -1971,14 +2750,12 @@ static void json_nvme_id_ns_descs(void *data, unsigned int nsid) len = sizeof(desc.nguid); nidt_name = "nguid"; break; - case NVME_NIDT_UUID: memcpy(desc.uuid, data + off, sizeof(desc.uuid)); nvme_uuid_to_string(desc.uuid, json_str); len = sizeof(desc.uuid); nidt_name = "uuid"; break; - case NVME_NIDT_CSI: memcpy(&desc.csi, data + off, sizeof(desc.csi)); sprintf(json_str_p, "%#x", desc.csi); @@ -1994,47 +2771,38 @@ static void json_nvme_id_ns_descs(void *data, unsigned int nsid) if (nidt_name) { struct json_object *elem = json_create_object(); - json_object_add_value_int(elem, "loc", pos); - json_object_add_value_int(elem, "nidt", (int)cur->nidt); - json_object_add_value_int(elem, "nidl", (int)cur->nidl); - json_object_add_value_string(elem, "type", nidt_name); - json_object_add_value_string(elem, nidt_name, json_str); + obj_add_int(elem, "loc", pos); + obj_add_int(elem, "nidt", (int)cur->nidt); + obj_add_int(elem, "nidl", (int)cur->nidl); + obj_add_str(elem, "Type", nidt_name); + obj_add_str(elem, nidt_name, json_str); - if (!json_array) { + if (!json_array) json_array = json_create_array(); - } - json_array_add_value_object(json_array, elem); + array_add_obj(json_array, elem); } len += sizeof(*cur); } - root = json_create_object(); - if (json_array) - json_object_add_value_array(root, "ns-descs", json_array); - - json_print_object(root, NULL); - printf("\n"); + obj_add_array(r, "ns-descs", json_array); - json_free_object(root); + json_print(r); } static void json_nvme_id_ctrl_nvm(struct nvme_id_ctrl_nvm *ctrl_nvm) { - struct json_object *root; + struct json_object *r = json_create_object(); - root = json_create_object(); - json_object_add_value_uint(root, "vsl", ctrl_nvm->vsl); - json_object_add_value_uint(root, "wzsl", ctrl_nvm->wzsl); - json_object_add_value_uint(root, "wusl", ctrl_nvm->wusl); - json_object_add_value_uint(root, "dmrl", ctrl_nvm->dmrl); - json_object_add_value_uint(root, "dmrsl", le32_to_cpu(ctrl_nvm->dmrsl)); - json_object_add_value_uint64(root, "dmsl", le64_to_cpu(ctrl_nvm->dmsl)); + obj_add_uint(r, "vsl", ctrl_nvm->vsl); + obj_add_uint(r, "wzsl", ctrl_nvm->wzsl); + obj_add_uint(r, "wusl", ctrl_nvm->wusl); + obj_add_uint(r, "dmrl", ctrl_nvm->dmrl); + obj_add_uint(r, "dmrsl", le32_to_cpu(ctrl_nvm->dmrsl)); + obj_add_uint64(r, "dmsl", le64_to_cpu(ctrl_nvm->dmsl)); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + json_print(r); } static void json_nvme_nvm_id_ns(struct nvme_nvm_id_ns *nvm_ns, @@ -2042,122 +2810,131 @@ static void json_nvme_nvm_id_ns(struct nvme_nvm_id_ns *nvm_ns, unsigned int lba_index, bool cap_only) { - struct json_object *root; - struct json_object *elbafs; + struct json_object *r = json_create_object(); + struct json_object *elbafs = json_create_array(); int i; - root = json_create_object(); + if (!cap_only) + obj_add_uint64(r, "lbstm", le64_to_cpu(nvm_ns->lbstm)); - if (!cap_only) { - json_object_add_value_uint64(root, "lbstm", le64_to_cpu(nvm_ns->lbstm)); - } - json_object_add_value_int(root, "pic", nvm_ns->pic); + obj_add_int(r, "pic", nvm_ns->pic); - elbafs = json_create_array(); - json_object_add_value_array(root, "elbafs", elbafs); + obj_add_array(r, "elbafs", elbafs); for (i = 0; i <= ns->nlbaf; i++) { struct json_object *elbaf = json_create_object(); unsigned int elbaf_val = le32_to_cpu(nvm_ns->elbaf[i]); - json_object_add_value_uint(elbaf, "sts", elbaf_val & 0x7F); - json_object_add_value_uint(elbaf, "pif", (elbaf_val >> 7) & 0x3); + obj_add_uint(elbaf, "sts", elbaf_val & 0x7F); + obj_add_uint(elbaf, "pif", (elbaf_val >> 7) & 0x3); - json_array_add_value_object(elbafs, elbaf); + array_add_obj(elbafs, elbaf); } - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + json_print(r); } static void json_nvme_zns_id_ctrl(struct nvme_zns_id_ctrl *ctrl) { - struct json_object *root; + struct json_object *r = json_create_object(); - root = json_create_object(); - json_object_add_value_int(root, "zasl", ctrl->zasl); + obj_add_int(r, "zasl", ctrl->zasl); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + json_print(r); } static void json_nvme_zns_id_ns(struct nvme_zns_id_ns *ns, struct nvme_id_ns *id_ns) { - struct json_object *root; - struct json_object *lbafs; + struct json_object *r = json_create_object(); + struct json_object *lbafs = json_create_array(); int i; - root = json_create_object(); - json_object_add_value_int(root, "zoc", le16_to_cpu(ns->zoc)); - json_object_add_value_int(root, "ozcs", le16_to_cpu(ns->ozcs)); - json_object_add_value_uint(root, "mar", le32_to_cpu(ns->mar)); - json_object_add_value_uint(root, "mor", le32_to_cpu(ns->mor)); - json_object_add_value_uint(root, "rrl", le32_to_cpu(ns->rrl)); - json_object_add_value_uint(root, "frl", le32_to_cpu(ns->frl)); - json_object_add_value_uint(root, "rrl1", le32_to_cpu(ns->rrl1)); - json_object_add_value_uint(root, "rrl2", le32_to_cpu(ns->rrl2)); - json_object_add_value_uint(root, "rrl3", le32_to_cpu(ns->rrl3)); - json_object_add_value_uint(root, "frl1", le32_to_cpu(ns->frl1)); - json_object_add_value_uint(root, "frl2", le32_to_cpu(ns->frl2)); - json_object_add_value_uint(root, "frl3", le32_to_cpu(ns->frl3)); - json_object_add_value_uint(root, "numzrwa", le32_to_cpu(ns->numzrwa)); - json_object_add_value_int(root, "zrwafg", le16_to_cpu(ns->zrwafg)); - json_object_add_value_int(root, "zrwasz", le16_to_cpu(ns->zrwasz)); - json_object_add_value_int(root, "zrwacap", ns->zrwacap); - - lbafs = json_create_array(); - json_object_add_value_array(root, "lbafe", lbafs); + obj_add_int(r, "zoc", le16_to_cpu(ns->zoc)); + obj_add_int(r, "ozcs", le16_to_cpu(ns->ozcs)); + obj_add_uint(r, "mar", le32_to_cpu(ns->mar)); + obj_add_uint(r, "mor", le32_to_cpu(ns->mor)); + obj_add_uint(r, "rrl", le32_to_cpu(ns->rrl)); + obj_add_uint(r, "frl", le32_to_cpu(ns->frl)); + obj_add_uint(r, "rrl1", le32_to_cpu(ns->rrl1)); + obj_add_uint(r, "rrl2", le32_to_cpu(ns->rrl2)); + obj_add_uint(r, "rrl3", le32_to_cpu(ns->rrl3)); + obj_add_uint(r, "frl1", le32_to_cpu(ns->frl1)); + obj_add_uint(r, "frl2", le32_to_cpu(ns->frl2)); + obj_add_uint(r, "frl3", le32_to_cpu(ns->frl3)); + obj_add_uint(r, "numzrwa", le32_to_cpu(ns->numzrwa)); + obj_add_int(r, "zrwafg", le16_to_cpu(ns->zrwafg)); + obj_add_int(r, "zrwasz", le16_to_cpu(ns->zrwasz)); + obj_add_int(r, "zrwacap", ns->zrwacap); + + obj_add_array(r, "lbafe", lbafs); for (i = 0; i <= id_ns->nlbaf; i++) { struct json_object *lbaf = json_create_object(); - json_object_add_value_int(lbaf, "zsze", - le64_to_cpu(ns->lbafe[i].zsze)); - json_object_add_value_int(lbaf, "zdes", ns->lbafe[i].zdes); + obj_add_uint64(lbaf, "zsze", le64_to_cpu(ns->lbafe[i].zsze)); + obj_add_int(lbaf, "zdes", ns->lbafe[i].zdes); - json_array_add_value_object(lbafs, lbaf); + array_add_obj(lbafs, lbaf); } - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + + json_print(r); } static void json_nvme_list_ns(struct nvme_ns_list *ns_list) { - struct json_object *root; + struct json_object *r = json_create_object(); struct json_object *valid_attrs; - struct json_object *valid; + struct json_object *valid = json_create_array(); int i; - root = json_create_object(); - valid = json_create_array(); - for (i = 0; i < 1024; i++) { if (ns_list->ns[i]) { valid_attrs = json_create_object(); - json_object_add_value_uint(valid_attrs, "nsid", - le32_to_cpu(ns_list->ns[i])); - json_array_add_value_object(valid, valid_attrs); + obj_add_uint(valid_attrs, "nsid", le32_to_cpu(ns_list->ns[i])); + array_add_obj(valid, valid_attrs); } } - json_object_add_value_array(root, "nsid_list", valid); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + + obj_add_array(r, "nsid_list", valid); + + json_print(r); +} + +static void json_zns_start_zone_list(__u64 nr_zones, struct json_object **zone_list) +{ + *zone_list = json_create_array(); +} + +static void json_zns_changed(struct nvme_zns_changed_zone_log *log) +{ + struct json_object *r = json_create_object(); + char json_str[STR_LEN]; + uint16_t nrzid = le16_to_cpu(log->nrzid); + int i; + + if (nrzid == 0xFFFF) { + obj_add_result(r, "Too many zones have changed to fit into the log. Use report zones for changes."); + } else { + obj_add_uint(r, "nrzid", nrzid); + for (i = 0; i < nrzid; i++) { + sprintf(json_str, "zid %03d", i); + obj_add_uint64(r, json_str, (uint64_t)le64_to_cpu(log->zid[i])); + } + } + + json_print(r); } static void json_zns_finish_zone_list(__u64 nr_zones, struct json_object *zone_list) { - struct json_object *root = json_create_object(); - json_object_add_value_uint(root, "nr_zones", nr_zones); - json_object_add_value_array(root, "zone_list", zone_list); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + struct json_object *r = json_create_object(); + + obj_add_uint(r, "nr_zones", nr_zones); + obj_add_array(r, "zone_list", zone_list); + + json_print(r); } static void json_nvme_zns_report_zones(void *report, __u32 descs, @@ -2175,127 +2952,739 @@ static void json_nvme_zns_report_zones(void *report, __u32 descs, (report + sizeof(*r) + i * (sizeof(*desc) + ext_size)); zone = json_create_object(); - json_object_add_value_uint64(zone, "slba", - le64_to_cpu(desc->zslba)); - json_object_add_value_uint64(zone, "wp", - le64_to_cpu(desc->wp)); - json_object_add_value_uint64(zone, "cap", - le64_to_cpu(desc->zcap)); - json_object_add_value_string(zone, "state", - nvme_zone_state_to_string(desc->zs >> 4)); - json_object_add_value_string(zone, "type", - nvme_zone_type_to_string(desc->zt)); - json_object_add_value_uint(zone, "attrs", desc->za); - json_object_add_value_uint(zone, "attrs_info", desc->zai); + obj_add_uint64(zone, "slba", le64_to_cpu(desc->zslba)); + obj_add_uint64(zone, "wp", le64_to_cpu(desc->wp)); + obj_add_uint64(zone, "cap", le64_to_cpu(desc->zcap)); + obj_add_str(zone, "state", nvme_zone_state_to_string(desc->zs >> 4)); + obj_add_str(zone, "type", nvme_zone_type_to_string(desc->zt)); + obj_add_uint(zone, "attrs", desc->za); + obj_add_uint(zone, "attrs_info", desc->zai); if (ext_size) { if (desc->za & NVME_ZNS_ZA_ZDEV) { ext_data = json_create_array(); d_json((unsigned char *)desc + sizeof(*desc), ext_size, 16, 1, ext_data); - json_object_add_value_array(zone, "ext_data", - ext_data); + obj_add_array(zone, "ext_data", ext_data); } else { - json_object_add_value_string(zone, "ext_data", "Not valid"); + obj_add_str(zone, "ext_data", "Not valid"); } } - json_array_add_value_object(zone_list, zone); + array_add_obj(zone_list, zone); + } +} + +static void json_feature_show_fields_arbitration(struct json_object *r, unsigned int result) +{ + char json_str[STR_LEN]; + + obj_add_uint(r, "High Priority Weight (HPW)", ((result & 0xff000000) >> 24) + 1); + obj_add_uint(r, "Medium Priority Weight (MPW)", ((result & 0xff0000) >> 16) + 1); + obj_add_uint(r, "Low Priority Weight (LPW)", ((result & 0xff00) >> 8) + 1); + + if ((result & 7) == 7) + sprintf(json_str, "No limit"); + else + sprintf(json_str, "%u", 1 << (result & 7)); + + obj_add_str(r, "Arbitration Burst (AB)", json_str); +} + +static void json_feature_show_fields_power_mgmt(struct json_object *r, unsigned int result) +{ + __u8 field = (result & 0xe0) >> 5; + + obj_add_uint(r, "Workload Hint (WH)", field); + obj_add_str(r, "WH description", nvme_feature_wl_hints_to_string(field)); + obj_add_uint(r, "Power State (PS)", result & 0x1f); +} + +static void json_lba_range_entry(struct nvme_lba_range_type *lbrt, int nr_ranges, + struct json_object *r) +{ + char json_str[STR_LEN]; + struct json_object *lbare; + int i; + int j; + struct json_object *lbara = json_create_array(); + + obj_add_array(r, "LBA Ranges", lbara); + + for (i = 0; i <= nr_ranges; i++) { + lbare = json_create_object(); + array_add_obj(lbara, lbare); + + obj_add_int(lbare, "LBA range", i); + + obj_add_uint_nx(lbare, "type", lbrt->entry[i].type); + + obj_add_str(lbare, "type description", + nvme_feature_lba_type_to_string(lbrt->entry[i].type)); + + obj_add_uint_nx(lbare, "attributes", lbrt->entry[i].attributes); + + obj_add_str(lbare, "attribute[0]", lbrt->entry[i].attributes & 1 ? + "LBA range may be overwritten" : "LBA range should not be overwritten"); + + obj_add_str(lbare, "attribute[1]", lbrt->entry[i].attributes & 2 ? + "LBA range should be hidden from the OS/EFI/BIOS" : + "LBA range should be visible from the OS/EFI/BIOS"); + + obj_add_nprix64(lbare, "slba", le64_to_cpu(lbrt->entry[i].slba)); + + obj_add_nprix64(lbare, "nlb", le64_to_cpu(lbrt->entry[i].nlb)); + + for (j = 0; j < ARRAY_SIZE(lbrt->entry[i].guid); j++) + sprintf(&json_str[j * 2], "%02x", lbrt->entry[i].guid[j]); + + obj_add_str(lbare, "guid", json_str); + } +} + +static void json_feature_show_fields_lba_range(struct json_object *r, __u8 field, + unsigned char *buf) +{ + obj_add_uint(r, "Number of LBA Ranges (NUM)", field + 1); + + if (buf) + json_lba_range_entry((struct nvme_lba_range_type *)buf, field, r); +} + +static void json_feature_show_fields_temp_thresh(struct json_object *r, unsigned int result) +{ + __u8 field = (result & 0x300000) >> 20; + char json_str[STR_LEN]; + + obj_add_uint(r, "Threshold Type Select (THSEL)", field); + obj_add_str(r, "THSEL description", nvme_feature_temp_type_to_string(field)); + + field = (result & 0xf0000) >> 16; + + obj_add_uint(r, "Threshold Temperature Select (TMPSEL)", field); + obj_add_str(r, "TMPSEL description", nvme_feature_temp_sel_to_string(field)); + + sprintf(json_str, "%ld Celsius", kelvin_to_celsius(result & 0xffff)); + obj_add_str(r, "Temperature Threshold (TMPTH)", json_str); + + sprintf(json_str, "%u K", result & 0xffff); + obj_add_str(r, "TMPTH kelvin", json_str); +} + +static void json_feature_show_fields_err_recovery(struct json_object *r, unsigned int result) +{ + char json_str[STR_LEN]; + + obj_add_str(r, "Deallocated or Unwritten Logical Block Error Enable (DULBE)", + (result & 0x10000) >> 16 ? "Enabled" : "Disabled"); + + sprintf(json_str, "%u ms", (result & 0xffff) * 100); + obj_add_str(r, "Time Limited Error Recovery (TLER)", json_str); +} + +static void json_feature_show_fields_volatile_wc(struct json_object *r, unsigned int result) +{ + obj_add_str(r, "Volatile Write Cache Enable (WCE)", result & 1 ? "Enabled" : "Disabled"); +} + +static void json_feature_show_fields_num_queues(struct json_object *r, unsigned int result) +{ + obj_add_uint(r, "Number of IO Completion Queues Allocated (NCQA)", + ((result & 0xffff0000) >> 16) + 1); + obj_add_uint(r, "Number of IO Submission Queues Allocated (NSQA)", (result & 0xffff) + 1); +} + +static void json_feature_show_fields_irq_coalesce(struct json_object *r, unsigned int result) +{ + char json_str[STR_LEN]; + + sprintf(json_str, "%u usec", ((result & 0xff00) >> 8) * 100); + obj_add_str(r, "Aggregation Time (TIME)", json_str); + + obj_add_uint(r, "Aggregation Threshold (THR)", (result & 0xff) + 1); +} + +static void json_feature_show_fields_irq_config(struct json_object *r, unsigned int result) +{ + obj_add_str(r, "Coalescing Disable (CD)", (result & 0x10000) >> 16 ? "True" : "False"); + obj_add_uint(r, "Interrupt Vector (IV)", result & 0xffff); +} + +static void json_feature_show_fields_write_atomic(struct json_object *r, unsigned int result) +{ + obj_add_str(r, "Disable Normal (DN)", result & 1 ? "True" : "False"); +} + +static void json_feature_show_fields_async_event(struct json_object *r, unsigned int result) +{ + obj_add_str(r, "Discovery Log Page Change Notices", (result & 0x80000000) >> 31 ? + "Send async event" : "Do not send async event"); + obj_add_str(r, "Endurance Group Event Aggregate Log Change Notices", (result & 0x4000) >> 14 ? + "Send async event" : "Do not send async event"); + obj_add_str(r, "LBA Status Information Notices", (result & 0x2000) >> 13 ? + "Send async event" : "Do not send async event"); + obj_add_str(r, "Predictable Latency Event Aggregate Log Change Notices", + (result & 0x1000) >> 12 ? "Send async event" : "Do not send async event"); + obj_add_str(r, "Asymmetric Namespace Access Change Notices", (result & 0x800) >> 11 ? + "Send async event" : "Do not send async event"); + obj_add_str(r, "Telemetry Log Notices", (result & 0x400) >> 10 ? "Send async event" : + "Do not send async event"); + obj_add_str(r, "Firmware Activation Notices", (result & 0x200) >> 9 ? "Send async event" : + "Do not send async event"); + obj_add_str(r, "Namespace Attribute Notices", (result & 0x100) >> 8 ? "Send async event" : + "Do not send async event"); + obj_add_str(r, "SMART / Health Critical Warnings", result & 0xff ? "Send async event" : + "Do not send async event"); +} + +static void json_auto_pst(struct nvme_feat_auto_pst *apst, struct json_object *r) +{ + int i; + __u64 value; + char json_str[STR_LEN]; + struct json_object *apsta = json_create_array(); + struct json_object *apste; + + obj_add_array(r, "Auto PST Entries", apsta); + + for (i = 0; i < ARRAY_SIZE(apst->apst_entry); i++) { + apste = json_create_object(); + array_add_obj(apsta, apste); + sprintf(json_str, "%2d", i); + obj_add_str(apste, "entry", json_str); + value = le64_to_cpu(apst->apst_entry[i]); + sprintf(json_str, "%u ms", (__u32)NVME_GET(value, APST_ENTRY_ITPT)); + obj_add_str(apste, "Idle Time Prior to Transition (ITPT)", json_str); + obj_add_uint(apste, "Idle Transition Power State (ITPS)", + (__u32)NVME_GET(value, APST_ENTRY_ITPS)); } } +static void json_feature_show_fields_auto_pst(struct json_object *r, unsigned int result, + unsigned char *buf) +{ + obj_add_str(r, "Autonomous Power State Transition Enable (APSTE)", result & 1 ? "Enabled" : + "Disabled"); + + if (buf) + json_auto_pst((struct nvme_feat_auto_pst *)buf, r); +} + +static void json_host_mem_buffer(struct nvme_host_mem_buf_attrs *hmb, struct json_object *r) +{ + char json_str[STR_LEN]; + + obj_add_uint(r, "Host Memory Descriptor List Entry Count (HMDLEC)", le32_to_cpu(hmb->hmdlec)); + + sprintf(json_str, "0x%x", le32_to_cpu(hmb->hmdlau)); + obj_add_str(r, "Host Memory Descriptor List Address (HMDLAU)", json_str); + + sprintf(json_str, "0x%x", le32_to_cpu(hmb->hmdlal)); + obj_add_str(r, "Host Memory Descriptor List Address (HMDLAL)", json_str); + + obj_add_uint(r, "Host Memory Buffer Size (HSIZE)", le32_to_cpu(hmb->hsize)); +} + +static void json_feature_show_fields_host_mem_buf(struct json_object *r, unsigned int result, + unsigned char *buf) +{ + obj_add_str(r, "Enable Host Memory (EHM)", result & 1 ? "Enabled" : "Disabled"); + + if (buf) + json_host_mem_buffer((struct nvme_host_mem_buf_attrs *)buf, r); +} + +static void json_timestamp(struct json_object *r, struct nvme_timestamp *ts) +{ + char buffer[BUF_LEN]; + time_t timestamp = int48_to_long(ts->timestamp) / 1000; + struct tm *tm = localtime(×tamp); + + obj_add_uint64(r, "timestamp", int48_to_long(ts->timestamp)); + + if(!strftime(buffer, sizeof(buffer), "%c %Z", tm)) + sprintf(buffer, "%s", "-"); + + obj_add_str(r, "timestamp string", buffer); + + obj_add_str(r, "timestamp origin", ts->attr & 2 ? + "The Timestamp field was initialized with a Timestamp value using a Set Features command." : + "The Timestamp field was initialized to 0h by a Controller Level Reset."); + + obj_add_str(r, "synch", ts->attr & 1 ? + "The controller may have stopped counting during vendor specific intervals after the Timestamp value was initialized." : + "The controller counted time in milliseconds continuously since the Timestamp value was initialized."); +} + +static void json_feature_show_fields_timestamp(struct json_object *r, unsigned char *buf) +{ + if (buf) + json_timestamp(r, (struct nvme_timestamp *)buf); +} + +static void json_feature_show_fields_kato(struct json_object *r, unsigned int result) +{ + obj_add_uint(r, "Keep Alive Timeout (KATO) in milliseconds", result); +} + +static void json_feature_show_fields_hctm(struct json_object *r, unsigned int result) +{ + char json_str[STR_LEN]; + + sprintf(json_str, "%u K", result >> 16); + obj_add_str(r, "Thermal Management Temperature 1 (TMT1)", json_str); + + sprintf(json_str, "%ld Celsius", kelvin_to_celsius(result >> 16)); + obj_add_str(r, "TMT1 celsius", json_str); + + sprintf(json_str, "%u K", result & 0xffff); + obj_add_str(r, "Thermal Management Temperature 2", json_str); + + sprintf(json_str, "%ld Celsius", kelvin_to_celsius(result & 0xffff)); + obj_add_str(r, "TMT2 celsius", json_str); +} + +static void json_feature_show_fields_nopsc(struct json_object *r, unsigned int result) +{ + obj_add_str(r, "Non-Operational Power State Permissive Mode Enable (NOPPME)", result & 1 ? + "True" : "False"); +} + +static void json_feature_show_fields_rrl(struct json_object *r, unsigned int result) +{ + obj_add_uint(r, "Read Recovery Level (RRL)", result & 0xf); +} + +static void json_plm_config(struct nvme_plm_config *plmcfg, struct json_object *r) +{ + char json_str[STR_LEN]; + + sprintf(json_str, "%04x", le16_to_cpu(plmcfg->ee)); + obj_add_str(r, "Enable Event", json_str); + + obj_add_uint64(r, "DTWIN Reads Threshold", le64_to_cpu(plmcfg->dtwinrt)); + obj_add_uint64(r, "DTWIN Writes Threshold", le64_to_cpu(plmcfg->dtwinwt)); + obj_add_uint64(r, "DTWIN Time Threshold", le64_to_cpu(plmcfg->dtwintt)); +} + +static void json_feature_show_fields_plm_config(struct json_object *r, unsigned int result, + unsigned char *buf) +{ + obj_add_str(r, "Predictable Latency Window Enabled", result & 1 ? "True" : "False"); + + if (buf) + json_plm_config((struct nvme_plm_config *)buf, r); +} + +static void json_feature_show_fields_plm_window(struct json_object *r, unsigned int result) +{ + obj_add_str(r, "Window Select", nvme_plm_window_to_string(result)); +} + +static void json_feature_show_fields_lba_sts_interval(struct json_object *r, unsigned int result) +{ + obj_add_uint(r, "LBA Status Information Poll Interval (LSIPI)", result >> 16); + obj_add_uint(r, "LBA Status Information Report Interval (LSIRI)", result & 0xffff); +} + +static void json_feature_show_fields_host_behavior(struct json_object *r, unsigned char *buf) +{ + if (buf) + obj_add_str(r, "Host Behavior Support", buf[0] & 0x1 ? "True" : "False"); +} + +static void json_feature_show_fields_sanitize(struct json_object *r, unsigned int result) +{ + obj_add_uint(r, "No-Deallocate Response Mode (NODRM)", result & 1); +} + +static void json_feature_show_fields_endurance_evt_cfg(struct json_object *r, unsigned int result) +{ + obj_add_uint(r, "Endurance Group Identifier (ENDGID)", result & 0xffff); + obj_add_uint(r, "Endurance Group Critical Warnings", result >> 16 & 0xff); +} + +static void json_feature_show_fields_iocs_profile(struct json_object *r, unsigned int result) +{ + obj_add_str(r, "I/O Command Set Profile", result & 0x1 ? "True" : "False"); +} + +static void json_feature_show_fields_spinup_control(struct json_object *r, unsigned int result) +{ + obj_add_str(r, "Spinup control feature Enabled", result & 1 ? "True" : "False"); +} + +static void json_host_metadata(struct json_object *r, enum nvme_features_id fid, + struct nvme_host_metadata *data) +{ + struct nvme_metadata_element_desc *desc = &data->descs[0]; + int i; + char val[VAL_LEN]; + __u16 len; + char json_str[STR_LEN]; + struct json_object *desca = json_create_array(); + struct json_object *desce; + + obj_add_int(r, "Num Metadata Element Descriptors", data->ndesc); + + obj_add_array(r, "Metadata Element Descriptors", desca); + + for (i = 0; i < data->ndesc; i++) { + desce = json_create_object(); + array_add_obj(desca, desce); + + obj_add_int(desce, "Element", i); + + sprintf(json_str, "0x%02x", desc->type); + obj_add_str(desce, "Type", json_str); + + obj_add_str(desce, "Type definition", + nvme_host_metadata_type_to_string(fid, desc->type)); + + obj_add_int(desce, "Revision", desc->rev); + + len = le16_to_cpu(desc->len); + obj_add_int(desce, "Length", len); + + strncpy(val, (char *)desc->val, min(sizeof(val) - 1, len)); + obj_add_str(desce, "Value", val); + + desc = (struct nvme_metadata_element_desc *)&desc->val[desc->len]; + } +} + +static void json_feature_show_fields_ns_metadata(struct json_object *r, enum nvme_features_id fid, + unsigned char *buf) +{ + if (buf) + json_host_metadata(r, fid, (struct nvme_host_metadata *)buf); +} + +static void json_feature_show_fields_sw_progress(struct json_object *r, unsigned int result) +{ + obj_add_uint(r, "Pre-boot Software Load Count (PBSLC)", result & 0xff); +} + +static void json_feature_show_fields_host_id(struct json_object *r, unsigned char *buf) +{ + uint64_t ull = 0; + int i; + + if (buf) { + for (i = sizeof(ull) / sizeof(*buf); i; i--) { + ull |= buf[i - 1]; + if (i - 1) + ull <<= BYTE_TO_BIT(sizeof(buf[i])); + } + obj_add_uint64(r, "Host Identifier (HOSTID)", ull); + } +} + +static void json_feature_show_fields_resv_mask(struct json_object *r, unsigned int result) +{ + obj_add_str(r, "Mask Reservation Preempted Notification (RESPRE)", (result & 8) >> 3 ? + "True" : "False"); + obj_add_str(r, "Mask Reservation Released Notification (RESREL)", (result & 4) >> 2 ? + "True" : "False"); + obj_add_str(r, "Mask Registration Preempted Notification (REGPRE)", (result & 2) >> 1 ? + "True" : "False"); +} + +static void json_feature_show_fields_resv_persist(struct json_object *r, unsigned int result) +{ + obj_add_str(r, "Persist Through Power Loss (PTPL)", result & 1 ? "True" : "False"); +} + +static void json_feature_show_fields_write_protect(struct json_object *r, unsigned int result) +{ + obj_add_str(r, "Namespace Write Protect", nvme_ns_wp_cfg_to_string(result)); +} + +static void json_feature_show_fields_fdp(struct json_object *r, unsigned int result) +{ + obj_add_str(r, "Flexible Direct Placement Enable (FDPE)", result & 1 ? "Yes" : "No"); + obj_add_uint(r, "Flexible Direct Placement Configuration Index", result >> 8 & 0xf); +} + +static void json_feature_show_fields_fdp_events(struct json_object *r, unsigned int result, + unsigned char *buf) +{ + unsigned int i; + struct nvme_fdp_supported_event_desc *d; + char json_str[STR_LEN]; + + for (i = 0; i < result; i++) { + d = &((struct nvme_fdp_supported_event_desc *)buf)[i]; + sprintf(json_str, "%s", d->evta & 0x1 ? "Enabled" : "Not enabled"); + obj_add_str(r, nvme_fdp_event_to_string(d->evt), json_str); + } +} + +static void json_feature_show(enum nvme_features_id fid, int sel, unsigned int result) +{ + struct json_object *r; + char json_str[STR_LEN]; + + sprintf(json_str, "feature: %#0*x", fid ? 4 : 2, fid); + r = obj_create(json_str); + + obj_add_str(r, "name", nvme_feature_to_string(fid)); + + sprintf(json_str, "%#0*x", result ? 10 : 8, result); + obj_add_str(r, nvme_select_to_string(sel), json_str); + + json_print(r); +} + +static void json_feature_show_fields(enum nvme_features_id fid, unsigned int result, + unsigned char *buf) +{ + struct json_object *r; + char json_str[STR_LEN]; + + sprintf(json_str, "Feature: %#0*x", fid ? 4 : 2, fid); + r = obj_create(json_str); + + switch (fid) { + case NVME_FEAT_FID_ARBITRATION: + json_feature_show_fields_arbitration(r, result); + break; + case NVME_FEAT_FID_POWER_MGMT: + json_feature_show_fields_power_mgmt(r, result); + break; + case NVME_FEAT_FID_LBA_RANGE: + json_feature_show_fields_lba_range(r, result & 0x3f, buf); + break; + case NVME_FEAT_FID_TEMP_THRESH: + json_feature_show_fields_temp_thresh(r, result); + break; + case NVME_FEAT_FID_ERR_RECOVERY: + json_feature_show_fields_err_recovery(r, result); + break; + case NVME_FEAT_FID_VOLATILE_WC: + json_feature_show_fields_volatile_wc(r, result); + break; + case NVME_FEAT_FID_NUM_QUEUES: + json_feature_show_fields_num_queues(r, result); + break; + case NVME_FEAT_FID_IRQ_COALESCE: + json_feature_show_fields_irq_coalesce(r, result); + break; + case NVME_FEAT_FID_IRQ_CONFIG: + json_feature_show_fields_irq_config(r, result); + break; + case NVME_FEAT_FID_WRITE_ATOMIC: + json_feature_show_fields_write_atomic(r, result); + break; + case NVME_FEAT_FID_ASYNC_EVENT: + json_feature_show_fields_async_event(r, result); + break; + case NVME_FEAT_FID_AUTO_PST: + json_feature_show_fields_auto_pst(r, result, buf); + break; + case NVME_FEAT_FID_HOST_MEM_BUF: + json_feature_show_fields_host_mem_buf(r, result, buf); + break; + case NVME_FEAT_FID_TIMESTAMP: + json_feature_show_fields_timestamp(r, buf); + break; + case NVME_FEAT_FID_KATO: + json_feature_show_fields_kato(r, result); + break; + case NVME_FEAT_FID_HCTM: + json_feature_show_fields_hctm(r, result); + break; + case NVME_FEAT_FID_NOPSC: + json_feature_show_fields_nopsc(r, result); + break; + case NVME_FEAT_FID_RRL: + json_feature_show_fields_rrl(r, result); + break; + case NVME_FEAT_FID_PLM_CONFIG: + json_feature_show_fields_plm_config(r, result, buf); + break; + case NVME_FEAT_FID_PLM_WINDOW: + json_feature_show_fields_plm_window(r, result); + break; + case NVME_FEAT_FID_LBA_STS_INTERVAL: + json_feature_show_fields_lba_sts_interval(r, result); + break; + case NVME_FEAT_FID_HOST_BEHAVIOR: + json_feature_show_fields_host_behavior(r, buf); + break; + case NVME_FEAT_FID_SANITIZE: + json_feature_show_fields_sanitize(r, result); + break; + case NVME_FEAT_FID_ENDURANCE_EVT_CFG: + json_feature_show_fields_endurance_evt_cfg(r, result); + break; + case NVME_FEAT_FID_IOCS_PROFILE: + json_feature_show_fields_iocs_profile(r, result); + break; + case NVME_FEAT_FID_SPINUP_CONTROL: + json_feature_show_fields_spinup_control(r, result); + break; + case NVME_FEAT_FID_ENH_CTRL_METADATA: + fallthrough; + case NVME_FEAT_FID_CTRL_METADATA: + fallthrough; + case NVME_FEAT_FID_NS_METADATA: + json_feature_show_fields_ns_metadata(r, fid, buf); + break; + case NVME_FEAT_FID_SW_PROGRESS: + json_feature_show_fields_sw_progress(r, result); + break; + case NVME_FEAT_FID_HOST_ID: + json_feature_show_fields_host_id(r, buf); + break; + case NVME_FEAT_FID_RESV_MASK: + json_feature_show_fields_resv_mask(r, result); + break; + case NVME_FEAT_FID_RESV_PERSIST: + json_feature_show_fields_resv_persist(r, result); + break; + case NVME_FEAT_FID_WRITE_PROTECT: + json_feature_show_fields_write_protect(r, result); + break; + case NVME_FEAT_FID_FDP: + json_feature_show_fields_fdp(r, result); + break; + case NVME_FEAT_FID_FDP_EVENTS: + json_feature_show_fields_fdp_events(r, result, buf); + break; + default: + break; + } + + json_print(r); +} + +void json_id_ctrl_rpmbs(__le32 ctrl_rpmbs) +{ + struct json_object *r = json_create_object(); + __u32 rpmbs = le32_to_cpu(ctrl_rpmbs); + __u32 asz = (rpmbs & 0xFF000000) >> 24; + __u32 tsz = (rpmbs & 0xFF0000) >> 16; + __u32 rsvd = (rpmbs & 0xFFC0) >> 6; + __u32 auth = (rpmbs & 0x38) >> 3; + __u32 rpmb = rpmbs & 7; + + obj_add_uint_nx(r, "[31:24]: Access Size", asz); + obj_add_uint_nx(r, "[23:16]: Total Size", tsz); + + if (rsvd) + obj_add_uint_nx(r, "[15:6]: Reserved", rsvd); + + obj_add_uint_nx(r, "[5:3]: Authentication Method", auth); + obj_add_uint_nx(r, "[2:0]: Number of RPMB Units", rpmb); + + json_print(r); +} + +static void json_lba_range(struct nvme_lba_range_type *lbrt, int nr_ranges) +{ + struct json_object *r = json_create_object(); + + json_lba_range_entry(lbrt, nr_ranges, r); + + json_print(r); +} + +static void json_lba_status_info(__u32 result) +{ + struct json_object *r = json_create_object(); + + obj_add_uint(r, "LBA Status Information Poll Interval (LSIPI)", (result >> 16) & 0xffff); + obj_add_uint(r, "LBA Status Information Report Interval (LSIRI)", result & 0xffff); + + json_print(r); +} + +void json_d(unsigned char *buf, int len, int width, int group) +{ + struct json_object *r = json_r ? json_r : json_create_object(); + char json_str[STR_LEN]; + struct json_object *data = json_create_array(); + + sprintf(json_str, "data: buf=%p len=%d width=%d group=%d", buf, len, width, group); + d_json(buf, len, width, group, data); + obj_add_array(r, json_str, data); + + json_print(r); +} + static void json_nvme_list_ctrl(struct nvme_ctrl_list *ctrl_list) { __u16 num = le16_to_cpu(ctrl_list->num); - struct json_object *root; + struct json_object *r = json_create_object(); struct json_object *valid_attrs; - struct json_object *valid; + struct json_object *valid = json_create_array(); int i; - root = json_create_object(); - valid = json_create_array(); - - json_object_add_value_uint(root, "num_ctrl", - le16_to_cpu(ctrl_list->num)); + obj_add_uint(r, "num_ctrl", le16_to_cpu(ctrl_list->num)); for (i = 0; i < min(num, 2047); i++) { - valid_attrs = json_create_object(); - json_object_add_value_uint(valid_attrs, "ctrl_id", - le16_to_cpu(ctrl_list->identifier[i])); - json_array_add_value_object(valid, valid_attrs); + obj_add_uint(valid_attrs, "ctrl_id", le16_to_cpu(ctrl_list->identifier[i])); + array_add_obj(valid, valid_attrs); } - json_object_add_value_array(root, "ctrl_list", valid); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + obj_add_array(r, "ctrl_list", valid); + + json_print(r); } static void json_nvme_id_nvmset(struct nvme_id_nvmset_list *nvmset, unsigned int nvmeset_id) { __u32 nent = nvmset->nid; - struct json_object *entries; - struct json_object *root; + struct json_object *entries = json_create_array(); + struct json_object *r = json_create_object(); int i; - root = json_create_object(); - - json_object_add_value_int(root, "nid", nent); + obj_add_int(r, "nid", nent); - entries = json_create_array(); for (i = 0; i < nent; i++) { struct json_object *entry = json_create_object(); - json_object_add_value_int(entry, "nvmset_id", - le16_to_cpu(nvmset->ent[i].nvmsetid)); - json_object_add_value_int(entry, "endurance_group_id", - le16_to_cpu(nvmset->ent[i].endgid)); - json_object_add_value_uint(entry, "random_4k_read_typical", - le32_to_cpu(nvmset->ent[i].rr4kt)); - json_object_add_value_uint(entry, "optimal_write_size", - le32_to_cpu(nvmset->ent[i].ows)); - json_object_add_value_uint128(entry, "total_nvmset_cap", - le128_to_cpu(nvmset->ent[i].tnvmsetcap)); - json_object_add_value_uint128(entry, "unalloc_nvmset_cap", - le128_to_cpu(nvmset->ent[i].unvmsetcap)); - json_array_add_value_object(entries, entry); - } - - json_object_add_value_array(root, "NVMSet", entries); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + obj_add_int(entry, "nvmset_id", le16_to_cpu(nvmset->ent[i].nvmsetid)); + obj_add_int(entry, "endurance_group_id", le16_to_cpu(nvmset->ent[i].endgid)); + obj_add_uint(entry, "random_4k_read_typical", le32_to_cpu(nvmset->ent[i].rr4kt)); + obj_add_uint(entry, "optimal_write_size", le32_to_cpu(nvmset->ent[i].ows)); + obj_add_uint128(entry, "total_nvmset_cap", le128_to_cpu(nvmset->ent[i].tnvmsetcap)); + obj_add_uint128(entry, "unalloc_nvmset_cap", + le128_to_cpu(nvmset->ent[i].unvmsetcap)); + array_add_obj(entries, entry); + } + + obj_add_array(r, "NVMSet", entries); + + json_print(r); } static void json_nvme_primary_ctrl_cap(const struct nvme_primary_ctrl_cap *caps) { - struct json_object *root; - - root = json_create_object(); - - json_object_add_value_uint(root, "cntlid", le16_to_cpu(caps->cntlid)); - json_object_add_value_uint(root, "portid", le16_to_cpu(caps->portid)); - json_object_add_value_uint(root, "crt", caps->crt); - - json_object_add_value_uint(root, "vqfrt", le32_to_cpu(caps->vqfrt)); - json_object_add_value_uint(root, "vqrfa", le32_to_cpu(caps->vqrfa)); - json_object_add_value_int(root, "vqrfap", le16_to_cpu(caps->vqrfap)); - json_object_add_value_int(root, "vqprt", le16_to_cpu(caps->vqprt)); - json_object_add_value_int(root, "vqfrsm", le16_to_cpu(caps->vqfrsm)); - json_object_add_value_int(root, "vqgran", le16_to_cpu(caps->vqgran)); - - json_object_add_value_uint(root, "vifrt", le32_to_cpu(caps->vifrt)); - json_object_add_value_uint(root, "virfa", le32_to_cpu(caps->virfa)); - json_object_add_value_int(root, "virfap", le16_to_cpu(caps->virfap)); - json_object_add_value_int(root, "viprt", le16_to_cpu(caps->viprt)); - json_object_add_value_int(root, "vifrsm", le16_to_cpu(caps->vifrsm)); - json_object_add_value_int(root, "vigran", le16_to_cpu(caps->vigran)); - - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + struct json_object *r = json_create_object(); + + obj_add_uint(r, "cntlid", le16_to_cpu(caps->cntlid)); + obj_add_uint(r, "portid", le16_to_cpu(caps->portid)); + obj_add_uint(r, "crt", caps->crt); + + obj_add_uint(r, "vqfrt", le32_to_cpu(caps->vqfrt)); + obj_add_uint(r, "vqrfa", le32_to_cpu(caps->vqrfa)); + obj_add_int(r, "vqrfap", le16_to_cpu(caps->vqrfap)); + obj_add_int(r, "vqprt", le16_to_cpu(caps->vqprt)); + obj_add_int(r, "vqfrsm", le16_to_cpu(caps->vqfrsm)); + obj_add_int(r, "vqgran", le16_to_cpu(caps->vqgran)); + + obj_add_uint(r, "vifrt", le32_to_cpu(caps->vifrt)); + obj_add_uint(r, "virfa", le32_to_cpu(caps->virfa)); + obj_add_int(r, "virfap", le16_to_cpu(caps->virfap)); + obj_add_int(r, "viprt", le16_to_cpu(caps->viprt)); + obj_add_int(r, "vifrsm", le16_to_cpu(caps->vifrsm)); + obj_add_int(r, "vigran", le16_to_cpu(caps->vigran)); + + json_print(r); } static void json_nvme_list_secondary_ctrl(const struct nvme_secondary_ctrl_list *sc_list, @@ -2303,83 +3692,62 @@ static void json_nvme_list_secondary_ctrl(const struct nvme_secondary_ctrl_list { const struct nvme_secondary_ctrl *sc_entry = &sc_list->sc_entry[0]; __u32 nent = min(sc_list->num, count); - struct json_object *entries; - struct json_object *root; + struct json_object *entries = json_create_array(); + struct json_object *r = json_create_object(); int i; - root = json_create_object(); - - json_object_add_value_int(root, "num", nent); + obj_add_int(r, "num", nent); - entries = json_create_array(); for (i = 0; i < nent; i++) { struct json_object *entry = json_create_object(); - json_object_add_value_int(entry, - "secondary-controller-identifier", - le16_to_cpu(sc_entry[i].scid)); - json_object_add_value_int(entry, - "primary-controller-identifier", - le16_to_cpu(sc_entry[i].pcid)); - json_object_add_value_int(entry, "secondary-controller-state", - sc_entry[i].scs); - json_object_add_value_int(entry, "virtual-function-number", - le16_to_cpu(sc_entry[i].vfn)); - json_object_add_value_int(entry, "num-virtual-queues", - le16_to_cpu(sc_entry[i].nvq)); - json_object_add_value_int(entry, "num-virtual-interrupts", - le16_to_cpu(sc_entry[i].nvi)); - json_array_add_value_object(entries, entry); - } - - json_object_add_value_array(root, "secondary-controllers", entries); - - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + obj_add_int(entry, "secondary-controller-identifier", + le16_to_cpu(sc_entry[i].scid)); + obj_add_int(entry, "primary-controller-identifier", le16_to_cpu(sc_entry[i].pcid)); + obj_add_int(entry, "secondary-controller-state", sc_entry[i].scs); + obj_add_int(entry, "virtual-function-number", le16_to_cpu(sc_entry[i].vfn)); + obj_add_int(entry, "num-virtual-queues", le16_to_cpu(sc_entry[i].nvq)); + obj_add_int(entry, "num-virtual-interrupts", le16_to_cpu(sc_entry[i].nvi)); + array_add_obj(entries, entry); + } + + obj_add_array(r, "secondary-controllers", entries); + + json_print(r); } static void json_nvme_id_ns_granularity_list( const struct nvme_id_ns_granularity_list *glist) { int i; - struct json_object *root; - struct json_object *entries; + struct json_object *r = json_create_object(); + struct json_object *entries = json_create_array(); - root = json_create_object(); + obj_add_int(r, "attributes", glist->attributes); + obj_add_int(r, "num-descriptors", glist->num_descriptors); - json_object_add_value_int(root, "attributes", glist->attributes); - json_object_add_value_int(root, "num-descriptors", - glist->num_descriptors); - - entries = json_create_array(); for (i = 0; i <= glist->num_descriptors; i++) { struct json_object *entry = json_create_object(); - json_object_add_value_uint64(entry, "namespace-size-granularity", - le64_to_cpu(glist->entry[i].nszegran)); - json_object_add_value_uint64(entry, "namespace-capacity-granularity", - le64_to_cpu(glist->entry[i].ncapgran)); - json_array_add_value_object(entries, entry); + obj_add_uint64(entry, "namespace-size-granularity", + le64_to_cpu(glist->entry[i].nszegran)); + obj_add_uint64(entry, "namespace-capacity-granularity", + le64_to_cpu(glist->entry[i].ncapgran)); + array_add_obj(entries, entry); } - json_object_add_value_array(root, "namespace-granularity-list", entries); + obj_add_array(r, "namespace-granularity-list", entries); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + json_print(r); } static void json_nvme_id_uuid_list(const struct nvme_id_uuid_list *uuid_list) { - struct json_object *root; - struct json_object *entries; + struct json_object *r = json_create_object(); + struct json_object *entries = json_create_array(); int i; - root = json_create_object(); - entries = json_create_array(); - /* The 0th entry is reserved */ - for (i = 1; i < NVME_ID_UUID_LIST_MAX; i++) { + for (i = 0; i < NVME_ID_UUID_LIST_MAX; i++) { __u8 uuid[NVME_UUID_LEN]; struct json_object *entry = json_create_object(); @@ -2387,30 +3755,27 @@ static void json_nvme_id_uuid_list(const struct nvme_id_uuid_list *uuid_list) if (memcmp(uuid_list->entry[i].uuid, zero_uuid, sizeof(zero_uuid)) == 0) break; memcpy(&uuid, uuid_list->entry[i].uuid, sizeof(uuid)); - json_object_add_value_int(entry, "association", + obj_add_int(entry, "association", uuid_list->entry[i].header & 0x3); - json_object_add_value_string(entry, "uuid", + obj_add_str(entry, "uuid", util_uuid_to_string(uuid)); - json_array_add_value_object(entries, entry); + array_add_obj(entries, entry); } - json_object_add_value_array(root, "UUID-list", entries); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + + obj_add_array(r, "UUID-list", entries); + + json_print(r); } static void json_id_domain_list(struct nvme_id_domain_list *id_dom) { - struct json_object *root; - struct json_object *entries; + struct json_object *r = json_create_object(); + struct json_object *entries = json_create_array(); struct json_object *entry; int i; nvme_uint128_t dom_cap, unalloc_dom_cap, max_egrp_dom_cap; - root = json_create_object(); - entries = json_create_array(); - - json_object_add_value_uint(root, "num_dom_entries", id_dom->num); + obj_add_uint(r, "num_dom_entries", id_dom->num); for (i = 0; i < id_dom->num; i++) { entry = json_create_object(); @@ -2418,78 +3783,67 @@ static void json_id_domain_list(struct nvme_id_domain_list *id_dom) unalloc_dom_cap = le128_to_cpu(id_dom->domain_attr[i].unalloc_dom_cap); max_egrp_dom_cap = le128_to_cpu(id_dom->domain_attr[i].max_egrp_dom_cap); - json_object_add_value_uint(entry, "dom_id", le16_to_cpu(id_dom->domain_attr[i].dom_id)); - json_object_add_value_uint128(entry, "dom_cap", dom_cap); - json_object_add_value_uint128(entry, "unalloc_dom_cap", unalloc_dom_cap); - json_object_add_value_uint128(entry, "max_egrp_dom_cap", max_egrp_dom_cap); + obj_add_uint(entry, "dom_id", le16_to_cpu(id_dom->domain_attr[i].dom_id)); + obj_add_uint128(entry, "dom_cap", dom_cap); + obj_add_uint128(entry, "unalloc_dom_cap", unalloc_dom_cap); + obj_add_uint128(entry, "max_egrp_dom_cap", max_egrp_dom_cap); - json_array_add_value_object(entries, entry); + array_add_obj(entries, entry); } - json_object_add_value_array(root, "domain_list", entries); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + obj_add_array(r, "domain_list", entries); + + json_print(r); } static void json_nvme_endurance_group_list(struct nvme_id_endurance_group_list *endgrp_list) { - struct json_object *root; + struct json_object *r = json_create_object(); struct json_object *valid_attrs; - struct json_object *valid; + struct json_object *valid = json_create_array(); int i; - root = json_create_object(); - valid = json_create_array(); - - json_object_add_value_uint(root, "num_endgrp_id", - le16_to_cpu(endgrp_list->num)); + obj_add_uint(r, "num_endgrp_id", le16_to_cpu(endgrp_list->num)); for (i = 0; i < min(le16_to_cpu(endgrp_list->num), 2047); i++) { valid_attrs = json_create_object(); - json_object_add_value_uint(valid_attrs, "endgrp_id", - le16_to_cpu(endgrp_list->identifier[i])); - json_array_add_value_object(valid, valid_attrs); + obj_add_uint(valid_attrs, "endgrp_id", le16_to_cpu(endgrp_list->identifier[i])); + array_add_obj(valid, valid_attrs); } - json_object_add_value_array(root, "endgrp_list", valid); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + obj_add_array(r, "endgrp_list", valid); + + json_print(r); } static void json_support_log(struct nvme_supported_log_pages *support_log, const char *devname) { - struct json_object *root; - struct json_object *valid; + struct json_object *r = json_create_object(); + struct json_object *valid = json_create_array(); struct json_object *valid_attrs; unsigned int lid; char key[128]; __u32 support; - root = json_create_object(); - valid = json_create_array(); - for (lid = 0; lid < 256; lid++) { support = le32_to_cpu(support_log->lid_support[lid]); if (support & 0x1) { valid_attrs = json_create_object(); sprintf(key, "lid_0x%x ", lid); - json_object_add_value_uint(valid_attrs, key, support); - json_array_add_value_object(valid, valid_attrs); + obj_add_uint(valid_attrs, key, support); + array_add_obj(valid, valid_attrs); } } - json_object_add_value_object(root, "supported_logs", valid); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + obj_add_obj(r, "supported_logs", valid); + + json_print(r); } -static void json_detail_list(nvme_root_t r) +static void json_detail_list(nvme_root_t t) { - struct json_object *jroot = json_create_object(); + struct json_object *r = json_create_object(); struct json_object *jdev = json_create_array(); nvme_host_t h; @@ -2498,36 +3852,36 @@ static void json_detail_list(nvme_root_t r) nvme_path_t p; nvme_ns_t n; - nvme_for_each_host(r, h) { + nvme_for_each_host(t, h) { struct json_object *hss = json_create_object(); struct json_object *jsslist = json_create_array(); const char *hostid; - json_object_add_value_string(hss, "HostNQN", nvme_host_get_hostnqn(h)); + obj_add_str(hss, "HostNQN", nvme_host_get_hostnqn(h)); hostid = nvme_host_get_hostid(h); if (hostid) - json_object_add_value_string(hss, "HostID", hostid); + obj_add_str(hss, "HostID", hostid); nvme_for_each_subsystem(h , s) { struct json_object *jss = json_create_object(); struct json_object *jctrls = json_create_array(); struct json_object *jnss = json_create_array(); - json_object_add_value_string(jss, "Subsystem", nvme_subsystem_get_name(s)); - json_object_add_value_string(jss, "SubsystemNQN", nvme_subsystem_get_nqn(s)); + obj_add_str(jss, "Subsystem", nvme_subsystem_get_name(s)); + obj_add_str(jss, "SubsystemNQN", nvme_subsystem_get_nqn(s)); nvme_subsystem_for_each_ctrl(s, c) { struct json_object *jctrl = json_create_object(); struct json_object *jnss = json_create_array(); struct json_object *jpaths = json_create_array(); - json_object_add_value_string(jctrl, "Controller", nvme_ctrl_get_name(c)); - json_object_add_value_string(jctrl, "SerialNumber", nvme_ctrl_get_serial(c)); - json_object_add_value_string(jctrl, "ModelNumber", nvme_ctrl_get_model(c)); - json_object_add_value_string(jctrl, "Firmware", nvme_ctrl_get_firmware(c)); - json_object_add_value_string(jctrl, "Transport", nvme_ctrl_get_transport(c)); - json_object_add_value_string(jctrl, "Address", nvme_ctrl_get_address(c)); - json_object_add_value_string(jctrl, "Slot", nvme_ctrl_get_phy_slot(c)); + obj_add_str(jctrl, "Controller", nvme_ctrl_get_name(c)); + obj_add_str(jctrl, "SerialNumber", nvme_ctrl_get_serial(c)); + obj_add_str(jctrl, "ModelNumber", nvme_ctrl_get_model(c)); + obj_add_str(jctrl, "Firmware", nvme_ctrl_get_firmware(c)); + obj_add_str(jctrl, "Transport", nvme_ctrl_get_transport(c)); + obj_add_str(jctrl, "Address", nvme_ctrl_get_address(c)); + obj_add_str(jctrl, "Slot", nvme_ctrl_get_phy_slot(c)); nvme_ctrl_for_each_ns(c, n) { struct json_object *jns = json_create_object(); @@ -2535,31 +3889,31 @@ static void json_detail_list(nvme_root_t r) uint64_t nsze = nvme_ns_get_lba_count(n) * lba; uint64_t nuse = nvme_ns_get_lba_util(n) * lba; - json_object_add_value_string(jns, "NameSpace", nvme_ns_get_name(n)); - json_object_add_value_string(jns, "Generic", nvme_ns_get_generic_name(n)); - json_object_add_value_int(jns, "NSID", nvme_ns_get_nsid(n)); - json_object_add_value_uint64(jns, "UsedBytes", nuse); - json_object_add_value_uint64(jns, "MaximumLBA", nvme_ns_get_lba_count(n)); - json_object_add_value_uint64(jns, "PhysicalSize", nsze); - json_object_add_value_int(jns, "SectorSize", lba); + obj_add_str(jns, "NameSpace", nvme_ns_get_name(n)); + obj_add_str(jns, "Generic", nvme_ns_get_generic_name(n)); + obj_add_int(jns, "NSID", nvme_ns_get_nsid(n)); + obj_add_uint64(jns, "UsedBytes", nuse); + obj_add_uint64(jns, "MaximumLBA", nvme_ns_get_lba_count(n)); + obj_add_uint64(jns, "PhysicalSize", nsze); + obj_add_int(jns, "SectorSize", lba); - json_array_add_value_object(jnss, jns); + array_add_obj(jnss, jns); } - json_object_add_value_object(jctrl, "Namespaces", jnss); + obj_add_obj(jctrl, "Namespaces", jnss); nvme_ctrl_for_each_path(c, p) { struct json_object *jpath = json_create_object(); - json_object_add_value_string(jpath, "Path", nvme_path_get_name(p)); - json_object_add_value_string(jpath, "ANAState", nvme_path_get_ana_state(p)); + obj_add_str(jpath, "Path", nvme_path_get_name(p)); + obj_add_str(jpath, "ANAState", nvme_path_get_ana_state(p)); - json_array_add_value_object(jpaths, jpath); + array_add_obj(jpaths, jpath); } - json_object_add_value_object(jctrl, "Paths", jpaths); + obj_add_obj(jctrl, "Paths", jpaths); - json_array_add_value_object(jctrls, jctrl); + array_add_obj(jctrls, jctrl); } - json_object_add_value_object(jss, "Controllers", jctrls); + obj_add_obj(jss, "Controllers", jctrls); nvme_subsystem_for_each_ns(s, n) { struct json_object *jns = json_create_object(); @@ -2568,36 +3922,35 @@ static void json_detail_list(nvme_root_t r) uint64_t nsze = nvme_ns_get_lba_count(n) * lba; uint64_t nuse = nvme_ns_get_lba_util(n) * lba; - json_object_add_value_string(jns, "NameSpace", nvme_ns_get_name(n)); - json_object_add_value_string(jns, "Generic", nvme_ns_get_generic_name(n)); - json_object_add_value_int(jns, "NSID", nvme_ns_get_nsid(n)); - json_object_add_value_uint64(jns, "UsedBytes", nuse); - json_object_add_value_uint64(jns, "MaximumLBA", nvme_ns_get_lba_count(n)); - json_object_add_value_uint64(jns, "PhysicalSize", nsze); - json_object_add_value_int(jns, "SectorSize", lba); + obj_add_str(jns, "NameSpace", nvme_ns_get_name(n)); + obj_add_str(jns, "Generic", nvme_ns_get_generic_name(n)); + obj_add_int(jns, "NSID", nvme_ns_get_nsid(n)); + obj_add_uint64(jns, "UsedBytes", nuse); + obj_add_uint64(jns, "MaximumLBA", nvme_ns_get_lba_count(n)); + obj_add_uint64(jns, "PhysicalSize", nsze); + obj_add_int(jns, "SectorSize", lba); - json_array_add_value_object(jnss, jns); + array_add_obj(jnss, jns); } - json_object_add_value_object(jss, "Namespaces", jnss); + obj_add_obj(jss, "Namespaces", jnss); - json_array_add_value_object(jsslist, jss); + array_add_obj(jsslist, jss); } - json_object_add_value_object(hss, "Subsystems", jsslist); - json_array_add_value_object(jdev, hss); + obj_add_obj(hss, "Subsystems", jsslist); + array_add_obj(jdev, hss); } - json_object_add_value_array(jroot, "Devices", jdev); - json_print_object(jroot, NULL); - printf("\n"); - json_free_object(jroot); + + obj_add_array(r, "Devices", jdev); + + json_print(r); } -static struct json_object *json_list_item(nvme_ns_t n) +static struct json_object *json_list_item_obj(nvme_ns_t n) { - struct json_object *jdevice = json_create_object(); - char devname[128] = { 0 }; - char genname[128] = { 0 }; - + struct json_object *r = json_create_object(); + char devname[NAME_LEN] = { 0 }; + char genname[NAME_LEN] = { 0 }; int lba = nvme_ns_get_lba_size(n); uint64_t nsze = nvme_ns_get_lba_count(n) * lba; uint64_t nuse = nvme_ns_get_lba_util(n) * lba; @@ -2605,23 +3958,23 @@ static struct json_object *json_list_item(nvme_ns_t n) nvme_dev_full_path(n, devname, sizeof(devname)); nvme_generic_full_path(n, genname, sizeof(genname)); - json_object_add_value_int(jdevice, "NameSpace", nvme_ns_get_nsid(n)); - json_object_add_value_string(jdevice, "DevicePath", devname); - json_object_add_value_string(jdevice, "GenericPath", genname); - json_object_add_value_string(jdevice, "Firmware", nvme_ns_get_firmware(n)); - json_object_add_value_string(jdevice, "ModelNumber", nvme_ns_get_model(n)); - json_object_add_value_string(jdevice, "SerialNumber", nvme_ns_get_serial(n)); - json_object_add_value_uint64(jdevice, "UsedBytes", nuse); - json_object_add_value_uint64(jdevice, "MaximumLBA", nvme_ns_get_lba_count(n)); - json_object_add_value_uint64(jdevice, "PhysicalSize", nsze); - json_object_add_value_int(jdevice, "SectorSize", lba); - - return jdevice; + obj_add_int(r, "NameSpace", nvme_ns_get_nsid(n)); + obj_add_str(r, "DevicePath", devname); + obj_add_str(r, "GenericPath", genname); + obj_add_str(r, "Firmware", nvme_ns_get_firmware(n)); + obj_add_str(r, "ModelNumber", nvme_ns_get_model(n)); + obj_add_str(r, "SerialNumber", nvme_ns_get_serial(n)); + obj_add_uint64(r, "UsedBytes", nuse); + obj_add_uint64(r, "MaximumLBA", nvme_ns_get_lba_count(n)); + obj_add_uint64(r, "PhysicalSize", nsze); + obj_add_int(r, "SectorSize", lba); + + return r; } -static void json_simple_list(nvme_root_t r) +static void json_simple_list(nvme_root_t t) { - struct json_object *jroot = json_create_object(); + struct json_object *r = json_create_object(); struct json_object *jdevices = json_create_array(); nvme_host_t h; @@ -2629,30 +3982,35 @@ static void json_simple_list(nvme_root_t r) nvme_ctrl_t c; nvme_ns_t n; - nvme_for_each_host(r, h) { + nvme_for_each_host(t, h) { nvme_for_each_subsystem(h, s) { nvme_subsystem_for_each_ns(s, n) - json_array_add_value_object(jdevices, - json_list_item(n)); + array_add_obj(jdevices, json_list_item_obj(n)); nvme_subsystem_for_each_ctrl(s, c) nvme_ctrl_for_each_ns(c, n) - json_array_add_value_object(jdevices, - json_list_item(n)); + array_add_obj(jdevices, json_list_item_obj(n)); } } - json_object_add_value_array(jroot, "Devices", jdevices); - json_print_object(jroot, NULL); - printf("\n"); - json_free_object(jroot); + + obj_add_array(r, "Devices", jdevices); + + json_print(r); } -static void json_print_list_items(nvme_root_t r) +static void json_list_item(nvme_ns_t n) +{ + struct json_object *r = json_list_item_obj(n); + + json_print(r); +} + +static void json_print_list_items(nvme_root_t t) { if (json_print_ops.flags & VERBOSE) - json_detail_list(r); + json_detail_list(t); else - json_simple_list(r); + json_simple_list(t); } static unsigned int json_subsystem_topology_multipath(nvme_subsystem_t s, @@ -2667,8 +4025,7 @@ static unsigned int json_subsystem_topology_multipath(nvme_subsystem_t s, struct json_object *paths; ns_attrs = json_create_object(); - json_object_add_value_int(ns_attrs, "NSID", - nvme_ns_get_nsid(n)); + obj_add_int(ns_attrs, "NSID", nvme_ns_get_nsid(n)); paths = json_create_array(); nvme_namespace_for_each_path(n, p) { @@ -2677,20 +4034,15 @@ static unsigned int json_subsystem_topology_multipath(nvme_subsystem_t s, nvme_ctrl_t c = nvme_path_get_ctrl(p); path_attrs = json_create_object(); - json_object_add_value_string(path_attrs, "Name", - nvme_ctrl_get_name(c)); - json_object_add_value_string(path_attrs, "Transport", - nvme_ctrl_get_transport(c)); - json_object_add_value_string(path_attrs, "Address", - nvme_ctrl_get_address(c)); - json_object_add_value_string(path_attrs, "State", - nvme_ctrl_get_state(c)); - json_object_add_value_string(path_attrs, "ANAState", - nvme_path_get_ana_state(p)); - json_array_add_value_object(paths, path_attrs); + obj_add_str(path_attrs, "Name", nvme_ctrl_get_name(c)); + obj_add_str(path_attrs, "Transport", nvme_ctrl_get_transport(c)); + obj_add_str(path_attrs, "Address", nvme_ctrl_get_address(c)); + obj_add_str(path_attrs, "State", nvme_ctrl_get_state(c)); + obj_add_str(path_attrs, "ANAState", nvme_path_get_ana_state(p)); + array_add_obj(paths, path_attrs); } - json_object_add_value_array(ns_attrs, "Paths", paths); - json_array_add_value_object(namespaces, ns_attrs); + obj_add_array(ns_attrs, "Paths", paths); + array_add_obj(namespaces, ns_attrs); i++; } @@ -2710,23 +4062,22 @@ static void json_print_nvme_subsystem_topology(nvme_subsystem_t s, struct json_object *ctrl; ns_attrs = json_create_object(); - json_object_add_value_int(ns_attrs, "NSID", - nvme_ns_get_nsid(n)); + obj_add_int(ns_attrs, "NSID", nvme_ns_get_nsid(n)); - ctrl = json_create_array(); + ctrl = json_create_array(); ctrl_attrs = json_create_object(); - json_object_add_value_string(ctrl_attrs, "Name", + obj_add_str(ctrl_attrs, "Name", nvme_ctrl_get_name(c)); - json_object_add_value_string(ctrl_attrs, "Transport", + obj_add_str(ctrl_attrs, "Transport", nvme_ctrl_get_transport(c)); - json_object_add_value_string(ctrl_attrs, "Address", + obj_add_str(ctrl_attrs, "Address", nvme_ctrl_get_address(c)); - json_object_add_value_string(ctrl_attrs, "State", + obj_add_str(ctrl_attrs, "State", nvme_ctrl_get_state(c)); - json_array_add_value_object(ctrl, ctrl_attrs); - json_object_add_value_array(ns_attrs, "Controller", ctrl); - json_array_add_value_object(namespaces, ns_attrs); + array_add_obj(ctrl, ctrl_attrs); + obj_add_array(ns_attrs, "Controller", ctrl); + array_add_obj(namespaces, ns_attrs); } } } @@ -2735,128 +4086,233 @@ static void json_simple_topology(nvme_root_t r) { struct json_object *host_attrs, *subsystem_attrs; struct json_object *subsystems, *namespaces; - struct json_object *root; + struct json_object *a = json_create_array(); nvme_host_t h; - root = json_create_array(); - nvme_for_each_host(r, h) { nvme_subsystem_t s; const char *hostid; host_attrs = json_create_object(); - json_object_add_value_string(host_attrs, "HostNQN", - nvme_host_get_hostnqn(h)); + obj_add_str(host_attrs, "HostNQN", nvme_host_get_hostnqn(h)); hostid = nvme_host_get_hostid(h); if (hostid) - json_object_add_value_string(host_attrs, "HostID", hostid); + obj_add_str(host_attrs, "HostID", hostid); subsystems = json_create_array(); nvme_for_each_subsystem(h, s) { subsystem_attrs = json_create_object(); - json_object_add_value_string(subsystem_attrs, "Name", - nvme_subsystem_get_name(s)); - json_object_add_value_string(subsystem_attrs, "NQN", - nvme_subsystem_get_nqn(s)); + obj_add_str(subsystem_attrs, "Name", nvme_subsystem_get_name(s)); + obj_add_str(subsystem_attrs, "NQN", nvme_subsystem_get_nqn(s)); + obj_add_str(subsystem_attrs, "IOPolicy", nvme_subsystem_get_iopolicy(s)); - json_array_add_value_object(subsystems, subsystem_attrs); + array_add_obj(subsystems, subsystem_attrs); namespaces = json_create_array(); if (!json_subsystem_topology_multipath(s, namespaces)) json_print_nvme_subsystem_topology(s, namespaces); - json_object_add_value_array(subsystem_attrs, "Namespaces", - namespaces); + obj_add_array(subsystem_attrs, "Namespaces", namespaces); } - json_object_add_value_array(host_attrs, "Subsystems", subsystems); - json_array_add_value_object(root, host_attrs); + obj_add_array(host_attrs, "Subsystems", subsystems); + array_add_obj(a, host_attrs); + } + + json_print(a); +} + +static void json_directive_show_fields_identify(__u8 doper, __u8 *field, struct json_object *r) +{ + struct json_object *support; + struct json_object *enabled; + struct json_object *persistent; + + switch (doper) { + case NVME_DIRECTIVE_RECEIVE_IDENTIFY_DOPER_PARAM: + support = json_create_array(); + obj_add_array(r, "Directive support", support); + obj_add_str(support, "Identify Directive", + *field & 0x1 ? "Supported" : "Not supported"); + obj_add_str(support, "Stream Directive", + *field & 0x2 ? "Supported" : "Not supported"); + obj_add_str(support, "Data Placement Directive", + *field & 0x4 ? "Supported" : "Not supported"); + enabled = json_create_array(); + obj_add_array(r, "Directive enabled", enabled); + obj_add_str(enabled, "Identify Directive", + *(field + 32) & 0x1 ? "Enabled" : "Disabled"); + obj_add_str(enabled, "Stream Directive", + *(field + 32) & 0x2 ? "Enabled" : "Disabled"); + obj_add_str(enabled, "Data Placement Directive", + *(field + 32) & 0x4 ? "Enabled" : "Disabled"); + persistent = json_create_array(); + obj_add_array(r, "Directive Persistent Across Controller Level Resets", + persistent); + obj_add_str(persistent, "Identify Directive", + *(field + 32) & 0x1 ? "Enabled" : "Disabled"); + obj_add_str(persistent, "Stream Directive", + *(field + 32) & 0x2 ? "Enabled" : "Disabled"); + obj_add_str(persistent, "Data Placement Directive", + *(field + 32) & 0x4 ? "Enabled" : "Disabled"); + break; + default: + obj_add_str(r, "Error", "invalid directive operations for Identify Directives"); + break; + } +} + +static void json_directive_show_fields_streams(__u8 doper, unsigned int result, __u16 *field, + struct json_object *r) +{ + int count; + int i; + char json_str[STR_LEN]; + + switch (doper) { + case NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_PARAM: + obj_add_uint(r, "Max Streams Limit (MSL)", le16_to_cpu(*field)); + obj_add_uint(r, "NVM Subsystem Streams Available (NSSA)", le16_to_cpu(*(field + 2))); + obj_add_uint(r, "NVM Subsystem Streams Open (NSSO)", le16_to_cpu(*(field + 4))); + obj_add_uint(r, "NVM Subsystem Stream Capability (NSSC)", le16_to_cpu(*(field + 6))); + obj_add_uint(r, "Stream Write Size (in unit of LB size) (SWS)", + le16_to_cpu(*(__u32 *)(field + 16))); + obj_add_uint(r, "Stream Granularity Size (in unit of SWS) (SGS)", + le16_to_cpu(*(field + 20))); + obj_add_uint(r, "Namespace Streams Allocated (NSA)", le16_to_cpu(*(field + 22))); + obj_add_uint(r, "Namespace Streams Open (NSO)", le16_to_cpu(*(field + 24))); + break; + case NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_STATUS: + count = *field; + obj_add_uint(r, "Open Stream Count", le16_to_cpu(*field)); + for (i = 0; i < count; i++) { + sprintf(json_str, "Stream Identifier %.6u", i + 1); + obj_add_uint(r, json_str, le16_to_cpu(*(field + (i + 1) * 2))); + } + break; + case NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_RESOURCE: + obj_add_uint(r, "Namespace Streams Allocated (NSA)", result & 0xffff); + break; + default: + obj_add_str(r, "Error", + "invalid directive operations for Streams Directives"); + break; + } +} + +static void json_directive_show_fields(__u8 dtype, __u8 doper, unsigned int result, + __u8 *field, struct json_object *r) +{ + switch (dtype) { + case NVME_DIRECTIVE_DTYPE_IDENTIFY: + json_directive_show_fields_identify(doper, field, r); + break; + case NVME_DIRECTIVE_DTYPE_STREAMS: + json_directive_show_fields_streams(doper, result, (__u16 *)field, r); + break; + default: + obj_add_str(r, "Error", "invalid directive type"); + break; } - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); +} + +static void json_directive_show(__u8 type, __u8 oper, __u16 spec, __u32 nsid, __u32 result, + void *buf, __u32 len) +{ + struct json_object *r = json_create_object(); + struct json_object *data; + char json_str[STR_LEN]; + + sprintf(json_str, "%#x", type); + obj_add_str(r, "Type", json_str); + sprintf(json_str, "%#x", oper); + obj_add_str(r, "Operation", json_str); + sprintf(json_str, "%#x", spec); + obj_add_str(r, "spec", json_str); + sprintf(json_str, "%#x", nsid); + obj_add_str(r, "NSID", json_str); + sprintf(json_str, "%#x", result); + obj_add_result(r, json_str); + + if (json_print_ops.flags & VERBOSE) { + json_directive_show_fields(type, oper, result, buf, r); + } else if (buf) { + data = json_create_array(); + d_json((unsigned char *)buf, len, 16, 1, data); + obj_add_array(r, "data", data); + } + + json_print(r); } static void json_discovery_log(struct nvmf_discovery_log *log, int numrec) { - struct json_object *root; - struct json_object *entries; + struct json_object *r = json_create_object(); + struct json_object *entries = json_create_array(); int i; - root = json_create_object(); - entries = json_create_array(); - json_object_add_value_uint64(root, "genctr", le64_to_cpu(log->genctr)); - json_object_add_value_array(root, "records", entries); + obj_add_uint64(r, "genctr", le64_to_cpu(log->genctr)); + obj_add_array(r, "records", entries); for (i = 0; i < numrec; i++) { struct nvmf_disc_log_entry *e = &log->entries[i]; struct json_object *entry = json_create_object(); - json_object_add_value_string(entry, "trtype", - nvmf_trtype_str(e->trtype)); - json_object_add_value_string(entry, "adrfam", - nvmf_adrfam_str(e->adrfam)); - json_object_add_value_string(entry, "subtype", - nvmf_subtype_str(e->subtype)); - json_object_add_value_string(entry,"treq", - nvmf_treq_str(e->treq)); - json_object_add_value_uint(entry, "portid", - le16_to_cpu(e->portid)); - json_object_add_value_string(entry, "trsvcid", e->trsvcid); - json_object_add_value_string(entry, "subnqn", e->subnqn); - json_object_add_value_string(entry, "traddr", e->traddr); - json_object_add_value_string(entry, "eflags", - nvmf_eflags_str(le16_to_cpu(e->eflags))); + obj_add_str(entry, "trtype", nvmf_trtype_str(e->trtype)); + obj_add_str(entry, "adrfam", nvmf_adrfam_str(e->adrfam)); + obj_add_str(entry, "subtype", nvmf_subtype_str(e->subtype)); + obj_add_str(entry,"treq", nvmf_treq_str(e->treq)); + obj_add_uint(entry, "portid", le16_to_cpu(e->portid)); + obj_add_str(entry, "trsvcid", e->trsvcid); + obj_add_str(entry, "subnqn", e->subnqn); + obj_add_str(entry, "traddr", e->traddr); + obj_add_str(entry, "eflags", nvmf_eflags_str(le16_to_cpu(e->eflags))); switch (e->trtype) { case NVMF_TRTYPE_RDMA: - json_object_add_value_string(entry, "rdma_prtype", - nvmf_prtype_str(e->tsas.rdma.prtype)); - json_object_add_value_string(entry, "rdma_qptype", - nvmf_qptype_str(e->tsas.rdma.qptype)); - json_object_add_value_string(entry, "rdma_cms", - nvmf_cms_str(e->tsas.rdma.cms)); - json_object_add_value_uint(entry, "rdma_pkey", - le16_to_cpu(e->tsas.rdma.pkey)); + obj_add_str(entry, "rdma_prtype", nvmf_prtype_str(e->tsas.rdma.prtype)); + obj_add_str(entry, "rdma_qptype", nvmf_qptype_str(e->tsas.rdma.qptype)); + obj_add_str(entry, "rdma_cms", nvmf_cms_str(e->tsas.rdma.cms)); + obj_add_uint(entry, "rdma_pkey", le16_to_cpu(e->tsas.rdma.pkey)); break; case NVMF_TRTYPE_TCP: - json_object_add_value_string(entry, "sectype", - nvmf_sectype_str(e->tsas.tcp.sectype)); + obj_add_str(entry, "sectype", nvmf_sectype_str(e->tsas.tcp.sectype)); + break; + default: break; } - json_array_add_value_object(entries, entry); + array_add_obj(entries, entry); } - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + + json_print(r); } static void json_connect_msg(nvme_ctrl_t c) { - struct json_object *root; + struct json_object *r = json_create_object(); - root = json_create_object(); - json_object_add_value_string(root, "device", nvme_ctrl_get_name(c)); + obj_add_str(r, "device", nvme_ctrl_get_name(c)); - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + json_print(r); } -static void json_output_object(struct json_object *root) +static void json_output_object(struct json_object *r) { - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); + json_print(r); } static void json_output_status(int status) { - struct json_object *root = json_create_object(); + struct json_object *r; + char json_str[STR_LEN]; int val; int type; + sprintf(json_str, "status: %d", status); + r = obj_create(json_str); + if (status < 0) { - json_object_add_value_string(root, "error", nvme_strerror(errno)); - return json_output_object(root); + obj_add_str(r, "error", nvme_strerror(errno)); + json_print(r); + return; } val = nvme_status_get_value(status); @@ -2864,65 +4320,119 @@ static void json_output_status(int status) switch (type) { case NVME_STATUS_TYPE_NVME: - json_object_add_value_string(root, "error", nvme_status_to_string(val, false)); - json_object_add_value_string(root, "type", "nvme"); + obj_add_str(r, "error", nvme_status_to_string(val, false)); + obj_add_str(r, "type", "nvme"); break; case NVME_STATUS_TYPE_MI: - json_object_add_value_string(root, "error", nvme_mi_status_to_string(val)); - json_object_add_value_string(root, "type", "nvme-mi"); + obj_add_str(r, "error", nvme_mi_status_to_string(val)); + obj_add_str(r, "type", "nvme-mi"); break; default: - json_object_add_value_string(root, "type", "unknow"); + obj_add_str(r, "type", "Unknown"); break; } - json_object_add_value_int(root, "value", val); + json_print(r); +} + +static void json_output_error_status(int status, const char *msg, va_list ap) +{ + struct json_object *r; + char json_str[STR_LEN]; + char *value; + int val; + int type; - json_output_object(root); + if (vasprintf(&value, msg, ap) < 0) + value = NULL; + + sprintf(json_str, "Error: %s", value ? value : "Could not allocate string"); + r = obj_create(json_str); + + free(value); + + if (status < 0) { + obj_add_str(r, "error", nvme_strerror(errno)); + json_print(r); + return; + } + + val = nvme_status_get_value(status); + type = nvme_status_get_type(status); + + switch (type) { + case NVME_STATUS_TYPE_NVME: + obj_add_str(r, "status", nvme_status_to_string(val, false)); + obj_add_str(r, "type", "nvme"); + break; + case NVME_STATUS_TYPE_MI: + obj_add_str(r, "status", nvme_mi_status_to_string(val)); + obj_add_str(r, "type", "nvme-mi"); + break; + default: + obj_add_str(r, "type", "Unknown"); + break; + } + + obj_add_int(r, "value", val); + + json_print(r); } static void json_output_message(bool error, const char *msg, va_list ap) { - struct json_object *root = json_create_object(); + struct json_object *r = json_r ? json_r : json_create_object(); char *value; - const char *key = error ? "error" : "result"; if (vasprintf(&value, msg, ap) < 0) value = NULL; - if (value) - json_object_add_value_string(root, key, value); - else - json_object_add_value_string(root, key, "Could not allocate string"); - - json_output_object(root); + obj_add_str(r, error ? "error" : "result", value ? value : "Could not allocate string"); free(value); + + json_print(r); } static void json_output_perror(const char *msg) { - struct json_object *root = json_create_object(); + struct json_object *r = json_create_object(); char *error; if (asprintf(&error, "%s: %s", msg, strerror(errno)) < 0) error = NULL; if (error) - json_object_add_value_string(root, "error", error); + obj_add_str(r, "error", error); else - json_object_add_value_string(root, "error", "Could not allocate string"); + obj_add_str(r, "error", "Could not allocate string"); - json_output_object(root); + json_output_object(r); free(error); } +void json_show_init(void) +{ + json_r = json_create_object(); +} + +void json_show_finish(void) +{ + if (json_r) + json_output_object(json_r); + + json_r = NULL; +} + static struct print_ops json_print_ops = { + /* libnvme types.h print functions */ .ana_log = json_ana_log, .boot_part_log = json_boot_part_log, + .phy_rx_eom_log = json_phy_rx_eom_log, .ctrl_list = json_nvme_list_ctrl, .ctrl_registers = json_ctrl_registers, + .directive = json_directive_show, .discovery_log = json_discovery_log, .effects_log_list = json_effects_log_list, .endurance_group_event_agg_log = json_endurance_group_event_agg_log, @@ -2937,20 +4447,22 @@ static struct print_ops json_print_ops = { .fid_supported_effects_log = json_fid_support_effects_log, .fw_log = json_fw_log, .id_ctrl = json_nvme_id_ctrl, - .ns_list = json_nvme_list_ns, - .nvm_id_ns = json_nvme_nvm_id_ns, .id_ctrl_nvm = json_nvme_id_ctrl_nvm, .id_domain_list = json_id_domain_list, .id_independent_id_ns = json_nvme_cmd_set_independent_id_ns, + .id_iocs = json_id_iocs, .id_ns = json_nvme_id_ns, .id_ns_descs = json_nvme_id_ns_descs, .id_ns_granularity_list = json_nvme_id_ns_granularity_list, .id_nvmset_list = json_nvme_id_nvmset, .id_uuid_list = json_nvme_id_uuid_list, + .lba_status = json_lba_status, .lba_status_log = json_lba_status_log, .media_unit_stat_log = json_media_unit_stat_log, .mi_cmd_support_effects_log = json_mi_cmd_support_effects_log, + .ns_list = json_nvme_list_ns, .ns_list_log = json_changed_ns_list_log, + .nvm_id_ns = json_nvme_nvm_id_ns, .persistent_event_log = json_persistent_event_log, .predictable_latency_event_agg_log = json_predictable_latency_event_agg_log, .predictable_latency_per_nvmset = json_predictable_latency_per_nvmset, @@ -2959,25 +4471,40 @@ static struct print_ops json_print_ops = { .resv_report = json_nvme_resv_report, .sanitize_log_page = json_sanitize_log, .secondary_ctrl_list = json_nvme_list_secondary_ctrl, + .select_result = json_select_result, .self_test_log = json_self_test_log, + .single_property = json_single_property, .smart_log = json_smart_log, .supported_cap_config_list_log = json_supported_cap_config_log, .supported_log_pages = json_support_log, - .zns_changed_zone_log = NULL, - .zns_report_zones = json_nvme_zns_report_zones, + .zns_start_zone_list = json_zns_start_zone_list, + .zns_changed_zone_log = json_zns_changed, .zns_finish_zone_list = json_zns_finish_zone_list, .zns_id_ctrl = json_nvme_zns_id_ctrl, .zns_id_ns = json_nvme_zns_id_ns, - + .zns_report_zones = json_nvme_zns_report_zones, + .show_feature = json_feature_show, + .show_feature_fields = json_feature_show_fields, + .id_ctrl_rpmbs = json_id_ctrl_rpmbs, + .lba_range = json_lba_range, + .lba_status_info = json_lba_status_info, + .d = json_d, + .show_init = json_show_init, + .show_finish = json_show_finish, + + /* libnvme tree print functions */ + .list_item = json_list_item, .list_items = json_print_list_items, .print_nvme_subsystem_list = json_print_nvme_subsystem_list, .topology_ctrl = json_simple_topology, .topology_namespace = json_simple_topology, + /* status and error messages */ .connect_msg = json_connect_msg, .show_message = json_output_message, .show_perror = json_output_perror, .show_status = json_output_status, + .show_error_status = json_output_error_status, }; struct print_ops *nvme_get_json_print_ops(enum nvme_print_flags flags) diff --git a/nvme-print-stdout.c b/nvme-print-stdout.c index 877ba75..e3c9a74 100644 --- a/nvme-print-stdout.c +++ b/nvme-print-stdout.c @@ -7,6 +7,11 @@ #include <time.h> #include <sys/stat.h> +#include <ccan/ccan/strset/strset.h> +#include <ccan/ccan/htable/htable_type.h> +#include <ccan/ccan/htable/htable.h> +#include <ccan/ccan/hash/hash.h> + #include "nvme.h" #include "libnvme.h" #include "nvme-print.h" @@ -21,15 +26,139 @@ static const char dash[100] = {[0 ... 99] = '-'}; static struct print_ops stdout_print_ops; -struct nvme_bar_cap { - __u16 mqes; - __u8 ams_cqr; - __u8 to; - __u16 bps_css_nssrs_dstrd; - __u8 mpsmax_mpsmin; - __u8 rsvd_crms_nsss_cmbs_pmrs; +static const char *subsys_key(const struct nvme_subsystem *s) +{ + return nvme_subsystem_get_name((nvme_subsystem_t)s); +} + +static const char *ctrl_key(const struct nvme_ctrl *c) +{ + return nvme_ctrl_get_name((nvme_ctrl_t)c); +} + +static const char *ns_key(const struct nvme_ns *n) +{ + return nvme_ns_get_name((nvme_ns_t)n); +} + +static bool subsys_cmp(const struct nvme_subsystem *s, const char *name) +{ + return !strcmp(nvme_subsystem_get_name((nvme_subsystem_t)s), name); +} + +static bool ctrl_cmp(const struct nvme_ctrl *c, const char *name) +{ + return !strcmp(nvme_ctrl_get_name((nvme_ctrl_t)c), name); +} + +static bool ns_cmp(const struct nvme_ns *n, const char *name) +{ + return !strcmp(nvme_ns_get_name((nvme_ns_t)n), name); +} + +HTABLE_DEFINE_TYPE(struct nvme_subsystem, subsys_key, hash_string, + subsys_cmp, htable_subsys); +HTABLE_DEFINE_TYPE(struct nvme_ctrl, ctrl_key, hash_string, + ctrl_cmp, htable_ctrl); +HTABLE_DEFINE_TYPE(struct nvme_ns, ns_key, hash_string, + ns_cmp, htable_ns); + +static void htable_ctrl_add_unique(struct htable_ctrl *ht, nvme_ctrl_t c) +{ + if (htable_ctrl_get(ht, nvme_ctrl_get_name(c))) + return; + + htable_ctrl_add(ht, c); +} + +static void htable_ns_add_unique(struct htable_ns *ht, nvme_ns_t n) +{ + struct htable_ns_iter it; + nvme_ns_t _n; + + /* + * Test if namespace pointer is already in the hash, and thus avoid + * inserting severaltimes the same pointer. + */ + for (_n = htable_ns_getfirst(ht, nvme_ns_get_name(n), &it); + _n; + _n = htable_ns_getnext(ht, nvme_ns_get_name(n), &it)) { + if (_n == n) + return; + } + htable_ns_add(ht, n); +} + +struct nvme_resources { + nvme_root_t r; + + struct htable_subsys ht_s; + struct htable_ctrl ht_c; + struct htable_ns ht_n; + struct strset subsystems; + struct strset ctrls; + struct strset namespaces; }; +static int nvme_resources_init(nvme_root_t r, struct nvme_resources *res) +{ + nvme_host_t h; + nvme_subsystem_t s; + nvme_ctrl_t c; + nvme_ns_t n; + nvme_path_t p; + + res->r = r; + htable_subsys_init(&res->ht_s); + htable_ctrl_init(&res->ht_c); + htable_ns_init(&res->ht_n); + strset_init(&res->subsystems); + strset_init(&res->ctrls); + strset_init(&res->namespaces); + + nvme_for_each_host(r, h) { + nvme_for_each_subsystem(h, s) { + htable_subsys_add(&res->ht_s, s); + strset_add(&res->subsystems, nvme_subsystem_get_name(s)); + + nvme_subsystem_for_each_ctrl(s, c) { + htable_ctrl_add_unique(&res->ht_c, c); + strset_add(&res->ctrls, nvme_ctrl_get_name(c)); + + nvme_ctrl_for_each_ns(c, n) { + htable_ns_add_unique(&res->ht_n, n); + strset_add(&res->namespaces, nvme_ns_get_name(n)); + } + + nvme_ctrl_for_each_path(c, p) { + n = nvme_path_get_ns(p); + if (n) { + htable_ns_add_unique(&res->ht_n, n); + strset_add(&res->namespaces, nvme_ns_get_name(n)); + } + } + } + + nvme_subsystem_for_each_ns(s, n) { + htable_ns_add_unique(&res->ht_n, n); + strset_add(&res->namespaces, nvme_ns_get_name(n)); + } + } + } + + return 0; +} + +static void nvme_resources_free(struct nvme_resources *res) +{ + strset_clear(&res->namespaces); + strset_clear(&res->ctrls); + strset_clear(&res->subsystems); + htable_ns_clear(&res->ht_n); + htable_ctrl_clear(&res->ht_c); + htable_subsys_clear(&res->ht_s); +} + static void stdout_feature_show_fields(enum nvme_features_id fid, unsigned int result, unsigned char *buf); @@ -388,6 +517,7 @@ static void stdout_persistent_event_log(void *pevent_log_info, break; default: printf("Reserved Event\n\n"); + break; } offset += le16_to_cpu(pevent_entry_head->el); printf("\n"); @@ -567,6 +697,112 @@ static void stdout_boot_part_log(void *bp_log, const char *devname, printf("Active BPID: %u\n", (le32_to_cpu(hdr->bpinfo) >> 31) & 0x1); } +static const char *eomip_to_string(__u8 eomip) +{ + const char *string; + switch (eomip) { + case NVME_PHY_RX_EOM_NOT_STARTED: + string = "Not Started"; + break; + case NVME_PHY_RX_EOM_IN_PROGRESS: + string = "In Progress"; + break; + case NVME_PHY_RX_EOM_COMPLETED: + string = "Completed"; + break; + default: + string = "Unknown"; + break; + } + return string; +} + +static void stdout_phy_rx_eom_odp(uint8_t odp) +{ + __u8 rsvd = (odp >> 2) & 0x3F; + __u8 edfp = (odp >> 1) & 0x1; + __u8 pefp = odp & 0x1; + + if (rsvd) + printf(" [7:2] : %#x\tReserved\n", rsvd); + printf(" [1:1] : %#x\tEye Data Field %sPresent\n", + edfp, edfp ? "" : "Not "); + printf(" [0:0] : %#x\tPrintable Eye Field %sPresent\n", + pefp, pefp ? "" : "Not "); +} + +static void stdout_eom_printable_eye(struct nvme_eom_lane_desc *lane) +{ + char *eye = (char *)lane->eye_desc; + int i, j; + for (i = 0; i < lane->nrows; i++) { + for (j = 0; j < lane->ncols; j++) + printf("%c", eye[i * lane->ncols + j]); + printf("\n"); + } +} + +static void stdout_phy_rx_eom_descs(struct nvme_phy_rx_eom_log *log) +{ + void *p = log->descs; + int i; + + for (i = 0; i < log->nd; i++) { + struct nvme_eom_lane_desc *desc = p; + + printf("Measurement Status: %s\n", + desc->mstatus ? "Successful" : "Not Successful"); + printf("Lane: %u\n", desc->lane); + printf("Eye: %u\n", desc->eye); + printf("Top: %u\n", le16_to_cpu(desc->top)); + printf("Bottom: %u\n", le16_to_cpu(desc->bottom)); + printf("Left: %u\n", le16_to_cpu(desc->left)); + printf("Right: %u\n", le16_to_cpu(desc->right)); + printf("Number of Rows: %u\n", le16_to_cpu(desc->nrows)); + printf("Number of Columns: %u\n", le16_to_cpu(desc->ncols)); + printf("Eye Data Length: %u\n", le16_to_cpu(desc->edlen)); + + if (log->odp & NVME_EOM_PRINTABLE_EYE_PRESENT) + stdout_eom_printable_eye(desc); + + /* Eye Data field is vendor specific */ + + p += log->dsize; + } +} + +static void stdout_phy_rx_eom_log(struct nvme_phy_rx_eom_log *log, __u16 controller) +{ + int human = stdout_print_ops.flags & VERBOSE; + + printf("Physical Interface Receiver Eye Opening Measurement Log for controller ID: %u\n", controller); + printf("Log ID: %u\n", log->lid); + printf("EOM In Progress: %s\n", eomip_to_string(log->eomip)); + printf("Header Size: %u\n", le16_to_cpu(log->hsize)); + printf("Result Size: %u\n", le32_to_cpu(log->rsize)); + printf("EOM Data Generation Number: %u\n", log->eomdgn); + printf("Log Revision: %u\n", log->lr); + printf("Optional Data Present: %u\n", log->odp); + if (human) + stdout_phy_rx_eom_odp(log->odp); + printf("Lanes: %u\n", log->lanes); + printf("Eyes Per Lane: %u\n", log->epl); + printf("Log Specific Parameter Field Copy: %u\n", log->lspfc); + printf("Link Information: %u\n", log->li); + printf("Log Specific Identifier Copy: %u\n", le16_to_cpu(log->lsic)); + printf("Descriptor Size: %u\n", le32_to_cpu(log->dsize)); + printf("Number of Descriptors: %u\n", le16_to_cpu(log->nd)); + printf("Maximum Top Bottom: %u\n", le16_to_cpu(log->maxtb)); + printf("Maximum Left Right: %u\n", le16_to_cpu(log->maxlr)); + printf("Estimated Time for Good Quality: %u\n", le16_to_cpu(log->etgood)); + printf("Estimated Time for Better Quality: %u\n", le16_to_cpu(log->etbetter)); + printf("Estimated Time for Best Quality: %u\n", le16_to_cpu(log->etbest)); + + if (log->eomip == NVME_PHY_RX_EOM_COMPLETED) { + stdout_phy_rx_eom_descs(log); + } +} + static void stdout_media_unit_stat_log(struct nvme_media_unit_stat_log *mus_log) { int i; @@ -597,7 +833,7 @@ static void stdout_media_unit_stat_log(struct nvme_media_unit_stat_log *mus_log) static void stdout_fdp_config_fdpa(uint8_t fdpa) { __u8 valid = (fdpa >> 7) & 0x1; - __u8 rsvd = (fdpa >> 5) >> 0x3; + __u8 rsvd = (fdpa >> 5) & 0x3; __u8 fdpvwc = (fdpa >> 4) & 0x1; __u8 rgif = fdpa & 0xf; @@ -826,13 +1062,24 @@ static void stdout_subsystem_ctrls(nvme_subsystem_t s) static void stdout_subsystem(nvme_root_t r, bool show_ana) { nvme_host_t h; + bool first = true; nvme_for_each_host(r, h) { nvme_subsystem_t s; nvme_for_each_subsystem(h, s) { + int len = strlen(nvme_subsystem_get_name(s)); + + if (!first) + printf("\n"); + first = false; + printf("%s - NQN=%s\n", nvme_subsystem_get_name(s), nvme_subsystem_get_nqn(s)); + printf("%*s hostnqn=%s\n", len, " ", + nvme_host_get_hostnqn(nvme_subsystem_get_host(s))); + printf("%*s iopolicy=%s\n", len, " ", + nvme_subsystem_get_iopolicy(s)); printf("\\\n"); if (!show_ana || !stdout_subsystem_multipath(s)) @@ -849,39 +1096,33 @@ static void stdout_subsystem_list(nvme_root_t r, bool show_ana) static void stdout_registers_cap(struct nvme_bar_cap *cap) { printf("\tController Ready With Media Support (CRWMS): %s\n", - ((cap->rsvd_crms_nsss_cmbs_pmrs & 0x08) >> 3) ? "Supported" : "Not Supported"); + cap->crwms ? "Supported" : "Not Supported"); printf("\tController Ready Independent of Media Support (CRIMS): %s\n", - ((cap->rsvd_crms_nsss_cmbs_pmrs & 0x10) >> 4) ? "Supported" : "Not Supported"); + cap->crims ? "Supported" : "Not Supported"); + printf("\tNVM Subsystem Shutdown Supported (NSSS): %s\n", cap->nsss ? "Supported" : "Not Supported"); printf("\tController Memory Buffer Supported (CMBS): The Controller Memory Buffer is %s\n", - ((cap->rsvd_crms_nsss_cmbs_pmrs & 0x02) >> 1) ? "Supported" : - "Not Supported"); + cap->cmbs ? "Supported" : "Not Supported"); printf("\tPersistent Memory Region Supported (PMRS): The Persistent Memory Region is %s\n", - (cap->rsvd_crms_nsss_cmbs_pmrs & 0x01) ? "Supported" : "Not Supported"); - printf("\tMemory Page Size Maximum (MPSMAX): %u bytes\n", - 1 << (12 + ((cap->mpsmax_mpsmin & 0xf0) >> 4))); - printf("\tMemory Page Size Minimum (MPSMIN): %u bytes\n", - 1 << (12 + (cap->mpsmax_mpsmin & 0x0f))); - printf("\tBoot Partition Support (BPS): %s\n", - (cap->bps_css_nssrs_dstrd & 0x2000) ? "Yes":"No"); + cap->pmrs ? "Supported" : "Not Supported"); + printf("\tMemory Page Size Maximum (MPSMAX): %u bytes\n", 1 << (12 + cap->mpsmax)); + printf("\tMemory Page Size Minimum (MPSMIN): %u bytes\n", 1 << (12 + cap->mpsmin)); + printf("\tController Power Scope (CPS): %s\n", + !cap->cps ? "Not Reported" : cap->cps == 1 ? "Controller scope" : + cap->cps == 2 ? "Domain scope" : "NVM subsystem scope"); + printf("\tBoot Partition Support (BPS): %s\n", cap->bps ? "Yes" : "No"); printf("\tCommand Sets Supported (CSS): NVM command set is %s\n", - (cap->bps_css_nssrs_dstrd & 0x0020) ? "Supported" : "Not Supported"); + cap->css & 0x01 ? "Supported" : "Not Supported"); printf("\t One or more I/O Command Sets are %s\n", - (cap->bps_css_nssrs_dstrd & 0x0800) ? "Supported" : "Not Supported"); + cap->css & 0x40 ? "Supported" : "Not Supported"); printf("\t %s\n", - (cap->bps_css_nssrs_dstrd & 0x1000) ? "Only Admin Command Set Supported" : - "I/O Command Set is Supported"); - printf("\tNVM Subsystem Reset Supported (NSSRS): %s\n", - (cap->bps_css_nssrs_dstrd & 0x0010) ? "Yes":"No"); - printf("\tDoorbell Stride (DSTRD): %u bytes\n", - 1 << (2 + (cap->bps_css_nssrs_dstrd & 0x000f))); - printf("\tTimeout (TO): %u ms\n", - cap->to * 500); + cap->css & 0x80 ? "Only Admin Command Set Supported" : "I/O Command Set is Supported"); + printf("\tNVM Subsystem Reset Supported (NSSRS): %s\n", cap->nssrs ? "Yes" : "No"); + printf("\tDoorbell Stride (DSTRD): %u bytes\n", 1 << (2 + cap->dstrd)); + printf("\tTimeout (TO): %u ms\n", cap->to * 500); printf("\tArbitration Mechanism Supported (AMS): Weighted Round Robin with Urgent Priority Class is %s\n", - (cap->ams_cqr & 0x02) ? "supported":"not supported"); - printf("\tContiguous Queues Required (CQR): %s\n", - (cap->ams_cqr & 0x01) ? "Yes":"No"); - printf("\tMaximum Queue Entries Supported (MQES): %u\n\n", - cap->mqes + 1); + cap->ams & 0x02 ? "Supported" : "Not supported"); + printf("\tContiguous Queues Required (CQR): %s\n", cap->cqr ? "Yes" : "No"); + printf("\tMaximum Queue Entries Supported (MQES): %u\n\n", cap->mqes + 1); } static void stdout_registers_version(__u32 vs) @@ -905,6 +1146,7 @@ static void stdout_registers_cc_ams (__u8 ams) break; default: printf("Reserved\n"); + break; } } @@ -923,13 +1165,14 @@ static void stdout_registers_cc_shn (__u8 shn) break; default: printf("Reserved\n"); + break; } } static void stdout_registers_cc(__u32 cc) { printf("\tController Ready Independent of Media Enable (CRIME): %s\n", - NVME_CC_CRIME(cc) ? "Enabled":"Disabled"); + NVME_CC_CRIME(cc) ? "Enabled" : "Disabled"); printf("\tI/O Completion Queue Entry Size (IOCQES): %u bytes\n", 1 << ((cc & 0x00f00000) >> NVME_CC_IOCQES_SHIFT)); @@ -944,7 +1187,7 @@ static void stdout_registers_cc(__u32 cc) (cc & 0x00000070) == 0x60 ? "All supported I/O Command Sets" : (cc & 0x00000070) == 0x70 ? "Admin Command Set only" : "Reserved"); printf("\tEnable (EN): %s\n\n", - (cc & 0x00000001) ? "Yes":"No"); + (cc & 0x00000001) ? "Yes" : "No"); } static void stdout_registers_csts_shst(__u8 shst) @@ -962,29 +1205,28 @@ static void stdout_registers_csts_shst(__u8 shst) break; default: printf("Reserved\n"); + break; } } static void stdout_registers_csts(__u32 csts) { printf("\tProcessing Paused (PP): %s\n", - (csts & 0x00000020) ? "Yes":"No"); + (csts & 0x00000020) ? "Yes" : "No"); printf("\tNVM Subsystem Reset Occurred (NSSRO): %s\n", - (csts & 0x00000010) ? "Yes":"No"); + (csts & 0x00000010) ? "Yes" : "No"); stdout_registers_csts_shst((csts & 0x0000000c) >> 2); printf("\tController Fatal Status (CFS): %s\n", - (csts & 0x00000002) ? "True":"False"); + (csts & 0x00000002) ? "True" : "False"); printf("\tReady (RDY): %s\n\n", - (csts & 0x00000001) ? "Yes":"No"); + (csts & 0x00000001) ? "Yes" : "No"); } static void stdout_registers_crto(__u32 crto) { - printf("\tCRIMT : %d secs\n", - NVME_CRTO_CRIMT(crto)/2 ); - printf("\tCRWMT : %d secs\n", - NVME_CRTO_CRWMT(crto)/2 ); + printf("\tCRIMT : %d secs\n", NVME_CRTO_CRIMT(crto) / 2); + printf("\tCRWMT : %d secs\n", NVME_CRTO_CRWMT(crto) / 2); } static void stdout_registers_aqa(__u32 aqa) @@ -1005,28 +1247,28 @@ static void stdout_registers_cmbloc(__u32 cmbloc, __u32 cmbsz) return; } printf("\tOffset (OFST): 0x%x (See cmbsz.szu for granularity)\n", - (cmbloc & 0xfffff000) >> 12); + (cmbloc & 0xfffff000) >> 12); printf("\tCMB Queue Dword Alignment (CQDA): %d\n", - (cmbloc & 0x00000100) >> 8); + (cmbloc & 0x00000100) >> 8); printf("\tCMB Data Metadata Mixed Memory Support (CDMMMS): %s\n", - enforced[(cmbloc & 0x00000080) >> 7]); + enforced[(cmbloc & 0x00000080) >> 7]); printf("\tCMB Data Pointer and Command Independent Locations Support (CDPCILS): %s\n", - enforced[(cmbloc & 0x00000040) >> 6]); + enforced[(cmbloc & 0x00000040) >> 6]); printf("\tCMB Data Pointer Mixed Locations Support (CDPMLS): %s\n", - enforced[(cmbloc & 0x00000020) >> 5]); + enforced[(cmbloc & 0x00000020) >> 5]); printf("\tCMB Queue Physically Discontiguous Support (CQPDS): %s\n", - enforced[(cmbloc & 0x00000010) >> 4]); + enforced[(cmbloc & 0x00000010) >> 4]); printf("\tCMB Queue Mixed Memory Support (CQMMS): %s\n", - enforced[(cmbloc & 0x00000008) >> 3]); + enforced[(cmbloc & 0x00000008) >> 3]); printf("\tBase Indicator Register (BIR): 0x%x\n\n", - (cmbloc & 0x00000007)); + (cmbloc & 0x00000007)); } static void stdout_registers_cmbsz(__u32 cmbsz) @@ -1035,20 +1277,19 @@ static void stdout_registers_cmbsz(__u32 cmbsz) printf("\tController Memory Buffer feature is not supported\n\n"); return; } - printf("\tSize (SZ): %u\n", - (cmbsz & 0xfffff000) >> 12); + printf("\tSize (SZ): %u\n", (cmbsz & 0xfffff000) >> 12); printf("\tSize Units (SZU): %s\n", - nvme_register_szu_to_string((cmbsz & 0x00000f00) >> 8)); + nvme_register_szu_to_string((cmbsz & 0x00000f00) >> 8)); printf("\tWrite Data Support (WDS): Write Data and metadata transfer in Controller Memory Buffer is %s\n", - (cmbsz & 0x00000010) ? "Supported":"Not supported"); + (cmbsz & 0x00000010) ? "Supported" : "Not supported"); printf("\tRead Data Support (RDS): Read Data and metadata transfer in Controller Memory Buffer is %s\n", - (cmbsz & 0x00000008) ? "Supported":"Not supported"); + (cmbsz & 0x00000008) ? "Supported" : "Not supported"); printf("\tPRP SGL List Support (LISTS): PRP/SG Lists in Controller Memory Buffer is %s\n", - (cmbsz & 0x00000004) ? "Supported":"Not supported"); + (cmbsz & 0x00000004) ? "Supported" : "Not supported"); printf("\tCompletion Queue Support (CQS): Admin and I/O Completion Queues in Controller Memory Buffer is %s\n", - (cmbsz & 0x00000002) ? "Supported":"Not supported"); + (cmbsz & 0x00000002) ? "Supported" : "Not supported"); printf("\tSubmission Queue Support (SQS): Admin and I/O Submission Queues in Controller Memory Buffer is %s\n\n", - (cmbsz & 0x00000001) ? "Supported":"Not supported"); + (cmbsz & 0x00000001) ? "Supported" : "Not supported"); } static void stdout_registers_bpinfo_brs(__u8 brs) @@ -1069,6 +1310,7 @@ static void stdout_registers_bpinfo_brs(__u8 brs) break; default: printf("Invalid\n"); + break; } } @@ -1093,7 +1335,6 @@ static void stdout_registers_bprsel(__u32 bprsel) static void stdout_registers_bpmbl(uint64_t bpmbl) { - printf("\tBoot Partition Memory Buffer Base Address (BMBBA): %"PRIx64"\n", bpmbl); } @@ -1125,13 +1366,13 @@ static void stdout_registers_pmrcap(__u32 pmrcap) printf("\tPersistent Memory Region Write Barrier Mechanisms (PMRWBM): %x\n", (pmrcap & 0x00003c00) >> 10); printf("\tPersistent Memory Region Time Units (PMRTU): PMR time unit is %s\n", - (pmrcap & 0x00000300) >> 8 ? "minutes":"500 milliseconds"); + (pmrcap & 0x00000300) >> 8 ? "minutes" : "500 milliseconds"); printf("\tBase Indicator Register (BIR): %x\n", (pmrcap & 0x000000e0) >> 5); printf("\tWrite Data Support (WDS): Write data to the PMR is %s\n", - (pmrcap & 0x00000010) ? "supported":"not supported"); + (pmrcap & 0x00000010) ? "supported" : "not supported"); printf("\tRead Data Support (RDS): Read data from the PMR is %s\n", - (pmrcap & 0x00000008) ? "supported":"not supported"); + (pmrcap & 0x00000008) ? "supported" : "not supported"); } static void stdout_registers_pmrctl(__u32 pmrctl) @@ -1150,7 +1391,7 @@ static void stdout_registers_pmrsts(__u32 pmrsts, __u32 pmrctl) "The Persistent Memory Region is %s to process "\ "PCI Express memory read and write requests\n", (pmrsts & 0x00000100) == 0 && (pmrctl & 0x00000001) ? - "READY":"Not Ready"); + "READY" : "Not Ready"); printf("\tError (ERR): %x\n", (pmrsts & 0x000000ff)); } @@ -1159,7 +1400,7 @@ static void stdout_registers_pmrebs(__u32 pmrebs) printf("\tPMR Elasticity Buffer Size Base (PMRWBZ): %x\n", (pmrebs & 0xffffff00) >> 8); printf("\tRead Bypass Behavior : memory reads not conflicting with memory writes "\ "in the PMR Elasticity Buffer %s bypass those memory writes\n", - (pmrebs & 0x00000010) ? "SHALL":"MAY"); + (pmrebs & 0x00000010) ? "SHALL" : "MAY"); printf("\tPMR Elasticity Buffer Size Units (PMRSZU): %s\n", nvme_register_pmr_pmrszu_to_string(pmrebs & 0x0000000f)); } @@ -1347,59 +1588,46 @@ void stdout_ctrl_registers(void *bar, bool fabrics) static void stdout_single_property(int offset, uint64_t value64) { int human = stdout_print_ops.flags & VERBOSE; - - uint32_t value32; + uint32_t value32 = (uint32_t)value64; if (!human) { if (nvme_is_64bit_reg(offset)) printf("property: 0x%02x (%s), value: %"PRIx64"\n", - offset, nvme_register_to_string(offset), - value64); + offset, nvme_register_to_string(offset), value64); else printf("property: 0x%02x (%s), value: %x\n", offset, - nvme_register_to_string(offset), - (uint32_t) value64); - + nvme_register_to_string(offset), value32); return; } - value32 = (uint32_t) value64; - switch (offset) { case NVME_REG_CAP: printf("cap : %"PRIx64"\n", value64); stdout_registers_cap((struct nvme_bar_cap *)&value64); break; - case NVME_REG_VS: printf("version : %x\n", value32); stdout_registers_version(value32); break; - case NVME_REG_CC: printf("cc : %x\n", value32); stdout_registers_cc(value32); break; - case NVME_REG_CSTS: printf("csts : %x\n", value32); stdout_registers_csts(value32); break; - case NVME_REG_NSSR: printf("nssr : %x\n", value32); - printf("\tNVM Subsystem Reset Control (NSSRC): %u\n\n", - value32); + printf("\tNVM Subsystem Reset Control (NSSRC): %u\n\n", value32); break; - case NVME_REG_CRTO: printf("crto : %x\n", value32); stdout_registers_crto(value32); break; - default: printf("unknown property: 0x%02x (%s), value: %"PRIx64"\n", - offset, nvme_register_to_string(offset), value64); + offset, nvme_register_to_string(offset), value64); break; } } @@ -1437,6 +1665,13 @@ static void stdout_status(int status) } } +static void stdout_error_status(int status, const char *msg, va_list ap) +{ + vfprintf(stderr, msg, ap); + fprintf(stderr, ": "); + stdout_status(status); +} + static void stdout_id_ctrl_cmic(__u8 cmic) { __u8 rsvd = (cmic & 0xF0) >> 4; @@ -1908,19 +2143,25 @@ static void stdout_id_ctrl_cqes(__u8 cqes) static void stdout_id_ctrl_oncs(__le16 ctrl_oncs) { __u16 oncs = le16_to_cpu(ctrl_oncs); - __u16 rsvd = (oncs & 0xFE00) >> 9; - __u16 copy = (oncs & 0x100) >> 8; - __u16 vrfy = (oncs & 0x80) >> 7; - __u16 tmst = (oncs & 0x40) >> 6; - __u16 resv = (oncs & 0x20) >> 5; - __u16 save = (oncs & 0x10) >> 4; - __u16 wzro = (oncs & 0x8) >> 3; - __u16 dsms = (oncs & 0x4) >> 2; - __u16 wunc = (oncs & 0x2) >> 1; - __u16 cmp = oncs & 0x1; + __u16 rsvd = oncs >> 11; + bool afc = !!(oncs & NVME_CTRL_ONCS_ALL_FAST_COPY); + bool csa = !!(oncs & NVME_CTRL_ONCS_COPY_SINGLE_ATOMICITY); + bool copy = !!(oncs & NVME_CTRL_ONCS_COPY); + bool vrfy = !!(oncs & NVME_CTRL_ONCS_VERIFY); + bool tmst = !!(oncs & NVME_CTRL_ONCS_TIMESTAMP); + bool resv = !!(oncs & NVME_CTRL_ONCS_RESERVATIONS); + bool save = !!(oncs & NVME_CTRL_ONCS_SAVE_FEATURES); + bool wzro = !!(oncs & NVME_CTRL_ONCS_WRITE_ZEROES); + bool dsms = !!(oncs & NVME_CTRL_ONCS_DSM); + bool wunc = !!(oncs & NVME_CTRL_ONCS_WRITE_UNCORRECTABLE); + bool cmp = !!(oncs & NVME_CTRL_ONCS_COMPARE); if (rsvd) - printf(" [15:9] : %#x\tReserved\n", rsvd); + printf(" [15:11] : %#x\tReserved\n", rsvd); + printf(" [10:10] : %#x\tAll Fast Copy %sSupported\n", + afc, afc ? "" : "Not "); + printf(" [9:9] : %#x\tCopy Single Atomicity %sSupported\n", + csa, csa ? "" : "Not "); printf(" [8:8] : %#x\tCopy %sSupported\n", copy, copy ? "" : "Not "); printf(" [7:7] : %#x\tVerify %sSupported\n", @@ -2029,15 +2270,16 @@ static void stdout_id_ctrl_nwpc(__u8 nwpc) static void stdout_id_ctrl_ocfs(__le16 ctrl_ocfs) { __u16 ocfs = le16_to_cpu(ctrl_ocfs); - __u16 rsvd = (ocfs & 0xfffc) >> 2; - __u8 copy_fmt_1 = (ocfs >> 1) & 0x1; - __u8 copy_fmt_0 = ocfs & 0x1; + __u16 rsvd = ocfs >> 4; + __u8 copy_fmt_supported; + int copy_fmt; if (rsvd) - printf(" [15:2] : %#x\tReserved\n", rsvd); - printf(" [1:1] : %#x\tController Copy Format 1h %sSupported\n", - copy_fmt_1, copy_fmt_1 ? "" : "Not "); - printf(" [0:0] : %#x\tController Copy Format 0h %sSupported\n", - copy_fmt_0, copy_fmt_0 ? "" : "Not "); + printf(" [15:4] : %#x\tReserved\n", rsvd); + for (copy_fmt = 3; copy_fmt >= 0; copy_fmt--) { + copy_fmt_supported = ocfs >> copy_fmt & 1; + printf(" [%d:%d] : %#x\tController Copy Format %xh %sSupported\n", copy_fmt, copy_fmt, + copy_fmt_supported, copy_fmt, copy_fmt_supported ? "" : "Not "); + } printf("\n"); } @@ -2184,9 +2426,9 @@ static void stdout_id_ns_dpc(__u8 dpc) __u8 pit1 = dpc & 0x1; if (rsvd) printf(" [7:5] : %#x\tReserved\n", rsvd); - printf(" [4:4] : %#x\tProtection Information Transferred as Last 8 Bytes of Metadata %sSupported\n", + printf(" [4:4] : %#x\tProtection Information Transferred as Last Bytes of Metadata %sSupported\n", pil8, pil8 ? "" : "Not "); - printf(" [3:3] : %#x\tProtection Information Transferred as First 8 Bytes of Metadata %sSupported\n", + printf(" [3:3] : %#x\tProtection Information Transferred as First Bytes of Metadata %sSupported\n", pif8, pif8 ? "" : "Not "); printf(" [2:2] : %#x\tProtection Information Type 3 %sSupported\n", pit3, pit3 ? "" : "Not "); @@ -2204,7 +2446,7 @@ static void stdout_id_ns_dps(__u8 dps) __u8 pit = dps & 0x7; if (rsvd) printf(" [7:4] : %#x\tReserved\n", rsvd); - printf(" [3:3] : %#x\tProtection Information is Transferred as %s 8 Bytes of Metadata\n", + printf(" [3:3] : %#x\tProtection Information is Transferred as %s Bytes of Metadata\n", pif8, pif8 ? "First" : "Last"); printf(" [2:0] : %#x\tProtection Information %s\n", pit, pit == 3 ? "Type 3 Enabled" : @@ -2531,19 +2773,17 @@ static void print_psd_workload(__u8 apw) /* Unknown or not provided */ printf("-"); break; - case 1: /* Extended idle period with burst of random write */ printf("1MiB 32 RW, 30s idle"); break; - case 2: /* Heavy sequential writes */ printf("80K 128KiB SW"); break; - default: printf("reserved"); + break; } } @@ -2556,19 +2796,17 @@ static void print_ps_power_and_scale(__le16 ctr_power, __u8 scale) /* Not reported for this power state */ printf("-"); break; - case NVME_PSD_PS_100_MICRO_WATT: /* Units of 0.0001W */ printf("%01u.%04uW", power / 10000, power % 10000); break; - case NVME_PSD_PS_10_MILLI_WATT: /* Units of 0.01W */ printf("%01u.%02uW", power / 100, power % 100); break; - default: printf("reserved"); + break; } } @@ -2765,6 +3003,7 @@ static void stdout_id_ctrl(struct nvme_id_ctrl *ctrl, printf("maxdna : %s\n", uint128_t_to_l10n_string(le128_to_cpu(ctrl->maxdna))); printf("maxcna : %u\n", le32_to_cpu(ctrl->maxcna)); + printf("oaqd : %u\n", le32_to_cpu(ctrl->oaqd)); printf("subnqn : %-.*s\n", (int)sizeof(ctrl->subnqn), ctrl->subnqn); printf("ioccsz : %u\n", le32_to_cpu(ctrl->ioccsz)); printf("iorcsz : %u\n", le32_to_cpu(ctrl->iorcsz)); @@ -2846,7 +3085,7 @@ static void stdout_nvm_id_ns(struct nvme_nvm_id_ns *nvm_ns, unsigned int nsid, pif == 1 ? "32b Guard" : "16b Guard", pif, sts, i == (ns->flbas & 0xf) ? in_use : ""); else - printf("elbaf %2d : pif:%d lbads:%-2d %s\n", i, + printf("elbaf %2d : pif:%d sts:%-2d %s\n", i, pif, sts, i == (ns->flbas & 0xf) ? in_use : ""); } } @@ -3000,6 +3239,11 @@ static void stdout_list_ns(struct nvme_ns_list *ns_list) } } +static void stdout_zns_start_zone_list(__u64 nr_zones, struct json_object **zone_list) +{ + printf("nr_zones: %"PRIu64"\n", (uint64_t)le64_to_cpu(nr_zones)); +} + static void stdout_zns_changed(struct nvme_zns_changed_zone_log *log) { uint16_t nrzid; @@ -3021,7 +3265,7 @@ static void stdout_zns_changed(struct nvme_zns_changed_zone_log *log) static void stdout_zns_report_zone_attributes(__u8 za, __u8 zai) { const char *const recommended_limit[4] = {"","1","2","3"}; - printf("Attrs: Zone Descriptor Extension is %sVaild\n", + printf("Attrs: Zone Descriptor Extension is %sVaild\n", (za & NVME_ZNS_ZA_ZDEV)? "" : "Not "); if(za & NVME_ZNS_ZA_RZR) { printf(" Reset Zone Recommended with Reset Recommended Limit%s\n", @@ -3057,8 +3301,7 @@ static void stdout_zns_report_zones(void *report, __u32 descs, (uint64_t)le64_to_cpu(desc->zcap), nvme_zone_state_to_string(desc->zs >> 4), nvme_zone_type_to_string(desc->zt)); stdout_zns_report_zone_attributes(desc->za, desc->zai); - } - else { + } else { printf("SLBA: %#-10"PRIx64" WP: %#-10"PRIx64" Cap: %#-10"PRIx64" State: %#-4x Type: %#-4x Attrs: %#-4x AttrsInfo: %#-4x\n", (uint64_t)le64_to_cpu(desc->zslba), (uint64_t)le64_to_cpu(desc->wp), (uint64_t)le64_to_cpu(desc->zcap), desc->zs, desc->zt, @@ -3079,9 +3322,8 @@ static void stdout_list_ctrl(struct nvme_ctrl_list *ctrl_list) int i; printf("num of ctrls present: %u\n", num); - for (i = 0; i < min(num, 2047); i++) { + for (i = 0; i < min(num, 2047); i++) printf("[%4u]:%#x\n", i, le16_to_cpu(ctrl_list->identifier[i])); - } } static void stdout_id_nvmset(struct nvme_id_nvmset_list *nvmset, @@ -3207,8 +3449,8 @@ static void stdout_id_uuid_list(const struct nvme_id_uuid_list *uuid_list) { int i, human = stdout_print_ops.flags & VERBOSE; - /* The 0th entry is reserved */ printf("NVME Identify UUID:\n"); + for (i = 0; i < NVME_ID_UUID_LIST_MAX; i++) { __u8 uuid[NVME_UUID_LEN]; char *association = ""; @@ -3279,7 +3521,7 @@ static void stdout_id_iocs(struct nvme_id_iocs *iocs) { __u16 i; - for (i = 0; i < 512; i++) + for (i = 0; i < ARRAY_SIZE(iocs->iocsc); i++) if (iocs->iocsc[i]) printf("I/O Command Set Combination[%u]:%"PRIx64"\n", i, (uint64_t)le64_to_cpu(iocs->iocsc[i])); @@ -3560,41 +3802,36 @@ static void stdout_supported_log(struct nvme_supported_log_pages *support_log, } } -static void stdout_endurance_log(struct nvme_endurance_group_log *endurance_log, - __u16 group_id, const char *devname) +static void stdout_endurance_log(struct nvme_endurance_group_log *endurance_log, __u16 group_id, + const char *devname) { - printf("Endurance Group Log for NVME device:%s Group ID:%x\n", devname, - group_id); - printf("critical warning : %u\n", - endurance_log->critical_warning); + printf("Endurance Group Log for NVME device:%s Group ID:%x\n", devname, group_id); + printf("critical_warning : %u\n", endurance_log->critical_warning); + printf("endurance_group_features: %u\n", endurance_log->endurance_group_features); printf("avl_spare : %u\n", endurance_log->avl_spare); - printf("avl_spare_threshold : %u\n", - endurance_log->avl_spare_threshold); + printf("avl_spare_threshold : %u\n", endurance_log->avl_spare_threshold); printf("percent_used : %u%%\n", endurance_log->percent_used); + printf("domain_identifier : %u\n", endurance_log->domain_identifier); printf("endurance_estimate : %s\n", - uint128_t_to_l10n_string( - le128_to_cpu(endurance_log->endurance_estimate))); + uint128_t_to_l10n_string(le128_to_cpu(endurance_log->endurance_estimate))); printf("data_units_read : %s\n", - uint128_t_to_l10n_string( - le128_to_cpu(endurance_log->data_units_read))); + uint128_t_to_l10n_string(le128_to_cpu(endurance_log->data_units_read))); printf("data_units_written : %s\n", - uint128_t_to_l10n_string( - le128_to_cpu(endurance_log->data_units_written))); + uint128_t_to_l10n_string(le128_to_cpu(endurance_log->data_units_written))); printf("media_units_written : %s\n", - uint128_t_to_l10n_string( - le128_to_cpu(endurance_log->media_units_written))); + uint128_t_to_l10n_string(le128_to_cpu(endurance_log->media_units_written))); printf("host_read_cmds : %s\n", - uint128_t_to_l10n_string( - le128_to_cpu(endurance_log->host_read_cmds))); + uint128_t_to_l10n_string(le128_to_cpu(endurance_log->host_read_cmds))); printf("host_write_cmds : %s\n", - uint128_t_to_l10n_string( - le128_to_cpu(endurance_log->host_write_cmds))); + uint128_t_to_l10n_string(le128_to_cpu(endurance_log->host_write_cmds))); printf("media_data_integrity_err: %s\n", - uint128_t_to_l10n_string( - le128_to_cpu(endurance_log->media_data_integrity_err))); + uint128_t_to_l10n_string(le128_to_cpu(endurance_log->media_data_integrity_err))); printf("num_err_info_log_entries: %s\n", - uint128_t_to_l10n_string( - le128_to_cpu(endurance_log->num_err_info_log_entries))); + uint128_t_to_l10n_string(le128_to_cpu(endurance_log->num_err_info_log_entries))); + printf("total_end_grp_cap : %s\n", + uint128_t_to_l10n_string(le128_to_cpu(endurance_log->total_end_grp_cap))); + printf("unalloc_end_grp_cap : %s\n", + uint128_t_to_l10n_string(le128_to_cpu(endurance_log->unalloc_end_grp_cap))); } static void stdout_smart_log(struct nvme_smart_log *smart, unsigned int nsid, @@ -3876,7 +4113,7 @@ static void stdout_sanitize_log(struct nvme_sanitize_log_page *sanitize, le32_to_cpu(sanitize->etcend)); } -static void stdout_select_result(__u32 result) +static void stdout_select_result(enum nvme_features_id fid, __u32 result) { if (result & 0x1) printf(" Feature is saveable\n"); @@ -3903,7 +4140,7 @@ static void stdout_lba_range(struct nvme_lba_range_type *lbrt, int nr_ranges) printf("\tslba : %#"PRIx64"\n", le64_to_cpu(lbrt->entry[i].slba)); printf("\tnlb : %#"PRIx64"\n", le64_to_cpu(lbrt->entry[i].nlb)); printf("\tguid : "); - for (j = 0; j < 16; j++) + for (j = 0; j < ARRAY_SIZE(lbrt->entry[i].guid); j++) printf("%02x", lbrt->entry[i].guid[j]); printf("\n"); } @@ -3916,15 +4153,15 @@ static void stdout_auto_pst(struct nvme_feat_auto_pst *apst) printf( "\tAuto PST Entries"); printf("\t.................\n"); - for (i = 0; i < 32; i++) { + for (i = 0; i < ARRAY_SIZE(apst->apst_entry); i++) { value = le64_to_cpu(apst->apst_entry[i]); printf("\tEntry[%2d] \n", i); printf("\t.................\n"); printf("\tIdle Time Prior to Transition (ITPT): %u ms\n", - (__u32)(value >> NVME_APST_ENTRY_ITPT_SHIFT) & NVME_APST_ENTRY_ITPT_MASK); + (__u32)NVME_GET(value, APST_ENTRY_ITPT)); printf("\tIdle Transition Power State (ITPS): %u\n", - (__u32)(value >> NVME_APST_ENTRY_ITPS_SHIFT ) & NVME_APST_ENTRY_ITPS_MASK); + (__u32)NVME_GET(value, APST_ENTRY_ITPS)); printf("\t.................\n"); } } @@ -3976,11 +4213,11 @@ static void stdout_directive_show_fields(__u8 dtype, __u8 doper, case NVME_DIRECTIVE_RECEIVE_IDENTIFY_DOPER_PARAM: printf("\tDirective support \n"); printf("\t\tIdentify Directive : %s\n", - (*field & 0x1) ? "supported":"not supported"); + (*field & 0x1) ? "supported" : "not supported"); printf("\t\tStream Directive : %s\n", - (*field & 0x2) ? "supported":"not supported"); + (*field & 0x2) ? "supported" : "not supported"); printf("\t\tData Placement Directive : %s\n", - (*field & 0x4) ? "supported":"not supported"); + (*field & 0x4) ? "supported" : "not supported"); printf("\tDirective enabled \n"); printf("\t\tIdentify Directive : %s\n", (*(field + 32) & 0x1) ? "enabled" : "disabled"); @@ -3995,40 +4232,39 @@ static void stdout_directive_show_fields(__u8 dtype, __u8 doper, (*(field + 32) & 0x2) ? "enabled" : "disabled"); printf("\t\tData Placement Directive : %s\n", (*(field + 32) & 0x4) ? "enabled" : "disabled"); - break; default: fprintf(stderr, "invalid directive operations for Identify Directives\n"); + break; } break; case NVME_DIRECTIVE_DTYPE_STREAMS: switch (doper) { case NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_PARAM: printf("\tMax Streams Limit (MSL): %u\n", - *(__u16 *) field); + *(__u16 *)field); printf("\tNVM Subsystem Streams Available (NSSA): %u\n", - *(__u16 *) (field + 2)); + *(__u16 *)(field + 2)); printf("\tNVM Subsystem Streams Open (NSSO): %u\n", - *(__u16 *) (field + 4)); + *(__u16 *)(field + 4)); printf("\tNVM Subsystem Stream Capability (NSSC): %u\n", - *(__u16 *) (field + 6)); + *(__u16 *)(field + 6)); printf("\tStream Write Size (in unit of LB size) (SWS): %u\n", - *(__u32 *) (field + 16)); + *(__u32 *)(field + 16)); printf("\tStream Granularity Size (in unit of SWS) (SGS): %u\n", - *(__u16 *) (field + 20)); + *(__u16 *)(field + 20)); printf("\tNamespace Streams Allocated (NSA): %u\n", - *(__u16 *) (field + 22)); + *(__u16 *)(field + 22)); printf("\tNamespace Streams Open (NSO): %u\n", - *(__u16 *) (field + 24)); + *(__u16 *)(field + 24)); break; case NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_STATUS: - count = *(__u16 *) field; - printf("\tOpen Stream Count : %u\n", *(__u16 *) field); - for ( i = 0; i < count; i++ ) { + count = *(__u16 *)field; + printf("\tOpen Stream Count : %u\n", *(__u16 *)field); + for (i = 0; i < count; i++) printf("\tStream Identifier %.6u : %u\n", i + 1, - *(__u16 *) (field + ((i + 1) * 2))); - } + *(__u16 *)(field + ((i + 1) * 2))); break; case NVME_DIRECTIVE_RECEIVE_STREAMS_DOPER_RESOURCE: printf("\tNamespace Streams Allocated (NSA): %u\n", @@ -4037,13 +4273,13 @@ static void stdout_directive_show_fields(__u8 dtype, __u8 doper, default: fprintf(stderr, "invalid directive operations for Streams Directives\n"); + break; } break; default: fprintf(stderr, "invalid directive type\n"); break; } - return; } static void stdout_directive_show(__u8 type, __u8 oper, __u16 spec, __u32 nsid, __u32 result, @@ -4063,6 +4299,41 @@ static void stdout_lba_status_info(__u32 result) printf("\tLBA Status Information Report Interval (LSIRI): %u\n", result & 0xffff); } +void stdout_d(unsigned char *buf, int len, int width, int group) +{ + int i, offset = 0; + char ascii[32 + 1] = { 0 }; + + assert(width < sizeof(ascii)); + + printf(" "); + + for (i = 0; i <= 15; i++) + printf("%3x", i); + + for (i = 0; i < len; i++) { + if (!(i % width)) + printf( "\n%04x:", offset); + if (i % group) + printf( "%02x", buf[i]); + else + printf( " %02x", buf[i]); + ascii[i % width] = (buf[i] >= '!' && buf[i] <= '~') ? buf[i] : '.'; + if (!((i + 1) % width)) { + printf( " \"%.*s\"", width, ascii); + offset += width; + memset(ascii, 0, sizeof(ascii)); + } + } + + if (strlen(ascii)) { + unsigned b = width - (i % width); + printf( " %*s \"%.*s\"", 2 * b + b / group + (b % group ? 1 : 0), "", width, ascii); + } + + printf( "\n"); +} + static void stdout_plm_config(struct nvme_plm_config *plmcfg) { printf("\tEnable Event :%04x\n", le16_to_cpu(plmcfg->ee)); @@ -4074,26 +4345,31 @@ static void stdout_plm_config(struct nvme_plm_config *plmcfg) static void stdout_host_metadata(enum nvme_features_id fid, struct nvme_host_metadata *data) { - struct nvme_metadata_element_desc *desc = &data->descs[0]; - int i; - char val[4096]; - __u16 len; + struct nvme_metadata_element_desc *desc = &data->descs[0]; + int i; + char val[4096]; + __u16 len; - printf("\tNum Metadata Element Descriptors: %d\n", data->ndesc); - for (i = 0; i < data->ndesc; i++) { - len = le16_to_cpu(desc->len); - strncpy(val, (char *)desc->val, min(sizeof(val) - 1, len)); + printf("\tNum Metadata Element Descriptors: %d\n", data->ndesc); + for (i = 0; i < data->ndesc; i++) { + len = le16_to_cpu(desc->len); + strncpy(val, (char *)desc->val, min(sizeof(val) - 1, len)); - printf("\tElement[%-3d]:\n", i); - printf("\t\tType : 0x%02x (%s)\n", desc->type, + printf("\tElement[%-3d]:\n", i); + printf("\t\tType : 0x%02x (%s)\n", desc->type, nvme_host_metadata_type_to_string(fid, desc->type)); - printf("\t\tRevision : %d\n", desc->rev); - printf("\t\tLength : %d\n", len); - printf("\t\tValue : %s\n", val); + printf("\t\tRevision : %d\n", desc->rev); + printf("\t\tLength : %d\n", len); + printf("\t\tValue : %s\n", val); + + desc = (struct nvme_metadata_element_desc *)&desc->val[desc->len]; + } +} - desc = (struct nvme_metadata_element_desc *) - &desc->val[desc->len]; - } +static void stdout_feature_show(enum nvme_features_id fid, int sel, unsigned int result) +{ + printf("get-feature:%#0*x (%s), %s value:%#0*x\n", fid ? 4 : 2, fid, + nvme_feature_to_string(fid), nvme_select_to_string(sel), result ? 10 : 8, result); } static void stdout_feature_show_fields(enum nvme_features_id fid, @@ -4116,8 +4392,8 @@ static void stdout_feature_show_fields(enum nvme_features_id fid, break; case NVME_FEAT_FID_POWER_MGMT: field = (result & 0x000000E0) >> 5; - printf("\tWorkload Hint (WH): %u - %s\n", field, nvme_feature_wl_hints_to_string(field)); - printf("\tPower State (PS): %u\n", result & 0x0000001f); + printf("\tWorkload Hint (WH): %u - %s\n", field, nvme_feature_wl_hints_to_string(field)); + printf("\tPower State (PS): %u\n", result & 0x0000001f); break; case NVME_FEAT_FID_LBA_RANGE: field = result & 0x0000003f; @@ -4137,56 +4413,56 @@ static void stdout_feature_show_fields(enum nvme_features_id fid, break; case NVME_FEAT_FID_ERR_RECOVERY: printf("\tDeallocated or Unwritten Logical Block Error Enable (DULBE): %s\n", - ((result & 0x00010000) >> 16) ? "Enabled":"Disabled"); + ((result & 0x00010000) >> 16) ? "Enabled" : "Disabled"); printf("\tTime Limited Error Recovery (TLER): %u ms\n", (result & 0x0000ffff) * 100); break; case NVME_FEAT_FID_VOLATILE_WC: - printf("\tVolatile Write Cache Enable (WCE): %s\n", (result & 0x00000001) ? "Enabled":"Disabled"); + printf("\tVolatile Write Cache Enable (WCE): %s\n", (result & 0x00000001) ? "Enabled" : "Disabled"); break; case NVME_FEAT_FID_NUM_QUEUES: printf("\tNumber of IO Completion Queues Allocated (NCQA): %u\n", ((result & 0xffff0000) >> 16) + 1); - printf("\tNumber of IO Submission Queues Allocated (NSQA): %u\n", (result & 0x0000ffff) + 1); + printf("\tNumber of IO Submission Queues Allocated (NSQA): %u\n", (result & 0x0000ffff) + 1); break; case NVME_FEAT_FID_IRQ_COALESCE: printf("\tAggregation Time (TIME): %u usec\n", ((result & 0x0000ff00) >> 8) * 100); - printf("\tAggregation Threshold (THR): %u\n", (result & 0x000000ff) + 1); + printf("\tAggregation Threshold (THR): %u\n", (result & 0x000000ff) + 1); break; case NVME_FEAT_FID_IRQ_CONFIG: - printf("\tCoalescing Disable (CD): %s\n", ((result & 0x00010000) >> 16) ? "True":"False"); - printf("\tInterrupt Vector (IV): %u\n", result & 0x0000ffff); + printf("\tCoalescing Disable (CD): %s\n", ((result & 0x00010000) >> 16) ? "True" : "False"); + printf("\tInterrupt Vector (IV): %u\n", result & 0x0000ffff); break; case NVME_FEAT_FID_WRITE_ATOMIC: - printf("\tDisable Normal (DN): %s\n", (result & 0x00000001) ? "True":"False"); + printf("\tDisable Normal (DN): %s\n", (result & 0x00000001) ? "True" : "False"); break; case NVME_FEAT_FID_ASYNC_EVENT: printf("\tDiscovery Log Page Change Notices : %s\n", - ((result & 0x80000000) >> 31) ? "Send async event":"Do not send async event"); + ((result & 0x80000000) >> 31) ? "Send async event" : "Do not send async event"); printf("\tEndurance Group Event Aggregate Log Change Notices : %s\n", - ((result & 0x00004000) >> 14) ? "Send async event":"Do not send async event"); + ((result & 0x00004000) >> 14) ? "Send async event" : "Do not send async event"); printf("\tLBA Status Information Notices : %s\n", - ((result & 0x00002000) >> 13) ? "Send async event":"Do not send async event"); + ((result & 0x00002000) >> 13) ? "Send async event" : "Do not send async event"); printf("\tPredictable Latency Event Aggregate Log Change Notices : %s\n", - ((result & 0x00001000) >> 12) ? "Send async event":"Do not send async event"); + ((result & 0x00001000) >> 12) ? "Send async event" : "Do not send async event"); printf("\tAsymmetric Namespace Access Change Notices : %s\n", - ((result & 0x00000800) >> 11) ? "Send async event":"Do not send async event"); + ((result & 0x00000800) >> 11) ? "Send async event" : "Do not send async event"); printf("\tTelemetry Log Notices : %s\n", - ((result & 0x00000400) >> 10) ? "Send async event":"Do not send async event"); + ((result & 0x00000400) >> 10) ? "Send async event" : "Do not send async event"); printf("\tFirmware Activation Notices : %s\n", - ((result & 0x00000200) >> 9) ? "Send async event":"Do not send async event"); + ((result & 0x00000200) >> 9) ? "Send async event" : "Do not send async event"); printf("\tNamespace Attribute Notices : %s\n", - ((result & 0x00000100) >> 8) ? "Send async event":"Do not send async event"); + ((result & 0x00000100) >> 8) ? "Send async event" : "Do not send async event"); printf("\tSMART / Health Critical Warnings : %s\n", - (result & 0x000000ff) ? "Send async event":"Do not send async event"); + (result & 0x000000ff) ? "Send async event" : "Do not send async event"); break; case NVME_FEAT_FID_AUTO_PST: printf("\tAutonomous Power State Transition Enable (APSTE): %s\n", - (result & 0x00000001) ? "Enabled":"Disabled"); + (result & 0x00000001) ? "Enabled" : "Disabled"); if (buf) stdout_auto_pst((struct nvme_feat_auto_pst *)buf); break; case NVME_FEAT_FID_HOST_MEM_BUF: - printf("\tEnable Host Memory (EHM): %s\n", (result & 0x00000001) ? "Enabled":"Disabled"); + printf("\tEnable Host Memory (EHM): %s\n", (result & 0x00000001) ? "Enabled" : "Disabled"); if (buf) stdout_host_mem_buffer((struct nvme_host_mem_buf_attrs *)buf); break; @@ -4211,7 +4487,7 @@ static void stdout_feature_show_fields(enum nvme_features_id fid, printf("\tRead Recovery Level (RRL): %u\n", result & 0xf); break; case NVME_FEAT_FID_PLM_CONFIG: - printf("\tPredictable Latency Window Enabled: %s\n", result & 0x1 ? "True":"False"); + printf("\tPredictable Latency Window Enabled: %s\n", result & 0x1 ? "True" : "False"); if (buf) stdout_plm_config((struct nvme_plm_config *)buf); break; @@ -4222,8 +4498,20 @@ static void stdout_feature_show_fields(enum nvme_features_id fid, stdout_lba_status_info(result); break; case NVME_FEAT_FID_HOST_BEHAVIOR: - if (buf) - printf("\tHost Behavior Support: %s\n", (buf[0] & 0x1) ? "True" : "False"); + if (buf) { + struct nvme_feat_host_behavior *host_behavior = + (struct nvme_feat_host_behavior *)buf; + printf("\tAdvanced Command Retry Enable (ACRE): %s\n", + host_behavior->acre ? "True" : "False"); + printf("\tExtended Telemetry Data Area 4 Supported (ETDAS): %s\n", + host_behavior->etdas ? "True" : "False"); + printf("\tLBA Format Extension Enable (LBAFEE): %s\n", + host_behavior->lbafee ? "True" : "False"); + printf("\tCopy Descriptor Format 2h Enabled (CDFE): %s\n", + host_behavior->cdfe & (1 << 2) ? "True" : "False"); + printf("\tCopy Descriptor Format 3h Enabled (CDFE): %s\n", + host_behavior->cdfe & (1 << 3) ? "True" : "False"); + } break; case NVME_FEAT_FID_SANITIZE: printf("\tNo-Deallocate Response Mode (NODRM) : %u\n", result & 0x1); @@ -4233,13 +4521,15 @@ static void stdout_feature_show_fields(enum nvme_features_id fid, printf("\tEndurance Group Critical Warnings : %u\n", (result >> 16) & 0xff); break; case NVME_FEAT_FID_IOCS_PROFILE: - printf("\tI/O Command Set Profile: %s\n", result & 0x1 ? "True":"False"); + printf("\tI/O Command Set Profile: %s\n", result & 0x1 ? "True" : "False"); break; case NVME_FEAT_FID_SPINUP_CONTROL: printf("\tSpinup control feature Enabled: %s\n", (result & 1) ? "True" : "False"); break; case NVME_FEAT_FID_ENH_CTRL_METADATA: + fallthrough; case NVME_FEAT_FID_CTRL_METADATA: + fallthrough; case NVME_FEAT_FID_NS_METADATA: if (buf) stdout_host_metadata(fid, (struct nvme_host_metadata *)buf); @@ -4257,14 +4547,14 @@ static void stdout_feature_show_fields(enum nvme_features_id fid, break; case NVME_FEAT_FID_RESV_MASK: printf("\tMask Reservation Preempted Notification (RESPRE): %s\n", - ((result & 0x00000008) >> 3) ? "True":"False"); + ((result & 0x00000008) >> 3) ? "True" : "False"); printf("\tMask Reservation Released Notification (RESREL): %s\n", - ((result & 0x00000004) >> 2) ? "True":"False"); + ((result & 0x00000004) >> 2) ? "True" : "False"); printf("\tMask Registration Preempted Notification (REGPRE): %s\n", - ((result & 0x00000002) >> 1) ? "True":"False"); + ((result & 0x00000002) >> 1) ? "True" : "False"); break; case NVME_FEAT_FID_RESV_PERSIST: - printf("\tPersist Through Power Loss (PTPL): %s\n", (result & 0x00000001) ? "True":"False"); + printf("\tPersist Through Power Loss (PTPL): %s\n", (result & 0x00000001) ? "True" : "False"); break; case NVME_FEAT_FID_WRITE_PROTECT: printf("\tNamespace Write Protect: %s\n", nvme_ns_wp_cfg_to_string(result)); @@ -4284,6 +4574,7 @@ static void stdout_feature_show_fields(enum nvme_features_id fid, printf("\t%-53s: %sEnabled\n", nvme_fdp_event_to_string(d->evt), d->evta & 0x1 ? "" : "Not "); } + break; default: break; } @@ -4309,6 +4600,8 @@ static void stdout_lba_status(struct nvme_lba_status *list, "\tnumber of logical blocks specified in the\n"\ "\tRange Length field\n"); break; + default: + break; } for (idx = 0; idx < list->nlsd; idx++) { @@ -4387,28 +4680,30 @@ static void stdout_list_item(nvme_ns_t n) nvme_ns_get_firmware(n)); } -static void stdout_simple_list(nvme_root_t r) +static bool stdout_simple_ns(const char *name, void *arg) { - nvme_host_t h; - nvme_subsystem_t s; - nvme_ctrl_t c; + struct nvme_resources *res = arg; nvme_ns_t n; + n = htable_ns_get(&res->ht_n, name); + stdout_list_item(n); + + return true; +} + +static void stdout_simple_list(nvme_root_t r) +{ + struct nvme_resources res; + + nvme_resources_init(r, &res); + printf("%-21s %-21s %-20s %-40s %-10s %-26s %-16s %-8s\n", - "Node", "Generic", "SN", "Model", "Namespace", "Usage", "Format", "FW Rev"); + "Node", "Generic", "SN", "Model", "Namespace", "Usage", "Format", "FW Rev"); printf("%-.21s %-.21s %-.20s %-.40s %-.10s %-.26s %-.16s %-.8s\n", - dash, dash, dash, dash, dash, dash, dash, dash); - - nvme_for_each_host(r, h) { - nvme_for_each_subsystem(h, s) { - nvme_subsystem_for_each_ns(s, n) - stdout_list_item(n); + dash, dash, dash, dash, dash, dash, dash, dash); + strset_iterate(&res.namespaces, stdout_simple_ns, &res); - nvme_subsystem_for_each_ctrl(s, c) - nvme_ctrl_for_each_ns(c, n) - stdout_list_item(n); - } - } + nvme_resources_free(&res); } static void stdout_ns_details(nvme_ns_t n) @@ -4435,100 +4730,153 @@ static void stdout_ns_details(nvme_ns_t n) genname, nvme_ns_get_nsid(n), usage, format); } -static void stdout_detailed_list(nvme_root_t r) +static bool stdout_detailed_name(const char *name, void *arg) { - nvme_host_t h; + bool *first = arg; + + printf("%s%s", *first ? "" : ", ", name); + *first = false; + + return true; +} + +static bool stdout_detailed_subsys(const char *name, void *arg) +{ + struct nvme_resources *res = arg; + struct htable_subsys_iter it; + struct strset ctrls; nvme_subsystem_t s; nvme_ctrl_t c; + bool first; + + strset_init(&ctrls); + first = true; + for (s = htable_subsys_getfirst(&res->ht_s, name, &it); + s; + s = htable_subsys_getnext(&res->ht_s, name, &it)) { + if (first) { + printf("%-16s %-96s ", name, nvme_subsystem_get_nqn(s)); + first = false; + } + + nvme_subsystem_for_each_ctrl(s, c) + strset_add(&ctrls, nvme_ctrl_get_name(c)); + } + + first = true; + strset_iterate(&ctrls, stdout_detailed_name, &first); + strset_clear(&ctrls); + printf("\n"); + + return true; +} + +static bool stdout_detailed_ctrl(const char *name, void *arg) +{ + struct nvme_resources *res = arg; + struct strset namespaces; + nvme_ctrl_t c; nvme_path_t p; nvme_ns_t n; + bool first; + + c = htable_ctrl_get(&res->ht_c, name); + assert(c); + + printf("%-8s %-20s %-40s %-8s %-6s %-14s %-6s %-12s ", + nvme_ctrl_get_name(c), + nvme_ctrl_get_serial(c), + nvme_ctrl_get_model(c), + nvme_ctrl_get_firmware(c), + nvme_ctrl_get_transport(c), + nvme_ctrl_get_address(c), + nvme_ctrl_get_phy_slot(c), + nvme_subsystem_get_name(nvme_ctrl_get_subsystem(c))); + + strset_init(&namespaces); + + nvme_ctrl_for_each_ns(c, n) + strset_add(&namespaces, nvme_ns_get_name(n)); + nvme_ctrl_for_each_path(c, p) { + n = nvme_path_get_ns(p); + if (!n) + continue; + strset_add(&namespaces, nvme_ns_get_name(n)); + } - printf("%-16s %-96s %-.16s\n", "Subsystem", "Subsystem-NQN", "Controllers"); - printf("%-.16s %-.96s %-.16s\n", dash, dash, dash); + first = true; + strset_iterate(&namespaces, stdout_detailed_name, &first); + strset_clear(&namespaces); - nvme_for_each_host(r, h) { - nvme_for_each_subsystem(h, s) { - bool first = true; - printf("%-16s %-96s ", nvme_subsystem_get_name(s), - nvme_subsystem_get_nqn(s)); + printf("\n"); - nvme_subsystem_for_each_ctrl(s, c) { - printf("%s%s", first ? "": ", ", - nvme_ctrl_get_name(c)); - first = false; - } - printf("\n"); + return true; +} + +static bool stdout_detailed_ns(const char *name, void *arg) +{ + struct nvme_resources *res = arg; + struct htable_ns_iter it; + struct strset ctrls; + nvme_ctrl_t c; + nvme_path_t p; + nvme_ns_t n; + bool first; + + strset_init(&ctrls); + first = true; + for (n = htable_ns_getfirst(&res->ht_n, name, &it); + n; + n = htable_ns_getnext(&res->ht_n, name, &it)) { + if (first) { + stdout_ns_details(n); + first = false; + } + + if (nvme_ns_get_ctrl(n)) { + printf("%s\n", nvme_ctrl_get_name(nvme_ns_get_ctrl(n))); + return true; + } + + nvme_namespace_for_each_path(n, p) { + c = nvme_path_get_ctrl(p); + strset_add(&ctrls, nvme_ctrl_get_name(c)); } } - printf("\n"); - printf("%-8s %-20s %-40s %-8s %-6s %-14s %-6s %-12s %-16s\n", "Device", - "SN", "MN", "FR", "TxPort", "Address", "Slot", "Subsystem", "Namespaces"); - printf("%-.8s %-.20s %-.40s %-.8s %-.6s %-.14s %-.6s %-.12s %-.16s\n", dash, - dash, dash, dash, dash, dash, dash, dash, dash); + first = true; + strset_iterate(&ctrls, stdout_detailed_name, &first); + strset_clear(&ctrls); - nvme_for_each_host(r, h) { - nvme_for_each_subsystem(h, s) { - nvme_subsystem_for_each_ctrl(s, c) { - bool first = true; + printf("\n"); + return true; +} - printf("%-8s %-20s %-40s %-8s %-6s %-14s %-6s %-12s ", - nvme_ctrl_get_name(c), - nvme_ctrl_get_serial(c), - nvme_ctrl_get_model(c), - nvme_ctrl_get_firmware(c), - nvme_ctrl_get_transport(c), - nvme_ctrl_get_address(c), - nvme_ctrl_get_phy_slot(c), - nvme_subsystem_get_name(s)); +static void stdout_detailed_list(nvme_root_t r) +{ + struct nvme_resources res; - nvme_ctrl_for_each_ns(c, n) { - printf("%s%s", first ? "": ", ", - nvme_ns_get_name(n)); - first = false; - } + nvme_resources_init(r, &res); - nvme_ctrl_for_each_path(c, p) { - n = nvme_path_get_ns(p); - if (!n) - continue; - printf("%s%s", first ? "": ", ", - nvme_ns_get_name(n)); - first = false; - } - printf("\n"); - } - } - } + printf("%-16s %-96s %-.16s\n", "Subsystem", "Subsystem-NQN", "Controllers"); + printf("%-.16s %-.96s %-.16s\n", dash, dash, dash); + strset_iterate(&res.subsystems, stdout_detailed_subsys, &res); + printf("\n"); + + printf("%-8s %-20s %-40s %-8s %-6s %-14s %-6s %-12s %-16s\n", "Device", + "SN", "MN", "FR", "TxPort", "Asdress", "Slot", "Subsystem", "Namespaces"); + printf("%-.8s %-.20s %-.40s %-.8s %-.6s %-.14s %-.6s %-.12s %-.16s\n", dash, + dash, dash, dash, dash, dash, dash, dash, dash); + strset_iterate(&res.ctrls, stdout_detailed_ctrl, &res); printf("\n"); printf("%-12s %-12s %-10s %-26s %-16s %-16s\n", "Device", "Generic", "NSID", "Usage", "Format", "Controllers"); printf("%-.12s %-.12s %-.10s %-.26s %-.16s %-.16s\n", dash, dash, dash, dash, dash, dash); + strset_iterate(&res.namespaces, stdout_detailed_ns, &res); - nvme_for_each_host(r, h) { - nvme_for_each_subsystem(h, s) { - nvme_subsystem_for_each_ctrl(s, c) { - nvme_ctrl_for_each_ns(c, n) { - stdout_ns_details(n); - printf("%s\n", nvme_ctrl_get_name(c)); - } - } - - nvme_subsystem_for_each_ns(s, n) { - bool first = true; - - stdout_ns_details(n); - nvme_subsystem_for_each_ctrl(s, c) { - printf("%s%s", first ? "" : ", ", - nvme_ctrl_get_name(c)); - first = false; - } - printf("\n"); - } - } - } + nvme_resources_free(&res); } static void stdout_list_items(nvme_root_t r) @@ -4560,6 +4908,9 @@ static void stdout_subsystem_topology_multipath(nvme_subsystem_t s, if (ranking == NVME_CLI_TOPO_NAMESPACE) { nvme_subsystem_for_each_ns(s, n) { + if (!nvme_namespace_first_path(n)) + continue; + printf(" +- ns %d\n", nvme_ns_get_nsid(n)); printf(" \\\n"); @@ -4638,12 +4989,22 @@ static void stdout_simple_topology(nvme_root_t r, { nvme_host_t h; nvme_subsystem_t s; + bool first = true; nvme_for_each_host(r, h) { nvme_for_each_subsystem(h, s) { + int len = strlen(nvme_subsystem_get_name(s)); + + if (!first) + printf("\n"); + first = false; printf("%s - NQN=%s\n", nvme_subsystem_get_name(s), nvme_subsystem_get_nqn(s)); + printf("%*s hostnqn=%s\n", len, " ", + nvme_host_get_hostnqn(nvme_subsystem_get_host(s))); + printf("%*s iopolicy=%s\n", len, " ", + nvme_subsystem_get_iopolicy(s)); printf("\\\n"); if (nvme_is_multipath(s)) @@ -4668,7 +5029,7 @@ static void stdout_message(bool error, const char *msg, va_list ap) { vfprintf(error ? stderr : stdout, msg, ap); - printf("\n"); + fprintf(error ? stderr : stdout, "\n"); } static void stdout_perror(const char *msg) @@ -4721,12 +5082,14 @@ static void stdout_discovery_log(struct nvmf_discovery_log *log, int numrec) static void stdout_connect_msg(nvme_ctrl_t c) { - printf("device: %s\n", nvme_ctrl_get_name(c)); + printf("connecting to device: %s\n", nvme_ctrl_get_name(c)); } static struct print_ops stdout_print_ops = { + /* libnvme types.h print functions */ .ana_log = stdout_ana_log, .boot_part_log = stdout_boot_part_log, + .phy_rx_eom_log = stdout_phy_rx_eom_log, .ctrl_list = stdout_list_ctrl, .ctrl_registers = stdout_ctrl_registers, .directive = stdout_directive_show, @@ -4745,7 +5108,6 @@ static struct print_ops stdout_print_ops = { .fw_log = stdout_fw_log, .id_ctrl = stdout_id_ctrl, .id_ctrl_nvm = stdout_id_ctrl_nvm, - .id_ctrl_rpmbs = stdout_id_ctrl_rpmbs, .id_domain_list = stdout_id_domain_list, .id_independent_id_ns = stdout_cmd_set_independent_id_ns, .id_iocs = stdout_id_iocs, @@ -4754,9 +5116,7 @@ static struct print_ops stdout_print_ops = { .id_ns_granularity_list = stdout_id_ns_granularity_list, .id_nvmset_list = stdout_id_nvmset, .id_uuid_list = stdout_id_uuid_list, - .lba_range = stdout_lba_range, .lba_status = stdout_lba_status, - .lba_status_info = stdout_lba_status_info, .lba_status_log = stdout_lba_status_log, .media_unit_stat_log = stdout_media_unit_stat_log, .mi_cmd_support_effects_log = stdout_mi_cmd_support_effects_log, @@ -4773,25 +5133,38 @@ static struct print_ops stdout_print_ops = { .secondary_ctrl_list = stdout_list_secondary_ctrl, .select_result = stdout_select_result, .self_test_log = stdout_self_test_log, - .show_feature_fields = stdout_feature_show_fields, .single_property = stdout_single_property, .smart_log = stdout_smart_log, .supported_cap_config_list_log = stdout_supported_cap_config_log, .supported_log_pages = stdout_supported_log, + .zns_start_zone_list = stdout_zns_start_zone_list, .zns_changed_zone_log = stdout_zns_changed, + .zns_finish_zone_list = NULL, .zns_id_ctrl = stdout_zns_id_ctrl, .zns_id_ns = stdout_zns_id_ns, .zns_report_zones = stdout_zns_report_zones, + .show_feature = stdout_feature_show, + .show_feature_fields = stdout_feature_show_fields, + .id_ctrl_rpmbs = stdout_id_ctrl_rpmbs, + .lba_range = stdout_lba_range, + .lba_status_info = stdout_lba_status_info, + .d = stdout_d, + .show_init = NULL, + .show_finish = NULL, + /* libnvme tree print functions */ + .list_item = stdout_list_item, .list_items = stdout_list_items, .print_nvme_subsystem_list = stdout_subsystem_list, .topology_ctrl = stdout_topology_ctrl, .topology_namespace = stdout_topology_namespace, - .show_status = stdout_status, + /* status and error messages */ + .connect_msg = stdout_connect_msg, .show_message = stdout_message, .show_perror = stdout_perror, - .connect_msg = stdout_connect_msg, + .show_status = stdout_status, + .show_error_status = stdout_error_status, }; struct print_ops *nvme_get_stdout_print_ops(enum nvme_print_flags flags) diff --git a/nvme-print.c b/nvme-print.c index 4b977c1..1086aad 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -15,21 +15,21 @@ #include "util/types.h" #include "common.h" -#define nvme_print(name, flags, ...) \ -do { \ - struct print_ops *ops = nvme_print_ops(flags); \ - if (ops) { \ - if (ops->name) \ - ops->name(__VA_ARGS__); \ - return; \ - } \ -} while(0); +#define nvme_print(name, flags, ...) \ + do { \ + struct print_ops *ops = nvme_print_ops(flags); \ + if (ops && ops->name) \ + ops->name(__VA_ARGS__); \ + } while (false) + +#define nvme_print_output_format(name, ...) \ + nvme_print(name, nvme_is_output_format_json() ? JSON : NORMAL, ##__VA_ARGS__); static struct print_ops *nvme_print_ops(enum nvme_print_flags flags) { struct print_ops *ops = NULL; - if (flags & JSON) + if (flags & JSON || nvme_is_output_format_json()) ops = nvme_get_json_print_ops(flags); else if (flags & BINARY) ops = nvme_get_binary_print_ops(flags); @@ -135,7 +135,6 @@ void nvme_show_predictable_latency_per_nvmset( __u16 nvmset_id, const char *devname, enum nvme_print_flags flags) { - nvme_print(predictable_latency_per_nvmset, flags, plpns_log, nvmset_id, devname); } @@ -258,6 +257,12 @@ void nvme_show_boot_part_log(void *bp_log, const char *devname, nvme_print(boot_part_log, flags, bp_log, devname, size); } +void nvme_show_phy_rx_eom_log(struct nvme_phy_rx_eom_log *log, __u16 controller, + enum nvme_print_flags flags) +{ + nvme_print(phy_rx_eom_log, flags, log, controller); +} + void nvme_show_media_unit_stat_log(struct nvme_media_unit_stat_log *mus_log, enum nvme_print_flags flags) { @@ -273,7 +278,6 @@ void nvme_show_fdp_configs(struct nvme_fdp_config_log *log, size_t len, void nvme_show_fdp_usage(struct nvme_fdp_ruhu_log *log, size_t len, enum nvme_print_flags flags) { - nvme_print(fdp_usage_log, flags,log, len); } @@ -306,7 +310,6 @@ void nvme_show_fdp_events(struct nvme_fdp_events_log *log, void nvme_show_fdp_ruh_status(struct nvme_fdp_ruh_status *status, size_t len, enum nvme_print_flags flags) { - nvme_print(fdp_ruh_status, flags, status, len); } @@ -376,37 +379,7 @@ void nvme_show_relatives(const char *name) void d(unsigned char *buf, int len, int width, int group) { - int i, offset = 0, line_done = 0; - char ascii[32 + 1]; - - assert(width < sizeof(ascii)); - printf(" "); - for (i = 0; i <= 15; i++) - printf("%3x", i); - for (i = 0; i < len; i++) { - line_done = 0; - if (i % width == 0) - printf( "\n%04x:", offset); - if (i % group == 0) - printf( " %02x", buf[i]); - else - printf( "%02x", buf[i]); - ascii[i % width] = (buf[i] >= '!' && buf[i] <= '~') ? buf[i] : '.'; - if (((i + 1) % width) == 0) { - ascii[i % width + 1] = '\0'; - printf( " \"%.*s\"", width, ascii); - offset += width; - line_done = 1; - } - } - if (!line_done) { - unsigned b = width - (i % width); - ascii[i % width + 1] = '\0'; - printf( " %*s \"%.*s\"", - 2 * b + b / group + (b % group ? 1 : 0), "", - width, ascii); - } - printf( "\n"); + nvme_print(d, NORMAL, buf, len, width, group); } void d_raw(unsigned char *buf, unsigned len) @@ -418,20 +391,29 @@ void d_raw(unsigned char *buf, unsigned len) void nvme_show_status(int status) { - struct print_ops *ops; + struct print_ops *ops = nvme_print_ops(NORMAL); - if (argconfig_output_format_json(false)) + if (nvme_is_output_format_json()) ops = nvme_print_ops(JSON); - else - ops =nvme_print_ops(0); - if (!ops) - return; + if (ops && ops->show_status) + ops->show_status(status); +} - if (!ops->show_status) - return; +void nvme_show_error_status(int status, const char *msg, ...) +{ + struct print_ops *ops = nvme_print_ops(NORMAL); + va_list ap; - ops->show_status(status); + va_start(ap, msg); + + if (nvme_is_output_format_json()) + ops = nvme_print_ops(JSON); + + if (ops && ops->show_status) + ops->show_error_status(status, msg, ap); + + va_end(ap); } void nvme_show_id_ctrl_rpmbs(__le32 ctrl_rpmbs, enum nvme_print_flags flags) @@ -495,12 +477,24 @@ void nvme_show_list_ns(struct nvme_ns_list *ns_list, enum nvme_print_flags flags nvme_print(ns_list, flags, ns_list); } +void nvme_zns_start_zone_list(__u64 nr_zones, struct json_object **zone_list, + enum nvme_print_flags flags) +{ + nvme_print(zns_start_zone_list, flags, nr_zones, zone_list); +} + void nvme_show_zns_changed(struct nvme_zns_changed_zone_log *log, enum nvme_print_flags flags) { nvme_print(zns_changed_zone_log, flags, log); } +void nvme_zns_finish_zone_list(__u64 nr_zones, struct json_object *zone_list, + enum nvme_print_flags flags) +{ + nvme_print(zns_finish_zone_list, flags, nr_zones, zone_list); +} + const char *nvme_zone_type_to_string(__u8 cond) { switch (cond) { @@ -613,13 +607,13 @@ const char *nvme_trtype_to_string(__u8 trtype) } void nvme_show_error_log(struct nvme_error_log_page *err_log, int entries, - const char *devname, enum nvme_print_flags flags) + const char *devname, enum nvme_print_flags flags) { nvme_print(error_log, flags, err_log, entries, devname); } void nvme_show_resv_report(struct nvme_resv_status *status, int bytes, - bool eds, enum nvme_print_flags flags) + bool eds, enum nvme_print_flags flags) { nvme_print(resv_report, flags, status, bytes, eds); } @@ -658,12 +652,19 @@ const char *nvme_log_to_string(__u8 lid) case NVME_LOG_LID_ENDURANCE_GROUP: return "Endurance Group Information"; case NVME_LOG_LID_PREDICTABLE_LAT_NVMSET: return "Predictable Latency Per NVM Set"; case NVME_LOG_LID_PREDICTABLE_LAT_AGG: return "Predictable Latency Event Aggregate"; + case NVME_LOG_LID_MEDIA_UNIT_STATUS: return "Media Unit Status"; + case NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST: return "Supported Capacity Configuration List"; case NVME_LOG_LID_ANA: return "Asymmetric Namespace Access"; case NVME_LOG_LID_PERSISTENT_EVENT: return "Persistent Event Log"; case NVME_LOG_LID_LBA_STATUS: return "LBA Status Information"; case NVME_LOG_LID_ENDURANCE_GRP_EVT: return "Endurance Group Event Aggregate"; case NVME_LOG_LID_FID_SUPPORTED_EFFECTS: return "Feature Identifiers Supported and Effects"; + case NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS: return "NVMe-MI Commands Supported and Effects"; case NVME_LOG_LID_BOOT_PARTITION: return "Boot Partition"; + case NVME_LOG_LID_FDP_CONFIGS: return "FDP Configurations"; + case NVME_LOG_LID_FDP_RUH_USAGE: return "Reclaim Unit Handle Usage"; + case NVME_LOG_LID_FDP_STATS: return "FDP Statistics"; + case NVME_LOG_LID_FDP_EVENTS: return "FDP Events"; case NVME_LOG_LID_DISCOVER: return "Discovery"; case NVME_LOG_LID_RESERVATION: return "Reservation Notification"; case NVME_LOG_LID_SANITIZE: return "Sanitize Status"; @@ -788,9 +789,9 @@ const char *nvme_select_to_string(int sel) } } -void nvme_show_select_result(__u32 result) +void nvme_show_select_result(enum nvme_features_id fid, __u32 result) { - nvme_print(select_result, 0, result); + nvme_print(select_result, NORMAL, fid, result); } const char *nvme_feature_lba_type_to_string(__u8 type) @@ -867,9 +868,8 @@ const char *nvme_ns_wp_cfg_to_string(enum nvme_ns_write_protect_cfg state) } void nvme_directive_show(__u8 type, __u8 oper, __u16 spec, __u32 nsid, __u32 result, - void *buf, __u32 len, enum nvme_print_flags flags) + void *buf, __u32 len, enum nvme_print_flags flags) { - nvme_print(directive, flags, type, oper, spec, nsid, result, buf, len); } @@ -887,7 +887,7 @@ const char *nvme_plm_window_to_string(__u32 plm) void nvme_show_lba_status_info(__u32 result) { - nvme_print(lba_status_info, 0, result); + nvme_print(lba_status_info, NORMAL, result); } const char *nvme_host_metadata_type_to_string(enum nvme_features_id fid, @@ -950,13 +950,18 @@ const char *nvme_host_metadata_type_to_string(enum nvme_features_id fid, } } +void nvme_feature_show(enum nvme_features_id fid, int sel, unsigned int result) +{ + nvme_print(show_feature, NORMAL, fid, sel, result); +} + void nvme_feature_show_fields(enum nvme_features_id fid, unsigned int result, unsigned char *buf) { - nvme_print(show_feature_fields, 0, fid, result, buf); + nvme_print(show_feature_fields, NORMAL, fid, result, buf); } void nvme_show_lba_status(struct nvme_lba_status *list, unsigned long len, - enum nvme_print_flags flags) + enum nvme_print_flags flags) { nvme_print(lba_status, flags, list, len); } @@ -1004,7 +1009,7 @@ void nvme_generic_full_path(nvme_ns_t n, char *path, size_t len) void nvme_show_list_item(nvme_ns_t n) { - nvme_print(list_item, 0, n); + nvme_print(list_item, NORMAL, n); } void nvme_show_list_items(nvme_root_t r, enum nvme_print_flags flags) @@ -1016,45 +1021,37 @@ void nvme_show_topology(nvme_root_t r, enum nvme_cli_topo_ranking ranking, enum nvme_print_flags flags) { - nvme_print(topology_namespace, flags, r); + if (ranking == NVME_CLI_TOPO_NAMESPACE) + nvme_print(topology_namespace, flags, r); + else + nvme_print(topology_ctrl, flags, r); } void nvme_show_message(bool error, const char *msg, ...) { - struct print_ops *ops; + struct print_ops *ops = nvme_print_ops(NORMAL); va_list ap; + va_start(ap, msg); - if (argconfig_output_format_json(false)) + if (nvme_is_output_format_json()) ops = nvme_print_ops(JSON); - else - ops = nvme_print_ops(0); - if (!ops) - return; - - if (!ops->show_message) - return; - ops->show_message(error, msg, ap); + if (ops && ops->show_message) + ops->show_message(error, msg, ap); va_end(ap); } void nvme_show_perror(const char *msg) { - struct print_ops *ops; + struct print_ops *ops = nvme_print_ops(NORMAL); - if (argconfig_output_format_json(false)) + if (nvme_is_output_format_json()) ops = nvme_print_ops(JSON); - else - ops = nvme_print_ops(0); - if (!ops) - return; - - if (!ops->show_perror) - return; - ops->show_perror(msg); + if (ops && ops->show_perror) + ops->show_perror(msg); } void nvme_show_discovery_log(struct nvmf_discovery_log *log, uint64_t numrec, @@ -1067,3 +1064,13 @@ void nvme_show_connect_msg(nvme_ctrl_t c, enum nvme_print_flags flags) { nvme_print(connect_msg, flags, c); } + +void nvme_show_init(void) +{ + nvme_print_output_format(show_init); +} + +void nvme_show_finish(void) +{ + nvme_print_output_format(show_finish); +} diff --git a/nvme-print.h b/nvme-print.h index 638a2b6..4533474 100644 --- a/nvme-print.h +++ b/nvme-print.h @@ -8,8 +8,8 @@ #include <ccan/list/list.h> typedef struct nvme_effects_log_node { + struct nvme_cmd_effects_log effects; /* needs to be first member because of alignment requirement. */ enum nvme_csi csi; - struct nvme_cmd_effects_log effects; struct list_node node; } nvme_effects_log_node_t; @@ -23,6 +23,7 @@ struct print_ops { /* libnvme types.h print functions */ void (*ana_log)(struct nvme_ana_log *ana_log, const char *devname, size_t len); void (*boot_part_log)(void *bp_log, const char *devname, __u32 size); + void (*phy_rx_eom_log)(struct nvme_phy_rx_eom_log *log, __u16 controller); void (*ctrl_list)(struct nvme_ctrl_list *ctrl_list); void (*ctrl_registers)(void *bar, bool fabrics); void (*directive)(__u8 type, __u8 oper, __u16 spec, __u32 nsid, __u32 result, void *buf, __u32 len); @@ -64,21 +65,26 @@ struct print_ops { void (*resv_report)(struct nvme_resv_status *status, int bytes, bool eds); void (*sanitize_log_page)(struct nvme_sanitize_log_page *sanitize_log, const char *devname); void (*secondary_ctrl_list)(const struct nvme_secondary_ctrl_list *sc_list, __u32 count); - void (*select_result)(__u32 result); + void (*select_result)(enum nvme_features_id fid, __u32 result); void (*self_test_log)(struct nvme_self_test_log *self_test, __u8 dst_entries, __u32 size, const char *devname); void (*single_property)(int offset, uint64_t value64); void (*smart_log)(struct nvme_smart_log *smart, unsigned int nsid, const char *devname); void (*supported_cap_config_list_log)(struct nvme_supported_cap_config_list_log *cap_log); void (*supported_log_pages)(struct nvme_supported_log_pages *support_log, const char *devname); + void (*zns_start_zone_list)(__u64 nr_zones, struct json_object **zone_list); void (*zns_changed_zone_log)(struct nvme_zns_changed_zone_log *log); void (*zns_finish_zone_list)(__u64 nr_zones, struct json_object *zone_list); void (*zns_id_ctrl)(struct nvme_zns_id_ctrl *ctrl); void (*zns_id_ns)(struct nvme_zns_id_ns *ns, struct nvme_id_ns *id_ns); void (*zns_report_zones)(void *report, __u32 descs, __u8 ext_size, __u32 report_size, struct json_object *zone_list); - void (*show_feature_fields)(enum nvme_features_id id, unsigned int result, unsigned char *buf); + void (*show_feature)(enum nvme_features_id fid, int sel, unsigned int result); + void (*show_feature_fields)(enum nvme_features_id fid, unsigned int result, unsigned char *buf); void (*id_ctrl_rpmbs)(__le32 ctrl_rpmbs); void (*lba_range)(struct nvme_lba_range_type *lbrt, int nr_ranges); void (*lba_status_info)(__u32 result); + void (*d)(unsigned char *buf, int len, int width, int group); + void (*show_init)(void); + void (*show_finish)(void); /* libnvme tree print functions */ void (*list_item)(nvme_ns_t n); @@ -92,10 +98,32 @@ struct print_ops { void (*show_message)(bool error, const char *msg, va_list ap); void (*show_perror)(const char *msg); void (*show_status)(int status); + void (*show_error_status)(int status, const char *msg, va_list ap); enum nvme_print_flags flags; }; +struct nvme_bar_cap { + __u16 mqes; + __u8 cqr:1; + __u8 ams:2; + __u8 rsvd19:5; + __u8 to; + __u16 dstrd:4; + __u16 nssrs:1; + __u16 css:8; + __u16 bps:1; + __u8 cps:2; + __u8 mpsmin:4; + __u8 mpsmax:4; + __u8 pmrs:1; + __u8 cmbs:1; + __u8 nsss:1; + __u8 crwms:1; + __u8 crims:1; + __u8 rsvd61:3; +}; + #ifdef CONFIG_JSONC struct print_ops *nvme_get_json_print_ops(enum nvme_print_flags flags); @@ -116,6 +144,7 @@ void nvme_show_relatives(const char *name); void nvme_show_id_iocs(struct nvme_id_iocs *iocs, enum nvme_print_flags flags); void nvme_show_id_ctrl(struct nvme_id_ctrl *ctrl, enum nvme_print_flags flags, void (*vendor_show)(__u8 *vs, struct json_object *root)); +void nvme_show_id_ctrl_rpmbs(__le32 ctrl_rpmbs, enum nvme_print_flags flags); void nvme_show_id_ns(struct nvme_id_ns *ns, unsigned int nsid, unsigned int lba_index, bool cap_only, enum nvme_print_flags flags); void nvme_show_cmd_set_independent_id_ns( @@ -165,6 +194,8 @@ void nvme_show_resv_notif_log(struct nvme_resv_notification_log *resv, const char *devname, enum nvme_print_flags flags); void nvme_show_boot_part_log(void *bp_log, const char *devname, __u32 size, enum nvme_print_flags flags); +void nvme_show_phy_rx_eom_log(struct nvme_phy_rx_eom_log *log, + __u16 controller, enum nvme_print_flags flags); void nvme_show_fid_support_effects_log(struct nvme_fid_supported_effects_log *fid_log, const char *devname, enum nvme_print_flags flags); void nvme_show_mi_cmd_support_effects_log(struct nvme_mi_cmd_supported_effects_log *mi_cmd_log, @@ -203,10 +234,11 @@ void nvme_show_topology(nvme_root_t t, enum nvme_cli_topo_ranking ranking, enum nvme_print_flags flags); +void nvme_feature_show(enum nvme_features_id fid, int sel, unsigned int result); void nvme_feature_show_fields(enum nvme_features_id fid, unsigned int result, unsigned char *buf); void nvme_directive_show(__u8 type, __u8 oper, __u16 spec, __u32 nsid, __u32 result, void *buf, __u32 len, enum nvme_print_flags flags); -void nvme_show_select_result(__u32 result); +void nvme_show_select_result(enum nvme_features_id fid, __u32 result); void nvme_show_zns_id_ctrl(struct nvme_zns_id_ctrl *ctrl, enum nvme_print_flags flags); @@ -217,8 +249,12 @@ void nvme_show_nvm_id_ns(struct nvme_nvm_id_ns *nvm_ns, unsigned int nsid, bool cap_only, enum nvme_print_flags flags); void nvme_show_zns_id_ns(struct nvme_zns_id_ns *ns, struct nvme_id_ns *id_ns, enum nvme_print_flags flags); +void nvme_zns_start_zone_list(__u64 nr_zones, struct json_object **zone_list, + enum nvme_print_flags flags); void nvme_show_zns_changed(struct nvme_zns_changed_zone_log *log, enum nvme_print_flags flags); +void nvme_zns_finish_zone_list(__u64 nr_zones, struct json_object *zone_list, + enum nvme_print_flags flags); void nvme_show_zns_report_zones(void *report, __u32 descs, __u8 ext_size, __u32 report_size, struct json_object *zone_list, @@ -271,5 +307,7 @@ void nvme_dev_full_path(nvme_ns_t n, char *path, size_t len); void nvme_generic_full_path(nvme_ns_t n, char *path, size_t len); void nvme_show_message(bool error, const char *msg, ...); void nvme_show_perror(const char *msg); - -#endif +void nvme_show_error_status(int status, const char *msg, ...); +void nvme_show_init(void); +void nvme_show_finish(void); +#endif /* NVME_PRINT_H */ diff --git a/nvme-rpmb.c b/nvme-rpmb.c index 40ddb5b..345e6ea 100644 --- a/nvme-rpmb.c +++ b/nvme-rpmb.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Copyright (C) 2020 Micron Techology Inc. All rights reserved. + * Copyright (C) 2020 Micron Technology Inc. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -32,6 +32,7 @@ #include "common.h" #include "nvme.h" #include "libnvme.h" +#include "nvme-print.h" #define CREATE_CMD @@ -48,7 +49,6 @@ #define HMAC_SHA256_HASH_SIZE 32 #define MD5_HASH_HASH_SIZE 16 -extern int nvme_show_id_ctrl_rpmbs(unsigned int); /* * Utility function to create hash value of given data (with given key) using * given hash algorithm; this function uses kernel crypto services @@ -68,7 +68,7 @@ unsigned char *create_hash(const char *algo, .salg_name = { 0 } }; - /* copy algorith name */ + /* copy algorithm name */ if (strlen(algo) > sizeof(provider_sa.salg_name)) { fprintf(stderr, "%s: algorithm name overflow", __func__); return hash; @@ -608,7 +608,7 @@ static int rpmb_program_auth_key(int fd, unsigned char target, goto out; } - /* re-use response buffer */ + /* reuse response buffer */ memset(rsp, 0, rsp_size); err = recv_rpmb_rsp(fd, req->target, rsp_size, rsp); if (err != 0) { @@ -903,7 +903,7 @@ int rpmb_cmd_option(int argc, char **argv, struct command *cmd, struct plugin *p /* parse and validate options; default print rpmb support info */ if (cfg.cmd == 0 || strcmp(cfg.cmd, "info") == 0) { - nvme_show_id_ctrl_rpmbs(regs.rpmbs); + nvme_show_id_ctrl_rpmbs(regs.rpmbs, 0); goto out; } @@ -1005,7 +1005,7 @@ int rpmb_cmd_option(int argc, char **argv, struct command *cmd, struct plugin *p cfg.blocks, (regs.access_size + 1)); if (err > 0 && msg_buf != NULL) { - printf("Writting %d bytes to file %s\n", + printf("Writing %d bytes to file %s\n", err * 512, cfg.msgfile); write_file(msg_buf, err * 512, NULL, cfg.msgfile, NULL); diff --git a/nvme-wrap.c b/nvme-wrap.c index faea690..a61b489 100644 --- a/nvme-wrap.c +++ b/nvme-wrap.c @@ -106,11 +106,11 @@ int nvme_cli_identify_primary_ctrl(struct nvme_dev *dev, __u32 nsid, return do_admin_op(identify_primary_ctrl, dev, nsid, cap); } -int nvme_cli_identify_secondary_ctrl_list(struct nvme_dev *dev, __u32 nsid, +int nvme_cli_identify_secondary_ctrl_list(struct nvme_dev *dev, __u16 ctrl_id, struct nvme_secondary_ctrl_list *sc_list) { - return do_admin_op(identify_secondary_ctrl_list, dev, nsid, ctrl_id, + return do_admin_op(identify_secondary_ctrl_list, dev, ctrl_id, sc_list); } @@ -302,6 +302,12 @@ int nvme_cli_get_log_boot_partition(struct nvme_dev *dev, bool rae, __u8 lsp, return do_admin_op(get_log_boot_partition, dev, rae, lsp, len, part); } +int nvme_cli_get_log_phy_rx_eom(struct nvme_dev *dev, __u8 lsp, __u16 controller, + __u32 len, struct nvme_phy_rx_eom_log *part) +{ + return do_admin_op(get_log_phy_rx_eom, dev, lsp, controller, len, part); +} + int nvme_cli_get_log_discovery(struct nvme_dev *dev, bool rae, __u32 offset, __u32 len, void *log) { @@ -423,3 +429,8 @@ int nvme_cli_security_receive(struct nvme_dev *dev, return -ENODEV; } +void nvme_cli_set_debug(struct nvme_dev *dev, bool set) +{ + if (dev->type == NVME_DEV_DIRECT) + nvme_set_debug(set); +} diff --git a/nvme-wrap.h b/nvme-wrap.h index f4bec98..c50df14 100644 --- a/nvme-wrap.h +++ b/nvme-wrap.h @@ -28,7 +28,7 @@ int nvme_cli_identify_allocated_ns_list(struct nvme_dev *dev, __u32 nsid, struct nvme_ns_list *list); int nvme_cli_identify_primary_ctrl(struct nvme_dev *dev, __u32 nsid, struct nvme_primary_ctrl_cap *cap); -int nvme_cli_identify_secondary_ctrl_list(struct nvme_dev *dev, __u32 nsid, +int nvme_cli_identify_secondary_ctrl_list(struct nvme_dev *dev, __u16 ctrl_id, struct nvme_secondary_ctrl_list *sc_list); int nvme_cli_ns_mgmt_delete(struct nvme_dev *dev, __u32 nsid); @@ -105,6 +105,8 @@ int nvme_cli_get_log_mi_cmd_supported_effects(struct nvme_dev *dev, bool rae, int nvme_cli_get_log_boot_partition(struct nvme_dev *dev, bool rae, __u8 lsp, __u32 len, struct nvme_boot_partition *part); +int nvme_cli_get_log_phy_rx_eom(struct nvme_dev *dev, __u8 lsp, __u16 controller, + __u32 len, struct nvme_phy_rx_eom_log *part); int nvme_cli_get_log_discovery(struct nvme_dev *dev, bool rae, __u32 offset, __u32 len, void *log); int nvme_cli_get_log_media_unit_stat(struct nvme_dev *dev, __u16 domid, @@ -145,4 +147,5 @@ int nvme_cli_security_send(struct nvme_dev *dev, int nvme_cli_security_receive(struct nvme_dev *dev, struct nvme_security_receive_args* args); +void nvme_cli_set_debug(struct nvme_dev *dev, bool set); #endif /* _NVME_WRAP_H */ @@ -27,6 +27,7 @@ #include "config.h" #include "nvme/tree.h" #include "nvme/types.h" +#include "util/cleanup.h" #include <errno.h> #include <getopt.h> #include <fcntl.h> @@ -41,10 +42,6 @@ #include <libgen.h> #include <signal.h> -#ifdef CONFIG_LIBHUGETLBFS -#include <hugetlbfs.h> -#endif - #include <linux/fs.h> #include <sys/mman.h> @@ -68,6 +65,7 @@ #include "fabrics.h" #define CREATE_CMD #include "nvme-builtin.h" +#include "malloc.h" struct feat_cfg { enum nvme_features_id feature_id; @@ -108,6 +106,14 @@ struct passthru_config { bool latency; }; +#define NVME_ARGS(n, c, ...) \ + struct argconfig_commandline_options n[] = { \ + OPT_FLAG("verbose", 'v', NULL, verbose), \ + OPT_FMT("output-format", 'o', &output_format_val, output_format), \ + ##__VA_ARGS__, \ + OPT_END() \ + } + static const char nvme_version_string[] = NVME_VERSION; static struct plugin builtin = { @@ -130,8 +136,6 @@ static struct program nvme = { }; const char *output_format = "Output format: normal|json|binary"; -static const char *output_format_no_binary = "Output format: normal|json"; - static const char *app_tag = "app tag for end-to-end PI"; static const char *app_tag_mask = "app tag mask for end-to-end PI"; static const char *block_count = "number of blocks (zeroes based) on device to access"; @@ -181,58 +185,9 @@ static const char *verbose = "Increase output verbosity"; static const char dash[51] = {[0 ... 49] = '=', '\0'}; static const char space[51] = {[0 ... 49] = ' ', '\0'}; -static void *mmap_registers(nvme_root_t r, struct nvme_dev *dev); - -static void *__nvme_alloc(size_t len, bool *huge) -{ - void *p; - - if (!posix_memalign(&p, getpagesize(), len)) { - *huge = false; - memset(p, 0, len); - return p; - } - return NULL; -} - -#define HUGE_MIN 0x80000 - -#ifdef CONFIG_LIBHUGETLBFS -void nvme_free(void *p, bool huge) -{ - if (huge) { - if (p) - free_hugepage_region(p); - } else { - free(p); - } -} - -void *nvme_alloc(size_t len, bool *huge) -{ - void *p; - - if (len < HUGE_MIN) - return __nvme_alloc(len, huge); - - p = get_hugepage_region(len, GHR_DEFAULT); - if (!p) - return __nvme_alloc(len, huge); - - *huge = true; - return p; -} -#else -void nvme_free(void *p, bool huge) -{ - free(p); -} +static char *output_format_val = "normal"; -void *nvme_alloc(size_t len, bool *huge) -{ - return __nvme_alloc(len, huge); -} -#endif +static void *mmap_registers(nvme_root_t r, struct nvme_dev *dev); const char *nvme_strerror(int errnum) { @@ -246,7 +201,7 @@ int map_log_level(int verbose, bool quiet) int log_level; /* - * LOG_NOTICE is unsued thus the user has to provide two 'v' for getting + * LOG_NOTICE is unused thus the user has to provide two 'v' for getting * any feedback at all. Thus skip this level */ verbose++; @@ -429,7 +384,7 @@ static int get_dev(struct nvme_dev **dev, int argc, char **argv, int flags) else ret = open_dev_direct(dev, devname, flags); - return ret; + return ret != 0 ? -errno : 0; } int parse_and_open(struct nvme_dev **dev, int argc, char **argv, @@ -445,6 +400,8 @@ int parse_and_open(struct nvme_dev **dev, int argc, char **argv, ret = get_dev(dev, argc, argv, O_RDONLY); if (ret < 0) argconfig_print_help(desc, opts); + else if (argconfig_parse_seen(opts, "verbose")) + nvme_cli_set_debug(*dev, true); return ret; } @@ -460,21 +417,35 @@ int open_exclusive(struct nvme_dev **dev, int argc, char **argv, return get_dev(dev, argc, argv, flags); } -enum nvme_print_flags validate_output_format(const char *format) +int validate_output_format(const char *format, enum nvme_print_flags *flags) { + enum nvme_print_flags f; + if (!format) return -EINVAL; if (!strcmp(format, "normal")) - return NORMAL; + f = NORMAL; + else if (!strcmp(format, "json")) + f = JSON; + else if (!strcmp(format, "binary")) + f = BINARY; + else + return -EINVAL; + + *flags = f; + + return 0; +} - if (!strcmp(format, "json")) - return JSON; +bool nvme_is_output_format_json(void) +{ + enum nvme_print_flags flags; - if (!strcmp(format, "binary")) - return BINARY; + if (validate_output_format(output_format_val, &flags)) + return false; - return -EINVAL; + return flags == JSON; } void dev_close(struct nvme_dev *dev) @@ -493,46 +464,41 @@ void dev_close(struct nvme_dev *dev) static int get_smart_log(int argc, char **argv, struct command *cmd, struct plugin *plugin) { - struct nvme_smart_log smart_log; const char *desc = "Retrieve SMART log for the given device\n" "(or optionally a namespace) in either decoded format\n" "(default) or binary."; + + _cleanup_free_ struct nvme_smart_log *smart_log = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; const char *namespace = "(optional) desired namespace"; enum nvme_print_flags flags; - struct nvme_dev *dev; int err = -1; struct config { __u32 namespace_id; - char *output_format; bool raw_binary; bool human_readable; }; struct config cfg = { .namespace_id = NVME_NSID_ALL, - .output_format = "normal", .raw_binary = false, .human_readable = false, }; - - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_output), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_info), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_output), + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_info)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_fd; + return err; } if (cfg.raw_binary) @@ -541,18 +507,20 @@ static int get_smart_log(int argc, char **argv, struct command *cmd, struct plug if (cfg.human_readable) flags |= VERBOSE; + smart_log = nvme_alloc(sizeof(*smart_log)); + if (!smart_log) + return -ENOMEM; + err = nvme_cli_get_log_smart(dev, cfg.namespace_id, false, - &smart_log); + smart_log); if (!err) - nvme_show_smart_log(&smart_log, cfg.namespace_id, + nvme_show_smart_log(smart_log, cfg.namespace_id, dev->name, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("smart log: %s", nvme_strerror(errno)); -close_fd: - dev_close(dev); -ret: + return err; } @@ -562,72 +530,67 @@ static int get_ana_log(int argc, char **argv, struct command *cmd, const char *desc = "Retrieve ANA log for the given device in\n" "decoded format (default), json or binary."; const char *groups = "Return ANA groups only."; - void *ana_log; + + _cleanup_nvme_dev_ struct nvme_dev *dev= NULL; + _cleanup_free_ struct nvme_id_ctrl *ctrl = NULL; + _cleanup_free_ void *ana_log = NULL; size_t ana_log_len; - struct nvme_id_ctrl ctrl; enum nvme_print_flags flags; enum nvme_log_ana_lsp lsp; - struct nvme_dev *dev; int err = -1; struct config { bool groups; - char *output_format; }; struct config cfg = { .groups = false, - .output_format = "normal", }; - OPT_ARGS(opts) = { - OPT_FLAG("groups", 'g', &cfg.groups, groups), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FLAG("groups", 'g', &cfg.groups, groups)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_fd; + return err; } - err = nvme_cli_identify_ctrl(dev, &ctrl); + ctrl = nvme_alloc(sizeof(*ctrl)); + if (!ctrl) + return -ENOMEM; + + err = nvme_cli_identify_ctrl(dev, ctrl); if (err) { nvme_show_error("ERROR : nvme_identify_ctrl() failed: %s", nvme_strerror(errno)); - goto close_fd; + return err; } ana_log_len = sizeof(struct nvme_ana_log) + - le32_to_cpu(ctrl.nanagrpid) * sizeof(struct nvme_ana_group_desc); - if (!(ctrl.anacap & (1 << 6))) - ana_log_len += le32_to_cpu(ctrl.mnan) * sizeof(__le32); + le32_to_cpu(ctrl->nanagrpid) * sizeof(struct nvme_ana_group_desc); + if (!(ctrl->anacap & (1 << 6))) + ana_log_len += le32_to_cpu(ctrl->mnan) * sizeof(__le32); - ana_log = malloc(ana_log_len); - if (!ana_log) { - err = -ENOMEM; - goto close_fd; - } + ana_log = nvme_alloc(ana_log_len); + if (!ana_log) + return -ENOMEM; lsp = cfg.groups ? NVME_LOG_ANA_LSP_RGO_GROUPS_ONLY : NVME_LOG_ANA_LSP_RGO_NAMESPACES; err = nvme_cli_get_log_ana(dev, lsp, true, 0, ana_log_len, ana_log); if (!err) - nvme_show_ana_log(ana_log, dev->name, flags, ana_log_len); + nvme_show_ana_log(ana_log, dev->name, ana_log_len, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("ana-log: %s", nvme_strerror(errno)); - free(ana_log); -close_fd: - dev_close(dev); -ret: + return err; } @@ -637,25 +600,32 @@ static int parse_telemetry_da(struct nvme_dev *dev, size_t *size) { - struct nvme_id_ctrl id_ctrl; + _cleanup_free_ struct nvme_id_ctrl *id_ctrl = NULL; + size_t dalb = 0; + + id_ctrl = nvme_alloc(sizeof(*id_ctrl)); + if (!id_ctrl) + return -ENOMEM; switch (da) { case NVME_TELEMETRY_DA_1: + dalb = le16_to_cpu(telem->dalb1); + break; case NVME_TELEMETRY_DA_2: + dalb = le16_to_cpu(telem->dalb2); + break; case NVME_TELEMETRY_DA_3: /* dalb3 >= dalb2 >= dalb1 */ - *size = (le16_to_cpu(telem->dalb3) + 1) * - NVME_LOG_TELEM_BLOCK_SIZE; + dalb = le16_to_cpu(telem->dalb3); break; case NVME_TELEMETRY_DA_4: - if (nvme_cli_identify_ctrl(dev, &id_ctrl)) { + if (nvme_cli_identify_ctrl(dev, id_ctrl)) { perror("identify-ctrl"); return -errno; } - if (id_ctrl.lpa & 0x40) { - *size = (le32_to_cpu(telem->dalb4) + 1) * - NVME_LOG_TELEM_BLOCK_SIZE; + if (id_ctrl->lpa & 0x40) { + dalb = le32_to_cpu(telem->dalb4); } else { nvme_show_error( "Data area 4 unsupported, bit 6 of Log Page Attributes not set"); @@ -667,10 +637,11 @@ static int parse_telemetry_da(struct nvme_dev *dev, return -EINVAL; } - if (*size == NVME_LOG_TELEM_BLOCK_SIZE) { + if (dalb == 0) { nvme_show_error("ERROR: No telemetry data block"); return -ENOENT; } + *size = (dalb + 1) * NVME_LOG_TELEM_BLOCK_SIZE; return 0; } @@ -680,7 +651,7 @@ static int get_log_telemetry_ctrl(struct nvme_dev *dev, bool rae, size_t size, struct nvme_telemetry_log *log; int err; - log = calloc(1, size); + log = nvme_alloc(size); if (!log) return -errno; @@ -700,7 +671,7 @@ static int get_log_telemetry_host(struct nvme_dev *dev, size_t size, struct nvme_telemetry_log *log; int err; - log = calloc(1, size); + log = nvme_alloc(size); if (!log) return -errno; @@ -719,10 +690,14 @@ static int __create_telemetry_log_host(struct nvme_dev *dev, size_t *size, struct nvme_telemetry_log **buf) { - struct nvme_telemetry_log log = { 0 }; + _cleanup_free_ struct nvme_telemetry_log *log = NULL; int err; - err = nvme_cli_get_log_create_telemetry_host(dev, &log); + log = nvme_alloc(sizeof(*log)); + if (!log) + return -ENOMEM; + + err = nvme_cli_get_log_create_telemetry_host(dev, log); if (err) return -errno; @@ -739,7 +714,7 @@ static int __get_telemetry_log_ctrl(struct nvme_dev *dev, struct nvme_telemetry_log *log; int err; - log = calloc(1, NVME_LOG_TELEM_BLOCK_SIZE); + log = nvme_alloc(NVME_LOG_TELEM_BLOCK_SIZE); if (!log) return -errno; @@ -784,16 +759,20 @@ static int __get_telemetry_log_host(struct nvme_dev *dev, size_t *size, struct nvme_telemetry_log **buf) { - struct nvme_telemetry_log log = { 0 }; + _cleanup_free_ struct nvme_telemetry_log *log = NULL; int err; + log = nvme_alloc(sizeof(*log)); + if (!log) + return -errno; + err = nvme_cli_get_log_telemetry_host(dev, 0, NVME_LOG_TELEM_BLOCK_SIZE, - &log); + log); if (err) return err; - err = parse_telemetry_da(dev, da, &log, size); + err = parse_telemetry_da(dev, da, log, size); if (err) return err; @@ -808,12 +787,14 @@ static int get_telemetry_log(int argc, char **argv, struct command *cmd, const char *hgen = "Have the host tell the controller to generate the report"; const char *cgen = "Gather report generated by the controller."; const char *dgen = "Pick which telemetry data area to report. Default is 3 to fetch areas 1-3. Valid options are 1, 2, 3, 4."; - struct nvme_telemetry_log *log = NULL; - int err = 0, output; + + _cleanup_free_ struct nvme_telemetry_log *log = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_file_ int output = -1; + int err = 0; size_t total_size; __u8 *data_ptr = NULL; int data_written = 0, data_remaining = 0; - struct nvme_dev *dev; struct config { char *file_name; @@ -830,23 +811,20 @@ static int get_telemetry_log(int argc, char **argv, struct command *cmd, .rae = true, }; - OPT_ARGS(opts) = { - OPT_FILE("output-file", 'o', &cfg.file_name, fname), - OPT_UINT("host-generate", 'g', &cfg.host_gen, hgen), - OPT_FLAG("controller-init", 'c', &cfg.ctrl_init, cgen), - OPT_UINT("data-area", 'd', &cfg.data_area, dgen), - OPT_FLAG("rae", 'r', &cfg.rae, rae), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FILE("output-file", 'O', &cfg.file_name, fname), + OPT_UINT("host-generate", 'g', &cfg.host_gen, hgen), + OPT_FLAG("controller-init", 'c', &cfg.ctrl_init, cgen), + OPT_UINT("data-area", 'd', &cfg.data_area, dgen), + OPT_FLAG("rae", 'r', &cfg.rae, rae)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (!cfg.file_name) { nvme_show_error("Please provide an output file!"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } cfg.host_gen = !!cfg.host_gen; @@ -854,10 +832,13 @@ static int get_telemetry_log(int argc, char **argv, struct command *cmd, if (output < 0) { nvme_show_error("Failed to open output file %s: %s!", cfg.file_name, strerror(errno)); - err = output; - goto close_dev; + return output; } + log = nvme_alloc(sizeof(*log)); + if (!log) + return -ENOMEM; + if (cfg.ctrl_init) err = __get_telemetry_log_ctrl(dev, cfg.rae, cfg.data_area, &total_size, &log); @@ -870,11 +851,11 @@ static int get_telemetry_log(int argc, char **argv, struct command *cmd, if (err < 0) { nvme_show_error("get-telemetry-log: %s", nvme_strerror(errno)); - goto close_output; + return err; } else if (err > 0) { nvme_show_status(err); fprintf(stderr, "Failed to acquire telemetry log %d!\n", err); - goto close_output; + return err; } data_written = 0; @@ -902,63 +883,54 @@ static int get_telemetry_log(int argc, char **argv, struct command *cmd, return -1; } - free(log); - -close_output: - close(output); -close_dev: - dev_close(dev); -ret: return err; } static int get_endurance_log(int argc, char **argv, struct command *cmd, struct plugin *plugin) { - struct nvme_endurance_group_log endurance_log; const char *desc = "Retrieves endurance groups log page and prints the log."; const char *group_id = "The endurance group identifier"; + + _cleanup_free_ struct nvme_endurance_group_log *endurance_log = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; struct config { - char *output_format; __u16 group_id; }; struct config cfg = { - .output_format = "normal", .group_id = 0, }; - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_SHRT("group-id", 'g', &cfg.group_id, group_id), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_SHRT("group-id", 'g', &cfg.group_id, group_id)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } + endurance_log = nvme_alloc(sizeof(*endurance_log)); + if (!endurance_log) + return -ENOMEM; + err = nvme_cli_get_log_endurance_group(dev, cfg.group_id, - &endurance_log); + endurance_log); if (!err) - nvme_show_endurance_log(&endurance_log, cfg.group_id, + nvme_show_endurance_log(endurance_log, cfg.group_id, dev->name, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("endurance log: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } @@ -968,7 +940,7 @@ static int collect_effects_log(struct nvme_dev *dev, enum nvme_csi csi, nvme_effects_log_node_t *node; int err; - node = malloc(sizeof(nvme_effects_log_node_t)); + node = nvme_alloc(sizeof(*node)); if (!node) return -ENOMEM; @@ -986,9 +958,10 @@ static int collect_effects_log(struct nvme_dev *dev, enum nvme_csi csi, static int get_effects_log(int argc, char **argv, struct command *cmd, struct plugin *plugin) { const char *desc = "Retrieve command effects log page and print the table."; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; struct list_head log_pages; nvme_effects_log_node_t *node; - struct nvme_dev *dev; void *bar = NULL; @@ -996,35 +969,30 @@ static int get_effects_log(int argc, char **argv, struct command *cmd, struct pl enum nvme_print_flags flags; struct config { - char *output_format; bool human_readable; bool raw_binary; int csi; }; struct config cfg = { - .output_format = "normal", .human_readable = false, .raw_binary = false, .csi = -1, }; - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_log), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_log), - OPT_INT("csi", 'c', &cfg.csi, csi), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_log), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_log), + OPT_INT("csi", 'c', &cfg.csi, csi)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) @@ -1056,7 +1024,7 @@ static int get_effects_log(int argc, char **argv, struct command *cmd, struct pl }; err = nvme_get_property(&args); if (err) - goto close_dev; + goto cleanup_list; } if (NVME_CAP_CSS(cap) & NVME_CAP_CSS_NVM) @@ -1077,12 +1045,10 @@ static int get_effects_log(int argc, char **argv, struct command *cmd, struct pl else nvme_show_perror("effects log page"); -close_dev: +cleanup_list: while ((node = list_pop(&log_pages, nvme_effects_log_node_t, node))) free(node); - dev_close(dev); -ret: return err; } @@ -1090,51 +1056,39 @@ static int get_supported_log_pages(int argc, char **argv, struct command *cmd, struct plugin *plugin) { const char *desc = "Retrieve supported logs and print the table."; - struct nvme_supported_log_pages supports; + + _cleanup_free_ struct nvme_supported_log_pages *supports = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err = -1; - struct config { - char *output_format; - bool verbose; - }; - - struct config cfg = { - .output_format = "normal", - .verbose = false - }; - - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("verbose", 'v', &cfg.verbose, verbose), - OPT_END() - }; + NVME_ARGS(opts, cfg); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } - if (cfg.verbose) + if (argconfig_parse_seen(opts, "verbose")) flags |= VERBOSE; - err = nvme_cli_get_log_supported_log_pages(dev, false, &supports); + supports = nvme_alloc(sizeof(*supports)); + if (!supports) + return -ENOMEM; + + err = nvme_cli_get_log_supported_log_pages(dev, false, supports); if (!err) - nvme_show_supported_log(&supports, dev->name, flags); + nvme_show_supported_log(supports, dev->name, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("supported log pages: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: return err; } @@ -1145,39 +1099,35 @@ static int get_error_log(int argc, char **argv, struct command *cmd, struct plug "in either decoded format (default) or binary."; const char *log_entries = "number of entries to retrieve"; const char *raw = "dump in binary format"; - struct nvme_error_log_page *err_log; + + _cleanup_free_ struct nvme_error_log_page *err_log = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; struct nvme_id_ctrl ctrl; enum nvme_print_flags flags; - struct nvme_dev *dev; int err = -1; struct config { __u32 log_entries; - char *output_format; bool raw_binary; }; struct config cfg = { .log_entries = 64, - .output_format = "normal", .raw_binary = false, }; - OPT_ARGS(opts) = { - OPT_UINT("log-entries", 'e', &cfg.log_entries, log_entries), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("log-entries", 'e', &cfg.log_entries, log_entries), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) @@ -1185,26 +1135,22 @@ static int get_error_log(int argc, char **argv, struct command *cmd, struct plug if (!cfg.log_entries) { nvme_show_error("non-zero log-entries is required param"); - err = -1; - goto close_dev; + return -1; } err = nvme_cli_identify_ctrl(dev, &ctrl); if (err < 0) { nvme_show_perror("identify controller"); - goto close_dev; + return err; } else if (err) { nvme_show_error("could not identify controller"); - err = -1; - goto close_dev; + return err; } cfg.log_entries = min(cfg.log_entries, ctrl.elpe + 1); - err_log = calloc(cfg.log_entries, sizeof(struct nvme_error_log_page)); - if (!err_log) { - err = -1; - goto close_dev; - } + err_log = nvme_alloc(cfg.log_entries * sizeof(struct nvme_error_log_page)); + if (!err_log) + return -ENOMEM; err = nvme_cli_get_log_error(dev, cfg.log_entries, false, err_log); if (!err) @@ -1215,11 +1161,6 @@ static int get_error_log(int argc, char **argv, struct command *cmd, struct plug else nvme_show_perror("error log"); - free(err_log); - -close_dev: - dev_close(dev); -ret: return err; } @@ -1227,50 +1168,48 @@ static int get_fw_log(int argc, char **argv, struct command *cmd, struct plugin { const char *desc = "Retrieve the firmware log for the\n" "specified device in either decoded format (default) or binary."; - struct nvme_firmware_slot fw_log; + + _cleanup_free_ struct nvme_firmware_slot *fw_log = NULL;; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; struct config { - char *output_format; bool raw_binary; }; struct config cfg = { - .output_format = "normal", .raw_binary = false, }; - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) flags = BINARY; - err = nvme_cli_get_log_fw_slot(dev, false, &fw_log); + fw_log = nvme_alloc(sizeof(*fw_log)); + if (!fw_log) + return -ENOMEM; + + err = nvme_cli_get_log_fw_slot(dev, false, fw_log); if (!err) - nvme_show_fw_log(&fw_log, dev->name, flags); + nvme_show_fw_log(fw_log, dev->name, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("fw log: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } @@ -1278,52 +1217,50 @@ static int get_changed_ns_list_log(int argc, char **argv, struct command *cmd, s { const char *desc = "Retrieve Changed Namespaces log for the given device\n" "in either decoded format (default) or binary."; - struct nvme_ns_list changed_ns_list_log; + + _cleanup_free_ struct nvme_ns_list *changed_ns_list_log = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; struct config { - char *output_format; bool raw_binary; }; struct config cfg = { - .output_format = "normal", .raw_binary = false, }; - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_output), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_output)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) flags = BINARY; + changed_ns_list_log = nvme_alloc(sizeof(*changed_ns_list_log)); + if (!changed_ns_list_log) + return -ENOMEM; + err = nvme_cli_get_log_changed_ns_list(dev, true, - &changed_ns_list_log); + changed_ns_list_log); if (!err) - nvme_show_changed_ns_list_log(&changed_ns_list_log, + nvme_show_changed_ns_list_log(changed_ns_list_log, dev->name, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("changed ns list log: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } @@ -1334,56 +1271,53 @@ static int get_pred_lat_per_nvmset_log(int argc, char **argv, "page and prints it for the given device in either decoded\n" "format(default),json or binary."; const char *nvmset_id = "NVM Set Identifier"; - struct nvme_nvmset_predictable_lat_log plpns_log; + + _cleanup_free_ struct nvme_nvmset_predictable_lat_log *plpns_log = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; struct config { __u16 nvmset_id; - char *output_format; bool raw_binary; }; struct config cfg = { .nvmset_id = 1, - .output_format = "normal", .raw_binary = false, }; - OPT_ARGS(opts) = { - OPT_SHRT("nvmset-id", 'i', &cfg.nvmset_id, nvmset_id), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_SHRT("nvmset-id", 'i', &cfg.nvmset_id, nvmset_id), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) flags = BINARY; + plpns_log = nvme_alloc(sizeof(*plpns_log)); + if (!plpns_log) + return -ENOMEM; + err = nvme_cli_get_log_predictable_lat_nvmset(dev, cfg.nvmset_id, - &plpns_log); + plpns_log); if (!err) - nvme_show_predictable_latency_per_nvmset(&plpns_log, cfg.nvmset_id, dev->name, + nvme_show_predictable_latency_per_nvmset(plpns_log, cfg.nvmset_id, dev->name, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("predictable latency per nvm set: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: return err; } @@ -1394,43 +1328,39 @@ static int get_pred_lat_event_agg_log(int argc, char **argv, "Aggregate Log page and prints it, for the given\n" "device in either decoded format(default), json or binary."; const char *log_entries = "Number of pending NVM Set log Entries list"; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ struct nvme_id_ctrl *ctrl = NULL; + _cleanup_free_ void *pea_log = NULL; enum nvme_print_flags flags; - struct nvme_id_ctrl ctrl; - struct nvme_dev *dev; __u32 log_size; - void *pea_log; int err; struct config { __u64 log_entries; bool rae; - char *output_format; bool raw_binary; }; struct config cfg = { .log_entries = 2044, .rae = false, - .output_format = "normal", .raw_binary = false, }; - OPT_ARGS(opts) = { - OPT_UINT("log-entries", 'e', &cfg.log_entries, log_entries), - OPT_FLAG("rae", 'r', &cfg.rae, rae), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("log-entries", 'e', &cfg.log_entries, log_entries), + OPT_FLAG("rae", 'r', &cfg.rae, rae), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) @@ -1438,26 +1368,28 @@ static int get_pred_lat_event_agg_log(int argc, char **argv, if (!cfg.log_entries) { nvme_show_error("non-zero log-entries is required param"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } - err = nvme_cli_identify_ctrl(dev, &ctrl); + ctrl = nvme_alloc(sizeof(*ctrl)); + if (!ctrl) + return -ENOMEM; + + err = nvme_cli_identify_ctrl(dev, ctrl); if (err < 0) { nvme_show_error("identify controller: %s", nvme_strerror(errno)); - goto close_dev; + return err; } else if (err) { nvme_show_status(err); - goto close_dev; + return err; } - cfg.log_entries = min(cfg.log_entries, le32_to_cpu(ctrl.nsetidmax)); + cfg.log_entries = min(cfg.log_entries, le32_to_cpu(ctrl->nsetidmax)); log_size = sizeof(__u64) + cfg.log_entries * sizeof(__u16); - pea_log = calloc(log_size, 1); - if (!pea_log) { - err = -ENOMEM; - goto close_dev; - } + + pea_log = nvme_alloc(log_size); + if (!pea_log) + return -ENOMEM; err = nvme_cli_get_log_predictable_lat_event(dev, cfg.rae, 0, log_size, pea_log); @@ -1469,11 +1401,7 @@ static int get_pred_lat_event_agg_log(int argc, char **argv, else nvme_show_error("predictable latency event aggregate log page: %s", nvme_strerror(errno)); - free(pea_log); -close_dev: - dev_close(dev); -ret: return err; } @@ -1485,74 +1413,69 @@ static int get_persistent_event_log(int argc, char **argv, const char *action = "action the controller shall take during\n" "processing this persistent log page command."; const char *log_len = "number of bytes to retrieve"; - struct nvme_persistent_event_log *pevent, *pevent_collected; + + _cleanup_free_ struct nvme_persistent_event_log *pevent_collected = NULL; + _cleanup_free_ struct nvme_persistent_event_log *pevent = NULL; + _cleanup_huge_ struct nvme_mem_huge mh = { 0, }; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; void *pevent_log_info; - struct nvme_dev *dev; - bool huge; int err; struct config { __u8 action; __u32 log_len; - char *output_format; bool raw_binary; }; struct config cfg = { .action = 0xff, .log_len = 0, - .output_format = "normal", .raw_binary = false, }; - OPT_ARGS(opts) = { - OPT_BYTE("action", 'a', &cfg.action, action), - OPT_UINT("log_len", 'l', &cfg.log_len, log_len), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_BYTE("action", 'a', &cfg.action, action), + OPT_UINT("log_len", 'l', &cfg.log_len, log_len), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) flags = BINARY; - pevent = calloc(sizeof(*pevent), 1); - if (!pevent) { - err = -ENOMEM; - goto close_dev; - } + pevent = nvme_alloc(sizeof(*pevent)); + if (!pevent) + return -ENOMEM; err = nvme_cli_get_log_persistent_event(dev, cfg.action, sizeof(*pevent), pevent); if (err < 0) { nvme_show_error("persistent event log: %s", nvme_strerror(errno)); - goto free_pevent; + return err; } else if (err) { nvme_show_status(err); - goto free_pevent; + return err; } if (cfg.action == NVME_PEVENT_LOG_RELEASE_CTX) { printf("Releasing Persistent Event Log Context\n"); - goto free_pevent; + return 0; } if (!cfg.log_len && cfg.action != NVME_PEVENT_LOG_EST_CTX_AND_READ) { cfg.log_len = le64_to_cpu(pevent->tll); } else if (!cfg.log_len && cfg.action == NVME_PEVENT_LOG_EST_CTX_AND_READ) { printf("Establishing Persistent Event Log Context\n"); - goto free_pevent; + return 0; } /* @@ -1565,11 +1488,10 @@ static int get_persistent_event_log(int argc, char **argv, if (cfg.action == NVME_PEVENT_LOG_EST_CTX_AND_READ) cfg.action = NVME_PEVENT_LOG_READ; - pevent_log_info = nvme_alloc(cfg.log_len, &huge); - if (!pevent_log_info) { - err = -ENOMEM; - goto free_pevent; - } + pevent_log_info = nvme_alloc_huge(cfg.log_len, &mh); + if (!pevent_log_info) + return -ENOMEM; + err = nvme_cli_get_log_persistent_event(dev, cfg.action, cfg.log_len, pevent_log_info); if (!err) { @@ -1578,16 +1500,16 @@ static int get_persistent_event_log(int argc, char **argv, pevent); if (err < 0) { nvme_show_error("persistent event log: %s", nvme_strerror(errno)); - goto free; + return err; } else if (err) { nvme_show_status(err); - goto free; + return err; } pevent_collected = pevent_log_info; if (pevent_collected->gen_number != pevent->gen_number) { printf("Collected Persistent Event Log may be invalid,\n" "Re-read the log is required\n"); - goto free; + return -EINVAL; } nvme_show_persistent_event_log(pevent_log_info, cfg.action, @@ -1598,13 +1520,6 @@ static int get_persistent_event_log(int argc, char **argv, nvme_show_error("persistent event log: %s", nvme_strerror(errno)); } -free: - nvme_free(pevent_log_info, huge); -free_pevent: - free(pevent); -close_dev: - dev_close(dev); -ret: return err; } @@ -1615,43 +1530,39 @@ static int get_endurance_event_agg_log(int argc, char **argv, "Event Aggregate page and prints it, for the given\n" "device in either decoded format(default), json or binary."; const char *log_entries = "Number of pending Endurance Group Event log Entries list"; - void *endurance_log; - struct nvme_id_ctrl ctrl; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ struct nvme_id_ctrl *ctrl = NULL; + _cleanup_free_ void *endurance_log = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; __u32 log_size; int err; struct config { __u64 log_entries; bool rae; - char *output_format; bool raw_binary; }; struct config cfg = { .log_entries = 2044, .rae = false, - .output_format = "normal", .raw_binary = false, }; - OPT_ARGS(opts) = { - OPT_UINT("log-entries", 'e', &cfg.log_entries, log_entries), - OPT_FLAG("rae", 'r', &cfg.rae, rae), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("log-entries", 'e', &cfg.log_entries, log_entries), + OPT_FLAG("rae", 'r', &cfg.rae, rae), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) @@ -1659,27 +1570,28 @@ static int get_endurance_event_agg_log(int argc, char **argv, if (!cfg.log_entries) { nvme_show_error("non-zero log-entries is required param"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } - err = nvme_cli_identify_ctrl(dev, &ctrl); + ctrl = nvme_alloc(sizeof(*ctrl)); + if (!ctrl) + return -ENOMEM; + + err = nvme_cli_identify_ctrl(dev, ctrl); if (err < 0) { nvme_show_error("identify controller: %s", nvme_strerror(errno)); - goto close_dev; + return err; } else if (err) { nvme_show_error("could not identify controller"); - err = -ENODEV; - goto close_dev; + return -ENODEV; } - cfg.log_entries = min(cfg.log_entries, le16_to_cpu(ctrl.endgidmax)); + cfg.log_entries = min(cfg.log_entries, le16_to_cpu(ctrl->endgidmax)); log_size = sizeof(__u64) + cfg.log_entries * sizeof(__u16); - endurance_log = calloc(log_size, 1); - if (!endurance_log) { - err = -ENOMEM; - goto close_dev; - } + + endurance_log = nvme_alloc(log_size); + if (!endurance_log) + return -ENOMEM; err = nvme_cli_get_log_endurance_grp_evt(dev, cfg.rae, 0, log_size, endurance_log); @@ -1691,11 +1603,7 @@ static int get_endurance_event_agg_log(int argc, char **argv, else nvme_show_error("endurance group event aggregate log page: %s", nvme_strerror(errno)); - free(endurance_log); -close_dev: - dev_close(dev); -ret: return err; } @@ -1704,66 +1612,56 @@ static int get_lba_status_log(int argc, char **argv, { const char *desc = "Retrieve Get LBA Status Info Log and prints it,\n" "for the given device in either decoded format(default),json or binary."; - void *lab_status; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ void *lba_status = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; __u32 lslplen; int err; struct config { bool rae; - char *output_format; }; struct config cfg = { .rae = false, - .output_format = "normal", }; - OPT_ARGS(opts) = { - OPT_FLAG("rae", 'r', &cfg.rae, rae), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FLAG("rae", 'r', &cfg.rae, rae)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } err = nvme_cli_get_log_lba_status(dev, true, 0, sizeof(__u32), &lslplen); if (err < 0) { nvme_show_error("lba status log page: %s", nvme_strerror(errno)); - goto close_dev; + return err; } else if (err) { nvme_show_status(err); - goto close_dev; + return err; } - lab_status = calloc(lslplen, 1); - if (!lab_status) { - err = -ENOMEM; - goto close_dev; - } + lba_status = nvme_alloc(lslplen); + if (!lba_status) + return -ENOMEM; - err = nvme_cli_get_log_lba_status(dev, cfg.rae, 0, lslplen, lab_status); + err = nvme_cli_get_log_lba_status(dev, cfg.rae, 0, lslplen, lba_status); if (!err) - nvme_show_lba_status_log(lab_status, lslplen, dev->name, flags); + nvme_show_lba_status_log(lba_status, lslplen, dev->name, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("lba status log page: %s", nvme_strerror(errno)); - free(lab_status); -close_dev: - dev_close(dev); -ret: return err; } @@ -1774,45 +1672,36 @@ static int get_resv_notif_log(int argc, char **argv, const char *desc = "Retrieve Reservation Notification\n" "log page and prints it, for the given\n" "device in either decoded format(default), json or binary."; - struct nvme_resv_notification_log resv; + + _cleanup_free_ struct nvme_resv_notification_log *resv = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; - struct config { - char *output_format; - }; - - struct config cfg = { - .output_format = "normal", - }; - - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } - err = nvme_cli_get_log_reservation(dev, false, &resv); + resv = nvme_alloc(sizeof(*resv)); + if (!resv) + return -ENOMEM; + + err = nvme_cli_get_log_reservation(dev, false, resv); if (!err) - nvme_show_resv_notif_log(&resv, dev->name, flags); + nvme_show_resv_notif_log(resv, dev->name, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("resv notifi log: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: return err; } @@ -1823,103 +1712,184 @@ static int get_boot_part_log(int argc, char **argv, struct command *cmd, struct "log page and prints it, for the given\n" "device in either decoded format(default), json or binary."; const char *fname = "boot partition data output file name"; - struct nvme_boot_partition boot; - __u8 *bp_log; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ struct nvme_boot_partition *boot = NULL; + _cleanup_free_ __u8 *bp_log = NULL; enum nvme_print_flags flags; - int err = -1, output = 0; - struct nvme_dev *dev; + int err = -1; + _cleanup_file_ int output = -1; __u32 bpsz = 0; struct config { __u8 lsp; char *file_name; - char *output_format; }; struct config cfg = { .lsp = 0, - .output_format = "normal", .file_name = NULL, }; - OPT_ARGS(opts) = { - OPT_BYTE("lsp", 's', &cfg.lsp, lsp), - OPT_FILE("output-file", 'f', &cfg.file_name, fname), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_BYTE("lsp", 's', &cfg.lsp, lsp), + OPT_FILE("output-file", 'f', &cfg.file_name, fname)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (!cfg.file_name) { nvme_show_error("Please provide an output file!"); - err = -1; - goto close_dev; + return -1; } if (cfg.lsp > 127) { nvme_show_error("invalid lsp param: %u", cfg.lsp); - err = -1; - goto close_dev; + return -1; } output = open(cfg.file_name, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (output < 0) { nvme_show_error("Failed to open output file %s: %s!", cfg.file_name, strerror(errno)); - err = output; - goto close_dev; + return output; } + boot = nvme_alloc(sizeof(*boot)); + if (!boot) + return -ENOMEM; + err = nvme_cli_get_log_boot_partition(dev, false, cfg.lsp, - sizeof(boot), &boot); + sizeof(*boot), boot); if (err < 0) { nvme_show_error("boot partition log: %s", nvme_strerror(errno)); - goto close_output; + return err; } else if (err) { nvme_show_status(err); - goto close_output; + return err; } - bpsz = (boot.bpinfo & 0x7fff) * 128 * 1024; - bp_log = calloc(sizeof(boot) + bpsz, 1); - if (!bp_log) { - err = -1; - goto close_output; - } + bpsz = (boot->bpinfo & 0x7fff) * 128 * 1024; + bp_log = nvme_alloc(sizeof(*boot) + bpsz); + if (!bp_log) + return -ENOMEM; err = nvme_cli_get_log_boot_partition(dev, false, cfg.lsp, - sizeof(boot) + bpsz, + sizeof(*boot) + bpsz, (struct nvme_boot_partition *)bp_log); if (!err) - nvme_show_boot_part_log(&bp_log, dev->name, flags, sizeof(boot) + bpsz); + nvme_show_boot_part_log(&bp_log, dev->name, sizeof(*boot) + bpsz, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("boot partition log: %s", nvme_strerror(errno)); - err = write(output, (void *) bp_log + sizeof(boot), bpsz); + err = write(output, (void *) bp_log + sizeof(*boot), bpsz); if (err != bpsz) fprintf(stderr, "Failed to flush all data to file!\n"); else printf("Data flushed into file %s\n", cfg.file_name); err = 0; - free(bp_log); + return err; +} + +static int get_phy_rx_eom_log(int argc, char **argv, struct command *cmd, + struct plugin *plugin) +{ + const char *desc = "Retrieve Physical Interface Receiver Eye Opening\n" + "Measurement log for the given device in decoded format\n" + "(default), json or binary."; + const char *controller = "Target Controller ID."; + _cleanup_free_ struct nvme_phy_rx_eom_log *phy_rx_eom_log = NULL; + size_t phy_rx_eom_log_len; + enum nvme_print_flags flags; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + int err = -1; + __u8 lsp_tmp; + + struct config { + __u8 lsp; + __u16 controller; + }; + + struct config cfg = { + .lsp = 0, + .controller = NVME_LOG_LSI_NONE, + }; + + NVME_ARGS(opts, cfg, + OPT_BYTE("lsp", 's', &cfg.lsp, lsp), + OPT_SHRT("controller", 'c', &cfg.controller, controller)); + + err = parse_and_open(&dev, argc, argv, desc, opts); + if (err) + return err; + + err = validate_output_format(output_format_val, &flags); + if (err < 0) { + nvme_show_error("Invalid output format"); + return err; + } + + if (cfg.lsp > 127) { + nvme_show_error("invalid lsp param: %u", cfg.lsp); + return -1; + } else if ((cfg.lsp & 3) == 3) { + nvme_show_error("invalid measurement quality: %u", cfg.lsp & 3); + return -1; + } else if ((cfg.lsp & 12) == 12) { + nvme_show_error("invalid action: %u", cfg.lsp & 12); + return -1; + } + + /* Fetching header to calculate total log length */ + phy_rx_eom_log_len = sizeof(struct nvme_phy_rx_eom_log); + phy_rx_eom_log = nvme_alloc(phy_rx_eom_log_len); + if (!phy_rx_eom_log) + return -ENOMEM; + + /* Just read measurement, take given action when fetching full log */ + lsp_tmp = cfg.lsp & 0xf3; + + err = nvme_cli_get_log_phy_rx_eom(dev, lsp_tmp, cfg.controller, phy_rx_eom_log_len, + phy_rx_eom_log); + if (err) { + if (err > 0) + nvme_show_status(err); + else + nvme_show_error("phy-rx-eom-log: %s", nvme_strerror(errno)); + + return err; + } + + if (phy_rx_eom_log->eomip == NVME_PHY_RX_EOM_COMPLETED) + phy_rx_eom_log_len = le16_to_cpu(phy_rx_eom_log->hsize) + + le32_to_cpu(phy_rx_eom_log->dsize) * + le16_to_cpu(phy_rx_eom_log->nd); + else + phy_rx_eom_log_len = le16_to_cpu(phy_rx_eom_log->hsize); + + phy_rx_eom_log = nvme_realloc(phy_rx_eom_log, phy_rx_eom_log_len); + if (!phy_rx_eom_log) + return -ENOMEM; + + err = nvme_cli_get_log_phy_rx_eom(dev, cfg.lsp, cfg.controller, phy_rx_eom_log_len, + phy_rx_eom_log); + if (!err) + nvme_show_phy_rx_eom_log(phy_rx_eom_log, cfg.controller, flags); + else if (err > 0) + nvme_show_status(err); + else + nvme_show_error("phy-rx-eom-log: %s", nvme_strerror(errno)); -close_output: - close(output); -close_dev: - dev_close(dev); -ret: return err; } @@ -1927,54 +1897,51 @@ static int get_media_unit_stat_log(int argc, char **argv, struct command *cmd, struct plugin *plugin) { const char *desc = "Retrieve the configuration and wear of media units and print it"; - struct nvme_media_unit_stat_log mus; + + _cleanup_free_ struct nvme_media_unit_stat_log *mus = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err = -1; struct config { __u16 domainid; - char *output_format; bool raw_binary; }; struct config cfg = { .domainid = 0, - .output_format = "normal", .raw_binary = false, }; - OPT_ARGS(opts) = { - OPT_UINT("domain-id", 'd', &cfg.domainid, domainid), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("domain-id", 'd', &cfg.domainid, domainid), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) flags = BINARY; - err = nvme_cli_get_log_media_unit_stat(dev, cfg.domainid, &mus); + mus = nvme_alloc(sizeof(*mus)); + if (!mus) + return -ENOMEM; + + err = nvme_cli_get_log_media_unit_stat(dev, cfg.domainid, mus); if (!err) - nvme_show_media_unit_stat_log(&mus, flags); + nvme_show_media_unit_stat_log(mus, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("media unit status log: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: return err; } @@ -1982,55 +1949,52 @@ static int get_supp_cap_config_log(int argc, char **argv, struct command *cmd, struct plugin *plugin) { const char *desc = "Retrieve the list of Supported Capacity Configuration Descriptors"; - struct nvme_supported_cap_config_list_log cap_log; + + _cleanup_free_ struct nvme_supported_cap_config_list_log *cap_log = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err = -1; struct config { __u16 domainid; - char *output_format; bool raw_binary; }; struct config cfg = { .domainid = 0, - .output_format = "normal", .raw_binary = false, }; - OPT_ARGS(opts) = { - OPT_UINT("domain-id", 'd', &cfg.domainid, domainid), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("domain-id", 'd', &cfg.domainid, domainid), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_use)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) flags = BINARY; + cap_log = nvme_alloc(sizeof(*cap_log)); + if (!cap_log) + return -ENOMEM; + err = nvme_cli_get_log_support_cap_config_list(dev, cfg.domainid, - &cap_log); + cap_log); if (!err) - nvme_show_supported_cap_config_log(&cap_log, flags); + nvme_show_supported_cap_config_log(cap_log, flags); else if (err > 0) nvme_show_status(err); else nvme_show_perror("supported capacity configuration list log"); -close_dev: - dev_close(dev); -ret: return err; } @@ -2039,8 +2003,8 @@ static int io_mgmt_send(int argc, char **argv, struct command *cmd, struct plugi const char *desc = "I/O Management Send"; const char *data = "optional file for data (default stdin)"; - struct nvme_dev *dev; - void *buf = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ void *buf = NULL; int err = -1; int dfd = STDIN_FILENO; @@ -2056,41 +2020,36 @@ static int io_mgmt_send(int argc, char **argv, struct command *cmd, struct plugi .mos = 0, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_SHRT("mos", 's', &cfg.mos, mos), - OPT_BYTE("mo", 'm', &cfg.mo, mo), - OPT_FILE("data", 'd', &cfg.file, data), - OPT_UINT("data-len", 'l', &cfg.data_len, buf_len), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_SHRT("mos", 's', &cfg.mos, mos), + OPT_BYTE("mo", 'm', &cfg.mo, mo), + OPT_FILE("data", 'd', &cfg.file, data), + OPT_UINT("data-len", 'l', &cfg.data_len, buf_len)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - return errno; + return err; if (!cfg.namespace_id) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_perror("get-namespace-id"); - goto close_dev; + return err; } } if (cfg.data_len) { - buf = calloc(1, cfg.data_len); - if (!buf) { - nvme_show_perror("could not alloc memory for io mgmt receive data"); - err = -ENOMEM; - goto close_dev; - } + buf = nvme_alloc(cfg.data_len); + if (!buf) + return -ENOMEM; } if (cfg.file) { dfd = open(cfg.file, O_RDONLY); if (dfd < 0) { nvme_show_perror(cfg.file); - goto free; + return -errno; } } @@ -2123,10 +2082,6 @@ static int io_mgmt_send(int argc, char **argv, struct command *cmd, struct plugi close_fd: if (cfg.file) close(dfd); -free: - free(buf); -close_dev: - dev_close(dev); return err; } @@ -2135,10 +2090,10 @@ static int io_mgmt_recv(int argc, char **argv, struct command *cmd, struct plugi const char *desc = "I/O Management Receive"; const char *data = "optional file for data (default stdout)"; - struct nvme_dev *dev; - void *buf = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ void *buf = NULL; int err = -1; - int dfd = STDOUT_FILENO; + _cleanup_file_ int dfd = -1; struct config { __u16 mos; @@ -2152,34 +2107,29 @@ static int io_mgmt_recv(int argc, char **argv, struct command *cmd, struct plugi .mos = 0, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_SHRT("mos", 's', &cfg.mos, mos), - OPT_BYTE("mo", 'm', &cfg.mo, mo), - OPT_FILE("data", 'd', &cfg.file, data), - OPT_UINT("data-len", 'l', &cfg.data_len, buf_len), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_SHRT("mos", 's', &cfg.mos, mos), + OPT_BYTE("mo", 'm', &cfg.mo, mo), + OPT_FILE("data", 'd', &cfg.file, data), + OPT_UINT("data-len", 'l', &cfg.data_len, buf_len)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - return errno; + return err; if (!cfg.namespace_id) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_perror("get-namespace-id"); - goto close_dev; + return err; } } if (cfg.data_len) { - buf = calloc(1, cfg.data_len); - if (!buf) { - nvme_show_perror("could not alloc memory for io mgmt receive data"); - err = -ENOMEM; - goto close_dev; - } + buf = nvme_alloc(cfg.data_len); + if (!buf) + return -ENOMEM; } struct nvme_io_mgmt_recv_args args = { @@ -2202,13 +2152,13 @@ static int io_mgmt_recv(int argc, char **argv, struct command *cmd, struct plugi dfd = open(cfg.file, O_WRONLY | O_CREAT, 0644); if (dfd < 0) { nvme_show_perror(cfg.file); - goto free; + return -errno; } err = write(dfd, buf, cfg.data_len); if (err < 0) { nvme_show_perror("write"); - goto close_fd; + return -errno; } } else { d((unsigned char *)buf, cfg.data_len, 16, 1); @@ -2219,14 +2169,6 @@ static int io_mgmt_recv(int argc, char **argv, struct command *cmd, struct plugi nvme_show_perror("io-mgmt-recv"); } -close_fd: - if (cfg.file) - close(dfd); -free: - free(buf); -close_dev: - dev_close(dev); - return err; } @@ -2243,8 +2185,9 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl const char *raw = "output in raw format"; const char *offset_type = "offset type"; const char *xfer_len = "read chunk size (default 4k)"; - struct nvme_dev *dev; - unsigned char *log; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ unsigned char *log = NULL; int err; struct config { @@ -2279,26 +2222,24 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl .xfer_len = 4096, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), - OPT_BYTE("log-id", 'i', &cfg.log_id, log_id), - OPT_UINT("log-len", 'l', &cfg.log_len, log_len), - OPT_UINT("aen", 'a', &cfg.aen, aen), - OPT_SUFFIX("lpo", 'o', &cfg.lpo, lpo), - OPT_BYTE("lsp", 's', &cfg.lsp, lsp), - OPT_SHRT("lsi", 'S', &cfg.lsi, lsi), - OPT_FLAG("rae", 'r', &cfg.rae, rae), - OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw), - OPT_BYTE("csi", 'y', &cfg.csi, csi), - OPT_FLAG("ot", 'O', &cfg.ot, offset_type), - OPT_UINT("xfer-len", 'x', &cfg.xfer_len, xfer_len), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), + OPT_BYTE("log-id", 'i', &cfg.log_id, log_id), + OPT_UINT("log-len", 'l', &cfg.log_len, log_len), + OPT_UINT("aen", 'a', &cfg.aen, aen), + OPT_SUFFIX("lpo", 'L', &cfg.lpo, lpo), + OPT_BYTE("lsp", 's', &cfg.lsp, lsp), + OPT_SHRT("lsi", 'S', &cfg.lsi, lsi), + OPT_FLAG("rae", 'r', &cfg.rae, rae), + OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw), + OPT_BYTE("csi", 'y', &cfg.csi, csi), + OPT_FLAG("ot", 'O', &cfg.ot, offset_type), + OPT_UINT("xfer-len", 'x', &cfg.xfer_len, xfer_len)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (cfg.aen) { cfg.log_len = 4096; @@ -2307,34 +2248,27 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl if (!cfg.log_len || cfg.log_len & 0x3) { nvme_show_error("non-zero or non-dw alignment log-len is required param"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.lsp > 127) { nvme_show_error("invalid lsp param"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.uuid_index > 127) { nvme_show_error("invalid uuid index param"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.xfer_len == 0 || cfg.xfer_len % 4096) { nvme_show_error("xfer-len argument invalid. It needs to be multiple of 4k"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } - log = malloc(cfg.log_len); - if (!log) { - nvme_show_perror("could not alloc buffer for log\n"); - err = -ENOMEM; - goto close_dev; - } + log = nvme_alloc(cfg.log_len); + if (!log) + return -ENOMEM; struct nvme_get_log_args args = { .args_size = sizeof(args), @@ -2365,52 +2299,44 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl } else { nvme_show_error("log page: %s", nvme_strerror(errno)); } - free(log); -close_dev: - dev_close(dev); -ret: return err; } static int sanitize_log(int argc, char **argv, struct command *command, struct plugin *plugin) { const char *desc = "Retrieve sanitize log and show it."; - struct nvme_sanitize_log_page sanitize_log; + + _cleanup_free_ struct nvme_sanitize_log_page *sanitize_log = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; struct config { bool rae; - char *output_format; bool human_readable; bool raw_binary; }; struct config cfg = { .rae = false, - .output_format = "normal", .human_readable = false, .raw_binary = false, }; - OPT_ARGS(opts) = { - OPT_FLAG("rae", 'r', &cfg.rae, rae), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_log), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_log), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FLAG("rae", 'r', &cfg.rae, rae), + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_log), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_log)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) @@ -2419,16 +2345,18 @@ static int sanitize_log(int argc, char **argv, struct command *command, struct p if (cfg.human_readable) flags |= VERBOSE; - err = nvme_cli_get_log_sanitize(dev, cfg.rae, &sanitize_log); + sanitize_log = nvme_alloc(sizeof(*sanitize_log)); + if (!sanitize_log) + return -ENOMEM; + + err = nvme_cli_get_log_sanitize(dev, cfg.rae, sanitize_log); if (!err) - nvme_show_sanitize_log(&sanitize_log, dev->name, flags); + nvme_show_sanitize_log(sanitize_log, dev->name, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("sanitize status log: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } @@ -2436,50 +2364,48 @@ static int get_fid_support_effects_log(int argc, char **argv, struct command *cm struct plugin *plugin) { const char *desc = "Retrieve FID Support and Effects log and show it."; - struct nvme_fid_supported_effects_log fid_support_log; + + _cleanup_free_ struct nvme_fid_supported_effects_log *fid_support_log = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err = -1; struct config { - char *output_format; bool human_readable; }; struct config cfg = { - .output_format = "normal", .human_readable = false, }; - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_log), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_log)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.human_readable) flags |= VERBOSE; - err = nvme_cli_get_log_fid_supported_effects(dev, false, &fid_support_log); + fid_support_log = nvme_alloc(sizeof(*fid_support_log)); + if (!fid_support_log) + return -ENOMEM; + + err = nvme_cli_get_log_fid_supported_effects(dev, false, fid_support_log); if (!err) - nvme_show_fid_support_effects_log(&fid_support_log, dev->name, flags); + nvme_show_fid_support_effects_log(fid_support_log, dev->name, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("fid support effects log: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } @@ -2487,50 +2413,48 @@ static int get_mi_cmd_support_effects_log(int argc, char **argv, struct command struct plugin *plugin) { const char *desc = "Retrieve NVMe-MI Command Support and Effects log and show it."; - struct nvme_mi_cmd_supported_effects_log mi_cmd_support_log; + + _cleanup_free_ struct nvme_mi_cmd_supported_effects_log *mi_cmd_support_log = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err = -1; struct config { - char *output_format; bool human_readable; }; struct config cfg = { - .output_format = "normal", .human_readable = false, }; - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_log), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_log)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.human_readable) flags |= VERBOSE; - err = nvme_cli_get_log_mi_cmd_supported_effects(dev, false, &mi_cmd_support_log); + mi_cmd_support_log = nvme_alloc(sizeof(*mi_cmd_support_log)); + if (!mi_cmd_support_log) + return -ENOMEM; + + err = nvme_cli_get_log_mi_cmd_supported_effects(dev, false, mi_cmd_support_log); if (!err) - nvme_show_mi_cmd_support_effects_log(&mi_cmd_support_log, dev->name, flags); + nvme_show_mi_cmd_support_effects_log(mi_cmd_support_log, dev->name, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("mi command support effects log: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } @@ -2539,45 +2463,39 @@ static int list_ctrl(int argc, char **argv, struct command *cmd, struct plugin * const char *desc = "Show controller list information for the subsystem the\n" "given device is part of, or optionally controllers attached to a specific namespace."; const char *controller = "controller to display"; - struct nvme_ctrl_list *cntlist; + + _cleanup_free_ struct nvme_ctrl_list *cntlist = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; struct config { __u16 cntid; __u32 namespace_id; - char *output_format; }; struct config cfg = { .cntid = 0, .namespace_id = NVME_NSID_NONE, - .output_format = "normal", }; - OPT_ARGS(opts) = { - OPT_SHRT("cntid", 'c', &cfg.cntid, controller), - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_optional), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_SHRT("cntid", 'c', &cfg.cntid, controller), + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_optional)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } - if (posix_memalign((void *)&cntlist, getpagesize(), 0x1000)) { - nvme_show_error("can not allocate controller list payload"); - err = -ENOMEM; - goto close_dev; - } + cntlist = nvme_alloc(sizeof(*cntlist)); + if (!cntlist) + return -ENOMEM; if (cfg.namespace_id == NVME_NSID_NONE) err = nvme_cli_identify_ctrl_list(dev, cfg.cntid, cntlist); @@ -2591,10 +2509,6 @@ static int list_ctrl(int argc, char **argv, struct command *cmd, struct plugin * else nvme_show_error("id controller list: %s", nvme_strerror(errno)); - free(cntlist); -close_dev: - dev_close(dev); -ret: return err; } @@ -2605,53 +2519,52 @@ static int list_ns(int argc, char **argv, struct command *cmd, struct plugin *pl const char *namespace_id = "first nsid returned list should start from"; const char *csi = "I/O command set identifier"; const char *all = "show all namespaces in the subsystem, whether attached or inactive"; - struct nvme_ns_list ns_list; + + _cleanup_free_ struct nvme_ns_list *ns_list = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; struct config { __u32 namespace_id; int csi; bool all; - char *output_format; }; struct config cfg = { .namespace_id = 1, .csi = -1, .all = false, - .output_format = "normal", }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id), - OPT_INT("csi", 'y', &cfg.csi, csi), - OPT_FLAG("all", 'a', &cfg.all, all), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format_no_binary), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id), + OPT_INT("csi", 'y', &cfg.csi, csi), + OPT_FLAG("all", 'a', &cfg.all, all)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); - if (flags != JSON && flags != NORMAL) { + err = validate_output_format(output_format_val, &flags); + if (err < 0 || (flags != JSON && flags != NORMAL)) { nvme_show_error("Invalid output format"); - goto close_dev; + return -EINVAL; } if (!cfg.namespace_id) { - err = -EINVAL; nvme_show_error("invalid nsid parameter"); - goto close_dev; + return -EINVAL; } + ns_list = nvme_alloc(sizeof(*ns_list)); + if (!ns_list) + return -ENOMEM; + struct nvme_identify_args args = { .args_size = sizeof(args), .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, - .data = &ns_list, + .data = ns_list, .nsid = cfg.namespace_id - 1. }; if (cfg.csi < 0) { @@ -2664,16 +2577,13 @@ static int list_ns(int argc, char **argv, struct command *cmd, struct plugin *pl } err = nvme_cli_identify(dev, &args); - if (!err) - nvme_show_list_ns(&ns_list, flags); + nvme_show_list_ns(ns_list, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("id namespace list: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } @@ -2682,60 +2592,54 @@ static int id_ns_lba_format(int argc, char **argv, struct command *cmd, struct p const char *desc = "Send an Identify Namespace command to the given\n" "device, returns capability field properties of the specified\n" "LBA Format index in various formats."; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ struct nvme_id_ns *ns = NULL; enum nvme_print_flags flags; - struct nvme_id_ns ns; - struct nvme_dev *dev; int err = -1; struct config { __u16 lba_format_index; __u8 uuid_index; - bool verbose; - char *output_format; }; struct config cfg = { .lba_format_index = 0, .uuid_index = NVME_UUID_NONE, - .verbose = false, - .output_format = "normal", }; - OPT_ARGS(opts) = { - OPT_UINT("lba-format-index", 'i', &cfg.lba_format_index, lba_format_index), - OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index), - OPT_FLAG("verbose", 'v', &cfg.verbose, verbose), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("lba-format-index", 'i', &cfg.lba_format_index, lba_format_index), + OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } - if (cfg.verbose) + if (argconfig_parse_seen(opts, "verbose")) flags |= VERBOSE; + ns = nvme_alloc(sizeof(*ns)); + if (!ns) + return -ENOMEM; + err = nvme_identify_ns_csi_user_data_format(dev_fd(dev), - cfg.lba_format_index, - cfg.uuid_index, NVME_CSI_NVM, &ns); + cfg.lba_format_index, + cfg.uuid_index, NVME_CSI_NVM, ns); if (!err) - nvme_show_id_ns(&ns, 0, cfg.lba_format_index, true, flags); + nvme_show_id_ns(ns, 0, cfg.lba_format_index, true, flags); else if (err > 0) nvme_show_status(err); else nvme_show_perror("identify namespace for specific LBA format"); -close_dev: - dev_close(dev); -ret: - return nvme_status_to_errno(err, false); + return err; } static int id_endurance_grp_list(int argc, char **argv, struct command *cmd, @@ -2743,41 +2647,36 @@ static int id_endurance_grp_list(int argc, char **argv, struct command *cmd, { const char *desc = "Show endurance group list information for the given endurance group id"; const char *endurance_grp_id = "Endurance Group ID"; - struct nvme_id_endurance_group_list *endgrp_list; + + _cleanup_free_ struct nvme_id_endurance_group_list *endgrp_list = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err = -1; struct config { __u16 endgrp_id; - char *output_format; }; struct config cfg = { .endgrp_id = 0, - .output_format = "normal", }; - OPT_ARGS(opts) = { - OPT_SHRT("endgrp-id", 'i', &cfg.endgrp_id, endurance_grp_id), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_SHRT("endgrp-id", 'i', &cfg.endgrp_id, endurance_grp_id)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); - if (flags != JSON && flags != NORMAL) { + err = validate_output_format(output_format_val, &flags); + if (err < 0 || (flags != JSON && flags != NORMAL)) { nvme_show_error("invalid output format"); - goto close_dev; + return -EINVAL; } - if (posix_memalign((void *)&endgrp_list, getpagesize(), 0x1000)) { - err = -1; - goto close_dev; - } + endgrp_list = nvme_alloc(sizeof(*endgrp_list)); + if (!endgrp_list) + return -ENOMEM; err = nvme_identify_endurance_group_list(dev_fd(dev), cfg.endgrp_id, endgrp_list); if (!err) @@ -2787,10 +2686,6 @@ static int id_endurance_grp_list(int argc, char **argv, struct command *cmd, else nvme_show_error("Id endurance group list: %s", nvme_strerror(errno)); - free(endgrp_list); -close_dev: - dev_close(dev); -ret: return err; } @@ -2803,7 +2698,8 @@ static int delete_ns(int argc, char **argv, struct command *cmd, struct plugin * "becomes inactive when that namespace is detached or, if\n" "the namespace is not already inactive, once deleted."; const char *namespace_id = "namespace to delete"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; struct config { @@ -2816,21 +2712,19 @@ static int delete_ns(int argc, char **argv, struct command *cmd, struct plugin * .timeout = 120000, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id), - OPT_UINT("timeout", 't', &cfg.timeout, timeout), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id), + OPT_UINT("timeout", 't', &cfg.timeout, timeout)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (!cfg.namespace_id) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } @@ -2842,18 +2736,15 @@ static int delete_ns(int argc, char **argv, struct command *cmd, struct plugin * else nvme_show_error("delete namespace: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: return err; } static int nvme_attach_ns(int argc, char **argv, int attach, const char *desc, struct command *cmd) { - struct nvme_ctrl_list cntlist; + _cleanup_free_ struct nvme_ctrl_list *cntlist = NULL; + _cleanup_free_ __u16 *ctrlist = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err, num, i, list[2048]; - struct nvme_dev *dev; - __u16 ctrlist[2048]; const char *namespace_id = "namespace to attach"; const char *cont = "optional comma-sep controller id list"; @@ -2868,20 +2759,17 @@ static int nvme_attach_ns(int argc, char **argv, int attach, const char *desc, s .cntlist = "", }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id), - OPT_LIST("controllers", 'c', &cfg.cntlist, cont), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id), + OPT_LIST("controllers", 'c', &cfg.cntlist, cont)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (!cfg.namespace_id) { nvme_show_error("%s: namespace-id parameter required", cmd->name); - err = -EINVAL; - goto close_dev; + return -EINVAL; } num = argconfig_parse_comma_sep_array(cfg.cntlist, list, 2047); @@ -2890,21 +2778,28 @@ static int nvme_attach_ns(int argc, char **argv, int attach, const char *desc, s if (num == -1) { nvme_show_error("%s: controller id list is malformed", cmd->name); - err = -EINVAL; - goto close_dev; + return -EINVAL; } + cntlist = nvme_alloc(sizeof(*cntlist)); + if (!cntlist) + return -ENOMEM; + + ctrlist = nvme_alloc(sizeof(*ctrlist) * 2048); + if (!ctrlist) + return -ENOMEM; + for (i = 0; i < num; i++) ctrlist[i] = (__u16)list[i]; - nvme_init_ctrl_list(&cntlist, num, ctrlist); + nvme_init_ctrl_list(cntlist, num, ctrlist); if (attach) err = nvme_cli_ns_attach_ctrls(dev, cfg.namespace_id, - &cntlist); + cntlist); else err = nvme_cli_ns_detach_ctrls(dev, cfg.namespace_id, - &cntlist); + cntlist); if (!err) printf("%s: Success, nsid:%d\n", cmd->name, cfg.namespace_id); @@ -2913,9 +2808,6 @@ static int nvme_attach_ns(int argc, char **argv, int attach, const char *desc, s else nvme_show_perror(attach ? "attach namespace" : "detach namespace"); -close_dev: - dev_close(dev); -ret: return err; } @@ -2943,18 +2835,18 @@ static int detach_ns(int argc, char **argv, struct command *cmd, struct plugin * static int parse_lba_num_si(struct nvme_dev *dev, const char *opt, const char *val, __u8 flbas, __u64 *num) { - struct nvme_id_ctrl ctrl; + _cleanup_free_ struct nvme_ns_list *ns_list = NULL; + _cleanup_free_ struct nvme_id_ctrl *ctrl = NULL; + _cleanup_free_ struct nvme_id_ns *ns = NULL; __u32 nsid = 1; - struct nvme_id_ns ns; char *endptr; int err = -EINVAL; int i; int lbas; - struct nvme_ns_list ns_list; + struct nvme_identify_args args = { .args_size = sizeof(args), .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, - .data = &ns_list, .cns = NVME_IDENTIFY_CNS_NS_ACTIVE_LIST, .nsid = nsid - 1. }; @@ -2969,7 +2861,11 @@ static int parse_lba_num_si(struct nvme_dev *dev, const char *opt, return err; } - err = nvme_cli_identify_ctrl(dev, &ctrl); + ctrl = nvme_alloc(sizeof(*ctrl)); + if (!ctrl) + return -ENOMEM; + + err = nvme_cli_identify_ctrl(dev, ctrl); if (err) { if (err < 0) nvme_show_error("identify controller: %s", nvme_strerror(errno)); @@ -2978,7 +2874,12 @@ static int parse_lba_num_si(struct nvme_dev *dev, const char *opt, return err; } - if ((ctrl.oacs & 0x8) >> 3) + ns_list = nvme_alloc(sizeof(*ns_list)); + if (!ns_list) + return -ENOMEM; + args.data = ns_list; + + if ((ctrl->oacs & 0x8) >> 3) nsid = NVME_NSID_ALL; else { err = nvme_cli_identify(dev, &args); @@ -2990,10 +2891,14 @@ static int parse_lba_num_si(struct nvme_dev *dev, const char *opt, nvme_show_status(err); return err; } - nsid = le32_to_cpu(ns_list.ns[0]); + nsid = le32_to_cpu(ns_list->ns[0]); } - err = nvme_cli_identify_ns(dev, nsid, &ns); + ns = nvme_alloc(sizeof(*ns)); + if (!ns) + return -ENOMEM; + + err = nvme_cli_identify_ns(dev, nsid, ns); if (err) { if (err < 0) nvme_show_error("identify namespace: %s", nvme_strerror(errno)); @@ -3003,7 +2908,7 @@ static int parse_lba_num_si(struct nvme_dev *dev, const char *opt, } i = flbas & NVME_NS_FLBAS_LOWER_MASK; - lbas = (1 << ns.lbaf[i].ds) + ns.lbaf[i].ms; + lbas = (1 << ns->lbaf[i].ds) + ns->lbaf[i].ms; if (suffix_si_parse(val, &endptr, (uint64_t *)num)) { nvme_show_error("Expected long suffixed integer argument for '%s-si' but got '%s'!", @@ -3032,6 +2937,7 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin * const char *nmic = "multipath and sharing capabilities (NMIC)"; const char *anagrpid = "ANA Group Identifier (ANAGRPID)"; const char *nvmsetid = "NVM Set Identifier (NVMSETID)"; + const char *endgid = "Endurance Group Identifier (ENDGID)"; const char *csi = "command set identifier (CSI)"; const char *lbstm = "logical block storage tag mask (LBSTM)"; const char *nphndls = "Number of Placement Handles (NPHNDLS)"; @@ -3045,8 +2951,9 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin * "Requested Number of ZRWA Resources (RNUMZRWA) for Zoned Namespace Command Set"; const char *phndls = "Comma separated list of Placement Handle Associated RUH"; - struct nvme_id_ns ns; - struct nvme_dev *dev; + _cleanup_free_ struct nvme_ns_mgmt_host_sw_specified *data = NULL; + _cleanup_free_ struct nvme_id_ns *ns = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err = 0, i; __u32 nsid; uint16_t num_phandle; @@ -3060,6 +2967,7 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin * __u8 nmic; __u32 anagrpid; __u16 nvmsetid; + __u16 endgid; __u64 bs; __u32 timeout; __u8 csi; @@ -3082,7 +2990,8 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin * .nmic = 0, .anagrpid = 0, .nvmsetid = 0, - .bs = 0x00, + .endgid = 0, + .bs = 0x00, .timeout = 120000, .csi = 0, .lbstm = 0, @@ -3096,48 +3005,51 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin * .phndls = "", }; - OPT_ARGS(opts) = { - OPT_SUFFIX("nsze", 's', &cfg.nsze, nsze), - OPT_SUFFIX("ncap", 'c', &cfg.ncap, ncap), - OPT_BYTE("flbas", 'f', &cfg.flbas, flbas), - OPT_BYTE("dps", 'd', &cfg.dps, dps), - OPT_BYTE("nmic", 'm', &cfg.nmic, nmic), - OPT_UINT("anagrp-id", 'a', &cfg.anagrpid, anagrpid), - OPT_UINT("nvmset-id", 'i', &cfg.nvmsetid, nvmsetid), - OPT_SUFFIX("block-size", 'b', &cfg.bs, bs), - OPT_UINT("timeout", 't', &cfg.timeout, timeout), - OPT_BYTE("csi", 'y', &cfg.csi, csi), - OPT_SUFFIX("lbstm", 'l', &cfg.lbstm, lbstm), - OPT_SHRT("nphndls", 'n', &cfg.nphndls, nphndls), - OPT_STR("nsze-si", 'S', &cfg.nsze_si, nsze_si), - OPT_STR("ncap-si", 'C', &cfg.ncap_si, ncap_si), - OPT_FLAG("azr", 'z', &cfg.azr, azr), - OPT_UINT("rar", 'r', &cfg.rar, rar), - OPT_UINT("ror", 'o', &cfg.ror, ror), - OPT_UINT("rnumzrwa", 'u', &cfg.rnumzrwa, rnumzrwa), - OPT_LIST("phndls", 'p', &cfg.phndls, phndls), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_SUFFIX("nsze", 's', &cfg.nsze, nsze), + OPT_SUFFIX("ncap", 'c', &cfg.ncap, ncap), + OPT_BYTE("flbas", 'f', &cfg.flbas, flbas), + OPT_BYTE("dps", 'd', &cfg.dps, dps), + OPT_BYTE("nmic", 'm', &cfg.nmic, nmic), + OPT_UINT("anagrp-id", 'a', &cfg.anagrpid, anagrpid), + OPT_UINT("nvmset-id", 'i', &cfg.nvmsetid, nvmsetid), + OPT_UINT("endg-id", 'e', &cfg.endgid, endgid), + OPT_SUFFIX("block-size", 'b', &cfg.bs, bs), + OPT_UINT("timeout", 't', &cfg.timeout, timeout), + OPT_BYTE("csi", 'y', &cfg.csi, csi), + OPT_SUFFIX("lbstm", 'l', &cfg.lbstm, lbstm), + OPT_SHRT("nphndls", 'n', &cfg.nphndls, nphndls), + OPT_STR("nsze-si", 'S', &cfg.nsze_si, nsze_si), + OPT_STR("ncap-si", 'C', &cfg.ncap_si, ncap_si), + OPT_FLAG("azr", 'z', &cfg.azr, azr), + OPT_UINT("rar", 'r', &cfg.rar, rar), + OPT_UINT("ror", 'O', &cfg.ror, ror), + OPT_UINT("rnumzrwa", 'u', &cfg.rnumzrwa, rnumzrwa), + OPT_LIST("phndls", 'p', &cfg.phndls, phndls)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (cfg.flbas != 0xff && cfg.bs != 0x00) { nvme_show_error( "Invalid specification of both FLBAS and Block Size, please specify only one"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.bs) { if ((cfg.bs & (~cfg.bs + 1)) != cfg.bs) { nvme_show_error( "Invalid value for block size (%"PRIu64"). Block size must be a power of two", (uint64_t)cfg.bs); - err = -EINVAL; - goto close_dev; + return -EINVAL; } - err = nvme_cli_identify_ns(dev, NVME_NSID_ALL, &ns); + + + ns = nvme_alloc(sizeof(*ns)); + if (!ns) + return -ENOMEM; + + err = nvme_cli_identify_ns(dev, NVME_NSID_ALL, ns); if (err) { if (err < 0) { nvme_show_error("identify-namespace: %s", nvme_strerror(errno)); @@ -3145,10 +3057,10 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin * fprintf(stderr, "identify failed\n"); nvme_show_status(err); } - goto close_dev; + return err; } - for (i = 0; i <= ns.nlbaf; ++i) { - if ((1 << ns.lbaf[i].ds) == cfg.bs && ns.lbaf[i].ms == 0) { + for (i = 0; i <= ns->nlbaf; ++i) { + if ((1 << ns->lbaf[i].ds) == cfg.bs && ns->lbaf[i].ms == 0) { cfg.flbas = i; break; } @@ -3160,51 +3072,51 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin * (uint64_t)cfg.bs); fprintf(stderr, "Please correct block size, or specify FLBAS directly\n"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } err = parse_lba_num_si(dev, "nsze", cfg.nsze_si, cfg.flbas, &cfg.nsze); if (err) - goto close_dev; + return err; err = parse_lba_num_si(dev, "ncap", cfg.ncap_si, cfg.flbas, &cfg.ncap); if (err) - goto close_dev; + return err; if (cfg.csi != NVME_CSI_ZNS && (cfg.azr || cfg.rar || cfg.ror || cfg.rnumzrwa)) { nvme_show_error("Invalid ZNS argument is given (CSI:%#x)", cfg.csi); - err = -EINVAL; - goto close_dev; - } - - struct nvme_ns_mgmt_host_sw_specified data = { - .nsze = cpu_to_le64(cfg.nsze), - .ncap = cpu_to_le64(cfg.ncap), - .flbas = cfg.flbas, - .dps = cfg.dps, - .nmic = cfg.nmic, - .anagrpid = cpu_to_le32(cfg.anagrpid), - .nvmsetid = cpu_to_le16(cfg.nvmsetid), - .lbstm = cpu_to_le64(cfg.lbstm), - .zns.znsco = cfg.azr, - .zns.rar = cpu_to_le32(cfg.rar), - .zns.ror = cpu_to_le32(cfg.ror), - .zns.rnumzrwa = cpu_to_le32(cfg.rnumzrwa), - .nphndls = cpu_to_le16(cfg.nphndls), - }; + return -EINVAL; + } + + data = nvme_alloc(sizeof(*data)); + if (!data) + return -ENOMEM; + + data->nsze = cpu_to_le64(cfg.nsze); + data->ncap = cpu_to_le64(cfg.ncap); + data->flbas = cfg.flbas; + data->dps = cfg.dps; + data->nmic = cfg.nmic; + data->anagrpid = cpu_to_le32(cfg.anagrpid); + data->nvmsetid = cpu_to_le16(cfg.nvmsetid); + data->endgid = cpu_to_le16(cfg.endgid); + data->lbstm = cpu_to_le64(cfg.lbstm); + data->zns.znsco = cfg.azr; + data->zns.rar = cpu_to_le32(cfg.rar); + data->zns.ror = cpu_to_le32(cfg.ror); + data->zns.rnumzrwa = cpu_to_le32(cfg.rnumzrwa); + data->nphndls = cpu_to_le16(cfg.nphndls); num_phandle = argconfig_parse_comma_sep_array_short(cfg.phndls, phndl, ARRAY_SIZE(phndl)); if (cfg.nphndls != num_phandle) { nvme_show_error("Invalid Placement handle list"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } for (i = 0; i < num_phandle; i++) - data.phndl[i] = cpu_to_le16(phndl[i]); + data->phndl[i] = cpu_to_le16(phndl[i]); - err = nvme_cli_ns_mgmt_create(dev, &data, &nsid, cfg.timeout, cfg.csi); + err = nvme_cli_ns_mgmt_create(dev, data, &nsid, cfg.timeout, cfg.csi); if (!err) printf("%s: Success, created nsid:%d\n", cmd->name, nsid); else if (err > 0) @@ -3212,9 +3124,6 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin * else nvme_show_error("create namespace: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: return err; } @@ -3264,21 +3173,7 @@ static int list_subsys(int argc, char **argv, struct command *cmd, int err; int nsid = NVME_NSID_ALL; - struct config { - char *output_format; - int verbose; - }; - - struct config cfg = { - .output_format = "normal", - .verbose = 0, - }; - - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format_no_binary), - OPT_INCR("verbose", 'v', &cfg.verbose, verbose), - OPT_END() - }; + NVME_ARGS(opts, cfg); err = argconfig_parse(argc, argv, desc, opts); if (err < 0) @@ -3288,16 +3183,16 @@ static int list_subsys(int argc, char **argv, struct command *cmd, if (optind < argc) devname = basename(argv[optind++]); - err = flags = validate_output_format(cfg.output_format); - if (flags != JSON && flags != NORMAL) { + err = validate_output_format(output_format_val, &flags); + if (err < 0 || (flags != JSON && flags != NORMAL)) { nvme_show_error("Invalid output format"); - goto ret; + return -EINVAL; } - if (cfg.verbose) + if (argconfig_parse_seen(opts, "verbose")) flags |= VERBOSE; - r = nvme_create_root(stderr, map_log_level(cfg.verbose, false)); + r = nvme_create_root(stderr, map_log_level(!!(flags & VERBOSE), false)); if (!r) { if (devname) nvme_show_error("Failed to scan nvme subsystem for %s", devname); @@ -3339,36 +3234,22 @@ static int list(int argc, char **argv, struct command *cmd, struct plugin *plugi nvme_root_t r; int err = 0; - struct config { - char *output_format; - bool verbose; - }; - - struct config cfg = { - .output_format = "normal", - .verbose = false, - }; - - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format_no_binary), - OPT_FLAG("verbose", 'v', &cfg.verbose, verbose), - OPT_END() - }; + NVME_ARGS(opts, cfg); err = argconfig_parse(argc, argv, desc, opts); if (err < 0) return err; - flags = validate_output_format(cfg.output_format); - if (flags != JSON && flags != NORMAL) { + err = validate_output_format(output_format_val, &flags); + if (err < 0 || (flags != JSON && flags != NORMAL)) { nvme_show_error("Invalid output format"); return -EINVAL; } - if (cfg.verbose) + if (argconfig_parse_seen(opts, "verbose")) flags |= VERBOSE; - r = nvme_create_root(stderr, map_log_level(cfg.verbose, false)); + r = nvme_create_root(stderr, map_log_level(!!(flags & VERBOSE), false)); if (!r) { nvme_show_error("Failed to create topology root: %s", nvme_strerror(errno)); return -errno; @@ -3395,41 +3276,37 @@ int __id_ctrl(int argc, char **argv, struct command *cmd, struct plugin *plugin, "binary format. May also return vendor-specific\n" "controller attributes in hex-dump if requested."; const char *vendor_specific = "dump binary vendor field"; + + _cleanup_free_ struct nvme_id_ctrl *ctrl = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_id_ctrl ctrl; - struct nvme_dev *dev; int err; struct config { bool vendor_specific; - char *output_format; bool raw_binary; bool human_readable; }; struct config cfg = { .vendor_specific = false, - .output_format = "normal", .raw_binary = false, .human_readable = false, }; - OPT_ARGS(opts) = { - OPT_FLAG("vendor-specific", 'v', &cfg.vendor_specific, vendor_specific), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_identify), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_identify), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FLAG("vendor-specific", 'V', &cfg.vendor_specific, vendor_specific), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_identify), + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_identify)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) @@ -3441,16 +3318,18 @@ int __id_ctrl(int argc, char **argv, struct command *cmd, struct plugin *plugin, if (cfg.human_readable) flags |= VERBOSE; - err = nvme_cli_identify_ctrl(dev, &ctrl); + ctrl = nvme_alloc(sizeof(*ctrl)); + if (!ctrl) + return -ENOMEM; + + err = nvme_cli_identify_ctrl(dev, ctrl); if (!err) - nvme_show_id_ctrl(&ctrl, flags, vs); + nvme_show_id_ctrl(ctrl, flags, vs); else if (err > 0) nvme_show_status(err); else nvme_show_error("identify controller: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } @@ -3465,44 +3344,36 @@ static int nvm_id_ctrl(int argc, char **argv, struct command *cmd, const char *desc = "Send an Identify Controller NVM Command Set\n" "command to the given device and report information about\n" "the specified controller in various formats."; + + _cleanup_free_ struct nvme_id_ctrl_nvm *ctrl_nvm = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_id_ctrl_nvm ctrl_nvm; - struct nvme_dev *dev; int err = -1; - struct config { - char *output_format; - }; - - struct config cfg = { - .output_format = "normal", - }; - - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } - err = nvme_nvm_identify_ctrl(dev_fd(dev), &ctrl_nvm); + ctrl_nvm = nvme_alloc(sizeof(*ctrl_nvm)); + if (!ctrl_nvm) + return -ENOMEM; + + err = nvme_nvm_identify_ctrl(dev_fd(dev), ctrl_nvm); if (!err) - nvme_show_id_ctrl_nvm(&ctrl_nvm, flags); + nvme_show_id_ctrl_nvm(ctrl_nvm, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("nvm identify controller: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } @@ -3512,75 +3383,73 @@ static int nvm_id_ns(int argc, char **argv, struct command *cmd, const char *desc = "Send an Identify Namespace NVM Command Set\n" "command to the given device and report information about\n" "the specified namespace in various formats."; + + _cleanup_free_ struct nvme_nvm_id_ns *id_ns = NULL; + _cleanup_free_ struct nvme_id_ns *ns = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_nvm_id_ns id_ns; - struct nvme_id_ns ns; - struct nvme_dev *dev; int err = -1; struct config { __u32 namespace_id; __u8 uuid_index; - char *output_format; - bool verbose; }; struct config cfg = { .namespace_id = 0, .uuid_index = NVME_UUID_NONE, - .output_format = "normal", - .verbose = false, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("verbose", 'v', &cfg.verbose, verbose), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } - if (cfg.verbose) + if (argconfig_parse_seen(opts, "verbose")) flags |= VERBOSE; if (!cfg.namespace_id) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_perror("get-namespace-id"); - goto close_dev; + return err; } } - err = nvme_cli_identify_ns(dev, cfg.namespace_id, &ns); + ns = nvme_alloc(sizeof(*ns)); + if (!ns) + return -ENOMEM; + + err = nvme_cli_identify_ns(dev, cfg.namespace_id, ns); if (err) { nvme_show_status(err); - goto close_dev; + return err; } + id_ns = nvme_alloc(sizeof(*id_ns)); + if (!id_ns) + return -ENOMEM; + err = nvme_identify_ns_csi(dev_fd(dev), cfg.namespace_id, - cfg.uuid_index, - NVME_CSI_NVM, &id_ns); + cfg.uuid_index, + NVME_CSI_NVM, id_ns); if (!err) - nvme_show_nvm_id_ns(&id_ns, cfg.namespace_id, &ns, 0, false, flags); + nvme_show_nvm_id_ns(id_ns, cfg.namespace_id, ns, 0, false, flags); else if (err > 0) nvme_show_status(err); else nvme_show_perror("nvm identify namespace"); -close_dev: - dev_close(dev); -ret: - return nvme_status_to_errno(err, false); + return err; } static int nvm_id_ns_lba_format(int argc, char **argv, struct command *cmd, struct plugin *plugin) @@ -3588,66 +3457,64 @@ static int nvm_id_ns_lba_format(int argc, char **argv, struct command *cmd, stru const char *desc = "Send an NVM Command Set specific Identify Namespace\n" "command to the given device, returns capability field properties of\n" "the specified LBA Format index in the specified namespace in various formats."; + + _cleanup_free_ struct nvme_nvm_id_ns *nvm_ns = NULL; + _cleanup_free_ struct nvme_id_ns *ns = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_id_ns ns; - struct nvme_nvm_id_ns nvm_ns; - struct nvme_dev *dev; int err = -1; struct config { __u16 lba_format_index; __u8 uuid_index; - bool verbose; - char *output_format; }; struct config cfg = { .lba_format_index = 0, .uuid_index = NVME_UUID_NONE, - .verbose = false, - .output_format = "normal", }; - OPT_ARGS(opts) = { - OPT_UINT("lba-format-index", 'i', &cfg.lba_format_index, lba_format_index), - OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index), - OPT_FLAG("verbose", 'v', &cfg.verbose, verbose), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("lba-format-index", 'i', &cfg.lba_format_index, lba_format_index), + OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } - if (cfg.verbose) + if (argconfig_parse_seen(opts, "verbose")) flags |= VERBOSE; - err = nvme_cli_identify_ns(dev, NVME_NSID_ALL, &ns); + ns = nvme_alloc(sizeof(*ns)); + if (!ns) + return -ENOMEM; + + err = nvme_cli_identify_ns(dev, NVME_NSID_ALL, ns); if (err) { - ns.nlbaf = NVME_FEAT_LBA_RANGE_MAX - 1; - ns.nulbaf = 0; + ns->nlbaf = NVME_FEAT_LBA_RANGE_MAX - 1; + ns->nulbaf = 0; } + nvm_ns = nvme_alloc(sizeof(*nvm_ns)); + if (!nvm_ns) + return -ENOMEM; + err = nvme_identify_iocs_ns_csi_user_data_format(dev_fd(dev), cfg.lba_format_index, - cfg.uuid_index, NVME_CSI_NVM, &nvm_ns); + cfg.uuid_index, NVME_CSI_NVM, nvm_ns); if (!err) - nvme_show_nvm_id_ns(&nvm_ns, 0, &ns, cfg.lba_format_index, true, flags); + nvme_show_nvm_id_ns(nvm_ns, 0, ns, cfg.lba_format_index, true, flags); else if (err > 0) nvme_show_status(err); else nvme_show_perror("NVM identify namespace for specific LBA format"); -close_dev: - dev_close(dev); -ret: - return nvme_status_to_errno(err, false); + return err; } static int ns_descs(int argc, char **argv, struct command *cmd, struct plugin *plugin) @@ -3656,38 +3523,34 @@ static int ns_descs(int argc, char **argv, struct command *cmd, struct plugin *p "given device, returns the namespace identification descriptors\n" "of the specific namespace in either human-readable or binary format."; const char *raw = "show descriptors in binary format"; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ void *nsdescs = NULL;; enum nvme_print_flags flags; - struct nvme_dev *dev; - void *nsdescs; int err; struct config { __u32 namespace_id; - char *output_format; bool raw_binary; }; struct config cfg = { .namespace_id = 0, - .output_format = "normal", .raw_binary = false, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) @@ -3697,14 +3560,13 @@ static int ns_descs(int argc, char **argv, struct command *cmd, struct plugin *p err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } - if (posix_memalign(&nsdescs, getpagesize(), 0x1000)) { - err = -ENOMEM; - goto close_dev; - } + nsdescs = nvme_alloc(sizeof(*nsdescs)); + if (!nsdescs) + return -ENOMEM; err = nvme_cli_identify_ns_descs(dev, cfg.namespace_id, nsdescs); if (!err) @@ -3713,10 +3575,7 @@ static int ns_descs(int argc, char **argv, struct command *cmd, struct plugin *p nvme_show_status(err); else nvme_show_error("identify namespace: %s", nvme_strerror(errno)); - free(nsdescs); -close_dev: - dev_close(dev); -ret: + return err; } @@ -3729,9 +3588,9 @@ static int id_ns(int argc, char **argv, struct command *cmd, struct plugin *plug const char *force = "Return this namespace, even if not attached (1.2 devices only)"; const char *vendor_specific = "dump binary vendor fields"; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ struct nvme_id_ns *ns = NULL; enum nvme_print_flags flags; - struct nvme_id_ns ns; - struct nvme_dev *dev; int err; struct config { @@ -3739,7 +3598,6 @@ static int id_ns(int argc, char **argv, struct command *cmd, struct plugin *plug bool force; bool vendor_specific; bool raw_binary; - char *output_format; bool human_readable; }; @@ -3748,28 +3606,24 @@ static int id_ns(int argc, char **argv, struct command *cmd, struct plugin *plug .force = false, .vendor_specific = false, .raw_binary = false, - .output_format = "normal", .human_readable = false, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_FLAG("force", 0, &cfg.force, force), - OPT_FLAG("vendor-specific", 'v', &cfg.vendor_specific, vendor_specific), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_identify), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_identify), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_FLAG("force", 0, &cfg.force, force), + OPT_FLAG("vendor-specific", 'V', &cfg.vendor_specific, vendor_specific), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_identify), + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_identify)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) @@ -3785,24 +3639,26 @@ static int id_ns(int argc, char **argv, struct command *cmd, struct plugin *plug err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } + ns = nvme_alloc(sizeof(*ns)); + if (!ns) + return -ENOMEM; + if (cfg.force) - err = nvme_cli_identify_allocated_ns(dev, cfg.namespace_id, &ns); + err = nvme_cli_identify_allocated_ns(dev, cfg.namespace_id, ns); else - err = nvme_cli_identify_ns(dev, cfg.namespace_id, &ns); + err = nvme_cli_identify_ns(dev, cfg.namespace_id, ns); if (!err) - nvme_show_id_ns(&ns, cfg.namespace_id, 0, false, flags); + nvme_show_id_ns(ns, cfg.namespace_id, 0, false, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("identify namespace: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } @@ -3812,41 +3668,37 @@ static int cmd_set_independent_id_ns(int argc, char **argv, struct command *cmd, const char *desc = "Send an I/O Command Set Independent Identify\n" "Namespace command to the given device, returns properties of the\n" "specified namespace in human-readable or binary or json format."; + + _cleanup_free_ struct nvme_id_independent_id_ns *ns = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_id_independent_id_ns ns; - struct nvme_dev *dev; int err = -1; struct config { __u32 namespace_id; bool raw_binary; - char *output_format; bool human_readable; }; struct config cfg = { .namespace_id = 0, .raw_binary = false, - .output_format = "normal", .human_readable = false, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_identify), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_identify), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_identify), + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_identify)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) @@ -3859,21 +3711,23 @@ static int cmd_set_independent_id_ns(int argc, char **argv, struct command *cmd, err = cfg.namespace_id = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_perror("get-namespace-id"); - goto close_dev; + return err; } } - err = nvme_identify_independent_identify_ns(dev_fd(dev), cfg.namespace_id, &ns); + ns = nvme_alloc(sizeof(*ns)); + if (!ns) + return -ENOMEM; + + err = nvme_identify_independent_identify_ns(dev_fd(dev), cfg.namespace_id, ns); if (!err) - nvme_show_cmd_set_independent_id_ns(&ns, cfg.namespace_id, flags); + nvme_show_cmd_set_independent_id_ns(ns, cfg.namespace_id, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("I/O command set independent identify namespace: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } @@ -3882,39 +3736,27 @@ static int id_ns_granularity(int argc, char **argv, struct command *cmd, struct const char *desc = "Send an Identify Namespace Granularity List command to the\n" "given device, returns namespace granularity list\n" "in either human-readable or binary format."; - struct nvme_id_ns_granularity_list *granularity_list; + + _cleanup_free_ struct nvme_id_ns_granularity_list *granularity_list = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; - struct config { - char *output_format; - }; - - struct config cfg = { - .output_format = "normal", - }; - - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } - if (posix_memalign((void *)&granularity_list, getpagesize(), NVME_IDENTIFY_DATA_SIZE)) { - nvme_show_error("can not allocate granularity list payload"); - err = -ENOMEM; - goto close_dev; - } + granularity_list = nvme_alloc(NVME_IDENTIFY_DATA_SIZE); + if (!granularity_list) + return -ENOMEM; err = nvme_identify_ns_granularity(dev_fd(dev), granularity_list); if (!err) @@ -3923,10 +3765,7 @@ static int id_ns_granularity(int argc, char **argv, struct command *cmd, struct nvme_show_status(err); else nvme_show_error("identify namespace granularity: %s", nvme_strerror(errno)); - free(granularity_list); -close_dev: - dev_close(dev); -ret: + return err; } @@ -3937,48 +3776,45 @@ static int id_nvmset(int argc, char **argv, struct command *cmd, struct plugin * "than or equal to the value specified CDW11.NVMSETID\n" "in either binary format or json format"; const char *nvmset_id = "NVM Set Identify value"; - struct nvme_id_nvmset_list nvmset; + + _cleanup_free_ struct nvme_id_nvmset_list *nvmset = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; struct config { __u16 nvmset_id; - char *output_format; }; struct config cfg = { .nvmset_id = 0, - .output_format = "normal", }; - OPT_ARGS(opts) = { - OPT_SHRT("nvmset_id", 'i', &cfg.nvmset_id, nvmset_id), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_SHRT("nvmset_id", 'i', &cfg.nvmset_id, nvmset_id)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } - err = nvme_identify_nvmset_list(dev_fd(dev), cfg.nvmset_id, &nvmset); + nvmset = nvme_alloc(sizeof(*nvmset)); + if (!nvmset) + return -ENOMEM; + + err = nvme_identify_nvmset_list(dev_fd(dev), cfg.nvmset_id, nvmset); if (!err) - nvme_show_id_nvmset(&nvmset, cfg.nvmset_id, flags); + nvme_show_id_nvmset(nvmset, cfg.nvmset_id, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("identify nvm set list: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: return err; } @@ -3989,38 +3825,34 @@ static int id_uuid(int argc, char **argv, struct command *cmd, struct plugin *pl "in either human-readable or binary format."; const char *raw = "show uuid in binary format"; const char *human_readable = "show uuid in readable format"; - struct nvme_id_uuid_list uuid_list; + + _cleanup_free_ struct nvme_id_uuid_list *uuid_list = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; struct config { - char *output_format; bool raw_binary; bool human_readable; }; struct config cfg = { - .output_format = "normal", .raw_binary = false, .human_readable = false, }; - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw), + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) @@ -4029,16 +3861,18 @@ static int id_uuid(int argc, char **argv, struct command *cmd, struct plugin *pl if (cfg.human_readable) flags |= VERBOSE; - err = nvme_identify_uuid(dev_fd(dev), &uuid_list); + uuid_list = nvme_alloc(sizeof(*uuid_list)); + if (!uuid_list) + return -ENOMEM; + + err = nvme_identify_uuid(dev_fd(dev), uuid_list); if (!err) - nvme_show_id_uuid_list(&uuid_list, flags); + nvme_show_id_uuid_list(uuid_list, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("identify UUID list: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } @@ -4048,8 +3882,9 @@ static int id_iocs(int argc, char **argv, struct command *cmd, struct plugin *pl "the given device, returns properties of the specified controller\n" "in either human-readable or binary format."; const char *controller_id = "identifier of desired controller"; - struct nvme_id_iocs iocs; - struct nvme_dev *dev; + + _cleanup_free_ struct nvme_id_iocs *iocs = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; struct config { @@ -4060,27 +3895,27 @@ static int id_iocs(int argc, char **argv, struct command *cmd, struct plugin *pl .cntid = 0xffff, }; - OPT_ARGS(opts) = { - OPT_SHRT("controller-id", 'c', &cfg.cntid, controller_id), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_SHRT("controller-id", 'c', &cfg.cntid, controller_id)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; + + iocs = nvme_alloc(sizeof(*iocs)); + if (!iocs) + return -ENOMEM; - err = nvme_identify_iocs(dev_fd(dev), cfg.cntid, &iocs); + err = nvme_identify_iocs(dev_fd(dev), cfg.cntid, iocs); if (!err) { printf("NVMe Identify I/O Command Set:\n"); - nvme_show_id_iocs(&iocs, 0); + nvme_show_id_iocs(iocs, 0); } else if (err > 0) { nvme_show_status(err); } else { nvme_show_error("NVMe Identify I/O Command Set: %s", nvme_strerror(errno)); } - dev_close(dev); -ret: return err; } @@ -4090,82 +3925,74 @@ static int id_domain(int argc, char **argv, struct command *cmd, struct plugin * "given device, returns properties of the specified domain\n" "in either normal|json|binary format."; const char *domain_id = "identifier of desired domain"; - struct nvme_id_domain_list id_domain; + + _cleanup_free_ struct nvme_id_domain_list *id_domain = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; struct config { __u16 dom_id; - char *output_format; }; struct config cfg = { .dom_id = 0xffff, - .output_format = "normal", }; - OPT_ARGS(opts) = { - OPT_SHRT("dom-id", 'd', &cfg.dom_id, domain_id), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_SHRT("dom-id", 'd', &cfg.dom_id, domain_id)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } - err = nvme_identify_domain_list(dev_fd(dev), cfg.dom_id, &id_domain); + id_domain = nvme_alloc(sizeof(*id_domain)); + if (!id_domain) + return -ENOMEM; + + err = nvme_identify_domain_list(dev_fd(dev), cfg.dom_id, id_domain); if (!err) { printf("NVMe Identify command for Domain List is successful:\n"); printf("NVMe Identify Domain List:\n"); - nvme_show_id_domain_list(&id_domain, flags); + nvme_show_id_domain_list(id_domain, flags); } else if (err > 0) { nvme_show_status(err); } else { nvme_show_error("NVMe Identify Domain List: %s", nvme_strerror(errno)); } -close_dev: - dev_close(dev); -ret: return err; } static int get_ns_id(int argc, char **argv, struct command *cmd, struct plugin *plugin) { const char *desc = "Get namespace ID of a the block device."; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; unsigned int nsid; - int err = 0; + int err; - OPT_ARGS(opts) = { - OPT_END() - }; + NVME_ARGS(opts, cfg); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; err = nvme_get_nsid(dev_fd(dev), &nsid); if (err < 0) { nvme_show_error("get namespace ID: %s", nvme_strerror(errno)); - err = errno; - goto close_fd; + return -errno; } - err = 0; + printf("%s: namespace-id:%d\n", dev->name, nsid); -close_fd: - dev_close(dev); -ret: - return err; + return 0; } static int virtual_mgmt(int argc, char **argv, struct command *cmd, struct plugin *plugin) @@ -4185,7 +4012,8 @@ static int virtual_mgmt(int argc, char **argv, struct command *cmd, struct plugi "8h: Secondary Assign\n" "9h: Secondary Online"; const char *nr = "Number of Controller Resources(NR)"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; __u32 result; int err; @@ -4203,17 +4031,15 @@ static int virtual_mgmt(int argc, char **argv, struct command *cmd, struct plugi .nr = 0, }; - OPT_ARGS(opts) = { - OPT_UINT("cntlid", 'c', &cfg.cntlid, cntlid), - OPT_BYTE("rt", 'r', &cfg.rt, rt), - OPT_BYTE("act", 'a', &cfg.act, act), - OPT_SHRT("nr", 'n', &cfg.nr, nr), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("cntlid", 'c', &cfg.cntlid, cntlid), + OPT_BYTE("rt", 'r', &cfg.rt, rt), + OPT_BYTE("act", 'a', &cfg.act, act), + OPT_SHRT("nr", 'n', &cfg.nr, nr)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; struct nvme_virtual_mgmt_args args = { .args_size = sizeof(args), @@ -4233,8 +4059,6 @@ static int virtual_mgmt(int argc, char **argv, struct command *cmd, struct plugi else nvme_show_error("virt-mgmt: %s", nvme_strerror(errno)); - dev_close(dev); -ret: return err; } @@ -4244,54 +4068,52 @@ static int primary_ctrl_caps(int argc, char **argv, struct command *cmd, struct const char *desc = "Send an Identify Primary Controller Capabilities\n" "command to the given device and report the information in a\n" "decoded format (default), json or binary."; - struct nvme_primary_ctrl_cap caps; + + _cleanup_free_ struct nvme_primary_ctrl_cap *caps = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; struct config { __u16 cntlid; - char *output_format; bool human_readable; }; struct config cfg = { .cntlid = 0, - .output_format = "normal", .human_readable = false, }; - OPT_ARGS(opts) = { - OPT_UINT("cntlid", 'c', &cfg.cntlid, cntlid), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_info), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("cntlid", 'c', &cfg.cntlid, cntlid), + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_info)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.human_readable) flags |= VERBOSE; - err = nvme_cli_identify_primary_ctrl(dev, cfg.cntlid, &caps); + caps = nvme_alloc(sizeof(*caps)); + if (!caps) + return -ENOMEM; + + err = nvme_cli_identify_primary_ctrl(dev, cfg.cntlid, caps); if (!err) - nvme_show_primary_ctrl_cap(&caps, flags); + nvme_show_primary_ctrl_cap(caps, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("identify primary controller capabilities: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } @@ -4302,56 +4124,45 @@ static int list_secondary_ctrl(int argc, char **argv, struct command *cmd, struc const char *controller = "lowest controller identifier to display"; const char *num_entries = "number of entries to retrieve"; - struct nvme_secondary_ctrl_list *sc_list; + _cleanup_free_ struct nvme_secondary_ctrl_list *sc_list = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; struct config { __u16 cntid; - __u32 namespace_id; __u32 num_entries; - char *output_format; }; struct config cfg = { .cntid = 0, - .namespace_id = 0, .num_entries = ARRAY_SIZE(sc_list->sc_entry), - .output_format = "normal", }; - OPT_ARGS(opts) = { - OPT_SHRT("cntid", 'c', &cfg.cntid, controller), - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_optional), - OPT_UINT("num-entries", 'e', &cfg.num_entries, num_entries), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_SHRT("cntid", 'c', &cfg.cntid, controller), + OPT_UINT("num-entries", 'e', &cfg.num_entries, num_entries)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_err; + return err; } if (!cfg.num_entries) { nvme_show_error("non-zero num-entries is required param"); - err = -EINVAL; - goto close_err; + return -EINVAL; } - if (posix_memalign((void *)&sc_list, getpagesize(), sizeof(*sc_list))) { - nvme_show_error("can not allocate controller list payload"); - err = -ENOMEM; - goto close_err; - } + sc_list = nvme_alloc(sizeof(*sc_list)); + if (!sc_list) + return -ENOMEM; - err = nvme_cli_identify_secondary_ctrl_list(dev, cfg.namespace_id, cfg.cntid, sc_list); + err = nvme_cli_identify_secondary_ctrl_list(dev, cfg.cntid, sc_list); if (!err) nvme_show_list_secondary_ctrl(sc_list, cfg.num_entries, flags); else if (err > 0) @@ -4359,11 +4170,6 @@ static int list_secondary_ctrl(int argc, char **argv, struct command *cmd, struc else nvme_show_error("id secondary controller list: %s", nvme_strerror(errno)); - free(sc_list); - -close_err: - dev_close(dev); -ret: return err; } @@ -4389,20 +4195,28 @@ static int sleep_self_test(unsigned int seconds) static int wait_self_test(struct nvme_dev *dev) { static const char spin[] = {'-', '\\', '|', '/' }; - struct nvme_self_test_log log; - struct nvme_id_ctrl ctrl; + _cleanup_free_ struct nvme_self_test_log *log = NULL; + _cleanup_free_ struct nvme_id_ctrl *ctrl = NULL; int err, i = 0, p = 0, cnt = 0; int wthr; signal(SIGINT, intr_self_test); - err = nvme_cli_identify_ctrl(dev, &ctrl); + ctrl = nvme_alloc(sizeof(*ctrl)); + if (!ctrl) + return -ENOMEM; + + log = nvme_alloc(sizeof(*log)); + if (!log) + return -ENOMEM; + + err = nvme_cli_identify_ctrl(dev, ctrl); if (err) { nvme_show_error("identify-ctrl: %s", nvme_strerror(errno)); return err; } - wthr = le16_to_cpu(ctrl.edstt) * 60 / 100 + 60; + wthr = le16_to_cpu(ctrl->edstt) * 60 / 100 + 60; printf("Waiting for self test completion...\n"); while (true) { @@ -4412,7 +4226,7 @@ static int wait_self_test(struct nvme_dev *dev) if (err) return err; - err = nvme_cli_get_log_device_self_test(dev, &log); + err = nvme_cli_get_log_device_self_test(dev, log); if (err) { printf("\n"); if (err < 0) @@ -4427,17 +4241,17 @@ static int wait_self_test(struct nvme_dev *dev) return -EIO; } - if (log.completion == 0 && p > 0) { + if (log->completion == 0 && p > 0) { printf("\r[%.*s] %3d%%\n", 50, dash, 100); break; } - if (log.completion < p) { + if (log->completion < p) { printf("\n"); - nvme_show_error("progress broken"); - return -EIO; - } else if (log.completion != p) { - p = log.completion; + nvme_show_error("progress broken"); + return -EIO; + } else if (log->completion != p) { + p = log->completion; cnt = 0; } @@ -4476,7 +4290,8 @@ static int device_self_test(int argc, char **argv, struct command *cmd, struct p "eh Start a vendor specific device self-test operation\n" "fh Abort the device self-test operation"; const char *wait = "Wait for the test to finish"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; struct config { @@ -4491,21 +4306,23 @@ static int device_self_test(int argc, char **argv, struct command *cmd, struct p .wait = false, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id), - OPT_BYTE("self-test-code", 's', &cfg.stc, self_test_code), - OPT_FLAG("wait", 'w', &cfg.wait, wait), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id), + OPT_BYTE("self-test-code", 's', &cfg.stc, self_test_code), + OPT_FLAG("wait", 'w', &cfg.wait, wait)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (cfg.stc == NVME_ST_CODE_RESERVED) { - struct nvme_self_test_log log; + _cleanup_free_ struct nvme_self_test_log *log = NULL; - err = nvme_cli_get_log_device_self_test(dev, &log); + log = nvme_alloc(sizeof(*log)); + if (!log) + return -ENOMEM; + + err = nvme_cli_get_log_device_self_test(dev, log); if (err) { printf("\n"); if (err < 0) @@ -4514,15 +4331,16 @@ static int device_self_test(int argc, char **argv, struct command *cmd, struct p nvme_show_status(err); } - if (log.completion == 0) { + if (log->completion == 0) { printf("no self test running\n"); } else { if (cfg.wait) err = wait_self_test(dev); else - printf("progress %d%%\n", log.completion); + printf("progress %d%%\n", log->completion); } - goto close_dev; + + goto check_abort; } struct nvme_dev_self_test_args args = { @@ -4550,12 +4368,10 @@ static int device_self_test(int argc, char **argv, struct command *cmd, struct p nvme_show_error("Device self-test: %s", nvme_strerror(errno)); } -close_dev: +check_abort: if (err == -EINTR) abort_self_test(&args); - dev_close(dev); -ret: return err; } @@ -4565,61 +4381,54 @@ static int self_test_log(int argc, char **argv, struct command *cmd, struct plug "(or optionally a namespace) in either decoded format (default) or binary."; const char *dst_entries = "Indicate how many DST log entries to be retrieved,\n" "by default all the 20 entries will be retrieved"; - struct nvme_self_test_log log; + + _cleanup_free_ struct nvme_self_test_log *log = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err; struct config { __u8 dst_entries; - char *output_format; - bool verbose; }; struct config cfg = { .dst_entries = NVME_LOG_ST_MAX_RESULTS, - .output_format = "normal", - .verbose = false, }; - OPT_ARGS(opts) = { - OPT_BYTE("dst-entries", 'e', &cfg.dst_entries, dst_entries), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("verbose", 'v', &cfg.verbose, verbose), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_BYTE("dst-entries", 'e', &cfg.dst_entries, dst_entries)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } - if (cfg.verbose) + if (argconfig_parse_seen(opts, "verbose")) flags |= VERBOSE; - err = nvme_cli_get_log_device_self_test(dev, &log); + log = nvme_alloc(sizeof(*log)); + if (!log) + return -ENOMEM; + + err = nvme_cli_get_log_device_self_test(dev, log); if (!err) - nvme_show_self_test_log(&log, cfg.dst_entries, 0, dev->name, flags); + nvme_show_self_test_log(log, cfg.dst_entries, 0, dev->name, flags); else if (err > 0) nvme_show_status(err); else nvme_show_error("self test log: %s", nvme_strerror(errno)); -close_dev: - dev_close(dev); -ret: + return err; } static int get_feature_id(struct nvme_dev *dev, struct feat_cfg *cfg, void **buf, __u32 *result) { - size_t size; - if (!cfg->data_len) nvme_get_feature_length(cfg->feature_id, cfg->cdw11, &cfg->data_len); @@ -4637,11 +4446,9 @@ static int get_feature_id(struct nvme_dev *dev, struct feat_cfg *cfg, cfg->data_len = 0; if (cfg->data_len) { - /* rounding up size to page size */ - size = ((cfg->data_len - 1) / getpagesize() + 1) * getpagesize(); - if (posix_memalign(buf, getpagesize(), size)) + *buf = nvme_alloc(cfg->data_len - 1); + if (!*buf) return -1; - memset(*buf, 0, size); } struct nvme_get_features_args args = { @@ -4673,13 +4480,9 @@ static void get_feature_id_print(struct feat_cfg cfg, int err, __u32 result, if (!err) { if (!cfg.raw_binary || !buf) { - printf("get-feature:%#0*x (%s), %s value:%#0*x\n", - cfg.feature_id ? 4 : 2, cfg.feature_id, - nvme_feature_to_string(cfg.feature_id), - nvme_select_to_string(cfg.sel), result ? 10 : 8, - result); + nvme_feature_show(cfg.feature_id, cfg.sel, result); if (cfg.sel == 3) - nvme_show_select_result(result); + nvme_show_select_result(cfg.feature_id, result); else if (cfg.human_readable) nvme_feature_show_fields(cfg.feature_id, result, buf); @@ -4693,7 +4496,7 @@ static void get_feature_id_print(struct feat_cfg cfg, int err, __u32 result, !nvme_status_equals(status, type, NVME_SC_INVALID_NS)) nvme_show_status(err); } else { - fprintf(stderr, "get-feature: %s\n", nvme_strerror(errno)); + nvme_show_error("get-feature: %s", nvme_strerror(errno)); } } @@ -4756,14 +4559,11 @@ static int get_feature_ids(struct nvme_dev *dev, struct feat_cfg cfg) continue; if (!nvme_status_equals(status, type, NVME_SC_INVALID_NS)) break; - fprintf(stderr, "get-feature:%#0*x (%s): ", - cfg.feature_id ? 4 : 2, cfg.feature_id, - nvme_feature_to_string(cfg.feature_id)); - nvme_show_status(err); + nvme_show_error_status(err, "get-feature:%#0*x (%s)", cfg.feature_id ? 4 : 2, + cfg.feature_id, nvme_feature_to_string(cfg.feature_id)); } - if (feat_num == 1 && - nvme_status_equals(status, type, NVME_SC_INVALID_FIELD)) + if (feat_num == 1 && nvme_status_equals(status, type, NVME_SC_INVALID_FIELD)) nvme_show_status(err); return err; @@ -4786,7 +4586,8 @@ static int get_feature(int argc, char **argv, struct command *cmd, const char *sel = "[0-3,8]: current/default/saved/supported/changed"; const char *cdw11 = "feature specific dword 11"; const char *human_readable = "show feature in readable format"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; struct feat_cfg cfg = { @@ -4800,28 +4601,26 @@ static int get_feature(int argc, char **argv, struct command *cmd, .human_readable = false, }; - OPT_ARGS(opts) = { - OPT_BYTE("feature-id", 'f', &cfg.feature_id, feature_id), - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_BYTE("sel", 's', &cfg.sel, sel), - OPT_UINT("data-len", 'l', &cfg.data_len, buf_len), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw), - OPT_UINT("cdw11", 'c', &cfg.cdw11, cdw11), - OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index_specify), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_BYTE("feature-id", 'f', &cfg.feature_id, feature_id), + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_BYTE("sel", 's', &cfg.sel, sel), + OPT_UINT("data-len", 'l', &cfg.data_len, buf_len), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw), + OPT_UINT("cdw11", 'c', &cfg.cdw11, cdw11), + OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index_specify), + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (!argconfig_parse_seen(opts, "namespace-id")) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { if (errno != ENOTTY) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } cfg.namespace_id = NVME_NSID_ALL; } @@ -4829,22 +4628,20 @@ static int get_feature(int argc, char **argv, struct command *cmd, if (cfg.sel > 8) { nvme_show_error("invalid 'select' param:%d", cfg.sel); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.uuid_index > 127) { nvme_show_error("invalid uuid index param: %u", cfg.uuid_index); - err = -1; - goto close_dev; + return -1; } + nvme_show_init(); + err = get_feature_ids(dev, cfg); -close_dev: - dev_close(dev); + nvme_show_finish(); -ret: return err; } @@ -4960,12 +4757,14 @@ static int fw_download(int argc, char **argv, struct command *cmd, struct plugin const char *offset = "starting dword offset, default 0"; const char *progress = "display firmware transfer progress"; const char *ignore_ovr = "ignore overwrite errors"; - unsigned int fw_size; - struct nvme_dev *dev; - int err, fw_fd = -1; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_huge_ struct nvme_mem_huge mh = { 0, }; + _cleanup_file_ int fw_fd = -1; + unsigned int fw_size, pos; + int err; struct stat sb; void *fw_buf; - bool huge; struct nvme_id_ctrl ctrl; struct config { @@ -4984,45 +4783,41 @@ static int fw_download(int argc, char **argv, struct command *cmd, struct plugin .ignore_ovr = false, }; - OPT_ARGS(opts) = { - OPT_FILE("fw", 'f', &cfg.fw, fw), - OPT_UINT("xfer", 'x', &cfg.xfer, xfer), - OPT_UINT("offset", 'o', &cfg.offset, offset), - OPT_FLAG("progress", 'p', &cfg.progress, progress), - OPT_FLAG("ignore-ovr", 'i', &cfg.ignore_ovr, ignore_ovr), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FILE("fw", 'f', &cfg.fw, fw), + OPT_UINT("xfer", 'x', &cfg.xfer, xfer), + OPT_UINT("offset", 'O', &cfg.offset, offset), + OPT_FLAG("progress", 'p', &cfg.progress, progress), + OPT_FLAG("ignore-ovr", 'i', &cfg.ignore_ovr, ignore_ovr)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; fw_fd = open(cfg.fw, O_RDONLY); cfg.offset <<= 2; if (fw_fd < 0) { nvme_show_error("Failed to open firmware file %s: %s", cfg.fw, strerror(errno)); - err = -EINVAL; - goto close_dev; + return -EINVAL; } err = fstat(fw_fd, &sb); if (err < 0) { nvme_show_perror("fstat"); - goto close_fw_fd; + return err; } fw_size = sb.st_size; if ((fw_size & 0x3) || (fw_size == 0)) { nvme_show_error("Invalid size:%d for f/w image", fw_size); - err = -EINVAL; - goto close_fw_fd; + return -EINVAL; } if (cfg.xfer == 0) { err = nvme_cli_identify_ctrl(dev, &ctrl); if (err) { nvme_show_error("identify-ctrl: %s", nvme_strerror(errno)); - goto close_fw_fd; + return err; } if (ctrl.fwug == 0 || ctrl.fwug == 0xff) cfg.xfer = 4096; @@ -5031,32 +4826,24 @@ static int fw_download(int argc, char **argv, struct command *cmd, struct plugin } else if (cfg.xfer % 4096) cfg.xfer = 4096; - if (cfg.xfer < HUGE_MIN) - fw_buf = __nvme_alloc(fw_size, &huge); - else - fw_buf = nvme_alloc(fw_size, &huge); - - if (!fw_buf) { - err = -ENOMEM; - goto close_fw_fd; - } + fw_buf = nvme_alloc_huge(fw_size, &mh); + if (!fw_buf) + return -ENOMEM; if (read(fw_fd, fw_buf, fw_size) != ((ssize_t)(fw_size))) { err = -errno; nvme_show_error("read :%s :%s", cfg.fw, strerror(errno)); - goto free; + return err; } - while (cfg.offset < fw_size) { - cfg.xfer = min(cfg.xfer, fw_size); + for (pos = 0; pos < fw_size; pos += cfg.xfer) { + cfg.xfer = min(cfg.xfer, fw_size - pos); - err = fw_download_single(dev, fw_buf + cfg.offset, fw_size, - cfg.offset, cfg.xfer, cfg.progress, - cfg.ignore_ovr); + err = fw_download_single(dev, fw_buf + pos, fw_size, + cfg.offset + pos, cfg.xfer, + cfg.progress, cfg.ignore_ovr); if (err) break; - - cfg.offset += cfg.xfer; } if (!err) { @@ -5066,13 +4853,6 @@ static int fw_download(int argc, char **argv, struct command *cmd, struct plugin printf("Firmware download success\n"); } -free: - nvme_free(fw_buf, huge); -close_fw_fd: - close(fw_fd); -close_dev: - dev_close(dev); -ret: return err; } @@ -5092,14 +4872,18 @@ static char *nvme_fw_status_reset_type(__u16 status) static bool fw_commit_support_mud(struct nvme_dev *dev) { - struct nvme_id_ctrl ctrl; + _cleanup_free_ struct nvme_id_ctrl *ctrl = NULL; int err; - err = nvme_cli_identify_ctrl(dev, &ctrl); + ctrl = nvme_alloc(sizeof(*ctrl)); + if (!ctrl) + return false; + + err = nvme_cli_identify_ctrl(dev, ctrl); if (err) nvme_show_error("identify-ctrl: %s", nvme_strerror(errno)); - else if (ctrl.frmw >> 5 & 0x1) + else if (ctrl->frmw >> 5 & 0x1) return true; return false; @@ -5131,7 +4915,8 @@ static int fw_commit(int argc, char **argv, struct command *cmd, struct plugin * const char *slot = "[0-7]: firmware slot for commit action"; const char *action = "[0-7]: commit action"; const char *bpid = "[0,1]: boot partition identifier, if applicable (default: 0)"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; __u32 result; int err; @@ -5147,31 +4932,26 @@ static int fw_commit(int argc, char **argv, struct command *cmd, struct plugin * .bpid = 0, }; - OPT_ARGS(opts) = { - OPT_BYTE("slot", 's', &cfg.slot, slot), - OPT_BYTE("action", 'a', &cfg.action, action), - OPT_BYTE("bpid", 'b', &cfg.bpid, bpid), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_BYTE("slot", 's', &cfg.slot, slot), + OPT_BYTE("action", 'a', &cfg.action, action), + OPT_BYTE("bpid", 'b', &cfg.bpid, bpid)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (cfg.slot > 7) { nvme_show_error("invalid slot:%d", cfg.slot); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.action > 7 || cfg.action == 4 || cfg.action == 5) { nvme_show_error("invalid action:%d", cfg.action); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.bpid > 1) { nvme_show_error("invalid boot partition id:%d", cfg.bpid); - err = -EINVAL; - goto close_dev; + return -EINVAL; } struct nvme_fw_commit_args args = { @@ -5218,25 +4998,21 @@ static int fw_commit(int argc, char **argv, struct command *cmd, struct plugin * fw_commit_print_mud(dev, result); } -close_dev: - dev_close(dev); -ret: return err; } static int subsystem_reset(int argc, char **argv, struct command *cmd, struct plugin *plugin) { const char *desc = "Resets the NVMe subsystem\n"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; - OPT_ARGS(opts) = { - OPT_END() - }; + NVME_ARGS(opts, cfg); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; err = nvme_subsystem_reset(dev_fd(dev)); if (err < 0) { @@ -5246,54 +5022,46 @@ static int subsystem_reset(int argc, char **argv, struct command *cmd, struct pl nvme_show_error("Subsystem-reset: %s", nvme_strerror(errno)); } - dev_close(dev); -ret: return err; } static int reset(int argc, char **argv, struct command *cmd, struct plugin *plugin) { const char *desc = "Resets the NVMe controller\n"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; - OPT_ARGS(opts) = { - OPT_END() - }; + NVME_ARGS(opts, cfg); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; err = nvme_ctrl_reset(dev_fd(dev)); if (err < 0) nvme_show_error("Reset: %s", nvme_strerror(errno)); - dev_close(dev); -ret: return err; } static int ns_rescan(int argc, char **argv, struct command *cmd, struct plugin *plugin) { const char *desc = "Rescans the NVMe namespaces\n"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; - OPT_ARGS(opts) = { - OPT_END() - }; + NVME_ARGS(opts, cfg); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; err = nvme_ns_rescan(dev_fd(dev)); if (err < 0) nvme_show_error("Namespace Rescan"); - dev_close(dev); -ret: return err; } @@ -5306,7 +5074,8 @@ static int sanitize_cmd(int argc, char **argv, struct command *cmd, struct plugi const char *ause_desc = "Allow unrestricted sanitize exit."; const char *sanact_desc = "Sanitize action: 1 = Exit failure mode, 2 = Start block erase, 3 = Start overwrite, 4 = Start crypto erase"; const char *ovrpat_desc = "Overwrite pattern."; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; struct config { @@ -5335,19 +5104,17 @@ static int sanitize_cmd(int argc, char **argv, struct command *cmd, struct plugi VAL_END() }; - OPT_ARGS(opts) = { - OPT_FLAG("no-dealloc", 'd', &cfg.no_dealloc, no_dealloc_desc), - OPT_FLAG("oipbp", 'i', &cfg.oipbp, oipbp_desc), - OPT_BYTE("owpass", 'n', &cfg.owpass, owpass_desc), - OPT_FLAG("ause", 'u', &cfg.ause, ause_desc), - OPT_BYTE("sanact", 'a', &cfg.sanact, sanact_desc, sanact), - OPT_UINT("ovrpat", 'p', &cfg.ovrpat, ovrpat_desc), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FLAG("no-dealloc", 'd', &cfg.no_dealloc, no_dealloc_desc), + OPT_FLAG("oipbp", 'i', &cfg.oipbp, oipbp_desc), + OPT_BYTE("owpass", 'n', &cfg.owpass, owpass_desc), + OPT_FLAG("ause", 'u', &cfg.ause, ause_desc), + OPT_BYTE("sanact", 'a', &cfg.sanact, sanact_desc, sanact), + OPT_UINT("ovrpat", 'p', &cfg.ovrpat, ovrpat_desc)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; switch (cfg.sanact) { case NVME_SANITIZE_SANACT_EXIT_FAILURE: @@ -5357,29 +5124,25 @@ static int sanitize_cmd(int argc, char **argv, struct command *cmd, struct plugi break; default: nvme_show_error("Invalid Sanitize Action"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.sanact == NVME_SANITIZE_SANACT_EXIT_FAILURE) { if (cfg.ause || cfg.no_dealloc) { nvme_show_error("SANACT is Exit Failure Mode"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } } if (cfg.sanact == NVME_SANITIZE_SANACT_START_OVERWRITE) { if (cfg.owpass > 15) { nvme_show_error("OWPASS out of range [0-15]"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } } else { if (cfg.owpass || cfg.oipbp || cfg.ovrpat) { nvme_show_error("SANACT is not Overwrite"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } } @@ -5399,9 +5162,6 @@ static int sanitize_cmd(int argc, char **argv, struct command *cmd, struct plugi else if (err > 0) nvme_show_status(err); -close_dev: - dev_close(dev); -ret: return err; } @@ -5503,38 +5263,34 @@ static int show_registers(int argc, char **argv, struct command *cmd, struct plu "in binary or human-readable format"; const char *human_readable = "show info in readable format in case of output_format == normal"; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; bool fabrics = false; nvme_root_t r; void *bar; int err; struct config { - char *output_format; bool human_readable; }; struct config cfg = { - .output_format = "normal", .human_readable = false, }; - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; r = nvme_scan(NULL); - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + goto free_tree; } if (cfg.human_readable) @@ -5544,7 +5300,7 @@ static int show_registers(int argc, char **argv, struct command *cmd, struct plu if (!bar) { err = nvme_get_properties(dev_fd(dev), &bar); if (err) - goto close_dev; + goto free_tree; fabrics = true; } @@ -5553,10 +5309,8 @@ static int show_registers(int argc, char **argv, struct command *cmd, struct plu free(bar); else munmap(bar, getpagesize()); -close_dev: - dev_close(dev); +free_tree: nvme_free_tree(r); -ret: return err; } @@ -5567,7 +5321,8 @@ static int get_property(int argc, char **argv, struct command *cmd, struct plugi "CAP=0x0, VS=0x8, CC=0x14, CSTS=0x1c, NSSR=0x20"; const char *offset = "offset of the requested property"; const char *human_readable = "show property in readable format"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; __u64 value; int err; @@ -5581,20 +5336,17 @@ static int get_property(int argc, char **argv, struct command *cmd, struct plugi .human_readable = false, }; - OPT_ARGS(opts) = { - OPT_UINT("offset", 'o', &cfg.offset, offset), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("offset", 'O', &cfg.offset, offset), + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (cfg.offset == -1) { nvme_show_error("offset required param"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } struct nvme_get_property_args args = { @@ -5612,9 +5364,6 @@ static int get_property(int argc, char **argv, struct command *cmd, struct plugi else if (err > 0) nvme_show_status(err); -close_dev: - dev_close(dev); -ret: return err; } @@ -5624,7 +5373,8 @@ static int set_property(int argc, char **argv, struct command *cmd, struct plugi "Writes and shows the defined NVMe controller property for NVMe over Fabric"; const char *offset = "the offset of the property"; const char *value = "the value of the property to be set"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; struct config { @@ -5637,25 +5387,21 @@ static int set_property(int argc, char **argv, struct command *cmd, struct plugi .value = -1, }; - OPT_ARGS(opts) = { - OPT_UINT("offset", 'o', &cfg.offset, offset), - OPT_UINT("value", 'v', &cfg.value, value), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("offset", 'O', &cfg.offset, offset), + OPT_UINT("value", 'V', &cfg.value, value)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (cfg.offset == -1) { nvme_show_error("offset required param"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.value == -1) { nvme_show_error("value required param"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } struct nvme_set_property_args args = { @@ -5675,9 +5421,6 @@ static int set_property(int argc, char **argv, struct command *cmd, struct plugi else if (err > 0) nvme_show_status(err); -close_dev: - dev_close(dev); -ret: return err; } @@ -5695,9 +5438,10 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin const char *reset = "Automatically reset the controller after successful format"; const char *bs = "target block size"; const char *force = "The \"I know what I'm doing\" flag, skip confirmation before sending command"; - struct nvme_id_ns ns; - struct nvme_id_ctrl ctrl; - struct nvme_dev *dev; + + _cleanup_free_ struct nvme_id_ctrl *ctrl = NULL; + _cleanup_free_ struct nvme_id_ns *ns = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; __u8 prev_lbaf = 0; int block_size; int err, i; @@ -5728,23 +5472,21 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin .bs = 0, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_UINT("timeout", 't', &cfg.timeout, timeout), - OPT_BYTE("lbaf", 'l', &cfg.lbaf, lbaf), - OPT_BYTE("ses", 's', &cfg.ses, ses), - OPT_BYTE("pi", 'i', &cfg.pi, pi), - OPT_BYTE("pil", 'p', &cfg.pil, pil), - OPT_BYTE("ms", 'm', &cfg.ms, ms), - OPT_FLAG("reset", 'r', &cfg.reset, reset), - OPT_FLAG("force", 0, &cfg.force, force), - OPT_SUFFIX("block-size", 'b', &cfg.bs, bs), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_UINT("timeout", 't', &cfg.timeout, timeout), + OPT_BYTE("lbaf", 'l', &cfg.lbaf, lbaf), + OPT_BYTE("ses", 's', &cfg.ses, ses), + OPT_BYTE("pi", 'i', &cfg.pi, pi), + OPT_BYTE("pil", 'p', &cfg.pil, pil), + OPT_BYTE("ms", 'm', &cfg.ms, ms), + OPT_FLAG("reset", 'r', &cfg.reset, reset), + OPT_FLAG("force", 0, &cfg.force, force), + OPT_SUFFIX("block-size", 'b', &cfg.bs, bs)); err = argconfig_parse(argc, argv, desc, opts); if (err) - goto ret; + return err; err = open_exclusive(&dev, argc, argv, cfg.force); if (err) { @@ -5756,32 +5498,34 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin } else { argconfig_print_help(desc, opts); } - goto ret; + return err; } if (cfg.lbaf != 0xff && cfg.bs != 0) { nvme_show_error( "Invalid specification of both LBAF and Block Size, please specify only one"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.bs) { if ((cfg.bs & (~cfg.bs + 1)) != cfg.bs) { nvme_show_error( "Invalid value for block size (%"PRIu64"), must be a power of two", (uint64_t) cfg.bs); - err = -EINVAL; - goto close_dev; + return -EINVAL; } } - err = nvme_cli_identify_ctrl(dev, &ctrl); + ctrl = nvme_alloc(sizeof(*ctrl)); + if (!ctrl) + return -ENOMEM; + + err = nvme_cli_identify_ctrl(dev, ctrl); if (err) { nvme_show_error("identify-ctrl: %s", nvme_strerror(errno)); - goto close_dev; + return -errno; } - if ((ctrl.fna & 1) == 1) { + if ((ctrl->fna & 1) == 1) { /* * FNA bit 0 set to 1: all namespaces ... shall be configured with the same * attributes and a format (excluding secure erase) of any namespace results in a @@ -5792,7 +5536,7 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return -errno; } } @@ -5800,12 +5544,15 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin nvme_show_error( "Invalid namespace ID, specify a namespace to format or use\n" "'-n 0xffffffff' to format all namespaces on this controller."); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.namespace_id != NVME_NSID_ALL) { - err = nvme_cli_identify_ns(dev, cfg.namespace_id, &ns); + ns = nvme_alloc(sizeof(*ns)); + if (!ns) + return -ENOMEM; + + err = nvme_cli_identify_ns(dev, cfg.namespace_id, ns); if (err) { if (err < 0) { nvme_show_error("identify-namespace: %s", nvme_strerror(errno)); @@ -5813,13 +5560,13 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin fprintf(stderr, "identify failed\n"); nvme_show_status(err); } - goto close_dev; + return err; } - nvme_id_ns_flbas_to_lbaf_inuse(ns.flbas, &prev_lbaf); + nvme_id_ns_flbas_to_lbaf_inuse(ns->flbas, &prev_lbaf); if (cfg.bs) { - for (i = 0; i <= ns.nlbaf; ++i) { - if ((1ULL << ns.lbaf[i].ds) == cfg.bs && ns.lbaf[i].ms == 0) { + for (i = 0; i <= ns->nlbaf; ++i) { + if ((1ULL << ns->lbaf[i].ds) == cfg.bs && ns->lbaf[i].ms == 0) { cfg.lbaf = i; break; } @@ -5830,8 +5577,7 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin (uint64_t)cfg.bs); fprintf(stderr, "Please correct block size, or specify LBAF directly\n"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } } else if (cfg.lbaf == 0xff) { cfg.lbaf = prev_lbaf; @@ -5844,28 +5590,23 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin /* ses & pi checks set to 7 for forward-compatibility */ if (cfg.ses > 7) { nvme_show_error("invalid secure erase settings:%d", cfg.ses); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.lbaf > 63) { nvme_show_error("invalid lbaf:%d", cfg.lbaf); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.pi > 7) { nvme_show_error("invalid pi:%d", cfg.pi); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.pil > 1) { nvme_show_error("invalid pil:%d", cfg.pil); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.ms > 1) { nvme_show_error("invalid ms:%d", cfg.ms); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (!cfg.force) { @@ -5904,11 +5645,10 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin if (is_chardev(dev)) { if (ioctl(dev_fd(dev), NVME_IOCTL_RESCAN) < 0) { nvme_show_error("failed to rescan namespaces"); - err = -errno; - goto close_dev; + return -errno; } } else if (cfg.namespace_id != NVME_NSID_ALL) { - block_size = 1 << ns.lbaf[cfg.lbaf].ds; + block_size = 1 << ns->lbaf[cfg.lbaf].ds; /* * If block size has been changed by the format @@ -5920,14 +5660,12 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin if (ioctl(dev_fd(dev), BLKBSZSET, &block_size) < 0) { nvme_show_error("failed to set block size to %d", block_size); - err = -errno; - goto close_dev; + return -errno; } if (ioctl(dev_fd(dev), BLKRRPART) < 0) { nvme_show_error("failed to re-read partition table"); - err = -errno; - goto close_dev; + return -errno; } } } @@ -5935,9 +5673,6 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin nvme_ctrl_reset(dev_fd(dev)); } -close_dev: - dev_close(dev); -ret: return err; } @@ -5960,11 +5695,12 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin const char *value = "new value of feature (required)"; const char *cdw12 = "feature cdw12, if used"; const char *save = "specifies that the controller shall save the attribute"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ void *buf = NULL; + _cleanup_file_ int ffd = STDIN_FILENO; int err; __u32 result; - void *buf = NULL; - int ffd = STDIN_FILENO; struct config { __u32 namespace_id; @@ -5987,28 +5723,26 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin .save = false, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), - OPT_BYTE("feature-id", 'f', &cfg.feature_id, feature_id), - OPT_SUFFIX("value", 'v', &cfg.value, value), - OPT_UINT("cdw12", 'c', &cfg.cdw12, cdw12), - OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index_specify), - OPT_UINT("data-len", 'l', &cfg.data_len, buf_len), - OPT_FILE("data", 'd', &cfg.file, data), - OPT_FLAG("save", 's', &cfg.save, save), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), + OPT_BYTE("feature-id", 'f', &cfg.feature_id, feature_id), + OPT_SUFFIX("value", 'V', &cfg.value, value), + OPT_UINT("cdw12", 'c', &cfg.cdw12, cdw12), + OPT_BYTE("uuid-index", 'U', &cfg.uuid_index, uuid_index_specify), + OPT_UINT("data-len", 'l', &cfg.data_len, buf_len), + OPT_FILE("data", 'd', &cfg.file, data), + OPT_FLAG("save", 's', &cfg.save, save)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (!argconfig_parse_seen(opts, "namespace-id")) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { if (errno != ENOTTY) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return -errno; } cfg.namespace_id = NVME_NSID_ALL; } @@ -6016,14 +5750,12 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin if (!cfg.feature_id) { nvme_show_error("feature-id required param"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.uuid_index > 127) { nvme_show_error("invalid uuid index param: %u", cfg.uuid_index); - err = -1; - goto close_dev; + return -1; } if (!cfg.data_len) @@ -6032,12 +5764,9 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin &cfg.data_len); if (cfg.data_len) { - if (posix_memalign(&buf, getpagesize(), cfg.data_len)) { - nvme_show_error("can not allocate feature payload"); - err = -ENOMEM; - goto close_dev; - } - memset(buf, 0, cfg.data_len); + buf = nvme_alloc(cfg.data_len); + if (!buf) + return -ENOMEM; } if (buf) { @@ -6050,22 +5779,20 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin if (cfg.feature_id == NVME_FEAT_FID_TIMESTAMP && cfg.value) { memcpy(buf, &cfg.value, NVME_FEAT_TIMESTAMP_DATA_SIZE); } else { - if (strlen(cfg.file)) { + if (strlen(cfg.file)) ffd = open(cfg.file, O_RDONLY); - if (ffd <= 0) { - nvme_show_error("Failed to open file %s: %s", - cfg.file, strerror(errno)); - err = -EINVAL; - goto free; - } + + if (ffd < 0) { + nvme_show_error("Failed to open file %s: %s", + cfg.file, strerror(errno)); + return -EINVAL; } - err = read(ffd, (void *)buf, cfg.data_len); + err = read(ffd, buf, cfg.data_len); if (err < 0) { - err = -errno; nvme_show_error("failed to read data buffer from input file: %s", strerror(errno)); - goto close_ffd; + return -errno; } } } @@ -6106,14 +5833,6 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin nvme_show_status(err); } -close_ffd: - if (ffd != STDIN_FILENO) - close(ffd); -free: - free(buf); -close_dev: - dev_close(dev); -ret: return err; } @@ -6126,10 +5845,12 @@ static int sec_send(int argc, char **argv, struct command *cmd, struct plugin *p "associates Security Sends (security-send) and Security Receives (security-recv)."; const char *file = "transfer payload"; const char *tl = "transfer length (cf. SPC-4)"; - int err, sec_fd = STDIN_FILENO; - struct nvme_dev *dev; - void *sec_buf; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ void *sec_buf = NULL; + _cleanup_file_ int sec_fd = -1; unsigned int sec_size; + int err; struct config { __u32 namespace_id; @@ -6149,24 +5870,21 @@ static int sec_send(int argc, char **argv, struct command *cmd, struct plugin *p .tl = 0, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), - OPT_FILE("file", 'f', &cfg.file, file), - OPT_BYTE("nssf", 'N', &cfg.nssf, nssf), - OPT_BYTE("secp", 'p', &cfg.secp, secp), - OPT_SHRT("spsp", 's', &cfg.spsp, spsp), - OPT_UINT("tl", 't', &cfg.tl, tl), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), + OPT_FILE("file", 'f', &cfg.file, file), + OPT_BYTE("nssf", 'N', &cfg.nssf, nssf), + OPT_BYTE("secp", 'p', &cfg.secp, secp), + OPT_SHRT("spsp", 's', &cfg.spsp, spsp), + OPT_UINT("tl", 't', &cfg.tl, tl)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (cfg.tl == 0) { nvme_show_error("--tl unspecified or zero"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if ((cfg.tl & 3) != 0) nvme_show_error( @@ -6179,33 +5897,27 @@ static int sec_send(int argc, char **argv, struct command *cmd, struct plugin *p sec_fd = open(cfg.file, O_RDONLY); if (sec_fd < 0) { nvme_show_error("Failed to open %s: %s", cfg.file, strerror(errno)); - err = -EINVAL; - goto close_dev; + return -EINVAL; } err = fstat(sec_fd, &sb); if (err < 0) { nvme_show_perror("fstat"); - goto close_sec_fd; + return err; } sec_size = cfg.tl > sb.st_size ? cfg.tl : sb.st_size; } - if (posix_memalign(&sec_buf, getpagesize(), cfg.tl)) { - nvme_show_error("No memory for security size:%d", cfg.tl); - err = -ENOMEM; - goto close_sec_fd; - } - - memset(sec_buf, 0, cfg.tl); // ensure zero fill if buf_size > sec_size + sec_buf = nvme_alloc(cfg.tl); + if (!sec_buf) + return -ENOMEM; err = read(sec_fd, sec_buf, sec_size); if (err < 0) { - err = -errno; nvme_show_error("Failed to read data from security file %s with %s", cfg.file, strerror(errno)); - goto free; + return -errno; } struct nvme_security_send_args args = { @@ -6231,13 +5943,6 @@ static int sec_send(int argc, char **argv, struct command *cmd, struct plugin *p else printf("NVME Security Send Command Success\n"); -free: - free(sec_buf); -close_sec_fd: - close(sec_fd); -close_dev: - dev_close(dev); -ret: return err; } @@ -6247,11 +5952,12 @@ static int dir_send(int argc, char **argv, struct command *cmd, struct plugin *p const char *endir = "directive enable"; const char *ttype = "target directive type to be enabled/disabled"; const char *input = "write/send file (default stdin)"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ void *buf = NULL; __u32 result; __u32 dw12 = 0; - void *buf = NULL; - int ffd = STDIN_FILENO; + _cleanup_file_ int ffd = STDIN_FILENO; int err; struct config { @@ -6280,23 +5986,21 @@ static int dir_send(int argc, char **argv, struct command *cmd, struct plugin *p .file = "", }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_UINT("data-len", 'l', &cfg.data_len, buf_len), - OPT_BYTE("dir-type", 'D', &cfg.dtype, dtype), - OPT_BYTE("target-dir", 'T', &cfg.ttype, ttype), - OPT_SHRT("dir-spec", 'S', &cfg.dspec, dspec_w_dtype), - OPT_BYTE("dir-oper", 'O', &cfg.doper, doper), - OPT_SHRT("endir", 'e', &cfg.endir, endir), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_directive), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_directive), - OPT_FILE("input-file", 'i', &cfg.file, input), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_UINT("data-len", 'l', &cfg.data_len, buf_len), + OPT_BYTE("dir-type", 'D', &cfg.dtype, dtype), + OPT_BYTE("target-dir", 'T', &cfg.ttype, ttype), + OPT_SHRT("dir-spec", 'S', &cfg.dspec, dspec_w_dtype), + OPT_BYTE("dir-oper", 'O', &cfg.doper, doper), + OPT_SHRT("endir", 'e', &cfg.endir, endir), + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_directive), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_directive), + OPT_FILE("input-file", 'i', &cfg.file, input)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; switch (cfg.dtype) { case NVME_DIRECTIVE_DTYPE_IDENTIFY: @@ -6304,15 +6008,13 @@ static int dir_send(int argc, char **argv, struct command *cmd, struct plugin *p case NVME_DIRECTIVE_SEND_IDENTIFY_DOPER_ENDIR: if (!cfg.ttype) { nvme_show_error("target-dir required param\n"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } dw12 = cfg.ttype << 8 | cfg.endir; break; default: nvme_show_error("invalid directive operations for Identify Directives"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } break; case NVME_DIRECTIVE_DTYPE_STREAMS: @@ -6322,22 +6024,18 @@ static int dir_send(int argc, char **argv, struct command *cmd, struct plugin *p break; default: nvme_show_error("invalid directive operations for Streams Directives"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } break; default: nvme_show_error("invalid directive type"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.data_len) { - if (posix_memalign(&buf, getpagesize(), cfg.data_len)) { - err = -ENOMEM; - goto close_dev; - } - memset(buf, 0, cfg.data_len); + buf = nvme_alloc(cfg.data_len); + if (!buf) + return -ENOMEM; } if (buf) { @@ -6346,16 +6044,14 @@ static int dir_send(int argc, char **argv, struct command *cmd, struct plugin *p if (ffd <= 0) { nvme_show_error("Failed to open file %s: %s", cfg.file, strerror(errno)); - err = -EINVAL; - goto free; + return -EINVAL; } } err = read(ffd, (void *)buf, cfg.data_len); if (err < 0) { - err = -errno; nvme_show_error("failed to read data buffer from input file %s", strerror(errno)); - goto close_ffd; + return -errno; } } @@ -6375,7 +6071,7 @@ static int dir_send(int argc, char **argv, struct command *cmd, struct plugin *p err = nvme_directive_send(&args); if (err < 0) { nvme_show_error("dir-send: %s", nvme_strerror(errno)); - goto close_ffd; + return err; } if (!err) { printf("dir-send: type %#x, operation %#x, spec_val %#x, nsid %#x, result %#x\n", @@ -6390,13 +6086,6 @@ static int dir_send(int argc, char **argv, struct command *cmd, struct plugin *p nvme_show_status(err); } -close_ffd: - close(ffd); -free: - free(buf); -close_dev: - dev_close(dev); -ret: return err; } @@ -6404,7 +6093,8 @@ static int write_uncor(int argc, char **argv, struct command *cmd, struct plugin { const char *desc = "The Write Uncorrectable command is used to set a range of logical blocks to invalid."; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; struct config { @@ -6423,31 +6113,28 @@ static int write_uncor(int argc, char **argv, struct command *cmd, struct plugin .dspec = 0, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), - OPT_SUFFIX("start-block", 's', &cfg.start_block, start_block), - OPT_SHRT("block-count", 'c', &cfg.block_count, block_count), - OPT_BYTE("dir-type", 'T', &cfg.dtype, dtype), - OPT_SHRT("dir-spec", 'S', &cfg.dspec, dspec_w_dtype), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), + OPT_SUFFIX("start-block", 's', &cfg.start_block, start_block), + OPT_SHRT("block-count", 'c', &cfg.block_count, block_count), + OPT_BYTE("dir-type", 'T', &cfg.dtype, dtype), + OPT_SHRT("dir-spec", 'S', &cfg.dspec, dspec_w_dtype)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (!cfg.namespace_id) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } if (cfg.dtype > 0xf) { nvme_show_error("Invalid directive type, %x", cfg.dtype); - err = -EINVAL; - goto close_dev; + return -EINVAL; } struct nvme_io_args args = { @@ -6469,9 +6156,6 @@ static int write_uncor(int argc, char **argv, struct command *cmd, struct plugin else printf("NVME Write Uncorrectable Success\n"); -close_dev: - dev_close(dev); -ret: return err; } @@ -6511,11 +6195,11 @@ static int invalid_tags(__u64 storage_tag, __u64 ref_tag, __u8 sts, __u8 pif) static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugin *plugin) { - __u16 control = 0; + _cleanup_free_ struct nvme_nvm_id_ns *nvm_ns = NULL; + _cleanup_free_ struct nvme_id_ns *ns = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; __u8 lba_index, sts = 0, pif = 0; - struct nvme_id_ns ns; - struct nvme_dev *dev; - struct nvme_nvm_id_ns nvm_ns; + __u16 control = 0; int err; const char *desc = @@ -6560,37 +6244,32 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi .dspec = 0, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), - OPT_SUFFIX("start-block", 's', &cfg.start_block, start_block), - OPT_SHRT("block-count", 'c', &cfg.block_count, block_count), - OPT_BYTE("dir-type", 'T', &cfg.dtype, dtype), - OPT_FLAG("deac", 'd', &cfg.deac, deac), - OPT_FLAG("limited-retry", 'l', &cfg.limited_retry, limited_retry), - OPT_FLAG("force-unit-access", 'f', &cfg.force_unit_access, force_unit_access), - OPT_BYTE("prinfo", 'p', &cfg.prinfo, prinfo), - OPT_SUFFIX("ref-tag", 'r', &cfg.ref_tag, ref_tag), - OPT_SHRT("app-tag-mask", 'm', &cfg.app_tag_mask, app_tag_mask), - OPT_SHRT("app-tag", 'a', &cfg.app_tag, app_tag), - OPT_SUFFIX("storage-tag", 'S', &cfg.storage_tag, storage_tag), - OPT_FLAG("storage-tag-check", 'C', &cfg.storage_tag_check, storage_tag_check), - OPT_SHRT("dir-spec", 'D', &cfg.dspec, dspec_w_dtype), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), + OPT_SUFFIX("start-block", 's', &cfg.start_block, start_block), + OPT_SHRT("block-count", 'c', &cfg.block_count, block_count), + OPT_BYTE("dir-type", 'T', &cfg.dtype, dtype), + OPT_FLAG("deac", 'd', &cfg.deac, deac), + OPT_FLAG("limited-retry", 'l', &cfg.limited_retry, limited_retry), + OPT_FLAG("force-unit-access", 'f', &cfg.force_unit_access, force_unit_access), + OPT_BYTE("prinfo", 'p', &cfg.prinfo, prinfo), + OPT_SUFFIX("ref-tag", 'r', &cfg.ref_tag, ref_tag), + OPT_SHRT("app-tag-mask", 'm', &cfg.app_tag_mask, app_tag_mask), + OPT_SHRT("app-tag", 'a', &cfg.app_tag, app_tag), + OPT_SUFFIX("storage-tag", 'S', &cfg.storage_tag, storage_tag), + OPT_FLAG("storage-tag-check", 'C', &cfg.storage_tag_check, storage_tag_check), + OPT_SHRT("dir-spec", 'D', &cfg.dspec, dspec_w_dtype)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - if (cfg.prinfo > 0xf) { - err = -EINVAL; - goto close_dev; - } + if (cfg.prinfo > 0xf) + return -EINVAL; if (cfg.dtype > 0xf) { nvme_show_error("Invalid directive type, %x", cfg.dtype); - err = -EINVAL; - goto close_dev; + return -EINVAL; } control |= (cfg.prinfo << 10); @@ -6607,30 +6286,36 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } - err = nvme_cli_identify_ns(dev, cfg.namespace_id, &ns); + ns = nvme_alloc(sizeof(*ns)); + if (!ns) + return -ENOMEM; + + err = nvme_cli_identify_ns(dev, cfg.namespace_id, ns); if (err < 0) { nvme_show_error("identify namespace: %s", nvme_strerror(errno)); - goto close_dev; + return err; } else if (err) { nvme_show_status(err); - goto close_dev; + return err; } - err = nvme_identify_ns_csi(dev_fd(dev), cfg.namespace_id, 0, NVME_CSI_NVM, &nvm_ns); + nvm_ns = nvme_alloc(sizeof(*nvm_ns)); + if (!nvm_ns) + return -ENOMEM; + + err = nvme_identify_ns_csi(dev_fd(dev), cfg.namespace_id, 0, NVME_CSI_NVM, nvm_ns); if (!err) { - nvme_id_ns_flbas_to_lbaf_inuse(ns.flbas, &lba_index); - sts = nvm_ns.elbaf[lba_index] & NVME_NVM_ELBAF_STS_MASK; - pif = (nvm_ns.elbaf[lba_index] & NVME_NVM_ELBAF_PIF_MASK) >> 7; + nvme_id_ns_flbas_to_lbaf_inuse(ns->flbas, &lba_index); + sts = nvm_ns->elbaf[lba_index] & NVME_NVM_ELBAF_STS_MASK; + pif = (nvm_ns->elbaf[lba_index] & NVME_NVM_ELBAF_PIF_MASK) >> 7; } - if (invalid_tags(cfg.storage_tag, cfg.ref_tag, sts, pif)) { - err = -EINVAL; - goto close_dev; - } + if (invalid_tags(cfg.storage_tag, cfg.ref_tag, sts, pif)) + return -EINVAL; struct nvme_io_args args = { .args_size = sizeof(args), @@ -6657,9 +6342,6 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi else printf("NVME Write Zeroes Success\n"); -close_dev: - dev_close(dev); -ret: return err; } @@ -6677,12 +6359,12 @@ static int dsm(int argc, char **argv, struct command *cmd, struct plugin *plugin const char *idr = "Attribute Integral Dataset for Read"; const char *cdw11 = "All the command DWORD 11 attributes. Use instead of specifying individual attributes"; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ struct nvme_dsm_range *dsm = NULL; uint16_t nr, nc, nb, ns; __u32 ctx_attrs[256] = {0,}; __u32 nlbs[256] = {0,}; __u64 slbas[256] = {0,}; - struct nvme_dsm_range dsm[256]; - struct nvme_dev *dev; int err; struct config { @@ -6707,42 +6389,43 @@ static int dsm(int argc, char **argv, struct command *cmd, struct plugin *plugin .cdw11 = 0, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_LIST("ctx-attrs", 'a', &cfg.ctx_attrs, context_attrs), - OPT_LIST("blocks", 'b', &cfg.blocks, blocks), - OPT_LIST("slbs", 's', &cfg.slbas, starting_blocks), - OPT_FLAG("ad", 'd', &cfg.ad, ad), - OPT_FLAG("idw", 'w', &cfg.idw, idw), - OPT_FLAG("idr", 'r', &cfg.idr, idr), - OPT_UINT("cdw11", 'c', &cfg.cdw11, cdw11), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_LIST("ctx-attrs", 'a', &cfg.ctx_attrs, context_attrs), + OPT_LIST("blocks", 'b', &cfg.blocks, blocks), + OPT_LIST("slbs", 's', &cfg.slbas, starting_blocks), + OPT_FLAG("ad", 'd', &cfg.ad, ad), + OPT_FLAG("idw", 'w', &cfg.idw, idw), + OPT_FLAG("idr", 'r', &cfg.idr, idr), + OPT_UINT("cdw11", 'c', &cfg.cdw11, cdw11)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - nc = argconfig_parse_comma_sep_array(cfg.ctx_attrs, (int *)ctx_attrs, ARRAY_SIZE(ctx_attrs)); - nb = argconfig_parse_comma_sep_array(cfg.blocks, (int *)nlbs, ARRAY_SIZE(nlbs)); - ns = argconfig_parse_comma_sep_array_long(cfg.slbas, (unsigned long long *)slbas, ARRAY_SIZE(slbas)); + nc = argconfig_parse_comma_sep_array_u32(cfg.ctx_attrs, ctx_attrs, ARRAY_SIZE(ctx_attrs)); + nb = argconfig_parse_comma_sep_array_u32(cfg.blocks, nlbs, ARRAY_SIZE(nlbs)); + ns = argconfig_parse_comma_sep_array_u64(cfg.slbas, slbas, ARRAY_SIZE(slbas)); nr = max(nc, max(nb, ns)); if (!nr || nr > 256) { nvme_show_error("No range definition provided"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (!cfg.namespace_id) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } if (!cfg.cdw11) cfg.cdw11 = (cfg.ad << 2) | (cfg.idw << 1) | (cfg.idr << 0); + dsm = nvme_alloc(sizeof(*dsm) * 256); + if (!dsm) + return -ENOMEM; + nvme_init_dsm_range(dsm, ctx_attrs, nlbs, slbas, nr); struct nvme_dsm_args args = { .args_size = sizeof(args), @@ -6762,9 +6445,6 @@ static int dsm(int argc, char **argv, struct command *cmd, struct plugin *plugin else printf("NVMe DSM: success\n"); -close_dev: - dev_close(dev); -ret: return err; } @@ -6776,6 +6456,8 @@ static int copy_cmd(int argc, char **argv, struct command *cmd, struct plugin *p const char *d_sdlba = "64-bit addr of first destination logical block"; const char *d_slbas = "64-bit addr of first block per range (comma-separated list)"; const char *d_nlbs = "number of blocks per range (comma-separated list, zeroes-based values)"; + const char *d_snsids = "source namespace identifier per range (comma-separated list)"; + const char *d_sopts = "source options per range (comma-separated list)"; const char *d_lr = "limited retry"; const char *d_fua = "force unit access"; const char *d_prinfor = "protection information and check field (read part)"; @@ -6790,30 +6472,36 @@ static int copy_cmd(int argc, char **argv, struct command *cmd, struct plugin *p const char *d_dspec = "directive specific (write part)"; const char *d_format = "source range entry format"; - uint16_t nr, nb, ns, nrts, natms, nats; - __u16 nlbs[128] = { 0 }; - unsigned long long slbas[128] = {0,}; - struct nvme_dev *dev; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + __u16 nr, nb, ns, nrts, natms, nats, nids; + __u16 nlbs[256] = { 0 }; + __u64 slbas[256] = { 0 }; + __u32 snsids[256] = { 0 }; + __u16 sopts[256] = { 0 }; int err; union { - __u32 f0[128]; - __u64 f1[101]; + __u32 short_pi[256]; + __u64 long_pi[256]; } eilbrts; - __u32 elbatms[128] = { 0 }; - __u32 elbats[128] = { 0 }; + __u32 elbatms[256] = { 0 }; + __u32 elbats[256] = { 0 }; union { - struct nvme_copy_range f0[128]; - struct nvme_copy_range_f1 f1[101]; - } copy; + struct nvme_copy_range f0[256]; + struct nvme_copy_range_f1 f1[256]; + struct nvme_copy_range_f2 f2[256]; + struct nvme_copy_range_f3 f3[256]; + } *copy; struct config { __u32 namespace_id; __u64 sdlba; char *slbas; char *nlbs; + char *snsids; + char *sopts; bool lr; bool fua; __u8 prinfow; @@ -6834,6 +6522,8 @@ static int copy_cmd(int argc, char **argv, struct command *cmd, struct plugin *p .sdlba = 0, .slbas = "", .nlbs = "", + .snsids = "", + .sopts = "", .lr = false, .fua = false, .prinfow = 0, @@ -6849,77 +6539,93 @@ static int copy_cmd(int argc, char **argv, struct command *cmd, struct plugin *p .format = 0, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_SUFFIX("sdlba", 'd', &cfg.sdlba, d_sdlba), - OPT_LIST("slbs", 's', &cfg.slbas, d_slbas), - OPT_LIST("blocks", 'b', &cfg.nlbs, d_nlbs), - OPT_FLAG("limited-retry", 'l', &cfg.lr, d_lr), - OPT_FLAG("force-unit-access", 'f', &cfg.fua, d_fua), - OPT_BYTE("prinfow", 'p', &cfg.prinfow, d_prinfow), - OPT_BYTE("prinfor", 'P', &cfg.prinfor, d_prinfor), - OPT_SUFFIX("ref-tag", 'r', &cfg.ilbrt, d_ilbrt), - OPT_LIST("expected-ref-tags", 'R', &cfg.eilbrts, d_eilbrts), - OPT_SHRT("app-tag", 'a', &cfg.lbat, d_lbat), - OPT_LIST("expected-app-tags", 'A', &cfg.elbats, d_elbats), - OPT_SHRT("app-tag-mask", 'm', &cfg.lbatm, d_lbatm), - OPT_LIST("expected-app-tag-masks", 'M', &cfg.elbatms, d_elbatms), - OPT_BYTE("dir-type", 'T', &cfg.dtype, d_dtype), - OPT_SHRT("dir-spec", 'S', &cfg.dspec, d_dspec), - OPT_BYTE("format", 'F', &cfg.format, d_format), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_SUFFIX("sdlba", 'd', &cfg.sdlba, d_sdlba), + OPT_LIST("slbs", 's', &cfg.slbas, d_slbas), + OPT_LIST("blocks", 'b', &cfg.nlbs, d_nlbs), + OPT_LIST("snsids", 'N', &cfg.snsids, d_snsids), + OPT_LIST("sopts", 'O', &cfg.sopts, d_sopts), + OPT_FLAG("limited-retry", 'l', &cfg.lr, d_lr), + OPT_FLAG("force-unit-access", 'f', &cfg.fua, d_fua), + OPT_BYTE("prinfow", 'p', &cfg.prinfow, d_prinfow), + OPT_BYTE("prinfor", 'P', &cfg.prinfor, d_prinfor), + OPT_SUFFIX("ref-tag", 'r', &cfg.ilbrt, d_ilbrt), + OPT_LIST("expected-ref-tags", 'R', &cfg.eilbrts, d_eilbrts), + OPT_SHRT("app-tag", 'a', &cfg.lbat, d_lbat), + OPT_LIST("expected-app-tags", 'A', &cfg.elbats, d_elbats), + OPT_SHRT("app-tag-mask", 'm', &cfg.lbatm, d_lbatm), + OPT_LIST("expected-app-tag-masks", 'M', &cfg.elbatms, d_elbatms), + OPT_BYTE("dir-type", 'T', &cfg.dtype, d_dtype), + OPT_SHRT("dir-spec", 'S', &cfg.dspec, d_dspec), + OPT_BYTE("format", 'F', &cfg.format, d_format)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; - - nb = argconfig_parse_comma_sep_array_short(cfg.nlbs, nlbs, ARRAY_SIZE(nlbs)); - ns = argconfig_parse_comma_sep_array_long(cfg.slbas, slbas, ARRAY_SIZE(slbas)); + return err; - if (cfg.format == 0) { - nrts = argconfig_parse_comma_sep_array(cfg.eilbrts, (int *)eilbrts.f0, - ARRAY_SIZE(eilbrts.f0)); - } else if (cfg.format == 1) { - nrts = argconfig_parse_comma_sep_array_long(cfg.eilbrts, - (unsigned long long *)eilbrts.f1, - ARRAY_SIZE(eilbrts.f1)); + nb = argconfig_parse_comma_sep_array_u16(cfg.nlbs, nlbs, ARRAY_SIZE(nlbs)); + ns = argconfig_parse_comma_sep_array_u64(cfg.slbas, slbas, ARRAY_SIZE(slbas)); + nids = argconfig_parse_comma_sep_array_u32(cfg.snsids, snsids, ARRAY_SIZE(snsids)); + argconfig_parse_comma_sep_array_u16(cfg.sopts, sopts, ARRAY_SIZE(sopts)); + + if (cfg.format == 0 || cfg.format == 2) { + nrts = argconfig_parse_comma_sep_array_u32(cfg.eilbrts, eilbrts.short_pi, + ARRAY_SIZE(eilbrts.short_pi)); + } else if (cfg.format == 1 || cfg.format == 3) { + nrts = argconfig_parse_comma_sep_array_u64(cfg.eilbrts, eilbrts.long_pi, + ARRAY_SIZE(eilbrts.long_pi)); } else { nvme_show_error("invalid format"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } - natms = argconfig_parse_comma_sep_array(cfg.elbatms, (int *)elbatms, ARRAY_SIZE(elbatms)); - nats = argconfig_parse_comma_sep_array(cfg.elbats, (int *)elbats, ARRAY_SIZE(elbats)); + natms = argconfig_parse_comma_sep_array_u32(cfg.elbatms, elbatms, ARRAY_SIZE(elbatms)); + nats = argconfig_parse_comma_sep_array_u32(cfg.elbats, elbats, ARRAY_SIZE(elbats)); nr = max(nb, max(ns, max(nrts, max(natms, nats)))); - if (!nr || nr > 128 || (cfg.format == 1 && nr > 101)) { + if (cfg.format == 2 || cfg.format == 3) { + if (nr != nids) { + nvme_show_error("formats 2 and 3 require source namespace ids for each source range"); + return -EINVAL; + } + } else if (nids) { + nvme_show_error("formats 0 and 1 do not support cross-namespace copy"); + return -EINVAL; + } + if (!nr || nr > 256) { nvme_show_error("invalid range"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (!cfg.namespace_id) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } + copy = nvme_alloc(sizeof(*copy)); + if (!copy) + return -ENOMEM; + if (cfg.format == 0) - nvme_init_copy_range(copy.f0, nlbs, (__u64 *)slbas, - eilbrts.f0, elbatms, elbats, nr); + nvme_init_copy_range(copy->f0, nlbs, slbas, eilbrts.short_pi, elbatms, elbats, nr); else if (cfg.format == 1) - nvme_init_copy_range_f1(copy.f1, nlbs, (__u64 *)slbas, - eilbrts.f1, elbatms, elbats, nr); + nvme_init_copy_range_f1(copy->f1, nlbs, slbas, eilbrts.long_pi, elbatms, elbats, nr); + else if (cfg.format == 2) + nvme_init_copy_range_f2(copy->f2, snsids, nlbs, slbas, sopts, eilbrts.short_pi, elbatms, + elbats, nr); + else if (cfg.format == 3) + nvme_init_copy_range_f3(copy->f3, snsids, nlbs, slbas, sopts, eilbrts.long_pi, elbatms, + elbats, nr); struct nvme_copy_args args = { .args_size = sizeof(args), .fd = dev_fd(dev), .nsid = cfg.namespace_id, - .copy = copy.f0, + .copy = copy->f0, .sdlba = cfg.sdlba, .nr = nr, .prinfor = cfg.prinfor, @@ -6943,9 +6649,6 @@ static int copy_cmd(int argc, char **argv, struct command *cmd, struct plugin *p else printf("NVMe Copy: success\n"); -close_dev: - dev_close(dev); -ret: return err; } @@ -6956,7 +6659,8 @@ static int flush_cmd(int argc, char **argv, struct command *cmd, struct plugin * "finished before the flush was submitted. Additional data may also be\n" "flushed by the controller, from any namespace, depending on controller and\n" "associated namespace status."; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; struct config { @@ -6967,20 +6671,18 @@ static int flush_cmd(int argc, char **argv, struct command *cmd, struct plugin * .namespace_id = 0, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (!cfg.namespace_id) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } @@ -6991,9 +6693,7 @@ static int flush_cmd(int argc, char **argv, struct command *cmd, struct plugin * nvme_show_status(err); else printf("NVMe Flush: success\n"); -close_dev: - dev_close(dev); -ret: + return err; } @@ -7006,7 +6706,8 @@ static int resv_acquire(int argc, char **argv, struct command *cmd, struct plugi "status Reservation Conflict if the given namespace is already reserved."; const char *prkey = "pre-empt reservation key"; const char *racqa = "reservation acquire action"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; struct config { @@ -7027,31 +6728,28 @@ static int resv_acquire(int argc, char **argv, struct command *cmd, struct plugi .iekey = false, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_SUFFIX("crkey", 'c', &cfg.crkey, crkey), - OPT_SUFFIX("prkey", 'p', &cfg.prkey, prkey), - OPT_BYTE("rtype", 't', &cfg.rtype, rtype), - OPT_BYTE("racqa", 'a', &cfg.racqa, racqa), - OPT_FLAG("iekey", 'i', &cfg.iekey, iekey), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_SUFFIX("crkey", 'c', &cfg.crkey, crkey), + OPT_SUFFIX("prkey", 'p', &cfg.prkey, prkey), + OPT_BYTE("rtype", 't', &cfg.rtype, rtype), + OPT_BYTE("racqa", 'a', &cfg.racqa, racqa), + OPT_FLAG("iekey", 'i', &cfg.iekey, iekey)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (!cfg.namespace_id) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } if (cfg.racqa > 7) { nvme_show_error("invalid racqa:%d", cfg.racqa); - err = -EINVAL; - goto close_dev; + return -EINVAL; } struct nvme_resv_acquire_args args = { @@ -7074,9 +6772,6 @@ static int resv_acquire(int argc, char **argv, struct command *cmd, struct plugi else printf("NVME Reservation Acquire success\n"); -close_dev: - dev_close(dev); -ret: return err; } @@ -7088,7 +6783,8 @@ static int resv_register(int argc, char **argv, struct command *cmd, struct plug const char *nrkey = "new reservation key"; const char *rrega = "reservation registration action"; const char *cptpl = "change persistence through power loss setting"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; struct config { @@ -7108,37 +6804,33 @@ static int resv_register(int argc, char **argv, struct command *cmd, struct plug .cptpl = false, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_SUFFIX("crkey", 'c', &cfg.crkey, crkey), - OPT_SUFFIX("nrkey", 'k', &cfg.nrkey, nrkey), - OPT_BYTE("rrega", 'r', &cfg.rrega, rrega), - OPT_BYTE("cptpl", 'p', &cfg.cptpl, cptpl), - OPT_FLAG("iekey", 'i', &cfg.iekey, iekey), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_SUFFIX("crkey", 'c', &cfg.crkey, crkey), + OPT_SUFFIX("nrkey", 'k', &cfg.nrkey, nrkey), + OPT_BYTE("rrega", 'r', &cfg.rrega, rrega), + OPT_BYTE("cptpl", 'p', &cfg.cptpl, cptpl), + OPT_FLAG("iekey", 'i', &cfg.iekey, iekey)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (!cfg.namespace_id) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } if (cfg.cptpl > 3) { nvme_show_error("invalid cptpl:%d", cfg.cptpl); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.rrega > 7) { nvme_show_error("invalid rrega:%d", cfg.rrega); - err = -EINVAL; - goto close_dev; + return -EINVAL; } struct nvme_resv_register_args args = { @@ -7161,9 +6853,6 @@ static int resv_register(int argc, char **argv, struct command *cmd, struct plug else printf("NVME Reservation success\n"); -close_dev: - dev_close(dev); -ret: return err; } @@ -7178,7 +6867,8 @@ static int resv_release(int argc, char **argv, struct command *cmd, struct plugi "Exclusive Access, all registrants on the namespace except\n" "the issuing controller are notified."; const char *rrela = "reservation release action"; - struct nvme_dev *dev; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; struct config { @@ -7197,30 +6887,27 @@ static int resv_release(int argc, char **argv, struct command *cmd, struct plugi .iekey = 0, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), - OPT_SUFFIX("crkey", 'c', &cfg.crkey, crkey), - OPT_BYTE("rtype", 't', &cfg.rtype, rtype), - OPT_BYTE("rrela", 'a', &cfg.rrela, rrela), - OPT_FLAG("iekey", 'i', &cfg.iekey, iekey), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), + OPT_SUFFIX("crkey", 'c', &cfg.crkey, crkey), + OPT_BYTE("rtype", 't', &cfg.rtype, rtype), + OPT_BYTE("rrela", 'a', &cfg.rrela, rrela), + OPT_FLAG("iekey", 'i', &cfg.iekey, iekey)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (!cfg.namespace_id) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } if (cfg.rrela > 7) { nvme_show_error("invalid rrela:%d", cfg.rrela); - err = -EINVAL; - goto close_dev; + return -EINVAL; } struct nvme_resv_release_args args = { @@ -7242,9 +6929,6 @@ static int resv_release(int argc, char **argv, struct command *cmd, struct plugi else printf("NVME Reservation Release success\n"); -close_dev: - dev_close(dev); -ret: return err; } @@ -7257,16 +6941,15 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin const char *numd = "number of dwords to transfer"; const char *eds = "request extended data structure"; - struct nvme_resv_status *status; + _cleanup_free_ struct nvme_resv_status *status = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; enum nvme_print_flags flags; - struct nvme_dev *dev; int err, size; struct config { __u32 namespace_id; __u32 numd; __u8 eds; - char *output_format; bool raw_binary; }; @@ -7274,27 +6957,23 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin .namespace_id = 0, .numd = 0, .eds = false, - .output_format = "normal", .raw_binary = false, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_UINT("numd", 'd', &cfg.numd, numd), - OPT_FLAG("eds", 'e', &cfg.eds, eds), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_dump), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_UINT("numd", 'd', &cfg.numd, numd), + OPT_FLAG("eds", 'e', &cfg.eds, eds), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_dump)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (cfg.raw_binary) @@ -7304,7 +6983,7 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } @@ -7315,12 +6994,9 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin size = (cfg.numd + 1) << 2; - if (posix_memalign((void **)&status, getpagesize(), size)) { - nvme_show_error("No memory for resv report:%d", size); - err = -ENOMEM; - goto close_dev; - } - memset(status, 0, size); + status = nvme_alloc(size); + if (!status) + return -ENOMEM; struct nvme_resv_report_args args = { .args_size = sizeof(args), @@ -7339,10 +7015,7 @@ static int resv_report(int argc, char **argv, struct command *cmd, struct plugin nvme_show_status(err); else nvme_show_error("reservation report: %s", nvme_strerror(errno)); - free(status); -close_dev: - dev_close(dev); -ret: + return err; } @@ -7357,20 +7030,21 @@ unsigned long long elapsed_utime(struct timeval start_time, static int submit_io(int opcode, char *command, const char *desc, int argc, char **argv) { struct timeval start_time, end_time; - void *buffer, *mbuffer = NULL; + void *buffer; + _cleanup_free_ void *mbuffer = NULL; int err = 0; - int dfd, mfd; - int flags = opcode & 1 ? O_RDONLY : O_WRONLY | O_CREAT; + _cleanup_file_ int dfd = -1, mfd = -1; + int flags; int mode = 0644; __u16 control = 0, nblocks = 0; __u32 dsmgmt = 0; - int logical_block_size = 0; + unsigned int logical_block_size = 0; unsigned long long buffer_size = 0, mbuffer_size = 0; - bool huge; - struct nvme_id_ns ns; - struct nvme_nvm_id_ns nvm_ns; + _cleanup_huge_ struct nvme_mem_huge mh = { 0, }; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ struct nvme_nvm_id_ns *nvm_ns = NULL; + _cleanup_free_ struct nvme_id_ns *ns = NULL; __u8 lba_index, ms = 0, sts = 0, pif = 0; - struct nvme_dev *dev; const char *start_block_addr = "64-bit addr of first block to access"; const char *data_size = "size of data in bytes"; @@ -7436,40 +7110,38 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char .force = false, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_SUFFIX("start-block", 's', &cfg.start_block, start_block_addr), - OPT_SHRT("block-count", 'c', &cfg.block_count, block_count), - OPT_SUFFIX("data-size", 'z', &cfg.data_size, data_size), - OPT_SUFFIX("metadata-size", 'y', &cfg.metadata_size, metadata_size), - OPT_SUFFIX("ref-tag", 'r', &cfg.ref_tag, ref_tag), - OPT_FILE("data", 'd', &cfg.data, data), - OPT_FILE("metadata", 'M', &cfg.metadata, metadata), - OPT_BYTE("prinfo", 'p', &cfg.prinfo, prinfo), - OPT_SHRT("app-tag-mask", 'm', &cfg.app_tag_mask, app_tag_mask), - OPT_SHRT("app-tag", 'a', &cfg.app_tag, app_tag), - OPT_SUFFIX("storage-tag", 'g', &cfg.storage_tag, storage_tag), - OPT_FLAG("limited-retry", 'l', &cfg.limited_retry, limited_retry_num), - OPT_FLAG("force-unit-access", 'f', &cfg.force_unit_access, force_unit_access), - OPT_FLAG("storage-tag-check", 'C', &cfg.storage_tag_check, storage_tag_check), - OPT_BYTE("dir-type", 'T', &cfg.dtype, dtype_for_write), - OPT_SHRT("dir-spec", 'S', &cfg.dspec, dspec), - OPT_BYTE("dsm", 'D', &cfg.dsmgmt, dsm), - OPT_FLAG("show-command", 'v', &cfg.show, show), - OPT_FLAG("dry-run", 'w', &cfg.dry_run, dry), - OPT_FLAG("latency", 't', &cfg.latency, latency), - OPT_FLAG("force", 0, &cfg.force, force), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_SUFFIX("start-block", 's', &cfg.start_block, start_block_addr), + OPT_SHRT("block-count", 'c', &cfg.block_count, block_count), + OPT_SUFFIX("data-size", 'z', &cfg.data_size, data_size), + OPT_SUFFIX("metadata-size", 'y', &cfg.metadata_size, metadata_size), + OPT_SUFFIX("ref-tag", 'r', &cfg.ref_tag, ref_tag), + OPT_FILE("data", 'd', &cfg.data, data), + OPT_FILE("metadata", 'M', &cfg.metadata, metadata), + OPT_BYTE("prinfo", 'p', &cfg.prinfo, prinfo), + OPT_SHRT("app-tag-mask", 'm', &cfg.app_tag_mask, app_tag_mask), + OPT_SHRT("app-tag", 'a', &cfg.app_tag, app_tag), + OPT_SUFFIX("storage-tag", 'g', &cfg.storage_tag, storage_tag), + OPT_FLAG("limited-retry", 'l', &cfg.limited_retry, limited_retry_num), + OPT_FLAG("force-unit-access", 'f', &cfg.force_unit_access, force_unit_access), + OPT_FLAG("storage-tag-check", 'C', &cfg.storage_tag_check, storage_tag_check), + OPT_BYTE("dir-type", 'T', &cfg.dtype, dtype_for_write), + OPT_SHRT("dir-spec", 'S', &cfg.dspec, dspec), + OPT_BYTE("dsm", 'D', &cfg.dsmgmt, dsm), + OPT_FLAG("show-command", 'V', &cfg.show, show), + OPT_FLAG("dry-run", 'w', &cfg.dry_run, dry), + OPT_FLAG("latency", 't', &cfg.latency, latency), + OPT_FLAG("force", 0, &cfg.force, force)); if (opcode != nvme_cmd_write) { err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; } else { err = argconfig_parse(argc, argv, desc, opts); if (err) - goto ret; + return err; err = open_exclusive(&dev, argc, argv, cfg.force); if (err) { if (errno == EBUSY) { @@ -7481,7 +7153,7 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char } else { argconfig_print_help(desc, opts); } - goto ret; + return err; } } @@ -7489,15 +7161,12 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } - dfd = mfd = opcode & 1 ? STDIN_FILENO : STDOUT_FILENO; - if (cfg.prinfo > 0xf) { - err = -EINVAL; - goto close_dev; - } + if (cfg.prinfo > 0xf) + return err; dsmgmt = cfg.dsmgmt; control |= (cfg.prinfo << 10); @@ -7510,19 +7179,25 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char if (cfg.dtype) { if (cfg.dtype > 0xf) { nvme_show_error("Invalid directive type, %x", cfg.dtype); - err = -EINVAL; - goto close_dev; + return -EINVAL; } control |= cfg.dtype << 4; dsmgmt |= ((__u32)cfg.dspec) << 16; } + if (opcode & 1) { + dfd = mfd = STDIN_FILENO; + flags = O_RDONLY; + } else { + dfd = mfd = STDOUT_FILENO; + flags = O_WRONLY | O_CREAT; + } + if (strlen(cfg.data)) { dfd = open(cfg.data, flags, mode); if (dfd < 0) { nvme_show_perror(cfg.data); - err = -EINVAL; - goto close_dev; + return -EINVAL; } } @@ -7530,19 +7205,40 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char mfd = open(cfg.metadata, flags, mode); if (mfd < 0) { nvme_show_perror(cfg.metadata); - err = -EINVAL; - goto close_dfd; + return -EINVAL; } } if (!cfg.data_size) { nvme_show_error("data size not provided"); - err = -EINVAL; - goto close_mfd; + return -EINVAL; } - if (nvme_get_logical_block_size(dev_fd(dev), cfg.namespace_id, &logical_block_size) < 0) - goto close_mfd; + ns = nvme_alloc(sizeof(*ns)); + if (!ns) + return -ENOMEM; + + err = nvme_cli_identify_ns(dev, cfg.namespace_id, ns); + if (err > 0) { + nvme_show_status(err); + return err; + } else if (err < 0) { + nvme_show_error("identify namespace: %s", nvme_strerror(errno)); + return err; + } + + nvme_id_ns_flbas_to_lbaf_inuse(ns->flbas, &lba_index); + logical_block_size = 1 << ns->lbaf[lba_index].ds; + ms = ns->lbaf[lba_index].ms; + if (NVME_FLBAS_META_EXT(ns->flbas)) { + /* + * No meta data is transferred for PRACT=1 and MD=8: + * 5.2.2.1 Protection Information and Write Commands + * 5.2.2.2 Protection Information and Read Commands + */ + if (!(cfg.prinfo == 0x1 && ms == 8)) + logical_block_size += ms; + } buffer_size = ((long long)cfg.block_count + 1) * logical_block_size; if (cfg.data_size < buffer_size) @@ -7550,35 +7246,30 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char else buffer_size = cfg.data_size; - /* Get the required block count. Note this is a zeroes based value. */ - nblocks = ((buffer_size + (logical_block_size - 1)) / logical_block_size) - 1; - - /* Update the data size based on the required block count */ - buffer_size = (nblocks + 1) * logical_block_size; + if (argconfig_parse_seen(opts, "block-count")) { + /* Use the value provided */ + nblocks = cfg.block_count; + } else { + /* Get the required block count. Note this is a zeroes based value. */ + nblocks = ((buffer_size + (logical_block_size - 1)) / logical_block_size) - 1; - buffer = nvme_alloc(buffer_size, &huge); - if (!buffer) { - err = -ENOMEM; - goto close_mfd; + /* Update the data size based on the required block count */ + buffer_size = ((unsigned long long)nblocks + 1) * logical_block_size; } - if (cfg.metadata_size) { - err = nvme_cli_identify_ns(dev, cfg.namespace_id, &ns); - if (err > 0) { - nvme_show_status(err); - goto free_buffer; - } else if (err < 0) { - nvme_show_error("identify namespace: %s", nvme_strerror(errno)); - goto free_buffer; - } + buffer = nvme_alloc_huge(buffer_size, &mh); + if (!buffer) + return -ENOMEM; - nvme_id_ns_flbas_to_lbaf_inuse(ns.flbas, &lba_index); - ms = ns.lbaf[lba_index].ms; + nvm_ns = nvme_alloc(sizeof(*nvm_ns)); + if (!nvm_ns) + return -ENOMEM; - err = nvme_identify_ns_csi(dev_fd(dev), 1, 0, NVME_CSI_NVM, &nvm_ns); + if (cfg.metadata_size) { + err = nvme_identify_ns_csi(dev_fd(dev), 1, 0, NVME_CSI_NVM, nvm_ns); if (!err) { - sts = nvm_ns.elbaf[lba_index] & NVME_NVM_ELBAF_STS_MASK; - pif = (nvm_ns.elbaf[lba_index] & NVME_NVM_ELBAF_PIF_MASK) >> 7; + sts = nvm_ns->elbaf[lba_index] & NVME_NVM_ELBAF_STS_MASK; + pif = (nvm_ns->elbaf[lba_index] & NVME_NVM_ELBAF_PIF_MASK) >> 7; } mbuffer_size = ((unsigned long long)cfg.block_count + 1) * ms; @@ -7589,24 +7280,20 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char mbuffer_size = cfg.metadata_size; mbuffer = malloc(mbuffer_size); - if (!mbuffer) { - err = -ENOMEM; - goto free_buffer; - } + if (!mbuffer) + return -ENOMEM; memset(mbuffer, 0, mbuffer_size); } - if (invalid_tags(cfg.storage_tag, cfg.ref_tag, sts, pif)) { - err = -EINVAL; - goto free_buffer; - } + if (invalid_tags(cfg.storage_tag, cfg.ref_tag, sts, pif)) + return -EINVAL; if (opcode & 1) { err = read(dfd, (void *)buffer, cfg.data_size); if (err < 0) { err = -errno; nvme_show_error("failed to read data buffer from input file %s", strerror(errno)); - goto free_mbuffer; + return err; } } @@ -7615,7 +7302,7 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char if (err < 0) { err = -errno; nvme_show_error("failed to read meta-data buffer from input file %s", strerror(errno)); - goto free_mbuffer; + return err; } } @@ -7638,7 +7325,7 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char printf("sts : %02x\n", sts); } if (cfg.dry_run) - goto free_mbuffer; + return 0; struct nvme_io_args args = { .args_size = sizeof(args), @@ -7683,22 +7370,10 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char strerror(errno)); err = -EINVAL; } else { - printf("%s: Success\n", command); + fprintf(stderr, "%s: Success\n", command); } } -free_mbuffer: - free(mbuffer); -free_buffer: - nvme_free(buffer, huge); -close_mfd: - if (strlen(cfg.metadata)) - close(mfd); -close_dfd: - close(dfd); -close_dev: - dev_close(dev); -ret: return err; } @@ -7731,9 +7406,9 @@ static int verify_cmd(int argc, char **argv, struct command *cmd, struct plugin { __u16 control = 0; __u8 lba_index, sts = 0, pif = 0; - struct nvme_id_ns ns; - struct nvme_nvm_id_ns nvm_ns; - struct nvme_dev *dev; + _cleanup_free_ struct nvme_nvm_id_ns *nvm_ns = NULL; + _cleanup_free_ struct nvme_id_ns *ns = NULL; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err; const char *desc = "Verify specified logical blocks on the given device."; @@ -7770,29 +7445,25 @@ static int verify_cmd(int argc, char **argv, struct command *cmd, struct plugin .storage_tag_check = false, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), - OPT_SUFFIX("start-block", 's', &cfg.start_block, start_block), - OPT_SHRT("block-count", 'c', &cfg.block_count, block_count), - OPT_FLAG("limited-retry", 'l', &cfg.limited_retry, limited_retry), - OPT_FLAG("force-unit-access", 'f', &cfg.force_unit_access, force_unit_access_verify), - OPT_BYTE("prinfo", 'p', &cfg.prinfo, prinfo), - OPT_SUFFIX("ref-tag", 'r', &cfg.ref_tag, ref_tag), - OPT_SHRT("app-tag", 'a', &cfg.app_tag, app_tag), - OPT_SHRT("app-tag-mask", 'm', &cfg.app_tag_mask, app_tag_mask), - OPT_SUFFIX("storage-tag", 'S', &cfg.storage_tag, storage_tag), - OPT_FLAG("storage-tag-check", 'C', &cfg.storage_tag_check, storage_tag_check), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), + OPT_SUFFIX("start-block", 's', &cfg.start_block, start_block), + OPT_SHRT("block-count", 'c', &cfg.block_count, block_count), + OPT_FLAG("limited-retry", 'l', &cfg.limited_retry, limited_retry), + OPT_FLAG("force-unit-access", 'f', &cfg.force_unit_access, force_unit_access_verify), + OPT_BYTE("prinfo", 'p', &cfg.prinfo, prinfo), + OPT_SUFFIX("ref-tag", 'r', &cfg.ref_tag, ref_tag), + OPT_SHRT("app-tag", 'a', &cfg.app_tag, app_tag), + OPT_SHRT("app-tag-mask", 'm', &cfg.app_tag_mask, app_tag_mask), + OPT_SUFFIX("storage-tag", 'S', &cfg.storage_tag, storage_tag), + OPT_FLAG("storage-tag-check", 'C', &cfg.storage_tag_check, storage_tag_check)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - if (cfg.prinfo > 0xf) { - err = EINVAL; - goto close_dev; - } + if (cfg.prinfo > 0xf) + return -EINVAL; control |= (cfg.prinfo << 10); if (cfg.limited_retry) @@ -7806,31 +7477,37 @@ static int verify_cmd(int argc, char **argv, struct command *cmd, struct plugin err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { nvme_show_error("get-namespace-id: %s", nvme_strerror(errno)); - goto close_dev; + return err; } } - err = nvme_cli_identify_ns(dev, cfg.namespace_id, &ns); + ns = nvme_alloc(sizeof(*ns)); + if (!ns) + return -ENOMEM; + + err = nvme_cli_identify_ns(dev, cfg.namespace_id, ns); if (err < 0) { nvme_show_error("identify namespace: %s", nvme_strerror(errno)); - goto close_dev; + return err; } else if (err) { nvme_show_status(err); - goto close_dev; + return err; } + nvm_ns = nvme_alloc(sizeof(*nvm_ns)); + if (!nvm_ns) + return -ENOMEM; + err = nvme_identify_ns_csi(dev_fd(dev), cfg.namespace_id, 0, - NVME_CSI_NVM, &nvm_ns); + NVME_CSI_NVM, nvm_ns); if (!err) { - nvme_id_ns_flbas_to_lbaf_inuse(ns.flbas, &lba_index); - sts = nvm_ns.elbaf[lba_index] & NVME_NVM_ELBAF_STS_MASK; - pif = (nvm_ns.elbaf[lba_index] & NVME_NVM_ELBAF_PIF_MASK) >> 7; + nvme_id_ns_flbas_to_lbaf_inuse(ns->flbas, &lba_index); + sts = nvm_ns->elbaf[lba_index] & NVME_NVM_ELBAF_STS_MASK; + pif = (nvm_ns->elbaf[lba_index] & NVME_NVM_ELBAF_PIF_MASK) >> 7; } - if (invalid_tags(cfg.storage_tag, cfg.ref_tag, sts, pif)) { - err = -EINVAL; - goto close_dev; - } + if (invalid_tags(cfg.storage_tag, cfg.ref_tag, sts, pif)) + return -EINVAL; struct nvme_io_args args = { .args_size = sizeof(args), @@ -7856,9 +7533,6 @@ static int verify_cmd(int argc, char **argv, struct command *cmd, struct plugin else printf("NVME Verify Success\n"); -close_dev: - dev_close(dev); -ret: return err; } @@ -7872,8 +7546,9 @@ static int sec_recv(int argc, char **argv, struct command *cmd, struct plugin *p "the same security protocol."; const char *size = "size of buffer (prints to stdout on success)"; const char *al = "allocation length (cf. SPC-4)"; - struct nvme_dev *dev; - void *sec_buf = NULL; + + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ void *sec_buf = NULL; int err; struct config { @@ -7896,27 +7571,23 @@ static int sec_recv(int argc, char **argv, struct command *cmd, struct plugin *p .raw_binary = false, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), - OPT_UINT("size", 'x', &cfg.size, size), - OPT_BYTE("nssf", 'N', &cfg.nssf, nssf), - OPT_BYTE("secp", 'p', &cfg.secp, secp), - OPT_SHRT("spsp", 's', &cfg.spsp, spsp), - OPT_UINT("al", 't', &cfg.al, al), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_dump), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), + OPT_UINT("size", 'x', &cfg.size, size), + OPT_BYTE("nssf", 'N', &cfg.nssf, nssf), + OPT_BYTE("secp", 'p', &cfg.secp, secp), + OPT_SHRT("spsp", 's', &cfg.spsp, spsp), + OPT_UINT("al", 't', &cfg.al, al), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_dump)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (cfg.size) { - if (posix_memalign(&sec_buf, getpagesize(), cfg.size)) { - nvme_show_error("No memory for security size:%d", cfg.size); - err = -ENOMEM; - goto close_dev; - } + sec_buf = nvme_alloc(sizeof(*sec_buf)); + if (!sec_buf) + return -ENOMEM; } struct nvme_security_receive_args args = { @@ -7946,11 +7617,6 @@ static int sec_recv(int argc, char **argv, struct command *cmd, struct plugin *p d_raw((unsigned char *)sec_buf, cfg.size); } - free(sec_buf); - -close_dev: - dev_close(dev); -ret: return err; } @@ -7967,10 +7633,10 @@ static int get_lba_status(int argc, char **argv, struct command *cmd, const char *rl = "Range Length(RL) specifies the length of the range of contiguous LBAs beginning at SLBA"; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ void *buf = NULL; enum nvme_print_flags flags; unsigned long buf_len; - struct nvme_dev *dev; - void *buf; int err; struct config { @@ -7980,7 +7646,6 @@ static int get_lba_status(int argc, char **argv, struct command *cmd, __u8 atype; __u16 rl; __u32 timeout; - char *output_format; }; struct config cfg = { @@ -7990,42 +7655,35 @@ static int get_lba_status(int argc, char **argv, struct command *cmd, .atype = 0, .rl = 0, .timeout = 0, - .output_format = "normal", }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), - OPT_SUFFIX("start-lba", 's', &cfg.slba, slba), - OPT_UINT("max-dw", 'm', &cfg.mndw, mndw), - OPT_BYTE("action", 'a', &cfg.atype, atype), - OPT_SHRT("range-len", 'l', &cfg.rl, rl), - OPT_UINT("timeout", 't', &cfg.timeout, timeout), - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), + OPT_SUFFIX("start-lba", 's', &cfg.slba, slba), + OPT_UINT("max-dw", 'm', &cfg.mndw, mndw), + OPT_BYTE("action", 'a', &cfg.atype, atype), + OPT_SHRT("range-len", 'l', &cfg.rl, rl), + OPT_UINT("timeout", 't', &cfg.timeout, timeout)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto err; + return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); - goto close_dev; + return err; } if (!cfg.atype) { nvme_show_error("action type (--action) has to be given"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } buf_len = (cfg.mndw + 1) * 4; - buf = calloc(1, buf_len); - if (!buf) { - err = -ENOMEM; - goto close_dev; - } + buf = nvme_alloc(buf_len); + if (!buf) + return -ENOMEM; struct nvme_get_lba_status_args args = { .args_size = sizeof(args), @@ -8046,10 +7704,7 @@ static int get_lba_status(int argc, char **argv, struct command *cmd, nvme_show_status(err); else nvme_show_error("get lba status: %s", nvme_strerror(errno)); - free(buf); -close_dev: - dev_close(dev); -err: + return err; } @@ -8066,7 +7721,7 @@ static int capacity_mgmt(int argc, char **argv, struct command *cmd, struct plug const char *cap_upper = "Most significant 32 bits of the capacity in bytes of the Endurance Group or NVM Set to be created"; - struct nvme_dev *dev; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err = -1; __u32 result; @@ -8084,22 +7739,19 @@ static int capacity_mgmt(int argc, char **argv, struct command *cmd, struct plug .dw12 = 0, }; - OPT_ARGS(opts) = { - OPT_BYTE("operation", 'o', &cfg.operation, operation), - OPT_SHRT("element-id", 'i', &cfg.element_id, element_id), - OPT_UINT("cap-lower", 'l', &cfg.dw11, cap_lower), - OPT_UINT("cap-upper", 'u', &cfg.dw12, cap_upper), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_BYTE("operation", 'O', &cfg.operation, operation), + OPT_SHRT("element-id", 'i', &cfg.element_id, element_id), + OPT_UINT("cap-lower", 'l', &cfg.dw11, cap_lower), + OPT_UINT("cap-upper", 'u', &cfg.dw12, cap_upper)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (cfg.operation > 0xf) { nvme_show_error("invalid operation field: %u", cfg.operation); - err = -1; - goto close_dev; + return -1; } struct nvme_capacity_mgmt_args args = { @@ -8125,9 +7777,6 @@ static int capacity_mgmt(int argc, char **argv, struct command *cmd, struct plug nvme_show_error("capacity management: %s", nvme_strerror(errno)); } -close_dev: - dev_close(dev); -ret: return err; } @@ -8137,10 +7786,10 @@ static int dir_receive(int argc, char **argv, struct command *cmd, struct plugin const char *nsr = "namespace stream requested"; enum nvme_print_flags flags = NORMAL; - struct nvme_dev *dev; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_free_ void *buf = NULL; __u32 result; __u32 dw12 = 0; - void *buf = NULL; int err; struct config { @@ -8165,21 +7814,19 @@ static int dir_receive(int argc, char **argv, struct command *cmd, struct plugin .human_readable = false, }; - OPT_ARGS(opts) = { - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), - OPT_UINT("data-len", 'l', &cfg.data_len, buf_len), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_directive), - OPT_BYTE("dir-type", 'D', &cfg.dtype, dtype), - OPT_SHRT("dir-spec", 'S', &cfg.dspec, dspec_w_dtype), - OPT_BYTE("dir-oper", 'O', &cfg.doper, doper), - OPT_SHRT("req-resource", 'r', &cfg.nsr, nsr), - OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_directive), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_desired), + OPT_UINT("data-len", 'l', &cfg.data_len, buf_len), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_directive), + OPT_BYTE("dir-type", 'D', &cfg.dtype, dtype), + OPT_SHRT("dir-spec", 'S', &cfg.dspec, dspec_w_dtype), + OPT_BYTE("dir-oper", 'O', &cfg.doper, doper), + OPT_SHRT("req-resource", 'r', &cfg.nsr, nsr), + OPT_FLAG("human-readable", 'H', &cfg.human_readable, human_readable_directive)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; if (cfg.human_readable) flags |= VERBOSE; @@ -8195,8 +7842,7 @@ static int dir_receive(int argc, char **argv, struct command *cmd, struct plugin break; default: nvme_show_error("invalid directive operations for Identify Directives"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } break; case NVME_DIRECTIVE_DTYPE_STREAMS: @@ -8214,22 +7860,18 @@ static int dir_receive(int argc, char **argv, struct command *cmd, struct plugin break; default: nvme_show_error("invalid directive operations for Streams Directives"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } break; default: nvme_show_error("invalid directive type"); - err = -EINVAL; - goto close_dev; + return -EINVAL; } if (cfg.data_len) { - if (posix_memalign(&buf, getpagesize(), cfg.data_len)) { - err = -ENOMEM; - goto close_dev; - } - memset(buf, 0, cfg.data_len); + buf = nvme_alloc(cfg.data_len); + if (!buf) + return -ENOMEM; } struct nvme_directive_recv_args args = { @@ -8254,10 +7896,6 @@ static int dir_receive(int argc, char **argv, struct command *cmd, struct plugin else if (err < 0) nvme_show_error("dir-receive: %s", nvme_strerror(errno)); - free(buf); -close_dev: - dev_close(dev); -ret: return err; } @@ -8289,7 +7927,7 @@ static int lockdown_cmd(int argc, char **argv, struct command *cmd, struct plugi "List that is used by the command.If this field is cleared to 0h,\n" "then no UUID index is specified"; - struct nvme_dev *dev; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; int err = -1; struct config { @@ -8308,39 +7946,33 @@ static int lockdown_cmd(int argc, char **argv, struct command *cmd, struct plugi .uuid = 0, }; - OPT_ARGS(opts) = { - OPT_BYTE("ofi", 'o', &cfg.ofi, ofi_desc), - OPT_BYTE("ifc", 'f', &cfg.ifc, ifc_desc), - OPT_BYTE("prhbt", 'p', &cfg.prhbt, prhbt_desc), - OPT_BYTE("scp", 's', &cfg.scp, scp_desc), - OPT_BYTE("uuid", 'U', &cfg.uuid, uuid_desc), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_BYTE("ofi", 'O', &cfg.ofi, ofi_desc), + OPT_BYTE("ifc", 'f', &cfg.ifc, ifc_desc), + OPT_BYTE("prhbt", 'p', &cfg.prhbt, prhbt_desc), + OPT_BYTE("scp", 's', &cfg.scp, scp_desc), + OPT_BYTE("uuid", 'U', &cfg.uuid, uuid_desc)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; /* check for input argument limit */ if (cfg.ifc > 3) { nvme_show_error("invalid interface settings:%d", cfg.ifc); - err = -1; - goto close_dev; + return -1; } if (cfg.prhbt > 1) { nvme_show_error("invalid prohibit settings:%d", cfg.prhbt); - err = -1; - goto close_dev; + return -1; } if (cfg.scp > 15) { nvme_show_error("invalid scope settings:%d", cfg.scp); - err = -1; - goto close_dev; + return -1; } if (cfg.uuid > 127) { nvme_show_error("invalid UUID index settings:%d", cfg.uuid); - err = -1; - goto close_dev; + return -1; } struct nvme_lockdown_args args = { @@ -8362,9 +7994,6 @@ static int lockdown_cmd(int argc, char **argv, struct command *cmd, struct plugi else printf("Lockdown Command is Successful\n"); -close_dev: - dev_close(dev); -ret: return err; } @@ -8416,13 +8045,15 @@ static int passthru(int argc, char **argv, bool admin, const char *wr = "set dataflow direction to send"; const char *prefill = "prefill buffers with known byte-value, default 0"; + _cleanup_huge_ struct nvme_mem_huge mh = { 0, }; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + _cleanup_file_ int dfd = -1, mfd = -1; int flags; int mode = 0644; - void *data = NULL, *mdata = NULL; - int err = 0, dfd, mfd; - struct nvme_dev *dev; + void *data = NULL; + _cleanup_free_ void *mdata = NULL; + int err = 0; __u32 result; - bool huge = false; const char *cmd_name = NULL; struct timeval start_time, end_time; @@ -8453,50 +8084,44 @@ static int passthru(int argc, char **argv, bool admin, .latency = false, }; - OPT_ARGS(opts) = { - OPT_BYTE("opcode", 'o', &cfg.opcode, opcode), - OPT_BYTE("flags", 'f', &cfg.flags, cflags), - OPT_BYTE("prefill", 'p', &cfg.prefill, prefill), - OPT_SHRT("rsvd", 'R', &cfg.rsvd, rsvd), - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), - OPT_UINT("data-len", 'l', &cfg.data_len, data_len), - OPT_UINT("metadata-len", 'm', &cfg.metadata_len, metadata_len), - OPT_UINT("timeout", 't', &cfg.timeout, timeout), - OPT_UINT("cdw2", '2', &cfg.cdw2, cdw2), - OPT_UINT("cdw3", '3', &cfg.cdw3, cdw3), - OPT_UINT("cdw10", '4', &cfg.cdw10, cdw10), - OPT_UINT("cdw11", '5', &cfg.cdw11, cdw11), - OPT_UINT("cdw12", '6', &cfg.cdw12, cdw12), - OPT_UINT("cdw13", '7', &cfg.cdw13, cdw13), - OPT_UINT("cdw14", '8', &cfg.cdw14, cdw14), - OPT_UINT("cdw15", '9', &cfg.cdw15, cdw15), - OPT_FILE("input-file", 'i', &cfg.input_file, input), - OPT_FILE("metadata", 'M', &cfg.metadata, metadata), - OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_dump), - OPT_FLAG("show-command", 's', &cfg.show_command, show), - OPT_FLAG("dry-run", 'd', &cfg.dry_run, dry), - OPT_FLAG("read", 'r', &cfg.read, re), - OPT_FLAG("write", 'w', &cfg.write, wr), - OPT_FLAG("latency", 'T', &cfg.latency, latency), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_BYTE("opcode", 'O', &cfg.opcode, opcode), + OPT_BYTE("flags", 'f', &cfg.flags, cflags), + OPT_BYTE("prefill", 'p', &cfg.prefill, prefill), + OPT_SHRT("rsvd", 'R', &cfg.rsvd, rsvd), + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), + OPT_UINT("data-len", 'l', &cfg.data_len, data_len), + OPT_UINT("metadata-len", 'm', &cfg.metadata_len, metadata_len), + OPT_UINT("timeout", 't', &cfg.timeout, timeout), + OPT_UINT("cdw2", '2', &cfg.cdw2, cdw2), + OPT_UINT("cdw3", '3', &cfg.cdw3, cdw3), + OPT_UINT("cdw10", '4', &cfg.cdw10, cdw10), + OPT_UINT("cdw11", '5', &cfg.cdw11, cdw11), + OPT_UINT("cdw12", '6', &cfg.cdw12, cdw12), + OPT_UINT("cdw13", '7', &cfg.cdw13, cdw13), + OPT_UINT("cdw14", '8', &cfg.cdw14, cdw14), + OPT_UINT("cdw15", '9', &cfg.cdw15, cdw15), + OPT_FILE("input-file", 'i', &cfg.input_file, input), + OPT_FILE("metadata", 'M', &cfg.metadata, metadata), + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw_dump), + OPT_FLAG("show-command", 's', &cfg.show_command, show), + OPT_FLAG("dry-run", 'd', &cfg.dry_run, dry), + OPT_FLAG("read", 'r', &cfg.read, re), + OPT_FLAG("write", 'w', &cfg.write, wr), + OPT_FLAG("latency", 'T', &cfg.latency, latency)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; - if (cfg.opcode & 0x01) + if (cfg.opcode & 0x01) { cfg.write = true; - - if (cfg.opcode & 0x02) - cfg.read = true; - - if (cfg.write) { flags = O_RDONLY; dfd = mfd = STDIN_FILENO; } - if (cfg.read) { + if (cfg.opcode & 0x02) { + cfg.read = true; flags = O_WRONLY | O_CREAT; dfd = mfd = STDOUT_FILENO; } @@ -8505,8 +8130,7 @@ static int passthru(int argc, char **argv, bool admin, dfd = open(cfg.input_file, flags, mode); if (dfd < 0) { nvme_show_perror(cfg.input_file); - err = -EINVAL; - goto close_dev; + return -EINVAL; } } @@ -8514,23 +8138,20 @@ static int passthru(int argc, char **argv, bool admin, mfd = open(cfg.metadata, flags, mode); if (mfd < 0) { nvme_show_perror(cfg.metadata); - err = -EINVAL; - goto close_dfd; + return -EINVAL; } } if (cfg.metadata_len) { mdata = malloc(cfg.metadata_len); - if (!mdata) { - err = -ENOMEM; - goto close_mfd; - } + if (!mdata) + return -ENOMEM; if (cfg.write) { if (read(mfd, mdata, cfg.metadata_len) < 0) { err = -errno; nvme_show_perror("failed to read metadata write buffer"); - goto free_metadata; + return err; } } else { memset(mdata, cfg.prefill, cfg.metadata_len); @@ -8538,22 +8159,19 @@ static int passthru(int argc, char **argv, bool admin, } if (cfg.data_len) { - data = nvme_alloc(cfg.data_len, &huge); - if (!data) { - err = -ENOMEM; - goto free_metadata; - } + data = nvme_alloc_huge(cfg.data_len, &mh); + if (!data) + return -ENOMEM; memset(data, cfg.prefill, cfg.data_len); if (!cfg.read && !cfg.write) { nvme_show_error("data direction not given"); - err = -EINVAL; - goto free_data; + return -EINVAL; } else if (cfg.write) { if (read(dfd, data, cfg.data_len) < 0) { err = -errno; nvme_show_error("failed to read write buffer %s", strerror(errno)); - goto free_data; + return err; } } } @@ -8578,7 +8196,7 @@ static int passthru(int argc, char **argv, bool admin, printf("timeout_ms : %08x\n", cfg.timeout); } if (cfg.dry_run) - goto free_data; + return 0; gettimeofday(&start_time, NULL); @@ -8615,24 +8233,12 @@ static int passthru(int argc, char **argv, bool admin, } else if (err) { nvme_show_status(err); } else { - printf("%s Command %s is Success and result: 0x%08x\n", admin ? "Admin" : "IO", - strcmp(cmd_name, "Unknown") ? cmd_name : "Vendor Specific", result); + fprintf(stderr, "%s Command %s is Success and result: 0x%08x\n", admin ? "Admin" : "IO", + strcmp(cmd_name, "Unknown") ? cmd_name : "Vendor Specific", result); if (cfg.read) passthru_print_read_output(cfg, data, dfd, mdata, mfd, err); } -free_metadata: - free(mdata); -free_data: - nvme_free(data, huge); -close_dfd: - if (strlen(cfg.input_file)) - close(dfd); -close_mfd: - if (cfg.metadata && strlen(cfg.metadata)) - close(mfd); -close_dev: - dev_close(dev); -ret: + return err; } @@ -8718,13 +8324,11 @@ static int gen_dhchap_key(int argc, char **argv, struct command *command, struct .hmac = 0, }; - OPT_ARGS(opts) = { - OPT_STR("secret", 's', &cfg.secret, secret), - OPT_UINT("key-length", 'l', &cfg.key_len, key_len), - OPT_STR("nqn", 'n', &cfg.nqn, nqn), - OPT_UINT("hmac", 'm', &cfg.hmac, hmac), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_STR("secret", 's', &cfg.secret, secret), + OPT_UINT("key-length", 'l', &cfg.key_len, key_len), + OPT_STR("nqn", 'n', &cfg.nqn, nqn), + OPT_UINT("hmac", 'm', &cfg.hmac, hmac)); err = argconfig_parse(argc, argv, desc, opts); if (err) @@ -8837,10 +8441,8 @@ static int check_dhchap_key(int argc, char **argv, struct command *command, stru .key = NULL, }; - OPT_ARGS(opts) = { - OPT_STR("key", 'k', &cfg.key, key), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_STR("key", 'k', &cfg.key, key)); err = argconfig_parse(argc, argv, desc, opts); if (err) @@ -8915,6 +8517,7 @@ static int gen_tls_key(int argc, char **argv, struct command *command, struct pl const char *secret = "Optional secret (in hexadecimal characters) to be used for the TLS key."; const char *hmac = "HMAC function to use for the retained key (1 = SHA-256, 2 = SHA-384)."; + const char *identity = "TLS identity version to use (0 = NVMe TCP 1.0c, 1 = NVMe TCP 2.0"; const char *hostnqn = "Host NQN for the retained key."; const char *subsysnqn = "Subsystem NQN for the retained key."; const char *keyring = "Keyring for the retained key."; @@ -8935,6 +8538,7 @@ static int gen_tls_key(int argc, char **argv, struct command *command, struct pl char *subsysnqn; char *secret; unsigned int hmac; + unsigned int identity; bool insert; }; @@ -8945,31 +8549,45 @@ static int gen_tls_key(int argc, char **argv, struct command *command, struct pl .subsysnqn = NULL, .secret = NULL, .hmac = 1, + .identity = 0, .insert = false, }; - OPT_ARGS(opts) = { - OPT_STR("keyring", 'k', &cfg.keyring, keyring), - OPT_STR("keytype", 't', &cfg.keytype, keytype), - OPT_STR("hostnqn", 'n', &cfg.hostnqn, hostnqn), - OPT_STR("subsysnqn", 'c', &cfg.subsysnqn, subsysnqn), - OPT_STR("secret", 's', &cfg.secret, secret), - OPT_UINT("hmac", 'm', &cfg.hmac, hmac), - OPT_FLAG("insert", 'i', &cfg.insert, insert), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_STR("keyring", 'k', &cfg.keyring, keyring), + OPT_STR("keytype", 't', &cfg.keytype, keytype), + OPT_STR("hostnqn", 'n', &cfg.hostnqn, hostnqn), + OPT_STR("subsysnqn", 'c', &cfg.subsysnqn, subsysnqn), + OPT_STR("secret", 's', &cfg.secret, secret), + OPT_UINT("hmac", 'm', &cfg.hmac, hmac), + OPT_UINT("identity", 'I', &cfg.identity, identity), + OPT_FLAG("insert", 'i', &cfg.insert, insert)); err = argconfig_parse(argc, argv, desc, opts); if (err) return err; - if (cfg.hmac < 1 || cfg.hmac > 3) { + if (cfg.hmac < 1 || cfg.hmac > 2) { nvme_show_error("Invalid HMAC identifier %u", cfg.hmac); return -EINVAL; } - if (cfg.insert && !cfg.subsysnqn) { - nvme_show_error("No subsystem NQN specified"); + if (cfg.identity > 1) { + nvme_show_error("Invalid TLS identity version %u", + cfg.identity); return -EINVAL; } + if (cfg.insert) { + if (!cfg.subsysnqn) { + nvme_show_error("No subsystem NQN specified"); + return -EINVAL; + } + if (!cfg.hostnqn) { + cfg.hostnqn = nvmf_hostnqn_from_file(); + if (!cfg.hostnqn) { + nvme_show_error("Failed to read host NQN"); + return -EINVAL; + } + } + } if (cfg.hmac == 2) key_len = 48; @@ -8988,7 +8606,7 @@ static int gen_tls_key(int argc, char **argv, struct command *command, struct pl nvme_show_error("Invalid secret '%s'", cfg.secret); return -EINVAL; } - if (i >= key_len) { + if (i >= key_len * 2) { fprintf(stderr, "Skipping excess secret bytes\n"); break; } @@ -9000,30 +8618,18 @@ static int gen_tls_key(int argc, char **argv, struct command *command, struct pl } } - if (cfg.hostnqn && !cfg.subsysnqn) { - nvme_show_error("Need to specify subsystem NQN to insert a TLS key"); - return -EINVAL; - } - if (cfg.subsysnqn) { - if (!cfg.hostnqn) { - cfg.hostnqn = nvmf_hostnqn_from_file(); - if (!cfg.hostnqn) { - nvme_show_error("Failed to read host NQN"); - return -EINVAL; - } - } - - tls_key = nvme_insert_tls_key(cfg.keyring, cfg.keytype, cfg.hostnqn, cfg.subsysnqn, - cfg.hmac, raw_secret, key_len); + if (cfg.insert) { + tls_key = nvme_insert_tls_key_versioned(cfg.keyring, + cfg.keytype, cfg.hostnqn, + cfg.subsysnqn, cfg.identity, + cfg.hmac, raw_secret, key_len); if (tls_key < 0) { nvme_show_error("Failed to insert key, error %d", errno); return -errno; } - if (cfg.insert) { - printf("Inserted TLS key %08x\n", (unsigned int)tls_key); - return 0; - } + printf("Inserted TLS key %08x\n", (unsigned int)tls_key); + return 0; } crc = crc32(crc, raw_secret, key_len); raw_secret[key_len++] = crc & 0xff; @@ -9042,10 +8648,12 @@ static int check_tls_key(int argc, char **argv, struct command *command, struct { const char *desc = "Check a TLS key for NVMe PSK Interchange format.\n"; const char *keydata = "TLS key (in PSK Interchange format) to be validated."; + const char *identity = "TLS identity version to use (0 = NVMe TCP 1.0c, 1 = NVMe TCP 2.0)"; const char *hostnqn = "Host NQN for the retained key."; const char *subsysnqn = "Subsystem NQN for the retained key."; const char *keyring = "Keyring for the retained key."; const char *keytype = "Key type of the retained key."; + const char *insert = "Insert retained key into the keyring."; unsigned char decoded_key[128]; unsigned int decoded_len; @@ -9054,11 +8662,13 @@ static int check_tls_key(int argc, char **argv, struct command *command, struct int err = 0, hmac; long tls_key; struct config { - char *keyring; - char *keytype; - char *hostnqn; - char *subsysnqn; - char *keydata; + char *keyring; + char *keytype; + char *hostnqn; + char *subsysnqn; + char *keydata; + unsigned int identity; + bool insert; }; struct config cfg = { @@ -9067,16 +8677,18 @@ static int check_tls_key(int argc, char **argv, struct command *command, struct .hostnqn = NULL, .subsysnqn = NULL, .keydata = NULL, + .identity = 0, + .insert = false, }; - OPT_ARGS(opts) = { - OPT_STR("keyring", 'k', &cfg.keyring, keyring), - OPT_STR("keytype", 't', &cfg.keytype, keytype), - OPT_STR("hostnqn", 'n', &cfg.hostnqn, hostnqn), - OPT_STR("subsysnqn", 'c', &cfg.subsysnqn, subsysnqn), - OPT_STR("keydata", 'd', &cfg.keydata, keydata), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_STR("keyring", 'k', &cfg.keyring, keyring), + OPT_STR("keytype", 't', &cfg.keytype, keytype), + OPT_STR("hostnqn", 'n', &cfg.hostnqn, hostnqn), + OPT_STR("subsysnqn", 'c', &cfg.subsysnqn, subsysnqn), + OPT_STR("keydata", 'd', &cfg.keydata, keydata), + OPT_UINT("identity", 'I', &cfg.identity, identity), + OPT_FLAG("insert", 'i', &cfg.insert, insert)); err = argconfig_parse(argc, argv, desc, opts); if (err) @@ -9086,6 +8698,11 @@ static int check_tls_key(int argc, char **argv, struct command *command, struct nvme_show_error("No key data"); return -EINVAL; } + if (cfg.identity > 1) { + nvme_show_error("Invalid TLS identity version %u", + cfg.identity); + return -EINVAL; + } if (sscanf(cfg.keydata, "NVMeTLSkey-1:%02x:*s", &hmac) != 1) { nvme_show_error("Invalid key '%s'", cfg.keydata); @@ -9109,6 +8726,18 @@ static int check_tls_key(int argc, char **argv, struct command *command, struct return -EINVAL; } + if (cfg.subsysnqn) { + if (cfg.insert && !cfg.hostnqn) { + cfg.hostnqn = nvmf_hostnqn_from_file(); + if (!cfg.hostnqn) { + nvme_show_error("Failed to read host NQN"); + return -EINVAL; + } + } + } else if (cfg.insert || cfg.identity == 1) { + nvme_show_error("Need to specify a subsystem NQN"); + return -EINVAL; + } err = base64_decode(cfg.keydata + 16, strlen(cfg.keydata) - 17, decoded_key); if (err < 0) { nvme_show_error("Base64 decoding failed (%s, error %d)", cfg.keydata + 16, err); @@ -9129,23 +8758,28 @@ static int check_tls_key(int argc, char **argv, struct command *command, struct nvme_show_error("CRC mismatch (key %08x, crc %08x)", key_crc, crc); return -EINVAL; } - if (cfg.subsysnqn) { - if (!cfg.hostnqn) { - cfg.hostnqn = nvmf_hostnqn_from_file(); - if (!cfg.hostnqn) { - nvme_show_error("Failed to read host NQN"); - return -EINVAL; - } - } - - tls_key = nvme_insert_tls_key(cfg.keyring, cfg.keytype, cfg.hostnqn, cfg.subsysnqn, - hmac, decoded_key, decoded_len); + if (cfg.insert) { + tls_key = nvme_insert_tls_key_versioned(cfg.keyring, + cfg.keytype, cfg.hostnqn, + cfg.subsysnqn, cfg.identity, + hmac, decoded_key, decoded_len); if (tls_key < 0) { nvme_show_error("Failed to insert key, error %d", errno); return -errno; } } else { - printf("Key is valid (HMAC %d, length %d, CRC %08x)\n", hmac, decoded_len, crc); + char *tls_id; + + tls_id = nvme_generate_tls_key_identity(cfg.hostnqn, + cfg.subsysnqn, cfg.identity, + hmac, decoded_key, decoded_len); + if (!tls_id) { + nvme_show_error("Failed to generated identity, error %d", + errno); + return -errno; + } + printf("%s\n", tls_id); + free(tls_id); } return 0; } @@ -9160,35 +8794,27 @@ static int show_topology_cmd(int argc, char **argv, struct command *command, str int err; struct config { - char *output_format; - int verbose; char *ranking; }; struct config cfg = { - .output_format = "normal", - .verbose = 0, .ranking = "namespace", }; - OPT_ARGS(opts) = { - OPT_FMT("output-format", 'o', &cfg.output_format, output_format), - OPT_INCR("verbose", 'v', &cfg.verbose, verbose), - OPT_FMT("ranking", 'r', &cfg.ranking, ranking), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_FMT("ranking", 'r', &cfg.ranking, ranking)); err = argconfig_parse(argc, argv, desc, opts); if (err) return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(output_format_val, &flags); if (err < 0) { nvme_show_error("Invalid output format"); return err; } - if (cfg.verbose) + if (argconfig_parse_seen(opts, "verbose")) flags |= VERBOSE; if (!strcmp(cfg.ranking, "namespace")) { @@ -9200,7 +8826,7 @@ static int show_topology_cmd(int argc, char **argv, struct command *command, str return -EINVAL; } - r = nvme_create_root(stderr, map_log_level(cfg.verbose, false)); + r = nvme_create_root(stderr, map_log_level(!!(flags & VERBOSE), false)); if (!r) { nvme_show_error("Failed to create topology root: %s", nvme_strerror(errno)); return -errno; @@ -9282,12 +8908,12 @@ static int nvme_mi(int argc, char **argv, __u8 admin_opcode, const char *desc) int mode = 0644; void *data = NULL; int err = 0; - bool send = admin_opcode == nvme_admin_nvme_mi_send ? true : false; - int fd = send ? STDIN_FILENO : STDOUT_FILENO; - int flags = send ? O_RDONLY : O_WRONLY | O_CREAT; - struct nvme_dev *dev; + bool send; + _cleanup_file_ int fd = -1; + int flags; + _cleanup_huge_ struct nvme_mem_huge mh = { 0, }; + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; __u32 result; - bool huge = false; struct config { __u8 opcode; @@ -9309,41 +8935,47 @@ static int nvme_mi(int argc, char **argv, __u8 admin_opcode, const char *desc) .input_file = "", }; - OPT_ARGS(opts) = { - OPT_BYTE("opcode", 'o', &cfg.opcode, opcode), - OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), - OPT_UINT("data-len", 'l', &cfg.data_len, data_len), - OPT_UINT("nmimt", 'm', &cfg.nmimt, nmimt), - OPT_UINT("nmd0", '0', &cfg.nmd0, nmd0), - OPT_UINT("nmd1", '1', &cfg.nmd1, nmd1), - OPT_FILE("input-file", 'i', &cfg.input_file, input), - OPT_END() - }; + NVME_ARGS(opts, cfg, + OPT_BYTE("opcode", 'O', &cfg.opcode, opcode), + OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_desired), + OPT_UINT("data-len", 'l', &cfg.data_len, data_len), + OPT_UINT("nmimt", 'm', &cfg.nmimt, nmimt), + OPT_UINT("nmd0", '0', &cfg.nmd0, nmd0), + OPT_UINT("nmd1", '1', &cfg.nmd1, nmd1), + OPT_FILE("input-file", 'i', &cfg.input_file, input)); err = parse_and_open(&dev, argc, argv, desc, opts); if (err) - goto ret; + return err; + + if (admin_opcode == nvme_admin_nvme_mi_send) { + flags = O_RDONLY; + fd = STDIN_FILENO; + send = true; + } else { + flags = O_WRONLY | O_CREAT; + fd = STDOUT_FILENO; + send = false; + } if (strlen(cfg.input_file)) { fd = open(cfg.input_file, flags, mode); if (fd < 0) { nvme_show_perror(cfg.input_file); - err = -EINVAL; - goto close_dev; + return -EINVAL; } } if (cfg.data_len) { - data = nvme_alloc(cfg.data_len, &huge); - if (!data) { - err = -ENOMEM; - goto close_fd; - } + data = nvme_alloc_huge(cfg.data_len, &mh); + if (!data) + return -ENOMEM; + if (send) { if (read(fd, data, cfg.data_len) < 0) { err = -errno; nvme_show_error("failed to read write buffer %s", strerror(errno)); - goto free_data; + return err; } } } @@ -9369,14 +9001,6 @@ static int nvme_mi(int argc, char **argv, __u8 admin_opcode, const char *desc) } } -free_data: - nvme_free(data, huge); -close_fd: - if (strlen(cfg.input_file)) - close(fd); -close_dev: - dev_close(dev); -ret: return err; } @@ -28,7 +28,9 @@ #include "plugin.h" #include "util/json.h" +#include "util/mem.h" #include "util/argconfig.h" +#include "util/cleanup.h" enum nvme_print_flags { NORMAL = 0, @@ -100,15 +102,19 @@ int parse_and_open(struct nvme_dev **dev, int argc, char **argv, const char *des void dev_close(struct nvme_dev *dev); +static inline DEFINE_CLEANUP_FUNC( + cleanup_nvme_dev, struct nvme_dev *, dev_close) +#define _cleanup_nvme_dev_ __cleanup__(cleanup_nvme_dev) + extern const char *output_format; -enum nvme_print_flags validate_output_format(const char *format); +int validate_output_format(const char *format, enum nvme_print_flags *flags); +bool nvme_is_output_format_json(void); int __id_ctrl(int argc, char **argv, struct command *cmd, struct plugin *plugin, void (*vs)(uint8_t *vs, struct json_object *root)); extern int current_index; -void *nvme_alloc(size_t len, bool *huge); -void nvme_free(void *p, bool huge); + const char *nvme_strerror(int errnum); unsigned long long elapsed_utime(struct timeval start_time, diff --git a/nvme.spec.in b/nvme.spec.in index fe4675a..3eab9ff 100644 --- a/nvme.spec.in +++ b/nvme.spec.in @@ -31,7 +31,7 @@ touch %{buildroot}@SYSCONFDIR@/nvme/hostid @SYSCONFDIR@/nvme/discovery.conf %ghost @SYSCONFDIR@/nvme/config.json @UDEVRULESDIR@/70-nvmf-autoconnect.rules -@UDEVRULESDIR@/71-nvmf-iopolicy-netapp.rules +@UDEVRULESDIR@/71-nvmf-netapp.rules @DRACUTRILESDIR@/70-nvmf-autoconnect.conf @SYSTEMDDIR@/nvmf-connect@.service @SYSTEMDDIR@/nvmefc-boot-connections.service diff --git a/nvmf-autoconnect/systemd/nvmf-autoconnect.service.in b/nvmf-autoconnect/systemd/nvmf-autoconnect.service.in index 621879a..92960cd 100644 --- a/nvmf-autoconnect/systemd/nvmf-autoconnect.service.in +++ b/nvmf-autoconnect/systemd/nvmf-autoconnect.service.in @@ -2,12 +2,13 @@ Description=Connect NVMe-oF subsystems automatically during boot ConditionPathExists=|@SYSCONFDIR@/nvme/config.json ConditionPathExists=|@SYSCONFDIR@/nvme/discovery.conf +Wants=modprobe@nvme_fabrics.service +After=modprobe@nvme_fabrics.service After=network-online.target Before=remote-fs-pre.target [Service] Type=oneshot -ExecStartPre=/sbin/modprobe nvme-fabrics ExecStart=@SBINDIR@/nvme connect-all --context=autoconnect [Install] diff --git a/nvmf-autoconnect/systemd/nvmf-connect-nbft.service.in b/nvmf-autoconnect/systemd/nvmf-connect-nbft.service.in new file mode 100644 index 0000000..820e6ce --- /dev/null +++ b/nvmf-autoconnect/systemd/nvmf-connect-nbft.service.in @@ -0,0 +1,14 @@ +# This unit is meant to be started by network management software +# after a network interface defined in the NBFT gets set up +[Unit] +Description=Connect NBFT-defined NVMe-oF subsystems automatically +ConditionPathExists=|/sys/firmware/acpi/tables/NBFT +ConditionPathExists=|/sys/firmware/acpi/tables/NBFT1 +Wants=modprobe@nvme_fabrics.service +After=modprobe@nvme_fabrics.service +After=network-online.target +Before=remote-fs-pre.target + +[Service] +Type=oneshot +ExecStart=@SBINDIR@/nvme connect-all --nbft diff --git a/nvmf-autoconnect/udev-rules/65-persistent-net-nbft.rules.in b/nvmf-autoconnect/udev-rules/65-persistent-net-nbft.rules.in new file mode 100644 index 0000000..344942b --- /dev/null +++ b/nvmf-autoconnect/udev-rules/65-persistent-net-nbft.rules.in @@ -0,0 +1,2 @@ +# Avoid renaming nbft$X interfaces +SUBSYSTEM=="net", ACTION!="remove", ENV{INTERFACE}=="nbft*", NAME:="%E{INTERFACE}" diff --git a/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in b/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in deleted file mode 100644 index aefd9d4..0000000 --- a/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in +++ /dev/null @@ -1,3 +0,0 @@ -# Enable round-robin for NetApp ONTAP and NetApp E-Series -ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{model}=="NetApp ONTAP Controller", ATTR{iopolicy}="round-robin" -ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{model}=="NetApp E-Series", ATTR{iopolicy}="round-robin" diff --git a/nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in b/nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in new file mode 100644 index 0000000..99b6a8b --- /dev/null +++ b/nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in @@ -0,0 +1,6 @@ +# Enable round-robin for NetApp ONTAP and NetApp E-Series +ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{subsystype}=="nvm", ATTR{model}=="NetApp ONTAP Controller", ATTR{iopolicy}="round-robin" +ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{subsystype}=="nvm", ATTR{model}=="NetApp E-Series", ATTR{iopolicy}="round-robin" + +# Set ctrl_loss_tmo to -1 for NetApp ONTAP NVMe/TCP +ACTION!="remove", SUBSYSTEM=="nvme", KERNEL=="nvme*", ATTR{transport}=="tcp", ATTR{model}=="NetApp ONTAP Controller", ATTR{ctrl_loss_tmo}="-1" diff --git a/plugins/fdp/fdp.c b/plugins/fdp/fdp.c index 8539e18..2a221f8 100644 --- a/plugins/fdp/fdp.c +++ b/plugins/fdp/fdp.c @@ -56,7 +56,7 @@ static int fdp_configs(int argc, char **argv, struct command *cmd, if (err) return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(cfg.output_format, &flags); if (flags < 0) goto out; @@ -137,7 +137,7 @@ static int fdp_usage(int argc, char **argv, struct command *cmd, struct plugin * if (err) return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(cfg.output_format, &flags); if (flags < 0) goto out; @@ -208,7 +208,7 @@ static int fdp_stats(int argc, char **argv, struct command *cmd, struct plugin * if (err) return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(cfg.output_format, &flags); if (flags < 0) goto out; @@ -269,7 +269,7 @@ static int fdp_events(int argc, char **argv, struct command *cmd, struct plugin if (err) return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(cfg.output_format, &flags); if (flags < 0) goto out; @@ -328,7 +328,7 @@ static int fdp_status(int argc, char **argv, struct command *cmd, struct plugin if (err) return err; - err = flags = validate_output_format(cfg.output_format); + err = validate_output_format(cfg.output_format, &flags); if (flags < 0) goto out; diff --git a/plugins/huawei/huawei-nvme.c b/plugins/huawei/huawei-nvme.c index 82e190f..0272dea 100644 --- a/plugins/huawei/huawei-nvme.c +++ b/plugins/huawei/huawei-nvme.c @@ -296,7 +296,7 @@ static int huawei_list(int argc, char **argv, struct command *command, struct huawei_list_item *list_items; unsigned int i, n, ret; unsigned int huawei_num = 0; - int fmt; + enum nvme_print_flags fmt; const char *desc = "Retrieve basic information for the given huawei device"; struct config { char *output_format; @@ -315,9 +315,9 @@ static int huawei_list(int argc, char **argv, struct command *command, if (ret) return ret; - fmt = validate_output_format(cfg.output_format); - if (fmt != JSON && fmt != NORMAL) - return -EINVAL; + ret = validate_output_format(cfg.output_format, &fmt); + if (ret < 0 || (fmt != JSON && fmt != NORMAL)) + return ret; n = scandir("/dev", &devices, nvme_namespace_filter, alphasort); if (n <= 0) diff --git a/plugins/intel/intel-nvme.c b/plugins/intel/intel-nvme.c index e62c85d..378ecc0 100644 --- a/plugins/intel/intel-nvme.c +++ b/plugins/intel/intel-nvme.c @@ -1065,7 +1065,7 @@ static int get_lat_stats_log(int argc, char **argv, struct command *cmd, struct media_version[1] = (data[3] << 8) | data[2]; if (err) - goto close_fd; + goto close_dev; if (media_version[0] == 1000) { __u32 thresholds[OPTANE_V1000_BUCKET_LEN] = {0}; @@ -1086,9 +1086,9 @@ static int get_lat_stats_log(int argc, char **argv, struct command *cmd, struct }; err = nvme_get_features(&args); if (err) { - fprintf(stderr, "Quering thresholds failed. "); + fprintf(stderr, "Querying thresholds failed. "); nvme_show_status(err); - goto close_fd; + goto close_dev; } /* Update bucket thresholds to be printed */ @@ -1124,7 +1124,7 @@ static int get_lat_stats_log(int argc, char **argv, struct command *cmd, struct sizeof(stats)); } -close_fd: +close_dev: dev_close(dev); return err; } diff --git a/plugins/memblaze/memblaze-nvme.c b/plugins/memblaze/memblaze-nvme.c index c0a70ee..b215125 100644 --- a/plugins/memblaze/memblaze-nvme.c +++ b/plugins/memblaze/memblaze-nvme.c @@ -646,7 +646,7 @@ static int glp_high_latency_show_bar(FILE *fdi, int print) } /* - * High latency log page definiton + * High latency log page definition * Total 32 bytes */ struct log_page_high_latency { @@ -1197,3 +1197,646 @@ static int mb_set_lat_stats(int argc, char **argv, dev_close(dev); return err; } + +// Global definitions + +static inline int K2C(int k) // KELVINS_2_CELSIUS +{ + return (k - 273); +}; + +// Global ID definitions + +enum { + // feature ids + FID_LATENCY_FEATURE = 0xd0, + + // log ids + LID_SMART_LOG_ADD = 0xca, + LID_LATENCY_STATISTICS = 0xd0, + LID_HIGH_LATENCY_LOG = 0xd1, + LID_PERFORMANCE_STATISTICS = 0xd2, +}; + +// smart-log-add + +struct smart_log_add_item { + uint32_t index; + char *attr; +}; + +struct __packed wear_level { + __le16 min; + __le16 max; + __le16 avg; +}; + +struct __packed smart_log_add_item_12 { + uint8_t id; + uint8_t rsvd[2]; + uint8_t norm; + uint8_t rsvd1; + union { + struct wear_level wear_level; // 0xad + struct temp_since_born { // 0xe7 + __le16 max; + __le16 min; + __le16 curr; + } temp_since_born; + struct power_consumption { // 0xe8 + __le16 max; + __le16 min; + __le16 curr; + } power_consumption; + struct temp_since_power_on { // 0xaf + __le16 max; + __le16 min; + __le16 curr; + } temp_since_power_on; + uint8_t raw[6]; + }; + uint8_t rsvd2; +}; + +struct __packed smart_log_add_item_10 { + uint8_t id; + uint8_t norm; + union { + struct wear_level wear_level; // 0xad + uint8_t raw[6]; + }; + uint8_t rsvd[2]; +}; + +struct smart_log_add { + union { + union { + struct smart_log_add_v0 { + struct smart_log_add_item_12 program_fail_count; + struct smart_log_add_item_12 erase_fail_count; + struct smart_log_add_item_12 wear_leveling_count; + struct smart_log_add_item_12 end_to_end_error_count; + struct smart_log_add_item_12 crc_error_count; + struct smart_log_add_item_12 timed_workload_media_wear; + struct smart_log_add_item_12 timed_workload_host_reads; + struct smart_log_add_item_12 timed_workload_timer; + struct smart_log_add_item_12 thermal_throttle_status; + struct smart_log_add_item_12 retry_buffer_overflow_counter; + struct smart_log_add_item_12 pll_lock_loss_count; + struct smart_log_add_item_12 nand_bytes_written; + struct smart_log_add_item_12 host_bytes_written; + struct smart_log_add_item_12 system_area_life_remaining; + struct smart_log_add_item_12 nand_bytes_read; + struct smart_log_add_item_12 temperature; + struct smart_log_add_item_12 power_consumption; + struct smart_log_add_item_12 power_on_temperature; + struct smart_log_add_item_12 power_loss_protection; + struct smart_log_add_item_12 read_fail_count; + struct smart_log_add_item_12 thermal_throttle_time; + struct smart_log_add_item_12 flash_error_media_count; + } v0; + + struct smart_log_add_item_12 v0_raw[22]; + }; + + union { + struct smart_log_add_v2 { + struct smart_log_add_item_12 program_fail_count; + struct smart_log_add_item_12 erase_fail_count; + struct smart_log_add_item_12 wear_leveling_count; + struct smart_log_add_item_12 end_to_end_error_count; + struct smart_log_add_item_12 crc_error_count; + struct smart_log_add_item_12 timed_workload_media_wear; + struct smart_log_add_item_12 timed_workload_host_reads; + struct smart_log_add_item_12 timed_workload_timer; + struct smart_log_add_item_12 thermal_throttle_status; + struct smart_log_add_item_12 lifetime_write_amplification; + struct smart_log_add_item_12 pll_lock_loss_count; + struct smart_log_add_item_12 nand_bytes_written; + struct smart_log_add_item_12 host_bytes_written; + struct smart_log_add_item_12 system_area_life_remaining; + struct smart_log_add_item_12 firmware_update_count; + struct smart_log_add_item_12 dram_cecc_count; + struct smart_log_add_item_12 dram_uecc_count; + struct smart_log_add_item_12 xor_pass_count; + struct smart_log_add_item_12 xor_fail_count; + struct smart_log_add_item_12 xor_invoked_count; + struct smart_log_add_item_12 inflight_read_io_cmd; + struct smart_log_add_item_12 flash_error_media_count; + struct smart_log_add_item_12 nand_bytes_read; + struct smart_log_add_item_12 temp_since_born; + struct smart_log_add_item_12 power_consumption; + struct smart_log_add_item_12 temp_since_bootup; + struct smart_log_add_item_12 thermal_throttle_time; + } v2; + + struct smart_log_add_item_12 v2_raw[27]; + }; + + union { + struct smart_log_add_v3 { + struct smart_log_add_item_10 program_fail_count; + struct smart_log_add_item_10 erase_fail_count; + struct smart_log_add_item_10 wear_leveling_count; + struct smart_log_add_item_10 ext_e2e_err_count; + struct smart_log_add_item_10 crc_err_count; + struct smart_log_add_item_10 nand_bytes_written; + struct smart_log_add_item_10 host_bytes_written; + struct smart_log_add_item_10 reallocated_sector_count; + struct smart_log_add_item_10 uncorrectable_sector_count; + struct smart_log_add_item_10 nand_uecc_detection; + struct smart_log_add_item_10 nand_xor_correction; + struct smart_log_add_item_10 gc_count; + struct smart_log_add_item_10 dram_uecc_detection_count; + struct smart_log_add_item_10 sram_uecc_detection_count; + struct smart_log_add_item_10 internal_raid_recovery_fail_count; + struct smart_log_add_item_10 inflight_cmds; + struct smart_log_add_item_10 internal_e2e_err_count; + struct smart_log_add_item_10 die_fail_count; + struct smart_log_add_item_10 wear_leveling_execution_count; + struct smart_log_add_item_10 read_disturb_count; + struct smart_log_add_item_10 data_retention_count; + struct smart_log_add_item_10 capacitor_health; + } v3; + + struct smart_log_add_item_10 v3_raw[24]; + }; + + uint8_t raw[512]; + }; +}; + +static void smart_log_add_v0_print(struct smart_log_add_item_12 *item, int item_count) +{ + static const struct smart_log_add_item items[0xff] = { + [0xab] = {0, "program_fail_count" }, + [0xac] = {1, "erase_fail_count" }, + [0xad] = {2, "wear_leveling_count" }, + [0xb8] = {3, "end_to_end_error_count" }, + [0xc7] = {4, "crc_error_count" }, + [0xe2] = {5, "timed_workload_media_wear" }, + [0xe3] = {6, "timed_workload_host_reads" }, + [0xe4] = {7, "timed_workload_timer" }, + [0xea] = {8, "thermal_throttle_status" }, + [0xf0] = {9, "retry_buffer_overflow_counter"}, + [0xf3] = {10, "pll_lock_loss_count" }, + [0xf4] = {11, "nand_bytes_written" }, + [0xf5] = {12, "host_bytes_written" }, + [0xf6] = {13, "system_area_life_remaining" }, + [0xfa] = {14, "nand_bytes_read" }, + [0xe7] = {15, "temperature" }, + [0xe8] = {16, "power_consumption" }, + [0xaf] = {17, "power_on_temperature" }, + [0xec] = {18, "power_loss_protection" }, + [0xf2] = {19, "read_fail_count" }, + [0xeb] = {20, "thermal_throttle_time" }, + [0xed] = {21, "flash_error_media_count" }, + }; + + for (int i = 0; i < item_count; i++, item++) { + if (item->id == 0) + continue; + + printf("%#-12" PRIx8 "%-36s%-12d", item->id, items[item->id].attr, item->norm); + switch (item->id) { + case 0xad: + printf("min: %d, max: %d, avg: %d\n", + le16_to_cpu(item->wear_level.min), + le16_to_cpu(item->wear_level.max), + le16_to_cpu(item->wear_level.avg)); + break; + case 0xe7: + printf("max: %d °C (%d K), min: %d °C (%d K), curr: %d °C (%d K)\n", + K2C(le16_to_cpu(item->temp_since_born.max)), + le16_to_cpu(item->temp_since_born.max), + K2C(le16_to_cpu(item->temp_since_born.min)), + le16_to_cpu(item->temp_since_born.min), + K2C(le16_to_cpu(item->temp_since_born.curr)), + le16_to_cpu(item->temp_since_born.curr)); + break; + case 0xe8: + printf("max: %d, min: %d, curr: %d\n", + le16_to_cpu(item->power_consumption.max), + le16_to_cpu(item->power_consumption.min), + le16_to_cpu(item->power_consumption.curr)); + break; + case 0xaf: + printf("max: %d °C (%d K), min: %d °C (%d K), curr: %d °C (%d K)\n", + K2C(le16_to_cpu(item->temp_since_power_on.max)), + le16_to_cpu(item->temp_since_power_on.max), + K2C(le16_to_cpu(item->temp_since_power_on.min)), + le16_to_cpu(item->temp_since_power_on.min), + K2C(le16_to_cpu(item->temp_since_power_on.curr)), + le16_to_cpu(item->temp_since_power_on.curr)); + break; + default: + printf("%" PRIu64 "\n", int48_to_long(item->raw)); + break; + } + } +} + +static void smart_log_add_v2_print(struct smart_log_add_item_12 *item, int item_count) +{ + static const struct smart_log_add_item items[0xff] = { + [0xab] = {0, "program_fail_count" }, + [0xac] = {1, "erase_fail_count" }, + [0xad] = {2, "wear_leveling_count" }, + [0xb8] = {3, "end_to_end_error_count" }, + [0xc7] = {4, "crc_error_count" }, + [0xe2] = {5, "timed_workload_media_wear" }, + [0xe3] = {6, "timed_workload_host_reads" }, + [0xe4] = {7, "timed_workload_timer" }, + [0xea] = {8, "thermal_throttle_status" }, + [0xf0] = {9, "lifetime_write_amplification"}, + [0xf3] = {10, "pll_lock_loss_count" }, + [0xf4] = {11, "nand_bytes_written" }, + [0xf5] = {12, "host_bytes_written" }, + [0xf6] = {13, "system_area_life_remaining" }, + [0xf9] = {14, "firmware_update_count" }, + [0xfa] = {15, "dram_cecc_count" }, + [0xfb] = {16, "dram_uecc_count" }, + [0xfc] = {17, "xor_pass_count" }, + [0xfd] = {18, "xor_fail_count" }, + [0xfe] = {19, "xor_invoked_count" }, + [0xe5] = {20, "inflight_read_io_cmd" }, + [0xe6] = {21, "flash_error_media_count" }, + [0xf8] = {22, "nand_bytes_read" }, + [0xe7] = {23, "temp_since_born" }, + [0xe8] = {24, "power_consumption" }, + [0xaf] = {25, "temp_since_bootup" }, + [0xeb] = {26, "thermal_throttle_time" }, + }; + + for (int i = 0; i < item_count; i++, item++) { + if (item->id == 0) + continue; + + printf("%#-12" PRIx8 "%-36s%-12d", item->id, items[item->id].attr, item->norm); + switch (item->id) { + case 0xad: + printf("min: %d, max: %d, avg: %d\n", + le16_to_cpu(item->wear_level.min), + le16_to_cpu(item->wear_level.max), + le16_to_cpu(item->wear_level.avg)); + break; + case 0xe7: + printf("max: %d °C (%d K), min: %d °C (%d K), curr: %d °C (%d K)\n", + K2C(le16_to_cpu(item->temp_since_born.max)), + le16_to_cpu(item->temp_since_born.max), + K2C(le16_to_cpu(item->temp_since_born.min)), + le16_to_cpu(item->temp_since_born.min), + K2C(le16_to_cpu(item->temp_since_born.curr)), + le16_to_cpu(item->temp_since_born.curr)); + break; + case 0xe8: + printf("max: %d, min: %d, curr: %d\n", + le16_to_cpu(item->power_consumption.max), + le16_to_cpu(item->power_consumption.min), + le16_to_cpu(item->power_consumption.curr)); + break; + case 0xaf: + printf("max: %d °C (%d K), min: %d °C (%d K), curr: %d °C (%d K)\n", + K2C(le16_to_cpu(item->temp_since_power_on.max)), + le16_to_cpu(item->temp_since_power_on.max), + K2C(le16_to_cpu(item->temp_since_power_on.min)), + le16_to_cpu(item->temp_since_power_on.min), + K2C(le16_to_cpu(item->temp_since_power_on.curr)), + le16_to_cpu(item->temp_since_power_on.curr)); + break; + default: + printf("%" PRIu64 "\n", int48_to_long(item->raw)); + break; + } + } +} + +static void smart_log_add_v3_print(struct smart_log_add_item_10 *item, int item_count) +{ + static const struct smart_log_add_item items[0xff] = { + [0xab] = {0, "program_fail_count" }, + [0xac] = {1, "erase_fail_count" }, + [0xad] = {2, "wear_leveling_count" }, + [0xb8] = {3, "ext_e2e_err_count" }, + [0xc7] = {4, "crc_err_count" }, + [0xf4] = {5, "nand_bytes_written" }, + [0xf5] = {6, "host_bytes_written" }, + [0xd0] = {7, "reallocated_sector_count" }, + [0xd1] = {8, "uncorrectable_sector_count" }, + [0xd2] = {9, "nand_uecc_detection" }, + [0xd3] = {10, "nand_xor_correction" }, + [0xd4] = {12, "gc_count" }, // 11 is reserved + [0xd5] = {13, "dram_uecc_detection_count" }, + [0xd6] = {14, "sram_uecc_detection_count" }, + [0xd7] = {15, "internal_raid_recovery_fail_count"}, + [0xd8] = {16, "inflight_cmds" }, + [0xd9] = {17, "internal_e2e_err_count" }, + [0xda] = {19, "die_fail_count" }, // 18 is reserved + [0xdb] = {20, "wear_leveling_execution_count" }, + [0xdc] = {21, "read_disturb_count" }, + [0xdd] = {22, "data_retention_count" }, + [0xde] = {23, "capacitor_health" }, + }; + + for (int i = 0; i < item_count; i++, item++) { + if (item->id == 0) + continue; + + printf("%#-12" PRIx8 "%-36s%-12d", item->id, items[item->id].attr, item->norm); + switch (item->id) { + case 0xad: + printf("min: %d, max: %d, avg: %d\n", + le16_to_cpu(item->wear_level.min), + le16_to_cpu(item->wear_level.max), + le16_to_cpu(item->wear_level.avg)); + break; + default: + printf("%" PRIu64 "\n", int48_to_long(item->raw)); + break; + } + } +} + +static void smart_log_add_print(struct smart_log_add *log, const char *devname) +{ + uint8_t version = log->raw[511]; + + printf("Version: %u\n", version); + printf("\n"); + printf("Additional Smart Log for NVMe device: %s\n", devname); + printf("\n"); + + printf("%-12s%-36s%-12s%s\n", "Id", "Key", "Normalized", "Raw"); + + switch (version) { + case 0: + return smart_log_add_v0_print(&log->v0_raw[0], + sizeof(struct smart_log_add_v0) / sizeof(struct smart_log_add_item_12)); + case 2: + return smart_log_add_v2_print(&log->v2_raw[0], + sizeof(struct smart_log_add_v2) / sizeof(struct smart_log_add_item_12)); + case 3: + return smart_log_add_v3_print(&log->v3_raw[0], + sizeof(struct smart_log_add_v3) / sizeof(struct smart_log_add_item_10)); + + case 1: + fprintf(stderr, "Version %d: N/A\n", version); + break; + default: + fprintf(stderr, "Version %d: Not supported yet\n", version); + break; + } +} + +static int mb_get_smart_log_add(int argc, char **argv, struct command *cmd, struct plugin *plugin) +{ + int err = 0; + + // Get the configuration + + struct config { + bool raw_binary; + }; + + struct config cfg = {0}; + + OPT_ARGS(opts) = { + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, "dump the whole log buffer in binary format"), + OPT_END()}; + + // Open device + + struct nvme_dev *dev = NULL; + + err = parse_and_open(&dev, argc, argv, cmd->help, opts); + if (err) + return err; + + // Get log + + struct smart_log_add log = {0}; + + err = nvme_get_log_simple(dev_fd(dev), LID_SMART_LOG_ADD, sizeof(struct smart_log_add), &log); + if (!err) { + if (!cfg.raw_binary) + smart_log_add_print(&log, dev->name); + else + d_raw((unsigned char *)&log, sizeof(struct smart_log_add)); + } else if (err > 0) { + nvme_show_status(err); + } else { + nvme_show_error("%s: %s", cmd->name, nvme_strerror(errno)); + } + + // Close device + + dev_close(dev); + return err; +} + +// performance-monitor + +struct latency_stats_bucket { + char *start_threshold; + char *end_threshold; +}; + +struct __packed latency_stats { + union { + struct latency_stats_v2_0 { + uint32_t minor_version; + uint32_t major_version; + uint32_t bucket_read_data[32]; + uint32_t rsvd[32]; + uint32_t bucket_write_data[32]; + uint32_t rsvd1[32]; + uint32_t bucket_trim_data[32]; + uint32_t rsvd2[32]; + uint8_t rsvd3[248]; + } v2_0; + uint8_t raw[1024]; + }; +}; + +struct __packed high_latency_log { + union { + struct high_latency_log_v1 { + uint32_t version; + struct high_latency_log_entry { + uint64_t timestamp; // ms + uint32_t latency; + uint32_t qid; + uint32_t opcode : 8; + uint32_t fuse : 2; + uint32_t psdt : 2; + uint32_t cid : 16; + uint32_t rsvd : 4; + uint32_t nsid; + uint64_t slba; + uint32_t nlb : 16; + uint32_t dtype : 8; + uint32_t pinfo : 4; + uint32_t fua : 1; + uint32_t lr : 1; + uint32_t rsvd1 : 2; + uint8_t rsvd2[28]; + } entries[1024]; + } v1; + uint8_t raw[4 + 1024 * 64]; + }; +}; + +struct __packed performance_stats { + union { + struct performance_stats_v1 { + uint8_t version; + uint8_t rsvd[3]; + struct performance_stats_timestamp { + uint8_t timestamp[6]; + struct performance_stats_entry { + uint16_t read_iops; // K IOPS + uint16_t read_bandwidth; // MiB + uint32_t read_latency; // us + uint32_t read_latency_max; // us + uint16_t write_iops; // K IOPS + uint16_t write_bandwidth; // MiB + uint32_t write_latency; // us + uint32_t write_latency_max; // us + } entries[3600]; + } timestamps[24]; + } v1; + uint8_t raw[4 + 24 * (6 + 3600 * 24)]; + }; +}; + +static int mb_set_latency_feature(int argc, char **argv, struct command *cmd, + struct plugin *plugin) +{ + int err = 0; + + // Get the configuration + + struct config { + uint32_t perf_monitor; + uint32_t cmd_mask; + uint32_t read_threshold; + uint32_t write_threshold; + uint32_t de_allocate_trim_threshold; + }; + + struct config cfg = {0}; + + OPT_ARGS(opts) = { + OPT_UINT("sel-perf-log", 's', &cfg.perf_monitor, + "Select features to turn on, default: Disable\n" + " bit 0: latency statistics\n" + " bit 1: high latency log\n" + " bit 2: Performance stat"), + OPT_UINT("set-commands-mask", 'm', &cfg.cmd_mask, + "Set Enable, default: Disable\n" + " bit 0: Read commands\n" + " bit 1: high Write commands\n" + " bit 2: De-allocate/TRIM (this bit is not worked for Performance stat.)"), + OPT_UINT("set-read-threshold", 'r', &cfg.read_threshold, + "set read high latency log threshold, it's a 0-based value and unit is 10ms"), + OPT_UINT("set-write-threshold", 'w', &cfg.write_threshold, + "set write high latency log threshold, it's a 0-based value and unit is 10ms"), + OPT_UINT("set-trim-threshold", 't', &cfg.de_allocate_trim_threshold, + "set trim high latency log threshold, it's a 0-based value and unit is 10ms"), + OPT_END()}; + + // Open device + + struct nvme_dev *dev = NULL; + + err = parse_and_open(&dev, argc, argv, cmd->help, opts); + if (err) + return err; + + + // Set feature + + uint32_t result = 0; + + struct nvme_set_features_args args = { + .args_size = sizeof(args), + .fd = dev_fd(dev), + .fid = FID_LATENCY_FEATURE, + .nsid = 0, + .cdw11 = 0 | cfg.perf_monitor, + .cdw12 = 0 | cfg.cmd_mask, + .cdw13 = 0 | + (cfg.read_threshold & 0xff) | + ((cfg.write_threshold & 0xff) << 8) | + ((cfg.de_allocate_trim_threshold & 0xff) << 16), + .cdw15 = 0, + .save = 0, + .uuidx = 0, + .data = NULL, + .data_len = 0, + .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, + .result = &result, + }; + + err = nvme_set_features(&args); + if (!err) + printf("%s have done successfully. result = %#" PRIx32 ".\n", cmd->name, result); + else if (err > 0) + nvme_show_status(err); + else + nvme_show_error("%s: %s", cmd->name, nvme_strerror(errno)); + + // Close device + + dev_close(dev); + return err; +} + +static int mb_get_latency_feature(int argc, char **argv, struct command *cmd, + struct plugin *plugin) +{ + int err = 0; + + // Get the configuration + + OPT_ARGS(opts) = { + OPT_END()}; + + // Open device + + struct nvme_dev *dev = NULL; + + err = parse_and_open(&dev, argc, argv, cmd->help, opts); + if (err) + return err; + + // Get feature + + uint32_t result = 0; + + err = nvme_get_features_simple(dev_fd(dev), FID_LATENCY_FEATURE, 0, &result); + if (!err) { + printf("%s have done successfully. result = %#" PRIx32 ".\n", cmd->name, result); + + printf("latency statistics enable status = %d\n", (result & (0x01 << 0)) >> 0); + printf("high latency enable status = %d\n", (result & (0x01 << 1)) >> 1); + printf("performance stat enable status = %d\n", (result & (0x01 << 2)) >> 2); + + printf("Monitor Read command = %d\n", (result & (0x01 << 4)) >> 4); + printf("Monitor Write command = %d\n", (result & (0x01 << 5)) >> 5); + printf("Monitor Trim command = %d\n", (result & (0x01 << 6)) >> 6); + + printf("Threshold for Read = %dms\n", (((result & (0xff << 8)) >> 8) + 1) * 10); + printf("Threshold for Write = %dms\n", (((result & (0xff << 16)) >> 16) + 1) * 10); + printf("Threshold for Trim = %dms\n", (((result & (0xff << 24)) >> 24) + 1) * 10); + } else if (err > 0) { + nvme_show_status(err); + } else { + nvme_show_error("%s: %s", cmd->name, nvme_strerror(errno)); + } + + // Close device + + dev_close(dev); + return err; +} diff --git a/plugins/memblaze/memblaze-nvme.h b/plugins/memblaze/memblaze-nvme.h index e214ca6..e25267b 100644 --- a/plugins/memblaze/memblaze-nvme.h +++ b/plugins/memblaze/memblaze-nvme.h @@ -18,6 +18,9 @@ PLUGIN(NAME("memblaze", "Memblaze vendor specific extensions", NVME_VERSION), ENTRY("lat-log", "Set Memblaze High Latency Log", mb_set_high_latency_log) ENTRY("lat-log-print", "Output Memblaze High Latency Log", mb_high_latency_log_print) ENTRY("clear-error-log", "Clear error log", memblaze_clear_error_log) + ENTRY("smart-log-add-x", "Retrieve Memblaze SMART Log, show it", mb_get_smart_log_add) + ENTRY("lat-set-feature-x", "Set Enable/Disable for Latency Monitor feature", mb_set_latency_feature) + ENTRY("lat-get-feature-x", "Get Enabled/Disabled of Latency Monitor feature", mb_get_latency_feature) ) ); diff --git a/plugins/memblaze/memblaze-utils.h b/plugins/memblaze/memblaze-utils.h index dd89189..8914f95 100644 --- a/plugins/memblaze/memblaze-utils.h +++ b/plugins/memblaze/memblaze-utils.h @@ -34,7 +34,7 @@ #define RAISIN_SI_VD_THERMAL_THROTTLE_TIME_ID 0xEB #define RAISIN_SI_VD_FLASH_MEDIA_ERROR_ID 0xED -/* Raisin Addtional smart internal ID */ +/* Raisin Additional smart internal ID */ typedef enum { /* smart attr following intel */ @@ -154,7 +154,7 @@ struct nvme_p4_smart_log /** * change 512 to 4096. * because micron's getlogpage request,the size of many commands have changed to 4k. - * request size > user malloc size,casuing parameters that are closed in momery are dirty. + * request size > user malloc size,casuing parameters that are closed in memery are dirty. */ __u8 resv[SMART_INFO_NEW_SIZE - sizeof(struct nvme_p4_smart_log_item) * NR_SMART_ITEMS]; }; diff --git a/plugins/micron/micron-nvme.c b/plugins/micron/micron-nvme.c index d6fb601..63a7a79 100644 --- a/plugins/micron/micron-nvme.c +++ b/plugins/micron/micron-nvme.c @@ -16,6 +16,7 @@ #include <limits.h> #include "linux/types.h" #include "nvme-print.h" +#include "util/cleanup.h" #define CREATE_CMD #include "micron-nvme.h" @@ -1767,10 +1768,10 @@ static void GetGenericLogs(int fd, const char *dir) struct nvme_firmware_slot fw_log; struct nvme_cmd_effects_log effects; struct nvme_persistent_event_log pevent_log; + _cleanup_huge_ struct nvme_mem_huge mh = { 0, }; void *pevent_log_info = NULL; __u32 log_len = 0; int err = 0; - bool huge = false; /* get self test log */ if (!nvme_get_log_device_self_test(fd, &self_test_log)) @@ -1799,17 +1800,17 @@ static void GetGenericLogs(int fd, const char *dir) } log_len = le64_to_cpu(pevent_log.tll); - pevent_log_info = nvme_alloc(log_len, &huge); + pevent_log_info = nvme_alloc_huge(log_len, &mh); if (!pevent_log_info) { perror("could not alloc buffer for persistent event log page (ignored)!\n"); return; } + err = nvme_get_log_persistent_event(fd, NVME_PEVENT_LOG_READ, log_len, pevent_log_info); if (!err) WriteData((__u8 *)pevent_log_info, log_len, dir, "persistent_event_log.bin", "persistent event log"); - nvme_free(pevent_log_info, huge); } static void GetNSIDDInfo(int fd, const char *dir, int nsid) @@ -2221,7 +2222,7 @@ static int display_fw_activate_entry(int entry_count, struct fw_activation_histo else sprintf(ptr, "| pass"); - /* replace all null charecters with spaces */ + /* replace all null characters with spaces */ ptr = formatted_entry; while (index < entry_size) { if (ptr[index] == '\0') @@ -2289,7 +2290,7 @@ static int micron_fw_activation_history(int argc, char **argv, struct command *c goto out; } - /* check if we have atleast one entry to print */ + /* check if we have at least one entry to print */ struct micron_fw_activation_history_table *table = (struct micron_fw_activation_history_table *)logC2; @@ -2696,7 +2697,7 @@ static int micron_ocp_smart_health_logs(int argc, char **argv, struct command *c /* check for models that support 0xC0 log */ if (eModel != M51CX) { - printf("Unsupported drive model for vs-smart-add-log commmand\n"); + printf("Unsupported drive model for vs-smart-add-log command\n"); err = -1; goto out; } diff --git a/plugins/nbft/nbft-plugin.c b/plugins/nbft/nbft-plugin.c index e8b3fed..2193ffb 100644 --- a/plugins/nbft/nbft-plugin.c +++ b/plugins/nbft/nbft-plugin.c @@ -543,7 +543,7 @@ int show_nbft(int argc, char **argv, struct command *cmd, struct plugin *plugin) if (ret) return ret; - ret = flags = validate_output_format(format); + ret = validate_output_format(format, &flags); if (ret < 0) return ret; diff --git a/plugins/ocp/meson.build b/plugins/ocp/meson.build index 405ee51..64447ff 100644 --- a/plugins/ocp/meson.build +++ b/plugins/ocp/meson.build @@ -1,7 +1,7 @@ sources += [ 'plugins/ocp/ocp-utils.c', 'plugins/ocp/ocp-nvme.c', - 'plugins/ocp/ocp-clear-fw-update-history.c', + 'plugins/ocp/ocp-clear-features.c', 'plugins/ocp/ocp-smart-extended-log.c', 'plugins/ocp/ocp-fw-activation-history.c', ] diff --git a/plugins/ocp/ocp-clear-features.c b/plugins/ocp/ocp-clear-features.c new file mode 100644 index 0000000..0f49584 --- /dev/null +++ b/plugins/ocp/ocp-clear-features.c @@ -0,0 +1,93 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2022 Solidigm. + * + * Authors: haro.panosyan@solidigm.com + * leonardo.da.cunha@solidigm.com + */ + +#include <unistd.h> +#include "ocp-utils.h" +#include "nvme-print.h" + +static const __u8 OCP_FID_CLEAR_FW_ACTIVATION_HISTORY = 0xC1; +static const __u8 OCP_FID_CLEAR_PCIE_CORRECTABLE_ERROR_COUNTERS = 0xC3; + +static int ocp_clear_feature(int argc, char **argv, const char *desc, const __u8 fid) +{ + __u32 result = 0; + __u32 clear = 1 << 31; + struct nvme_dev *dev; + int uuid_index = 0; + bool uuid = true; + int err; + + OPT_ARGS(opts) = { + OPT_FLAG("no-uuid", 'n', NULL, + "Skip UUID index search (UUID index not required for OCP 1.0)"), + OPT_END() + }; + + err = parse_and_open(&dev, argc, argv, desc, opts); + if (err) + return err; + + if (opts[0].seen) + uuid = false; + + if (uuid) { + /* OCP 2.0 requires UUID index support */ + err = ocp_get_uuid_index(dev, &uuid_index); + if (err || !uuid_index) { + fprintf(stderr, "ERROR: No OCP UUID index found\n"); + goto close_dev; + } + } + + struct nvme_set_features_args args = { + .result = &result, + .data = NULL, + .args_size = sizeof(args), + .fd = dev_fd(dev), + .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, + .nsid = 0, + .cdw11 = clear, + .cdw12 = 0, + .cdw13 = 0, + .cdw15 = 0, + .data_len = 0, + .save = 0, + .uuidx = uuid_index, + .fid = fid, + }; + + err = nvme_set_features(&args); + + if (err == 0) + printf("Success : %s\n", desc); + else if (err > 0) + nvme_show_status(err); + else + printf("Fail : %s\n", desc); +close_dev: + /* Redundant close() to make static code analysis happy */ + close(dev->direct.fd); + dev_close(dev); + return err; +} + +int ocp_clear_fw_update_history(int argc, char **argv, struct command *cmd, struct plugin *plugin) +{ + const char *desc = "OCP Clear Firmware Update History"; + + return ocp_clear_feature(argc, argv, desc, OCP_FID_CLEAR_FW_ACTIVATION_HISTORY); +} + +int ocp_clear_pcie_correctable_errors(int argc, char **argv, struct command *cmd, + struct plugin *plugin) +{ + const char *desc = "OCP Clear PCIe Correctable Error Counters"; + + return ocp_clear_feature(argc, argv, desc, + OCP_FID_CLEAR_PCIE_CORRECTABLE_ERROR_COUNTERS); +} diff --git a/plugins/ocp/ocp-clear-features.h b/plugins/ocp/ocp-clear-features.h new file mode 100644 index 0000000..99766dd --- /dev/null +++ b/plugins/ocp/ocp-clear-features.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2022 Solidigm. + * + * Authors: haro.panosyan@solidigm.com + * leonardo.da.cunha@solidigm.com + */ + +int ocp_clear_fw_update_history(int argc, char **argv, struct command *cmd, struct plugin *plugin); + +int ocp_clear_pcie_correctable_errors(int argc, char **argv, struct command *cmd, + struct plugin *plugin); diff --git a/plugins/ocp/ocp-clear-fw-update-history.c b/plugins/ocp/ocp-clear-fw-update-history.c deleted file mode 100644 index 6b256b1..0000000 --- a/plugins/ocp/ocp-clear-fw-update-history.c +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright (c) 2022 Solidigm. - * - * Authors: haro.panosyan@solidigm.com - * leonardo.da.cunha@solidigm.com - */ - -#include <unistd.h> -#include "ocp-utils.h" -#include "nvme-print.h" - -static const __u8 OCP_FID_CLEAR_FW_ACTIVATION_HISTORY = 0xC1; - -int ocp_clear_fw_update_history(int argc, char **argv, struct command *cmd, struct plugin *plugin) -{ - const char *desc = "OCP Clear Firmware Update History"; - - return ocp_clear_feature(argc, argv, desc, OCP_FID_CLEAR_FW_ACTIVATION_HISTORY); -} diff --git a/plugins/ocp/ocp-clear-fw-update-history.h b/plugins/ocp/ocp-clear-fw-update-history.h deleted file mode 100644 index cd0844c..0000000 --- a/plugins/ocp/ocp-clear-fw-update-history.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (c) 2022 Solidigm. - * - * Authors: haro.panosyan@solidigm.com - * leonardo.da.cunha@solidigm.com - */ - -int ocp_clear_fw_update_history(int argc, char **argv, - struct command *cmd, struct plugin *plugin); diff --git a/plugins/ocp/ocp-fw-activation-history.c b/plugins/ocp/ocp-fw-activation-history.c index b067346..ad96c6b 100644 --- a/plugins/ocp/ocp-fw-activation-history.c +++ b/plugins/ocp/ocp-fw-activation-history.c @@ -207,16 +207,18 @@ int ocp_fw_activation_history_log(int argc, char **argv, struct command *cmd, } if (!err) { - const enum nvme_print_flags print_flag = validate_output_format(format); + enum nvme_print_flags print_flag; + + err = validate_output_format(format, &print_flag); + if (err < 0) { + fprintf(stderr, "Error: Invalid output format.\n"); + return err; + } if (print_flag == JSON) ocp_fw_activation_history_json(&fw_history); else if (print_flag == NORMAL) ocp_fw_activation_history_normal(&fw_history); - else { - fprintf(stderr, "Error: Invalid output format.\n"); - err = -EINVAL; - } } return err; diff --git a/plugins/ocp/ocp-nvme.c b/plugins/ocp/ocp-nvme.c index edf75fc..53ae0f4 100644 --- a/plugins/ocp/ocp-nvme.c +++ b/plugins/ocp/ocp-nvme.c @@ -25,7 +25,7 @@ #include "nvme-print.h" #include "ocp-smart-extended-log.h" -#include "ocp-clear-fw-update-history.h" +#include "ocp-clear-features.h" #include "ocp-fw-activation-history.h" #define CREATE_CMD @@ -117,7 +117,6 @@ static int ocp_print_C3_log_normal(struct nvme_dev *dev, { char ts_buf[128]; int i, j; - int pos = 0; printf("-Latency Monitor/C3 Log Page Data-\n"); printf(" Controller : %s\n", dev->name); @@ -141,6 +140,8 @@ static int ocp_print_C3_log_normal(struct nvme_dev *dev, printf(" Active Threshold D %d ms\n", C3_ACTIVE_THRESHOLD_INCREMENT * le16_to_cpu(log_data->active_threshold_d+1)); + printf(" Active Latency Configuration 0x%x \n", + le16_to_cpu(log_data->active_latency_config)); printf(" Active Latency Minimum Window %d ms\n", C3_MINIMUM_WINDOW_INCREMENT * le16_to_cpu(log_data->active_latency_min_window)); @@ -178,14 +179,6 @@ static int ocp_print_C3_log_normal(struct nvme_dev *dev, printf(" Read Write Deallocate/Trim\n"); for (i = 0; i < C3_BUCKET_NUM; i++) { - printf(" Active Latency Mode: Bucket %d %27d %27d %27d\n", - i, - log_data->active_latency_config & (1 << pos), - log_data->active_latency_config & (1 << pos), - log_data->active_latency_config & (1 << pos)); - } - - for (i = 0; i < C3_BUCKET_NUM; i++) { printf(" Active Bucket Counter: Bucket %d %27d %27d %27d\n", i, le32_to_cpu(log_data->active_bucket_counter[i][READ]), @@ -196,10 +189,10 @@ static int ocp_print_C3_log_normal(struct nvme_dev *dev, for (i = 0; i < C3_BUCKET_NUM; i++) { printf(" Active Latency Time Stamp: Bucket %d ", i); for (j = 2; j >= 0; j--) { - if (le64_to_cpu(log_data->active_latency_timestamp[i][j]) == -1) { + if (le64_to_cpu(log_data->active_latency_timestamp[3-i][j]) == -1) { printf(" N/A "); } else { - convert_ts(le64_to_cpu(log_data->active_latency_timestamp[i][j]), ts_buf); + convert_ts(le64_to_cpu(log_data->active_latency_timestamp[3-i][j]), ts_buf); printf("%s ", ts_buf); } } @@ -209,9 +202,9 @@ static int ocp_print_C3_log_normal(struct nvme_dev *dev, for (i = 0; i < C3_BUCKET_NUM; i++) { printf(" Active Measured Latency: Bucket %d %27d ms %27d ms %27d ms\n", i, - le16_to_cpu(log_data->active_measured_latency[i][READ-1]), - le16_to_cpu(log_data->active_measured_latency[i][WRITE-1]), - le16_to_cpu(log_data->active_measured_latency[i][TRIM-1])); + le16_to_cpu(log_data->active_measured_latency[3-i][READ-1]), + le16_to_cpu(log_data->active_measured_latency[3-i][WRITE-1]), + le16_to_cpu(log_data->active_measured_latency[3-i][TRIM-1])); } printf("\n"); @@ -226,10 +219,10 @@ static int ocp_print_C3_log_normal(struct nvme_dev *dev, for (i = 0; i < C3_BUCKET_NUM; i++) { printf(" Static Latency Time Stamp: Bucket %d ", i); for (j = 2; j >= 0; j--) { - if (le64_to_cpu(log_data->static_latency_timestamp[i][j]) == -1) { + if (le64_to_cpu(log_data->static_latency_timestamp[3-i][j]) == -1) { printf(" N/A "); } else { - convert_ts(le64_to_cpu(log_data->static_latency_timestamp[i][j]), ts_buf); + convert_ts(le64_to_cpu(log_data->static_latency_timestamp[3-i][j]), ts_buf); printf("%s ", ts_buf); } } @@ -239,9 +232,9 @@ static int ocp_print_C3_log_normal(struct nvme_dev *dev, for (i = 0; i < C3_BUCKET_NUM; i++) { printf(" Static Measured Latency: Bucket %d %27d ms %27d ms %27d ms\n", i, - le16_to_cpu(log_data->static_measured_latency[i][READ-1]), - le16_to_cpu(log_data->static_measured_latency[i][WRITE-1]), - le16_to_cpu(log_data->static_measured_latency[i][TRIM-1])); + le16_to_cpu(log_data->static_measured_latency[3-i][READ-1]), + le16_to_cpu(log_data->static_measured_latency[3-i][WRITE-1]), + le16_to_cpu(log_data->static_measured_latency[3-i][TRIM-1])); } return 0; @@ -253,7 +246,6 @@ static void ocp_print_C3_log_json(struct ssd_latency_monitor_log *log_data) char ts_buf[128]; char buf[128]; int i, j; - int pos = 0; char *operation[3] = {"Trim", "Write", "Read"}; root = json_create_object(); @@ -278,19 +270,8 @@ static void ocp_print_C3_log_json(struct ssd_latency_monitor_log *log_data) json_object_add_value_uint(root, "Active Threshold D", C3_ACTIVE_THRESHOLD_INCREMENT * le16_to_cpu(log_data->active_threshold_d + 1)); - - for (i = 0; i < C3_BUCKET_NUM; i++) { - struct json_object *bucket; - - bucket = json_create_object(); - sprintf(buf, "Active Latency Mode: Bucket %d", i); - for (j = 2; j >= 0; j--) { - json_object_add_value_uint(bucket, operation[j], - log_data->active_latency_config & (1 << pos)); - } - json_object_add_value_object(root, buf, bucket); - } - + json_object_add_value_uint(root, "Active Latency Configuration", + le16_to_cpu(log_data->active_latency_config)); json_object_add_value_uint(root, "Active Latency Minimum Window", C3_MINIMUM_WINDOW_INCREMENT * le16_to_cpu(log_data->active_latency_min_window)); @@ -313,10 +294,10 @@ static void ocp_print_C3_log_json(struct ssd_latency_monitor_log *log_data) bucket = json_create_object(); sprintf(buf, "Active Latency Time Stamp: Bucket %d", i); for (j = 2; j >= 0; j--) { - if (le64_to_cpu(log_data->active_latency_timestamp[i][j]) == -1) { + if (le64_to_cpu(log_data->active_latency_timestamp[3-i][j]) == -1) { json_object_add_value_string(bucket, operation[j], "NA"); } else { - convert_ts(le64_to_cpu(log_data->active_latency_timestamp[i][j]), ts_buf); + convert_ts(le64_to_cpu(log_data->active_latency_timestamp[3-i][j]), ts_buf); json_object_add_value_string(bucket, operation[j], ts_buf); } } @@ -330,7 +311,7 @@ static void ocp_print_C3_log_json(struct ssd_latency_monitor_log *log_data) sprintf(buf, "Active Measured Latency: Bucket %d", i); for (j = 2; j >= 0; j--) { json_object_add_value_uint(bucket, operation[j], - le16_to_cpu(log_data->active_measured_latency[i][j])); + le16_to_cpu(log_data->active_measured_latency[3-i][j])); } json_object_add_value_object(root, buf, bucket); } @@ -356,10 +337,10 @@ static void ocp_print_C3_log_json(struct ssd_latency_monitor_log *log_data) bucket = json_create_object(); sprintf(buf, "Static Latency Time Stamp: Bucket %d", i); for (j = 2; j >= 0; j--) { - if (le64_to_cpu(log_data->static_latency_timestamp[i][j]) == -1) { + if (le64_to_cpu(log_data->static_latency_timestamp[3-i][j]) == -1) { json_object_add_value_string(bucket, operation[j], "NA"); } else { - convert_ts(le64_to_cpu(log_data->static_latency_timestamp[i][j]), ts_buf); + convert_ts(le64_to_cpu(log_data->static_latency_timestamp[3-i][j]), ts_buf); json_object_add_value_string(bucket, operation[j], ts_buf); } } @@ -373,7 +354,7 @@ static void ocp_print_C3_log_json(struct ssd_latency_monitor_log *log_data) sprintf(buf, "Static Measured Latency: Bucket %d", i); for (j = 2; j >= 0; j--) { json_object_add_value_uint(bucket, operation[j], - le16_to_cpu(log_data->static_measured_latency[i][j])); + le16_to_cpu(log_data->static_measured_latency[3-i][j])); } json_object_add_value_object(root, buf, bucket); } @@ -416,15 +397,15 @@ static void ocp_print_C3_log_json(struct ssd_latency_monitor_log *log_data) static int get_c3_log_page(struct nvme_dev *dev, char *format) { struct ssd_latency_monitor_log *log_data; - int ret = 0; - int fmt = -1; + enum nvme_print_flags fmt; + int ret; __u8 *data; int i; - fmt = validate_output_format(format); - if (fmt < 0) { + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR : OCP : invalid output format\n"); - return fmt; + return ret; } data = malloc(sizeof(__u8) * C3_LATENCY_MON_LOG_BUF_LEN); @@ -481,6 +462,9 @@ static int get_c3_log_page(struct nvme_dev *dev, char *format) case JSON: ocp_print_C3_log_json(log_data); break; + default: + fprintf(stderr, "unhandled output format\n"); + } } else { fprintf(stderr, @@ -707,7 +691,7 @@ static int eol_plp_failure_mode_get(struct nvme_dev *dev, const __u32 nsid, nvme_select_to_string(sel), eol_plp_failure_mode_to_string(result)); if (sel == NVME_GET_FEATURES_SEL_SUPPORTED) - nvme_show_select_result(result); + nvme_show_select_result(fid, result); } else { nvme_show_error("Could not get feature: %#0*x.", fid ? 4 : 2, fid); } @@ -847,6 +831,31 @@ struct telemetry_initiated_log { __u8 ReasonIdentifier[128]; }; +struct telemetry_data_area_1 { + __le16 major_version; + __le16 minor_version; + __u8 reserved1[4]; + __le64 timestamp; + __u8 log_page_guid[16]; + __u8 no_of_tps_supp; + __u8 tps; + __u8 reserved2[6]; + __le16 sls; + __u8 reserved3[8]; + __le16 fw_revision; + __u8 reserved4[32]; + __le16 da1_stat_start; + __le16 da1_stat_size; + __le16 da2_stat_start; + __le16 da2_stat_size; + __u8 reserved5[32]; + __u8 event_fifo_da[16]; + __le64 event_fifo_start[16]; + __le64 event_fifo_size[16]; + __u8 reserved6[80]; + __u8 smart_health_info[512]; + __u8 smart_health_info_extended[512]; +}; static void get_serial_number(struct nvme_id_ctrl *ctrl, char *sn) { int i; @@ -913,6 +922,144 @@ static void print_telemetry_header(struct telemetry_initiated_log *logheader, printf("===============================================\n\n"); } } +static int get_telemetry_data(struct nvme_dev *dev, __u32 ns, __u8 tele_type, + __u32 data_len, void *data, __u8 nLSP, __u8 nRAE, + __u64 offset) +{ + struct nvme_passthru_cmd cmd = { + .opcode = nvme_admin_get_log_page, + .nsid = ns, + .addr = (__u64)(uintptr_t) data, + .data_len = data_len, + }; + __u32 numd = (data_len >> 2) - 1; + __u16 numdu = numd >> 16; + __u16 numdl = numd & 0xffff; + cmd.cdw10 = tele_type | (nLSP & 0x0F) << 8 | (nRAE & 0x01) << 15 | (numdl & 0xFFFF) << 16; + cmd.cdw11 = numdu; + cmd.cdw12 = offset; + cmd.cdw13 = 0; + cmd.cdw14 = 0; + return nvme_submit_admin_passthru(dev_fd(dev), &cmd, NULL); +} +static void print_telemetry_data_area_1(struct telemetry_data_area_1 *da1, + int tele_type) +{ + if (da1) { + unsigned int i = 0; + if (tele_type == TELEMETRY_TYPE_HOST) + printf("============ Telemetry Host Data area 1 ============\n"); + else + printf("========= Telemetry Controller Data area 1 =========\n"); + printf("Major Version : 0x%x\n", le16_to_cpu(da1->major_version)); + printf("Minor Version : 0x%x\n", le16_to_cpu(da1->minor_version)); + for (i = 0; i < 4; i++) + printf("reserved1 : 0x%x\n", da1->reserved1[i]); + printf("Timestamp : %"PRIu64"\n", le64_to_cpu(da1->timestamp)); + for (i = 15; i >= 0; i--) + printf("%x", da1->log_page_guid[i]); + printf("Number Telemetry Profiles Supported : 0x%x\n", da1->no_of_tps_supp); + printf("Telemetry Profile Selected (TPS) : 0x%x\n", da1->tps); + for (i = 0; i < 6; i++) + printf("reserved2 : 0x%x\n", da1->reserved2[i]); + printf("Telemetry String Log Size (SLS) : 0x%x\n", le16_to_cpu(da1->sls)); + for (i = 0; i < 8; i++) + printf("reserved3 : 0x%x\n", da1->reserved3[i]); + printf("Firmware Revision : 0x%x\n", le16_to_cpu(da1->fw_revision)); + for (i = 0; i < 32; i++) + printf("reserved4 : 0x%x\n", da1->reserved4[i]); + printf("Data Area 1 Statistic Start : 0x%x\n", le16_to_cpu(da1->da1_stat_start)); + printf("Data Area 1 Statistic Size : 0x%x\n", le16_to_cpu(da1->da1_stat_size)); + printf("Data Area 2 Statistic Start : 0x%x\n", le16_to_cpu(da1->da2_stat_start)); + printf("Data Area 2 Statistic Size : 0x%x\n", le16_to_cpu(da1->da2_stat_size)); + for (i = 0; i < 32; i++) + printf("reserved5 : 0x%x\n", da1->reserved5[i]); + for (i = 0; i < 17; i++){ + printf("Event FIFO %d Data Area : 0x%x\n", i, da1->event_fifo_da[i]); + printf("Event FIFO %d Start : %"PRIu64"\n", i, le64_to_cpu(da1->event_fifo_start[i])); + printf("Event FIFO %d Size : %"PRIu64"\n", i, le64_to_cpu(da1->event_fifo_size[i])); + } + for (i = 0; i < 80; i++) + printf("reserved6 : 0x%x\n", da1->reserved6[i]); + for (i = 0; i < 512; i++){ + printf("SMART / Health Information : 0x%x\n", da1->smart_health_info[i]); + printf("SMART / Health Information Extended : 0x%x\n", da1->smart_health_info_extended[i]); + } + printf("===============================================\n\n"); + } +} +static void print_telemetry_da1_stat(__u8 *da1_stat, int tele_type, __u16 buf_size) +{ + if (da1_stat) { + unsigned int i = 0; + if (tele_type == TELEMETRY_TYPE_HOST) + printf("============ Telemetry Host Data area 1 Statistics ============\n"); + else + printf("========= Telemetry Controller Data area 1 Statistics =========\n"); + while((i + 8) < buf_size) { + printf("Statistics Identifier : 0x%x\n", (da1_stat[i] | da1_stat[i+1] << 8)); + printf("Statistics info : 0x%x\n", da1_stat[i+2]); + printf("NS info : 0x%x\n", da1_stat[i+3]); + printf("Statistic Data Size : 0x%x\n", (da1_stat[i+4] | da1_stat[i+5] << 8)); + printf("Reserved : 0x%x\n", (da1_stat[i+6] | da1_stat[i+7] << 8)); + i = 8 + ((da1_stat[i+4] | da1_stat[i+5] << 8) * 4); + } + printf("===============================================\n\n"); + } +} +static void print_telemetry_da1_fifo(__u8 *da1_fifo, int tele_type, __u16 buf_size) +{ + if (da1_fifo) { + unsigned int i = 0; + if (tele_type == TELEMETRY_TYPE_HOST) + printf("============ Telemetry Host Data area 1 FIFO ============\n"); + else + printf("========= Telemetry Controller Data area 1 FIFO =========\n"); + while((i + 4) < buf_size) { + printf("Debug Event Class Type : 0x%x\n", da1_fifo[i]); + printf("Event ID : 0x%x\n", (da1_fifo[i+1] | da1_fifo[i+2] << 8)); + printf("Event Data Size : 0x%x\n", da1_fifo[3]); + i = 4 + ((da1_fifo[3]) * 4); + } + printf("===============================================\n\n"); + } +} +static void print_telemetry_da2_stat(__u8 *da1_stat, int tele_type, __u16 buf_size) +{ + if (da1_stat) { + unsigned int i = 0; + if (tele_type == TELEMETRY_TYPE_HOST) + printf("============ Telemetry Host Data area 1 Statistics ============\n"); + else + printf("========= Telemetry Controller Data area 1 Statistics =========\n"); + while((i + 8) < buf_size) { + printf("Statistics Identifier : 0x%x\n", (da1_stat[i] | da1_stat[i+1] << 8)); + printf("Statistics info : 0x%x\n", da1_stat[i+2]); + printf("NS info : 0x%x\n", da1_stat[i+3]); + printf("Statistic Data Size : 0x%x\n", (da1_stat[i+4] | da1_stat[i+5] << 8)); + printf("Reserved : 0x%x\n", (da1_stat[i+6] | da1_stat[i+7] << 8)); + i = 8 + ((da1_stat[i+4] | da1_stat[i+5] << 8) * 4); + } + printf("===============================================\n\n"); + } +} +static void print_telemetry_da2_fifo(__u8 *da1_fifo, int tele_type, __u16 buf_size) +{ + if (da1_fifo) { + unsigned int i = 0; + if (tele_type == TELEMETRY_TYPE_HOST) + printf("============ Telemetry Host Data area 1 Statistics ============\n"); + else + printf("========= Telemetry Controller Data area 1 Statistics =========\n"); + while((i + 4) < buf_size) { + printf("Debug Event Class Type : 0x%x\n", da1_fifo[i]); + printf("Event ID : 0x%x\n", (da1_fifo[i+1] | da1_fifo[i+2] << 8)); + printf("Event Data Size : 0x%x\n", da1_fifo[3]); + i = 4 + ((da1_fifo[3]) * 4); + } + printf("===============================================\n\n"); + } +} static int extract_dump_get_log(struct nvme_dev *dev, char *featurename, char *filename, char *sn, int dumpsize, int transfersize, __u32 nsid, __u8 log_id, @@ -1000,9 +1147,12 @@ static int get_telemetry_dump(struct nvme_dev *dev, char *filename, char *sn, { __u32 err = 0, nsid = 0; __u8 lsp = 0, rae = 0; + unsigned int i = 0; char data[TELEMETRY_TRANSFER_SIZE] = { 0 }; + char data1[1536] = { 0 }; char *featurename = 0; struct telemetry_initiated_log *logheader = (struct telemetry_initiated_log *)data; + struct telemetry_data_area_1 *da1 = (struct telemetry_data_area_1 *)data1; __u64 offset = 0, size = 0; char dumpname[FILE_NAME_SIZE] = { 0 }; @@ -1029,6 +1179,43 @@ static int get_telemetry_dump(struct nvme_dev *dev, char *filename, char *sn, if (header_print) print_telemetry_header(logheader, tele_type); + err = get_telemetry_data(dev, nsid, tele_type, 1536, + (void *)data1, lsp, rae, 512); + if (err) + return err; + print_telemetry_data_area_1(da1, tele_type); + char *da1_stat = calloc((da1->da1_stat_size * 4), sizeof(char)); + err = get_telemetry_data(dev, nsid, tele_type, (da1->da1_stat_size) * 4, + (void *)da1_stat, lsp, rae, (da1->da1_stat_start) * 4); + if (err) + return err; + print_telemetry_da1_stat((void *)da1_stat, tele_type, (da1->da1_stat_size) * 4); + for (i = 0; i < 17 ; i++){ + if (da1->event_fifo_da[i] == 1){ + char *da1_fifo = calloc((da1->event_fifo_size[i]) * 4, sizeof(char)); + err = get_telemetry_data(dev, nsid, tele_type, (da1->event_fifo_size[i]) * 4, + (void *)da1_stat, lsp, rae, (da1->event_fifo_start[i]) * 4); + if (err) + return err; + print_telemetry_da1_fifo((void *)da1_fifo, tele_type, (da1->event_fifo_size[i]) * 4); + } + } + char *da2_stat = calloc((da1->da2_stat_size * 4), sizeof(char)); + err = get_telemetry_data(dev, nsid, tele_type, (da1->da2_stat_size) * 4, + (void *)da2_stat, lsp, rae, (da1->da2_stat_start) * 4); + if (err) + return err; + print_telemetry_da2_stat((void *)da2_stat, tele_type, (da1->da2_stat_size) * 4); + for (i = 0; i < 17 ; i++){ + if (da1->event_fifo_da[i] == 2){ + char *da1_fifo = calloc((da1->event_fifo_size[i]) * 4, sizeof(char)); + err = get_telemetry_data(dev, nsid, tele_type, (da1->event_fifo_size[i]) * 4, + (void *)da1_stat, lsp, rae, (da1->event_fifo_start[i]) * 4); + if (err) + return err; + print_telemetry_da2_fifo((void *)da1_fifo, tele_type, (da1->event_fifo_size[i]) * 4); + } + } switch (data_area) { case 1: @@ -1324,17 +1511,17 @@ static void ocp_print_c5_log_binary(struct unsupported_requirement_log *log_data static int get_c5_log_page(struct nvme_dev *dev, char *format) { - int ret = 0; - int fmt = -1; + enum nvme_print_flags fmt; + int ret; __u8 *data; int i; struct unsupported_requirement_log *log_data; int j; - fmt = validate_output_format(format); - if (fmt < 0) { + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR : OCP : invalid output format\n"); - return fmt; + return ret; } data = (__u8 *)malloc(sizeof(__u8) * C5_UNSUPPORTED_REQS_LEN); @@ -1386,6 +1573,8 @@ static int get_c5_log_page(struct nvme_dev *dev, char *format) case BINARY: ocp_print_c5_log_binary(log_data); break; + default: + break; } } else { fprintf(stderr, "ERROR : OCP : Unable to read C3 data from buffer\n"); @@ -1548,16 +1737,16 @@ static void ocp_print_c1_log_binary(struct ocp_error_recovery_log_page *log_data static int get_c1_log_page(struct nvme_dev *dev, char *format) { - int ret = 0; - int fmt = -1; + struct ocp_error_recovery_log_page *log_data; + enum nvme_print_flags fmt; + int ret; __u8 *data; int i, j; - struct ocp_error_recovery_log_page *log_data; - fmt = validate_output_format(format); - if (fmt < 0) { + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR : OCP : invalid output format\n"); - return fmt; + return ret; } data = (__u8 *)malloc(sizeof(__u8) * C1_ERROR_RECOVERY_LOG_BUF_LEN); @@ -1609,6 +1798,8 @@ static int get_c1_log_page(struct nvme_dev *dev, char *format) case BINARY: ocp_print_c1_log_binary(log_data); break; + default: + break; } } else { fprintf(stderr, "ERROR : OCP : Unable to read C1 data from buffer\n"); @@ -1762,16 +1953,16 @@ static void ocp_print_c4_log_binary(struct ocp_device_capabilities_log_page *log static int get_c4_log_page(struct nvme_dev *dev, char *format) { - int ret = 0; - int fmt = -1; + struct ocp_device_capabilities_log_page *log_data; + enum nvme_print_flags fmt; + int ret; __u8 *data; int i, j; - struct ocp_device_capabilities_log_page *log_data; - fmt = validate_output_format(format); - if (fmt < 0) { + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR : OCP : invalid output format\n"); - return fmt; + return ret; } data = (__u8 *)malloc(sizeof(__u8) * C4_DEV_CAP_REQ_LEN); @@ -1823,6 +2014,8 @@ static int get_c4_log_page(struct nvme_dev *dev, char *format) case BINARY: ocp_print_c4_log_binary(log_data); break; + default: + break; } } else { fprintf(stderr, "ERROR : OCP : Unable to read C4 data from buffer\n"); @@ -1867,9 +2060,891 @@ static int ocp_device_capabilities_log(int argc, char **argv, struct command *cm /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -/// Misc +/// DSSD Power State (Feature Identifier C7h) Set Feature + +static int set_dssd_power_state(struct nvme_dev *dev, const __u32 nsid, + const __u8 fid, __u8 power_state, bool save, + bool uuid) +{ + __u32 result; + int err; + int uuid_index = 0; + + if (uuid) { + /* OCP 2.0 requires UUID index support */ + err = ocp_get_uuid_index(dev, &uuid_index); + if (err || !uuid_index) { + nvme_show_error("ERROR: No OCP UUID index found"); + return err; + } + } + + struct nvme_set_features_args args = { + .args_size = sizeof(args), + .fd = dev_fd(dev), + .fid = fid, + .nsid = nsid, + .cdw11 = power_state, + .cdw12 = 0, + .save = save, + .uuidx = uuid_index, + .cdw15 = 0, + .data_len = 0, + .data = NULL, + .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, + .result = &result, + }; + + err = nvme_set_features(&args); + if (err > 0) { + nvme_show_status(err); + } else if (err < 0) { + nvme_show_perror("Define DSSD Power State"); + fprintf(stderr, "Command failed while parsing.\n"); + } else { + printf("Successfully set DSSD Power State (feature: 0xC7) to below values\n"); + printf("DSSD Power State: 0x%x\n", power_state); + printf("Save bit Value: 0x%x\n", save); + } + + return err; +} + +static int set_dssd_power_state_feature(int argc, char **argv, struct command *cmd, + struct plugin *plugin) +{ + const char *desc = "Define DSSD Power State (Feature Identifier C7h) Set Feature."; + const char *power_state = "DSSD Power State to set in watts"; + const char *save = "Specifies that the controller shall save the attribute"; + const __u32 nsid = 0; + const __u8 fid = 0xC7; + struct nvme_dev *dev; + int err; + + struct config { + __u8 power_state; + bool save; + }; + + struct config cfg = { + .power_state = 0, + .save = false, + }; + + OPT_ARGS(opts) = { + OPT_BYTE("power-state", 'p', &cfg.power_state, power_state), + OPT_FLAG("save", 's', &cfg.save, save), + OPT_FLAG("no-uuid", 'n', NULL, + "Skip UUID index search (UUID index not required for OCP 1.0)"), + OPT_END() + }; + + err = parse_and_open(&dev, argc, argv, desc, opts); + if (err) + return err; + + if (argconfig_parse_seen(opts, "power state")) + err = set_dssd_power_state(dev, nsid, fid, cfg.power_state, + cfg.save, + !argconfig_parse_seen(opts, "no-uuid")); + + dev_close(dev); + + return err; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +/// plp_health_check_interval + +static int set_plp_health_check_interval(int argc, char **argv, struct command *cmd, + struct plugin *plugin) +{ + + const char *desc = "Define Issue Set Feature command (FID : 0xC6) PLP Health Check Interval"; + const char *plp_health_interval = "[31:16]:PLP Health Check Interval"; + const char *save = "Specifies that the controller shall save the attribute"; + const __u32 nsid = 0; + const __u8 fid = 0xc6; + struct nvme_dev *dev; + int err; + __u32 result; + int uuid_index = 0; + + struct config { + __le16 plp_health_interval; + bool save; + }; + + struct config cfg = { + .plp_health_interval = 0, + .save = false, + }; + + OPT_ARGS(opts) = { + OPT_BYTE("plp_health_interval", 'p', &cfg.plp_health_interval, plp_health_interval), + OPT_FLAG("save", 's', &cfg.save, save), + OPT_FLAG("no-uuid", 'n', NULL, + "Skip UUID index search (UUID index not required for OCP 1.0)"), + OPT_END() + }; + + err = parse_and_open(&dev, argc, argv, desc, opts); + if (err) + return err; + + + if (!argconfig_parse_seen(opts, "no-uuid")) { + /* OCP 2.0 requires UUID index support */ + err = ocp_get_uuid_index(dev, &uuid_index); + if (err || !uuid_index) { + printf("ERROR: No OCP UUID index found"); + return err; + } + } + + + struct nvme_set_features_args args = { + .args_size = sizeof(args), + .fd = dev_fd(dev), + .fid = fid, + .nsid = nsid, + .cdw11 = cfg.plp_health_interval << 16, + .cdw12 = 0, + .save = cfg.save, + .uuidx = uuid_index, + .cdw15 = 0, + .data_len = 0, + .data = NULL, + .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, + .result = &result, + }; + + err = nvme_set_features(&args); + if (err > 0) { + nvme_show_status(err); + } else if (err < 0) { + nvme_show_perror("Define PLP Health Check Interval"); + fprintf(stderr, "Command failed while parsing.\n"); + } else { + printf("Successfully set the PLP Health Check Interval"); + printf("PLP Health Check Interval: 0x%x\n", cfg.plp_health_interval); + printf("Save bit Value: 0x%x\n", cfg.save); + } + return err; +} + +static int get_plp_health_check_interval(int argc, char **argv, struct command *cmd, + struct plugin *plugin) +{ + + const char *desc = "Define Issue Get Feature command (FID : 0xC6) PLP Health Check Interval"; + const char *sel = "[0-3,8]: current/default/saved/supported/changed"; + const __u32 nsid = 0; + const __u8 fid = 0xc6; + struct nvme_dev *dev; + __u32 result; + int err; + + struct config { + __u8 sel; + }; + + struct config cfg = { + .sel = 0, + }; + + OPT_ARGS(opts) = { + OPT_BYTE("sel", 'S', &cfg.sel, sel), + OPT_END() + }; + + err = parse_and_open(&dev, argc, argv, desc, opts); + if (err) + return err; + + + struct nvme_get_features_args args = { + .args_size = sizeof(args), + .fd = dev_fd(dev), + .fid = fid, + .nsid = nsid, + .sel = cfg.sel, + .cdw11 = 0, + .uuidx = 0, + .data_len = 0, + .data = NULL, + .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, + .result = &result, + }; + + err = nvme_get_features(&args); + if (!err) { + printf("get-feature:0xC6 %s value: %#08x\n", nvme_select_to_string(cfg.sel), result); + + if (cfg.sel == NVME_GET_FEATURES_SEL_SUPPORTED) + nvme_show_select_result(fid, result); + } else { + nvme_show_error("Could not get feature: 0xC6"); + } + + return err; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +/// Telemetry String Log Format Log Page (LID : C9h) + +/* C9 Telemetry String Log Format Log Page */ +#define C9_GUID_LENGTH 16 +#define C9_TELEMETRY_STRING_LOG_ENABLE_OPCODE 0xC9 +#define C9_TELEMETRY_STR_LOG_LEN 432 +#define C9_TELEMETRY_STR_LOG_SIST_OFST 431 + +/** + * struct telemetry_str_log_format - Telemetry String Log Format + * @log_page_version: indicates the version of the mapping this log page uses + * Shall be set to 01h. + * @reserved1: Reserved. + * @log_page_guid: Shall be set to B13A83691A8F408B9EA495940057AA44h. + * @sls: Shall be set to the number of DWORDS in the String Log. + * @reserved2: reserved. + * @sits: shall be set to the number of DWORDS in the Statistics + * Identifier String Table + * @ests: Shall be set to the number of DWORDS from byte 0 of this + * log page to the start of the Event String Table + * @estsz: shall be set to the number of DWORDS in the Event String Table + * @vu_eve_sts: Shall be set to the number of DWORDS from byte 0 of this + * log page to the start of the VU Event String Table + * @vu_eve_st_sz: shall be set to the number of DWORDS in the VU Event String Table + * @ascts: the number of DWORDS from byte 0 of this log page until the ASCII Table Starts. + * @asctsz: the number of DWORDS in the ASCII Table + * @fifo1: FIFO 0 ASCII String + * @fifo2: FIFO 1 ASCII String + * @fifo3: FIFO 2 ASCII String + * @fifo4: FIFO 3 ASCII String + * @fif05: FIFO 4 ASCII String + * @fifo6: FIFO 5 ASCII String + * @fifo7: FIFO 6 ASCII String + * @fifo8: FIFO 7 ASCII String + * @fifo9: FIFO 8 ASCII String + * @fifo10: FIFO 9 ASCII String + * @fif011: FIFO 10 ASCII String + * @fif012: FIFO 11 ASCII String + * @fifo13: FIFO 12 ASCII String + * @fif014: FIFO 13 ASCII String + * @fif015: FIFO 14 ASCII String + * @fif016: FIFO 15 ASCII String + * @reserved3: reserved + */ +struct __attribute__((__packed__)) telemetry_str_log_format { + __u8 log_page_version; + __u8 reserved1[15]; + __u8 log_page_guid[C9_GUID_LENGTH]; + __le64 sls; + __u8 reserved2[24]; + __le64 sits; + __le64 sitsz; + __le64 ests; + __le64 estsz; + __le64 vu_eve_sts; + __le64 vu_eve_st_sz; + __le64 ascts; + __le64 asctsz; + __u8 fifo1[16]; + __u8 fifo2[16]; + __u8 fifo3[16]; + __u8 fifo4[16]; + __u8 fifo5[16]; + __u8 fifo6[16]; + __u8 fifo7[16]; + __u8 fifo8[16]; + __u8 fifo9[16]; + __u8 fifo10[16]; + __u8 fifo11[16]; + __u8 fifo12[16]; + __u8 fifo13[16]; + __u8 fifo14[16]; + __u8 fifo15[16]; + __u8 fifo16[16]; + __u8 reserved3[48]; +}; + +/* + * struct statistics_id_str_table_entry - Statistics Identifier String Table Entry + * @vs_si: Shall be set the Vendor Unique Statistic Identifier number. + * @reserved1: Reserved + * @ascii_id_len: Shall be set the number of ASCII Characters that are valid. + * @ascii_id_ofst: Shall be set to the offset from DWORD 0/Byte 0 of the Start + * of the ASCII Table to the first character of the string for + * this Statistic Identifier string.. + * @reserved2 reserved + */ +struct __attribute__((__packed__)) statistics_id_str_table_entry { + __le16 vs_si; + __u8 reserved1; + __u8 ascii_id_len; + __le64 ascii_id_ofst; + __le32 reserved2; +}; + +/* + * struct event_id_str_table_entry - Event Identifier String Table Entry + * @deb_eve_class: Shall be set the Debug Class. + * @ei: Shall be set to the Event Identifier + * @ascii_id_len: Shall be set the number of ASCII Characters that are valid. + * @ascii_id_ofst: This is the offset from DWORD 0/ Byte 0 of the start of the + * ASCII table to the ASCII data for this identifier + * @reserved2 reserved + */ +struct __attribute__((__packed__)) event_id_str_table_entry { + __u8 deb_eve_class; + __le16 ei; + __u8 ascii_id_len; + __le64 ascii_id_ofst; + __le32 reserved2; +}; + +/* + * struct vu_event_id_str_table_entry - VU Event Identifier String Table Entry + * @deb_eve_class: Shall be set the Debug Class. + * @vu_ei: Shall be set to the VU Event Identifier + * @ascii_id_len: Shall be set the number of ASCII Characters that are valid. + * @ascii_id_ofst: This is the offset from DWORD 0/ Byte 0 of the start of the + * ASCII table to the ASCII data for this identifier + * @reserved reserved + */ +struct __attribute__((__packed__)) vu_event_id_str_table_entry { + __u8 deb_eve_class; + __le16 vu_ei; + __u8 ascii_id_len; + __le64 ascii_id_ofst; + __le32 reserved; +}; + +/* Function declaration for Telemetry String Log Format (LID:C9h) */ +static int ocp_telemetry_str_log_format(int argc, char **argv, struct command *cmd, + struct plugin *plugin); -static const __u8 OCP_FID_CLEAR_PCIE_CORRECTABLE_ERROR_COUNTERS = 0xC3; + +static int ocp_print_C9_log_normal(struct telemetry_str_log_format *log_data,__u8 *log_data_buf) +{ + //calculating the index value for array + __le64 stat_id_index = (log_data->sitsz * 4) / 16; + __le64 eve_id_index = (log_data->estsz * 4) / 16; + __le64 vu_eve_index = (log_data->vu_eve_st_sz * 4) / 16; + __le64 ascii_table_index = (log_data->asctsz * 4); + //Calculating the offset for dynamic fields. + __le64 stat_id_str_table_ofst = C9_TELEMETRY_STR_LOG_SIST_OFST + (log_data->sitsz * 4); + __le64 event_str_table_ofst = stat_id_str_table_ofst + (log_data->estsz * 4); + __le64 vu_event_str_table_ofst = event_str_table_ofst + (log_data->vu_eve_st_sz * 4); + __le64 ascii_table_ofst = vu_event_str_table_ofst + (log_data->asctsz * 4); + struct statistics_id_str_table_entry stat_id_str_table_arr[stat_id_index]; + struct event_id_str_table_entry event_id_str_table_arr[eve_id_index]; + struct vu_event_id_str_table_entry vu_event_id_str_table_arr[vu_eve_index]; + __u8 ascii_table_info_arr[ascii_table_index]; + int j; + + printf(" Log Page Version : 0x%x\n", log_data->log_page_version); + + printf(" Reserved : "); + for (j = 0; j < 15; j++) + printf("%d", log_data->reserved1[j]); + printf("\n"); + + printf(" Log page GUID : 0x"); + for (j = C9_GUID_LENGTH - 1; j >= 0; j--) + printf("%x", log_data->log_page_guid[j]); + printf("\n"); + + printf(" Telemetry String Log Size : 0x%lx\n", le64_to_cpu(log_data->sls)); + + printf(" Reserved : "); + for (j = 0; j < 24; j++) + printf("%d", log_data->reserved2[j]); + printf("\n"); + + printf(" Statistics Identifier String Table Start : 0x%lx\n", le64_to_cpu(log_data->sits)); + printf(" Statistics Identifier String Table Size : 0x%lx\n", le64_to_cpu(log_data->sitsz)); + printf(" Event String Table Start : 0x%lx\n", le64_to_cpu(log_data->ests)); + printf(" Event String Table Size : 0x%lx\n", le64_to_cpu(log_data->estsz)); + printf(" VU Event String Table Start : 0x%lx\n", le64_to_cpu(log_data->vu_eve_sts)); + printf(" VU Event String Table Size : 0x%lx\n", le64_to_cpu(log_data->vu_eve_st_sz)); + printf(" ASCII Table Start : 0x%lx\n", le64_to_cpu(log_data->ascts)); + printf(" ASCII Table Size : 0x%lx\n", le64_to_cpu(log_data->asctsz)); + + printf(" FIFO 1 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo1[j], log_data->fifo1[j]); + } + + printf(" FIFO 2 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo2[j], log_data->fifo2[j]); + } + + printf(" FIFO 3 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo3[j], log_data->fifo3[j]); + } + + printf(" FIFO 4 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + + printf(" %d %d %c \n", j, log_data->fifo4[j], log_data->fifo4[j]); + } + + printf(" FIFO 5 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo5[j], log_data->fifo5[j]); + } + + printf(" FIFO 6 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo6[j], log_data->fifo6[j]); + } + + printf(" FIFO 7 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo7[j], log_data->fifo7[j]); + } + + printf(" FIFO 8 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf("index value ascii_val"); + printf(" %d %d %c \n", j, log_data->fifo8[j], log_data->fifo8[j]); + } + + printf(" FIFO 9 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo9[j], log_data->fifo9[j]); + } + + printf(" FIFO 10 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo10[j], log_data->fifo10[j]); + } + + printf(" FIFO 11 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo11[j], log_data->fifo11[j]); + } + + printf(" FIFO 12 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo12[j], log_data->fifo12[j]); + } + + printf(" FIFO 13 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo13[j], log_data->fifo13[j]); + } + + printf(" FIFO 14 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo14[j], log_data->fifo14[j]); + } + + printf(" FIFO 15 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo15[j], log_data->fifo16[j]); + } + + printf(" FIFO 16 ASCII String\n"); + printf(" index value ascii_val\n"); + for (j = 0; j < 16; j++){ + printf(" %d %d %c \n", j, log_data->fifo16[j], log_data->fifo16[j]); + } + + printf(" Reserved : "); + for (j = 0; j < 48; j++) + printf("%d", log_data->reserved3[j]); + printf("\n"); + + memcpy(stat_id_str_table_arr, (__u8*)log_data_buf + stat_id_str_table_ofst, (log_data->sitsz * 4)); + memcpy(event_id_str_table_arr, (__u8*)log_data_buf + event_str_table_ofst, (log_data->estsz * 4)); + memcpy(vu_event_id_str_table_arr, (__u8*)log_data_buf + vu_event_str_table_ofst, (log_data->vu_eve_st_sz * 4)); + memcpy(ascii_table_info_arr, (__u8*)log_data_buf + ascii_table_ofst, (log_data->asctsz * 4)); + + printf(" Statistics Identifier String Table\n"); + for (j = 0; j < stat_id_index; j++){ + printf(" Vendor Specific Statistic Identifier : 0x%x\n",le16_to_cpu(stat_id_str_table_arr[j].vs_si)); + printf(" Reserved : 0x%d",stat_id_str_table_arr[j].reserved1); + printf(" ASCII ID Length : 0x%x\n",stat_id_str_table_arr[j].ascii_id_len); + printf(" ASCII ID offset : 0x%lx\n",le64_to_cpu(stat_id_str_table_arr[j].ascii_id_ofst)); + printf(" Reserved : 0x%d\n",stat_id_str_table_arr[j].reserved2); + } + + printf(" Event Identifier String Table Entry\n"); + for (j = 0; j < eve_id_index; j++){ + printf(" Debug Event Class : 0x%x\n",event_id_str_table_arr[j].deb_eve_class); + printf(" Event Identifier : 0x%x\n",le16_to_cpu(event_id_str_table_arr[j].ei)); + printf(" ASCII ID Length : 0x%x\n",event_id_str_table_arr[j].ascii_id_len); + printf(" ASCII ID offset : 0x%lx\n",le64_to_cpu(event_id_str_table_arr[j].ascii_id_ofst)); + printf(" Reserved : 0x%d\n",event_id_str_table_arr[j].reserved2); + + } + + printf(" VU Event Identifier String Table Entry\n"); + for (j = 0; j < vu_eve_index; j++){ + printf(" Debug Event Class : 0x%x\n",vu_event_id_str_table_arr[j].deb_eve_class); + printf(" VU Event Identifier : 0x%x\n",le16_to_cpu(vu_event_id_str_table_arr[j].vu_ei)); + printf(" ASCII ID Length : 0x%x\n",vu_event_id_str_table_arr[j].ascii_id_len); + printf(" ASCII ID offset : 0x%lx\n",le64_to_cpu(vu_event_id_str_table_arr[j].ascii_id_ofst)); + printf(" Reserved : 0x%d\n",vu_event_id_str_table_arr[j].reserved); + + } + + printf(" ASCII Table\n"); + printf(" Byte Data_Byte ASCII_Character\n"); + for (j = 0; j < ascii_table_index; j++){ + printf(" %lld 0x%x %c \n",ascii_table_ofst+j,ascii_table_info_arr[j],ascii_table_info_arr[j]); + } + return 0; +} + +static int ocp_print_C9_log_json(struct telemetry_str_log_format *log_data,__u8 *log_data_buf) +{ + struct json_object *root = json_create_object(); + struct json_object *stat_table = json_create_object(); + struct json_object *eve_table = json_create_object(); + struct json_object *vu_eve_table = json_create_object(); + struct json_object *entry = json_create_object(); + char res_arr[48]; + char *res = res_arr; + char guid_buf[C9_GUID_LENGTH]; + char *guid = guid_buf; + char fifo_arr[16]; + char *fifo = fifo_arr; + //calculating the index value for array + __le64 stat_id_index = (log_data->sitsz * 4) / 16; + __le64 eve_id_index = (log_data->estsz * 4) / 16; + __le64 vu_eve_index = (log_data->vu_eve_st_sz * 4) / 16; + __le64 ascii_table_index = (log_data->asctsz * 4); + //Calculating the offset for dynamic fields. + __le64 stat_id_str_table_ofst = C9_TELEMETRY_STR_LOG_SIST_OFST + (log_data->sitsz * 4); + __le64 event_str_table_ofst = stat_id_str_table_ofst + (log_data->estsz * 4); + __le64 vu_event_str_table_ofst = event_str_table_ofst + (log_data->vu_eve_st_sz * 4); + __le64 ascii_table_ofst = vu_event_str_table_ofst + (log_data->asctsz * 4); + struct statistics_id_str_table_entry stat_id_str_table_arr[stat_id_index]; + struct event_id_str_table_entry event_id_str_table_arr[eve_id_index]; + struct vu_event_id_str_table_entry vu_event_id_str_table_arr[vu_eve_index]; + __u8 ascii_table_info_arr[ascii_table_index]; + char ascii_buf[ascii_table_index]; + char *ascii = ascii_buf; + int j; + + json_object_add_value_int(root, "Log Page Version", le16_to_cpu(log_data->log_page_version)); + + memset((__u8 *)res, 0, 15); + for (j = 0; j < 15; j++) + res += sprintf(res, "%d", log_data->reserved1[j]); + json_object_add_value_string(root, "Reserved", res_arr); + + memset((void *)guid, 0, C9_GUID_LENGTH); + for (j = C9_GUID_LENGTH - 1; j >= 0; j--) + guid += sprintf(guid, "%02x", log_data->log_page_guid[j]); + json_object_add_value_string(root, "Log page GUID", guid_buf); + + json_object_add_value_int(root, "Telemetry String Log Size", le64_to_cpu(log_data->sls)); + + memset((__u8 *)res, 0, 24); + for (j = 0; j < 24; j++) + res += sprintf(res, "%d", log_data->reserved2[j]); + json_object_add_value_string(root, "Reserved", res_arr); + + json_object_add_value_int(root, "Statistics Identifier String Table Start", le64_to_cpu(log_data->sits)); + json_object_add_value_int(root, "Event String Table Start", le64_to_cpu(log_data->ests)); + json_object_add_value_int(root, "Event String Table Size", le64_to_cpu(log_data->estsz)); + json_object_add_value_int(root, "VU Event String Table Start", le64_to_cpu(log_data->vu_eve_sts)); + json_object_add_value_int(root, "VU Event String Table Size", le64_to_cpu(log_data->vu_eve_st_sz)); + json_object_add_value_int(root, "ASCII Table Start", le64_to_cpu(log_data->ascts)); + json_object_add_value_int(root, "ASCII Table Size", le64_to_cpu(log_data->asctsz)); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo1[j]); + json_object_add_value_string(root, "FIFO 1 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo2[j]); + json_object_add_value_string(root, "FIFO 2 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo3[j]); + json_object_add_value_string(root, "FIFO 3 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo4[j]); + json_object_add_value_string(root, "FIFO 4 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo5[j]); + json_object_add_value_string(root, "FIFO 5 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo6[j]); + json_object_add_value_string(root, "FIFO 6 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo7[j]); + json_object_add_value_string(root, "FIFO 7 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo8[j]); + json_object_add_value_string(root, "FIFO 8 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo9[j]); + json_object_add_value_string(root, "FIFO 9 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo10[j]); + json_object_add_value_string(root, "FIFO 10 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo11[j]); + json_object_add_value_string(root, "FIFO 11 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo12[j]); + json_object_add_value_string(root, "FIFO 12 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo13[j]); + json_object_add_value_string(root, "FIFO 13 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo14[j]); + json_object_add_value_string(root, "FIFO 14 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo15[j]); + json_object_add_value_string(root, "FIFO 15 ASCII String", fifo_arr); + + memset((void *)fifo, 0, 16); + for (j = 0; j < 16; j++) + fifo += sprintf(fifo, "%c", log_data->fifo16[j]); + json_object_add_value_string(root, "FIFO 16 ASCII String", fifo_arr); + + memset((__u8 *)res, 0, 48); + for (j = 0; j < 48; j++) + res += sprintf(res, "%d", log_data->reserved3[j]); + json_object_add_value_string(root, "Reserved", res_arr); + + memcpy(stat_id_str_table_arr, (__u8*)log_data_buf + stat_id_str_table_ofst, (log_data->sitsz * 4)); + memcpy(event_id_str_table_arr, (__u8*)log_data_buf + event_str_table_ofst, (log_data->estsz * 4)); + memcpy(vu_event_id_str_table_arr, (__u8*)log_data_buf + vu_event_str_table_ofst, (log_data->vu_eve_st_sz * 4)); + memcpy(ascii_table_info_arr, (__u8*)log_data_buf + ascii_table_ofst, (log_data->asctsz * 4)); + + for (j = 0; j < stat_id_index; j++){ + json_object_add_value_int(entry, "Vendor Specific Statistic Identifier", le16_to_cpu(stat_id_str_table_arr[j].vs_si)); + json_object_add_value_int(entry, "Reserved", le64_to_cpu(stat_id_str_table_arr[j].reserved1)); + json_object_add_value_int(entry, "ASCII ID Length", le64_to_cpu(stat_id_str_table_arr[j].ascii_id_len)); + json_object_add_value_int(entry, "ASCII ID offset", le64_to_cpu(stat_id_str_table_arr[j].ascii_id_ofst)); + json_object_add_value_int(entry, "Reserved", le64_to_cpu(stat_id_str_table_arr[j].reserved2)); + json_array_add_value_object(stat_table, entry); + } + json_object_add_value_array(root, "Statistics Identifier String Table", stat_table); + + for (j = 0; j < eve_id_index; j++){ + json_object_add_value_int(entry, "Debug Event Class", le16_to_cpu(event_id_str_table_arr[j].deb_eve_class)); + json_object_add_value_int(entry, "Event Identifier", le16_to_cpu(event_id_str_table_arr[j].ei)); + json_object_add_value_int(entry, "ASCII ID Length", le64_to_cpu(event_id_str_table_arr[j].ascii_id_len)); + json_object_add_value_int(entry, "ASCII ID offset", le64_to_cpu(event_id_str_table_arr[j].ascii_id_ofst)); + json_object_add_value_int(entry, "Reserved", le64_to_cpu(event_id_str_table_arr[j].reserved2)); + json_array_add_value_object(eve_table, entry); + } + json_object_add_value_array(root, "Event Identifier String Table Entry", eve_table); + + for (j = 0; j < vu_eve_index; j++){ + json_object_add_value_int(entry, "Debug Event Class", le16_to_cpu(vu_event_id_str_table_arr[j].deb_eve_class)); + json_object_add_value_int(entry, "VU Event Identifier", le16_to_cpu(vu_event_id_str_table_arr[j].vu_ei)); + json_object_add_value_int(entry, "ASCII ID Length", le64_to_cpu(vu_event_id_str_table_arr[j].ascii_id_len)); + json_object_add_value_int(entry, "ASCII ID offset", le64_to_cpu(vu_event_id_str_table_arr[j].ascii_id_ofst)); + json_object_add_value_int(entry, "Reserved", le64_to_cpu(vu_event_id_str_table_arr[j].reserved)); + json_array_add_value_object(vu_eve_table, entry); + } + json_object_add_value_array(root, "VU Event Identifier String Table Entry", vu_eve_table); + + memset((void *)ascii, 0, ascii_table_index); + for (j = 0; j < ascii_table_index; j++) + ascii += sprintf(ascii, "%c", ascii_table_info_arr[j]); + json_object_add_value_string(root, "ASCII Table", ascii_buf); + + json_print_object(root, NULL); + printf("\n"); + json_free_object(root); + json_free_object(stat_table); + json_free_object(eve_table); + json_free_object(vu_eve_table); + + return 0; +} + +static void ocp_print_c9_log_binary(__u8 *log_data_buf,int total_log_page_size) +{ + return d_raw((unsigned char *)log_data_buf, total_log_page_size); +} + +static int get_c9_log_page(struct nvme_dev *dev, char *format) +{ + int ret = 0; + __u8 *header_data; + struct telemetry_str_log_format *log_data; + enum nvme_print_flags fmt; + __u8 *full_log_buf_data = NULL; + __le64 stat_id_str_table_ofst = 0; + __le64 event_str_table_ofst = 0; + __le64 vu_event_str_table_ofst = 0; + __le64 ascii_table_ofst = 0; + __le64 total_log_page_sz = 0; + + ret = validate_output_format(format, &fmt); + if (ret < 0) { + fprintf(stderr, "ERROR : OCP : invalid output format\n"); + return ret; + } + + header_data = (__u8 *)malloc(sizeof(__u8) * C9_TELEMETRY_STR_LOG_LEN); + if (!header_data) { + fprintf(stderr, "ERROR : OCP : malloc : %s\n", strerror(errno)); + return -1; + } + memset(header_data, 0, sizeof(__u8) * C9_TELEMETRY_STR_LOG_LEN); + + ret = nvme_get_log_simple(dev_fd(dev), C9_TELEMETRY_STRING_LOG_ENABLE_OPCODE, + C9_TELEMETRY_STR_LOG_LEN, header_data); + + if (!ret) { + log_data = (struct telemetry_str_log_format *)header_data; + printf("Statistics Identifier String Table Size = %lld\n",log_data->sitsz); + printf("Event String Table Size = %lld\n",log_data->estsz); + printf("VU Event String Table Size = %lld\n",log_data->vu_eve_st_sz); + printf("ASCII Table Size = %lld\n",log_data->asctsz); + + //Calculating the offset for dynamic fields. + stat_id_str_table_ofst = C9_TELEMETRY_STR_LOG_SIST_OFST + (log_data->sitsz * 4); + event_str_table_ofst = stat_id_str_table_ofst + (log_data->estsz * 4); + vu_event_str_table_ofst = event_str_table_ofst + (log_data->vu_eve_st_sz * 4); + ascii_table_ofst = vu_event_str_table_ofst + (log_data->asctsz * 4); + total_log_page_sz = stat_id_str_table_ofst + event_str_table_ofst + vu_event_str_table_ofst + ascii_table_ofst; + + printf("stat_id_str_table_ofst = %lld\n",stat_id_str_table_ofst); + printf("event_str_table_ofst = %lld\n",event_str_table_ofst); + printf("vu_event_str_table_ofst = %lld\n",vu_event_str_table_ofst); + printf("ascii_table_ofst = %lld\n",ascii_table_ofst); + printf("total_log_page_sz = %lld\n",total_log_page_sz); + + full_log_buf_data = (__u8 *)malloc(sizeof(__u8) * total_log_page_sz); + if (!full_log_buf_data) { + fprintf(stderr, "ERROR : OCP : malloc : %s\n", strerror(errno)); + return -1; + } + memset(full_log_buf_data, 0, sizeof(__u8) * total_log_page_sz); + + ret = nvme_get_log_simple(dev_fd(dev), C9_TELEMETRY_STRING_LOG_ENABLE_OPCODE, + total_log_page_sz, full_log_buf_data); + + if (!ret) { + switch (fmt) { + case NORMAL: + ocp_print_C9_log_normal(log_data,full_log_buf_data); + break; + case JSON: + ocp_print_C9_log_json(log_data,full_log_buf_data); + break; + case BINARY: + ocp_print_c9_log_binary(full_log_buf_data,total_log_page_sz); + break; + default: + fprintf(stderr, "unhandled output format\n"); + break; + } + } else{ + fprintf(stderr, "ERROR : OCP : Unable to read C9 data from buffer\n"); + } + } else { + fprintf(stderr, "ERROR : OCP : Unable to read C9 data from buffer\n"); + } + + free(header_data); + free(full_log_buf_data); + + return ret; +} + +static int ocp_telemetry_str_log_format(int argc, char **argv, struct command *cmd, + struct plugin *plugin) +{ + struct nvme_dev *dev; + int ret = 0; + const char *desc = "Retrieve telemetry string log format"; + + struct config { + char *output_format; + }; + + struct config cfg = { + .output_format = "normal", + }; + + OPT_ARGS(opts) = { + OPT_FMT("output-format", 'o', &cfg.output_format, "output Format: normal|json"), + OPT_END() + }; + + ret = parse_and_open(&dev, argc, argv, desc, opts); + if (ret) + return ret; + + ret = get_c9_log_page(dev, cfg.output_format); + if (ret) + fprintf(stderr, "ERROR : OCP : Failure reading the C9 Log Page, ret = %d\n", ret); + + dev_close(dev); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +/// Misc static int clear_fw_update_history(int argc, char **argv, struct command *cmd, struct plugin *plugin) @@ -1883,14 +2958,10 @@ static int smart_add_log(int argc, char **argv, struct command *cmd, return ocp_smart_add_log(argc, argv, cmd, plugin); } -static int clear_pcie_corectable_error_counters(int argc, char **argv, - struct command *cmd, +static int clear_pcie_correctable_error_counters(int argc, char **argv, struct command *cmd, struct plugin *plugin) { - const char *desc = "OCP Clear PCIe Correctable Error Counters"; - - return ocp_clear_feature(argc, argv, desc, - OCP_FID_CLEAR_PCIE_CORRECTABLE_ERROR_COUNTERS); + return ocp_clear_pcie_correctable_errors(argc, argv, cmd, plugin); } static int fw_activation_history_log(int argc, char **argv, struct command *cmd, diff --git a/plugins/ocp/ocp-nvme.h b/plugins/ocp/ocp-nvme.h index 74dd0ef..95539b0 100644 --- a/plugins/ocp/ocp-nvme.h +++ b/plugins/ocp/ocp-nvme.h @@ -21,11 +21,15 @@ PLUGIN(NAME("ocp", "OCP cloud SSD extensions", NVME_VERSION), ENTRY("internal-log", "Retrieve and save internal device telemetry log", ocp_telemetry_log) ENTRY("clear-fw-activate-history", "Clear firmware update history log", clear_fw_update_history) ENTRY("eol-plp-failure-mode", "Define EOL or PLP circuitry failure mode.", eol_plp_failure_mode) - ENTRY("clear-pcie-correctable-error-counters", "Clear PCIe correctable error counters", clear_pcie_corectable_error_counters) - ENTRY("vs-fw-activate-history", "Get firmware activation history log", fw_activation_history_log) + ENTRY("clear-pcie-correctable-errors", "Clear PCIe correctable error counters", clear_pcie_correctable_error_counters) + ENTRY("fw-activate-history", "Get firmware activation history log", fw_activation_history_log) ENTRY("unsupported-reqs-log", "Get Unsupported Requirements Log Page", ocp_unsupported_requirements_log) ENTRY("error-recovery-log", "Retrieve Error Recovery Log Page", ocp_error_recovery_log) ENTRY("device-capability-log", "Get Device capabilities Requirements Log Page", ocp_device_capabilities_log) + ENTRY("set-dssd-power-state-feature", "Get Device capabilities Requirements Log Page", set_dssd_power_state_feature) + ENTRY("set-plp-health-check-interval", "Set PLP Health Check Interval", set_plp_health_check_interval) + ENTRY("get-plp-health-check-interval", "Get PLP Health Check Interval", get_plp_health_check_interval) + ENTRY("telemetry-string-log", "Retrieve Telemetry string Log Page", ocp_telemetry_str_log_format) ) ); diff --git a/plugins/ocp/ocp-smart-extended-log.c b/plugins/ocp/ocp-smart-extended-log.c index c989d34..0d8ba81 100644 --- a/plugins/ocp/ocp-smart-extended-log.c +++ b/plugins/ocp/ocp-smart-extended-log.c @@ -252,15 +252,15 @@ static void ocp_print_C0_log_json(void *data) static int get_c0_log_page(int fd, char *format) { + enum nvme_print_flags fmt; __u8 *data; int i; - int ret = 0; - int fmt = -1; + int ret; - fmt = validate_output_format(format); - if (fmt < 0) { + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR : OCP : invalid output format\n"); - return fmt; + return ret; } data = malloc(sizeof(__u8) * C0_SMART_CLOUD_ATTR_LEN); @@ -307,6 +307,8 @@ static int get_c0_log_page(int fd, char *format) case JSON: ocp_print_C0_log_json(data); break; + default: + break; } } else { fprintf(stderr, "ERROR : OCP : Unable to read C0 data from buffer\n"); diff --git a/plugins/ocp/ocp-utils.c b/plugins/ocp/ocp-utils.c index a37a58c..1257b30 100644 --- a/plugins/ocp/ocp-utils.c +++ b/plugins/ocp/ocp-utils.c @@ -30,66 +30,3 @@ int ocp_get_uuid_index(struct nvme_dev *dev, int *index) } return err; } - -int ocp_clear_feature(int argc, char **argv, const char *desc, const __u8 fid) -{ - __u32 result = 0; - __u32 clear = 1 << 31; - struct nvme_dev *dev; - int uuid_index = 0; - bool uuid = true; - int err; - - OPT_ARGS(opts) = { - OPT_FLAG("no-uuid", 'n', NULL, - "Skip UUID index search (UUID index not required for OCP 1.0)"), - OPT_END() - }; - - err = parse_and_open(&dev, argc, argv, desc, opts); - if (err) - return err; - - if (opts[0].seen) - uuid = false; - - if (uuid) { - /* OCP 2.0 requires UUID index support */ - err = ocp_get_uuid_index(dev, &uuid_index); - if (err || !uuid_index) { - fprintf(stderr, "ERROR: No OCP UUID index found\n"); - goto close_dev; - } - } - - struct nvme_set_features_args args = { - .result = &result, - .data = NULL, - .args_size = sizeof(args), - .fd = dev_fd(dev), - .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, - .nsid = 0, - .cdw11 = clear, - .cdw12 = 0, - .cdw13 = 0, - .cdw15 = 0, - .data_len = 0, - .save = 0, - .uuidx = uuid_index, - .fid = fid, - }; - - err = nvme_set_features(&args); - - if (err == 0) - printf("Success : %s\n", desc); - else if (err > 0) - nvme_show_status(err); - else - printf("Fail : %s\n", desc); -close_dev: - /* Redundant close() to make static code analysis happy */ - close(dev->direct.fd); - dev_close(dev); - return err; -} diff --git a/plugins/ocp/ocp-utils.h b/plugins/ocp/ocp-utils.h index a962169..d02bea9 100644 --- a/plugins/ocp/ocp-utils.h +++ b/plugins/ocp/ocp-utils.h @@ -10,11 +10,9 @@ /** * ocp_get_uuid_index() - Get OCP UUID index * @dev: nvme device - * @index: integer ponter to here to save the index + * @index: integer pointer to here to save the index * @result: The command completion result from CQE dword0 * * Return: Zero if nvme device has UUID list log page, or result of get uuid list otherwise. */ int ocp_get_uuid_index(struct nvme_dev *dev, int *index); - -int ocp_clear_feature(int argc, char **argv, const char *desc, const __u8 fid); diff --git a/plugins/scaleflux/sfx-nvme.c b/plugins/scaleflux/sfx-nvme.c index 01867c7..f752d5d 100644 --- a/plugins/scaleflux/sfx-nvme.c +++ b/plugins/scaleflux/sfx-nvme.c @@ -21,6 +21,7 @@ #include "linux/types.h" #include "nvme-wrap.h" #include "nvme-print.h" +#include "util/cleanup.h" #define CREATE_CMD #include "sfx-nvme.h" @@ -881,7 +882,7 @@ static int change_sanity_check(int fd, __u64 trg_in_4k, int *shrink) if (trg_in_4k < provisoned_cap_4k || trg_in_4k > ((__u64)provisoned_cap_4k * 4)) { fprintf(stderr, - "WARNING: Only support 1.0~4.0 x provisoned capacity!\n"); + "WARNING: Only support 1.0~4.0 x provisioned capacity!\n"); if (trg_in_4k < provisoned_cap_4k) fprintf(stderr, "WARNING: The target capacity is less than 1.0 x provisioned capacity!\n"); @@ -924,7 +925,7 @@ static int change_sanity_check(int fd, __u64 trg_in_4k, int *shrink) * * @param str, prompt string * - * @return 0, cancled; 1 confirmed + * @return 0, canceled; 1 confirmed */ static int sfx_confirm_change(const char *str) { @@ -936,7 +937,7 @@ static int sfx_confirm_change(const char *str) fprintf(stderr, "Confirm Y/y, Others cancel:\n"); confirm = (unsigned char)fgetc(stdin); if (confirm != 'y' && confirm != 'Y') { - fprintf(stderr, "Cancled.\n"); + fprintf(stderr, "Canceled.\n"); return 0; } fprintf(stderr, "Sending operation ...\n"); @@ -1349,12 +1350,12 @@ static int nvme_dump_evtlog(struct nvme_dev *dev, __u32 namespace_id, __u32 stor { struct nvme_persistent_event_log *pevent; void *pevent_log_info; + _cleanup_huge_ struct nvme_mem_huge mh = { 0, }; __u8 lsp_base; __u32 offset = 0; __u32 length = 0; __u32 log_len; __u32 single_len; - bool huge; int err = 0; FILE *fd = NULL; struct nvme_get_log_args args = { @@ -1410,7 +1411,7 @@ static int nvme_dump_evtlog(struct nvme_dev *dev, __u32 namespace_id, __u32 stor if (log_len % 4) log_len = (log_len / 4 + 1) * 4; - pevent_log_info = nvme_alloc(single_len, &huge); + pevent_log_info = nvme_alloc_huge(single_len, &mh); if (!pevent_log_info) { err = -ENOMEM; goto free_pevent; @@ -1420,7 +1421,7 @@ static int nvme_dump_evtlog(struct nvme_dev *dev, __u32 namespace_id, __u32 stor if (!fd) { fprintf(stderr, "Failed to open %s file to write\n", file); err = ENOENT; - goto free; + goto free_pevent; } args.lsp = lsp_base + NVME_PEVENT_LOG_READ; @@ -1453,8 +1454,8 @@ static int nvme_dump_evtlog(struct nvme_dev *dev, __u32 namespace_id, __u32 stor printf("\nDump-evtlog: Success\n"); if (parse) { - nvme_free(pevent_log_info, huge); - pevent_log_info = nvme_alloc(log_len, &huge); + nvme_free_huge(&mh); + pevent_log_info = nvme_alloc_huge(log_len, &mh); if (!pevent_log_info) { fprintf(stderr, "Failed to alloc enough memory 0x%x to parse evtlog\n", log_len); err = -ENOMEM; @@ -1466,7 +1467,7 @@ static int nvme_dump_evtlog(struct nvme_dev *dev, __u32 namespace_id, __u32 stor if (!fd) { fprintf(stderr, "Failed to open %s file to read\n", file); err = ENOENT; - goto free; + goto free_pevent; } if (fread(pevent_log_info, 1, log_len, fd) != log_len) { fprintf(stderr, "Failed to read evtlog to buffer\n"); @@ -1478,8 +1479,6 @@ static int nvme_dump_evtlog(struct nvme_dev *dev, __u32 namespace_id, __u32 stor close_fd: fclose(fd); -free: - nvme_free(pevent_log_info, huge); free_pevent: free(pevent); ret: diff --git a/plugins/seagate/seagate-nvme.c b/plugins/seagate/seagate-nvme.c index 0f4f59d..887e5bc 100644 --- a/plugins/seagate/seagate-nvme.c +++ b/plugins/seagate/seagate-nvme.c @@ -926,7 +926,7 @@ static int vs_smart_log(int argc, char **argv, struct command *cmd, struct plugi /** * Here we should identify if the drive is a Panthor or Jaguar. * Here we need to extract the model no from ctrl-id abd use it - * to deternine drive family. + * to determine drive family. */ err = nvme_identify_ctrl(dev_fd(dev), &ctrl); @@ -1299,7 +1299,7 @@ static void print_stx_vs_fw_activate_history(stx_fw_activ_history_log_page fwAct char buf[80]; if (fwActivHis.numValidFwActHisEnt > 0) { - printf("\n\nSeagate FW Activation Histry :\n"); + printf("\n\nSeagate FW Activation History :\n"); printf("%-9s %-21s %-7s %-13s %-9s %-5s %-15s %-9s\n", "Counter ", " Timestamp ", " PCC ", "Previous FW ", "New FW ", "Slot", "Commit Action", "Result"); for (i = 0; i < fwActivHis.numValidFwActHisEnt; i++) { @@ -1406,7 +1406,7 @@ static int stx_vs_fw_activate_history(int argc, char **argv, struct command *cmd } if (strcmp(cfg.output_format, "json")) - printf("Seagate FW Activation Histry Information :\n"); + printf("Seagate FW Activation History Information :\n"); err = nvme_get_log_simple(dev_fd(dev), 0xC2, sizeof(fwActivHis), &fwActivHis); if (!err) { diff --git a/plugins/solidigm/meson.build b/plugins/solidigm/meson.build index 84495a1..052afa1 100644 --- a/plugins/solidigm/meson.build +++ b/plugins/solidigm/meson.build @@ -8,6 +8,9 @@ sources += [ 'plugins/solidigm/solidigm-telemetry.c', 'plugins/solidigm/solidigm-internal-logs.c', 'plugins/solidigm/solidigm-market-log.c', + 'plugins/solidigm/solidigm-temp-stats.c', + 'plugins/solidigm/solidigm-get-drive-info.c', + 'plugins/solidigm/solidigm-ocp-version.c', ] subdir('solidigm-telemetry') diff --git a/plugins/solidigm/solidigm-garbage-collection.c b/plugins/solidigm/solidigm-garbage-collection.c index b26d754..a37e9c5 100644 --- a/plugins/solidigm/solidigm-garbage-collection.c +++ b/plugins/solidigm/solidigm-garbage-collection.c @@ -68,6 +68,7 @@ static void vu_gc_log_show(struct garbage_control_collection_log *payload, const int solidigm_get_garbage_collection_log(int argc, char **argv, struct command *cmd, struct plugin *plugin) { const char *desc = "Get and parse Solidigm vendor specific garbage collection event log."; + enum nvme_print_flags flags; struct nvme_dev *dev; int err; __u8 uuid_index; @@ -89,9 +90,8 @@ int solidigm_get_garbage_collection_log(int argc, char **argv, struct command *c if (err) return err; - enum nvme_print_flags flags = validate_output_format(cfg.output_format); - - if (flags == -EINVAL) { + err = validate_output_format(cfg.output_format, &flags); + if (err) { fprintf(stderr, "Invalid output format '%s'\n", cfg.output_format); dev_close(dev); return -EINVAL; diff --git a/plugins/solidigm/solidigm-get-drive-info.c b/plugins/solidigm/solidigm-get-drive-info.c new file mode 100644 index 0000000..21f59bb --- /dev/null +++ b/plugins/solidigm/solidigm-get-drive-info.c @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2023 Solidigm. + * + * Authors: leonardo.da.cunha@solidigm.com + */ + +#include <errno.h> +#include "nvme-print.h" +#include "nvme-wrap.h" +#include "common.h" + +int sldgm_get_drive_info(int argc, char **argv, struct command *cmd, struct plugin *plugin) +{ + _cleanup_nvme_dev_ struct nvme_dev *dev = NULL; + const char *desc = "Get drive HW information"; + const char *FTL_unit_size_str = "FTL_unit_size"; + char *output_format = "normal"; + enum nvme_print_flags flags; + nvme_root_t r; + nvme_ctrl_t c; + nvme_ns_t n; + struct nvme_id_ns ns = { 0 }; + __u8 flbaf_inUse; + __u16 lba_size; + __u16 ftl_unit_size; + int err; + + OPT_ARGS(opts) = { + OPT_FMT("output-format", 'o', &output_format, "normal|json"), + OPT_END() + }; + + err = parse_and_open(&dev, argc, argv, desc, opts); + if (err) + return err; + + err = validate_output_format(output_format, &flags); + if ((err < 0) || !(flags == NORMAL || flags == JSON)) { + nvme_show_error("Invalid output format"); + return err; + } + + r = nvme_scan(NULL); + c = nvme_scan_ctrl(r, dev->name); + n = c ? nvme_ctrl_first_ns(c) : nvme_scan_namespace(dev->name); + if (!n) { + nvme_show_error("solidigm-vs-drive-info: drive missing namespace"); + return -EINVAL; + } + + err = nvme_ns_identify(n, &ns); + if (err) { + nvme_show_error("identify namespace: %s", nvme_strerror(errno)); + return err; + } + + if (!(ns.nsfeat & 0x10)) { + nvme_show_error("solidigm-vs-drive-info: performance options not available"); + return -EINVAL; + } + + nvme_id_ns_flbas_to_lbaf_inuse(ns.flbas, &flbaf_inUse); + lba_size = 1 << ns.lbaf[flbaf_inUse].ds; + ftl_unit_size = (le16_to_cpu(ns.npwg) + 1) * lba_size / 1024; + + if (flags == JSON) { + struct json_object *root = json_create_object(); + + json_object_add_value_int(root, FTL_unit_size_str, ftl_unit_size); + json_print_object(root, NULL); + printf("\n"); + json_free_object(root); + } else { + printf("%s: %d\n", FTL_unit_size_str, ftl_unit_size); + } + + return err; +} diff --git a/plugins/solidigm/solidigm-get-drive-info.h b/plugins/solidigm/solidigm-get-drive-info.h new file mode 100644 index 0000000..ffc1bd2 --- /dev/null +++ b/plugins/solidigm/solidigm-get-drive-info.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2023 Solidigm. + * + * Author: leonardo.da.cunha@solidigm.com + */ + +int sldgm_get_drive_info(int argc, char **argv, struct command *cmd, struct plugin *plugin); diff --git a/plugins/solidigm/solidigm-internal-logs.c b/plugins/solidigm/solidigm-internal-logs.c index 4730443..236652a 100644 --- a/plugins/solidigm/solidigm-internal-logs.c +++ b/plugins/solidigm/solidigm-internal-logs.c @@ -19,6 +19,7 @@ #include "libnvme.h" #include "plugin.h" #include "nvme-print.h" +#include "solidigm-util.h" #define DWORD_SIZE 4 @@ -427,7 +428,8 @@ static int dump_telemetry(struct nvme_dev *dev, struct config cfg, enum telemetr int err = 0, output; __u8 *buffer = NULL; size_t bytes_remaining = 0; - int data_area = NVME_TELEMETRY_DA_3; + enum nvme_telemetry_da da; + size_t max_data_tx; char file_path[PATH_MAX]; char *log_name; @@ -444,6 +446,12 @@ static int dump_telemetry(struct nvme_dev *dev, struct config cfg, enum telemetr default: return -EINVAL; } + err = nvme_get_telemetry_max(dev_fd(dev), &da, &max_data_tx); + if (err) + return err; + + if (max_data_tx > DRIVER_MAX_TX_256K) + max_data_tx = DRIVER_MAX_TX_256K; sprintf(file_path, "%s_%s.bin", cfg.file_prefix, log_name); output = open(file_path, O_WRONLY | O_CREAT | O_TRUNC, 0644); @@ -452,16 +460,16 @@ static int dump_telemetry(struct nvme_dev *dev, struct config cfg, enum telemetr switch (ttype) { case HOSTGENNEW: - err = nvme_get_new_host_telemetry(dev_fd(dev), &log, - data_area, &log_size); + err = nvme_get_telemetry_log(dev_fd(dev), true, false, false, max_data_tx, da, + &log, &log_size); break; case HOSTGENOLD: - err = nvme_get_host_telemetry(dev_fd(dev), &log, - data_area, &log_size); + err = nvme_get_telemetry_log(dev_fd(dev), false, false, false, max_data_tx, da, + &log, &log_size); break; case CONTROLLER: - err = nvme_get_ctrl_telemetry(dev_fd(dev), true, &log, - data_area, &log_size); + err = nvme_get_telemetry_log(dev_fd(dev), false, true, true, max_data_tx, da, &log, + &log_size); break; } @@ -546,42 +554,42 @@ int solidigm_get_internal_log(int argc, char **argv, struct command *command, if (err == 0) log_count++; else if (err < 0) - perror("Assert log"); + perror("Error retrieving Assert log"); } if (all || !strcmp(cfg.type, "EVENT")) { err = dump_event_logs(dev, cfg); if (err == 0) log_count++; else if (err < 0) - perror("Eventt log"); + perror("Error retrieving Event log"); } if (all || !strcmp(cfg.type, "NLOG")) { err = dump_nlogs(dev, cfg, -1); if (err == 0) log_count++; else if (err < 0) - perror("Nlog"); + perror("Error retrieving Nlog"); } if (all || !strcmp(cfg.type, "CONTROLLERINITTELEMETRY")) { err = dump_telemetry(dev, cfg, CONTROLLER); if (err == 0) log_count++; else if (err < 0) - perror("Telemetry Controller Initated"); + perror("Error retrieving Telemetry Controller Initiated"); } if (all || !strcmp(cfg.type, "HOSTINITTELEMETRYNOGEN")) { err = dump_telemetry(dev, cfg, HOSTGENOLD); if (err == 0) log_count++; else if (err < 0) - perror("Previously existing Telemetry Host Initated"); + perror("Error retrieving previously existing Telemetry Host Initiated"); } if (all || !strcmp(cfg.type, "HOSTINITTELEMETRY")) { err = dump_telemetry(dev, cfg, HOSTGENNEW); if (err == 0) log_count++; else if (err < 0) - perror("Telemetry Host Initated"); + perror("Error retrieving Telemetry Host Initiated"); } if (log_count == 0) { diff --git a/plugins/solidigm/solidigm-latency-tracking.c b/plugins/solidigm/solidigm-latency-tracking.c index 481a831..66f3c56 100644 --- a/plugins/solidigm/solidigm-latency-tracking.c +++ b/plugins/solidigm/solidigm-latency-tracking.c @@ -411,8 +411,8 @@ int solidigm_get_latency_tracking_log(int argc, char **argv, struct command *cmd lt.fd = dev_fd(dev); - lt.print_flags = validate_output_format(lt.cfg.output_format); - if (lt.print_flags == -EINVAL) { + err = validate_output_format(lt.cfg.output_format, <.print_flags); + if (err < 0) { fprintf(stderr, "Invalid output format '%s'\n", lt.cfg.output_format); dev_close(dev); return -EINVAL; diff --git a/plugins/solidigm/solidigm-log-page-dir.c b/plugins/solidigm/solidigm-log-page-dir.c index 111a433..bf272f8 100644 --- a/plugins/solidigm/solidigm-log-page-dir.c +++ b/plugins/solidigm/solidigm-log-page-dir.c @@ -100,38 +100,13 @@ static struct lid_dir *get_standard_lids(struct nvme_supported_log_pages *suppor static struct lid_dir standard_dir = { 0 }; init_lid_dir(&standard_dir); - standard_dir.lid[0x00].str = "Supported Log Pages"; - standard_dir.lid[0x01].str = "Error Information"; - standard_dir.lid[0x02].str = "SMART / Health Information"; - standard_dir.lid[0x03].str = "Firmware Slot Information"; - standard_dir.lid[0x04].str = "Changed Namespace List"; - standard_dir.lid[0x05].str = "Commands Supported and Effects"; - standard_dir.lid[0x06].str = "Device Self Test"; - standard_dir.lid[0x07].str = "Telemetry Host-Initiated"; - standard_dir.lid[0x08].str = "Telemetry Controller-Initiated"; - standard_dir.lid[0x09].str = "Endurance Group Information"; - standard_dir.lid[0x0A].str = "Predictable Latency Per NVM Set"; - standard_dir.lid[0x0B].str = "Predictable Latency Event Aggregate"; - standard_dir.lid[0x0C].str = "Asymmetric Namespace Access"; - standard_dir.lid[0x0D].str = "Persistent Event Log"; - standard_dir.lid[0x0E].str = "Predictable Latency Event Aggregate"; - standard_dir.lid[0x0F].str = "Endurance Group Event Aggregate"; - standard_dir.lid[0x10].str = "Media Unit Status"; - standard_dir.lid[0x11].str = "Supported Capacity Configuration List"; - standard_dir.lid[0x12].str = "Feature Identifiers Supported and Effects"; - standard_dir.lid[0x13].str = "NVMe-MI Commands Supported and Effects"; - standard_dir.lid[0x14].str = "Command and Feature lockdown"; - standard_dir.lid[0x15].str = "Boot Partition"; - standard_dir.lid[0x16].str = "Rotational Media Information"; - standard_dir.lid[0x70].str = "Discovery"; - standard_dir.lid[0x80].str = "Reservation Notification"; - standard_dir.lid[0x81].str = "Sanitize Status"; for (int lid = 0; lid < NVME_LOG_SUPPORTED_LOG_PAGES_MAX; lid++) { if (!supported->lid_support[lid] || lid >= MIN_VENDOR_LID) continue; standard_dir.lid[lid].supported = true; + standard_dir.lid[lid].str = nvme_log_to_string(lid); } return &standard_dir; @@ -158,6 +133,14 @@ static struct lid_dir *get_solidigm_lids(struct nvme_supported_log_pages *suppor solidigm_dir.lid[0xC4].str = "Endurance Manager Statistics"; solidigm_dir.lid[0xC5].str = "Temperature Statistics"; solidigm_dir.lid[0xCA].str = "SMART Attributes"; + solidigm_dir.lid[0xCB].str = "VU NVMe IO Queue Metrics Log Page"; + solidigm_dir.lid[0xDD].str = "VU Marketing Description Log Page"; + solidigm_dir.lid[0xEF].str = "Performance Rating and LBA Access Histogram"; + solidigm_dir.lid[0xF2].str = "Get Power Usage Log Page"; + solidigm_dir.lid[0xF6].str = "Vt Histo Get Log Page"; + solidigm_dir.lid[0xF9].str = "Workload Tracker Get Log Page"; + solidigm_dir.lid[0xFD].str = "Garbage Control Collection Log Page"; + solidigm_dir.lid[0xFE].str = "Latency Outlier Log Page"; update_vendor_lid_supported(supported, &solidigm_dir); @@ -281,15 +264,18 @@ int solidigm_get_log_page_directory_log(int argc, char **argv, struct command *c } if (!err) { - const enum nvme_print_flags print_flag = validate_output_format(format); + enum nvme_print_flags print_flag; + + err = validate_output_format(format, &print_flag); + if (err < 0) { + fprintf(stderr, "Error: Invalid output format specified: %s.\n", format); + return err; + } if (print_flag == NORMAL) { supported_log_pages_normal(lid_dirs); } else if (print_flag == JSON) { supported_log_pages_json(lid_dirs); - } else { - fprintf(stderr, "Error: Invalid output format specified: %s.\n", format); - err = -EINVAL; } } diff --git a/plugins/solidigm/solidigm-nvme.c b/plugins/solidigm/solidigm-nvme.c index b0db1ea..3fb86f5 100644 --- a/plugins/solidigm/solidigm-nvme.c +++ b/plugins/solidigm/solidigm-nvme.c @@ -18,8 +18,11 @@ #include "solidigm-telemetry.h" #include "solidigm-log-page-dir.h" #include "solidigm-market-log.h" +#include "solidigm-temp-stats.h" +#include "solidigm-get-drive-info.h" +#include "solidigm-ocp-version.h" -#include "plugins/ocp/ocp-clear-fw-update-history.h" +#include "plugins/ocp/ocp-clear-features.h" #include "plugins/ocp/ocp-smart-extended-log.h" #include "plugins/ocp/ocp-fw-activation-history.h" @@ -59,6 +62,12 @@ static int clear_fw_update_history(int argc, char **argv, struct command *cmd, return ocp_clear_fw_update_history(argc, argv, cmd, plugin); } +static int clear_pcie_correctable_error_counters(int argc, char **argv, struct command *cmd, + struct plugin *plugin) +{ + return ocp_clear_pcie_correctable_errors(argc, argv, cmd, plugin); +} + static int smart_cloud(int argc, char **argv, struct command *cmd, struct plugin *plugin) { @@ -82,3 +91,19 @@ static int get_market_log(int argc, char **argv, struct command *cmd, { return sldgm_get_market_log(argc, argv, cmd, plugin); } + +static int get_temp_stats_log(int argc, char **argv, struct command *cmd, struct plugin *plugin) +{ + return sldgm_get_temp_stats_log(argc, argv, cmd, plugin); +} + +static int get_drive_info(int argc, char **argv, struct command *cmd, struct plugin *plugin) +{ + return sldgm_get_drive_info(argc, argv, cmd, plugin); +} + +static int get_cloud_SSDplugin_version(int argc, char **argv, struct command *cmd, + struct plugin *plugin) +{ + return sldgm_ocp_version(argc, argv, cmd, plugin); +} diff --git a/plugins/solidigm/solidigm-nvme.h b/plugins/solidigm/solidigm-nvme.h index 69b63e5..a984a38 100644 --- a/plugins/solidigm/solidigm-nvme.h +++ b/plugins/solidigm/solidigm-nvme.h @@ -13,7 +13,7 @@ #include "cmd.h" -#define SOLIDIGM_PLUGIN_VERSION "0.14" +#define SOLIDIGM_PLUGIN_VERSION "1.0" PLUGIN(NAME("solidigm", "Solidigm vendor specific extensions", SOLIDIGM_PLUGIN_VERSION), COMMAND_LIST( @@ -25,9 +25,13 @@ PLUGIN(NAME("solidigm", "Solidigm vendor specific extensions", SOLIDIGM_PLUGIN_V ENTRY("market-log", "Retrieve Market Log", get_market_log) ENTRY("latency-tracking-log", "Enable/Retrieve Latency tracking Log", get_latency_tracking_log) ENTRY("parse-telemetry-log", "Parse Telemetry Log binary", get_telemetry_log) + ENTRY("clear-pcie-correctable-errors ", "Clear PCIe Correctable Error Counters (redirects to ocp plug-in)", clear_pcie_correctable_error_counters) ENTRY("clear-fw-activate-history", "Clear firmware update history log (redirects to ocp plug-in)", clear_fw_update_history) ENTRY("vs-fw-activate-history", "Get firmware activation history log (redirects to ocp plug-in)", fw_activation_history) ENTRY("log-page-directory", "Retrieve log page directory", get_log_page_directory_log) + ENTRY("temp-stats", "Retrieve Temperature Statistics log", get_temp_stats_log) + ENTRY("vs-drive-info", "Retrieve drive information", get_drive_info) + ENTRY("cloud-SSDplugin-version", "Prints plug-in OCP version", get_cloud_SSDplugin_version) ) ); diff --git a/plugins/solidigm/solidigm-ocp-version.c b/plugins/solidigm/solidigm-ocp-version.c new file mode 100644 index 0000000..4048cc1 --- /dev/null +++ b/plugins/solidigm/solidigm-ocp-version.c @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2023 Solidigm. + * + * Author: leonardo.da.cunha@solidigm.com + */ + +#include <stdio.h> +#include "nvme.h" + +int sldgm_ocp_version(int argc, char **argv, struct command *cmd, struct plugin *plugin) +{ + const char *desc = "Prints OCP extensions version of Solidigm plugin"; + + OPT_ARGS(opts) = { + OPT_END() + }; + + int err = argconfig_parse(argc, argv, desc, opts); + + if (!err) + printf("1.0\n"); + + return err; +} diff --git a/plugins/solidigm/solidigm-ocp-version.h b/plugins/solidigm/solidigm-ocp-version.h new file mode 100644 index 0000000..d79452c --- /dev/null +++ b/plugins/solidigm/solidigm-ocp-version.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2023 Solidigm. + * + * Author: leonardo.da.cunha@solidigm.com + */ + +int sldgm_ocp_version(int argc, char **argv, struct command *cmd, struct plugin *plugin); diff --git a/plugins/solidigm/solidigm-smart.c b/plugins/solidigm/solidigm-smart.c index e3d468a..62245fa 100644 --- a/plugins/solidigm/solidigm-smart.c +++ b/plugins/solidigm/solidigm-smart.c @@ -69,15 +69,17 @@ static char *id_to_name(__u8 id) case 0xE2: return "media_wear_percentage"; case 0xE3: - return "host_reads"; + return "timed_work_load_host_reads"; case 0xE4: - return "timed_work_load"; + return "timed_work_load_timer"; case 0xE5: return "read_commands_in_flight_counter"; case 0xE6: return "write_commands_in_flight_counter"; case 0xEA: return "thermal_throttle_status"; + case 0xEE: + return "re_sku_count"; case 0xF0: return "retry_buffer_overflow_counter"; case 0xF3: @@ -220,11 +222,11 @@ int solidigm_get_additional_smart_log(int argc, char **argv, struct command *cmd if (err) return err; - flags = validate_output_format(cfg.output_format); - if (flags == -EINVAL) { + err = validate_output_format(cfg.output_format, &flags); + if (err < 0) { fprintf(stderr, "Invalid output format '%s'\n", cfg.output_format); dev_close(dev); - return flags; + return err; } uuid_index = solidigm_get_vu_uuid_index(dev); diff --git a/plugins/solidigm/solidigm-telemetry.c b/plugins/solidigm/solidigm-telemetry.c index 472284a..2bebccc 100644 --- a/plugins/solidigm/solidigm-telemetry.c +++ b/plugins/solidigm/solidigm-telemetry.c @@ -22,6 +22,7 @@ #include "solidigm-telemetry/header.h" #include "solidigm-telemetry/config.h" #include "solidigm-telemetry/data-area.h" +#include "solidigm-util.h" static int read_file2buffer(char *file_name, char **buffer, size_t *length) { @@ -71,7 +72,7 @@ int solidigm_get_telemetry_log(int argc, char **argv, struct command *cmd, struc struct config cfg = { .host_gen = 1, .ctrl_init = false, - .data_area = 3, + .data_area = -1, .cfg_file = NULL, .is_input_file = false, }; @@ -90,6 +91,10 @@ int solidigm_get_telemetry_log(int argc, char **argv, struct command *cmd, struc if (err) goto ret; + /* When not selected on the command line, get minimum data area required */ + if (cfg.data_area == -1) + cfg.data_area = cfg.cfg_file ? 3 : 1; + if (cfg.is_input_file) { if (optind >= argc) { err = errno = EINVAL; @@ -138,19 +143,23 @@ int solidigm_get_telemetry_log(int argc, char **argv, struct command *cmd, struc } if (!cfg.is_input_file) { - if (cfg.ctrl_init) - err = nvme_get_ctrl_telemetry(dev_fd(dev), true, - &tl.log, cfg.data_area, - &tl.log_size); - else if (cfg.host_gen) - err = nvme_get_new_host_telemetry(dev_fd(dev), &tl.log, - cfg.data_area, - &tl.log_size); - else - err = nvme_get_host_telemetry(dev_fd(dev), &tl.log, - cfg.data_area, - &tl.log_size); + size_t max_data_tx; + + err = nvme_get_telemetry_max(dev_fd(dev), NULL, &max_data_tx); + if (err < 0) { + SOLIDIGM_LOG_WARNING("identify_ctrl: %s", + nvme_strerror(errno)); + goto close_fd; + } else if (err > 0) { + nvme_show_status(err); + SOLIDIGM_LOG_WARNING("Failed to acquire identify ctrl %d!", err); + goto close_fd; + } + if (max_data_tx > DRIVER_MAX_TX_256K) + max_data_tx = DRIVER_MAX_TX_256K; + err = nvme_get_telemetry_log(dev_fd(dev), cfg.host_gen, cfg.ctrl_init, true, + max_data_tx, cfg.data_area, &tl.log, &tl.log_size); if (err < 0) { SOLIDIGM_LOG_WARNING("get-telemetry-log: %s", nvme_strerror(errno)); diff --git a/plugins/solidigm/solidigm-telemetry/config.c b/plugins/solidigm/solidigm-telemetry/config.c index cc2a8bb..eceeede 100644 --- a/plugins/solidigm/solidigm-telemetry/config.c +++ b/plugins/solidigm/solidigm-telemetry/config.c @@ -9,7 +9,7 @@ #include <string.h> #include "config.h" -// max 16 bit unsigned integer nummber 65535 +// max 16 bit unsigned integer number 65535 #define MAX_16BIT_NUM_AS_STRING_SIZE 6 #define OBJ_NAME_PREFIX "UID_" diff --git a/plugins/solidigm/solidigm-telemetry/data-area.c b/plugins/solidigm/solidigm-telemetry/data-area.c index 0cfa56c..14d612b 100644 --- a/plugins/solidigm/solidigm-telemetry/data-area.c +++ b/plugins/solidigm/solidigm-telemetry/data-area.c @@ -57,7 +57,7 @@ static bool telemetry_log_get_value(const struct telemetry_log *tl, char err_msg[MAX_WARNING_SIZE]; snprintf(err_msg, MAX_WARNING_SIZE, - "Value crossing 64 bit, byte aligned bounday, not supported. size_bit=%u, offset_bit_from_byte=%u.", + "Value crossing 64 bit, byte aligned boundary, not supported. size_bit=%u, offset_bit_from_byte=%u.", size_bit, offset_bit_from_byte); *val_obj = json_object_new_string(err_msg); diff --git a/plugins/solidigm/solidigm-telemetry/nlog.c b/plugins/solidigm/solidigm-telemetry/nlog.c index 43b8918..926772b 100644 --- a/plugins/solidigm/solidigm-telemetry/nlog.c +++ b/plugins/solidigm/solidigm-telemetry/nlog.c @@ -8,15 +8,16 @@ #include "nlog.h" #include "config.h" #include <string.h> -#include <math.h> #include <stdio.h> +#include "ccan/ilog/ilog.h" + #define LOG_ENTRY_HEADER_SIZE 1 #define LOG_ENTRY_TIMESTAMP_SIZE 2 #define LOG_ENTRY_NUM_ARGS_MAX 8 #define LOG_ENTRY_MAX_SIZE (LOG_ENTRY_HEADER_SIZE + LOG_ENTRY_TIMESTAMP_SIZE + \ LOG_ENTRY_NUM_ARGS_MAX) -#define NUM_ARGS_MASK ((1 << ((int)log2(LOG_ENTRY_NUM_ARGS_MAX)+1)) - 1) +#define NUM_ARGS_MASK ((1 << ((int)STATIC_ILOG_32(LOG_ENTRY_NUM_ARGS_MAX))) - 1) #define MAX_HEADER_MISMATCH_TRACK 10 static int formats_find(struct json_object *formats, uint32_t val, struct json_object **format) diff --git a/plugins/solidigm/solidigm-temp-stats.c b/plugins/solidigm/solidigm-temp-stats.c new file mode 100644 index 0000000..85a3c37 --- /dev/null +++ b/plugins/solidigm/solidigm-temp-stats.c @@ -0,0 +1,108 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2023 Solidigm. + * + * Author: leonardo.da.cunha@solidigm.com + */ + +#include <errno.h> + +#include "common.h" +#include "nvme-print.h" +#include "solidigm-util.h" + +#define SLDGM_TEMP_STATS_LID 0xC5 + +struct temp_stats { + __le64 curr; + __le64 last_overtemp; + __le64 life_overtemp; + __le64 highest_temp; + __le64 lowest_temp; + __u8 rsvd[40]; + __le64 max_operating_temp; + __le64 min_operating_temp; + __le64 est_offset; +}; + +static void show_temp_stats(struct temp_stats *stats) +{ + printf("Current temperature : %"PRIu64"\n", le64_to_cpu(stats->curr)); + printf("Last critical overtemp flag : %"PRIu64"\n", le64_to_cpu(stats->last_overtemp)); + printf("Life critical overtemp flag : %"PRIu64"\n", le64_to_cpu(stats->life_overtemp)); + printf("Highest temperature : %"PRIu64"\n", le64_to_cpu(stats->highest_temp)); + printf("Lowest temperature : %"PRIu64"\n", le64_to_cpu(stats->lowest_temp)); + printf("Max operating temperature : %"PRIu64"\n", le64_to_cpu(stats->max_operating_temp)); + printf("Min operating temperature : %"PRIu64"\n", le64_to_cpu(stats->min_operating_temp)); + printf("Estimated offset : %"PRIu64"\n", le64_to_cpu(stats->est_offset)); +} + +int sldgm_get_temp_stats_log(int argc, char **argv, struct command *cmd, struct plugin *plugin) +{ + unsigned char buffer[4096] = {0}; + struct nvme_dev *dev; + __u8 uuid_idx; + int err; + + const char *desc = "Get/show Temperature Statistics log."; + const char *raw = "dump output in binary format"; + struct config { + bool raw_binary; + }; + + struct config cfg = { + .raw_binary = false, + }; + + OPT_ARGS(opts) = { + OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw), + OPT_END() + }; + + err = parse_and_open(&dev, argc, argv, desc, opts); + if (err) + return err; + + uuid_idx = solidigm_get_vu_uuid_index(dev); + + struct nvme_get_log_args args = { + .lpo = 0, + .result = NULL, + .log = buffer, + .args_size = sizeof(args), + .fd = dev_fd(dev), + .uuidx = uuid_idx, + .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, + .lid = SLDGM_TEMP_STATS_LID, + .len = sizeof(buffer), + .nsid = NVME_NSID_ALL, + .csi = NVME_CSI_NVM, + .lsi = NVME_LOG_LSI_NONE, + .lsp = NVME_LOG_LSP_NONE, + .rae = false, + .ot = false, + }; + + err = nvme_get_log(&args); + if (!err) { + uint64_t *guid = (uint64_t *)&buffer[4080]; + + if (guid[1] == 0xC7BB98B7D0324863 && guid[0] == 0xBB2C23990E9C722F) { + fprintf(stderr, "Error: Log page has 'OCP unsupported Requirements' GUID\n"); + err = -EBADMSG; + goto closefd; + } + if (!cfg.raw_binary) + show_temp_stats((struct temp_stats *) buffer); + else + d_raw(buffer, sizeof(struct temp_stats)); + } else if (err > 0) { + nvme_show_status(err); + } + +closefd: + /* Redundant close() to make static code analysis happy */ + close(dev->direct.fd); + dev_close(dev); + return err; +} diff --git a/plugins/solidigm/solidigm-temp-stats.h b/plugins/solidigm/solidigm-temp-stats.h new file mode 100644 index 0000000..58d5a86 --- /dev/null +++ b/plugins/solidigm/solidigm-temp-stats.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2023 Solidigm. + * + * Author: leonardo.da.cunha@solidigm.com + */ + +int sldgm_get_temp_stats_log(int argc, char **argv, struct command *cmd, struct plugin *plugin); diff --git a/plugins/solidigm/solidigm-util.h b/plugins/solidigm/solidigm-util.h index 3a18501..fa5032f 100644 --- a/plugins/solidigm/solidigm-util.h +++ b/plugins/solidigm/solidigm-util.h @@ -7,4 +7,6 @@ #include "nvme.h" +#define DRIVER_MAX_TX_256K (256 * 1024) + __u8 solidigm_get_vu_uuid_index(struct nvme_dev *dev); diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c index ec3f2b0..d663131 100644 --- a/plugins/wdc/wdc-nvme.c +++ b/plugins/wdc/wdc-nvme.c @@ -36,6 +36,7 @@ #include "libnvme.h" #include "plugin.h" #include "linux/types.h" +#include "util/cleanup.h" #include "util/types.h" #include "nvme-print.h" @@ -80,12 +81,14 @@ #define WDC_NVME_SN655_DEV_ID 0x2722 #define WDC_NVME_SN860_DEV_ID 0x2730 #define WDC_NVME_SN660_DEV_ID 0x2704 - -/* This id's are no longer supported, delete ?? */ -#define WDC_NVME_SN550_DEV_ID 0x2708 #define WDC_NVME_SN560_DEV_ID_1 0x2712 #define WDC_NVME_SN560_DEV_ID_2 0x2713 #define WDC_NVME_SN560_DEV_ID_3 0x2714 +#define WDC_NVME_SN861_DEV_ID 0x2750 +#define WDC_NVME_SN861_DEV_ID_1 0x2751 + +/* This id's are no longer supported, delete ?? */ +#define WDC_NVME_SN550_DEV_ID 0x2708 #define WDC_NVME_SXSLCL_DEV_ID 0x2001 #define WDC_NVME_SN520_DEV_ID 0x5003 @@ -147,6 +150,8 @@ #define WDC_DRIVE_CAP_OCP_C4_LOG_PAGE 0x0000004000000000 #define WDC_DRIVE_CAP_OCP_C5_LOG_PAGE 0x0000008000000000 #define WDC_DRIVE_CAP_DEVICE_WAF 0x0000010000000000 +#define WDC_DRIVE_CAP_SET_LATENCY_MONITOR 0x0000020000000000 + #define WDC_DRIVE_CAP_SMART_LOG_MASK (WDC_DRIVE_CAP_C0_LOG_PAGE | \ WDC_DRIVE_CAP_C1_LOG_PAGE | \ WDC_DRIVE_CAP_CA_LOG_PAGE | \ @@ -162,6 +167,7 @@ WDC_DRIVE_CAP_DUI | \ WDC_DRIVE_CAP_DUI_DATA | \ WDC_SN730B_CAP_VUC_LOG) + /* SN730 Get Log Capabilities */ #define SN730_NVME_GET_LOG_OPCODE 0xc2 #define SN730_GET_FULL_LOG_LENGTH 0x00080009 @@ -301,8 +307,8 @@ #define WDC_NVME_GET_STAT_PERF_INTERVAL_LIFETIME 0x0F /* C2 Log Page */ -#define WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_OPCODE 0xC2 -#define WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_OPCODE_C8 0xC8 +#define WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID 0xC2 +#define WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID_C8 0xC8 #define WDC_C2_LOG_BUF_LEN 0x1000 #define WDC_C2_LOG_PAGES_SUPPORTED_ID 0x08 #define WDC_C2_CUSTOMER_ID_ID 0x15 @@ -367,12 +373,12 @@ static __u8 wdc_lat_mon_guid[WDC_C3_GUID_LENGTH] = { #define NVME_LOG_PERSISTENT_EVENT 0x0D #define WDC_LOG_ID_C0 0xC0 #define WDC_LOG_ID_C1 0xC1 -#define WDC_LOG_ID_C2 WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_OPCODE +#define WDC_LOG_ID_C2 WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID #define WDC_LOG_ID_C3 0xC3 #define WDC_LOG_ID_C4 0xC4 #define WDC_LOG_ID_C5 0xC5 #define WDC_LOG_ID_C6 0xC6 -#define WDC_LOG_ID_C8 WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_OPCODE_C8 +#define WDC_LOG_ID_C8 WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID_C8 #define WDC_LOG_ID_CA WDC_NVME_GET_DEVICE_INFO_LOG_OPCODE #define WDC_LOG_ID_CB WDC_NVME_GET_FW_ACT_HISTORY_LOG_ID #define WDC_LOG_ID_D0 WDC_NVME_GET_VU_SMART_LOG_OPCODE @@ -446,6 +452,12 @@ static __u8 wdc_lat_mon_guid[WDC_C3_GUID_LENGTH] = { #define WDC_ENC_CRASH_DUMP_ID 0xE4 #define WDC_ENC_LOG_DUMP_ID 0xE2 +/* OCP Log Page Directory Data Structure */ +#define BYTE_TO_BIT(byte) ((byte) * 8) + +/* Set latency monitor feature */ +#define NVME_FEAT_OCP_LATENCY_MONITOR 0xC5 + enum _NVME_FEATURES_SELECT { FS_CURRENT = 0, FS_DEFAULT = 1, @@ -473,6 +485,27 @@ enum NVME_FEATURE_IDENTIFIERS { FID_RESERVATION_PERSISTENCE = 0x83 }; +/* WDC UUID value */ +const uint8_t WDC_UUID[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0xb9, 0x8c, 0x52, 0x0c, 0x4c, + 0x5a, 0x15, 0xab, 0xe6, 0x33, 0x29, 0x9a, 0x70, 0xdf, 0xd0 +}; + +/* WDC_UUID value for SN640_3 devices */ +const uint8_t WDC_UUID_SN640_3[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22 +}; + +/* UUID field with value of 0 indicates end of UUID List*/ +const uint8_t UUID_END[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + enum WDC_DRIVE_ESSENTIAL_TYPE { WDC_DE_TYPE_IDENTIFY = 0x1, WDC_DE_TYPE_SMARTATTRIBUTEDUMP = 0x2, @@ -656,6 +689,67 @@ enum { SCAO_LPG = 496, /* Log page GUID */ }; +struct ocp_bad_nand_block_count { + __u64 raw : 48; + __u16 normalized : 16; +}; + +struct ocp_e2e_correction_count { + __u32 detected; + __u32 corrected; +}; + +struct ocp_user_data_erase_count { + __u32 maximum; + __u32 minimum; +}; + +struct ocp_thermal_status { + __u8 num_events; + __u8 current_status; +}; + +struct __packed ocp_dssd_specific_ver { + __u8 errata_ver; + __u16 point_ver; + __u16 minor_ver; + __u8 major_ver; +}; + +struct ocp_cloud_smart_log { + __u8 physical_media_units_written[16]; + __u8 physical_media_units_read[16]; + struct ocp_bad_nand_block_count bad_user_nand_blocks; + struct ocp_bad_nand_block_count bad_system_nand_blocks; + __u64 xor_recovery_count; + __u64 uncorrectable_read_error_count; + __u64 soft_ecc_error_count; + struct ocp_e2e_correction_count e2e_correction_counts; + __u8 system_data_percent_used; + __u64 refresh_counts : 56; + struct ocp_user_data_erase_count user_data_erase_counts; + struct ocp_thermal_status thermal_status; + struct ocp_dssd_specific_ver dssd_specific_ver; + __u64 pcie_correctable_error_count; + __u32 incomplete_shutdowns; + __u8 rsvd116[4]; + __u8 percent_free_blocks; + __u8 rsvd121[7]; + __u16 capacitor_health; + __u8 nvme_errata_ver; + __u8 rsvd131[5]; + __u64 unaligned_io; + __u64 security_version_number; + __u64 total_nuse; + __u8 plp_start_count[16]; + __u8 endurance_estimate[16]; + __u64 pcie_link_retraining_cnt; + __u64 power_state_change_cnt; + __u8 rsvd208[286]; + __u16 log_page_version; + __u8 log_page_guid[16]; +}; + static __u8 scao_guid[WDC_C0_GUID_LENGTH] = { 0xC5, 0xAF, 0x10, 0x28, 0xEA, 0xBF, 0xF2, 0xA4, 0x9C, 0x4F, 0x6F, 0x7C, 0xC9, 0x14, 0xD5, 0xAF @@ -793,6 +887,46 @@ static struct NVME_VU_DE_LOGPAGE_LIST deVULogPagesList[] = { { NVME_DE_LOGPAGE_C0, 0xC0, 512, "0xc0"} }; +enum { + WDC_NVME_ADMIN_VUC_OPCODE_D2 = 0xD2, + WDC_VUC_SUBOPCODE_VS_DRIVE_INFO_D2 = 0x0000010A, + WDC_VUC_SUBOPCODE_LOG_PAGE_DIR_D2 = 0x00000105, +}; + +enum { + NVME_LOG_NS_BASE = 0x80, + NVME_LOG_VS_BASE = 0xC0, +}; + +/*drive_info struct*/ +struct ocp_drive_info { + __u32 hw_revision; + __u32 ftl_unit_size; +}; + +/*get log page directory struct*/ +struct log_page_directory { + __u64 supported_lid_bitmap; + __u64 rsvd; + __u64 supported_ns_lid_bitmap; + __u64 supported_vs_lid_bitmap; +}; + +/*set latency monitor feature */ +struct __packed feature_latency_monitor { + __u16 active_bucket_timer_threshold; + __u8 active_threshold_a; + __u8 active_threshold_b; + __u8 active_threshold_c; + __u8 active_threshold_d; + __u16 active_latency_config; + __u8 active_latency_minimum_window; + __u16 debug_log_trigger_enable; + __u8 discard_debug_log; + __u8 latency_monitor_feature_enable; + __u8 reserved[4083]; +}; + static int wdc_get_serial_name(struct nvme_dev *dev, char *file, size_t len, const char *suffix); static int wdc_create_log_file(char *file, __u8 *drive_log_data, __u32 drive_log_length); static int wdc_do_clear_dump(struct nvme_dev *dev, __u8 opcode, __u32 cdw12); @@ -1228,7 +1362,7 @@ struct __packed wdc_fw_act_history_log_format_c2 { struct __packed wdc_ocp_C4_dev_cap_log { __le16 num_pcie_ports; /* 0000 - Number of PCI Express Ports */ __le16 oob_mgmt_support; /* 0002 - OOB Management Interfaces Supported */ - __le16 wrt_zeros_support; /* 0004 - Write Zeros Commmand Support */ + __le16 wrt_zeros_support; /* 0004 - Write Zeros Command Support */ __le16 sanitize_support; /* 0006 - Sanitize Command Support */ __le16 dsm_support; /* 0008 - Dataset Management Command Support */ __le16 wrt_uncor_support; /* 0010 - Write Uncorrectable Command Support */ @@ -1268,6 +1402,21 @@ static __u8 wdc_ocp_c5_guid[WDC_OCP_C5_GUID_LENGTH] = { 0x2F, 0x72, 0x9C, 0x0 #define WDC_REASON_ID_ENTRY_LEN 128 #define WDC_REASON_ID_PATH_NAME "/usr/local/nvmecli" +const char *log_page_name[256] = { + [NVME_LOG_LID_ERROR] = "Error Information", + [NVME_LOG_LID_SMART] = "SMART / Health Information", + [NVME_LOG_LID_FW_SLOT] = "Firmware Slot Information", + [NVME_LOG_LID_CHANGED_NS] = "Changed Namespace List", + [NVME_LOG_LID_CMD_EFFECTS] = "Command Supported and Effects", + [NVME_LOG_LID_TELEMETRY_HOST] = "Telemetry Host-Initiated", + [NVME_LOG_LID_TELEMETRY_CTRL] = "Telemetry Controller-Initiated", + [NVME_LOG_LID_SANITIZE] = "Sanitize Status", + [WDC_LOG_ID_C0] = "Extended SMART Information", + [WDC_LOG_ID_C2] = "Firmware Activation History", + [WDC_LOG_ID_C3] = "Latency Monitor", + [WDC_LOG_ID_C4] = "Device Capabilities", + [WDC_LOG_ID_C5] = "Unsupported Requirements", +}; static double safe_div_fp(double numerator, double denominator) { @@ -1367,6 +1516,60 @@ static int wdc_get_vendor_id(struct nvme_dev *dev, uint32_t *vendor_id) return ret; } +static bool wdc_is_sn861(__u32 device_id) +{ + if ((device_id == WDC_NVME_SN861_DEV_ID) || + (device_id == WDC_NVME_SN861_DEV_ID_1)) + return true; + else + return false; +} + + +static bool wdc_is_sn640(__u32 device_id) +{ + if ((device_id == WDC_NVME_SN640_DEV_ID) || + (device_id == WDC_NVME_SN640_DEV_ID_1) || + (device_id == WDC_NVME_SN640_DEV_ID_2)) + return true; + else + return false; +} + +static bool wdc_is_sn640_3(__u32 device_id) +{ + if (device_id == WDC_NVME_SN640_DEV_ID_3) + return true; + else + return false; +} + +static bool wdc_is_sn650_u2(__u32 device_id) +{ + if (device_id == WDC_NVME_SN650_DEV_ID_3) + return true; + else + return false; +} + +static bool wdc_is_sn650_e1l(__u32 device_id) +{ + if (device_id == WDC_NVME_SN650_DEV_ID_4) + return true; + else + return false; +} + +static bool needs_c2_log_page_check(__u32 device_id) +{ + if ((wdc_is_sn640(device_id)) || + (wdc_is_sn650_u2(device_id)) || + (wdc_is_sn650_e1l(device_id))) + return true; + else + return false; +} + static bool wdc_check_power_of_2(int num) { return num && (!(num & (num-1))); @@ -1548,7 +1751,7 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev) WDC_DEV_CAP_LOG_ID)) capabilities |= WDC_DRIVE_CAP_OCP_C4_LOG_PAGE; - /* verify the 0xC5 (OCP Unsupported Requirments) log page is supported */ + /* verify the 0xC5 (OCP Unsupported Requirements) log page is supported */ if (wdc_nvme_check_supported_log_page(r, dev, WDC_UNSUPPORTED_REQS_LOG_ID)) capabilities |= WDC_DRIVE_CAP_OCP_C5_LOG_PAGE; @@ -1637,7 +1840,7 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev) if (wdc_nvme_check_supported_log_page(r, dev, WDC_DEV_CAP_LOG_ID)) capabilities |= WDC_DRIVE_CAP_OCP_C4_LOG_PAGE; - /* verify the 0xC5 (OCP Unsupported Requirments) log page is supported */ + /* verify the 0xC5 (OCP Unsupported Requirements) log page is supported */ if (wdc_nvme_check_supported_log_page(r, dev, WDC_UNSUPPORTED_REQS_LOG_ID)) capabilities |= WDC_DRIVE_CAP_OCP_C5_LOG_PAGE; @@ -1666,6 +1869,23 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev) WDC_DRIVE_CAP_CLEAR_PCIE); break; + case WDC_NVME_SN861_DEV_ID: + fallthrough; + case WDC_NVME_SN861_DEV_ID_1: + capabilities |= (WDC_DRIVE_CAP_C0_LOG_PAGE | + WDC_DRIVE_CAP_C3_LOG_PAGE | + WDC_DRIVE_CAP_CA_LOG_PAGE | + WDC_DRIVE_CAP_OCP_C4_LOG_PAGE | + WDC_DRIVE_CAP_OCP_C5_LOG_PAGE | + WDC_DRIVE_CAP_INTERNAL_LOG | + WDC_DRIVE_CAP_FW_ACTIVATE_HISTORY_C2 | + WDC_DRIVE_CAP_VU_FID_CLEAR_PCIE | + WDC_DRIVE_CAP_VU_FID_CLEAR_FW_ACT_HISTORY | + WDC_DRIVE_CAP_INFO | + WDC_DRIVE_CAP_CLOUD_SSD_VERSION | + WDC_DRIVE_CAP_LOG_PAGE_DIR | + WDC_DRIVE_CAP_SET_LATENCY_MONITOR); + break; default: capabilities = 0; } @@ -1958,7 +2178,7 @@ bool wdc_get_dev_mng_log_entry(__u32 log_length, __u32 entry_id, remaining_len = 0; valid_log = false; - /* The struture is invalid, so any match that was found is invalid. */ + /* The structure is invalid, so any match that was found is invalid. */ *p_p_found_log_entry = NULL; } else { /* Structure must have at least one valid entry to be considered valid */ @@ -1982,33 +2202,25 @@ bool wdc_get_dev_mng_log_entry(__u32 log_length, __u32 entry_id, return valid_log; } -static bool get_dev_mgment_cbs_data(nvme_root_t r, struct nvme_dev *dev, - __u8 log_id, void **cbs_data) +static bool get_dev_mgmt_log_page_lid_data(struct nvme_dev *dev, + void **cbs_data, + __u8 lid, + __u8 log_id, + __u8 uuid_ix) { - int ret = -1; void *data; struct wdc_c2_log_page_header *hdr_ptr; struct wdc_c2_log_subpage_header *sph; __u32 length = 0; + int ret = 0; bool found = false; - __u8 uuid_ix = 1; - __u8 lid = 0; - *cbs_data = NULL; - __u32 device_id, read_vendor_id; - - ret = wdc_get_pci_ids(r, dev, &device_id, &read_vendor_id); - if (device_id == WDC_NVME_ZN350_DEV_ID || device_id == WDC_NVME_ZN350_DEV_ID_1) { - lid = WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_OPCODE_C8; - uuid_ix = 0; - } else { - lid = WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_OPCODE; - } data = (__u8 *)malloc(sizeof(__u8) * WDC_C2_LOG_BUF_LEN); if (!data) { fprintf(stderr, "ERROR: WDC: malloc: %s\n", strerror(errno)); return false; } + memset(data, 0, sizeof(__u8) * WDC_C2_LOG_BUF_LEN); /* get the log page length */ @@ -2031,7 +2243,9 @@ static bool get_dev_mgment_cbs_data(nvme_root_t r, struct nvme_dev *dev, }; ret = nvme_get_log(&args_len); if (ret) { - fprintf(stderr, "ERROR: WDC: Unable to get 0x%x Log Page length, ret = 0x%x\n", lid, ret); + fprintf(stderr, + "ERROR: WDC: Unable to get 0x%x Log Page length with uuid %d, ret = 0x%x\n", + lid, uuid_ix, ret); goto end; } @@ -2044,37 +2258,38 @@ static bool get_dev_mgment_cbs_data(nvme_root_t r, struct nvme_dev *dev, data = calloc(length, sizeof(__u8)); if (!data) { fprintf(stderr, "ERROR: WDC: malloc: %s\n", strerror(errno)); - return false; + goto end; } - } - /* get the log page data */ - struct nvme_get_log_args args_data = { - .args_size = sizeof(args_data), - .fd = dev_fd(dev), - .lid = lid, - .nsid = 0xFFFFFFFF, - .lpo = 0, - .lsp = NVME_LOG_LSP_NONE, - .lsi = 0, - .rae = false, - .uuidx = uuid_ix, - .csi = NVME_CSI_NVM, - .ot = false, - .len = length, - .log = data, - .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, - .result = NULL, - }; - ret = nvme_get_log(&args_data); + /* get the log page data with the increased length */ + struct nvme_get_log_args args_data = { + .args_size = sizeof(args_data), + .fd = dev_fd(dev), + .lid = lid, + .nsid = 0xFFFFFFFF, + .lpo = 0, + .lsp = NVME_LOG_LSP_NONE, + .lsi = 0, + .rae = false, + .uuidx = uuid_ix, + .csi = NVME_CSI_NVM, + .ot = false, + .len = length, + .log = data, + .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, + .result = NULL, + }; + ret = nvme_get_log(&args_data); - if (ret) { - fprintf(stderr, "ERROR: WDC: Unable to read 0x%x Log Page data, ret = 0x%x\n", lid, ret); - goto end; + if (ret) { + fprintf(stderr, + "ERROR: WDC: Unable to read 0x%x Log Page data with uuid %d, ret = 0x%x\n", + lid, uuid_ix, ret); + goto end; + } } /* Check the log data to see if the WD version of log page ID's is found */ - length = sizeof(struct wdc_c2_log_page_header); hdr_ptr = (struct wdc_c2_log_page_header *)data; sph = (struct wdc_c2_log_subpage_header *)(data + length); @@ -2083,50 +2298,91 @@ static bool get_dev_mgment_cbs_data(nvme_root_t r, struct nvme_dev *dev, *cbs_data = calloc(le32_to_cpu(sph->length), sizeof(__u8)); if (!*cbs_data) { fprintf(stderr, "ERROR: WDC: calloc: %s\n", strerror(errno)); + found = false; goto end; } memcpy((void *)*cbs_data, (void *)&sph->data, le32_to_cpu(sph->length)); } else { - /* not found with uuid = 1 try with uuid = 0 */ - uuid_ix = 0; - /* get the log page data */ - struct nvme_get_log_args args = { - .args_size = sizeof(args), - .fd = dev_fd(dev), - .lid = lid, - .nsid = 0xFFFFFFFF, - .lpo = 0, - .lsp = NVME_LOG_LSP_NONE, - .lsi = 0, - .rae = false, - .uuidx = uuid_ix, - .csi = NVME_CSI_NVM, - .ot = false, - .len = le32_to_cpu(hdr_ptr->length), - .log = data, - .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, - .result = NULL, - }; - ret = nvme_get_log(&args); + fprintf(stderr, "ERROR: WDC: C2 log id 0x%x not found with uuid index %d\n", + log_id, uuid_ix); + } - hdr_ptr = (struct wdc_c2_log_page_header *)data; - sph = (struct wdc_c2_log_subpage_header *)(data + length); - found = wdc_get_dev_mng_log_entry(le32_to_cpu(hdr_ptr->length), log_id, hdr_ptr, &sph); - if (found) { - *cbs_data = calloc(le32_to_cpu(sph->length), sizeof(__u8)); - if (!*cbs_data) { - fprintf(stderr, "ERROR: WDC: calloc: %s\n", strerror(errno)); - goto end; - } - memcpy((void *)*cbs_data, (void *)&sph->data, le32_to_cpu(sph->length)); +end: + free(data); + return found; +} + +static bool get_dev_mgment_cbs_data(nvme_root_t r, struct nvme_dev *dev, + __u8 log_id, void **cbs_data) +{ + int ret = -1; + bool found = false; + __u8 uuid_ix = 0; + __u8 lid = 0; + *cbs_data = NULL; + __u32 device_id, read_vendor_id; + bool uuid_present = false; + int index = 0, uuid_index = 0; + struct nvme_id_uuid_list uuid_list; + + ret = wdc_get_pci_ids(r, dev, &device_id, &read_vendor_id); + if (ret == 0) { + if (device_id == WDC_NVME_ZN350_DEV_ID || device_id == WDC_NVME_ZN350_DEV_ID_1) { + lid = WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID_C8; + uuid_ix = 0; } else { - /* WD version not found */ - fprintf(stderr, "ERROR: WDC: Unable to find correct version of page 0x%x, entry id = %d\n", lid, log_id); + lid = WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID; } + } else { + fprintf(stderr, "ERROR: WDC: get pci ids: %d\n", ret); + return false; + } + + typedef struct nvme_id_uuid_list_entry *uuid_list_entry; + + memset(&uuid_list, 0, sizeof(struct nvme_id_uuid_list)); + if (wdc_CheckUuidListSupport(dev, &uuid_list)) { + uuid_list_entry uuid_list_entry_ptr = (uuid_list_entry)&uuid_list.entry[0]; + + while (index <= NVME_ID_UUID_LIST_MAX && + !wdc_UuidEqual(uuid_list_entry_ptr, (uuid_list_entry)UUID_END)) { + + if (wdc_UuidEqual(uuid_list_entry_ptr, + (uuid_list_entry)WDC_UUID)) { + uuid_present = true; + break; + } else if (wdc_UuidEqual(uuid_list_entry_ptr, + (uuid_list_entry)WDC_UUID_SN640_3) && + wdc_is_sn640_3(device_id)) { + uuid_present = true; + break; + } + index++; + uuid_list_entry_ptr = (uuid_list_entry)&uuid_list.entry[index]; + } + if (uuid_present) + uuid_index = index + 1; + } + + if (!uuid_index && needs_c2_log_page_check(device_id)) { + /* In certain devices that don't support UUID lists, there are multiple + * definitions of the C2 logpage. In those cases, the code + * needs to try two UUID indexes and use an identification algorithm + * to determine which is returning the correct log page data. + */ + uuid_ix = 1; + } + + found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_ix); + + if (!found) { + /* not found with uuid = 1 try with uuid = 0 */ + uuid_ix = 0; + fprintf(stderr, "Not found, requesting log page with uuid_index %d\n", uuid_index); + + found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_ix); } -end: - free(data); return found; } @@ -3373,6 +3629,102 @@ free_buf: return ret; } +static int dump_internal_logs(struct nvme_dev *dev, char *dir_name, int verbose) +{ + char file_path[128]; + void *telemetry_log; + const size_t bs = 512; + struct nvme_telemetry_log *hdr; + size_t full_size, offset = bs; + int err, output; + + if (verbose) + printf("NVMe Telemetry log...\n"); + + hdr = malloc(bs); + telemetry_log = malloc(bs); + if (!hdr || !telemetry_log) { + fprintf(stderr, "Failed to allocate %zu bytes for log: %s\n", bs, strerror(errno)); + err = -ENOMEM; + goto free_mem; + } + memset(hdr, 0, bs); + + sprintf(file_path, "%s/telemetry.bin", dir_name); + output = open(file_path, O_WRONLY | O_CREAT | O_TRUNC, 0666); + if (output < 0) { + fprintf(stderr, "Failed to open output file %s: %s!\n", file_path, strerror(errno)); + err = output; + goto free_mem; + } + + struct nvme_get_log_args args = { + .lpo = 0, + .result = NULL, + .log = hdr, + .args_size = sizeof(args), + .fd = dev_fd(dev), + .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, + .lid = NVME_LOG_LID_TELEMETRY_HOST, + .len = bs, + .nsid = NVME_NSID_ALL, + .csi = NVME_CSI_NVM, + .lsi = NVME_LOG_LSI_NONE, + .lsp = NVME_LOG_TELEM_HOST_LSP_CREATE, + .uuidx = NVME_UUID_NONE, + .rae = true, + .ot = false, + }; + + err = nvme_get_log(&args); + if (err < 0) + perror("get-telemetry-log"); + else if (err > 0) { + nvme_show_status(err); + fprintf(stderr, "Failed to acquire telemetry header %d!\n", err); + goto close_output; + } + + err = write(output, (void *)hdr, bs); + if (err != bs) { + fprintf(stderr, "Failed to flush all data to file!\n"); + goto close_output; + } + + full_size = (le16_to_cpu(hdr->dalb3) * bs) + offset; + + while (offset != full_size) { + args.log = telemetry_log; + args.lpo = offset; + args.lsp = NVME_LOG_LSP_NONE; + err = nvme_get_log(&args); + if (err < 0) { + perror("get-telemetry-log"); + break; + } else if (err > 0) { + fprintf(stderr, "Failed to acquire full telemetry log!\n"); + nvme_show_status(err); + break; + } + + err = write(output, (void *)telemetry_log, bs); + if (err != bs) { + fprintf(stderr, "Failed to flush all data to file!\n"); + break; + } + err = 0; + offset += bs; + } + +close_output: + close(output); +free_mem: + free(hdr); + free(telemetry_log); + + return err; +} + static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *command, struct plugin *plugin) { @@ -3385,6 +3737,7 @@ static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *command char *type = "Telemetry type - NONE, HOST, or CONTROLLER. Currently only supported on the SN530, SN640, SN730, SN740, SN810, SN840 and ZN350 devices."; char *verbose = "Display more debug messages."; char f[PATH_MAX] = {0}; + char fb[PATH_MAX/2] = {0}; char fileSuffix[PATH_MAX] = {0}; struct nvme_dev *dev; nvme_root_t r; @@ -3393,6 +3746,9 @@ static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *command UtilsTimeInfo timeInfo; __u8 timeStamp[MAX_PATH_LEN]; __u64 capabilities = 0; + __u32 device_id, read_vendor_id; + char file_path[PATH_MAX/2] = {0}; + char cmd_buf[PATH_MAX] = {0}; int ret = -1; struct config { @@ -3441,72 +3797,149 @@ static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *command goto out; } - if (cfg.file) { - int verify_file; + ret = wdc_get_pci_ids(r, dev, &device_id, &read_vendor_id); - /* verify the passed in file name and path is valid before getting the dump data */ - verify_file = open(cfg.file, O_WRONLY | O_CREAT | O_TRUNC, 0666); - if (verify_file < 0) { - fprintf(stderr, "ERROR: WDC: open: %s\n", strerror(errno)); - goto out; + if (!wdc_is_sn861(device_id)) { + if (cfg.file) { + int verify_file; + + /* verify file name and path is valid before getting dump data */ + verify_file = open(cfg.file, O_WRONLY | O_CREAT | O_TRUNC, 0666); + if (verify_file < 0) { + fprintf(stderr, "ERROR: WDC: open: %s\n", strerror(errno)); + goto out; + } + close(verify_file); + strncpy(f, cfg.file, PATH_MAX - 1); + } else { + wdc_UtilsGetTime(&timeInfo); + memset(timeStamp, 0, sizeof(timeStamp)); + wdc_UtilsSnprintf((char *)timeStamp, MAX_PATH_LEN, + "%02u%02u%02u_%02u%02u%02u", timeInfo.year, + timeInfo.month, timeInfo.dayOfMonth, + timeInfo.hour, timeInfo.minute, + timeInfo.second); + snprintf(fileSuffix, PATH_MAX, "_internal_fw_log_%s", (char *)timeStamp); + + ret = wdc_get_serial_name(dev, f, PATH_MAX, fileSuffix); + if (ret) { + fprintf(stderr, "ERROR: WDC: failed to generate file name\n"); + goto out; + } } - close(verify_file); - strncpy(f, cfg.file, PATH_MAX - 1); - } else { - wdc_UtilsGetTime(&timeInfo); - memset(timeStamp, 0, sizeof(timeStamp)); - wdc_UtilsSnprintf((char *)timeStamp, MAX_PATH_LEN, "%02u%02u%02u_%02u%02u%02u", - timeInfo.year, timeInfo.month, timeInfo.dayOfMonth, - timeInfo.hour, timeInfo.minute, timeInfo.second); - snprintf(fileSuffix, PATH_MAX, "_internal_fw_log_%s", (char *)timeStamp); - ret = wdc_get_serial_name(dev, f, PATH_MAX, fileSuffix); - if (ret) { - fprintf(stderr, "ERROR: WDC: failed to generate file name\n"); - goto out; + if (!cfg.file) { + if (strlen(f) > PATH_MAX - 5) { + fprintf(stderr, "ERROR: WDC: file name overflow\n"); + ret = -1; + goto out; + } + strcat(f, ".bin"); } - } + fprintf(stderr, "%s: filename = %s\n", __func__, f); - if (!cfg.file) { - if (strlen(f) > PATH_MAX - 5) { - fprintf(stderr, "ERROR: WDC: file name overflow\n"); + if (cfg.data_area) { + if (cfg.data_area > 5 || cfg.data_area < 1) { + fprintf(stderr, "ERROR: WDC: Data area must be 1-5\n"); + ret = -1; + goto out; + } + } + + if (!cfg.type || !strcmp(cfg.type, "NONE") || !strcmp(cfg.type, "none")) { + telemetry_type = WDC_TELEMETRY_TYPE_NONE; + data_area = 0; + } else if (!strcmp(cfg.type, "HOST") || !strcmp(cfg.type, "host")) { + telemetry_type = WDC_TELEMETRY_TYPE_HOST; + telemetry_data_area = cfg.data_area; + } else if (!strcmp(cfg.type, "CONTROLLER") || !strcmp(cfg.type, "controller")) { + telemetry_type = WDC_TELEMETRY_TYPE_CONTROLLER; + telemetry_data_area = cfg.data_area; + } else { + fprintf(stderr, + "ERROR: WDC: Invalid type - Must be NONE, HOST or CONTROLLER\n"); ret = -1; goto out; } - strcat(f, ".bin"); - } - fprintf(stderr, "%s: filename = %s\n", __func__, f); + } else { + if (cfg.file) { + strncpy(fb, cfg.file, PATH_MAX/2 - 8); + } else { + wdc_UtilsGetTime(&timeInfo); + memset(timeStamp, 0, sizeof(timeStamp)); + wdc_UtilsSnprintf((char *)timeStamp, MAX_PATH_LEN, + "%02u%02u%02u_%02u%02u%02u", timeInfo.year, + timeInfo.month, timeInfo.dayOfMonth, + timeInfo.hour, timeInfo.minute, + timeInfo.second); + snprintf(fileSuffix, PATH_MAX, "_internal_fw_log_%s", (char *)timeStamp); + + ret = wdc_get_serial_name(dev, fb, PATH_MAX/2 - 7, fileSuffix); + if (ret) { + fprintf(stderr, "ERROR: WDC: failed to generate file name\n"); + goto out; + } - if (cfg.data_area) { - if (cfg.data_area > 5 || cfg.data_area < 1) { - fprintf(stderr, "ERROR: WDC: Data area must be 1-5\n"); + if (strlen(fb) > PATH_MAX/2 - 7) { + fprintf(stderr, "ERROR: WDC: file name overflow\n"); + ret = -1; + goto out; + } + } + fprintf(stderr, "%s: filename = %s.tar.gz\n", __func__, fb); + + + memset(file_path, 0, sizeof(file_path)); + if (snprintf(file_path, PATH_MAX/2 - 8, "%s.tar.gz", fb) >= PATH_MAX/2 - 8) { + fprintf(stderr, "File path is too long!\n"); ret = -1; goto out; } - } - - if (!cfg.type || !strcmp(cfg.type, "NONE") || !strcmp(cfg.type, "none")) { - telemetry_type = WDC_TELEMETRY_TYPE_NONE; - data_area = 0; - } else if (!strcmp(cfg.type, "HOST") || !strcmp(cfg.type, "host")) { - telemetry_type = WDC_TELEMETRY_TYPE_HOST; - telemetry_data_area = cfg.data_area; - } else if (!strcmp(cfg.type, "CONTROLLER") || !strcmp(cfg.type, "controller")) { - telemetry_type = WDC_TELEMETRY_TYPE_CONTROLLER; - telemetry_data_area = cfg.data_area; - } else { - fprintf(stderr, "ERROR: WDC: Invalid type - Must be NONE, HOST or CONTROLLER\n"); - ret = -1; - goto out; + if (access(file_path, F_OK) != -1) { + fprintf(stderr, "Output file already exists!\n"); + ret = -EEXIST; + goto out; + } } capabilities = wdc_get_drive_capabilities(r, dev); if ((capabilities & WDC_DRIVE_CAP_INTERNAL_LOG) == WDC_DRIVE_CAP_INTERNAL_LOG) { - if (!telemetry_data_area) - telemetry_data_area = 3; /* Set the default DA to 3 if not specified */ + if (!wdc_is_sn861(device_id)) { + /* Set the default DA to 3 if not specified */ + if (!telemetry_data_area) + telemetry_data_area = 3; + + ret = wdc_do_cap_diag(r, dev, f, xfer_size, + telemetry_type, telemetry_data_area); + } else { + if (cfg.verbose) + printf("Creating temp directory...\n"); + + ret = mkdir(fb, 0666); + if (ret) { + fprintf(stderr, "Failed to create directory!\n"); + goto out; + } - ret = wdc_do_cap_diag(r, dev, f, xfer_size, - telemetry_type, telemetry_data_area); + ret = dump_internal_logs(dev, fb, cfg.verbose); + if (ret < 0) + perror("vs-internal-log"); + + if (cfg.verbose) + printf("Archiving...\n"); + + if (snprintf(cmd_buf, PATH_MAX, + "tar --remove-files -czf %s %s", + file_path, fb) >= PATH_MAX) { + fprintf(stderr, "Command buffer is too long!\n"); + ret = -1; + goto out; + } + + ret = system(cmd_buf); + if (ret) + fprintf(stderr, "Failed to create an archive file!\n"); + } goto out; } if ((capabilities & WDC_DRIVE_CAP_DUI) == WDC_DRIVE_CAP_DUI) { @@ -4362,7 +4795,7 @@ static void wdc_print_dev_cap_log_normal(struct wdc_ocp_C4_dev_cap_log *log_data printf(" Minimum DSSD Power State : 0x%x\n", le16_to_cpu(log_data->min_dssd_ps)); for (j = 0; j < WDC_OCP_C4_NUM_PS_DESCR; j++) - printf(" DSSD Power State %d Desriptor : 0x%x\n", j, log_data->dssd_ps_descr[j]); + printf(" DSSD Power State %d Descriptor : 0x%x\n", j, log_data->dssd_ps_descr[j]); printf(" Log Page Version : 0x%x\n", le16_to_cpu(log_data->log_page_version)); printf(" Log page GUID : 0x"); @@ -5006,7 +5439,9 @@ static void wdc_get_commit_action_bin(__u8 commit_action_type, char *action_bin) } -static void wdc_print_fw_act_history_log_normal(__u8 *data, int num_entries, __u32 cust_id, __u32 vendor_id) +static void wdc_print_fw_act_history_log_normal(__u8 *data, int num_entries, + __u32 cust_id, __u32 vendor_id, + __u32 device_id) { int i, j; char previous_fw[9]; @@ -5020,7 +5455,9 @@ static void wdc_print_fw_act_history_log_normal(__u8 *data, int num_entries, __u if (data[0] == WDC_NVME_GET_FW_ACT_HISTORY_C2_LOG_ID) { printf(" Firmware Activate History Log\n"); - if (cust_id == WDC_CUSTOMER_ID_0x1005 || vendor_id == WDC_NVME_SNDK_VID) { + if (cust_id == WDC_CUSTOMER_ID_0x1005 || + vendor_id == WDC_NVME_SNDK_VID || + wdc_is_sn861(device_id)) { printf(" Power on Hour Power Cycle Previous New\n"); printf(" Entry hh:mm:ss Count Firmware Firmware Slot Action Result\n"); printf(" ----- ----------------- ----------------- --------- --------- ----- ------ -------\n"); @@ -5079,6 +5516,26 @@ static void wdc_print_fw_act_history_log_normal(__u8 *data, int num_entries, __u (int)((timestamp/1000)%60)); printf("%s", time_str); printf(" "); + } else if (wdc_is_sn861(device_id)) { + printf(" "); + char timestamp[20]; + __u64 hour; + __u8 min; + __u8 sec; + __u64 timestamp_sec; + + timestamp_sec = + le64_to_cpu(fw_act_history_entry->entry[entryIdx].timestamp) + / 1000; + hour = timestamp_sec / 3600; + min = (timestamp_sec % 3600) / 60; + sec = timestamp_sec % 60; + + sprintf(timestamp, + "%"PRIu64":%02"PRIu8":%02"PRIu8, + (uint64_t)hour, min, sec); + printf("%-11s", timestamp); + printf(" "); } else { printf(" "); uint64_t timestamp = (0x0000FFFFFFFFFFFF & le64_to_cpu(fw_act_history_entry->entry[entryIdx].timestamp)); @@ -5177,7 +5634,9 @@ static void wdc_print_fw_act_history_log_normal(__u8 *data, int num_entries, __u } } -static void wdc_print_fw_act_history_log_json(__u8 *data, int num_entries, __u32 cust_id, __u32 vendor_id) +static void wdc_print_fw_act_history_log_json(__u8 *data, int num_entries, + __u32 cust_id, __u32 vendor_id, + __u32 device_id) { struct json_object *root = json_create_object(); int i, j; @@ -5186,11 +5645,13 @@ static void wdc_print_fw_act_history_log_json(__u8 *data, int num_entries, __u32 char commit_action_bin[8]; char fail_str[32]; char time_str[11]; + char ext_time_str[20]; memset((void *)previous_fw, 0, 9); memset((void *)new_fw, 0, 9); memset((void *)commit_action_bin, 0, 8); memset((void *)time_str, 0, 11); + memset((void *)ext_time_str, 0, 20); memset((void *)fail_str, 0, 11); char *null_fw = "--------"; __u16 oldestEntryIdx = 0, entryIdx = 0; @@ -5242,6 +5703,17 @@ static void wdc_print_fw_act_history_log_json(__u8 *data, int num_entries, __u32 sprintf((char *)time_str, "%04d:%02d:%02d", (int)((timestamp/(3600*1000))%24), (int)((timestamp/(1000*60))%60), (int)((timestamp/1000)%60)); json_object_add_value_string(root, "Power on Hour", time_str); + } else if (wdc_is_sn861(device_id)) { + __u64 timestamp_sec = + le64_to_cpu(fw_act_history_entry->entry[entryIdx].timestamp) + / 1000; + + sprintf((char *)ext_time_str, + "%"PRIu64":%02"PRIu8":%02"PRIu8, + (uint64_t)(__u64)(timestamp_sec/3600), + (__u8)((timestamp_sec%3600)/60), + (__u8)(timestamp_sec%60)); + json_object_add_value_string(root, "Power on Hour", ext_time_str); } else { uint64_t timestamp = (0x0000FFFFFFFFFFFF & le64_to_cpu(fw_act_history_entry->entry[entryIdx].timestamp)); @@ -6071,7 +6543,7 @@ static void wdc_print_smart_cloud_attr_C0_normal(void *data) (uint16_t)le16_to_cpu(*(uint16_t *)&log_data[SCAO_CPH])); printf(" Unaligned I/O : %"PRIu64"\n", (uint64_t)le64_to_cpu(*(uint64_t *)&log_data[SCAO_UIO])); - printf(" Securqity Version Number : %"PRIu64"\n", + printf(" Security Version Number : %"PRIu64"\n", (uint64_t)le64_to_cpu(*(uint64_t *)&log_data[SCAO_SVN])); printf(" NUSE Namespace utilization : %"PRIu64"\n", (uint64_t)le64_to_cpu(*(uint64_t *)&log_data[SCAO_NUSE])); @@ -6465,17 +6937,19 @@ static int wdc_get_c0_log_page_sn(nvme_root_t r, struct nvme_dev *dev, int uuid_ static int wdc_get_c0_log_page(nvme_root_t r, struct nvme_dev *dev, char *format, int uuid_index, __u32 namespace_id) { - int ret = 0; - int fmt = -1; - __u8 *data; uint32_t device_id, read_vendor_id; + enum nvme_print_flags fmt; + int ret; + __u8 *data; + __u8 log_id; + __u32 length; if (!wdc_check_device(r, dev)) return -1; - fmt = validate_output_format(format); - if (fmt < 0) { + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: invalid output format\n"); - return fmt; + return ret; } ret = wdc_get_pci_ids(r, dev, &device_id, &read_vendor_id); @@ -6495,6 +6969,16 @@ static int wdc_get_c0_log_page(nvme_root_t r, struct nvme_dev *dev, char *format fallthrough; case WDC_NVME_SN860_DEV_ID: fallthrough; + case WDC_NVME_SN560_DEV_ID_1: + fallthrough; + case WDC_NVME_SN560_DEV_ID_2: + fallthrough; + case WDC_NVME_SN560_DEV_ID_3: + fallthrough; + case WDC_NVME_SN550_DEV_ID: + ret = wdc_get_c0_log_page_sn(r, dev, uuid_index, format, namespace_id, fmt); + break; + case WDC_NVME_SN650_DEV_ID: fallthrough; case WDC_NVME_SN650_DEV_ID_1: @@ -6506,16 +6990,63 @@ static int wdc_get_c0_log_page(nvme_root_t r, struct nvme_dev *dev, char *format case WDC_NVME_SN650_DEV_ID_4: fallthrough; case WDC_NVME_SN655_DEV_ID: - fallthrough; - case WDC_NVME_SN560_DEV_ID_1: - fallthrough; - case WDC_NVME_SN560_DEV_ID_2: - fallthrough; - case WDC_NVME_SN560_DEV_ID_3: - fallthrough; - case WDC_NVME_SN550_DEV_ID: - ret = wdc_get_c0_log_page_sn(r, dev, uuid_index, format, namespace_id, fmt); + if (uuid_index == 0) { + log_id = WDC_NVME_GET_SMART_CLOUD_ATTR_LOG_ID; + length = WDC_NVME_SMART_CLOUD_ATTR_LEN; + } else { + log_id = WDC_NVME_GET_EOL_STATUS_LOG_OPCODE; + length = WDC_NVME_EOL_STATUS_LOG_LEN; + } + + data = (__u8 *)malloc(sizeof(__u8) * length); + if (!data) { + fprintf(stderr, "ERROR: WDC: malloc: %s\n", strerror(errno)); + return -1; + } + + if (namespace_id == NVME_NSID_ALL) { + ret = nvme_get_nsid(dev_fd(dev), &namespace_id); + if (ret < 0) + namespace_id = NVME_NSID_ALL; + } + + /* Get the 0xC0 log data */ + struct nvme_get_log_args args = { + .args_size = sizeof(args), + .fd = dev_fd(dev), + .lid = log_id, + .nsid = namespace_id, + .lpo = 0, + .lsp = NVME_LOG_LSP_NONE, + .lsi = 0, + .rae = false, + .uuidx = uuid_index, + .csi = NVME_CSI_NVM, + .ot = false, + .len = length, + .log = data, + .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, + .result = NULL, + }; + ret = nvme_get_log(&args); + + if (strcmp(format, "json")) + nvme_show_status(ret); + + if (!ret) { + /* parse the data */ + if (uuid_index == 0) + wdc_print_c0_cloud_attr_log(data, fmt); + else + wdc_print_c0_eol_log(data, fmt); + } else { + fprintf(stderr, "ERROR: WDC: Unable to read C0 Log Page data "); + fprintf(stderr, "with uuid index %d\n", uuid_index); + ret = -1; + } + free(data); break; + case WDC_NVME_ZN350_DEV_ID: fallthrough; case WDC_NVME_ZN350_DEV_ID_1: @@ -6697,7 +7228,9 @@ static int wdc_print_d0_log(struct wdc_ssd_d0_smart_log *perf, int fmt) return 0; } -static int wdc_print_fw_act_history_log(__u8 *data, int num_entries, int fmt, __u32 cust_id, __u32 vendor_id) +static int wdc_print_fw_act_history_log(__u8 *data, int num_entries, int fmt, + __u32 cust_id, __u32 vendor_id, + __u32 device_id) { if (!data) { fprintf(stderr, "ERROR: WDC: Invalid buffer to read fw activate history entries\n"); @@ -6706,10 +7239,12 @@ static int wdc_print_fw_act_history_log(__u8 *data, int num_entries, int fmt, __ switch (fmt) { case NORMAL: - wdc_print_fw_act_history_log_normal(data, num_entries, cust_id, vendor_id); + wdc_print_fw_act_history_log_normal(data, num_entries, cust_id, + vendor_id, device_id); break; case JSON: - wdc_print_fw_act_history_log_json(data, num_entries, cust_id, vendor_id); + wdc_print_fw_act_history_log_json(data, num_entries, cust_id, + vendor_id, device_id); break; } return 0; @@ -6717,19 +7252,19 @@ static int wdc_print_fw_act_history_log(__u8 *data, int num_entries, int fmt, __ static int wdc_get_ca_log_page(nvme_root_t r, struct nvme_dev *dev, char *format) { - int ret = 0; - int fmt = -1; - __u8 *data; - struct wdc_ssd_ca_perf_stats *perf; uint32_t read_device_id, read_vendor_id; + struct wdc_ssd_ca_perf_stats *perf; + enum nvme_print_flags fmt; __u32 cust_id; + __u8 *data; + int ret; if (!wdc_check_device(r, dev)) return -1; - fmt = validate_output_format(format); - if (fmt < 0) { + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: invalid output format\n"); - return fmt; + return ret; } /* verify the 0xCA log page is supported */ @@ -6853,23 +7388,24 @@ static int wdc_get_ca_log_page(nvme_root_t r, struct nvme_dev *dev, char *format static int wdc_get_c1_log_page(nvme_root_t r, struct nvme_dev *dev, char *format, uint8_t interval) { - int ret = 0; - int fmt = -1; + struct wdc_log_page_subpage_header *sph; + struct wdc_ssd_perf_stats *perf; + struct wdc_log_page_header *l; + enum nvme_print_flags fmt; + int total_subpages; + int skip_cnt = 4; __u8 *data; __u8 *p; int i; - int skip_cnt = 4; - int total_subpages; - struct wdc_log_page_header *l; - struct wdc_log_page_subpage_header *sph; - struct wdc_ssd_perf_stats *perf; + int ret; if (!wdc_check_device(r, dev)) return -1; - fmt = validate_output_format(format); - if (fmt < 0) { + + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: invalid output format\n"); - return fmt; + return ret; } if (interval < 1 || interval > 15) { @@ -6911,18 +7447,19 @@ static int wdc_get_c1_log_page(nvme_root_t r, struct nvme_dev *dev, static int wdc_get_c3_log_page(nvme_root_t r, struct nvme_dev *dev, char *format) { - int ret = 0; - int fmt = -1; + struct wdc_ssd_latency_monitor_log *log_data; + enum nvme_print_flags fmt; __u8 *data; + int ret; int i; - struct wdc_ssd_latency_monitor_log *log_data; if (!wdc_check_device(r, dev)) return -1; - fmt = validate_output_format(format); - if (fmt < 0) { + + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: invalid output format\n"); - return fmt; + return ret; } data = (__u8 *)malloc(sizeof(__u8) * WDC_LATENCY_MON_LOG_BUF_LEN); @@ -6982,18 +7519,19 @@ out: static int wdc_get_ocp_c1_log_page(nvme_root_t r, struct nvme_dev *dev, char *format) { - int ret = 0; - int fmt = -1; + struct wdc_ocp_c1_error_recovery_log *log_data; + enum nvme_print_flags fmt; __u8 *data; + int ret; int i; - struct wdc_ocp_c1_error_recovery_log *log_data; if (!wdc_check_device(r, dev)) return -1; - fmt = validate_output_format(format); - if (fmt < 0) { + + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: invalid output format\n"); - return fmt; + return ret; } data = (__u8 *)malloc(sizeof(__u8) * WDC_ERROR_REC_LOG_BUF_LEN); @@ -7052,18 +7590,19 @@ out: static int wdc_get_ocp_c4_log_page(nvme_root_t r, struct nvme_dev *dev, char *format) { - int ret = 0; - int fmt = -1; + struct wdc_ocp_C4_dev_cap_log *log_data; + enum nvme_print_flags fmt; __u8 *data; + int ret; int i; - struct wdc_ocp_C4_dev_cap_log *log_data; if (!wdc_check_device(r, dev)) return -1; - fmt = validate_output_format(format); - if (fmt < 0) { + + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: invalid output format\n"); - return fmt; + return ret; } data = (__u8 *)malloc(sizeof(__u8) * WDC_DEV_CAP_LOG_BUF_LEN); @@ -7121,18 +7660,19 @@ out: static int wdc_get_ocp_c5_log_page(nvme_root_t r, struct nvme_dev *dev, char *format) { - int ret = 0; - int fmt = -1; + struct wdc_ocp_C5_unsupported_reqs *log_data; + enum nvme_print_flags fmt; + int ret; __u8 *data; int i; - struct wdc_ocp_C5_unsupported_reqs *log_data; if (!wdc_check_device(r, dev)) return -1; - fmt = validate_output_format(format); - if (fmt < 0) { + + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: invalid output format\n"); - return fmt; + return ret; } data = (__u8 *)malloc(sizeof(__u8) * WDC_UNSUPPORTED_REQS_LOG_BUF_LEN); @@ -7190,17 +7730,18 @@ out: static int wdc_get_d0_log_page(nvme_root_t r, struct nvme_dev *dev, char *format) { + struct wdc_ssd_d0_smart_log *perf; + enum nvme_print_flags fmt; int ret = 0; - int fmt = -1; __u8 *data; - struct wdc_ssd_d0_smart_log *perf; if (!wdc_check_device(r, dev)) return -1; - fmt = validate_output_format(format); - if (fmt < 0) { + + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: invalid output format\n"); - return fmt; + return ret; } /* verify the 0xD0 log page is supported */ @@ -7235,6 +7776,235 @@ static int wdc_get_d0_log_page(nvme_root_t r, struct nvme_dev *dev, char *format return ret; } +static long double le_to_float(__u8 *data, int byte_len) +{ + long double result = 0; + int i; + + for (i = 0; i < byte_len; i++) { + result *= 256; + result += data[15 - i]; + } + + return result; +} + +static void stringify_log_page_guid(__u8 *guid, char *buf) +{ + char *ptr = buf; + int i; + + memset(buf, 0, sizeof(char) * 19); + + ptr += sprintf(ptr, "0x"); + for (i = 0; i < 16; i++) + ptr += sprintf(ptr, "%x", guid[15 - i]); +} + +static const char *const cloud_smart_log_thermal_status[] = { + [0x00] = "unthrottled", + [0x01] = "first_level", + [0x02] = "second_level", + [0x03] = "third_level", +}; + +static const char *stringify_cloud_smart_log_thermal_status(__u8 status) +{ + if (status < ARRAY_SIZE(cloud_smart_log_thermal_status) && + cloud_smart_log_thermal_status[status]) + return cloud_smart_log_thermal_status[status]; + return "unrecognized"; +} + +static void show_cloud_smart_log_json(struct ocp_cloud_smart_log *log) +{ + struct json_object *root; + struct json_object *bad_user_nand_blocks; + struct json_object *bad_system_nand_blocks; + struct json_object *e2e_correction_counts; + struct json_object *user_data_erase_counts; + struct json_object *thermal_status; + struct json_object *dssd_specific_ver; + char buf[2 * sizeof(log->log_page_guid) + 3]; + + bad_user_nand_blocks = json_create_object(); + json_object_add_value_uint(bad_user_nand_blocks, "normalized", + le16_to_cpu(log->bad_user_nand_blocks.normalized)); + json_object_add_value_uint(bad_user_nand_blocks, "raw", + le64_to_cpu(log->bad_user_nand_blocks.raw)); + + bad_system_nand_blocks = json_create_object(); + json_object_add_value_uint(bad_system_nand_blocks, "normalized", + le16_to_cpu(log->bad_system_nand_blocks.normalized)); + json_object_add_value_uint(bad_system_nand_blocks, "raw", + le64_to_cpu(log->bad_system_nand_blocks.raw)); + + e2e_correction_counts = json_create_object(); + json_object_add_value_uint(e2e_correction_counts, "corrected", + le32_to_cpu(log->e2e_correction_counts.corrected)); + json_object_add_value_uint(e2e_correction_counts, "detected", + le32_to_cpu(log->e2e_correction_counts.detected)); + + user_data_erase_counts = json_create_object(); + json_object_add_value_uint(user_data_erase_counts, "minimum", + le32_to_cpu(log->user_data_erase_counts.minimum)); + json_object_add_value_uint(user_data_erase_counts, "maximum", + le32_to_cpu(log->user_data_erase_counts.maximum)); + + thermal_status = json_create_object(); + json_object_add_value_string(thermal_status, "current_status", + stringify_cloud_smart_log_thermal_status(log->thermal_status.current_status)); + json_object_add_value_uint(thermal_status, "num_events", + log->thermal_status.num_events); + + dssd_specific_ver = json_create_object(); + json_object_add_value_uint(dssd_specific_ver, "major_ver", + log->dssd_specific_ver.major_ver); + json_object_add_value_uint(dssd_specific_ver, "minor_ver", + le16_to_cpu(log->dssd_specific_ver.minor_ver)); + json_object_add_value_uint(dssd_specific_ver, "point_ver", + le16_to_cpu(log->dssd_specific_ver.point_ver)); + json_object_add_value_uint(dssd_specific_ver, "errata_ver", + log->dssd_specific_ver.errata_ver); + + root = json_create_object(); + json_object_add_value_uint64(root, "physical_media_units_written", + le_to_float(log->physical_media_units_written, 16)); + json_object_add_value_uint64(root, "physical_media_units_read", + le_to_float(log->physical_media_units_read, 16)); + json_object_add_value_object(root, "bad_user_nand_blocks", + bad_user_nand_blocks); + json_object_add_value_object(root, "bad_system_nand_blocks", + bad_system_nand_blocks); + json_object_add_value_uint(root, "xor_recovery_count", + le64_to_cpu(log->xor_recovery_count)); + json_object_add_value_uint(root, "uncorrectable_read_error_count", + le64_to_cpu(log->uncorrectable_read_error_count)); + json_object_add_value_uint(root, "soft_ecc_error_count", + le64_to_cpu(log->soft_ecc_error_count)); + json_object_add_value_object(root, "e2e_correction_counts", + e2e_correction_counts); + json_object_add_value_uint(root, "system_data_percent_used", + log->system_data_percent_used); + json_object_add_value_uint(root, "refresh_counts", + le64_to_cpu(log->refresh_counts)); + json_object_add_value_object(root, "user_data_erase_counts", + user_data_erase_counts); + json_object_add_value_object(root, "thermal_status", thermal_status); + json_object_add_value_object(root, "dssd_specific_ver", + dssd_specific_ver); + json_object_add_value_uint(root, "pcie_correctable_error_count", + le64_to_cpu(log->pcie_correctable_error_count)); + json_object_add_value_uint(root, "incomplete_shutdowns", + le32_to_cpu(log->incomplete_shutdowns)); + json_object_add_value_uint(root, "percent_free_blocks", + log->percent_free_blocks); + json_object_add_value_uint(root, "capacitor_health", + le16_to_cpu(log->capacitor_health)); + sprintf(buf, "%c", log->nvme_errata_ver); + json_object_add_value_string(root, "nvme_errata_version", buf); + json_object_add_value_uint(root, "unaligned_io", + le64_to_cpu(log->unaligned_io)); + json_object_add_value_uint(root, "security_version_number", + le64_to_cpu(log->security_version_number)); + json_object_add_value_uint(root, "total_nuse", + le64_to_cpu(log->total_nuse)); + json_object_add_value_uint64(root, "plp_start_count", + le_to_float(log->plp_start_count, 16)); + json_object_add_value_uint64(root, "endurance_estimate", + le_to_float(log->endurance_estimate, 16)); + json_object_add_value_uint(root, "pcie_link_retraining_count", + le64_to_cpu(log->pcie_link_retraining_cnt)); + json_object_add_value_uint(root, "power_state_change_count", + le64_to_cpu(log->power_state_change_cnt)); + json_object_add_value_uint(root, "log_page_version", + le16_to_cpu(log->log_page_version)); + stringify_log_page_guid(log->log_page_guid, buf); + json_object_add_value_string(root, "log_page_guid", buf); + + json_print_object(root, NULL); + printf("\n"); + json_free_object(root); +} + +static void show_cloud_smart_log_normal(struct ocp_cloud_smart_log *log, struct nvme_dev *dev) +{ + char buf[2 * sizeof(log->log_page_guid) + 3]; + + printf("Smart Extended Log for NVME device:%s\n", dev->name); + printf("Physical Media Units Written : %'.0Lf\n", + le_to_float(log->physical_media_units_written, 16)); + printf("Physical Media Units Read : %'.0Lf\n", + le_to_float(log->physical_media_units_read, 16)); + printf("Bad User NAND Blocks (Normalized) : %" PRIu16 "%%\n", + le16_to_cpu(log->bad_user_nand_blocks.normalized)); + printf("Bad User NAND Blocks (Raw) : %" PRIu64 "\n", + le64_to_cpu(log->bad_user_nand_blocks.raw)); + printf("Bad System NAND Blocks (Normalized) : %" PRIu16 "%%\n", + le16_to_cpu(log->bad_system_nand_blocks.normalized)); + printf("Bad System NAND Blocks (Raw) : %" PRIu64 "\n", + le64_to_cpu(log->bad_system_nand_blocks.raw)); + printf("XOR Recovery Count : %" PRIu64 "\n", + le64_to_cpu(log->xor_recovery_count)); + printf("Uncorrectable Read Error Count : %" PRIu64 "\n", + le64_to_cpu(log->uncorrectable_read_error_count)); + printf("Soft ECC Error Count : %" PRIu64 "\n", + le64_to_cpu(log->soft_ecc_error_count)); + printf("End to End Correction Counts (Corrected) : %" PRIu32 "\n", + le32_to_cpu(log->e2e_correction_counts.corrected)); + printf("End to End Correction Counts (Detected) : %" PRIu32 "\n", + le32_to_cpu(log->e2e_correction_counts.detected)); + printf("System Data %% Used : %" PRIu8 "%%\n", + log->system_data_percent_used); + printf("Refresh Counts : %" PRIu64 "\n", + le64_to_cpu(log->refresh_counts)); + printf("User Data Erase Counts (Minimum) : %" PRIu32 "\n", + le32_to_cpu(log->user_data_erase_counts.minimum)); + printf("User Data Erase Counts (Maximum) : %" PRIu32 "\n", + le32_to_cpu(log->user_data_erase_counts.maximum)); + printf("Thermal Throttling Status (Current Status) : %s\n", + stringify_cloud_smart_log_thermal_status(log->thermal_status.current_status)); + printf("Thermal Throttling Status (Number of Events) : %" PRIu8 "\n", + log->thermal_status.num_events); + printf("NVMe Major Version : %" PRIu8 "\n", + log->dssd_specific_ver.major_ver); + printf(" Minor Version : %" PRIu16 "\n", + le16_to_cpu(log->dssd_specific_ver.minor_ver)); + printf(" Point Version : %" PRIu16 "\n", + le16_to_cpu(log->dssd_specific_ver.point_ver)); + printf(" Errata Version : %" PRIu8 "\n", + log->dssd_specific_ver.errata_ver); + printf("PCIe Correctable Error Count : %" PRIu64 "\n", + le64_to_cpu(log->pcie_correctable_error_count)); + printf("Incomplete Shutdowns : %" PRIu32 "\n", + le32_to_cpu(log->incomplete_shutdowns)); + printf("%% Free Blocks : %" PRIu8 "%%\n", + log->percent_free_blocks); + printf("Capacitor Health : %" PRIu16 "%%\n", + le16_to_cpu(log->capacitor_health)); + printf("NVMe Errata Version : %c\n", + log->nvme_errata_ver); + printf("Unaligned IO : %" PRIu64 "\n", + le64_to_cpu(log->unaligned_io)); + printf("Security Version Number : %" PRIu64 "\n", + le64_to_cpu(log->security_version_number)); + printf("Total NUSE : %" PRIu64 "\n", + le64_to_cpu(log->total_nuse)); + printf("PLP Start Count : %'.0Lf\n", + le_to_float(log->plp_start_count, 16)); + printf("Endurance Estimate : %'.0Lf\n", + le_to_float(log->endurance_estimate, 16)); + printf("PCIe Link Retraining Count : %" PRIu64 "\n", + le64_to_cpu(log->pcie_link_retraining_cnt)); + printf("Power State Change Count : %" PRIu64 "\n", + le64_to_cpu(log->power_state_change_cnt)); + printf("Log Page Version : %" PRIu16 "\n", + le16_to_cpu(log->log_page_version)); + stringify_log_page_guid(log->log_page_guid, buf); + printf("Log Page GUID : %s\n", buf); + printf("\n\n"); +} + static int wdc_vs_smart_add_log(int argc, char **argv, struct command *command, struct plugin *plugin) { @@ -7243,6 +8013,7 @@ static int wdc_vs_smart_add_log(int argc, char **argv, struct command *command, const char *log_page_version = "Log Page Version: 0 = vendor, 1 = WDC"; const char *log_page_mask = "Log Page Mask, comma separated list: 0xC0, 0xC1, 0xCA, 0xD0"; const char *namespace_id = "desired namespace id"; + enum nvme_print_flags fmt; struct nvme_dev *dev; nvme_root_t r; int ret = 0; @@ -7250,6 +8021,7 @@ static int wdc_vs_smart_add_log(int argc, char **argv, struct command *command, int page_mask = 0, num, i; int log_page_list[16]; __u64 capabilities = 0; + __u32 device_id, read_vendor_id; struct config { uint8_t interval; @@ -7269,7 +8041,7 @@ static int wdc_vs_smart_add_log(int argc, char **argv, struct command *command, OPT_ARGS(opts) = { OPT_UINT("interval", 'i', &cfg.interval, interval), - OPT_FMT("output-format", 'o', &cfg.output_format, "Output Format: normal|json"), + OPT_FMT("output-format", 'o', &cfg.output_format, output_format), OPT_BYTE("log-page-version", 'l', &cfg.log_page_version, log_page_version), OPT_LIST("log-page-mask", 'p', &cfg.log_page_mask, log_page_mask), OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id), @@ -7317,8 +8089,9 @@ static int wdc_vs_smart_add_log(int argc, char **argv, struct command *command, if (!page_mask) fprintf(stderr, "ERROR: WDC: Unknown log page mask - %s\n", cfg.log_page_mask); - capabilities = wdc_get_drive_capabilities(r, dev); + ret = wdc_get_pci_ids(r, dev, &device_id, &read_vendor_id); + capabilities = wdc_get_drive_capabilities(r, dev); if (!(capabilities & WDC_DRIVE_CAP_SMART_LOG_MASK)) { fprintf(stderr, "ERROR: WDC: unsupported device for this command\n"); ret = -1; @@ -7328,13 +8101,56 @@ static int wdc_vs_smart_add_log(int argc, char **argv, struct command *command, if (((capabilities & WDC_DRIVE_CAP_C0_LOG_PAGE) == WDC_DRIVE_CAP_C0_LOG_PAGE) && (page_mask & WDC_C0_PAGE_MASK)) { /* Get 0xC0 log page if possible. */ - ret = wdc_get_c0_log_page(r, dev, cfg.output_format, - uuid_index, cfg.namespace_id); - if (ret) - fprintf(stderr, "ERROR: WDC: Failure reading the C0 Log Page, ret = %d\n", ret); + if (!wdc_is_sn861(device_id)) { + ret = wdc_get_c0_log_page(r, dev, cfg.output_format, + uuid_index, cfg.namespace_id); + if (ret) + fprintf(stderr, + "ERROR: WDC: Failure reading the C0 Log Page, ret = %d\n", + ret); + } else { + struct ocp_cloud_smart_log log; + char buf[2 * sizeof(log.log_page_guid) + 3]; + + ret = validate_output_format(output_format, &fmt); + if (ret < 0) { + fprintf(stderr, "Invalid output format: %s\n", cfg.output_format); + goto out; + } + + ret = nvme_get_log_simple(dev_fd(dev), + WDC_NVME_GET_SMART_CLOUD_ATTR_LOG_ID, + sizeof(log), &log); + if (!ret) { + char *ptr = buf; + int i; + __u8 *guid = log.log_page_guid; + + memset(buf, 0, sizeof(char) * 19); + + ptr += sprintf(ptr, "0x"); + for (i = 0; i < 16; i++) + ptr += sprintf(ptr, "%x", guid[15 - i]); + if (strcmp(buf, "0xafd514c97c6f4f9ca4f2bfea2810afc5")) + fprintf(stderr, "Invalid GUID: %s\n", buf); + else { + if (fmt == BINARY) + d_raw((unsigned char *)&log, sizeof(log)); + else if (fmt == JSON) + show_cloud_smart_log_json(&log); + else + show_cloud_smart_log_normal(&log, dev); + } + } else if (ret > 0) { + nvme_show_status(ret); + } else { + perror("vs-smart-add-log"); + } + } } if (((capabilities & (WDC_DRIVE_CAP_CA_LOG_PAGE)) == (WDC_DRIVE_CAP_CA_LOG_PAGE)) && - (page_mask & WDC_CA_PAGE_MASK)) { + (page_mask & WDC_CA_PAGE_MASK) && + (!wdc_is_sn861(device_id))) { /* Get the CA Log Page */ ret = wdc_get_ca_log_page(r, dev, cfg.output_format); if (ret) @@ -7367,10 +8183,11 @@ static int wdc_vs_cloud_log(int argc, char **argv, struct command *command, { const char *desc = "Retrieve Cloud Log Smart/Health Information"; const char *namespace_id = "desired namespace id"; + enum nvme_print_flags fmt; __u64 capabilities = 0; struct nvme_dev *dev; - int ret, fmt = -1; nvme_root_t r; + int ret; __u8 *data; struct config { @@ -7411,14 +8228,13 @@ static int wdc_vs_cloud_log(int argc, char **argv, struct command *command, nvme_show_status(ret); if (!ret) { - fmt = validate_output_format(cfg.output_format); - if (fmt < 0) { + ret = validate_output_format(cfg.output_format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC %s: invalid output format\n", __func__); - ret = fmt; + } else { + /* parse the data */ + wdc_print_ext_smart_cloud_log(data, fmt); } - - /* parse the data */ - wdc_print_ext_smart_cloud_log(data, fmt); } else { fprintf(stderr, "ERROR: WDC: Unable to read C0 Log Page V1 data\n"); ret = -1; @@ -7438,9 +8254,10 @@ static int wdc_vs_hw_rev_log(int argc, char **argv, struct command *command, { const char *desc = "Retrieve Hardware Revision Log Information"; const char *namespace_id = "desired namespace id"; + enum nvme_print_flags fmt; __u64 capabilities = 0; struct nvme_dev *dev; - int ret, fmt = -1; + int ret; __u8 *data = NULL; nvme_root_t r; @@ -7480,10 +8297,9 @@ static int wdc_vs_hw_rev_log(int argc, char **argv, struct command *command, nvme_show_status(ret); if (!ret) { - fmt = validate_output_format(cfg.output_format); - if (fmt < 0) { + ret = validate_output_format(cfg.output_format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC %s: invalid output format\n", __func__); - ret = fmt; goto free_buf; } @@ -7499,6 +8315,8 @@ static int wdc_vs_hw_rev_log(int argc, char **argv, struct command *command, case JSON: wdc_print_hw_rev_log_json(data); break; + default: + break; } } else { fprintf(stderr, "ERROR: WDC: Unable to read Hardware Revision Log Page data\n"); @@ -7521,11 +8339,11 @@ static int wdc_vs_device_waf(int argc, char **argv, struct command *command, const char *desc = "Retrieve Device Write Amplication Factor"; const char *namespace_id = "desired namespace id"; struct nvme_smart_log smart_log; + enum nvme_print_flags fmt; struct nvme_dev *dev; __u8 *data; nvme_root_t r; int ret = 0; - int fmt = -1; __u64 capabilities = 0; struct __packed wdc_nvme_ext_smart_log * ext_smart_log_ptr; long double data_units_written = 0, @@ -7601,10 +8419,9 @@ static int wdc_vs_device_waf(int argc, char **argv, struct command *command, if (strcmp(cfg.output_format, "json")) nvme_show_status(ret); - fmt = validate_output_format(cfg.output_format); - if (fmt < 0) { + ret = validate_output_format(cfg.output_format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC %s: invalid output format\n", __func__); - ret = fmt; goto out; } @@ -7936,7 +8753,7 @@ static int wdc_drive_status(int argc, char **argv, struct command *command, /* verify the 0xC2 Device Manageability log page is supported */ if (wdc_nvme_check_supported_log_page(r, dev, - WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_OPCODE) == false) { + WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID) == false) { fprintf(stderr, "ERROR: WDC: 0xC2 Log Page not supported\n"); ret = -1; goto out; @@ -8078,18 +8895,18 @@ out: static int wdc_get_fw_act_history(nvme_root_t r, struct nvme_dev *dev, char *format) { - int ret = 0; - int fmt = -1; - __u8 *data; struct wdc_fw_act_history_log_hdr *fw_act_history_hdr; + enum nvme_print_flags fmt; + int ret; + __u8 *data; if (!wdc_check_device(r, dev)) return -1; - fmt = validate_output_format(format); - if (fmt < 0) { + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: invalid output format\n"); - return fmt; + return ret; } /* verify the FW Activate History log page is supported */ @@ -8121,7 +8938,7 @@ static int wdc_get_fw_act_history(nvme_root_t r, struct nvme_dev *dev, if ((fw_act_history_hdr->num_entries > 0) && (fw_act_history_hdr->num_entries <= WDC_MAX_NUM_ACT_HIST_ENTRIES)) { ret = wdc_print_fw_act_history_log(data, fw_act_history_hdr->num_entries, - fmt, 0, 0); + fmt, 0, 0, 0); } else if (!fw_act_history_hdr->num_entries) { fprintf(stderr, "INFO: WDC: No FW Activate History entries found.\n"); ret = 0; @@ -8159,21 +8976,21 @@ static __u32 wdc_get_fw_cust_id(nvme_root_t r, struct nvme_dev *dev) static int wdc_get_fw_act_history_C2(nvme_root_t r, struct nvme_dev *dev, char *format) { - int ret = 0; - int fmt = -1; - __u8 *data; - __u32 cust_id; struct wdc_fw_act_history_log_format_c2 *fw_act_history_log; __u32 tot_entries = 0, num_entries = 0; __u32 vendor_id = 0, device_id = 0; + __u32 cust_id = 0; + enum nvme_print_flags fmt; + __u8 *data; + int ret; if (!wdc_check_device(r, dev)) return -1; - fmt = validate_output_format(format); - if (fmt < 0) { + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: invalid output format\n"); - return fmt; + return ret; } ret = wdc_get_pci_ids(r, dev, &device_id, &vendor_id); @@ -8200,15 +9017,20 @@ static int wdc_get_fw_act_history_C2(nvme_root_t r, struct nvme_dev *dev, if (tot_entries > 0) { /* get the FW customer id */ - cust_id = wdc_get_fw_cust_id(r, dev); - if (cust_id == WDC_INVALID_CUSTOMER_ID) { - fprintf(stderr, "%s: ERROR: WDC: invalid customer id\n", __func__); - ret = -1; - goto freeData; + if (!wdc_is_sn861(device_id)) { + cust_id = wdc_get_fw_cust_id(r, dev); + if (cust_id == WDC_INVALID_CUSTOMER_ID) { + fprintf(stderr, + "%s: ERROR: WDC: invalid customer id\n", + __func__); + ret = -1; + goto freeData; + } } num_entries = (tot_entries < WDC_MAX_NUM_ACT_HIST_ENTRIES) ? tot_entries : WDC_MAX_NUM_ACT_HIST_ENTRIES; - ret = wdc_print_fw_act_history_log(data, num_entries, fmt, cust_id, vendor_id); + ret = wdc_print_fw_act_history_log(data, num_entries, + fmt, cust_id, vendor_id, device_id); } else { fprintf(stderr, "INFO: WDC: No FW Activate History entries found.\n"); ret = 0; @@ -9437,7 +10259,7 @@ static int wdc_reason_identifier(int argc, char **argv, cfg.log_id != NVME_LOG_LID_TELEMETRY_CTRL) { fprintf(stderr, "ERROR: WDC: Invalid Log ID. It must be 7 (Host) or 8 (Controller)\n"); ret = -1; - goto close_fd; + goto close_dev; } if (cfg.file) { @@ -9448,7 +10270,7 @@ static int wdc_reason_identifier(int argc, char **argv, if (verify_file < 0) { fprintf(stderr, "ERROR: WDC: open: %s\n", strerror(errno)); ret = -1; - goto close_fd; + goto close_dev; } close(verify_file); strncpy(f, cfg.file, PATH_MAX - 1); @@ -9466,12 +10288,12 @@ static int wdc_reason_identifier(int argc, char **argv, if (wdc_get_serial_name(dev, f, PATH_MAX, fileSuffix) == -1) { fprintf(stderr, "ERROR: WDC: failed to generate file name\n"); ret = -1; - goto close_fd; + goto close_dev; } if (strlen(f) > PATH_MAX - 5) { fprintf(stderr, "ERROR: WDC: file name overflow\n"); ret = -1; - goto close_fd; + goto close_dev; } strcat(f, ".bin"); } @@ -9488,7 +10310,7 @@ static int wdc_reason_identifier(int argc, char **argv, nvme_show_status(ret); -close_fd: +close_dev: dev_close(dev); nvme_free_tree(r); return ret; @@ -9570,10 +10392,104 @@ static const char *nvme_log_id_to_string(__u8 log_id) } } +static void __json_log_page_directory(struct log_page_directory *directory) +{ + __u32 bitmap_idx; + __u8 log_id; + struct json_object *root; + struct json_object *entries; + + root = json_create_object(); + + entries = json_create_array(); + json_object_add_value_array(root, "Entries", entries); + + for (bitmap_idx = 0; bitmap_idx < BYTE_TO_BIT(sizeof(__u64)); bitmap_idx++) { + log_id = bitmap_idx; + if (!log_page_name[log_id]) + continue; + if (directory->supported_lid_bitmap & (1ULL << bitmap_idx)) { + struct json_object *json_entry = json_create_object(); + + json_object_add_value_uint(json_entry, "Log ID", log_id); + json_object_add_value_string(json_entry, "Log Page Name", + log_page_name[log_id]); + + json_array_add_value_object(entries, json_entry); + } + } + + for (bitmap_idx = 0; bitmap_idx < BYTE_TO_BIT(sizeof(__u64)); bitmap_idx++) { + log_id = NVME_LOG_NS_BASE + bitmap_idx; + if (!log_page_name[log_id]) + continue; + if (directory->supported_ns_lid_bitmap & (1ULL << bitmap_idx)) { + struct json_object *json_entry = json_create_object(); + + json_object_add_value_uint(json_entry, "Log ID", log_id); + json_object_add_value_string(json_entry, "Log Page Name", + log_page_name[log_id]); + + json_array_add_value_object(entries, json_entry); + } + } + + for (bitmap_idx = 0; bitmap_idx < BYTE_TO_BIT(sizeof(__u64)); bitmap_idx++) { + log_id = NVME_LOG_VS_BASE + bitmap_idx; + if (!log_page_name[log_id]) + continue; + if (directory->supported_vs_lid_bitmap & (1ULL << bitmap_idx)) { + struct json_object *json_entry = json_create_object(); + + json_object_add_value_uint(json_entry, "Log ID", log_id); + json_object_add_value_string(json_entry, "Log Page Name", + log_page_name[log_id]); + + json_array_add_value_object(entries, json_entry); + } + } + + json_print_object(root, NULL); + printf("\n"); + json_free_object(root); +} + + +static void __show_log_page_directory(struct log_page_directory *directory) +{ + __u32 bitmap_idx; + __u8 log_id; + + for (bitmap_idx = 0; bitmap_idx < BYTE_TO_BIT(sizeof(__u64)); bitmap_idx++) { + if (directory->supported_lid_bitmap & (1ULL << bitmap_idx)) { + log_id = bitmap_idx; + if (log_page_name[log_id]) + printf("0x%02X: %s\n", log_id, log_page_name[log_id]); + } + } + + for (bitmap_idx = 0; bitmap_idx < BYTE_TO_BIT(sizeof(__u64)); bitmap_idx++) { + if (directory->supported_ns_lid_bitmap & (1ULL << bitmap_idx)) { + log_id = NVME_LOG_NS_BASE + bitmap_idx; + if (log_page_name[log_id]) + printf("0x%02X: %s\n", log_id, log_page_name[log_id]); + } + } + + for (bitmap_idx = 0; bitmap_idx < BYTE_TO_BIT(sizeof(__u64)); bitmap_idx++) { + if (directory->supported_vs_lid_bitmap & (1ULL << bitmap_idx)) { + log_id = NVME_LOG_VS_BASE + bitmap_idx; + if (log_page_name[log_id]) + printf("0x%02X: %s\n", log_id, log_page_name[log_id]); + } + } +} + static int wdc_log_page_directory(int argc, char **argv, struct command *command, struct plugin *plugin) { const char *desc = "Retrieve Log Page Directory."; + enum nvme_print_flags fmt; struct nvme_dev *dev; int ret = 0; nvme_root_t r; @@ -9582,6 +10498,8 @@ static int wdc_log_page_directory(int argc, char **argv, struct command *command int i; __u8 log_id = 0; __u32 device_id, read_vendor_id; + bool uuid_supported = false; + struct nvme_id_uuid_list uuid_list; struct config { char *output_format; @@ -9600,13 +10518,12 @@ static int wdc_log_page_directory(int argc, char **argv, struct command *command if (ret) return ret; - ret = validate_output_format(cfg.output_format); + ret = validate_output_format(cfg.output_format, &fmt); if (ret < 0) { fprintf(stderr, "%s: ERROR: WDC: invalid output format\n", __func__); dev_close(dev); return ret; } - ret = 0; r = nvme_scan(NULL); capabilities = wdc_get_drive_capabilities(r, dev); @@ -9615,54 +10532,110 @@ static int wdc_log_page_directory(int argc, char **argv, struct command *command fprintf(stderr, "ERROR: WDC: unsupported device for this command\n"); ret = -1; } else { - ret = wdc_get_pci_ids(r, dev, &device_id, &read_vendor_id); - log_id = (device_id == WDC_NVME_ZN350_DEV_ID || device_id == WDC_NVME_ZN350_DEV_ID_1) ? - WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_OPCODE_C8 : WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_OPCODE; - /* verify the 0xC2 Device Manageability log page is supported */ - if (wdc_nvme_check_supported_log_page(r, dev, log_id) == false) { - fprintf(stderr, "%s: ERROR: WDC: 0x%x Log Page not supported\n", __func__, log_id); - ret = -1; - goto out; - } - if (get_dev_mgment_cbs_data(r, dev, WDC_C2_LOG_PAGES_SUPPORTED_ID, (void *)&cbs_data)) { - if (cbs_data) { - printf("Log Page Directory\n"); - /* print the supported pages */ - if (!strcmp(cfg.output_format, "normal")) { - for (i = 0; i < le32_to_cpu(cbs_data->length); i++) - printf("0x%x - %s\n", cbs_data->data[i], - nvme_log_id_to_string(cbs_data->data[i])); - } else if (!strcmp(cfg.output_format, "binary")) { - d((__u8 *)cbs_data->data, le32_to_cpu(cbs_data->length), 16, - 1); - } else if (!strcmp(cfg.output_format, "json")) { - struct json_object *root = json_create_object(); - - for (i = 0; i < le32_to_cpu(cbs_data->length); i++) - json_object_add_value_int(root, - nvme_log_id_to_string(cbs_data->data[i]), - cbs_data->data[i]); + memset(&uuid_list, 0, sizeof(struct nvme_id_uuid_list)); + if (wdc_CheckUuidListSupport(dev, &uuid_list)) + uuid_supported = true; - json_print_object(root, NULL); - printf("\n"); - json_free_object(root); - } else { - fprintf(stderr, - "%s: ERROR: WDC: Invalid format, format = %s\n", - __func__, cfg.output_format); + if (uuid_supported) + fprintf(stderr, "WDC: UUID lists supported\n"); + else + fprintf(stderr, "WDC: UUID lists NOT supported\n"); + + + ret = wdc_get_pci_ids(r, dev, &device_id, &read_vendor_id); + log_id = (device_id == WDC_NVME_ZN350_DEV_ID || + device_id == WDC_NVME_ZN350_DEV_ID_1) ? + WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID_C8 : + WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID; + + if (!wdc_is_sn861(device_id)) { + /* verify the 0xC2 Device Manageability log page is supported */ + if (wdc_nvme_check_supported_log_page(r, dev, log_id) == false) { + fprintf(stderr, + "%s: ERROR: WDC: 0x%x Log Page not supported\n", + __func__, log_id); + ret = -1; + goto out; + } + + if (!get_dev_mgment_cbs_data(r, dev, + WDC_C2_LOG_PAGES_SUPPORTED_ID, + (void *)&cbs_data)) { + fprintf(stderr, + "%s: ERROR: WDC: 0xC2 Log Page entry ID 0x%x not found\n", + __func__, WDC_C2_LOG_PAGES_SUPPORTED_ID); + ret = -1; + goto out; + } + if (!cbs_data) { + fprintf(stderr, "%s: ERROR: WDC: NULL_data ptr\n", __func__); + ret = -1; + goto out; + } + printf("Log Page Directory\n"); + /* print the supported pages */ + if (!strcmp(cfg.output_format, "normal")) { + for (i = 0; i < le32_to_cpu(cbs_data->length); i++) + printf("0x%x - %s\n", cbs_data->data[i], + nvme_log_id_to_string(cbs_data->data[i])); + } else if (!strcmp(cfg.output_format, "binary")) { + d((__u8 *)cbs_data->data, + le32_to_cpu(cbs_data->length), 16, 1); + } else if (!strcmp(cfg.output_format, "json")) { + struct json_object *root = json_create_object(); + + for (i = 0; i < le32_to_cpu(cbs_data->length); i++) { + json_object_add_value_int(root, + nvme_log_id_to_string(cbs_data->data[i]), + cbs_data->data[i]); } - free(cbs_data); + json_print_object(root, NULL); + printf("\n"); + json_free_object(root); } else { - fprintf(stderr, "%s: ERROR: WDC: NULL_data ptr\n", __func__); + fprintf(stderr, + "%s: ERROR: WDC: Invalid format, format = %s\n", + __func__, cfg.output_format); } + + free(cbs_data); } else { - fprintf(stderr, "%s: ERROR: WDC: 0xC2 Log Page entry ID 0x%x not found\n", - __func__, WDC_C2_LOG_PAGES_SUPPORTED_ID); - } + struct log_page_directory *dir; + void *data = NULL; + __u32 result; + + if (posix_memalign(&data, getpagesize(), 512)) { + fprintf(stderr, + "can not allocate log page directory payload\n"); + ret = ENOMEM; + goto out; + } + dir = (struct log_page_directory *)data; + ret = nvme_admin_passthru(dev_fd(dev), WDC_NVME_ADMIN_VUC_OPCODE_D2, 0, 0, + 0, 0, 0, 8, + 0, WDC_VUC_SUBOPCODE_LOG_PAGE_DIR_D2, 0, 0, 0, + 32, data, 0, NULL, + 0, &result); + if (!ret) { + switch (fmt) { + case BINARY: + d_raw((unsigned char *)data, 32); + break; + case JSON: + __json_log_page_directory(dir); + break; + default: + __show_log_page_directory(dir); + } + } else { + fprintf(stderr, "NVMe Status:%s(%x)\n", + nvme_status_to_string(ret, false), ret); + } + } } out: @@ -10176,22 +11149,21 @@ static void wdc_print_pcie_stats_json(struct wdc_vs_pcie_stats *pcie_stats) static int wdc_do_vs_nand_stats_sn810_2(struct nvme_dev *dev, char *format) { - int ret; - int fmt = -1; + enum nvme_print_flags fmt; uint8_t *data = NULL; + int ret; data = NULL; ret = nvme_get_ext_smart_cloud_log(dev_fd(dev), &data, 0, NVME_NSID_ALL); if (ret) { - fprintf(stderr, "ERROR: WDC: %s : Failed to retreive NAND stats\n", __func__); + fprintf(stderr, "ERROR: WDC: %s : Failed to retrieve NAND stats\n", __func__); goto out; } else { - fmt = validate_output_format(format); - if (fmt < 0) { + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: %s : invalid output format\n", __func__); - ret = fmt; goto out; } @@ -10203,6 +11175,8 @@ static int wdc_do_vs_nand_stats_sn810_2(struct nvme_dev *dev, char *format) case JSON: wdc_print_ext_smart_cloud_log_json(data, WDC_SCA_V1_NAND_STATS); break; + default: + break; } } @@ -10214,10 +11188,10 @@ out: static int wdc_do_vs_nand_stats(struct nvme_dev *dev, char *format) { - int ret; - int fmt = -1; + enum nvme_print_flags fmt; uint8_t *output = NULL; __u16 version = 0; + int ret; output = (uint8_t *)calloc(WDC_NVME_NAND_STATS_SIZE, sizeof(uint8_t)); if (!output) { @@ -10229,13 +11203,12 @@ static int wdc_do_vs_nand_stats(struct nvme_dev *dev, char *format) ret = nvme_get_log_simple(dev_fd(dev), WDC_NVME_NAND_STATS_LOG_ID, WDC_NVME_NAND_STATS_SIZE, (void *)output); if (ret) { - fprintf(stderr, "ERROR: WDC: %s : Failed to retreive NAND stats\n", __func__); + fprintf(stderr, "ERROR: WDC: %s : Failed to retrieve NAND stats\n", __func__); goto out; } else { - fmt = validate_output_format(format); - if (fmt < 0) { + ret = validate_output_format(format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: invalid output format\n"); - ret = fmt; goto out; } @@ -10249,6 +11222,8 @@ static int wdc_do_vs_nand_stats(struct nvme_dev *dev, char *format) case JSON: wdc_print_nand_stats_json(version, output); break; + default: + break; } } @@ -10337,14 +11312,14 @@ static int wdc_vs_pcie_stats(int argc, char **argv, struct command *command, struct plugin *plugin) { const char *desc = "Retrieve PCIE statistics."; + enum nvme_print_flags fmt; struct nvme_dev *dev; - int ret = 0; nvme_root_t r; + int ret; __u64 capabilities = 0; - int fmt = -1; + _cleanup_huge_ struct nvme_mem_huge mh = { 0, }; struct wdc_vs_pcie_stats *pcieStatsPtr = NULL; int pcie_stats_size = sizeof(struct wdc_vs_pcie_stats); - bool huge; struct config { char *output_format; @@ -10363,16 +11338,14 @@ static int wdc_vs_pcie_stats(int argc, char **argv, struct command *command, if (ret) return ret; - r = nvme_scan(NULL); - fmt = validate_output_format(cfg.output_format); - if (fmt < 0) { + ret = validate_output_format(cfg.output_format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: invalid output format\n"); - ret = fmt; goto out; } - pcieStatsPtr = nvme_alloc(pcie_stats_size, &huge); + pcieStatsPtr = nvme_alloc_huge(pcie_stats_size, &mh); if (!pcieStatsPtr) { fprintf(stderr, "ERROR: WDC: PCIE Stats alloc: %s\n", strerror(errno)); ret = -1; @@ -10399,12 +11372,11 @@ static int wdc_vs_pcie_stats(int argc, char **argv, struct command *command, case JSON: wdc_print_pcie_stats_json(pcieStatsPtr); break; + default: + break; } } } - - nvme_free(pcieStatsPtr, huge); - out: nvme_free_tree(r); dev_close(dev); @@ -10415,6 +11387,7 @@ static int wdc_vs_drive_info(int argc, char **argv, struct command *command, struct plugin *plugin) { const char *desc = "Send a vs-drive-info command."; + enum nvme_print_flags fmt; nvme_root_t r; uint64_t capabilities = 0; struct nvme_dev *dev; @@ -10428,12 +11401,14 @@ static int wdc_vs_drive_info(int argc, char **argv, __u8 *data = NULL; __u32 ftl_unit_size = 0, tcg_dev_ownership = 0; __u16 boot_spec_major = 0, boot_spec_minor = 0; - int fmt = -1; struct json_object *root = NULL; char formatter[41] = { 0 }; char rev_str[16] = { 0 }; uint32_t read_device_id = -1, read_vendor_id = -1; struct __packed wdc_nvme_ext_smart_log * ext_smart_log_ptr = NULL; + struct ocp_drive_info info; + __u32 data_len = 0; + unsigned int num_dwords = 0; struct config { char *output_format; @@ -10452,11 +11427,11 @@ static int wdc_vs_drive_info(int argc, char **argv, if (ret) return ret; - fmt = validate_output_format(cfg.output_format); - if (fmt < 0) { + ret = validate_output_format(cfg.output_format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC %s invalid output format\n", __func__); dev_close(dev); - return fmt; + return ret; } /* get the id ctrl data used to fill in drive info below */ @@ -10502,13 +11477,13 @@ static int wdc_vs_drive_info(int argc, char **argv, rev = (double)(cpu_to_le32(result) & 0x0000ffff); if (fmt == NORMAL) { - printf("Drive HW Revison: %4.1f\n", (.1 * rev)); + printf("Drive HW Revision: %4.1f\n", (.1 * rev)); printf("FTL Unit Size: 0x%x KB\n", size); printf("Customer SN: %-.*s\n", (int)sizeof(ctrl.sn), &ctrl.sn[0]); } else if (fmt == JSON) { root = json_create_object(); sprintf(rev_str, "%4.1f", (.1 * rev)); - json_object_add_value_string(root, "Drive HW Revison", rev_str); + json_object_add_value_string(root, "Drive HW Revision", rev_str); json_object_add_value_int(root, "FTL Unit Size", le16_to_cpu(size)); wdc_StrFormat(formatter, sizeof(formatter), &ctrl.sn[0], sizeof(ctrl.sn)); @@ -10611,6 +11586,52 @@ static int wdc_vs_drive_info(int argc, char **argv, } break; + case WDC_NVME_SN861_DEV_ID: + fallthrough; + case WDC_NVME_SN861_DEV_ID_1: + data_len = sizeof(info); + num_dwords = data_len / 4; + if (data_len % 4 != 0) + num_dwords += 1; + + ret = nvme_admin_passthru(dev_fd(dev), + WDC_NVME_ADMIN_VUC_OPCODE_D2, + 0, 0, 0, 0, 0, num_dwords, 0, + WDC_VUC_SUBOPCODE_VS_DRIVE_INFO_D2, + 0, 0, 0, data_len, &info, 0, + NULL, 0, NULL); + + if (!ret) { + __u16 hw_rev_major, hw_rev_minor; + + hw_rev_major = le32_to_cpu(info.hw_revision) / 10; + hw_rev_minor = le32_to_cpu(info.hw_revision) % 10; + if (fmt == NORMAL) { + printf("HW Revision : %" PRIu32 ".%" PRIu32 "\n", + hw_rev_major, hw_rev_minor); + printf("FTL Unit Size : %" PRIu32 "\n", + le32_to_cpu(info.ftl_unit_size)); + } else if (fmt == JSON) { + char buf[20]; + + root = json_create_object(); + + memset((void *)buf, 0, 20); + sprintf(buf, "%" PRIu32 ".%" PRIu32, + hw_rev_major, hw_rev_minor); + + json_object_add_value_string(root, + "hw_revision", buf); + json_object_add_value_uint(root, + "ftl_unit_size", + le32_to_cpu(info.ftl_unit_size)); + + json_print_object(root, NULL); + printf("\n"); + json_free_object(root); + } + } + break; default: fprintf(stderr, "ERROR: WDC: unsupported device for this command\n"); ret = -1; @@ -10634,12 +11655,13 @@ static int wdc_vs_temperature_stats(int argc, char **argv, const char *desc = "Send a vs-temperature-stats command."; struct nvme_smart_log smart_log; struct nvme_id_ctrl id_ctrl; + enum nvme_print_flags fmt; struct nvme_dev *dev; nvme_root_t r; uint64_t capabilities = 0; __u32 hctm_tmt; int temperature, temp_tmt1, temp_tmt2; - int ret, fmt = -1; + int ret; struct config { char *output_format; @@ -10659,10 +11681,9 @@ static int wdc_vs_temperature_stats(int argc, char **argv, return ret; r = nvme_scan(NULL); - fmt = validate_output_format(cfg.output_format); - if (fmt < 0) { + ret = validate_output_format(cfg.output_format, &fmt); + if (ret < 0) { fprintf(stderr, "ERROR: WDC: invalid output format\n"); - ret = fmt; goto out; } @@ -10844,6 +11865,8 @@ static int wdc_capabilities(int argc, char **argv, struct command *command, stru capabilities & WDC_DRIVE_CAP_HW_REV_LOG_PAGE ? "Supported" : "Not Supported"); printf("vs-device_waf : %s\n", capabilities & WDC_DRIVE_CAP_DEVICE_WAF ? "Supported" : "Not Supported"); + printf("set-latency-monitor-feature : %s\n", + capabilities & WDC_DRIVE_CAP_SET_LATENCY_MONITOR ? "Supported" : "Not Supported"); printf("capabilities : Supported\n"); nvme_free_tree(r); dev_close(dev); @@ -11214,3 +12237,159 @@ static int wdc_enc_get_nic_log(struct nvme_dev *dev, __u8 log_id, __u32 xfer_siz free(dump_data); return ret; } + +//------------------------------------------------------------------------------------ +// Description: set latency monitor feature +// +int wdc_set_latency_monitor_feature(int argc, char **argv, struct command *cmd, + struct plugin *plugin) +{ + const char *desc = "Set Latency Monitor feature."; + + uint64_t capabilities = 0; + struct nvme_dev *dev; + nvme_root_t r; + int ret; + __u32 result; + struct feature_latency_monitor buf = {0,}; + + const char *active_bucket_timer_threshold = + "This is the value that loads the Active Bucket Timer Threshold."; + const char *active_threshold_a = + "This is the value that loads into the Active Threshold A."; + const char *active_threshold_b = + "This is the value that loads into the Active Threshold B."; + const char *active_threshold_c = + "This is the value that loads into the Active Threshold C."; + const char *active_threshold_d = + "This is the value that loads into the Active Threshold D."; + const char *active_latency_config = + "This is the value that loads into the Active Latency Configuration."; + const char *active_latency_minimum_window = + "This is the value that loads into the Active Latency Minimum Window."; + const char *debug_log_trigger_enable = + "This is the value that loads into the Debug Log Trigger Enable."; + const char *discard_debug_log = "Discard Debug Log."; + const char *latency_monitor_feature_enable = "Latency Monitor Feature Enable."; + + struct config { + __u16 active_bucket_timer_threshold; + __u8 active_threshold_a; + __u8 active_threshold_b; + __u8 active_threshold_c; + __u8 active_threshold_d; + __u16 active_latency_config; + __u8 active_latency_minimum_window; + __u16 debug_log_trigger_enable; + __u8 discard_debug_log; + __u8 latency_monitor_feature_enable; + }; + + struct config cfg = { + .active_bucket_timer_threshold = 0x7E0, + .active_threshold_a = 0x5, + .active_threshold_b = 0x13, + .active_threshold_c = 0x1E, + .active_threshold_d = 0x2E, + .active_latency_config = 0xFFF, + .active_latency_minimum_window = 0xA, + .debug_log_trigger_enable = 0, + .discard_debug_log = 0, + .latency_monitor_feature_enable = 0x7, + }; + + OPT_ARGS(opts) = { + OPT_UINT("active_bucket_timer_threshold", 't', + &cfg.active_bucket_timer_threshold, + active_bucket_timer_threshold), + OPT_UINT("active_threshold_a", 'a', &cfg.active_threshold_a, + active_threshold_a), + OPT_UINT("active_threshold_b", 'b', &cfg.active_threshold_b, + active_threshold_b), + OPT_UINT("active_threshold_c", 'c', &cfg.active_threshold_c, + active_threshold_c), + OPT_UINT("active_threshold_d", 'd', &cfg.active_threshold_d, + active_threshold_d), + OPT_UINT("active_latency_config", 'f', + &cfg.active_latency_config, active_latency_config), + OPT_UINT("active_latency_minimum_window", 'w', + &cfg.active_latency_minimum_window, + active_latency_minimum_window), + OPT_UINT("debug_log_trigger_enable", 'r', + &cfg.debug_log_trigger_enable, debug_log_trigger_enable), + OPT_UINT("discard_debug_log", 'l', &cfg.discard_debug_log, + discard_debug_log), + OPT_UINT("latency_monitor_feature_enable", 'e', + &cfg.latency_monitor_feature_enable, + latency_monitor_feature_enable), + OPT_END() + }; + + ret = parse_and_open(&dev, argc, argv, desc, opts); + + if (ret < 0) + return ret; + + /* get capabilities */ + r = nvme_scan(NULL); + wdc_check_device(r, dev); + capabilities = wdc_get_drive_capabilities(r, dev); + + if (!(capabilities & WDC_DRIVE_CAP_SET_LATENCY_MONITOR)) { + fprintf(stderr, "ERROR: WDC: unsupported device for this command\n"); + return -1; + } + + memset(&buf, 0, sizeof(struct feature_latency_monitor)); + + buf.active_bucket_timer_threshold = cfg.active_bucket_timer_threshold; + buf.active_threshold_a = cfg.active_threshold_a; + buf.active_threshold_b = cfg.active_threshold_b; + buf.active_threshold_c = cfg.active_threshold_c; + buf.active_threshold_d = cfg.active_threshold_d; + buf.active_latency_config = cfg.active_latency_config; + buf.active_latency_minimum_window = cfg.active_latency_minimum_window; + buf.debug_log_trigger_enable = cfg.debug_log_trigger_enable; + buf.discard_debug_log = cfg.discard_debug_log; + buf.latency_monitor_feature_enable = cfg.latency_monitor_feature_enable; + + struct nvme_set_features_args args = { + .args_size = sizeof(args), + .fd = dev_fd(dev), + .fid = NVME_FEAT_OCP_LATENCY_MONITOR, + .nsid = 0, + .cdw12 = 0, + .save = 1, + .data_len = sizeof(struct feature_latency_monitor), + .data = (void *)&buf, + .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, + .result = &result, + }; + + ret = nvme_set_features(&args); + + if (ret < 0) { + perror("set-feature"); + } else if (!ret) { + printf("NVME_FEAT_OCP_LATENCY_MONITOR: 0x%02x\n", + NVME_FEAT_OCP_LATENCY_MONITOR); + printf("active bucket timer threshold: 0x%x\n", + buf.active_bucket_timer_threshold); + printf("active threshold a: 0x%x\n", buf.active_threshold_a); + printf("active threshold b: 0x%x\n", buf.active_threshold_b); + printf("active threshold c: 0x%x\n", buf.active_threshold_c); + printf("active threshold d: 0x%x\n", buf.active_threshold_d); + printf("active latency config: 0x%x\n", buf.active_latency_config); + printf("active latency minimum window: 0x%x\n", + buf.active_latency_minimum_window); + printf("debug log trigger enable: 0x%x\n", + buf.debug_log_trigger_enable); + printf("discard debug log: 0x%x\n", buf.discard_debug_log); + printf("latency monitor feature enable: 0x%x\n", + buf.latency_monitor_feature_enable); + } else if (ret > 0) + fprintf(stderr, "NVMe Status:%s(%x)\n", + nvme_status_to_string(ret, false), ret); + + return ret; +} diff --git a/plugins/wdc/wdc-nvme.h b/plugins/wdc/wdc-nvme.h index cdd9615..f3f28a7 100644 --- a/plugins/wdc/wdc-nvme.h +++ b/plugins/wdc/wdc-nvme.h @@ -5,7 +5,7 @@ #if !defined(WDC_NVME) || defined(CMD_HEADER_MULTI_READ) #define WDC_NVME -#define WDC_PLUGIN_VERSION "2.3.1" +#define WDC_PLUGIN_VERSION "2.3.5" #include "cmd.h" PLUGIN(NAME("wdc", "Western Digital vendor specific extensions", WDC_PLUGIN_VERSION), @@ -17,34 +17,72 @@ PLUGIN(NAME("wdc", "Western Digital vendor specific extensions", WDC_PLUGIN_VERS ENTRY("id-ctrl", "WDC identify controller", wdc_id_ctrl) ENTRY("purge", "WDC Purge", wdc_purge) ENTRY("purge-monitor", "WDC Purge Monitor", wdc_purge_monitor) - ENTRY("vs-internal-log", "WDC Internal Firmware Log", wdc_vs_internal_fw_log) + ENTRY("vs-internal-log", "WDC Internal Firmware Log", + wdc_vs_internal_fw_log) ENTRY("vs-nand-stats", "WDC NAND Statistics", wdc_vs_nand_stats) - ENTRY("vs-smart-add-log", "WDC Additional Smart Log", wdc_vs_smart_add_log) - ENTRY("clear-pcie-correctable-errors", "WDC Clear PCIe Correctable Error Count", wdc_clear_pcie_correctable_errors) - ENTRY("drive-essentials", "WDC Drive Essentials", wdc_drive_essentials) - ENTRY("get-drive-status", "WDC Get Drive Status", wdc_drive_status) - ENTRY("clear-assert-dump", "WDC Clear Assert Dump", wdc_clear_assert_dump) + ENTRY("vs-smart-add-log", "WDC Additional Smart Log", + wdc_vs_smart_add_log) + ENTRY("clear-pcie-correctable-errors", + "WDC Clear PCIe Correctable Error Count", + wdc_clear_pcie_correctable_errors) + ENTRY("drive-essentials", "WDC Drive Essentials", + wdc_drive_essentials) + ENTRY("get-drive-status", "WDC Get Drive Status", + wdc_drive_status) + ENTRY("clear-assert-dump", "WDC Clear Assert Dump", + wdc_clear_assert_dump) ENTRY("drive-resize", "WDC Drive Resize", wdc_drive_resize) - ENTRY("vs-fw-activate-history", "WDC Get FW Activate History", wdc_vs_fw_activate_history) - ENTRY("clear-fw-activate-history", "WDC Clear FW Activate History", wdc_clear_fw_activate_history) + ENTRY("vs-fw-activate-history", "WDC Get FW Activate History", + wdc_vs_fw_activate_history) + ENTRY("clear-fw-activate-history", + "WDC Clear FW Activate History", + wdc_clear_fw_activate_history) ENTRY("enc-get-log", "WDC Get Enclosure Log", wdc_enc_get_log) - ENTRY("vs-telemetry-controller-option", "WDC Enable/Disable Controller Initiated Telemetry Log", wdc_vs_telemetry_controller_option) - ENTRY("vs-error-reason-identifier", "WDC Telemetry Reason Identifier", wdc_reason_identifier) - ENTRY("log-page-directory", "WDC Get Log Page Directory", wdc_log_page_directory) - ENTRY("namespace-resize", "WDC NamespaceDrive Resize", wdc_namespace_resize) + ENTRY("vs-telemetry-controller-option", + "WDC Enable/Disable Controller Initiated Telemetry Log", + wdc_vs_telemetry_controller_option) + ENTRY("vs-error-reason-identifier", + "WDC Telemetry Reason Identifier", + wdc_reason_identifier) + ENTRY("log-page-directory", "WDC Get Log Page Directory", + wdc_log_page_directory) + ENTRY("namespace-resize", "WDC NamespaceDrive Resize", + wdc_namespace_resize) ENTRY("vs-drive-info", "WDC Get Drive Info", wdc_vs_drive_info) - ENTRY("vs-temperature-stats", "WDC Get Temperature Stats", wdc_vs_temperature_stats) - ENTRY("capabilities", "WDC Device Capabilities", wdc_capabilities) - ENTRY("cloud-SSD-plugin-version", "WDC Cloud SSD Plugin Version", wdc_cloud_ssd_plugin_version) - ENTRY("vs-pcie-stats", "WDC VS PCIE Statistics", wdc_vs_pcie_stats) - ENTRY("get-latency-monitor-log", "WDC Get Latency Monitor Log Page", wdc_get_latency_monitor_log) - ENTRY("get-error-recovery-log", "WDC Get Error Recovery Log Page", wdc_get_error_recovery_log) - ENTRY("get-dev-capabilities-log", "WDC Get Device Capabilities Log Page", wdc_get_dev_capabilities_log) - ENTRY("get-unsupported-reqs-log", "WDC Get Unsupported Requirements Log Page", wdc_get_unsupported_reqs_log) - ENTRY("cloud-boot-SSD-version", "WDC Get the Cloud Boot SSD Version", wdc_cloud_boot_SSD_version) - ENTRY("vs-cloud-log", "WDC Get the Cloud Log Page", wdc_vs_cloud_log) - ENTRY("vs-hw-rev-log", "WDC Get the Hardware Revision Log Page", wdc_vs_hw_rev_log) - ENTRY("vs-device-waf", "WDC Calculate Device Write Amplication Factor", wdc_vs_device_waf) + ENTRY("vs-temperature-stats", "WDC Get Temperature Stats", + wdc_vs_temperature_stats) + ENTRY("capabilities", "WDC Device Capabilities", + wdc_capabilities) + ENTRY("cloud-SSD-plugin-version", + "WDC Cloud SSD Plugin Version", + wdc_cloud_ssd_plugin_version) + ENTRY("vs-pcie-stats", "WDC VS PCIE Statistics", + wdc_vs_pcie_stats) + ENTRY("get-latency-monitor-log", + "WDC Get Latency Monitor Log Page", + wdc_get_latency_monitor_log) + ENTRY("get-error-recovery-log", + "WDC Get Error Recovery Log Page", + wdc_get_error_recovery_log) + ENTRY("get-dev-capabilities-log", + "WDC Get Device Capabilities Log Page", + wdc_get_dev_capabilities_log) + ENTRY("get-unsupported-reqs-log", + "WDC Get Unsupported Requirements Log Page", + wdc_get_unsupported_reqs_log) + ENTRY("cloud-boot-SSD-version", + "WDC Get the Cloud Boot SSD Version", + wdc_cloud_boot_SSD_version) + ENTRY("vs-cloud-log", "WDC Get the Cloud Log Page", + wdc_vs_cloud_log) + ENTRY("vs-hw-rev-log", "WDC Get the Hardware Revision Log Page", + wdc_vs_hw_rev_log) + ENTRY("vs-device-waf", + "WDC Calculate Device Write Amplication Factor", + wdc_vs_device_waf) + ENTRY("set-latency-monitor-feature", + "WDC set Latency Monitor feature", + wdc_set_latency_monitor_feature) ) ); diff --git a/plugins/wdc/wdc-utils.c b/plugins/wdc/wdc-utils.c index 3b60772..be2ef06 100644 --- a/plugins/wdc/wdc-utils.c +++ b/plugins/wdc/wdc-utils.c @@ -24,6 +24,9 @@ #include <string.h> #include <unistd.h> #include <time.h> +#include "nvme.h" +#include "libnvme.h" +#include "nvme-print.h" #include "wdc-utils.h" int wdc_UtilsSnprintf(char *buffer, unsigned int sizeOfBuffer, const char *format, ...) @@ -133,8 +136,8 @@ end: /** * Compares the strings ignoring their cases. * - * @param pcSrc Points to a null terminated string for comapring. - * @param pcDst Points to a null terminated string for comapring. + * @param pcSrc Points to a null terminated string for comparing. + * @param pcDst Points to a null terminated string for comparing. * * @returns zero if the string matches or * 1 if the pcSrc string is lexically higher than pcDst or @@ -162,3 +165,42 @@ void wdc_StrFormat(char *formatter, size_t fmt_sz, char *tofmt, size_t tofmtsz) } } +bool wdc_CheckUuidListSupport(struct nvme_dev *dev, struct nvme_id_uuid_list *uuid_list) +{ + int err; + struct nvme_id_ctrl ctrl; + + memset(&ctrl, 0, sizeof(struct nvme_id_ctrl)); + err = nvme_identify_ctrl(dev_fd(dev), &ctrl); + if (err) { + fprintf(stderr, "ERROR: WDC: nvme_identify_ctrl() failed 0x%x\n", err); + return false; + } + + if ((ctrl.ctratt & NVME_CTRL_CTRATT_UUID_LIST) == NVME_CTRL_CTRATT_UUID_LIST) { + err = nvme_identify_uuid(dev_fd(dev), uuid_list); + if (!err) + return true; + else if (err > 0) + nvme_show_status(err); + else + nvme_show_error("identify UUID list: %s", nvme_strerror(errno)); + } + + return false; +} + +bool wdc_UuidEqual(struct nvme_id_uuid_list_entry *entry1, struct nvme_id_uuid_list_entry *entry2) +{ + int i; + + for (i = 0; i < 16; i++) { + if (entry1->uuid[i] != entry2->uuid[i]) + break; + } + + if (i == 16) + return true; + else + return false; +} diff --git a/plugins/wdc/wdc-utils.h b/plugins/wdc/wdc-utils.h index 83b208e..3fc47ca 100644 --- a/plugins/wdc/wdc-utils.h +++ b/plugins/wdc/wdc-utils.h @@ -31,6 +31,7 @@ #include <sys/time.h> #include <sys/stat.h> +#include <stdbool.h> #include <string.h> #include <unistd.h> @@ -76,4 +77,5 @@ int wdc_UtilsStrCompare(char *pcSrc, char *pcDst); int wdc_UtilsCreateDir(char *path); int wdc_WriteToFile(char *fileName, char *buffer, unsigned int bufferLen); void wdc_StrFormat(char *formatter, size_t fmt_sz, char *tofmt, size_t tofmtsz); - +bool wdc_CheckUuidListSupport(struct nvme_dev *dev, struct nvme_id_uuid_list *uuid_list); +bool wdc_UuidEqual(struct nvme_id_uuid_list_entry *entry1, struct nvme_id_uuid_list_entry *entry2); diff --git a/plugins/ymtc/ymtc-nvme.c b/plugins/ymtc/ymtc-nvme.c index 1f99a64..5568c80 100644 --- a/plugins/ymtc/ymtc-nvme.c +++ b/plugins/ymtc/ymtc-nvme.c @@ -54,7 +54,7 @@ static int show_ymtc_smart_log(struct nvme_dev *dev, __u32 nsid, /* Table Title */ printf("Additional Smart Log for NVME device:%s namespace-id:%x\n", dev->name, nsid); - /* Clumn Name*/ + /* Column Name*/ printf("key normalized raw\n"); /* 00 SI_VD_PROGRAM_FAIL */ get_ymtc_smart_info(smart, SI_VD_PROGRAM_FAIL, nm, raw); diff --git a/plugins/ymtc/ymtc-utils.h b/plugins/ymtc/ymtc-utils.h index 39f79cb..e9a3572 100644 --- a/plugins/ymtc/ymtc-utils.h +++ b/plugins/ymtc/ymtc-utils.h @@ -34,7 +34,7 @@ typedef unsigned char u8; #define SI_VD_THERMAL_THROTTLE_TIME_ID 0xEB #define SI_VD_FLASH_MEDIA_ERROR_ID 0xED -/* Addtional smart internal ID */ +/* Additional smart internal ID */ typedef enum { /* smart attr following intel */ diff --git a/plugins/zns/zns.c b/plugins/zns/zns.c index 5b9d013..a7a3766 100644 --- a/plugins/zns/zns.c +++ b/plugins/zns/zns.c @@ -12,6 +12,7 @@ #include "nvme.h" #include "libnvme.h" #include "nvme-print.h" +#include "util/cleanup.h" #define CREATE_CMD #include "zns.h" @@ -135,9 +136,9 @@ static int id_ctrl(int argc, char **argv, struct command *cmd, struct plugin *pl if (err) return errno; - err = flags = validate_output_format(cfg.output_format); - if (flags < 0) - goto close_fd; + err = validate_output_format(cfg.output_format, &flags); + if (err < 0) + goto close_dev; err = nvme_zns_identify_ctrl(dev_fd(dev), &ctrl); if (!err) @@ -146,7 +147,7 @@ static int id_ctrl(int argc, char **argv, struct command *cmd, struct plugin *pl nvme_show_status(err); else perror("zns identify controller"); -close_fd: +close_dev: dev_close(dev); return err; } @@ -188,9 +189,9 @@ static int id_ns(int argc, char **argv, struct command *cmd, struct plugin *plug if (err) return errno; - flags = validate_output_format(cfg.output_format); - if (flags < 0) - goto close_fd; + err = validate_output_format(cfg.output_format, &flags); + if (err < 0) + goto close_dev; if (cfg.vendor_specific) flags |= VS; if (cfg.human_readable) @@ -200,14 +201,14 @@ static int id_ns(int argc, char **argv, struct command *cmd, struct plugin *plug err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { perror("get-namespace-id"); - goto close_fd; + goto close_dev; } } err = nvme_identify_ns(dev_fd(dev), cfg.namespace_id, &id_ns); if (err) { nvme_show_status(err); - goto close_fd; + goto close_dev; } err = nvme_zns_identify_ns(dev_fd(dev), cfg.namespace_id, &ns); @@ -217,7 +218,7 @@ static int id_ns(int argc, char **argv, struct command *cmd, struct plugin *plug nvme_show_status(err); else perror("zns identify namespace"); -close_fd: +close_dev: dev_close(dev); return err; } @@ -560,7 +561,7 @@ static int set_zone_desc(int argc, char **argv, struct command *cmd, struct plug const char *desc = "Set Zone Descriptor Extension\n"; const char *zslba = "starting LBA of the zone for this command"; const char *zrwaa = "Allocate Zone Random Write Area to zone"; - const char *data = "optional file for zone extention data (default stdin)"; + const char *data = "optional file for zone extension data (default stdin)"; const char *timeout = "timeout value, in milliseconds"; int ffd = STDIN_FILENO, err; @@ -603,7 +604,7 @@ static int set_zone_desc(int argc, char **argv, struct command *cmd, struct plug if (!data_len || data_len < 0) { fprintf(stderr, - "zone format does not provide descriptor extention\n"); + "zone format does not provide descriptor extension\n"); errno = EINVAL; err = -1; goto close_dev; @@ -765,8 +766,8 @@ static int zone_mgmt_recv(int argc, char **argv, struct command *cmd, struct plu if (err) return errno; - flags = validate_output_format(cfg.output_format); - if (flags < 0) + err = validate_output_format(cfg.output_format, &flags); + if (err < 0) goto close_dev; if (!cfg.namespace_id) { @@ -833,20 +834,20 @@ static int report_zones(int argc, char **argv, struct command *cmd, struct plugi int zdes = 0, err = -1; struct nvme_dev *dev; __u32 report_size; - bool huge = false; struct nvme_zone_report *report, *buff; + _cleanup_huge_ struct nvme_mem_huge mh = { 0, }; unsigned int nr_zones_chunks = 1024, /* 1024 entries * 64 bytes per entry = 64k byte transfer */ nr_zones_retrieved = 0, nr_zones, - offset, log_len; + __u64 offset; int total_nr_zones = 0; struct nvme_zns_id_ns id_zns; struct nvme_id_ns id_ns; uint8_t lbaf; __le64 zsze; - struct json_object *zone_list = 0; + struct json_object *zone_list = NULL; struct config { char *output_format; @@ -880,8 +881,8 @@ static int report_zones(int argc, char **argv, struct command *cmd, struct plugi if (err) return errno; - flags = validate_output_format(cfg.output_format); - if (flags < 0) + err = validate_output_format(cfg.output_format, &flags); + if (err < 0) goto close_dev; if (cfg.verbose) flags |= VERBOSE; @@ -949,7 +950,7 @@ static int report_zones(int argc, char **argv, struct command *cmd, struct plugi log_len = sizeof(struct nvme_zone_report) + ((sizeof(struct nvme_zns_desc) * nr_zones_chunks) + (nr_zones_chunks * zdes)); report_size = log_len; - report = nvme_alloc(report_size, &huge); + report = nvme_alloc_huge(report_size, &mh); if (!report) { perror("alloc"); err = -ENOMEM; @@ -957,10 +958,8 @@ static int report_zones(int argc, char **argv, struct command *cmd, struct plugi } offset = cfg.zslba; - if (flags & JSON) - zone_list = json_create_array(); - else - printf("nr_zones: %"PRIu64"\n", (uint64_t)le64_to_cpu(total_nr_zones)); + + nvme_zns_start_zone_list(total_nr_zones, &zone_list, flags); while (nr_zones_retrieved < nr_zones) { if (nr_zones_retrieved >= nr_zones) @@ -989,15 +988,7 @@ static int report_zones(int argc, char **argv, struct command *cmd, struct plugi offset = le64_to_cpu(report->entries[nr_zones_chunks-1].zslba) + zsze; } - if (flags & JSON) { - struct print_ops *ops; - - ops = nvme_get_json_print_ops(flags); - if (ops) - ops->zns_finish_zone_list(total_nr_zones, zone_list); - } - - nvme_free(report, huge); + nvme_zns_finish_zone_list(total_nr_zones, zone_list, flags); free_buff: free(buff); @@ -1256,15 +1247,15 @@ static int changed_zone_list(int argc, char **argv, struct command *cmd, struct if (err) return errno; - flags = validate_output_format(cfg.output_format); - if (flags < 0) - goto close_fd; + err = validate_output_format(cfg.output_format, &flags); + if (err < 0) + goto close_dev; if (!cfg.namespace_id) { err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id); if (err < 0) { perror("get-namespace-id"); - goto close_fd; + goto close_dev; } } @@ -1277,7 +1268,7 @@ static int changed_zone_list(int argc, char **argv, struct command *cmd, struct else perror("zns changed-zone-list"); -close_fd: +close_dev: dev_close(dev); return err; } diff --git a/plugins/zns/zns.h b/plugins/zns/zns.h index 77bfdd6..43c4ecd 100644 --- a/plugins/zns/zns.h +++ b/plugins/zns/zns.h @@ -15,7 +15,7 @@ PLUGIN(NAME("zns", "Zoned Namespace Command Set", NVME_VERSION), ENTRY("report-zones", "Report zones associated to a Zoned Namespace", report_zones) ENTRY("reset-zone", "Reset one or more zones", reset_zone) ENTRY("close-zone", "Close one or more zones", close_zone) - ENTRY("finish-zone", "Finishe one or more zones", finish_zone) + ENTRY("finish-zone", "Finish one or more zones", finish_zone) ENTRY("open-zone", "Open one or more zones", open_zone) ENTRY("offline-zone", "Offline one or more zones", offline_zone) ENTRY("set-zone-desc", "Attach zone descriptor extension data to a zone", set_zone_desc) diff --git a/scripts/build.sh b/scripts/build.sh index 94c62b8..470f39a 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e usage() { echo "Usage: build.sh [-b [release|debug]] " @@ -16,8 +17,10 @@ usage() { echo "configs with meson:" echo " [default] default settings" echo " fallback download all dependencies" - echo " and build them as shared libaries" + echo " and build them as shared libraries" echo " cross use cross toolchain to build" + echo " coverage build coverage report" + echo " appimage build AppImage target" echo "" echo "configs with muon:" echo " [default] minimal static build" @@ -56,6 +59,9 @@ CONFIG=${1:-"default"} cd "$(git rev-parse --show-toplevel)" || exit 1 BUILDDIR="$(pwd)/.build-ci" +TOOLDIR="$(pwd)/.build-tools" + +fn_exists() { declare -F "$1" > /dev/null; } config_meson_default() { CC="${CC}" "${MESON}" setup \ @@ -89,6 +95,26 @@ config_meson_cross() { "${BUILDDIR}" } +config_meson_coverage() { + CC="${CC}" "${MESON}" setup \ + --werror \ + --buildtype="${BUILDTYPE}" \ + --force-fallback-for=libnvme \ + -Dlibnvme:werror=false \ + -Db_coverage=true \ + "${BUILDDIR}" +} + +config_meson_appimage() { + CC="${CC}" "${MESON}" setup \ + --werror \ + --buildtype="${BUILDTYPE}" \ + --force-fallback-for=libnvme \ + --prefix=/usr \ + -Dlibnvme:werror=false \ + "${BUILDDIR}" +} + build_meson() { "${MESON}" compile \ -C "${BUILDDIR}" @@ -99,45 +125,68 @@ test_meson() { -C "${BUILDDIR}" } +test_meson_coverage() { + "${MESON}" test \ + -C "${BUILDDIR}" + ninja -C "${BUILDDIR}" coverage --verbose +} + +install_meson_appimage() { + "${MESON}" install \ + -C "${BUILDDIR}" +} + tools_build_samurai() { - mkdir -p "${BUILDDIR}"/build-tools - git clone --depth 1 https://github.com/michaelforney/samurai.git \ - "${BUILDDIR}/build-tools/samurai" - pushd "${BUILDDIR}/build-tools/samurai" || exit 1 + if [ ! -d "${TOOLDIR}"/samurai ]; then + git clone --depth 1 https://github.com/michaelforney/samurai.git \ + "${TOOLDIR}/samurai" + fi - CC="${CC}" make - SAMU="${BUILDDIR}/build-tools/samurai/samu" + if [[ -f "${TOOLDIR}/samurai/samu" ]]; then + return + fi + pushd "${TOOLDIR}/samurai" || exit 1 + CC="${CC}" make popd || exit 1 } tools_build_muon() { - mkdir -p "${BUILDDIR}"/build-tools - git clone --depth 1 https://git.sr.ht/~lattis/muon \ - "${BUILDDIR}/build-tools/muon" - pushd "${BUILDDIR}/build-tools/muon" || exit 1 + if [ ! -d "${TOOLDIR}/muon" ]; then + git clone --depth 1 https://git.sr.ht/~lattis/muon \ + "${TOOLDIR}/muon" + fi - CC="${CC}" ninja="${SAMU}" ./bootstrap.sh stage1 + if [[ -f "${TOOLDIR}/build-muon/muon" ]]; then + return + fi + + pushd "${TOOLDIR}/muon" || exit 1 + + CC="${CC}" CFLAGS="${CFLAGS} -std=c99" ninja="${SAMU}" ./bootstrap.sh stage1 CC="${CC}" ninja="${SAMU}" stage1/muon setup \ - -Dprefix="${BUILDDIR}/build-tools" \ - -Dlibcurl=enabled \ - -Dlibarchive=enabled \ - -Dlibpkgconf=enabled \ + -Dprefix="${TOOLDIR}" \ -Ddocs=disabled \ -Dsamurai=disabled \ - "${BUILDDIR}/build-tools/.build-muon" - "${SAMU}" -C "${BUILDDIR}/build-tools/.build-muon" + -Dbestline=disabled \ + "${TOOLDIR}/build-muon" + "${SAMU}" -C "${TOOLDIR}/build-muon" MUON="${BUILDDIR}/build-tools/.build-muon/muon" - # "${MUON}" -C "${BUILDDIR}/build-tools/.build-muon" test + # "${TOOLDIR}/build-muon/muon" \ + # -C "${TOOLDIR}/build-muon" test popd || exit 1 } config_muon_default() { - CC="${CC}" CFLAGS="${CFLAGS} -static" \ - ninja="${SAMU}" "${MUON}" setup \ + # wrap_mode=forcefallback depends on git being available + + CC="${CC}" CFLAGS="${CFLAGS}" ninja="${SAMU}" \ + "${MUON}" setup \ + -Ddefault_library=static \ + -Dc_link_args="-static" \ -Dwrap_mode=forcefallback \ -Dlibnvme:json-c=disabled \ -Dlibnvme:python=disabled \ @@ -156,22 +205,26 @@ test_muon() { ldd "${BUILDDIR}/nvme" 2>&1 | grep 'not a dynamic executable' || exit 1 } -rm -rf "${BUILDDIR}" - if [[ "${BUILDTOOL}" == "muon" ]]; then - if ! which samu ; then + SAMU="$(which samu 2> /dev/null)" || true + if [[ -z "${SAMU}" ]]; then tools_build_samurai - else - SAMU="$(which samu)" + SAMU="${TOOLDIR}/samurai/samu" fi - if ! which muon ; then + MUON="$(which muon 2> /dev/null)" || true + if [[ -z "${MUON}" ]]; then tools_build_muon - else - MUON="$(which muon)" + MUON="${TOOLDIR}/build-muon/muon" fi fi +echo "samu: ${SAMU}" +echo "muon: ${MUON}" + +rm -rf "${BUILDDIR}" + config_"${BUILDTOOL}"_"${CONFIG}" -build_"${BUILDTOOL}" -test_"${BUILDTOOL}" +fn_exists "build_${BUILDTOOL}_${CONFIG}" && "build_${BUILDTOOL}_${CONFIG}" || build_"${BUILDTOOL}" +fn_exists "test_${BUILDTOOL}_${CONFIG}" && "test_${BUILDTOOL}_${CONFIG}" || test_"${BUILDTOOL}" +fn_exists "install_${BUILDTOOL}_${CONFIG}" && "install_${BUILDTOOL}_${CONFIG}" || true; diff --git a/scripts/release.sh b/scripts/release.sh index dad3f25..d2cbb08 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -60,7 +60,7 @@ cd "$(git rev-parse --show-toplevel)" || exit 1 if [[ -f subprojects/libnvme.wrap ]]; then git -C subprojects/libnvme fetch --all - # extract the vesion string from libnvme by using the ref + # extract the version string from libnvme by using the ref # defined in libnvme.wrap. libnvme_ref=$(sed -n "s/revision = \([0-9a-z]\+\)/\1/p" subprojects/libnvme.wrap) libnvme_VERSION=$(git -C subprojects/libnvme describe "${libnvme_ref}") @@ -94,7 +94,7 @@ if [ -d "Documentation" ]; then elif [ -d "doc" ]; then doc_dir="doc" else - echo "documenation directory not found" + echo "documentation directory not found" exit 1 fi diff --git a/subprojects/json-c.wrap b/subprojects/json-c.wrap index ce9ff51..569f78e 100644 --- a/subprojects/json-c.wrap +++ b/subprojects/json-c.wrap @@ -1,12 +1,13 @@ [wrap-file] -directory = json-c-0.16 -source_url = https://s3.amazonaws.com/json-c_releases/releases/json-c-0.16.tar.gz -source_filename = json-c-0.16.tar.gz -source_hash = 8e45ac8f96ec7791eaf3bb7ee50e9c2100bbbc87b8d0f1d030c5ba8a0288d96b -patch_filename = json-c_0.16-3_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/json-c_0.16-3/get_patch -patch_hash = 6e712826ba1e6e1b6d21c6157a764984fedc6b594c9f92443498b972b6377a94 -wrapdb_version = 0.16-3 +directory = json-c-0.17 +source_url = https://s3.amazonaws.com/json-c_releases/releases/json-c-0.17.tar.gz +source_filename = json-c-0.17.tar.gz +source_hash = 7550914d58fb63b2c3546f3ccfbe11f1c094147bd31a69dcd23714d7956159e6 +patch_filename = json-c_0.17-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/json-c_0.17-2/get_patch +patch_hash = c1a9a7e2ea6bed89a59e13a5684be25899a5a510963154c4450c5a492b8f3984 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/json-c_0.17-2/json-c-0.17.tar.gz +wrapdb_version = 0.17-2 [provide] json-c = json_c_dep diff --git a/subprojects/libnvme.wrap b/subprojects/libnvme.wrap index 6070d24..4ba4f09 100644 --- a/subprojects/libnvme.wrap +++ b/subprojects/libnvme.wrap @@ -1,6 +1,6 @@ [wrap-git] url = https://github.com/linux-nvme/libnvme.git -revision = 4fea83db8328ea788ea8f1001e8ce1cb80ef5fae +revision = f38b1d72e5077c827a3fdf8989dcc2dae70701d1 [provide] libnvme = libnvme_dep diff --git a/tests/meson.build b/tests/meson.build index 90f1a68..f8c6aa2 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -95,5 +95,5 @@ if autopep8.found() and isort.found() command : [python, linter_script, 'format'], ) else - message('autopep8 or isort not found. Python formating disabled') + message('autopep8 or isort not found. Python formatting disabled') endif diff --git a/tests/nvme_attach_detach_ns_test.py b/tests/nvme_attach_detach_ns_test.py index 07c118f..075f211 100644 --- a/tests/nvme_attach_detach_ns_test.py +++ b/tests/nvme_attach_detach_ns_test.py @@ -64,7 +64,7 @@ class TestNVMeAttachDetachNSCmd(TestNVMe): Post Section for TestNVMeAttachDetachNSCmd - Create primary namespace. - - Atttach it to controller. + - Attach it to controller. - Call super class's destructor. """ self.assertEqual(self.create_and_validate_ns(self.default_nsid, diff --git a/tests/nvme_copy_test.py b/tests/nvme_copy_test.py index d84a6d2..a547231 100644 --- a/tests/nvme_copy_test.py +++ b/tests/nvme_copy_test.py @@ -4,56 +4,110 @@ # # Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved. # -# Author: Arunpandian J <apj.arun@samsung.com> +# Authors: Arunpandian J <apj.arun@samsung.com> +# Joy Gu <jgu@purestorage.com> """ NVMe Copy Testcase:- 1. Issue copy command on set of block; shall pass. + 2. If cross-namespace copy formats are supported, enable and test + cross-namespace copy formats. """ +import subprocess + from nvme_test import TestNVMe class TestNVMeCopy(TestNVMe): """ - Represents NVMe Verify testcase. + Represents NVMe Copy testcase. - Attributes: - - start_block : starting block of to verify operation. - - range : Range of blocks for DSM operation. - - slbs : 64-bit addr of first block per range + - ocfs : optional copy formats supported + - host_behavior_data : host behavior support data to restore during teardown - test_log_dir : directory for logs, temp files. """ def setUp(self): """ Pre Section for TestNVMeCopy """ super().setUp() - self.start_block = 0 - self.range = 1 - self.slbs = 1 - self.namespace = 1 + print("\nSetting up test...") + self.ocfs = self.get_ocfs() + cross_namespace_copy = self.ocfs & 0xc + if cross_namespace_copy: + # get host behavior support data + get_features_cmd = ["nvme", "get-feature", self.ctrl, "--feature-id=0x16", "--data-len=512", "-b"] + print("Running command:", " ".join(get_features_cmd)) + self.host_behavior_data = subprocess.check_output(get_features_cmd) + # enable cross-namespace copy formats + if self.host_behavior_data[4] & cross_namespace_copy: + # skip if already enabled + print("Cross-namespace copy already enabled, skipping set-features") + self.host_behavior_data = None + else: + data = self.host_behavior_data[:4] + cross_namespace_copy.to_bytes(2, 'little') + self.host_behavior_data[6:] + set_features_cmd = ["nvme", "set-feature", self.ctrl, "--feature-id=0x16", "--data-len=512"] + print("Running command:", " ".join(set_features_cmd)) + proc = subprocess.Popen(set_features_cmd, + stdout=subprocess.PIPE, + stdin=subprocess.PIPE) + proc.communicate(input=data) + self.assertEqual(proc.returncode, 0, "Failed to enable cross-namespace copy formats") + get_ns_id_cmd = ["nvme", "get-ns-id", self.ns1] + print("Running command:", " ".join(get_ns_id_cmd)) + output = subprocess.check_output(get_ns_id_cmd) + self.ns1_nsid = int(output.decode().strip().split(':')[-1]) self.setup_log_dir(self.__class__.__name__) def tearDown(self): """ Post Section for TestNVMeCopy """ + print("Tearing down test...") + if self.host_behavior_data: + # restore saved host behavior support data + set_features_cmd = ["nvme", "set-feature", self.ctrl, "--feature-id=0x16", "--data-len=512"] + print("Running command:", " ".join(set_features_cmd)) + proc = subprocess.Popen(set_features_cmd, + stdout=subprocess.PIPE, + stdin=subprocess.PIPE) + proc.communicate(input=self.host_behavior_data) super().tearDown() - def copy(self): + def copy(self, sdlba, blocks, slbs, **kwargs): """ Wrapper for nvme copy - Args: - - None + - sdlba : destination logical block address + - blocks : number of logical blocks (0-based) + - slbs : source range logical block address + - descriptor_format : copy descriptor format (optional) + - snsids : source namespace id (optional) + - sopts : source options (optional) - Returns: - - return code for nvme copy command. + - None """ - copy_cmd = "nvme copy " + self.ctrl + \ - " --namespace-id=" + str(self.namespace) + \ - " --sdlba=" + str(self.start_block) + \ - " --blocks=" + str(self.range) + \ - " --slbs=" + str(self.range) - return self.exec_cmd(copy_cmd) + # skip if descriptor format not supported (default format is 0) + desc_format = kwargs.get("descriptor_format", 0) + if not self.ocfs & (1 << desc_format): + print(f"Skip copy because descriptor format {desc_format} is not supported") + return + # build copy command + copy_cmd = f"nvme copy {self.ns1} --format={desc_format} --sdlba={sdlba} --blocks={blocks} --slbs={slbs}" + if "snsids" in kwargs: + copy_cmd += f" --snsids={kwargs['snsids']}" + if "sopts" in kwargs: + copy_cmd += f" --sopts={kwargs['sopts']}" + # run and assert success + print("Running command:", copy_cmd) + self.assertEqual(self.exec_cmd(copy_cmd), 0) def test_copy(self): """ Testcase main """ - self.assertEqual(self.copy(), 0) + print("Running test...") + self.copy(0, 1, 2, descriptor_format=0) + self.copy(0, 1, 2, descriptor_format=1) + self.copy(0, 1, 2, descriptor_format=2, snsids=self.ns1_nsid) + self.copy(0, 1, 2, descriptor_format=2, snsids=self.ns1_nsid, sopts=0) + self.copy(0, 1, 2, descriptor_format=3, snsids=self.ns1_nsid) + self.copy(0, 1, 2, descriptor_format=3, snsids=self.ns1_nsid, sopts=0) diff --git a/tests/nvme_create_max_ns_test.py b/tests/nvme_create_max_ns_test.py index 5179711..bda93e1 100644 --- a/tests/nvme_create_max_ns_test.py +++ b/tests/nvme_create_max_ns_test.py @@ -66,7 +66,7 @@ class TestNVMeCreateMaxNS(TestNVMe): Post Section for TestNVMeAttachDetachNSCmd - Create primary namespace. - - Atttach it to controller. + - Attach it to controller. - Call super class's destructor. """ self.assertEqual(self.create_and_validate_ns(self.default_nsid, diff --git a/tests/nvme_format_test.py b/tests/nvme_format_test.py index 68e5a2f..40635c1 100644 --- a/tests/nvme_format_test.py +++ b/tests/nvme_format_test.py @@ -81,7 +81,7 @@ class TestNVMeFormatCmd(TestNVMe): Post Section for TestNVMeFormatCmd - Create primary namespace. - - Atttach it to controller. + - Attach it to controller. - Call super class's destructor. """ self.assertEqual(self.create_and_validate_ns(self.default_nsid, diff --git a/tests/nvme_get_features_test.py b/tests/nvme_get_features_test.py index 784f2be..974fc34 100644 --- a/tests/nvme_get_features_test.py +++ b/tests/nvme_get_features_test.py @@ -47,7 +47,7 @@ class TestNVMeGetMandatoryFeatures(TestNVMe): - Attributes: - feature_id_list : list of the mandatory features. - get_vector_list_cmd : vector list collection for 09h. - - vector_list_len : numer of the interrupt vectors. + - vector_list_len : number of the interrupt vectors. """ def setUp(self): diff --git a/tests/nvme_test.py b/tests/nvme_test.py index d5eca18..0df3dac 100644 --- a/tests/nvme_test.py +++ b/tests/nvme_test.py @@ -39,7 +39,7 @@ from nvme_test_logger import TestNVMeLogger class TestNVMe(unittest.TestCase): """ - Represents a testcase, each testcase shuold inherit this + Represents a testcase, each testcase should inherit this class or appropriate subclass which is a child of this class. Common utility functions used in various testcases. @@ -58,11 +58,13 @@ class TestNVMe(unittest.TestCase): self.ctrl = "XXX" self.ns1 = "XXX" self.test_log_dir = "XXX" + self.do_validate_pci_device = True self.default_nsid = 0x1 self.config_file = 'tests/config.json' self.load_config() - self.validate_pci_device() + if self.do_validate_pci_device: + self.validate_pci_device() def tearDown(self): """ Post Section for TestNVMe. """ @@ -70,7 +72,7 @@ class TestNVMe(unittest.TestCase): shutil.rmtree(self.log_dir, ignore_errors=True) def validate_pci_device(self): - """ Validate underlaying device belogs to pci subsystem. + """ Validate underlying device belongs to pci subsystem. - Args: - None - Returns: @@ -93,6 +95,7 @@ class TestNVMe(unittest.TestCase): self.ctrl = config['controller'] self.ns1 = config['ns1'] self.log_dir = config['log_dir'] + self.do_validate_pci_device = config.get('do_validate_pci_device', self.do_validate_pci_device) self.clear_log_dir = False if self.clear_log_dir is True: @@ -162,7 +165,7 @@ class TestNVMe(unittest.TestCase): return ctrl_id def get_ns_list(self): - """ Wrapper for extrating the namespace list. + """ Wrapper for extracting the namespace list. - Args: - None - Returns: @@ -181,7 +184,7 @@ class TestNVMe(unittest.TestCase): return ns_list def get_max_ns(self): - """ Wrapper for extracting maximum number of namspaces supported. + """ Wrapper for extracting maximum number of namespaces supported. - Args: - None - Returns: @@ -228,6 +231,19 @@ class TestNVMe(unittest.TestCase): print(ncap) return int(ncap) + def get_ocfs(self): + """ Wrapper for extracting optional copy formats supported + - Args: + - None + - Returns: + - Optional Copy Formats Supported + """ + pattern = re.compile(r'^ocfs\s*: 0x[0-9a-fA-F]+$') + output = subprocess.check_output(["nvme", "id-ctrl", self.ctrl], encoding='utf-8') + ocfs_line = next(line for line in output.splitlines() if pattern.match(line)) + ocfs = ocfs_line.split(":")[1].strip() + return int(ocfs, 16) + def get_format(self): """ Wrapper for extracting format. - Args: diff --git a/unit/test-uint128.c b/unit/test-uint128.c index 6301a38..f8478ef 100644 --- a/unit/test-uint128.c +++ b/unit/test-uint128.c @@ -3,6 +3,7 @@ #include <string.h> #include <stdio.h> #include <stdlib.h> +#include <locale.h> #include "../util/types.h" @@ -27,25 +28,36 @@ static void check_str(nvme_uint128_t val, const char *exp, const char *res) } struct tostr_test { + const char *locale; nvme_uint128_t val; const char *exp; }; static struct tostr_test tostr_tests[] = { - { U128(0, 0, 0, 0), "0" }, - { U128(0, 0, 0, 1), "1" }, - { U128(0, 0, 0, 10), "10" }, - { U128(4, 3, 2, 1), "316912650112397582603894390785" }, + { NULL, U128(0, 0, 0, 0),"0" }, + { NULL, U128(0, 0, 0, 1), "1" }, + { NULL, U128(0, 0, 0, 10), "10" }, + { NULL, U128(4, 3, 2, 1), "316912650112397582603894390785" }, { + NULL, U128(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), "340282366920938463463374607431768211455" }, + { "fr_FR.utf-8", U128(0, 0, 0, 1000), "1\u202f000" }, }; void tostr_test(struct tostr_test *test) { char *str; - str = uint128_t_to_string(test->val); + + if (!setlocale(LC_NUMERIC, test->locale)) + return; + + if (test->locale) + str = uint128_t_to_l10n_string(test->val); + else + str = uint128_t_to_string(test->val); + check_str(test->val, test->exp, str); } diff --git a/util/argconfig.c b/util/argconfig.c index effeea2..5ec3d6f 100644 --- a/util/argconfig.c +++ b/util/argconfig.c @@ -41,6 +41,7 @@ #include <stdarg.h> #include <string.h> #include <stdbool.h> +#include <locale.h> static const char *append_usage_str = ""; @@ -163,6 +164,8 @@ static int argconfig_parse_type(struct argconfig_commandline_options *s, struct char *endptr; int ret = 0; + errno = 0; /* To distinguish success/failure after strtol/stroul call */ + switch (s->config_type) { case CFG_STRING: *((char **)value) = optarg; @@ -177,15 +180,6 @@ static int argconfig_parse_type(struct argconfig_commandline_options *s, struct if (errno || optarg == endptr) ret = argconfig_error("integer", option[index].name, optarg); break; - case CFG_BOOL: { - int tmp = strtol(optarg, &endptr, 0); - - if (errno || tmp < 0 || tmp > 1 || optarg == endptr) - ret = argconfig_error("0 or 1", option[index].name, optarg); - else - *((int *)value) = tmp; - break; - } case CFG_BYTE: ret = argconfig_parse_byte(option[index].name, optarg, (uint8_t *)value); break; @@ -313,23 +307,11 @@ static int argconfig_parse_val(struct argconfig_commandline_options *s, struct o return argconfig_parse_type(s, option, index); } -bool argconfig_output_format_json(bool set) -{ - static bool output_format_json; - - if (set) - output_format_json = true; - - return output_format_json; -} - -static bool argconfig_check_output_format_json(struct argconfig_commandline_options *s) +static bool argconfig_check_human_readable(struct argconfig_commandline_options *s) { for (; s && s->option; s++) { - if (strcmp(s->option, "output-format") || s->config_type != CFG_STRING) - continue; - if (!strcmp(*(char **)s->default_value, "json")) - return true; + if (!strcmp(s->option, "human-readable") && s->config_type == CFG_FLAG) + return s->seen; } return false; @@ -375,14 +357,10 @@ int argconfig_parse(int argc, char *argv[], const char *program_desc, } long_opts[option_index].name = "help"; - long_opts[option_index++].val = 'h'; - - long_opts[option_index].name = "json"; - long_opts[option_index].val = 'j'; + long_opts[option_index].val = 'h'; short_opts[short_index++] = '?'; - short_opts[short_index++] = 'h'; - short_opts[short_index] = 'j'; + short_opts[short_index] = 'h'; optind = 0; while ((c = getopt_long_only(argc, argv, short_opts, long_opts, &option_index)) != -1) { @@ -392,8 +370,6 @@ int argconfig_parse(int argc, char *argv[], const char *program_desc, ret = -EINVAL; break; } - if (c == 'j') - argconfig_output_format_json(true); for (option_index = 0; option_index < options_count; option_index++) { if (c == options[option_index].short_option) break; @@ -416,8 +392,8 @@ int argconfig_parse(int argc, char *argv[], const char *program_desc, break; } - if (argconfig_check_output_format_json(options)) - argconfig_output_format_json(true); + if (!argconfig_check_human_readable(options)) + setlocale(LC_ALL, "C"); out: free(short_opts); @@ -549,6 +525,58 @@ int argconfig_parse_comma_sep_array_long(char *string, unsigned long long *val, } } +#define DEFINE_ARGCONFIG_PARSE_COMMA_SEP_ARRAY_UINT_FUNC(size) \ +int argconfig_parse_comma_sep_array_u##size(char *string, \ + __u##size *val, \ + unsigned int max_length) \ +{ \ + int ret = 0; \ + uintmax_t v; \ + char *tmp; \ + char *p; \ + \ + if (!string || !strlen(string)) \ + return 0; \ + \ + tmp = strtok(string, ","); \ + if (!tmp) \ + return 0; \ + \ + v = strtoumax(tmp, &p, 0); \ + if (*p != 0) \ + return -1; \ + if (v > UINT##size##_MAX) { \ + fprintf(stderr, "%s out of range\n", tmp); \ + return -1; \ + } \ + val[ret] = v; \ + \ + ret++; \ + while (1) { \ + tmp = strtok(NULL, ","); \ + \ + if (tmp == NULL) \ + return ret; \ + \ + if (ret >= max_length) \ + return -1; \ + \ + v = strtoumax(tmp, &p, 0); \ + if (*p != 0) \ + return -1; \ + if (v > UINT##size##_MAX) { \ + fprintf(stderr, "%s out of range\n", tmp); \ + return -1; \ + } \ + val[ret] = v; \ + ret++; \ + } \ +} + +DEFINE_ARGCONFIG_PARSE_COMMA_SEP_ARRAY_UINT_FUNC(16); +DEFINE_ARGCONFIG_PARSE_COMMA_SEP_ARRAY_UINT_FUNC(32); +DEFINE_ARGCONFIG_PARSE_COMMA_SEP_ARRAY_UINT_FUNC(64); + bool argconfig_parse_seen(struct argconfig_commandline_options *s, const char *option) { diff --git a/util/argconfig.h b/util/argconfig.h index eaf8375..2a04a32 100644 --- a/util/argconfig.h +++ b/util/argconfig.h @@ -41,6 +41,8 @@ #include <stdbool.h> #include <stdint.h> +#include <linux/types.h> + enum argconfig_types { CFG_FLAG, CFG_STRING, @@ -49,7 +51,6 @@ enum argconfig_types { CFG_LONG, CFG_LONG_SUFFIX, CFG_DOUBLE, - CFG_BOOL, CFG_BYTE, CFG_SHORT, CFG_POSITIVE, @@ -174,10 +175,15 @@ int argconfig_parse_comma_sep_array_short(char *string, unsigned short *ret, unsigned int max_length); int argconfig_parse_comma_sep_array_long(char *string, unsigned long long *ret, unsigned int max_length); +int argconfig_parse_comma_sep_array_u16(char *string, __u16 *val, + unsigned int max_length); +int argconfig_parse_comma_sep_array_u32(char *string, __u32 *val, + unsigned int max_length); +int argconfig_parse_comma_sep_array_u64(char *string, __u64 *val, + unsigned int max_length); int argconfig_parse_byte(const char *opt, const char *str, unsigned char *val); void print_word_wrapped(const char *s, int indent, int start, FILE *stream); bool argconfig_parse_seen(struct argconfig_commandline_options *options, const char *option); -bool argconfig_output_format_json(bool set); #endif diff --git a/util/cleanup.c b/util/cleanup.c deleted file mode 100644 index d6ac7c6..0000000 --- a/util/cleanup.c +++ /dev/null @@ -1,5 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -#include <stdlib.h> -#include "cleanup.h" - -DEFINE_CLEANUP_FUNC(cleanup_charp, char *, free); diff --git a/util/cleanup.h b/util/cleanup.h index 575a25d..ee9b120 100644 --- a/util/cleanup.h +++ b/util/cleanup.h @@ -2,6 +2,11 @@ #ifndef __CLEANUP_H #define __CLEANUP_H +#include <unistd.h> +#include <stdlib.h> + +#include "util/mem.h" + #define __cleanup__(fn) __attribute__((cleanup(fn))) #define DECLARE_CLEANUP_FUNC(name, type) \ @@ -14,6 +19,19 @@ DECLARE_CLEANUP_FUNC(name, type) \ free_fn(*__p); \ } -DECLARE_CLEANUP_FUNC(cleanup_charp, char *); +static inline void freep(void *p) +{ + free(*(void**) p); +} +#define _cleanup_free_ __cleanup__(freep) + +#define _cleanup_huge_ __cleanup__(nvme_free_huge) + +static inline void close_file(int *f) +{ + if (*f > STDERR_FILENO) + close(*f); +} +#define _cleanup_file_ __cleanup__(close_file) #endif diff --git a/util/json.h b/util/json.h index c362408..54e33e3 100644 --- a/util/json.h +++ b/util/json.h @@ -28,16 +28,18 @@ json_object_object_add(o, k, util_json_object_new_double(v)) #define json_object_add_value_float(o, k, v) \ json_object_object_add(o, k, json_object_new_double(v)) -#define json_object_add_value_string(o, k, v) \ - json_object_object_add(o, k, json_object_new_string(v)) +static inline int json_object_add_value_string(struct json_object *o, const char *k, const char *v) { + return json_object_object_add(o, k, v ? json_object_new_string(v) : NULL); +} #define json_object_add_value_array(o, k, v) \ json_object_object_add(o, k, v) #define json_object_add_value_object(o, k, v) \ json_object_object_add(o, k, v) #define json_array_add_value_object(o, k) \ json_object_array_add(o, k) -#define json_array_add_value_string(o, v) \ - json_object_array_add(o, json_object_new_string(v)) +static inline int json_array_add_value_string(struct json_object *o, const char *v) { + return json_object_array_add(o, v ? json_object_new_string(v) : NULL); +} #define json_print_object(o, u) \ printf("%s", json_object_to_json_string_ext(o, \ JSON_C_TO_STRING_PRETTY | \ diff --git a/util/mem.c b/util/mem.c new file mode 100644 index 0000000..d2be46e --- /dev/null +++ b/util/mem.c @@ -0,0 +1,109 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include <stdlib.h> +#include <unistd.h> +#include <malloc.h> +#include <string.h> +#include <sys/mman.h> + +#include "mem.h" + +#include "common.h" + +#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S)) +#define HUGE_MIN 0x80000 + +void *nvme_alloc(size_t len) +{ + void *p; + + len = ROUND_UP(len, 0x1000); + if (posix_memalign((void *)&p, getpagesize(), len)) + return NULL; + + memset(p, 0, len); + return p; +} + +void *nvme_realloc(void *p, size_t len) +{ + size_t old_len = malloc_usable_size(p); + + void *result = nvme_alloc(len); + + if (p) { + memcpy(result, p, min(old_len, len)); + free(p); + } + + return result; +} + +void *nvme_alloc_huge(size_t len, struct nvme_mem_huge *mh) +{ + memset(mh, 0, sizeof(*mh)); + + len = ROUND_UP(len, 0x1000); + + /* + * For smaller allocation we just use posix_memalign and hope the kernel + * is able to convert to a contiguous memory region. + */ + if (len < HUGE_MIN) { + mh->p = nvme_alloc(len); + if (!mh->p) + return NULL; + mh->posix_memalign = true; + mh->len = len; + return mh->p; + } + + /* + * Larger allocation will almost certainly fail with the small + * allocation approach. Instead try pre-allocating memory from the + * HugeTLB pool. + * + * https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt + */ + mh->p = mmap(NULL, len, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE | MAP_HUGETLB, -1, 0); + if (mh->p != MAP_FAILED) { + mh->len = len; + return mh->p; + } + + /* + * And if mmap fails because the pool is empty, try to use + * posix_memalign/madvise as fallback with a 2MB aligmnent in order to + * fullfil the request. This gives the kernel a chance to try to claim + * some huge pages. This might still fail though. + */ + len = ROUND_UP(len, 0x200000); + if (posix_memalign(&mh->p, 0x200000, len)) + return NULL; + mh->posix_memalign = true; + mh->len = len; + + memset(mh->p, 0, mh->len); + + if (madvise(mh->p, mh->len, MADV_HUGEPAGE) < 0) { + nvme_free_huge(mh); + return NULL; + } + + return mh->p; +} + +void nvme_free_huge(struct nvme_mem_huge *mh) + +{ + if (!mh || mh->len == 0) + return; + + if (mh->posix_memalign) + free(mh->p); + else + munmap(mh->p, mh->len); + + mh->len = 0; + mh->p = NULL; +} diff --git a/util/mem.h b/util/mem.h new file mode 100644 index 0000000..d13eb3a --- /dev/null +++ b/util/mem.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef MEM_H_ +#define MEM_H_ + +#include <stddef.h> +#include <stdbool.h> + +void *nvme_alloc(size_t len); +void *nvme_realloc(void *p, size_t len); + +struct nvme_mem_huge { + size_t len; + bool posix_memalign; /* p has been allocated using posix_memalign */ + void *p; +}; + +void *nvme_alloc_huge(size_t len, struct nvme_mem_huge *mh); +void nvme_free_huge(struct nvme_mem_huge *mh); + +#endif /* MEM_H_ */ diff --git a/util/meson.build b/util/meson.build index f149d03..dfc683b 100644 --- a/util/meson.build +++ b/util/meson.build @@ -3,8 +3,8 @@ sources += [ 'util/argconfig.c', 'util/base64.c', - 'util/cleanup.c', 'util/crc32.c', + 'util/mem.c', 'util/suffix.c', 'util/types.c', ] diff --git a/util/types.c b/util/types.c index 044391d..376c734 100644 --- a/util/types.c +++ b/util/types.c @@ -67,20 +67,21 @@ static char *__uint128_t_to_string(nvme_uint128_t val, bool l10n) int idx = 60; __u64 div, rem; char *sep = NULL; - int i, len = 0; + int i, len = 0, cl = 0; if (l10n) { sep = localeconv()->thousands_sep; len = strlen(sep); + cl = 1; } /* terminate at the end, and build up from the ones */ str[--idx] = '\0'; do { - if (len && !((sizeof(str) - idx) % (3 + len))) { + if (len && !((sizeof(str) - idx) % (3 + cl))) { for (i = 0; i < len; i++) - str[--idx] = sep[i]; + str[--idx] = sep[len - i - 1]; } rem = val.words[0]; |