From 77c35c043a8d50244d4fbaa4f2b5d0b7d4fd856f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 21 Aug 2002 07:14:21 +0000 Subject: Remove drm_linux.h, move the two useful defines into drm_drv.h (the only place they're used). Use fd locking on -current. Actually copy in data from userspace to kernel in the linux-compat ioctl path. Make sure ioctl sizes are as expected in the ioctl handler functions. --- bsd-core/drm_os_freebsd.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'bsd-core/drm_os_freebsd.h') diff --git a/bsd-core/drm_os_freebsd.h b/bsd-core/drm_os_freebsd.h index 23838139..6f878d4f 100644 --- a/bsd-core/drm_os_freebsd.h +++ b/bsd-core/drm_os_freebsd.h @@ -65,7 +65,6 @@ #include #include #include -#include "drm_linux.h" #endif #define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */ @@ -140,14 +139,18 @@ do { \ } \ } while (0) -#define DRM_COPY_TO_USER_IOCTL(arg1, arg2, arg3) \ - *arg1 = arg2 -#define DRM_COPY_FROM_USER_IOCTL(arg1, arg2, arg3) \ - arg1 = *arg2 -#define DRM_COPY_TO_USER(arg1, arg2, arg3) \ - copyout(arg2, arg1, arg3) -#define DRM_COPY_FROM_USER(arg1, arg2, arg3) \ - copyin(arg2, arg1, arg3) +#define DRM_COPY_TO_USER_IOCTL(user, kern, size) \ + if ( IOCPARM_LEN(cmd) != size) \ + return EINVAL; \ + *user = kern; +#define DRM_COPY_FROM_USER_IOCTL(kern, user, size) \ + if ( IOCPARM_LEN(cmd) != size) \ + return EINVAL; \ + kern = *user; +#define DRM_COPY_TO_USER(user, kern, size) \ + copyout(kern, user, size) +#define DRM_COPY_FROM_USER(kern, user, size) \ + copyin(user, kern, size) /* Macros for userspace access with checking readability once */ /* FIXME: can't find equivalent functionality for nocheck yet. * It's be slower than linux, but should be correct. -- cgit v1.2.3