00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "includes.h"
00023
00024 #if defined(LINUX) && defined(HAVE_FSID_INT)
00025 static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf)
00026 {
00027 struct statvfs statvfs_buf;
00028 int result;
00029
00030 result = statvfs(path, &statvfs_buf);
00031
00032 if (!result) {
00033 statbuf->OptimalTransferSize = statvfs_buf.f_frsize;
00034 statbuf->BlockSize = statvfs_buf.f_bsize;
00035 statbuf->TotalBlocks = statvfs_buf.f_blocks;
00036 statbuf->BlocksAvail = statvfs_buf.f_bfree;
00037 statbuf->UserBlocksAvail = statvfs_buf.f_bavail;
00038 statbuf->TotalFileNodes = statvfs_buf.f_files;
00039 statbuf->FreeFileNodes = statvfs_buf.f_ffree;
00040 statbuf->FsIdentifier = statvfs_buf.f_fsid;
00041 }
00042 return result;
00043 }
00044 #endif
00045
00046
00047
00048
00049
00050
00051
00052 int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf)
00053 {
00054 #if defined(LINUX) && defined(HAVE_FSID_INT)
00055 return linux_statvfs(path, statbuf);
00056 #else
00057
00058 #ifdef EOPNOTSUPP
00059 return EOPNOTSUPP;
00060 #else
00061 return -1;
00062 #endif
00063 #endif
00064
00065 }