summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/drmP.h
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-06-03 17:21:23 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-06-03 17:21:23 +0000
commitf477a7be1a11212b343d8d9a83976683c4f6f10f (patch)
treeff1149e184151907bfc8ce826a425d8e72272f93 /sys/dev/pci/drm/drmP.h
parentf85e7f6f471cf857331d4b96043121305d4db1a1 (diff)
Make *drm(4) use D_CLONE so that the per-open data actually works. Since
i'm modifying this code anyway, prepare for privsep by making it so that "master" openers must be root, and remove some spurious suser() checks. For example, every DRM_ROOT_ONLY ioctl is also DRM_MASTER. Without this change, privsep wouldn't work since the fd is no longer root owned. With this, X privsep should work as soon as the userland bits are done (currently unwritten). Looked over by kettenis@, ok thib@.
Diffstat (limited to 'sys/dev/pci/drm/drmP.h')
-rw-r--r--sys/dev/pci/drm/drmP.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h
index ae3842c596a..6248fedfaec 100644
--- a/sys/dev/pci/drm/drmP.h
+++ b/sys/dev/pci/drm/drmP.h
@@ -322,11 +322,18 @@ enum {
#elif defined(__NetBSD__)
#define drm_get_device_from_kdev(_kdev) device_lookup(&drm_cd, minor(_kdev))
#elif defined(__OpenBSD__)
+/* D_CLONE only supports one device, this will be fixed eventually */
+#define drm_get_device_from_kdev(_kdev) \
+ drm_units[0]
+
+#if 0 /* D_CLONE only supports on device for now */
#define drm_get_device_from_kdev(_kdev) \
(minor(kdev) < DRM_MAXUNITS) ? \
drm_units[minor(kdev)] : NULL
#endif
+#endif /* __FreeBSD__ / __NetBSD__ / __OpenBSD__ */
+
#ifdef __FreeBSD__
#define PAGE_ALIGN(addr) round_page(addr)
#if __FreeBSD_version >= 700000
@@ -968,10 +975,13 @@ dev_type_mmap(drm_mmap);
extern drm_local_map_t *drm_getsarea(drm_device_t *dev);
/* File operations helpers (drm_fops.c) */
-int drm_open_helper(DRM_CDEV kdev, int flags, int fmt,
- DRM_STRUCTPROC *p, drm_device_t *dev);
-extern drm_file_t *drm_find_file_by_proc(drm_device_t *dev,
- DRM_STRUCTPROC *p);
+int drm_open_helper(DRM_CDEV, int, int,
+ DRM_STRUCTPROC *, drm_device_t *);
+#ifdef __OpenBSD__
+drm_file_t *drm_find_file_by_minor(drm_device_t *, int);
+#else
+drm_file_t *drm_find_file_by_proc(drm_device_t *, DRM_STRUCTPROC *);
+#endif
/* Memory management support (drm_memory.c) */
void drm_mem_init(void);