Lines Matching refs:file
117 static int dma_buf_file_release(struct inode *inode, struct file *file)
121 if (!is_dma_buf_file(file)) {
125 dmabuf = file->private_data;
210 static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
214 if (!is_dma_buf_file(file)) {
218 dmabuf = file->private_data;
233 static loff_t dma_buf_llseek(struct file *file, loff_t offset, int whence)
238 if (!is_dma_buf_file(file)) {
242 dmabuf = file->private_data;
295 static __poll_t dma_buf_poll(struct file *file, poll_table *poll)
304 dmabuf = file->private_data;
311 poll_wait(file, &dmabuf->poll, poll);
461 static long dma_buf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
468 dmabuf = file->private_data;
511 static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file)
513 struct dma_buf *dmabuf = file->private_data;
517 seq_printf(m, "count:\t%ld\n", file_count(dmabuf->file) - 1);
537 * is_dma_buf_file - Check if struct file* is associated with dma_buf
539 int is_dma_buf_file(struct file *file)
541 return file->f_op == &dma_buf_fops;
545 static struct file *dma_buf_getfile(struct dma_buf *dmabuf, int flags)
547 struct file *file;
557 file = alloc_file_pseudo(inode, dma_buf_mnt, "dmabuf", flags, &dma_buf_fops);
558 if (IS_ERR(file)) {
561 file->f_flags = flags & (O_ACCMODE | O_NONBLOCK);
562 file->private_data = dmabuf;
563 file->f_path.dentry->d_fsdata = dmabuf;
565 return file;
569 return file;
581 * as a file descriptor by calling dma_buf_fd().
583 * 2. Userspace passes this file-descriptors to all drivers it wants this buffer
604 * dma_buf_export - Creates a new dma_buf, and associates an anon file
624 struct file *file;
674 file = dma_buf_getfile(dmabuf, exp_info->flags);
675 if (IS_ERR(file)) {
676 ret = PTR_ERR(file);
680 file->f_mode |= FMODE_LSEEK;
681 dmabuf->file = file;
700 * Set file->f_path.dentry->d_fsdata to NULL so that when
704 file->f_path.dentry->d_fsdata = NULL;
705 fput(file);
715 * dma_buf_fd - returns a file descriptor for the given dma_buf
725 if (!dmabuf || !dmabuf->file) {
734 fd_install(fd, dmabuf->file);
745 * file's refcounting done by fget to increase refcount. returns ERR_PTR
750 struct file *file;
752 file = fget(fd);
753 if (!file) {
757 if (!is_dma_buf_file(file)) {
758 fput(file);
762 return file->private_data;
770 * Uses file's refcounting done implicitly by fput().
772 * If, as a result of this call, the refcount becomes 0, the 'release' file
778 if (WARN_ON(!dmabuf || !dmabuf->file)) {
782 fput(dmabuf->file);
1144 * framework already supported this and for DMA buffer file descriptors to
1194 * set up a mapping in userspace, calling do_mmap with dma_buf->file will
1324 * This function adjusts the passed in vma so that it points at the file of the
1333 struct file *oldfile;
1356 get_file(dmabuf->file);
1358 vma->vm_file = dmabuf->file;
1365 fput(dmabuf->file);
1516 buf_obj->size, buf_obj->file->f_flags, buf_obj->file->f_mode, file_count(buf_obj->file),
1517 buf_obj->exp_name, file_inode(buf_obj->file)->i_ino, buf_obj->name ?: "NULL",
1617 struct dma_buf *get_dma_buf_from_file(struct file *f)