aboutsummaryrefslogtreecommitdiff
path: root/sbin/nvmecontrol/format.c
Commit message (Collapse)AuthorAgeFilesLines
* nvmecontrol: Fix minor usage typoAlexander Ziaee2024-12-061-1/+1
| | | | | | | | PR: 282930 MFC after: 3 days Reported by: Gian-Simon Purkert <gspurki@gmail.com> Reviewed by: imp, jhb, emaste Differential Revision: https://reviews.freebsd.org/D47726
* nvmecontrol: Use the NVMEV macro instead of expanded versionsJohn Baldwin2024-01-291-16/+11
| | | | | | 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
* Improve nvmecontrol error reporting.Alexander Motin2020-11-131-9/+12
| | | | | | | | MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=367630
* Fix parameter check broken at r350057.Alexander Motin2019-08-031-1/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=350555
* Add IOCTL to translate nvdX into nvmeY and NSID.Alexander Motin2019-08-011-15/+5
| | | | | | | | | | | | | | | 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
* Tune some commands desctiption.Alexander Motin2019-07-311-8/+8
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=350462
* Create generic command / arg parsing routinesWarner Losh2019-07-161-51/+97
| | | | | | | | | | | | | | | | | | | | | 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
* Const poison the command interfaceWarner Losh2018-12-061-1/+1
| | | | | | | | | | | | 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-12/+4
| | | | | | | | | | | | | 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 NVMe compatible with the original APIChuck Tuffli2018-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The original NVMe API used bit-fields to represent fields in data structures defined by the specification (e.g. the op-code in the command data structure). The implementation targeted x86_64 processors and defined the bit fields for little endian dwords (i.e. 32 bits). This approach does not work as-is for big endian architectures and was changed to use a combination of bit shifts and masks to support PowerPC. Unfortunately, this changed the NVMe API and forces #ifdef's based on the OS revision level in user space code. This change reverts to something that looks like the original API, but it uses bytes instead of bit-fields inside the packed command structure. As a bonus, this works as-is for both big and little endian CPU architectures. Bump __FreeBSD_version to 1200081 due to API change Reviewed by: imp, kbowling, smh, mav Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D16404 Notes: svn path=/head/; revision=338182
* Add some argument checks to be more user-friendly.Alexander Motin2018-03-131-23/+35
| | | | | | | | MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=330846
* Add `nvmecontrol format` subcommand.Alexander Motin2018-03-131-0/+175
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