X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/d26ffc64f583ab2d29df48f13518685602bc8832..d9a64523371fa019c4575bb400cbbc3a50ac9903:/bsd/vfs/kpi_vfs.c diff --git a/bsd/vfs/kpi_vfs.c b/bsd/vfs/kpi_vfs.c index 060866928..f09e98f74 100644 --- a/bsd/vfs/kpi_vfs.c +++ b/bsd/vfs/kpi_vfs.c @@ -103,10 +103,12 @@ #include #include #include +#include #include #include #include +#include #include @@ -120,6 +122,10 @@ #include #endif +#if NULLFS +#include +#endif + #include #define ESUCCESS 0 @@ -1595,12 +1601,16 @@ vfs_ctx_skipatime (vfs_context_t ctx) { if (proc->p_lflag & P_LRAGE_VNODES) { return 1; } - + if (ut) { - if (ut->uu_flag & UT_RAGE_VNODES) { + if (ut->uu_flag & (UT_RAGE_VNODES | UT_ATIME_UPDATE)) { return 1; } } + + if (proc->p_vfs_iopolicy & P_VFS_IOPOLICY_ATIME_UPDATES) { + return 1; + } } return 0; } @@ -2904,6 +2914,20 @@ vnode_ismonitored(vnode_t vp) { return (vp->v_knotes.slh_first != NULL); } +int +vnode_getbackingvnode(vnode_t in_vp, vnode_t* out_vpp) +{ + if (out_vpp) { + *out_vpp = NULLVP; + } +#if NULLFS + return nullfs_getbackingvnode(in_vp, out_vpp); +#else +#pragma unused(in_vp) + return ENOENT; +#endif +} + /* * Initialize a struct vnode_attr and activate the attributes required * by the vnode_notify() call. @@ -4003,37 +4027,35 @@ vn_rename(struct vnode *fdvp, struct vnode **fvpp, struct componentname *fcnp, s * in the rename syscall. It's OK if the source file does not exist, since this * is only for AppleDouble files. */ - if (xfromname != NULL) { - MALLOC(fromnd, struct nameidata *, sizeof (struct nameidata), M_TEMP, M_WAITOK); - NDINIT(fromnd, RENAME, OP_RENAME, NOFOLLOW | USEDVP | CN_NBMOUNTLOOK, - UIO_SYSSPACE, CAST_USER_ADDR_T(xfromname), ctx); - fromnd->ni_dvp = fdvp; - error = namei(fromnd); - - /* - * If there was an error looking up source attribute file, - * we'll behave as if it didn't exist. - */ + MALLOC(fromnd, struct nameidata *, sizeof (struct nameidata), M_TEMP, M_WAITOK); + NDINIT(fromnd, RENAME, OP_RENAME, NOFOLLOW | USEDVP | CN_NBMOUNTLOOK, + UIO_SYSSPACE, CAST_USER_ADDR_T(xfromname), ctx); + fromnd->ni_dvp = fdvp; + error = namei(fromnd); - if (error == 0) { - if (fromnd->ni_vp) { - /* src_attr_vp indicates need to call vnode_put / nameidone later */ - src_attr_vp = fromnd->ni_vp; - - if (fromnd->ni_vp->v_type != VREG) { - src_attr_vp = NULLVP; - vnode_put(fromnd->ni_vp); - } - } - /* - * Either we got an invalid vnode type (not a regular file) or the namei lookup - * suppressed ENOENT as a valid error since we're renaming. Either way, we don't - * have a vnode here, so we drop our namei buffer for the source attribute file - */ - if (src_attr_vp == NULLVP) { - nameidone(fromnd); + /* + * If there was an error looking up source attribute file, + * we'll behave as if it didn't exist. + */ + + if (error == 0) { + if (fromnd->ni_vp) { + /* src_attr_vp indicates need to call vnode_put / nameidone later */ + src_attr_vp = fromnd->ni_vp; + + if (fromnd->ni_vp->v_type != VREG) { + src_attr_vp = NULLVP; + vnode_put(fromnd->ni_vp); } } + /* + * Either we got an invalid vnode type (not a regular file) or the namei lookup + * suppressed ENOENT as a valid error since we're renaming. Either way, we don't + * have a vnode here, so we drop our namei buffer for the source attribute file + */ + if (src_attr_vp == NULLVP) { + nameidone(fromnd); + } } } #endif /* CONFIG_APPLEDOUBLE */ @@ -5466,8 +5488,11 @@ VNOP_CLONEFILE(vnode_t fvp, vnode_t dvp, vnode_t *vpp, _err = (*dvp->v_op[vnop_clonefile_desc.vdesc_offset])(&a); - if (_err == 0 && *vpp) + if (_err == 0 && *vpp) { DTRACE_FSINFO(clonefile, vnode_t, *vpp); + if (kdebug_enable) + kdebug_lookup(*vpp, cnp); + } post_event_if_success(dvp, _err, NOTE_WRITE);