$NetBSD: patch-aa,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $ --- fs.c.orig 2004-08-25 18:24:24.000000000 +0200 +++ fs.c @@ -19,6 +19,11 @@ #include #endif +#if defined (__NetBSD__) +#include +#define STATVFS 1 +#endif + /* TODO: benchmark which is faster, fstatvfs() or pre-opened fd and * statvfs() (fstatvfs() would handle mounts I think...) */ @@ -27,16 +32,25 @@ struct fs_stat *fs_stats = fs_stats_; void update_fs_stats() { unsigned int i; +#ifndef STATVFS struct statfs s; +#else + struct statvfs s; +#endif for (i=0; i<16; i++) { if (fs_stats[i].fd <= 0) break; +#ifndef STATVFS fstatfs(fs_stats[i].fd, &s); - fs_stats[i].size = (long long) s.f_blocks * s.f_bsize; /* bfree (root) or bavail (non-roots) ? */ fs_stats[i].avail = (long long) s.f_bavail * s.f_bsize; +#else + fstatvfs(fs_stats[i].fd, &s); + fs_stats[i].size = (int64_t) s.f_blocks * 1024; + fs_stats[i].avail = (int64_t) s.f_bavail * 1024; +#endif } }