- libdrm-2.4.0-no-freaking-mknod.patch: Don't magically mknod the device

file, that's what udev is for.
This commit is contained in:
Adam Jackson 2007-11-13 00:31:01 +00:00
parent 9e18d9077b
commit 8c8d1e5cc5
3 changed files with 101 additions and 14 deletions

View File

@ -1,11 +0,0 @@
--- libdrm-2.3.0/libdrm/xf86drm.h.jx 2006-11-08 16:55:14.000000000 -0500
+++ libdrm-2.3.0/libdrm/xf86drm.h 2007-01-29 14:35:36.000000000 -0500
@@ -46,7 +46,7 @@
/* Default /dev/dri directory permissions 0755 */
#define DRM_DEV_DIRMODE \
(S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
-#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
+#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
#define DRM_DIR_NAME "/dev/dri"
#define DRM_DEV_NAME "%s/card%d"

View File

@ -0,0 +1,94 @@
diff -up libdrm-2.4.0/libdrm/xf86drm.c.mknod libdrm-2.4.0/libdrm/xf86drm.c
--- libdrm-2.4.0/libdrm/xf86drm.c.mknod 2007-10-30 20:10:10.000000000 -0400
+++ libdrm-2.4.0/libdrm/xf86drm.c 2007-11-12 19:26:12.000000000 -0500
@@ -266,64 +266,12 @@ static int drmMatchBusID(const char *id1
*/
static int drmOpenDevice(long dev, int minor)
{
- stat_t st;
char buf[64];
int fd;
- mode_t devmode = DRM_DEV_MODE, serv_mode;
- int isroot = !geteuid();
- uid_t user = DRM_DEV_UID;
- gid_t group = DRM_DEV_GID, serv_group;
sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor);
drmMsg("drmOpenDevice: node name is %s\n", buf);
- if (drm_server_info) {
- 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 (stat(DRM_DIR_NAME, &st)) {
- if (!isroot)
- return DRM_ERR_NOT_ROOT;
- mkdir(DRM_DIR_NAME, DRM_DEV_DIRMODE);
- chown(DRM_DIR_NAME, 0, 0); /* root:root */
- chmod(DRM_DIR_NAME, DRM_DEV_DIRMODE);
- }
-
- /* Check if the device node exists and create it if necessary. */
- if (stat(buf, &st)) {
- if (!isroot)
- return DRM_ERR_NOT_ROOT;
- remove(buf);
- mknod(buf, S_IFCHR | devmode, dev);
- }
-
- if (drm_server_info) {
- chown(buf, user, group);
- chmod(buf, devmode);
- }
-
- fd = open(buf, O_RDWR, 0);
- drmMsg("drmOpenDevice: open result is %d, (%s)\n",
- fd, fd < 0 ? strerror(errno) : "OK");
- if (fd >= 0)
- return fd;
-
- /* Check if the device node is not what we expect it to be, and recreate it
- * and try again if so.
- */
- if (st.st_rdev != dev) {
- if (!isroot)
- return DRM_ERR_NOT_ROOT;
- remove(buf);
- mknod(buf, S_IFCHR | devmode, dev);
- if (drm_server_info) {
- chown(buf, user, group);
- chmod(buf, devmode);
- }
- }
fd = open(buf, O_RDWR, 0);
drmMsg("drmOpenDevice: open result is %d, (%s)\n",
fd, fd < 0 ? strerror(errno) : "OK");
@@ -331,7 +279,6 @@ static int drmOpenDevice(long dev, int m
return fd;
drmMsg("drmOpenDevice: Open failed\n");
- remove(buf);
return -errno;
}
diff -up libdrm-2.4.0/libdrm/xf86drm.h.mknod libdrm-2.4.0/libdrm/xf86drm.h
--- libdrm-2.4.0/libdrm/xf86drm.h.mknod 2007-07-19 00:27:52.000000000 -0400
+++ libdrm-2.4.0/libdrm/xf86drm.h 2007-11-12 19:27:51.000000000 -0500
@@ -39,14 +39,6 @@
#include <stdint.h>
#include <drm.h>
- /* Defaults, if nothing set in xf86config */
-#define DRM_DEV_UID 0
-#define DRM_DEV_GID 0
-/* Default /dev/dri directory permissions 0755 */
-#define DRM_DEV_DIRMODE \
- (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
-#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
-
#define DRM_DIR_NAME "/dev/dri"
#define DRM_DEV_NAME "%s/card%d"
#define DRM_PROC_NAME "/proc/dri/" /* For backward Linux compatibility */

View File

@ -1,7 +1,7 @@
Summary: Direct Rendering Manager runtime library Summary: Direct Rendering Manager runtime library
Name: libdrm Name: libdrm
Version: 2.4.0 Version: 2.4.0
Release: 0%{?dist} Release: 0.1%{?dist}
License: MIT License: MIT
Group: System Environment/Libraries Group: System Environment/Libraries
URL: http://dri.sourceforge.net URL: http://dri.sourceforge.net
@ -10,7 +10,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: pkgconfig automake autoconf libtool BuildRequires: pkgconfig automake autoconf libtool
Patch1: libdrm-2.3.0-default-mode.patch Patch2: libdrm-2.4.0-no-freaking-mknod.patch
%description %description
Direct Rendering Manager runtime library Direct Rendering Manager runtime library
@ -25,7 +25,7 @@ Direct Rendering Manager development package
%prep %prep
%setup -q %setup -q
%patch1 -p1 -b .666 %patch2 -p1 -b .mknod
%build %build
aclocal ; automake ; autoconf aclocal ; automake ; autoconf
@ -76,6 +76,10 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/pkgconfig/libdrm.pc %{_libdir}/pkgconfig/libdrm.pc
%changelog %changelog
* Mon Nov 12 2007 Adam Jackson <ajax@redhat.com> 2.4.0-0.1
- libdrm-2.4.0-no-freaking-mknod.patch: Don't magically mknod the device
file, that's what udev is for.
* Thu Nov 01 2007 Dave Airlie <airlied@redhat.com> - 2.4.0-0 * Thu Nov 01 2007 Dave Airlie <airlied@redhat.com> - 2.4.0-0
- Import a snapshot of what will be 2.4 upstream - Import a snapshot of what will be 2.4 upstream