Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / sys / statvfs.h @ 14

History | View | Annotate | Download (6 KB)

1 13 up20180614
/*        $NetBSD: statvfs.h,v 1.18 2013/04/05 17:34:27 christos 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
 *
19
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
 * POSSIBILITY OF SUCH DAMAGE.
30
 */
31
32
#ifndef        _SYS_STATVFS_H_
33
#define        _SYS_STATVFS_H_
34
35
#include <sys/cdefs.h>
36
#include <sys/featuretest.h>
37
#include <sys/stdint.h>
38
#include <machine/ansi.h>
39
#include <sys/ansi.h>
40
#include <sys/fstypes.h>
41
42
#define        _VFS_NAMELEN        32
43
#define        _VFS_MNAMELEN        1024
44
45
#ifndef        fsblkcnt_t
46
typedef        __fsblkcnt_t        fsblkcnt_t;        /* fs block count (statvfs) */
47
#define        fsblkcnt_t        __fsblkcnt_t
48
#endif
49
50
#ifndef        fsfilcnt_t
51
typedef        __fsfilcnt_t        fsfilcnt_t;        /* fs file count */
52
#define        fsfilcnt_t        __fsfilcnt_t
53
#endif
54
55
#ifndef        uid_t
56
typedef        __uid_t                uid_t;                /* user id */
57
#define        uid_t                __uid_t
58
#endif
59
60
#ifdef        _BSD_SIZE_T_
61
typedef        _BSD_SIZE_T_                size_t;
62
#define        _SIZE_T
63
#undef        _BSD_SIZE_T_
64
#endif
65
66
struct statvfs {
67
        unsigned long        f_flag;                /* copy of mount exported flags */
68
        unsigned long        f_bsize;        /* file system block size */
69
        unsigned long        f_frsize;        /* fundamental file system block size */
70
        unsigned long        f_iosize;        /* optimal file system block size */
71
72
        /* The following are in units of f_frsize */
73
        fsblkcnt_t        f_blocks;        /* number of blocks in file system, */
74
        fsblkcnt_t        f_bfree;        /* free blocks avail in file system */
75
        fsblkcnt_t        f_bavail;        /* free blocks avail to non-root */
76
        fsblkcnt_t        f_bresvd;        /* blocks reserved for root */
77
78
        fsfilcnt_t        f_files;        /* total file nodes in file system */
79
        fsfilcnt_t        f_ffree;        /* free file nodes in file system */
80
        fsfilcnt_t        f_favail;        /* free file nodes avail to non-root */
81
        fsfilcnt_t        f_fresvd;        /* file nodes reserved for root */
82
83
        uint64_t          f_syncreads;        /* count of sync reads since mount */
84
        uint64_t          f_syncwrites;        /* count of sync writes since mount */
85
86
        uint64_t          f_asyncreads;        /* count of async reads since mount */
87
        uint64_t          f_asyncwrites;        /* count of async writes since mount */
88
89
        fsid_t                f_fsidx;        /* NetBSD compatible fsid */
90
        unsigned long        f_fsid;                /* Posix compatible fsid */
91
        unsigned long        f_namemax;        /* maximum filename length */
92
        uid_t                f_owner;        /* user that mounted the file system */
93
94
        uint32_t        f_spare[4];        /* spare space */
95
96
        char        f_fstypename[_VFS_NAMELEN]; /* fs type name */
97
        char        f_mntonname[_VFS_MNAMELEN];  /* directory on which mounted */
98
        char        f_mntfromname[_VFS_MNAMELEN];  /* mounted file system */
99
100
};
101
102
#if defined(_NETBSD_SOURCE) && !defined(_POSIX_SOURCE) && \
103
    !defined(_XOPEN_SOURCE)
104
#define        VFS_NAMELEN        _VFS_NAMELEN
105
#define        VFS_MNAMELEN        _VFS_MNAMELEN
106
#endif
107
108
#define        ST_RDONLY        MNT_RDONLY
109
#define        ST_SYNCHRONOUS        MNT_SYNCHRONOUS
110
#define        ST_NOEXEC        MNT_NOEXEC
111
#define        ST_NOSUID        MNT_NOSUID
112
#define        ST_NODEV        MNT_NODEV
113
#define        ST_UNION        MNT_UNION
114
#define        ST_ASYNC        MNT_ASYNC
115
#define        ST_NOCOREDUMP        MNT_NOCOREDUMP
116
#define        ST_RELATIME        MNT_RELATIME
117
#define        ST_IGNORE        MNT_IGNORE
118
#define        ST_NOATIME        MNT_NOATIME
119
#define        ST_SYMPERM        MNT_SYMPERM
120
#define        ST_NODEVMTIME        MNT_NODEVMTIME
121
#define        ST_SOFTDEP        MNT_SOFTDEP
122
#define        ST_LOG                MNT_LOG
123
#define        ST_EXTATTR        MNT_EXTATTR
124
125
#define        ST_EXRDONLY        MNT_EXRDONLY
126
#define        ST_EXPORTED        MNT_EXPORTED
127
#define        ST_DEFEXPORTED        MNT_DEFEXPORTED
128
#define        ST_EXPORTANON        MNT_EXPORTANON
129
#define        ST_EXKERB        MNT_EXKERB
130
#define        ST_EXNORESPORT        MNT_EXNORESPORT
131
#define        ST_EXPUBLIC        MNT_EXPUBLIC
132
133
#define        ST_LOCAL        MNT_LOCAL
134
#define        ST_QUOTA        MNT_QUOTA
135
#define        ST_ROOTFS        MNT_ROOTFS
136
137
138
#define        ST_WAIT                MNT_WAIT
139
#define        ST_NOWAIT        MNT_NOWAIT
140
141
#if defined(__minix)
142
#define        ST_NOTRUNC      __MNT_UNUSED1
143
#endif /* defined(__minix) */
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
    const char *, 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
#include <sys/kmem.h>
179
#define        STATVFSBUF_GET()        kmem_alloc(sizeof(struct statvfs), KM_SLEEP)
180
#define        STATVFSBUF_PUT(sb)        kmem_free(sb, sizeof(struct statvfs))
181
#endif /* defined(_KERNEL) */
182
183
#endif /* !_SYS_STATVFS_H_ */