summaryrefslogtreecommitdiff
path: root/lib/ioctl_wrappers.h
diff options
context:
space:
mode:
authorRobert Foss <robert.foss@collabora.com>2017-01-02 05:07:10 -0500
committerRobert Foss <robert.foss@collabora.com>2017-01-02 05:27:56 -0500
commit091a452489ac184bbc4d0d23ce6a255abc0f4631 (patch)
treec68ac3d087937d9397783af974f7f708c9d37e39 /lib/ioctl_wrappers.h
parentdbee0832c586596d60ae1dc3eef92e3638af94d3 (diff)
lib/ioctl_wrappers.h: Add to_user_pointer() helper
Add to_user_pointer() helper function which helps cast pointers properly when being used with ioctls. Signed-off-by: Robert Foss <robert.foss@collabora.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/ioctl_wrappers.h')
-rw-r--r--lib/ioctl_wrappers.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 26270975..2ac57f47 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -239,4 +239,15 @@ int __kms_addfb(int fd, uint32_t handle, uint32_t width, uint32_t height,
uint32_t stride, uint32_t pixel_format, uint64_t modifier,
uint32_t flags, uint32_t *buf_id);
+/**
+ * to_user_pointer:
+ *
+ * Makes sure that pointer on 32 and 64-bit systems
+ * are casted properly for being sent through an ioctl.
+ */
+inline uint64_t to_user_pointer(void *ptr)
+{
+ return (uint64_t)(uintptr_t) ptr;
+}
+
#endif /* IOCTL_WRAPPERS_H */