[PATCH 1/2] Redefine the %M in config file search path to be xorg.conf version

Alan Coopersmith alan.coopersmith at oracle.com
Thu Jun 3 18:59:03 PDT 2010


Declare the xorg.conf file format version to be 4, the same as the
XF86Config version, and stop pretending to track the XFree86 version.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 hw/xfree86/doc/sgml/DESIGN.xml |    5 +++--
 hw/xfree86/parser/scan.c       |   23 +++++++----------------
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/hw/xfree86/doc/sgml/DESIGN.xml b/hw/xfree86/doc/sgml/DESIGN.xml
index 826a970..6c90a40 100644
--- a/hw/xfree86/doc/sgml/DESIGN.xml
+++ b/hw/xfree86/doc/sgml/DESIGN.xml
@@ -118,8 +118,9 @@ routines common to all the X servers in the sample implementation.
     <title>The xorg.conf File</title>
 
     <para>
-The xorg.conf file format is similar to the old format, with the following
-changes:
+The xorg.conf file format is based on the XF86Config format from XFree86 4.4,
+which is in turn similar to the old XFree86 3.x XF86Config format, with the
+following changes:
     </para>
 
     <sect2>
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 06710d5..9771913 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -601,7 +601,7 @@ xf86pathIsSafe(const char *path)
  *    %P    projroot
  *    %C    sysconfdir
  *    %D    datadir
- *    %M    major version number
+ *    %M    config file format version number
  *    %%    %
  */
 
@@ -627,16 +627,10 @@ xf86pathIsSafe(const char *path)
 #define XCONFENV	"XORGCONFIG"
 #endif
 #define XFREE86CFGFILE "XF86Config"
-#ifndef XF86_VERSION_MAJOR
-#ifdef XVERSION
-#if XVERSION > 40000000
-#define XF86_VERSION_MAJOR	(XVERSION / 10000000)
-#else
-#define XF86_VERSION_MAJOR	(XVERSION / 1000)
-#endif
-#else
-#define XF86_VERSION_MAJOR	4
-#endif
+/* xorg.conf is based on XF86Config version 4.   If we ever break
+   compatibility of the xorg.conf syntax, we'll bump this version number. */
+#ifndef CONFIG_FILE_VERSION
+#define CONFIG_FILE_VERSION	4
 #endif
 
 #define BAIL_OUT		do {									\
@@ -771,11 +765,8 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot,
 				break;
 			case 'M':
 				if (!majorvers[0]) {
-					if (XF86_VERSION_MAJOR < 0 || XF86_VERSION_MAJOR > 99) {
-						fprintf(stderr, "XF86_VERSION_MAJOR is out of range\n");
-						BAIL_OUT;
-					} else
-						sprintf(majorvers, "%d", XF86_VERSION_MAJOR);
+					snprintf(majorvers, sizeof(majorvers),
+						 "%d", CONFIG_FILE_VERSION);
 				}
 				APPEND_STR(majorvers);
 				break;
-- 
1.5.6.5



More information about the xorg-devel mailing list