Move the remnants of loadext.c to miinitext.c
There was nothing XFree86-specific or loader-specific about this, aside from using xf86MsgVerb instead of ErrorF. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
a089af3477
commit
79d14d9fc3
|
@ -169,11 +169,6 @@ typedef struct {
|
||||||
|
|
||||||
#define INITARGS void
|
#define INITARGS void
|
||||||
|
|
||||||
/* This really shouldn't be here, but gets moved in about three commits'
|
|
||||||
* time. So odds are the only people who ever see this comment are doing
|
|
||||||
* patch review, in which case, thanks! */
|
|
||||||
extern _X_EXPORT void AddStaticExtensions(void);
|
|
||||||
|
|
||||||
/* Prototypes for Loader functions that are exported to modules */
|
/* Prototypes for Loader functions that are exported to modules */
|
||||||
extern _X_EXPORT pointer LoadSubModule(pointer, const char *, const char **,
|
extern _X_EXPORT pointer LoadSubModule(pointer, const char *, const char **,
|
||||||
const char **, pointer,
|
const char **, pointer,
|
||||||
|
@ -184,7 +179,6 @@ extern _X_EXPORT pointer LoaderSymbol(const char *);
|
||||||
extern _X_EXPORT char **LoaderListDirs(const char **, const char **);
|
extern _X_EXPORT char **LoaderListDirs(const char **, const char **);
|
||||||
extern _X_EXPORT void LoaderFreeDirList(char **);
|
extern _X_EXPORT void LoaderFreeDirList(char **);
|
||||||
extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int);
|
extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int);
|
||||||
extern _X_EXPORT void LoadExtension(ExtensionModule *, Bool);
|
|
||||||
extern _X_EXPORT void LoaderGetOS(const char **name, int *major, int *minor,
|
extern _X_EXPORT void LoaderGetOS(const char **name, int *major, int *minor,
|
||||||
int *teeny);
|
int *teeny);
|
||||||
extern _X_EXPORT Bool LoaderShouldIgnoreABI(void);
|
extern _X_EXPORT Bool LoaderShouldIgnoreABI(void);
|
||||||
|
|
|
@ -14,7 +14,6 @@ EXTRA_DIST = \
|
||||||
libloader_la_SOURCES = \
|
libloader_la_SOURCES = \
|
||||||
loader.c \
|
loader.c \
|
||||||
loaderProcs.h \
|
loaderProcs.h \
|
||||||
loadext.c \
|
|
||||||
loadmod.c \
|
loadmod.c \
|
||||||
os.c
|
os.c
|
||||||
|
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2000 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,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* 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).
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Maybe this file belongs elsewhere? */
|
|
||||||
|
|
||||||
#define LOADERDECLARATIONS
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "loaderProcs.h"
|
|
||||||
#include "misc.h"
|
|
||||||
#include "xf86.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This should be static, but miinitext wants it. FIXME: make extension
|
|
||||||
* initialization not completely terrible.
|
|
||||||
*/
|
|
||||||
ExtensionModule *ExtensionModuleList = NULL;
|
|
||||||
static int numExtensionModules = 0;
|
|
||||||
|
|
||||||
static ExtensionModule *
|
|
||||||
NewExtensionModule(void)
|
|
||||||
{
|
|
||||||
ExtensionModule *save = ExtensionModuleList;
|
|
||||||
int n;
|
|
||||||
|
|
||||||
/* Make sure built-in extensions get added to the list before those
|
|
||||||
* in modules. */
|
|
||||||
AddStaticExtensions();
|
|
||||||
|
|
||||||
/* Sanity check */
|
|
||||||
if (!ExtensionModuleList)
|
|
||||||
numExtensionModules = 0;
|
|
||||||
|
|
||||||
n = numExtensionModules + 1;
|
|
||||||
ExtensionModuleList = realloc(ExtensionModuleList,
|
|
||||||
(n + 1) * sizeof(ExtensionModule));
|
|
||||||
if (ExtensionModuleList == NULL) {
|
|
||||||
ExtensionModuleList = save;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
numExtensionModules++;
|
|
||||||
ExtensionModuleList[numExtensionModules].name = NULL;
|
|
||||||
return ExtensionModuleList + (numExtensionModules - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
LoadExtension(ExtensionModule * e, Bool builtin)
|
|
||||||
{
|
|
||||||
ExtensionModule *newext;
|
|
||||||
|
|
||||||
if (e == NULL || e->name == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(newext = NewExtensionModule()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (builtin)
|
|
||||||
xf86MsgVerb(X_INFO, 2, "Initializing built-in extension %s\n", e->name);
|
|
||||||
else
|
|
||||||
xf86MsgVerb(X_INFO, 2, "Loading extension %s\n", e->name);
|
|
||||||
|
|
||||||
newext->name = e->name;
|
|
||||||
newext->initFunc = e->initFunc;
|
|
||||||
newext->disablePtr = e->disablePtr;
|
|
||||||
newext->setupFunc = e->setupFunc;
|
|
||||||
|
|
||||||
if (e->setupFunc != NULL)
|
|
||||||
e->setupFunc();
|
|
||||||
}
|
|
|
@ -87,8 +87,6 @@ typedef struct {
|
||||||
InitExtension setupFunc;
|
InitExtension setupFunc;
|
||||||
} ExtensionModule;
|
} ExtensionModule;
|
||||||
|
|
||||||
extern ExtensionModule *ExtensionModuleList;
|
|
||||||
|
|
||||||
extern _X_EXPORT unsigned short StandardMinorOpcode(ClientPtr /*client */ );
|
extern _X_EXPORT unsigned short StandardMinorOpcode(ClientPtr /*client */ );
|
||||||
|
|
||||||
extern _X_EXPORT Bool EnableDisableExtension(const char *name, Bool enable);
|
extern _X_EXPORT Bool EnableDisableExtension(const char *name, Bool enable);
|
||||||
|
@ -100,4 +98,6 @@ extern _X_EXPORT void InitExtensions(int argc, char **argv);
|
||||||
|
|
||||||
extern _X_EXPORT void CloseDownExtensions(void);
|
extern _X_EXPORT void CloseDownExtensions(void);
|
||||||
|
|
||||||
|
extern _X_EXPORT void LoadExtension(ExtensionModule *ext, Bool external);
|
||||||
|
|
||||||
#endif /* EXTENSION_H */
|
#endif /* EXTENSION_H */
|
||||||
|
|
|
@ -44,6 +44,33 @@ SOFTWARE.
|
||||||
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2000 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,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* 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).
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -418,7 +445,10 @@ static ExtensionModule staticExtensions[] = {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
static ExtensionModule *ExtensionModuleList = NULL;
|
||||||
|
static int numExtensionModules = 0;
|
||||||
|
|
||||||
|
static void
|
||||||
AddStaticExtensions(void)
|
AddStaticExtensions(void)
|
||||||
{
|
{
|
||||||
static Bool listInitialised = FALSE;
|
static Bool listInitialised = FALSE;
|
||||||
|
@ -450,4 +480,57 @@ InitExtensions(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ExtensionModule *
|
||||||
|
NewExtensionModule(void)
|
||||||
|
{
|
||||||
|
ExtensionModule *save = ExtensionModuleList;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
/* Make sure built-in extensions get added to the list before those
|
||||||
|
* in modules. */
|
||||||
|
AddStaticExtensions();
|
||||||
|
|
||||||
|
/* Sanity check */
|
||||||
|
if (!ExtensionModuleList)
|
||||||
|
numExtensionModules = 0;
|
||||||
|
|
||||||
|
n = numExtensionModules + 1;
|
||||||
|
ExtensionModuleList = realloc(ExtensionModuleList,
|
||||||
|
(n + 1) * sizeof(ExtensionModule));
|
||||||
|
if (ExtensionModuleList == NULL) {
|
||||||
|
ExtensionModuleList = save;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
numExtensionModules++;
|
||||||
|
ExtensionModuleList[numExtensionModules].name = NULL;
|
||||||
|
return ExtensionModuleList + (numExtensionModules - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LoadExtension(ExtensionModule * e, Bool builtin)
|
||||||
|
{
|
||||||
|
ExtensionModule *newext;
|
||||||
|
|
||||||
|
if (e == NULL || e->name == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!(newext = NewExtensionModule()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (builtin)
|
||||||
|
ErrorF("Initializing built-in extension %s\n", e->name);
|
||||||
|
else
|
||||||
|
ErrorF("Loading extension %s\n", e->name);
|
||||||
|
|
||||||
|
newext->name = e->name;
|
||||||
|
newext->initFunc = e->initFunc;
|
||||||
|
newext->disablePtr = e->disablePtr;
|
||||||
|
newext->setupFunc = e->setupFunc;
|
||||||
|
|
||||||
|
if (e->setupFunc != NULL)
|
||||||
|
e->setupFunc();
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* XFree86LOADER */
|
#endif /* XFree86LOADER */
|
||||||
|
|
Loading…
Reference in New Issue