Project

General

Profile

Statistics
| Branch: | Revision:

scoutos / prex-0.9.0 / include / sys / mount.h @ 03e9c04a

History | View | Annotate | Download (5.3 KB)

1 03e9c04a Brad Neuman
/*-
2
 * Copyright (c) 1989, 1991, 1993
3
 *        The Regents of the University of California.  All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 * 3. Neither the name of the University nor the names of its contributors
14
 *    may be used to endorse or promote products derived from this software
15
 *    without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
 * SUCH DAMAGE.
28
 *
29
 *        @(#)mount.h        8.21 (Berkeley) 5/20/95
30
 */
31
32
#ifndef _SYS_MOUNT_H_
33
#define _SYS_MOUNT_H_
34
35
#include <sys/cdefs.h>
36
#include <sys/list.h>
37
#include <sys/vnode.h>
38
#include <sys/syslimits.h>
39
40
typedef struct { int32_t val[2]; } fsid_t;        /* file system id type */
41
42
43
/*
44
 * file system statistics
45
 */
46
struct statfs {
47
        short        f_type;                        /* filesystem type number */
48
        short        f_flags;                /* copy of mount flags */
49
        long        f_bsize;                /* fundamental file system block size */
50
        long        f_blocks;                /* total data blocks in file system */
51
        long        f_bfree;                /* free blocks in fs */
52
        long        f_bavail;                /* free blocks avail to non-superuser */
53
        long        f_files;                /* total file nodes in file system */
54
        long        f_ffree;                /* free file nodes in fs */
55
        fsid_t        f_fsid;                        /* file system id */
56
        long        f_namelen;                /* maximum filename length */
57
};
58
59
/*
60
 * Mount data
61
 */
62
struct mount {
63
        struct list        m_link;                /* link to next mount point */
64
        struct vfsops        *m_op;                /* pointer to vfs operation */
65
        int                m_flags;        /* mount flag */
66
        int                m_count;        /* reference count */
67
        char                m_path[PATH_MAX]; /* mounted path */
68
        dev_t                m_dev;                /* mounted device */
69
        struct vnode        *m_root;        /* root vnode */
70
        struct vnode        *m_covered;        /* vnode covered on parent fs */
71
        void                *m_data;        /* private data for fs */
72
};
73
typedef struct mount *mount_t;
74
75
76
/*
77
 * Mount flags.
78
 *
79
 * Unmount uses MNT_FORCE flag.
80
 */
81
#define        MNT_RDONLY        0x00000001        /* read only filesystem */
82
#define        MNT_SYNCHRONOUS        0x00000002        /* file system written synchronously */
83
#define        MNT_NOEXEC        0x00000004        /* can't exec from filesystem */
84
#define        MNT_NOSUID        0x00000008        /* don't honor setuid bits on fs */
85
#define        MNT_NODEV        0x00000010        /* don't interpret special files */
86
#define        MNT_UNION        0x00000020        /* union with underlying filesystem */
87
#define        MNT_ASYNC        0x00000040        /* file system written asynchronously */
88
89
/*
90
 * exported mount flags.
91
 */
92
#define        MNT_EXRDONLY        0x00000080        /* exported read only */
93
#define        MNT_EXPORTED        0x00000100        /* file system is exported */
94
#define        MNT_DEFEXPORTED        0x00000200        /* exported to the world */
95
#define        MNT_EXPORTANON        0x00000400        /* use anon uid mapping for everyone */
96
#define        MNT_EXKERB        0x00000800        /* exported with Kerberos uid mapping */
97
98
/*
99
 * Flags set by internal operations.
100
 */
101
#define        MNT_LOCAL        0x00001000        /* filesystem is stored locally */
102
#define        MNT_QUOTA        0x00002000        /* quotas are enabled on filesystem */
103
#define        MNT_ROOTFS        0x00004000        /* identifies the root filesystem */
104
105
/*
106
 * Mask of flags that are visible to statfs()
107
 */
108
#define        MNT_VISFLAGMASK        0x0000ffff
109
110
/*
111
 * Filesystem type switch table.
112
 */
113
struct vfssw {
114
        char                *vs_name;        /* name of file system */
115
        int                (*vs_init)(void); /* initialize routine */
116
        struct vfsops        *vs_op;                /* pointer to vfs operation */
117
};
118
119
/*
120
 * Operations supported on virtual file system.
121
 */
122
struct vfsops {
123
        int (*vfs_mount)        (mount_t, char *, int, void *);
124
        int (*vfs_unmount)        (mount_t);
125
        int (*vfs_sync)                (mount_t);
126
        int (*vfs_vget)                (mount_t, vnode_t);
127
        int (*vfs_statfs)        (mount_t, struct statfs *);
128
        struct vnops        *vfs_vnops;
129
};
130
131
typedef int (*vfsop_mount_t)(mount_t, char *, int, void *);
132
typedef int (*vfsop_umount_t)(mount_t);
133
typedef int (*vfsop_sync_t)(mount_t);
134
typedef int (*vfsop_vget_t)(mount_t, vnode_t);
135
typedef int (*vfsop_statfs_t)(mount_t, struct statfs *);
136
137
/*
138
 * VFS interface
139
 */
140
#define VFS_MOUNT(MP, DEV, FL, DAT) ((MP)->m_op->vfs_mount)(MP, DEV, FL, DAT)
141
#define VFS_UNMOUNT(MP)             ((MP)->m_op->vfs_unmount)(MP)
142
#define VFS_SYNC(MP)                ((MP)->m_op->vfs_sync)(MP)
143
#define VFS_VGET(MP, VP)            ((MP)->m_op->vfs_vget)(MP, VP)
144
#define VFS_STATFS(MP, SFP)         ((MP)->m_op->vfs_statfs)(MP, SFP)
145
146
#define VFS_NULL                    ((void *)vfs_null)
147
148
__BEGIN_DECLS
149
int        mount(const char *, const char *, const char *, int, void *);
150
int        umount(const char *);
151
int        vfs_nullop(void);
152
int        vfs_einval(void);
153
__END_DECLS
154
155
#endif        /* !_SYS_MOUNT_H_ */