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