• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/xnu-2782.1.97/bsd/vfs/

Lines Matching defs:ctx

144 static int change_dir(struct nameidata *ndp, vfs_context_t ctx);
145 static int checkdirs(vnode_t olddp, vfs_context_t ctx);
146 void enablequotas(struct mount *mp, vfs_context_t ctx);
149 static int setutimes(vfs_context_t ctx, vnode_t vp, const struct timespec *ts, int nullflag);
162 vfs_context_t ctx);
165 int prepare_coveredvp(vnode_t vp, vfs_context_t ctx, struct componentname *cnp, const char *fsname, boolean_t skip_auth);
174 static int authorize_devpath_and_update_mntfromname(mount_t mp, user_addr_t devpath, vnode_t *devvpp, vfs_context_t ctx);
175 static int place_mount_and_checkdirs(mount_t mp, vnode_t vp, vfs_context_t ctx);
177 static int mount_begin_update(mount_t mp, vfs_context_t ctx, int flags);
179 static int relocate_imageboot_source(vnode_t pvp, vnode_t vp, struct componentname *cnp, const char *fsname, vfs_context_t ctx, boolean_t is64bit, user_addr_t fsmountargs, boolean_t by_index);
234 void *data, __unused size_t datalen, int syscall_flags, __unused uint32_t kern_flags, vfs_context_t ctx)
241 UIO_SYSSPACE, CAST_USER_ADDR_T(path), ctx);
262 syscall_flags, kern_flags, NULL, TRUE, ctx);
325 vfs_context_t ctx = vfs_context_current();
348 UIO_USERSPACE, uap->path, ctx);
361 ctx, is_64bit, uap->data, (flags == MNT_IMGSRC_BY_INDEX));
441 labelstr, FALSE, ctx);
475 * ctx caller's context
480 char *labelstr, boolean_t kernelmount, vfs_context_t ctx)
492 struct proc *p = vfs_context_proc(ctx);
555 if (mp->mnt_vfsstat.f_owner != kauth_cred_getuid(vfs_context_ucred(ctx)) &&
556 (error = suser(vfs_context_ucred(ctx), &p->p_acflag))) {
560 error = mac_mount_check_remount(ctx, mp);
569 if ((!kernelmount) && suser(vfs_context_ucred(ctx), NULL)) {
587 if ((!kernelmount) && suser(vfs_context_ucred(ctx), NULL)) {
616 error = prepare_coveredvp(vp, ctx, cnp, fstypename, ((internal_flags & KERNEL_MOUNT_NOAUTH) != 0));
655 mp->mnt_vfsstat.f_owner = kauth_cred_getuid(vfs_context_ucred(ctx));
708 if (vfs_context_is64bit(ctx)) {
725 NDINIT(&nd, LOOKUP, OP_MOUNT, FOLLOW, UIO_USERSPACE, devpath, ctx);
746 if (suser(vfs_context_ucred(ctx), NULL) != 0) {
751 if ((error = vnode_authorize(devvp, NULL, accessmode, ctx)) != 0)
772 if ( (error = VNOP_FSYNC(devvp, MNT_WAIT, ctx)) ) {
781 error = mac_vnode_check_open(ctx,
787 if ( (error = VNOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, ctx)) )
804 if (suser(vfs_context_ucred(ctx), NULL) &&
807 ctx)) != 0) {
830 mac_mount_label_associate(ctx, mp);
834 error = mac_mount_check_label_update(ctx, mp);
843 error = VFS_MOUNT(mp, device_vnode, fsmountargs, ctx);
857 enablequotas(mp, ctx);
868 error = VFS_ROOT(mp, &rvp, ctx);
873 error = vnode_label(mp, NULL, rvp, NULL, 0, ctx);
908 error = checkdirs(vp, ctx);
917 (void)VFS_START(mp, 0, ctx);
935 vfs_getattr(mp, &vfsattr, ctx) == 0 &&
964 enablequotas(mp, ctx);
996 VNOP_CLOSE(device_vnode, ronly ? FREAD : FREAD|FWRITE, ctx);
1024 (void)VFS_UNMOUNT(mp, MNT_FORCE, ctx);
1038 ctx);
1089 prepare_coveredvp(vnode_t vp, vfs_context_t ctx, struct componentname *cnp, const char *fsname, boolean_t skip_auth)
1104 if ((error = vnode_getattr(vp, &va, ctx)) ||
1105 (va.va_uid != kauth_cred_getuid(vfs_context_ucred(ctx)) &&
1106 (!vfs_context_issuser(ctx)))) {
1112 if ( (error = VNOP_FSYNC(vp, MNT_WAIT, ctx)) )
1129 error = mac_mount_check_mount(ctx, vp,
1152 authorize_devpath_and_update_mntfromname(mount_t mp, user_addr_t devpath, vnode_t *devvpp, vfs_context_t ctx)
1159 NDINIT(&nd, LOOKUP, OP_LOOKUP, FOLLOW, UIO_USERSPACE, devpath, ctx);
1198 if (!vfs_context_issuser(ctx)) {
1202 if ((error = vnode_authorize(vp, NULL, accessmode, ctx)) != 0) {
1226 place_mount_and_checkdirs(mount_t mp, vnode_t vp, vfs_context_t ctx)
1254 error = checkdirs(vp, ctx);
1280 mount_begin_update(mount_t mp, vfs_context_t ctx, int flags)
1307 if (mp->mnt_vfsstat.f_owner != kauth_cred_getuid(vfs_context_ucred(ctx)) &&
1308 (!vfs_context_issuser(ctx))) {
1313 error = mac_mount_check_remount(ctx, mp);
1353 const char *fsname, vfs_context_t ctx,
1373 if (!vfs_context_issuser(ctx)) {
1452 error = mount_begin_update(mp , ctx, 0);
1471 error = prepare_coveredvp(vp, ctx, cnp, fsname, FALSE);
1492 error = authorize_devpath_and_update_mntfromname(mp, devpath, &devvp, ctx);
1508 error = place_mount_and_checkdirs(mp, vp, ctx);
1572 enablequotas(struct mount *mp, vfs_context_t ctx)
1592 CAST_USER_ADDR_T(qfpath), ctx);
1599 (void) VFS_QUOTACTL(mp, QCMD(Q_QUOTAON, type), 0, qfpath, ctx);
1665 checkdirs(vnode_t olddp, vfs_context_t ctx)
1674 err = VFS_ROOT(olddp->v_mountedhere, &newdp, ctx);
1713 vfs_context_t ctx = vfs_context_current();
1716 UIO_USERSPACE, uap->path, ctx);
1725 error = mac_mount_check_umount(ctx, mp);
1741 return (safedounmount(mp, uap->flags, ctx));
1745 vfs_unmountbyfsid(fsid_t * fsid, int flags, vfs_context_t ctx)
1756 return(safedounmount(mp, flags, ctx));
1765 safedounmount(struct mount *mp, int flags, vfs_context_t ctx)
1768 proc_t p = vfs_context_proc(ctx);
1808 return (dounmount(mp, flags, 1, ctx));
1819 dounmount(struct mount *mp, int flags, int withref, vfs_context_t ctx)
1828 proc_t p = vfs_context_proc(ctx);
1874 (void) dounmount_submounts(mp, flags | MNT_LNOSUB, ctx);
1900 error = VFS_SYNC(mp, MNT_WAIT, ctx);
1912 vfs_nested_trigger_unmounts(mp, flags, ctx);
1929 error = VFS_UNMOUNT(mp, flags, ctx);
1949 ctx);
2019 mp->mnt_triggercallback(mp, VTC_RELEASE, mp->mnt_triggerdata, ctx);
2021 mp->mnt_triggercallback(mp, VTC_REPLACE, mp->mnt_triggerdata, ctx);
2061 vnode_trigger_rearm(coveredvp, ctx);
2090 dounmount_submounts(struct mount *mp, int flags, vfs_context_t ctx)
2139 (void) dounmount(smp, flags, 1, ctx);
2285 vfs_context_t ctx = vfs_context_current();
2291 uap->path, ctx);
2338 error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, datap, ctx);
2395 vfs_context_t ctx = vfs_context_current();
2399 UIO_USERSPACE, uap->path, ctx);
2408 error = vfs_update_vfsstat(mp, ctx, VFS_USER_EVENT);
2594 vfs_context_t ctx = vfs_context_current();
2603 (error = vfs_update_vfsstat(mp, ctx,
2612 error = munge_statfs(mp, sp, fstp->sfsp, &my_size, IS_64BIT_PROCESS(vfs_context_proc(ctx)), FALSE);
2832 * ctx - vfs context of caller
2841 vnode_getfromfd(vfs_context_t ctx, int fd, vnode_t *vpp)
2846 proc_t p = vfs_context_proc(ctx);
2928 vfs_context_t ctx = vfs_context_current();
2938 thread_t th = vfs_context_thread(ctx);
2966 error = mac_vnode_check_chdir(ctx, vp);
2970 error = vnode_authorize(vp, NULL, KAUTH_VNODE_SEARCH, ctx);
2979 error = VFS_ROOT(mp, &tdp, ctx);
2993 thread_t th = vfs_context_thread(ctx);
3050 vfs_context_t ctx = vfs_context_current();
3053 UIO_USERSPACE, uap->path, ctx);
3054 error = change_dir(&nd, ctx);
3067 thread_t th = vfs_context_thread(ctx);
3149 vfs_context_t ctx = vfs_context_current();
3155 UIO_USERSPACE, uap->path, ctx);
3156 error = change_dir(&nd, ctx);
3161 error = mac_vnode_check_chroot(ctx, nd.ni_vp,
3196 change_dir(struct nameidata *ndp, vfs_context_t ctx)
3212 error = mac_vnode_check_chdir(ctx, vp);
3219 error = vnode_authorize(vp, NULL, KAUTH_VNODE_SEARCH, ctx);
3275 open1(vfs_context_t ctx, struct nameidata *ndp, int uflags,
3279 proc_t p = vfs_context_proc(ctx);
3280 uthread_t uu = get_bsdthread_info(vfs_context_thread(ctx));
3300 &fp, &indx, ctx, fp_zalloc, cra)) != 0) {
3379 error = mac_file_check_lock(vfs_context_ucred(ctx), fp->f_fglob,
3384 if ((error = VNOP_ADVLOCK(vp, (caddr_t)fp->f_fglob, F_SETLK, &lf, type, ctx, NULL)))
3390 if ((flags & O_TRUNC) && ((error = vnode_setsize(vp, (off_t)0, 0, ctx)) != 0))
3465 vp, (caddr_t)fp->f_fglob, F_UNLCK, &lf, F_FLOCK, ctx, NULL);
3483 open1at(vfs_context_t ctx, struct nameidata *ndp, int uflags,
3514 error = open1(ctx, ndp, uflags, vap, fp_zalloc, cra,
3521 return (open1(ctx, ndp, uflags, vap, fp_zalloc, cra, retval));
3638 openat_internal(vfs_context_t ctx, user_addr_t path, int flags, int mode,
3641 struct filedesc *fdp = (vfs_context_proc(ctx))->p_fd;
3652 segflg, path, ctx);
3654 return (open1at(ctx, &nd, flags, &va, fileproc_alloc_init, NULL,
3720 vfs_context_t ctx = vfs_context_current();
3742 ctx, fsid.val[0], objid,
3758 ctx, (user_addr_t)buf, uap->oflags, 0, AT_FDCWD, UIO_SYSSPACE, retval);
3769 static int mkfifo1(vfs_context_t ctx, user_addr_t upath, struct vnode_attr *vap);
3775 vfs_context_t ctx = vfs_context_current();
3786 return(mkfifo1(ctx, uap->path, &va));
3791 if ((error = suser(vfs_context_ucred(ctx), &p->p_acflag)))
3794 UIO_USERSPACE, uap->path, ctx);
3822 error = mac_vnode_check_create(ctx,
3828 if ((error = vnode_authorize(dvp, NULL, KAUTH_VNODE_ADD_FILE, ctx)) != 0)
3831 if ((error = vn_create(dvp, &vp, &nd, &va, 0, 0, NULL, ctx)) != 0)
3847 add_fsevent(FSE_CREATE_FILE, ctx,
3877 mkfifo1(vfs_context_t ctx, user_addr_t upath, struct vnode_attr *vap)
3884 UIO_USERSPACE, upath, ctx);
3898 if ((error = vn_authorize_create(dvp, &nd.ni_cnd, vap, ctx, NULL)) != 0)
3901 error = vn_create(dvp, &vp, &nd, vap, 0, 0, NULL, ctx);
4071 linkat_internal(vfs_context_t ctx, int fd1, user_addr_t path, int fd2,
4090 segflg, path, ctx);
4109 if (!kauth_cred_issuser(vfs_context_ucred(ctx))) {
4114 if (vnode_getattr(vp, &dva, ctx) != 0 ||
4116 (dva.va_uid != kauth_cred_getuid(vfs_context_ucred(ctx)))) {
4137 if ((error = mac_vnode_check_link(ctx, dvp, vp, &nd.ni_cnd)) != 0)
4142 if ((error = vnode_authorize(vp, NULL, KAUTH_VNODE_LINKTARGET, ctx)) != 0)
4157 if ((error = vnode_authorize(dvp, NULL, KAUTH_VNODE_ADD_FILE, ctx)) != 0)
4161 error = VNOP_LINK(vp, dvp, &nd.ni_cnd, ctx);
4166 (void)mac_vnode_notify_link(ctx, vp, dvp, &nd.ni_cnd);
4203 kauth_authorize_fileop(vfs_context_ucred(ctx), KAUTH_FILEOP_LINK,
4214 if (get_fse_info(vp, &finfo, ctx) == 0) {
4220 add_fsevent(FSE_CREATE_FILE, ctx,
4226 add_fsevent(FSE_STAT_CHANGED, ctx,
4275 symlinkat_internal(vfs_context_t ctx, user_addr_t path_data, int fd,
4299 segflg, link, ctx);
4307 p = vfs_context_proc(ctx);
4315 error = vnode_flags(dvp, &dfflags, ctx);
4322 error = mac_vnode_check_create(ctx,
4336 error = vnode_authorize(dvp, NULL, KAUTH_VNODE_ADD_FILE, ctx);
4339 error = vnode_authattr_new(dvp, &va, 0, ctx);
4341 error = VNOP_SYMLINK(dvp, &vp, &nd.ni_cnd, &va, path, ctx);
4345 error = vnode_label(vnode_mount(vp), dvp, vp, &nd.ni_cnd, VNODE_LABEL_CREATE, ctx);
4350 error = vnode_setattr_fallback(vp, &va, ctx);
4386 kauth_authorize_fileop(vfs_context_ucred(ctx), KAUTH_FILEOP_SYMLINK,
4402 add_fsevent(FSE_CREATE_FILE, ctx,
4455 unlink1at(vfs_context_t ctx, struct nameidata *ndp, int unlink_flags, int fd)
4511 error = vn_authorize_unlink(dvp, vp, cnp, ctx, NULL);
4530 get_fse_info(vp, &finfo, ctx);
4556 error = vnode_removenamedstream(dvp, vp, XATTR_RESOURCEFORK_NAME, 0, ctx);
4560 error = vn_remove(dvp, &ndp->ni_vp, ndp, flags, vap, ctx);
4585 kauth_authorize_fileop(vfs_context_ucred(ctx),
4605 get_fse_info(vp, &finfo, ctx);
4612 add_fsevent(FSE_DELETE, ctx,
4647 unlink1(vfs_context_t ctx, struct nameidata *ndp, int unlink_flags)
4649 return (unlink1at(ctx, ndp, unlink_flags, AT_FDCWD));
4656 unlinkat_internal(vfs_context_t ctx, int fd, user_addr_t path,
4662 path, ctx);
4663 return (unlink1at(ctx, &nd, 0, fd));
4694 vfs_context_t ctx = vfs_context_current();
4697 uap->path, ctx);
4698 return unlink1(ctx, &nd, VNODE_REMOVE_NODELETEBUSY);
4709 struct vfs_context *ctx;
4724 ctx = vfs_context_current();
4727 error = mac_file_check_get_offset(vfs_context_ucred(ctx),
4730 error = mac_file_check_change_offset(vfs_context_ucred(ctx),
4747 if ((error = vnode_size(vp, &file_size, ctx)) != 0)
4795 access1(vnode_t vp, vnode_t dvp, int uflags, vfs_context_t ctx)
4830 error = mac_vnode_check_access(ctx, vp, uflags);
4837 error = vnode_authorize(vp, dvp, action | KAUTH_VNODE_ACCESS, ctx);
5131 faccessat_internal(vfs_context_t ctx, int fd, user_addr_t path, int amode,
5151 context.vc_ucred = ctx->vc_ucred;
5152 context.vc_thread = ctx->vc_thread;
5229 fstatat_internal(vfs_context_t ctx, user_addr_t path, user_addr_t ub,
5253 segflg, path, ctx);
5280 error = vn_stat(nd.ni_vp, statptr, (xsecurity != USER_ADDR_NULL ? &fsec : NULL), isstat64, ctx);
5297 if (IS_64BIT_PROCESS(vfs_context_proc(ctx))) {
5316 if (IS_64BIT_PROCESS(vfs_context_proc(ctx))) {
5541 vfs_context_t ctx = vfs_context_current();
5544 UIO_USERSPACE, uap->path, ctx);
5549 error = vn_pathconf(nd.ni_vp, uap->name, retval, ctx);
5561 readlinkat_internal(vfs_context_t ctx, int fd, user_addr_t path,
5572 seg, path, ctx);
5588 error = mac_vnode_check_readlink(ctx, vp);
5592 ctx);
5594 error = VNOP_READLINK(vp, auio, ctx);
5627 chflags1(vnode_t vp, int flags, vfs_context_t ctx)
5637 error = mac_vnode_check_setflags(ctx, vp, flags);
5643 if ((error = vnode_authattr(vp, &va, &action, ctx)) != 0)
5650 if (action && ((error = vnode_authorize(vp, NULL, action | KAUTH_VNODE_NOIMMUTABLE, ctx)) != 0))
5652 error = vnode_setattr(vp, &va, ctx);
5670 vfs_context_t ctx = vfs_context_current();
5676 UIO_USERSPACE, uap->path, ctx);
5683 error = chflags1(vp, uap->flags, ctx);
5729 chmod_vnode(vfs_context_t ctx, vnode_t vp, struct vnode_attr *vap)
5746 (error = mac_vnode_check_setmode(ctx, vp, (mode_t)vap->va_mode)) != 0)
5751 if (((error = vnode_authattr(vp, vap, &action, ctx)) != 0) ||
5752 ((error = vnode_authorize(vp, NULL, action, ctx)) != 0)) {
5758 error = vnode_setattr(vp, vap, ctx);
5772 chmodat(vfs_context_t ctx, user_addr_t path, struct vnode_attr *vap,
5780 segflg, path, ctx);
5783 error = chmod_vnode(ctx, nd.ni_vp, vap);
5857 fchmodat_internal(vfs_context_t ctx, user_addr_t path, int mode, int fd,
5865 return (chmodat(ctx, path, &va, fd, flag, segflg));
5994 fchownat_internal(vfs_context_t ctx, int fd, user_addr_t path, uid_t uid,
6008 path, ctx);
6023 error = mac_vnode_check_setowner(ctx, vp, uid, gid);
6029 if ((error = vnode_authattr(vp, &va, &action, ctx)) != 0)
6031 if (action && ((error = vnode_authorize(vp, NULL, action, ctx)) != 0))
6033 error = vnode_setattr(vp, &va, ctx);
6079 vfs_context_t ctx = vfs_context_current();
6111 error = mac_vnode_check_setowner(ctx, vp, uap->uid, uap->gid);
6117 if ((error = vnode_authattr(vp, &va, &action, ctx)) != 0)
6119 if (action && ((error = vnode_authorize(vp, NULL, action, ctx)) != 0)) {
6124 error = vnode_setattr(vp, &va, ctx);
6164 setutimes(vfs_context_t ctx, vnode_t vp, const struct timespec *ts,
6188 error = mac_vnode_check_setutimes(ctx, vp, ts[0], ts[1]);
6192 if ((error = vnode_authattr(vp, &va, &action, ctx)) != 0) {
6199 if ((action != 0) && ((error = vnode_authorize(vp, NULL, action, ctx)) != 0)) {
6204 error = vnode_setattr(vp, &va, ctx);
6221 vfs_context_t ctx = vfs_context_current();
6228 UIO_USERSPACE, uap->path, ctx);
6242 error = setutimes(ctx, nd.ni_vp, ts, usrtvp == USER_ADDR_NULL);
6287 vfs_context_t ctx = vfs_context_current();
6295 UIO_USERSPACE, uap->path, ctx);
6306 error = mac_vnode_check_truncate(ctx, NOCRED, vp);
6311 if ((error = vnode_authattr(vp, &va, &action, ctx)) != 0)
6313 if ((action != 0) && ((error = vnode_authorize(vp, NULL, action, ctx)) != 0))
6315 error = vnode_setattr(vp, &va, ctx);
6328 vfs_context_t ctx = vfs_context_current();
6369 error = mac_vnode_check_truncate(ctx,
6378 error = vnode_setattr(vp, &va, ctx);
6454 vfs_context_t ctx = vfs_context_current();
6468 error = VNOP_FSYNC(vp, flags, ctx);
6477 (void) vnode_flushnamedstream(vp->v_parent, vp, ctx);
6500 vfs_context_t ctx = vfs_context_current();
6509 UIO_USERSPACE, uap->from, ctx);
6516 UIO_USERSPACE, uap->to, ctx);
6534 if ((error = vnode_authorize(tdvp, NULL, KAUTH_VNODE_ADD_FILE, ctx)) != 0)
6547 error = VNOP_COPYFILE(fvp, tdvp, tvp, &tond.ni_cnd, uap->mode, uap->flags, ctx);
6579 renameat_internal(vfs_context_t ctx, int fromfd, user_addr_t from,
6620 segflg, from, ctx);
6624 segflg, to, ctx);
6671 error = vn_authorize_rename(fdvp, fvp, &fromnd->ni_cnd, tdvp, tvp, &tond->ni_cnd, ctx, NULL);
6699 if (VNOP_PATHCONF(fvp, _PC_CASE_SENSITIVE, &pathconf_val, ctx) != 0 ||
6856 get_fse_info(fvp, &from_finfo, ctx);
6867 get_fse_info(tvp, &to_finfo, ctx);
6911 0, ctx);
6953 kauth_authorize_fileop(vfs_context_ucred(ctx),
6972 add_fsevent(FSE_RENAME, ctx,
6979 add_fsevent(FSE_RENAME, ctx,
7135 mkdir1at(vfs_context_t ctx, user_addr_t path, struct vnode_attr *vap, int fd,
7146 path, ctx);
7173 if ((error = vn_authorize_mkdir(dvp, &nd.ni_cnd, vap, ctx, NULL)) != 0) {
7186 path, ctx);
7203 if ((error = vn_create(dvp, &vp, &nd, vap, 0, 0, NULL, ctx)) != 0) {
7222 add_fsevent(FSE_CREATE_DIR, ctx, FSE_ARG_VNODE, vp, FSE_ARG_DONE);
7306 rmdirat_internal(vfs_context_t ctx, int fd, user_addr_t dirpath,
7332 segflg, dirpath, ctx);
7368 error = vn_authorize_rmdir(dvp, vp, &nd.ni_cnd, ctx, NULL);
7387 get_fse_info(vp, &finfo, ctx);
7416 error = vn_rmdir(dvp, &vp, &nd, vap, ctx);
7434 error = rmdir_remove_orphaned_appleDouble(vp, ctx, &restart_flag);
7444 error = vn_rmdir(dvp, &vp, &nd, vap, ctx);
7453 kauth_authorize_fileop(vfs_context_ucred(ctx),
7470 add_fsevent(FSE_DELETE, ctx,
7818 vfs_context_t ctx = vfs_context_current();
7823 uap->path, ctx);
7842 error = mac_vnode_check_revoke(ctx, vp);
7849 if ((error = vnode_getattr(vp, &va, ctx)))
7851 if (kauth_cred_getuid(vfs_context_ucred(ctx)) != va.va_uid &&
7852 (error = suser(vfs_context_ucred(ctx), &p->p_acflag)))
7855 VNOP_REVOKE(vp, REVOKEALL, ctx);
7886 vfs_context_t ctx = vfs_context_current();
7912 error = mac_file_check_change_offset(vfs_context_ucred(ctx),
7932 error = mac_vnode_check_readdir(ctx, vp);
7954 if ((error = vnode_authorize(vp, NULL, action, ctx)) == 0) {
7960 (u_long)(uint32_t)uap->options, &newstate, &eofflag, &count, ctx);
7980 if (lookup_traverse_union(tvp, &vp, ctx) == 0) {
8024 vfs_context_t ctx = vfs_context_current();
8041 UIO_USERSPACE, uap->path1, ctx);
8051 UIO_USERSPACE, uap->path2, ctx);
8084 error = mac_vnode_check_exchangedata(ctx,
8089 if (((error = vnode_authorize(fvp, NULL, KAUTH_VNODE_READ_DATA | KAUTH_VNODE_WRITE_DATA, ctx)) != 0) ||
8090 ((error = vnode_authorize(svp, NULL, KAUTH_VNODE_READ_DATA | KAUTH_VNODE_WRITE_DATA, ctx)) != 0))
8109 get_fse_info(fvp, &f_finfo, ctx);
8110 get_fse_info(svp, &s_finfo, ctx);
8118 error = VNOP_EXCHANGE(fvp, svp, 0, ctx);
8127 kauth_authorize_fileop(vfs_context_ucred(ctx), KAUTH_FILEOP_EXCHANGE,
8147 add_fsevent(FSE_EXCHANGE, ctx,
8202 vfs_context_t ctx = vfs_context_current();
8339 UIO_USERSPACE, uap->path, ctx);
8350 error = VFS_ROOT(vnode_mount(vp), &tvp, ctx);
8377 error = mac_vnode_check_searchfs(ctx, vp, &searchblock.searchattrs);
8414 ctx);
8524 static int vn_open_with_vp(vnode_t vp, int fmode, vfs_context_t ctx);
8856 vn_open_with_vp(vnode_t vp, int fmode, vfs_context_t ctx)
8865 error = mac_vnode_check_open(ctx, vp, fmode);
8889 if ((error = vnode_authorize(vp, NULL, action, ctx)) != 0)
8906 if ( (error = VNOP_OPEN(vp, fmode, ctx)) ) {
8910 VNOP_CLOSE(vp, fmode, ctx);
8918 mac_vnode_notify_open(ctx, vp, fmode);
8920 kauth_authorize_fileop(vfs_context_ucred(ctx), KAUTH_FILEOP_OPEN,
8977 vfs_context_t ctx = vfs_context_current();
8991 error = vn_open_with_vp(nspace_items[i].vp, fmode, ctx);
8998 if ((error = falloc(p, &fp, &indx, ctx))) {
8999 vn_close(nspace_items[i].vp, fmode, ctx);
9047 error = vnode_getattr(nspace_items[i].vp, &va, ctx);
9058 vn_close(nspace_items[i].vp, fmode, ctx);
9222 fsctl_internal(proc_t p, vnode_t *arg_vp, u_long cmd, user_addr_t udata, u_long options, vfs_context_t ctx)
9311 error = VNOP_IOCTL(vp, F_FULLFSYNC, (caddr_t)NULL, 0, ctx);
9563 error = VNOP_IOCTL(vp, IOCBASECMD(cmd), data, options, ctx);
9590 vfs_context_t ctx = vfs_context_current();
9598 UIO_USERSPACE, uap->path, ctx);
9604 error = mac_mount_check_fsctl(ctx, vnode_mount(vp), uap->cmd);
9610 error = fsctl_internal(p, &vp, uap->cmd, (user_addr_t)uap->data, uap->options, ctx);
9623 vfs_context_t ctx = vfs_context_current();
9639 error = mac_mount_check_fsctl(ctx, vnode_mount(vp), uap->cmd);
9645 error = fsctl_internal(p, &vp, uap->cmd, (user_addr_t)uap->data, uap->options, ctx);
9666 vfs_context_t ctx = vfs_context_current();
9679 NDINIT(&nd, LOOKUP, OP_GETXATTR, nameiflags, spacetype, uap->path, ctx);
9690 if (!vfs_context_issuser(ctx) || strcmp(attrname, "com.apple.system.Security") != 0) {
9728 error = vn_getxattr(vp, attrname, auio, &attrsize, uap->options, ctx);
9801 vfs_context_t ctx = vfs_context_current();
9827 NDINIT(&nd, LOOKUP, OP_SETXATTR, nameiflags, spacetype, uap->path, ctx);
9838 error = vn_setxattr(vp, attrname, auio, uap->options, ctx);
9841 add_fsevent(FSE_XATTR_MODIFIED, ctx,
9865 vfs_context_t ctx = vfs_context_current();
9893 add_fsevent(FSE_XATTR_MODIFIED, ctx,
9915 vfs_context_t ctx = vfs_context_current();
9930 NDINIT(&nd, LOOKUP, OP_REMOVEXATTR, nameiflags, spacetype, uap->path, ctx);
9937 error = vn_removexattr(vp, attrname, uap->options, ctx);
9940 add_fsevent(FSE_XATTR_REMOVED, ctx,
9962 vfs_context_t ctx = vfs_context_current();
9985 add_fsevent(FSE_XATTR_REMOVED, ctx,
10005 vfs_context_t ctx = vfs_context_current();
10017 NDINIT(&nd, LOOKUP, OP_LISTXATTR, nameiflags, spacetype, uap->path, ctx);
10029 error = vn_listxattr(vp, auio, &attrsize, uap->options, ctx);
10083 vfs_context_t ctx, int volfs_id, uint64_t objid,
10107 error = VFS_ROOT(mp, &vp, ctx);
10109 error = VFS_VGET(mp, (ino64_t)objid, &vp, ctx);
10132 error = mac_vnode_check_fsgetpath(ctx, vp);
10140 bpflags = vfs_context_suser(ctx) ? BUILDPATH_CHECKACCESS : 0;
10142 error = build_path(vp, buf, bufsize, &length, bpflags, ctx);
10184 vfs_context_t ctx = vfs_context_current();
10206 ctx, fsid.val[0], uap->objid,