adding docs for 'printcap cache time' -- patch from Lars
[Samba.git] / source / smbd / statvfs.c
blob300b14a7c083d43d367d503ec34a6b46e9c495e5
1 /*
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 2 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, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "includes.h"
24 #if defined(LINUX) && defined(HAVE_FSID_INT)
25 static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf)
27 struct statvfs statvfs_buf;
28 int result;
30 result = statvfs(path, &statvfs_buf);
32 if (!result) {
33 statbuf->OptimalTransferSize = statvfs_buf.f_frsize;
34 statbuf->BlockSize = statvfs_buf.f_bsize;
35 statbuf->TotalBlocks = statvfs_buf.f_blocks;
36 statbuf->BlocksAvail = statvfs_buf.f_bfree;
37 statbuf->UserBlocksAvail = statvfs_buf.f_bavail;
38 statbuf->TotalFileNodes = statvfs_buf.f_files;
39 statbuf->FreeFileNodes = statvfs_buf.f_ffree;
40 statbuf->FsIdentifier = statvfs_buf.f_fsid;
42 return result;
44 #endif
46 /*
47 sys_statvfs() is an abstraction layer over system-dependent statvfs()/statfs()
48 for particular POSIX systems. Due to controversy of what is considered more important
49 between LSB and FreeBSD/POSIX.1 (IEEE Std 1003.1-2001) we need to abstract the interface
50 so that particular OS would use its preffered interface.
52 int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf)
54 #if defined(LINUX) && defined(HAVE_FSID_INT)
55 return linux_statvfs(path, statbuf);
56 #else
57 /* BB change this to return invalid level */
58 #ifdef EOPNOTSUPP
59 return EOPNOTSUPP;
60 #else
61 return -1;
62 #endif /* EOPNOTSUPP */
63 #endif /* LINUX */