Skip to contentSkip to conversation

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

PATCH In review Daniel Vetter 5 participants 21 messages Mar 30, 2016 – Apr 6, 2016

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

PATCH 1/3 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

PATCH 2/3 drm: align #include directives with libdrm in uapi headers

We can't use <drm/*.h> because that upsets the serach paths in libdrm. Also, drop the circular inclusion in drm_mode.h.

v2: Actually change the right headers.

---
 include/uapi/drm/drm.h      | 2 +-
 include/uapi/drm/drm_mode.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
include/uapi/drm/drm.h +1 -1
index d299c7749091..c7ecc3abff03 100644
@@ -685,7 +685,7 @@ struct drm_prime_handle {
 	__s32 fd;
 };
 
-#include <drm/drm_mode.h>
+#include "drm_mode.h"
 
 #define DRM_IOCTL_BASE			'd'
 #define DRM_IO(nr)			_IO(DRM_IOCTL_BASE,nr)
include/uapi/drm/drm_mode.h +0 -2
index c0217434d28d..db106ab01039 100644
@@ -27,8 +27,6 @@
 #ifndef _DRM_MODE_H
 #define _DRM_MODE_H
 
-#include "drm.h"
-
 #define DRM_DISPLAY_INFO_LEN	32
 #define DRM_CONNECTOR_NAME_LEN	32
 #define DRM_DISPLAY_MODE_LEN	32
Signature · 6 lines
2.8.0.rc3

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

Re: [PATCH 2/3] drm: align #include directives with libdrm in uapi headers

Quoted 30 lines · Daniel Vetter

We can't use <drm/*.h> because that upsets the serach paths in libdrm. Also, drop the circular inclusion in drm_mode.h.

v2: Actually change the right headers.

---
 include/uapi/drm/drm.h      | 2 +-
 include/uapi/drm/drm_mode.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
include/uapi/drm/drm.h +1 -1
index d299c7749091..c7ecc3abff03 100644
@@ -685,7 +685,7 @@ struct drm_prime_handle {
        __s32 fd;
 };
 
-#include <drm/drm_mode.h>
+#include "drm_mode.h"
 
 #define DRM_IOCTL_BASE                 'd'
 #define DRM_IO(nr)                     _IO(DRM_IOCTL_BASE,nr)
include/uapi/drm/drm_mode.h +0 -0
index c0217434d28d..db106ab01039 100644

include/uapi/drm/drm_mode.h line 31

Quoted 5 lines
include/uapi/drm/drm_mode.h +0 -2
@@ -27,8 +27,6 @@
 #ifndef _DRM_MODE_H
 #define _DRM_MODE_H
 
-#include "drm.h"
-

I'm thinking about the complete inverse actually.

Any program that depends on drm_mode.h but does not include it explicitly is severely broken. On the other hand, we rely on the drm.h to resolve the linux specific types (for non-linux platforms).

Unfortunately I've not looked how much busted userspace there is in either case (this patch vs my suggestion).

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

#3 lore raw

Re: [PATCH 2/3] drm: align #include directives with libdrm in uapi headers

Quoted 38 lines · Emil Velikov
Quoted 30 lines · Daniel Vetter

We can't use <drm/*.h> because that upsets the serach paths in libdrm. Also, drop the circular inclusion in drm_mode.h.

v2: Actually change the right headers.

---
 include/uapi/drm/drm.h      | 2 +-
 include/uapi/drm/drm_mode.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
include/uapi/drm/drm.h +1 -1
index d299c7749091..c7ecc3abff03 100644
@@ -685,7 +685,7 @@ struct drm_prime_handle {
        __s32 fd;
 };
 
-#include <drm/drm_mode.h>
+#include "drm_mode.h"
 
 #define DRM_IOCTL_BASE                 'd'
 #define DRM_IO(nr)                     _IO(DRM_IOCTL_BASE,nr)
include/uapi/drm/drm_mode.h +0 -0
index c0217434d28d..db106ab01039 100644

include/uapi/drm/drm_mode.h line 31

