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