2011-02-12 05:22:29 +00:00
|
|
|
#ifndef _SYS_STATVFS_H
|
|
|
|
#define _SYS_STATVFS_H
|
|
|
|
|
2011-11-11 01:40:06 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2011-02-12 05:22:29 +00:00
|
|
|
|
2012-09-08 03:13:55 +00:00
|
|
|
#include <features.h>
|
2012-09-07 02:44:55 +00:00
|
|
|
|
2011-02-12 05:22:29 +00:00
|
|
|
#define __NEED_fsblkcnt_t
|
|
|
|
#define __NEED_fsfilcnt_t
|
|
|
|
#include <bits/alltypes.h>
|
|
|
|
|
2011-09-20 03:35:48 +00:00
|
|
|
struct statvfs {
|
|
|
|
unsigned long f_bsize, f_frsize;
|
|
|
|
fsblkcnt_t f_blocks, f_bfree, f_bavail;
|
|
|
|
fsfilcnt_t f_files, f_ffree, f_favail;
|
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
|
|
unsigned long f_fsid;
|
|
|
|
unsigned :8*(2*sizeof(int)-sizeof(long));
|
|
|
|
#else
|
|
|
|
unsigned :8*(2*sizeof(int)-sizeof(long));
|
|
|
|
unsigned long f_fsid;
|
|
|
|
#endif
|
|
|
|
unsigned long f_flag, f_namemax;
|
statvfs: allocate spare for f_type
This is the only missing part in struct statvfs. The LSB calls
[f]statfs() deprecated, and its weird types are definitely
off-putting. However, its use is required to get f_type.
Instead, allocate one of the six spares to f_type, copied directly
from struct statfs. This then becomes a small extension to the
standard interface on Linux, instead of two different interfaces, one
of which is quite odd due to being an ABI type, and there no longer is
any reason to use statfs().
The underlying kernel type is a mess, but all architectures agree on u32
(or more) for the ABI, and all filesystem magicks are 32-bit integers.
Since commit 6567db65f495cf7c11f5c1e60a3e54543d5a69bc (prior to
1.0.0), the spare slots have been zero-filled, so on all versions that
may be reasonably be encountered in the wild, applications can rely on
a nonzero f_type as indication that the new field has been filled in.
2023-08-17 20:05:14 +00:00
|
|
|
unsigned int f_type;
|
|
|
|
int __reserved[5];
|
2011-09-20 03:35:48 +00:00
|
|
|
};
|
2011-02-12 05:22:29 +00:00
|
|
|
|
2012-09-07 02:44:55 +00:00
|
|
|
int statvfs (const char *__restrict, struct statvfs *__restrict);
|
2011-02-12 05:22:29 +00:00
|
|
|
int fstatvfs (int, struct statvfs *);
|
|
|
|
|
|
|
|
#define ST_RDONLY 1
|
|
|
|
#define ST_NOSUID 2
|
|
|
|
#define ST_NODEV 4
|
|
|
|
#define ST_NOEXEC 8
|
|
|
|
#define ST_SYNCHRONOUS 16
|
|
|
|
#define ST_MANDLOCK 64
|
|
|
|
#define ST_WRITE 128
|
|
|
|
#define ST_APPEND 256
|
|
|
|
#define ST_IMMUTABLE 512
|
|
|
|
#define ST_NOATIME 1024
|
|
|
|
#define ST_NODIRATIME 2048
|
2018-07-13 00:41:30 +00:00
|
|
|
#define ST_RELATIME 4096
|
2011-02-12 05:22:29 +00:00
|
|
|
|
2022-09-27 19:04:05 +00:00
|
|
|
#if defined(_LARGEFILE64_SOURCE)
|
2012-05-04 04:31:25 +00:00
|
|
|
#define statvfs64 statvfs
|
|
|
|
#define fstatvfs64 fstatvfs
|
|
|
|
#define fsblkcnt64_t fsblkcnt_t
|
|
|
|
#define fsfilcnt64_t fsfilcnt_t
|
|
|
|
#endif
|
|
|
|
|
2011-11-11 01:40:06 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2011-02-12 05:22:29 +00:00
|
|
|
|
|
|
|
#endif
|