Quoted 5 lines
include/uapi/drm/drm_mode.h +0 -2
@@ -27,8 +27,6 @@
 #ifndef _DRM_MODE_H
 #define _DRM_MODE_H
 
-#include "drm.h"
-

I'm thinking about the complete inverse actually.

Quoted 6 lines

Any program that depends on drm_mode.h but does not include it explicitly is severely broken. On the other hand, we rely on the drm.h to resolve the linux specific types (for non-linux platforms).

Unfortunately I've not looked how much busted userspace there is in either case (this patch vs my suggestion).

Well I was just blindly aligning the #includes to match what we have right now in libdrm. That's the safest option really. It would be nice to untangle this, but I think it's too late for that now :( -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

Re: [PATCH 2/3] drm: align #include directives with libdrm in uapi headers

Quoted 43 lines · Daniel Vetter
Quoted 42 lines · Emil Velikov
Quoted 30 lines · Daniel Vetter

We can't use <drm/*.h> because that upsets the serach paths in libdrm. Also, drop the circular inclusion in drm_mode.h.

v2: Actually change the right headers.

---
 include/uapi/drm/drm.h      | 2 +-
 include/uapi/drm/drm_mode.h | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
include/uapi/drm/drm.h +1 -1
index d299c7749091..c7ecc3abff03 100644
@@ -685,7 +685,7 @@ struct drm_prime_handle {
        __s32 fd;
 };
 
-#include <drm/drm_mode.h>
+#include "drm_mode.h"
 
 #define DRM_IOCTL_BASE                 'd'
 #define DRM_IO(nr)                     _IO(DRM_IOCTL_BASE,nr)
include/uapi/drm/drm_mode.h +0 -0
index c0217434d28d..db106ab01039 100644

include/uapi/drm/drm_mode.h line 31

Quoted 5 lines
include/uapi/drm/drm_mode.h +0 -2
@@ -27,8 +27,6 @@
 #ifndef _DRM_MODE_H
 #define _DRM_MODE_H
 
-#include "drm.h"
-

I'm thinking about the complete inverse actually.

Any program that depends on drm_mode.h but does not include it explicitly is severely broken. On the other hand, we rely on the drm.h to resolve the linux specific types (for non-linux platforms).

Quoted 6 lines
Quoted 2 lines

Unfortunately I've not looked how much busted userspace there is in either case (this patch vs my suggestion).

Well I was just blindly aligning the #includes to match what we have right now in libdrm. That's the safest option really. It would be nice to untangle this, but I think it's too late for that now :(

Sadly that's the case. As I doubt anyone is interested in seeing existing userspace burn (fail to build), so let's keep the drm_mode.h. Although let's also keep the drm.h include - it's a way to of being nice to devs so that they don't need nasty workarounds.

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

#5 lore raw

PATCH 1/1 drm: align #include directives with libdrm in uapi headers

In reply to Daniel Vetter

We can't use <drm/*.h> because that upsets the serach paths in libdrm. Also, drop the circular inclusion in drm_mode.h.

v2: Actually change the right headers.

v3: Drop the #include removal per Emil's request.

---
 include/uapi/drm/drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/drm.h +1 -1
index 7d42d105f32a..85ada499574b 100644
@@ -685,7 +685,7 @@ struct drm_prime_handle {
 	__s32 fd;
 };
 
-#include <drm/drm_mode.h>
+#include "drm_mode.h"
 
 #define DRM_IOCTL_BASE			'd'
 #define DRM_IO(nr)			_IO(DRM_IOCTL_BASE,nr)
Signature · 6 lines
2.8.0.rc3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#6 lore raw

Re: [PATCH] drm: align #include directives with libdrm in uapi headers

Quoted 7 lines · Daniel Vetter

We can't use <drm/*.h> because that upsets the serach paths in libdrm. Also, drop the circular inclusion in drm_mode.h.

v2: Actually change the right headers.

v3: Drop the #include removal per Emil's request.

Thanks.

Quoted 2 lines

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

#7 lore raw

PATCH 3/3 drm: Move DRM_MODE_OBJECT_* to uapi headers

