[PATCH 2/4] devPrivates rework: add header file w/ new interface

Eamon Walsh ewalsh at tycho.nsa.gov
Thu Feb 22 16:05:32 PST 2007


Adds new dix header file privates.h containing new interface.

---
 include/Makefile.am |    1 +
 include/privates.h  |   77 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/include/Makefile.am b/include/Makefile.am
index 4289b81..4d8910b 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -31,6 +31,7 @@ sdk_HEADERS =		\
 	os.h		\
 	pixmap.h	\
 	pixmapstr.h	\
+	privates.h	\
 	property.h	\
 	propertyst.h	\
 	region.h	\
diff --git a/include/privates.h b/include/privates.h
new file mode 100644
index 0000000..05753f2
--- /dev/null
+++ b/include/privates.h
@@ -0,0 +1,77 @@
+/***********************************************************
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************/
+
+#ifndef PRIVATES_H
+#define PRIVATES_H 1
+
+#include "dix.h"
+#include "resource.h"
+
+/*****************************************************************
+ * STUFF FOR PRIVATES
+ *****************************************************************/
+
+/*
+ * Request private space for your driver/module in all resources of a type.
+ * A non-null pScreen argument restricts to resources on a given screen.
+ */
+extern int
+dixRequestPrivate(RESTYPE type, unsigned size, pointer pScreen);
+
+/*
+ * Request private space in just one individual resource object.
+ */
+extern int
+dixRequestSinglePrivate(RESTYPE type, unsigned size, pointer instance);
+
+/*
+ * Look up a private pointer.
+ */
+extern pointer
+dixLookupPrivate(RESTYPE type, int index, pointer instance);
+
+/*
+ * Register callbacks to be called on private allocation/freeing.
+ * The calldata argument to the callbacks is a PrivateCallbackPtr.
+ */
+typedef struct _PrivateCallback {
+    pointer value;		/* pointer to private */
+    int index;			/* registration index */
+    ResourcePtr resource;	/* resource record (do not modify!) */
+} PrivateCallbackRec, *PrivateCallbackPtr;
+
+extern int
+dixRegisterPrivateInitFunc(RESTYPE type, int index,
+			   CallbackProcPtr callback, pointer userdata);
+
+extern int
+dixRegisterPrivateDeleteFunc(RESTYPE type, int index,
+			     CallbackProcPtr callback, pointer userdata);
+
+/*
+ * Internal functions
+ */
+extern void
+dixResetPrivates(void);
+
+extern int
+dixUpdatePrivates(void);
+
+extern ResourcePtr
+dixAllocateResourceRec(RESTYPE type, pointer parent);
+
+extern void
+dixCallPrivateInitFuncs(ResourcePtr res);
+
+extern void
+dixFreeResourceRec(ResourcePtr res);
+
+#endif /* PRIVATES_H */
-- 1.4.4.2




More information about the xorg mailing list