Lines Matching refs:file
40 struct file *filp) in do_truncate()
168 if (!f.file) in do_sys_ftruncate()
172 if (f.file->f_flags & O_LARGEFILE) in do_sys_ftruncate()
175 dentry = f.file->f_path.dentry; in do_sys_ftruncate()
178 if (!S_ISREG(inode->i_mode) || !(f.file->f_mode & FMODE_WRITE)) in do_sys_ftruncate()
188 if (IS_APPEND(file_inode(f.file))) in do_sys_ftruncate()
192 error = locks_verify_truncate(inode, f.file, length); in do_sys_ftruncate()
194 error = security_path_truncate(&f.file->f_path); in do_sys_ftruncate()
196 error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, f.file); in do_sys_ftruncate()
230 int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len) in vfs_fallocate() argument
232 struct inode *inode = file_inode(file); in vfs_fallocate()
267 if (!(file->f_mode & FMODE_WRITE)) in vfs_fallocate()
289 ret = security_file_permission(file, MAY_WRITE); in vfs_fallocate()
306 if (!file->f_op->fallocate) in vfs_fallocate()
309 file_start_write(file); in vfs_fallocate()
310 ret = file->f_op->fallocate(file, mode, offset, len); in vfs_fallocate()
320 fsnotify_modify(file); in vfs_fallocate()
322 file_end_write(file); in vfs_fallocate()
332 if (f.file) { in ksys_fallocate()
333 error = vfs_fallocate(f.file, mode, offset, len); in ksys_fallocate()
518 if (!f.file) in SYSCALL_DEFINE1()
522 if (!d_can_lookup(f.file->f_path.dentry)) in SYSCALL_DEFINE1()
525 error = inode_permission(file_inode(f.file), MAY_EXEC | MAY_CHDIR); in SYSCALL_DEFINE1()
527 set_fs_pwd(current->fs, &f.file->f_path); in SYSCALL_DEFINE1()
596 int vfs_fchmod(struct file *file, umode_t mode) in vfs_fchmod() argument
598 audit_file(file); in vfs_fchmod()
599 return chmod_common(&file->f_path, mode); in vfs_fchmod()
607 if (f.file) { in SYSCALL_DEFINE2()
608 err = vfs_fchmod(f.file, mode); in SYSCALL_DEFINE2()
734 int vfs_fchown(struct file *file, uid_t user, gid_t group) in vfs_fchown() argument
738 error = mnt_want_write_file(file); in vfs_fchown()
741 audit_file(file); in vfs_fchown()
742 error = chown_common(&file->f_path, user, group); in vfs_fchown()
743 mnt_drop_write_file(file); in vfs_fchown()
752 if (f.file) { in ksys_fchown()
753 error = vfs_fchown(f.file, user, group); in ksys_fchown()
764 static int do_dentry_open(struct file *f, in do_dentry_open() argument
766 int (*open)(struct inode *, struct file *)) in do_dentry_open()
896 int finish_open(struct file *file, struct dentry *dentry, in finish_open() argument
897 int (*open)(struct inode *, struct file *)) in finish_open()
899 BUG_ON(file->f_mode & FMODE_OPENED); /* once it's opened, it's opened */ in finish_open()
901 file->f_path.dentry = dentry; in finish_open()
902 return do_dentry_open(file, d_backing_inode(dentry), open); in finish_open()
920 int finish_no_open(struct file *file, struct dentry *dentry) in finish_no_open() argument
922 file->f_path.dentry = dentry; in finish_no_open()
927 char *file_path(struct file *filp, char *buf, int buflen) in file_path()
939 int vfs_open(const struct path *path, struct file *file) in vfs_open() argument
941 file->f_path = *path; in vfs_open()
942 return do_dentry_open(file, d_backing_inode(path->dentry), NULL); in vfs_open()
945 struct file *dentry_open(const struct path *path, int flags, in dentry_open()
949 struct file *f; in dentry_open()
968 struct file *open_with_fake_path(const struct path *path, int flags, in open_with_fake_path()
971 struct file *f = alloc_empty_file_noaccount(flags, cred); in open_with_fake_path()
1135 struct file *file_open_name(struct filename *name, int flags, umode_t mode) in file_open_name()
1156 struct file *filp_open(const char *filename, int flags, umode_t mode) in filp_open()
1159 struct file *file = ERR_CAST(name); in filp_open() local
1162 file = file_open_name(name, flags, mode); in filp_open()
1165 return file; in filp_open()
1170 struct file *filp_open_block(const char *filename, int flags, umode_t mode) in filp_open_block()
1172 struct file *file; in filp_open_block() local
1174 file = filp_open(filename, flags, mode); in filp_open_block()
1175 if (IS_ERR(file)) in filp_open_block()
1179 if (!S_ISBLK(file->f_mapping->host->i_mode)) { in filp_open_block()
1180 filp_close(file, NULL); in filp_open_block()
1181 file = ERR_PTR(-ENOTBLK); in filp_open_block()
1185 return file; in filp_open_block()
1189 struct file *file_open_root(struct dentry *dentry, struct vfsmount *mnt, in file_open_root()
1217 struct file *f = do_filp_open(dfd, tmp, &op); in do_sys_openat2()
1315 int filp_close(struct file *filp, fl_owner_t id) in filp_close()
1392 int generic_file_open(struct inode * inode, struct file * filp) in generic_file_open()
1407 int nonseekable_open(struct inode *inode, struct file *filp) in nonseekable_open()
1425 int stream_open(struct inode *inode, struct file *filp) in stream_open()