From: Robert Foss <robert.foss@collabora.com>
To: intel-gfx@lists.freedesktop.org,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Robert Bragg <robert@sixbynine.org>,
Chris Wilson <chris@chris-wilson.co.uk>
Subject: [PATCH i-g-t v4 2/2] lib/ioctl_wrappers.h: Add to_user_pointer() helper
Date: Mon, 2 Jan 2017 05:25:55 -0500 [thread overview]
Message-ID: <20170102102555.9056-3-robert.foss@collabora.com> (raw)
In-Reply-To: <20170102102555.9056-1-robert.foss@collabora.com>
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>
---
lib/ioctl_wrappers.h | 11 +++++++++++
1 file changed, 11 insertions(+)
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 */
--
2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-01-02 10:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 10:25 [PATCH i-g-t v4 0/2] 32/64-bit ptr wrapper Robert Foss
2017-01-02 10:25 ` [PATCH i-g-t v4 1/2] tests/perf: Fix pointer length compilation errors on 32-bit systems Robert Foss
2017-01-02 10:25 ` Robert Foss [this message]
2017-01-02 10:42 ` [PATCH i-g-t v4 0/2] 32/64-bit ptr wrapper Chris Wilson
2017-01-02 11:43 ` Robert Foss
2017-01-02 11:50 ` Chris Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170102102555.9056-3-robert.foss@collabora.com \
--to=robert.foss@collabora.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=robert@sixbynine.org \
--cc=tomeu.vizoso@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox