master
1/* $NetBSD: mount.h,v 1.240 2022/11/04 11:20:40 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_transinfo; /* for FS-internal use */
145 void *mnt_data; /* private data */
146 kmutex_t *mnt_renamelock; /* per-fs rename lock */
147 int mnt_flag; /* flags */
148 int mnt_iflag; /* internal flags */
149 int mnt_fs_bshift; /* offset shift for lblkno */
150 int mnt_dev_bshift; /* shift for device sectors */
151 specificdata_reference
152 mnt_specdataref; /* subsystem specific data */
153 kmutex_t *mnt_updating; /* to serialize updates */
154 const struct wapbl_ops
155 *mnt_wapbl_op; /* logging ops */
156 struct wapbl *mnt_wapbl; /* log info */
157 struct wapbl_replay
158 *mnt_wapbl_replay; /* replay support XXX: what? */
159 uint64_t mnt_gen;
160
161 /*
162 * Volatile data: pad to keep away from the stable items.
163 */
164 int mnt_refcnt /* ref count on this structure */
165 __aligned(COHERENCY_UNIT);
166 int mnt_synclist_slot; /* synclist slot index */
167 TAILQ_HEAD(, vnode_impl) mnt_vnodelist; /* list of vnodes this mount */
168 struct statvfs mnt_stat; /* cache of filesystem stats */
169};
170
171#endif /* defined(_KERNEL) || defined(__EXPOSE_MOUNT) */
172
173#ifdef _KERNEL
174
175struct quotactl_args; /* in sys/quotactl.h */
176struct quotastat; /* in sys/quotactl.h */
177struct quotaidtypestat; /* in sys/quotactl.h */
178struct quotaobjtypestat; /* in sys/quotactl.h */
179struct quotakcursor; /* in sys/quotactl.h */
180struct quotakey; /* in sys/quota.h */
181struct quotaval; /* in sys/quota.h */
182
183/*
184 * Operations supported on mounted file system.
185 */
186
187struct vfsops {
188 const char *vfs_name;
189 size_t vfs_min_mount_data;
190 int (*vfs_mount) (struct mount *, const char *, void *,
191 size_t *);
192 int (*vfs_start) (struct mount *, int);
193 int (*vfs_unmount) (struct mount *, int);
194 int (*vfs_root) (struct mount *, int, struct vnode **);
195 int (*vfs_quotactl) (struct mount *, struct quotactl_args *);
196 int (*vfs_statvfs) (struct mount *, struct statvfs *);
197 int (*vfs_sync) (struct mount *, int, struct kauth_cred *);
198 int (*vfs_vget) (struct mount *, ino_t, int, struct vnode **);
199 int (*vfs_loadvnode) (struct mount *, struct vnode *,
200 const void *, size_t, const void **);
201 int (*vfs_newvnode) (struct mount *, struct vnode *, struct vnode *,
202 struct vattr *, kauth_cred_t, void *,
203 size_t *, const void **);
204 int (*vfs_fhtovp) (struct mount *, struct fid *, int,
205 struct vnode **);
206 int (*vfs_vptofh) (struct vnode *, struct fid *, size_t *);
207 void (*vfs_init) (void);
208 void (*vfs_reinit) (void);
209 void (*vfs_done) (void);
210 int (*vfs_mountroot)(void);
211 int (*vfs_snapshot) (struct mount *, struct vnode *,
212 struct timespec *);
213 int (*vfs_extattrctl) (struct mount *, int,
214 struct vnode *, int, const char *);
215 int (*vfs_suspendctl) (struct mount *, int);
216 int (*vfs_renamelock_enter)(struct mount *);
217 void (*vfs_renamelock_exit)(struct mount *);
218 int (*vfs_fsync) (struct vnode *, int);
219 const struct vnodeopv_desc * const *vfs_opv_descs;
220 int vfs_refcount;
221 LIST_ENTRY(vfsops) vfs_list;
222};
223
224/* XXX vget is actually file system internal. */
225#define VFS_VGET(MP, INO, LK, VPP) (*(MP)->mnt_op->vfs_vget)(MP, INO, LK, VPP)
226#define VFS_LOADVNODE(MP, VP, KEY, KEY_LEN, NEW_KEY) \
227 (*(MP)->mnt_op->vfs_loadvnode)(MP, VP, KEY, KEY_LEN, NEW_KEY)
228#define VFS_NEWVNODE(MP, DVP, VP, VAP, CRED, EXTRA, NEW_LEN, NEW_KEY) \
229 (*(MP)->mnt_op->vfs_newvnode)(MP, DVP, VP, VAP, CRED, EXTRA, \
230 NEW_LEN, NEW_KEY)
231
232#define VFS_RENAMELOCK_ENTER(MP) (*(MP)->mnt_op->vfs_renamelock_enter)(MP)
233#define VFS_RENAMELOCK_EXIT(MP) (*(MP)->mnt_op->vfs_renamelock_exit)(MP)
234#define VFS_FSYNC(MP, VP, FLG) (*(MP)->mnt_op->vfs_fsync)(VP, FLG)
235
236int VFS_MOUNT(struct mount *, const char *, void *, size_t *);
237int VFS_START(struct mount *, int);
238int VFS_UNMOUNT(struct mount *, int);
239int VFS_ROOT(struct mount *, int, struct vnode **);
240int VFS_QUOTACTL(struct mount *, struct quotactl_args *);
241int VFS_STATVFS(struct mount *, struct statvfs *);
242int VFS_SYNC(struct mount *, int, struct kauth_cred *);
243int VFS_FHTOVP(struct mount *, struct fid *, int, struct vnode **);
244int VFS_VPTOFH(struct vnode *, struct fid *, size_t *);
245int VFS_SNAPSHOT(struct mount *, struct vnode *, struct timespec *);
246int VFS_EXTATTRCTL(struct mount *, int, struct vnode *, int, const char *);
247int VFS_SUSPENDCTL(struct mount *, int);
248
249struct vnodeopv_desc;
250struct kauth_cred;
251
252#define VFS_MAX_MOUNT_DATA 8192
253
254#define VFS_PROTOS(fsname) \
255int fsname##_mount(struct mount *, const char *, void *, \
256 size_t *); \
257int fsname##_start(struct mount *, int); \
258int fsname##_unmount(struct mount *, int); \
259int fsname##_root(struct mount *, int, struct vnode **); \
260int fsname##_quotactl(struct mount *, struct quotactl_args *); \
261int fsname##_statvfs(struct mount *, struct statvfs *); \
262int fsname##_sync(struct mount *, int, struct kauth_cred *); \
263int fsname##_vget(struct mount *, ino_t, int, struct vnode **); \
264int fsname##_loadvnode(struct mount *, struct vnode *, \
265 const void *, size_t, const void **); \
266int fsname##_newvnode(struct mount *, struct vnode *, \
267 struct vnode *, struct vattr *, kauth_cred_t, void *, \
268 size_t *, const void **); \
269int fsname##_fhtovp(struct mount *, struct fid *, int, struct vnode **);\
270int fsname##_vptofh(struct vnode *, struct fid *, size_t *); \
271void fsname##_init(void); \
272void fsname##_reinit(void); \
273void fsname##_done(void); \
274int fsname##_mountroot(void); \
275int fsname##_snapshot(struct mount *, struct vnode *, \
276 struct timespec *); \
277int fsname##_extattrctl(struct mount *, int, struct vnode *, int, \
278 const char *); \
279int fsname##_suspendctl(struct mount *, int)
280
281/*
282 * This operations vector is so wapbl can be wrapped into a filesystem lkm.
283 * XXX Eventually, we want to move this functionality
284 * down into the filesystems themselves so that this isn't needed.
285 */
286struct wapbl_ops {
287 void (*wo_wapbl_discard)(struct wapbl *);
288 int (*wo_wapbl_replay_isopen)(struct wapbl_replay *);
289 int (*wo_wapbl_replay_can_read)(struct wapbl_replay *, daddr_t, long);
290 int (*wo_wapbl_replay_read)(struct wapbl_replay *, void *, daddr_t, long);
291 void (*wo_wapbl_add_buf)(struct wapbl *, struct buf *);
292 void (*wo_wapbl_remove_buf)(struct wapbl *, struct buf *);
293 void (*wo_wapbl_resize_buf)(struct wapbl *, struct buf *, long, long);
294 int (*wo_wapbl_begin)(struct wapbl *, const char *, int);
295 void (*wo_wapbl_end)(struct wapbl *);
296 void (*wo_wapbl_junlock_assert)(struct wapbl *);
297 void (*wo_wapbl_jlock_assert)(struct wapbl *);
298 void (*wo_wapbl_biodone)(struct buf *);
299};
300#define WAPBL_DISCARD(MP) \
301 (*(MP)->mnt_wapbl_op->wo_wapbl_discard)((MP)->mnt_wapbl)
302#define WAPBL_REPLAY_ISOPEN(MP) \
303 (*(MP)->mnt_wapbl_op->wo_wapbl_replay_isopen)((MP)->mnt_wapbl_replay)
304#define WAPBL_REPLAY_CAN_READ(MP, BLK, LEN) \
305 (*(MP)->mnt_wapbl_op->wo_wapbl_replay_can_read)((MP)->mnt_wapbl_replay, \
306 (BLK), (LEN))
307#define WAPBL_REPLAY_READ(MP, DATA, BLK, LEN) \
308 (*(MP)->mnt_wapbl_op->wo_wapbl_replay_read)((MP)->mnt_wapbl_replay, \
309 (DATA), (BLK), (LEN))
310#define WAPBL_ADD_BUF(MP, BP) \
311 (*(MP)->mnt_wapbl_op->wo_wapbl_add_buf)((MP)->mnt_wapbl, (BP))
312#define WAPBL_REMOVE_BUF(MP, BP) \
313 (*(MP)->mnt_wapbl_op->wo_wapbl_remove_buf)((MP)->mnt_wapbl, (BP))
314#define WAPBL_RESIZE_BUF(MP, BP, OLDSZ, OLDCNT) \
315 (*(MP)->mnt_wapbl_op->wo_wapbl_resize_buf)((MP)->mnt_wapbl, (BP), \
316 (OLDSZ), (OLDCNT))
317#define WAPBL_BEGIN(MP) \
318 (*(MP)->mnt_wapbl_op->wo_wapbl_begin)((MP)->mnt_wapbl, \
319 __FILE__, __LINE__)
320#define WAPBL_END(MP) \
321 (*(MP)->mnt_wapbl_op->wo_wapbl_end)((MP)->mnt_wapbl)
322#define WAPBL_JUNLOCK_ASSERT(MP) \
323 (*(MP)->mnt_wapbl_op->wo_wapbl_junlock_assert)((MP)->mnt_wapbl)
324#define WAPBL_JLOCK_ASSERT(MP) \
325 (*(MP)->mnt_wapbl_op->wo_wapbl_jlock_assert)((MP)->mnt_wapbl)
326
327struct vfs_hooks {
328 LIST_ENTRY(vfs_hooks) vfs_hooks_list;
329 void (*vh_unmount)(struct mount *);
330 int (*vh_reexport)(struct mount *, const char *, void *);
331 void (*vh_future_expansion_1)(void);
332 void (*vh_future_expansion_2)(void);
333 void (*vh_future_expansion_3)(void);
334 void (*vh_future_expansion_4)(void);
335 void (*vh_future_expansion_5)(void);
336};
337
338void vfs_hooks_init(void);
339int vfs_hooks_attach(struct vfs_hooks *);
340int vfs_hooks_detach(struct vfs_hooks *);
341void vfs_hooks_unmount(struct mount *);
342int vfs_hooks_reexport(struct mount *, const char *, void *);
343
344#endif /* _KERNEL */
345
346/*
347 * Export arguments for local filesystem mount calls.
348 *
349 * This structure is deprecated and is only provided for compatibility
350 * reasons with old binary utilities; several file systems expose an
351 * instance of this structure in their mount arguments structure, thus
352 * needing a padding in place of the old values. This definition cannot
353 * change in the future due to this reason.
354 * XXX: This should be moved to the compat subtree but cannot be done
355 * until we can move the mount args structures themselves.
356 *
357 * The current export_args structure can be found in nfs/nfs.h.
358 */
359struct export_args30 {
360 int ex_flags; /* export related flags */
361 uid_t ex_root; /* mapping for root uid */
362 struct uucred ex_anon; /* mapping for anonymous user */
363 struct sockaddr *ex_addr; /* net address to which exported */
364 int ex_addrlen; /* and the net address length */
365 struct sockaddr *ex_mask; /* mask of valid bits in saddr */
366 int ex_masklen; /* and the smask length */
367 char *ex_indexfile; /* index file for WebNFS URLs */
368};
369
370struct mnt_export_args30 {
371 const char *fspec; /* Always NULL */
372 struct export_args30 eargs;
373};
374
375#ifdef _KERNEL
376
377/*
378 * exported VFS interface (see vfssubr(9))
379 */
380struct mount *vfs_getvfs(fsid_t *); /* return vfs given fsid */
381int vfs_composefh(struct vnode *, fhandle_t *, size_t *);
382int vfs_composefh_alloc(struct vnode *, fhandle_t **);
383void vfs_composefh_free(fhandle_t *);
384int vfs_fhtovp(fhandle_t *, struct vnode **);
385int vfs_mountedon(struct vnode *);/* is a vfs mounted on vp */
386int vfs_mountroot(void);
387void vfs_shutdown(void); /* unmount and sync file systems */
388void vfs_sync_all(struct lwp *);
389bool vfs_unmountall(struct lwp *); /* unmount file systems */
390bool vfs_unmountall1(struct lwp *, bool, bool);
391bool vfs_unmount_forceone(struct lwp *);
392int vfs_busy(struct mount *);
393int vfs_trybusy(struct mount *);
394int vfs_rootmountalloc(const char *, const char *, struct mount **);
395void vfs_unbusy(struct mount *);
396int vfs_set_lowermount(struct mount *, struct mount *);
397int vfs_attach(struct vfsops *);
398int vfs_detach(struct vfsops *);
399void vfs_reinit(void);
400struct vfsops *vfs_getopsbyname(const char *);
401void vfs_delref(struct vfsops *);
402void vfs_ref(struct mount *);
403void vfs_rele(struct mount *);
404struct mount *vfs_mountalloc(struct vfsops *, struct vnode *);
405int vfs_stdextattrctl(struct mount *, int, struct vnode *,
406 int, const char *);
407void vfs_insmntque(struct vnode *, struct mount *);
408int vfs_quotactl_stat(struct mount *, struct quotastat *);
409int vfs_quotactl_idtypestat(struct mount *, int, struct quotaidtypestat *);
410int vfs_quotactl_objtypestat(struct mount *,int,struct quotaobjtypestat *);
411int vfs_quotactl_get(struct mount *, const struct quotakey *,
412 struct quotaval *);
413int vfs_quotactl_put(struct mount *, const struct quotakey *,
414 const struct quotaval *);
415int vfs_quotactl_del(struct mount *, const struct quotakey *);
416int vfs_quotactl_cursoropen(struct mount *, struct quotakcursor *);
417int vfs_quotactl_cursorclose(struct mount *, struct quotakcursor *);
418int vfs_quotactl_cursorskipidtype(struct mount *, struct quotakcursor *,
419 int);
420int vfs_quotactl_cursorget(struct mount *, struct quotakcursor *,
421 struct quotakey *, struct quotaval *, unsigned, unsigned *);
422int vfs_quotactl_cursoratend(struct mount *, struct quotakcursor *, int *);
423int vfs_quotactl_cursorrewind(struct mount *, struct quotakcursor *);
424int vfs_quotactl_quotaon(struct mount *, int, const char *);
425int vfs_quotactl_quotaoff(struct mount *, int);
426
427struct vnode_iterator; /* Opaque. */
428void vfs_vnode_iterator_init(struct mount *, struct vnode_iterator **);
429void vfs_vnode_iterator_destroy(struct vnode_iterator *);
430struct vnode *vfs_vnode_iterator_next(struct vnode_iterator *,
431 bool (*)(void *, struct vnode *), void *);
432
433/* Syncer */
434extern int syncer_maxdelay;
435extern time_t syncdelay;
436extern time_t filedelay;
437extern time_t dirdelay;
438extern time_t metadelay;
439void vfs_syncer_add_to_worklist(struct mount *);
440void vfs_syncer_remove_from_worklist(struct mount *);
441
442extern int vfs_magiclinks;
443extern int vfs_timestamp_precision;
444
445extern struct vfsops *vfssw[]; /* filesystem type table */
446extern int nvfssw;
447extern kmutex_t vfs_list_lock;
448
449void vfs_mount_sysinit(void);
450long makefstype(const char *);
451int mount_domount(struct lwp *, struct vnode **, struct vfsops *,
452 const char *, int, void *, size_t *);
453int dounmount(struct mount *, int, struct lwp *);
454int do_sys_mount(struct lwp *, const char *, enum uio_seg, const char *,
455 int, void *, enum uio_seg, size_t, register_t *);
456void vfsinit(void);
457void vfs_evfilt_fs_init(void);
458void vfs_opv_init(const struct vnodeopv_desc * const *);
459void vfs_opv_free(const struct vnodeopv_desc * const *);
460#ifdef DEBUG
461void vfs_bufstats(void);
462#endif
463
464int mount_specific_key_create(specificdata_key_t *, specificdata_dtor_t);
465void mount_specific_key_delete(specificdata_key_t);
466void mount_initspecific(struct mount *);
467void mount_finispecific(struct mount *);
468void * mount_getspecific(struct mount *, specificdata_key_t);
469void mount_setspecific(struct mount *, specificdata_key_t, void *);
470
471int usermount_common_policy(struct mount *, u_long);
472
473typedef struct mount_iterator mount_iterator_t; /* Opaque. */
474void mountlist_iterator_init(mount_iterator_t **);
475void mountlist_iterator_destroy(mount_iterator_t *);
476struct mount *mountlist_iterator_next(mount_iterator_t *);
477struct mount *mountlist_iterator_trynext(mount_iterator_t *);
478struct mount *_mountlist_next(struct mount *);
479void mountlist_append(struct mount *);
480void mountlist_remove(struct mount *);
481
482LIST_HEAD(vfs_list_head, vfsops);
483extern struct vfs_list_head vfs_list;
484
485#else /* _KERNEL */
486
487#include <sys/cdefs.h>
488
489__BEGIN_DECLS
490#if !defined(__LIBC12_SOURCE__) && !defined(_STANDALONE)
491int getfh(const char *, void *, size_t *)
492 __RENAME(__getfh30);
493#endif
494
495int unmount(const char *, int);
496#if defined(_NETBSD_SOURCE)
497#ifndef __LIBC12_SOURCE__
498int mount(const char *, const char *, int, void *, size_t) __RENAME(__mount50);
499int fhopen(const void *, size_t, int) __RENAME(__fhopen40);
500int fhstat(const void *, size_t, struct stat *) __RENAME(__fhstat50);
501#endif
502#endif /* _NETBSD_SOURCE */
503__END_DECLS
504
505#endif /* _KERNEL */
506#endif /* !_STANDALONE */
507
508#endif /* !_SYS_MOUNT_H_ */