FreeBSD/Linux Kernel Cross Reference
sys/sys/statvfs.h
1 /* $NetBSD: statvfs.h,v 1.11 2006/07/31 16:34:44 martin Exp $ */
2
3 /*-
4 * Copyright (c) 2004 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #ifndef _SYS_STATVFS_H_
40 #define _SYS_STATVFS_H_
41
42 #include <sys/cdefs.h>
43 #include <sys/featuretest.h>
44 #include <sys/stdint.h>
45 #include <machine/ansi.h>
46 #include <sys/ansi.h>
47 #include <sys/fstypes.h>
48
49 #define _VFS_NAMELEN 32
50 #define _VFS_MNAMELEN 1024
51
52 #ifndef fsblkcnt_t
53 typedef __fsblkcnt_t fsblkcnt_t; /* fs block count (statvfs) */
54 #define fsblkcnt_t __fsblkcnt_t
55 #endif
56
57 #ifndef fsfilcnt_t
58 typedef __fsfilcnt_t fsfilcnt_t; /* fs file count */
59 #define fsfilcnt_t __fsfilcnt_t
60 #endif
61
62 #ifndef uid_t
63 typedef __uid_t uid_t; /* user id */
64 #define uid_t __uid_t
65 #endif
66
67 #ifdef _BSD_SIZE_T_
68 typedef _BSD_SIZE_T_ size_t;
69 #define _SIZE_T
70 #undef _BSD_SIZE_T_
71 #endif
72
73 struct statvfs {
74 unsigned long f_flag; /* copy of mount exported flags */
75 unsigned long f_bsize; /* file system block size */
76 unsigned long f_frsize; /* fundamental file system block size */
77 unsigned long f_iosize; /* optimal file system block size */
78
79 fsblkcnt_t f_blocks; /* number of blocks in file system, */
80 /* (in units of f_frsize) */
81 fsblkcnt_t f_bfree; /* free blocks avail in file system */
82 fsblkcnt_t f_bavail; /* free blocks avail to non-root */
83 fsblkcnt_t f_bresvd; /* blocks reserved for root */
84
85 fsfilcnt_t f_files; /* total file nodes in file system */
86 fsfilcnt_t f_ffree; /* free file nodes in file system */
87 fsfilcnt_t f_favail; /* free file nodes avail to non-root */
88 fsfilcnt_t f_fresvd; /* file nodes reserved for root */
89
90 uint64_t f_syncreads; /* count of sync reads since mount */
91 uint64_t f_syncwrites; /* count of sync writes since mount */
92
93 uint64_t f_asyncreads; /* count of async reads since mount */
94 uint64_t f_asyncwrites; /* count of async writes since mount */
95
96 fsid_t f_fsidx; /* NetBSD compatible fsid */
97 unsigned long f_fsid; /* Posix compatible fsid */
98 unsigned long f_namemax; /* maximum filename length */
99 uid_t f_owner; /* user that mounted the file system */
100
101 uint32_t f_spare[4]; /* spare space */
102
103 char f_fstypename[_VFS_NAMELEN]; /* fs type name */
104 char f_mntonname[_VFS_MNAMELEN]; /* directory on which mounted */
105 char f_mntfromname[_VFS_MNAMELEN]; /* mounted file system */
106
107 };
108
109 #if defined(_NETBSD_SOURCE) && !defined(_POSIX_SOURCE) && \
110 !defined(_XOPEN_SOURCE)
111 #define VFS_NAMELEN _VFS_NAMELEN
112 #define VFS_MNAMELEN _VFS_MNAMELEN
113 #endif
114
115 #define ST_RDONLY MNT_RDONLY
116 #define ST_SYNCHRONOUS MNT_SYNCHRONOUS
117 #define ST_NOEXEC MNT_NOEXEC
118 #define ST_NOSUID MNT_NOSUID
119 #define ST_NODEV MNT_NODEV
120 #define ST_UNION MNT_UNION
121 #define ST_ASYNC MNT_ASYNC
122 #define ST_NOCOREDUMP MNT_NOCOREDUMP
123 #define ST_IGNORE MNT_IGNORE
124 #define ST_NOATIME MNT_NOATIME
125 #define ST_SYMPERM MNT_SYMPERM
126 #define ST_NODEVMTIME MNT_NODEVMTIME
127 #define ST_SOFTDEP MNT_SOFTDEP
128
129 #define ST_EXRDONLY MNT_EXRDONLY
130 #define ST_EXPORTED MNT_EXPORTED
131 #define ST_DEFEXPORTED MNT_DEFEXPORTED
132 #define ST_EXPORTANON MNT_EXPORTANON
133 #define ST_EXKERB MNT_EXKERB
134 #define ST_EXNORESPORT MNT_EXNORESPORT
135 #define ST_EXPUBLIC MNT_EXPUBLIC
136
137 #define ST_LOCAL MNT_LOCAL
138 #define ST_QUOTA MNT_QUOTA
139 #define ST_ROOTFS MNT_ROOTFS
140
141
142 #define ST_WAIT MNT_WAIT
143 #define ST_NOWAIT MNT_NOWAIT
144
145 #if defined(_KERNEL) || defined(_STANDALONE)
146 struct mount;
147 struct lwp;
148
149 int set_statvfs_info(const char *, int, const char *, int,
150 struct mount *, struct lwp *);
151 void copy_statvfs_info(struct statvfs *, const struct mount *);
152 int dostatvfs(struct mount *, struct statvfs *, struct lwp *, int, int);
153 #else
154 __BEGIN_DECLS
155 int statvfs(const char *__restrict, struct statvfs *__restrict);
156 int fstatvfs(int, struct statvfs *);
157 int getvfsstat(struct statvfs *, size_t, int);
158 #ifndef __LIBC12_SOURCE__
159 int getmntinfo(struct statvfs **, int) __RENAME(__getmntinfo13);
160 #endif /* __LIBC12_SOURCE__ */
161 #if defined(_NETBSD_SOURCE)
162 #ifndef __LIBC12_SOURCE__
163 int fhstatvfs(const void *, size_t, struct statvfs *)
164 __RENAME(__fhstatvfs40);
165 #endif
166
167 int statvfs1(const char *__restrict, struct statvfs *__restrict, int);
168 int fstatvfs1(int, struct statvfs *, int);
169 #ifndef __LIBC12_SOURCE__
170 int fhstatvfs1(const void *, size_t, struct statvfs *, int)
171 __RENAME(__fhstatvfs140);
172 #endif
173 #endif /* _NETBSD_SOURCE */
174 __END_DECLS
175 #endif /* _KERNEL || _STANDALONE */
176
177 #if defined(_KERNEL)
178 #define STATVFSBUF_GET() malloc(sizeof(struct statvfs), M_TEMP, M_WAITOK)
179 #define STATVFSBUF_PUT(sb) free(sb, M_TEMP);
180 #endif /* defined(_KERNEL) */
181
182 #endif /* !_SYS_STATVFS_H_ */
Cache object: 200fb95fd9f10da19072cf26f89150b8
|