/* * lfs_sane_rename: The hairiest vop, with the saner API. * * Arguments: * * . fdvp (from directory vnode), * . fcnp (from component name), * . tdvp (to directory vnode), * . tcnp (to component name), * . cred (credentials structure), and * . posixly_correct (flag for behaviour if target & source link same file). * * fdvp and tdvp may be the same, and must be referenced and unlocked. */ static int lfs_sane_rename( struct vnode *fdvp, struct componentname *fcnp, struct vnode *tdvp, struct componentname *tcnp, kauth_cred_t cred, bool posixly_correct) { struct ulfs_lookup_results fulr, tulr; /* * XXX Provisional kludge -- ulfs_lookup does not reject rename * of . or .. (from or to), so we hack it here. This is not * the right place: it should be caller's responsibility to * reject this case. */ KASSERT(fcnp != NULL); KASSERT(tcnp != NULL); KASSERT(fcnp != tcnp); KASSERT(fcnp->cn_nameptr != NULL); KASSERT(tcnp->cn_nameptr != NULL); if ((fcnp->cn_flags | tcnp->cn_flags) & ISDOTDOT) return EINVAL; /* XXX EISDIR? */ if ((fcnp->cn_namelen == 1) && (fcnp->cn_nameptr[0] == '.')) return EINVAL; if ((tcnp->cn_namelen == 1) && (tcnp->cn_nameptr[0] == '.')) return EINVAL; return genfs_sane_rename(&lfs_genfs_rename_ops, fdvp, fcnp, &fulr, tdvp, tcnp, &tulr, cred, posixly_correct); }
/* * udf_sane_rename: The hairiest vop, with the saner API. * * Arguments: * * . fdvp (from directory vnode), * . fcnp (from component name), * . tdvp (to directory vnode), * . tcnp (to component name), * . cred (credentials structure), and * . posixly_correct (flag for behaviour if target & source link same file). * * fdvp and tdvp may be the same, and must be referenced and unlocked. */ static int udf_sane_rename( struct vnode *fdvp, struct componentname *fcnp, struct vnode *tdvp, struct componentname *tcnp, kauth_cred_t cred, bool posixly_correct) { DPRINTF(CALL, ("udf_sane_rename '%s' -> '%s'\n", fcnp->cn_nameptr, tcnp->cn_nameptr)); return genfs_sane_rename(&udf_genfs_rename_ops, fdvp, fcnp, NULL, tdvp, tcnp, NULL, cred, posixly_correct); }
/* * mumblefs_sane_rename: The hairiest vop, with the saner API. * * Arguments: * * . fdvp (from directory vnode), * . fcnp (from component name), * . tdvp (to directory vnode), * . tcnp (to component name), * . cred (credentials structure), and * . posixly_correct (flag for behaviour if target & source link same file). * * fdvp and tdvp may be the same, and must be referenced and unlocked. */ static int mumblefs_sane_rename( struct vnode *fdvp, struct componentname *fcnp, struct vnode *tdvp, struct componentname *tcnp, kauth_cred_t cred, bool posixly_correct) { struct mumblefs_lookup_results fulr, tulr; return genfs_sane_rename(&mumblefs_genfs_rename_ops, fdvp, fcnp, &fulr, tdvp, tcnp, &tulr, cred, posixly_correct); }