OSDN Git Service

nouveau: add symbols test
[android-x86/external-libdrm.git] / xf86drm.c
index 194cd35..ffc53b8 100644 (file)
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -52,6 +52,9 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include <stdarg.h>
+#ifdef HAVE_SYS_MKDEV_H
+# include <sys/mkdev.h> /* defines major(), minor(), and makedev() on Solaris */
+#endif
 
 /* Not all systems have MAP_FAILED defined */
 #ifndef MAP_FAILED
@@ -111,11 +114,6 @@ drmDebugPrint(const char *format, va_list ap)
     return vfprintf(stderr, format, ap);
 }
 
-typedef int DRM_PRINTFLIKE(1, 0) (*debug_msg_func_t)(const char *format,
-                                                    va_list ap);
-
-static debug_msg_func_t drm_debug_print = drmDebugPrint;
-
 void
 drmMsg(const char *format, ...)
 {
@@ -127,18 +125,12 @@ drmMsg(const char *format, ...)
        if (drm_server_info) {
          drm_server_info->debug_print(format,ap);
        } else {
-         drm_debug_print(format, ap);
+         drmDebugPrint(format, ap);
        }
        va_end(ap);
     }
 }
 
-void
-drmSetDebugMsgFunction(debug_msg_func_t debug_msg_ptr)
-{
-    drm_debug_print = debug_msg_ptr;
-}
-
 static void *drmHashTable = NULL; /* Context switch callbacks */
 
 void *drmGetHashTable(void)
@@ -274,6 +266,7 @@ static int drmMatchBusID(const char *id1, const char *id2, int pci_domain_ok)
  * If any other failure happened then it will output error mesage using
  * drmMsg() call.
  */
+#if !defined(UDEV)
 static int chown_check_return(const char *path, uid_t owner, gid_t group)
 {
        int rv;
@@ -289,6 +282,7 @@ static int chown_check_return(const char *path, uid_t owner, gid_t group)
                        path, errno, strerror(errno));
        return -1;
 }
+#endif
 
 /**
  * Open the DRM device, creating it if necessary.
@@ -310,10 +304,13 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
     char            buf[64];
     int             fd;
     mode_t          devmode = DRM_DEV_MODE, serv_mode;
+    gid_t           serv_group;
+#if !defined(UDEV)
     int             isroot  = !geteuid();
     uid_t           user    = DRM_DEV_UID;
-    gid_t           group   = DRM_DEV_GID, serv_group;
-    
+    gid_t           group   = DRM_DEV_GID;
+#endif
+
     switch (type) {
     case DRM_NODE_PRIMARY:
            dev_name = DRM_DEV_NAME;
@@ -335,7 +332,6 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
        drm_server_info->get_perms(&serv_group, &serv_mode);
        devmode  = serv_mode ? serv_mode : DRM_DEV_MODE;
        devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
-       group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
     }
 
 #if !defined(UDEV)
@@ -356,6 +352,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
     }
 
     if (drm_server_info) {
+       group = (serv_group >= 0) ? serv_group : DRM_DEV_GID;
        chown_check_return(buf, user, group);
        chmod(buf, devmode);
     }
@@ -1722,7 +1719,7 @@ int drmAgpEnable(int fd, unsigned long mode)
 {
     drm_agp_mode_t m;
 
-    memclear(mode);
+    memclear(m);
     m.mode = mode;
     if (drmIoctl(fd, DRM_IOCTL_AGP_ENABLE, &m))
        return -errno;