Module Name: xsrc
Committed By: riastradh
Date: Sat Mar 22 02:15:00 UTC 2014
Modified Files:
xsrc/external/mit/libdrm/dist: xf86drm.c
Log Message:
Use #ifdef DRM_IOCTL_MMAP, not #ifdef __NetBSD__.
Initialize with `= {0}' rather than a temporary static constant
variable.
Requested by christos@.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/libdrm/dist/xf86drm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: xsrc/external/mit/libdrm/dist/xf86drm.c
diff -u xsrc/external/mit/libdrm/dist/xf86drm.c:1.6 xsrc/external/mit/libdrm/dist/xf86drm.c:1.7
--- xsrc/external/mit/libdrm/dist/xf86drm.c:1.6 Fri Mar 21 18:09:50 2014
+++ xsrc/external/mit/libdrm/dist/xf86drm.c Sat Mar 22 02:15:00 2014
@@ -1138,9 +1138,8 @@ int drmClose(int fd)
int drmMap(int fd, drm_handle_t handle, drmSize size, drmAddressPtr address)
{
static unsigned long pagesize_mask = 0;
-#ifdef __NetBSD__ /* XXX */
- static const struct drm_mmap zero_mmap_req;
- struct drm_mmap mmap_req = zero_mmap_req;
+#ifdef DRM_IOCTL_MMAP
+ struct drm_mmap mmap_req = {0};
#endif
if (fd < 0)
@@ -1151,20 +1150,20 @@ int drmMap(int fd, drm_handle_t handle,
size = (size + pagesize_mask) & ~pagesize_mask;
-#ifdef __NetBSD__
+#ifdef DRM_IOCTL_MMAP
mmap_req.dnm_addr = NULL;
mmap_req.dnm_size = size;
mmap_req.dnm_prot = (PROT_READ | PROT_WRITE);
mmap_req.dnm_flags = MAP_SHARED;
mmap_req.dnm_offset = handle;
- if (drmIoctl(fd, DRM_IOCTL_MMAP, &mmap_req) == -1)
- return -errno;
- *address = mmap_req.dnm_addr;
-#else
+ if (drmIoctl(fd, DRM_IOCTL_MMAP, &mmap_req) == 0) {
+ *address = mmap_req.dnm_addr;
+ return 0;
+ }
+#endif
*address = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, handle);
if (*address == MAP_FAILED)
return -errno;
-#endif
return 0;
}