Commit Graph

9 Commits

Author SHA1 Message Date
eugen
ed557b0b0d trim(8): emit more user-friendly error message in verbose mode.
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
2019-03-15 14:42:23 +00:00
eugen
ce3b318432 trim(8): add another safety net
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
2019-03-14 12:25:16 +00:00
eugen
f1e5596466 Re-add new small tool trim(8) to delete contents for blocks
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
2019-01-17 18:07:59 +00:00
eugen
3d0280477f Remove trim(8) by multiple demands. 2018-12-01 03:20:10 +00:00
eugen
b78257ce60 trim(8): serveral style fixes
Submitted by:		imp
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D18380
2018-11-30 21:57:02 +00:00
eugen
7741f8f4ff trim.8: fix contents after rename from trim.1
MFC after:	1 month
2018-11-29 16:13:46 +00:00
eugen
00724865f2 trim(8): fix Makefile after rename from trim(1).
MFC after:	1 month
2018-11-29 16:10:54 +00:00
eugen
b9227cba47 Rename trim.1 to trim.8 too.
MFC after:	1 month
2018-11-29 16:09:24 +00:00
eugen
0af151b2c1 Move trim(1) from usr.bin to usr.sbin to become trim(8).
Requested by:	se
MFC after:	1 month
2018-11-29 16:08:16 +00:00