aboutsummaryrefslogtreecommitdiff
path: root/sbin/nvmecontrol/identify.c
Commit message (Collapse)AuthorAgeFilesLines
* nvmecontrol(8): Fix two typos in command messagesGordon Bergling2025-04-261-1/+1
| | | | | | | | Fix two typos in command messages: - s/identiy/identity/ MFC after: 1 week
* nvmecontrol: Use the NVMEV macro instead of expanded versionsJohn Baldwin2024-01-291-60/+49
| | | | | | Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D43597
* sbin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* nvmecontrol: Display Metadata and Sanitize capabilities of the deviceAllan Jude2021-09-211-1/+11
| | | | | | | | | | | | | | | | Determine if a device supports "Extended" or "Separate" metadata, and what the current metadata setting is (None, Extended, Separate) Also determine if the device supports: - Sanitize Crypto Erase - Sanitize Block Erase - Sanitize Overwrite Reviewed by: chuck Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. X-NetApp-PR: #49 Differential Revision: https://reviews.freebsd.org/D31067
* Filter out LBA formats with LBA Data Size of 0.Alexander Motin2021-07-141-0/+2
| | | | | | | According to the spec: "If the value reported is 0h, then LBA format is not supported / used or is not currently available". MFC after: 1 week
* Improve nvmecontrol error reporting.Alexander Motin2020-11-131-2/+5
| | | | | | | | MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=367630
* Add missing newlines.Alexander Motin2020-07-231-5/+5
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=363448
* Open device with O_RDONLY when command is non-invasive.Alexander Motin2020-04-201-2/+2
| | | | | | | | | | This allows to use some of the subcommands against mounted nvd devices. MFC after: 1 week Sponsored by: iXystems, Inc. Notes: svn path=/head/; revision=360117
* Fix various Coverity-detected errors in nvmecontrolDavid Bright2020-04-021-2/+3
| | | | | | | | | | | | | | | | | | | | | | This fixes several Coverity-detected errors in nvmecontrol. While in here, a couple additional errors with shift/mask confusion that were not diagnosed by Coverity are also fixed. CIDs addressed: 1040299, 1040300, 1403972, 1403973, 1403985, 1403988, 1403990, 1404374, 1404427, 1404469, 1404510, 1404534, 1418118 CID 1403657 (resource leak of shared library handle) was marked "intentional" in the Coverity scan database. Reviewed by: vangyzen, robert.herndon_dell.com Reviewed by: daniel.william.ryan_gmail.com (earlier version) Reviewed by: rramsden_isilon.com (earlier version), imp MFC after: 5 days Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D24203 Notes: svn path=/head/; revision=359562
* Print few more useful identify fields.Alexander Motin2019-08-141-10/+23
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=351038
* Add IOCTL to translate nvdX into nvmeY and NSID.Alexander Motin2019-08-011-43/+31
| | | | | | | | | | | | | | | While very useful by itself, it also makes `nvmecontrol` not depend on hardcoded device names parsing, that in its turn makes simple to take nvdX (and potentially any other) device names as arguments. Also added IOCTL bypass from nvdX to respective nvmeYnsZ makes them interchangeable for management purposes. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=350523
* Feature-complete NVMe Namespace Management.Alexander Motin2019-07-311-20/+26
| | | | | | | | | | | | | | | | | | This adds several previously missed but important subcommands to list namespaces and controllers. It also fixes few previously added but just found with real testing to be broken subcommands. Also while there, add possibility to explicitly specify nsid for `nvmecontrol identify` subcommand. It may be useful to specify nsids not having own devices, for example 0xffffffff, or just newly created ones. MFC after: 2 weeks Relnotes: yes Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=350477
* Create generic command / arg parsing routinesWarner Losh2019-07-161-73/+55
| | | | | | | | | | | | | | | | | | | | | Create a set of routines and structures to hold the data for the args for a command. Use them to generate help and to parse args. Convert all the current commands over to the new format. "comnd" is a hat-tip to the TOPS-20 %COMND JSYS that (very) loosely inspired much of the subsequent command line notions in the industry, but this is far simpler (the %COMND man page is longer than this code) and not in the kernel... Also, it implements today's de-facto command [verb]+ [opts]* [args]* format rather than the old, archaic TOPS-20 command format :) This is a snapshot of a work in progress to get the nvme passthru stuff committed. In time it will become a private library and used by some other programs in the tree that conform to the above pattern. Differential Revision: https://reviews.freebsd.org/D19296 Notes: svn path=/head/; revision=350057
* Decode Deallocate Logical Block Features.Alexander Motin2019-05-051-1/+11
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=347158
* Const poison the command interfaceWarner Losh2018-12-061-3/+3
| | | | | | | | | | | | Make the pointers we pass into the commands const, also make the linker set mirrors const. Suggested by: cem@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18459 Notes: svn path=/head/; revision=341658
* Usage cleanup pt 2Warner Losh2018-12-021-1/+1
| | | | | | | | | | | | | Eliminage redundant spaces and nvmecontrol at start of all the usage strings. Update the usage printing code to add them back when presenting to the user. Allow multi-line usage messages and print proper leading spaces for lines starting with a space. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Notes: svn path=/head/; revision=341413
* Usage cleanup pt 1Warner Losh2018-12-021-21/+13
| | | | | | | | | | | | | Provide a usage() function that takes a struct nvme_function pointer and produces a usage mssage. Eliminate all now-redundant usage functions. Propigate the new argument through the program as needed. Use common routine to print usage. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Notes: svn path=/head/; revision=341412
* Move nvmecontrol to using linker sets for commandsWarner Losh2018-12-021-1/+6
| | | | | | | | | | | | | | | | | More commands will be added to nvmecontrol. Also, there will be a few more vendor commands (some of which may need to remain private to companies writing them). The first step on that journey is to move to using linker sets to dispatch commands. The next step will be using dlopen to bring in the .so's that have the command that might need to remain private for seamless integration. Similar changes to this will be needed for vendor specific log pages. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D18403 Notes: svn path=/head/; revision=341407
* Make it possible to use print_controller from another programWarner Losh2018-06-131-180/+2
| | | | | | | | | | | | | Rename print_controller to nvme_print_controller. Put it in its own file for easy inclusion. Move util.c to be nc_util.c to not conflict with camcontrol. add nvecontrol_ext.h to define shared interfaces. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D15371 Notes: svn path=/head/; revision=335091
* Print Maximum Data Transfer Size as a long rather than intJustin Hibbits2018-06-071-1/+1
| | | | | | | | | | | | PowerPC has PAGE_SIZE as a long, not an int. This causes the compiler to throw a format mismatch warning on this print. To work around the difference, print it as a long instead of an int, and force the argument to a long. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D15653 Notes: svn path=/head/; revision=334754
* Add `nvmecontrol format` subcommand.Alexander Motin2018-03-131-1/+2
| | | | | | | | | | | It allows to change namespace parameters, such as block size, metadata, protection information, etc. and/or erase the data. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=330826
* Print fuses and fna fields in identify data.Alexander Motin2018-03-121-0/+11
| | | | | | | | MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=330802
* Add new identify data structures fields from NVMe 1.3a.Alexander Motin2018-03-111-15/+117
| | | | | | | | Some of them are already supported by existing hardware, so reporting them `nvmecontrol identify` can be useful. Notes: svn path=/head/; revision=330759
* nvmecontrol: fix build on amd64/clangAlan Somers2018-02-221-1/+1
| | | | | | | | Broken by: 329824 Sponsored by: Spectra Logic Corp Notes: svn path=/head/; revision=329830
* NVMe: Add big-endian supportWojciech Macek2018-02-221-24/+83
| | | | | | | | | | | | | | | | Remove bitfields from defined structures as they are not portable. Instead use shift and mask macros in the driver and nvmecontrol application. NVMe is now working on powerpc64 host. Submitted by: Michal Stanek <mst@semihalf.com> Obtained from: Semihalf Reviewed by: imp, wma Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D13916 Notes: svn path=/head/; revision=329824
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326276
* Print the controller's ID in identify.Warner Losh2017-08-281-1/+2
| | | | | | | | Submitted by: Matt Williams Sponsored by: Netflix Notes: svn path=/head/; revision=322992
* Report some aspects of namespaces and namespace support in identifyWarner Losh2017-06-271-2/+15
| | | | | | | | | | command. Sponsored by: Netflix Submitted by: Matt Williams (via D11330) Notes: svn path=/head/; revision=320425
* Add message when nvd disks are attached and detached.Jim Harris2013-07-191-6/+8
| | | | | | | | | | | | | | | As part of this commit, add an nvme_strvis() function which borrows heavily from cam_strvis(). This will allow stripping of leading/trailing whitespace and also handle unprintable characters in model/serial numbers. This function goes into a new nvme_util.c file which is used by both the driver and nvmecontrol. Sponsored by: Intel Reviewed by: carl MFC after: 3 days Notes: svn path=/head/; revision=253476
* Define constants for the lengths of the serial number, model numberJim Harris2013-07-171-3/+6
| | | | | | | | | | | | | | and firmware revision in the controller's identify structure. Also modify consumers of these fields to ensure they only use the specified number of bytes for their respective fields. Sponsored by: Intel Reviewed by: carl MFC after: 3 days Notes: svn path=/head/; revision=253437
* Ensure controller or namespace node name is specified before trying toJim Harris2013-07-091-0/+4
| | | | | | | | | | | | | access it. While here, also fix the identify usage message to show the -v and -x parameters. Sponsored by: Intel MFC after: 3 days Notes: svn path=/head/; revision=253116
* Condense the output for displaying LBA formats.Jim Harris2013-07-091-6/+4
| | | | | | | | Sponsored by: Intel MFC after: 3 days Notes: svn path=/head/; revision=253115
* Send per-namespace logpage commands to the controller devnode, so theyJim Harris2013-07-091-16/+4
| | | | | | | | | | | | | | are processed as admin commands, not I/O commands. As part of this change, pull out the code for parsing a namespace node string into a separate function, since it is used for both identify and logpage commands. Sponsored by: Intel MFC after: 3 days Notes: svn path=/head/; revision=253114
* Incorporate feedback from bde@ based on r252672 changes:Jim Harris2013-07-091-12/+10
| | | | | | | | | | | | | | | * Use 0/1 instead of sysexits. Man pages are confusing on this topic, but 0/1 is sufficient for nvmecontrol. * Use err function family where possible instead of fprintf/exit. * Fix some typing errors. * Clean up some error message inconsistencies. Sponsored by: Intel Submitted by: bde (parts of firmware.c changes) MFC after: 3 days Notes: svn path=/head/; revision=253109
* Add generalized helper functions for printing hex data as part ofJim Harris2013-06-261-40/+2
| | | | | | | | | | | nvmecontrol commands. Submitted by: Joe Golio <joseph.golio@emc.com> Obtained from: EMC / Isilon Storage Division MFC after: 3 days Notes: svn path=/head/; revision=252275
* Ensure that a device node is specified when invoking the identify or resetJim Harris2013-06-261-0/+8
| | | | | | | | | | | | | commands. Also improve the checking of device node names, so that better error messages are displayed when incorrect names are specified. Sponsored by: Intel MFC after: 3 days Notes: svn path=/head/; revision=252274
* Create #defines for NVME_CTRLR_PREFIX and NVME_NS_PREFIX for the "nvme"Jim Harris2013-06-261-2/+2
| | | | | | | | | | | and "ns" strings, rather than hardcoding the string values throughout the nvmecontrol code base. Sponsored by: Intel MFC after: 3 days Notes: svn path=/head/; revision=252270
* Break out code related to the identify command into a separate source file.Jim Harris2013-06-261-0/+321
Sponsored by: Intel MFC after: 3 days Notes: svn path=/head/; revision=252266