Mail Archives: djgpp/2000/07/12/11:38:38

X-Authentication-Warning: broeker owned process doing -bs
Date: Wed, 12 Jul 2000 17:37:20 +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.1000712181146.4113E-100000@is>
Message-ID: <Pine.LNX.4.10.10007121719030.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:

> > Speaking about 'du':
> > 
> > > Unfortunately, it also doesn't take the exact cluster size into account, 
> > > so the size it prints is always less than the actual size.
> > > 
> > > Perhaps a future port of Fileutils could take care of this.
> > 
> > I'm not too sure. That had better be introduced not in the DJGPP port, but
> > as a new feature to the FSF version, and then implemented for all ports
> > using FAT filesystems, simultaneously.
> 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?

According to the fileutils 4.0 docs I consulted, du only uses block size
for displaying, not for measuring the file length.  To quote the docs:
(info fileutils, node 'Block Size'):

--- quote ---
   Some GNU programs (at least `df', `du', and `ls') display file sizes
in "blocks".  You can adjust the block size to make file sizes easier
to read.  The block size used for display is independent of any
filesystem block size.  Displayed sizes are rounded to the nearest
block, with ties rounding to an even number.
--- end quote ---

For actually measuring in units of clusters, it'd have to cope with two
independent block sizes: the 'true' blockiness of the filesystem, and the
block size requested by the user (KBytes by default, but may be anything
you can think of, including 1000-Bytes, megabytes, or automatic
human-readable style).

> I'm not sure this is all there is to it.  IIRC, `du' expects `stat' or 
> some other system call to return the actual block size, and uses that if 
> it's available.  We didn't have the appropriate field in struct stat at 
> the time, so I tricked `du' to use its fallback.

If du really uses file-system dependent block size for anything, then it
must be violating it's own documentation...

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