[Intel-gfx] [PATCH 1/3] drm: Expose a method for creating anonymous struct file around drm_minor

Chris Wilson chris at chris-wilson.co.uk
Wed Nov 6 10:26:48 UTC 2019


Quoting Daniel Vetter (2019-11-06 10:19:50)
> On Wed, Nov 06, 2019 at 10:07:14AM +0000, Chris Wilson wrote:
> > Sometimes we need to create a struct file to wrap a drm_device, as it
> > the user were to have opened /dev/dri/card0 but to do so anonymously
> > (i.e. for internal use). Provide a utility method to create a struct
> > file with the drm_device->driver.fops, that wrap the drm_device.
> > 
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> 
> For proper internal access we already have drm_client_open, so I think
> this has limited (but good use) in selftests only. So
> EXPORT_SYMBOL_FOR_TESTS_ONLY plus maybe a clearer name for the intended
> use like drm_file_mock_open?

I found the example in drm_gem_prime_mmap() that was doing the same trick,
and the trick of being able to instantiate new struct file and install a
fd whenever seems like it will come in handy... Just lacking the third
user at the moment to claim generality.
-Chris


More information about the Intel-gfx mailing list