xf86Module.h revision 8c3d541c7ee7442f570b22eca3d82808b35b0385
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains the parts of the loader interface that are visible
* to modules. This is the only loader-related header that modules should
* include.
*
* It should include a bare minimum of other headers.
*
* Xserver/.
*
*/
#ifndef _XF86MODULE_H
#define _XF86MODULE_H
#include "misc.h"
#ifndef NULL
#define NULL ((void *)0)
#endif
typedef enum {
LD_RESOLV_IFDONE = 0, /* only check if no more
delays pending */
#define DEFAULT_LIST ((char *)-1)
/* This indicates a special module that doesn't have the usual entry point */
/* Built-in ABI classes. These definitions must not be changed. */
#define ABI_CLASS_NONE NULL
#define ABI_CLASS_ANSIC "X.Org ANSI C Emulation"
#define ABI_CLASS_VIDEODRV "X.Org Video Driver"
#define ABI_CLASS_XINPUT "X.Org XInput driver"
#define ABI_CLASS_EXTENSION "X.Org Server Extension"
#define ABI_CLASS_FONT "X.Org Font Renderer"
#define ABI_MINOR_MASK 0x0000FFFF
#define ABI_MAJOR_MASK 0xFFFF0000
#define GET_ABI_MINOR(v) ((v) & ABI_MINOR_MASK)
/*
* ABI versions. Each version has a major and minor revision. Modules
* using lower minor revisions must work with servers of a higher minor
* revision. There is no compatibility between different major revisions.
* Whenever the ABI_ANSIC_VERSION is changed, the others must also be
* changed. The minor revision mask is 0x0000FFFF and the major revision
* mask is 0xFFFF0000.
*/
#define MODINFOSTRING1 0xef23fdc5
#define MODINFOSTRING2 0x10dc023a
#ifndef MODULEVENDORSTRING
#define MODULEVENDORSTRING "X.Org Foundation"
#endif
/* Error return codes for errmaj. New codes must only be added at the end. */
typedef enum {
LDR_NOERROR = 0,
LDR_NOMEM, /* memory allocation failed */
LDR_NOENT, /* Module file does not exist */
LDR_NOSUBENT, /* pre-requsite file to be sub-loaded does not exist */
LDR_NOSPACE, /* internal module array full */
LDR_NOMODOPEN, /* module file could not be opened (check errmin) */
LDR_UNKTYPE, /* file is not a recognized module type */
LDR_NOLOAD, /* type specific loader failed */
LDR_ONCEONLY, /* Module should only be loaded once (not an error) */
LDR_NOPORTOPEN, /* could not open port (check errmin) */
LDR_NOHARDWARE, /* could not query/initialize the hardware device */
LDR_MISMATCH, /* the module didn't match the spec'd requirments */
LDR_BADUSAGE, /* LoadModule is called with bad arguments */
LDR_INVALID, /* The module doesn't have a valid ModuleData object */
LDR_BADOS, /* The module doesn't support the OS */
LDR_MODSPECIFIC /* A module-specific error in the SetupProc */
/*
* Some common module classes. The moduleclass can be used to identify
* that modules loaded are of the correct type. This is a finer
* classification than the ABI classes even though the default set of
* classes have the same names. For example, not all modules that require
* the video driver ABI are themselves video drivers.
*/
#define MOD_CLASS_NONE NULL
#define MOD_CLASS_VIDEODRV "X.Org Video Driver"
#define MOD_CLASS_XINPUT "X.Org XInput Driver"
#define MOD_CLASS_FONT "X.Org Font Renderer"
#define MOD_CLASS_EXTENSION "X.Org Server Extension"
/* This structure is expected to be returned by the initfunc */
typedef struct {
const char * modname; /* name of module, e.g. "foo" */
const char * vendor; /* vendor specific string */
const char * abiclass; /* ABI class that the module uses */
const char * moduleclass; /* module class description */
/* version info structure */
/*
* This structure can be used to callers of LoadModule and LoadSubModule to
*/
typedef struct {
const char * abiclass; /* ABI class that the module uses */
const char * moduleclass; /* module class */
/* values to indicate unspecified fields in XF86ModReqInfo. */
#define MAJOR_UNSPEC 0xFF
#define MINOR_UNSPEC 0xFF
#define PATCH_UNSPEC 0xFFFF
#define ABI_VERS_UNSPEC 0xFFFFFFFF
#define INITARGS void
typedef void (*InitExtension)(INITARGS);
typedef struct {
const char * name;
const char ** initDependencies;
/* Prototypes for Loader functions that are exported to modules */
const char **, pointer, const XF86ModReqInfo *,
int *, int *);
extern _X_EXPORT char **LoaderListDirs(const char **, const char **);
extern _X_EXPORT void LoaderFreeDirList(char **);
extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int);
typedef void (*ModuleTearDownProc)(pointer);
typedef struct {
#endif /* _XF86STR_H */