loader: Rename drm_open_device() to loader_open_device() and share it
authorDerek Foreman <derekf@osg.samsung.com>
Wed, 17 Jun 2015 16:28:49 +0000 (11:28 -0500)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 23 Jun 2015 15:54:51 +0000 (16:54 +0100)
This is already our common idiom for opening files with CLOEXEC and
it's a little ugly, so let's share this one implementation.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
src/loader/loader.c
src/loader/loader.h

index 17bf13360057f11a43ce903e00f66261507c38bb..fc468153425029916c68d9ce2d9ab13a689c64ed 100644 (file)
@@ -314,8 +314,8 @@ get_id_path_tag_from_fd(struct udev *udev, int fd)
    return id_path_tag;
 }
 
-static int
-drm_open_device(const char *device_name)
+int
+loader_open_device(const char *device_name)
 {
    int fd;
 #ifdef O_CLOEXEC
@@ -404,7 +404,7 @@ int loader_get_user_preferred_fd(int default_fd, int *different_device)
       goto default_device_clean;
    }
 
-   fd = drm_open_device(device_name);
+   fd = loader_open_device(device_name);
    if (fd >= 0) {
       close(default_fd);
    } else {
index 60c58f2f8fc59ee7a68d440b9d3ced121c3ade6e..055dc786892113ca61c9522796ee63bae1f8010b 100644 (file)
@@ -36,6 +36,9 @@ extern "C" {
 #define _LOADER_DRI          (1 << 0)
 #define _LOADER_GALLIUM      (1 << 1)
 
+int
+loader_open_device(const char *);
+
 int
 loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id);