[PATCH] Remove lnx_font.c and lnx.h

Matt Turner mattst88 at gmail.com
Sun Nov 1 12:22:44 PST 2009


I couldn't find any version of the X xserver that ever used lnx_font.c
so let's delete it. I tried contacting its author, Egbert, multiple
times on IRC and email [*] but never got any response. It also hasn't
been seriously touched since January 2005.

[*] http://lists.x.org/archives/xorg-devel/2009-October/002855.html

Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
 hw/xfree86/os-support/linux/Makefile.am |    6 -
 hw/xfree86/os-support/linux/lnx.h       |   17 --
 hw/xfree86/os-support/linux/lnx_apm.c   |    1 -
 hw/xfree86/os-support/linux/lnx_font.c  |  285 -------------------------------
 hw/xfree86/os-support/linux/lnx_init.c  |   30 +---
 hw/xfree86/os-support/linux/lnx_video.c |    1 -
 6 files changed, 2 insertions(+), 338 deletions(-)
 delete mode 100644 hw/xfree86/os-support/linux/lnx.h
 delete mode 100644 hw/xfree86/os-support/linux/lnx_font.c

diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index 1239c8f..7a82627 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -40,13 +40,7 @@ AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_
 
 INCLUDES = $(XORG_INCS) $(PLATFORM_INCLUDES) $(LIBDRM_CFLAGS)
 
-# FIXME: These need to be added to the build
-LNX_EXTRA_SRCS = \
-	lnx_font.c
-
 EXTRA_DIST = \
-	$(LNX_EXTRA_SRCS) \
-	lnx.h \
 	$(srcdir)/../shared/xf86Axp.h
 
 if LINUX_ALPHA
diff --git a/hw/xfree86/os-support/linux/lnx.h b/hw/xfree86/os-support/linux/lnx.h
deleted file mode 100644
index 3a2391e..0000000
--- a/hw/xfree86/os-support/linux/lnx.h
+++ /dev/null
@@ -1,17 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef LNX_H_
-
-# if defined(DO_OS_FONTRESTORE)
-Bool lnx_savefont(void);
-Bool lnx_restorefont(void);
-Bool lnx_switchaway(void);
-void lnx_freefontdata(void);
-# endif
-
-#define LNX_H_
-
-#endif
diff --git a/hw/xfree86/os-support/linux/lnx_apm.c b/hw/xfree86/os-support/linux/lnx_apm.c
index 4ccc7d6..54c6989 100644
--- a/hw/xfree86/os-support/linux/lnx_apm.c
+++ b/hw/xfree86/os-support/linux/lnx_apm.c
@@ -16,7 +16,6 @@ extern PMClose lnxACPIOpen(void);
 
 #ifdef HAVE_APM
 
-#include "lnx.h"
 #include <linux/apm_bios.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
