summaryrefslogtreecommitdiff
path: root/bsd/drm_os_freebsd.h
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2002-08-21 07:14:21 +0000
committerEric Anholt <anholt@freebsd.org>2002-08-21 07:14:21 +0000
commit77c35c043a8d50244d4fbaa4f2b5d0b7d4fd856f (patch)
treeca52e3a1f9ad3d6b328ffef3051d65b07b678f09 /bsd/drm_os_freebsd.h
parent8eedac58332094c72caf1fc6c41312e8ce1728b7 (diff)
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.
Diffstat (limited to 'bsd/drm_os_freebsd.h')
-rw-r--r--bsd/drm_os_freebsd.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/bsd/drm_os_freebsd.h b/bsd/drm_os_freebsd.h
index 23838139..6f878d4f 100644
--- a/bsd/drm_os_freebsd.h
+++ b/bsd/drm_os_freebsd.h
@@ -65,7 +65,6 @@
#include <sys/proc.h>
#include <machine/../linux/linux.h>
#include <machine/../linux/linux_proto.h>
-#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.