The friendly Operating System for the Internet of Things
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 */
27 #if MODULE_NEWLIB || defined(__mips__)
28 /* newlib support for fsblkcnt_t was only recently added to the newlib git
29  * repository, commit f3e587d30a9f65d0c6551ad14095300f6e81672e, 15 apr 2016.
30  * Will be included in release 2.5.0, around new year 2016/2017.
31  * We provide the below workaround if the used tool chain is too old. */
32 #ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */
33 #include <stdint.h>
34 /* Default to 32 bit file sizes on newlib platforms */
35 typedef uint32_t fsblkcnt_t;
36 typedef uint32_t fsfilcnt_t;
37 #define _FSBLKCNT_T_DECLARED
38 #endif
39 #endif
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
47 struct statvfs {
48  unsigned long f_bsize;
49  unsigned long f_frsize;
50  fsblkcnt_t f_blocks;
52  fsblkcnt_t f_bfree;
53  fsblkcnt_t f_bavail;
55  fsfilcnt_t f_files;
56  fsfilcnt_t f_ffree;
57  fsfilcnt_t f_favail;
60  unsigned long f_fsid;
61  unsigned long f_flag;
62  unsigned long f_namemax;
63 };
64 
65 enum {
66  ST_RDONLY = 1, /* Mount read-only. */
67  ST_NOSUID = 2, /* Ignore suid and sgid bits. */
68 };
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif /* SYS_STATVFS_H_ */
75 
76 #endif /* CPU_NATIVE */
77 
unsigned long f_fsid
File system ID.
Definition: statvfs.h:60
fsblkcnt_t f_bavail
Number of free blocks available to non-privileged process.
Definition: statvfs.h:53
fsblkcnt_t f_blocks
Total number of blocks on file system in units of f_frsize.
Definition: statvfs.h:50
unsigned long f_frsize
Fundamental file system block size.
Definition: statvfs.h:49
unsigned long f_namemax
Maximum filename length.
Definition: statvfs.h:62
fsfilcnt_t f_ffree
Total number of free file serial numbers.
Definition: statvfs.h:56
fsblkcnt_t f_bfree
Total number of free blocks.
Definition: statvfs.h:52
fsfilcnt_t f_files
Total number of file serial numbers.
Definition: statvfs.h:55
File system information.
Definition: statvfs.h:47
unsigned long f_flag
Bit mask of f_flag values.
Definition: statvfs.h:61
fsfilcnt_t f_favail
Number of file serial numbers available to non-privileged process.
Definition: statvfs.h:57
unsigned long f_bsize
File system block size.
Definition: statvfs.h:48