On Tue, 4 Nov 2008 23:42:49 +0100, Max Laier <[EMAIL PROTECTED]> wrote: > Hi again, > > On Saturday 01 November 2008 21:14:42 I wrote: >> a thread on freebsd-stable@ [1] about problems with du(1) and compressed >> zfs filesystems got me looking for a possible solution. Attached is a diff >> for du(1) that adds two new options: >> >> -A to display the apparent size of the file instead of the used blocks. >> -B bsize to specify a custom blocksize. In particular one <512byte >> >> The GNU du(1) has --apparent-size for -A, but we don't like long options. >> That's not to say that it couldn't be added for script compat. -B is >> probably not that interesting, but it can be helpful and came for free. > > Attached is an updated patch. This refines the -B option to something more > useful (and fixes a bug in the original patch). > > From the man page: > > -B blocksize > Calculate block counts in blocksize byte blocks. This is differ- > ent from the -k, -m options or setting BLOCKSIZE and gives an > estimate of how many space the examined file hierachy would > require on a filesystem with the given blocksize. Unless in -A > mode, blocksize is rounded up to the next multiple of 512.
That looks nice! With a small fix (``how _much_ space'') I like the idea a lot :) The patch fails to apply on a recent /head snapshot of du though: : [EMAIL PROTECTED]:/ws/bsd/src/usr.bin/du$ patch -p0 -i ~/du.AB.diff : [...] : The text leading up to this was: : -------------------------- : |Index: du.c : |=================================================================== : |--- du.c (revision 184656) : |+++ du.c (working copy) : -------------------------- : Patching file du.c using Plan A... : Hunk #1 failed at 79. : Hunk #2 failed at 99. : Hunk #3 failed at 159. : Hunk #4 succeeded at 215 (offset -2 lines). : Hunk #5 failed at 236. : Hunk #6 failed at 259. : Hunk #7 failed at 292. : Hunk #8 failed at 317. : Hunk #9 succeeded at 465 (offset -5 lines). : Hunk #10 succeeded at 482 (offset -2 lines). : 7 out of 10 hunks failed--saving rejects to du.c.rej : done : [EMAIL PROTECTED]:/ws/bsd/src/usr.bin/du$ Can you please refresh and repost it? _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"