8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 20:43:02 +01:00
This commit is contained in:
asfernandes 2009-09-30 01:10:11 +00:00
parent 2e14aeab73
commit 90dfb9a411
13 changed files with 47 additions and 51 deletions

View File

@ -276,9 +276,9 @@
# ----------------------------
# Remove protection against opening databases on NFS mounted volumes on
# Linux/Unix and SMB/CIFS volumes on Windows
# Linux/Unix and SMB/CIFS volumes on Windows.
#
# This also permits creating database shadows on mounted network volumes
# This also permits creating database shadows on mounted network volumes.
#
# ***WARNING*** ***WARNING*** ***WARNING*** ***WARNING***
#

View File

@ -482,7 +482,6 @@ rebuild_codes :
#___________________________________________________________________________
#

View File

@ -30,7 +30,8 @@
#include "../common/classes/vector.h"
namespace Firebird {
namespace Firebird
{
template <typename K>
class DefaultHash
{
@ -41,7 +42,7 @@ namespace Firebird {
size_t val;
const char* data = static_cast<const char*>(value);
while (length >= sizeof(size_t))
{
memcpy(&val, data, sizeof(size_t));
@ -75,7 +76,7 @@ namespace Firebird {
const static size_t DEFAULT_SIZE = 97; // largest prime number < 100
};
template <typename C,
template <typename C,
size_t HASHSIZE = DefaultHash<C>::DEFAULT_SIZE,
typename K = C, // default key
typename KeyOfValue = DefaultKeyValue<C>, // default keygen
@ -88,9 +89,9 @@ namespace Firebird {
class Entry;
friend class Entry;
// This class is supposed to be used as a BASE class for class to be hashed
class Entry
{
// This class is supposed to be used as a BASE class for class to be hashed
private:
Entry** previousElement;
Entry* nextElement;
@ -102,7 +103,7 @@ namespace Firebird {
{
unLink();
}
void link(Entry** where)
{
unLink();
@ -134,7 +135,7 @@ namespace Firebird {
// ... and next pointer in previous element
*previousElement = nextElement;
// finally mark ourselves not linked
previousElement = 0;
previousElement = NULL;
}
}
@ -247,7 +248,7 @@ namespace Firebird {
void next()
{
while(!current)
while (!current)
{
if (++elem >= HASHSIZE)
{
@ -301,7 +302,6 @@ namespace Firebird {
return !(*this == h);
}
}; // class iterator
}; // class Hash
} // namespace Firebird

View File

@ -154,7 +154,7 @@ typedef Hash<
DeferredWork
> DfwHash;
class DeferredWork : public pool_alloc<type_dfw>,
class DeferredWork : public pool_alloc<type_dfw>,
public DfwHash::Entry
{
private:
@ -177,9 +177,9 @@ public:
string dfw_name; // name of object
public:
DeferredWork(MemoryPool& p, DeferredWork*** end,
DeferredWork(MemoryPool& p, DeferredWork*** end,
enum dfw_t t, USHORT id, SLONG sn, const string& name)
: dfw_type(t), dfw_end(end), dfw_prev(dfw_end ? *dfw_end : NULL),
: dfw_type(t), dfw_end(end), dfw_prev(dfw_end ? *dfw_end : NULL),
dfw_next(dfw_prev ? *dfw_prev : NULL), dfw_lock(NULL), dfw_args(p),
dfw_sav_number(sn), dfw_id(id), dfw_count(1), dfw_name(p, name)
{
@ -255,7 +255,7 @@ public:
// hash interface
bool isEqual(const DeferredWork& work) const
{
if (dfw_type == work.dfw_type &&
if (dfw_type == work.dfw_type &&
dfw_id == work.dfw_id &&
dfw_name == work.dfw_name &&
dfw_sav_number == work.dfw_sav_number)
@ -306,11 +306,7 @@ public:
// hash interface
bool isEqual(const SLONG& number) const
{
if (dfw_sav_number == number)
{
return true;
}
return false;
return dfw_sav_number == number;
}
DfwSavePoint* get() { return this; }
@ -328,7 +324,7 @@ public:
DeferredWork* work;
DeferredWork** end;
DeferredJob() : work(0), end(&work) { }
DeferredJob() : work(NULL), end(&work) { }
};
} // namespace Jrd
@ -538,13 +534,13 @@ void DFW_delete_deferred( jrd_tra* transaction, SLONG sav_number)
*
**************************************/
// If there is no deferred work, just return
// If there is no deferred work, just return
if (!transaction->tra_deferred_job) {
return;
}
// Remove deferred work and events which are to be rolled back
// Remove deferred work and events which are to be rolled back
if (sav_number == -1)
{
@ -952,8 +948,8 @@ DeferredWork* DFW_post_work_arg( jrd_tra* transaction, DeferredWork* work, const
if (! arg)
{
arg = FB_NEW(*transaction->tra_pool)
DeferredWork(*transaction->tra_pool, 0, type, id, 0, name);
arg = FB_NEW(*transaction->tra_pool)
DeferredWork(*transaction->tra_pool, 0, type, id, 0, name);
work->dfw_args.add(arg);
}
@ -4137,7 +4133,7 @@ static bool find_depend_in_dfw(thread_db* tdbb,
break;
}
// Look to see if an object of the desired type is being deleted.
// Look to see if an object of the desired type is being deleted.
for (DeferredWork* work = transaction->tra_deferred_job->work; work; work = work->getNext())
{
if ((work->dfw_type == dfw_type ||
@ -5696,12 +5692,11 @@ static string get_string(const dsc* desc)
{
/**************************************
*
*g e t _ s t r i n g
* g e t _ s t r i n g
*
**************************************
*
* Functional description
*Get string for a given descriptor.
* Get string for a given descriptor.
*
**************************************/
const char* str;
@ -5713,7 +5708,7 @@ static string get_string(const dsc* desc)
}
// Find the actual length of the string, searching until the claimed
// end of the string, or the terminating \0, whichever comes first
// end of the string, or the terminating \0, whichever comes first.
USHORT length = MOV_make_string(desc, ttype_metadata, &str, &temp, sizeof(temp));
@ -5732,4 +5727,3 @@ static string get_string(const dsc* desc)
return string(str, length);
}

View File

@ -172,7 +172,8 @@ void GRANT_privileges(thread_db* tdbb, const Firebird::string& name, USHORT id,
transaction);
}
}
else {
else
{
finish_security_class(acl, public_priv);
save_security_class(tdbb, s_class, acl, transaction);
}

View File

@ -34,4 +34,3 @@ namespace Jrd
void GRANT_privileges(Jrd::thread_db*, const Firebird::string&, USHORT, Jrd::jrd_tra*);
#endif // JRD_GRANT_PROTO_H

View File

@ -110,6 +110,7 @@ void NBackupStateLock::blockingAstHandler(thread_db* tdbb)
CCH_flush_ast(tdbb);
NBAK_TRACE_AST(("database FLUSHED"));
}
GlobalRWLock::blockingAstHandler(tdbb);
if (wasWrite && (cachedLock->lck_physical == LCK_read))
@ -170,9 +171,11 @@ void BackupManager::openDelta()
{
fb_assert(!diff_file);
diff_file = PIO_open(database, diff_name, diff_name, false);
if (database->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) {
PIO_force_write(diff_file,
database->dbb_flags & DBB_force_write,
if (database->dbb_flags & (DBB_force_write | DBB_no_fs_cache))
{
PIO_force_write(diff_file,
database->dbb_flags & DBB_force_write,
database->dbb_flags & DBB_no_fs_cache);
}
}
@ -213,11 +216,14 @@ void BackupManager::beginBackup(thread_db* tdbb)
// Create file
NBAK_TRACE(("Creating difference file %s", diff_name.c_str()));
diff_file = PIO_create(database, diff_name, true, false, false);
if (database->dbb_flags & (DBB_force_write | DBB_no_fs_cache)) {
PIO_force_write(diff_file,
database->dbb_flags & DBB_force_write,
if (database->dbb_flags & (DBB_force_write | DBB_no_fs_cache))
{
PIO_force_write(diff_file,
database->dbb_flags & DBB_force_write,
database->dbb_flags & DBB_no_fs_cache);
}
#ifdef UNIX
// adjust difference file access rights to make it match main DB ones
if (diff_file && geteuid() == 0)
@ -240,6 +246,7 @@ void BackupManager::beginBackup(thread_db* tdbb)
}
}
#endif
// Zero out first page (empty allocation table)
BufferDesc temp_bdb;
temp_bdb.bdb_page = 0;

View File

@ -37,4 +37,3 @@ void PCMET_expression_index(Jrd::thread_db*, const Firebird::string&, USHORT, Jr
void PCMET_lookup_index(Jrd::thread_db*, Jrd::jrd_rel*, Jrd::index_desc*);
#endif // JRD_PCMET_PROTO_H

View File

@ -38,7 +38,6 @@ struct que
typedef que* QUE;
inline void QUE_INIT(que& aque)
{
aque.que_backward = &aque;
@ -140,4 +139,3 @@ typedef srq *SRQ;
#endif /* JRD_QUE_H */

View File

@ -1318,7 +1318,7 @@ void VIO_erase(thread_db* tdbb, record_param* rpb, jrd_tra* transaction)
MET_lookup_partner(tdbb, r2, &idx, index_name) &&
(partner = MET_lookup_relation_id(tdbb, idx.idx_primary_relation, false)) )
{
DFW_post_work_arg(transaction, work, 0, partner->rel_id,
DFW_post_work_arg(transaction, work, 0, partner->rel_id,
dfw_arg_partner_rel_id);
}
else

View File

@ -1142,7 +1142,7 @@ void LockManager::acquire_shmem(SRQ_PTR owner_offset)
bug(NULL, "map of lock file extent failed");
}
}
#else //USE_SHMEM_EXT
#else //USE_SHMEM_EXT
if (m_header->lhb_length > m_shmem.sh_mem_length_mapped
#ifdef LOCK_DEBUG_REMAP
@ -1248,7 +1248,7 @@ UCHAR* LockManager::alloc(USHORT size, ISC_STATUS* status_vector)
if (m_header->lhb_used + size > m_header->lhb_length)
{
#ifdef USE_SHMEM_EXT
// round up so next object starts at beginngin of next extent
// round up so next object starts at beginning of next extent
block = m_header->lhb_used = m_header->lhb_length;
if (newExtent())
{

View File

@ -499,7 +499,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
FPRINTF(outfile, "Insufficient memory for lock statistics.\n");
exit(FINI_OK);
}
memcpy((UCHAR*) buffer, LOCK_header, extentSize);
for (ULONG extent = 1; extent < extentsCount; ++extent)
@ -610,7 +610,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
FPRINTF(outfile, "Insufficient memory for lock statistics.\n");
exit(FINI_OK);
}
memcpy(newBuf, LOCK_header, extentSize);
buffer = newBuf;
@ -618,18 +618,18 @@ int CLIB_ROUTINE main( int argc, char *argv[])
{
Firebird::PathName extName;
extName.printf("%s.ext%d", filename.c_str(), extent);
const int fd = open(extName.c_str(), O_RDONLY | O_BINARY);
if (fd == -1)
{
FPRINTF(outfile, "Unable to open lock file extent number %d, file %s.\n",
FPRINTF(outfile, "Unable to open lock file extent number %d, file %s.\n",
extent, extName.c_str());
exit(FINI_OK);
}
if (read(fd, ((UCHAR*) buffer) + extent * extentSize, extentSize) != extentSize)
{
FPRINTF(outfile, "Could not read lock file extent number %d, file %s.\n",
FPRINTF(outfile, "Could not read lock file extent number %d, file %s.\n",
extent, extName.c_str());
exit(FINI_OK);
}

View File

@ -39,4 +39,3 @@ int main( int argc, char **argv)
return;
return semctl(semid, 0, IPC_RMID, 0);
}