1/*	$NetBSD: mount.h,v 1.241 2023/04/22 14:30:54 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/ucred.h>
48#include <sys/fstypes.h>
49#include <sys/statvfs.h>
50#if defined(_KERNEL) || defined(__EXPOSE_MOUNT)
51#include <sys/uio.h>
52#include <sys/queue.h>
53#include <sys/rwlock.h>
54#include <sys/specificdata.h>
55#include <sys/condvar.h>
56#endif	/* defined(_KERNEL) || defined(__EXPOSE_MOUNT) */
57#endif	/* !_STANDALONE */
58
59/*
60 * file system statistics
61 */
62
63#define	MNAMELEN	90	/* length of buffer for returned name */
64
65/*
66 * File system types.
67 */
68#define	MOUNT_FFS	"ffs"		/* UNIX "Fast" Filesystem */
69#define	MOUNT_UFS	MOUNT_FFS	/* for compatibility */
70#define	MOUNT_NFS	"nfs"		/* Network Filesystem */
71#define	MOUNT_MFS	"mfs"		/* Memory Filesystem */
72#define	MOUNT_MSDOS	"msdos"		/* MSDOS Filesystem */
73#define	MOUNT_LFS	"lfs"		/* Log-based Filesystem */
74#define	MOUNT_FDESC	"fdesc"		/* File Descriptor Filesystem */
75#define	MOUNT_NULL	"null"		/* Minimal Filesystem Layer */
76#define	MOUNT_OVERLAY	"overlay"	/* Minimal Overlay Filesystem Layer */
77#define	MOUNT_UMAP	"umap"	/* User/Group Identifier Remapping Filesystem */
78#define	MOUNT_KERNFS	"kernfs"	/* Kernel Information Filesystem */
79#define	MOUNT_PROCFS	"procfs"	/* /proc Filesystem */
80#define	MOUNT_AFS	"afs"		/* Andrew Filesystem */
81#define	MOUNT_CD9660	"cd9660"	/* ISO9660 (aka CDROM) Filesystem */
82#define	MOUNT_UNION	"union"		/* Union (translucent) Filesystem */
83#define	MOUNT_ADOSFS	"adosfs"	/* AmigaDOS Filesystem */
84#define	MOUNT_EXT2FS	"ext2fs"	/* Second Extended Filesystem */
85#define	MOUNT_CFS	"coda"		/* Coda Filesystem */
86#define	MOUNT_CODA	MOUNT_CFS	/* Coda Filesystem */
87#define	MOUNT_FILECORE	"filecore"	/* Acorn Filecore Filesystem */
88#define	MOUNT_NTFS	"ntfs"		/* Windows/NT Filesystem */
89#define	MOUNT_SMBFS	"smbfs"		/* CIFS (SMB) */
90#define	MOUNT_PTYFS	"ptyfs"		/* Pseudo tty filesystem */
91#define	MOUNT_TMPFS	"tmpfs"		/* Efficient memory file-system */
92#define MOUNT_UDF	"udf"		/* UDF CD/DVD filesystem */
93#define	MOUNT_SYSVBFS	"sysvbfs"	/* System V Boot Filesystem */
94#define MOUNT_PUFFS	"puffs"		/* Pass-to-Userspace filesystem */
95#define MOUNT_HFS	"hfs"		/* Apple HFS+ Filesystem */
96#define MOUNT_EFS	"efs"		/* SGI's Extent Filesystem */
97#define MOUNT_ZFS	"zfs"		/* Sun ZFS */
98#define MOUNT_NILFS	"nilfs"		/* NTT's NiLFS(2) logging file system */
99#define MOUNT_RUMPFS	"rumpfs"	/* rump virtual file system */
100#define MOUNT_V7FS	"v7fs"		/* 7th Edition of Unix Filesystem */
101#define MOUNT_AUTOFS	"autofs"	/* Automounter Filesystem */
102
103/*
104 * Sysctl CTL_VFS definitions.
105 *
106 * Second level identifier specifies which filesystem. Second level
107 * identifier VFS_GENERIC returns information about all filesystems.
108 *
109 * Note the slightly non-flat nature of these sysctl numbers.  Oh for
110 * a better sysctl interface.
111 */
112#define VFS_GENERIC	0		/* generic filesystem information */
113#define VFS_MAXTYPENUM	1		/* int: highest defined fs type */
114#define VFS_CONF	2		/* struct: vfsconf for filesystem given
115					   as next argument */
116#define VFS_USERMOUNT	3		/* enable/disable fs mnt by non-root */
117#define	VFS_MAGICLINKS  4		/* expand 'magic' symlinks */
118#define	VFS_TIMESTAMP_PRECISION  5	/* file timestamp precision */
119
120/* vfsquery flags for kqueue(2) */
121#define VQ_MOUNT	0x0001	/* new filesystem arrived */
122#define VQ_UNMOUNT	0x0002	/* filesystem has left */
123
124#ifndef _STANDALONE
125
126#if defined(_KERNEL) || defined(__EXPOSE_MOUNT)
127
128struct vnode;
129struct vnode_impl;
130struct vattr;
131
132/*
133 * Structure per mounted file system.  Each mounted file system has an
134 * array of operations and an instance record.
135 */
136struct mount {
137	/*
138	 * Mostly stable data.
139	 */
140	kmutex_t	*mnt_vnodelock;		/* lock on mnt_vnodelist */
141	struct vfsops	*mnt_op;		/* operations on fs */
142	struct vnode	*mnt_vnodecovered;	/* vnode we mounted on */
143	struct mount	*mnt_lower;		/* fs mounted on */
144	void		*mnt_data;		/* private data */
145	kmutex_t	*mnt_renamelock;	/* per-fs rename lock */
146	int		mnt_flag;		/* flags */
147	int		mnt_iflag;		/* internal flags */
148	int		mnt_fs_bshift;		/* offset shift for lblkno */
149	int		mnt_dev_bshift;		/* shift for device sectors */
150	specificdata_reference
151			mnt_specdataref;	/* subsystem specific data */
152	kmutex_t	*mnt_updating;		/* to serialize updates */
153	const struct wapbl_ops
154			*mnt_wapbl_op;		/* logging ops */
155	struct wapbl	*mnt_wapbl;		/* log info */
156	struct wapbl_replay
157			*mnt_wapbl_replay;	/* replay support XXX: what? */
158	uint64_t	mnt_gen;
159
160	/*
161	 * Volatile data: pad to keep away from the stable items.
162	 */
163	int		mnt_refcnt		/* ref count on this structure */
164	    __aligned(COHERENCY_UNIT);
165	int		mnt_synclist_slot;	/* synclist slot index */
166	TAILQ_HEAD(, vnode_impl) mnt_vnodelist;	/* list of vnodes this mount */
167	struct statvfs	mnt_stat;		/* cache of filesystem stats */
168};
169
170#endif /* defined(_KERNEL) || defined(__EXPOSE_MOUNT) */
171
172#ifdef _KERNEL
173
174struct quotactl_args;		/* in sys/quotactl.h */
175struct quotastat;		/* in sys/quotactl.h */
176struct quotaidtypestat;		/* in sys/quotactl.h */
177struct quotaobjtypestat;	/* in sys/quotactl.h */
178struct quotakcursor;		/* in sys/quotactl.h */
179struct quotakey;		/* in sys/quota.h */
180struct quotaval;		/* in sys/quota.h */
181
182/*
183 * Operations supported on mounted file system.
184 */
185
186struct vfsops {
187	const char *vfs_name;
188	size_t	vfs_min_mount_data;
189	int	(*vfs_mount)	(struct mount *, const char *, void *,
190				    size_t *);
191	int	(*vfs_start)	(struct mount *, int);
192	int	(*vfs_unmount)	(struct mount *, int);
193	int	(*vfs_root)	(struct mount *, int, struct vnode **);
194	int	(*vfs_quotactl)	(struct mount *, struct quotactl_args *);
195	int	(*vfs_statvfs)	(struct mount *, struct statvfs *);
196	int	(*vfs_sync)	(struct mount *, int, struct kauth_cred *);
197	int	(*vfs_vget)	(struct mount *, ino_t, int, struct vnode **);
198	int	(*vfs_loadvnode) (struct mount *, struct vnode *,
199				    const void *, size_t, const void **);
200	int	(*vfs_newvnode) (struct mount *, struct vnode *, struct vnode *,
201				    struct vattr *, kauth_cred_t, void *,
202				    size_t *, const void **);
203	int	(*vfs_fhtovp)	(struct mount *, struct fid *, int,
204				    struct vnode **);
205	int	(*vfs_vptofh)	(struct vnode *, struct fid *, size_t *);
206	void	(*vfs_init)	(void);
207	void	(*vfs_reinit)	(void);
208	void	(*vfs_done)	(void);
209	int	(*vfs_mountroot)(void);
210	int	(*vfs_snapshot)	(struct mount *, struct vnode *,
211				    struct timespec *);
212	int	(*vfs_extattrctl) (struct mount *, int,
213				    struct vnode *, int, const char *);
214	int	(*vfs_suspendctl) (struct mount *, int);
215	int	(*vfs_renamelock_enter)(struct mount *);
216	void	(*vfs_renamelock_exit)(struct mount *);
217	int	(*vfs_fsync)	(struct vnode *, int);
218	const struct vnodeopv_desc * const *vfs_opv_descs;
219	int	vfs_refcount;
220	LIST_ENTRY(vfsops) vfs_list;
221};
222
223/* XXX vget is actually file system internal. */
224#define VFS_VGET(MP, INO, LK, VPP) (*(MP)->mnt_op->vfs_vget)(MP, INO, LK, VPP)
225#define VFS_LOADVNODE(MP, VP, KEY, KEY_LEN, NEW_KEY) \
226	(*(MP)->mnt_op->vfs_loadvnode)(MP, VP, KEY, KEY_LEN, NEW_KEY)
227#define VFS_NEWVNODE(MP, DVP, VP, VAP, CRED, EXTRA, NEW_LEN, NEW_KEY) \
228	(*(MP)->mnt_op->vfs_newvnode)(MP, DVP, VP, VAP, CRED, EXTRA, \
229	    NEW_LEN, NEW_KEY)
230
231#define VFS_RENAMELOCK_ENTER(MP)  (*(MP)->mnt_op->vfs_renamelock_enter)(MP)
232#define VFS_RENAMELOCK_EXIT(MP)   (*(MP)->mnt_op->vfs_renamelock_exit)(MP)
233#define VFS_FSYNC(MP, VP, FLG)	  (*(MP)->mnt_op->vfs_fsync)(VP, FLG)
234
235int	VFS_MOUNT(struct mount *, const char *, void *, size_t *);
236int	VFS_START(struct mount *, int);
237int	VFS_UNMOUNT(struct mount *, int);
238int	VFS_ROOT(struct mount *, int, struct vnode **);
239int	VFS_QUOTACTL(struct mount *, struct quotactl_args *);
240int	VFS_STATVFS(struct mount *, struct statvfs *);
241int	VFS_SYNC(struct mount *, int, struct kauth_cred *);
242int	VFS_FHTOVP(struct mount *, struct fid *, int, struct vnode **);
243int	VFS_VPTOFH(struct vnode *, struct fid *, size_t *);
244int	VFS_SNAPSHOT(struct mount *, struct vnode *, struct timespec *);
245int	VFS_EXTATTRCTL(struct mount *, int, struct vnode *, int, const char *);
246int	VFS_SUSPENDCTL(struct mount *, int);
247
248struct vnodeopv_desc;
249struct kauth_cred;
250
251#define	VFS_MAX_MOUNT_DATA	8192
252
253#define VFS_PROTOS(fsname)						\
254int	fsname##_mount(struct mount *, const char *, void *,		\
255		size_t *);						\
256int	fsname##_start(struct mount *, int);				\
257int	fsname##_unmount(struct mount *, int);				\
258int	fsname##_root(struct mount *, int, struct vnode **);		\
259int	fsname##_quotactl(struct mount *, struct quotactl_args *);	\
260int	fsname##_statvfs(struct mount *, struct statvfs *);		\
261int	fsname##_sync(struct mount *, int, struct kauth_cred *);	\
262int	fsname##_vget(struct mount *, ino_t, int, struct vnode **);	\
263int	fsname##_loadvnode(struct mount *, struct vnode *,		\
264		const void *, size_t, const void **);			\
265int	fsname##_newvnode(struct mount *, struct vnode *,		\
266		struct vnode *, struct vattr *, kauth_cred_t, void *,	\
267		size_t *, const void **);				\
268int	fsname##_fhtovp(struct mount *, struct fid *, int, struct vnode **);\
269int	fsname##_vptofh(struct vnode *, struct fid *, size_t *);	\
270void	fsname##_init(void);						\
271void	fsname##_reinit(void);						\
272void	fsname##_done(void);						\
273int	fsname##_mountroot(void);					\
274int	fsname##_snapshot(struct mount *, struct vnode *,		\
275		struct timespec *);					\
276int	fsname##_extattrctl(struct mount *, int, struct vnode *, int,	\
277		const char *);						\
278int	fsname##_suspendctl(struct mount *, int)
279
280/*
281 * This operations vector is so wapbl can be wrapped into a filesystem lkm.
282 * XXX Eventually, we want to move this functionality
283 * down into the filesystems themselves so that this isn't needed.
284 */
285struct wapbl_ops {
286	void (*wo_wapbl_discard)(struct wapbl *);
287	int (*wo_wapbl_replay_isopen)(struct wapbl_replay *);
288	int (*wo_wapbl_replay_can_read)(struct wapbl_replay *, daddr_t, long);
289	int (*wo_wapbl_replay_read)(struct wapbl_replay *, void *, daddr_t, long);
290	void (*wo_wapbl_add_buf)(struct wapbl *, struct buf *);
291	void (*wo_wapbl_remove_buf)(struct wapbl *, struct buf *);
292	void (*wo_wapbl_resize_buf)(struct wapbl *, struct buf *, long, long);
293	int (*wo_wapbl_begin)(struct wapbl *, const char *, int);
294	void (*wo_wapbl_end)(struct wapbl *);
295	void (*wo_wapbl_junlock_assert)(struct wapbl *);
296	void (*wo_wapbl_jlock_assert)(struct wapbl *);
297	void (*wo_wapbl_biodone)(struct buf *);
298};
299#define WAPBL_DISCARD(MP)						\
300    (*(MP)->mnt_wapbl_op->wo_wapbl_discard)((MP)->mnt_wapbl)
301#define WAPBL_REPLAY_ISOPEN(MP)						\
302    (*(MP)->mnt_wapbl_op->wo_wapbl_replay_isopen)((MP)->mnt_wapbl_replay)
303#define WAPBL_REPLAY_CAN_READ(MP, BLK, LEN)				\
304    (*(MP)->mnt_wapbl_op->wo_wapbl_replay_can_read)((MP)->mnt_wapbl_replay, \
305    (BLK), (LEN))
306#define WAPBL_REPLAY_READ(MP, DATA, BLK, LEN)				\
307    (*(MP)->mnt_wapbl_op->wo_wapbl_replay_read)((MP)->mnt_wapbl_replay,	\
308    (DATA), (BLK), (LEN))
309#define WAPBL_ADD_BUF(MP, BP)						\
310    (*(MP)->mnt_wapbl_op->wo_wapbl_add_buf)((MP)->mnt_wapbl, (BP))
311#define WAPBL_REMOVE_BUF(MP, BP)					\
312    (*(MP)->mnt_wapbl_op->wo_wapbl_remove_buf)((MP)->mnt_wapbl, (BP))
313#define WAPBL_RESIZE_BUF(MP, BP, OLDSZ, OLDCNT)				\
314    (*(MP)->mnt_wapbl_op->wo_wapbl_resize_buf)((MP)->mnt_wapbl, (BP),	\
315    (OLDSZ), (OLDCNT))
316#define WAPBL_BEGIN(MP)							\
317    (*(MP)->mnt_wapbl_op->wo_wapbl_begin)((MP)->mnt_wapbl,		\
318    __FILE__, __LINE__)
319#define WAPBL_END(MP)							\
320    (*(MP)->mnt_wapbl_op->wo_wapbl_end)((MP)->mnt_wapbl)
321#define WAPBL_JUNLOCK_ASSERT(MP)					\
322    (*(MP)->mnt_wapbl_op->wo_wapbl_junlock_assert)((MP)->mnt_wapbl)
323#define WAPBL_JLOCK_ASSERT(MP)						\
324    (*(MP)->mnt_wapbl_op->wo_wapbl_jlock_assert)((MP)->mnt_wapbl)
325
326struct vfs_hooks {
327	LIST_ENTRY(vfs_hooks) vfs_hooks_list;
328	void	(*vh_unmount)(struct mount *);
329	int	(*vh_reexport)(struct mount *, const char *, void *);
330	void	(*vh_future_expansion_1)(void);
331	void	(*vh_future_expansion_2)(void);
332	void	(*vh_future_expansion_3)(void);
333	void	(*vh_future_expansion_4)(void);
334	void	(*vh_future_expansion_5)(void);
335};
336
337void	vfs_hooks_init(void);
338int	vfs_hooks_attach(struct vfs_hooks *);
339int	vfs_hooks_detach(struct vfs_hooks *);
340void	vfs_hooks_unmount(struct mount *);
341int	vfs_hooks_reexport(struct mount *, const char *, void *);
342
343#endif /* _KERNEL */
344
345/*
346 * Export arguments for local filesystem mount calls.
347 *
348 * This structure is deprecated and is only provided for compatibility
349 * reasons with old binary utilities; several file systems expose an
350 * instance of this structure in their mount arguments structure, thus
351 * needing a padding in place of the old values.  This definition cannot
352 * change in the future due to this reason.
353 * XXX: This should be moved to the compat subtree but cannot be done
354 * until we can move the mount args structures themselves.
355 *
356 * The current export_args structure can be found in nfs/nfs.h.
357 */
358struct export_args30 {
359	int	ex_flags;		/* export related flags */
360	uid_t	ex_root;		/* mapping for root uid */
361	struct	uucred ex_anon;		/* mapping for anonymous user */
362	struct	sockaddr *ex_addr;	/* net address to which exported */
363	int	ex_addrlen;		/* and the net address length */
364	struct	sockaddr *ex_mask;	/* mask of valid bits in saddr */
365	int	ex_masklen;		/* and the smask length */
366	char	*ex_indexfile;		/* index file for WebNFS URLs */
367};
368
369struct mnt_export_args30 {
370	const char *fspec;		/* Always NULL */
371	struct export_args30 eargs;
372};
373
374#ifdef _KERNEL
375
376/*
377 * exported VFS interface (see vfssubr(9))
378 */
379struct	mount *vfs_getvfs(fsid_t *);    /* return vfs given fsid */
380int	vfs_composefh(struct vnode *, fhandle_t *, size_t *);
381int	vfs_composefh_alloc(struct vnode *, fhandle_t **);
382void	vfs_composefh_free(fhandle_t *);
383int	vfs_fhtovp(fhandle_t *, struct vnode **);
384int	vfs_mountedon(struct vnode *);/* is a vfs mounted on vp */
385int	vfs_mountroot(void);
386void	vfs_shutdown(void);	    /* unmount and sync file systems */
387void	vfs_sync_all(struct lwp *);
388bool	vfs_unmountall(struct lwp *);	    /* unmount file systems */
389bool	vfs_unmountall1(struct lwp *, bool, bool);
390bool	vfs_unmount_forceone(struct lwp *);
391int 	vfs_busy(struct mount *);
392int 	vfs_trybusy(struct mount *);
393int	vfs_rootmountalloc(const char *, const char *, struct mount **);
394void	vfs_unbusy(struct mount *);
395int	vfs_set_lowermount(struct mount *, struct mount *);
396int	vfs_attach(struct vfsops *);
397int	vfs_detach(struct vfsops *);
398void	vfs_reinit(void);
399struct vfsops *vfs_getopsbyname(const char *);
400void	vfs_delref(struct vfsops *);
401void	vfs_ref(struct mount *);
402void	vfs_rele(struct mount *);
403struct mount *vfs_mountalloc(struct vfsops *, struct vnode *);
404int	vfs_stdextattrctl(struct mount *, int, struct vnode *,
405	    int, const char *);
406void	vfs_insmntque(struct vnode *, struct mount *);
407int	vfs_quotactl_stat(struct mount *, struct quotastat *);
408int	vfs_quotactl_idtypestat(struct mount *, int, struct quotaidtypestat *);
409int	vfs_quotactl_objtypestat(struct mount *,int,struct quotaobjtypestat *);
410int	vfs_quotactl_get(struct mount *, const struct quotakey *,
411	    struct quotaval *);
412int	vfs_quotactl_put(struct mount *, const struct quotakey *,
413	    const struct quotaval *);
414int	vfs_quotactl_del(struct mount *, const struct quotakey *);
415int	vfs_quotactl_cursoropen(struct mount *, struct quotakcursor *);
416int	vfs_quotactl_cursorclose(struct mount *, struct quotakcursor *);
417int	vfs_quotactl_cursorskipidtype(struct mount *, struct quotakcursor *,
418            int);
419int	vfs_quotactl_cursorget(struct mount *, struct quotakcursor *,
420            struct quotakey *, struct quotaval *, unsigned, unsigned *);
421int	vfs_quotactl_cursoratend(struct mount *, struct quotakcursor *, int *);
422int	vfs_quotactl_cursorrewind(struct mount *, struct quotakcursor *);
423int	vfs_quotactl_quotaon(struct mount *, int, const char *);
424int	vfs_quotactl_quotaoff(struct mount *, int);
425
426struct vnode_iterator; /* Opaque. */
427void	vfs_vnode_iterator_init(struct mount *, struct vnode_iterator **);
428void	vfs_vnode_iterator_destroy(struct vnode_iterator *);
429struct vnode *vfs_vnode_iterator_next(struct vnode_iterator *,
430    bool (*)(void *, struct vnode *), void *);
431
432/* Syncer */
433extern int	syncer_maxdelay;
434extern time_t	syncdelay;
435extern time_t	filedelay;
436extern time_t	dirdelay;
437extern time_t	metadelay;
438void	vfs_syncer_add_to_worklist(struct mount *);
439void	vfs_syncer_remove_from_worklist(struct mount *);
440
441extern int vfs_magiclinks;
442extern int vfs_timestamp_precision;
443
444extern	struct vfsops *vfssw[];			/* filesystem type table */
445extern	int nvfssw;
446extern	kmutex_t vfs_list_lock;
447
448void	vfs_mount_sysinit(void);
449long	makefstype(const char *);
450int	mount_domount(struct lwp *, struct vnode **, struct vfsops *,
451	    const char *, int, void *, size_t *);
452int	dounmount(struct mount *, int, struct lwp *);
453int	do_sys_mount(struct lwp *, const char *, enum uio_seg, const char *,
454	    int, void *, enum uio_seg, size_t, register_t *);
455void	vfsinit(void);
456void	vfs_evfilt_fs_init(void);
457void	vfs_opv_init(const struct vnodeopv_desc * const *);
458void	vfs_opv_free(const struct vnodeopv_desc * const *);
459#ifdef DEBUG
460void	vfs_bufstats(void);
461#endif
462
463int	mount_specific_key_create(specificdata_key_t *, specificdata_dtor_t);
464void	mount_specific_key_delete(specificdata_key_t);
465void 	mount_initspecific(struct mount *);
466void 	mount_finispecific(struct mount *);
467void *	mount_getspecific(struct mount *, specificdata_key_t);
468void	mount_setspecific(struct mount *, specificdata_key_t, void *);
469
470int	usermount_common_policy(struct mount *, u_long);
471
472typedef struct mount_iterator mount_iterator_t; /* Opaque. */
473void	mountlist_iterator_init(mount_iterator_t **);
474void	mountlist_iterator_destroy(mount_iterator_t *);
475struct mount *mountlist_iterator_next(mount_iterator_t *);
476struct mount *mountlist_iterator_trynext(mount_iterator_t *);
477struct mount *_mountlist_next(struct mount *);
478void	mountlist_append(struct mount *);
479void	mountlist_remove(struct mount *);
480
481LIST_HEAD(vfs_list_head, vfsops);
482extern struct vfs_list_head vfs_list;
483
484#else /* _KERNEL */
485
486#include <sys/cdefs.h>
487
488__BEGIN_DECLS
489#if !defined(__LIBC12_SOURCE__) && !defined(_STANDALONE)
490int	getfh(const char *, void *, size_t *)
491	__RENAME(__getfh30);
492#endif
493
494int	unmount(const char *, int);
495#if defined(_NETBSD_SOURCE)
496#ifndef __LIBC12_SOURCE__
497int mount(const char *, const char *, int, void *, size_t) __RENAME(__mount50);
498int	fhopen(const void *, size_t, int) __RENAME(__fhopen40);
499int	fhstat(const void *, size_t, struct stat *) __RENAME(__fhstat50);
500#endif
501#endif /* _NETBSD_SOURCE */
502__END_DECLS
503
504#endif /* _KERNEL */
505#endif /* !_STANDALONE */
506
507#endif /* !_SYS_MOUNT_H_ */
508