| 1 | /* |
| 2 | * Copyright (c) 2000-2021 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 SPARTA, Inc. in 2005 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 | |
| 71 | #ifndef _SYS_MOUNT_H_ |
| 72 | #define _SYS_MOUNT_H_ |
| 73 | |
| 74 | #include <sys/appleapiopts.h> |
| 75 | #include <sys/cdefs.h> |
| 76 | #include <sys/attr.h> /* needed for vol_capabilities_attr_t */ |
| 77 | #include <os/base.h> |
| 78 | |
| 79 | #include <stdint.h> |
| 80 | #include <sys/ucred.h> |
| 81 | #include <sys/queue.h> /* XXX needed for user builds */ |
| 82 | #include <Availability.h> |
| 83 | |
| 84 | #include <sys/_types/_fsid_t.h> /* file system id type */ |
| 85 | #include <sys/_types/_graftdmg_un.h> |
| 86 | #include <sys/_types/_mount_t.h> |
| 87 | #include <sys/_types/_vnode_t.h> |
| 88 | |
| 89 | /* |
| 90 | * file system statistics |
| 91 | */ |
| 92 | |
| 93 | #define MFSNAMELEN 15 /* length of fs type name, not inc. null */ |
| 94 | #define MFSTYPENAMELEN 16 /* length of fs type name including null */ |
| 95 | |
| 96 | #if __DARWIN_64_BIT_INO_T |
| 97 | #define MNAMELEN MAXPATHLEN /* length of buffer for returned name */ |
| 98 | #else /* ! __DARWIN_64_BIT_INO_T */ |
| 99 | #define MNAMELEN 90 /* length of buffer for returned name */ |
| 100 | #endif /* __DARWIN_64_BIT_INO_T */ |
| 101 | |
| 102 | #define MNT_EXT_ROOT_DATA_VOL 0x00000001 /* Data volume of root volume group */ |
| 103 | #define MNT_EXT_FSKIT 0x00000002 /* this is an FSKit mount */ |
| 104 | |
| 105 | #define __DARWIN_STRUCT_STATFS64 { \ |
| 106 | 	uint32_t	f_bsize; /* fundamental file system block size */ \ |
| 107 | 	int32_t		f_iosize; /* optimal transfer block size */ \ |
| 108 | 	uint64_t	f_blocks; /* total data blocks in file system */ \ |
| 109 | 	uint64_t	f_bfree; /* free blocks in fs */ \ |
| 110 | 	uint64_t	f_bavail; /* free blocks avail to non-superuser */ \ |
| 111 | 	uint64_t	f_files; /* total file nodes in file system */ \ |
| 112 | 	uint64_t	f_ffree; /* free file nodes in fs */ \ |
| 113 | 	fsid_t		f_fsid; /* file system id */ \ |
| 114 | 	uid_t		f_owner; /* user that mounted the filesystem */ \ |
| 115 | 	uint32_t	f_type; /* type of filesystem */ \ |
| 116 | 	uint32_t	f_flags; /* copy of mount exported flags */ \ |
| 117 | 	uint32_t	f_fssubtype; /* fs sub-type (flavor) */ \ |
| 118 | 	char		f_fstypename[MFSTYPENAMELEN]; /* fs type name */ \ |
| 119 | 	char		f_mntonname[MAXPATHLEN]; /* directory on which mounted */ \ |
| 120 | 	char		f_mntfromname[MAXPATHLEN]; /* mounted filesystem */ \ |
| 121 | 	uint32_t f_flags_ext; /* extended flags */ \ |
| 122 | 	uint32_t	f_reserved[7]; /* For future use */ \ |
| 123 | } |
| 124 | |
| 125 | #if !__DARWIN_ONLY_64_BIT_INO_T |
| 126 | |
| 127 | struct statfs64 __DARWIN_STRUCT_STATFS64; |
| 128 | |
| 129 | #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ |
| 130 | |
| 131 | #if __DARWIN_64_BIT_INO_T |
| 132 | |
| 133 | struct statfs __DARWIN_STRUCT_STATFS64; |
| 134 | |
| 135 | #else /* !__DARWIN_64_BIT_INO_T */ |
| 136 | |
| 137 | /* |
| 138 | * LP64 - WARNING - must be kept in sync with struct user_statfs in mount_internal.h. |
| 139 | */ |
| 140 | struct statfs { |
| 141 | 	short f_otype; /* TEMPORARY SHADOW COPY OF f_type */ |
| 142 | 	short f_oflags; /* TEMPORARY SHADOW COPY OF f_flags */ |
| 143 | 	long f_bsize; /* fundamental file system block size */ |
| 144 | 	long f_iosize; /* optimal transfer block size */ |
| 145 | 	long f_blocks; /* total data blocks in file system */ |
| 146 | 	long f_bfree; /* free blocks in fs */ |
| 147 | 	long f_bavail; /* free blocks avail to non-superuser */ |
| 148 | 	long f_files; /* total file nodes in file system */ |
| 149 | 	long f_ffree; /* free file nodes in fs */ |
| 150 | 	fsid_t f_fsid; /* file system id */ |
| 151 | 	uid_t f_owner; /* user that mounted the filesystem */ |
| 152 | 	short f_reserved1; /* spare for later */ |
| 153 | 	short f_type; /* type of filesystem */ |
| 154 | 	long f_flags; /* copy of mount exported flags */ |
| 155 | 	long f_reserved2[2]; /* reserved for future use */ |
| 156 | 	char f_fstypename[MFSNAMELEN]; /* fs type name */ |
| 157 | 	char f_mntonname[MNAMELEN]; /* directory on which mounted */ |
| 158 | 	char f_mntfromname[MNAMELEN];/* mounted filesystem */ |
| 159 | 	char f_reserved3; /* For alignment */ |
| 160 | 	long f_reserved4[4]; /* For future use */ |
| 161 | }; |
| 162 | |
| 163 | #endif /* __DARWIN_64_BIT_INO_T */ |
| 164 | |
| 165 | #pragma pack(4) |
| 166 | |
| 167 | struct vfsstatfs { |
| 168 | 	uint32_t f_bsize; /* fundamental file system block size */ |
| 169 | 	size_t f_iosize; /* optimal transfer block size */ |
| 170 | 	uint64_t f_blocks; /* total data blocks in file system */ |
| 171 | 	uint64_t f_bfree; /* free blocks in fs */ |
| 172 | 	uint64_t f_bavail; /* free blocks avail to non-superuser */ |
| 173 | 	uint64_t f_bused; /* free blocks avail to non-superuser */ |
| 174 | 	uint64_t f_files; /* total file nodes in file system */ |
| 175 | 	uint64_t f_ffree; /* free file nodes in fs */ |
| 176 | 	fsid_t f_fsid; /* file system id */ |
| 177 | 	uid_t f_owner; /* user that mounted the filesystem */ |
| 178 | 	uint64_t f_flags; /* copy of mount exported flags */ |
| 179 | 	char f_fstypename[MFSTYPENAMELEN];/* fs type name inclus */ |
| 180 | 	char f_mntonname[MAXPATHLEN];/* directory on which mounted */ |
| 181 | 	char f_mntfromname[MAXPATHLEN];/* mounted filesystem */ |
| 182 | 	uint32_t f_fssubtype; /* fs sub-type (flavor) */ |
| 183 | 	void *f_reserved[2]; /* For future use == 0 */ |
| 184 | }; |
| 185 | |
| 186 | #pragma pack() |
| 187 | |
| 188 | |
| 189 | /* |
| 190 | * User specifiable flags. |
| 191 | * |
| 192 | * Unmount uses MNT_FORCE flag. |
| 193 | */ |
| 194 | #define MNT_RDONLY 0x00000001 /* read only filesystem */ |
| 195 | #define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */ |
| 196 | #define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */ |
| 197 | #define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */ |
| 198 | #define MNT_NODEV 0x00000010 /* don't interpret special files */ |
| 199 | #define MNT_UNION 0x00000020 /* union with underlying filesystem */ |
| 200 | #define MNT_ASYNC 0x00000040 /* file system written asynchronously */ |
| 201 | #define MNT_CPROTECT 0x00000080 /* file system supports content protection */ |
| 202 | |
| 203 | /* |
| 204 | * NFS export related mount flags. |
| 205 | */ |
| 206 | #define MNT_EXPORTED 0x00000100 /* file system is exported */ |
| 207 | |
| 208 | /* |
| 209 | * Denotes storage which can be removed from the system by the user. |
| 210 | */ |
| 211 | |
| 212 | #define MNT_REMOVABLE 0x00000200 |
| 213 | |
| 214 | /* |
| 215 | * MAC labeled / "quarantined" flag |
| 216 | */ |
| 217 | #define MNT_QUARANTINE 0x00000400 /* file system is quarantined */ |
| 218 | |
| 219 | /* |
| 220 | * Flags set by internal operations. |
| 221 | */ |
| 222 | #define MNT_LOCAL 0x00001000 /* filesystem is stored locally */ |
| 223 | #define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */ |
| 224 | #define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */ |
| 225 | #define MNT_DOVOLFS 0x00008000 /* FS supports volfs (deprecated flag in Mac OS X 10.5) */ |
| 226 | |
| 227 | |
| 228 | #define MNT_DONTBROWSE 0x00100000 /* file system is not appropriate path to user data */ |
| 229 | #define MNT_IGNORE_OWNERSHIP 0x00200000 /* VFS will ignore ownership information on filesystem objects */ |
| 230 | #define MNT_AUTOMOUNTED 0x00400000 /* filesystem was mounted by automounter */ |
| 231 | #define MNT_JOURNALED 0x00800000 /* filesystem is journaled */ |
| 232 | #define MNT_NOUSERXATTR 0x01000000 /* Don't allow user extended attributes */ |
| 233 | #define MNT_DEFWRITE 0x02000000 /* filesystem should defer writes */ |
| 234 | #define MNT_MULTILABEL 0x04000000 /* MAC support for individual labels */ |
| 235 | #define MNT_NOFOLLOW 0x08000000 /* don't follow symlink when resolving mount point */ |
| 236 | #define MNT_NOATIME 0x10000000 /* disable update of file access time */ |
| 237 | #define MNT_SNAPSHOT 0x40000000 /* The mount is a snapshot */ |
| 238 | #define MNT_STRICTATIME 0x80000000 /* enable strict update of file access time */ |
| 239 | |
| 240 | /* backwards compatibility only */ |
| 241 | #define MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP |
| 242 | |
| 243 | |
| 244 | /* |
| 245 | * XXX I think that this could now become (~(MNT_CMDFLAGS)) |
| 246 | * but the 'mount' program may need changing to handle this. |
| 247 | */ |
| 248 | #define MNT_VISFLAGMASK (MNT_RDONLY	| MNT_SYNCHRONOUS | MNT_NOEXEC	| \ |
| 249 | 	 MNT_NOSUID	| MNT_NODEV	| MNT_UNION	| \ |
| 250 | 	 MNT_ASYNC	| MNT_EXPORTED	| MNT_QUARANTINE | \ |
| 251 | 	 MNT_LOCAL	| MNT_QUOTA | MNT_REMOVABLE | \ |
| 252 | 	 MNT_ROOTFS	| MNT_DOVOLFS	| MNT_DONTBROWSE | \ |
| 253 | 	 MNT_IGNORE_OWNERSHIP | MNT_AUTOMOUNTED | MNT_JOURNALED | \ |
| 254 | 	 MNT_NOUSERXATTR | MNT_DEFWRITE	| MNT_MULTILABEL | \ |
| 255 | 	 MNT_NOFOLLOW | MNT_NOATIME | MNT_STRICTATIME | \ |
| 256 | 	 MNT_SNAPSHOT | MNT_CPROTECT) |
| 257 | /* |
| 258 | * External filesystem command modifier flags. |
| 259 | * Unmount can use the MNT_FORCE flag. |
| 260 | * XXX These are not STATES and really should be somewhere else. |
| 261 | * External filesystem control flags. |
| 262 | */ |
| 263 | #define MNT_UPDATE 0x00010000 /* not a real mount, just an update */ |
| 264 | #define MNT_NOBLOCK 0x00020000 /* don't block unmount if not responding */ |
| 265 | #define MNT_RELOAD 0x00040000 /* reload filesystem data */ |
| 266 | #define MNT_FORCE 0x00080000 /* force unmount or readonly change */ |
| 267 | #define MNT_CMDFLAGS (MNT_UPDATE|MNT_NOBLOCK|MNT_RELOAD|MNT_FORCE) |
| 268 | |
| 269 | |
| 270 | |
| 271 | /* |
| 272 | * Sysctl CTL_VFS definitions. |
| 273 | * |
| 274 | * Second level identifier specifies which filesystem. Second level |
| 275 | * identifier VFS_GENERIC returns information about all filesystems. |
| 276 | */ |
| 277 | #define VFS_GENERIC 0 /* generic filesystem information */ |
| 278 | #define VFS_NUMMNTOPS 1 /* int: total num of vfs mount/unmount operations */ |
| 279 | /* |
| 280 | * Third level identifiers for VFS_GENERIC are given below; third |
| 281 | * level identifiers for specific filesystems are given in their |
| 282 | * mount specific header files. |
| 283 | */ |
| 284 | #define VFS_MAXTYPENUM 1 /* int: highest defined filesystem type */ |
| 285 | #define VFS_CONF 2 /* struct: vfsconf for filesystem given |
| 286 | 	 * as next argument */ |
| 287 | |
| 288 | /* |
| 289 | * Flags for various system call interfaces. |
| 290 | * |
| 291 | * waitfor flags to vfs_sync() and getfsstat() |
| 292 | */ |
| 293 | #define MNT_WAIT 1 /* synchronized I/O file integrity completion */ |
| 294 | #define MNT_NOWAIT 2 /* start all I/O, but do not wait for it */ |
| 295 | #define MNT_DWAIT 4 /* synchronized I/O data integrity completion */ |
| 296 | |
| 297 | |
| 298 | /* Reserved fields preserve binary compatibility */ |
| 299 | struct vfsconf { |
| 300 | 	uint32_t vfc_reserved1; /* opaque */ |
| 301 | 	char vfc_name[MFSNAMELEN]; /* filesystem type name */ |
| 302 | 	int vfc_typenum; /* historic filesystem type number */ |
| 303 | 	int vfc_refcount; /* number mounted of this type */ |
| 304 | 	int vfc_flags; /* permanent flags */ |
| 305 | 	uint32_t vfc_reserved2; /* opaque */ |
| 306 | 	uint32_t vfc_reserved3; /* opaque */ |
| 307 | }; |
| 308 | |
| 309 | struct vfsidctl { |
| 310 | 	int vc_vers; /* should be VFSIDCTL_VERS1 (below) */ |
| 311 | 	fsid_t vc_fsid; /* fsid to operate on. */ |
| 312 | 	void *vc_ptr; /* pointer to data structure. */ |
| 313 | 	size_t vc_len; /* sizeof said structure. */ |
| 314 | 	u_int32_t vc_spare[12]; /* spare (must be zero). */ |
| 315 | }; |
| 316 | |
| 317 | |
| 318 | /* vfsidctl API version. */ |
| 319 | #define VFS_CTL_VERS1 0x01 |
| 320 | |
| 321 | |
| 322 | /* |
| 323 | * New style VFS sysctls, do not reuse/conflict with the namespace for |
| 324 | * private sysctls. |
| 325 | */ |
| 326 | #define VFS_CTL_OSTATFS 0x00010001 /* old legacy statfs */ |
| 327 | #define VFS_CTL_UMOUNT 0x00010002 /* unmount */ |
| 328 | #define VFS_CTL_QUERY 0x00010003 /* anything wrong? (vfsquery) */ |
| 329 | #define VFS_CTL_NEWADDR 0x00010004 /* reconnect to new address */ |
| 330 | #define VFS_CTL_TIMEO 0x00010005 /* set timeout for vfs notification */ |
| 331 | #define VFS_CTL_NOLOCKS 0x00010006 /* disable file locking */ |
| 332 | #define VFS_CTL_SADDR 0x00010007 /* get server address */ |
| 333 | #define VFS_CTL_DISC 0x00010008 /* server disconnected */ |
| 334 | #define VFS_CTL_SERVERINFO 0x00010009 /* information about fs server */ |
| 335 | #define VFS_CTL_NSTATUS 0x0001000A /* netfs mount status */ |
| 336 | #define VFS_CTL_STATFS64 0x0001000B /* statfs64 */ |
| 337 | |
| 338 | /* |
| 339 | * Automatically select the correct VFS_CTL_*STATFS* flavor based |
| 340 | * on what "struct statfs" layout the client will use. |
| 341 | */ |
| 342 | #if __DARWIN_64_BIT_INO_T |
| 343 | #define VFS_CTL_STATFS VFS_CTL_STATFS64 |
| 344 | #else |
| 345 | #define VFS_CTL_STATFS VFS_CTL_OSTATFS |
| 346 | #endif |
| 347 | |
| 348 | struct vfsquery { |
| 349 | 	u_int32_t vq_flags; |
| 350 | 	u_int32_t vq_spare[31]; |
| 351 | }; |
| 352 | |
| 353 | struct vfs_server { |
| 354 | 	int32_t vs_minutes; /* minutes until server goes down. */ |
| 355 | 	u_int8_t vs_server_name[MAXHOSTNAMELEN * 3]; /* UTF8 server name to display (null terminated) */ |
| 356 | }; |
| 357 | |
| 358 | /* |
| 359 | * NetFS mount status - returned by VFS_CTL_NSTATUS |
| 360 | */ |
| 361 | struct netfs_status { |
| 362 | 	u_int32_t ns_status; // Current status of mount (vfsquery flags) |
| 363 | 	char ns_mountopts[512]; // Significant mount options |
| 364 | 	uint32_t ns_waittime; // Time waiting for reply (sec) |
| 365 | 	uint32_t ns_threadcount; // Number of threads blocked on network calls |
| 366 | 	uint64_t ns_threadids[0]; // Thread IDs of those blocked threads |
| 367 | }; |
| 368 | |
| 369 | /* vfsquery flags */ |
| 370 | #define VQ_NOTRESP 0x0001 /* server down */ |
| 371 | #define VQ_NEEDAUTH 0x0002 /* server bad auth */ |
| 372 | #define VQ_LOWDISK 0x0004 /* we're low on space */ |
| 373 | #define VQ_MOUNT 0x0008 /* new filesystem arrived */ |
| 374 | #define VQ_UNMOUNT 0x0010 /* filesystem has left */ |
| 375 | #define VQ_DEAD 0x0020 /* filesystem is dead, needs force unmount */ |
| 376 | #define VQ_ASSIST 0x0040 /* filesystem needs assistance from external program */ |
| 377 | #define VQ_NOTRESPLOCK 0x0080 /* server lockd down */ |
| 378 | #define VQ_UPDATE 0x0100 /* filesystem information has changed */ |
| 379 | #define VQ_VERYLOWDISK 0x0200 /* file system has *very* little disk space left */ |
| 380 | #define VQ_SYNCEVENT 0x0400 /* a sync just happened (not set by kernel starting Mac OS X 10.9) */ |
| 381 | #define VQ_SERVEREVENT 0x0800 /* server issued notification/warning */ |
| 382 | #define VQ_QUOTA 0x1000 /* a user quota has been hit */ |
| 383 | #define VQ_NEARLOWDISK 0x2000 /* Above lowdisk and below desired disk space */ |
| 384 | #define VQ_DESIRED_DISK 0x4000 /* the desired disk space */ |
| 385 | #define VQ_FREE_SPACE_CHANGE 0x8000 /* free disk space has significantly changed */ |
| 386 | #define VQ_PURGEABLE_SPACE_CHANGE 0x10000 /* purgeable disk space has significantly changed */ |
| 387 | #define VQ_IDLE_PURGE_NOTIFY 0x20000 /* Above nearlowdisk and below desired disk space */ |
| 388 | #define VQ_FLAG40000 0x40000 /* placeholder */ |
| 389 | |
| 390 | |
| 391 | |
| 392 | /* |
| 393 | * Generic file handle |
| 394 | */ |
| 395 | #define NFS_MAX_FH_SIZE NFSV4_MAX_FH_SIZE |
| 396 | #define NFSV4_MAX_FH_SIZE 128 |
| 397 | #define NFSV3_MAX_FH_SIZE 64 |
| 398 | #define NFSV2_MAX_FH_SIZE 32 |
| 399 | struct fhandle { |
| 400 | 	unsigned int fh_len; /* length of file handle */ |
| 401 | 	unsigned char fh_data[NFS_MAX_FH_SIZE]; /* file handle value */ |
| 402 | }; |
| 403 | typedef struct fhandle fhandle_t; |
| 404 | |
| 405 | /* |
| 406 | * Cryptex authentication |
| 407 | * Note: these 2 enums are used in conjunction, graftdmg_type is used for authentication while grafting |
| 408 | * cryptexes and cryptex_auth_type is currently used for authentication while mounting generic |
| 409 | * cryptexes. We need to make sure we do not use the reserved values in each for a new authentication type. |
| 410 | */ |
| 411 | // bump up the version for any change that has kext dependency |
| 412 | #define CRYPTEX_AUTH_STRUCT_VERSION 2 |
| 413 | OS_ENUM(graftdmg_type, uint32_t, |
| 414 | GRAFTDMG_CRYPTEX_BOOT = 1, |
| 415 | GRAFTDMG_CRYPTEX_PREBOOT = 2, |
| 416 | GRAFTDMG_CRYPTEX_DOWNLEVEL = 3, |
| 417 | GRAFTDMG_CRYPTEX_AUTH_ENV_GENERIC = 4, |
| 418 | // Reserved: CRYPTEX1_AUTH_ENV_GENERIC_SUPPLEMENTAL = 5, |
| 419 | GRAFTDMG_CRYPTEX_PDI_NONCE = 6, |
| 420 | GRAFTDMG_CRYPTEX_EFFECTIVE_AP = 7, |
| 421 | GRAFTDMG_CRYPTEX_MOBILE_ASSET = 8, |
| 422 | GRAFTDMG_CRYPTEX_MOBILE_ASSET_WITH_CODE = 9, |
| 423 | // Update this when a new type is added |
| 424 | GRAFTDMG_CRYPTEX_MAX = 9); |
| 425 | |
| 426 | OS_ENUM(cryptex_auth_type, uint32_t, |
| 427 | // Reserved: GRAFTDMG_CRYPTEX_BOOT = 1, |
| 428 | // Reserved: GRAFTDMG_CRYPTEX_PREBOOT = 2, |
| 429 | // Reserved: GRAFTDMG_CRYPTEX_DOWNLEVEL = 3, |
| 430 | CRYPTEX1_AUTH_ENV_GENERIC = 4, |
| 431 | CRYPTEX1_AUTH_ENV_GENERIC_SUPPLEMENTAL = 5, |
| 432 | CRYPTEX_AUTH_PDI_NONCE = 6, |
| 433 | // Reserved: GRAFTDMG_CRYPTEX_EFFECTIVE_AP = 7, |
| 434 | CRYPTEX_AUTH_MOBILE_ASSET = 8, |
| 435 | CRYPTEX_AUTH_MOBILE_ASSET_WITH_CODE = 9, |
| 436 | // Update this when a new type is added |
| 437 | CRYPTEX_AUTH_MAX = 9); |
| 438 | |
| 439 | |
| 440 | __BEGIN_DECLS |
| 441 | int fhopen(const struct fhandle *, int); |
| 442 | int fstatfs(int, struct statfs *) __DARWIN_INODE64(fstatfs); |
| 443 | #if !__DARWIN_ONLY_64_BIT_INO_T |
| 444 | int fstatfs64(int, struct statfs64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); |
| 445 | #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ |
| 446 | int getfh(const char *, fhandle_t *); |
| 447 | int getfsstat(struct statfs *, int, int) __DARWIN_INODE64(getfsstat); |
| 448 | #if !__DARWIN_ONLY_64_BIT_INO_T |
| 449 | int getfsstat64(struct statfs64 *, int, int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); |
| 450 | #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ |
| 451 | int getmntinfo(struct statfs **, int) __DARWIN_INODE64(getmntinfo); |
| 452 | int getmntinfo_r_np(struct statfs **, int) __DARWIN_INODE64(getmntinfo_r_np) |
| 453 | __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) |
| 454 | __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); |
| 455 | #if !__DARWIN_ONLY_64_BIT_INO_T |
| 456 | int getmntinfo64(struct statfs64 **, int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); |
| 457 | #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ |
| 458 | int mount(const char *, const char *, int, void *); |
| 459 | int fmount(const char *, int, int, void *) __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); |
| 460 | int statfs(const char *, struct statfs *) __DARWIN_INODE64(statfs); |
| 461 | #if !__DARWIN_ONLY_64_BIT_INO_T |
| 462 | int statfs64(const char *, struct statfs64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); |
| 463 | #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ |
| 464 | int unmount(const char *, int); |
| 465 | int funmount(int, int) __OSX_AVAILABLE(16.0) __IOS_AVAILABLE(19.0) __TVOS_AVAILABLE(19.0) __WATCHOS_AVAILABLE(12.0); |
| 466 | int getvfsbyname(const char *, struct vfsconf *); |
| 467 | __END_DECLS |
| 468 | |
| 469 | |
| 470 | #endif /* !_SYS_MOUNT_H_ */ |