Lines Matching full:file
36 #include <linux/file.h>
91 * DOC: file operations
93 * Drivers must define the file operations structure that forms the DRM
106 * userspace through the file descriptor. They are used to send vblank event and
119 * No other file operations are supported by the DRM userspace API. Overall the
145 * drm_file_alloc - allocate file context
148 * This allocates a new DRM file context. It is not linked into any context and
158 struct drm_file *file; in drm_file_alloc() local
161 file = kzalloc(sizeof(*file), GFP_KERNEL); in drm_file_alloc()
162 if (!file) in drm_file_alloc()
165 file->pid = get_pid(task_pid(current)); in drm_file_alloc()
166 file->minor = minor; in drm_file_alloc()
169 file->authenticated = capable(CAP_SYS_ADMIN); in drm_file_alloc()
171 INIT_LIST_HEAD(&file->lhead); in drm_file_alloc()
172 INIT_LIST_HEAD(&file->fbs); in drm_file_alloc()
173 mutex_init(&file->fbs_lock); in drm_file_alloc()
174 INIT_LIST_HEAD(&file->blobs); in drm_file_alloc()
175 INIT_LIST_HEAD(&file->pending_event_list); in drm_file_alloc()
176 INIT_LIST_HEAD(&file->event_list); in drm_file_alloc()
177 init_waitqueue_head(&file->event_wait); in drm_file_alloc()
178 file->event_space = 4096; /* set aside 4k for event buffer */ in drm_file_alloc()
180 mutex_init(&file->event_read_lock); in drm_file_alloc()
183 drm_gem_open(dev, file); in drm_file_alloc()
186 drm_syncobj_open(file); in drm_file_alloc()
188 drm_prime_init_file_private(&file->prime); in drm_file_alloc()
191 ret = dev->driver->open(dev, file); in drm_file_alloc()
196 return file; in drm_file_alloc()
199 drm_prime_destroy_file_private(&file->prime); in drm_file_alloc()
201 drm_syncobj_release(file); in drm_file_alloc()
203 drm_gem_release(dev, file); in drm_file_alloc()
204 put_pid(file->pid); in drm_file_alloc()
205 kfree(file); in drm_file_alloc()
235 * drm_file_free - free file context
236 * @file: context to free, or NULL
238 * This destroys and deallocates a DRM file context previously allocated via
247 void drm_file_free(struct drm_file *file) in drm_file_free() argument
251 if (!file) in drm_file_free()
254 dev = file->minor->dev; in drm_file_free()
258 (long)old_encode_dev(file->minor->kdev->devt), in drm_file_free()
263 dev->driver->preclose(dev, file); in drm_file_free()
266 drm_legacy_lock_release(dev, file->filp); in drm_file_free()
269 drm_legacy_reclaim_buffers(dev, file); in drm_file_free()
271 drm_events_release(file); in drm_file_free()
274 drm_fb_release(file); in drm_file_free()
275 drm_property_destroy_user_blobs(dev, file); in drm_file_free()
279 drm_syncobj_release(file); in drm_file_free()
282 drm_gem_release(dev, file); in drm_file_free()
284 drm_legacy_ctxbitmap_flush(dev, file); in drm_file_free()
286 if (drm_is_primary_client(file)) in drm_file_free()
287 drm_master_release(file); in drm_file_free()
290 dev->driver->postclose(dev, file); in drm_file_free()
292 drm_prime_destroy_file_private(&file->prime); in drm_file_free()
294 WARN_ON(!list_empty(&file->event_list)); in drm_file_free()
296 put_pid(file->pid); in drm_file_free()
297 kfree(file); in drm_file_free()
300 static void drm_close_helper(struct file *filp) in drm_close_helper()
328 * \param filp file pointer.
332 * Creates and initializes a drm_file structure for the file private data in \p
335 static int drm_open_helper(struct file *filp, struct drm_minor *minor) in drm_open_helper()
397 * drm_open - open method for DRM file
399 * @filp: file pointer.
402 * It looks up the correct DRM device and instantiates all the per-file
409 int drm_open(struct inode *inode, struct file *filp) in drm_open()
470 * drm_release - release method for DRM file
472 * @filp: file pointer.
475 * method. It frees any resources associated with the open file, and calls the
476 * &drm_driver.postclose driver callback. If this is the last open file for the
483 int drm_release(struct inode *inode, struct file *filp) in drm_release()
509 * drm_release_noglobal - release method for DRM file
511 * @filp: file pointer.
514 * method. It frees any resources associated with the open file prior to taking
516 * callback. If this is the last open file for the DRM device also proceeds to
523 int drm_release_noglobal(struct inode *inode, struct file *filp) in drm_release_noglobal()
543 * drm_read - read method for DRM file
544 * @filp: file pointer
568 ssize_t drm_read(struct file *filp, char __user *buffer, in drm_read()
638 * drm_poll - poll method for DRM file
639 * @filp: file pointer
651 * Mask of POLL flags indicating the current status of the file.
653 __poll_t drm_poll(struct file *filp, struct poll_table_struct *wait) in drm_poll()
670 * @file_priv: DRM file private data
712 * @file_priv: DRM file private data
778 * drm_send_event_locked - send DRM event to file descriptor
783 * to its associated userspace DRM file. Callers must already hold
787 * corresponding DRM file is closed. Drivers need not worry about whether the
788 * DRM file for this event still exists and can call this function upon
820 * drm_send_event - send DRM event to file descriptor
825 * to its associated userspace DRM file. This function acquires
830 * corresponding DRM file is closed. Drivers need not worry about whether the
831 * DRM file for this event still exists and can call this function upon
845 * mock_drm_getfile - Create a new struct file for the drm device
847 * @flags: file creation mode (O_RDWR etc)
849 * This create a new struct file that wraps a DRM file context around a
851 * invoking userspace. The struct file may be operated on using its f_op
856 * Pointer to newly created struct file, ERR_PTR on failure.
858 struct file *mock_drm_getfile(struct drm_minor *minor, unsigned int flags) in mock_drm_getfile()
862 struct file *file; in mock_drm_getfile() local
868 file = anon_inode_getfile("drm", dev->driver->fops, priv, flags); in mock_drm_getfile()
869 if (IS_ERR(file)) { in mock_drm_getfile()
871 return file; in mock_drm_getfile()
875 file->f_mapping = dev->anon_inode->i_mapping; in mock_drm_getfile()
878 priv->filp = file; in mock_drm_getfile()
880 return file; in mock_drm_getfile()
934 * @file: The struct file representing the address space being mmap()'d.
953 unsigned long drm_get_unmapped_area(struct file *file, in drm_get_unmapped_area() argument
966 * @pgoff is the file page-offset the huge page boundaries of in drm_get_unmapped_area()
979 addr = current->mm->get_unmapped_area(file, uaddr, len, pgoff, flags); in drm_get_unmapped_area()
1009 unsigned long drm_get_unmapped_area(struct file *file, in drm_get_unmapped_area() argument
1014 return current->mm->get_unmapped_area(file, uaddr, len, pgoff, flags); in drm_get_unmapped_area()