Lines Matching defs:file

6   See the file COPYING.
172 int fuse_do_open(struct fuse_mount *fm, u64 nodeid, struct file *file,
175 struct fuse_file *ff = fuse_file_open(fm, nodeid, file->f_flags, isdir);
178 file->private_data = ff;
184 static void fuse_link_write_file(struct file *file)
186 struct inode *inode = file_inode(file);
188 struct fuse_file *ff = file->private_data;
190 * file may be written through mmap, so chain it onto the
199 int fuse_finish_open(struct inode *inode, struct file *file)
201 struct fuse_file *ff = file->private_data;
205 err = fuse_file_io_open(file, inode);
210 stream_open(inode, file);
212 nonseekable_open(inode, file);
214 if ((file->f_mode & FMODE_WRITE) && fc->writeback_cache)
215 fuse_link_write_file(file);
220 static void fuse_truncate_update_attr(struct inode *inode, struct file *file)
229 file_update_time(file);
233 static int fuse_open(struct inode *inode, struct file *file)
240 bool is_truncate = (file->f_flags & O_TRUNC) && fc->atomic_o_trunc;
247 err = generic_file_open(inode, file);
264 err = fuse_do_open(fm, get_node_id(inode), file, false);
266 ff = file->private_data;
267 err = fuse_finish_open(inode, file);
269 fuse_sync_release(fi, ff, file->f_flags);
271 fuse_truncate_update_attr(inode, file);
362 void fuse_release_common(struct file *file, bool isdir)
364 fuse_file_release(file_inode(file), file->private_data, file->f_flags,
365 (fl_owner_t) file, isdir);
368 static int fuse_release(struct inode *inode, struct file *file)
379 fuse_release_common(file, false);
501 static int fuse_flush(struct file *file, fl_owner_t id)
503 struct inode *inode = file_inode(file);
505 struct fuse_file *ff = file->private_data;
524 err = filemap_check_errors(file->f_mapping);
558 int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
561 struct inode *inode = file->f_mapping->host;
563 struct fuse_file *ff = file->private_data;
578 static int fuse_fsync(struct file *file, loff_t start, loff_t end,
581 struct inode *inode = file->f_mapping->host;
595 err = file_write_and_wait_range(file, start, end);
606 err = file_check_and_advance_wb_err(file);
617 err = fuse_fsync_common(file, start, end, datasync, FUSE_FSYNC);
628 void fuse_read_args_fill(struct fuse_io_args *ia, struct file *file, loff_t pos,
631 struct fuse_file *ff = file->private_data;
637 ia->read.in.flags = file->f_flags;
804 struct file *file = ia->io->iocb->ki_filp;
805 struct fuse_file *ff = file->private_data;
808 fuse_read_args_fill(ia, file, pos, count, FUSE_READ);
842 * the file. Some data after the hole is in page cache, but has not
851 static int fuse_do_readpage(struct file *file, struct page *page)
880 fuse_read_args_fill(&ia, file, pos, desc.length, FUSE_READ);
885 * Short read means EOF. If file size is larger, truncate it
895 static int fuse_read_folio(struct file *file, struct folio *folio)
905 err = fuse_do_readpage(file, page);
929 * Short read means EOF. If file size is larger, truncate it
953 static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file)
955 struct fuse_file *ff = file->private_data;
974 fuse_read_args_fill(ia, file, pos, count, FUSE_READ);
1029 fuse_send_readpages(ia, rac->file);
1092 struct file *file = iocb->ki_filp;
1093 struct fuse_file *ff = file->private_data;
1139 struct file *file = iocb->ki_filp;
1140 struct fuse_file *ff = file->private_data;
1334 struct file *file = iocb->ki_filp;
1335 struct fuse_file *ff = file->private_data;
1404 struct file *file = iocb->ki_filp;
1405 struct address_space *mapping = file->f_mapping;
1413 err = fuse_update_attributes(mapping->host, file,
1420 file_inode(file))) {
1436 err = file_remove_privs(file);
1440 err = file_update_time(file);
1537 struct file *file = io->iocb->ki_filp;
1538 struct address_space *mapping = file->f_mapping;
1540 struct fuse_file *ff = file->private_data;
1693 struct file *file = iocb->ki_filp;
1694 struct fuse_file *ff = file->private_data;
1695 struct inode *inode = file_inode(file);
1714 struct file *file = iocb->ki_filp;
1715 struct fuse_file *ff = file->private_data;
1716 struct inode *inode = file_inode(file);
1733 static ssize_t fuse_splice_read(struct file *in, loff_t *ppos,
1746 static ssize_t fuse_splice_write(struct pipe_inode_info *pipe, struct file *out,
2230 * read to an mmaped fuse file will set the page dirty twice; once when
2393 static int fuse_write_begin(struct file *file, struct address_space *mapping,
2397 struct fuse_conn *fc = get_fuse_conn(file_inode(file));
2413 * Check if the start this page comes after the end of file, in which
2423 err = fuse_do_readpage(file, page);
2437 static int fuse_write_end(struct file *file, struct address_space *mapping,
2533 static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma)
2535 struct fuse_file *ff = file->private_data;
2537 struct inode *inode = file_inode(file);
2542 return fuse_dax_mmap(file, vma);
2545 * If inode is in passthrough io mode, because it has some file open
2546 * in passthrough mode, either mmap to backing file or fail mmap,
2550 return fuse_passthrough_mmap(file, vma);
2566 invalidate_inode_pages2(file->f_mapping);
2570 return generic_file_mmap(file, vma);
2574 * First mmap of direct_io file enters caching inode io mode.
2578 * the direct_io file release.
2586 fuse_link_write_file(file);
2588 file_accessed(file);
2626 static void fuse_lk_fill(struct fuse_args *args, struct file *file,
2630 struct inode *inode = file_inode(file);
2632 struct fuse_file *ff = file->private_data;
2650 static int fuse_getlk(struct file *file, struct file_lock *fl)
2652 struct inode *inode = file_inode(file);
2659 fuse_lk_fill(&args, file, fl, FUSE_GETLK, 0, 0, &inarg);
2670 static int fuse_setlk(struct file *file, struct file_lock *fl, int flock)
2672 struct inode *inode = file_inode(file);
2686 fuse_lk_fill(&args, file, fl, opcode, pid_nr, flock, &inarg);
2696 static int fuse_file_lock(struct file *file, int cmd, struct file_lock *fl)
2698 struct inode *inode = file_inode(file);
2706 posix_test_lock(file, fl);
2709 err = fuse_getlk(file, fl);
2712 err = posix_lock_file(file, fl, NULL);
2714 err = fuse_setlk(file, fl, 0);
2719 static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl)
2721 struct inode *inode = file_inode(file);
2726 err = locks_lock_file_wait(file, fl);
2728 struct fuse_file *ff = file->private_data;
2732 err = fuse_setlk(file, fl, 1);
2768 static loff_t fuse_lseek(struct file *file, loff_t offset, int whence)
2770 struct inode *inode = file->f_mapping->host;
2772 struct fuse_file *ff = file->private_data;
2802 return vfs_setpos(file, outarg.offset, inode->i_sb->s_maxbytes);
2805 err = fuse_update_attributes(inode, file, STATX_SIZE);
2807 return generic_file_llseek(file, offset, whence);
2812 static loff_t fuse_file_llseek(struct file *file, loff_t offset, int whence)
2815 struct inode *inode = file_inode(file);
2821 retval = generic_file_llseek(file, offset, whence);
2825 retval = fuse_update_attributes(inode, file, STATX_SIZE);
2827 retval = generic_file_llseek(file, offset, whence);
2833 retval = fuse_lseek(file, offset, whence);
2874 * The file is about to be polled. Make sure it's on the polled_files
2876 * not removed before the file is released. This is because a file
2894 __poll_t fuse_file_poll(struct file *file, poll_table *wait)
2896 struct fuse_file *ff = file->private_data;
2906 poll_wait(file, &ff->poll_wait, wait);
2962 static void fuse_do_truncate(struct file *file)
2964 struct inode *inode = file->f_mapping->host;
2970 attr.ia_file = file;
2973 fuse_do_setattr(file_dentry(file), &attr, file);
2986 struct file *file = iocb->ki_filp;
2987 struct fuse_file *ff = file->private_data;
2996 inode = file->f_mapping->host;
3029 * We cannot asynchronously extend the size of a file.
3071 fuse_do_truncate(file);
3087 static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
3090 struct fuse_file *ff = file->private_data;
3091 struct inode *inode = file_inode(file);
3136 err = file_modified(file);
3156 /* we could have extended the file */
3159 file_update_time(file);
3181 static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,
3182 struct file *file_out, loff_t pos_out,
3228 * Write out dirty pages in the destination file before sending the COPY
3288 static ssize_t fuse_copy_file_range(struct file *src_file, loff_t src_off,
3289 struct file *dst_file, loff_t dst_off,