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 128 struct vnode; 129 struct vnode_impl; 130 struct vattr; 131 132 /* 133 * Structure per mounted file system. Each mounted file system has an 134 * array of operations and an instance record. 135 */ 136 struct 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 174 struct quotactl_args; /* in sys/quotactl.h */ 175 struct quotastat; /* in sys/quotactl.h */ 176 struct quotaidtypestat; /* in sys/quotactl.h */ 177 struct quotaobjtypestat; /* in sys/quotactl.h */ 178 struct quotakcursor; /* in sys/quotactl.h */ 179 struct quotakey; /* in sys/quota.h */ 180 struct quotaval; /* in sys/quota.h */ 181 182 /* 183 * Operations supported on mounted file system. 184 */ 185 186 struct 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 235 int VFS_MOUNT(struct mount *, const char *, void *, size_t *); 236 int VFS_START(struct mount *, int); 237 int VFS_UNMOUNT(struct mount *, int); 238 int VFS_ROOT(struct mount *, int, struct vnode **); 239 int VFS_QUOTACTL(struct mount *, struct quotactl_args *); 240 int VFS_STATVFS(struct mount *, struct statvfs *); 241 int VFS_SYNC(struct mount *, int, struct kauth_cred *); 242 int VFS_FHTOVP(struct mount *, struct fid *, int, struct vnode **); 243 int VFS_VPTOFH(struct vnode *, struct fid *, size_t *); 244 int VFS_SNAPSHOT(struct mount *, struct vnode *, struct timespec *); 245 int VFS_EXTATTRCTL(struct mount *, int, struct vnode *, int, const char *); 246 int VFS_SUSPENDCTL(struct mount *, int); 247 248 struct vnodeopv_desc; 249 struct kauth_cred; 250 251 #define VFS_MAX_MOUNT_DATA 8192 252 253 #define VFS_PROTOS(fsname) \ 254 int fsname##_mount(struct mount *, const char *, void *, \ 255 size_t *); \ 256 int fsname##_start(struct mount *, int); \ 257 int fsname##_unmount(struct mount *, int); \ 258 int fsname##_root(struct mount *, int, struct vnode **); \ 259 int fsname##_quotactl(struct mount *, struct quotactl_args *); \ 260 int fsname##_statvfs(struct mount *, struct statvfs *); \ 261 int fsname##_sync(struct mount *, int, struct kauth_cred *); \ 262 int fsname##_vget(struct mount *, ino_t, int, struct vnode **); \ 263 int fsname##_loadvnode(struct mount *, struct vnode *, \ 264 const void *, size_t, const void **); \ 265 int fsname##_newvnode(struct mount *, struct vnode *, \ 266 struct vnode *, struct vattr *, kauth_cred_t, void *, \ 267 size_t *, const void **); \ 268 int fsname##_fhtovp(struct mount *, struct fid *, int, struct vnode **);\ 269 int fsname##_vptofh(struct vnode *, struct fid *, size_t *); \ 270 void fsname##_init(void); \ 271 void fsname##_reinit(void); \ 272 void fsname##_done(void); \ 273 int fsname##_mountroot(void); \ 274 int fsname##_snapshot(struct mount *, struct vnode *, \ 275 struct timespec *); \ 276 int fsname##_extattrctl(struct mount *, int, struct vnode *, int, \ 277 const char *); \ 278 int 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 */ 285 struct 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 326 struct 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 337 void vfs_hooks_init(void); 338 int vfs_hooks_attach(struct vfs_hooks *); 339 int vfs_hooks_detach(struct vfs_hooks *); 340 void vfs_hooks_unmount(struct mount *); 341 int 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 */ 358 struct 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 369 struct 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 */ 379 struct mount *vfs_getvfs(fsid_t *); /* return vfs given fsid */ 380 int vfs_composefh(struct vnode *, fhandle_t *, size_t *); 381 int vfs_composefh_alloc(struct vnode *, fhandle_t **); 382 void vfs_composefh_free(fhandle_t *); 383 int vfs_fhtovp(fhandle_t *, struct vnode **); 384 int vfs_mountedon(struct vnode *);/* is a vfs mounted on vp */ 385 int vfs_mountroot(void); 386 void vfs_shutdown(void); /* unmount and sync file systems */ 387 void vfs_sync_all(struct lwp *); 388 bool vfs_unmountall(struct lwp *); /* unmount file systems */ 389 bool vfs_unmountall1(struct lwp *, bool, bool); 390 bool vfs_unmount_forceone(struct lwp *); 391 int vfs_busy(struct mount *); 392 int vfs_trybusy(struct mount *); 393 int vfs_rootmountalloc(const char *, const char *, struct mount **); 394 void vfs_unbusy(struct mount *); 395 int vfs_set_lowermount(struct mount *, struct mount *); 396 int vfs_attach(struct vfsops *); 397 int vfs_detach(struct vfsops *); 398 void vfs_reinit(void); 399 struct vfsops *vfs_getopsbyname(const char *); 400 void vfs_delref(struct vfsops *); 401 void vfs_ref(struct mount *); 402 void vfs_rele(struct mount *); 403 struct mount *vfs_mountalloc(struct vfsops *, struct vnode *); 404 int vfs_stdextattrctl(struct mount *, int, struct vnode *, 405 int, const char *); 406 void vfs_insmntque(struct vnode *, struct mount *); 407 int vfs_quotactl_stat(struct mount *, struct quotastat *); 408 int vfs_quotactl_idtypestat(struct mount *, int, struct quotaidtypestat *); 409 int vfs_quotactl_objtypestat(struct mount *,int,struct quotaobjtypestat *); 410 int vfs_quotactl_get(struct mount *, const struct quotakey *, 411 struct quotaval *); 412 int vfs_quotactl_put(struct mount *, const struct quotakey *, 413 const struct quotaval *); 414 int vfs_quotactl_del(struct mount *, const struct quotakey *); 415 int vfs_quotactl_cursoropen(struct mount *, struct quotakcursor *); 416 int vfs_quotactl_cursorclose(struct mount *, struct quotakcursor *); 417 int vfs_quotactl_cursorskipidtype(struct mount *, struct quotakcursor *, 418 int); 419 int vfs_quotactl_cursorget(struct mount *, struct quotakcursor *, 420 struct quotakey *, struct quotaval *, unsigned, unsigned *); 421 int vfs_quotactl_cursoratend(struct mount *, struct quotakcursor *, int *); 422 int vfs_quotactl_cursorrewind(struct mount *, struct quotakcursor *); 423 int vfs_quotactl_quotaon(struct mount *, int, const char *); 424 int vfs_quotactl_quotaoff(struct mount *, int); 425 426 struct vnode_iterator; /* Opaque. */ 427 void vfs_vnode_iterator_init(struct mount *, struct vnode_iterator **); 428 void vfs_vnode_iterator_destroy(struct vnode_iterator *); 429 struct vnode *vfs_vnode_iterator_next(struct vnode_iterator *, 430 bool (*)(void *, struct vnode *), void *); 431 432 /* Syncer */ 433 extern int syncer_maxdelay; 434 extern time_t syncdelay; 435 extern time_t filedelay; 436 extern time_t dirdelay; 437 extern time_t metadelay; 438 void vfs_syncer_add_to_worklist(struct mount *); 439 void vfs_syncer_remove_from_worklist(struct mount *); 440 441 extern int vfs_magiclinks; 442 extern int vfs_timestamp_precision; 443 444 extern struct vfsops *vfssw[]; /* filesystem type table */ 445 extern int nvfssw; 446 extern kmutex_t vfs_list_lock; 447 448 void vfs_mount_sysinit(void); 449 long makefstype(const char *); 450 int mount_domount(struct lwp *, struct vnode **, struct vfsops *, 451 const char *, int, void *, size_t *); 452 int dounmount(struct mount *, int, struct lwp *); 453 int do_sys_mount(struct lwp *, const char *, enum uio_seg, const char *, 454 int, void *, enum uio_seg, size_t, register_t *); 455 void vfsinit(void); 456 void vfs_evfilt_fs_init(void); 457 void vfs_opv_init(const struct vnodeopv_desc * const *); 458 void vfs_opv_free(const struct vnodeopv_desc * const *); 459 #ifdef DEBUG 460 void vfs_bufstats(void); 461 #endif 462 463 int mount_specific_key_create(specificdata_key_t *, specificdata_dtor_t); 464 void mount_specific_key_delete(specificdata_key_t); 465 void mount_initspecific(struct mount *); 466 void mount_finispecific(struct mount *); 467 void * mount_getspecific(struct mount *, specificdata_key_t); 468 void mount_setspecific(struct mount *, specificdata_key_t, void *); 469 470 int usermount_common_policy(struct mount *, u_long); 471 472 typedef struct mount_iterator mount_iterator_t; /* Opaque. */ 473 void mountlist_iterator_init(mount_iterator_t **); 474 void mountlist_iterator_destroy(mount_iterator_t *); 475 struct mount *mountlist_iterator_next(mount_iterator_t *); 476 struct mount *mountlist_iterator_trynext(mount_iterator_t *); 477 struct mount *_mountlist_next(struct mount *); 478 void mountlist_append(struct mount *); 479 void mountlist_remove(struct mount *); 480 481 LIST_HEAD(vfs_list_head, vfsops); 482 extern 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) 490 int getfh(const char *, void *, size_t *) 491 __RENAME(__getfh30); 492 #endif 493 494 int unmount(const char *, int); 495 #if defined(_NETBSD_SOURCE) 496 #ifndef __LIBC12_SOURCE__ 497 int mount(const char *, const char *, int, void *, size_t) __RENAME(__mount50); 498 int fhopen(const void *, size_t, int) __RENAME(__fhopen40); 499 int 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