In reply to Daniel Vetter

These type defines are officially part of the uapi, but ended up in the wrong headers somehow when we split them all.

---
 include/drm/drm_crtc.h      | 10 ----------
 include/uapi/drm/drm_mode.h | 10 ++++++++++
 2 files changed, 10 insertions(+), 10 deletions(-)
include/drm/drm_crtc.h +0 -10
index bc7fbb572155..8cb377c5eb93 100644
@@ -45,16 +45,6 @@ struct drm_clip_rect;
 struct device_node;
 struct fence;
 
-#define DRM_MODE_OBJECT_CRTC 0xcccccccc
-#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
-#define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
-#define DRM_MODE_OBJECT_MODE 0xdededede
-#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
-#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
-#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
-#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
-#define DRM_MODE_OBJECT_ANY 0
-
 struct drm_mode_object {
 	uint32_t id;
 	uint32_t type;
include/uapi/drm/drm_mode.h +10 -0
index db106ab01039..8c48c0a558c0 100644
@@ -318,6 +318,16 @@ struct drm_mode_connector_set_property {
 	__u32 connector_id;
 };
 
+#define DRM_MODE_OBJECT_CRTC 0xcccccccc
+#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
+#define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
+#define DRM_MODE_OBJECT_MODE 0xdededede
+#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
+#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
+#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
+#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
+#define DRM_MODE_OBJECT_ANY 0
+
 struct drm_mode_obj_get_properties {
 	__u64 props_ptr;
 	__u64 prop_values_ptr;
Signature · 6 lines
2.8.0.rc3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 3/3
#8 lore raw

Re: [PATCH 3/3] drm: Move DRM_MODE_OBJECT_* to uapi headers

Quoted 5 lines · Daniel Vetter

These type defines are officially part of the uapi, but ended up in the wrong headers somehow when we split them all.

The way it was done originally (by Paulo) with commit c543188afb7a83e66161c026dc6fd5eb38dc0b63 it seemed deliberate. At the same time the libdrm got a different treatment 8c75703df0fdf65b3851f8eb5822705638decff3. Would be swell Paulo can confirm (re: unintentional or deliberate difference), if he recalls any of this :-)

Barring any objections from Paulo

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

#9 lore raw

Re: [PATCH 3/3] drm: Move DRM_MODE_OBJECT_* to uapi headers

2016-03-30 13:07 GMT-03:00 Emil Velikov <[email protected]>:

Quoted 6 lines · Daniel Vetter
Quoted 5 lines

These type defines are officially part of the uapi, but ended up in the wrong headers somehow when we split them all.

Quoted 8 lines

The way it was done originally (by Paulo) with commit c543188afb7a83e66161c026dc6fd5eb38dc0b63 it seemed deliberate. At the same time the libdrm got a different treatment 8c75703df0fdf65b3851f8eb5822705638decff3. Would be swell Paulo can confirm (re: unintentional or deliberate difference), if he recalls any of this :-)

Barring any objections from Paulo

No objections from Paulo. The include/uapi directory didn't even exist at that time, and I guess I was just trying to make things work, without any specific coding philosophy in mind.

Quoted 7 lines

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

Signature · 5 lines
Paulo Zanoni
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw

Re: [PATCH 3/3] drm: Move DRM_MODE_OBJECT_* to uapi headers

Quoted 14 lines · Paulo Zanoni

2016-03-30 13:07 GMT-03:00 Emil Velikov <[email protected]>:

Quoted 13 lines · Daniel Vetter
Quoted 5 lines

These type defines are officially part of the uapi, but ended up in the wrong headers somehow when we split them all.

The way it was done originally (by Paulo) with commit c543188afb7a83e66161c026dc6fd5eb38dc0b63 it seemed deliberate. At the same time the libdrm got a different treatment 8c75703df0fdf65b3851f8eb5822705638decff3. Would be swell Paulo can confirm (re: unintentional or deliberate difference), if he recalls any of this :-)

Quoted 5 lines
Quoted 1 line

Barring any objections from Paulo

