Loading...
Searching...
No Matches
statvfs.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Eistec AB
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
14
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
22#include <sys/types.h> /* for fsblkcnt_t, fsfilcnt_t */
23#if MODULE_NEWLIB
24/* newlib support for fsblkcnt_t was only recently added to the newlib git
25 * repository, commit f3e587d30a9f65d0c6551ad14095300f6e81672e, 15 apr 2016.
26 * Will be included in release 2.5.0, around new year 2016/2017.
27 * We provide the below workaround if the used tool chain is too old. */
28#ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */
29#include <stdint.h>
30/* Default to 32 bit file sizes on newlib platforms */
31typedef uint32_t fsblkcnt_t;
32typedef uint32_t fsfilcnt_t;
33#define _FSBLKCNT_T_DECLARED
34#endif
35#endif
36#ifdef __cplusplus
37extern "C" {
38#endif
39
43struct statvfs {
44 unsigned long f_bsize;
45 unsigned long f_frsize;
46 fsblkcnt_t f_blocks;
48 fsblkcnt_t f_bfree;
49 fsblkcnt_t f_bavail;
51 fsfilcnt_t f_files;
52 fsfilcnt_t f_ffree;
53 fsfilcnt_t f_favail;
55
56 unsigned long f_fsid;
57 unsigned long f_flag;
58 unsigned long f_namemax;
59};
60
61enum {
62 ST_RDONLY = 1, /* Mount read-only. */
63 ST_NOSUID = 2, /* Ignore suid and sgid bits. */
64};
65
66#ifdef __cplusplus
67}
68#endif
69
70#endif /* CPU_NATIVE */
71
File system information.
Definition statvfs.h:43
unsigned long f_namemax
Maximum filename length.
Definition statvfs.h:58
unsigned long f_fsid
File system ID.
Definition statvfs.h:56
unsigned long f_bsize
File system block size.
Definition statvfs.h:44
fsblkcnt_t f_bavail
Number of free blocks available to non-privileged process.
Definition statvfs.h:49
fsfilcnt_t f_files
Total number of file serial numbers.
Definition statvfs.h:51
fsfilcnt_t f_ffree
Total number of free file serial numbers.
Definition statvfs.h:52
fsfilcnt_t f_favail
Number of file serial numbers 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:46
fsblkcnt_t f_bfree
Total number of free blocks.
Definition statvfs.h:48
unsigned long f_flag
Bit mask of f_flag values.
Definition statvfs.h:57
unsigned long f_frsize
Fundamental file system block size.
Definition statvfs.h:45