Add a feature subcommand for the NVMe Get Features and Set Features
commands:
camcontrol feature ndaX -a <get|set> -f feature [-d data]
[-s num] [-U]There is no transport-specific prefix in the name: SCSI has no
feature command (the closest equivalents are mode pages), and the
ATA SET FEATURES subcommands are already exposed through dedicated
camcontrol subcommands (apm, aam, epc and the power commands), so
the name is unclaimed. The subcommand returns an error for
non-NVMe devices.
Currently, only the hostid feature is fully implemented. The
hostid value for set is specified with -d as a UUID or an integer
in decimal, hex, or octal, and -U outputs the hostid as a UUID on
get.
The -s argument exposes the feature select / save fields from the
NVMe specification. If bit 4 of the Optional NVM Command Support
(ONCS) field of the Identify Controller data is set, each feature
has a default, saved and current value, plus a capabilities mask:
- For get, -s selects which to display: 0 (current), 1 (default), 2 (saved) or 3 (capabilities).
- For set, -s is the save flag; a value of 1 sets the saved value as well as the current value, so the feature persists across an NVMe reset. Setting the save flag only works if the feature's capability mask includes saveable.
sbin/camcontrol/nvfeature.c:
New file, the camcontrol(8) feature subcommand for getting and setting NVMe features.
sbin/camcontrol/camcontrol.c:
Add the feature subcommand, dispatched only to NVMe devices.
sbin/camcontrol/camcontrol.h:
Add the nvmefeature() prototype.
sbin/camcontrol/Makefile:
Add nvfeature.c to the build.
sbin/camcontrol/camcontrol.8:
Document the feature subcommand.
Co-authored-by: Reid Linnemann <reidl@spectralogic.com>
Co-authored-by: Dave Baukus <daveb@spectralogic.com>
Sponsored by: Spectra Logic
Depends on D59535
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>