[PATCH] remove #ifdef XFree86Server from hw/xfree86/* [WAS: #ifdef XFree86Server in hw/xfree86/*]

Enrico Weigelt weigelt at metux.de
Thu Jun 8 05:14:09 PDT 2006


* Enrico Weigelt <weigelt at metux.de> schrieb:

Hi folks,

> I'm currently cleaning up the #ifdef XFree86Server (as already said)
> and I'm wondering whether they make sense within the hw/xfree86/*
> stuff (ie. xf86drm.c). AFAICS the xfree86/xorg server/hw is always 
> compiled with -DXFree86Server. Or am I missing something ?

here's a first patch on this topic. It removes these conditionals
within the xorg/xf86 subtree, where they seem to be useless.

The second patch is against the (trimmed down) nonserver copy of 
the os-support lib, which is introduced by my utils-oslib-nonserver
patch, I posted some weeks ago.


cu
-- 
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux IT service - http://www.metux.de/
---------------------------------------------------------------------
 Please visit the OpenSource QM Taskforce:
 	http://wiki.metux.de/public/OpenSource_QM_Taskforce
 Patches / Fixes for a lot dozens of packages in dozens of versions:
	http://patches.metux.de/
---------------------------------------------------------------------
-------------- next part --------------
diff -ruN xorg-server-1.0.99.902.orig/hw/xfree86/os-support-nonserver/shared/sigio.c xorg-server-1.0.99.902/hw/xfree86/os-support-nonserver/shared/sigio.c
--- xorg-server-1.0.99.902.orig/hw/xfree86/os-support-nonserver/shared/sigio.c	Fri Jun  2 13:39:57 2006
+++ xorg-server-1.0.99.902/hw/xfree86/os-support-nonserver/shared/sigio.c	Thu Jun  8 03:13:20 2006
@@ -58,22 +58,11 @@
 #include <xorg-config.h>
 #endif
 
-#ifdef XFree86Server
 # include <X11/X.h>
 # include "xf86.h"
 # include "xf86Priv.h"
 # include "xf86_OSlib.h"
 # include "inputstr.h"
