xf86ExtensionInit is called after configuration file parsing, so it can perform the two parts of extension initialisation currently done by extmod: enabling and disabling of extensions through an 'omit' option, and SELinux configuration.
Signed-off-by: Daniel Stone <dan...@fooishbar.org> --- hw/xfree86/common/Makefile.am | 2 +- hw/xfree86/common/xf86.h | 3 ++ hw/xfree86/common/xf86Extensions.c | 56 ++++++++++++++++++++++++++++++++++++ hw/xfree86/common/xf86Init.c | 2 + 4 files changed, 62 insertions(+), 1 deletions(-) create mode 100644 hw/xfree86/common/xf86Extensions.c diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am index c031d4b..5853661 100644 --- a/hw/xfree86/common/Makefile.am +++ b/hw/xfree86/common/Makefile.am @@ -36,7 +36,7 @@ libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \ xf86Option.c xf86Init.c xf86VGAarbiter.c \ xf86VidMode.c xf86fbman.c xf86cmap.c \ xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \ - xf86Mode.c xorgHelper.c \ + xf86Mode.c xorgHelper.c xf86Extensions.c \ $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES) nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h libcommon_la_LIBADD = $(top_builddir)/config/libconfig.la diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 54332e3..e29e958 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -348,6 +348,9 @@ extern _X_EXPORT Bool xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen, extern _X_EXPORT Bool VidModeExtensionInit(ScreenPtr pScreen); +/* xf86Extensions.c */ +extern void xf86ExtensionInit(void); + #endif /* _NO_XF86_PROTOTYPES */ #endif /* _XF86_H */ diff --git a/hw/xfree86/common/xf86Extensions.c b/hw/xfree86/common/xf86Extensions.c new file mode 100644 index 0000000..b430d32 --- /dev/null +++ b/hw/xfree86/common/xf86Extensions.c @@ -0,0 +1,56 @@ +/* + * Copyright © 2011 Daniel Stone + * + * 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 (including the next + * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Author: Daniel Stone <dan...@fooishbar.org> + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "extension.h" +#include "globals.h" + +#include "xf86.h" +#include "xf86Config.h" +#include "xf86Opt.h" + +void +xf86ExtensionInit(void) +{ + if (xf86configptr->conf_modules) { + XF86LoadPtr modp = xf86configptr->conf_modules->mod_load_lst; + for (modp = xf86configptr->conf_modules->mod_load_lst; modp; + modp = modp->list.next) { + XF86OptionPtr opt; + if (strcmp(modp->load_name, "extmod") != 0) + continue; + for (opt = modp->load_opt; opt; opt = opt->list.next) { + if (strncmp(opt->opt_name, "omit", 4) != 0 || + strlen(opt->opt_name) < 5) + continue; + if (EnableDisableExtension(opt->opt_name + 4, FALSE)) + xf86MarkOptionUsed(opt); + } + } + } +} diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 53f763a..5535396 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -404,6 +404,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) xf86OSPMClose = xf86OSPMOpen(); #endif + xf86ExtensionInit(); + /* Load all modules specified explicitly in the config file */ if ((modulelist = xf86ModulelistFromConfig(&optionlist))) { xf86LoadModules(modulelist, optionlist); -- 1.7.5.4 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel