mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
The struct spacectl_range we use is only really used in these three lines of code, so re-scope it down to just the dealloc branch. This is marginally easier to reason about what might be necessary to replace in porting our truncate(1) to other platforms. While we're here, add a test for the -d flag to be sure it really does punch a hole in the file. The test also tries to confirm that it does not disturb other segments of the file in the process, just to inspire some confidence that it's not corrupting the file somehow. Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51207