2 Unix SMB/CIFS implementation.
3 VFS API's statvfs abstraction
4 Copyright (C) Alexander Bokovoy 2005
5 Copyright (C) Steve French 2005
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #if defined(LINUX) && defined(HAVE_FSID_INT)
24 static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf)
26 struct statvfs statvfs_buf;
29 result = statvfs(path, &statvfs_buf);
32 statbuf->OptimalTransferSize = statvfs_buf.f_frsize;
33 statbuf->BlockSize = statvfs_buf.f_bsize;
34 statbuf->TotalBlocks = statvfs_buf.f_blocks;
35 statbuf->BlocksAvail = statvfs_buf.f_bfree;
36 statbuf->UserBlocksAvail = statvfs_buf.f_bavail;
37 statbuf->TotalFileNodes = statvfs_buf.f_files;
38 statbuf->FreeFileNodes = statvfs_buf.f_ffree;
39 statbuf->FsIdentifier = statvfs_buf.f_fsid;
46 sys_statvfs() is an abstraction layer over system-dependent statvfs()/statfs()
47 for particular POSIX systems. Due to controversy of what is considered more important
48 between LSB and FreeBSD/POSIX.1 (IEEE Std 1003.1-2001) we need to abstract the interface
49 so that particular OS would use its preffered interface.
51 int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf)
53 #if defined(LINUX) && defined(HAVE_FSID_INT)
54 return linux_statvfs(path, statbuf);
56 /* BB change this to return invalid level */
61 #endif /* EOPNOTSUPP */