1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 23 /* All Rights Reserved */ 24 25 /* 26 * Copyright 2014 Garrett D'Amore <garrett@damore.org> 27 * 28 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 29 * Use is subject to license terms. 30 */ 31 32 #ifndef _SYS_STATVFS_H 33 #define _SYS_STATVFS_H 34 35 #include <sys/feature_tests.h> 36 #include <sys/types.h> 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 /* 43 * Structure returned by statvfs(2). 44 */ 45 46 #define _FSTYPSZ 16 47 #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 48 #ifndef FSTYPSZ 49 #define FSTYPSZ _FSTYPSZ 50 #endif 51 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 52 53 typedef struct statvfs { 54 unsigned long f_bsize; /* fundamental file system block size */ 55 unsigned long f_frsize; /* fragment size */ 56 fsblkcnt_t f_blocks; /* total blocks of f_frsize on fs */ 57 fsblkcnt_t f_bfree; /* total free blocks of f_frsize */ 58 fsblkcnt_t f_bavail; /* free blocks avail to non-superuser */ 59 fsfilcnt_t f_files; /* total file nodes (inodes) */ 60 fsfilcnt_t f_ffree; /* total free file nodes */ 61 fsfilcnt_t f_favail; /* free nodes avail to non-superuser */ 62 unsigned long f_fsid; /* file system id (dev for now) */ 63 char f_basetype[_FSTYPSZ]; /* target fs type name, */ 64 /* null-terminated */ 65 unsigned long f_flag; /* bit-mask of flags */ 66 unsigned long f_namemax; /* maximum file name length */ 67 char f_fstr[32]; /* filesystem-specific string */ 68 #if !defined(_LP64) 69 unsigned long f_filler[16]; /* reserved for future expansion */ 70 #endif 71 } statvfs_t; 72 73 #if defined(_SYSCALL32) 74 75 /* Kernel view of user ILP32 statvfs structure */ 76 77 typedef struct statvfs32 { 78 uint32_t f_bsize; /* fundamental file system block size */ 79 uint32_t f_frsize; /* fragment size */ 80 fsblkcnt32_t f_blocks; /* total blocks of f_frsize on fs */ 81 fsblkcnt32_t f_bfree; /* total free blocks of f_frsize */ 82 fsblkcnt32_t f_bavail; /* free blocks avail to non-superuser */ 83 fsfilcnt32_t f_files; /* total file nodes (inodes) */ 84 fsfilcnt32_t f_ffree; /* total free file nodes */ 85 fsfilcnt32_t f_favail; /* free nodes avail to non-superuser */ 86 uint32_t f_fsid; /* file system id (dev for now) */ 87 char f_basetype[_FSTYPSZ]; /* target fs type name, */ 88 /* null-terminated */ 89 uint32_t f_flag; /* bit-mask of flags */ 90 uint32_t f_namemax; /* maximum file name length */ 91 char f_fstr[32]; /* filesystem-specific string */ 92 uint32_t f_filler[16]; /* reserved for future expansion */ 93 } statvfs32_t; 94 95 #endif /* _SYSCALL32 */ 96 97 /* transitional large file interface version */ 98 #if defined(_LARGEFILE64_SOURCE) 99 typedef struct statvfs64 { 100 unsigned long f_bsize; /* preferred file system block size */ 101 unsigned long f_frsize; /* fundamental file system block size */ 102 fsblkcnt64_t f_blocks; /* total blocks of f_frsize */ 103 fsblkcnt64_t f_bfree; /* total free blocks of f_frsize */ 104 fsblkcnt64_t f_bavail; /* free blocks avail to non-superuser */ 105 fsfilcnt64_t f_files; /* total # of file nodes (inodes) */ 106 fsfilcnt64_t f_ffree; /* total # of free file nodes */ 107 fsfilcnt64_t f_favail; /* free nodes avail to non-superuser */ 108 unsigned long f_fsid; /* file system id (dev for now) */ 109 char f_basetype[FSTYPSZ]; /* target fs type name, */ 110 /* null-terminated */ 111 unsigned long f_flag; /* bit-mask of flags */ 112 unsigned long f_namemax; /* maximum file name length */ 113 char f_fstr[32]; /* filesystem-specific string */ 114 #if !defined(_LP64) 115 unsigned long f_filler[16]; /* reserved for future expansion */ 116 #endif /* _LP64 */ 117 } statvfs64_t; 118 #endif 119 120 #if defined(_SYSCALL32) 121 122 /* Kernel view of user ILP32 statvfs64 structure */ 123 124 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 125 #pragma pack(4) 126 #endif 127 128 typedef struct statvfs64_32 { 129 uint32_t f_bsize; /* preferred file system block size */ 130 uint32_t f_frsize; /* fundamental file system block size */ 131 fsblkcnt64_t f_blocks; /* total blocks of f_frsize */ 132 fsblkcnt64_t f_bfree; /* total free blocks of f_frsize */ 133 fsblkcnt64_t f_bavail; /* free blocks avail to non-superuser */ 134 fsfilcnt64_t f_files; /* total # of file nodes (inodes) */ 135 fsfilcnt64_t f_ffree; /* total # of free file nodes */ 136 fsfilcnt64_t f_favail; /* free nodes avail to non-superuser */ 137 uint32_t f_fsid; /* file system id (dev for now) */ 138 char f_basetype[FSTYPSZ]; /* target fs type name, */ 139 /* null-terminated */ 140 uint32_t f_flag; /* bit-mask of flags */ 141 uint32_t f_namemax; /* maximum file name length */ 142 char f_fstr[32]; /* filesystem-specific string */ 143 uint32_t f_filler[16]; /* reserved for future expansion */ 144 } statvfs64_32_t; 145 146 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 147 #pragma pack() 148 #endif 149 150 #endif /* _SYSCALL32 */ 151 152 /* 153 * Flag definitions. 154 */ 155 156 #define ST_RDONLY 0x01 /* read-only file system */ 157 #define ST_NOSUID 0x02 /* does not support setuid/setgid semantics */ 158 #define ST_NOTRUNC 0x04 /* does not truncate long file names */ 159 160 #if !defined(_KERNEL) 161 /* 162 * large file compilation environment setup 163 */ 164 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 165 #ifdef __PRAGMA_REDEFINE_EXTNAME 166 #pragma redefine_extname statvfs statvfs64 167 #pragma redefine_extname fstatvfs fstatvfs64 168 #else 169 #define statvfs_t statvfs64_t 170 #define statvfs statvfs64 171 #define fstatvfs fstatvfs64 172 #endif 173 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ 174 175 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE) 176 /* 177 * In the LP64 compilation environment, map large file interfaces 178 * back to native versions where possible. 179 */ 180 #ifdef __PRAGMA_REDEFINE_EXTNAME 181 #pragma redefine_extname statvfs64 statvfs 182 #pragma redefine_extname fstatvfs64 fstatvfs 183 #else 184 #define statvfs64_t statvfs_t 185 #define statvfs64 statvfs 186 #define fstatvfs64 fstatvfs 187 #endif 188 #endif /* _LP64 && _LARGEFILE64_SOURCE */ 189 190 int statvfs(const char *_RESTRICT_KYWD, statvfs_t *_RESTRICT_KYWD); 191 int fstatvfs(int, statvfs_t *); 192 193 /* transitional large file interface versions */ 194 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 195 !defined(__PRAGMA_REDEFINE_EXTNAME)) 196 int statvfs64(const char *_RESTRICT_KYWD, statvfs64_t *_RESTRICT_KYWD); 197 int fstatvfs64(int, statvfs64_t *); 198 #endif /* _LARGEFILE64_SOURCE... */ 199 #endif /* !defined(_KERNEL) */ 200 201 #ifdef __cplusplus 202 } 203 #endif 204 205 #endif /* _SYS_STATVFS_H */