/*
- * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2014 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
- *
- * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* Please see the License for the specific language governing rights and
* limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
+/*
+ * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
+ * support for mandatory and extensible security protections. This notice
+ * is included in support of clause 2.2 (b) of the Apple Public License,
+ * Version 2.0.
+ */
/*
* Warning: This file is generated automatically.
#define _SYS_VNODE_IF_H_
#include <sys/appleapiopts.h>
+#include <sys/cdefs.h>
+#include <sys/kernel_types.h>
+#include <sys/buf.h>
+#ifdef BSD_KERNEL_PRIVATE
+#include <sys/vm.h>
+#endif
+#include <mach/memory_object_types.h>
+
+
+#ifdef KERNEL
+
+extern struct vnodeop_desc vnop_default_desc;
+extern struct vnodeop_desc vnop_lookup_desc;
+#ifdef KERNEL_PRIVATE
+extern struct vnodeop_desc vnop_compound_open_desc;
+extern struct vnodeop_desc vnop_compound_remove_desc;
+extern struct vnodeop_desc vnop_compound_rename_desc;
+extern struct vnodeop_desc vnop_compound_mkdir_desc;
+extern struct vnodeop_desc vnop_compound_rmdir_desc;
+#endif /* KERNEL_PRIVATE */
+extern struct vnodeop_desc vnop_create_desc;
+extern struct vnodeop_desc vnop_whiteout_desc; // obsolete
+extern struct vnodeop_desc vnop_mknod_desc;
+extern struct vnodeop_desc vnop_open_desc;
+extern struct vnodeop_desc vnop_close_desc;
+extern struct vnodeop_desc vnop_access_desc;
+extern struct vnodeop_desc vnop_getattr_desc;
+extern struct vnodeop_desc vnop_setattr_desc;
+extern struct vnodeop_desc vnop_read_desc;
+extern struct vnodeop_desc vnop_write_desc;
+extern struct vnodeop_desc vnop_ioctl_desc;
+extern struct vnodeop_desc vnop_select_desc;
+extern struct vnodeop_desc vnop_exchange_desc;
+extern struct vnodeop_desc vnop_revoke_desc;
+extern struct vnodeop_desc vnop_mmap_desc;
+extern struct vnodeop_desc vnop_mnomap_desc;
+extern struct vnodeop_desc vnop_fsync_desc;
+extern struct vnodeop_desc vnop_remove_desc;
+extern struct vnodeop_desc vnop_link_desc;
+extern struct vnodeop_desc vnop_rename_desc;
+extern struct vnodeop_desc vnop_mkdir_desc;
+extern struct vnodeop_desc vnop_rmdir_desc;
+extern struct vnodeop_desc vnop_symlink_desc;
+extern struct vnodeop_desc vnop_readdir_desc;
+extern struct vnodeop_desc vnop_readdirattr_desc;
+extern struct vnodeop_desc vnop_getattrlistbulk_desc;
+extern struct vnodeop_desc vnop_readlink_desc;
+extern struct vnodeop_desc vnop_inactive_desc;
+extern struct vnodeop_desc vnop_reclaim_desc;
+extern struct vnodeop_desc vnop_print_desc;
+extern struct vnodeop_desc vnop_pathconf_desc;
+extern struct vnodeop_desc vnop_advlock_desc;
+extern struct vnodeop_desc vnop_truncate_desc;
+extern struct vnodeop_desc vnop_allocate_desc;
+extern struct vnodeop_desc vnop_pagein_desc;
+extern struct vnodeop_desc vnop_pageout_desc;
+extern struct vnodeop_desc vnop_searchfs_desc;
+extern struct vnodeop_desc vnop_copyfile_desc;
+extern struct vnodeop_desc vnop_blktooff_desc;
+extern struct vnodeop_desc vnop_offtoblk_desc;
+extern struct vnodeop_desc vnop_blockmap_desc;
+extern struct vnodeop_desc vnop_strategy_desc;
+extern struct vnodeop_desc vnop_bwrite_desc;
#ifdef __APPLE_API_UNSTABLE
-extern struct vnodeop_desc vop_default_desc;
+#if NAMEDSTREAMS
+extern struct vnodeop_desc vnop_getnamedstream_desc;
+extern struct vnodeop_desc vnop_makenamedstream_desc;
+extern struct vnodeop_desc vnop_removenamedstream_desc;
+#endif
-struct vop_lookup_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_dvp;
- struct vnode **a_vpp;
- struct componentname *a_cnp;
-};
-extern struct vnodeop_desc vop_lookup_desc;
-#define VOP_LOOKUP(dvp, vpp, cnp) _VOP_LOOKUP(dvp, vpp, cnp)
-static __inline int _VOP_LOOKUP(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp)
-{
- struct vop_lookup_args a;
- a.a_desc = VDESC(vop_lookup);
- a.a_dvp = dvp;
- a.a_vpp = vpp;
- a.a_cnp = cnp;
- return (VCALL(dvp, VOFFSET(vop_lookup), &a));
-}
-
-struct vop_cachedlookup_args {
+#endif
+
+__BEGIN_DECLS
+
+struct vnop_lookup_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_dvp;
- struct vnode **a_vpp;
+ vnode_t a_dvp;
+ vnode_t *a_vpp;
struct componentname *a_cnp;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_cachedlookup_desc;
-#define VOP_CACHEDLOOKUP(dvp, vpp, cnp) _VOP_CACHEDLOOKUP(dvp, vpp, cnp)
-static __inline int _VOP_CACHEDLOOKUP(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp)
-{
- struct vop_cachedlookup_args a;
- a.a_desc = VDESC(vop_cachedlookup);
- a.a_dvp = dvp;
- a.a_vpp = vpp;
- a.a_cnp = cnp;
- return (VCALL(dvp, VOFFSET(vop_cachedlookup), &a));
-}
-
-struct vop_create_args {
+
+/*!
+ @function VNOP_LOOKUP
+ @abstract Call down to a filesystem to look for a directory entry by name.
+ @discussion VNOP_LOOKUP is the key pathway through which VFS asks a filesystem to find a file. The vnode
+ should be returned with an iocount to be dropped by the caller. A VNOP_LOOKUP() calldown can come without
+ a preceding VNOP_OPEN().
+ @param dvp Directory in which to look up file.
+ @param vpp Destination for found vnode.
+ @param cnp Structure describing filename to find, reason for lookup, and various other data.
+ @param ctx Context against which to authenticate lookup request.
+ @return 0 for success or a filesystem-specific error.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_LOOKUP(vnode_t, vnode_t *, struct componentname *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_create_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_dvp;
- struct vnode **a_vpp;
+ vnode_t a_dvp;
+ vnode_t *a_vpp;
struct componentname *a_cnp;
- struct vattr *a_vap;
+ struct vnode_attr *a_vap;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_create_desc;
-#define VOP_CREATE(dvp, vpp, cnp, vap) _VOP_CREATE(dvp, vpp, cnp, vap)
-static __inline int _VOP_CREATE(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct vattr *vap)
-{
- struct vop_create_args a;
- a.a_desc = VDESC(vop_create);
- a.a_dvp = dvp;
- a.a_vpp = vpp;
- a.a_cnp = cnp;
- a.a_vap = vap;
- return (VCALL(dvp, VOFFSET(vop_create), &a));
-}
-
-struct vop_whiteout_args {
+
+/*!
+ @function VNOP_CREATE
+ @abstract Call down to a filesystem to create a regular file (VREG).
+ @discussion If file creation succeeds, "vpp" should be returned with an iocount to be dropped by the caller.
+ A VNOP_CREATE() calldown can come without a preceding VNOP_OPEN().
+ @param dvp Directory in which to create file.
+ @param vpp Destination for vnode for newly created file.
+ @param cnp Description of filename to create.
+ @param vap File creation properties, as seen in vnode_getattr(). Manipulated with VATTR_ISACTIVE, VATTR_RETURN,
+ VATTR_SET_SUPPORTED, and so forth.
+ @param ctx Context against which to authenticate file creation.
+ @return 0 for success or a filesystem-specific error.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_CREATE(vnode_t, vnode_t *, struct componentname *, struct vnode_attr *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_whiteout_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_dvp;
+ vnode_t a_dvp;
struct componentname *a_cnp;
int a_flags;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_whiteout_desc;
-#define VOP_WHITEOUT(dvp, cnp, flags) _VOP_WHITEOUT(dvp, cnp, flags)
-static __inline int _VOP_WHITEOUT(struct vnode *dvp, struct componentname *cnp, int flags)
-{
- struct vop_whiteout_args a;
- a.a_desc = VDESC(vop_whiteout);
- a.a_dvp = dvp;
- a.a_cnp = cnp;
- a.a_flags = flags;
- return (VCALL(dvp, VOFFSET(vop_whiteout), &a));
-}
-
-struct vop_mknod_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_dvp;
- struct vnode **a_vpp;
- struct componentname *a_cnp;
- struct vattr *a_vap;
-};
-extern struct vnodeop_desc vop_mknod_desc;
-#define VOP_MKNOD(dvp, vpp, cnp, vap) _VOP_MKNOD(dvp, vpp, cnp, vap)
-static __inline int _VOP_MKNOD(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct vattr *vap)
-{
- struct vop_mknod_args a;
- a.a_desc = VDESC(vop_mknod);
- a.a_dvp = dvp;
- a.a_vpp = vpp;
- a.a_cnp = cnp;
- a.a_vap = vap;
- return (VCALL(dvp, VOFFSET(vop_mknod), &a));
-}
-
-struct vop_mkcomplex_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_dvp;
- struct vnode **a_vpp;
- struct componentname *a_cnp;
- struct vattr *a_vap;
- u_long a_type;
+
+/*!
+ @function VNOP_WHITEOUT
+ @abstract Obsolete - no longer supported.
+ @discussion Whiteouts are used to support the union filesystem, whereby one filesystem is mounted "transparently"
+ on top of another. A whiteout in the upper layer of a union mount is a "deletion" of a file in the lower layer;
+ lookups will catch the whiteout and fail, setting ISWHITEOUT in the componentname structure, even if an underlying
+ file of the same name exists. The whiteout vnop is used for creation, deletion, and checking whether a directory
+ supports whiteouts (see flags).
+ also support the LOOKUP flag, which is used to test whether a directory supports whiteouts.
+ @param dvp Directory in which to create.
+ @param cnp Name information for whiteout.
+ @param flags CREATE: create a whiteout. LOOKUP: check whether a directory supports whiteouts, DELETE: remove a whiteout.
+ @param ctx Context against which to authenticate whiteout creation.
+ @return 0 for success or a filesystem-specific error. Returning 0 for LOOKUP indicates that a directory does support whiteouts.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_WHITEOUT(vnode_t, struct componentname *, int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_mknod_args {
+ struct vnodeop_desc *a_desc;
+ vnode_t a_dvp;
+ vnode_t *a_vpp;
+ struct componentname *a_cnp;
+ struct vnode_attr *a_vap;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_mkcomplex_desc;
-#define VOP_MKCOMPLEX(dvp, vpp, cnp, vap, type) _VOP_MKCOMPLEX(dvp, vpp, cnp, vap, type)
-static __inline int _VOP_MKCOMPLEX(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct vattr *vap, u_long type)
-{
- struct vop_mkcomplex_args a;
- a.a_desc = VDESC(vop_mkcomplex);
- a.a_dvp = dvp;
- a.a_vpp = vpp;
- a.a_cnp = cnp;
- a.a_vap = vap;
- a.a_type = type;
- return (VCALL(dvp, VOFFSET(vop_mkcomplex), &a));
-}
-
-struct vop_open_args {
+
+/*!
+ @function VNOP_MKNOD
+ @abstract Call down to a filesystem to create a special file.
+ @discussion The mknod vnop is used to create character and block device files, named pipe (FIFO) files, and named sockets.
+ The newly created file should be returned with an iocount which will be dropped by the caller. A VNOP_MKNOD() call
+ can come down without a preceding VNOP_OPEN().
+ @param dvp Directory in which to create the special file.
+ @param vpp Destination for newly created vnode.
+ @param cnp Name information for new file.
+ @param vap Attributes for new file, including type.
+ @param ctx Context against which to authenticate node creation.
+ @return 0 for success or a filesystem-specific error.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_MKNOD(vnode_t, vnode_t *, struct componentname *, struct vnode_attr *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_open_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
int a_mode;
- struct ucred *a_cred;
- struct proc *a_p;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_open_desc;
-#define VOP_OPEN(vp, mode, cred, p) _VOP_OPEN(vp, mode, cred, p)
-static __inline int _VOP_OPEN(struct vnode *vp, int mode, struct ucred *cred, struct proc *p)
-{
- struct vop_open_args a;
- a.a_desc = VDESC(vop_open);
- a.a_vp = vp;
- a.a_mode = mode;
- a.a_cred = cred;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_open), &a));
-}
-
-struct vop_close_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- int a_fflag;
- struct ucred *a_cred;
- struct proc *a_p;
-};
-extern struct vnodeop_desc vop_close_desc;
-#define VOP_CLOSE(vp, fflag, cred, p) _VOP_CLOSE(vp, fflag, cred, p)
-static __inline int _VOP_CLOSE(struct vnode *vp, int fflag, struct ucred *cred, struct proc *p)
-{
- struct vop_close_args a;
- a.a_desc = VDESC(vop_close);
- a.a_vp = vp;
- a.a_fflag = fflag;
- a.a_cred = cred;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_close), &a));
-}
-
-struct vop_access_args {
+
+#ifdef KERNEL_PRIVATE
+struct vnop_compound_open_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- int a_mode;
- struct ucred *a_cred;
- struct proc *a_p;
+
+ vnode_t a_dvp; /* Directory in which to open/create */
+ vnode_t *a_vpp; /* Resulting vnode */
+ int a_fmode; /* Open mode */
+ struct componentname *a_cnp; /* Path to look up */
+ struct vnode_attr *a_vap; /* Attributes with which to create, if appropriate */
+ uint32_t a_flags; /* VNOP-control flags */
+ uint32_t *a_status; /* Information about results */
+
+ vfs_context_t a_context; /* Authorization context */
+
+ int (*a_open_create_authorizer)( /* Authorizer for create case */
+ vnode_t dvp, /* Directory in which to create */
+ struct componentname *cnp, /* As passed to VNOP */
+ struct vnode_attr *vap, /* As passed to VNOP */
+ vfs_context_t ctx, /* Context */
+ void *reserved); /* Who knows */
+
+ int (*a_open_existing_authorizer)( /* Authorizer for preexisting case */
+ vnode_t vp, /* vp to open */
+ struct componentname *cnp, /* Lookup state */
+ int fmode, /* As passed to VNOP */
+ vfs_context_t ctx, /* Context */
+ void *reserved); /* Who knows */
+
+ void *a_reserved;
};
-extern struct vnodeop_desc vop_access_desc;
-#define VOP_ACCESS(vp, mode, cred, p) _VOP_ACCESS(vp, mode, cred, p)
-static __inline int _VOP_ACCESS(struct vnode *vp, int mode, struct ucred *cred, struct proc *p)
-{
- struct vop_access_args a;
- a.a_desc = VDESC(vop_access);
- a.a_vp = vp;
- a.a_mode = mode;
- a.a_cred = cred;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_access), &a));
-}
-
-struct vop_getattr_args {
+
+/* Results */
+#define COMPOUND_OPEN_STATUS_DID_CREATE 0x00000001
+#endif /* KERNEL_PRIVATE */
+
+/*!
+ @function VNOP_OPEN
+ @abstract Call down to a filesystem to open a file.
+ @discussion The open vnop gives a filesystem a chance to initialize a file for
+ operations like reading, writing, and ioctls. VFS promises to send down exactly one VNOP_CLOSE()
+ for each VNOP_OPEN().
+ @param vp File to open.
+ @param mode FREAD and/or FWRITE.
+ @param ctx Context against which to authenticate open.
+ @return 0 for success or a filesystem-specific error.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_OPEN(vnode_t, int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+#ifdef BSD_KERNEL_PRIVATE
+struct nameidata;
+extern int VNOP_COMPOUND_OPEN(vnode_t dvp, vnode_t *vpp, struct nameidata *ndp, int32_t flags, int32_t fmode, uint32_t *status, struct vnode_attr *vap, vfs_context_t ctx);
+#endif
+
+struct vnop_close_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct vattr *a_vap;
- struct ucred *a_cred;
- struct proc *a_p;
+ vnode_t a_vp;
+ int a_fflag;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_getattr_desc;
-#define VOP_GETATTR(vp, vap, cred, p) _VOP_GETATTR(vp, vap, cred, p)
-static __inline int _VOP_GETATTR(struct vnode *vp, struct vattr *vap, struct ucred *cred, struct proc *p)
-{
- struct vop_getattr_args a;
- a.a_desc = VDESC(vop_getattr);
- a.a_vp = vp;
- a.a_vap = vap;
- a.a_cred = cred;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_getattr), &a));
-}
-
-struct vop_setattr_args {
+
+/*!
+ @function VNOP_CLOSE
+ @abstract Call down to a filesystem to close a file.
+ @discussion The close vnop gives a filesystem a chance to release state set up
+ by a VNOP_OPEN(). VFS promises to send down exactly one VNOP_CLOSE() for each VNOP_OPEN().
+ @param vp File to close.
+ @param fflag FREAD and/or FWRITE; in the case of a file opened with open(2), fflag corresponds
+ to how the file was opened.
+ @param ctx Context against which to authenticate close.
+ @return 0 for success or a filesystem-specific error.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_CLOSE(vnode_t, int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_access_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct vattr *a_vap;
- struct ucred *a_cred;
- struct proc *a_p;
+ vnode_t a_vp;
+ int a_action;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_setattr_desc;
-#define VOP_SETATTR(vp, vap, cred, p) _VOP_SETATTR(vp, vap, cred, p)
-static __inline int _VOP_SETATTR(struct vnode *vp, struct vattr *vap, struct ucred *cred, struct proc *p)
-{
- struct vop_setattr_args a;
- a.a_desc = VDESC(vop_setattr);
- a.a_vp = vp;
- a.a_vap = vap;
- a.a_cred = cred;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_setattr), &a));
-}
-
-struct vop_getattrlist_args {
+
+/*!
+ @function VNOP_ACCESS
+ @abstract Call down to a filesystem to see if a kauth-style operation is permitted.
+ @discussion VNOP_ACCESS is currently only called on filesystems which mark themselves
+ as doing their authentication remotely (vfs_setauthopaque(), vfs_authopaque()). A VNOP_ACCESS()
+ calldown may come without any preceding VNOP_OPEN().
+ @param vp File to authorize action for.
+ @param action kauth-style action to be checked for permissions, e.g. KAUTH_VNODE_DELETE.
+ @param ctx Context against which to authenticate action.
+ @return 0 for success or a filesystem-specific error.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_ACCESS(vnode_t, int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_getattr_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct attrlist *a_alist;
- struct uio *a_uio;
- struct ucred *a_cred;
- struct proc *a_p;
+ vnode_t a_vp;
+ struct vnode_attr *a_vap;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_getattrlist_desc;
-#define VOP_GETATTRLIST(vp, alist, uio, cred, p) _VOP_GETATTRLIST(vp, alist, uio, cred, p)
-static __inline int _VOP_GETATTRLIST(struct vnode *vp, struct attrlist *alist, struct uio *uio, struct ucred *cred, struct proc *p)
-{
- struct vop_getattrlist_args a;
- a.a_desc = VDESC(vop_getattrlist);
- a.a_vp = vp;
- a.a_alist = alist;
- a.a_uio = uio;
- a.a_cred = cred;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_getattrlist), &a));
-}
-
-struct vop_setattrlist_args {
+
+/*!
+ @function VNOP_GETATTR
+ @abstract Call down to a filesystem to get vnode attributes.
+ @discussion Supported attributes ("Yes, I am returning this information") are set with VATTR_SET_SUPPORTED.
+ Which attributes have been requested is checked with VATTR_IS_ACTIVE. Attributes
+ are returned with VATTR_RETURN. It is through VNOP_GETATTR that routines like stat() get their information.
+ A VNOP_GETATTR() calldown may come without any preceding VNOP_OPEN().
+ @param vp The vnode whose attributes to get.
+ @param vap Container for which attributes are requested, which attributes are supported by the filesystem, and attribute values.
+ @param ctx Context against which to authenticate request for attributes.
+ @return 0 for success or a filesystem-specific error. VNOP_GETATTR() can return success even if not
+ all requested attributes were returned; returning an error-value should indicate that something went wrong, rather than that
+ some attribute is not supported.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_GETATTR(vnode_t, struct vnode_attr *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_setattr_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct attrlist *a_alist;
- struct uio *a_uio;
- struct ucred *a_cred;
- struct proc *a_p;
+ vnode_t a_vp;
+ struct vnode_attr *a_vap;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_setattrlist_desc;
-#define VOP_SETATTRLIST(vp, alist, uio, cred, p) _VOP_SETATTRLIST(vp, alist, uio, cred, p)
-static __inline int _VOP_SETATTRLIST(struct vnode *vp, struct attrlist *alist, struct uio *uio, struct ucred *cred, struct proc *p)
-{
- struct vop_setattrlist_args a;
- a.a_desc = VDESC(vop_setattrlist);
- a.a_vp = vp;
- a.a_alist = alist;
- a.a_uio = uio;
- a.a_cred = cred;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_setattrlist), &a));
-}
-
-struct vop_read_args {
+
+/*!
+ @function VNOP_SETATTR
+ @abstract Call down to a filesystem to set vnode attributes.
+ @discussion Supported attributes ("Yes, I am setting this attribute.") are set with VATTR_SET_SUPPORTED.
+ Requested attributes are checked with VATTR_IS_ACTIVE. Attribute values are accessed directly through
+ structure fields. VNOP_SETATTR() is the core of the KPI function vnode_setattr(), which is used by chmod(),
+ chown(), truncate(), and many others. A VNOP_SETATTR() call may come without any preceding VNOP_OPEN().
+ @param vp The vnode whose attributes to set.
+ @param vap Container for which attributes are to be set and their desired values, as well as for the filesystem to
+ return information about which attributes were successfully set.
+ @param ctx Context against which to authenticate request for attribute change.
+ @return 0 for success or a filesystem-specific error. VNOP_SETATTR() can return success even if not
+ all requested attributes were set; returning an error-value should indicate that something went wrong, rather than that
+ some attribute is not supported.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_SETATTR(vnode_t, struct vnode_attr *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_read_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
struct uio *a_uio;
int a_ioflag;
- struct ucred *a_cred;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_read_desc;
-#define VOP_READ(vp, uio, ioflag, cred) _VOP_READ(vp, uio, ioflag, cred)
-static __inline int _VOP_READ(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred)
-{
- struct vop_read_args a;
- a.a_desc = VDESC(vop_read);
- a.a_vp = vp;
- a.a_uio = uio;
- a.a_ioflag = ioflag;
- a.a_cred = cred;
- {
- int _err;
- extern int ubc_hold(struct vnode *vp);
- extern void ubc_rele(struct vnode *vp);
- int _didhold = ubc_hold(vp);
- _err = VCALL(vp, VOFFSET(vop_read), &a);
- if (_didhold)
- ubc_rele(vp);
- return (_err);
- }
-}
-
-struct vop_write_args {
+
+/*!
+ @function VNOP_READ
+ @abstract Call down to a filesystem to read file data.
+ @discussion VNOP_READ() is where the hard work of of the read() system call happens. The filesystem may use
+ the buffer cache, the cluster layer, or an alternative method to get its data; uio routines will be used to see that data
+ is copied to the correct virtual address in the correct address space and will update its uio argument
+ to indicate how much data has been moved.
+ @param vp The vnode to read from.
+ @param uio Description of request, including file offset, amount of data requested, destination address for data,
+ and whether that destination is in kernel or user space.
+ @param ctx Context against which to authenticate read request.
+ @return 0 for success or a filesystem-specific error. VNOP_READ() can return success even if less data was
+ read than originally requested; returning an error value should indicate that something actually went wrong.
+ */
+extern errno_t VNOP_READ(vnode_t, struct uio *, int, vfs_context_t);
+
+struct vnop_write_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
struct uio *a_uio;
int a_ioflag;
- struct ucred *a_cred;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_write_desc;
-#define VOP_WRITE(vp, uio, ioflag, cred) _VOP_WRITE(vp, uio, ioflag, cred)
-static __inline int _VOP_WRITE(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred)
-{
- struct vop_write_args a;
- a.a_desc = VDESC(vop_write);
- a.a_vp = vp;
- a.a_uio = uio;
- a.a_ioflag = ioflag;
- a.a_cred = cred;
- {
- int _err;
- extern int ubc_hold(struct vnode *vp);
- extern void ubc_rele(struct vnode *vp);
- int _didhold = ubc_hold(vp);
- _err = VCALL(vp, VOFFSET(vop_write), &a);
- if (_didhold)
- ubc_rele(vp);
- return (_err);
- }
-}
-
-struct vop_lease_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct proc *a_p;
- struct ucred *a_cred;
- int a_flag;
-};
-extern struct vnodeop_desc vop_lease_desc;
-#define VOP_LEASE(vp, p, cred, flag) _VOP_LEASE(vp, p, cred, flag)
-static __inline int _VOP_LEASE(struct vnode *vp, struct proc *p, struct ucred *cred, int flag)
-{
- struct vop_lease_args a;
- a.a_desc = VDESC(vop_lease);
- a.a_vp = vp;
- a.a_p = p;
- a.a_cred = cred;
- a.a_flag = flag;
- return (VCALL(vp, VOFFSET(vop_lease), &a));
-}
-
-struct vop_ioctl_args {
+
+/*!
+ @function VNOP_WRITE
+ @abstract Call down to the filesystem to write file data.
+ @discussion VNOP_WRITE() is to write() as VNOP_READ() is to read(). The filesystem may use
+ the buffer cache, the cluster layer, or an alternative method to write its data; uio routines will be used to see that data
+ is copied to the correct virtual address in the correct address space and will update its uio argument
+ to indicate how much data has been moved.
+ @param vp The vnode to write to.
+ @param uio Description of request, including file offset, amount of data to write, source address for data,
+ and whether that destination is in kernel or user space.
+ @param ctx Context against which to authenticate write request.
+ @return 0 for success or a filesystem-specific error. VNOP_WRITE() can return success even if less data was
+ written than originally requested; returning an error value should indicate that something actually went wrong.
+ */
+extern errno_t VNOP_WRITE(vnode_t, struct uio *, int, vfs_context_t);
+
+struct vnop_ioctl_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
u_long a_command;
caddr_t a_data;
int a_fflag;
- struct ucred *a_cred;
- struct proc *a_p;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_ioctl_desc;
-#define VOP_IOCTL(vp, command, data, fflag, cred, p) _VOP_IOCTL(vp, command, data, fflag, cred, p)
-static __inline int _VOP_IOCTL(struct vnode *vp, u_long command, caddr_t data, int fflag, struct ucred *cred, struct proc *p)
-{
- struct vop_ioctl_args a;
- a.a_desc = VDESC(vop_ioctl);
- a.a_vp = vp;
- a.a_command = command;
- a.a_data = data;
- a.a_fflag = fflag;
- a.a_cred = cred;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_ioctl), &a));
-}
-
-struct vop_select_args {
+
+/*!
+ @function VNOP_IOCTL
+ @abstract Call down to a filesystem or device driver to execute various control operations on or request data about a file.
+ @discussion Ioctl controls are typically associated with devices, but they can in fact be passed
+ down for any file; they are used to implement any of a wide range of controls and information requests.
+ fcntl() calls VNOP_IOCTL for several commands, and will attempt a VNOP_IOCTL if it is passed an unknown command,
+ though no copyin or copyout of arguments can occur in this case--the "arg" must be an integer value.
+ Filesystems can define their own fcntls using this mechanism. How ioctl commands are structured
+ is slightly complicated; see the manual page for ioctl(2).
+ @param vp The vnode to execute the command on.
+ @param command Identifier for action to take.
+ @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 VNOP_IOCTL() are
+ responsible for copying to and from userland.
+ @param ctx Context against which to authenticate ioctl request.
+ @return 0 for success or a filesystem-specific error.
+ */
+extern errno_t VNOP_IOCTL(vnode_t, u_long, caddr_t, int, vfs_context_t);
+
+struct vnop_select_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
int a_which;
int a_fflags;
- struct ucred *a_cred;
void *a_wql;
- struct proc *a_p;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_select_desc;
-#define VOP_SELECT(vp, which, fflags, cred, wql, p) _VOP_SELECT(vp, which, fflags, cred, wql, p)
-static __inline int _VOP_SELECT(struct vnode *vp, int which, int fflags, struct ucred *cred, void *wql, struct proc *p)
-{
- struct vop_select_args a;
- a.a_desc = VDESC(vop_select);
- a.a_vp = vp;
- a.a_which = which;
- a.a_fflags = fflags;
- a.a_cred = cred;
- a.a_wql = wql;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_select), &a));
-}
-
-struct vop_exchange_args {
+
+/*!
+ @function VNOP_SELECT
+ @abstract Call down to a filesystem or device to check if a file is ready for I/O and request later notification if it is not currently ready.
+ @discussion In general, regular are always "ready for I/O" and their select vnops simply return "1."
+ Devices, though, may or may not be read; they keep track of who is selecting on them and send notifications
+ when they become ready. xnu provides structures and routines for tracking threads waiting for I/O and waking up
+ those threads: see selrecord(), selthreadclear(), seltrue(), selwait(), selwakeup(), and the selinfo structure (sys/select.h).
+ @param vp The vnode to check for I/O readiness.
+ @param which What kind of I/O is desired: FREAD, FWRITE.
+ @param fflags Flags from fileglob as seen in fcntl.h, e.g. O_NONBLOCK, O_APPEND.
+ @param wql Opaque object to pass to selrecord().
+ @param ctx Context to authenticate for select request.
+ @return Nonzero indicates that a file is ready for I/O. 0 indicates that the file is not ready for I/O;
+ there is no way to return an error. 0 should be returned if the device (or file) is not ready for I/O
+ and the driver (or filesystem) is going to track the request and provide subsequent wakeups.
+ the device (or filesystem) will provide a wakeup.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_SELECT(vnode_t, int, int, void *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_exchange_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_fvp;
- struct vnode *a_tvp;
- struct ucred *a_cred;
- struct proc *a_p;
+ vnode_t a_fvp;
+ vnode_t a_tvp;
+ int a_options;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_exchange_desc;
-#define VOP_EXCHANGE(fvp, tvp, cred, p) _VOP_EXCHANGE(fvp, tvp, cred, p)
-static __inline int _VOP_EXCHANGE(struct vnode *fvp, struct vnode *tvp, struct ucred *cred, struct proc *p)
-{
- struct vop_exchange_args a;
- a.a_desc = VDESC(vop_exchange);
- a.a_fvp = fvp;
- a.a_tvp = tvp;
- a.a_cred = cred;
- a.a_p = p;
- return (VCALL(fvp, VOFFSET(vop_exchange), &a));
-}
-
-struct vop_revoke_args {
+
+/*!
+ @function VNOP_EXCHANGE
+ @abstract Call down to a filesystem to atomically exchange the data of two files.
+ @discussion VNOP_EXCHANGE() is currently only called by the exchangedata() system call. It will only
+ be applied to files on the same volume.
+ @param fvp First vnode.
+ @param tvp Second vnode.
+ @param options Unused.
+ @param ctx Context to authenticate for exchangedata request.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_EXCHANGE(vnode_t, vnode_t, int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_revoke_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
int a_flags;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_revoke_desc;
-#define VOP_REVOKE(vp, flags) _VOP_REVOKE(vp, flags)
-static __inline int _VOP_REVOKE(struct vnode *vp, int flags)
-{
- struct vop_revoke_args a;
- a.a_desc = VDESC(vop_revoke);
- a.a_vp = vp;
- a.a_flags = flags;
- return (VCALL(vp, VOFFSET(vop_revoke), &a));
-}
-
-struct vop_mmap_args {
+
+/*!
+ @function VNOP_REVOKE
+ @abstract Call down to a filesystem to invalidate all open file descriptors for a vnode.
+ @discussion This function is typically called as part of a TTY revoke, but can also be
+ used on regular files. Most filesystems simply use nop_revoke(), which calls vn_revoke(),
+ as their revoke vnop implementation.
+ @param vp The vnode to revoke.
+ @param flags Unused.
+ @param ctx Context to authenticate for revoke request.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_REVOKE(vnode_t, int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_mmap_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
int a_fflags;
- struct ucred *a_cred;
- struct proc *a_p;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_mmap_desc;
-#define VOP_MMAP(vp, fflags, cred, p) _VOP_MMAP(vp, fflags, cred, p)
-static __inline int _VOP_MMAP(struct vnode *vp, int fflags, struct ucred *cred, struct proc *p)
-{
- struct vop_mmap_args a;
- a.a_desc = VDESC(vop_mmap);
- a.a_vp = vp;
- a.a_fflags = fflags;
- a.a_cred = cred;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_mmap), &a));
-}
-
-struct vop_fsync_args {
+
+/*!
+ @function VNOP_MMAP
+ @abstract Notify a filesystem that a file is being mmap-ed.
+ @discussion VNOP_MMAP is an advisory calldown to say that the system is mmap-ing a file.
+ @param vp The vnode being mmapped.
+ @param flags Memory protection: PROT_READ, PROT_WRITE, PROT_EXEC.
+ @param ctx Context to authenticate for mmap request.
+ @return 0 for success; all errors except EPERM are ignored.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_MMAP(vnode_t, int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_mnomap_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct ucred *a_cred;
- int a_waitfor;
- struct proc *a_p;
+ vnode_t a_vp;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_fsync_desc;
-#define VOP_FSYNC(vp, cred, waitfor, p) _VOP_FSYNC(vp, cred, waitfor, p)
-static __inline int _VOP_FSYNC(struct vnode *vp, struct ucred *cred, int waitfor, struct proc *p)
-{
- struct vop_fsync_args a;
- a.a_desc = VDESC(vop_fsync);
- a.a_vp = vp;
- a.a_cred = cred;
- a.a_waitfor = waitfor;
- a.a_p = p;
- {
- int _err;
- extern int ubc_hold(struct vnode *vp);
- extern void ubc_rele(struct vnode *vp);
- int _didhold = ubc_hold(vp);
- _err = VCALL(vp, VOFFSET(vop_fsync), &a);
- if (_didhold)
- ubc_rele(vp);
- return (_err);
- }
-}
-
-struct vop_seek_args {
+
+/*!
+ @function VNOP_MNOMAP
+ @abstract Inform a filesystem that a file is no longer mapped.
+ @discussion In general, no action is required of a filesystem for VNOP_MNOMAP.
+ @param vp The vnode which is no longer mapped.
+ @param ctx Context to authenticate for mnomap request.
+ @return Return value is ignored.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_MNOMAP(vnode_t, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_fsync_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- off_t a_oldoff;
- off_t a_newoff;
- struct ucred *a_cred;
+ vnode_t a_vp;
+ int a_waitfor;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_seek_desc;
-#define VOP_SEEK(vp, oldoff, newoff, cred) _VOP_SEEK(vp, oldoff, newoff, cred)
-static __inline int _VOP_SEEK(struct vnode *vp, off_t oldoff, off_t newoff, struct ucred *cred)
-{
- struct vop_seek_args a;
- a.a_desc = VDESC(vop_seek);
- a.a_vp = vp;
- a.a_oldoff = oldoff;
- a.a_newoff = newoff;
- a.a_cred = cred;
- return (VCALL(vp, VOFFSET(vop_seek), &a));
-}
-
-struct vop_remove_args {
+
+/*!
+ @function VNOP_FSYNC
+ @abstract Call down to a filesystem to synchronize a file with on-disk state.
+ @discussion VNOP_FSYNC is called whenever we need to make sure that a file's data has been
+ pushed to backing store, for example when recycling; it is also the heart of the fsync() system call.
+ @param vp The vnode whose data to flush to backing store.
+ @param ctx Context to authenticate for fsync request.
+ @return 0 for success, else an error code.
+ */
+extern errno_t VNOP_FSYNC(vnode_t, int, vfs_context_t);
+
+struct vnop_remove_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_dvp;
- struct vnode *a_vp;
+ vnode_t a_dvp;
+ vnode_t a_vp;
struct componentname *a_cnp;
+ int a_flags;
+ vfs_context_t a_context;
+};
+
+/*!
+ @function VNOP_REMOVE
+ @abstract Call down to a filesystem to delete a file.
+ @discussion VNOP_REMOVE is called to remove a file from a filesystem's namespace, for example by unlink().
+ It can operate on regular files, named pipes, special files, and in some cases on directories.
+ @param dvp Directory in which to delete a file.
+ @param vp The file to delete.
+ @param cnp Filename information.
+ @param ctx Context to authenticate for fsync request.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_REMOVE(vnode_t, vnode_t, struct componentname *, int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+#ifdef KERNEL_PRIVATE
+struct vnop_compound_remove_args {
+ struct vnodeop_desc *a_desc;
+ vnode_t a_dvp; /* Directory in which to lookup and remove */
+ vnode_t *a_vpp; /* File to remove; may or may not point to NULL pointer */
+ struct componentname *a_cnp; /* Name of file to remove */
+ struct vnode_attr *a_vap; /* Destination for file attributes on successful delete */
+ uint32_t a_flags; /* Control flags (unused) */
+ vfs_context_t a_context; /* Authorization context */
+ int (*a_remove_authorizer)( /* Authorizer callback */
+ vnode_t dvp, /* Directory in which to delete */
+ vnode_t vp, /* File to delete */
+ struct componentname *cnp, /* As passed to VNOP */
+ vfs_context_t ctx, /* As passed to VNOP */
+ void *reserved); /* Always NULL */
+ void *a_reserved; /* Unused */
};
-extern struct vnodeop_desc vop_remove_desc;
-#define VOP_REMOVE(dvp, vp, cnp) _VOP_REMOVE(dvp, vp, cnp)
-static __inline int _VOP_REMOVE(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
-{
- struct vop_remove_args a;
- a.a_desc = VDESC(vop_remove);
- a.a_dvp = dvp;
- a.a_vp = vp;
- a.a_cnp = cnp;
- return (VCALL(dvp, VOFFSET(vop_remove), &a));
-}
-
-struct vop_link_args {
+#endif /* KERNEL_PRIVATE */
+
+#ifdef BSD_KERNEL_PRIVATE
+extern errno_t VNOP_COMPOUND_REMOVE(vnode_t, vnode_t*, struct nameidata *, int32_t flags, struct vnode_attr *vap, vfs_context_t);
+#endif
+struct vnop_link_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct vnode *a_tdvp;
+ vnode_t a_vp;
+ vnode_t a_tdvp;
struct componentname *a_cnp;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_link_desc;
-#define VOP_LINK(vp, tdvp, cnp) _VOP_LINK(vp, tdvp, cnp)
-static __inline int _VOP_LINK(struct vnode *vp, struct vnode *tdvp, struct componentname *cnp)
-{
- struct vop_link_args a;
- a.a_desc = VDESC(vop_link);
- a.a_vp = vp;
- a.a_tdvp = tdvp;
- a.a_cnp = cnp;
- return (VCALL(vp, VOFFSET(vop_link), &a));
-}
-
-struct vop_rename_args {
+
+/*!
+ @function VNOP_LINK
+ @abstract Call down to a filesystem to create a hardlink to a file.
+ @discussion See "man 2 link".
+ @param vp File to link to.
+ @param dvp Directory in which to create the link.
+ @param cnp Filename information for new link.
+ @param ctx Context to authenticate for link request.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_LINK(vnode_t, vnode_t, struct componentname *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_rename_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_fdvp;
- struct vnode *a_fvp;
+ vnode_t a_fdvp;
+ vnode_t a_fvp;
struct componentname *a_fcnp;
- struct vnode *a_tdvp;
- struct vnode *a_tvp;
+ vnode_t a_tdvp;
+ vnode_t a_tvp;
struct componentname *a_tcnp;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_rename_desc;
-#define VOP_RENAME(fdvp, fvp, fcnp, tdvp, tvp, tcnp) _VOP_RENAME(fdvp, fvp, fcnp, tdvp, tvp, tcnp)
-static __inline int _VOP_RENAME(struct vnode *fdvp, struct vnode *fvp, struct componentname *fcnp, struct vnode *tdvp, struct vnode *tvp, struct componentname *tcnp)
-{
- struct vop_rename_args a;
- a.a_desc = VDESC(vop_rename);
- a.a_fdvp = fdvp;
- a.a_fvp = fvp;
- a.a_fcnp = fcnp;
- a.a_tdvp = tdvp;
- a.a_tvp = tvp;
- a.a_tcnp = tcnp;
- return (VCALL(fdvp, VOFFSET(vop_rename), &a));
-}
-
-struct vop_mkdir_args {
+
+/*!
+ @function VNOP_RENAME
+ @abstract Call down to a filesystem to rename a file.
+ @discussion VNOP_RENAME() will only be called with a source and target on the same volume.
+ @param fdvp Directory in which source file resides.
+ @param fvp File being renamed.
+ @param fcnp Name information for source file.
+ @param tdvp Directory file is being moved to.
+ @param tvp Existing file with same name as target, should one exist.
+ @param tcnp Name information for target path.
+ @param ctx Context to authenticate for rename request.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_RENAME(vnode_t, vnode_t, struct componentname *, vnode_t, vnode_t, struct componentname *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+#ifdef KERNEL_PRIVATE
+struct vnop_compound_rename_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_dvp;
- struct vnode **a_vpp;
- struct componentname *a_cnp;
- struct vattr *a_vap;
+
+ vnode_t a_fdvp; /* Directory from which to rename */
+ vnode_t *a_fvpp; /* Vnode to rename (can point to a NULL pointer) */
+ struct componentname *a_fcnp; /* Source name */
+ struct vnode_attr *a_fvap;
+
+ vnode_t a_tdvp; /* Directory to which to rename */
+ vnode_t *a_tvpp; /* Vnode to rename over (can point to a NULL pointer) */
+ struct componentname *a_tcnp; /* Destination name */
+ struct vnode_attr *a_tvap;
+
+ uint32_t a_flags; /* Control flags: currently unused */
+ vfs_context_t a_context; /* Authorization context */
+ int (*a_rename_authorizer)( /* Authorization callback */
+ vnode_t fdvp, /* As passed to VNOP */
+ vnode_t fvp, /* Vnode to rename */
+ struct componentname *fcnp, /* As passed to VNOP */
+ vnode_t tdvp, /* As passed to VNOP */
+ vnode_t tvp, /* Vnode to rename over (can be NULL) */
+ struct componentname *tcnp, /* As passed to VNOP */
+ vfs_context_t ctx, /* As passed to VNOP */
+ void *reserved); /* Always NULL */
+ void *a_reserved; /* Currently unused */
};
-extern struct vnodeop_desc vop_mkdir_desc;
-#define VOP_MKDIR(dvp, vpp, cnp, vap) _VOP_MKDIR(dvp, vpp, cnp, vap)
-static __inline int _VOP_MKDIR(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct vattr *vap)
-{
- struct vop_mkdir_args a;
- a.a_desc = VDESC(vop_mkdir);
- a.a_dvp = dvp;
- a.a_vpp = vpp;
- a.a_cnp = cnp;
- a.a_vap = vap;
- return (VCALL(dvp, VOFFSET(vop_mkdir), &a));
-}
-
-struct vop_rmdir_args {
+#endif /* KERNEL_PRIVATE */
+
+#ifdef XNU_KERNEL_PRIVATE
+errno_t
+VNOP_COMPOUND_RENAME(
+ struct vnode *fdvp, struct vnode **fvpp, struct componentname *fcnp, struct vnode_attr *fvap,
+ struct vnode *tdvp, struct vnode **tvpp, struct componentname *tcnp, struct vnode_attr *tvap,
+ uint32_t flags,vfs_context_t ctx);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_mkdir_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_dvp;
- struct vnode *a_vp;
+ vnode_t a_dvp;
+ vnode_t *a_vpp;
struct componentname *a_cnp;
+ struct vnode_attr *a_vap;
+ vfs_context_t a_context;
+};
+
+/*!
+ @function VNOP_MKDIR
+ @abstract Call down to a filesystem to create a directory.
+ @discussion The newly created directory should be returned with an iocount which will be dropped by the caller.
+ @param dvp Directory in which to create new directory.
+ @param vpp Destination for pointer to new directory's vnode.
+ @param cnp Name information for new directory.
+ @param vap Attributes for new directory.
+ @param ctx Context to authenticate for mkdir request.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_MKDIR(vnode_t, vnode_t *, struct componentname *, struct vnode_attr *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+
+#ifdef KERNEL_PRIVATE
+struct vnop_compound_mkdir_args {
+ struct vnodeop_desc *a_desc;
+ vnode_t a_dvp; /* Directory in which to create */
+ vnode_t *a_vpp; /* Destination for found or created vnode */
+ struct componentname *a_cnp; /* Name of directory to create */
+ struct vnode_attr *a_vap; /* Creation attributes */
+ uint32_t a_flags; /* Control flags (unused) */
+ vfs_context_t a_context; /* Authorization context */
+#if 0
+ int (*a_mkdir_authorizer)(vnode_t dvp, struct componentname *cnp, struct vnode_attr *vap, vfs_context_t ctx, void *reserved);
+#endif /* 0 */
+ void *a_reserved; /* Unused */
};
-extern struct vnodeop_desc vop_rmdir_desc;
-#define VOP_RMDIR(dvp, vp, cnp) _VOP_RMDIR(dvp, vp, cnp)
-static __inline int _VOP_RMDIR(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
-{
- struct vop_rmdir_args a;
- a.a_desc = VDESC(vop_rmdir);
- a.a_dvp = dvp;
- a.a_vp = vp;
- a.a_cnp = cnp;
- return (VCALL(dvp, VOFFSET(vop_rmdir), &a));
-}
-
-struct vop_symlink_args {
+#endif /* KERNEL_PRIVATE */
+
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_COMPOUND_MKDIR(vnode_t, vnode_t *, struct nameidata *, struct vnode_attr *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_rmdir_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_dvp;
- struct vnode **a_vpp;
+ vnode_t a_dvp;
+ vnode_t a_vp;
struct componentname *a_cnp;
- struct vattr *a_vap;
- char *a_target;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_symlink_desc;
-#define VOP_SYMLINK(dvp, vpp, cnp, vap, target) _VOP_SYMLINK(dvp, vpp, cnp, vap, target)
-static __inline int _VOP_SYMLINK(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct vattr *vap, char *target)
-{
- struct vop_symlink_args a;
- a.a_desc = VDESC(vop_symlink);
- a.a_dvp = dvp;
- a.a_vpp = vpp;
- a.a_cnp = cnp;
- a.a_vap = vap;
- a.a_target = target;
- return (VCALL(dvp, VOFFSET(vop_symlink), &a));
-}
-
-struct vop_readdir_args {
+
+/*!
+ @function VNOP_RMDIR
+ @abstract Call down to a filesystem to delete a directory.
+ @param dvp Parent of directory to be removed.
+ @param vp Directory to remove.
+ @param cnp Name information for directory to be deleted.
+ @param ctx Context to authenticate for rmdir request.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_RMDIR(vnode_t, vnode_t, struct componentname *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+#ifdef KERNEL_PRIVATE
+struct vnop_compound_rmdir_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_dvp; /* Directory in which to look up and delete */
+ vnode_t *a_vpp; /* Destination for found vnode */
+ struct componentname *a_cnp; /* Name to delete */
+ struct vnode_attr *a_vap; /* Location in which to store attributes if delete succeeds (can be NULL) */
+ uint32_t a_flags; /* Control flags (currently unused) */
+ vfs_context_t a_context; /* Context for authorization */
+ int (*a_rmdir_authorizer)( /* Authorization callback */
+ vnode_t dvp, /* As passed to VNOP */
+ vnode_t vp, /* Directory to delete */
+ struct componentname *cnp, /* As passed to VNOP */
+ vfs_context_t ctx, /* As passed to VNOP */
+ void *reserved); /* Always NULL */
+ void *a_reserved; /* Unused */
+};
+#endif /* KERNEL_PRIVATE */
+
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_COMPOUND_RMDIR(vnode_t, vnode_t*, struct nameidata *, struct vnode_attr *vap, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+
+struct vnop_symlink_args {
+ struct vnodeop_desc *a_desc;
+ vnode_t a_dvp;
+ vnode_t *a_vpp;
+ struct componentname *a_cnp;
+ struct vnode_attr *a_vap;
+ char *a_target;
+ vfs_context_t a_context;
+};
+
+/*!
+ @function VNOP_SYMLINK
+ @abstract Call down to a filesystem to create a symbolic link.
+ @param If VNOP_SYMLINK() is successful, the new file should be returned with an iocount which will
+ be dropped by the caller. VFS does not ensure that the target path will have a length shorter
+ than the max symlink length for the filesystem.
+ @param dvp Parent directory for new symlink file.
+ @param vpp
+ @param cnp Name information for new symlink.
+ @param vap Attributes for symlink.
+ @param target Path for symlink to store; for "ln -s /var/vardir linktovardir", "target" would be "/var/vardir"
+ @param ctx Context to authenticate for symlink request.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_SYMLINK(vnode_t, vnode_t *, struct componentname *, struct vnode_attr *, char *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+/*
+ *
+ * When VNOP_READDIR is called from the NFS Server, the nfs_data
+ * argument is non-NULL.
+ *
+ * The value of nfs_eofflag should be set to TRUE if the end of
+ * the directory was reached while reading.
+ *
+ * The directory seek offset (cookies) are returned to the NFS client and
+ * may be used later to restart a directory read part way through
+ * the directory. There is one cookie returned for each directory
+ * entry returned and its size is determince from nfs_sizeofcookie.
+ * The value of the cookie should be the logical offset within the
+ * directory where the on-disc version of the appropriate directory
+ * entry starts. Memory for the cookies is allocated from M_TEMP
+ * and it is freed by the caller of VNOP_READDIR.
+ *
+ */
+
+struct vnop_readdir_args {
+ struct vnodeop_desc *a_desc;
+ vnode_t a_vp;
struct uio *a_uio;
- struct ucred *a_cred;
+ int a_flags;
int *a_eofflag;
- int *a_ncookies;
- u_long **a_cookies;
+ int *a_numdirent;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_readdir_desc;
-#define VOP_READDIR(vp, uio, cred, eofflag, ncookies, cookies) _VOP_READDIR(vp, uio, cred, eofflag, ncookies, cookies)
-static __inline int _VOP_READDIR(struct vnode *vp, struct uio *uio, struct ucred *cred, int *eofflag, int *ncookies, u_long **cookies)
-{
- struct vop_readdir_args a;
- a.a_desc = VDESC(vop_readdir);
- a.a_vp = vp;
- a.a_uio = uio;
- a.a_cred = cred;
- a.a_eofflag = eofflag;
- a.a_ncookies = ncookies;
- a.a_cookies = cookies;
- return (VCALL(vp, VOFFSET(vop_readdir), &a));
-}
-
-struct vop_readdirattr_args {
+
+/*!
+ @function VNOP_READDIR
+ @abstract Call down to a filesystem to enumerate directory entries.
+ @discussion VNOP_READDIR() packs a buffer with "struct dirent" directory entry representations as described
+ by the "getdirentries" manual page.
+ @param vp Directory to enumerate.
+ @param uio Destination information for resulting direntries.
+ @param flags VNODE_READDIR_EXTENDED, VNODE_READDIR_REQSEEKOFF, VNODE_READDIR_SEEKOFF32: Apple-internal flags.
+ @param eofflag Should be set to 1 if the end of the directory has been reached.
+ @param numdirent Should be set to number of entries written into buffer.
+ @param ctx Context to authenticate for readdir request.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_READDIR(vnode_t, struct uio *, int, int *, int *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_readdirattr_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
struct attrlist *a_alist;
struct uio *a_uio;
- u_long a_maxcount;
- u_long a_options;
- u_long *a_newstate;
+ uint32_t a_maxcount;
+ uint32_t a_options;
+ uint32_t *a_newstate;
int *a_eofflag;
- u_long *a_actualcount;
- u_long **a_cookies;
- struct ucred *a_cred;
+ uint32_t *a_actualcount;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_readdirattr_desc;
-#define VOP_READDIRATTR(vp, alist, uio, maxcount, options, newstate, eofflag, actualcount, cookies, cred) _VOP_READDIRATTR(vp, alist, uio, maxcount, options, newstate, eofflag, actualcount, cookies, cred)
-static __inline int _VOP_READDIRATTR(struct vnode *vp, struct attrlist *alist, struct uio *uio, u_long maxcount, u_long options, u_long *newstate, int *eofflag, u_long *actualcount, u_long **cookies, struct ucred *cred)
-{
- struct vop_readdirattr_args a;
- a.a_desc = VDESC(vop_readdirattr);
- a.a_vp = vp;
- a.a_alist = alist;
- a.a_uio = uio;
- a.a_maxcount = maxcount;
- a.a_options = options;
- a.a_newstate = newstate;
- a.a_eofflag = eofflag;
- a.a_actualcount = actualcount;
- a.a_cookies = cookies;
- a.a_cred = cred;
- return (VCALL(vp, VOFFSET(vop_readdirattr), &a));
-}
-
-struct vop_readlink_args {
+
+/*!
+ @function VNOP_READDIRATTR
+ @abstract Call down to get file attributes for many files in a directory at once.
+ @discussion VNOP_READDIRATTR() packs a buffer with file attributes, as if the results of many "getattrlist" calls.
+ @param vp Directory in which to enumerate entries' attributes.
+ @param alist Which attributes are wanted for each directory entry.
+ @param uio Destination information for resulting attributes.
+ @param maxcount Maximum count of files to get attributes for.
+ @param options FSOPT_NOFOLLOW: do not follow symbolic links. FSOPT_NOINMEMUPDATE: do not use data which have been
+ updated since an inode was loaded into memory.
+ @param newstate The "newstate" should be set to a value which changes if the contents of a directory change
+ through an addition or deletion but stays the same otherwise.
+ @param eofflag Should be set to 1 if the end of the directory has been reached.
+ @param actualcount Should be set to number of files whose attributes were written into buffer.
+ @param ctx Context to authenticate for readdirattr request.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_READDIRATTR(vnode_t, struct attrlist *, struct uio *, uint32_t, uint32_t, uint32_t *, int *, uint32_t *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_getattrlistbulk_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
+ struct attrlist *a_alist;
+ struct vnode_attr *a_vap;
struct uio *a_uio;
- struct ucred *a_cred;
-};
-extern struct vnodeop_desc vop_readlink_desc;
-#define VOP_READLINK(vp, uio, cred) _VOP_READLINK(vp, uio, cred)
-static __inline int _VOP_READLINK(struct vnode *vp, struct uio *uio, struct ucred *cred)
-{
- struct vop_readlink_args a;
- a.a_desc = VDESC(vop_readlink);
- a.a_vp = vp;
- a.a_uio = uio;
- a.a_cred = cred;
- return (VCALL(vp, VOFFSET(vop_readlink), &a));
-}
-
-struct vop_abortop_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_dvp;
- struct componentname *a_cnp;
-};
-extern struct vnodeop_desc vop_abortop_desc;
-#define VOP_ABORTOP(dvp, cnp) _VOP_ABORTOP(dvp, cnp)
-static __inline int _VOP_ABORTOP(struct vnode *dvp, struct componentname *cnp)
-{
- struct vop_abortop_args a;
- a.a_desc = VDESC(vop_abortop);
- a.a_dvp = dvp;
- a.a_cnp = cnp;
- return (VCALL(dvp, VOFFSET(vop_abortop), &a));
-}
-
-struct vop_inactive_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct proc *a_p;
-};
-extern struct vnodeop_desc vop_inactive_desc;
-#define VOP_INACTIVE(vp, p) _VOP_INACTIVE(vp, p)
-static __inline int _VOP_INACTIVE(struct vnode *vp, struct proc *p)
-{
- struct vop_inactive_args a;
- a.a_desc = VDESC(vop_inactive);
- a.a_vp = vp;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_inactive), &a));
-}
-
-struct vop_reclaim_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct proc *a_p;
-};
-extern struct vnodeop_desc vop_reclaim_desc;
-#define VOP_RECLAIM(vp, p) _VOP_RECLAIM(vp, p)
-static __inline int _VOP_RECLAIM(struct vnode *vp, struct proc *p)
-{
- struct vop_reclaim_args a;
- a.a_desc = VDESC(vop_reclaim);
- a.a_vp = vp;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_reclaim), &a));
-}
-
-struct vop_lock_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- int a_flags;
- struct proc *a_p;
+ void *a_private;
+ uint64_t a_options;
+ int32_t *a_eofflag;
+ int32_t *a_actualcount;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_lock_desc;
-#define VOP_LOCK(vp, flags, p) _VOP_LOCK(vp, flags, p)
-static __inline int _VOP_LOCK(struct vnode *vp, int flags, struct proc *p)
-{
- struct vop_lock_args a;
- a.a_desc = VDESC(vop_lock);
- a.a_vp = vp;
- a.a_flags = flags;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_lock), &a));
-}
-
-struct vop_unlock_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- int a_flags;
- struct proc *a_p;
-};
-extern struct vnodeop_desc vop_unlock_desc;
-#define VOP_UNLOCK(vp, flags, p) _VOP_UNLOCK(vp, flags, p)
-static __inline int _VOP_UNLOCK(struct vnode *vp, int flags, struct proc *p)
-{
- struct vop_unlock_args a;
- a.a_desc = VDESC(vop_unlock);
- a.a_vp = vp;
- a.a_flags = flags;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_unlock), &a));
-}
-
-struct vop_bmap_args {
+
+/*!
+ @function VNOP_GETATTRLISTBULK
+ @abstract Call down to get file attributes for many files in a directory at once.
+ @discussion VNOP_GETATTRLISTBULK() packs a buffer with file attributes, as if the results of many "getattrlist" calls.
+ @param vp Directory in which to enumerate entries' attributes.
+ @param alist Which attributes are wanted for each directory entry.
+ @param uio Destination information for resulting attributes.
+ @param vap initialised vnode_attr structure pointer. This structure also has memory allocated (MAXPATHLEN bytes) and assigned to the va_name field for filesystems to use.
+ @param private reserved for future use.
+ @param options
+ @param eofflag Should be set to 1 if the end of the directory has been reached.
+ @param actualcount Should be set to number of files whose attributes were written into buffer.
+ @param ctx Context to authenticate for getattrlistbulk request.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_GETATTRLISTBULK(vnode_t, struct attrlist *, struct vnode_attr *, uio_t, void *, uint64_t, int32_t *, int32_t *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_readlink_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- daddr_t a_bn;
- struct vnode **a_vpp;
- daddr_t *a_bnp;
- int *a_runp;
+ vnode_t a_vp;
+ struct uio *a_uio;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_bmap_desc;
-#define VOP_BMAP(vp, bn, vpp, bnp, runp) _VOP_BMAP(vp, bn, vpp, bnp, runp)
-static __inline int _VOP_BMAP(struct vnode *vp, daddr_t bn, struct vnode **vpp, daddr_t *bnp, int *runp)
-{
- struct vop_bmap_args a;
- a.a_desc = VDESC(vop_bmap);
- a.a_vp = vp;
- a.a_bn = bn;
- a.a_vpp = vpp;
- a.a_bnp = bnp;
- a.a_runp = runp;
- return (VCALL(vp, VOFFSET(vop_bmap), &a));
-}
-
-struct vop_print_args {
+
+/*!
+ @function VNOP_READLINK
+ @abstract Call down to a filesystem to get the pathname represented by a symbolic link.
+ @discussion VNOP_READLINK() gets the path stored in a symbolic link; it is called by namei() and the readlink() system call.
+ @param vp Symbolic link to read from.
+ @param uio Destination information for link path.
+ @param ctx Context to authenticate for readlink request.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_READLINK(vnode_t, struct uio *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_inactive_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_print_desc;
-#define VOP_PRINT(vp) _VOP_PRINT(vp)
-static __inline int _VOP_PRINT(struct vnode *vp)
-{
- struct vop_print_args a;
- a.a_desc = VDESC(vop_print);
- a.a_vp = vp;
- return (VCALL(vp, VOFFSET(vop_print), &a));
-}
-
-struct vop_islocked_args {
+
+/*!
+ @function VNOP_INACTIVE
+ @abstract Notify a filesystem that the last usecount (persistent reference) on a vnode has been dropped.
+ @discussion VNOP_INACTVE() gives a filesystem a chance to aggressively release resources assocated with a vnode, perhaps
+ even to call vnode_recycle(), but no action is prescribed; it is acceptable for VNOP_INACTIVE to be a no-op and
+ to defer all reclamation until VNOP_RECLAIM().
+ VNOP_INACTVE() will not be called on a vnode if no persistent reference is ever taken; an
+ important example is a stat(), which takes an iocount, reads its data, and drops that iocount.
+ @param vp The vnode which is now inactive.
+ @param ctx Context to authenticate for inactive message.
+ @return 0 for success, else an error code, but return value is currently ignored.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_INACTIVE(vnode_t, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_reclaim_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_islocked_desc;
-#define VOP_ISLOCKED(vp) _VOP_ISLOCKED(vp)
-static __inline int _VOP_ISLOCKED(struct vnode *vp)
-{
- struct vop_islocked_args a;
- a.a_desc = VDESC(vop_islocked);
- a.a_vp = vp;
- return (VCALL(vp, VOFFSET(vop_islocked), &a));
-}
-
-struct vop_pathconf_args {
+
+/*!
+ @function VNOP_RECLAIM
+ @abstract Release filesystem-internal resources for a vnode.
+ @discussion VNOP_RECLAIM() is called as part of the process of recycling a vnode. During
+ a reclaim routine, a filesystem should remove a vnode from its hash and deallocate any resources
+ allocated to that vnode. VFS guarantees that when VNOP_RECLAIM() is called, there are no more
+ iocount references on a vnode (though there may still be usecount references--these are invalidated
+ by the reclaim) and that no more will be granted. This means in practice that there will be no
+ filesystem calls on the vnode being reclaimed until the reclaim has finished and the vnode has
+ been reused.
+ @param vp The vnode to reclaim.
+ @param ctx Context to authenticate for reclaim.
+ @return 0 for success, or an error code. A nonzero return value results in a panic.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_RECLAIM(vnode_t, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_pathconf_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
int a_name;
- register_t *a_retval;
+ int32_t *a_retval;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_pathconf_desc;
-#define VOP_PATHCONF(vp, name, retval) _VOP_PATHCONF(vp, name, retval)
-static __inline int _VOP_PATHCONF(struct vnode *vp, int name, register_t *retval)
-{
- struct vop_pathconf_args a;
- a.a_desc = VDESC(vop_pathconf);
- a.a_vp = vp;
- a.a_name = name;
- a.a_retval = retval;
- return (VCALL(vp, VOFFSET(vop_pathconf), &a));
-}
-
-struct vop_advlock_args {
+
+/*!
+ @function VNOP_PATHCONF
+ @abstract Query a filesystem for path properties.
+ @param vp The vnode whose filesystem to query.
+ @param name Which property to request: see unistd.h. For example: _PC_CASE_SENSITIVE (is
+ a filesystem case-sensitive?). Only one property can be requested at a time.
+ @param retval Destination for value of property.
+ @param ctx Context to authenticate for pathconf request.
+ @return 0 for success, or an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_PATHCONF(vnode_t, int, int32_t *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_advlock_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
caddr_t a_id;
int a_op;
struct flock *a_fl;
int a_flags;
+ vfs_context_t a_context;
+ struct timespec *a_timeout;
};
-extern struct vnodeop_desc vop_advlock_desc;
-#define VOP_ADVLOCK(vp, id, op, fl, flags) _VOP_ADVLOCK(vp, id, op, fl, flags)
-static __inline int _VOP_ADVLOCK(struct vnode *vp, caddr_t id, int op, struct flock *fl, int flags)
-{
- struct vop_advlock_args a;
- a.a_desc = VDESC(vop_advlock);
- a.a_vp = vp;
- a.a_id = id;
- a.a_op = op;
- a.a_fl = fl;
- a.a_flags = flags;
- return (VCALL(vp, VOFFSET(vop_advlock), &a));
-}
-
-struct vop_blkatoff_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- off_t a_offset;
- char **a_res;
- struct buf **a_bpp;
-};
-extern struct vnodeop_desc vop_blkatoff_desc;
-#define VOP_BLKATOFF(vp, offset, res, bpp) _VOP_BLKATOFF(vp, offset, res, bpp)
-static __inline int _VOP_BLKATOFF(struct vnode *vp, off_t offset, char **res, struct buf **bpp)
-{
- struct vop_blkatoff_args a;
- a.a_desc = VDESC(vop_blkatoff);
- a.a_vp = vp;
- a.a_offset = offset;
- a.a_res = res;
- a.a_bpp = bpp;
- return (VCALL(vp, VOFFSET(vop_blkatoff), &a));
-}
-
-struct vop_valloc_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_pvp;
- int a_mode;
- struct ucred *a_cred;
- struct vnode **a_vpp;
-};
-extern struct vnodeop_desc vop_valloc_desc;
-#define VOP_VALLOC(pvp, mode, cred, vpp) _VOP_VALLOC(pvp, mode, cred, vpp)
-static __inline int _VOP_VALLOC(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp)
-{
- struct vop_valloc_args a;
- a.a_desc = VDESC(vop_valloc);
- a.a_pvp = pvp;
- a.a_mode = mode;
- a.a_cred = cred;
- a.a_vpp = vpp;
- return (VCALL(pvp, VOFFSET(vop_valloc), &a));
-}
-
-struct vop_reallocblks_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct cluster_save *a_buflist;
-};
-extern struct vnodeop_desc vop_reallocblks_desc;
-#define VOP_REALLOCBLKS(vp, buflist) _VOP_REALLOCBLKS(vp, buflist)
-static __inline int _VOP_REALLOCBLKS(struct vnode *vp, struct cluster_save *buflist)
-{
- struct vop_reallocblks_args a;
- a.a_desc = VDESC(vop_reallocblks);
- a.a_vp = vp;
- a.a_buflist = buflist;
- return (VCALL(vp, VOFFSET(vop_reallocblks), &a));
-}
-
-struct vop_vfree_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_pvp;
- ino_t a_ino;
- int a_mode;
-};
-extern struct vnodeop_desc vop_vfree_desc;
-#define VOP_VFREE(pvp, ino, mode) _VOP_VFREE(pvp, ino, mode)
-static __inline int _VOP_VFREE(struct vnode *pvp, ino_t ino, int mode)
-{
- struct vop_vfree_args a;
- a.a_desc = VDESC(vop_vfree);
- a.a_pvp = pvp;
- a.a_ino = ino;
- a.a_mode = mode;
- return (VCALL(pvp, VOFFSET(vop_vfree), &a));
-}
-
-struct vop_truncate_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- off_t a_length;
- int a_flags;
- struct ucred *a_cred;
- struct proc *a_p;
-};
-extern struct vnodeop_desc vop_truncate_desc;
-#define VOP_TRUNCATE(vp, length, flags, cred, p) _VOP_TRUNCATE(vp, length, flags, cred, p)
-static __inline int _VOP_TRUNCATE(struct vnode *vp, off_t length, int flags, struct ucred *cred, struct proc *p)
-{
- struct vop_truncate_args a;
- a.a_desc = VDESC(vop_truncate);
- a.a_vp = vp;
- a.a_length = length;
- a.a_flags = flags;
- a.a_cred = cred;
- a.a_p = p;
- {
- int _err;
- extern int ubc_hold(struct vnode *vp);
- extern void ubc_rele(struct vnode *vp);
- int _didhold = ubc_hold(vp);
- _err = VCALL(vp, VOFFSET(vop_truncate), &a);
- if (_didhold)
- ubc_rele(vp);
- return (_err);
- }
-}
-
-struct vop_allocate_args {
+
+/*!
+ @function VNOP_ADVLOCK
+ @abstract Aquire or release and advisory lock on a vnode.
+ @discussion Advisory locking is somewhat complicated. VNOP_ADVLOCK is overloaded for
+ both flock() and POSIX advisory locking usage, though not all filesystems support both (or any). VFS
+ provides an advisory locking mechanism for filesystems which can take advantage of it; vfs_setlocklocal()
+ marks a filesystem as using VFS advisory locking support.
+ @param vp The vnode to lock or unlock.
+ @param id Identifier for lock holder: ignored by most filesystems.
+ @param op Which locking operation: F_SETLK: set locking information about a region.
+ F_GETLK: get locking information about the specified region. F_UNLCK: Unlock a region.
+ @param fl Description of file region to lock. l_whence is as with "lseek."
+ Includes a type: F_RDLCK (shared lock), F_UNLCK (unlock) , and F_WRLCK (exclusive lock).
+ @param flags F_FLOCK: use flock() semantics. F_POSIX: use POSIX semantics. F_WAIT: sleep if necessary.
+ F_PROV: Non-coelesced provisional lock (unused in xnu).
+ @param ctx Context to authenticate for advisory locking request.
+ @param timeout Timespec for timeout in case of F_SETLKWTIMEOUT.
+ @return 0 for success, or an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_ADVLOCK(vnode_t, caddr_t, int, struct flock *, int, vfs_context_t, struct timespec *);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_allocate_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
off_t a_length;
u_int32_t a_flags;
off_t *a_bytesallocated;
off_t a_offset;
- struct ucred *a_cred;
- struct proc *a_p;
-};
-extern struct vnodeop_desc vop_allocate_desc;
-#define VOP_ALLOCATE(vp, length, flags, bytesallocated, offset, cred, p) _VOP_ALLOCATE(vp, length, flags, bytesallocated, offset, cred, p)
-static __inline int _VOP_ALLOCATE(struct vnode *vp, off_t length, u_int32_t flags, off_t *bytesallocated, off_t offset, struct ucred *cred, struct proc *p)
-{
- struct vop_allocate_args a;
- a.a_desc = VDESC(vop_allocate);
- a.a_vp = vp;
- a.a_length = length;
- a.a_flags = flags;
- a.a_bytesallocated = bytesallocated;
- a.a_offset = offset;
- a.a_cred = cred;
- a.a_p = p;
- return (VCALL(vp, VOFFSET(vop_allocate), &a));
-}
-
-struct vop_update_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct timeval *a_access;
- struct timeval *a_modify;
- int a_waitfor;
-};
-extern struct vnodeop_desc vop_update_desc;
-#define VOP_UPDATE(vp, access, modify, waitfor) _VOP_UPDATE(vp, access, modify, waitfor)
-static __inline int _VOP_UPDATE(struct vnode *vp, struct timeval *access, struct timeval *modify, int waitfor)
-{
- struct vop_update_args a;
- a.a_desc = VDESC(vop_update);
- a.a_vp = vp;
- a.a_access = access;
- a.a_modify = modify;
- a.a_waitfor = waitfor;
- return (VCALL(vp, VOFFSET(vop_update), &a));
-}
-
-struct vop_pgrd_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct uio *a_uio;
- struct ucred *a_cred;
-};
-extern struct vnodeop_desc vop_pgrd_desc;
-#define VOP_PGRD(vp, uio, cred) _VOP_PGRD(vp, uio, cred)
-static __inline int _VOP_PGRD(struct vnode *vp, struct uio *uio, struct ucred *cred)
-{
- struct vop_pgrd_args a;
- a.a_desc = VDESC(vop_pgrd);
- a.a_vp = vp;
- a.a_uio = uio;
- a.a_cred = cred;
- return (VCALL(vp, VOFFSET(vop_pgrd), &a));
-}
-
-struct vop_pgwr_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct uio *a_uio;
- struct ucred *a_cred;
- vm_offset_t a_offset;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_pgwr_desc;
-#define VOP_PGWR(vp, uio, cred, offset) _VOP_PGWR(vp, uio, cred, offset)
-static __inline int _VOP_PGWR(struct vnode *vp, struct uio *uio, struct ucred *cred, vm_offset_t offset)
-{
- struct vop_pgwr_args a;
- a.a_desc = VDESC(vop_pgwr);
- a.a_vp = vp;
- a.a_uio = uio;
- a.a_cred = cred;
- a.a_offset = offset;
- return (VCALL(vp, VOFFSET(vop_pgwr), &a));
-}
-
-struct vop_pagein_args {
+
+/*!
+ @function VNOP_ALLOCATE
+ @abstract Pre-allocate space for a file.
+ @discussion VNOP_ALLOCATE() changes the amount of backing store set aside to
+ a file. It can be used to either shrink or grow a file. If the file shrinks,
+ its ubc size will be modified accordingly, but if it grows, then the ubc size is unchanged;
+ space is set aside without being actively used by the file. VNOP_ALLOCATE() is currently only
+ called as part of the F_PREALLOCATE fcntl.
+ @param vp The vnode for which to preallocate space.
+ @param length Desired preallocated file length.
+ @param flags
+ PREALLOCATE: preallocate allocation blocks.
+ ALLOCATECONTIG: allocate contigious space.
+ ALLOCATEALL: allocate all requested space or no space at all.
+ FREEREMAINDER: deallocate allocated but unfilled blocks.
+ ALLOCATEFROMPEOF: allocate from the physical eof.
+ ALLOCATEFROMVOL: allocate from the volume offset.
+ @param bytesallocated Additional bytes set aside for file. Set to 0 if none are allocated
+ OR if the file is contracted.
+ @param offset Hint for where to find free blocks.
+ @param ctx Context to authenticate for allocation request.
+ @return 0 for success, or an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_ALLOCATE(vnode_t, off_t, u_int32_t, off_t *, off_t, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_pagein_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
upl_t a_pl;
- vm_offset_t a_pl_offset;
+ upl_offset_t a_pl_offset;
off_t a_f_offset;
size_t a_size;
- struct ucred *a_cred;
int a_flags;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_pagein_desc;
-#define VOP_PAGEIN(vp, pl, pl_offset, f_offset, size, cred, flags) _VOP_PAGEIN(vp, pl, pl_offset, f_offset, size, cred, flags)
-static __inline int _VOP_PAGEIN(struct vnode *vp, upl_t pl, vm_offset_t pl_offset, off_t f_offset, size_t size, struct ucred *cred, int flags)
-{
- struct vop_pagein_args a;
- a.a_desc = VDESC(vop_pagein);
- a.a_vp = vp;
- a.a_pl = pl;
- a.a_pl_offset = pl_offset;
- a.a_f_offset = f_offset;
- a.a_size = size;
- a.a_cred = cred;
- a.a_flags = flags;
- return (VCALL(vp, VOFFSET(vop_pagein), &a));
-}
-
-struct vop_pageout_args {
+
+/*!
+ @function VNOP_PAGEIN
+ @abstract Pull file data into memory.
+ @discussion VNOP_PAGEIN() is called by when a process faults on data mapped from a file or
+ when madvise() demands pre-fetching. It is conceptually somewhat similar to VNOP_READ(). Filesystems
+ are typically expected to call cluster_pagein() to handle the labor of mapping and committing the UPL.
+ @param vp The vnode for which to page in data.
+ @param pl UPL describing pages needing to be paged in.
+ @param pl_offset Offset in UPL at which to start placing data.
+ @param f_offset Offset in file of data needing to be paged in.
+ @param size Amount of data to page in (in bytes).
+ @param flags UPL-style flags: UPL_IOSYNC, UPL_NOCOMMIT, UPL_NORDAHEAD, UPL_VNODE_PAGER, UPL_MSYNC.
+ Filesystems should generally leave it to the cluster layer to handle these flags. See the
+ memory_object_types.h header in the kernel framework if interested.
+ @param ctx Context to authenticate for pagein request.
+ @return 0 for success, or an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_PAGEIN(vnode_t, upl_t, upl_offset_t, off_t, size_t, int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_pageout_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
upl_t a_pl;
- vm_offset_t a_pl_offset;
+ upl_offset_t a_pl_offset;
off_t a_f_offset;
size_t a_size;
- struct ucred *a_cred;
int a_flags;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_pageout_desc;
-#define VOP_PAGEOUT(vp, pl, pl_offset, f_offset, size, cred, flags) _VOP_PAGEOUT(vp, pl, pl_offset, f_offset, size, cred, flags)
-static __inline int _VOP_PAGEOUT(struct vnode *vp, upl_t pl, vm_offset_t pl_offset, off_t f_offset, size_t size, struct ucred *cred, int flags)
-{
- struct vop_pageout_args a;
- a.a_desc = VDESC(vop_pageout);
- a.a_vp = vp;
- a.a_pl = pl;
- a.a_pl_offset = pl_offset;
- a.a_f_offset = f_offset;
- a.a_size = size;
- a.a_cred = cred;
- a.a_flags = flags;
- return (VCALL(vp, VOFFSET(vop_pageout), &a));
-}
-
-struct vop_devblocksize_args {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- register_t *a_retval;
-};
-extern struct vnodeop_desc vop_devblocksize_desc;
-#define VOP_DEVBLOCKSIZE(vp, retval) _VOP_DEVBLOCKSIZE(vp, retval)
-static __inline int _VOP_DEVBLOCKSIZE(struct vnode *vp, register_t *retval)
-{
- struct vop_devblocksize_args a;
- a.a_desc = VDESC(vop_devblocksize);
- a.a_vp = vp;
- a.a_retval = retval;
- return (VCALL(vp, VOFFSET(vop_devblocksize), &a));
-}
-
-struct vop_searchfs_args {
+
+/*!
+ @function VNOP_PAGEOUT
+ @abstract Write data from a mapped file back to disk.
+ @discussion VNOP_PAGEOUT() is called when data from a mapped file needs to be flushed to disk, either
+ because of an msync() call or due to memory pressure. Filesystems are for the most part expected to
+ just call cluster_pageout(). However, if they opt into the VFC_VFSVNOP_PAGEOUTV2 flag, then
+ they will be responsible for creating their own UPLs.
+ @param vp The vnode for which to page out data.
+ @param pl UPL describing pages needed to be paged out. If UPL is NULL, then it means the filesystem
+ has opted into VFC_VFSVNOP_PAGEOUTV2 semantics, which means that it will create and operate on its own UPLs
+ as opposed to relying on the one passed down into the filesystem. This means that the filesystem must be
+ responsible for N cluster_pageout calls for N dirty ranges in the UPL.
+ @param pl_offset Offset in UPL from which to start paging out data. Under the new VFC_VFSVNOP_PAGEOUTV2
+ semantics, this is the offset in the range specified that must be paged out if the associated page is dirty.
+ @param f_offset Offset in file of data needing to be paged out. Under the new VFC_VFSVNOP_PAGEOUTV2
+ semantics, this represents the offset in the file where we should start looking for dirty pages.
+ @param size Amount of data to page out (in bytes). Under VFC_VFSVNOP_PAGEOUTV2, this represents
+ the size of the range to be considered. The fileystem is free to extend or shrink the specified range
+ to better fit its blocking model as long as the page at 'pl_offset' is included.
+ @param flags UPL-style flags: UPL_IOSYNC, UPL_NOCOMMIT, UPL_NORDAHEAD, UPL_VNODE_PAGER, UPL_MSYNC.
+ Filesystems should generally leave it to the cluster layer to handle these flags. See the
+ memory_object_types.h header in the kernel framework if interested.
+ @param ctx Context to authenticate for pageout request.
+ @return 0 for success, or an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_PAGEOUT(vnode_t, upl_t, upl_offset_t, off_t, size_t, int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_searchfs_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
void *a_searchparams1;
void *a_searchparams2;
struct attrlist *a_searchattrs;
- u_long a_maxmatches;
+ uint32_t a_maxmatches;
struct timeval *a_timelimit;
struct attrlist *a_returnattrs;
- u_long *a_nummatches;
- u_long a_scriptcode;
- u_long a_options;
+ uint32_t *a_nummatches;
+ uint32_t a_scriptcode;
+ uint32_t a_options;
struct uio *a_uio;
struct searchstate *a_searchstate;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_searchfs_desc;
-#define VOP_SEARCHFS(vp, searchparams1, searchparams2, searchattrs, maxmatches, timelimit, returnattrs, nummatches, scriptcode, options, uio, searchstate) _VOP_SEARCHFS(vp, searchparams1, searchparams2, searchattrs, maxmatches, timelimit, returnattrs, nummatches, scriptcode, options, uio, searchstate)
-static __inline int _VOP_SEARCHFS(struct vnode *vp, void *searchparams1, void *searchparams2, struct attrlist *searchattrs, u_long maxmatches, struct timeval *timelimit, struct attrlist *returnattrs, u_long *nummatches, u_long scriptcode, u_long options, struct uio *uio, struct searchstate *searchstate)
-{
- struct vop_searchfs_args a;
- a.a_desc = VDESC(vop_searchfs);
- a.a_vp = vp;
- a.a_searchparams1 = searchparams1;
- a.a_searchparams2 = searchparams2;
- a.a_searchattrs = searchattrs;
- a.a_maxmatches = maxmatches;
- a.a_timelimit = timelimit;
- a.a_returnattrs = returnattrs;
- a.a_nummatches = nummatches;
- a.a_scriptcode = scriptcode;
- a.a_options = options;
- a.a_uio = uio;
- a.a_searchstate = searchstate;
- return (VCALL(vp, VOFFSET(vop_searchfs), &a));
-}
-
-struct vop_copyfile_args {
+
+/*
+ @function VNOP_SEARCHFS
+ @abstract Search a filesystem quickly for files or directories that match the passed-in search criteria.
+ @discussion VNOP_SEARCHFS is a getattrlist-based system call which is implemented almost entirely inside
+ supported filesystems. Callers provide a set of criteria to match against, and the filesystem is responsible
+ for finding all files or directories that match the criteria. Once these files or directories are found,
+ the user-requested attributes of these files is provided as output. The set of searchable attributes is a
+ subset of the getattrlist attributes. For example, ATTR_CMN_UUID is not a valid searchable attribute as of
+ 10.6. A common usage scenario could be to request all files whose mod dates is greater than time X, less than
+ time Y, and provide the inode ID and filename of the matching objects as output.
+ @param vp The vnode representing the mountpoint of the filesystem to be searched.
+ @param a_searchparams1 If one-argument search criteria is requested, the search criteria would go here. However,
+ some search criteria, like ATTR_CMN_MODTIME, can be bounded. The user could request files modified between time X
+ and time Y. In this case, the lower bound goes in a_searchparams1.
+ @param a_searchparams2 If two-argument search criteria is requested, the upper bound goes in here.
+ @param a_searchattrs Contains the getattrlist-style attribute bits which are requested by the current search.
+ @param a_maxmatches The maximum number of matches to return in a single system call.
+ @param a_timelimit The suggested maximum amount of time we can spend in the kernel to service this system call.
+ Filesystems should use this as a guide only, and set their own internal maximum time to avoid denial of service.
+ @param a_returnattrs The getattrlist-style attributes to return for items in the filesystem that match the search
+ criteria above.
+ @param a_scriptcode Currently ignored.
+ @param a_uio The uio in which to write out the search matches.
+ @param a_searchstate Sometimes searches cannot be completed in a single system call. In this case, we provide
+ an identifier back to the user which indicates where to resume a previously-started search. This is an opaque structure
+ used by the filesystem to identify where to resume said search.
+ @param a_context The context in which to perform the filesystem search.
+ @return 0 on success, EAGAIN for searches which could not be completed in 1 call, and other ERRNOS as needed.
+ */
+
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_SEARCHFS(vnode_t, void *, void *, struct attrlist *, uint32_t, struct timeval *, struct attrlist *, uint32_t *, uint32_t, uint32_t, struct uio *, struct searchstate *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_copyfile_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_fvp;
- struct vnode *a_tdvp;
- struct vnode *a_tvp;
+ vnode_t a_fvp;
+ vnode_t a_tdvp;
+ vnode_t a_tvp;
struct componentname *a_tcnp;
int a_mode;
int a_flags;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_copyfile_desc;
-#define VOP_COPYFILE(fvp, tdvp, tvp, tcnp, mode, flags) _VOP_COPYFILE(fvp, tdvp, tvp, tcnp, mode, flags)
-static __inline int _VOP_COPYFILE(struct vnode *fvp, struct vnode *tdvp, struct vnode *tvp, struct componentname *tcnp, int mode, int flags)
-{
- struct vop_copyfile_args a;
- a.a_desc = VDESC(vop_copyfile);
- a.a_fvp = fvp;
- a.a_tdvp = tdvp;
- a.a_tvp = tvp;
- a.a_tcnp = tcnp;
- a.a_mode = mode;
- a.a_flags = flags;
- return (VCALL(fvp, VOFFSET(vop_copyfile), &a));
-}
-
-struct vop_blktooff_args {
+
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_COPYFILE(vnode_t, vnode_t, vnode_t, struct componentname *, int, int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_getxattr_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- daddr_t a_lblkno;
+ vnode_t a_vp;
+ const char * a_name;
+ uio_t a_uio;
+ size_t *a_size;
+ int a_options;
+ vfs_context_t a_context;
+};
+extern struct vnodeop_desc vnop_getxattr_desc;
+
+/*!
+ @function VNOP_GETXATTR
+ @abstract Get extended file attributes.
+ @param vp The vnode to get extended attributes for.
+ @param name Which property to extract.
+ @param uio Destination information for attribute value.
+ @param size Should be set to the amount of data written.
+ @param options XATTR_NOSECURITY: bypass security-checking.
+ @param ctx Context to authenticate for getxattr request.
+ @return 0 for success, or an error code.
+ */
+extern errno_t VNOP_GETXATTR(vnode_t, const char *, uio_t, size_t *, int, vfs_context_t);
+
+struct vnop_setxattr_args {
+ struct vnodeop_desc *a_desc;
+ vnode_t a_vp;
+ const char * a_name;
+ uio_t a_uio;
+ int a_options;
+ vfs_context_t a_context;
+};
+extern struct vnodeop_desc vnop_setxattr_desc;
+
+/*!
+ @function VNOP_SETXATTR
+ @abstract Set extended file attributes.
+ @param vp The vnode to set extended attributes for.
+ @param name Which property to extract.
+ @param uio Source information for attribute value.
+ @param options XATTR_NOSECURITY: bypass security-checking. XATTR_CREATE: set value, fail if exists.
+ XATTR_REPLACE: set value, fail if does not exist.
+ @param ctx Context to authenticate for setxattr request.
+ @return 0 for success, or an error code.
+ */
+extern errno_t VNOP_SETXATTR(vnode_t, const char *, uio_t, int, vfs_context_t);
+
+struct vnop_removexattr_args {
+ struct vnodeop_desc *a_desc;
+ vnode_t a_vp;
+ const char * a_name;
+ int a_options;
+ vfs_context_t a_context;
+};
+extern struct vnodeop_desc vnop_removexattr_desc;
+
+/*!
+ @function VNOP_REMOVEXATTR
+ @abstract Remove extended file attributes.
+ @param vp The vnode from which to remove extended attributes.
+ @param name Which attribute to delete.
+ @param options XATTR_NOSECURITY: bypass security-checking.
+ @param ctx Context to authenticate for attribute delete request.
+ @return 0 for success, or an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_REMOVEXATTR(vnode_t, const char *, int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_listxattr_args {
+ struct vnodeop_desc *a_desc;
+ vnode_t a_vp;
+ uio_t a_uio;
+ size_t *a_size;
+ int a_options;
+ vfs_context_t a_context;
+};
+extern struct vnodeop_desc vnop_listxattr_desc;
+
+/*!
+ @function VNOP_LISTXATTR
+ @abstract List extended attribute keys.
+ @discussion Should write a sequence of unseparated, null-terminated extended-attribute
+ names into the space described by the provided uio. These keys can then be passed to
+ getxattr() (and VNOP_GETXATTR()).
+ @param vp The vnode for which to get extended attribute keys.
+ @param uio Description of target memory for attribute keys.
+ @param size Should be set to amount of data written to buffer.
+ @param options XATTR_NOSECURITY: bypass security checking.
+ @param ctx Context to authenticate for attribute name request.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_LISTXATTR(vnode_t, uio_t, size_t *, int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_blktooff_args {
+ struct vnodeop_desc *a_desc;
+ vnode_t a_vp;
+ daddr64_t a_lblkno;
off_t *a_offset;
};
-extern struct vnodeop_desc vop_blktooff_desc;
-#define VOP_BLKTOOFF(vp, lblkno, offset) _VOP_BLKTOOFF(vp, lblkno, offset)
-static __inline int _VOP_BLKTOOFF(struct vnode *vp, daddr_t lblkno, off_t *offset)
-{
- struct vop_blktooff_args a;
- a.a_desc = VDESC(vop_blktooff);
- a.a_vp = vp;
- a.a_lblkno = lblkno;
- a.a_offset = offset;
- return (VCALL(vp, VOFFSET(vop_blktooff), &a));
-}
-
-struct vop_offtoblk_args {
+
+/*!
+ @function VNOP_BLKTOOFF
+ @abstract Call down to a filesystem to convert a logical block number to a file offset.
+ @discussion VNOP_BLKTOOFF() converts a logical block to a file offset in bytes. That offset
+ can be passed to VNOP_BLOCKMAP(), then, to get a physical block number--buf_strategy() does this.
+ @param vp The vnode for which to convert a logical block to an offset.
+ @param lblkno Logical block number to turn into offset.
+ @param offset Destination for file offset.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_BLKTOOFF(vnode_t, daddr64_t, off_t *);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_offtoblk_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
off_t a_offset;
- daddr_t *a_lblkno;
+ daddr64_t *a_lblkno;
};
-extern struct vnodeop_desc vop_offtoblk_desc;
-#define VOP_OFFTOBLK(vp, offset, lblkno) _VOP_OFFTOBLK(vp, offset, lblkno)
-static __inline int _VOP_OFFTOBLK(struct vnode *vp, off_t offset, daddr_t *lblkno)
-{
- struct vop_offtoblk_args a;
- a.a_desc = VDESC(vop_offtoblk);
- a.a_vp = vp;
- a.a_offset = offset;
- a.a_lblkno = lblkno;
- return (VCALL(vp, VOFFSET(vop_offtoblk), &a));
-}
-
-struct vop_cmap_args {
+
+/*!
+ @function VNOP_OFFTOBLK
+ @abstract Call down to a filesystem to convert a file offset to a logical block number.
+ @param vp The vnode for which to convert an offset to a logical block number.
+ @param offset File offset to convert.
+ @param lblkno Destination for corresponding logical block number.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_OFFTOBLK(vnode_t, off_t, daddr64_t *);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_blockmap_args {
struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
+ vnode_t a_vp;
off_t a_foffset;
size_t a_size;
- daddr_t *a_bpn;
+ daddr64_t *a_bpn;
size_t *a_run;
void *a_poff;
+ int a_flags;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_cmap_desc;
-#define VOP_CMAP(vp, foffset, size, bpn, run, poff) _VOP_CMAP(vp, foffset, size, bpn, run, poff)
-static __inline int _VOP_CMAP(struct vnode *vp, off_t foffset, size_t size, daddr_t *bpn, size_t *run, void *poff)
-{
- struct vop_cmap_args a;
- a.a_desc = VDESC(vop_cmap);
- a.a_vp = vp;
- a.a_foffset = foffset;
- a.a_size = size;
- a.a_bpn = bpn;
- a.a_run = run;
- a.a_poff = poff;
- return (VCALL(vp, VOFFSET(vop_cmap), &a));
-}
-
-/* Special cases: */
-#include <sys/buf.h>
-#include <sys/vm.h>
-struct vop_strategy_args {
+/*!
+ @function VNOP_BLOCKMAP
+ @abstract Call down to a filesystem to get information about the on-disk layout of a file region.
+ @discussion VNOP_BLOCKMAP() returns the information required to pass a request for a contiguous region
+ down to a device's strategy routine.
+ @param vp The vnode for which to get on-disk information.
+ @param foffset Offset (in bytes) at which region starts.
+ @param size Size of region.
+ @param bpn Destination for physical block number at which region begins on disk.
+ @param run Destination for number of bytes which can be found contiguously on-disk before
+ first discontinuity.
+ @param poff Currently unused.
+ @param flags VNODE_READ: request is for a read. VNODE_WRITE: request is for a write.
+ @param ctx Context to authenticate for blockmap request; currently often set to NULL.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_BLOCKMAP(vnode_t, off_t, size_t, daddr64_t *, size_t *, void *,
+ int, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_strategy_args {
struct vnodeop_desc *a_desc;
struct buf *a_bp;
};
-extern struct vnodeop_desc vop_strategy_desc;
-#define VOP_STRATEGY(bp) _VOP_STRATEGY(bp)
-static __inline int _VOP_STRATEGY(struct buf *bp)
-{
- struct vop_strategy_args a;
- a.a_desc = VDESC(vop_strategy);
- a.a_bp = bp;
- return (VCALL(bp->b_vp, VOFFSET(vop_strategy), &a));
-}
-
-struct vop_bwrite_args {
+
+/*!
+ @function VNOP_STRATEGY
+ @abstract Initiate I/O on a file (both read and write).
+ @discussion A filesystem strategy routine takes a buffer, performs whatever manipulations are necessary for passing
+ the I/O request down to the device layer, and calls the appropriate device's strategy routine. Most filesystems should
+ just call buf_strategy() with "bp" as the argument.
+ @param bp Complete specificiation of requested I/O: region of data involved, whether request is for read or write, and so on.
+ @return 0 for success, else an error code.
+ */
+extern errno_t VNOP_STRATEGY(struct buf *bp);
+
+struct vnop_bwrite_args {
struct vnodeop_desc *a_desc;
- struct buf *a_bp;
+ buf_t a_bp;
+};
+
+/*!
+ @function VNOP_BWRITE
+ @abstract Write a buffer to backing store.
+ @discussion VNOP_BWRITE() is called by buf_bawrite() (asynchronous write) and potentially by buf_bdwrite() (delayed write)
+ but not by buf_bwrite(). A filesystem may choose to perform some kind of manipulation of the buffer in this routine; it
+ generally will end up calling VFS's default implementation, vn_bwrite() (which calls buf_bwrite() without further ado).
+ @param bp The buffer to write.
+ @return 0 for success, else an error code.
+ */
+extern errno_t VNOP_BWRITE(buf_t);
+
+struct vnop_kqfilt_add_args {
+ struct vnodeop_desc *a_desc;
+ struct vnode *a_vp;
+ struct knote *a_kn;
+ vfs_context_t a_context;
};
-extern struct vnodeop_desc vop_bwrite_desc;
-#define VOP_BWRITE(bp) _VOP_BWRITE(bp)
-static __inline int _VOP_BWRITE(struct buf *bp)
-{
- struct vop_bwrite_args a;
- a.a_desc = VDESC(vop_bwrite);
- a.a_bp = bp;
- return (VCALL(bp->b_vp, VOFFSET(vop_bwrite), &a));
-}
-
-/* End of special cases. */
-
-#endif /* __APPLE_API_UNSTABLE */
+extern struct vnodeop_desc vnop_kqfilt_add_desc;
+
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_KQFILT_ADD(vnode_t , struct knote *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_kqfilt_remove_args {
+ struct vnodeop_desc *a_desc;
+ struct vnode *a_vp;
+ uintptr_t a_ident;
+ vfs_context_t a_context;
+};
+extern struct vnodeop_desc vnop_kqfilt_remove_desc;
+
+#ifdef XNU_KERNEL_PRIVATE
+errno_t VNOP_KQFILT_REMOVE(vnode_t , uintptr_t , vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+
+#ifdef KERNEL_PRIVATE
+#define VNODE_MONITOR_BEGIN 0x01
+#define VNODE_MONITOR_END 0x02
+#define VNODE_MONITOR_UPDATE 0x04
+struct vnop_monitor_args {
+ struct vnodeop_desc *a_desc;
+ vnode_t a_vp;
+ uint32_t a_events;
+ uint32_t a_flags;
+ void *a_handle;
+ vfs_context_t a_context;
+};
+extern struct vnodeop_desc vnop_monitor_desc;
+#endif /* KERNEL_PRIVATE */
+
+#ifdef XNU_KERNEL_PRIVATE
+/*!
+ @function VNOP_MONITOR
+ @abstract Indicate to a filesystem that the number of watchers of a file has changed.
+ @param vp The vnode whose watch state has changed.
+ @param events Unused. Filesystems can ignore this parameter.
+ @param flags Type of change to the watch state. VNODE_MONITOR_BEGIN is passed when the kernel
+ begins tracking a new watcher of a file. VNODE_MONITOR_END is passed when a watcher stops watching a file.
+ VNODE_MONITOR_UPDATE is currently unused. A filesystem is guaranteed that each VNODE_MONITOR_BEGIN
+ will be matched by a VNODE_MONITOR_END with the same "handle" argument.
+ @param handle Unique identifier for a given watcher. A VNODE_MONITOR_BEGIN for a given handle will be matched with a
+ VNODE_MONITOR_END for the same handle; a filesystem need not consider this parameter unless
+ it for some reason wants be able to match specific VNOP_MONITOR calls rather than just keeping
+ a count.
+ @param ctx The context which is starting to monitor a file or ending a watch on a file. A matching
+ pair of VNODE_MONITOR_BEGIN and VNODE_MONITOR_END need not have the same context.
+ @discussion VNOP_MONITOR() is intended to let networked filesystems know when they should bother
+ listening for changes to files which occur remotely, so that they can post notifications using
+ vnode_notify(). Local filesystems should not implement a monitor vnop.
+ It is called when there is a new watcher for a file or when a watcher for a file goes away.
+ Each BEGIN will be matched with an END with the same handle. Note that vnode_ismonitored() can
+ be used to see if there are currently watchers for a file.
+ */
+errno_t VNOP_MONITOR(vnode_t , uint32_t, uint32_t, void*, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct label;
+struct vnop_setlabel_args {
+ struct vnodeop_desc *a_desc;
+ struct vnode *a_vp;
+ struct label *a_vl;
+ vfs_context_t a_context;
+};
+extern struct vnodeop_desc vnop_setlabel_desc;
+
+/*!
+ @function VNOP_SETLABEL
+ @abstract Associate a MACF label with a file.
+ @param vp The vnode to label.
+ @param label The desired label.
+ @param ctx Context to authenticate for label change.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+errno_t VNOP_SETLABEL(vnode_t, struct label *, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+#ifdef __APPLE_API_UNSTABLE
+
+#if NAMEDSTREAMS
+
+enum nsoperation { NS_OPEN, NS_CREATE, NS_DELETE };
+
+struct vnop_getnamedstream_args {
+ struct vnodeop_desc *a_desc;
+ vnode_t a_vp;
+ vnode_t *a_svpp;
+ const char *a_name;
+ enum nsoperation a_operation;
+ int a_flags;
+ vfs_context_t a_context;
+};
+
+/*!
+ @function VNOP_GETNAMEDSTREAM
+ @abstract Get a named stream associated with a file.
+ @discussion If this call sucecss, svpp should be returned with an iocount which the caller
+ will drop. VFS provides a facility for simulating named streams when interacting with filesystems
+ which do not support them.
+ @param vp The vnode for which to get a named stream.
+ @param svpp Destination for pointer to named stream's vnode.
+ @param name The name of the named stream, e.g. "com.apple.ResourceFork".
+ @param operation Operation to perform. In HFS and AFP, this parameter is only considered as follows:
+ if the resource fork has not been opened and the operation is not NS_OPEN, fail with ENOATTR. Currently
+ only passed as NS_OPEN by VFS.
+ @param flags Currently unused.
+ @param ctx Context to authenticate for getting named stream.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_GETNAMEDSTREAM(vnode_t, vnode_t *, const char *, enum nsoperation, int flags, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_makenamedstream_args {
+ struct vnodeop_desc *a_desc;
+ vnode_t *a_svpp;
+ vnode_t a_vp;
+ const char *a_name;
+ int a_flags;
+ vfs_context_t a_context;
+};
+
+/*!
+ @function VNOP_MAKENAMEDSTREAM
+ @abstract Create a named stream associated with a file.
+ @discussion If this call succeeds, svpp should be returned with an iocount which the caller will drop.
+ VFS provides a facility for simulating named streams when interacting with filesystems
+ which do not support them.
+ @param vp The vnode for which to get a named stream.
+ @param svpp Destination for pointer to named stream's vnode.
+ @param name The name of the named stream, e.g. "com.apple.ResourceFork".
+ @param flags Currently unused.
+ @param ctx Context to authenticate creating named stream.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_MAKENAMEDSTREAM(vnode_t, vnode_t *, const char *, int flags, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+
+struct vnop_removenamedstream_args {
+ struct vnodeop_desc *a_desc;
+ vnode_t a_vp;
+ vnode_t a_svp;
+ const char *a_name;
+ int a_flags;
+ vfs_context_t a_context;
+};
+
+/*!
+ @function VNOP_REMOVENAMEDSTREAM
+ @abstract Delete a named stream associated with a file.
+ @discussion VFS provides a facility for simulating named streams when interacting with filesystems
+ which do not support them.
+ @param vp The vnode to which the named stream belongs.
+ @param svp The named stream's vnode.
+ @param name The name of the named stream, e.g. "com.apple.ResourceFork".
+ @param flags Currently unused.
+ @param ctx Context to authenticate deleting named stream.
+ @return 0 for success, else an error code.
+ */
+#ifdef XNU_KERNEL_PRIVATE
+extern errno_t VNOP_REMOVENAMEDSTREAM(vnode_t, vnode_t, const char *, int flags, vfs_context_t);
+#endif /* XNU_KERNEL_PRIVATE */
+#endif
+
+#endif
+
+__END_DECLS
+
+#endif /* KERNEL */
+
#endif /* !_SYS_VNODE_IF_H_ */