-#else
-# include <unistd.h>
-# include <signal.h>
-# include <fcntl.h>
-# include <sys/time.h>
-# include <errno.h>
-# include <stdio.h>
-# include <string.h>
-# define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
-#endif
 
 /*
  * Linux libc5 defines FASYNC, but not O_ASYNC.  Don't know if it is
@@ -126,11 +115,9 @@
 				   xf86SigIOFuncs[i].closure);
 	    r--;
 	}
-#ifdef XFree86Server
     if (r > 0) {
       xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r);
     }
-#endif
 }
 
 static int
diff -ruN xorg-server-1.0.99.902.orig/hw/xfree86/os-support-nonserver/shared/sigiostubs.c xorg-server-1.0.99.902/hw/xfree86/os-support-nonserver/shared/sigiostubs.c
--- xorg-server-1.0.99.902.orig/hw/xfree86/os-support-nonserver/shared/sigiostubs.c	Fri Jun  2 13:39:57 2006
+++ xorg-server-1.0.99.902/hw/xfree86/os-support-nonserver/shared/sigiostubs.c	Thu Jun  8 03:11:07 2006
@@ -31,7 +31,6 @@
 #include <xorg-config.h>
 #endif
 
-#ifdef XFree86Server
 #ifdef __UNIXOS2__
 # define I_NEED_OS2_H
 #endif
@@ -39,10 +38,3 @@
 # include "xf86.h"
 # include "xf86Priv.h"
 # include "xf86_OSlib.h"
-#else
-# include <unistd.h>
-# include <signal.h>
-# include <fcntl.h>
-# include <sys/time.h>
-# include <errno.h>
-#endif
-------------- next part --------------
diff -ruN xorg-server-1.0.99.902.orig/hw/xfree86/os-support/shared/sigio.c xorg-server-1.0.99.902/hw/xfree86/os-support/shared/sigio.c
--- xorg-server-1.0.99.902.orig/hw/xfree86/os-support/shared/sigio.c	Fri Jun  2 13:39:55 2006
+++ xorg-server-1.0.99.902/hw/xfree86/os-support/shared/sigio.c	Thu Jun  8 03:13:59 2006
@@ -58,22 +58,11 @@
 #include <xorg-config.h>
 #endif
 
-#ifdef XFree86Server
 # include <X11/X.h>
 # include "xf86.h"
 # include "xf86Priv.h"
 # include "xf86_OSlib.h"
 # include "inputstr.h"
-#else
-# include <unistd.h>
-# include <signal.h>
-# include <fcntl.h>
-# include <sys/time.h>
-# include <errno.h>
-# include <stdio.h>
-# include <string.h>
-# define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
-#endif
 
 /*
  * Linux libc5 defines FASYNC, but not O_ASYNC.  Don't know if it is
@@ -126,11 +115,9 @@
 				   xf86SigIOFuncs[i].closure);
 	    r--;
 	}
-#ifdef XFree86Server
     if (r > 0) {
       xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r);
     }
-#endif
 }
 
 static int
@@ -159,24 +146,14 @@
 		return 0;
 	    blocked = xf86BlockSIGIO();
 	    if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_ASYNC) == -1) {
-#ifdef XFree86Server
 		xf86Msg(X_WARNING, "fcntl(%d, O_ASYNC): %s\n", 
 			fd, strerror(errno));
-#else
-		fprintf(stderr,"fcntl(%d, O_ASYNC): %s\n", 
-			fd, strerror(errno));
-#endif
 		xf86UnblockSIGIO(blocked);
 		return 0;
 	    }
 	    if (fcntl(fd, F_SETOWN, getpid()) == -1) {
-#ifdef XFree86Server
 		xf86Msg(X_WARNING, "fcntl(%d, F_SETOWN): %s\n", 
 			fd, strerror(errno));
-#else
-		fprintf(stderr,"fcntl(%d, F_SETOWN): %s\n", 
-			fd, strerror(errno));
-#endif
 		xf86UnblockSIGIO(blocked);
 		return 0;
 	    }
@@ -289,7 +266,6 @@
     }
 }
 
-#ifdef XFree86Server
 void
 xf86AssertBlockedSIGIO (char *where)
 {
@@ -308,5 +284,3 @@
 {
     return 1;
 }
-
-#endif
diff -ruN xorg-server-1.0.99.902.orig/hw/xfree86/os-support/shared/sigiostubs.c xorg-server-1.0.99.902/hw/xfree86/os-support/shared/sigiostubs.c
--- xorg-server-1.0.99.902.orig/hw/xfree86/os-support/shared/sigiostubs.c	Fri Jun  2 13:39:55 2006
+++ xorg-server-1.0.99.902/hw/xfree86/os-support/shared/sigiostubs.c	Thu Jun  8 03:12:18 2006
@@ -31,7 +31,6 @@
 #include <xorg-config.h>
 #endif
 
-#ifdef XFree86Server
 #ifdef __UNIXOS2__
 # define I_NEED_OS2_H
 #endif
@@ -39,13 +38,6 @@
 # include "xf86.h"
 # include "xf86Priv.h"
 # include "xf86_OSlib.h"
-#else
-# include <unistd.h>
-# include <signal.h>
-# include <fcntl.h>
-# include <sys/time.h>
-# include <errno.h>
-#endif
 
 _X_EXPORT int
 xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure)
@@ -70,12 +62,10 @@
 {
 }
 
-#ifdef XFree86Server
 void
 xf86AssertBlockedSIGIO (char *where)
 {
 }
-#endif
 
 /* XXX This is a quick hack for the benefit of xf86SetSilkenMouse() */
 Bool
diff -ruN xorg-server-1.0.99.902.orig/hw/xfree86/os-support/xf86_OSproc.h xorg-server-1.0.99.902/hw/xfree86/os-support/xf86_OSproc.h
--- xorg-server-1.0.99.902.orig/hw/xfree86/os-support/xf86_OSproc.h	Fri Jun  2 13:39:55 2006
+++ xorg-server-1.0.99.902/hw/xfree86/os-support/xf86_OSproc.h	Thu Jun  8 03:11:12 2006
@@ -212,9 +212,7 @@
 extern int xf86RemoveSIGIOHandler(int fd);
 extern int xf86BlockSIGIO (void);
 extern void xf86UnblockSIGIO (int);
-#ifdef XFree86Server
 extern void xf86AssertBlockedSIGIO (char *);
