summaryrefslogtreecommitdiff
path: root/shared-core/drm.h
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2004-06-01 16:17:32 +0000
committerIan Romanick <idr@us.ibm.com>2004-06-01 16:17:32 +0000
commitf994b1f31bb64f0fb56a778c350b6ff05c93501f (patch)
tree8647d21863a5bfcd959bb358974a819a329da7fe /shared-core/drm.h
parent024fd4b15022236fe3f79eba23fec5d6177d0cb4 (diff)
Replace size_t with an ugly, ugly hack. This was done so that code in the
core X-server would compile. Hopefully, this will soon be replaced with explicitly sized types (i.e., uint32_t) and everyone will be happy.
Diffstat (limited to 'shared-core/drm.h')
-rw-r--r--shared-core/drm.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/shared-core/drm.h b/shared-core/drm.h
index ceba2424..f7508b16 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -148,6 +148,22 @@ typedef struct drm_hw_lock {
} drm_hw_lock_t;
+/* This is beyond ugly, and only works on GCC. However, it allows me to use
+ * drm.h in places (i.e., in the X-server) where I can't use size_t. The real
+ * fix is to use uint32_t instead of size_t, but that fix will break existing
+ * LP64 (i.e., PowerPC64, SPARC64, IA-64, Alpha, etc.) systems. That *will*
+ * eventually happen, though. I chose 'unsigned long' to be the fallback type
+ * because that works on all the platforms I know about. Hopefully, the
+ * real fix will happen before that bites us.
+ */
+
+#ifdef __SIZE_TYPE__
+# define DRM_SIZE_T __SIZE_TYPE__
+#else
+# warning "__SIZE_TYPE__ not defined. Assuming sizeof(size_t) == sizeof(unsigned long)!"
+# define DRM_SIZE_T unsigned long
+#endif
+
/**
* DRM_IOCTL_VERSION ioctl argument type.
*
@@ -157,11 +173,11 @@ typedef struct drm_version {
int version_major; /**< Major version */
int version_minor; /**< Minor version */
int version_patchlevel;/**< Patch level */
- size_t name_len; /**< Length of name buffer */
+ DRM_SIZE_T name_len; /**< Length of name buffer */
char *name; /**< Name of driver */
- size_t date_len; /**< Length of date buffer */
+ DRM_SIZE_T date_len; /**< Length of date buffer */
char *date; /**< User-space buffer to hold date */
- size_t desc_len; /**< Length of desc buffer */
+ DRM_SIZE_T desc_len; /**< Length of desc buffer */
char *desc; /**< User-space buffer to hold desc */
} drm_version_t;
@@ -172,10 +188,11 @@ typedef struct drm_version {
* \sa drmGetBusid() and drmSetBusId().
*/
typedef struct drm_unique {
- size_t unique_len; /**< Length of unique */
+ DRM_SIZE_T unique_len; /**< Length of unique */
char *unique; /**< Unique name for driver instantiation */
} drm_unique_t;
+#undef DRM_SIZE_T
typedef struct drm_list {
int count; /**< Length of user-space structures */