Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / unix / sysv / linux / generic / bits / statfs.h
blobe32cf76741943f79f6d04fe68c83483bf548c78c
1 /* Copyright (C) 2011-2014 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <http://www.gnu.org/licenses/>. */
19 #ifndef _SYS_STATFS_H
20 # error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
21 #endif
23 #include <endian.h>
24 #include <bits/types.h>
25 #include <bits/wordsize.h>
27 /* 64-bit libc uses the kernel's 'struct statfs', accessed via the
28 statfs() syscall; 32-bit libc uses the kernel's 'struct statfs64'
29 and accesses it via the statfs64() syscall. All the various
30 APIs offered by libc use the kernel shape for their struct statfs
31 structure; the only difference is that 32-bit programs not
32 using __USE_FILE_OFFSET64 only see the low 32 bits of some
33 of the fields (the __fsblkcnt_t and __fsfilcnt_t fields). */
35 #if defined __USE_FILE_OFFSET64
36 # define __field64(type, type64, name) type64 name
37 #elif __WORDSIZE == 64
38 # define __field64(type, type64, name) type name
39 #elif __BYTE_ORDER == __LITTLE_ENDIAN
40 # define __field64(type, type64, name) \
41 type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad
42 #else
43 # define __field64(type, type64, name) \
44 int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name
45 #endif
47 struct statfs
49 __SWORD_TYPE f_type;
50 __SWORD_TYPE f_bsize;
51 __field64(__fsblkcnt_t, __fsblkcnt64_t, f_blocks);
52 __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bfree);
53 __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bavail);
54 __field64(__fsfilcnt_t, __fsfilcnt64_t, f_files);
55 __field64(__fsfilcnt_t, __fsfilcnt64_t, f_ffree);
56 __fsid_t f_fsid;
57 __SWORD_TYPE f_namelen;
58 __SWORD_TYPE f_frsize;
59 __SWORD_TYPE f_flags;
60 __SWORD_TYPE f_spare[4];
63 #undef __field64
65 #ifdef __USE_LARGEFILE64
66 struct statfs64
68 __SWORD_TYPE f_type;
69 __SWORD_TYPE f_bsize;
70 __fsblkcnt64_t f_blocks;
71 __fsblkcnt64_t f_bfree;
72 __fsblkcnt64_t f_bavail;
73 __fsfilcnt64_t f_files;
74 __fsfilcnt64_t f_ffree;
75 __fsid_t f_fsid;
76 __SWORD_TYPE f_namelen;
77 __SWORD_TYPE f_frsize;
78 __SWORD_TYPE f_flags;
79 __SWORD_TYPE f_spare[4];
81 #endif
83 /* Tell code we have these members. */
84 #define _STATFS_F_NAMELEN
85 #define _STATFS_F_FRSIZE
86 #define _STATFS_F_FLAGS