VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.6.99-20090831/privates.h@ 32915

Last change on this file since 32915 was 22658, checked in by vboxsync, 15 years ago

export Xorg 1.6.99 headers to OSE

  • Property svn:eol-style set to native
File size: 3.2 KB
Line 
1/***********************************************************
2
3THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
6AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
7AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
8CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9
10******************************************************************/
11
12#ifndef PRIVATES_H
13#define PRIVATES_H 1
14
15#include "dix.h"
16#include "resource.h"
17
18/*****************************************************************
19 * STUFF FOR PRIVATES
20 *****************************************************************/
21
22typedef int *DevPrivateKey;
23struct _Private;
24typedef struct _Private PrivateRec;
25
26/*
27 * Request pre-allocated private space for your driver/module.
28 * Calling this is not necessary if only a pointer by itself is needed.
29 */
30extern _X_EXPORT int
31dixRequestPrivate(const DevPrivateKey key, unsigned size);
32
33/*
34 * Allocates a new private and attaches it to an existing object.
35 */
36extern _X_EXPORT pointer *
37dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key);
38
39/*
40 * Look up a private pointer.
41 */
42extern _X_EXPORT pointer
43dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key);
44
45/*
46 * Look up the address of a private pointer.
47 */
48extern _X_EXPORT pointer *
49dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key);
50
51/*
52 * Set a private pointer.
53 */
54extern _X_EXPORT int
55dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val);
56
57/*
58 * Register callbacks to be called on private allocation/freeing.
59 * The calldata argument to the callbacks is a PrivateCallbackPtr.
60 */
61typedef struct _PrivateCallback {
62 DevPrivateKey key; /* private registration key */
63 pointer *value; /* address of private pointer */
64} PrivateCallbackRec;
65
66extern _X_EXPORT int
67dixRegisterPrivateInitFunc(const DevPrivateKey key,
68 CallbackProcPtr callback, pointer userdata);
69
70extern _X_EXPORT int
71dixRegisterPrivateDeleteFunc(const DevPrivateKey key,
72 CallbackProcPtr callback, pointer userdata);
73
74/*
75 * Frees private data.
76 */
77extern _X_EXPORT void
78dixFreePrivates(PrivateRec *privates);
79
80/*
81 * Resets the subsystem, called from the main loop.
82 */
83extern _X_EXPORT int
84dixResetPrivates(void);
85
86/*
87 * These next two functions are necessary because the position of
88 * the devPrivates field varies by structure and calling code might
89 * only know the resource type, not the structure definition.
90 */
91
92/*
93 * Looks up the offset where the devPrivates field is located.
94 * Returns -1 if no offset has been registered for the resource type.
95 */
96extern _X_EXPORT int
97dixLookupPrivateOffset(RESTYPE type);
98
99/*
100 * Specifies the offset where the devPrivates field is located.
101 * A negative value indicates no devPrivates field is available.
102 */
103extern _X_EXPORT int
104dixRegisterPrivateOffset(RESTYPE type, int offset);
105
106/*
107 * Convenience macro for adding an offset to an object pointer
108 * when making a call to one of the devPrivates functions
109 */
110#define DEVPRIV_AT(ptr, offset) ((PrivateRec **)((char *)ptr + offset))
111
112#endif /* PRIVATES_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette