2014-10-31 09:45:12 +10:00
|
|
|
/*
|
|
|
|
|
*
|
2003-11-14 16:48:57 +00:00
|
|
|
* Copyright (c) 1997 Metro Link Incorporated
|
2014-10-31 09:45:12 +10:00
|
|
|
*
|
2003-11-14 16:48:57 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
2014-10-31 09:45:12 +10:00
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
2003-11-14 16:48:57 +00:00
|
|
|
* 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:
|
2014-10-31 09:45:12 +10:00
|
|
|
*
|
2003-11-14 16:48:57 +00:00
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
|
* all copies or substantial portions of the Software.
|
2014-10-31 09:45:12 +10:00
|
|
|
*
|
2003-11-14 16:48:57 +00:00
|
|
|
* 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 X CONSORTIUM 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.
|
2014-10-31 09:45:12 +10:00
|
|
|
*
|
2003-11-14 16:48:57 +00:00
|
|
|
* Except as contained in this notice, the name of the Metro Link shall not be
|
|
|
|
|
* used in advertising or otherwise to promote the sale, use or other dealings
|
|
|
|
|
* in this Software without prior written authorization from Metro Link.
|
2014-10-31 09:45:12 +10:00
|
|
|
*
|
2003-11-14 16:48:57 +00:00
|
|
|
*/
|
2003-11-25 19:29:01 +00:00
|
|
|
/*
|
|
|
|
|
* 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,
|
|
|
|
|
* 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).
|
|
|
|
|
*/
|
|
|
|
|
|
2005-07-03 07:02:09 +00:00
|
|
|
#ifdef HAVE_XORG_CONFIG_H
|
|
|
|
|
#include <xorg-config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
Fix a segfault that occurs if xorg.conf.d is absent:
In InitOutput, if xf86HandleConfigFile returns CONFIG_NOFILE
(which it does if no config file or directory is present), the
autoconfig flag is set, causing xf86AutoConfig to be called
later on.
xf86AutoConfig calls xf86OutputClassDriverList via the
call tree:
xf86AutoConfig =>
listPossibleVideoDrivers =>
xf86PlatformMatchDriver =>
xf86OutputClassDriverList
and xf86OutputClassDriverList attempts to traverse a linked list
that is a member of the XF86ConfigRec struct pointed to by the
global xf86configptr, which is NULL at this point because the
XF86ConfigRec struct is only allocated (by xf86readConfigFile)
AFTER the config file and directory have been successfully
opened; the CONFIG_NOFILE return from xf86HandleConfigFile
occurs BEFORE the call to xf86readConfigFile which allocates
the XF86ConfigRec struct.
Rx: In read.c (for symmetry with xf86freeConfig, which already
appears in this file), add a new function xf86allocateConfig
which tests the value of xf86configptr and, if it's NULL,
allocates the XF86ConfigRec struct and deposits the pointer
in xf86configptr. In xf86Parser.h, add a prototype for the
new xf86allocateConfig function.
Back in read.c, #include "xf86Config.h". In xf86readConfigFile,
change the open-code call to calloc to a call to the new
xf86allocateConfig function.
In xf86AutoConfig.c, add a call to the new xf86allocateConfig function
to the beginning of xf86AutoConfig to make sure the XF86ConfigRec struct
is allocated.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
2016-11-15 16:34:38 -05:00
|
|
|
#include "xf86Config.h"
|
2003-11-14 16:48:57 +00:00
|
|
|
#include "xf86Parser.h"
|
|
|
|
|
#include "xf86tokens.h"
|
|
|
|
|
#include "Configint.h"
|
|
|
|
|
|
|
|
|
|
|
2016-04-17 20:30:43 +01:00
|
|
|
static const xf86ConfigSymTabRec TopLevelTab[] = {
|
2012-03-21 12:55:09 -07:00
|
|
|
{SECTION, "section"},
|
|
|
|
|
{-1, ""},
|
2003-11-14 16:48:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define CLEANUP xf86freeConfig
|
|
|
|
|
|
2014-10-31 09:45:12 +10:00
|
|
|
/*
|
2007-03-25 12:27:01 -04:00
|
|
|
* This function resolves name references and reports errors if the named
|
|
|
|
|
* objects cannot be found.
|
|
|
|
|
*/
|
|
|
|
|
static int
|
2012-03-21 12:55:09 -07:00
|
|
|
xf86validateConfig(XF86ConfigPtr p)
|
2007-03-25 12:27:01 -04:00
|
|
|
{
|
2012-03-21 12:55:09 -07:00
|
|
|
if (!xf86validateScreen(p))
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (!xf86validateInput(p))
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (!xf86validateLayout(p))
|
|
|
|
|
return FALSE;
|
2007-03-25 12:27:01 -04:00
|
|
|
|
2012-03-21 12:55:09 -07:00
|
|
|
return TRUE;
|
2007-03-25 12:27:01 -04:00
|
|
|
}
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
|
|
|
XF86ConfigPtr
|
2012-03-21 12:55:09 -07:00
|
|
|
xf86readConfigFile(void)
|
2003-11-14 16:48:57 +00:00
|
|
|
{
|
2012-03-21 12:55:09 -07:00
|
|
|
int token;
|
|
|
|
|
XF86ConfigPtr ptr = NULL;
|
2003-11-14 16:48:57 +00:00
|
|
|
|
Fix a segfault that occurs if xorg.conf.d is absent:
In InitOutput, if xf86HandleConfigFile returns CONFIG_NOFILE
(which it does if no config file or directory is present), the
autoconfig flag is set, causing xf86AutoConfig to be called
later on.
xf86AutoConfig calls xf86OutputClassDriverList via the
call tree:
xf86AutoConfig =>
listPossibleVideoDrivers =>
xf86PlatformMatchDriver =>
xf86OutputClassDriverList
and xf86OutputClassDriverList attempts to traverse a linked list
that is a member of the XF86ConfigRec struct pointed to by the
global xf86configptr, which is NULL at this point because the
XF86ConfigRec struct is only allocated (by xf86readConfigFile)
AFTER the config file and directory have been successfully
opened; the CONFIG_NOFILE return from xf86HandleConfigFile
occurs BEFORE the call to xf86readConfigFile which allocates
the XF86ConfigRec struct.
Rx: In read.c (for symmetry with xf86freeConfig, which already
appears in this file), add a new function xf86allocateConfig
which tests the value of xf86configptr and, if it's NULL,
allocates the XF86ConfigRec struct and deposits the pointer
in xf86configptr. In xf86Parser.h, add a prototype for the
new xf86allocateConfig function.
Back in read.c, #include "xf86Config.h". In xf86readConfigFile,
change the open-code call to calloc to a call to the new
xf86allocateConfig function.
In xf86AutoConfig.c, add a call to the new xf86allocateConfig function
to the beginning of xf86AutoConfig to make sure the XF86ConfigRec struct
is allocated.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
2016-11-15 16:34:38 -05:00
|
|
|
if ((ptr = xf86allocateConfig()) == NULL) {
|
2012-03-21 12:55:09 -07:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2003-11-14 16:48:57 +00:00
|
|
|
|
2012-03-21 12:55:09 -07:00
|
|
|
while ((token = xf86getToken(TopLevelTab)) != EOF_TOKEN) {
|
|
|
|
|
switch (token) {
|
|
|
|
|
case COMMENT:
|
2013-12-15 01:41:19 -08:00
|
|
|
ptr->conf_comment = xf86addComment(ptr->conf_comment, xf86_lex_val.str);
|
2012-03-21 12:55:09 -07:00
|
|
|
break;
|
|
|
|
|
case SECTION:
|
|
|
|
|
if (xf86getSubToken(&(ptr->conf_comment)) != STRING) {
|
|
|
|
|
xf86parseError(QUOTE_MSG, "Section");
|
|
|
|
|
CLEANUP(ptr);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
xf86setSection(xf86_lex_val.str);
|
|
|
|
|
if (xf86nameCompare(xf86_lex_val.str, "files") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_RETURN(conf_files, xf86parseFilesSection());
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "serverflags") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_RETURN(conf_flags, xf86parseFlagsSection());
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "pointer") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_LIST(conf_input_lst, xf86parsePointerSection,
|
|
|
|
|
XF86ConfInputPtr);
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "videoadaptor") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_LIST(conf_videoadaptor_lst, xf86parseVideoAdaptorSection,
|
|
|
|
|
XF86ConfVideoAdaptorPtr);
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "device") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_LIST(conf_device_lst, xf86parseDeviceSection,
|
|
|
|
|
XF86ConfDevicePtr);
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "monitor") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_LIST(conf_monitor_lst, xf86parseMonitorSection,
|
|
|
|
|
XF86ConfMonitorPtr);
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "modes") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_LIST(conf_modes_lst, xf86parseModesSection,
|
|
|
|
|
XF86ConfModesPtr);
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "screen") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_LIST(conf_screen_lst, xf86parseScreenSection,
|
|
|
|
|
XF86ConfScreenPtr);
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "inputdevice") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_LIST(conf_input_lst, xf86parseInputSection,
|
|
|
|
|
XF86ConfInputPtr);
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "inputclass") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_LIST(conf_inputclass_lst,
|
|
|
|
|
xf86parseInputClassSection, XF86ConfInputClassPtr);
|
|
|
|
|
}
|
2014-02-13 13:42:05 +01:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "outputclass") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
|
|
|
|
HANDLE_LIST(conf_outputclass_lst, xf86parseOutputClassSection,
|
|
|
|
|
XF86ConfOutputClassPtr);
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "module") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_RETURN(conf_modules, xf86parseModuleSection());
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "serverlayout") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_LIST(conf_layout_lst, xf86parseLayoutSection,
|
|
|
|
|
XF86ConfLayoutPtr);
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "vendor") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_LIST(conf_vendor_lst, xf86parseVendorSection,
|
|
|
|
|
XF86ConfVendorPtr);
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "dri") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_RETURN(conf_dri, xf86parseDRISection());
|
|
|
|
|
}
|
2013-12-15 01:41:19 -08:00
|
|
|
else if (xf86nameCompare(xf86_lex_val.str, "extensions") == 0) {
|
|
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
HANDLE_RETURN(conf_extensions, xf86parseExtensionsSection());
|
|
|
|
|
}
|
|
|
|
|
else {
|
2013-12-15 01:41:19 -08:00
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
Error(INVALID_SECTION_MSG, xf86tokenString());
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2013-12-15 01:41:19 -08:00
|
|
|
free(xf86_lex_val.str);
|
|
|
|
|
xf86_lex_val.str = NULL;
|
2012-03-21 12:55:09 -07:00
|
|
|
Error(INVALID_KEYWORD_MSG, xf86tokenString());
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-11-14 16:48:57 +00:00
|
|
|
|
2012-03-21 12:55:09 -07:00
|
|
|
if (xf86validateConfig(ptr))
|
|
|
|
|
return ptr;
|
|
|
|
|
else {
|
|
|
|
|
CLEANUP(ptr);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2003-11-14 16:48:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#undef CLEANUP
|
|
|
|
|
|
2014-10-31 09:45:12 +10:00
|
|
|
/*
|
2003-11-14 16:48:57 +00:00
|
|
|
* adds an item to the end of the linked list. Any record whose first field
|
|
|
|
|
* is a GenericListRec can be cast to this type and used with this function.
|
|
|
|
|
* A pointer to the head of the list is returned to handle the addition of
|
|
|
|
|
* the first item.
|
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
|
|
|
GenericListPtr
|
2012-03-21 12:55:09 -07:00
|
|
|
xf86addListItem(GenericListPtr head, GenericListPtr new)
|
2003-11-14 16:48:57 +00:00
|
|
|
{
|
2012-03-21 12:55:09 -07:00
|
|
|
GenericListPtr p = head;
|
|
|
|
|
GenericListPtr last = NULL;
|
2003-11-14 16:48:57 +00:00
|
|
|
|
2012-03-21 12:55:09 -07:00
|
|
|
while (p) {
|
|
|
|
|
last = p;
|
|
|
|
|
p = p->next;
|
|
|
|
|
}
|
2003-11-14 16:48:57 +00:00
|
|
|
|
2012-03-21 12:55:09 -07:00
|
|
|
if (last) {
|
|
|
|
|
last->next = new;
|
|
|
|
|
return head;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return new;
|
2003-11-14 16:48:57 +00:00
|
|
|
}
|
|
|
|
|
|
2014-10-31 09:45:12 +10:00
|
|
|
/*
|
2003-11-14 16:48:57 +00:00
|
|
|
* Test if one chained list contains the other.
|
|
|
|
|
* In this case both list have the same endpoint (provided they don't loop)
|
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
|
|
|
int
|
2003-11-14 16:48:57 +00:00
|
|
|
xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2)
|
|
|
|
|
{
|
2012-03-21 12:55:09 -07:00
|
|
|
GenericListPtr p = list_1;
|
|
|
|
|
GenericListPtr last_1 = NULL, last_2 = NULL;
|
2003-11-14 16:48:57 +00:00
|
|
|
|
2012-03-21 12:55:09 -07:00
|
|
|
while (p) {
|
|
|
|
|
last_1 = p;
|
|
|
|
|
p = p->next;
|
|
|
|
|
}
|
2003-11-14 16:48:57 +00:00
|
|
|
|
2012-03-21 12:55:09 -07:00
|
|
|
p = list_2;
|
|
|
|
|
while (p) {
|
|
|
|
|
last_2 = p;
|
|
|
|
|
p = p->next;
|
|
|
|
|
}
|
2003-11-14 16:48:57 +00:00
|
|
|
|
2012-03-21 12:55:09 -07:00
|
|
|
return (!(last_1 == last_2));
|
2003-11-14 16:48:57 +00:00
|
|
|
}
|
|
|
|
|
|
Fix a segfault that occurs if xorg.conf.d is absent:
In InitOutput, if xf86HandleConfigFile returns CONFIG_NOFILE
(which it does if no config file or directory is present), the
autoconfig flag is set, causing xf86AutoConfig to be called
later on.
xf86AutoConfig calls xf86OutputClassDriverList via the
call tree:
xf86AutoConfig =>
listPossibleVideoDrivers =>
xf86PlatformMatchDriver =>
xf86OutputClassDriverList
and xf86OutputClassDriverList attempts to traverse a linked list
that is a member of the XF86ConfigRec struct pointed to by the
global xf86configptr, which is NULL at this point because the
XF86ConfigRec struct is only allocated (by xf86readConfigFile)
AFTER the config file and directory have been successfully
opened; the CONFIG_NOFILE return from xf86HandleConfigFile
occurs BEFORE the call to xf86readConfigFile which allocates
the XF86ConfigRec struct.
Rx: In read.c (for symmetry with xf86freeConfig, which already
appears in this file), add a new function xf86allocateConfig
which tests the value of xf86configptr and, if it's NULL,
allocates the XF86ConfigRec struct and deposits the pointer
in xf86configptr. In xf86Parser.h, add a prototype for the
new xf86allocateConfig function.
Back in read.c, #include "xf86Config.h". In xf86readConfigFile,
change the open-code call to calloc to a call to the new
xf86allocateConfig function.
In xf86AutoConfig.c, add a call to the new xf86allocateConfig function
to the beginning of xf86AutoConfig to make sure the XF86ConfigRec struct
is allocated.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
2016-11-15 16:34:38 -05:00
|
|
|
/*
|
|
|
|
|
* Conditionally allocate config struct, but only allocate it
|
|
|
|
|
* if it's not already there. In either event, return the pointer
|
|
|
|
|
* to the global config struct.
|
|
|
|
|
*/
|
|
|
|
|
XF86ConfigPtr xf86allocateConfig(void)
|
|
|
|
|
{
|
|
|
|
|
if (!xf86configptr) {
|
|
|
|
|
xf86configptr = calloc(1, sizeof(XF86ConfigRec));
|
|
|
|
|
}
|
|
|
|
|
return xf86configptr;
|
|
|
|
|
}
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
|
|
|
void
|
2012-03-21 12:55:09 -07:00
|
|
|
xf86freeConfig(XF86ConfigPtr p)
|
2003-11-14 16:48:57 +00:00
|
|
|
{
|
2012-03-21 12:55:09 -07:00
|
|
|
if (p == NULL)
|
|
|
|
|
return;
|
2003-11-14 16:48:57 +00:00
|
|
|
|
2012-03-21 12:55:09 -07:00
|
|
|
xf86freeFiles(p->conf_files);
|
|
|
|
|
xf86freeModules(p->conf_modules);
|
|
|
|
|
xf86freeFlags(p->conf_flags);
|
|
|
|
|
xf86freeMonitorList(p->conf_monitor_lst);
|
|
|
|
|
xf86freeModesList(p->conf_modes_lst);
|
|
|
|
|
xf86freeVideoAdaptorList(p->conf_videoadaptor_lst);
|
|
|
|
|
xf86freeDeviceList(p->conf_device_lst);
|
|
|
|
|
xf86freeScreenList(p->conf_screen_lst);
|
|
|
|
|
xf86freeLayoutList(p->conf_layout_lst);
|
|
|
|
|
xf86freeInputList(p->conf_input_lst);
|
|
|
|
|
xf86freeVendorList(p->conf_vendor_lst);
|
|
|
|
|
xf86freeDRI(p->conf_dri);
|
|
|
|
|
xf86freeExtensions(p->conf_extensions);
|
|
|
|
|
TestFree(p->conf_comment);
|
2003-11-14 16:48:57 +00:00
|
|
|
|
2012-03-21 12:55:09 -07:00
|
|
|
free(p);
|
2003-11-14 16:48:57 +00:00
|
|
|
}
|