Subject: statvfs(2) replacement for statfs(2) patch
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 04/19/2004 17:58:37
Hello,
As some of you might know I've been working on replacing statfs(2)
and friends with statvfs(2).
Due to the size of the patch, I am not including it here but it is
available on:
ftp://ftp.astron.com/pri/statvfs.tar.gz
This patch replaces the BSD4.4 statfs() family of calls with the POSIX/XOpen
compliant statvfs() flavors. I've taken advantage of the change to:
- make the fields 64 bit so that we are not limited by 2 TB
- add read statistics
- increase the size of the mounted paths
- resolve the confusion between bsize meaning fragment size on
statfs() and block size on statvfs()
- eliminate the need for bavail to be negative, by adding bresvd.
- add favail and fresvd for filesystems that implement reserved
inode space (none currently do).
- use clamping instead of overflow on the old compat statfs() calls.
I am running with this patch on one of my machines, but I don't recommend
that you patch your systems to use it.
The statfs() calls are still available at link time for dynamic binaries,
and at runtime for statically linked binaries (with COMPAT_20), but they
are not available at compile time. This is a design choice, to force people
to move to the more portable statvfs() call, without needing to provide
an expanded statfs() call that would handle > 2TB or limiting old programs
to 2TB.
Thanks to Enami for the preliminary comments, suggestions and fixes.
Your feedback is welcome; I am planning to commit the bulk of this RSN.
christos