aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/trim/trim.c
Commit message (Collapse)AuthorAgeFilesLines
* trim(8): fix usage lineEugene Grosbein2025-07-201-1/+1
| | | | Fix usage line after previous change.
* trim(8): minor output correctionEugene Grosbein2025-07-201-5/+6
| | | | | | | | | | | | "trim /dev/da*" would print the following line multiple times when given multiple agruments: dry run: add -f to actually perform the operation Print it once before looping over arguments. Also, note possible suffixes P and E after offset/length as per expand_number(3).
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | 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
* trim(8): candelete() returns wrong results because fd is opened O_WRONLYAllan Jude2020-04-231-1/+1
| | | | | | | | | | This was discovered while using trim(8) to test bhyve trim Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D24371 Notes: svn path=/head/; revision=360230
* trim(8): emit more user-friendly error message in verbose mode.Eugene Grosbein2019-03-151-4/+21
| | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=345184
* trim(8): add another safety netEugene Grosbein2019-03-141-0/+18
| | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=345130
* Re-add new small tool trim(8) to delete contents for blocksEugene Grosbein2019-01-171-0/+210
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=343118
* Remove trim(8) by multiple demands.Eugene Grosbein2018-12-011-210/+0
| | | | Notes: svn path=/head/; revision=341356
* trim(8): serveral style fixesEugene Grosbein2018-11-301-49/+47
| | | | | | | | | Submitted by: imp MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D18380 Notes: svn path=/head/; revision=341352
* Move trim(1) from usr.bin to usr.sbin to become trim(8).Eugene Grosbein2018-11-291-0/+212
Requested by: se MFC after: 1 month Notes: svn path=/head/; revision=341243