8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 06:43:03 +01:00

rename local macro to ease cleaning

This commit is contained in:
brodsom 2004-05-15 00:59:29 +00:00
parent 2ddaf442c2
commit 725e073f1c

View File

@ -78,17 +78,16 @@ using namespace Jrd;
#endif #endif
#endif #endif
#ifdef SUPERSERVER
#ifndef SUPERSERVER #define THD_IO_MUTEX_INIT(mutx) THD_MUTEX_INIT(mutx)
#undef THD_MUTEX_INIT #define THD_IO_MUTEX_LOCK(mutx) THD_MUTEX_LOCK(mutx)
#undef THD_MUTEX_LOCK #define THD_IO_MUTEX_UNLOCK(mutx) THD_MUTEX_UNLOCK(mutx)
#undef THD_MUTEX_UNLOCK #define THD_IO_MUTEX_DESTROY(mutx) THD_MUTEX_DESTROY(mutx)
#undef THD_MUTEX_DESTROY #else
#define THD_IO_MUTEX_INIT(mutx)
#define THD_MUTEX_INIT(mutx) #define THD_IO_MUTEX_LOCK(mutx)
#define THD_MUTEX_LOCK(mutx) #define THD_IO_MUTEX_UNLOCK(mutx)
#define THD_MUTEX_UNLOCK(mutx) #define THD_IO_MUTEX_DESTROY(mutx)
#define THD_MUTEX_DESTROY(mutx)
#endif #endif
#define IO_RETRY 20 #define IO_RETRY 20
@ -213,7 +212,7 @@ void PIO_close(jrd_file* main_file)
close(file->fil_desc); close(file->fil_desc);
file->fil_desc = -1; file->fil_desc = -1;
#ifndef PREAD_PWRITE #ifndef PREAD_PWRITE
THD_MUTEX_DESTROY(file->fil_mutex); THD_IO_MUTEX_DESTROY(file->fil_mutex);
#endif #endif
} }
} }
@ -340,9 +339,9 @@ void PIO_flush(jrd_file* main_file)
#ifndef SUPERSERVER_V2 #ifndef SUPERSERVER_V2
for (file = main_file; file; file = file->fil_next) { for (file = main_file; file; file = file->fil_next) {
if (file->fil_desc != -1) { /* This really should be an error */ if (file->fil_desc != -1) { /* This really should be an error */
THD_MUTEX_LOCK(file->fil_mutex); THD_IO_MUTEX_LOCK(file->fil_mutex);
fsync(file->fil_desc); fsync(file->fil_desc);
THD_MUTEX_UNLOCK(file->fil_mutex); THD_IO_MUTEX_UNLOCK(file->fil_mutex);
} }
} }
#endif #endif
@ -424,10 +423,10 @@ void PIO_header(Database* dbb, SCHAR * address, int length)
for (i = 0; i < IO_RETRY; i++) { for (i = 0; i < IO_RETRY; i++) {
#ifndef PREAD_PWRITE #ifndef PREAD_PWRITE
THD_MUTEX_LOCK(file->fil_mutex); THD_IO_MUTEX_LOCK(file->fil_mutex);
if ((lseek(file->fil_desc, LSEEK_OFFSET_CAST 0, 0)) == -1) { if ((lseek(file->fil_desc, LSEEK_OFFSET_CAST 0, 0)) == -1) {
THD_MUTEX_UNLOCK(file->fil_mutex); THD_IO_MUTEX_UNLOCK(file->fil_mutex);
unix_error("lseek", file, isc_io_read_err, 0); unix_error("lseek", file, isc_io_read_err, 0);
} }
#endif #endif
@ -441,7 +440,7 @@ void PIO_header(Database* dbb, SCHAR * address, int length)
#else #else
if ((bytes = read(file->fil_desc, spare_buffer, length)) == if ((bytes = read(file->fil_desc, spare_buffer, length)) ==
(UINT64) -1) { (UINT64) -1) {
THD_MUTEX_UNLOCK(file->fil_mutex); THD_IO_MUTEX_UNLOCK(file->fil_mutex);
#endif #endif
if (SYSCALL_INTERRUPTED(errno)) if (SYSCALL_INTERRUPTED(errno))
continue; continue;
@ -457,7 +456,7 @@ void PIO_header(Database* dbb, SCHAR * address, int length)
if ((bytes = pread(file->fil_desc, address, length, 0)) == (UINT64) -1) { if ((bytes = pread(file->fil_desc, address, length, 0)) == (UINT64) -1) {
#else #else
if ((bytes = read(file->fil_desc, address, length)) == (UINT64) -1) { if ((bytes = read(file->fil_desc, address, length)) == (UINT64) -1) {
THD_MUTEX_UNLOCK(file->fil_mutex); THD_IO_MUTEX_UNLOCK(file->fil_mutex);
#endif #endif
if (SYSCALL_INTERRUPTED(errno)) if (SYSCALL_INTERRUPTED(errno))
continue; continue;
@ -483,7 +482,7 @@ void PIO_header(Database* dbb, SCHAR * address, int length)
} }
} }
#ifndef PREAD_PWRITE #ifndef PREAD_PWRITE
THD_MUTEX_UNLOCK(file->fil_mutex); THD_IO_MUTEX_UNLOCK(file->fil_mutex);
#endif #endif
ISC_enable(); ISC_enable();
} }
@ -720,7 +719,7 @@ bool PIO_read(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* statu
break; break;
} }
#ifndef PREAD_PWRITE #ifndef PREAD_PWRITE
THD_MUTEX_UNLOCK(file->fil_mutex); THD_IO_MUTEX_UNLOCK(file->fil_mutex);
#endif #endif
if (bytes == -1U && !SYSCALL_INTERRUPTED(errno)) if (bytes == -1U && !SYSCALL_INTERRUPTED(errno))
return unix_error("read", file, isc_io_read_err, return unix_error("read", file, isc_io_read_err,
@ -739,7 +738,7 @@ bool PIO_read(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* statu
#else #else
if ((bytes = read(file->fil_desc, page, size)) == size) if ((bytes = read(file->fil_desc, page, size)) == size)
break; break;
THD_MUTEX_UNLOCK(file->fil_mutex); THD_IO_MUTEX_UNLOCK(file->fil_mutex);
#endif #endif
if (bytes == -1U && !SYSCALL_INTERRUPTED(errno)) if (bytes == -1U && !SYSCALL_INTERRUPTED(errno))
return unix_error("read", file, isc_io_read_err, return unix_error("read", file, isc_io_read_err,
@ -748,7 +747,7 @@ bool PIO_read(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* statu
} }
#ifndef PREAD_PWRITE #ifndef PREAD_PWRITE
THD_MUTEX_UNLOCK(file->fil_mutex); THD_IO_MUTEX_UNLOCK(file->fil_mutex);
#endif #endif
if (i == IO_RETRY) { if (i == IO_RETRY) {
@ -812,7 +811,7 @@ bool PIO_write(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* stat
#else #else
if ((bytes = write(file->fil_desc, spare_buffer, size)) == size) if ((bytes = write(file->fil_desc, spare_buffer, size)) == size)
break; break;
THD_MUTEX_UNLOCK(file->fil_mutex); THD_IO_MUTEX_UNLOCK(file->fil_mutex);
#endif #endif
if (bytes == -1U && !SYSCALL_INTERRUPTED(errno)) if (bytes == -1U && !SYSCALL_INTERRUPTED(errno))
return unix_error("write", file, isc_io_write_err, return unix_error("write", file, isc_io_write_err,
@ -831,7 +830,7 @@ bool PIO_write(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* stat
#else #else
if ((bytes = write(file->fil_desc, page, size)) == size) if ((bytes = write(file->fil_desc, page, size)) == size)
break; break;
THD_MUTEX_UNLOCK(file->fil_mutex); THD_IO_MUTEX_UNLOCK(file->fil_mutex);
#endif #endif
if (bytes == (SLONG) -1 && !SYSCALL_INTERRUPTED(errno)) if (bytes == (SLONG) -1 && !SYSCALL_INTERRUPTED(errno))
return unix_error("write", file, isc_io_write_err, return unix_error("write", file, isc_io_write_err,
@ -840,7 +839,7 @@ bool PIO_write(jrd_file* file, BufferDesc* bdb, Ods::pag* page, ISC_STATUS* stat
} }
#ifndef PREAD_PWRITE #ifndef PREAD_PWRITE
THD_MUTEX_UNLOCK(file->fil_mutex); THD_IO_MUTEX_UNLOCK(file->fil_mutex);
#endif #endif
ISC_enable(); ISC_enable();
@ -941,11 +940,11 @@ static jrd_file* seek_file(jrd_file* file, BufferDesc* bdb, UINT64* offset,
#ifdef PREAD_PWRITE #ifdef PREAD_PWRITE
*offset = lseek_offset; *offset = lseek_offset;
#else #else
THD_MUTEX_LOCK(file->fil_mutex); THD_IO_MUTEX_LOCK(file->fil_mutex);
if ((lseek(file->fil_desc, LSEEK_OFFSET_CAST lseek_offset, 0)) == (off_t)-1) if ((lseek(file->fil_desc, LSEEK_OFFSET_CAST lseek_offset, 0)) == (off_t)-1)
{ {
THD_MUTEX_UNLOCK(file->fil_mutex); THD_IO_MUTEX_UNLOCK(file->fil_mutex);
unix_error("lseek", file, isc_io_access_err, status_vector); unix_error("lseek", file, isc_io_access_err, status_vector);
return 0; return 0;
} }
@ -978,7 +977,7 @@ static jrd_file* setup_file(Database* dbb, const TEXT* file_name, USHORT file_le
MOVE_FAST(file_name, file->fil_string, file_length); MOVE_FAST(file_name, file->fil_string, file_length);
file->fil_string[file_length] = '\0'; file->fil_string[file_length] = '\0';
#ifndef PREAD_PWRITE #ifndef PREAD_PWRITE
THD_MUTEX_INIT(file->fil_mutex); THD_IO_MUTEX_INIT(file->fil_mutex);
#endif #endif
/* If this isn't the primary file, we're done */ /* If this isn't the primary file, we're done */