xref: /netbsd/sys/sys/mount.h (revision c4a72b64)
1 /*	$NetBSD: mount.h,v 1.98 2002/09/21 18:06:08 christos 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. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *	This product includes software developed by the University of
18  *	California, Berkeley and its contributors.
19  * 4. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  *	@(#)mount.h	8.21 (Berkeley) 5/20/95
36  */
37 
38 #ifndef _SYS_MOUNT_H_
39 #define _SYS_MOUNT_H_
40 
41 #ifndef _KERNEL
42 #include <sys/ucred.h>
43 #if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
44 #include <sys/stat.h>
45 #endif /* !_POSIX_C_SOURCE */
46 #endif
47 #include <sys/queue.h>
48 #include <sys/lock.h>
49 
50 typedef struct { int32_t val[2]; } fsid_t;	/* file system id type */
51 
52 /*
53  * File identifier.
54  * These are unique per filesystem on a single machine.
55  */
56 #define	MAXFIDSZ	16
57 
58 struct fid {
59 	u_short		fid_len;		/* length of data in bytes */
60 	u_short		fid_reserved;		/* force longword alignment */
61 	char		fid_data[MAXFIDSZ];	/* data (variable length) */
62 };
63 
64 /*
65  * file system statistics
66  */
67 
68 #define	MFSNAMELEN	16	/* length of fs type name, including nul */
69 #define	MNAMELEN	90	/* length of buffer for returned name */
70 
71 struct statfs {
72 	short	f_type;			/* type of file system */
73 	u_short	f_oflags;		/* deprecated copy of mount flags */
74 	long	f_bsize;		/* fundamental file system block size */
75 	long	f_iosize;		/* optimal transfer block size */
76 	long	f_blocks;		/* total data blocks in file system */
77 	long	f_bfree;		/* free blocks in fs */
78 	long	f_bavail;		/* free blocks avail to non-superuser */
79 	long	f_files;		/* total file nodes in file system */
80 	long	f_ffree;		/* free file nodes in fs */
81 	fsid_t	f_fsid;			/* file system id */
82 	uid_t	f_owner;		/* user that mounted the file system */
83 	long	f_flags;		/* copy of mount flags */
84 	long	f_syncwrites;		/* count of sync writes since mount */
85 	long	f_asyncwrites;		/* count of async writes since mount */
86 	long	f_spare[1];		/* spare for later */
87 	char	f_fstypename[MFSNAMELEN]; /* fs type name */
88 	char	f_mntonname[MNAMELEN];	  /* directory on which mounted */
89 	char	f_mntfromname[MNAMELEN];  /* mounted file system */
90 };
91 
92 /*
93  * File system types.
94  */
95 #define	MOUNT_FFS	"ffs"		/* UNIX "Fast" Filesystem */
96 #define	MOUNT_UFS	MOUNT_FFS	/* for compatibility */
97 #define	MOUNT_NFS	"nfs"		/* Network Filesystem */
98 #define	MOUNT_MFS	"mfs"		/* Memory Filesystem */
99 #define	MOUNT_MSDOS	"msdos"		/* MSDOS Filesystem */
100 #define	MOUNT_LFS	"lfs"		/* Log-based Filesystem */
101 #define	MOUNT_FDESC	"fdesc"		/* File Descriptor Filesystem */
102 #define	MOUNT_PORTAL	"portal"	/* Portal Filesystem */
103 #define	MOUNT_NULL	"null"		/* Minimal Filesystem Layer */
104 #define	MOUNT_OVERLAY	"overlay"	/* Minimal Overlay Filesystem Layer */
105 #define	MOUNT_UMAP	"umap"	/* User/Group Identifier Remapping Filesystem */
106 #define	MOUNT_KERNFS	"kernfs"	/* Kernel Information Filesystem */
107 #define	MOUNT_PROCFS	"procfs"	/* /proc Filesystem */
108 #define	MOUNT_AFS	"afs"		/* Andrew Filesystem */
109 #define	MOUNT_CD9660	"cd9660"	/* ISO9660 (aka CDROM) Filesystem */
110 #define	MOUNT_UNION	"union"		/* Union (translucent) Filesystem */
111 #define	MOUNT_ADOSFS	"adosfs"	/* AmigaDOS Filesystem */
112 #define	MOUNT_EXT2FS	"ext2fs"	/* Second Extended Filesystem */
113 #define	MOUNT_CFS	"coda"		/* Coda Filesystem */
114 #define	MOUNT_CODA	"coda"		/* Coda Filesystem */
115 #define	MOUNT_FILECORE	"filecore"	/* Acorn Filecore Filesystem */
116 #define	MOUNT_NTFS	"ntfs"		/* Windows/NT Filesystem */
117 #define	MOUNT_SMBFS	"smbfs"		/* CIFS (SMB) */
118 
119 /*
120  * Structure per mounted file system.  Each mounted file system has an
121  * array of operations and an instance record.  The file systems are
122  * put on a doubly linked list.
123  */
124 LIST_HEAD(vnodelst, vnode);
125 
126 struct mount {
127 	CIRCLEQ_ENTRY(mount) mnt_list;		/* mount list */
128 	struct vfsops	*mnt_op;		/* operations on fs */
129 	struct vnode	*mnt_vnodecovered;	/* vnode we mounted on */
130 	struct vnode	*mnt_syncer;		/* syncer vnode */
131 	struct vnodelst	mnt_vnodelist;		/* list of vnodes this mount */
132 	struct lock	mnt_lock;		/* mount structure lock */
133 	int		mnt_flag;		/* flags */
134 	int		mnt_maxsymlinklen;	/* max size of short symlink */
135 	int		mnt_fs_bshift;		/* offset shift for lblkno */
136 	int		mnt_dev_bshift;		/* shift for device sectors */
137 	struct statfs	mnt_stat;		/* cache of filesystem stats */
138 	void		*mnt_data;		/* private data */
139 	int		mnt_wcnt;		/* count of vfs_busy waiters */
140 	struct proc	*mnt_unmounter;		/* who is unmounting */
141 };
142 
143 /*
144  * Mount flags.  XXX BEWARE: these are not in numerical order!
145  *
146  * Unmount uses MNT_FORCE flag.
147  *
148  * Note that all mount flags are listed here.  if you need to add one, take
149  * one of the __MNT_UNUSED flags.
150  */
151 
152 #define __MNT_UNUSED2	0x00400000
153 #define __MNT_UNUSED3	0x00800000
154 
155 #define	MNT_RDONLY	0x00000001	/* read only filesystem */
156 #define	MNT_SYNCHRONOUS	0x00000002	/* file system written synchronously */
157 #define	MNT_NOEXEC	0x00000004	/* can't exec from filesystem */
158 #define	MNT_NOSUID	0x00000008	/* don't honor setuid bits on fs */
159 #define	MNT_NODEV	0x00000010	/* don't interpret special files */
160 #define	MNT_UNION	0x00000020	/* union with underlying filesystem */
161 #define	MNT_ASYNC	0x00000040	/* file system written asynchronously */
162 #define	MNT_NOCOREDUMP	0x00008000	/* don't write core dumps to this FS */
163 #define MNT_IGNORE	0x00100000	/* don't show entry in df */
164 #define MNT_NOATIME	0x04000000	/* Never update access times in fs */
165 #define MNT_SYMPERM	0x20000000	/* recognize symlink permission */
166 #define MNT_NODEVMTIME	0x40000000	/* Never update mod times for devs */
167 #define MNT_SOFTDEP	0x80000000	/* Use soft dependencies */
168 
169 #define __MNT_BASIC_FLAGS \
170 	{ MNT_RDONLY,		0,	"read-only" }, \
171 	{ MNT_SYNCHRONOUS,	0,	"synchronous" }, \
172 	{ MNT_NOEXEC,		0,	"noexec" }, \
173 	{ MNT_NOSUID,		0,	"nosuid" }, \
174 	{ MNT_NODEV,		0,	"nodev" }, \
175 	{ MNT_UNION,		0,	"union" }, \
176 	{ MNT_ASYNC,		0,	"asynchronous" }, \
177 	{ MNT_NOCOREDUMP,	0,	"nocoredump" }, \
178 	{ MNT_IGNORE,		0,	"hidden" }, \
179 	{ MNT_NOATIME,		0,	"noatime" }, \
180 	{ MNT_SYMPERM,		0,	"symperm" }, \
181 	{ MNT_NODEVMTIME,	0,	"nodevmtime" }, \
182 	{ MNT_SOFTDEP,		0,	"soft dependencies" },
183 
184 /*
185  * exported mount flags.
186  */
187 #define	MNT_EXRDONLY	0x00000080	/* exported read only */
188 #define	MNT_EXPORTED	0x00000100	/* file system is exported */
189 #define	MNT_DEFEXPORTED	0x00000200	/* exported to the world */
190 #define	MNT_EXPORTANON	0x00000400	/* use anon uid mapping for everyone */
191 #define	MNT_EXKERB	0x00000800	/* exported with Kerberos uid mapping */
192 #define MNT_EXNORESPORT	0x08000000	/* don't enforce reserved ports (NFS) */
193 #define MNT_EXPUBLIC	0x10000000	/* public export (WebNFS) */
194 
195 #define __MNT_EXPORTED_FLAGS \
196 	{ MNT_EXRDONLY,		1,	"exported read-only" }, \
197 	{ MNT_EXPORTED,		0,	"NFS exported" }, \
198 	{ MNT_DEFEXPORTED,	1,	"exported to the world" }, \
199 	{ MNT_EXPORTANON,	1,	"anon uid mapping" }, \
200 	{ MNT_EXKERB,		1,	"kerberos uid mapping" }, \
201 	{ MNT_EXNORESPORT,	0,	"non-reserved ports" }, \
202 	{ MNT_EXPUBLIC,		0,	"WebNFS exports" },
203 /*
204  * Flags set by internal operations.
205  */
206 #define	MNT_LOCAL	0x00001000	/* filesystem is stored locally */
207 #define	MNT_QUOTA	0x00002000	/* quotas are enabled on filesystem */
208 #define	MNT_ROOTFS	0x00004000	/* identifies the root filesystem */
209 
210 
211 #define __MNT_INTERNAL_FLAGS \
212 	{ MNT_LOCAL,		0,	"local" }, \
213 	{ MNT_QUOTA,		0,	"with quotas" }, \
214 	{ MNT_ROOTFS,		1,	"root file system" },
215 /*
216  * Mask of flags that are visible to statfs()
217  */
218 #define	MNT_VISFLAGMASK	0xfc10ffff
219 
220 /*
221  * External filesystem control flags.
222  *
223  * MNT_MLOCK lock the mount entry so that name lookup cannot proceed
224  * past the mount point.  This keeps the subtree stable during mounts
225  * and unmounts.
226  */
227 #define	MNT_UPDATE	0x00010000	/* not a real mount, just an update */
228 #define	MNT_DELEXPORT	0x00020000	/* delete export host lists */
229 #define	MNT_RELOAD	0x00040000	/* reload filesystem data */
230 #define	MNT_FORCE	0x00080000	/* force unmount or readonly change */
231 #define	MNT_GETARGS	0x00400000	/* retrieve file system specific args */
232 
233 #define __MNT_EXTERNAL_FLAGS \
234 	{ MNT_UPDATE,		1,	"being updated" }, \
235 	{ MNT_DELEXPORT,	1,	"delete export list" }, \
236 	{ MNT_RELOAD,		1,	"reload filesystem data" }, \
237 	{ MNT_FORCE,		1,	"force unmount or readonly change" },
238 /*
239  * Internal filesystem control flags.
240  *
241  * MNT_UNMOUNT locks the mount entry so that name lookup cannot proceed
242  * past the mount point.  This keeps the subtree stable during mounts
243  * and unmounts.
244  */
245 #define	MNT_GONE	0x00200000	/* filesystem is gone.. */
246 #define MNT_UNMOUNT	0x01000000	/* unmount in progress */
247 #define MNT_WANTRDWR	0x02000000	/* upgrade to read/write requested */
248 
249 #define __MNT_CONTROL_FLAGS \
250 	{ MNT_GONE,		0,	"gone" }, \
251 	{ MNT_UNMOUNT,		0,	"unmount in progress" }, \
252 	{ MNT_WANTRDWR,		0,	"upgrade to read/write requested" },
253 
254 #define __MNT_FLAGS \
255 	__MNT_BASIC_FLAGS \
256 	__MNT_EXPORTED_FLAGS \
257 	__MNT_INTERNAL_FLAGS \
258 	__MNT_EXTERNAL_FLAGS \
259 	__MNT_CONTROL_FLAGS
260 /*
261  * Sysctl CTL_VFS definitions.
262  *
263  * Second level identifier specifies which filesystem. Second level
264  * identifier VFS_GENERIC returns information about all filesystems.
265  *
266  * Note the slightly non-flat nature of these sysctl numbers.  Oh for
267  * a better sysctl interface.
268  */
269 #define VFS_GENERIC	0		/* generic filesystem information */
270 #define VFS_MAXTYPENUM	1		/* int: highest defined fs type */
271 #define VFS_CONF	2		/* struct: vfsconf for filesystem given
272 					   as next argument */
273 #define VFS_USERMOUNT	3		/* enable/disable fs mnt by non-root */
274 #define	VFSGEN_MAXID	4		/* number of valid vfs.generic ids */
275 
276 /*
277  * USE THE SAME NAMES AS MOUNT_*!
278  *
279  * Only need to add new entry here if the filesystem actually supports
280  * sysctl(2).
281  */
282 #define	CTL_VFS_NAMES { \
283 	{ "generic", CTLTYPE_NODE }, \
284 	{ MOUNT_FFS, CTLTYPE_NODE }, \
285 	{ MOUNT_NFS, CTLTYPE_NODE }, \
286 	{ MOUNT_MFS, CTLTYPE_NODE }, \
287 	{ MOUNT_MSDOS, CTLTYPE_NODE }, \
288 	{ MOUNT_LFS, CTLTYPE_NODE }, \
289 	{ 0, 0 }, 			/* MOUNT_LOFS */ \
290 	{ MOUNT_FDESC, CTLTYPE_NODE }, \
291 	{ MOUNT_PORTAL, CTLTYPE_NODE }, \
292 	{ MOUNT_NULL, CTLTYPE_NODE }, \
293 	{ MOUNT_UMAP, CTLTYPE_NODE }, \
294 	{ MOUNT_KERNFS, CTLTYPE_NODE }, \
295 	{ MOUNT_PROCFS, CTLTYPE_NODE }, \
296 	{ MOUNT_AFS, CTLTYPE_NODE }, \
297 	{ MOUNT_CD9660, CTLTYPE_NODE }, \
298 	{ MOUNT_UNION, CTLTYPE_NODE }, \
299 	{ MOUNT_ADOSFS, CTLTYPE_NODE }, \
300 	{ MOUNT_EXT2FS, CTLTYPE_NODE }, \
301 	{ MOUNT_CODA, CTLTYPE_NODE }, \
302 	{ MOUNT_FILECORE, CTLTYPE_NODE }, \
303 	{ MOUNT_NTFS, CTLTYPE_NODE }, \
304 }
305 
306 #define	VFS_MAXID	20		/* number of valid vfs ids */
307 
308 #define	CTL_VFSGENCTL_NAMES { \
309 	{ 0, 0 }, \
310 	{ "maxtypenum", CTLTYPE_INT }, \
311 	{ "conf", CTLTYPE_NODE }, 	/* Special */ \
312 	{ "usermount", CTLTYPE_INT }, \
313 }
314 
315 /*
316  * Operations supported on mounted file system.
317  */
318 #ifdef _KERNEL
319 
320 #if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_44)
321 
322 /*
323  * Filesystem configuration information. Not used by NetBSD, but
324  * defined here to provide a compatible sysctl interface to Lite2.
325  */
326 struct vfsconf {
327 	struct	vfsops *vfc_vfsops;	/* filesystem operations vector */
328 	char	vfc_name[MFSNAMELEN]; 	/* filesystem type name */
329 	int	vfc_typenum;		/* historic filesystem type number */
330 	int  	vfc_refcount;		/* number mounted of this type */
331 	int	vfc_flags;		/* permanent flags */
332 	int	(*vfc_mountroot)(void);	/* if != NULL, routine to mount root */
333 	struct	vfsconf *vfc_next; 	/* next in list */
334 };
335 
336 #endif
337 
338 #if __STDC__
339 struct nameidata;
340 struct mbuf;
341 struct vnodeopv_desc;
342 #endif
343 
344 struct vfsops {
345 	const char *vfs_name;
346 	int	(*vfs_mount)	__P((struct mount *mp, const char *path,
347 				    void *data, struct nameidata *ndp,
348 				    struct proc *p));
349 	int	(*vfs_start)	__P((struct mount *mp, int flags,
350 				    struct proc *p));
351 	int	(*vfs_unmount)	__P((struct mount *mp, int mntflags,
352 				    struct proc *p));
353 	int	(*vfs_root)	__P((struct mount *mp, struct vnode **vpp));
354 	int	(*vfs_quotactl)	__P((struct mount *mp, int cmds, uid_t uid,
355 				    caddr_t arg, struct proc *p));
356 	int	(*vfs_statfs)	__P((struct mount *mp, struct statfs *sbp,
357 				    struct proc *p));
358 	int	(*vfs_sync)	__P((struct mount *mp, int waitfor,
359 				    struct ucred *cred, struct proc *p));
360 	int	(*vfs_vget)	__P((struct mount *mp, ino_t ino,
361 				    struct vnode **vpp));
362 	int	(*vfs_fhtovp)	__P((struct mount *mp, struct fid *fhp,
363 				    struct vnode **vpp));
364 	int	(*vfs_vptofh)	__P((struct vnode *vp, struct fid *fhp));
365 	void	(*vfs_init)	__P((void));
366 	void	(*vfs_reinit)	__P((void));
367 	void	(*vfs_done)	__P((void));
368 	int	(*vfs_sysctl)	__P((int *, u_int, void *, size_t *, void *,
369 				    size_t, struct proc *));
370 	int	(*vfs_mountroot) __P((void));
371 	int	(*vfs_checkexp) __P((struct mount *mp, struct mbuf *nam,
372 				    int *extflagsp, struct ucred **credanonp));
373 	const struct vnodeopv_desc * const *vfs_opv_descs;
374 	int	vfs_refcount;
375 	LIST_ENTRY(vfsops) vfs_list;
376 };
377 
378 #define VFS_MOUNT(MP, PATH, DATA, NDP, P) \
379 	(*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, NDP, P)
380 #define VFS_START(MP, FLAGS, P)	  (*(MP)->mnt_op->vfs_start)(MP, FLAGS, P)
381 #define VFS_UNMOUNT(MP, FORCE, P) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE, P)
382 #define VFS_ROOT(MP, VPP)	  (*(MP)->mnt_op->vfs_root)(MP, VPP)
383 #define VFS_QUOTACTL(MP,C,U,A,P)  (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, P)
384 #define VFS_STATFS(MP, SBP, P)	  (*(MP)->mnt_op->vfs_statfs)(MP, SBP, P)
385 #define VFS_SYNC(MP, WAIT, C, P)  (*(MP)->mnt_op->vfs_sync)(MP, WAIT, C, P)
386 #define VFS_VGET(MP, INO, VPP)	  (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP)
387 #define VFS_FHTOVP(MP, FIDP, VPP) (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP)
388 #define VFS_CHECKEXP(MP, NAM, EXFLG, CRED) \
389 	(*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED)
390 #define	VFS_VPTOFH(VP, FIDP)	  (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP)
391 #endif /* _KERNEL */
392 
393 /*
394  * Flags for various system call interfaces.
395  *
396  * waitfor flags to vfs_sync() and getfsstat()
397  */
398 #define MNT_WAIT	1	/* synchronously wait for I/O to complete */
399 #define MNT_NOWAIT	2	/* start all I/O, but do not wait for it */
400 #define MNT_LAZY 	3	/* push data not written by filesystem syncer */
401 
402 /*
403  * Generic file handle
404  */
405 struct fhandle {
406 	fsid_t	fh_fsid;	/* File system id of mount point */
407 	struct	fid fh_fid;	/* File sys specific id */
408 };
409 typedef struct fhandle	fhandle_t;
410 
411 #ifdef _KERNEL
412 #include <net/radix.h>
413 #include <sys/socket.h>		/* XXX for AF_MAX */
414 
415 /*
416  * Network address lookup element
417  */
418 struct netcred {
419 	struct	radix_node netc_rnodes[2];
420 	int	netc_exflags;
421 	struct	ucred netc_anon;
422 };
423 
424 /*
425  * Network export information
426  */
427 struct netexport {
428 	struct	netcred ne_defexported;		      /* Default export */
429 	struct	radix_node_head *ne_rtable[AF_MAX+1]; /* Individual exports */
430 };
431 #endif /* _KERNEL */
432 
433 /*
434  * Export arguments for local filesystem mount calls.
435  */
436 struct export_args {
437 	int	ex_flags;		/* export related flags */
438 	uid_t	ex_root;		/* mapping for root uid */
439 	struct	uucred ex_anon;		/* mapping for anonymous user */
440 	struct	sockaddr *ex_addr;	/* net address to which exported */
441 	int	ex_addrlen;		/* and the net address length */
442 	struct	sockaddr *ex_mask;	/* mask of valid bits in saddr */
443 	int	ex_masklen;		/* and the smask length */
444 	char	*ex_indexfile;		/* index file for WebNFS URLs */
445 };
446 
447 /*
448  * Structure holding information for a publicly exported filesystem
449  * (WebNFS). Currently the specs allow just for one such filesystem.
450  */
451 struct nfs_public {
452 	int		np_valid;	/* Do we hold valid information */
453 	fhandle_t	np_handle;	/* Filehandle for pub fs (internal) */
454 	struct mount	*np_mount;	/* Mountpoint of exported fs */
455 	char		*np_index;	/* Index file */
456 };
457 
458 #ifdef _KERNEL
459 /*
460  * exported vnode operations
461  */
462 struct	mount *vfs_getvfs __P((fsid_t *));    /* return vfs given fsid */
463 int	vfs_export			    /* process mount export info */
464 	  __P((struct mount *, struct netexport *, struct export_args *));
465 #define	vfs_showexport(a, b, c)	(void)memset((b), 0, sizeof(*(b)))
466 struct	netcred *vfs_export_lookup	    /* lookup host in fs export list */
467 	  __P((struct mount *, struct netexport *, struct mbuf *));
468 int	vfs_setpublicfs			    /* set publicly exported fs */
469 	  __P((struct mount *, struct netexport *, struct export_args *));
470 int	vfs_lock __P((struct mount *));	    /* lock a vfs */
471 int	vfs_mountedon __P((struct vnode *));/* is a vfs mounted on vp */
472 int	vfs_mountroot __P((void));
473 void	vfs_shutdown __P((void));	    /* unmount and sync file systems */
474 void	vfs_unlock __P((struct mount *));   /* unlock a vfs */
475 void	vfs_unmountall __P((struct proc *));	    /* unmount file systems */
476 int 	vfs_busy __P((struct mount *, int, struct simplelock *));
477 int	vfs_rootmountalloc __P((char *, char *, struct mount **));
478 void	vfs_unbusy __P((struct mount *));
479 int	vfs_attach __P((struct vfsops *));
480 int	vfs_detach __P((struct vfsops *));
481 void	vfs_reinit __P((void));
482 struct vfsops *vfs_getopsbyname __P((const char *));
483 int	vfs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
484 			struct proc *));
485 
486 extern	CIRCLEQ_HEAD(mntlist, mount) mountlist;	/* mounted filesystem list */
487 extern	struct vfsops *vfssw[];			/* filesystem type table */
488 extern	int nvfssw;
489 extern	struct nfs_public nfs_pub;
490 extern	struct simplelock mountlist_slock;
491 extern	struct simplelock spechash_slock;
492 long	makefstype __P((const char *));
493 int	dounmount __P((struct mount *, int, struct proc *));
494 void	vfsinit __P((void));
495 void	vfs_opv_init __P((const struct vnodeopv_desc * const *));
496 void	vfs_opv_free __P((const struct vnodeopv_desc * const *));
497 #ifdef DEBUG
498 void	vfs_bufstats __P((void));
499 #endif
500 
501 LIST_HEAD(vfs_list_head, vfsops);
502 extern struct vfs_list_head vfs_list;
503 
504 #else /* _KERNEL */
505 
506 #include <sys/cdefs.h>
507 
508 __BEGIN_DECLS
509 int	fstatfs __P((int, struct statfs *));
510 int	getfh __P((const char *, fhandle_t *));
511 int	getfsstat __P((struct statfs *, long, int));
512 int	getmntinfo __P((struct statfs **, int));
513 int	mount __P((const char *, const char *, int, void *));
514 int	statfs __P((const char *, struct statfs *));
515 int	unmount __P((const char *, int));
516 #if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
517 int	fhopen __P((const fhandle_t *, int));
518 int	fhstat __P((const fhandle_t *, struct stat *));
519 int	fhstatfs __P((const fhandle_t *, struct statfs *));
520 #endif /* !_POSIX_C_SOURCE */
521 __END_DECLS
522 
523 #endif /* _KERNEL */
524 
525 #endif /* !_SYS_MOUNT_H_ */
526