]>
Commit | Line | Data |
---|---|---|
bead4a89 | 1 | /* |
5b74111a | 2 | * Copyright (C) 1996-2018 The Squid Software Foundation and contributors |
bead4a89 AJ |
3 | * |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
615540cd AJ |
9 | #ifndef _SQUID_COMPAT_XSTATVFS_H |
10 | #define _SQUID_COMPAT_XSTATVFS_H | |
11 | ||
12 | #if HAVE_SYS_STATVFS_H && HAVE_STATVFS | |
13 | #include <sys/statvfs.h> | |
14 | #endif | |
15 | ||
16 | /* Windows and Linux use sys/vfs.h */ | |
17 | #if HAVE_SYS_VFS_H | |
18 | #include <sys/vfs.h> | |
19 | #endif | |
20 | ||
21 | /* BSD and old Linux use sys/statfs.h */ | |
22 | #if !HAVE_STATVFS | |
23 | #if HAVE_SYS_STATFS_H | |
24 | #include <sys/statfs.h> | |
25 | #endif | |
26 | /* statfs() needs <sys/param.h> and <sys/mount.h> on BSD systems */ | |
27 | #if HAVE_SYS_PARAM_H | |
28 | #include <sys/param.h> | |
29 | #endif | |
30 | #if HAVE_SYS_MOUNT_H | |
31 | #include <sys/mount.h> | |
32 | #endif | |
33 | #endif /* !HAVE_STATVFS */ | |
34 | ||
615540cd AJ |
35 | #if HAVE_STATVFS |
36 | #define xstatvfs statvfs | |
37 | ||
38 | #else | |
39 | ||
40 | typedef unsigned long fsblkcnt_t; | |
41 | typedef unsigned long fsfilcnt_t; | |
42 | ||
43 | struct statvfs { | |
44 | unsigned long f_bsize; /* file system block size */ | |
45 | unsigned long f_frsize; /* fragment size */ | |
46 | fsblkcnt_t f_blocks; /* size of fs in f_frsize units */ | |
47 | fsblkcnt_t f_bfree; /* # free blocks */ | |
48 | fsblkcnt_t f_bavail; /* # free blocks for unprivileged users */ | |
49 | fsfilcnt_t f_files; /* # inodes */ | |
50 | fsfilcnt_t f_ffree; /* # free inodes */ | |
51 | fsfilcnt_t f_favail; /* # free inodes for unprivileged users */ | |
52 | unsigned long f_fsid; /* file system ID */ | |
53 | unsigned long f_flag; /* mount flags */ | |
54 | unsigned long f_namemax; /* maximum filename length */ | |
55 | }; | |
56 | ||
57 | #if defined(__cplusplus) | |
58 | extern "C" | |
59 | #endif | |
60 | int xstatvfs(const char *path, struct statvfs *buf); | |
61 | ||
62 | #endif | |
63 | ||
64 | #endif /* _SQUID_COMPAT_XSTATVFS_H */ | |
f53969cc | 65 |