From 7fbff1ea9714270a4eaa0b8f9233f5e1d7dfa69f Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 19 Jan 2003 16:44:32 +0000 Subject: cleanup and removal of libdha_exit. forgot to commit this git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9026 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libdha/libdha.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'libdha/libdha.c') diff --git a/libdha/libdha.c b/libdha/libdha.c index e0739e1a03..6d32f68d02 100644 --- a/libdha/libdha.c +++ b/libdha/libdha.c @@ -32,14 +32,6 @@ #endif #include -/* instead exit() use libdha_exit, and do the 'mother-application' deinit - only in this code */ -void libdha_exit(const char *message, int level) -{ - printf("libdha: FATAL: %s\n", message); - exit(level); /* FIXME */ -} - #if defined(_WIN32) #include "sysdep/libdha_win32.c" #elif defined (__EMX__) @@ -73,7 +65,8 @@ void libdha_exit(const char *message, int level) #include #endif -static int mem=-1; +static int mem_fd = -1; + void *map_phys_mem(unsigned long base, unsigned long size) { #ifdef ARCH_ALPHA @@ -82,7 +75,7 @@ void *map_phys_mem(unsigned long base, unsigned long size) #endif #ifdef CONFIG_SVGAHELPER - if ( (mem = open(DEV_SVGA,O_RDWR)) == -1) { + if ( (mem_fd = open(DEV_SVGA,O_RDWR)) == -1) { perror("libdha: SVGAlib kernelhelper failed"); #ifdef CONFIG_DHAHELPER goto dha_helper_way; @@ -96,7 +89,7 @@ void *map_phys_mem(unsigned long base, unsigned long size) #ifdef CONFIG_DHAHELPER dha_helper_way: - if ( (mem = open("/dev/dhahelper",O_RDWR)) < 0) + if ( (mem_fd = open("/dev/dhahelper",O_RDWR)) < 0) { perror("libdha: DHA kernelhelper failed"); goto dev_mem_way; @@ -110,10 +103,10 @@ dha_helper_way: mem_req.offset = 0; mem_req.size = size; - if (ioctl(mem, DHAHELPER_MEMORY, &mem_req) < 0) + if (ioctl(mem_fd, DHAHELPER_MEMORY, &mem_req) < 0) { perror("libdha: DHA kernelhelper failed"); - close(mem); + close(mem_fd); goto dev_mem_way; } else @@ -122,14 +115,14 @@ dha_helper_way: #endif dev_mem_way: - if ( (mem = open(DEV_MEM,O_RDWR)) == -1) + if ( (mem_fd = open(DEV_MEM,O_RDWR)) == -1) { perror("libdha: opening /dev/mem failed"); - exit(1); + return -1; } mmap: - return mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,mem,base); + return mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,mem_fd,base); } #endif /* CONFIG_DHAHELPER */ @@ -140,10 +133,13 @@ void unmap_phys_mem(void *ptr, unsigned long size) if (res == -1) { perror("libdha: unmapping memory failed"); - exit(1); + return -1; } - close(mem); - mem = -1; + + close(mem_fd); + mem_fd = -1; + + return; } unsigned char INPORT8(unsigned idx) -- cgit v1.2.3