delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/12/30/14:40:53

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3E10A13E.75FD92FB@phekda.freeserve.co.uk>
Date: Mon, 30 Dec 2002 19:40:46 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Problem with df reporting the wrong sizes [PATCH]
References: <E18Szay-0000eR-00 AT phekda DOT freeserve DOT co DOT uk> <7263-Mon30Dec2002205236+0200-eliz AT is DOT elta DOT co DOT il>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Eli Zaretskii wrote:
> 
> > Date: Mon, 30 Dec 2002 13:05:32 +0000
> > From: "Richard Dawe" <rich AT phekda DOT freeserve DOT co DOT uk>
[snip]
> > (b) Modify the code to find the real sector size. Then scale
> >     the free block size numbers by (cluster size / sector size),
> >     to give the correct figures for free sectors.
> >
> >     This method could be troublesome, unless we assume that
> >     cluster sizes are always equal to the sector size multiplied
> >     by a power of 2.
> >
> >     *statvfs() use statfs() to get their information. Looking at
> >     the statfs code, it doesn't look like all the methods for finding
> >     disk space (CD-ROM, Windows '9x, Windows '9x other method) return
> >     the sector size. If not all the methods return the sector size,
> >     then this method can't really be used (we can only really support
> >     the "common lowest denominator").
[snip]
> Ny vote is for b), unless it's very expensive or very tricky to
> implement.

(b) will require some refactoring of the code in statfs. The simplest way is
to make statfs and statvfs use an internal function, which returns all the
information. I don't think this will be much work.

But what do we do in the case where we do not know the sector size in bytes?
We have two choices:

* return the cluster size in bytes;
* return some number - e.g.: 512 bytes.

I prefer the former.

Is there any point returning the sector size, if we do not always know it?
Wouldn't it be better to be consistent and return the cluster size in all
cases?

Are sector sizes always a power of 2? If not, then how will *statvfs cope with
converting numbers of clusters to number of sectors?

Bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


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