VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/1.3/xorg/xf86Module.h@ 13384

Last change on this file since 13384 was 11550, checked in by vboxsync, 16 years ago

eol-style

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