drm-shim: Use hide_drm_device_path() to hide other drm devices
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19241>
This commit is contained in:
@@ -324,6 +324,11 @@ PUBLIC int open(const char *path, int flags, ...)
|
||||
mode_t mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
|
||||
if (hide_drm_device_path(path)) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strcmp(path, render_node_path) != 0)
|
||||
return real_open(path, flags, mode);
|
||||
|
||||
@@ -363,6 +368,11 @@ PUBLIC int __xstat(int ver, const char *path, struct stat *st)
|
||||
if (render_node_minor == -1)
|
||||
return real___xstat(ver, path, st);
|
||||
|
||||
if (hide_drm_device_path(path)) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Fool libdrm's probe of whether the /sys dir for this char dev is
|
||||
* there.
|
||||
*/
|
||||
@@ -397,6 +407,11 @@ PUBLIC int __xstat64(int ver, const char *path, struct stat64 *st)
|
||||
if (render_node_minor == -1)
|
||||
return real___xstat64(ver, path, st);
|
||||
|
||||
if (hide_drm_device_path(path)) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Fool libdrm's probe of whether the /sys dir for this char dev is
|
||||
* there.
|
||||
*/
|
||||
@@ -465,6 +480,11 @@ PUBLIC int stat(const char* path, struct stat* stat_buf)
|
||||
if (render_node_minor == -1)
|
||||
return real_stat(path, stat_buf);
|
||||
|
||||
if (hide_drm_device_path(path)) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Fool libdrm's probe of whether the /sys dir for this char dev is
|
||||
* there.
|
||||
*/
|
||||
@@ -498,6 +518,11 @@ PUBLIC int stat64(const char* path, struct stat64* stat_buf)
|
||||
if (render_node_minor == -1)
|
||||
return real_stat64(path, stat_buf);
|
||||
|
||||
if (hide_drm_device_path(path)) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Fool libdrm's probe of whether the /sys dir for this char dev is
|
||||
* there.
|
||||
*/
|
||||
@@ -654,6 +679,11 @@ readlink(const char *path, char *buf, size_t size)
|
||||
{
|
||||
init_shim();
|
||||
|
||||
if (hide_drm_device_path(path)) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strcmp(path, subsystem_path) != 0)
|
||||
return real_readlink(path, buf, size);
|
||||
|
||||
|
Reference in New Issue
Block a user