statvfs.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Eistec AB
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
15 /* If building on native we need to use the system libraries instead */
16 #ifdef CPU_NATIVE
17 #pragma GCC system_header
18 /* without the GCC pragma above #include_next will trigger a pedantic error */
19 #include_next <sys/statvfs.h>
20 #else
21 #ifndef SYS_STATVFS_H
22 #define SYS_STATVFS_H
23 
24 #include <sys/types.h> /* for fsblkcnt_t, fsfilcnt_t */
25 #if MODULE_NEWLIB
26 /* newlib support for fsblkcnt_t was only recently added to the newlib git
27  * repository, commit f3e587d30a9f65d0c6551ad14095300f6e81672e, 15 apr 2016.
28  * Will be included in release 2.5.0, around new year 2016/2017.
29  * We provide the below workaround if the used tool chain is too old. */
30 #ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */
31 #include <stdint.h>
32 /* Default to 32 bit file sizes on newlib platforms */
33 typedef uint32_t fsblkcnt_t;
34 typedef uint32_t fsfilcnt_t;
35 #define _FSBLKCNT_T_DECLARED
36 #endif
37 #endif
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
45 struct statvfs {
46  unsigned long f_bsize;
47  unsigned long f_frsize;
48  fsblkcnt_t f_blocks;
50  fsblkcnt_t f_bfree;
51  fsblkcnt_t f_bavail;
53  fsfilcnt_t f_files;
54  fsfilcnt_t f_ffree;
55  fsfilcnt_t f_favail;
58  unsigned long f_fsid;
59  unsigned long f_flag;
60  unsigned long f_namemax;
61 };
62 
63 enum {
64  ST_RDONLY = 1, /* Mount read-only. */
65  ST_NOSUID = 2, /* Ignore suid and sgid bits. */
66 };
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif /* SYS_STATVFS_H */
73 
74 #endif /* CPU_NATIVE */
75 
unsigned long f_fsid
File system ID.
Definition: statvfs.h:58
fsblkcnt_t f_bavail
Number of free blocks available to non-privileged process.
Definition: statvfs.h:51
fsblkcnt_t f_blocks
Total number of blocks on file system in units of f_frsize.
Definition: statvfs.h:48
unsigned long f_frsize
Fundamental file system block size.
Definition: statvfs.h:47
unsigned long f_namemax
Maximum filename length.
Definition: statvfs.h:60
fsfilcnt_t f_ffree
Total number of free file serial numbers.
Definition: statvfs.h:54
fsblkcnt_t f_bfree
Total number of free blocks.
Definition: statvfs.h:50
fsfilcnt_t f_files
Total number of file serial numbers.
Definition: statvfs.h:53
File system information.
Definition: statvfs.h:45
unsigned long f_flag
Bit mask of f_flag values.
Definition: statvfs.h:59
fsfilcnt_t f_favail
Number of file serial numbers available to non-privileged process.
Definition: statvfs.h:55
unsigned long f_bsize
File system block size.
Definition: statvfs.h:46