[PATCH xserver 2/8] bsd: Replacement screenFd on consoleFd because they are equivalent
Alexandr Shadchin
alexandr.shadchin at gmail.com
Thu Sep 15 10:20:22 PDT 2011
Signed-off-by: Alexandr Shadchin <Alexandr.Shadchin at gmail.com>
---
hw/xfree86/common/xf86Globals.c | 1 -
hw/xfree86/common/xf86Privstr.h | 2 --
hw/xfree86/os-support/bsd/alpha_video.c | 2 +-
hw/xfree86/os-support/bsd/arm_video.c | 6 +++---
hw/xfree86/os-support/bsd/bsd_init.c | 13 +------------
hw/xfree86/os-support/bsd/i386_video.c | 2 +-
hw/xfree86/os-support/bsd/ppc_video.c | 4 ++--
hw/xfree86/os-support/bsd/sparc64_video.c | 2 +-
8 files changed, 9 insertions(+), 23 deletions(-)
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 16d5557..5e56438 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -109,7 +109,6 @@ xf86InfoRec xf86Info = {
.caughtSignal = FALSE,
.currentScreen = NULL,
#ifdef CSRG_BASED
- .screenFd = -1,
.consType = -1,
#endif
.allowMouseOpenFail = FALSE,
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index 608f9bd..added3c 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -74,8 +74,6 @@ typedef struct {
/* graphics part */
ScreenPtr currentScreen;
#if defined(CSRG_BASED) || defined(__FreeBSD_kernel__)
- int screenFd; /* fd for memory mapped access to
- * vga card */
int consType; /* Which console driver? */
#endif
diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c
index bb3a5cb..15eb2a4 100644
--- a/hw/xfree86/os-support/bsd/alpha_video.c
+++ b/hw/xfree86/os-support/bsd/alpha_video.c
@@ -340,7 +340,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
base = mmap(0, Size,
(flags & VIDMEM_READONLY) ?
PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, xf86Info.screenFd,
+ MAP_FLAGS, xf86Info.consoleFd,
(unsigned long)Base + BUS_BASE);
if (base == MAP_FAILED)
{
diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c
index 482d53f..eb631a7 100644
--- a/hw/xfree86/os-support/bsd/arm_video.c
+++ b/hw/xfree86/os-support/bsd/arm_video.c
@@ -213,7 +213,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
base = mmap(0, Size,
(flags & VIDMEM_READONLY) ?
PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, xf86Info.screenFd,
+ MAP_FLAGS, xf86Info.consoleFd,
(unsigned long)Base - 0xA0000);
if (base == MAP_FAILED)
{
@@ -306,7 +306,7 @@ checkMapInfo(Bool warn, int Region)
if(!memAccP->Checked)
{
- if(ioctl(xf86Info.screenFd, memAccP->ioctl, &(memAccP->memInfo)) == -1)
+ if(ioctl(xf86Info.consoleFd, memAccP->ioctl, &(memAccP->memInfo)) == -1)
{
if(warn)
{
@@ -360,7 +360,7 @@ xf86MapInfoMap(struct memAccess *memInfoP, pointer Base, unsigned long Size)
Size,
PROT_READ | PROT_WRITE,
MAP_SHARED,
- xf86Info.screenFd,
+ xf86Info.consoleFd,
(unsigned long)mapInfoP->u.map_info_mmap.map_offset))
== (pointer)-1)
{
diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c
index 123eb17..e5c8495 100644
--- a/hw/xfree86/os-support/bsd/bsd_init.c
+++ b/hw/xfree86/os-support/bsd/bsd_init.c
@@ -212,7 +212,6 @@ xf86OpenConsole()
fclose(stdin);
#endif
xf86Info.consoleFd = fd;
- xf86Info.screenFd = fd;
switch (xf86Info.consType)
{
@@ -688,22 +687,12 @@ xf86CloseConsole()
case WSCONS:
{
int mode = WSDISPLAYIO_MODE_EMUL;
- ioctl(xf86Info.screenFd, WSDISPLAYIO_SMODE, &mode);
+ ioctl(xf86Info.consoleFd, WSDISPLAYIO_SMODE, &mode);
break;
}
#endif
}
- if (xf86Info.screenFd != xf86Info.consoleFd)
- {
- close(xf86Info.screenFd);
- close(xf86Info.consoleFd);
- if ((xf86Info.consoleFd = open("/dev/console",O_RDONLY,0)) <0)
- {
- xf86FatalError("xf86CloseConsole: Cannot open /dev/console (%s)",
- strerror(errno));
- }
- }
close(xf86Info.consoleFd);
if (devConsoleFd >= 0)
close(devConsoleFd);
diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index 7aef079..525bfb6 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -258,7 +258,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
base = mmap(0, Size,
(flags & VIDMEM_READONLY) ?
PROT_READ : (PROT_READ | PROT_WRITE),
- MAP_FLAGS, xf86Info.screenFd,
+ MAP_FLAGS, xf86Info.consoleFd,
(unsigned long)Base - 0xA0000
);
if (base == MAP_FAILED)
diff --git a/hw/xfree86/os-support/bsd/ppc_video.c b/hw/xfree86/os-support/bsd/ppc_video.c
index 7e3fcdb..aeaf183 100644
--- a/hw/xfree86/os-support/bsd/ppc_video.c
+++ b/hw/xfree86/os-support/bsd/ppc_video.c
@@ -73,7 +73,7 @@ volatile unsigned char *ioBase = MAP_FAILED;
static pointer
ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
- int fd = xf86Info.screenFd;
+ int fd = xf86Info.consoleFd;
pointer base;
#ifdef DEBUG
xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d",
@@ -125,7 +125,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
Bool xf86EnableIO()
{
- int fd = xf86Info.screenFd;
+ int fd = xf86Info.consoleFd;
xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd);
if (ioBase == MAP_FAILED)
diff --git a/hw/xfree86/os-support/bsd/sparc64_video.c b/hw/xfree86/os-support/bsd/sparc64_video.c
index c838792..a2a30c9 100644
--- a/hw/xfree86/os-support/bsd/sparc64_video.c
+++ b/hw/xfree86/os-support/bsd/sparc64_video.c
@@ -58,7 +58,7 @@ static pointer
sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size,
int flags)
{
- int fd = xf86Info.screenFd;
+ int fd = xf86Info.consoleFd;
pointer base;
#ifdef DEBUG
--
1.7.6
More information about the xorg-devel
mailing list