From 38bd1e123d959e0a13514ec415afc8bfb5a170f2 Mon Sep 17 00:00:00 2001 From: Alexandr Shadchin Date: Fri, 26 Aug 2011 18:54:01 +0600 Subject: bsd: Replacement screenFd on consoleFd because they are equivalent Signed-off-by: Alexandr Shadchin Reviewed-by: Jamey Sharp Tested-by: Matthieu Herrb --- 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 93533ec80..9a42bb990 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -111,7 +111,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 14cd56a26..feab5c161 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -76,8 +76,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 bb3a5cb47..15eb2a422 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 482d53fc3..eb631a7f3 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 837a2f4d1..f9d546f28 100644 --- a/hw/xfree86/os-support/bsd/bsd_init.c +++ b/hw/xfree86/os-support/bsd/bsd_init.c @@ -211,7 +211,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 7aef07901..525bfb607 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 7e3fcdb2c..aeaf18305 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 c838792b5..a2a30c9d7 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 -- cgit v1.2.3