1/*
2 * Copyright (c) 2000-2014 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29/*
30 * Copyright (c) 1989, 1991, 1993
31 *	The Regents of the University of California.  All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 *    notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 *    notice, this list of conditions and the following disclaimer in the
40 *    documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 *    must display the following acknowledgement:
43 *	This product includes software developed by the University of
44 *	California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 *    may be used to endorse or promote products derived from this software
47 *    without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 *	@(#)mount.h	8.21 (Berkeley) 5/20/95
62 */
63/*
64 * NOTICE: This file was modified by McAfee Research in 2004 to introduce
65 * support for mandatory and extensible security protections.  This notice
66 * is included in support of clause 2.2 (b) of the Apple Public License,
67 * Version 2.0.
68 */
69
70#ifndef _SYS_MOUNT_INTERNAL_H_
71#define	_SYS_MOUNT_INTERNAL_H_
72
73#include <sys/appleapiopts.h>
74#ifndef KERNEL
75#include <sys/ucred.h>
76#else
77#include <sys/kernel_types.h>
78#include <sys/namei.h>
79#endif
80#include <sys/queue.h>
81#include <sys/lock.h>
82#include <net/radix.h>
83#include <sys/socket.h>		/* XXX for AF_MAX */
84#include <sys/vfs_context.h>		/* XXX for AF_MAX */
85#include <sys/mount.h>
86#include <sys/cdefs.h>
87#include <sys/sysctl.h>
88
89struct label;
90
91#if defined(__i386__) || defined(__x86_64__)
92typedef uint64_t  pending_io_t;
93#define INCR_PENDING_IO(a, b) OSAddAtomic64((int64_t)(a), (int64_t *)&(b));
94#else
95typedef uint32_t  pending_io_t;
96#define INCR_PENDING_IO(a, b) OSAddAtomic((int32_t)(a), (int32_t *)&(b));
97#endif
98
99
100/*
101 * Structure per mounted file system.  Each mounted file system has an
102 * array of operations and an instance record.  The file systems are
103 * put on a doubly linked list.
104 */
105TAILQ_HEAD(vnodelst, vnode);
106
107struct mount {
108	TAILQ_ENTRY(mount) mnt_list;		/* mount list */
109	int32_t		mnt_count;		/* reference on the mount */
110	lck_mtx_t	mnt_mlock;		/* mutex that protects mount point */
111	struct vfsops	*mnt_op;		/* operations on fs */
112	struct vfstable	*mnt_vtable;		/* configuration info */
113	struct vnode	*mnt_vnodecovered;	/* vnode we mounted on */
114	struct vnodelst	mnt_vnodelist;		/* list of vnodes this mount */
115	struct vnodelst	mnt_workerqueue;		/* list of vnodes this mount */
116	struct vnodelst	mnt_newvnodes;		/* list of vnodes this mount */
117	uint32_t		mnt_flag;		/* flags */
118	uint32_t		mnt_kern_flag;		/* kernel only flags */
119	uint32_t		mnt_compound_ops;	/* Available compound operations */
120	uint32_t		mnt_lflag;			/* mount life cycle flags */
121	uint32_t		mnt_maxsymlinklen;	/* max size of short symlink */
122	struct vfsstatfs	mnt_vfsstat;		/* cache of filesystem stats */
123	qaddr_t		mnt_data;		/* private data */
124	/* Cached values of the IO constraints for the device */
125	uint32_t	mnt_maxreadcnt;		/* Max. byte count for read */
126	uint32_t	mnt_maxwritecnt;	/* Max. byte count for write */
127	uint32_t	mnt_segreadcnt;		/* Max. segment count for read */
128	uint32_t	mnt_segwritecnt;	/* Max. segment count for write */
129	uint32_t	mnt_maxsegreadsize;	/* Max. segment read size  */
130	uint32_t	mnt_maxsegwritesize;	/* Max. segment write size */
131	uint32_t	mnt_alignmentmask;	/* Mask of bits that aren't addressable via DMA */
132	uint32_t	mnt_devblocksize;	/* the underlying device block size */
133	uint32_t	mnt_ioqueue_depth;	/* the maxiumum number of commands a device can accept */
134        uint32_t	mnt_ioscale;		/* scale the various throttles/limits imposed on the amount of I/O in flight */
135	uint32_t	mnt_ioflags;		/* flags for  underlying device */
136	pending_io_t	mnt_pending_write_size __attribute__((aligned(sizeof(pending_io_t))));	/* byte count of pending writes */
137	pending_io_t	mnt_pending_read_size  __attribute__((aligned(sizeof(pending_io_t))));	/* byte count of pending reads */
138	struct timeval	mnt_last_write_issued_timestamp;
139	struct timeval	mnt_last_write_completed_timestamp;
140
141	lck_rw_t	mnt_rwlock;		/* mutex readwrite lock */
142	lck_mtx_t	mnt_renamelock;		/* mutex that serializes renames that change shape of tree */
143	vnode_t		mnt_devvp;		/* the device mounted on for local file systems */
144	uint32_t	mnt_devbsdunit;		/* the BSD unit number of the device */
145	uint64_t	mnt_throttle_mask;	/* the throttle mask of what devices will be affected by I/O from this mnt */
146	void		*mnt_throttle_info;	/* used by the throttle code */
147	int32_t		mnt_crossref;		/* refernces to cover lookups  crossing into mp */
148	int32_t		mnt_iterref;		/* refernces to cover iterations; drained makes it -ve  */
149#if CONFIG_TRIGGERS
150	int32_t		mnt_numtriggers; 	/* num of trigger vnodes for this mount */
151	vfs_trigger_callback_t *mnt_triggercallback;
152	void		*mnt_triggerdata;
153#endif
154 	/* XXX 3762912 hack to support HFS filesystem 'owner' */
155 	uid_t		mnt_fsowner;
156 	gid_t		mnt_fsgroup;
157
158	struct label	*mnt_mntlabel;		/* MAC mount label */
159	struct label	*mnt_fslabel;		/* MAC default fs label */
160
161	/*
162	 * cache the rootvp of the last mount point
163	 * in the chain in the mount struct pointed
164	 * to by the vnode sitting in '/'
165	 * this cache is used to shortcircuit the
166	 * mount chain traversal and allows us
167	 * to traverse to the true underlying rootvp
168	 * in 1 easy step inside of 'cache_lookup_path'
169	 *
170	 * make sure to validate against the cached vid
171	 * in case the rootvp gets stolen away since
172	 * we don't take an explicit long term reference
173	 * on it when we mount it
174	 */
175	vnode_t		mnt_realrootvp;
176	uint32_t	mnt_realrootvp_vid;
177	/*
178	 * bumped each time a mount or unmount
179	 * occurs... its used to invalidate
180	 * 'mnt_realrootvp' from the cache
181	 */
182	uint32_t             mnt_generation;
183        /*
184	 * if 'MNTK_AUTH_CACHE_TIMEOUT' is
185	 * set, then 'mnt_authcache_ttl' is
186	 * the time-to-live for the per-vnode authentication cache
187	 * on this mount... if zero, no cache is maintained...
188	 * if 'MNTK_AUTH_CACHE_TIMEOUT' isn't set, its the
189	 * time-to-live for the cached lookup right for
190	 * volumes marked 'MNTK_AUTH_OPAQUE'.
191	 */
192	int		mnt_authcache_ttl;
193	char		fstypename_override[MFSTYPENAMELEN];
194};
195
196/*
197 * default number of seconds to keep cached lookup
198 * rights valid on mounts marked MNTK_AUTH_OPAQUE
199 */
200#define CACHED_LOOKUP_RIGHT_TTL		2
201
202/*
203 * ioflags
204 */
205#define MNT_IOFLAGS_FUA_SUPPORTED	0x00000001
206#define MNT_IOFLAGS_UNMAP_SUPPORTED	0x00000002
207#define MNT_IOFLAGS_IOSCHED_SUPPORTED	0x00000004
208#define MNT_IOFLAGS_CSUNMAP_SUPPORTED	0x00000008
209
210/*
211 * ioqueue depth for devices that don't report one
212 */
213#define MNT_DEFAULT_IOQUEUE_DEPTH	32
214
215
216/* XXX 3762912 hack to support HFS filesystem 'owner' */
217#define vfs_setowner(_mp, _uid, _gid)	do {(_mp)->mnt_fsowner = (_uid); (_mp)->mnt_fsgroup = (_gid); } while (0)
218
219
220/* mount point to which dead vps point to */
221extern struct mount * dead_mountp;
222
223/*
224 * Internal filesystem control flags stored in mnt_kern_flag.
225 *
226 * MNTK_UNMOUNT locks the mount entry so that name lookup cannot proceed
227 * past the mount point.  This keeps the subtree stable during mounts
228 * and unmounts.
229 *
230 * Note:	We are counting down on new bit assignments.  This is
231 *		because the bits here were broken out from the high bits
232 *		of the mount flags.
233 */
234#define MNTK_SWAP_MOUNT		0x00000100	/* we are swapping to this mount */
235#define MNTK_DENY_READDIREXT 0x00000200 /* Deny Extended-style readdir's for this volume */
236#define MNTK_PERMIT_UNMOUNT	0x00000400	/* Allow (non-forced) unmounts by UIDs other than the one that mounted the volume */
237#ifdef NFSCLIENT
238#define MNTK_TYPENAME_OVERRIDE  0x00000800      /* override the fstypename for statfs() */
239#endif /* NFSCLIENT */
240#define MNTK_KERNEL_MOUNT	0x00001000	/* mount came from kernel side */
241#ifdef CONFIG_IMGSRC_ACCESS
242#define MNTK_HAS_MOVED		0x00002000
243#define MNTK_BACKS_ROOT		0x00004000
244#endif /* CONFIG_IMGSRC_ACCESS */
245#define MNTK_AUTH_CACHE_TTL	0x00008000      /* rights cache has TTL - TTL of 0 disables cache */
246#define	MNTK_PATH_FROM_ID	0x00010000	/* mounted file system supports id-to-path lookups */
247#define	MNTK_UNMOUNT_PREFLIGHT	0x00020000	/* mounted file system wants preflight check during unmount */
248#define	MNTK_NAMED_STREAMS	0x00040000	/* mounted file system supports Named Streams VNOPs */
249#define	MNTK_EXTENDED_ATTRS	0x00080000	/* mounted file system supports Extended Attributes VNOPs */
250#define	MNTK_LOCK_LOCAL		0x00100000	/* advisory locking is done above the VFS itself */
251#define MNTK_VIRTUALDEV 	0x00200000      /* mounted on a virtual device i.e. a disk image */
252#define MNTK_ROOTDEV    	0x00400000      /* this filesystem resides on the same device as the root */
253#define MNTK_SSD		0x00800000	/* underlying device is of the solid state variety */
254#define MNTK_UNMOUNT		0x01000000	/* unmount in progress */
255#define	MNTK_MWAIT		0x02000000	/* waiting for unmount to finish */
256#define MNTK_WANTRDWR		0x04000000	/* upgrade to read/write requested */
257#if REV_ENDIAN_FS
258#define MNT_REVEND		0x08000000	/* Reverse endian FS */
259#endif /* REV_ENDIAN_FS */
260#define MNTK_AUTH_OPAQUE        0x20000000      /* authorisation decisions are not made locally */
261#define MNTK_AUTH_OPAQUE_ACCESS 0x40000000      /* VNOP_ACCESS is reliable for remote auth */
262#define MNTK_EXTENDED_SECURITY	0x80000000	/* extended security supported */
263
264#define	MNT_LNOTRESP		0x00000001	/* mount not responding */
265#define MNT_LUNMOUNT		0x00000002	/* mount in unmount */
266#define MNT_LFORCE		0x00000004	/* mount in forced unmount */
267#define MNT_LDRAIN		0x00000008	/* mount in drain */
268#define MNT_LITER		0x00000010	/* mount in iteration */
269#define MNT_LNEWVN		0x00000020	/* mount has new vnodes created */
270#define MNT_LWAIT		0x00000040	/* wait for unmount op */
271#define MNT_LITERWAIT		0x00000080	/* mount in iteration */
272#define MNT_LDEAD		0x00000100	/* mount already unmounted*/
273#define MNT_LNOSUB		0x00000200	/* submount - no recursion */
274
275
276/*
277 * Generic file handle
278 */
279#define	NFS_MAX_FH_SIZE		NFSV4_MAX_FH_SIZE
280#define	NFSV4_MAX_FH_SIZE	128
281#define	NFSV3_MAX_FH_SIZE	64
282#define	NFSV2_MAX_FH_SIZE	32
283struct fhandle {
284	int		fh_len;				/* length of file handle */
285	unsigned char	fh_data[NFS_MAX_FH_SIZE];	/* file handle value */
286};
287typedef struct fhandle	fhandle_t;
288
289
290
291/*
292 * Filesystem configuration information. One of these exists for each
293 * type of filesystem supported by the kernel. These are searched at
294 * mount time to identify the requested filesystem.
295 */
296struct vfstable {
297	struct	vfsops *vfc_vfsops;	/* filesystem operations vector */
298	char	vfc_name[MFSNAMELEN];	/* filesystem type name */
299	int	vfc_typenum;		/* historic filesystem type number */
300	int	vfc_refcount;		/* number mounted of this type */
301	int	vfc_flags;		/* permanent flags */
302	int	(*vfc_mountroot)(mount_t, vnode_t, vfs_context_t);	/* if != NULL, routine to mount root */
303	struct	vfstable *vfc_next;	/* next in list */
304	int32_t	vfc_reserved1;
305	int32_t vfc_reserved2;
306	int 		vfc_vfsflags;	/* for optional types */
307	void *		vfc_descptr;	/* desc table allocated address */
308	int			vfc_descsize;	/* size allocated for desc table */
309	struct sysctl_oid	*vfc_sysctl;	/* dynamically registered sysctl node */
310};
311
312/* vfc_vfsflags: */
313#define VFC_VFSLOCALARGS	0x002
314#define	VFC_VFSGENERICARGS	0x004
315#define	VFC_VFSNATIVEXATTR	0x010
316#define	VFC_VFSDIRLINKS		0x020
317#define	VFC_VFSPREFLIGHT	0x040
318#define	VFC_VFSREADDIR_EXTENDED	0x080
319#define	VFC_VFS64BITREADY	0x100
320#define	VFC_VFSNOMACLABEL	0x1000
321#define	VFC_VFSVNOP_PAGEINV2	0x2000
322#define	VFC_VFSVNOP_PAGEOUTV2	0x4000
323#define	VFC_VFSVNOP_NOUPDATEID_RENAME	0x8000
324#if CONFIG_SECLUDED_RENAME
325#define VFC_VFSVNOP_SECLUDE_RENAME 	0x10000
326#endif
327
328
329extern int maxvfstypenum;		/* highest defined filesystem type */
330extern struct vfstable  *vfsconf;	/* head of list of filesystem types */
331extern const int maxvfsslots;		/* Maximum statically allocated slots available to be used */
332extern int numused_vfsslots;	/* number of statically allocated slots already used */
333extern int numregistered_fses;	/* number of total registered filesystems */
334
335/* the following two are xnu private */
336struct vfstable *	vfstable_add(struct	vfstable *);
337int	vfstable_del(struct vfstable *);
338
339
340struct vfsmount_args {
341	union {
342		struct {
343			char * mnt_fspec;
344			void * mnt_fsdata;
345		} mnt_localfs_args;
346		struct {
347			void *  mnt_fsdata;		/* FS specific */
348		} mnt_remotefs_args;
349	} mountfs_args;
350};
351
352
353/*
354 * LP64 *user* version of statfs structure.
355 * NOTE - must be kept in sync with struct statfs in mount.h
356 */
357struct user64_statfs {
358	short		f_otype;		/* TEMPORARY SHADOW COPY OF f_type */
359	short		f_oflags;		/* TEMPORARY SHADOW COPY OF f_flags */
360	user64_long_t	f_bsize;		/* fundamental file system block size */
361	user64_long_t	f_iosize;		/* optimal transfer block size */
362	user64_long_t	f_blocks;		/* total data blocks in file system */
363	user64_long_t	f_bfree;		/* free blocks in fs */
364	user64_long_t	f_bavail;		/* free blocks avail to non-superuser */
365	user64_long_t	f_files;		/* total file nodes in file system */
366	user64_long_t	f_ffree;		/* free file nodes in fs */
367	fsid_t		f_fsid;			/* file system id */
368	uid_t		f_owner;		/* user that mounted the filesystem */
369	short		f_reserved1;	/* spare for later */
370	short		f_type;			/* type of filesystem */
371    user64_long_t	f_flags;		/* copy of mount exported flags */
372	user64_long_t f_reserved2[2];	/* reserved for future use */
373	char		f_fstypename[MFSNAMELEN]; /* fs type name */
374	char		f_mntonname[MNAMELEN];	/* directory on which mounted */
375	char		f_mntfromname[MNAMELEN];/* mounted filesystem */
376	char		f_reserved3;	/* For alignment */
377	user64_long_t	f_reserved4[4];	/* For future use */
378};
379
380/*
381 * ILP32 *user* version of statfs structure.
382 * NOTE - must be kept in sync with struct statfs in mount.h
383 */
384struct user32_statfs {
385	short		f_otype;		/* TEMPORARY SHADOW COPY OF f_type */
386	short		f_oflags;		/* TEMPORARY SHADOW COPY OF f_flags */
387	user32_long_t	f_bsize;		/* fundamental file system block size */
388	user32_long_t	f_iosize;		/* optimal transfer block size */
389	user32_long_t	f_blocks;		/* total data blocks in file system */
390	user32_long_t	f_bfree;		/* free blocks in fs */
391	user32_long_t	f_bavail;		/* free blocks avail to non-superuser */
392	user32_long_t	f_files;		/* total file nodes in file system */
393	user32_long_t	f_ffree;		/* free file nodes in fs */
394	fsid_t		f_fsid;			/* file system id */
395	uid_t		f_owner;		/* user that mounted the filesystem */
396	short		f_reserved1;	/* spare for later */
397	short		f_type;			/* type of filesystem */
398    user32_long_t	f_flags;		/* copy of mount exported flags */
399	user32_long_t f_reserved2[2];	/* reserved for future use */
400	char		f_fstypename[MFSNAMELEN]; /* fs type name */
401	char		f_mntonname[MNAMELEN];	/* directory on which mounted */
402	char		f_mntfromname[MNAMELEN];/* mounted filesystem */
403	char		f_reserved3;	/* For alignment */
404	user32_long_t	f_reserved4[4];	/* For future use */
405};
406
407/*
408 * throttle I/Os are affected only by normal I/Os happening on the same spindle.  Currently we use a 64-bit integer to
409 * represent what devices are affected, so we can handle at most 64 different spindles.  Since
410 * throttled I/O is usually useful in non-server environment only, this number is enough in most cases.
411 */
412#define LOWPRI_MAX_NUM_DEV 64
413
414__BEGIN_DECLS
415
416extern uint32_t mount_generation;
417extern TAILQ_HEAD(mntlist, mount) mountlist;
418void mount_list_lock(void);
419void mount_list_unlock(void);
420void mount_lock_init(mount_t);
421void mount_lock_destroy(mount_t);
422void mount_lock(mount_t);
423void mount_lock_spin(mount_t);
424void mount_unlock(mount_t);
425void mount_lock_renames(mount_t);
426void mount_unlock_renames(mount_t);
427void mount_ref(mount_t, int);
428void mount_drop(mount_t, int);
429int  mount_refdrain(mount_t);
430
431/* vfs_rootmountalloc should be kept as a private api */
432errno_t vfs_rootmountalloc(const char *, const char *, mount_t *mpp);
433
434int	vfs_mountroot(void);
435void	vfs_unmountall(void);
436int	safedounmount(struct mount *, int, vfs_context_t);
437int	dounmount(struct mount *, int, int, vfs_context_t);
438void	dounmount_submounts(struct mount *, int, vfs_context_t);
439
440/* xnu internal api */
441void  mount_dropcrossref(mount_t, vnode_t, int);
442mount_t mount_lookupby_volfsid(int, int);
443mount_t mount_list_lookupby_fsid(fsid_t *, int, int);
444int  mount_list_add(mount_t);
445void mount_list_remove(mount_t);
446int  mount_iterref(mount_t, int);
447int  mount_isdrained(mount_t, int);
448void mount_iterdrop(mount_t);
449void mount_iterdrain(mount_t);
450void mount_iterreset(mount_t);
451
452/* tags a volume as not supporting extended readdir for NFS exports */
453#ifdef BSD_KERNEL_PRIVATE
454void mount_set_noreaddirext (mount_t);
455#endif
456
457/* Private NFS spi */
458#define KERNEL_MOUNT_NOAUTH		0x01 /* Don't check the UID of the directory we are mounting on */
459#define KERNEL_MOUNT_PERMIT_UNMOUNT	0x02 /* Allow (non-forced) unmounts by users other the one who mounted the volume */
460#if NFSCLIENT || DEVFS
461/*
462 * NOTE: kernel_mount() does not force MNT_NOSUID, MNT_NOEXEC, or MNT_NODEC for non-privileged
463 * mounting credentials, as the mount(2) system call does.
464 */
465int kernel_mount(char *, vnode_t, vnode_t, const char *, void *, size_t, int, uint32_t, vfs_context_t);
466boolean_t vfs_iskernelmount(mount_t);
467#endif
468
469/* throttled I/O api */
470
471/* returned by throttle_io_will_be_throttled */
472#define THROTTLE_DISENGAGED	0
473#define THROTTLE_ENGAGED	1
474#define THROTTLE_NOW		2
475
476int  throttle_get_io_policy(struct uthread **ut);
477int  throttle_get_passive_io_policy(struct uthread **ut);
478int  throttle_io_will_be_throttled(int lowpri_window_msecs, mount_t mp);
479void *throttle_info_update_by_mount(mount_t mp);
480void rethrottle_thread(uthread_t ut);
481void throttle_info_reset_window(uthread_t ut);
482
483
484/* throttled I/O helper function */
485/* convert the lowest bit to a device index */
486extern int num_trailing_0(uint64_t n);
487
488/* sync lock */
489extern lck_mtx_t * sync_mtx_lck;
490
491extern int sync_timeout;
492
493__END_DECLS
494
495#endif /* !_SYS_MOUNT_INTERNAL_H_ */
496