[PATCH 0/4] devPrivates rework (v2): introduction/RFC

Eamon Walsh ewalsh at tycho.nsa.gov
Mon Mar 5 11:13:42 PST 2007

This is a rework of the devPrivates mechanism to use a common set of 

This version does not mess with the resource system other than adding a 
class RC_PRIVATES and placeholder types.  This version also doesn't 
require changing any structures; the existing devPrivates fields are 
reused.  Finally, this version borrows some ideas from the cairo 
user_data mechanism such as the use of static variable addresses as keys 
instead of generated integers.

Interface Overview

int dixRequestPrivate(RESTYPE type, devprivate_key_t *const key, 
unsigned size, pointer parent);
Requests size bytes of private space on objects of type type on screen
parent (NULL for all screens).

pointer dixLookupPrivate(PrivateRec **privates, devprivate_key_t *const 
Returns a pointer to the private data associated with instance.

int dixSetPrivate(PrivateRec **privates, devprivate_key_t *const key, 
pointer newvalue);
Sets a private pointer to the specified value.

int dixRegisterPrivateInitFunc(devprivate_key_t *const key, 
CallbackProcPtr callbackfunc, pointer userdata);
int dixRegisterPrivateDeleteFunc(devprivate_key_t *const key,
CallbackProcPtr callbackfunc, pointer userdata);
Registers callbacks that can be used to initialize the newly allocated
space (zeroed out by default), or cleanup just before the space gets
freed.  Users do not free the private pointer themselves!  The argument
to the callback is a structure that contains the key and private pointer.

Eamon Walsh <ewalsh at tycho.nsa.gov>
National Security Agency

More information about the xorg mailing list