History log of /freebsd-current/usr.sbin/trim/trim.c
Revision Date Author Comments
# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

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


# 9d433cb8 23-Apr-2020 Allan Jude <allanjude@FreeBSD.org>

trim(8): candelete() returns wrong results because fd is opened O_WRONLY

This was discovered while using trim(8) to test bhyve trim

Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D24371


# fa707ac7 15-Mar-2019 Eugene Grosbein <eugen@FreeBSD.org>

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


# 7f654915 13-Mar-2019 Eugene Grosbein <eugen@FreeBSD.org>

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


# 2b5691ee 17-Jan-2019 Eugene Grosbein <eugen@FreeBSD.org>

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


# e0d16695 30-Nov-2018 Eugene Grosbein <eugen@FreeBSD.org>

Remove trim(8) by multiple demands.


# 09057b2c 30-Nov-2018 Eugene Grosbein <eugen@FreeBSD.org>

trim(8): serveral style fixes

Submitted by: imp
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18380


# fcd7ccb2 29-Nov-2018 Eugene Grosbein <eugen@FreeBSD.org>

Move trim(1) from usr.bin to usr.sbin to become trim(8).

Requested by: se
MFC after: 1 month