[PATCH] Add helper function CreateNewResourceTypeNamed

Alan Coopersmith alan.coopersmith at sun.com
Thu Feb 12 19:36:06 PST 2009


Calls CreateNewResourceType to make a resource type, and if that
succeeds, calls RegisterResourceName to record the type name for
use by X-Resource, XACE/SELinux/XTsol, and DTrace.

Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
---
 dix/resource.c     |   13 ++++++++++++-
 include/resource.h |    3 +++
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/dix/resource.c b/dix/resource.c
index ec1d8cf..e3b0024 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -147,10 +147,10 @@ Equipment Corporation.
 #endif
 #include "xace.h"
 #include <assert.h>
+#include "registry.h"
 
 #ifdef XSERVER_DTRACE
 #include <sys/types.h>
-#include "registry.h"
 typedef const char *string;
 #include "Xserver-dtrace.h"
 
@@ -224,6 +224,17 @@ CreateNewResourceType(DeleteType deleteFunc)
 }
 
 RESTYPE
+CreateNewResourceTypeNamed(DeleteType deleteFunc, char *name)
+{
+    RESTYPE res = CreateNewResourceType(deleteFunc);
+
+    if (res && name)
+	RegisterResourceName(res, name);
+
+    return res;
+}
+
+RESTYPE
 CreateNewResourceClass(void)
 {
     RESTYPE next = lastResourceClass >> 1;
diff --git a/include/resource.h b/include/resource.h
index cb6e064..8432a6b 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -157,6 +157,9 @@ typedef Bool (*FindComplexResType)(
 extern _X_EXPORT RESTYPE CreateNewResourceType(
     DeleteType /*deleteFunc*/);
 
+extern _X_EXPORT RESTYPE CreateNewResourceTypeNamed(
+    DeleteType /*deleteFunc*/, char * /*name*/);
+
 extern _X_EXPORT RESTYPE CreateNewResourceClass(void);
 
 extern _X_EXPORT Bool InitClientResources(
-- 
1.5.6.5



More information about the xorg-devel mailing list