No objections from Paulo. The include/uapi directory didn't even exist at that time, and I guess I was just trying to make things work, without any specific coding philosophy in mind.

Yeah, I suspect that this was actually fumbled in the uapi split-up somehow ...
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#11 lore raw

PATCH 1/2 drm: Untangle __KERNEL__ guards

In reply to Daniel Vetter

make headers_install can't handle fancy conditions, so let's simplify things for it a bit.

---
 include/uapi/drm/drm.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
include/uapi/drm/drm.h +7 -1
index c7ecc3abff03..3b56285a7e2a 100644
@@ -36,7 +36,13 @@
 #ifndef _DRM_H_
 #define _DRM_H_
 
-#if defined(__KERNEL__) || defined(__linux__)
+#if defined(__KERNEL__)
+
+#include <linux/types.h>
+#include <asm/ioctl.h>
+typedef unsigned int drm_handle_t;
+
+#elif defined(__linux__)
 
 #include <linux/types.h>
 #include <asm/ioctl.h>
Signature · 6 lines
2.8.0.rc3

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

PATCH 2/2 drm: Make uapi headers C89 pendantic compliant

This ports the below libdrm commit to the kernel

commit 0f4452bb51306024fbf4cbf77d8baab20cefba67

Author: Daniel Kurtz <[email protected]>
Date:   Mon Aug 26 23:39:16 2013 +0800

libdrm: Make some drm headers compatible with gcc -std=c89 -pedantic

The following minor changes were needed to these headers:
* Convert // comments to /* */
* No , after final member of enum

With these changes, these header files can be included by a program that is built with gcc options:
-std=c89 -Werror -pedantic

---
 include/uapi/drm/drm.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/drm/drm.h +2 -2
index 3b56285a7e2a..8b41297038aa 100644
@@ -187,7 +187,7 @@ enum drm_map_type {
 	_DRM_SHM = 2,		  /**< shared, cached */
 	_DRM_AGP = 3,		  /**< AGP/GART */
 	_DRM_SCATTER_GATHER = 4,  /**< Scatter/gather memory for PCI DMA */
-	_DRM_CONSISTENT = 5,	  /**< Consistent memory for PCI DMA */
+	_DRM_CONSISTENT = 5	  /**< Consistent memory for PCI DMA */
 };
 
 /**
@@ -441,7 +441,7 @@ struct drm_draw {
  * DRM_IOCTL_UPDATE_DRAW ioctl argument type.
  */
 typedef enum {
-	DRM_DRAWABLE_CLIPRECTS,
+	DRM_DRAWABLE_CLIPRECTS
 } drm_drawable_info_type_t;
 
 struct drm_update_draw {
Signature · 6 lines
2.8.0.rc3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 2/2
#13 lore raw

Re: [PATCH 2/2] drm: Make uapi headers C89 pendantic compliant

Quoted 16 lines · Daniel Vetter

This ports the below libdrm commit to the kernel

commit 0f4452bb51306024fbf4cbf77d8baab20cefba67

Author: Daniel Kurtz <[email protected]>
Date:   Mon Aug 26 23:39:16 2013 +0800

libdrm: Make some drm headers compatible with gcc -std=c89 -pedantic

The following minor changes were needed to these headers:
* Convert // comments to /* */
* No , after final member of enum

With these changes, these header files can be included by a program that is built with gcc options:
-std=c89 -Werror -pedantic

Quoted 5 lines

Yes, please :-)

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

#14 lore raw

Re: [PATCH 2/2] drm: Make uapi headers C89 pendantic compliant

Quoted 17 lines · Emil Velikov
Quoted 16 lines · Daniel Vetter

This ports the below libdrm commit to the kernel

commit 0f4452bb51306024fbf4cbf77d8baab20cefba67

Author: Daniel Kurtz <[email protected]>
Date:   Mon Aug 26 23:39:16 2013 +0800

libdrm: Make some drm headers compatible with gcc -std=c89 -pedantic

The following minor changes were needed to these headers:
* Convert // comments to /* */
* No , after final member of enum

