Lines Matching refs:file
227 struct file *file; member
486 struct file *file; member
494 struct file *file; member
503 struct file *file; member
517 struct file *file; member
526 struct file *file; member
534 struct file *file; member
539 struct file *file; member
550 struct file *file; member
567 struct file *file; member
573 struct file *file; member
588 struct file *file; member
597 struct file *file; member
604 struct file *file; member
611 struct file *file; member
618 struct file *file; member
626 struct file *file_out;
635 struct file *file; member
644 struct file *file; member
653 struct file *file; member
658 struct file *file; member
667 struct file *file; member
674 struct file *file; member
681 struct file *file; member
688 struct file *file; member
697 struct file *file; member
833 struct file *file; member
1099 static struct file *io_file_get(struct io_ring_ctx *ctx,
1109 static int io_install_fixed_file(struct io_kiocb *req, struct file *file,
1119 struct sock *io_uring_get_socket(struct file *file) in io_uring_get_socket() argument
1122 if (file->f_op == &io_uring_fops) { in io_uring_get_socket()
1123 struct io_ring_ctx *ctx = file->private_data; in io_uring_get_socket()
1452 io_wq_hash_work(&req->work, file_inode(req->file)); in io_prep_async_work()
1453 } else if (!req->file || !S_ISBLK(file_inode(req->file)->i_mode)) { in io_prep_async_work()
2019 static inline void io_put_file(struct file *file) in io_put_file() argument
2021 if (file) in io_put_file()
2022 fput(file); in io_put_file()
2032 io_put_file(req->file); in io_dismantle_req()
2691 struct super_block *sb = file_inode(req->file)->i_sb; in kiocb_end_write()
2711 umode_t mode = file_inode(req->file)->i_mode; in io_rw_should_reissue()
2755 fsnotify_modify(req->file); in io_req_io_end()
2757 fsnotify_access(req->file); in io_req_io_end()
2877 if (list_req->file != req->file) { in io_iopoll_req_issued()
2921 static bool __io_file_supports_nowait(struct file *file, int rw) in __io_file_supports_nowait() argument
2923 umode_t mode = file_inode(file)->i_mode; in __io_file_supports_nowait()
2927 io_bdev_nowait(I_BDEV(file->f_mapping->host))) in __io_file_supports_nowait()
2935 io_bdev_nowait(file->f_inode->i_sb->s_bdev) && in __io_file_supports_nowait()
2936 file->f_op != &io_uring_fops) in __io_file_supports_nowait()
2942 if (file->f_flags & O_NONBLOCK) in __io_file_supports_nowait()
2945 if (!(file->f_mode & FMODE_NOWAIT)) in __io_file_supports_nowait()
2949 return file->f_op->read_iter != NULL; in __io_file_supports_nowait()
2951 return file->f_op->write_iter != NULL; in __io_file_supports_nowait()
2961 return __io_file_supports_nowait(req->file, rw); in io_file_supports_nowait()
2969 struct file *file = req->file; in io_prep_rw() local
2973 if (!io_req_ffs_set(req) && S_ISREG(file_inode(file)->i_mode)) in io_prep_rw()
2989 ((file->f_flags & O_NONBLOCK) && !io_file_supports_nowait(req, rw))) in io_prep_rw()
3065 if (!(req->file->f_mode & FMODE_STREAM)) { in io_kiocb_update_pos()
3067 kiocb->ki_pos = req->file->f_pos; in io_kiocb_update_pos()
3081 req->file->f_pos = kiocb->ki_pos; in kiocb_done()
3375 struct file *file = req->file; in loop_rw_iter() local
3403 nr = file->f_op->read(file, iovec.iov_base, in loop_rw_iter()
3406 nr = file->f_op->write(file, iovec.iov_base, in loop_rw_iter()
3510 if (unlikely(!(req->file->f_mode & FMODE_READ))) in io_read_prep()
3573 if (file_can_poll(req->file) || !(req->file->f_mode & FMODE_BUF_RASYNC)) in io_rw_should_retry()
3588 if (req->file->f_op->read_iter) in io_iter_do_read()
3589 return call_read_iter(req->file, &req->rw.kiocb, iter); in io_iter_do_read()
3590 else if (req->file->f_op->read) in io_iter_do_read()
3599 S_ISBLK(file_inode(req->file)->i_mode); in need_read_all()
3646 ret = rw_verify_area(READ, req->file, ppos, req->result); in io_read()
3736 if (unlikely(!(req->file->f_mode & FMODE_WRITE))) in io_write_prep()
3783 ret = rw_verify_area(WRITE, req->file, ppos, req->result); in io_write()
3795 sb_start_write(file_inode(req->file)->i_sb); in io_write()
3796 __sb_writers_release(file_inode(req->file)->i_sb, in io_write()
3801 if (req->file->f_op->write_iter) in io_write()
3802 ret2 = call_write_iter(req->file, kiocb, iter); in io_write()
3803 else if (req->file->f_op->write) in io_write()
4115 sock = sock_from_file(req->file); in io_shutdown()
4157 struct file *out = sp->file_out; in io_tee()
4159 struct file *in; in io_tee()
4196 struct file *out = sp->file_out; in io_splice()
4199 struct file *in; in io_splice()
4269 ret = vfs_fsync_range(req->file, req->sync.off, in io_fsync()
4300 ret = vfs_fallocate(req->file, req->sync.mode, req->sync.off, in io_fallocate()
4305 fsnotify_modify(req->file); in io_fallocate()
4375 struct file *file; in io_openat2() local
4404 file = do_filp_open(req->open.dfd, req->open.filename, &op); in io_openat2()
4405 if (IS_ERR(file)) { in io_openat2()
4414 ret = PTR_ERR(file); in io_openat2()
4423 file->f_flags &= ~O_NONBLOCK; in io_openat2()
4424 fsnotify_open(file); in io_openat2()
4427 fd_install(ret, file); in io_openat2()
4429 ret = io_install_fixed_file(req, file, issue_flags, in io_openat2()
4721 ret = vfs_fadvise(req->file, fa->offset, fa->len, fa->advice); in io_fadvise()
4786 struct file *file = NULL; in io_close() local
4800 file = fdt->fd[close->fd]; in io_close()
4801 if (!file || file->f_op == &io_uring_fops) { in io_close()
4803 file = NULL; in io_close()
4808 if (file->f_op->flush && (issue_flags & IO_URING_F_NONBLOCK)) { in io_close()
4813 ret = __close_fd_get_file(close->fd, &file); in io_close()
4822 ret = filp_close(file, current->files); in io_close()
4826 if (file) in io_close()
4827 fput(file); in io_close()
4856 ret = sync_file_range(req->file, req->sync.off, req->sync.len, in io_sync_file_range()
4956 sock = sock_from_file(req->file); in io_sendmsg()
5014 sock = sock_from_file(req->file); in io_send()
5211 sock = sock_from_file(req->file); in io_recvmsg()
5283 sock = sock_from_file(req->file); in io_recv()
5369 struct file *file; in io_accept() local
5377 file = do_accept(req->file, file_flags, accept->addr, accept->addr_len, in io_accept()
5379 if (IS_ERR(file)) { in io_accept()
5382 ret = PTR_ERR(file); in io_accept()
5391 fd_install(fd, file); in io_accept()
5394 ret = io_install_fixed_file(req, file, issue_flags, in io_accept()
5444 ret = __sys_connect_file(req->file, &io->address, in io_connect()
5664 req->result = vfs_poll(req->file, &pt) & poll->events; in io_poll_check_events()
5860 static void io_poll_queue_proc(struct file *file, struct wait_queue_head *head, in io_poll_queue_proc() argument
5877 poll->file = req->file; in __io_arm_poll_handler()
5890 mask = vfs_poll(req->file, &ipt->pt) & poll->events; in __io_arm_poll_handler()
5927 static void io_async_queue_proc(struct file *file, struct wait_queue_head *head, in io_async_queue_proc() argument
5959 if (!req->file || !file_can_poll(req->file)) in io_arm_poll_handler()
7038 if ((ctx->flags & IORING_SETUP_IOPOLL) && req->file) in io_issue_sqe()
7106 static inline struct file *io_file_from_index(struct io_ring_ctx *ctx, in io_file_from_index()
7111 return (struct file *) (slot->file_ptr & FFS_MASK); in io_file_from_index()
7114 static void io_fixed_file_set(struct io_fixed_file *file_slot, struct file *file) in io_fixed_file_set() argument
7116 unsigned long file_ptr = (unsigned long) file; in io_fixed_file_set()
7118 if (__io_file_supports_nowait(file, READ)) in io_fixed_file_set()
7120 if (__io_file_supports_nowait(file, WRITE)) in io_fixed_file_set()
7122 if (S_ISREG(file_inode(file)->i_mode)) in io_fixed_file_set()
7127 static inline struct file *io_file_get_fixed(struct io_ring_ctx *ctx, in io_file_get_fixed()
7131 struct file *file = NULL; in io_file_get_fixed() local
7140 file = (struct file *) (file_ptr & FFS_MASK); in io_file_get_fixed()
7147 return file; in io_file_get_fixed()
7150 static struct file *io_file_get_normal(struct io_ring_ctx *ctx, in io_file_get_normal()
7153 struct file *file = fget(fd); in io_file_get_normal() local
7158 if (file && unlikely(file->f_op == &io_uring_fops)) in io_file_get_normal()
7160 return file; in io_file_get_normal()
7163 static inline struct file *io_file_get(struct io_ring_ctx *ctx, in io_file_get()
7350 req->file = NULL; in io_init_req()
7389 req->file = io_file_get(ctx, req, READ_ONCE(sqe->fd), in io_init_req()
7392 if (unlikely(!req->file)) in io_init_req()
8179 struct file *file; in __io_sqe_files_unregister()
8181 file = io_file_from_index(ctx, i); in __io_sqe_files_unregister()
8182 if (file) in __io_sqe_files_unregister()
8183 fput(file); in __io_sqe_files_unregister()
8284 if (!f.file) in io_attach_sq_data()
8286 if (f.file->f_op != &io_uring_fops) { in io_attach_sq_data()
8291 ctx_attach = f.file->private_data; in io_attach_sq_data()
8366 struct file *file = io_file_from_index(ctx, i + offset); in __io_sqe_files_scm() local
8368 if (!file) in __io_sqe_files_scm()
8370 fpl->fp[nr_files] = get_file(file); in __io_sqe_files_scm()
8384 struct file *file = io_file_from_index(ctx, i + offset); in __io_sqe_files_scm() local
8386 if (file) in __io_sqe_files_scm()
8387 fput(file); in __io_sqe_files_scm()
8424 struct file *file = io_file_from_index(ctx, total); in io_sqe_files_scm() local
8426 if (file) in io_sqe_files_scm()
8427 fput(file); in io_sqe_files_scm()
8442 struct file *file = prsrc->file; in io_rsrc_file_put() local
8463 if (fp->fp[i] != file) in io_rsrc_file_put()
8470 left * sizeof(struct file *)); in io_rsrc_file_put()
8479 fput(file); in io_rsrc_file_put()
8480 file = NULL; in io_rsrc_file_put()
8484 if (!file) in io_rsrc_file_put()
8499 fput(file); in io_rsrc_file_put()
8555 struct file *file; in io_sqe_files_register() local
8592 file = fget(fd); in io_sqe_files_register()
8594 if (unlikely(!file)) in io_sqe_files_register()
8604 if (file->f_op == &io_uring_fops) { in io_sqe_files_register()
8605 fput(file); in io_sqe_files_register()
8608 io_fixed_file_set(io_fixed_file_slot(&ctx->file_table, i), file); in io_sqe_files_register()
8621 file = io_file_from_index(ctx, i); in io_sqe_files_register()
8622 if (file) in io_sqe_files_register()
8623 fput(file); in io_sqe_files_register()
8650 static int io_install_fixed_file(struct io_kiocb *req, struct file *file, in io_install_fixed_file() argument
8660 if (file->f_op == &io_uring_fops) in io_install_fixed_file()
8673 struct file *old_file; in io_install_fixed_file()
8679 old_file = (struct file *)(file_slot->file_ptr & FFS_MASK); in io_install_fixed_file()
8689 io_fixed_file_set(file_slot, file); in io_install_fixed_file()
8696 fput(file); in io_install_fixed_file()
8705 struct file *file; in io_close_fixed() local
8725 file = (struct file *)(file_slot->file_ptr & FFS_MASK); in io_close_fixed()
8726 ret = io_queue_rsrc_removal(ctx->file_data, offset, ctx->rsrc_node, file); in io_close_fixed()
8746 struct file *file; in __io_sqe_files_update() local
8775 file = (struct file *)(file_slot->file_ptr & FFS_MASK); in __io_sqe_files_update()
8776 err = io_queue_rsrc_removal(data, i, ctx->rsrc_node, file); in __io_sqe_files_update()
8783 file = fget(fd); in __io_sqe_files_update()
8784 if (!file) { in __io_sqe_files_update()
8796 if (file->f_op == &io_uring_fops) { in __io_sqe_files_update()
8797 fput(file); in __io_sqe_files_update()
8802 io_fixed_file_set(file_slot, file); in __io_sqe_files_update()
8902 if (!f.file) in io_sq_offload_create()
8904 if (f.file->f_op != &io_uring_fops) { in io_sq_offload_create()
9265 struct file *file = vmas[0]->vm_file; in io_sqe_buffer_register() local
9269 if (vmas[i]->vm_file != file) { in io_sqe_buffer_register()
9273 if (!file) in io_sqe_buffer_register()
9275 if (!vma_is_shmem(vmas[i]) && !is_file_hugepages(file)) { in io_sqe_buffer_register()
9575 ctx->ring_sock->file = NULL; /* so that iput() is called */ in io_ring_ctx_free()
9599 static __poll_t io_uring_poll(struct file *file, poll_table *wait) in io_uring_poll() argument
9601 struct io_ring_ctx *ctx = file->private_data; in io_uring_poll()
9604 poll_wait(file, &ctx->poll_wait, wait); in io_uring_poll()
9811 static int io_uring_release(struct inode *inode, struct file *file) in io_uring_release() argument
9813 struct io_ring_ctx *ctx = file->private_data; in io_uring_release()
9815 file->private_data = NULL; in io_uring_release()
10109 static void *io_uring_validate_mmap_request(struct file *file, in io_uring_validate_mmap_request() argument
10112 struct io_ring_ctx *ctx = file->private_data; in io_uring_validate_mmap_request()
10138 static int io_uring_mmap(struct file *file, struct vm_area_struct *vma) in io_uring_mmap() argument
10144 ptr = io_uring_validate_mmap_request(file, vma->vm_pgoff, sz); in io_uring_mmap()
10154 static int io_uring_mmap(struct file *file, struct vm_area_struct *vma) in io_uring_mmap() argument
10159 static unsigned int io_uring_nommu_mmap_capabilities(struct file *file) in io_uring_nommu_mmap_capabilities() argument
10164 static unsigned long io_uring_nommu_get_unmapped_area(struct file *file, in io_uring_nommu_get_unmapped_area() argument
10170 ptr = io_uring_validate_mmap_request(file, pgoff, len); in io_uring_nommu_get_unmapped_area()
10245 if (unlikely(!f.file)) in SYSCALL_DEFINE6()
10249 if (unlikely(f.file->f_op != &io_uring_fops)) in SYSCALL_DEFINE6()
10253 ctx = f.file->private_data; in SYSCALL_DEFINE6()
10387 struct file *f = io_file_from_index(ctx, i); in __io_uring_show_fdinfo()
10424 static void io_uring_show_fdinfo(struct seq_file *m, struct file *f) in io_uring_show_fdinfo()
10490 static int io_uring_install_fd(struct io_ring_ctx *ctx, struct file *file) in io_uring_install_fd() argument
10503 fd_install(fd, file); in io_uring_install_fd()
10513 static struct file *io_uring_get_file(struct io_ring_ctx *ctx) in io_uring_get_file()
10515 struct file *file; in io_uring_get_file() local
10525 file = anon_inode_getfile("[io_uring]", &io_uring_fops, ctx, in io_uring_get_file()
10528 if (IS_ERR(file)) { in io_uring_get_file()
10532 ctx->ring_sock->file = file; in io_uring_get_file()
10535 return file; in io_uring_get_file()
10542 struct file *file; in io_uring_create() local
10641 file = io_uring_get_file(ctx); in io_uring_create()
10642 if (IS_ERR(file)) { in io_uring_create()
10643 ret = PTR_ERR(file); in io_uring_create()
10651 ret = io_uring_install_fd(ctx, file); in io_uring_create()
10654 fput(file); in io_uring_create()
11245 if (!f.file) in SYSCALL_DEFINE4()
11249 if (f.file->f_op != &io_uring_fops) in SYSCALL_DEFINE4()
11252 ctx = f.file->private_data; in SYSCALL_DEFINE4()