diff --git a/hw/xfree86/os-support/linux/lnx_font.c b/hw/xfree86/os-support/linux/lnx_font.c
deleted file mode 100644
index d6fc283..0000000
--- a/hw/xfree86/os-support/linux/lnx_font.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright 2004, Egbert Eich
- *
- * 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
- * EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
- * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of Egbert Eich shall not
- * be used in advertising or otherwise to promote the sale, use or other deal-
- *ings in this Software without prior written authorization from Egbert Eich.
- *
- */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "lnx.h"
-
-#include <sys/stat.h>
-#include <string.h>
-#include <errno.h>
-
-struct {
-    int width;
-    int height;
-    int charcount;
-    unsigned char *data;
-} lnxfont = { 0, 0, 0, NULL };
-
-
-static Bool
-getfont(int *width, int *height, 
-	int *charcount, unsigned char *data)
-{
-    struct console_font_op op;
-    struct consolefontdesc ds;
-    int result;
-
-    op.op = KD_FONT_OP_GET;
-    op.width = *width;
-    op.height = *height;
-    op.charcount = *charcount;
-    op.data = data;
-    op.flags = 0;
-
-    SYSCALL(result = ioctl(xf86Info.consoleFd, KDFONTOP, &op));
-    DebugF("Console font read: h: %i count: %i\n",op.height,op.charcount);
-
-    if (!result) {
-
-	*width = op.width;
-	*height = op.height;
-	*charcount = op.charcount;
-	
-	return TRUE;
-    } 
-    
-    if (errno != ENOSYS && errno != EINVAL)
-	return FALSE;
-
-    /* GIO_FONTX fallback */
-    ds.charcount = *charcount;
-    ds.charheight = *height;
-    ds.chardata = (char *)data;
-    *width = 8;
-    
-    SYSCALL(result = ioctl(xf86Info.consoleFd, GIO_FONTX, &ds));
-    
-    if (!result) {
-	
-	*charcount = ds.charcount;
-	*height = ds.charheight;
-
-	return TRUE;
-    }
-
-    if (errno != ENOSYS && errno != EINVAL)
-	return FALSE;
-
-    /* GIO_FONT fallback */
-    if (*charcount < 256)
-	return FALSE;
-
-    SYSCALL(result = ioctl(xf86Info.consoleFd, GIO_FONT, data));
-
-    if (!result) {
-	*height = 0;
-	*charcount = 512;
-	return TRUE;
-    }
-
-    return FALSE;
-
-}
-
-#define VERSION_LEN 31
-
-Bool
-lnx_savefont(void)
-{
-    unsigned char *fontdata;
-#if CHECK_OS_VERSION
-    char kernel_version[VERSION_LEN + 1];
-    int k_major, k_minor, k_release;
-#endif
-    int size;
-    int fd;
-    int width = 32, height = 32, charcount = 2048;
-
-    DebugF("SAVE font\n");
-
-#if CHECK_OS_VERSION
-    /* Check if the kernel has full support for this */
-    if ((fd = open ("/proc/sys/kernel/osrelease",O_RDONLY)) == -1) {
-	close (fd);
-	return TRUE;
-    }
-    size = read(fd, kernel_version, VERSION_LEN);
-    close (fd);
-
-    if (size < 0)
-	return TRUE;
-
-    size = sscanf(kernel_version, "%d.%d.%d",&k_major,&k_minor,&k_release);
-    if (size < 3 
-	|| (k_major < 2) 
-	|| ((k_major == 2) 
-	    && ((k_minor < 6) 
-		|| ( k_minor == 6 
-		     && k_release < 11))))
-	return TRUE;
-#endif
-							    
-    /* if we are in fbdev mode we don't bother saving fonts */
-    if ((fd = open ("/dev/fb0",O_RDWR)) != -1) {
-	close (fd);
-	return TRUE;
-    }
-
-    if (!getfont(&width, &height, &charcount, NULL)) {
-	xf86Msg(X_WARNING, 
-		"lnx_savefont: cannot obtain font info\n");
-	goto error;
-    } else if (charcount == 2048) {
-	xf86Msg(X_WARNING, "lnx_savefont: "
-		"kernel bug: kernel doesn't report font info\n");
-	return FALSE;
-    }
-
-    size = bits_to_bytes(width) * 32 * charcount;
-    fontdata = (unsigned char *)xnfalloc(size);
-    if (!fontdata) {
-	xf86Msg(X_WARNING,
-		"lnx_savefont: cannot allocate memory to save font\n");
-	goto error;
-    }
-
-    if (!getfont(&width, &height, &charcount, fontdata)) {
-	xf86Msg(X_WARNING,"lnx_savefont: cannot read font data\n");
-	goto error;
-    }
-    lnxfont.width = width;
-    lnxfont.height = height;
-    lnxfont.charcount = charcount;
-    lnxfont.data = fontdata;
-
-    return TRUE;
-
- error:
-    return FALSE;
-}
-
-static Bool
-setfont(int width, int height, 
-	int charcount, unsigned char *data)
-{
-    struct console_font_op op;
-    struct consolefontdesc ds;
-    int result;
-
-    op.op = KD_FONT_OP_SET;
-    op.flags = 0;
-    op.charcount = charcount;
-    op.width = width;
-    op.height = height;
-    op.data = data;
-
-    SYSCALL(result = ioctl(xf86Info.consoleFd, KDFONTOP, &op));
-
-    if (!result) 
-	return TRUE;
-
-    if (errno != ENOSYS && errno != EINVAL)
-	return FALSE;
-
-    /* PIO_FONTX fallback */
-    if (width != 8)
-	return FALSE;
-
-    ds.charcount = charcount;
-    ds.chardata = (char *)data;
-    ds.charheight = height;
-    SYSCALL(result = ioctl(xf86Info.consoleFd, PIO_FONTX, &ds));
-    
-    if (!result)
-	return TRUE;
-
-    if (errno != ENOSYS && errno != EINVAL)
-	return FALSE;
-
-    /* PIO_FONT fallback */
-    SYSCALL(result = ioctl(xf86Info.consoleFd, PIO_FONT, data));
-    
-    if (!result)
-	return TRUE;
-    
-    return FALSE;
-}
-
-Bool
-lnx_restorefont(void)
-{
-    if (lnxfont.data == NULL)
-	return FALSE;
-    DebugF("RESTORE font\n");
-#if 0
-    /* must wack the height to make the kernel reprogram the VGA registers */
-    if (!setfont(lnxfont.width, lnxfont.height + 1, lnxfont.charcount,
-		lnxfont.data)) {
-	xf86Msg(X_WARNING,"lnx_fontretore: cannot write font data\n");
-	return FALSE;
-    }
-#endif
-    if (!setfont(lnxfont.width, lnxfont.height, lnxfont.charcount,
-		lnxfont.data)) {
-	xf86Msg(X_WARNING,"lnx_restorefont: cannot write font data\n");
-	return FALSE;
-    }
-
-    return TRUE;
-}
-
-Bool
-lnx_switchaway(void)
-{
-    Bool ret;
-
-    /* temporarily switch to text mode */
-    ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);
-    ret = lnx_restorefont();
-    ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS);
-    return ret;
-}
-
-void
-lnx_freefontdata(void)
-{
-    if (lnxfont.data == NULL)
-	return;
-
-    xfree(lnxfont.data);
-    lnxfont.data = NULL;
-    lnxfont.width = lnxfont.height = lnxfont.charcount = 0;
-}
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index f84c614..297e7a6 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -35,7 +35,6 @@
 #include "xf86.h"
 #include "xf86Priv.h"
 #include "xf86_OSlib.h"
