1 /* 2 * Copyright (c) 2000-2018 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 #ifndef KERNEL 80 #include <stdint.h> 81 #include <sys/ucred.h> 82 #include <sys/queue.h> /* XXX needed for user builds */ 83 #include <Availability.h> 84 #else 85 #include <sys/kernel_types.h> 86 #include <uuid/uuid.h> 87 #endif 88 89 #include <sys/_types/_fsid_t.h> /* file system id type */ 90 91 /* 92 * file system statistics 93 */ 94 95 #define MFSNAMELEN 15 /* length of fs type name, not inc. null */ 96 #define MFSTYPENAMELEN 16 /* length of fs type name including null */ 97 98 #if __DARWIN_64_BIT_INO_T 99 #define MNAMELEN MAXPATHLEN /* length of buffer for returned name */ 100 #else /* ! __DARWIN_64_BIT_INO_T */ 101 #define MNAMELEN 90 /* length of buffer for returned name */ 102 #endif /* __DARWIN_64_BIT_INO_T */ 103 104 #define MNT_EXT_ROOT_DATA_VOL 0x00000001 /* Data volume of root volume group */ 105 106 #define __DARWIN_STRUCT_STATFS64 { \ 107 uint32_t f_bsize; /* fundamental file system block size */ \ 108 int32_t f_iosize; /* optimal transfer block size */ \ 109 uint64_t f_blocks; /* total data blocks in file system */ \ 110 uint64_t f_bfree; /* free blocks in fs */ \ 111 uint64_t f_bavail; /* free blocks avail to non-superuser */ \ 112 uint64_t f_files; /* total file nodes in file system */ \ 113 uint64_t f_ffree; /* free file nodes in fs */ \ 114 fsid_t f_fsid; /* file system id */ \ 115 uid_t f_owner; /* user that mounted the filesystem */ \ 116 uint32_t f_type; /* type of filesystem */ \ 117 uint32_t f_flags; /* copy of mount exported flags */ \ 118 uint32_t f_fssubtype; /* fs sub-type (flavor) */ \ 119 char f_fstypename[MFSTYPENAMELEN]; /* fs type name */ \ 120 char f_mntonname[MAXPATHLEN]; /* directory on which mounted */ \ 121 char f_mntfromname[MAXPATHLEN]; /* mounted filesystem */ \ 122 uint32_t f_flags_ext; /* extended flags */ \ 123 uint32_t f_reserved[7]; /* For future use */ \ 124 } 125 126 #if !__DARWIN_ONLY_64_BIT_INO_T 127 128 struct statfs64 __DARWIN_STRUCT_STATFS64; 129 130 #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ 131 132 #if __DARWIN_64_BIT_INO_T 133 134 struct statfs __DARWIN_STRUCT_STATFS64; 135 136 #else /* !__DARWIN_64_BIT_INO_T */ 137 138 /* 139 * LP64 - WARNING - must be kept in sync with struct user_statfs in mount_internal.h. 140 */ 141 struct statfs { 142 short f_otype; /* TEMPORARY SHADOW COPY OF f_type */ 143 short f_oflags; /* TEMPORARY SHADOW COPY OF f_flags */ 144 long f_bsize; /* fundamental file system block size */ 145 long f_iosize; /* optimal transfer block size */ 146 long f_blocks; /* total data blocks in file system */ 147 long f_bfree; /* free blocks in fs */ 148 long f_bavail; /* free blocks avail to non-superuser */ 149 long f_files; /* total file nodes in file system */ 150 long f_ffree; /* free file nodes in fs */ 151 fsid_t f_fsid; /* file system id */ 152 uid_t f_owner; /* user that mounted the filesystem */ 153 short f_reserved1; /* spare for later */ 154 short f_type; /* type of filesystem */ 155 long f_flags; /* copy of mount exported flags */ 156 long f_reserved2[2]; /* reserved for future use */ 157 char f_fstypename[MFSNAMELEN]; /* fs type name */ 158 char f_mntonname[MNAMELEN]; /* directory on which mounted */ 159 char f_mntfromname[MNAMELEN];/* mounted filesystem */ 160 char f_reserved3; /* For alignment */ 161 long f_reserved4[4]; /* For future use */ 162 }; 163 164 #endif /* __DARWIN_64_BIT_INO_T */ 165 166 #pragma pack(4) 167 168 struct vfsstatfs { 169 uint32_t f_bsize; /* fundamental file system block size */ 170 size_t f_iosize; /* optimal transfer block size */ 171 uint64_t f_blocks; /* total data blocks in file system */ 172 uint64_t f_bfree; /* free blocks in fs */ 173 uint64_t f_bavail; /* free blocks avail to non-superuser */ 174 uint64_t f_bused; /* free blocks avail to non-superuser */ 175 uint64_t f_files; /* total file nodes in file system */ 176 uint64_t f_ffree; /* free file nodes in fs */ 177 fsid_t f_fsid; /* file system id */ 178 uid_t f_owner; /* user that mounted the filesystem */ 179 uint64_t f_flags; /* copy of mount exported flags */ 180 char f_fstypename[MFSTYPENAMELEN];/* fs type name inclus */ 181 char f_mntonname[MAXPATHLEN];/* directory on which mounted */ 182 char f_mntfromname[MAXPATHLEN];/* mounted filesystem */ 183 uint32_t f_fssubtype; /* fs sub-type (flavor) */ 184 void *f_reserved[2]; /* For future use == 0 */ 185 }; 186 187 #pragma pack() 188 189 #ifdef KERNEL 190 /* 191 * Kernel level support for the VFS_GETATTR(), VFS_SETATTR() for use in 192 * implementation of filesystem KEXTs, and by the vfs_getattr() and 193 * vfs_setattr() KPIs. 194 */ 195 196 #define VFSATTR_INIT(s) ((s)->f_supported = (s)->f_active = 0LL) 197 #define VFSATTR_SET_SUPPORTED(s, a) ((s)->f_supported |= VFSATTR_ ## a) 198 #define VFSATTR_IS_SUPPORTED(s, a) ((s)->f_supported & VFSATTR_ ## a) 199 #define VFSATTR_CLEAR_ACTIVE(s, a) ((s)->f_active &= ~VFSATTR_ ## a) 200 #define VFSATTR_IS_ACTIVE(s, a) ((s)->f_active & VFSATTR_ ## a) 201 #define VFSATTR_ALL_SUPPORTED(s) (((s)->f_active & (s)->f_supported) == (s)->f_active) 202 #define VFSATTR_WANTED(s, a) ((s)->f_active |= VFSATTR_ ## a) 203 #define VFSATTR_RETURN(s, a, x) do { (s)-> a = (x); VFSATTR_SET_SUPPORTED(s, a);} while(0) 204 205 #define VFSATTR_f_objcount (1LL<< 0) 206 #define VFSATTR_f_filecount (1LL<< 1) 207 #define VFSATTR_f_dircount (1LL<< 2) 208 #define VFSATTR_f_maxobjcount (1LL<< 3) 209 #define VFSATTR_f_bsize (1LL<< 4) 210 #define VFSATTR_f_iosize (1LL<< 5) 211 #define VFSATTR_f_blocks (1LL<< 6) 212 #define VFSATTR_f_bfree (1LL<< 7) 213 #define VFSATTR_f_bavail (1LL<< 8) 214 #define VFSATTR_f_bused (1LL<< 9) 215 #define VFSATTR_f_files (1LL<< 10) 216 #define VFSATTR_f_ffree (1LL<< 11) 217 #define VFSATTR_f_fsid (1LL<< 12) 218 #define VFSATTR_f_owner (1LL<< 13) 219 #define VFSATTR_f_capabilities (1LL<< 14) 220 #define VFSATTR_f_attributes (1LL<< 15) 221 #define VFSATTR_f_create_time (1LL<< 16) 222 #define VFSATTR_f_modify_time (1LL<< 17) 223 #define VFSATTR_f_access_time (1LL<< 18) 224 #define VFSATTR_f_backup_time (1LL<< 19) 225 #define VFSATTR_f_fssubtype (1LL<< 20) 226 #define VFSATTR_f_vol_name (1LL<< 21) 227 #define VFSATTR_f_signature (1LL<< 22) 228 #define VFSATTR_f_carbon_fsid (1LL<< 23) 229 #define VFSATTR_f_uuid (1LL<< 24) 230 #define VFSATTR_f_quota (1LL<< 25) 231 #define VFSATTR_f_reserved (1LL<< 26) 232 233 234 /* 235 * Argument structure. 236 */ 237 #pragma pack(4) 238 /* 239 * Note: the size of the vfs_attr structure can change. 240 * A kext should only reference the fields that are 241 * marked as active; it should not depend on the actual 242 * size of the structure or attempt to copy it. 243 */ 244 struct vfs_attr { 245 uint64_t f_supported; 246 uint64_t f_active; 247 248 uint64_t f_objcount; /* number of filesystem objects in volume */ 249 uint64_t f_filecount; /* ... files */ 250 uint64_t f_dircount; /* ... directories */ 251 uint64_t f_maxobjcount; /* maximum number of filesystem objects */ 252 253 uint32_t f_bsize; /* block size for the below size values */ 254 size_t f_iosize; /* optimal transfer block size */ 255 uint64_t f_blocks; /* total data blocks in file system */ 256 uint64_t f_bfree; /* free blocks in fs */ 257 uint64_t f_bavail; /* free blocks avail to non-superuser */ 258 uint64_t f_bused; /* blocks in use */ 259 uint64_t f_files; /* total file nodes in file system */ 260 uint64_t f_ffree; /* free file nodes in fs */ 261 fsid_t f_fsid; /* file system id */ 262 uid_t f_owner; /* user that mounted the filesystem */ 263 264 vol_capabilities_attr_t f_capabilities; 265 vol_attributes_attr_t f_attributes; 266 267 struct timespec f_create_time; /* creation time */ 268 struct timespec f_modify_time; /* last modification time */ 269 struct timespec f_access_time; /* time of last access */ 270 struct timespec f_backup_time; /* last backup time */ 271 272 uint32_t f_fssubtype; /* filesystem subtype */ 273 274 char *f_vol_name; /* volume name */ 275 276 uint16_t f_signature; /* used for ATTR_VOL_SIGNATURE, Carbon's FSVolumeInfo.signature */ 277 uint16_t f_carbon_fsid; /* same as Carbon's FSVolumeInfo.filesystemID */ 278 uuid_t f_uuid; /* file system UUID (version 3 or 5), available in 10.6 and later */ 279 uint64_t f_quota; /* total quota data blocks in file system */ 280 uint64_t f_reserved; /* total reserved data blocks in file system */ 281 }; 282 283 #pragma pack() 284 285 #endif /* KERNEL */ 286 287 /* 288 * User specifiable flags. 289 * 290 * Unmount uses MNT_FORCE flag. 291 */ 292 #define MNT_RDONLY 0x00000001 /* read only filesystem */ 293 #define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */ 294 #define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */ 295 #define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */ 296 #define MNT_NODEV 0x00000010 /* don't interpret special files */ 297 #define MNT_UNION 0x00000020 /* union with underlying filesystem */ 298 #define MNT_ASYNC 0x00000040 /* file system written asynchronously */ 299 #define MNT_CPROTECT 0x00000080 /* file system supports content protection */ 300 301 /* 302 * NFS export related mount flags. 303 */ 304 #define MNT_EXPORTED 0x00000100 /* file system is exported */ 305 306 /* 307 * Denotes storage which can be removed from the system by the user. 308 */ 309 310 #define MNT_REMOVABLE 0x00000200 311 312 /* 313 * MAC labeled / "quarantined" flag 314 */ 315 #define MNT_QUARANTINE 0x00000400 /* file system is quarantined */ 316 317 /* 318 * Flags set by internal operations. 319 */ 320 #define MNT_LOCAL 0x00001000 /* filesystem is stored locally */ 321 #define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */ 322 #define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */ 323 #define MNT_DOVOLFS 0x00008000 /* FS supports volfs (deprecated flag in Mac OS X 10.5) */ 324 325 326 #define MNT_DONTBROWSE 0x00100000 /* file system is not appropriate path to user data */ 327 #define MNT_IGNORE_OWNERSHIP 0x00200000 /* VFS will ignore ownership information on filesystem objects */ 328 #define MNT_AUTOMOUNTED 0x00400000 /* filesystem was mounted by automounter */ 329 #define MNT_JOURNALED 0x00800000 /* filesystem is journaled */ 330 #define MNT_NOUSERXATTR 0x01000000 /* Don't allow user extended attributes */ 331 #define MNT_DEFWRITE 0x02000000 /* filesystem should defer writes */ 332 #define MNT_MULTILABEL 0x04000000 /* MAC support for individual labels */ 333 #define MNT_NOFOLLOW 0x08000000 /* don't follow symlink when resolving mount point */ 334 #define MNT_NOATIME 0x10000000 /* disable update of file access time */ 335 #define MNT_SNAPSHOT 0x40000000 /* The mount is a snapshot */ 336 #define MNT_STRICTATIME 0x80000000 /* enable strict update of file access time */ 337 #ifdef BSD_KERNEL_PRIVATE 338 /* #define MNT_IMGSRC_BY_INDEX 0x20000000 see sys/imgsrc.h */ 339 #endif /* BSD_KERNEL_PRIVATE */ 340 341 /* backwards compatibility only */ 342 #define MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP 343 344 345 /* 346 * XXX I think that this could now become (~(MNT_CMDFLAGS)) 347 * but the 'mount' program may need changing to handle this. 348 */ 349 #define MNT_VISFLAGMASK (MNT_RDONLY | MNT_SYNCHRONOUS | MNT_NOEXEC | \ 350 MNT_NOSUID | MNT_NODEV | MNT_UNION | \ 351 MNT_ASYNC | MNT_EXPORTED | MNT_QUARANTINE | \ 352 MNT_LOCAL | MNT_QUOTA | MNT_REMOVABLE | \ 353 MNT_ROOTFS | MNT_DOVOLFS | MNT_DONTBROWSE | \ 354 MNT_IGNORE_OWNERSHIP | MNT_AUTOMOUNTED | MNT_JOURNALED | \ 355 MNT_NOUSERXATTR | MNT_DEFWRITE | MNT_MULTILABEL | \ 356 MNT_NOFOLLOW | MNT_NOATIME | MNT_STRICTATIME | \ 357 MNT_SNAPSHOT | MNT_CPROTECT) 358 /* 359 * External filesystem command modifier flags. 360 * Unmount can use the MNT_FORCE flag. 361 * XXX These are not STATES and really should be somewhere else. 362 * External filesystem control flags. 363 */ 364 #define MNT_UPDATE 0x00010000 /* not a real mount, just an update */ 365 #define MNT_NOBLOCK 0x00020000 /* don't block unmount if not responding */ 366 #define MNT_RELOAD 0x00040000 /* reload filesystem data */ 367 #define MNT_FORCE 0x00080000 /* force unmount or readonly change */ 368 #define MNT_CMDFLAGS (MNT_UPDATE|MNT_NOBLOCK|MNT_RELOAD|MNT_FORCE) 369 370 371 372 /* 373 * Sysctl CTL_VFS definitions. 374 * 375 * Second level identifier specifies which filesystem. Second level 376 * identifier VFS_GENERIC returns information about all filesystems. 377 */ 378 #define VFS_GENERIC 0 /* generic filesystem information */ 379 #define VFS_NUMMNTOPS 1 /* int: total num of vfs mount/unmount operations */ 380 /* 381 * Third level identifiers for VFS_GENERIC are given below; third 382 * level identifiers for specific filesystems are given in their 383 * mount specific header files. 384 */ 385 #define VFS_MAXTYPENUM 1 /* int: highest defined filesystem type */ 386 #define VFS_CONF 2 /* struct: vfsconf for filesystem given 387 * as next argument */ 388 389 /* 390 * Flags for various system call interfaces. 391 * 392 * waitfor flags to vfs_sync() and getfsstat() 393 */ 394 #define MNT_WAIT 1 /* synchronized I/O file integrity completion */ 395 #define MNT_NOWAIT 2 /* start all I/O, but do not wait for it */ 396 #define MNT_DWAIT 4 /* synchronized I/O data integrity completion */ 397 #ifdef KERNEL 398 /* only for VFS_SYNC */ 399 #define MNT_VOLUME 8 /* sync on a single mounted filesystem */ 400 #endif 401 402 403 #if !defined(KERNEL) && !defined(_KERN_SYS_KERNELTYPES_H_) /* also defined in kernel_types.h */ 404 struct mount; 405 typedef struct mount * mount_t; 406 struct vnode; 407 typedef struct vnode * vnode_t; 408 #endif 409 410 /* Reserved fields preserve binary compatibility */ 411 struct vfsconf { 412 uint32_t vfc_reserved1; /* opaque */ 413 char vfc_name[MFSNAMELEN]; /* filesystem type name */ 414 int vfc_typenum; /* historic filesystem type number */ 415 int vfc_refcount; /* number mounted of this type */ 416 int vfc_flags; /* permanent flags */ 417 uint32_t vfc_reserved2; /* opaque */ 418 uint32_t vfc_reserved3; /* opaque */ 419 }; 420 421 struct vfsidctl { 422 int vc_vers; /* should be VFSIDCTL_VERS1 (below) */ 423 fsid_t vc_fsid; /* fsid to operate on. */ 424 void *vc_ptr; /* pointer to data structure. */ 425 size_t vc_len; /* sizeof said structure. */ 426 u_int32_t vc_spare[12]; /* spare (must be zero). */ 427 }; 428 429 430 /* vfsidctl API version. */ 431 #define VFS_CTL_VERS1 0x01 432 433 #ifdef KERNEL 434 struct user_vfsidctl { 435 int vc_vers; /* should be VFSIDCTL_VERS1 (below) */ 436 fsid_t vc_fsid; /* fsid to operate on. */ 437 user_addr_t vc_ptr __attribute((aligned(8))); /* pointer to data structure. */ 438 user_size_t vc_len; /* sizeof said structure. */ 439 u_int32_t vc_spare[12]; /* spare (must be zero). */ 440 }; 441 442 struct user32_vfsidctl { 443 int vc_vers; /* should be VFSIDCTL_VERS1 (below) */ 444 fsid_t vc_fsid; /* fsid to operate on. */ 445 user32_addr_t vc_ptr; /* pointer to data structure. */ 446 user32_size_t vc_len; /* sizeof said structure. */ 447 u_int32_t vc_spare[12]; /* spare (must be zero). */ 448 }; 449 450 union union_vfsidctl { /* the fields vc_vers and vc_fsid are compatible */ 451 struct user32_vfsidctl vc32; 452 struct user_vfsidctl vc64; 453 }; 454 455 #endif /* KERNEL */ 456 457 /* 458 * New style VFS sysctls, do not reuse/conflict with the namespace for 459 * private sysctls. 460 */ 461 #define VFS_CTL_OSTATFS 0x00010001 /* old legacy statfs */ 462 #define VFS_CTL_UMOUNT 0x00010002 /* unmount */ 463 #define VFS_CTL_QUERY 0x00010003 /* anything wrong? (vfsquery) */ 464 #define VFS_CTL_NEWADDR 0x00010004 /* reconnect to new address */ 465 #define VFS_CTL_TIMEO 0x00010005 /* set timeout for vfs notification */ 466 #define VFS_CTL_NOLOCKS 0x00010006 /* disable file locking */ 467 #define VFS_CTL_SADDR 0x00010007 /* get server address */ 468 #define VFS_CTL_DISC 0x00010008 /* server disconnected */ 469 #define VFS_CTL_SERVERINFO 0x00010009 /* information about fs server */ 470 #define VFS_CTL_NSTATUS 0x0001000A /* netfs mount status */ 471 #define VFS_CTL_STATFS64 0x0001000B /* statfs64 */ 472 473 #ifndef KERNEL 474 /* 475 * Automatically select the correct VFS_CTL_*STATFS* flavor based 476 * on what "struct statfs" layout the client will use. 477 */ 478 #if __DARWIN_64_BIT_INO_T 479 #define VFS_CTL_STATFS VFS_CTL_STATFS64 480 #else 481 #define VFS_CTL_STATFS VFS_CTL_OSTATFS 482 #endif 483 #endif /* ! KERNEL */ 484 485 struct vfsquery { 486 u_int32_t vq_flags; 487 u_int32_t vq_spare[31]; 488 }; 489 490 struct vfs_server { 491 int32_t vs_minutes; /* minutes until server goes down. */ 492 u_int8_t vs_server_name[MAXHOSTNAMELEN * 3]; /* UTF8 server name to display (null terminated) */ 493 }; 494 495 /* 496 * NetFS mount status - returned by VFS_CTL_NSTATUS 497 */ 498 struct netfs_status { 499 u_int32_t ns_status; // Current status of mount (vfsquery flags) 500 char ns_mountopts[512]; // Significant mount options 501 uint32_t ns_waittime; // Time waiting for reply (sec) 502 uint32_t ns_threadcount; // Number of threads blocked on network calls 503 uint64_t ns_threadids[0]; // Thread IDs of those blocked threads 504 }; 505 506 /* vfsquery flags */ 507 #define VQ_NOTRESP 0x0001 /* server down */ 508 #define VQ_NEEDAUTH 0x0002 /* server bad auth */ 509 #define VQ_LOWDISK 0x0004 /* we're low on space */ 510 #define VQ_MOUNT 0x0008 /* new filesystem arrived */ 511 #define VQ_UNMOUNT 0x0010 /* filesystem has left */ 512 #define VQ_DEAD 0x0020 /* filesystem is dead, needs force unmount */ 513 #define VQ_ASSIST 0x0040 /* filesystem needs assistance from external program */ 514 #define VQ_NOTRESPLOCK 0x0080 /* server lockd down */ 515 #define VQ_UPDATE 0x0100 /* filesystem information has changed */ 516 #define VQ_VERYLOWDISK 0x0200 /* file system has *very* little disk space left */ 517 #define VQ_SYNCEVENT 0x0400 /* a sync just happened (not set by kernel starting Mac OS X 10.9) */ 518 #define VQ_SERVEREVENT 0x0800 /* server issued notification/warning */ 519 #define VQ_QUOTA 0x1000 /* a user quota has been hit */ 520 #define VQ_NEARLOWDISK 0x2000 /* Above lowdisk and below desired disk space */ 521 #define VQ_DESIRED_DISK 0x4000 /* the desired disk space */ 522 #define VQ_FREE_SPACE_CHANGE 0x8000 /* free disk space has significantly changed */ 523 #define VQ_FLAG10000 0x10000 /* placeholder */ 524 525 526 #ifdef KERNEL 527 528 /* Structure for setting device IO parameters per mount point */ 529 struct vfsioattr { 530 u_int32_t io_maxreadcnt; /* Max. byte count for read */ 531 u_int32_t io_maxwritecnt; /* Max. byte count for write */ 532 u_int32_t io_segreadcnt; /* Max. segment count for read */ 533 u_int32_t io_segwritecnt; /* Max. segment count for write */ 534 u_int32_t io_maxsegreadsize; /* Max. segment read size */ 535 u_int32_t io_maxsegwritesize; /* Max. segment write size */ 536 u_int32_t io_devblocksize; /* the underlying device block size */ 537 u_int32_t io_flags; /* flags for underlying device */ 538 union { 539 int64_t io_max_swappin_available; 540 // On 32 bit architectures, we don't have any spare 541 void *io_reserved[2]; 542 }; 543 }; 544 545 #define VFS_IOATTR_FLAGS_FUA 0x00000001 /* Write-through cache supported */ 546 #define VFS_IOATTR_FLAGS_UNMAP 0x00000002 /* Unmap (trim) supported */ 547 #define VFS_IOATTR_FLAGS_SWAPPIN_SUPPORTED 0x00000010 /* Pinning swap file supported */ 548 549 /* 550 * Filesystem Registration information 551 */ 552 #define VFS_TBLTHREADSAFE 0x0001 /* Only threadsafe filesystems are supported */ 553 #define VFS_TBLFSNODELOCK 0x0002 /* Only threadsafe filesystems are supported */ 554 #define VFS_TBLNOTYPENUM 0x0008 555 #define VFS_TBLLOCALVOL 0x0010 556 #define VFS_TBL64BITREADY 0x0020 557 #define VFS_TBLNATIVEXATTR 0x0040 558 #define VFS_TBLDIRLINKS 0x0080 559 #define VFS_TBLUNMOUNT_PREFLIGHT 0x0100 /* does a preflight check before unmounting */ 560 #define VFS_TBLGENERICMNTARGS 0x0200 /* force generic mount args for local fs */ 561 #define VFS_TBLREADDIR_EXTENDED 0x0400 /* fs supports VNODE_READDIR_EXTENDED */ 562 #define VFS_TBLNOMACLABEL 0x1000 563 #define VFS_TBLVNOP_PAGEINV2 0x2000 564 #define VFS_TBLVNOP_PAGEOUTV2 0x4000 565 #define VFS_TBLVNOP_NOUPDATEID_RENAME 0x8000 /* vfs should not call vnode_update_ident on rename */ 566 #define VFS_TBLVNOP_SECLUDE_RENAME 0x10000 567 #define VFS_TBLCANMOUNTROOT 0x20000 568 569 570 struct vfs_fsentry { 571 struct vfsops * vfe_vfsops; /* vfs operations */ 572 int vfe_vopcnt; /* # of vnodeopv_desc being registered (reg, spec, fifo ...) */ 573 struct vnodeopv_desc ** vfe_opvdescs; /* null terminated; */ 574 int vfe_fstypenum; /* historic filesystem type number */ 575 char vfe_fsname[MFSNAMELEN]; /* filesystem type name */ 576 uint32_t vfe_flags; /* defines the FS capabilities */ 577 void * vfe_reserv[2];/* reserved for future use; set this to zero*/ 578 }; 579 580 581 582 struct vfsops { 583 /*! 584 * @field vfs_mount 585 * @abstract Perform filesystem-specific operations required for mounting. 586 * @discussion Typical operations include setting the mount-specific data with vfs_setfsprivate(). 587 * Note that if a mount call fails, the filesystem must clean up any state it has constructed, because 588 * vfs-level mount code will not clean it up. 589 * @param mp Mount structure for the newly mounted filesystem. 590 * @param devvp Device that the filesystem is mounted from. 591 * @param data Filesystem-specific data passed down from userspace. 592 * @param context Context to authenticate for mount. 593 * @return 0 for success, else an error code. Once success is returned, the filesystem should be ready to go active; 594 * VFS will not ask again. 595 */ 596 int (*vfs_mount)(struct mount *mp, vnode_t devvp, user_addr_t data, vfs_context_t context); 597 598 /*! 599 * @field vfs_start 600 * @abstract Mark a mount as ready to be used. 601 * @discussion After receiving this calldown, a filesystem will be hooked into the mount list and should expect 602 * calls down from the VFS layer. 603 * @param mp Mount structure being activated. 604 * @param flags Unused. 605 * @param context Context to authenticate for mount. 606 * @return Return value is ignored. 607 */ 608 int (*vfs_start)(struct mount *mp, int flags, vfs_context_t context); 609 610 /*! 611 * @field vfs_unmount 612 * @abstract Perform filesystem-specific cleanup as part of unmount. 613 * @discussion If the unmount downcall succeeds, VFS considers itself authorized to destroy all 614 * state related to the mount. 615 * @param mp Mount structure to unmount. 616 * @param mntflags MNT_FORCE indicates that we wish to unmount even if there are active vnodes. 617 * @param context Context to authenticate for unmount. 618 * @return 0 for success, else an error code. 619 */ 620 int (*vfs_unmount)(struct mount *mp, int mntflags, vfs_context_t context); 621 622 /*! 623 * @field vfs_root 624 * @abstract Get the root vnode of a filesystem. 625 * @discussion Upon success, should return with an iocount held on the root vnode which the caller will 626 * drop with vnode_put(). 627 * @param mp Mount for which to get the root. 628 * @param vpp Destination for root vnode. 629 * @param context Context to authenticate for getting the root. 630 * @return 0 for success, else an error code. 631 */ 632 int (*vfs_root)(struct mount *mp, struct vnode **vpp, vfs_context_t context); 633 634 /*! 635 * @field vfs_quotactl 636 * @abstract Manipulate quotas for a volume. 637 * @param mp Mount for which to manipulate quotas. 638 * @param cmds Detailed in "quotactl" manual page. 639 * @param uid Detailed in "quotactl" manual page. 640 * @param arg Detailed in "quotactl" manual page. 641 * @param context Context to authenticate for changing quotas. 642 * @return 0 for success, else an error code. 643 */ 644 int (*vfs_quotactl)(struct mount *mp, int cmds, uid_t uid, caddr_t arg, vfs_context_t context); 645 646 /*! 647 * @field vfs_getattr 648 * @abstract Get filesystem attributes. 649 * @discussion See VFSATTR_RETURN, VFSATTR_ACTIVE, VFSATTR_SET_SUPPORTED, VFSATTR_WANTED macros. 650 * @param mp Mount for which to get parameters. 651 * @param vfa Container for specifying which attributes are desired and which attributes the filesystem 652 * supports, as well as for returning results. 653 * @param ctx Context to authenticate for getting filesystem attributes. 654 * @return 0 for success, else an error code. 655 */ 656 int (*vfs_getattr)(struct mount *mp, struct vfs_attr *, vfs_context_t context); 657 /* int (*vfs_statfs)(struct mount *mp, struct vfsstatfs *sbp, vfs_context_t context);*/ 658 659 /*! 660 * @field vfs_sync 661 * @abstract Flush all filesystem data to backing store. 662 * @discussion vfs_sync will be called as part of the sync() system call and during unmount. 663 * @param mp Mountpoint to sync. 664 * @param waitfor MNT_WAIT: flush synchronously, waiting for all data to be written before returning. MNT_NOWAIT: start I/O but do not wait for it. 665 * @param ctx Context to authenticate for the sync. 666 * @return 0 for success, else an error code. 667 */ 668 int (*vfs_sync)(struct mount *mp, int waitfor, vfs_context_t context); 669 670 /*! 671 * @field vfs_vget 672 * @abstract Get a vnode by file id (inode number). 673 * @discussion This routine is chiefly used to build paths to vnodes. Result should be turned with an iocount that the 674 * caller will drop with vnode_put(). 675 * @param mp Mount against which to look up inode number. 676 * @param ino File ID for desired file, as found through a readdir. 677 * @param vpp Destination for vnode. 678 * @return 0 for success, else an error code. 679 */ 680 int (*vfs_vget)(struct mount *mp, ino64_t ino, struct vnode **vpp, vfs_context_t context); 681 682 /*! 683 * @field vfs_fhtovp 684 * @abstract Get the vnode corresponding to a file handle. 685 * @discussion Filesystems can return handles to files which are independent of their (transient) vnode identities. 686 * vfs_thtovp converts that persistent handle back to a vnode. The vnode should be returned with an iocount which 687 * the caller will drop with vnode_put(). 688 * @param mp Mount against which to look up file handle. 689 * @param fhlen Size of file handle structure, as returned by vfs_vptofh. 690 * @param fhp Pointer to handle. 691 * @param vpp Destination for vnode. 692 * @param ctx Context against which to authenticate the file-handle conversion. 693 * @return 0 for success, else an error code. 694 */ 695 int (*vfs_fhtovp)(struct mount *mp, int fhlen, unsigned char *fhp, struct vnode **vpp, 696 vfs_context_t context); 697 698 /*! 699 * @field vfs_vptofh 700 * @abstract Get a persistent handle corresponding to a vnode. 701 * @param mp Mount against which to convert the vnode to a handle. 702 * @param fhlen Size of buffer provided for handle; set to size of actual handle returned. 703 * @param fhp Pointer to buffer in which to place handle data. 704 * @param ctx Context against which to authenticate the file-handle request. 705 * @return 0 for success, else an error code. 706 */ 707 int (*vfs_vptofh)(struct vnode *vp, int *fhlen, unsigned char *fhp, vfs_context_t context); 708 709 /*! 710 * @field vfs_init 711 * @abstract Prepare a filesystem for having instances mounted. 712 * @discussion This routine is called once, before any particular instance of a filesystem 713 * is mounted; it allows the filesystem to initialize whatever global data structures 714 * are shared across all mounts. If this returns successfully, a filesystem should be ready to have 715 * instances mounted. 716 * @param vfsconf Configuration information. Currently, the only useful data are the filesystem name, 717 * typenum, and flags. The flags field will be either 0 or MNT_LOCAL. Many filesystems ignore this 718 * parameter. 719 * @return 0 for success, else an error code. 720 */ 721 int (*vfs_init)(struct vfsconf *); 722 723 /*! 724 * @field vfs_sysctl 725 * @abstract Broad interface for querying and controlling filesystem. 726 * @discussion VFS defines VFS_CTL_QUERY as a generic status request which is answered 727 * with the VQ_* macros in a "struct vfsquery." 728 * A filesystem may also define implementation-specific commands. See "man 3 sysctl" 729 * for the meaning of sysctl parameters. 730 * @param context Context against which to authenticate command. 731 * @return 0 for success, else an error code. 732 */ 733 int (*vfs_sysctl)(int *, u_int, user_addr_t, size_t *, user_addr_t, size_t, vfs_context_t context); 734 735 /*! 736 * @field vfs_setattr 737 * @abstract Set filesystem attributes. 738 * @discussion The other side of the vfs_getattr coin. Currently only called to set volume name. 739 * @param mp Mount on which to set attributes. 740 * @param vfa VFS attribute structure containing requested attributes to set and their values. Currently 741 * will only be called with f_vol_name set. 742 * @param context Context against which to authenticate attribute change. 743 * @return 0 for success, else an error code. 744 */ 745 int (*vfs_setattr)(struct mount *mp, struct vfs_attr *, vfs_context_t context); 746 747 /*! 748 * @field vfs_ioctl 749 * @abstract File system control operations. 750 * @discussion Unlike vfs_sysctl, this is specific to a particular volume. 751 * @param mp The mount to execute the command on. 752 * @param command Identifier for action to take. The command used here 753 * should be in the same namespace as VNOP ioctl commands. 754 * @param data Pointer to data; this can be an integer constant (of 32 bits 755 * only) or an address to be read from or written to, depending on "command." 756 * If it is an address, it is valid and resides in the kernel; callers of 757 * VFS_IOCTL() are responsible for copying to and from userland. 758 * @param flags Reserved for future use, set to zero 759 * @param ctx Context against which to authenticate ioctl request. 760 * @return 0 for success, else an error code. 761 */ 762 int (*vfs_ioctl)(struct mount *mp, u_long command, caddr_t data, 763 int flags, vfs_context_t context); 764 765 /*! 766 * @field vfs_vget_snapdir 767 * @abstract Get the vnode for the snapshot directory of a filesystem. 768 * @discussion Upon success, should return with an iocount held on the root vnode which the caller will 769 * drop with vnode_put(). 770 * @param mp Mount for which to get the root. 771 * @param vpp Destination for snapshot directory vnode. 772 * @param context Context to authenticate for getting the snapshot directory. 773 * @return 0 for success, else an error code. 774 */ 775 int (*vfs_vget_snapdir)(struct mount *mp, struct vnode **vpp, vfs_context_t context); 776 void *vfs_reserved5; 777 void *vfs_reserved4; 778 void *vfs_reserved3; 779 void *vfs_reserved2; 780 void *vfs_reserved1; 781 }; 782 783 #ifdef KERNEL 784 785 /* 786 * Commands for vfs_ioctl. While they are encoded the same way as for ioctl(2), 787 * there is no generic interface for them from userspace like ioctl(2). 788 */ 789 struct fs_snapshot_mount_args { 790 mount_t sm_mp; 791 struct componentname *sm_cnp; 792 }; 793 794 #define VFSIOC_MOUNT_SNAPSHOT _IOW('V', 1, struct fs_snapshot_mount_args) 795 796 struct fs_snapshot_revert_args { 797 struct componentname *sr_cnp; 798 }; 799 #define VFSIOC_REVERT_SNAPSHOT _IOW('V', 2, struct fs_snapshot_revert_args) 800 801 struct fs_snapshot_root_args { 802 struct componentname *sr_cnp; 803 }; 804 #define VFSIOC_ROOT_SNAPSHOT _IOW('V', 3, struct fs_snapshot_root_args) 805 806 typedef struct fs_role_mount_args { 807 mount_t root_mp; 808 uint32_t mount_role; 809 } fs_role_mount_args_t; 810 811 OS_ENUM(vfs_roles, uint32_t, 812 VFS_SYSTEM_ROLE = 1, 813 VFS_RECOVERY_ROLE = 4, 814 VFS_VM_ROLE = 8, 815 VFS_PREBOOT_ROLE = 16, 816 VFS_DATA_ROLE = 64); 817 818 #define VFSIOC_MOUNT_BYROLE _IOW('V', 4, fs_role_mount_args_t) 819 820 // When this is defined, it is safe to use VFS_RECOVERY_ROLE and 821 // VFS_PREBOOT_ROLE. 822 #define VFSIOC_MOUNT_BYROLE_has_recovery 1 823 824 #endif /* KERNEL */ 825 826 /* 827 * flags passed into vfs_iterate 828 */ 829 #ifdef PRIVATE 830 #define VFS_ITERATE_TAIL_FIRST (1 << 0) 831 #define VFS_ITERATE_CB_DROPREF (1 << 1) // Callback will drop the iterref 832 #define VFS_ITERATE_NOSKIP_UNMOUNT (1 << 2) /* Callback will be made on FS in unmount. 833 * The callback cannot make any calls 834 * into the Filesystem when this is set. */ 835 #endif /* PRIVATE */ 836 837 /* 838 * return values from callback 839 */ 840 #define VFS_RETURNED 0 /* done with vnode, reference can be dropped */ 841 #define VFS_RETURNED_DONE 1 /* done with vnode, reference can be dropped, terminate iteration */ 842 #define VFS_CLAIMED 2 /* don't drop reference */ 843 #define VFS_CLAIMED_DONE 3 /* don't drop reference, terminate iteration */ 844 845 846 __BEGIN_DECLS 847 #ifdef BSD_KERNEL_PRIVATE 848 extern int VFS_MOUNT(mount_t, vnode_t, user_addr_t, vfs_context_t); 849 extern int VFS_START(mount_t, int, vfs_context_t); 850 extern int VFS_UNMOUNT(mount_t, int, vfs_context_t); 851 extern int VFS_ROOT(mount_t, vnode_t *, vfs_context_t); 852 extern int VFS_QUOTACTL(mount_t, int, uid_t, caddr_t, vfs_context_t); 853 extern int VFS_GETATTR(mount_t, struct vfs_attr *, vfs_context_t); 854 extern int VFS_SETATTR(mount_t, struct vfs_attr *, vfs_context_t); 855 extern int VFS_SYNC(mount_t, int, vfs_context_t); 856 extern int VFS_VGET(mount_t, ino64_t, vnode_t *, vfs_context_t); 857 extern int VFS_FHTOVP(mount_t, int, unsigned char *, vnode_t *, vfs_context_t); 858 extern int VFS_VPTOFH(vnode_t, int *, unsigned char *, vfs_context_t); 859 extern int VFS_IOCTL(mount_t mp, u_long command, caddr_t data, 860 int flags, vfs_context_t context); 861 extern int VFS_VGET_SNAPDIR(mount_t, vnode_t *, vfs_context_t); 862 #endif /* BSD_KERNEL_PRIVATE */ 863 /* 864 * prototypes for exported VFS operations 865 */ 866 867 /*! 868 * @function vfs_fsadd 869 * @abstract Register a filesystem with VFS. 870 * @discussion Typically called by a filesystem Kernel Extension when it is loaded. 871 * @param vfe Filesystem information: table of vfs operations, list of vnode operation tables, 872 * filesystem type number (can be omitted with VFS_TBLNOTYPENUM flag), name, flags. 873 * @param handle Opaque handle which will be passed to vfs_fsremove. 874 * @return 0 for success, else an error code. 875 */ 876 int vfs_fsadd(struct vfs_fsentry *vfe, vfstable_t *handle); 877 878 /*! 879 * @function vfs_fsremove 880 * @abstract Unregister a filesystem with VFS. 881 * @discussion Typically called by a filesystem Kernel Extension when it is unloaded. 882 * @param handle Handle which was returned by vfs_fsadd. 883 * @return 0 for success, else an error code. 884 */ 885 int vfs_fsremove(vfstable_t handle); 886 887 /*! 888 * @function vfs_iterate 889 * @abstract Iterate over all mountpoints with a callback. Used, for example, by sync(). 890 * @param flags Unused. 891 * @param callout Function which takes a mount and arbitrary passed-in "arg," and returns one of VFS_RETURNED_DONE or VFS_CLAIMED_DONE: end 892 * iteration and return success. VFS_RETURNED or VFS_CLAIMED: continue iterating. Anything else: continue iterating. 893 * @param arg Arbitrary data to pass to callback. 894 * @return 0 for success, else an error code. 895 */ 896 int vfs_iterate(int flags, int (*callout)(struct mount *, void *), void *arg); 897 898 /*! 899 * @function vfs_init_io_attributes 900 * @abstract Set I/O attributes on a mountpoint based on device properties. 901 * @param devvp Block device vnode from which a filesystem is being mounted. 902 * @param mp Mountpoint whose I/O parameters to initialize. 903 * @return 0 for success, else an error code. 904 */ 905 int vfs_init_io_attributes(vnode_t devvp, mount_t mp); 906 907 /*! 908 * @function vfs_flags 909 * @abstract Retrieve mount flags. 910 * @discussion Results will be in the bitwise "OR" of MNT_VISFLAGMASK and MNT_CMDFLAGS. 911 * @param mp Mount whose flags to grab. 912 * @return Flags. 913 */ 914 uint64_t vfs_flags(mount_t mp); 915 916 /*! 917 * @function vfs_setflags 918 * @abstract Set flags on a mount. 919 * @discussion Sets mount flags to the bitwise "OR" of their current value and the specified bits. Often 920 * used by a filesystem as part of the mount process. 921 * @param mp Mount whose flags to set. 922 * @param flags Flags to activate. Must be in the bitwise "OR" of MNT_VISFLAGMASK and MNT_CMDFLAGS. 923 */ 924 void vfs_setflags(mount_t mp, uint64_t flags); 925 926 /*! 927 * @function vfs_clearflags 928 * @abstract Clear flags on a mount. 929 * @discussion Sets mount flags to the bitwise "AND" of their current value and the complement of the specified bits. 930 * @param mp Mount whose flags to set. 931 * @param flags Flags to deactivate. Must be in the bitwise "OR" of MNT_VISFLAGMASK and MNT_CMDFLAGS. 932 */ 933 void vfs_clearflags(mount_t mp, uint64_t flags); 934 935 /*! 936 * @function vfs_issynchronous 937 * @abstract Determine if writes to a filesystem occur synchronously. 938 * @param mp Mount to test. 939 * @return Nonzero if writes occur synchronously, else 0. 940 */ 941 int vfs_issynchronous(mount_t mp); 942 943 /*! 944 * @function vfs_iswriteupgrade 945 * @abstract Determine if a filesystem is mounted read-only but a request has been made to upgrade 946 * to read-write. 947 * @param mp Mount to test. 948 * @return Nonzero if a request has been made to update from read-only to read-write, else 0. 949 */ 950 int vfs_iswriteupgrade(mount_t mp); 951 952 /*! 953 * @function vfs_isupdate 954 * @abstract Determine if a mount update is in progress. 955 * @param mp Mount to test. 956 * @return Nonzero if a mount update is in progress, 0 otherwise. 957 */ 958 int vfs_isupdate(mount_t mp); 959 960 /*! 961 * @function vfs_isreload 962 * @abstract Determine if a reload of filesystem data is in progress. This can only be the case 963 * for a read-only filesystem; all data is brought in from secondary storage. 964 * @param mp Mount to test. 965 * @return Nonzero if a request has been made to reload data, else 0. 966 */ 967 int vfs_isreload(mount_t mp); 968 969 /*! 970 * @function vfs_isforce 971 * @abstract Determine if a forced unmount is in progress. 972 * @discussion A forced unmount invalidates open files. 973 * @param mp Mount to test. 974 * @return Nonzero if a request has been made to forcibly unmount, else 0. 975 */ 976 int vfs_isforce(mount_t mp); 977 978 /*! 979 * @function vfs_isunmount 980 * @abstract Determine if an unmount is in progress. 981 * @discussion This is an unsynchronized snapshot of the mount state. It should only be called 982 * if the mount is known to be valid, e.g. there are known to be live files on that volume. 983 * @param mp Mount to test. 984 * @return Nonzero if an unmount is in progress, else zero. 985 */ 986 int vfs_isunmount(mount_t mp); 987 988 /*! 989 * @function vfs_isrdonly 990 * @abstract Determine if a filesystem is mounted read-only. 991 * @param mp Mount to test. 992 * @return Nonzero if filesystem is mounted read-only, else 0. 993 */ 994 int vfs_isrdonly(mount_t mp); 995 996 /*! 997 * @function vfs_isrdwr 998 * @abstract Determine if a filesystem is mounted with writes enabled. 999 * @param mp Mount to test. 1000 * @return Nonzero if filesystem is mounted read-write, else 0. 1001 */ 1002 int vfs_isrdwr(mount_t mp); 1003 1004 /*! 1005 * @function vfs_authopaque 1006 * @abstract Determine if a filesystem's authorization decisions occur remotely. 1007 * @param mp Mount to test. 1008 * @return Nonzero if filesystem authorization is controlled remotely, else 0. 1009 */ 1010 int vfs_authopaque(mount_t mp); 1011 1012 /*! 1013 * @function vfs_authopaqueaccess 1014 * @abstract Check if a filesystem is marked as having reliable remote VNOP_ACCESS support. 1015 * @param mp Mount to test. 1016 * @return Nonzero if VNOP_ACCESS is supported remotely, else 0. 1017 */ 1018 int vfs_authopaqueaccess(mount_t mp); 1019 1020 /*! 1021 * @function vfs_setauthopaque 1022 * @abstract Mark a filesystem as having authorization decisions controlled remotely. 1023 * @param mp Mount to mark. 1024 */ 1025 void vfs_setauthopaque(mount_t mp); 1026 1027 /*! 1028 * @function vfs_setauthopaqueaccess 1029 * @abstract Mark a filesystem as having remote VNOP_ACCESS support. 1030 * @param mp Mount to mark. 1031 */ 1032 void vfs_setauthopaqueaccess(mount_t mp); 1033 1034 /*! 1035 * @function vfs_clearauthopaque 1036 * @abstract Mark a filesystem as not having remote authorization decisions. 1037 * @param mp Mount to mark. 1038 */ 1039 void vfs_clearauthopaque(mount_t mp); 1040 1041 /*! 1042 * @function vfs_clearauthopaque 1043 * @abstract Mark a filesystem as not having remote VNOP_ACCESS support. 1044 * @param mp Mount to mark. 1045 */ 1046 void vfs_clearauthopaqueaccess(mount_t mp); 1047 1048 /*! 1049 * @function vfs_setextendedsecurity 1050 * @abstract Mark a filesystem as supporting security controls beyond POSIX permissions. 1051 * @discussion Specific controls include ACLs, file owner UUIDs, and group UUIDs. 1052 * @param mp Mount to test. 1053 */ 1054 void vfs_setextendedsecurity(mount_t mp); 1055 1056 /*! 1057 * @function vfs_clearextendedsecurity 1058 * @abstract Mark a filesystem as NOT supporting security controls beyond POSIX permissions. 1059 * @discussion Specific controls include ACLs, file owner UUIDs, and group UUIDs. 1060 * @param mp Mount to test. 1061 */ 1062 void vfs_clearextendedsecurity(mount_t mp); 1063 1064 /*! 1065 * @function vfs_setnoswap 1066 * @abstract Mark a filesystem as unable to use swap files. 1067 * @param mp Mount to mark. 1068 */ 1069 #ifdef KERNEL_PRIVATE 1070 void vfs_setnoswap(mount_t mp); 1071 #endif 1072 1073 /*! 1074 * @function vfs_clearnoswap 1075 * @abstract Mark a filesystem as capable of using swap files. 1076 * @param mp Mount to mark. 1077 */ 1078 #ifdef KERNEL_PRIVATE 1079 void vfs_clearnoswap(mount_t mp); 1080 #endif 1081 1082 /*! 1083 * @function vfs_setlocklocal 1084 * @abstract Mark a filesystem as using VFS-level advisory locking support. 1085 * @discussion Advisory locking operations will not call down to the filesystem if this flag is set. 1086 * @param mp Mount to mark. 1087 */ 1088 void vfs_setlocklocal(mount_t mp); 1089 1090 /*! 1091 * @function vfs_authcache_ttl 1092 * @abstract Determine the time-to-live of cached authorized credentials for files in this filesystem. 1093 * @discussion If a filesystem is set to allow caching credentials, the VFS layer can authorize 1094 * previously-authorized actions from the same vfs_context_t without calling down to the filesystem (though 1095 * it will not deny based on the cache). 1096 * @param mp Mount for which to check cache lifetime. 1097 * @return Cache lifetime in seconds. CACHED_RIGHT_INFINITE_TTL indicates that credentials never expire. 1098 */ 1099 int vfs_authcache_ttl(mount_t mp); 1100 1101 /*! 1102 * @function vfs_setauthcache_ttl 1103 * @abstract Enable credential caching and set time-to-live of cached authorized credentials for files in this filesystem. 1104 * @discussion If a filesystem is set to allow caching credentials, the VFS layer can authorize 1105 * previously-authorized actions from the same vfs_context_t without calling down to the filesystem (though 1106 * it will not deny based on the cache). 1107 * @param mp Mount for which to set cache lifetime. 1108 */ 1109 void vfs_setauthcache_ttl(mount_t mp, int ttl); 1110 1111 /*! 1112 * @function vfs_clearauthcache_ttl 1113 * @abstract Remove time-to-live controls for cached credentials on a filesytem. Filesystems with remote authorization 1114 * decisions (opaque) will still have KAUTH_VNODE_SEARCH rights cached for a default of CACHED_LOOKUP_RIGHT_TTL seconds. 1115 * @param mp Mount for which to clear cache lifetime. 1116 */ 1117 void vfs_clearauthcache_ttl(mount_t mp); 1118 1119 /* 1120 * return value from vfs_cachedrights_ttl if 1121 * neither MNTK_AUTH_OPAQUE | MNTK_AUTH_CACHE_TTL 1122 * is set in mnt_kern_flag.. it indicates 1123 * that no TTL is being applied to the vnode rights cache 1124 */ 1125 #define CACHED_RIGHT_INFINITE_TTL ~0 1126 1127 /*! 1128 * @function vfs_maxsymlen 1129 * @abstract Get the maximum length of a symbolic link on a filesystem. 1130 * @param mp Mount from which to get symlink length cap. 1131 * @return Max symlink length. 1132 */ 1133 uint32_t vfs_maxsymlen(mount_t mp); 1134 1135 /*! 1136 * @function vfs_setmaxsymlen 1137 * @abstract Set the maximum length of a symbolic link on a filesystem. 1138 * @param mp Mount on which to set symlink length cap. 1139 * @param symlen Length to set. 1140 */ 1141 void vfs_setmaxsymlen(mount_t mp, uint32_t symlen); 1142 1143 /*! 1144 * @function vfs_fsprivate 1145 * @abstract Get filesystem-private mount data. 1146 * @discussion A filesystem generally has an internal mount structure which it attaches to the VFS-level mount structure 1147 * as part of the mounting process. 1148 * @param mp Mount for which to get private data. 1149 * @return Private data. 1150 */ 1151 void * vfs_fsprivate(mount_t mp); 1152 1153 /*! 1154 * @function vfs_setfsprivate 1155 * @abstract Set filesystem-private mount data. 1156 * @discussion A filesystem generally has an internal mount structure which it attaches to the VFS-level mount structure 1157 * as part of the mounting process. 1158 * @param mp Mount for which to set private data. 1159 */ 1160 void vfs_setfsprivate(mount_t mp, void *mntdata); 1161 1162 /*! 1163 * @function vfs_statfs 1164 * @abstract Get information about filesystem status. 1165 * @discussion Each filesystem has a struct vfsstatfs associated with it which is updated as events occur; this function 1166 * returns a pointer to it. Note that the data in the structure will continue to change over time and also that it may 1167 * be quite stale if vfs_update_vfsstat has not been called recently. 1168 * @param mp Mount for which to get vfsstatfs pointer. 1169 * @return Pointer to vfsstatfs. 1170 */ 1171 struct vfsstatfs * vfs_statfs(mount_t mp); 1172 #define VFS_USER_EVENT 0 1173 #define VFS_KERNEL_EVENT 1 1174 1175 /*! 1176 * @function vfs_update_vfsstat 1177 * @abstract Update cached filesystem status information in the VFS mount structure. 1178 * @discussion Each filesystem has a struct vfsstatfs associated with it which is updated as events occur; this function 1179 * updates it so that the structure pointer returned by vfs_statfs() returns a pointer to fairly recent data. 1180 * @param mp Mount for which to update cached status information. 1181 * @param ctx Context to authenticate against for call down to filesystem. 1182 * @param eventtype VFS_USER_EVENT: need for update is driven by user-level request; perform additional authentication. 1183 * VFS_KERNEL_EVENT: need for update is driven by in-kernel events. Skip extra authentication. 1184 * @return 0 for success, or an error code for authentication failure or problem with call to filesystem to 1185 * request information. 1186 */ 1187 int vfs_update_vfsstat(mount_t mp, vfs_context_t ctx, int eventtype); 1188 1189 /*! 1190 * @function vfs_typenum 1191 * @abstract Get (archaic) filesystem type number. 1192 * @discussion Filesystem type numbers are an old construct; most filesystems just get a number assigned based on 1193 * the order in which they are registered with the system. 1194 * @param mp Mount for which to get type number. 1195 * @return Type number. 1196 */ 1197 int vfs_typenum(mount_t mp); 1198 1199 /*! 1200 * @function vfs_name 1201 * @abstract Copy filesystem name into a buffer. 1202 * @discussion Get filesystem name; this refers to the filesystem type of which a mount is an instantiation, 1203 * rather than a name specific to the mountpoint. 1204 * @param mp Mount for which to get name. 1205 * @param buffer Destination for name; length should be at least MFSNAMELEN. 1206 */ 1207 void vfs_name(mount_t mp, char *buffer); 1208 1209 /*! 1210 * @function vfs_devblocksize 1211 * @abstract Get the block size of the device underlying a mount. 1212 * @param mp Mount for which to get block size. 1213 * @return Block size. 1214 */ 1215 int vfs_devblocksize(mount_t mp); 1216 1217 /*! 1218 * @function vfs_ioattr 1219 * @abstract Get I/O attributes associated with a mounpoint. 1220 * @param mp Mount for which to get attributes. If NULL, system defaults are filled into ioattrp. 1221 * @param ioattrp Destination for results. 1222 */ 1223 void vfs_ioattr(mount_t mp, struct vfsioattr *ioattrp); 1224 1225 /*! 1226 * @function vfs_setioattr 1227 * @abstract Set I/O attributes associated with a mounpoint. 1228 * @param mp Mount for which to set attributes. 1229 * @param ioattrp Structure containing I/O parameters; all fields must be filled in. 1230 */ 1231 void vfs_setioattr(mount_t mp, struct vfsioattr *ioattrp); 1232 1233 /*! 1234 * @function vfs_64bitready 1235 * @abstract Check if the filesystem associated with a mountpoint is marked ready for interaction with 64-bit user processes. 1236 * @param mp Mount to test. 1237 * @return Nonzero if filesystem is ready for 64-bit; 0 otherwise. 1238 */ 1239 int vfs_64bitready(mount_t mp); 1240 1241 1242 #define LK_NOWAIT 1 1243 /*! 1244 * @function vfs_busy 1245 * @abstract "Busy" a mountpoint. 1246 * @discussion vfs_busy() will "busy" a mountpoint, preventing unmounts from taking off, by taking its reader-writer lock 1247 * in a shared manner. If a mount is dead, 1248 * it will fail; if an unmount is in progress, depending on flags, it will either fail immediately or block 1249 * until the unmount completes (then failing if the unmount has succeeded, or potentially succeeding if unmounting failed). 1250 * A successful vfs_busy() must be followed by a vfs_unbusy() to release the lock on the mount. 1251 * @param mp Mount to busy. 1252 * @param flags LK_NOWAIT: fail with ENOENT if an unmount is in progress. 1253 * @return 0 for success, with a lock held; an error code otherwise, with no lock held. 1254 */ 1255 int vfs_busy(mount_t mp, int flags); 1256 1257 /*! 1258 * @function vfs_unbusy 1259 * @abstract "Unbusy" a mountpoint by releasing its read-write lock. 1260 * @discussion A successful vfs_busy() must be followed by a vfs_unbusy() to release the lock on the mount. 1261 * @param mp Mount to unbusy. 1262 */ 1263 void vfs_unbusy(mount_t mp); 1264 1265 /*! 1266 * @function vfs_getnewfsid 1267 * @abstract Generate a unique filesystem ID for a mount and store it in the mount structure. 1268 * @discussion Filesystem IDs are returned as part of "struct statfs." This function is typically 1269 * called as part of file-system specific mount code (i.e. through VFS_MOUNT). 1270 * @param mp Mount to set an ID for. 1271 */ 1272 void vfs_getnewfsid(struct mount *mp); 1273 1274 /*! 1275 * @function vfs_getvfs 1276 * @abstract Given a filesystem ID, look up a mount structure. 1277 * @param fsid Filesystem ID to look up. 1278 * @return Mountpoint if found, else NULL. Note unmounting mountpoints can be returned. 1279 */ 1280 mount_t vfs_getvfs(fsid_t *fsid); 1281 1282 /*! 1283 * @function vfs_mountedon 1284 * @abstract Check whether a given block device has a filesystem mounted on it. 1285 * @discussion Note that this is NOT a check for a covered vnode (the directory upon which 1286 * a filesystem is mounted)--it is a test for whether a block device is being used as the source 1287 * of a filesystem. Note that a block device marked as being mounted on cannot be opened. 1288 * @param vp The vnode to test. 1289 * @return EBUSY if vnode is indeed the source of a filesystem; 0 if it is not. 1290 */ 1291 int vfs_mountedon(struct vnode *vp); 1292 1293 /*! 1294 * @function vfs_unmountbyfsid 1295 * @abstract Find a filesystem by ID and unmount it. 1296 * @param fsid ID of filesystem to unmount, as found through (for example) statfs. 1297 * @param flags MNT_FORCE: forcibly invalidate files open on the mount (though in-flight I/O operations 1298 * will be allowed to complete). 1299 * @param ctx Context against which to authenticate unmount operation. 1300 * @return 0 for succcess, nonero for failure. 1301 */ 1302 int vfs_unmountbyfsid(fsid_t *fsid, int flags, vfs_context_t ctx); 1303 1304 /*! 1305 * @function vfs_event_signal 1306 * @abstract Post a kqueue-style event on a filesystem (EVFILT_FS). 1307 * @param fsid Unused. 1308 * @param event Events to post. 1309 * @param data Unused. 1310 */ 1311 void vfs_event_signal(fsid_t *fsid, u_int32_t event, intptr_t data); 1312 1313 /*! 1314 * @function vfs_event_init 1315 * @abstract This function should not be called by kexts. 1316 */ 1317 void vfs_event_init(void); /* XXX We should not export this */ 1318 1319 /*! 1320 * @function vfs_set_root_unmount_cleanly 1321 * @abstract This function should be called by the root file system 1322 * when it is being mounted if the file system state is consistent. 1323 */ 1324 void vfs_set_root_unmounted_cleanly(void); 1325 1326 #ifdef KERNEL_PRIVATE 1327 int vfs_getbyid(fsid_t *fsid, ino64_t ino, vnode_t *vpp, vfs_context_t ctx); 1328 int vfs_getattr(mount_t mp, struct vfs_attr *vfa, vfs_context_t ctx); 1329 int vfs_setattr(mount_t mp, struct vfs_attr *vfa, vfs_context_t ctx); 1330 int vfs_extendedsecurity(mount_t); 1331 mount_t vfs_getvfs_by_mntonname(char *); 1332 vnode_t vfs_vnodecovered(mount_t mp); /* Returns vnode with an iocount that must be released with vnode_put() */ 1333 vnode_t vfs_devvp(mount_t mp); /* Please see block comment with implementation */ 1334 int vfs_nativexattrs(mount_t mp); /* whether or not the FS supports EAs natively */ 1335 void * vfs_mntlabel(mount_t mp); /* Safe to cast to "struct label*"; returns "void*" to limit dependence of mount.h on security headers. */ 1336 void vfs_setcompoundopen(mount_t mp); 1337 uint64_t vfs_throttle_mask(mount_t mp); 1338 int vfs_isswapmount(mount_t mp); 1339 int vfs_context_dataless_materialization_is_prevented(vfs_context_t); 1340 boolean_t vfs_context_is_dataless_manipulator(vfs_context_t); 1341 boolean_t vfs_context_can_resolve_triggers(vfs_context_t); 1342 void vfs_setmntsystem(mount_t mp); 1343 void vfs_setmntsystemdata(mount_t mp); 1344 void vfs_setmntswap(mount_t mp); 1345 boolean_t vfs_is_basesystem(mount_t mp); 1346 boolean_t vfs_iskernelmount(mount_t mp); 1347 1348 OS_ENUM(bsd_bootfail_mode, uint32_t, 1349 BSD_BOOTFAIL_SEAL_BROKEN = 1, 1350 BSD_BOOTFAIL_MEDIA_MISSING = 2); 1351 1352 boolean_t bsd_boot_to_recovery(bsd_bootfail_mode_t mode, uuid_t volume_uuid, boolean_t reboot); 1353 1354 struct vnode_trigger_info; 1355 1356 /*! 1357 * @function vfs_addtrigger 1358 * @abstract Create an "external" trigger vnode: look up a vnode and mark it as 1359 * a trigger. Can only safely be called in the context of a callback set by 1360 * vfs_settriggercallback(). May only be used on a file which is not already 1361 * marked as a trigger. 1362 * @param relpath Path relative to root of mountpoint at which to mark trigger. 1363 * @param vtip Information about trigger; analogous to "vnode_trigger_param" 1364 * argument to vnode_create. 1365 * @param ctx Authorization context. 1366 */ 1367 int vfs_addtrigger(mount_t mp, const char *relpath, struct vnode_trigger_info *vtip, vfs_context_t ctx); 1368 1369 1370 /*! 1371 * @enum vfs_trigger_callback_op_t 1372 * @abstract Operation to perform after an attempted unmount (successful or otherwise). 1373 * @constant VTC_REPLACE Unmount failed: attempt to replace triggers. Only valid 1374 * VFS operation to perform in this context is vfs_addtrigger(). 1375 * @constant VTC_RELEASE Unmount succeeded: release external triggering context. 1376 */ 1377 typedef enum { 1378 VTC_REPLACE, 1379 VTC_RELEASE 1380 } vfs_trigger_callback_op_t; 1381 1382 /*! 1383 * @typedef vfs_trigger_callback_t 1384 * @abstract Callback to be passed to vfs_settriggercallback() and invoked from 1385 * unmount context. 1386 * @param mp Mountpoint on which unmount is occurring. 1387 * @param op Operation (see vfs_trigger_callback_op_t) 1388 * @param data Context passed to vfs_settriggercallback() 1389 * @param ctx Authorization context in which unmount is occurring. 1390 */ 1391 typedef void vfs_trigger_callback_t(mount_t mp, vfs_trigger_callback_op_t op, void *data, vfs_context_t ctx); 1392 1393 /*! 1394 * @function vfs_settriggercallback 1395 * @abstract Install a callback to be called after unmount attempts on a volume, 1396 * to restore triggers for failed unmounts and release state for successful ones. 1397 * @discussion Installs a callback which will be called in two situations: a 1398 * failed unmount where vnodes may have been reclaimed and a successful unmount. 1399 * Gives an external trigger-marking entity an opportunity to replace triggers 1400 * which may have been reclaimed. The callback can only be installed (not 1401 * cleared), and only one callback can be installed. The callback will be called 1402 * with a read-write lock held on the mount point; in the VTC_REPLACE case, the 1403 * <em>only</em> valid VFS operation to perform in the context of the callback is 1404 * vfs_addtrigger() on the mountpoint in question. This rwlock is held in order 1405 * to attempt to provide some modicum of coverage from lookups which might find 1406 * missing trigger vnodes and receive spurious ENOENTs. Note that this 1407 * protection is incomplete--current working directories, or traversals up into a 1408 * volume via ".." may still find missing triggers. As of this writing, no 1409 * serialization mechanism exists to do better than this. 1410 * When the "op" is VTC_RELEASE, the mountpoint is going away, and the only valid 1411 * VFS operation is to free the private data pointer if needed. The callback 1412 * will be called immediately, with VTC_REPLACE, from vfs_settriggercallback(), 1413 * if installation is successful. 1414 * @param fsid FSID for filesystem in question. 1415 * @param vtc Callback pointer. 1416 * @param data Context pointer to be passed to callback. 1417 * @param flags Currently unused. 1418 * @param ctx Authorization context. 1419 * @return 0 for success. EBUSY if a trigger has already been installed. 1420 */ 1421 int vfs_settriggercallback(fsid_t *fsid, vfs_trigger_callback_t vtc, void *data, uint32_t flags, vfs_context_t ctx); 1422 1423 /* tags a volume as not supporting extended readdir for NFS exports */ 1424 void mount_set_noreaddirext(mount_t); 1425 1426 /*! 1427 * @function vfs_get_statfs64 1428 * @abstract Get the same information as vfs_statfs(), but in a format suitable 1429 * for copying to userland. 1430 */ 1431 void vfs_get_statfs64(struct mount *mp, struct statfs64 *sfs); 1432 1433 /*! 1434 * @function vfs_mount_id 1435 * @abstract Retrieve the system-wide unique mount ID for a mount point. 1436 * The ID is generated at mount and does not change on remount. 1437 * @param mp Mountpoint for which to get the mount ID. 1438 */ 1439 uint64_t vfs_mount_id(mount_t mp); 1440 1441 /*! 1442 * @function vfs_mount_at_path 1443 * @abstract A wrapper around kernel_mount() to be used only in special 1444 * circumstances. 1445 */ 1446 int vfs_mount_at_path(const char *fstype, const char *path, 1447 vnode_t pvp, vnode_t vp, void *data, size_t datalen, int mnt_flags, 1448 int flags); 1449 1450 /*! 1451 * @function vfs_mount_override_type_name 1452 * @abstract override the fstypename for statfs. 1453 * @param mp Mountpint for which to override the type name. 1454 * @param name Name to override. 1455 */ 1456 int vfs_mount_override_type_name(mount_t mp, const char *name); 1457 1458 #define VFS_MOUNT_FLAG_NOAUTH 0x01 /* Don't check the UID of the directory we are mounting on */ 1459 #define VFS_MOUNT_FLAG_PERMIT_UNMOUNT 0x02 /* Allow (non-forced) unmounts by users other the one who mounted the volume */ 1460 1461 #endif /* KERNEL_PRIVATE */ 1462 __END_DECLS 1463 1464 #endif /* KERNEL */ 1465 1466 /* 1467 * Generic file handle 1468 */ 1469 #define NFS_MAX_FH_SIZE NFSV4_MAX_FH_SIZE 1470 #define NFSV4_MAX_FH_SIZE 128 1471 #define NFSV3_MAX_FH_SIZE 64 1472 #define NFSV2_MAX_FH_SIZE 32 1473 struct fhandle { 1474 unsigned int fh_len; /* length of file handle */ 1475 unsigned char fh_data[NFS_MAX_FH_SIZE]; /* file handle value */ 1476 }; 1477 typedef struct fhandle fhandle_t; 1478 1479 1480 #ifndef KERNEL 1481 1482 __BEGIN_DECLS 1483 int fhopen(const struct fhandle *, int); 1484 int fstatfs(int, struct statfs *) __DARWIN_INODE64(fstatfs); 1485 #if !__DARWIN_ONLY_64_BIT_INO_T 1486 int fstatfs64(int, struct statfs64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); 1487 #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ 1488 int getfh(const char *, fhandle_t *); 1489 int getfsstat(struct statfs *, int, int) __DARWIN_INODE64(getfsstat); 1490 #if !__DARWIN_ONLY_64_BIT_INO_T 1491 int getfsstat64(struct statfs64 *, int, int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); 1492 #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ 1493 int getmntinfo(struct statfs **, int) __DARWIN_INODE64(getmntinfo); 1494 int getmntinfo_r_np(struct statfs **, int) __DARWIN_INODE64(getmntinfo_r_np) 1495 __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) 1496 __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); 1497 #if !__DARWIN_ONLY_64_BIT_INO_T 1498 int getmntinfo64(struct statfs64 **, int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); 1499 #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ 1500 int mount(const char *, const char *, int, void *); 1501 int fmount(const char *, int, int, void *) __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); 1502 int statfs(const char *, struct statfs *) __DARWIN_INODE64(statfs); 1503 #if !__DARWIN_ONLY_64_BIT_INO_T 1504 int statfs64(const char *, struct statfs64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA); 1505 #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ 1506 int unmount(const char *, int); 1507 int getvfsbyname(const char *, struct vfsconf *); 1508 #if PRIVATE 1509 int pivot_root(const char *, const char *) __OSX_AVAILABLE(10.16); 1510 #endif 1511 __END_DECLS 1512 1513 #endif /* KERNEL */ 1514 #endif /* !_SYS_MOUNT_H_ */ 1515