1 /* Copyright (C) 2011-2022 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3 
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8 
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13 
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library.  If not, see
16    <https://www.gnu.org/licenses/>.  */
17 
18 #ifndef _SYS_STATFS_H
19 # error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
20 #endif
21 
22 #include <bits/endian.h>
23 #include <bits/types.h>
24 #include <bits/wordsize.h>
25 
26 #if defined __USE_FILE_OFFSET64
27 # define __field64(type, type64, name) type64 name
28 #elif __BYTE_ORDER == __LITTLE_ENDIAN
29 # define __field64(type, type64, name) \
30   type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad
31 #else
32 # define __field64(type, type64, name) \
33   int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name
34 #endif
35 
36 struct statfs
37   {
38     __SWORD_TYPE f_type;
39     __SWORD_TYPE f_bsize;
40     __field64(__fsblkcnt_t, __fsblkcnt64_t, f_blocks);
41     __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bfree);
42     __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bavail);
43     __field64(__fsfilcnt_t, __fsfilcnt64_t, f_files);
44     __field64(__fsfilcnt_t, __fsfilcnt64_t, f_ffree);
45     __fsid_t f_fsid;
46     __SWORD_TYPE f_namelen;
47     __SWORD_TYPE f_frsize;
48     __SWORD_TYPE f_flags;
49     __SWORD_TYPE f_spare[4];
50   };
51 
52 #undef __field64
53 
54 #ifdef __USE_LARGEFILE64
55 struct statfs64
56   {
57     __SWORD_TYPE f_type;
58     __SWORD_TYPE f_bsize;
59     __fsblkcnt64_t f_blocks;
60     __fsblkcnt64_t f_bfree;
61     __fsblkcnt64_t f_bavail;
62     __fsfilcnt64_t f_files;
63     __fsfilcnt64_t f_ffree;
64     __fsid_t f_fsid;
65     __SWORD_TYPE f_namelen;
66     __SWORD_TYPE f_frsize;
67     __SWORD_TYPE f_flags;
68     __SWORD_TYPE f_spare[4];
69   };
70 #endif
71 
72 /* Tell code we have these members.  */
73 #define _STATFS_F_NAMELEN
74 #define _STATFS_F_FRSIZE
75 #define _STATFS_F_FLAGS
76