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