diff mbox series

[RFC,6/9] drm/vgem: move IOCTLs numbers to enum

Message ID 20230317121213.93991-7-mcanal@igalia.com (mailing list archive)
State New, archived
Headers show
Series Rust version of the VGEM driver | expand

Commit Message

Maíra Canal March 17, 2023, 12:12 p.m. UTC
Bindgen doesn't expand C macros, which makes DRM_IOCTL_VGEM_FENCE_ATTACH
and DRM_IOCTL_VGEM_FENCE_SIGNAL not accessible through the Rust
bindings. So, move the IOCTLs numbers to a enum, preserving the same
values and the same name. This won't produce any functional changes to
the UAPI and it will make it possible to use this UAPI in Rust.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 include/uapi/drm/vgem_drm.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/include/uapi/drm/vgem_drm.h b/include/uapi/drm/vgem_drm.h
index bf66f5db6da8..53ee3af0b25a 100644
--- a/include/uapi/drm/vgem_drm.h
+++ b/include/uapi/drm/vgem_drm.h
@@ -39,9 +39,6 @@  extern "C" {
 #define DRM_VGEM_FENCE_ATTACH	0x1
 #define DRM_VGEM_FENCE_SIGNAL	0x2
 
-#define DRM_IOCTL_VGEM_FENCE_ATTACH	DRM_IOWR( DRM_COMMAND_BASE + DRM_VGEM_FENCE_ATTACH, struct drm_vgem_fence_attach)
-#define DRM_IOCTL_VGEM_FENCE_SIGNAL	DRM_IOW( DRM_COMMAND_BASE + DRM_VGEM_FENCE_SIGNAL, struct drm_vgem_fence_signal)
-
 struct drm_vgem_fence_attach {
 	__u32 handle;
 	__u32 flags;
@@ -55,6 +52,12 @@  struct drm_vgem_fence_signal {
 	__u32 flags;
 };
 
+/* Note: this is an enum so that it can be resolved by Rust bindgen. */
+enum {
+	DRM_IOCTL_VGEM_FENCE_ATTACH	= DRM_IOWR(DRM_COMMAND_BASE + DRM_VGEM_FENCE_ATTACH, struct drm_vgem_fence_attach),
+	DRM_IOCTL_VGEM_FENCE_SIGNAL	= DRM_IOW(DRM_COMMAND_BASE + DRM_VGEM_FENCE_SIGNAL, struct drm_vgem_fence_signal),
+};
+
 #if defined(__cplusplus)
 }
 #endif