devPrivates rework: hook up new mechanism in backwards-compatibility mode

on existing structures that support devPrivates.
This commit is contained in:
Eamon Walsh 2007-03-07 11:22:42 -05:00 committed by Eamon Walsh
commit c45f676208
4 changed files with 76 additions and 39 deletions

View file

@ -30,6 +30,13 @@ typedef struct _Private {
struct _Private *next;
} PrivateRec;
/*
* Backwards compatibility macro. Use to get the proper PrivateRec
* reference from any of the structure types that supported the old
* devPrivates mechanism.
*/
#define DEVPRIV_PTR(foo) ((PrivateRec **)(&(foo)->devPrivates[0].ptr))
/*
* Request pre-allocated private space for your driver/module.
* A non-null pScreen argument restricts to objects on a given screen.
@ -156,4 +163,7 @@ dixLookupPrivateOffset(RESTYPE type);
extern int
dixRegisterPrivateOffset(RESTYPE type, unsigned offset);
/* Used by the legacy support, don't rely on this being here */
#define PadToLong(w) ((((w) + sizeof(long)-1) / sizeof(long)) * sizeof(long))
#endif /* PRIVATES_H */