-#endif
 extern Bool xf86SIGIOSupported (void);
 
 #ifdef XF86_OS_PRIVS
diff -ruN xorg-server-1.0.99.902.orig/hw/xfree86/os-support/drm/xf86drm.c xorg-server-1.0.99.902/hw/xfree86/os-support/drm/xf86drm.c
--- xorg-server-1.0.99.902.orig/hw/xfree86/os-support/drm/xf86drm.c	Fri Jun  2 13:39:55 2006
+++ xorg-server-1.0.99.902/hw/xfree86/os-support/drm/xf86drm.c	Thu Jun  8 03:15:18 2006
@@ -37,7 +37,6 @@
 #include <xorg-config.h>
 #endif
 
-#ifdef XFree86Server
 # include "xf86.h"
 # include "xf86_OSproc.h"
 # define _DRM_MALLOC xalloc
@@ -45,10 +44,6 @@
 # ifndef XFree86LOADER
 #  include <sys/mman.h>
 # endif
-#else
-# define _DRM_MALLOC malloc
-# define _DRM_FREE   free
-#endif
 
 #include "drm.h"
 #include <stdio.h>
@@ -124,17 +119,9 @@
 {
     va_list	ap;
 
-#ifndef XFree86Server
-    const char *env;
-    if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose"))
-#endif
     {
 	va_start(ap, format);
-#ifdef XFree86Server
 	xf86VDrvMsgVerb(-1, X_NONE, DRM_MSG_VERBOSITY, format, ap);
-#else
-	vfprintf(stderr, format, ap);
-#endif
 	va_end(ap);
     }
 }
@@ -270,19 +257,15 @@
     int             fd;
     mode_t          devmode = DRM_DEV_MODE;
     int             isroot  = !geteuid();
-#if defined(XFree86Server)
     uid_t           user    = DRM_DEV_UID;
     gid_t           group   = DRM_DEV_GID;
-#endif
 
     sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor);
     drmMsg("drmOpenDevice: node name is %s\n", buf);
 
-#if defined(XFree86Server)
     devmode  = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE;
     devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
     group = (xf86ConfigDRI.group >= 0) ? xf86ConfigDRI.group : DRM_DEV_GID;
-#endif
 
     if (stat(DRM_DIR_NAME, &st)) {
 	if (!isroot) return DRM_ERR_NOT_ROOT;
@@ -297,10 +280,8 @@
 	remove(buf);
 	mknod(buf, S_IFCHR | devmode, dev);
     }
-#if defined(XFree86Server)
     chown(buf, user, group);
     chmod(buf, devmode);
-#endif
 
     fd = open(buf, O_RDWR, 0);
     drmMsg("drmOpenDevice: open result is %d, (%s)\n",
@@ -314,10 +295,8 @@
 	if (!isroot) return DRM_ERR_NOT_ROOT;
 	remove(buf);
 	mknod(buf, S_IFCHR | devmode, dev);
-#if defined(XFree86Server)
 	chown(buf, user, group);
 	chmod(buf, devmode);
-#endif
     }
     fd = open(buf, O_RDWR, 0);
     drmMsg("drmOpenDevice: open result is %d, (%s)\n",
@@ -454,16 +433,12 @@
     char *        id;
     
     if (!drmAvailable()) {
-#if !defined(XFree86Server)
-	return -1;
-#else
         /* try to load the kernel module now */
         if (!xf86LoadKernelModule(name)) {
             ErrorF("[drm] failed to load kernel module \"%s\"\n",
 		   name);
             return -1;
         }
-#endif
     }
 
     /*
@@ -546,7 +521,6 @@
  */
 int drmOpen(const char *name, const char *busid)
 {
-#ifdef XFree86Server
     if (!drmAvailable() && name != NULL) {
 	/* try to load the kernel */
 	if (!xf86LoadKernelModule(name)) {
@@ -555,7 +529,6 @@
 	    return -1;
 	}
     }
-#endif
 
     if (busid) {
 	int fd;
@@ -2259,7 +2232,6 @@
     return 0;
 }
 
-#if defined(XFree86Server) 
 static void drmSIGIOHandler(int interrupt, void *closure)
 {
     unsigned long key;
@@ -2323,4 +2295,3 @@
 
     return xf86RemoveSIGIOHandler(fd);
 }
-#endif


More information about the xorg mailing list