With these changes, these header files can be included by a program that is built with gcc options:
-std=c89 -Werror -pedantic

Quoted 8 lines
Quoted 5 lines

Yes, please :-)

Also applied, thanks for your review.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/2
#15 lore raw

Re: [PATCH 1/2] drm: Untangle __KERNEL__ guards

In reply to Daniel Vetter
Quoted 16 lines · Daniel Vetter

make headers_install can't handle fancy conditions, so let's simplify things for it a bit.

---
 include/uapi/drm/drm.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
include/uapi/drm/drm.h +0 -0
index c7ecc3abff03..3b56285a7e2a 100644
@@ -36,7 +36,13 @@
 #ifndef _DRM_H_
 #define _DRM_H_

include/uapi/drm/drm.h line 46

Quoted 10 lines
include/uapi/drm/drm.h +7 -1
 
-#if defined(__KERNEL__) || defined(__linux__)
+#if defined(__KERNEL__)
+
+#include <linux/types.h>
+#include <asm/ioctl.h>
+typedef unsigned int drm_handle_t;
+
+#elif defined(__linux__)
 

Bit dubious how that used to work, and that the program fails with the original, yet handled "elif defined..." correctly.

Regardless,

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

#16 lore raw

Re: [PATCH 1/2] drm: Untangle __KERNEL__ guards

Quoted 18 lines · Emil Velikov
Quoted 17 lines · Daniel Vetter

make headers_install can't handle fancy conditions, so let's simplify things for it a bit.

---
 include/uapi/drm/drm.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
include/uapi/drm/drm.h +0 -0
index c7ecc3abff03..3b56285a7e2a 100644
@@ -36,7 +36,13 @@
 #ifndef _DRM_H_
 #define _DRM_H_
 
Quoted 11 lines

include/uapi/drm/drm.h line 46

Quoted 9 lines
include/uapi/drm/drm.h +7 -1
-#if defined(__KERNEL__) || defined(__linux__)
+#if defined(__KERNEL__)
+
+#include <linux/types.h>
+#include <asm/ioctl.h>
+typedef unsigned int drm_handle_t;
+
+#elif defined(__linux__)
 

Bit dubious how that used to work, and that the program fails with the original, yet handled "elif defined..." correctly.

I didn't dare looking into the horror show the script is - still charred from looking too closely at kerneldoc ;-)

Quoted 2 lines

Regardless,

Thanks for the review, all expect the last one (to make them pendantic compliant, still missing r-b on that) applied to drm-misc. -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#17 lore raw

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

In reply to 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.

v2: Also annote with __user, as request by Emil&Ilia.

Cc Ilia Mirkin <[email protected]>
Cc Emil Velikov <[email protected]>
---
 include/uapi/drm/drm.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/drm/drm.h +4 -0
index a0ebfe7c9a28..7d42d105f32a 100644
@@ -373,7 +373,11 @@ struct drm_buf_pub {
  */
 struct drm_buf_map {
 	int count;		/**< Length of the buffer list */
+#ifdef __cplusplus
+	void __user *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
#19 lore raw
In reply to Daniel Vetter
Quoted 23 lines · On Wed, 30 Mar 2016 16:19:42 +0200 Daniel Vetter <[email protected]> wrote:

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 +3 -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
Quoted 4 lines

user-virtual */ +#endif
struct drm_buf_pub __user *list; /**< Buffer
information */ };

Why not simply rename the field ?

Signature · 5 lines
Gabriel Laskar
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#20 lore raw
Quoted 24 lines · Gabriel Laskar
Quoted 21 lines · On Wed, 30 Mar 2016 16:19:42 +0200 Daniel Vetter <[email protected]> wrote:

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 +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;
Quoted 9 lines
Quoted 6 lines
include/uapi/drm/drm.h +1 -0
+#else
      void __user *virtual;           /**< Mmap'd area in

user-virtual */ +#endif
struct drm_buf_pub __user *list; /**< Buffer
information */ };

Why not simply rename the field ?

It will break existing users. Some of which haven't been updated/maintained in a long while.

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