xref: /dragonfly/sys/sys/statvfs.h (revision b9a2c4b6)
17c11ba07SJeroen Ruigrok/asmodai /*
27c11ba07SJeroen Ruigrok/asmodai  * Copyright (c) 2005 The DragonFly Project.  All rights reserved.
37c11ba07SJeroen Ruigrok/asmodai  *
47c11ba07SJeroen Ruigrok/asmodai  * This code is derived from software contributed to The DragonFly Project
57c11ba07SJeroen Ruigrok/asmodai  * by Jeroen Ruigrok van der Werven <asmodai@tendra.org>
67c11ba07SJeroen Ruigrok/asmodai  *
77c11ba07SJeroen Ruigrok/asmodai  * Redistribution and use in source and binary forms, with or without
87c11ba07SJeroen Ruigrok/asmodai  * modification, are permitted provided that the following conditions
97c11ba07SJeroen Ruigrok/asmodai  * are met:
107c11ba07SJeroen Ruigrok/asmodai  *
117c11ba07SJeroen Ruigrok/asmodai  * 1. Redistributions of source code must retain the above copyright
127c11ba07SJeroen Ruigrok/asmodai  *    notice, this list of conditions and the following disclaimer.
137c11ba07SJeroen Ruigrok/asmodai  * 2. Redistributions in binary form must reproduce the above copyright
147c11ba07SJeroen Ruigrok/asmodai  *    notice, this list of conditions and the following disclaimer in
157c11ba07SJeroen Ruigrok/asmodai  *    the documentation and/or other materials provided with the
167c11ba07SJeroen Ruigrok/asmodai  *    distribution.
177c11ba07SJeroen Ruigrok/asmodai  * 3. Neither the name of The DragonFly Project nor the names of its
187c11ba07SJeroen Ruigrok/asmodai  *    contributors may be used to endorse or promote products derived
197c11ba07SJeroen Ruigrok/asmodai  *    from this software without specific, prior written permission.
207c11ba07SJeroen Ruigrok/asmodai  *
217c11ba07SJeroen Ruigrok/asmodai  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
227c11ba07SJeroen Ruigrok/asmodai  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
237c11ba07SJeroen Ruigrok/asmodai  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
247c11ba07SJeroen Ruigrok/asmodai  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
257c11ba07SJeroen Ruigrok/asmodai  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
267c11ba07SJeroen Ruigrok/asmodai  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
277c11ba07SJeroen Ruigrok/asmodai  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
287c11ba07SJeroen Ruigrok/asmodai  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
297c11ba07SJeroen Ruigrok/asmodai  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
307c11ba07SJeroen Ruigrok/asmodai  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
317c11ba07SJeroen Ruigrok/asmodai  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
327c11ba07SJeroen Ruigrok/asmodai  * SUCH DAMAGE.
337c11ba07SJeroen Ruigrok/asmodai  */
347c11ba07SJeroen Ruigrok/asmodai 
35be1dbd42SJeroen Ruigrok/asmodai #ifndef _SYS_STATVFS_H_
36be1dbd42SJeroen Ruigrok/asmodai #define _SYS_STATVFS_H_
37be1dbd42SJeroen Ruigrok/asmodai 
38*b9a2c4b6SSascha Wildner #include <machine/stdint.h>
3950626622SMatthew Dillon #include <sys/uuid.h>
407c11ba07SJeroen Ruigrok/asmodai 
41*b9a2c4b6SSascha Wildner #ifndef _FSBLKCNT_T_DECLARED
42*b9a2c4b6SSascha Wildner typedef	__uint64_t	fsblkcnt_t;	/* filesystem block count */
43*b9a2c4b6SSascha Wildner #define	_FSBLKCNT_T_DECLARED
44*b9a2c4b6SSascha Wildner #endif
45*b9a2c4b6SSascha Wildner #ifndef _FSFILCNT_T_DECLARED
46*b9a2c4b6SSascha Wildner typedef	__uint64_t	fsfilcnt_t;	/* filesystem file count */
47*b9a2c4b6SSascha Wildner #define	_FSFILCNT_T_DECLARED
48*b9a2c4b6SSascha Wildner #endif
49*b9a2c4b6SSascha Wildner #ifndef _UID_T_DECLARED
50*b9a2c4b6SSascha Wildner typedef	__uint32_t	uid_t;		/* user id */
51*b9a2c4b6SSascha Wildner #define	_UID_T_DECLARED
52*b9a2c4b6SSascha Wildner #endif
53*b9a2c4b6SSascha Wildner 
54*b9a2c4b6SSascha Wildner #if __BSD_VISIBLE
55c4c8e252SMatthew Dillon struct fhandle;
56e3297706SMatthew Dillon struct statfs;
57*b9a2c4b6SSascha Wildner #endif
58c4c8e252SMatthew Dillon 
597c11ba07SJeroen Ruigrok/asmodai /*
607c11ba07SJeroen Ruigrok/asmodai  * The POSIX 1003.1 standard uses free and available nomenclature to mean the
617c11ba07SJeroen Ruigrok/asmodai  * following:
627c11ba07SJeroen Ruigrok/asmodai  * - free means all space, including privileged processes,
637c11ba07SJeroen Ruigrok/asmodai  * - avail means all space available to unprivileged processes.
647c11ba07SJeroen Ruigrok/asmodai  */
657c11ba07SJeroen Ruigrok/asmodai 
667c11ba07SJeroen Ruigrok/asmodai struct statvfs {
677c11ba07SJeroen Ruigrok/asmodai 	unsigned long	f_bsize;	/* file system block size */
68a20b11abSJoerg Sonnenberger 	unsigned long	f_frsize;	/* fundamental file system block size */
697c11ba07SJeroen Ruigrok/asmodai 	fsblkcnt_t	f_blocks;	/* total number of blocks on fs */
707c11ba07SJeroen Ruigrok/asmodai 	fsblkcnt_t	f_bfree;	/* total number of free blocks */
717c11ba07SJeroen Ruigrok/asmodai 	fsblkcnt_t	f_bavail;	/* total number of available blocks */
727c11ba07SJeroen Ruigrok/asmodai 	fsfilcnt_t	f_files;	/* total number of file serial num */
737c11ba07SJeroen Ruigrok/asmodai 	fsfilcnt_t	f_ffree;	/* total number of free file ser num */
747c11ba07SJeroen Ruigrok/asmodai 	fsfilcnt_t	f_favail;	/* total number of avail file ser num */
757c11ba07SJeroen Ruigrok/asmodai 	unsigned long	f_fsid;		/* file system ID */
767c11ba07SJeroen Ruigrok/asmodai 	unsigned long	f_flag;		/* bit mask of f_flag values */
777c11ba07SJeroen Ruigrok/asmodai 	unsigned long	f_namemax;	/* maximum filename length */
7855a21979SJoerg Sonnenberger 	uid_t		f_owner;	/* user that mounted the filesystem */
7955a21979SJoerg Sonnenberger 	unsigned int	f_type;		/* filesystem type */
8055a21979SJoerg Sonnenberger 
81*b9a2c4b6SSascha Wildner 	__uint64_t  	f_syncreads;	/* count of sync reads since mount */
82*b9a2c4b6SSascha Wildner 	__uint64_t  	f_syncwrites;	/* count of sync writes since mount */
8355a21979SJoerg Sonnenberger 
84*b9a2c4b6SSascha Wildner 	__uint64_t  	f_asyncreads;	/* count of async reads since mount */
85*b9a2c4b6SSascha Wildner 	__uint64_t  	f_asyncwrites;	/* count of async writes since mount */
8655a21979SJoerg Sonnenberger 
8750626622SMatthew Dillon 	/*
8850626622SMatthew Dillon 	 * DragonFly extensions - full uuid FSID and owner
8950626622SMatthew Dillon 	 */
9050626622SMatthew Dillon 	uuid_t		f_fsid_uuid;
9150626622SMatthew Dillon 	uuid_t		f_uid_uuid;
927c11ba07SJeroen Ruigrok/asmodai };
937c11ba07SJeroen Ruigrok/asmodai 
9450626622SMatthew Dillon /*
9550626622SMatthew Dillon  * f_flag definitions
9650626622SMatthew Dillon  */
9750626622SMatthew Dillon #define ST_RDONLY	0x00000001	/* fs is read-only */
9850626622SMatthew Dillon #define ST_NOSUID	0x00000002	/* ST_ISUID or ST_ISGID not supported */
9950626622SMatthew Dillon 
100*b9a2c4b6SSascha Wildner #if __BSD_VISIBLE
10150626622SMatthew Dillon /*
10250626622SMatthew Dillon  * DragonFly specific flags
10350626622SMatthew Dillon  */
10450626622SMatthew Dillon #define ST_FSID_UUID	0x40000000	/* f_fsid_uuid field is valid */
10550626622SMatthew Dillon #define ST_OWNER_UUID	0x80000000	/* f_owner_uuid field is valid */
106*b9a2c4b6SSascha Wildner #endif
1077c11ba07SJeroen Ruigrok/asmodai 
1087a2611c3SJoerg Sonnenberger __BEGIN_DECLS
1097c11ba07SJeroen Ruigrok/asmodai int	fstatvfs(int, struct statvfs *);
1107c11ba07SJeroen Ruigrok/asmodai int	statvfs(const char * __restrict, struct statvfs * __restrict);
111*b9a2c4b6SSascha Wildner 
112*b9a2c4b6SSascha Wildner #if __BSD_VISIBLE
1130e735c8fSMatthew Dillon int	fhstatvfs(const struct fhandle *, struct statvfs * __restrict);
114d3bdc5e5SHasso Tepper int	getvfsstat(struct statfs * __restrict, struct statvfs * __restrict, long, int);
115*b9a2c4b6SSascha Wildner #endif
1167a2611c3SJoerg Sonnenberger __END_DECLS
117be1dbd42SJeroen Ruigrok/asmodai 
118be1dbd42SJeroen Ruigrok/asmodai #endif /* _SYS_STATVFS_H_ */
119