VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.6.0/privates.h@ 40349

最後變更 在這個檔案從40349是 17471,由 vboxsync 提交於 16 年 前

export to OSE

  • 屬性 svn:eol-style 設為 native
檔案大小: 3.1 KB
 
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 int
31dixRequestPrivate(const DevPrivateKey key, unsigned size);
32
33/*
34 * Allocates a new private and attaches it to an existing object.
35 */
36extern pointer *
37dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key);
38
39/*
40 * Look up a private pointer.
41 */
42pointer
43dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key);
44
45/*
46 * Look up the address of a private pointer.
47 */
48pointer *
49dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key);
50
51/*
52 * Set a private pointer.
53 */
54int
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 int
67dixRegisterPrivateInitFunc(const DevPrivateKey key,
68 CallbackProcPtr callback, pointer userdata);
69
70extern int
71dixRegisterPrivateDeleteFunc(const DevPrivateKey key,
72 CallbackProcPtr callback, pointer userdata);
73
74/*
75 * Frees private data.
76 */
77extern void
78dixFreePrivates(PrivateRec *privates);
79
80/*
81 * Resets the subsystem, called from the main loop.
82 */
83extern 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 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 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 */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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