bsd: Replacement screenFd on consoleFd because they are equivalent

Signed-off-by: Alexandr Shadchin <Alexandr.Shadchin@gmail.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Tested-by: Matthieu Herrb <matthieu.herrb@laas.fr>
This commit is contained in:
Alexandr Shadchin 2011-08-26 18:54:01 +06:00
parent f015351c73
commit 38bd1e123d
8 changed files with 9 additions and 23 deletions

View File

@ -111,7 +111,6 @@ xf86InfoRec xf86Info = {
.caughtSignal = FALSE, .caughtSignal = FALSE,
.currentScreen = NULL, .currentScreen = NULL,
#ifdef CSRG_BASED #ifdef CSRG_BASED
.screenFd = -1,
.consType = -1, .consType = -1,
#endif #endif
.allowMouseOpenFail = FALSE, .allowMouseOpenFail = FALSE,

View File

@ -76,8 +76,6 @@ typedef struct {
/* graphics part */ /* graphics part */
ScreenPtr currentScreen; ScreenPtr currentScreen;
#if defined(CSRG_BASED) || defined(__FreeBSD_kernel__) #if defined(CSRG_BASED) || defined(__FreeBSD_kernel__)
int screenFd; /* fd for memory mapped access to
* vga card */
int consType; /* Which console driver? */ int consType; /* Which console driver? */
#endif #endif

View File

@ -340,7 +340,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
base = mmap(0, Size, base = mmap(0, Size,
(flags & VIDMEM_READONLY) ? (flags & VIDMEM_READONLY) ?
PROT_READ : (PROT_READ | PROT_WRITE), PROT_READ : (PROT_READ | PROT_WRITE),
MAP_FLAGS, xf86Info.screenFd, MAP_FLAGS, xf86Info.consoleFd,
(unsigned long)Base + BUS_BASE); (unsigned long)Base + BUS_BASE);
if (base == MAP_FAILED) if (base == MAP_FAILED)
{ {

View File

@ -213,7 +213,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
base = mmap(0, Size, base = mmap(0, Size,
(flags & VIDMEM_READONLY) ? (flags & VIDMEM_READONLY) ?
PROT_READ : (PROT_READ | PROT_WRITE), PROT_READ : (PROT_READ | PROT_WRITE),
MAP_FLAGS, xf86Info.screenFd, MAP_FLAGS, xf86Info.consoleFd,
(unsigned long)Base - 0xA0000); (unsigned long)Base - 0xA0000);
if (base == MAP_FAILED) if (base == MAP_FAILED)
{ {
@ -306,7 +306,7 @@ checkMapInfo(Bool warn, int Region)
if(!memAccP->Checked) if(!memAccP->Checked)
{ {
if(ioctl(xf86Info.screenFd, memAccP->ioctl, &(memAccP->memInfo)) == -1) if(ioctl(xf86Info.consoleFd, memAccP->ioctl, &(memAccP->memInfo)) == -1)
{ {
if(warn) if(warn)
{ {
@ -360,7 +360,7 @@ xf86MapInfoMap(struct memAccess *memInfoP, pointer Base, unsigned long Size)
Size, Size,
PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
MAP_SHARED, MAP_SHARED,
xf86Info.screenFd, xf86Info.consoleFd,
(unsigned long)mapInfoP->u.map_info_mmap.map_offset)) (unsigned long)mapInfoP->u.map_info_mmap.map_offset))
== (pointer)-1) == (pointer)-1)
{ {

View File

@ -211,7 +211,6 @@ xf86OpenConsole()
fclose(stdin); fclose(stdin);
#endif #endif
xf86Info.consoleFd = fd; xf86Info.consoleFd = fd;
xf86Info.screenFd = fd;
switch (xf86Info.consType) switch (xf86Info.consType)
{ {
@ -688,22 +687,12 @@ xf86CloseConsole()
case WSCONS: case WSCONS:
{ {
int mode = WSDISPLAYIO_MODE_EMUL; int mode = WSDISPLAYIO_MODE_EMUL;
ioctl(xf86Info.screenFd, WSDISPLAYIO_SMODE, &mode); ioctl(xf86Info.consoleFd, WSDISPLAYIO_SMODE, &mode);
break; break;
} }
#endif #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); close(xf86Info.consoleFd);
if (devConsoleFd >= 0) if (devConsoleFd >= 0)
close(devConsoleFd); close(devConsoleFd);

View File

@ -258,7 +258,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
base = mmap(0, Size, base = mmap(0, Size,
(flags & VIDMEM_READONLY) ? (flags & VIDMEM_READONLY) ?
PROT_READ : (PROT_READ | PROT_WRITE), PROT_READ : (PROT_READ | PROT_WRITE),
MAP_FLAGS, xf86Info.screenFd, MAP_FLAGS, xf86Info.consoleFd,
(unsigned long)Base - 0xA0000 (unsigned long)Base - 0xA0000
); );
if (base == MAP_FAILED) if (base == MAP_FAILED)

View File

@ -73,7 +73,7 @@ volatile unsigned char *ioBase = MAP_FAILED;
static pointer static pointer
ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{ {
int fd = xf86Info.screenFd; int fd = xf86Info.consoleFd;
pointer base; pointer base;
#ifdef DEBUG #ifdef DEBUG
xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", 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() Bool xf86EnableIO()
{ {
int fd = xf86Info.screenFd; int fd = xf86Info.consoleFd;
xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd); xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd);
if (ioBase == MAP_FAILED) if (ioBase == MAP_FAILED)

View File

@ -58,7 +58,7 @@ static pointer
sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size,
int flags) int flags)
{ {
int fd = xf86Info.screenFd; int fd = xf86Info.consoleFd;
pointer base; pointer base;
#ifdef DEBUG #ifdef DEBUG