• Home
  • Raw
  • Download

Lines Matching defs:file

53 #include <linux/file.h>
156 struct sock *io_uring_get_socket(struct file *file)
159 if (io_is_uring_fops(file)) {
160 struct io_ring_ctx *ctx = file->private_data;
422 if (req->file && !io_req_ffs_set(req))
423 req->flags |= io_file_get_flags(req->file) << REQ_F_SUPPORT_NOWAIT_BIT;
427 io_wq_hash_work(&req->work, file_inode(req->file));
428 } else if (!req->file || !S_ISBLK(file_inode(req->file)->i_mode)) {
958 io_put_file(req->file);
1309 io_put_file(req->file);
1366 /* See comment at the top of this file */
1511 if (list_req->file != req->file)
1545 * If we tracked the file through the SCM inflight mechanism, we could support
1546 * any file. For now, just ensure that anything potentially problematic is done
1549 static bool __io_file_supports_nowait(struct file *file, umode_t mode)
1553 io_bdev_nowait(I_BDEV(file->f_mapping->host)))
1561 io_bdev_nowait(file->f_inode->i_sb->s_bdev) &&
1562 !io_is_uring_fops(file))
1568 if (file->f_flags & O_NONBLOCK)
1570 return file->f_mode & FMODE_NOWAIT;
1574 * If we tracked the file through the SCM inflight mechanism, we could support
1575 * any file. For now, just ensure that anything potentially problematic is done
1578 unsigned int io_file_get_flags(struct file *file)
1580 umode_t mode = file_inode(file)->i_mode;
1585 if (__io_file_supports_nowait(file, mode))
1605 /* assign early for deferred execution for non-fixed file */
1606 if (def->needs_file && !(req->flags & REQ_F_FIXED_FILE) && !req->file)
1607 req->file = io_file_get_normal(req, req->cqe.fd);
1706 if (req->file || !io_op_defs[req->opcode].needs_file)
1710 req->file = io_file_get_fixed(req, req->cqe.fd, issue_flags);
1712 req->file = io_file_get_normal(req, req->cqe.fd);
1714 return !!req->file;
1748 /* If the op doesn't have a file, we're not polling for it */
1802 if (opcode_poll && file_can_poll(req->file)) {
1846 inline struct file *io_file_get_fixed(struct io_kiocb *req, int fd,
1850 struct file *file = NULL;
1859 file = (struct file *) (file_ptr & FFS_MASK);
1866 return file;
1869 struct file *io_file_get_normal(struct io_kiocb *req, int fd)
1871 struct file *file = fget(fd);
1876 if (file && io_is_uring_fops(file))
1878 return file;
1918 * We async punt it if the file wasn't marked NOWAIT, or if the file
2009 req->file = NULL;
2646 ctx->ring_sock->file = NULL; /* so that iput() is called */
2672 static __poll_t io_uring_poll(struct file *file, poll_table *wait)
2674 struct io_ring_ctx *ctx = file->private_data;
2677 poll_wait(file, &ctx->cq_wait, wait);
2866 static int io_uring_release(struct inode *inode, struct file *file)
2868 struct io_ring_ctx *ctx = file->private_data;
2870 file->private_data = NULL;
3075 static void *io_uring_validate_mmap_request(struct file *file,
3078 struct io_ring_ctx *ctx = file->private_data;
3104 static __cold int io_uring_mmap(struct file *file, struct vm_area_struct *vma)
3110 ptr = io_uring_validate_mmap_request(file, vma->vm_pgoff, sz);
3118 static unsigned long io_uring_mmu_get_unmapped_area(struct file *filp,
3140 * - use a NULL file pointer to reference physical memory, and
3163 static int io_uring_mmap(struct file *file, struct vm_area_struct *vma)
3168 static unsigned int io_uring_nommu_mmap_capabilities(struct file *file)
3173 static unsigned long io_uring_nommu_get_unmapped_area(struct file *file,
3179 ptr = io_uring_validate_mmap_request(file, pgoff, len);
3256 f.file = tctx->registered_rings[fd];
3258 if (unlikely(!f.file))
3262 if (unlikely(!f.file))
3265 if (unlikely(!io_is_uring_fops(f.file)))
3269 ctx = f.file->private_data;
3384 bool io_is_uring_fops(struct file *file)
3386 return file->f_op == &io_uring_fops;
3434 static int io_uring_install_fd(struct io_ring_ctx *ctx, struct file *file)
3447 fd_install(fd, file);
3455 * we have to tie this fd to a socket for file garbage collection purposes.
3457 static struct file *io_uring_get_file(struct io_ring_ctx *ctx)
3459 struct file *file;
3469 file = anon_inode_getfile_secure("[io_uring]", &io_uring_fops, ctx,
3472 if (IS_ERR(file)) {
3476 ctx->ring_sock->file = file;
3479 return file;
3486 struct file *file;
3632 file = io_uring_get_file(ctx);
3633 if (IS_ERR(file)) {
3634 ret = PTR_ERR(file);
3642 ret = io_uring_install_fd(ctx, file);
3645 fput(file);
3979 * dying as we're holding a file ref here.
4147 if (!f.file)
4151 if (!io_is_uring_fops(f.file))
4154 ctx = f.file->private_data;