VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.5.3/xf86Module.h@ 36304

Last change on this file since 36304 was 17471, checked in by vboxsync, 16 years ago

export to OSE

  • Property svn:eol-style set to native
File size: 8.8 KB
Line 
1/*
2 * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Except as contained in this notice, the name of the copyright holder(s)
23 * and author(s) shall not be used in advertising or otherwise to promote
24 * the sale, use or other dealings in this Software without prior written
25 * authorization from the copyright holder(s) and author(s).
26 */
27
28/*
29 * This file contains the parts of the loader interface that are visible
30 * to modules. This is the only loader-related header that modules should
31 * include.
32 *
33 * It should include a bare minimum of other headers.
34 *
35 * Longer term, the module/loader code should probably live directly under
36 * Xserver/.
37 *
38 * XXX This file arguably belongs in xfree86/loader/.
39 */
40
41#ifndef _XF86MODULE_H
42#define _XF86MODULE_H
43
44#include "misc.h"
45#include "xf86Version.h"
46#ifndef NULL
47#define NULL ((void *)0)
48#endif
49
50typedef enum {
51 LD_RESOLV_IFDONE = 0, /* only check if no more
52 delays pending */
53 LD_RESOLV_NOW = 1, /* finish one delay step */
54 LD_RESOLV_FORCE = 2 /* force checking... */
55} LoaderResolveOptions;
56
57#define DEFAULT_LIST ((char *)-1)
58
59/* This indicates a special module that doesn't have the usual entry point */
60#define EXTERN_MODULE ((pointer)-1)
61
62/* Built-in ABI classes. These definitions must not be changed. */
63#define ABI_CLASS_NONE NULL
64#define ABI_CLASS_ANSIC "X.Org ANSI C Emulation"
65#define ABI_CLASS_VIDEODRV "X.Org Video Driver"
66#define ABI_CLASS_XINPUT "X.Org XInput driver"
67#define ABI_CLASS_EXTENSION "X.Org Server Extension"
68#define ABI_CLASS_FONT "X.Org Font Renderer"
69
70#define ABI_MINOR_MASK 0x0000FFFF
71#define ABI_MAJOR_MASK 0xFFFF0000
72#define GET_ABI_MINOR(v) ((v) & ABI_MINOR_MASK)
73#define GET_ABI_MAJOR(v) (((v) & ABI_MAJOR_MASK) >> 16)
74#define SET_ABI_VERSION(maj, min) \
75 ((((maj) << 16) & ABI_MAJOR_MASK) | ((min) & ABI_MINOR_MASK))
76
77/*
78 * ABI versions. Each version has a major and minor revision. Modules
79 * using lower minor revisions must work with servers of a higher minor
80 * revision. There is no compatibility between different major revisions.
81 * Whenever the ABI_ANSIC_VERSION is changed, the others must also be
82 * changed. The minor revision mask is 0x0000FFFF and the major revision
83 * mask is 0xFFFF0000.
84 */
85#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
86#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(4, 1)
87#define ABI_XINPUT_VERSION SET_ABI_VERSION(2, 1)
88#define ABI_EXTENSION_VERSION SET_ABI_VERSION(1, 1)
89#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)
90
91#define MODINFOSTRING1 0xef23fdc5
92#define MODINFOSTRING2 0x10dc023a
93
94#ifndef MODULEVENDORSTRING
95#define MODULEVENDORSTRING "X.Org Foundation"
96#endif
97
98/* Error return codes for errmaj. New codes must only be added at the end. */
99typedef enum {
100 LDR_NOERROR = 0,
101 LDR_NOMEM, /* memory allocation failed */
102 LDR_NOENT, /* Module file does not exist */
103 LDR_NOSUBENT, /* pre-requsite file to be sub-loaded does not exist */
104 LDR_NOSPACE, /* internal module array full */
105 LDR_NOMODOPEN, /* module file could not be opened (check errmin) */
106 LDR_UNKTYPE, /* file is not a recognized module type */
107 LDR_NOLOAD, /* type specific loader failed */
108 LDR_ONCEONLY, /* Module should only be loaded once (not an error) */
109 LDR_NOPORTOPEN, /* could not open port (check errmin) */
110 LDR_NOHARDWARE, /* could not query/initialize the hardware device */
111 LDR_MISMATCH, /* the module didn't match the spec'd requirments */
112 LDR_BADUSAGE, /* LoadModule is called with bad arguments */
113 LDR_INVALID, /* The module doesn't have a valid ModuleData object */
114 LDR_BADOS, /* The module doesn't support the OS */
115 LDR_MODSPECIFIC /* A module-specific error in the SetupProc */
116} LoaderErrorCode;
117
118/*
119 * Some common module classes. The moduleclass can be used to identify
120 * that modules loaded are of the correct type. This is a finer
121 * classification than the ABI classes even though the default set of
122 * classes have the same names. For example, not all modules that require
123 * the video driver ABI are themselves video drivers.
124 */
125#define MOD_CLASS_NONE NULL
126#define MOD_CLASS_VIDEODRV "X.Org Video Driver"
127#define MOD_CLASS_XINPUT "X.Org XInput Driver"
128#define MOD_CLASS_FONT "X.Org Font Renderer"
129#define MOD_CLASS_EXTENSION "X.Org Server Extension"
130
131/* This structure is expected to be returned by the initfunc */
132typedef struct {
133 const char * modname; /* name of module, e.g. "foo" */
134 const char * vendor; /* vendor specific string */
135 CARD32 _modinfo1_; /* constant MODINFOSTRING1/2 to find */
136 CARD32 _modinfo2_; /* infoarea with a binary editor or sign tool */
137 CARD32 xf86version; /* contains XF86_VERSION_CURRENT */
138 CARD8 majorversion; /* module-specific major version */
139 CARD8 minorversion; /* module-specific minor version */
140 CARD16 patchlevel; /* module-specific patch level */
141 const char * abiclass; /* ABI class that the module uses */
142 CARD32 abiversion; /* ABI version */
143 const char * moduleclass; /* module class description */
144 CARD32 checksum[4]; /* contains a digital signature of the */
145 /* version info structure */
146} XF86ModuleVersionInfo;
147
148/*
149 * This structure can be used to callers of LoadModule and LoadSubModule to
150 * specify version and/or ABI requirements.
151 */
152typedef struct {
153 CARD8 majorversion; /* module-specific major version */
154 CARD8 minorversion; /* moudle-specific minor version */
155 CARD16 patchlevel; /* module-specific patch level */
156 const char * abiclass; /* ABI class that the module uses */
157 CARD32 abiversion; /* ABI version */
158 const char * moduleclass; /* module class */
159} XF86ModReqInfo;
160
161/* values to indicate unspecified fields in XF86ModReqInfo. */
162#define MAJOR_UNSPEC 0xFF
163#define MINOR_UNSPEC 0xFF
164#define PATCH_UNSPEC 0xFFFF
165#define ABI_VERS_UNSPEC 0xFFFFFFFF
166
167#define MODULE_VERSION_NUMERIC(maj, min, patch) \
168 ((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF))
169#define GET_MODULE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF)
170#define GET_MODULE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF)
171#define GET_MODULE_PATCHLEVEL(vers) ((vers) & 0xFFFF)
172
173#define INITARGS void
174
175typedef void (*InitExtension)(INITARGS);
176
177typedef struct {
178 InitExtension initFunc;
179 const char * name;
180 Bool *disablePtr;
181 InitExtension setupFunc;
182 const char ** initDependencies;
183} ExtensionModule;
184
185extern ExtensionModule *ExtensionModuleList;
186
187/* Prototypes for Loader functions that are exported to modules */
188#ifndef IN_LOADER
189/* Prototypes with opaque pointers for use by modules */
190pointer LoadSubModule(pointer, const char *, const char **,
191 const char **, pointer, const XF86ModReqInfo *,
192 int *, int *);
193pointer LoadSubModuleLocal(pointer, const char *, const char **,
194 const char **, pointer, const XF86ModReqInfo *,
195 int *, int *);
196void UnloadSubModule(pointer);
197void LoadFont(pointer);
198void UnloadModule (pointer);
199#endif
200pointer LoaderSymbol(const char *);
201pointer LoaderSymbolLocal(pointer module, const char *);
202char **LoaderListDirs(const char **, const char **);
203void LoaderFreeDirList(char **);
204void LoaderErrorMsg(const char *, const char *, int, int);
205void LoadExtension(ExtensionModule *, Bool);
206void LoaderRefSymLists(const char **, ...);
207void LoaderRefSymbols(const char *, ...);
208void LoaderReqSymLists(const char **, ...);
209void LoaderReqSymbols(const char *, ...);
210int LoaderCheckUnresolved(int);
211void LoaderGetOS(const char **name, int *major, int *minor, int *teeny);
212int LoaderGetABIVersion(const char *abiclass);
213
214typedef pointer (*ModuleSetupProc)(pointer, pointer, int *, int *);
215typedef void (*ModuleTearDownProc)(pointer);
216#define MODULESETUPPROTO(func) pointer func(pointer, pointer, int*, int*)
217#define MODULETEARDOWNPROTO(func) void func(pointer)
218
219typedef struct {
220 XF86ModuleVersionInfo * vers;
221 ModuleSetupProc setup;
222 ModuleTearDownProc teardown;
223} XF86ModuleData;
224
225#endif /* _XF86STR_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