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
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.
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]
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
26 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
28 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
29 * Use is subject to license terms.
32 #ifndef _SYS_STATVFS_H
33 #define _SYS_STATVFS_H
35 #include <sys/feature_tests.h>
36 #include <sys/types.h>
43 * Structure returned by statvfs(2).
47 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
49 #define FSTYPSZ _FSTYPSZ
51 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
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, */
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 */
69 unsigned long f_filler
[16]; /* reserved for future expansion */
73 #if defined(_SYSCALL32)
75 /* Kernel view of user ILP32 statvfs structure */
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, */
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 */
95 #endif /* _SYSCALL32 */
97 /* transitional large file interface version */
98 typedef struct statvfs64
{
99 unsigned long f_bsize
; /* preferred file system block size */
100 unsigned long f_frsize
; /* fundamental file system block size */
101 fsblkcnt64_t f_blocks
; /* total blocks of f_frsize */
102 fsblkcnt64_t f_bfree
; /* total free blocks of f_frsize */
103 fsblkcnt64_t f_bavail
; /* free blocks avail to non-superuser */
104 fsfilcnt64_t f_files
; /* total # of file nodes (inodes) */
105 fsfilcnt64_t f_ffree
; /* total # of free file nodes */
106 fsfilcnt64_t f_favail
; /* free nodes avail to non-superuser */
107 unsigned long f_fsid
; /* file system id (dev for now) */
108 char f_basetype
[_FSTYPSZ
]; /* target fs type name, */
109 /* null-terminated */
110 unsigned long f_flag
; /* bit-mask of flags */
111 unsigned long f_namemax
; /* maximum file name length */
112 char f_fstr
[32]; /* filesystem-specific string */
114 unsigned long f_filler
[16]; /* reserved for future expansion */
118 #if defined(_SYSCALL32)
120 /* Kernel view of user ILP32 statvfs64 structure */
122 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
126 typedef struct statvfs64_32
{
127 uint32_t f_bsize
; /* preferred file system block size */
128 uint32_t f_frsize
; /* fundamental file system block size */
129 fsblkcnt64_t f_blocks
; /* total blocks of f_frsize */
130 fsblkcnt64_t f_bfree
; /* total free blocks of f_frsize */
131 fsblkcnt64_t f_bavail
; /* free blocks avail to non-superuser */
132 fsfilcnt64_t f_files
; /* total # of file nodes (inodes) */
133 fsfilcnt64_t f_ffree
; /* total # of free file nodes */
134 fsfilcnt64_t f_favail
; /* free nodes avail to non-superuser */
135 uint32_t f_fsid
; /* file system id (dev for now) */
136 char f_basetype
[_FSTYPSZ
]; /* target fs type name, */
137 /* null-terminated */
138 uint32_t f_flag
; /* bit-mask of flags */
139 uint32_t f_namemax
; /* maximum file name length */
140 char f_fstr
[32]; /* filesystem-specific string */
141 uint32_t f_filler
[16]; /* reserved for future expansion */
144 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
148 #endif /* _SYSCALL32 */
154 #define ST_RDONLY 0x01 /* read-only file system */
155 #define ST_NOSUID 0x02 /* does not support setuid/setgid semantics */
156 #define ST_NOTRUNC 0x04 /* does not truncate long file names */
159 int statvfs(const char *_RESTRICT_KYWD
, struct statvfs
*_RESTRICT_KYWD
);
160 int fstatvfs(int, struct statvfs
*);
163 * FIXME: source compat; statvfs64() is an alias of statvfs(), but the argument
164 * types have different names (struct statvfs vs struct statvfs64) even if
165 * identical, so we can't simply add the function decl here - use a #define
168 #define statvfs64 statvfs
169 #define statvfs64_t statvfs_t
170 int fstatvfs64(int, struct statvfs
*);
177 #endif /* _SYS_STATVFS_H */