[PATCH 1/4] devPrivates rework: add RC_PRIVATES class, make ResourceRec visible
Eamon Walsh
ewalsh at tycho.nsa.gov
Thu Feb 22 16:03:26 PST 2007
Moves the ResourceRec out to resource.h, adds necessary fields,
adds PrivateRec structure, adds RC_PRIVATES class.
---
dix/resource.c | 6 ------
include/resource.h | 26 ++++++++++++++++++++++++--
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/dix/resource.c b/dix/resource.c
index 4468f45..584ac94 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -169,12 +169,6 @@ static void RebuildTable(
#define INITHASHSIZE 6
#define MAXHASHSIZE 11
-typedef struct _Resource {
- struct _Resource *next;
- XID id;
- RESTYPE type;
- pointer value;
-} ResourceRec, *ResourcePtr;
#define NullResource ((ResourcePtr)NULL)
typedef struct _ClientResource {
diff --git a/include/resource.h b/include/resource.h
index 3231e8c..9023058 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -53,10 +53,27 @@ SOFTWARE.
* STUFF FOR RESOURCES
*****************************************************************/
-/* classes for Resource routines */
+/* Resource structures */
typedef unsigned long RESTYPE;
+typedef struct _Private {
+ int index;
+ pointer value;
+ struct _Private *next;
+} PrivateRec, *PrivatePtr;
+
+typedef struct _Resource {
+ struct _Resource *next;
+ struct _Resource *nexttype;
+ XID id;
+ RESTYPE type;
+ pointer value;
+ PrivatePtr privates;
+} ResourceRec, *ResourcePtr;
+
+/* classes for Resource routines */
+
#define RC_VANILLA ((RESTYPE)0)
#define RC_CACHED ((RESTYPE)1<<31)
#define RC_DRAWABLE ((RESTYPE)1<<30)
@@ -66,7 +83,12 @@ typedef unsigned long RESTYPE;
* Extensions can use this too!
*/
#define RC_NEVERRETAIN ((RESTYPE)1<<29)
-#define RC_LASTPREDEF RC_NEVERRETAIN
+/* Use class RC_PRIVATES for resources that support extra private data.
+ * Resources having this class must provide a field of type ResourcePtr
+ * at the top of the resource structure, which must be initalized to NULL.
+ */
+#define RC_PRIVATES ((RESTYPE)1<<28)
+#define RC_LASTPREDEF RC_PRIVATES
#define RC_ANY (~(RESTYPE)0)
/* types for Resource routines */
-- 1.4.4.2
More information about the xorg
mailing list