diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2009-12-21 00:04:16 -0800 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2009-12-22 23:20:45 -0800 |
commit | efa5269f23c2237eb5368bf5245ffbbf35714153 (patch) | |
tree | fc0d6e114c93b0f13148b81c20b9e7614e8320c6 /hw/xfree86/common | |
parent | f1e869aca176e9113f9d234b0ea59b4cac295cc4 (diff) |
xfree86: Use xorg.conf.d directory for multiple config files
Currently there is a single file, xorg.conf, for configuring the server.
This works fine most of the time, but it becomes a problem when packages
or system services need to adjust the configuration. Instead, allow
multiple configuration files to live in a directory. Typically this will
be /etc/X11/xorg.conf.d.
Files with a suffix of .conf will be read and added to the server
configuration after xorg.conf. The server won't fall back to using the
auto configuration unless there is no config file and there are no files
in the config directory.
Right now this uses a simpler search template than the config file
search path by not using the command line or environment variable
parameters. The matching code was refactored a bit to make this more
coherent. Any DDX wanting to read the config files will need to call
xf86initConfigFiles before opening/reading them. This is to allow
xf86openConfigFile without xf86openConfigDirFiles and vice-versa.
Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Diffstat (limited to 'hw/xfree86/common')
-rw-r--r-- | hw/xfree86/common/xf86AutoConfig.c | 3 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Config.c | 19 |
2 files changed, 18 insertions, 4 deletions
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c index a6199b0e8..1c4595e36 100644 --- a/hw/xfree86/common/xf86AutoConfig.c +++ b/hw/xfree86/common/xf86AutoConfig.c @@ -272,7 +272,8 @@ xf86AutoConfig(void) for (cp = builtinConfig; *cp; cp++) xf86ErrorFVerb(3, "\t%s", *cp); xf86MsgVerb(X_DEFAULT, 3, "--- End of built-in configuration ---\n"); - + + xf86initConfigFiles(); xf86setBuiltinConfig(builtinConfig); ret = xf86HandleConfigFile(TRUE); FreeConfig(); diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 5ad5e702d..ffb964386 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -95,6 +95,13 @@ extern DeviceAssocRec mouse_assoc; "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ "%P/lib/X11/%X" #endif +#ifndef CONFIGDIRPATH +#define CONFIGDIRPATH "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ + "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ + "%P/etc/X11/%X," \ + "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ + "%P/lib/X11/%X" +#endif #ifndef PROJECTROOT #define PROJECTROOT "/usr/X11R6" #endif @@ -2389,7 +2396,7 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) { ConfigStatus xf86HandleConfigFile(Bool autoconfig) { - const char *filename; + const char *filename, *dirname; char *searchpath; MessageType from = X_DEFAULT; char *scanptr; @@ -2405,7 +2412,9 @@ xf86HandleConfigFile(Bool autoconfig) if (xf86ConfigFile) from = X_CMDLINE; + xf86initConfigFiles(); filename = xf86openConfigFile(searchpath, xf86ConfigFile, PROJECTROOT); + dirname = xf86openConfigDirFiles(CONFIGDIRPATH, NULL, PROJECTROOT); if (filename) { xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename); xf86ConfigFile = xnfstrdup(filename); @@ -2413,10 +2422,14 @@ xf86HandleConfigFile(Bool autoconfig) if (xf86ConfigFile) xf86Msg(X_ERROR, "Unable to locate/open config file: \"%s\"\n", xf86ConfigFile); - return CONFIG_NOFILE; } + if (dirname) + xf86MsgVerb(X_DEFAULT, 0, "Using config directory: \"%s\"\n", + dirname); + if (!filename && !dirname) + return CONFIG_NOFILE; } - + if ((xf86configptr = xf86readConfigFile ()) == NULL) { xf86Msg(X_ERROR, "Problem parsing the config file\n"); return CONFIG_PARSE_ERROR; |