Support formatting NVMe namespaces through the existing format
subcommand rather than a separate nvformat subcommand. The format
subcommand now dispatches on the device protocol, in the same way the
identify and persist subcommands do, and issues the NVMe FORMAT NVM
command for NVMe devices.
The SCSI syntax and behavior are unchanged. The NVMe-specific
options are -e (secure erase setting), -G (format all namespaces),
-f (LBA format), -l (protection information location), -m (metadata
setting) and -p (protection information type). The -q and -y options
work for both protocols; NVMe formats gain the same confirmation
question that SCSI formats have always had. The -r and -w options
are SCSI only; -r returns an error for NVMe devices and -w has no
effect, since the NVMe format command does not complete until the
format is finished.
The default timeout for NVMe is 30 seconds for a cryptographic erase
and 30 minutes otherwise; -T overrides.
sbin/camcontrol/nvformat.c:
New file, the NVMe format backend for the format subcommand.
sbin/camcontrol/camcontrol.c:
Dispatch the format subcommand to scsiformat() or nvmeformat() based on the device protocol.
sbin/camcontrol/camcontrol.h:
Add the nvmeformat() prototype.
sbin/camcontrol/Makefile:
Add nvformat.c to the build.
sbin/camcontrol/camcontrol.8:
Document NVMe support in the format subcommand section, and note the differences from SCSI where they occur.
Sponsored by: Spectra Logic
Depends on D59534
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>