From a42ece0bce1a5a97b7492f3201f81758d39f9c42 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 28 Nov 2009 12:23:20 +0000 Subject: [PATCH] Using mmap() by default for allocating read buffers --- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/libburn/sg-linux.c | 28 +++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index 0a062323..6d743bd3 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.11.26.211418" +#define Cdrskin_timestamP "2009.11.28.122436" diff --git a/libburn/trunk/libburn/sg-linux.c b/libburn/trunk/libburn/sg-linux.c index 403e0897..4fc4396d 100644 --- a/libburn/trunk/libburn/sg-linux.c +++ b/libburn/trunk/libburn/sg-linux.c @@ -108,6 +108,9 @@ Hint: You should also look into sg-freebsd-port.c, which is a younger and /* for ioctl(BLKGETSIZE) */ #include +/* for mmap() */ +#include + #include /* Values within sg_io_hdr_t indicating success after ioctl(SG_IO) : */ @@ -2089,24 +2092,21 @@ int burn_os_stdio_capacity(char *path, off_t *bytes) /* ts A91122 : an interface to open(O_DIRECT) or similar OS tricks. */ -#ifdef Libburn_read_o_direcT - -#include - #ifdef PROT_READ #ifdef PROT_WRITE #ifdef MAP_SHARED #ifdef MAP_ANONYMOUS #ifdef MAP_FAILED +#define Libburn_linux_do_mmaP 1 +#endif +#endif +#endif +#endif +#endif + +#ifdef Libburn_read_o_direcT #ifdef O_DIRECT - #define Libburn_linux_do_o_direcT 1 - -#endif -#endif -#endif -#endif -#endif #endif #endif /* Libburn_read_o_direcT */ @@ -2132,7 +2132,7 @@ void *burn_os_alloc_buffer(size_t amount, int flag) { void *buf = NULL; -#ifdef Libburn_linux_do_o_direcT +#ifdef Libburn_linux_do_mmaP /* >>> check whether size is suitable */; @@ -2147,7 +2147,7 @@ void *burn_os_alloc_buffer(size_t amount, int flag) memset(buf, 0, amount); #else buf = calloc(1, amount); -#endif /* ! Libburn_linux_do_o_direcT */ +#endif /* ! Libburn_linux_do_mmaP */ return buf; } @@ -2159,7 +2159,7 @@ int burn_os_free_buffer(void *buffer, size_t amount, int flag) if (buffer == NULL) return 0; -#ifdef Libburn_linux_do_o_direcT +#ifdef Libburn_linux_do_mmaP ret = munmap(buffer, amount); #else free(buffer);