xserver: Branch 'XACE-SELINUX' - 5 commits
Eamon Walsh
ewalsh at kemper.freedesktop.org
Sat Feb 24 00:20:26 EET 2007
dix/main.c | 2
dix/privates.c | 317 +++++++++++++++++++++++++++++++++++++++++++++
dix/resource.c | 28 ++-
hw/xfree86/loader/dixsym.c | 7
include/Makefile.am | 1
include/miscstruct.h | 13 -
include/privates.h | 77 ++++++++++
include/resource.h | 32 ++++
mfb/mfbbitblt.c | 28 ++-
9 files changed, 466 insertions(+), 39 deletions(-)
New commits:
diff-tree 81372f9096b952f4be545654b0b44ac37ef4f2c2 (from 16f2b8892d9ebcef6410a675d10549043223f617)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Fri Feb 23 13:23:12 2007 -0500
devPrivates rework: hook up new interface in resource system; add new
resource-adding function that takes an additional ScreenPtr argument.
diff --git a/dix/main.c b/dix/main.c
index 3a77533..b5954af 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -89,6 +89,7 @@ Equipment Corporation.
#include "os.h"
#include "windowstr.h"
#include "resource.h"
+#include "privates.h"
#include "dixstruct.h"
#include "gcstruct.h"
#include "extension.h"
@@ -356,6 +357,7 @@ main(int argc, char *argv[], char *envp[
InitAtoms();
InitEvents();
InitGlyphCaching();
+ dixResetPrivates();
ResetExtensionPrivates();
ResetClientPrivates();
ResetScreenPrivates();
diff --git a/dix/resource.c b/dix/resource.c
index 584ac94..bddc18c 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -135,6 +135,7 @@ Equipment Corporation.
#include "misc.h"
#include "os.h"
#include "resource.h"
+#include "privates.h"
#include "dixstruct.h"
#include "opaque.h"
#include "windowstr.h"
@@ -206,6 +207,8 @@ CreateNewResourceType(DeleteType deleteF
if (next & lastResourceClass)
return 0;
+ if (!dixUpdatePrivates())
+ return 0;
funcs = (DeleteType *)xrealloc(DeleteFuncs,
(next + 1) * sizeof(DeleteType));
if (!funcs)
@@ -451,7 +454,7 @@ FakeClientID(register int client)
}
_X_EXPORT Bool
-AddResource(XID id, RESTYPE type, pointer value)
+dixAddResource(XID id, RESTYPE type, pointer value, pointer parent)
{
int client;
register ClientResourceRec *rrec;
@@ -472,7 +475,7 @@ AddResource(XID id, RESTYPE type, pointe
(rrec->hashsize < MAXHASHSIZE))
RebuildTable(client);
head = &rrec->resources[Hash(client, id)];
- res = (ResourcePtr)xalloc(sizeof(ResourceRec));
+ res = dixAllocateResourceRec(type, value, parent);
if (!res)
{
(*DeleteFuncs[type & TypeMask])(value, id);
@@ -486,9 +489,16 @@ AddResource(XID id, RESTYPE type, pointe
rrec->elements++;
if (!(id & SERVER_BIT) && (id >= rrec->expectID))
rrec->expectID = id + 1;
+ dixCallPrivateInitFuncs(res);
return TRUE;
}
+_X_EXPORT Bool
+AddResource(XID id, RESTYPE type, pointer value)
+{
+ return dixAddResource(id, type, value, NULL);
+}
+
static void
RebuildTable(int client)
{
@@ -570,7 +580,7 @@ FreeResource(XID id, RESTYPE skipDeleteF
FlushClientCaches(res->id);
if (rtype != skipDeleteFuncType)
(*DeleteFuncs[rtype & TypeMask])(res->value, res->id);
- xfree(res);
+ dixFreeResourceRec(res);
if (*eltptr != elements)
prev = head; /* prev may no longer be valid */
gotOne = TRUE;
@@ -614,7 +624,7 @@ FreeResourceByType(XID id, RESTYPE type,
FlushClientCaches(res->id);
if (!skipFree)
(*DeleteFuncs[type & TypeMask])(res->value, res->id);
- xfree(res);
+ dixFreeResourceRec(res);
break;
}
else
@@ -779,7 +789,7 @@ FreeClientNeverRetainResources(ClientPtr
if (rtype & RC_CACHED)
FlushClientCaches(this->id);
(*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
- xfree(this);
+ dixFreeResourceRec(this);
}
else
prev = &this->next;
@@ -829,7 +839,7 @@ FreeClientResources(ClientPtr client)
if (rtype & RC_CACHED)
FlushClientCaches(this->id);
(*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
- xfree(this);
+ dixFreeResourceRec(this);
}
}
xfree(clientTable[client->index].resources);
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index 9136351..7735767 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -283,6 +283,7 @@ _X_HIDDEN void *dixLookupTab[] = {
#endif
/* resource.c */
SYMFUNC(AddResource)
+ SYMFUNC(dixAddResource)
SYMFUNC(ChangeResourceValue)
SYMFUNC(CreateNewResourceClass)
SYMFUNC(CreateNewResourceType)
diff --git a/include/resource.h b/include/resource.h
index 9023058..617afbf 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -183,6 +183,12 @@ extern Bool AddResource(
RESTYPE /*type*/,
pointer /*value*/);
+extern Bool dixAddResource(
+ XID /*id*/,
+ RESTYPE /*type*/,
+ pointer /*value*/,
+ pointer /*parent*/);
+
extern void FreeResource(
XID /*id*/,
RESTYPE /*skipDeleteFuncType*/);
diff-tree 16f2b8892d9ebcef6410a675d10549043223f617 (from 779faccfb78648a9f7e70b77dcfa9f6e19559772)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Fri Feb 23 13:20:43 2007 -0500
devPrivates rework: add new interface implementation.
diff --git a/dix/privates.c b/dix/privates.c
index b20a1db..feab867 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -36,6 +36,7 @@ from The Open Group.
#include "os.h"
#include "windowstr.h"
#include "resource.h"
+#include "privates.h"
#include "dixstruct.h"
#include "gcstruct.h"
#include "colormapst.h"
@@ -44,6 +45,322 @@ from The Open Group.
#include "inputstr.h"
#include "extnsionst.h"
+typedef struct _PrivateDescItem {
+ int index;
+ RESTYPE type;
+ pointer parent;
+ unsigned size;
+ CallbackListPtr initfuncs;
+ CallbackListPtr deletefuncs;
+} PrivateDescItemRec, *PrivateDescItemPtr;
+
+/* keeps track of whether resource objects have been created */
+static char *instances = NULL;
+static RESTYPE instancesSize = 0;
+static char anyInstances = 0;
+
+/* list of all allocated privates */
+static PrivateDescItemPtr items = NULL;
+static unsigned itemsSize = 0;
+static unsigned nextPrivateIndex = 0;
+
+/* number of extra slots to add when resizing the tables */
+#define PRIV_TAB_INCREMENT 48
+/* set in index value for privates registered after resources were created */
+#define PRIV_DYN_MASK (1<<30)
+/* descriptor item lookup convenience macro */
+#define GET_DESCRIPTOR(index) (items + ((index) & (PRIV_DYN_MASK - 1)))
+/* type mask convenience macro */
+#define TYPE_BITS(type) ((type) & TypeMask)
+
+static _X_INLINE ResourcePtr
+findResourceBucket(RESTYPE type, pointer instance) {
+ ResourcePtr res = *((ResourcePtr *)instance);
+
+ while (res->type != type)
+ res = res->nexttype;
+ return res;
+}
+
+/*
+ * Request functions; the latter calls the former internally.
+ */
+_X_EXPORT int
+dixRequestPrivate(RESTYPE type, unsigned size, pointer parent)
+{
+ int index = nextPrivateIndex;
+
+ /* check if privates descriptor table needs to be resized */
+ if (nextPrivateIndex >= itemsSize) {
+ unsigned bytes;
+ unsigned size = itemsSize;
+
+ while (nextPrivateIndex >= size)
+ size += PRIV_TAB_INCREMENT;
+
+ bytes = size * sizeof(PrivateDescItemRec);
+ items = (PrivateDescItemPtr)xrealloc(items, bytes);
+ if (!items) {
+ itemsSize = nextPrivateIndex = 0;
+ return -1;
+ }
+ memset(items + itemsSize, 0,
+ (size - itemsSize) * sizeof(PrivateDescItemRec));
+ }
+
+ /* figure out if resource instances already exist */
+ if ((type != RC_ANY && instances[TYPE_BITS(type)]) ||
+ (type == RC_ANY && anyInstances))
+ index |= PRIV_DYN_MASK;
+
+ /* add privates descriptor */
+ items[nextPrivateIndex].index = index;
+ items[nextPrivateIndex].type = type;
+ items[nextPrivateIndex].parent = parent;
+ items[nextPrivateIndex].size = size;
+ nextPrivateIndex++;
+ return index;
+}
+
+_X_EXPORT int
+dixRequestSinglePrivate(RESTYPE type, unsigned size, pointer instance)
+{
+ PrivatePtr ptr;
+ ResourcePtr res = findResourceBucket(type, instance);
+ int index = dixRequestPrivate(type, size, instance);
+ if (index < 0)
+ return index;
+
+ ptr = (PrivatePtr)xalloc(sizeof(PrivateRec) + size);
+ if (!ptr)
+ return -1;
+ ptr->index = index;
+ ptr->value = ptr + 1;
+ ptr->next = res->privates;
+ res->privates = ptr;
+ return index;
+}
+
+/*
+ * Lookup function (some of this could be static inlined)
+ */
+_X_EXPORT pointer
+dixLookupPrivate(RESTYPE type, int index, pointer instance)
+{
+ ResourcePtr res = findResourceBucket(type, instance);
+ PrivatePtr ptr = res->privates;
+ PrivateDescItemPtr item;
+ PrivateCallbackRec calldata;
+
+ /* see if private has already been allocated (likely) */
+ while (ptr) {
+ if (ptr->index == index)
+ return ptr->value;
+ ptr = ptr->next;
+ }
+
+ /* past this point, need to create private on the fly */
+ /* create the new private */
+ item = GET_DESCRIPTOR(index);
+ ptr = (PrivatePtr)xalloc(sizeof(PrivateRec) + item->size);
+ if (!ptr)
+ return NULL;
+ memset(ptr, 0, sizeof(PrivateRec) + item->size);
+ ptr->index = index;
+ ptr->value = ptr + 1;
+ ptr->next = res->privates;
+ res->privates = ptr;
+
+ /* call any init funcs and return */
+ calldata.value = ptr->value;
+ calldata.index = index;
+ calldata.resource = res;
+ CallCallbacks(&item->initfuncs, &calldata);
+ return ptr->value;
+}
+
+/*
+ * Callback registration
+ */
+_X_EXPORT int
+dixRegisterPrivateInitFunc(RESTYPE type, int index,
+ CallbackProcPtr callback, pointer data)
+{
+ return AddCallback(&GET_DESCRIPTOR(index)->initfuncs, callback, data);
+}
+
+_X_EXPORT int
+dixRegisterPrivateDeleteFunc(RESTYPE type, int index,
+ CallbackProcPtr callback, pointer data)
+{
+ return AddCallback(&GET_DESCRIPTOR(index)->deletefuncs, callback, data);
+}
+
+/*
+ * Internal function called from the main loop to reset the subsystem.
+ */
+void
+dixResetPrivates(void)
+{
+ if (items)
+ xfree(items);
+ items = NULL;
+ itemsSize = 0;
+ nextPrivateIndex = 0;
+
+ if (instances)
+ xfree(instances);
+ instances = NULL;
+ instancesSize = 0;
+ anyInstances = 0;
+}
+
+/*
+ * Internal function called from CreateNewResourceType.
+ */
+int
+dixUpdatePrivates(void)
+{
+ RESTYPE next = lastResourceType + 1;
+
+ /* check if instances table needs to be resized */
+ if (next >= instancesSize) {
+ RESTYPE size = instancesSize;
+
+ while (next >= size)
+ size += PRIV_TAB_INCREMENT;
+
+ instances = (char *)xrealloc(instances, size);
+ if (!instances) {
+ instancesSize = 0;
+ return FALSE;
+ }
+ memset(instances + instancesSize, 0, size - instancesSize);
+ instancesSize = size;
+ }
+ return TRUE;
+}
+
+/*
+ * Internal function called from dixAddResource.
+ * Allocates a ResourceRec along with any private space all in one chunk.
+ */
+ResourcePtr
+dixAllocateResourceRec(RESTYPE type, pointer instance, pointer parent)
+{
+ unsigned i, count = 0, size = sizeof(ResourceRec);
+ ResourcePtr res;
+ PrivatePtr ptr;
+ char *value;
+
+ /* first pass figures out total size */
+ for (i=0; i<nextPrivateIndex; i++)
+ if (items[i].type == type &&
+ (items[i].parent == NULL || items[i].parent == parent)) {
+
+ size += sizeof(PrivateRec) + items[i].size;
+ count++;
+ }
+
+ /* allocate resource bucket */
+ res = (ResourcePtr)xalloc(size);
+ if (!res)
+ return res;
+ memset(res, 0, size);
+ ptr = (PrivatePtr)(res + 1);
+ value = (char *)(ptr + count);
+ res->privates = (count > 0) ? ptr : NULL;
+
+ /* second pass sets up privates records */
+ count = 0;
+ for (i=0; i<nextPrivateIndex; i++)
+ if (items[i].type == type &&
+ (items[i].parent == NULL || items[i].parent == parent)) {
+
+ ptr[count].index = items[i].index;
+ ptr[count].value = value;
+ ptr[count].next = ptr + (count + 1);
+ count++;
+ value += items[i].size;
+ }
+
+ if (count > 0)
+ ptr[count-1].next = NULL;
+
+ /* hook up back-pointer to resource record(s) */
+ if (type & RC_PRIVATES) {
+ res->nexttype = *((ResourcePtr *)instance);
+ *((ResourcePtr *)instance) = res;
+ }
+
+ instances[TYPE_BITS(type)] = anyInstances = 1;
+ return res;
+}
+
+/*
+ * Internal function called from dixAddResource.
+ * Calls the init functions on a newly allocated resource.
+ */
+void
+dixCallPrivateInitFuncs(ResourcePtr res)
+{
+ PrivatePtr ptr = res->privates;
+ PrivateCallbackRec calldata;
+
+ calldata.resource = res;
+ while (ptr) {
+ calldata.value = ptr->value;
+ calldata.index = ptr->index;
+ CallCallbacks(&GET_DESCRIPTOR(ptr->index)->initfuncs, &calldata);
+ ptr = ptr->next;
+ }
+}
+
+/*
+ * Internal function called from the various delete resource functions.
+ * Calls delete callbacks before freeing the ResourceRec and other bits.
+ */
+void
+dixFreeResourceRec(ResourcePtr res)
+{
+ ResourcePtr *tmp;
+ PrivatePtr ptr, next, base;
+ PrivateCallbackRec calldata;
+
+ /* first pass calls the delete callbacks */
+ ptr = res->privates;
+ calldata.resource = res;
+ while (ptr) {
+ calldata.value = ptr->value;
+ calldata.index = ptr->index;
+ CallCallbacks(&GET_DESCRIPTOR(ptr->index)->deletefuncs, &calldata);
+ ptr = ptr->next;
+ }
+
+ /* second pass frees any off-struct private records */
+ ptr = res->privates;
+ base = (PrivatePtr)(res + 1);
+ while (ptr && ptr != base) {
+ next = ptr->next;
+ xfree(ptr);
+ ptr = next;
+ }
+
+ /* remove the record from the nexttype linked list and free it*/
+ if (res->type & RC_PRIVATES) {
+ tmp = (ResourcePtr *)res->value;
+ while (*tmp != res)
+ tmp = &(*tmp)->nexttype;
+ *tmp = (*tmp)->nexttype;
+ }
+ xfree(res);
+}
+
+/*
+ * Following is the old devPrivates support. These functions and variables
+ * are deprecated, and should no longer be used.
+ */
+
/*
* See the Wrappers and devPrivates section in "Definition of the
* Porting Layer for the X v11 Sample Server" (doc/Server/ddx.tbl.ms)
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index 32e0e4f..9136351 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -63,6 +63,7 @@
#include "globals.h"
#include "os.h"
#include "osdep.h"
+#include "privates.h"
#include "resource.h"
#include "servermd.h"
#include "scrnintstr.h"
@@ -259,6 +260,11 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(GetScratchPixmapHeader)
SYMFUNC(FreeScratchPixmapHeader)
/* privates.c */
+ SYMFUNC(dixRequestPrivate)
+ SYMFUNC(dixRequestSinglePrivate)
+ SYMFUNC(dixLookupPrivate)
+ SYMFUNC(dixRegisterPrivateInitFunc)
+ SYMFUNC(dixRegisterPrivateDeleteFunc)
SYMFUNC(AllocateExtensionPrivate)
SYMFUNC(AllocateExtensionPrivateIndex)
SYMFUNC(AllocateClientPrivate)
diff-tree 779faccfb78648a9f7e70b77dcfa9f6e19559772 (from 9a3eb0357e779d5d5f76858f23667956c4c5d721)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Fri Feb 23 13:19:53 2007 -0500
devPrivates rework: add dix header file containing new interface.
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..8d74270
--- /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 value, pointer parent);
+
+extern void
+dixCallPrivateInitFuncs(ResourcePtr res);
+
+extern void
+dixFreeResourceRec(ResourcePtr res);
+
+#endif /* PRIVATES_H */
diff-tree 9a3eb0357e779d5d5f76858f23667956c4c5d721 (from 2534f5a9027c196f677923aaa38fa9ed9917f73d)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Fri Feb 16 19:30:03 2007 -0500
devPrivates rework: add RC_PRIVATES class, make ResourceRec visible in
the API, and add extra fields and structure supporting private storage.
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 */
diff-tree 2534f5a9027c196f677923aaa38fa9ed9917f73d (from f452507ca9209598401d15da0039aaa4e1fed1a3)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Fri Feb 16 15:33:48 2007 -0500
Remove nasty function pointer type from DevUnion, return to documented type.
diff --git a/include/miscstruct.h b/include/miscstruct.h
index c39f03c..f784587 100644
--- a/include/miscstruct.h
+++ b/include/miscstruct.h
@@ -50,7 +50,6 @@ SOFTWARE.
#include "misc.h"
#include <X11/Xprotostr.h>
-#include "gc.h"
typedef xPoint DDXPointRec;
@@ -62,17 +61,7 @@ typedef union _DevUnion {
pointer ptr;
long val;
unsigned long uval;
- RegionPtr (*fptr)(
- DrawablePtr /* pSrcDrawable */,
- DrawablePtr /* pDstDrawable */,
- GCPtr /* pGC */,
- int /* srcx */,
- int /* srcy */,
- int /* width */,
- int /* height */,
- int /* dstx */,
- int /* dsty */,
- unsigned long /* bitPlane */);
+ pointer (*fptr)(void);
} DevUnion;
#endif /* MISCSTRUCT_H */
diff --git a/mfb/mfbbitblt.c b/mfb/mfbbitblt.c
index 0f84df3..270fd96 100644
--- a/mfb/mfbbitblt.c
+++ b/mfb/mfbbitblt.c
@@ -400,20 +400,22 @@ int dstx, dsty;
static unsigned long copyPlaneGeneration;
static int copyPlaneScreenIndex = -1;
+typedef RegionPtr (*CopyPlaneFuncPtr)(
+ DrawablePtr /* pSrcDrawable */,
+ DrawablePtr /* pDstDrawable */,
+ GCPtr /* pGC */,
+ int /* srcx */,
+ int /* srcy */,
+ int /* width */,
+ int /* height */,
+ int /* dstx */,
+ int /* dsty */,
+ unsigned long /* bitPlane */);
+
Bool
mfbRegisterCopyPlaneProc (pScreen, proc)
ScreenPtr pScreen;
- RegionPtr (*proc)(
- DrawablePtr /* pSrcDrawable */,
- DrawablePtr /* pDstDrawable */,
- GCPtr /* pGC */,
- int /* srcx */,
- int /* srcy */,
- int /* width */,
- int /* height */,
- int /* dstx */,
- int /* dsty */,
- unsigned long /* bitPlane */);
+ CopyPlaneFuncPtr proc;
{
if (copyPlaneGeneration != serverGeneration)
{
@@ -422,7 +424,7 @@ mfbRegisterCopyPlaneProc (pScreen, proc)
return FALSE;
copyPlaneGeneration = serverGeneration;
}
- pScreen->devPrivates[copyPlaneScreenIndex].fptr = proc;
+ pScreen->devPrivates[copyPlaneScreenIndex].fptr = (CopyPlaneFuncPtr)proc;
return TRUE;
}
@@ -468,7 +470,7 @@ unsigned long plane;
if (pSrcDrawable->depth != 1)
{
if (copyPlaneScreenIndex >= 0 &&
- (copyPlane =
+ (copyPlane = (CopyPlaneFuncPtr)
pSrcDrawable->pScreen->devPrivates[copyPlaneScreenIndex].fptr)
)
{
More information about the xorg-commit
mailing list