Mail Archives: djgpp/2000/07/12/14:00:17

X-Authentication-Warning: broeker owned process doing -bs
Date: Wed, 12 Jul 2000 19:59:43 +0200 (MET DST)
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
X-Sender: broeker AT acp3bf
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
cc: djgpp AT delorie DOT com
Subject: Re: Filetree disk size
In-Reply-To: <Pine.SUN.3.91.1000712191537.4869A-100000@is>
Message-ID: <Pine.LNX.4.10.10007121916010.32191-100000@acp3bf>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 12 Jul 2000, Eli Zaretskii wrote:

> On Wed, 12 Jul 2000, Hans-Bernhard Broeker wrote:
> > > It's a simple change, and is a useful feature to have.  `du' expects the 
> > > library to return the block size, and if it does not, falls back to some 
> > > simple-minded default.  
> > 
> > What library? What 'block size' does it read from it?
> See the definition of the macro ST_NBLOCKS on src/system.h in the 
> Fileutils distribution.

OK, I finally bit the bullet and d/l'ed the sources. Turns out I must have
misunderstood how 'du' works all the time: they really do use the
'st_blocks' field of 'struct stat' to calculate file lengths, if that
field is available. But the README warns that there is no reliable way of
getting at the number of bytes per such st_blocks unit...

OTOH, I just tried 'du -a --bytes' in a directory full of small files, on
a Linux box: the result clearly shows that it actually measured in terms
of single bytes, not clusters or blocks. Even if I applied it to a mounted
MSDOS filesystems. Here's an excerpt of "du -a --bytes | sort -n" output:

128     /mnt/C/mouse/mousecc.ini
147     /mnt/C/config.old
166     /mnt/C/autoexec.old
177     /mnt/C/autoexec.lgi

[FYI: that's du --version: GNU fileutils 3.12]

I.e. no matter how it actually does it, it obviously has not blockiness in
its input figures. 

OTOH, compiling fileutils 4.0 on a Digital Unix Alpha box, I get
quantization into units of 1024 bytes.

So: yes, support for this feature could arguably be added to 'du', leaving
only two question to answer: do we need a command line option to switch
this off/on? And of course the usual: who'll do it?

Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019