Skip to contentSkip to conversation

drm: Make drm.h uapi header safe for C++

PATCH In review Daniel Vetter 3 participants 3 messages Mar 30, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Make drm.h uapi header safe for C++

virtual is a protected keyword in C++ and can't be used at all. Ugh.

This aligns the kernel versions of the drm headers with the ones in libdrm.

---
 include/uapi/drm/drm.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/drm/drm.h +4 -0
index a0ebfe7c9a28..d299c7749091 100644
@@ -373,7 +373,11 @@ struct drm_buf_pub {
  */
 struct drm_buf_map {
 	int count;		/**< Length of the buffer list */
+#ifdef __cplusplus
+	void *virt;
+#else
 	void __user *virtual;		/**< Mmap'd area in user-virtual */
+#endif
 	struct drm_buf_pub __user *list;	/**< Buffer information */
 };
 
Signature · 6 lines
2.8.0.rc3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 16 lines · Daniel Vetter

virtual is a protected keyword in C++ and can't be used at all. Ugh.

This aligns the kernel versions of the drm headers with the ones in libdrm.

---
 include/uapi/drm/drm.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/drm/drm.h +0 -0
index a0ebfe7c9a28..d299c7749091 100644

include/uapi/drm/drm.h struct drm_buf_pub { · line 377

Quoted 5 lines
include/uapi/drm/drm.h +2 -0
@@ -373,7 +373,11 @@ struct drm_buf_pub {
  */
 struct drm_buf_map {
        int count;              /**< Length of the buffer list */
+#ifdef __cplusplus
+       void *virt;

Shouldn't this also be __user for consistency? (I realize it'll never play since the kernel doesn't get built with C++...)

Quoted 9 lines
include/uapi/drm/drm.h +2 -1
+#else
        void __user *virtual;           /**< Mmap'd area in user-virtual */
+#endif
        struct drm_buf_pub __user *list;        /**< Buffer information */
 };
 
--

2.8.0.rc3

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
Quoted 12 lines · Ilia Mirkin
Quoted 11 lines · Daniel Vetter

virtual is a protected keyword in C++ and can't be used at all. Ugh.

This aligns the kernel versions of the drm headers with the ones in libdrm.

---
 include/uapi/drm/drm.h | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 14 lines

include/uapi/drm/drm.h struct drm_buf_pub { · line 377

Quoted 10 lines
include/uapi/drm/drm.h +2 -0
index a0ebfe7c9a28..d299c7749091 100644
@@ -373,7 +373,11 @@ struct drm_buf_pub {
  */
 struct drm_buf_map {
        int count;              /**< Length of the buffer list */
+#ifdef __cplusplus
+       void *virt;

Shouldn't this also be __user for consistency? (I realize it'll never play since the kernel doesn't get built with C++...)

Yes please. There is also a bunch of extern C guards that could be nice, but that's a whole another thing.

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel