www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/25/06:35:04

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: Waldemar Schultz <schultz AT ma DOT tum DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How to obtain correct disk size
Date: Mon, 25 Feb 2002 12:18:02 +0100
Organization: [posted via] Leibniz-Rechenzentrum, Muenchen (Germany)
Lines: 54
Message-ID: <3C7A1D6A.51B89C72@ma.tum.de>
References: <%Qvd8.5806$0y2 DOT 288632 AT typhoon DOT austin DOT rr DOT com> <Xns91BD97E3CBC2Fasu1cornelledu AT 132 DOT 236 DOT 56 DOT 8> <A5zd8.2428$dj3 DOT 121152 AT typhoon DOT austin DOT rr DOT com> <200202222204 DOT g1MM4J623552 AT envy DOT delorie DOT com> <001101c1bbef$efac2a20$0265a8c0 AT tpc2> <2593-Sat23Feb2002101825+0200-eliz AT is DOT elta DOT co DOT il> <000d01c1bc50$0ee85fc0$0265a8c0 AT tpc2> <5567-Sat23Feb2002152057+0200-eliz AT is DOT elta DOT co DOT il>
NNTP-Posting-Host: pcritter14.mathematik.tu-muenchen.de
Mime-Version: 1.0
X-Trace: wsc10.lrz-muenchen.de 1014635858 9807 131.159.68.151 (25 Feb 2002 11:17:38 GMT)
X-Complaints-To: news AT lrz-muenchen DOT de
NNTP-Posting-Date: 25 Feb 2002 11:17:38 GMT
X-Mailer: Mozilla 4.75 [de] (Win98; U)
X-Accept-Language: de,en-US
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii schrieb:
> 
> > From: "Hugo Simon" <hugo DOT simon AT gmx DOT de>
> > Date: Sat, 23 Feb 2002 10:54:11 +0100
> >
> > > Is that a FAT32 disk?  DJGPP v2.03 does not yet support FAT32-specific
> > > system calls.  There's code in the CVS to support that, though.
> > Yes it is FAT32. But I cannot find the code you mentioned. Maybe it is
> > because I didn't know how to handle CVS. The front end I cannot download,
> > the FTP server does not respond. And in the web interface I find no search
> > function.
> 
> You want the source of the function `statfs' (`getdfree' wasn't
> extended to handle FAT32, and probably never will, since it is
> documented to call a specific function of Int 21h, and that function
> doesn't support FAT32).  So get from the CVS the file
> src/libc/compat/sys/vfs/statfs.c, compile it, and put it into your
> library instead of the existing one, like this:
> 
>     gcc -c -O2 statfs.c
>     ar rvs c:/djgpp/libc.a statfs.o

      ar rvs c:/djgpp/lib/libc.a statfs.o                     

> 
> (this assumes your DJGPP installation is rooted at C:\DJGPP; if not,
> change the last command as appropriate).  Thereafter, use the `statfs'
> function in your programs; see the docs of `statfs' for the details.

that's what I was looking for too. Thanks.
BTW I'd like to propose a small change to file 'statfs.txh'
to make the example work out of the box on large FAT32 drives.

@example
struct statfs fs;
statfs("anything", &fs);
printf("%d bytes left\n", fs.f_bfree * fs.f_bsize);
@end example

to

@example
struct statfs fs;
unsigned long long free,size;
statfs("anything", &fs);
free=fs.f_bfree;
size=fs.f_bsize;
printf("%lld bytes left\n", free * size);
@end example

-- 
 Gruss Waldemar Schultz.         schultz AT ma DOT tum DOT de
 Technische Universität München, Zentrum Mathematik M1, D 80290 München
 Tel: +49 (0)89 2892 8226        FAX: +49 (0)89 2892 8228

- Raw text -


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