root / lab4 / .minix-src / include / sys / mount.h @ 14
History | View | Annotate | Download (20.7 KB)
1 | 13 | up20180614 | /* $NetBSD: mount.h,v 1.217 2015/05/06 15:57:08 hannken Exp $ */
|
---|---|---|---|
2 | |||
3 | /*
|
||
4 | * Copyright (c) 1989, 1991, 1993
|
||
5 | * The Regents of the University of California. All rights reserved.
|
||
6 | *
|
||
7 | * Redistribution and use in source and binary forms, with or without
|
||
8 | * modification, are permitted provided that the following conditions
|
||
9 | * are met:
|
||
10 | * 1. Redistributions of source code must retain the above copyright
|
||
11 | * notice, this list of conditions and the following disclaimer.
|
||
12 | * 2. Redistributions in binary form must reproduce the above copyright
|
||
13 | * notice, this list of conditions and the following disclaimer in the
|
||
14 | * documentation and/or other materials provided with the distribution.
|
||
15 | * 3. Neither the name of the University nor the names of its contributors
|
||
16 | * may be used to endorse or promote products derived from this software
|
||
17 | * without specific prior written permission.
|
||
18 | *
|
||
19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||
29 | * SUCH DAMAGE.
|
||
30 | *
|
||
31 | * @(#)mount.h 8.21 (Berkeley) 5/20/95
|
||
32 | */
|
||
33 | |||
34 | #ifndef _SYS_MOUNT_H_
|
||
35 | #define _SYS_MOUNT_H_
|
||
36 | |||
37 | #ifndef _KERNEL
|
||
38 | #include <sys/featuretest.h> |
||
39 | #if defined(_NETBSD_SOURCE)
|
||
40 | #include <sys/stat.h> |
||
41 | #endif /* _NETBSD_SOURCE */ |
||
42 | #endif
|
||
43 | |||
44 | #ifndef _STANDALONE
|
||
45 | #include <sys/param.h> /* precautionary upon removal from ucred.h */ |
||
46 | #include <sys/time.h> |
||
47 | #include <sys/uio.h> |
||
48 | #include <sys/ucred.h> |
||
49 | #include <sys/fstypes.h> |
||
50 | #include <sys/queue.h> |
||
51 | #include <sys/rwlock.h> |
||
52 | #include <sys/statvfs.h> |
||
53 | #include <sys/specificdata.h> |
||
54 | #include <sys/condvar.h> |
||
55 | #endif /* !_STANDALONE */ |
||
56 | |||
57 | /*
|
||
58 | * file system statistics
|
||
59 | */
|
||
60 | |||
61 | #define MNAMELEN 90 /* length of buffer for returned name */ |
||
62 | |||
63 | /*
|
||
64 | * File system types.
|
||
65 | */
|
||
66 | #define MOUNT_FFS "ffs" /* UNIX "Fast" Filesystem */ |
||
67 | #define MOUNT_UFS MOUNT_FFS /* for compatibility */ |
||
68 | #define MOUNT_NFS "nfs" /* Network Filesystem */ |
||
69 | #define MOUNT_MFS "mfs" /* Memory Filesystem */ |
||
70 | #define MOUNT_MSDOS "msdos" /* MSDOS Filesystem */ |
||
71 | #define MOUNT_LFS "lfs" /* Log-based Filesystem */ |
||
72 | #define MOUNT_FDESC "fdesc" /* File Descriptor Filesystem */ |
||
73 | #define MOUNT_NULL "null" /* Minimal Filesystem Layer */ |
||
74 | #define MOUNT_OVERLAY "overlay" /* Minimal Overlay Filesystem Layer */ |
||
75 | #define MOUNT_UMAP "umap" /* User/Group Identifier Remapping Filesystem */ |
||
76 | #define MOUNT_KERNFS "kernfs" /* Kernel Information Filesystem */ |
||
77 | #define MOUNT_PROCFS "procfs" /* /proc Filesystem */ |
||
78 | #define MOUNT_AFS "afs" /* Andrew Filesystem */ |
||
79 | #define MOUNT_CD9660 "cd9660" /* ISO9660 (aka CDROM) Filesystem */ |
||
80 | #define MOUNT_UNION "union" /* Union (translucent) Filesystem */ |
||
81 | #define MOUNT_ADOSFS "adosfs" /* AmigaDOS Filesystem */ |
||
82 | #define MOUNT_EXT2FS "ext2fs" /* Second Extended Filesystem */ |
||
83 | #define MOUNT_CFS "coda" /* Coda Filesystem */ |
||
84 | #define MOUNT_CODA MOUNT_CFS /* Coda Filesystem */ |
||
85 | #define MOUNT_FILECORE "filecore" /* Acorn Filecore Filesystem */ |
||
86 | #define MOUNT_NTFS "ntfs" /* Windows/NT Filesystem */ |
||
87 | #define MOUNT_SMBFS "smbfs" /* CIFS (SMB) */ |
||
88 | #define MOUNT_PTYFS "ptyfs" /* Pseudo tty filesystem */ |
||
89 | #define MOUNT_TMPFS "tmpfs" /* Efficient memory file-system */ |
||
90 | #define MOUNT_UDF "udf" /* UDF CD/DVD filesystem */ |
||
91 | #define MOUNT_SYSVBFS "sysvbfs" /* System V Boot Filesystem */ |
||
92 | #define MOUNT_PUFFS "puffs" /* Pass-to-Userspace filesystem */ |
||
93 | #define MOUNT_HFS "hfs" /* Apple HFS+ Filesystem */ |
||
94 | #define MOUNT_EFS "efs" /* SGI's Extent Filesystem */ |
||
95 | #define MOUNT_ZFS "zfs" /* Sun ZFS */ |
||
96 | #define MOUNT_NILFS "nilfs" /* NTT's NiLFS(2) logging file system */ |
||
97 | #define MOUNT_RUMPFS "rumpfs" /* rump virtual file system */ |
||
98 | #define MOUNT_V7FS "v7fs" /* 7th Edition of Unix Filesystem */ |
||
99 | |||
100 | #ifndef _STANDALONE
|
||
101 | |||
102 | struct vnode;
|
||
103 | struct vattr;
|
||
104 | |||
105 | /*
|
||
106 | * Structure per mounted file system. Each mounted file system has an
|
||
107 | * array of operations and an instance record. The file systems are
|
||
108 | * put on a doubly linked list.
|
||
109 | */
|
||
110 | struct mount {
|
||
111 | TAILQ_ENTRY(mount) mnt_list; /* mount list */
|
||
112 | TAILQ_HEAD(, vnode) mnt_vnodelist; /* list of vnodes this mount */
|
||
113 | struct vfsops *mnt_op; /* operations on fs */ |
||
114 | struct vnode *mnt_vnodecovered; /* vnode we mounted on */ |
||
115 | int mnt_synclist_slot; /* synclist slot index */ |
||
116 | void *mnt_transinfo; /* for FS-internal use */ |
||
117 | void *mnt_data; /* private data */ |
||
118 | kmutex_t mnt_unmounting; /* to prevent new activity */
|
||
119 | kmutex_t mnt_renamelock; /* per-fs rename lock */
|
||
120 | int mnt_refcnt; /* ref count on this structure */ |
||
121 | unsigned int mnt_busynest; /* vfs_busy nestings */ |
||
122 | int mnt_flag; /* flags */ |
||
123 | int mnt_iflag; /* internal flags */ |
||
124 | int mnt_fs_bshift; /* offset shift for lblkno */ |
||
125 | int mnt_dev_bshift; /* shift for device sectors */ |
||
126 | struct statvfs mnt_stat; /* cache of filesystem stats */ |
||
127 | specificdata_reference |
||
128 | mnt_specdataref; /* subsystem specific data */
|
||
129 | kmutex_t mnt_updating; /* to serialize updates */
|
||
130 | struct wapbl_ops
|
||
131 | *mnt_wapbl_op; /* logging ops */
|
||
132 | struct wapbl *mnt_wapbl; /* log info */ |
||
133 | struct wapbl_replay
|
||
134 | *mnt_wapbl_replay; /* replay support XXX: what? */
|
||
135 | uint64_t mnt_gen; |
||
136 | }; |
||
137 | |||
138 | /*
|
||
139 | * Sysctl CTL_VFS definitions.
|
||
140 | *
|
||
141 | * Second level identifier specifies which filesystem. Second level
|
||
142 | * identifier VFS_GENERIC returns information about all filesystems.
|
||
143 | *
|
||
144 | * Note the slightly non-flat nature of these sysctl numbers. Oh for
|
||
145 | * a better sysctl interface.
|
||
146 | */
|
||
147 | #define VFS_GENERIC 0 /* generic filesystem information */ |
||
148 | #define VFS_MAXTYPENUM 1 /* int: highest defined fs type */ |
||
149 | #define VFS_CONF 2 /* struct: vfsconf for filesystem given |
||
150 | as next argument */
|
||
151 | #define VFS_USERMOUNT 3 /* enable/disable fs mnt by non-root */ |
||
152 | #define VFS_MAGICLINKS 4 /* expand 'magic' symlinks */ |
||
153 | #define VFSGEN_MAXID 5 /* number of valid vfs.generic ids */ |
||
154 | |||
155 | /*
|
||
156 | * USE THE SAME NAMES AS MOUNT_*!
|
||
157 | *
|
||
158 | * Only need to add new entry here if the filesystem actually supports
|
||
159 | * sysctl(2).
|
||
160 | */
|
||
161 | #define CTL_VFS_NAMES { \
|
||
162 | { "generic", CTLTYPE_NODE }, \
|
||
163 | { MOUNT_FFS, CTLTYPE_NODE }, \ |
||
164 | { MOUNT_NFS, CTLTYPE_NODE }, \ |
||
165 | { MOUNT_MFS, CTLTYPE_NODE }, \ |
||
166 | { MOUNT_MSDOS, CTLTYPE_NODE }, \ |
||
167 | { MOUNT_LFS, CTLTYPE_NODE }, \ |
||
168 | { 0, 0 }, /* MOUNT_LOFS */ \ |
||
169 | { MOUNT_FDESC, CTLTYPE_NODE }, \ |
||
170 | { MOUNT_NULL, CTLTYPE_NODE }, \ |
||
171 | { MOUNT_UMAP, CTLTYPE_NODE }, \ |
||
172 | { MOUNT_KERNFS, CTLTYPE_NODE }, \ |
||
173 | { MOUNT_PROCFS, CTLTYPE_NODE }, \ |
||
174 | { MOUNT_AFS, CTLTYPE_NODE }, \ |
||
175 | { MOUNT_CD9660, CTLTYPE_NODE }, \ |
||
176 | { MOUNT_UNION, CTLTYPE_NODE }, \ |
||
177 | { MOUNT_ADOSFS, CTLTYPE_NODE }, \ |
||
178 | { MOUNT_EXT2FS, CTLTYPE_NODE }, \ |
||
179 | { MOUNT_CODA, CTLTYPE_NODE }, \ |
||
180 | { MOUNT_FILECORE, CTLTYPE_NODE }, \ |
||
181 | { MOUNT_NTFS, CTLTYPE_NODE }, \ |
||
182 | } |
||
183 | |||
184 | #define VFS_MAXID 20 /* number of valid vfs ids */ |
||
185 | |||
186 | #define CTL_VFSGENCTL_NAMES { \
|
||
187 | { 0, 0 }, \ |
||
188 | { "maxtypenum", CTLTYPE_INT }, \
|
||
189 | { "conf", CTLTYPE_NODE }, /* Special */ \ |
||
190 | { "usermount", CTLTYPE_INT }, \
|
||
191 | { "magiclinks", CTLTYPE_INT }, \
|
||
192 | } |
||
193 | |||
194 | #if defined(_KERNEL)
|
||
195 | |||
196 | struct quotactl_args; /* in sys/quotactl.h */ |
||
197 | struct quotastat; /* in sys/quotactl.h */ |
||
198 | struct quotaidtypestat; /* in sys/quotactl.h */ |
||
199 | struct quotaobjtypestat; /* in sys/quotactl.h */ |
||
200 | struct quotakcursor; /* in sys/quotactl.h */ |
||
201 | struct quotakey; /* in sys/quota.h */ |
||
202 | struct quotaval; /* in sys/quota.h */ |
||
203 | |||
204 | #if __STDC__
|
||
205 | struct nameidata;
|
||
206 | #endif
|
||
207 | |||
208 | /*
|
||
209 | * Operations supported on mounted file system.
|
||
210 | */
|
||
211 | |||
212 | struct vfsops {
|
||
213 | const char *vfs_name; |
||
214 | size_t vfs_min_mount_data; |
||
215 | int (*vfs_mount) (struct mount *, const char *, void *, |
||
216 | size_t *); |
||
217 | int (*vfs_start) (struct mount *, int); |
||
218 | int (*vfs_unmount) (struct mount *, int); |
||
219 | int (*vfs_root) (struct mount *, struct vnode **); |
||
220 | int (*vfs_quotactl) (struct mount *, struct quotactl_args *); |
||
221 | int (*vfs_statvfs) (struct mount *, struct statvfs *); |
||
222 | int (*vfs_sync) (struct mount *, int, struct kauth_cred *); |
||
223 | int (*vfs_vget) (struct mount *, ino_t, struct vnode **); |
||
224 | int (*vfs_loadvnode) (struct mount *, struct vnode *, |
||
225 | const void *, size_t, const void **); |
||
226 | int (*vfs_newvnode) (struct mount *, struct vnode *, struct vnode *, |
||
227 | struct vattr *, kauth_cred_t,
|
||
228 | size_t *, const void **); |
||
229 | int (*vfs_fhtovp) (struct mount *, struct fid *, |
||
230 | struct vnode **);
|
||
231 | int (*vfs_vptofh) (struct vnode *, struct fid *, size_t *); |
||
232 | void (*vfs_init) (void); |
||
233 | void (*vfs_reinit) (void); |
||
234 | void (*vfs_done) (void); |
||
235 | int (*vfs_mountroot)(void); |
||
236 | int (*vfs_snapshot) (struct mount *, struct vnode *, |
||
237 | struct timespec *);
|
||
238 | int (*vfs_extattrctl) (struct mount *, int, |
||
239 | struct vnode *, int, const char *); |
||
240 | int (*vfs_suspendctl) (struct mount *, int); |
||
241 | int (*vfs_renamelock_enter)(struct mount *); |
||
242 | void (*vfs_renamelock_exit)(struct mount *); |
||
243 | int (*vfs_fsync) (struct vnode *, int); |
||
244 | const struct vnodeopv_desc * const *vfs_opv_descs; |
||
245 | int vfs_refcount;
|
||
246 | LIST_ENTRY(vfsops) vfs_list; |
||
247 | }; |
||
248 | |||
249 | /* XXX vget is actually file system internal. */
|
||
250 | #define VFS_VGET(MP, INO, VPP) (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP)
|
||
251 | #define VFS_LOADVNODE(MP, VP, KEY, KEY_LEN, NEW_KEY) \
|
||
252 | (*(MP)->mnt_op->vfs_loadvnode)(MP, VP, KEY, KEY_LEN, NEW_KEY) |
||
253 | #define VFS_NEWVNODE(MP, DVP, VP, VAP, CRED, NEW_LEN, NEW_KEY) \
|
||
254 | (*(MP)->mnt_op->vfs_newvnode)(MP, DVP, VP, VAP, CRED, NEW_LEN, NEW_KEY) |
||
255 | |||
256 | #define VFS_RENAMELOCK_ENTER(MP) (*(MP)->mnt_op->vfs_renamelock_enter)(MP)
|
||
257 | #define VFS_RENAMELOCK_EXIT(MP) (*(MP)->mnt_op->vfs_renamelock_exit)(MP)
|
||
258 | #define VFS_FSYNC(MP, VP, FLG) (*(MP)->mnt_op->vfs_fsync)(VP, FLG)
|
||
259 | |||
260 | int VFS_MOUNT(struct mount *, const char *, void *, size_t *); |
||
261 | int VFS_START(struct mount *, int); |
||
262 | int VFS_UNMOUNT(struct mount *, int); |
||
263 | int VFS_ROOT(struct mount *, struct vnode **); |
||
264 | int VFS_QUOTACTL(struct mount *, struct quotactl_args *); |
||
265 | int VFS_STATVFS(struct mount *, struct statvfs *); |
||
266 | int VFS_SYNC(struct mount *, int, struct kauth_cred *); |
||
267 | int VFS_FHTOVP(struct mount *, struct fid *, struct vnode **); |
||
268 | int VFS_VPTOFH(struct vnode *, struct fid *, size_t *); |
||
269 | int VFS_SNAPSHOT(struct mount *, struct vnode *, struct timespec *); |
||
270 | int VFS_EXTATTRCTL(struct mount *, int, struct vnode *, int, const char *); |
||
271 | int VFS_SUSPENDCTL(struct mount *, int); |
||
272 | |||
273 | #endif /* _KERNEL */ |
||
274 | |||
275 | #ifdef _KERNEL
|
||
276 | #if __STDC__
|
||
277 | struct mbuf;
|
||
278 | struct vnodeopv_desc;
|
||
279 | struct kauth_cred;
|
||
280 | #endif
|
||
281 | |||
282 | #define VFS_MAX_MOUNT_DATA 8192 |
||
283 | |||
284 | #define VFS_PROTOS(fsname) \
|
||
285 | int fsname##_mount(struct mount *, const char *, void *, \ |
||
286 | size_t *); \ |
||
287 | int fsname##_start(struct mount *, int); \ |
||
288 | int fsname##_unmount(struct mount *, int); \ |
||
289 | int fsname##_root(struct mount *, struct vnode **); \ |
||
290 | int fsname##_quotactl(struct mount *, struct quotactl_args *); \ |
||
291 | int fsname##_statvfs(struct mount *, struct statvfs *); \ |
||
292 | int fsname##_sync(struct mount *, int, struct kauth_cred *); \ |
||
293 | int fsname##_vget(struct mount *, ino_t, struct vnode **); \ |
||
294 | int fsname##_loadvnode(struct mount *, struct vnode *, \ |
||
295 | const void *, size_t, const void **); \ |
||
296 | int fsname##_newvnode(struct mount *, struct vnode *, \ |
||
297 | struct vnode *, struct vattr *, kauth_cred_t, \ |
||
298 | size_t *, const void **); \ |
||
299 | int fsname##_fhtovp(struct mount *, struct fid *, struct vnode **); \ |
||
300 | int fsname##_vptofh(struct vnode *, struct fid *, size_t *); \ |
||
301 | void fsname##_init(void); \ |
||
302 | void fsname##_reinit(void); \ |
||
303 | void fsname##_done(void); \ |
||
304 | int fsname##_mountroot(void); \ |
||
305 | int fsname##_snapshot(struct mount *, struct vnode *, \ |
||
306 | struct timespec *); \
|
||
307 | int fsname##_extattrctl(struct mount *, int, struct vnode *, int, \ |
||
308 | const char *); \ |
||
309 | int fsname##_suspendctl(struct mount *, int) |
||
310 | |||
311 | /*
|
||
312 | * This operations vector is so wapbl can be wrapped into a filesystem lkm.
|
||
313 | * XXX Eventually, we want to move this functionality
|
||
314 | * down into the filesystems themselves so that this isn't needed.
|
||
315 | */
|
||
316 | struct wapbl_ops {
|
||
317 | void (*wo_wapbl_discard)(struct wapbl *); |
||
318 | int (*wo_wapbl_replay_isopen)(struct wapbl_replay *); |
||
319 | int (*wo_wapbl_replay_can_read)(struct wapbl_replay *, daddr_t, long); |
||
320 | int (*wo_wapbl_replay_read)(struct wapbl_replay *, void *, daddr_t, long); |
||
321 | void (*wo_wapbl_add_buf)(struct wapbl *, struct buf *); |
||
322 | void (*wo_wapbl_remove_buf)(struct wapbl *, struct buf *); |
||
323 | void (*wo_wapbl_resize_buf)(struct wapbl *, struct buf *, long, long); |
||
324 | int (*wo_wapbl_begin)(struct wapbl *, const char *, int); |
||
325 | void (*wo_wapbl_end)(struct wapbl *); |
||
326 | void (*wo_wapbl_junlock_assert)(struct wapbl *); |
||
327 | void (*wo_wapbl_biodone)(struct buf *); |
||
328 | }; |
||
329 | #define WAPBL_DISCARD(MP) \
|
||
330 | (*(MP)->mnt_wapbl_op->wo_wapbl_discard)((MP)->mnt_wapbl) |
||
331 | #define WAPBL_REPLAY_ISOPEN(MP) \
|
||
332 | (*(MP)->mnt_wapbl_op->wo_wapbl_replay_isopen)((MP)->mnt_wapbl_replay) |
||
333 | #define WAPBL_REPLAY_CAN_READ(MP, BLK, LEN) \
|
||
334 | (*(MP)->mnt_wapbl_op->wo_wapbl_replay_can_read)((MP)->mnt_wapbl_replay, \ |
||
335 | (BLK), (LEN)) |
||
336 | #define WAPBL_REPLAY_READ(MP, DATA, BLK, LEN) \
|
||
337 | (*(MP)->mnt_wapbl_op->wo_wapbl_replay_read)((MP)->mnt_wapbl_replay, \ |
||
338 | (DATA), (BLK), (LEN)) |
||
339 | #define WAPBL_ADD_BUF(MP, BP) \
|
||
340 | (*(MP)->mnt_wapbl_op->wo_wapbl_add_buf)((MP)->mnt_wapbl, (BP)) |
||
341 | #define WAPBL_REMOVE_BUF(MP, BP) \
|
||
342 | (*(MP)->mnt_wapbl_op->wo_wapbl_remove_buf)((MP)->mnt_wapbl, (BP)) |
||
343 | #define WAPBL_RESIZE_BUF(MP, BP, OLDSZ, OLDCNT) \
|
||
344 | (*(MP)->mnt_wapbl_op->wo_wapbl_resize_buf)((MP)->mnt_wapbl, (BP), \ |
||
345 | (OLDSZ), (OLDCNT)) |
||
346 | #define WAPBL_BEGIN(MP) \
|
||
347 | (*(MP)->mnt_wapbl_op->wo_wapbl_begin)((MP)->mnt_wapbl, \ |
||
348 | __FILE__, __LINE__) |
||
349 | #define WAPBL_END(MP) \
|
||
350 | (*(MP)->mnt_wapbl_op->wo_wapbl_end)((MP)->mnt_wapbl) |
||
351 | #define WAPBL_JUNLOCK_ASSERT(MP) \
|
||
352 | (*(MP)->mnt_wapbl_op->wo_wapbl_junlock_assert)((MP)->mnt_wapbl) |
||
353 | |||
354 | struct vfs_hooks {
|
||
355 | LIST_ENTRY(vfs_hooks) vfs_hooks_list; |
||
356 | void (*vh_unmount)(struct mount *); |
||
357 | int (*vh_reexport)(struct mount *, const char *, void *); |
||
358 | void (*vh_future_expansion_1)(void); |
||
359 | void (*vh_future_expansion_2)(void); |
||
360 | void (*vh_future_expansion_3)(void); |
||
361 | void (*vh_future_expansion_4)(void); |
||
362 | void (*vh_future_expansion_5)(void); |
||
363 | }; |
||
364 | |||
365 | void vfs_hooks_init(void); |
||
366 | int vfs_hooks_attach(struct vfs_hooks *); |
||
367 | int vfs_hooks_detach(struct vfs_hooks *); |
||
368 | void vfs_hooks_unmount(struct mount *); |
||
369 | int vfs_hooks_reexport(struct mount *, const char *, void *); |
||
370 | |||
371 | #endif /* _KERNEL */ |
||
372 | |||
373 | /*
|
||
374 | * Export arguments for local filesystem mount calls.
|
||
375 | *
|
||
376 | * This structure is deprecated and is only provided for compatibility
|
||
377 | * reasons with old binary utilities; several file systems expose an
|
||
378 | * instance of this structure in their mount arguments structure, thus
|
||
379 | * needing a padding in place of the old values. This definition cannot
|
||
380 | * change in the future due to this reason.
|
||
381 | * XXX: This should be moved to the compat subtree but cannot be done
|
||
382 | * until we can move the mount args structures themselves.
|
||
383 | *
|
||
384 | * The current export_args structure can be found in nfs/nfs.h.
|
||
385 | */
|
||
386 | struct export_args30 {
|
||
387 | int ex_flags; /* export related flags */ |
||
388 | uid_t ex_root; /* mapping for root uid */
|
||
389 | struct uucred ex_anon; /* mapping for anonymous user */ |
||
390 | struct sockaddr *ex_addr; /* net address to which exported */ |
||
391 | int ex_addrlen; /* and the net address length */ |
||
392 | struct sockaddr *ex_mask; /* mask of valid bits in saddr */ |
||
393 | int ex_masklen; /* and the smask length */ |
||
394 | char *ex_indexfile; /* index file for WebNFS URLs */ |
||
395 | }; |
||
396 | |||
397 | struct mnt_export_args30 {
|
||
398 | const char *fspec; /* Always NULL */ |
||
399 | struct export_args30 eargs;
|
||
400 | }; |
||
401 | |||
402 | #ifdef _KERNEL
|
||
403 | |||
404 | /*
|
||
405 | * exported VFS interface (see vfssubr(9))
|
||
406 | */
|
||
407 | struct mount *vfs_getvfs(fsid_t *); /* return vfs given fsid */ |
||
408 | int vfs_composefh(struct vnode *, fhandle_t *, size_t *); |
||
409 | int vfs_composefh_alloc(struct vnode *, fhandle_t **); |
||
410 | void vfs_composefh_free(fhandle_t *);
|
||
411 | int vfs_fhtovp(fhandle_t *, struct vnode **); |
||
412 | int vfs_mountedon(struct vnode *);/* is a vfs mounted on vp */ |
||
413 | int vfs_mountroot(void); |
||
414 | void vfs_shutdown(void); /* unmount and sync file systems */ |
||
415 | void vfs_sync_all(struct lwp *); |
||
416 | bool vfs_unmountall(struct lwp *); /* unmount file systems */ |
||
417 | bool vfs_unmountall1(struct lwp *, bool, bool); |
||
418 | bool vfs_unmount_forceone(struct lwp *); |
||
419 | int vfs_busy(struct mount *, struct mount **); |
||
420 | int vfs_rootmountalloc(const char *, const char *, struct mount **); |
||
421 | void vfs_unbusy(struct mount *, bool, struct mount **); |
||
422 | int vfs_attach(struct vfsops *); |
||
423 | int vfs_detach(struct vfsops *); |
||
424 | void vfs_reinit(void); |
||
425 | struct vfsops *vfs_getopsbyname(const char *); |
||
426 | void vfs_delref(struct vfsops *); |
||
427 | void vfs_destroy(struct mount *); |
||
428 | struct mount *vfs_mountalloc(struct vfsops *, struct vnode *); |
||
429 | int vfs_stdextattrctl(struct mount *, int, struct vnode *, |
||
430 | int, const char *); |
||
431 | void vfs_insmntque(struct vnode *, struct mount *); |
||
432 | int vfs_quotactl_stat(struct mount *, struct quotastat *); |
||
433 | int vfs_quotactl_idtypestat(struct mount *, int, struct quotaidtypestat *); |
||
434 | int vfs_quotactl_objtypestat(struct mount *,int,struct quotaobjtypestat *); |
||
435 | int vfs_quotactl_get(struct mount *, const struct quotakey *, |
||
436 | struct quotaval *);
|
||
437 | int vfs_quotactl_put(struct mount *, const struct quotakey *, |
||
438 | const struct quotaval *); |
||
439 | int vfs_quotactl_del(struct mount *, const struct quotakey *); |
||
440 | int vfs_quotactl_cursoropen(struct mount *, struct quotakcursor *); |
||
441 | int vfs_quotactl_cursorclose(struct mount *, struct quotakcursor *); |
||
442 | int vfs_quotactl_cursorskipidtype(struct mount *, struct quotakcursor *, |
||
443 | int);
|
||
444 | int vfs_quotactl_cursorget(struct mount *, struct quotakcursor *, |
||
445 | struct quotakey *, struct quotaval *, unsigned, unsigned *); |
||
446 | int vfs_quotactl_cursoratend(struct mount *, struct quotakcursor *, int *); |
||
447 | int vfs_quotactl_cursorrewind(struct mount *, struct quotakcursor *); |
||
448 | int vfs_quotactl_quotaon(struct mount *, int, const char *); |
||
449 | int vfs_quotactl_quotaoff(struct mount *, int); |
||
450 | |||
451 | struct vnode_iterator; /* Opaque. */ |
||
452 | void vfs_vnode_iterator_init(struct mount *, struct vnode_iterator **); |
||
453 | void vfs_vnode_iterator_destroy(struct vnode_iterator *); |
||
454 | struct vnode *vfs_vnode_iterator_next(struct vnode_iterator *, |
||
455 | bool (*)(void *, struct vnode *), void *); |
||
456 | |||
457 | /* Syncer */
|
||
458 | extern int syncer_maxdelay; |
||
459 | extern kmutex_t syncer_mutex;
|
||
460 | extern time_t syncdelay;
|
||
461 | extern time_t filedelay;
|
||
462 | extern time_t dirdelay;
|
||
463 | extern time_t metadelay;
|
||
464 | void vfs_syncer_add_to_worklist(struct mount *); |
||
465 | void vfs_syncer_remove_from_worklist(struct mount *); |
||
466 | |||
467 | extern TAILQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */ |
||
468 | extern struct vfsops *vfssw[]; /* filesystem type table */ |
||
469 | extern int nvfssw; |
||
470 | extern kmutex_t mountlist_lock;
|
||
471 | extern kmutex_t vfs_list_lock;
|
||
472 | |||
473 | void vfs_mount_sysinit(void); |
||
474 | long makefstype(const char *); |
||
475 | int mount_domount(struct lwp *, struct vnode **, struct vfsops *, |
||
476 | const char *, int, void *, size_t *); |
||
477 | int dounmount(struct mount *, int, struct lwp *); |
||
478 | int do_sys_mount(struct lwp *, struct vfsops *, const char *, const char *, |
||
479 | int, void *, enum uio_seg, size_t, register_t *); |
||
480 | void vfsinit(void); |
||
481 | void vfs_opv_init(const struct vnodeopv_desc * const *); |
||
482 | void vfs_opv_free(const struct vnodeopv_desc * const *); |
||
483 | #ifdef DEBUG
|
||
484 | void vfs_bufstats(void); |
||
485 | #endif
|
||
486 | |||
487 | int mount_specific_key_create(specificdata_key_t *, specificdata_dtor_t);
|
||
488 | void mount_specific_key_delete(specificdata_key_t);
|
||
489 | void mount_initspecific(struct mount *); |
||
490 | void mount_finispecific(struct mount *); |
||
491 | void * mount_getspecific(struct mount *, specificdata_key_t); |
||
492 | void mount_setspecific(struct mount *, specificdata_key_t, void *); |
||
493 | |||
494 | int usermount_common_policy(struct mount *, u_long); |
||
495 | void mountlist_append(struct mount *); |
||
496 | |||
497 | LIST_HEAD(vfs_list_head, vfsops); |
||
498 | extern struct vfs_list_head vfs_list; |
||
499 | |||
500 | #else /* _KERNEL */ |
||
501 | |||
502 | #include <sys/cdefs.h> |
||
503 | |||
504 | __BEGIN_DECLS |
||
505 | #if !defined(__LIBC12_SOURCE__) && !defined(_STANDALONE)
|
||
506 | int getfh(const char *, void *, size_t *) |
||
507 | __RENAME(__getfh30); |
||
508 | #endif
|
||
509 | |||
510 | #if !defined(__minix)
|
||
511 | int unmount(const char *, int); |
||
512 | #else
|
||
513 | int minix_umount(const char *_name, int srvflags); |
||
514 | #endif /* !defined(__minix) */ |
||
515 | |||
516 | #if defined(_NETBSD_SOURCE)
|
||
517 | #ifndef __LIBC12_SOURCE__
|
||
518 | #if !defined(__minix)
|
||
519 | int mount(const char *, const char *, int, void *, size_t) __RENAME(__mount50); |
||
520 | #else
|
||
521 | int minix_mount(char *_spec, char *_name, int _mountflags, int srvflags, char *type, |
||
522 | char *args);
|
||
523 | #endif /* !defined(__minix) */ |
||
524 | int fhopen(const void *, size_t, int) __RENAME(__fhopen40); |
||
525 | int fhstat(const void *, size_t, struct stat *) __RENAME(__fhstat50); |
||
526 | #endif
|
||
527 | #endif /* _NETBSD_SOURCE */ |
||
528 | __END_DECLS |
||
529 | |||
530 | #endif /* _KERNEL */ |
||
531 | #endif /* !_STANDALONE */ |
||
532 | |||
533 | #if defined(__minix) && !defined(_STANDALONE)
|
||
534 | /* Service flags. These are not passed to VFS. */
|
||
535 | #define MS_REUSE 0x001 /* Tell RS to try reusing binary from memory */ |
||
536 | #define MS_EXISTING 0x002 /* Tell mount to use already running server */ |
||
537 | |||
538 | #define MNT_LABEL_LEN 16 /* Length of fs label including nul */ |
||
539 | |||
540 | /* Legacy definitions. */
|
||
541 | #define MNTNAMELEN 16 /* Length of fs type name including nul */ |
||
542 | #define MNTFLAGLEN 64 /* Length of flags string including nul */ |
||
543 | #endif /* defined(__minix) && !defined(_STANDALONE) */ |
||
544 | |||
545 | #endif /* !_SYS_MOUNT_H_ */ |