Lines Matching refs:f
161 struct fd f; in do_sys_ftruncate() local
168 f = fdget(fd); in do_sys_ftruncate()
169 if (!f.file) in do_sys_ftruncate()
173 if (f.file->f_flags & O_LARGEFILE) in do_sys_ftruncate()
176 dentry = f.file->f_path.dentry; in do_sys_ftruncate()
179 if (!S_ISREG(inode->i_mode) || !(f.file->f_mode & FMODE_WRITE)) in do_sys_ftruncate()
189 if (IS_APPEND(file_inode(f.file))) in do_sys_ftruncate()
192 error = security_path_truncate(&f.file->f_path); in do_sys_ftruncate()
194 error = do_truncate(file_mnt_user_ns(f.file), dentry, length, in do_sys_ftruncate()
195 ATTR_MTIME | ATTR_CTIME, f.file); in do_sys_ftruncate()
198 fdput(f); in do_sys_ftruncate()
328 struct fd f = fdget(fd); in ksys_fallocate() local
331 if (f.file) { in ksys_fallocate()
332 error = vfs_fallocate(f.file, mode, offset, len); in ksys_fallocate()
333 fdput(f); in ksys_fallocate()
513 struct fd f = fdget_raw(fd); in SYSCALL_DEFINE1() local
517 if (!f.file) in SYSCALL_DEFINE1()
521 if (!d_can_lookup(f.file->f_path.dentry)) in SYSCALL_DEFINE1()
524 error = file_permission(f.file, MAY_EXEC | MAY_CHDIR); in SYSCALL_DEFINE1()
526 set_fs_pwd(current->fs, &f.file->f_path); in SYSCALL_DEFINE1()
528 fdput(f); in SYSCALL_DEFINE1()
604 struct fd f = fdget(fd); in SYSCALL_DEFINE2() local
607 if (f.file) { in SYSCALL_DEFINE2()
608 err = vfs_fchmod(f.file, mode); in SYSCALL_DEFINE2()
609 fdput(f); in SYSCALL_DEFINE2()
756 struct fd f = fdget(fd); in ksys_fchown() local
759 if (f.file) { in ksys_fchown()
760 error = vfs_fchown(f.file, user, group); in ksys_fchown()
761 fdput(f); in ksys_fchown()
771 static int do_dentry_open(struct file *f, in do_dentry_open() argument
778 path_get(&f->f_path); in do_dentry_open()
779 f->f_inode = inode; in do_dentry_open()
780 f->f_mapping = inode->i_mapping; in do_dentry_open()
781 f->f_wb_err = filemap_sample_wb_err(f->f_mapping); in do_dentry_open()
782 f->f_sb_err = file_sample_sb_err(f); in do_dentry_open()
784 if (unlikely(f->f_flags & O_PATH)) { in do_dentry_open()
785 f->f_mode = FMODE_PATH | FMODE_OPENED; in do_dentry_open()
786 f->f_op = &empty_fops; in do_dentry_open()
790 if ((f->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { in do_dentry_open()
792 } else if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) { in do_dentry_open()
796 error = __mnt_want_write(f->f_path.mnt); in do_dentry_open()
801 f->f_mode |= FMODE_WRITER; in do_dentry_open()
806 f->f_mode |= FMODE_ATOMIC_POS; in do_dentry_open()
808 f->f_op = fops_get(inode->i_fop); in do_dentry_open()
809 if (WARN_ON(!f->f_op)) { in do_dentry_open()
813 trace_android_vh_check_file_open(f); in do_dentry_open()
815 error = security_file_open(f); in do_dentry_open()
819 error = break_lease(locks_inode(f), f->f_flags); in do_dentry_open()
824 f->f_mode |= FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE; in do_dentry_open()
826 open = f->f_op->open; in do_dentry_open()
828 error = open(inode, f); in do_dentry_open()
832 f->f_mode |= FMODE_OPENED; in do_dentry_open()
833 if ((f->f_mode & FMODE_READ) && in do_dentry_open()
834 likely(f->f_op->read || f->f_op->read_iter)) in do_dentry_open()
835 f->f_mode |= FMODE_CAN_READ; in do_dentry_open()
836 if ((f->f_mode & FMODE_WRITE) && in do_dentry_open()
837 likely(f->f_op->write || f->f_op->write_iter)) in do_dentry_open()
838 f->f_mode |= FMODE_CAN_WRITE; in do_dentry_open()
840 f->f_write_hint = WRITE_LIFE_NOT_SET; in do_dentry_open()
841 f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); in do_dentry_open()
843 file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping); in do_dentry_open()
846 if (f->f_flags & O_DIRECT) { in do_dentry_open()
847 if (!f->f_mapping->a_ops || !f->f_mapping->a_ops->direct_IO) in do_dentry_open()
855 if (f->f_mode & FMODE_WRITE) { in do_dentry_open()
884 fops_put(f->f_op); in do_dentry_open()
885 put_file_access(f); in do_dentry_open()
887 path_put(&f->f_path); in do_dentry_open()
888 f->f_path.mnt = NULL; in do_dentry_open()
889 f->f_path.dentry = NULL; in do_dentry_open()
890 f->f_inode = NULL; in do_dentry_open()
965 struct file *f; in dentry_open() local
972 f = alloc_empty_file(flags, cred); in dentry_open()
973 if (!IS_ERR(f)) { in dentry_open()
974 error = vfs_open(path, f); in dentry_open()
976 fput(f); in dentry_open()
977 f = ERR_PTR(error); in dentry_open()
980 return f; in dentry_open()
987 struct file *f = alloc_empty_file_noaccount(flags, cred); in open_with_fake_path() local
988 if (!IS_ERR(f)) { in open_with_fake_path()
991 f->f_path = *path; in open_with_fake_path()
992 error = do_dentry_open(f, inode, NULL); in open_with_fake_path()
994 fput(f); in open_with_fake_path()
995 f = ERR_PTR(error); in open_with_fake_path()
998 return f; in open_with_fake_path()
1234 struct file *f = do_filp_open(dfd, tmp, &op); in do_sys_openat2() local
1235 if (IS_ERR(f)) { in do_sys_openat2()
1237 fd = PTR_ERR(f); in do_sys_openat2()
1239 fsnotify_open(f); in do_sys_openat2()
1240 fd_install(fd, f); in do_sys_openat2()