-#include "lnx.h"
 
 #include <sys/stat.h>
 
@@ -230,9 +229,6 @@ xf86OpenConsole(void)
         {
             struct termios nTty;
 
-#if defined(DO_OS_FONTRESTORE)
-	    lnx_savefont();
-#endif
 	    /*
 	     * now get the VT.  This _must_ succeed, or else fail completely.
 	     */
@@ -302,17 +298,12 @@ xf86OpenConsole(void)
 		        strerror(errno));
         }
     }
-    return;
 }
 
 void
 xf86CloseConsole(void)
 {
     struct vt_mode   VT;
-#if defined(DO_OS_FONTRESTORE)
-    struct vt_stat vts;
-    int vtno = -1;
-#endif
 
     if (ShareVTs) {
         close(xf86Info.consoleFd);
@@ -324,14 +315,6 @@ xf86CloseConsole(void)
 	console_handler = NULL;
     };
 
-#if defined(DO_OS_FONTRESTORE)
-    if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts) < 0)
-	xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETSTATE failed: %s\n",
-		strerror(errno));
-    else
-	vtno = vts.v_active;
-#endif
-
     /* Back to text mode ... */
     if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT) < 0)
 	xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
@@ -366,18 +349,10 @@ xf86CloseConsole(void)
 			strerror(errno));
 	    activeVT = -1;
         }
-
-#if defined(DO_OS_FONTRESTORE)
-        if (xf86Info.vtno == vtno)	/* check if we are active */
-	    lnx_restorefont();
-        lnx_freefontdata();
-#endif
     }
     close(xf86Info.consoleFd);	/* make the vt-manager happy */
 
     restoreVtPerms();		/* restore the permissions */
-
-    return;
 }
 
 int
@@ -421,7 +396,6 @@ xf86UseMsg(void)
 	ErrorF("vtXX                   use the specified VT number\n");
 	ErrorF("-keeptty               ");
 	ErrorF("don't detach controlling tty (for debugging only)\n");
-        ErrorF("-novtswitch            don't immediately switch to new VT\n");
-        ErrorF("-sharevts              share VTs with another X server\n");
-	return;
+	ErrorF("-novtswitch            don't immediately switch to new VT\n");
+	ErrorF("-sharevts              share VTs with another X server\n");
 }
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 5acb6e3..f388afb 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -38,7 +38,6 @@
 #include "xf86Priv.h"
 #include "xf86_OSlib.h"
 #include "xf86OSpriv.h"
-#include "lnx.h"
 #ifdef __alpha__
 #include "shared/xf86Axp.h"
 #endif
-- 
1.6.4.4



More information about the xorg-devel mailing list