[Mesa-dev] [PATCH 2/4] loader: Rename drm_open_device() to loader_open_device() and share it

Derek Foreman derekf at osg.samsung.com
Wed Jun 17 09:28:49 PDT 2015


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 at osg.samsung.com>
---
 src/loader/loader.c | 6 +++---
 src/loader/loader.h | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/loader/loader.c b/src/loader/loader.c
index 17bf133..fc46815 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -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 {
diff --git a/src/loader/loader.h b/src/loader/loader.h
index 60c58f2..055dc78 100644
--- a/src/loader/loader.h
+++ b/src/loader/loader.h
@@ -37,6 +37,9 @@ extern "C" {
 #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);
 
 char *
-- 
2.1.4



More information about the mesa-dev mailing list