If underlying driver provides no TRIM/UNMAP support and operation fails
due to this reason, state it clearly in verbose mode (default)
instead of writing standard message that may be too cryptic for a user:
trim: ioctl(DIOCGDELETE) failed: nda0: Operation not supported
Now it would write:
trim: nda0: TRIM/UNMAP not supported by driver
But still use previous format including errno value for quiet mode.
Small candelete() function borrowed from diskinfo(8) code.
This function was committed by Alan Somers <asomers@FreeBSD.org>,
so give him some credit.
Reported by: chuck
It is quite easy make a mistake and run something like this:
trim -f /dev/da0 -r rfile
This would trim the whole device then emit an error on non-existing file -r.
Add another check to prevent this while allowing this form still
for real object names beginning from dash:
trim -f -- /dev/da0 -r rfile
MFC after: 1 week
on devices using wear-leveling algorithms as a few weeks passed
after review and discussion of trim(8) ceased and
we still have no utility to perform the job.
Reviewed by: hackers@
MFC after: 2 weeks