mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
os0file.c Removed extraneous undef and inclde of aio.h, fixed typecasts to off_t
os0file.c Removed unnecessary code from os_file_read
This commit is contained in:
parent
c058b5a196
commit
afbc2c8e7c
1 changed files with 9 additions and 16 deletions
|
@ -15,9 +15,6 @@ Created 10/21/1995 Heikki Tuuri
|
|||
/* We assume in this case that the OS has standard Posix aio (at least SunOS
|
||||
2.6, HP-UX 11i and AIX 4.3 have) */
|
||||
|
||||
#undef __USE_FILE_OFFSET64
|
||||
|
||||
#include <aio.h>
|
||||
#endif
|
||||
|
||||
/* We use these mutexes to protect lseek + file i/o operation, if the
|
||||
|
@ -520,8 +517,10 @@ os_file_pread(
|
|||
ulint n, /* in: number of bytes to read */
|
||||
ulint offset) /* in: offset from where to read */
|
||||
{
|
||||
off_t offs = (off_t)offset;
|
||||
|
||||
#ifdef HAVE_PREAD
|
||||
return(pread(file, buf, n, (off_t) offset));
|
||||
return(pread(file, buf, n, offs));
|
||||
#else
|
||||
ssize_t ret;
|
||||
ulint i;
|
||||
|
@ -531,7 +530,7 @@ os_file_pread(
|
|||
|
||||
os_mutex_enter(os_file_seek_mutexes[i]);
|
||||
|
||||
ret = lseek(file, (off_t) offset, 0);
|
||||
ret = lseek(file, offs, 0);
|
||||
|
||||
if (ret < 0) {
|
||||
os_mutex_exit(os_file_seek_mutexes[i]);
|
||||
|
@ -560,9 +559,10 @@ os_file_pwrite(
|
|||
ulint offset) /* in: offset where to write */
|
||||
{
|
||||
ssize_t ret;
|
||||
off_t offs = (off_t)offset;
|
||||
|
||||
#ifdef HAVE_PWRITE
|
||||
ret = pwrite(file, buf, n, (off_t) offset);
|
||||
ret = pwrite(file, buf, n, offs);
|
||||
|
||||
/* Always do fsync to reduce the probability that when the OS crashes,
|
||||
a database page is only partially physically written to disk. */
|
||||
|
@ -578,7 +578,7 @@ os_file_pwrite(
|
|||
|
||||
os_mutex_enter(os_file_seek_mutexes[i]);
|
||||
|
||||
ret = lseek(file, (off_t) offset, 0);
|
||||
ret = lseek(file, offs, 0);
|
||||
|
||||
if (ret < 0) {
|
||||
os_mutex_exit(os_file_seek_mutexes[i]);
|
||||
|
@ -661,7 +661,6 @@ try_again:
|
|||
#else
|
||||
ibool retry;
|
||||
ssize_t ret;
|
||||
ulint i;
|
||||
|
||||
#if (UNIV_WORD_SIZE == 8)
|
||||
offset = offset + (offset_high << 32);
|
||||
|
@ -669,15 +668,9 @@ try_again:
|
|||
UT_NOT_USED(offset_high);
|
||||
#endif
|
||||
try_again:
|
||||
/* Protect the seek / read operation with a mutex */
|
||||
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
|
||||
|
||||
os_mutex_enter(os_file_seek_mutexes[i]);
|
||||
|
||||
ret = os_file_pread(file, buf, n, (off_t) offset);
|
||||
ret = os_file_pread(file, buf, n, offset);
|
||||
|
||||
if ((ulint)ret == n) {
|
||||
os_mutex_exit(os_file_seek_mutexes[i]);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
@ -767,7 +760,7 @@ try_again:
|
|||
UT_NOT_USED(offset_high);
|
||||
#endif
|
||||
try_again:
|
||||
ret = os_file_pwrite(file, buf, n, (off_t) offset);
|
||||
ret = os_file_pwrite(file, buf, n, offset);
|
||||
|
||||
if ((ulint)ret == n) {
|
||||
return(TRUE);
|
||||
|
|
Loading…
Add table
Reference in a new issue