X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/316670eb35587141e969394ae8537d66b9211e80..5c9f46613a83ebfc29a5b1f099448259e96a98f0:/bsd/sys/mount.h diff --git a/bsd/sys/mount.h b/bsd/sys/mount.h index 9a2c732f0..8ee2cc256 100644 --- a/bsd/sys/mount.h +++ b/bsd/sys/mount.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2010 Apple Inc. All rights reserved. + * Copyright (c) 2000-2017 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -85,7 +85,7 @@ #include #endif -typedef struct fsid { int32_t val[2]; } fsid_t; /* file system id type */ +#include /* file system id type */ /* * file system statistics @@ -223,6 +223,9 @@ struct vfsstatfs { #define VFSATTR_f_signature (1LL<< 22) #define VFSATTR_f_carbon_fsid (1LL<< 23) #define VFSATTR_f_uuid (1LL<< 24) +#define VFSATTR_f_quota (1LL<< 25) +#define VFSATTR_f_reserved (1LL<< 26) + /* * Argument structure. @@ -269,6 +272,8 @@ struct vfs_attr { uint16_t f_signature; /* used for ATTR_VOL_SIGNATURE, Carbon's FSVolumeInfo.signature */ uint16_t f_carbon_fsid; /* same as Carbon's FSVolumeInfo.filesystemID */ uuid_t f_uuid; /* file system UUID (version 3 or 5), available in 10.6 and later */ + uint64_t f_quota; /* total quota data blocks in file system */ + uint64_t f_reserved; /* total reserved data blocks in file system */ }; #pragma pack() @@ -315,7 +320,8 @@ struct vfs_attr { #define MNT_NOUSERXATTR 0x01000000 /* Don't allow user extended attributes */ #define MNT_DEFWRITE 0x02000000 /* filesystem should defer writes */ #define MNT_MULTILABEL 0x04000000 /* MAC support for individual labels */ -#define MNT_NOATIME 0x10000000 /* disable update of file access time */ +#define MNT_NOATIME 0x10000000 /* disable update of file access time */ +#define MNT_SNAPSHOT 0x40000000 /* The mount is a snapshot */ #ifdef BSD_KERNEL_PRIVATE /* #define MNT_IMGSRC_BY_INDEX 0x20000000 see sys/imgsrc.h */ #endif /* BSD_KERNEL_PRIVATE */ @@ -335,7 +341,7 @@ struct vfs_attr { MNT_ROOTFS | MNT_DOVOLFS | MNT_DONTBROWSE | \ MNT_IGNORE_OWNERSHIP | MNT_AUTOMOUNTED | MNT_JOURNALED | \ MNT_NOUSERXATTR | MNT_DEFWRITE | MNT_MULTILABEL | \ - MNT_NOATIME | MNT_CPROTECT) + MNT_NOATIME | MNT_SNAPSHOT | MNT_CPROTECT) /* * External filesystem command modifier flags. * Unmount can use the MNT_FORCE flag. @@ -366,7 +372,6 @@ struct vfs_attr { #define VFS_MAXTYPENUM 1 /* int: highest defined filesystem type */ #define VFS_CONF 2 /* struct: vfsconf for filesystem given as next argument */ -#define VFS_SET_PACKAGE_EXTS 3 /* set package extension list */ /* * Flags for various system call interfaces. @@ -444,12 +449,30 @@ union union_vfsidctl { /* the fields vc_vers and vc_fsid are compatible */ #define VFS_CTL_NOLOCKS 0x00010006 /* disable file locking */ #define VFS_CTL_SADDR 0x00010007 /* get server address */ #define VFS_CTL_DISC 0x00010008 /* server disconnected */ +#define VFS_CTL_SERVERINFO 0x00010009 /* information about fs server */ +#define VFS_CTL_NSTATUS 0x0001000A /* netfs mount status */ struct vfsquery { u_int32_t vq_flags; u_int32_t vq_spare[31]; }; +struct vfs_server { + int32_t vs_minutes; /* minutes until server goes down. */ + u_int8_t vs_server_name[MAXHOSTNAMELEN*3]; /* UTF8 server name to display (null terminated) */ +}; + +/* + * NetFS mount status - returned by VFS_CTL_NSTATUS + */ +struct netfs_status { + u_int32_t ns_status; // Current status of mount (vfsquery flags) + char ns_mountopts[512]; // Significant mount options + uint32_t ns_waittime; // Time waiting for reply (sec) + uint32_t ns_threadcount; // Number of threads blocked on network calls + uint64_t ns_threadids[0]; // Thread IDs of those blocked threads +}; + /* vfsquery flags */ #define VQ_NOTRESP 0x0001 /* server down */ #define VQ_NEEDAUTH 0x0002 /* server bad auth */ @@ -461,11 +484,11 @@ struct vfsquery { #define VQ_NOTRESPLOCK 0x0080 /* server lockd down */ #define VQ_UPDATE 0x0100 /* filesystem information has changed */ #define VQ_VERYLOWDISK 0x0200 /* file system has *very* little disk space left */ -#define VQ_SYNCEVENT 0x0400 /* a sync just happened */ -#define VQ_FLAG0800 0x0800 /* placeholder */ -#define VQ_FLAG1000 0x1000 /* placeholder */ -#define VQ_FLAG2000 0x2000 /* placeholder */ -#define VQ_FLAG4000 0x4000 /* placeholder */ +#define VQ_SYNCEVENT 0x0400 /* a sync just happened (not set by kernel starting Mac OS X 10.9) */ +#define VQ_SERVEREVENT 0x0800 /* server issued notification/warning */ +#define VQ_QUOTA 0x1000 /* a user quota has been hit */ +#define VQ_NEARLOWDISK 0x2000 /* Above lowdisk and below desired disk space */ +#define VQ_DESIRED_DISK 0x4000 /* the desired disk space */ #define VQ_FLAG8000 0x8000 /* placeholder */ @@ -481,17 +504,22 @@ struct vfsioattr { u_int32_t io_maxsegwritesize; /* Max. segment write size */ u_int32_t io_devblocksize; /* the underlying device block size */ u_int32_t io_flags; /* flags for underlying device */ - void * io_reserved[2]; /* extended attribute information */ + union { + int64_t io_max_swappin_available; + // On 32 bit architectures, we don't have any spare + void *io_reserved[2]; + }; }; -#define VFS_IOATTR_FLAGS_FUA 0x01 /* Write-through cache supported */ -#define VFS_IOATTR_FLAGS_UNMAP 0x02 /* Unmap (trim) supported */ +#define VFS_IOATTR_FLAGS_FUA 0x00000001 /* Write-through cache supported */ +#define VFS_IOATTR_FLAGS_UNMAP 0x00000002 /* Unmap (trim) supported */ +#define VFS_IOATTR_FLAGS_SWAPPIN_SUPPORTED 0x00000010 /* Pinning swap file supported */ /* * Filesystem Registration information */ -#define VFS_TBLTHREADSAFE 0x0001 -#define VFS_TBLFSNODELOCK 0x0002 +#define VFS_TBLTHREADSAFE 0x0001 /* Only threadsafe filesystems are supported */ +#define VFS_TBLFSNODELOCK 0x0002 /* Only threadsafe filesystems are supported */ #define VFS_TBLNOTYPENUM 0x0008 #define VFS_TBLLOCALVOL 0x0010 #define VFS_TBL64BITREADY 0x0020 @@ -503,6 +531,9 @@ struct vfsioattr { #define VFS_TBLNOMACLABEL 0x1000 #define VFS_TBLVNOP_PAGEINV2 0x2000 #define VFS_TBLVNOP_PAGEOUTV2 0x4000 +#define VFS_TBLVNOP_NOUPDATEID_RENAME 0x8000 /* vfs should not call vnode_update_ident on rename */ +#define VFS_TBLVNOP_SECLUDE_RENAME 0x10000 +#define VFS_TBLCANMOUNTROOT 0x20000 struct vfs_fsentry { @@ -681,15 +712,74 @@ struct vfsops { @return 0 for success, else an error code. */ int (*vfs_setattr)(struct mount *mp, struct vfs_attr *, vfs_context_t context); - void *vfs_reserved[7]; + + /*! + @function vfs_ioctl + @abstract File system control operations. + @discussion Unlike vfs_sysctl, this is specific to a particular volume. + @param mp The mount to execute the command on. + @param command Identifier for action to take. The command used here + should be in the same namespace as VNOP ioctl commands. + @param data Pointer to data; this can be an integer constant (of 32 bits + only) or an address to be read from or written to, depending on "command." + If it is an address, it is valid and resides in the kernel; callers of + VFS_IOCTL() are responsible for copying to and from userland. + @param flags Reserved for future use, set to zero + @param ctx Context against which to authenticate ioctl request. + @return 0 for success, else an error code. + */ + int (*vfs_ioctl)(struct mount *mp, u_long command, caddr_t data, + int flags, vfs_context_t context); + + /*! + @function vfs_vget_snapdir + @abstract Get the vnode for the snapshot directory of a filesystem. + @discussion Upon success, should return with an iocount held on the root vnode which the caller will + drop with vnode_put(). + @param mp Mount for which to get the root. + @param vpp Destination for snapshot directory vnode. + @param context Context to authenticate for getting the snapshot directory. + @return 0 for success, else an error code. + */ + int (*vfs_vget_snapdir)(struct mount *mp, struct vnode **vpp, vfs_context_t context); + void *vfs_reserved5; + void *vfs_reserved4; + void *vfs_reserved3; + void *vfs_reserved2; + void *vfs_reserved1; +}; + +#ifdef KERNEL + +/* + * Commands for vfs_ioctl. While they are encoded the same way as for ioctl(2), + * there is no generic interface for them from userspace like ioctl(2). + */ +struct fs_snapshot_mount_args { + mount_t sm_mp; + struct componentname *sm_cnp; +}; + +#define VFSIOC_MOUNT_SNAPSHOT _IOW('V', 1, struct fs_snapshot_mount_args) + +struct fs_snapshot_revert_args { + struct componentname *sr_cnp; }; +#define VFSIOC_REVERT_SNAPSHOT _IOW('V', 2, struct fs_snapshot_revert_args) + +struct fs_snapshot_root_args { + struct componentname *sr_cnp; +}; +#define VFSIOC_ROOT_SNAPSHOT _IOW('V', 3, struct fs_snapshot_root_args) +#endif /* KERNEL */ /* * flags passed into vfs_iterate */ #ifdef PRIVATE #define VFS_ITERATE_TAIL_FIRST (1 << 0) +#define VFS_ITERATE_CB_DROPREF (1 << 1) // Callback will drop the iterref #endif /* PRIVATE */ /* @@ -714,6 +804,9 @@ extern int VFS_SYNC(mount_t, int, vfs_context_t); extern int VFS_VGET(mount_t, ino64_t, vnode_t *, vfs_context_t); extern int VFS_FHTOVP(mount_t, int, unsigned char *, vnode_t *, vfs_context_t); extern int VFS_VPTOFH(vnode_t, int *, unsigned char *, vfs_context_t); +extern int VFS_IOCTL(mount_t mp, u_long command, caddr_t data, + int flags, vfs_context_t context); +extern int VFS_VGET_SNAPDIR(mount_t, vnode_t *, vfs_context_t); #endif /* BSD_KERNEL_PRIVATE */ /* * prototypes for exported VFS operations @@ -728,7 +821,7 @@ extern int VFS_VPTOFH(vnode_t, int *, unsigned char *, vfs_context_t); @param handle Opaque handle which will be passed to vfs_fsremove. @return 0 for success, else an error code. */ -int vfs_fsadd(struct vfs_fsentry *, vfstable_t *); +int vfs_fsadd(struct vfs_fsentry *vfe, vfstable_t *handle); /*! @function vfs_fsremove @@ -737,18 +830,18 @@ int vfs_fsadd(struct vfs_fsentry *, vfstable_t *); @param handle Handle which was returned by vfs_fsadd. @return 0 for success, else an error code. */ -int vfs_fsremove(vfstable_t); +int vfs_fsremove(vfstable_t handle); /*! @function vfs_iterate @abstract Iterate over all mountpoints with a callback. Used, for example, by sync(). @param flags Unused. - @param callback Function which takes a mount and arbitrary passed-in "arg," and returns one of VFS_RETURNED_DONE or VFS_CLAIMED_DONE: end + @param callout Function which takes a mount and arbitrary passed-in "arg," and returns one of VFS_RETURNED_DONE or VFS_CLAIMED_DONE: end iteration and return success. VFS_RETURNED or VFS_CLAIMED: continue iterating. Anything else: continue iterating. @param arg Arbitrary data to pass to callback. @return 0 for success, else an error code. */ -int vfs_iterate(int, int (*)(struct mount *, void *), void *); +int vfs_iterate(int flags, int (*callout)(struct mount *, void *), void *arg); /*! @function vfs_init_io_attributes @@ -757,7 +850,7 @@ int vfs_iterate(int, int (*)(struct mount *, void *), void *); @param mp Mountpoint whose I/O parameters to initialize. @return 0 for success, else an error code. */ -int vfs_init_io_attributes(vnode_t, mount_t); +int vfs_init_io_attributes(vnode_t devvp, mount_t mp); /*! @function vfs_flags @@ -766,7 +859,7 @@ int vfs_init_io_attributes(vnode_t, mount_t); @param mp Mount whose flags to grab. @return Flags. */ -uint64_t vfs_flags(mount_t); +uint64_t vfs_flags(mount_t mp); /*! @function vfs_setflags @@ -775,9 +868,8 @@ uint64_t vfs_flags(mount_t); used by a filesystem as part of the mount process. @param mp Mount whose flags to set. @param flags Flags to activate. Must be in the bitwise "OR" of MNT_VISFLAGMASK and MNT_CMDFLAGS. - @return Flags. */ -void vfs_setflags(mount_t, uint64_t); +void vfs_setflags(mount_t mp, uint64_t flags); /*! @function vfs_clearflags @@ -785,9 +877,8 @@ void vfs_setflags(mount_t, uint64_t); @discussion Sets mount flags to the bitwise "AND" of their current value and the complement of the specified bits. @param mp Mount whose flags to set. @param flags Flags to deactivate. Must be in the bitwise "OR" of MNT_VISFLAGMASK and MNT_CMDFLAGS. - @return void. */ -void vfs_clearflags(mount_t, uint64_t); +void vfs_clearflags(mount_t mp, uint64_t flags); /*! @function vfs_issynchronous @@ -795,7 +886,7 @@ void vfs_clearflags(mount_t, uint64_t); @param mp Mount to test. @return Nonzero if writes occur synchronously, else 0. */ -int vfs_issynchronous(mount_t); +int vfs_issynchronous(mount_t mp); /*! @function vfs_iswriteupgrade @@ -804,7 +895,7 @@ int vfs_issynchronous(mount_t); @param mp Mount to test. @return Nonzero if a request has been made to update from read-only to read-write, else 0. */ -int vfs_iswriteupgrade(mount_t); +int vfs_iswriteupgrade(mount_t mp); /*! @function vfs_isupdate @@ -812,7 +903,7 @@ int vfs_iswriteupgrade(mount_t); @param mp Mount to test. @return Nonzero if a mount update is in progress, 0 otherwise. */ -int vfs_isupdate(mount_t); +int vfs_isupdate(mount_t mp); /*! @function vfs_isreload @@ -821,7 +912,7 @@ int vfs_isupdate(mount_t); @param mp Mount to test. @return Nonzero if a request has been made to reload data, else 0. */ -int vfs_isreload(mount_t); +int vfs_isreload(mount_t mp); /*! @function vfs_isforce @@ -830,7 +921,7 @@ int vfs_isreload(mount_t); @param mp Mount to test. @return Nonzero if a request has been made to forcibly unmount, else 0. */ -int vfs_isforce(mount_t); +int vfs_isforce(mount_t mp); /*! @function vfs_isunmount @@ -848,7 +939,7 @@ int vfs_isunmount(mount_t mp); @param mp Mount to test. @return Nonzero if filesystem is mounted read-only, else 0. */ -int vfs_isrdonly(mount_t); +int vfs_isrdonly(mount_t mp); /*! @function vfs_isrdwr @@ -856,7 +947,7 @@ int vfs_isrdonly(mount_t); @param mp Mount to test. @return Nonzero if filesystem is mounted read-write, else 0. */ -int vfs_isrdwr(mount_t); +int vfs_isrdwr(mount_t mp); /*! @function vfs_authopaque @@ -864,7 +955,7 @@ int vfs_isrdwr(mount_t); @param mp Mount to test. @return Nonzero if filesystem authorization is controlled remotely, else 0. */ -int vfs_authopaque(mount_t); +int vfs_authopaque(mount_t mp); /*! @function vfs_authopaqueaccess @@ -872,66 +963,73 @@ int vfs_authopaque(mount_t); @param mp Mount to test. @return Nonzero if VNOP_ACCESS is supported remotely, else 0. */ -int vfs_authopaqueaccess(mount_t); +int vfs_authopaqueaccess(mount_t mp); /*! @function vfs_setauthopaque @abstract Mark a filesystem as having authorization decisions controlled remotely. @param mp Mount to mark. - @return void. */ -void vfs_setauthopaque(mount_t); +void vfs_setauthopaque(mount_t mp); /*! @function vfs_setauthopaqueaccess @abstract Mark a filesystem as having remote VNOP_ACCESS support. @param mp Mount to mark. - @return void. */ -void vfs_setauthopaqueaccess(mount_t); +void vfs_setauthopaqueaccess(mount_t mp); /*! @function vfs_clearauthopaque @abstract Mark a filesystem as not having remote authorization decisions. @param mp Mount to mark. - @return void. */ -void vfs_clearauthopaque(mount_t); +void vfs_clearauthopaque(mount_t mp); /*! @function vfs_clearauthopaque @abstract Mark a filesystem as not having remote VNOP_ACCESS support. @param mp Mount to mark. - @return void. */ -void vfs_clearauthopaqueaccess(mount_t); +void vfs_clearauthopaqueaccess(mount_t mp); /*! @function vfs_setextendedsecurity @abstract Mark a filesystem as supporting security controls beyond POSIX permissions. @discussion Specific controls include ACLs, file owner UUIDs, and group UUIDs. @param mp Mount to test. - @return void. */ -void vfs_setextendedsecurity(mount_t); +void vfs_setextendedsecurity(mount_t mp); /*! @function vfs_clearextendedsecurity @abstract Mark a filesystem as NOT supporting security controls beyond POSIX permissions. @discussion Specific controls include ACLs, file owner UUIDs, and group UUIDs. @param mp Mount to test. - @return void. */ -void vfs_clearextendedsecurity(mount_t); +void vfs_clearextendedsecurity(mount_t mp); + +/*! + @function vfs_setnoswap + @abstract Mark a filesystem as unable to use swap files. + @param mp Mount to mark. + */ +void vfs_setnoswap(mount_t mp); + +/*! + @function vfs_clearnoswap + @abstract Mark a filesystem as capable of using swap files. + @param mp Mount to mark. + */ +void vfs_clearnoswap(mount_t mp); /*! @function vfs_setlocklocal @abstract Mark a filesystem as using VFS-level advisory locking support. @discussion Advisory locking operations will not call down to the filesystem if this flag is set. @param mp Mount to mark. - @return void. */ -void vfs_setlocklocal(mount_t); +void vfs_setlocklocal(mount_t mp); /*! @function vfs_authcache_ttl @@ -942,7 +1040,7 @@ void vfs_setlocklocal(mount_t); @param mp Mount for which to check cache lifetime. @return Cache lifetime in seconds. CACHED_RIGHT_INFINITE_TTL indicates that credentials never expire. */ -int vfs_authcache_ttl(mount_t); +int vfs_authcache_ttl(mount_t mp); /*! @function vfs_setauthcache_ttl @@ -951,18 +1049,16 @@ int vfs_authcache_ttl(mount_t); previously-authorized actions from the same vfs_context_t without calling down to the filesystem (though it will not deny based on the cache). @param mp Mount for which to set cache lifetime. - @return void. */ -void vfs_setauthcache_ttl(mount_t, int); +void vfs_setauthcache_ttl(mount_t mp, int ttl); /*! @function vfs_clearauthcache_ttl @abstract Remove time-to-live controls for cached credentials on a filesytem. Filesystems with remote authorization decisions (opaque) will still have KAUTH_VNODE_SEARCH rights cached for a default of CACHED_LOOKUP_RIGHT_TTL seconds. @param mp Mount for which to clear cache lifetime. - @return void. */ -void vfs_clearauthcache_ttl(mount_t); +void vfs_clearauthcache_ttl(mount_t mp); /* * return value from vfs_cachedrights_ttl if @@ -978,16 +1074,15 @@ void vfs_clearauthcache_ttl(mount_t); @param mp Mount from which to get symlink length cap. @return Max symlink length. */ -uint32_t vfs_maxsymlen(mount_t); +uint32_t vfs_maxsymlen(mount_t mp); /*! @function vfs_setmaxsymlen @abstract Set the maximum length of a symbolic link on a filesystem. @param mp Mount on which to set symlink length cap. @param symlen Length to set. - @return Max symlink length. */ -void vfs_setmaxsymlen(mount_t, uint32_t); +void vfs_setmaxsymlen(mount_t mp, uint32_t symlen); /*! @function vfs_fsprivate @@ -997,7 +1092,7 @@ void vfs_setmaxsymlen(mount_t, uint32_t); @param mp Mount for which to get private data. @return Private data. */ -void * vfs_fsprivate(mount_t); +void * vfs_fsprivate(mount_t mp); /*! @function vfs_setfsprivate @@ -1005,20 +1100,19 @@ void * vfs_fsprivate(mount_t); @discussion A filesystem generally has an internal mount structure which it attaches to the VFS-level mount structure as part of the mounting process. @param mp Mount for which to set private data. - @return Void. */ -void vfs_setfsprivate(mount_t, void *mntdata); +void vfs_setfsprivate(mount_t mp, void *mntdata); /*! @function vfs_statfs @abstract Get information about filesystem status. @discussion Each filesystem has a struct vfsstatfs associated with it which is updated as events occur; this function returns a pointer to it. Note that the data in the structure will continue to change over time and also that it may - be quite stale of vfs_update_vfsstat has not been called recently. + be quite stale if vfs_update_vfsstat has not been called recently. @param mp Mount for which to get vfsstatfs pointer. @return Pointer to vfsstatfs. */ -struct vfsstatfs * vfs_statfs(mount_t); +struct vfsstatfs * vfs_statfs(mount_t mp); #define VFS_USER_EVENT 0 #define VFS_KERNEL_EVENT 1 @@ -1034,7 +1128,7 @@ struct vfsstatfs * vfs_statfs(mount_t); @return 0 for success, or an error code for authentication failure or problem with call to filesystem to request information. */ -int vfs_update_vfsstat(mount_t, vfs_context_t, int eventtype); +int vfs_update_vfsstat(mount_t mp, vfs_context_t ctx, int eventtype); /*! @function vfs_typenum @@ -1044,7 +1138,7 @@ int vfs_update_vfsstat(mount_t, vfs_context_t, int eventtype); @param mp Mount for which to get type number. @return Type number. */ -int vfs_typenum(mount_t); +int vfs_typenum(mount_t mp); /*! @function vfs_name @@ -1053,9 +1147,8 @@ int vfs_typenum(mount_t); rather than a name specific to the mountpoint. @param mp Mount for which to get name. @param buffer Destination for name; length should be at least MFSNAMELEN. - @return void. */ -void vfs_name(mount_t, char *); +void vfs_name(mount_t mp, char *buffer); /*! @function vfs_devblocksize @@ -1063,25 +1156,23 @@ void vfs_name(mount_t, char *); @param mp Mount for which to get block size. @return Block size. */ -int vfs_devblocksize(mount_t); +int vfs_devblocksize(mount_t mp); /*! @function vfs_ioattr @abstract Get I/O attributes associated with a mounpoint. @param mp Mount for which to get attributes. If NULL, system defaults are filled into ioattrp. @param ioattrp Destination for results. - @return void. */ -void vfs_ioattr(mount_t, struct vfsioattr *); +void vfs_ioattr(mount_t mp, struct vfsioattr *ioattrp); /*! @function vfs_setioattr @abstract Set I/O attributes associated with a mounpoint. @param mp Mount for which to set attributes. @param ioattrp Structure containing I/O parameters; all fields must be filled in. - @return void. */ -void vfs_setioattr(mount_t, struct vfsioattr *); +void vfs_setioattr(mount_t mp, struct vfsioattr *ioattrp); /*! @function vfs_64bitready @@ -1089,7 +1180,7 @@ void vfs_setioattr(mount_t, struct vfsioattr *); @param mp Mount to test. @return Nonzero if filesystem is ready for 64-bit; 0 otherwise. */ -int vfs_64bitready(mount_t); +int vfs_64bitready(mount_t mp); #define LK_NOWAIT 1 @@ -1105,16 +1196,15 @@ int vfs_64bitready(mount_t); @param flags LK_NOWAIT: fail with ENOENT if an unmount is in progress. @return 0 for success, with a lock held; an error code otherwise, with no lock held. */ -int vfs_busy(mount_t, int); +int vfs_busy(mount_t mp, int flags); /*! @function vfs_unbusy @abstract "Unbusy" a mountpoint by releasing its read-write lock. @discussion A successful vfs_busy() must be followed by a vfs_unbusy() to release the lock on the mount. @param mp Mount to unbusy. - @return void. */ -void vfs_unbusy(mount_t); +void vfs_unbusy(mount_t mp); /*! @function vfs_getnewfsid @@ -1122,9 +1212,8 @@ void vfs_unbusy(mount_t); @discussion Filesystem IDs are returned as part of "struct statfs." This function is typically called as part of file-system specific mount code (i.e. through VFS_MOUNT). @param mp Mount to set an ID for. - @return void. */ -void vfs_getnewfsid(struct mount *); +void vfs_getnewfsid(struct mount *mp); /*! @function vfs_getvfs @@ -1132,7 +1221,7 @@ void vfs_getnewfsid(struct mount *); @param fsid Filesystem ID to look up. @return Mountpoint if found, else NULL. Note unmounting mountpoints can be returned. */ -mount_t vfs_getvfs(fsid_t *); +mount_t vfs_getvfs(fsid_t *fsid); /*! @function vfs_mountedon @@ -1143,7 +1232,7 @@ mount_t vfs_getvfs(fsid_t *); @param vp The vnode to test. @return EBUSY if vnode is indeed the source of a filesystem; 0 if it is not. */ -int vfs_mountedon(struct vnode *); +int vfs_mountedon(struct vnode *vp); /*! @function vfs_unmountbyfsid @@ -1154,7 +1243,7 @@ int vfs_mountedon(struct vnode *); @param ctx Context against which to authenticate unmount operation. @return 0 for succcess, nonero for failure. */ -int vfs_unmountbyfsid(fsid_t *, int, vfs_context_t); +int vfs_unmountbyfsid(fsid_t *fsid, int flags, vfs_context_t ctx); /*! @function vfs_event_signal @@ -1162,27 +1251,35 @@ int vfs_unmountbyfsid(fsid_t *, int, vfs_context_t); @param fsid Unused. @param event Events to post. @param data Unused. - @return void. */ -void vfs_event_signal(fsid_t *, u_int32_t, intptr_t); +void vfs_event_signal(fsid_t *fsid, u_int32_t event, intptr_t data); + /*! @function vfs_event_init @abstract This function should not be called by kexts. */ void vfs_event_init(void); /* XXX We should not export this */ + +/*! + @function vfs_set_root_unmount_cleanly + @abstract This function should be called by the root file system + when it is being mounted if the file system state is consistent. +*/ +void vfs_set_root_unmounted_cleanly(void); + #ifdef KERNEL_PRIVATE int vfs_getbyid(fsid_t *fsid, ino64_t ino, vnode_t *vpp, vfs_context_t ctx); int vfs_getattr(mount_t mp, struct vfs_attr *vfa, vfs_context_t ctx); int vfs_setattr(mount_t mp, struct vfs_attr *vfa, vfs_context_t ctx); int vfs_extendedsecurity(mount_t); mount_t vfs_getvfs_by_mntonname(char *); -void vfs_markdependency(mount_t); vnode_t vfs_vnodecovered(mount_t mp); /* Returns vnode with an iocount that must be released with vnode_put() */ vnode_t vfs_devvp(mount_t mp); /* Please see block comment with implementation */ +int vfs_nativexattrs (mount_t mp); /* whether or not the FS supports EAs natively */ void * vfs_mntlabel(mount_t mp); /* Safe to cast to "struct label*"; returns "void*" to limit dependence of mount.h on security headers. */ -void vfs_setunmountpreflight(mount_t mp); void vfs_setcompoundopen(mount_t mp); uint64_t vfs_throttle_mask(mount_t mp); +int vfs_isswapmount(mount_t mp); struct vnode_trigger_info; @@ -1253,6 +1350,9 @@ typedef void vfs_trigger_callback_t(mount_t mp, vfs_trigger_callback_op_t op, vo */ int vfs_settriggercallback(fsid_t *fsid, vfs_trigger_callback_t vtc, void *data, uint32_t flags, vfs_context_t ctx); +/* tags a volume as not supporting extended readdir for NFS exports */ +void mount_set_noreaddirext (mount_t); + #endif /* KERNEL_PRIVATE */ __END_DECLS @@ -1286,10 +1386,14 @@ int getfsstat(struct statfs *, int, int) __DARWIN_INODE64(getfsstat); int getfsstat64(struct statfs64 *, int, int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA); #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ int getmntinfo(struct statfs **, int) __DARWIN_INODE64(getmntinfo); +int getmntinfo_r_np(struct statfs **, int) __DARWIN_INODE64(getmntinfo_r_np) + __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) + __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); #if !__DARWIN_ONLY_64_BIT_INO_T int getmntinfo64(struct statfs64 **, int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA); #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ int mount(const char *, const char *, int, void *); +int fmount(const char *, int, int, void *) __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0); int statfs(const char *, struct statfs *) __DARWIN_INODE64(statfs); #if !__DARWIN_ONLY_64_BIT_INO_T int statfs64(const char *, struct statfs64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);