xref: /freebsd/crypto/openssh/openbsd-compat/bsd-statvfs.h (revision 3416500aef140042c64bc149cb1ec6620483bc44)
1 /*
2  * Copyright (c) 2008,2014 Darren Tucker <dtucker@zip.com.au>
3  *
4  * Permission to use, copy, modify, and distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
13  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
14  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #include "includes.h"
18 
19 #if !defined(HAVE_STATVFS) || !defined(HAVE_FSTATVFS)
20 
21 #include <sys/types.h>
22 
23 #ifdef HAVE_SYS_MOUNT_H
24 #include <sys/mount.h>
25 #endif
26 #ifdef HAVE_SYS_STATFS_H
27 #include <sys/statfs.h>
28 #endif
29 
30 #ifndef HAVE_FSBLKCNT_T
31 typedef unsigned long fsblkcnt_t;
32 #endif
33 #ifndef HAVE_FSFILCNT_T
34 typedef unsigned long fsfilcnt_t;
35 #endif
36 
37 #ifndef ST_RDONLY
38 #define ST_RDONLY	1
39 #endif
40 #ifndef ST_NOSUID
41 #define ST_NOSUID	2
42 #endif
43 
44 	/* as defined in IEEE Std 1003.1, 2004 Edition */
45 struct statvfs {
46 	unsigned long f_bsize;	/* File system block size. */
47 	unsigned long f_frsize;	/* Fundamental file system block size. */
48 	fsblkcnt_t f_blocks;	/* Total number of blocks on file system in */
49 				/* units of f_frsize. */
50 	fsblkcnt_t    f_bfree;	/* Total number of free blocks. */
51 	fsblkcnt_t    f_bavail;	/* Number of free blocks available to  */
52 				/* non-privileged process.  */
53 	fsfilcnt_t    f_files;	/* Total number of file serial numbers. */
54 	fsfilcnt_t    f_ffree;	/* Total number of free file serial numbers. */
55 	fsfilcnt_t    f_favail;	/* Number of file serial numbers available to */
56 				/* non-privileged process. */
57 	unsigned long f_fsid;	/* File system ID. */
58 	unsigned long f_flag;	/* BBit mask of f_flag values. */
59 	unsigned long f_namemax;/*  Maximum filename length. */
60 };
61 #endif
62 
63 #ifndef HAVE_STATVFS
64 int statvfs(const char *, struct statvfs *);
65 #endif
66 
67 #ifndef HAVE_FSTATVFS
68 int fstatvfs(int, struct statvfs *);
69 #endif
70