From 7168edca86ea7ea6642f71a95094bf68ae211c31 Mon Sep 17 00:00:00 2001 From: brodsom Date: Sat, 3 Jul 2004 00:13:46 +0000 Subject: [PATCH] Put thread functions into thread class --- src/alice/all.cpp | 4 +- src/burp/backup.epp | 90 +++++++++++++++---------------- src/burp/burp.cpp | 36 ++++++------- src/burp/burp.h | 57 ++++++++++---------- src/burp/misc.cpp | 4 +- src/burp/mvol.cpp | 50 ++++++++--------- src/burp/mvol_proto.h | 6 +-- src/burp/restore.epp | 122 +++++++++++++++++++++--------------------- 8 files changed, 184 insertions(+), 185 deletions(-) diff --git a/src/alice/all.cpp b/src/alice/all.cpp index 684674da9b..f0258bf574 100644 --- a/src/alice/all.cpp +++ b/src/alice/all.cpp @@ -24,7 +24,7 @@ // //____________________________________________________________ // -// $Id: all.cpp,v 1.25 2004-07-02 10:02:46 brodsom Exp $ +// $Id: all.cpp,v 1.26 2004-07-03 00:13:09 brodsom Exp $ // #include "firebird.h" @@ -140,7 +140,7 @@ AliceMemoryPool* AliceMemoryPool::create_new_pool(MemoryPool* parent) // TMN: John, is this correct? AliceMemoryPool* pool = new(0, parent) AliceMemoryPool(parent); - tgbl::pool_vec_t::iterator curr; + AliceGlobals::pool_vec_t::iterator curr; for (curr = tdgbl->pools.begin(); curr != tdgbl->pools.end(); ++curr) { diff --git a/src/burp/backup.epp b/src/burp/backup.epp index 90c459e6b3..a97baa7b2b 100644 --- a/src/burp/backup.epp +++ b/src/burp/backup.epp @@ -37,7 +37,7 @@ */ /* -$Id: backup.epp,v 1.61 2004-06-08 13:39:53 alexpeshkoff Exp $ +$Id: backup.epp,v 1.62 2004-07-03 00:13:45 brodsom Exp $ */ #include "firebird.h" @@ -80,7 +80,7 @@ const ULONG BACKUP_VERBOSE_INTERVAL = 20000; #define PUT_TEXT(attribute, text) put_text ((attribute), (text), sizeof(text)) #define COPY(source, target) copy ((source), (target), sizeof(target)) -inline void put(tgbl* tdgbl, UCHAR c) +inline void put(BurpGlobals* tdgbl, UCHAR c) { if (--(tdgbl->io_cnt) >= 0) *(tdgbl->io_ptr)++ = c; @@ -88,7 +88,7 @@ inline void put(tgbl* tdgbl, UCHAR c) MVOL_write(c, &tdgbl->io_cnt, &tdgbl->io_ptr); } -inline const UCHAR* put_block(tgbl* tdgbl, const UCHAR* p, ULONG n) +inline const UCHAR* put_block(BurpGlobals* tdgbl, const UCHAR* p, ULONG n) { return MVOL_write_block (tdgbl, p, n); } @@ -169,7 +169,7 @@ struct rfr_tab_t { const TEXT *relation; const TEXT *field; - // Let's be compatible with tgbl.BCK_capabilities, although we could follow + // Let's be compatible with BurpGlobals*.BCK_capabilities, although we could follow // the enumeration backup_capabilities but the enum then should be defined // in burp.h instead so BCK_capabilities isn't anymore a simple SLONG. SLONG bit_mask; @@ -254,7 +254,7 @@ int BACKUP_backup(const TEXT* dbb_file, const TEXT* file_name) ISC_STATUS_ARRAY status_vector; TEXT temp[GDS_NAME_LEN]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); tdgbl->gbl_database_file_name = dbb_file; @@ -523,7 +523,7 @@ void compress(const UCHAR* data, ULONG length) * Write out data in compressed form. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); const UCHAR* p = data; const UCHAR* end = p + length; @@ -603,7 +603,7 @@ void general_on_error(void) * Handle any general ON_ERROR clause during backup. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); BURP_print_status(isc_status); BURP_abort(); @@ -626,7 +626,7 @@ burp_fld* get_fields( burp_rel* relation) burp_fld* field; ISC_QUAD* blob_id; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); USHORT count = 1; burp_fld* fields = NULL; @@ -911,7 +911,7 @@ SINT64 get_gen_id( const TEXT* name, SSHORT name_len) **************************************/ UCHAR blr_buffer[100]; // enough to fit blr - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FB_API_HANDLE gen_id_reqh = 0; UCHAR* blr = blr_buffer; @@ -1047,7 +1047,7 @@ void get_ranges( burp_fld* field) * the ranges in rdb$field_dimensions. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); SLONG* rp = field->fld_ranges; USHORT count = 0; @@ -1092,7 +1092,7 @@ void put_array( burp_fld* field, burp_rel* relation, ISC_QUAD* blob_id) SLONG range_buffer[16]; // enough for 16 dimensions UCHAR blr_buffer[200]; // enough for a sdl with 16 dimensions - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // If the array is null, don't store it. It will be restored as null. @@ -1301,7 +1301,7 @@ void put_asciz( const SCHAR attribute, const TEXT* string) * Write an attribute starting with a null terminated string. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); ULONG l = strlen(string); @@ -1327,7 +1327,7 @@ void put_blob( burp_fld* field, ISC_QUAD* blob_id, ULONG count) ISC_STATUS_ARRAY status_vector; UCHAR blob_info[32], static_buffer[1024]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // If the blob is null, don't store it. It will be restored as null. @@ -1444,7 +1444,7 @@ bool put_blr_blob( SCHAR attribute, ISC_QUAD * blob_id) ISC_STATUS_ARRAY status_vector; UCHAR blob_info[32], static_buffer[1024]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // If the blob is null, don't store it. It will be restored as null. @@ -1558,7 +1558,7 @@ void put_data(burp_rel* relation) burp_fld* field; ISC_STATUS_ARRAY status_vector; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // CVC: A signed short isn't enough if the engine allows near 32K fields, // each being char(1) ASCII in the worst case. Looking at BLR generation @@ -1892,7 +1892,7 @@ void put_index( burp_rel* relation) ULONG count; TEXT temp[GDS_NAME_LEN]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); /* if we have all capabilities, use the first request to get the most performance out of the latest engine; if we don't @@ -2085,7 +2085,7 @@ int put_message( SCHAR attribute, const TEXT* text, ULONG length) * which function of the two you use). * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); ULONG l = 0; for (const TEXT* p = text; *p && l < length; p++) @@ -2114,7 +2114,7 @@ void put_numeric( SCHAR attribute, SLONG value) * low byte first, high byte last, as in VAX. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); const SLONG vax_value = (SLONG) isc_vax_integer((const char*) &value, sizeof(value)); @@ -2139,7 +2139,7 @@ void put_int64( SCHAR attribute, SINT64 value) * INT64 value, while put_numeric handles a 32-bit value. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); const UINT64 le_value = (UINT64) isc_portable_integer((const UCHAR*) &value, sizeof(value)); @@ -2164,7 +2164,7 @@ void put_relation( burp_rel* relation) **************************************/ TEXT temp[GDS_NAME_LEN]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); /* Write local field information. This is made slightly more complicated by the requirement that computational fields be aligned. */ @@ -2354,7 +2354,7 @@ bool put_source_blob(SCHAR attribute, ISC_STATUS_ARRAY status_vector; UCHAR blob_info[48], static_buffer[1024]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // If the blob is null, don't store it. It will be restored as null. @@ -2477,7 +2477,7 @@ int put_text( SCHAR attribute, const TEXT* text, SSHORT size_len) * with quoted names and embedded spaces. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); const SSHORT l = (SSHORT) symbol_length (text, (ULONG) size_len); @@ -2505,7 +2505,7 @@ void set_capabilities(void) * unpleasantness later. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FB_API_HANDLE req = 0; @@ -2582,7 +2582,7 @@ void write_character_sets(void) **************************************/ isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$CHARACTER_SETS WITH X.RDB$SYSTEM_FLAG MISSING OR X.RDB$SYSTEM_FLAG NE 1 @@ -2628,7 +2628,7 @@ void write_check_constraints(void) **************************************/ isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$CHECK_CONSTRAINTS @@ -2662,7 +2662,7 @@ void write_collations(void) **************************************/ isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$COLLATIONS WITH X.RDB$SYSTEM_FLAG MISSING OR X.RDB$SYSTEM_FLAG NE 1 @@ -2705,7 +2705,7 @@ void write_database( const TEXT* dbb_file) SCHAR buffer[256]; isc_req_handle req_handle1 = 0, req_handle2 = 0, req_handle3 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); put(tdgbl, (UCHAR) (rec_physical_db)); @@ -2871,7 +2871,7 @@ void write_exceptions(void) TEXT temp[GDS_NAME_LEN]; isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$EXCEPTIONS @@ -2907,7 +2907,7 @@ void write_field_dimensions(void) **************************************/ isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$FIELD_DIMENSIONS @@ -2942,7 +2942,7 @@ void write_filters(void) TEXT temp[GDS_NAME_LEN]; isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$FILTERS @@ -2982,7 +2982,7 @@ void write_functions(void) TEXT temp[GDS_NAME_LEN]; isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$FUNCTIONS @@ -3023,7 +3023,7 @@ void write_function_args( GDS_NAME funcptr) **************************************/ TEXT temp[GDS_NAME_LEN]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); /* if we have all capabilities, use the first request to get the most performance out of the latest engine; if we don't @@ -3120,7 +3120,7 @@ void write_generators(void) isc_req_handle req_handle1 = 0; TEXT temp[GDS_NAME_LEN]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$GENERATORS WITH X.RDB$SYSTEM_FLAG MISSING OR X.RDB$SYSTEM_FLAG NE 1 @@ -3162,7 +3162,7 @@ void write_global_fields(void) isc_req_handle req_handle1 = 0, req_handle2 = 0, req_handle3 = 0, req_handle4 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); /* if we have all capabilities, use the first request to get the most performance out of the latest engine; if we don't @@ -3359,7 +3359,7 @@ void write_procedures(void) TEXT temp[GDS_NAME_LEN]; isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$PROCEDURES @@ -3405,7 +3405,7 @@ void write_procedure_prms( GDS_NAME procptr) **************************************/ TEXT temp[GDS_NAME_LEN]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE tdgbl->handles_write_procedure_prms_req_handle1) X IN RDB$PROCEDURE_PARAMETERS WITH X.RDB$PROCEDURE_NAME EQ procptr @@ -3442,7 +3442,7 @@ void write_ref_constraints(void) **************************************/ isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$REF_CONSTRAINTS @@ -3477,7 +3477,7 @@ void write_rel_constraints(void) TEXT temp[GDS_NAME_LEN]; isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$RELATION_CONSTRAINTS @@ -3517,7 +3517,7 @@ void write_relations(void) TEXT temp[GDS_NAME_LEN]; isc_req_handle req_handle1 = 0, req_handle2 = 0, req_handle3 = 0, req_handle4 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); /* if we have all capabilities, use the first request to get the most performance out of the latest engine; if we don't @@ -3684,7 +3684,7 @@ void write_shadow_files(void) TEXT temp[GDS_NAME_LEN]; isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$FILES @@ -3725,7 +3725,7 @@ void write_sql_roles(void) isc_req_handle req_handle1 = 0; TEXT temp[GDS_NAME_LEN]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$ROLES @@ -3761,7 +3761,7 @@ void write_triggers(void) TEXT temp[GDS_NAME_LEN]; isc_req_handle req_handle1 = 0, req_handle2 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); /* if we have all capabilities, use the first request to get the most performance out of the latest engine; if we don't @@ -3867,7 +3867,7 @@ void write_trigger_messages(void) TEXT temp[GDS_NAME_LEN]; isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) T IN RDB$TRIGGERS CROSS X IN RDB$TRIGGER_MESSAGES @@ -3905,7 +3905,7 @@ void write_types(void) **************************************/ isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) X IN RDB$TYPES WITH X.RDB$SYSTEM_FLAG NE 1 OR @@ -3945,7 +3945,7 @@ void write_user_privileges(void) TEXT temp[GDS_NAME_LEN]; isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); if (tdgbl->BCK_capabilities & BCK_ods8) { diff --git a/src/burp/burp.cpp b/src/burp/burp.cpp index 15654d4c1e..0697f42dea 100644 --- a/src/burp/burp.cpp +++ b/src/burp/burp.cpp @@ -125,7 +125,7 @@ static ULONG get_size(const SCHAR*, burp_fil*); static gbak_action open_files(const TEXT *, const TEXT**, bool, USHORT); static int common_main(int, char**, Jrd::pfn_svc_output, Jrd::Service*); #ifndef SUPERSERVER -tgbl *gdgbl; +BurpGlobals *gdgbl; static int output_main(Jrd::Service*, const UCHAR*); static int api_gbak(int, char**, USHORT, TEXT*, TEXT*, TEXT *, bool, bool); #endif @@ -360,10 +360,10 @@ static int api_gbak(int argc, * Run gbak using services APIs * **********************************************/ - tgbl ldgbl; - tgbl* tdgbl = &ldgbl; - BURP_set_thread_data(tdgbl); - memset((void *) tdgbl, 0, sizeof(tgbl)); + BurpGlobals ldgbl; + BurpGlobals* tdgbl = &ldgbl; + BurpGlobals::setSpecific(tdgbl); + memset((void *) tdgbl, 0, sizeof(BurpGlobals)); tdgbl->output_proc = output_main; const TEXT* usr; @@ -577,11 +577,11 @@ int common_main(int argc, JMP_BUF env; // TMN: This variable should probably be removed, but I left it in -// in case some platform should redefine the BURP BURP_set_thread_data. -//tgbl thd_context; +// in case some platform should redefine the BURP BurpGlobals::setSpecific. +//BurpGlobals thd_context; gbak_action action = QUIT; - tgbl *tdgbl = (tgbl*) gds__alloc(sizeof(tgbl)); + BurpGlobals *tdgbl = (BurpGlobals*) gds__alloc(sizeof(BurpGlobals)); // NOMEM: return error, FREE: during function exit in the SETJMP if (tdgbl == NULL) { @@ -590,9 +590,9 @@ int common_main(int argc, return FINI_ERROR; } - BURP_set_thread_data(tdgbl); + BurpGlobals::setSpecific(tdgbl); SVC_PUTSPECIFIC_DATA; - memset((void *) tdgbl, 0, sizeof(tgbl)); + memset((void *) tdgbl, 0, sizeof(BurpGlobals)); tdgbl->burp_env = reinterpret_cast(env); tdgbl->file_desc = INVALID_HANDLE_VALUE; tdgbl->output_proc = output_proc; @@ -1204,7 +1204,7 @@ int common_main(int argc, gds__free(mem); } - BURP_restore_thread_data(); + BurpGlobals::restoreSpecific(); if (tdgbl != NULL) { gds__free(tdgbl); } @@ -1232,7 +1232,7 @@ void BURP_abort(void) * Abandon a failed operation. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); BURP_print(83, 0, 0, 0, 0, 0); // msg 83 Exiting before completion due to errors @@ -1264,7 +1264,7 @@ void BURP_error(USHORT errcode, bool abort, * **************************************/ #ifdef SUPERSERVER - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); ISC_STATUS *status = tdgbl->service_blk->svc_status; @@ -1326,7 +1326,7 @@ void BURP_error_redirect(const ISC_STATUS* status_vector, // Raises an exception when the old SEH system would jump to another place. -void BURP_exit_local(int code, TGBL tdgbl) +void BURP_exit_local(int code, BurpGlobals* tdgbl) { tdgbl->exit_code = code; if (tdgbl->burp_env != NULL) @@ -1484,7 +1484,7 @@ void BURP_print_status(const ISC_STATUS* status_vector) if (status_vector) { const ISC_STATUS* vector = status_vector; #ifdef SUPERSERVER - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); ISC_STATUS* status = tdgbl->service_blk->svc_status; if (status != status_vector) { int i = 0; @@ -1563,7 +1563,7 @@ void BURP_verbose(USHORT number, * user defined yieding function. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); if (tdgbl->gbl_sw_verbose) BURP_print(number, arg1, arg2, arg3, arg4, arg5); @@ -1663,7 +1663,7 @@ static gbak_action open_files(const TEXT* file1, * and db handle. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); ISC_STATUS* status_vector = tdgbl->status; // try to attach the database using the first file_name @@ -2062,7 +2062,7 @@ static void burp_output( const SCHAR* format, ...) UCHAR buf[1000]; int exit_code; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); if (tdgbl->sw_redirect == NOOUTPUT || format[0] == '\0') { exit_code = diff --git a/src/burp/burp.h b/src/burp/burp.h index 748921b414..216c9c87aa 100644 --- a/src/burp/burp.h +++ b/src/burp/burp.h @@ -761,8 +761,12 @@ static const char* HDR_SPLIT_TAG = HDR_SPLIT_TAG6; const unsigned int MIN_SPLIT_SIZE = 2048; // bytes // Global switches and data +#ifndef SUPERSERVER +class BurpGlobals; +extern BurpGlobals* gdgbl; +#endif -class tgbl : public thdd +class BurpGlobals : public thdd { public: const TEXT* gbl_database_file_name; @@ -888,38 +892,33 @@ public: isc_req_handle handles_write_procedure_prms_req_handle1; USHORT hdr_forced_writes; TEXT database_security_class[GDS_NAME_LEN]; // To save database security class for deferred update +#ifdef SUPERSERVER + static inline BurpGlobals* getSpecific() { + return (BurpGlobals*) thdd::getSpecific(); + } + static inline void setSpecific(BurpGlobals* tdgbl) { + tdgbl->thdd_type = THDD_TYPE_TGBL; + tdgbl->putSpecific(); + } + static inline void restoreSpecific() { + thdd::restoreSpecific(); + } +#else + static inline BurpGlobals* getSpecific() { + return gdgbl; + } + static inline void setSpecific(BurpGlobals* tdgbl) { + gdgbl = tdgbl; + tdgbl->thdd_type = THDD_TYPE_TGBL; + } + static inline void restoreSpecific() { + } +#endif }; -typedef tgbl* TGBL; - // CVC: This aux routine declared here to not force inclusion of burp.h with burp_proto.h // in other modules. -void BURP_exit_local(int code, tgbl* tdgbl); - -#ifdef SUPERSERVER -inline tgbl* BURP_get_thread_data() { - return (tgbl*) thdd::getSpecific(); -} -inline void BURP_set_thread_data(tgbl* tdgbl) { - tdgbl->thdd_type = THDD_TYPE_TGBL; - tdgbl->putSpecific(); -} -inline void BURP_restore_thread_data() { - thdd::restoreSpecific(); -} -#else -extern tgbl* gdgbl; - -inline tgbl* BURP_get_thread_data() { - return gdgbl; -} -inline void BURP_set_thread_data(tgbl* tdgbl) { - gdgbl = tdgbl; - tdgbl->thdd_type = THDD_TYPE_TGBL; -} -inline void BURP_restore_thread_data() { -} -#endif +void BURP_exit_local(int code, BurpGlobals* tdgbl); const int FINI_DB_NOT_ONLINE = 2; /* database is not on-line due to failure to activate one or more diff --git a/src/burp/misc.cpp b/src/burp/misc.cpp index ee508bdff4..1d61295af8 100644 --- a/src/burp/misc.cpp +++ b/src/burp/misc.cpp @@ -50,7 +50,7 @@ UCHAR *MISC_alloc_burp(ULONG size) * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // Add some header space to store a list of blocks allocated for this gbak size += ROUNDUP(sizeof(UCHAR *), ALIGNMENT); @@ -90,7 +90,7 @@ void MISC_free_burp( void *free) * Release an unwanted block. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); if (free != NULL) { // Point at the head of the allocated block diff --git a/src/burp/mvol.cpp b/src/burp/mvol.cpp index 3e6444edb0..7e52e3cafc 100644 --- a/src/burp/mvol.cpp +++ b/src/burp/mvol.cpp @@ -78,12 +78,12 @@ const char* TERM_OUTPUT = "/dev/tty"; const int MAX_HEADER_SIZE = 512; -static inline int get(TGBL tdgbl) +static inline int get(BurpGlobals* tdgbl) { return (--(tdgbl->mvol_io_cnt) >= 0 ? *(tdgbl->mvol_io_ptr)++ : 255); } -static inline void put(TGBL tdgbl, UCHAR c) +static inline void put(BurpGlobals* tdgbl, UCHAR c) { --(tdgbl->mvol_io_cnt); *(tdgbl->mvol_io_ptr)++ = c; @@ -110,7 +110,7 @@ static DESC next_volume(DESC, ULONG, bool); // UINT64 MVOL_fini_read() { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); if (strcmp(tdgbl->mvol_old_file, "stdin") != 0) { @@ -138,7 +138,7 @@ UINT64 MVOL_fini_read() // UINT64 MVOL_fini_write(int* io_cnt, UCHAR** io_ptr) { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); MVOL_write(rec_end, io_cnt, io_ptr); flush_platf(tdgbl->file_desc); @@ -166,7 +166,7 @@ UINT64 MVOL_fini_write(int* io_cnt, UCHAR** io_ptr) // void MVOL_init(ULONG io_buf_size) { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); tdgbl->mvol_io_buffer_size = io_buf_size; } @@ -182,7 +182,7 @@ void MVOL_init_read(const UCHAR* database_name, // unused? int* cnt, UCHAR** ptr) { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); tdgbl->mvol_volume_count = 1; tdgbl->mvol_empty_file = TRUE; @@ -230,7 +230,7 @@ void MVOL_init_write(const UCHAR* database_name, // unused? int* cnt, UCHAR** ptr) { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); tdgbl->mvol_volume_count = 1; tdgbl->mvol_empty_file = TRUE; @@ -275,7 +275,7 @@ void MVOL_init_write(const UCHAR* database_name, // unused? // int MVOL_read(int* cnt, UCHAR** ptr) { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); for (;;) { @@ -332,7 +332,7 @@ int MVOL_read(int* cnt, UCHAR** ptr) // int MVOL_read(int* cnt, UCHAR** ptr) { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); for (;;) { @@ -380,7 +380,7 @@ int MVOL_read(int* cnt, UCHAR** ptr) // Read a chunk of data from the IO buffer. // Return a pointer to the first position NOT read into. // -UCHAR* MVOL_read_block(TGBL tdgbl, UCHAR * ptr, ULONG count) +UCHAR* MVOL_read_block(BurpGlobals* tdgbl, UCHAR * ptr, ULONG count) { // To handle tape drives & Multi-volume boundaries, use the normal // read function, instead of doing a more optimal bulk read. @@ -420,7 +420,7 @@ UCHAR* MVOL_read_block(TGBL tdgbl, UCHAR * ptr, ULONG count) // Skip head in the IO buffer. Often used when only // doing partial restores. // -void MVOL_skip_block( TGBL tdgbl, ULONG count) +void MVOL_skip_block( BurpGlobals* tdgbl, ULONG count) { // To handle tape drives & Multi-volume boundaries, use the normal // read function, instead of doing a more optimal seek. @@ -460,7 +460,7 @@ DESC MVOL_open(const char * name, ULONG mode, ULONG create) TAPE_GET_MEDIA_PARAMETERS param; DWORD size = sizeof(param); - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); if (strnicmp(name, "\\\\.\\tape", 8)) { @@ -523,7 +523,7 @@ UCHAR MVOL_write(UCHAR c, int *io_cnt, UCHAR ** io_ptr) UCHAR *ptr; ULONG left, cnt; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); ULONG size_to_write = BURP_UP_TO_BLOCK(*io_ptr - tdgbl->mvol_io_buffer); @@ -709,7 +709,7 @@ UCHAR MVOL_write(UCHAR c, int *io_cnt, UCHAR ** io_ptr) // Write a chunk of data to the IO buffer. // Return a pointer to the first position NOT written from. // -const UCHAR *MVOL_write_block(TGBL tdgbl, const UCHAR * ptr, ULONG count) +const UCHAR *MVOL_write_block(BurpGlobals* tdgbl, const UCHAR * ptr, ULONG count) { // To handle tape drives & Multi-volume boundaries, use the normal // write function, instead of doing a more optimal bulk write. @@ -752,7 +752,7 @@ static void bad_attribute(USHORT attribute, USHORT type) { TEXT name[128]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); gds__msg_format(0, 12, type, sizeof(name), name, 0, 0, 0, 0, 0); BURP_print(80, name, (void*) (IPTR) attribute, NULL, NULL, NULL); @@ -772,7 +772,7 @@ static void bad_attribute(USHORT attribute, USHORT type) // static void file_not_empty(void) { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); tdgbl->mvol_empty_file = FALSE; } @@ -798,7 +798,7 @@ static SLONG get_numeric(void) // static int get_text(UCHAR* text, SSHORT length) { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); ULONG l = get(tdgbl); length -= l; @@ -829,7 +829,7 @@ static int get_text(UCHAR* text, SSHORT length) // static DESC next_volume( DESC handle, ULONG mode, bool full_buffer) { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // We must close the old handle before the user inserts // another tape, or something. @@ -951,7 +951,7 @@ static void prompt_for_name(SCHAR* name, int length) FILE* term_out = NULL; TEXT msg[128]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // Unless we are operating as a service, stdin can't necessarily be trusted. // Get a location to read from. @@ -1047,7 +1047,7 @@ static void prompt_for_name(SCHAR* name, int length) // static void put_asciz( SCHAR attribute, const TEXT* string) { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); SSHORT l = 0; for (const TEXT *p = string; *p; p++) @@ -1074,7 +1074,7 @@ static void put_asciz( SCHAR attribute, const TEXT* string) // static void put_numeric( SCHAR attribute, int value) { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); const ULONG vax_value = gds__vax_integer(reinterpret_cast(&value), sizeof(value)); const UCHAR* p = (UCHAR *) &vax_value; @@ -1101,7 +1101,7 @@ static bool read_header(DESC handle, ULONG temp_buffer_size; TEXT buffer[256], *p, msg[128]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // Headers are a version number, and a volume number @@ -1235,7 +1235,7 @@ static bool write_header(DESC handle, ULONG backup_buffer_size, bool full_buffer) { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); if (backup_buffer_size) { @@ -1318,7 +1318,7 @@ bool MVOL_split_hdr_write(void) { TEXT buffer[HDR_SPLIT_SIZE + 1]; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); fb_assert(tdgbl->action->act_action == ACT_backup_split); fb_assert(tdgbl->action->act_file->fil_fd != INVALID_HANDLE_VALUE); @@ -1357,7 +1357,7 @@ bool MVOL_split_hdr_write(void) // bool MVOL_split_hdr_read(void) { - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); fb_assert(tdgbl->action->act_file->fil_fd != INVALID_HANDLE_VALUE); diff --git a/src/burp/mvol_proto.h b/src/burp/mvol_proto.h index 198ea9c6b6..7b838e0070 100644 --- a/src/burp/mvol_proto.h +++ b/src/burp/mvol_proto.h @@ -35,10 +35,10 @@ void MVOL_init_write(const UCHAR*, const UCHAR*, int*, UCHAR**); bool MVOL_split_hdr_write(); bool MVOL_split_hdr_read(); int MVOL_read(int*, UCHAR**); -UCHAR* MVOL_read_block(TGBL, UCHAR*, ULONG); -void MVOL_skip_block(TGBL, ULONG); +UCHAR* MVOL_read_block(BurpGlobals*, UCHAR*, ULONG); +void MVOL_skip_block(BurpGlobals*, ULONG); UCHAR MVOL_write(UCHAR, int*, UCHAR**); -const UCHAR* MVOL_write_block(TGBL, const UCHAR*, ULONG); +const UCHAR* MVOL_write_block(BurpGlobals*, const UCHAR*, ULONG); #if defined WIN_NT DESC MVOL_open(const char*, ULONG, ULONG); diff --git a/src/burp/restore.epp b/src/burp/restore.epp index 80eb08bc95..3fc7d7903a 100644 --- a/src/burp/restore.epp +++ b/src/burp/restore.epp @@ -24,7 +24,7 @@ * 2003.08.17 Claudio Valderrama: Fix SF Bug #750659. */ /* -$Id: restore.epp,v 1.79 2004-06-29 04:37:36 robocop Exp $ +$Id: restore.epp,v 1.80 2004-07-03 00:13:46 brodsom Exp $ */ #include "firebird.h" @@ -164,7 +164,7 @@ const SSHORT old_sparcs[] = #endif //MVOL_read returns int -static inline int get(tgbl* tdgbl) +static inline int get(BurpGlobals* tdgbl) { if (--(tdgbl->io_cnt) >= 0) return *(tdgbl->io_ptr)++; @@ -172,13 +172,13 @@ static inline int get(tgbl* tdgbl) return MVOL_read(&tdgbl->io_cnt, &tdgbl->io_ptr); } -static inline ATT_TYPE get_attribute(ATT_TYPE *att, TGBL tdgbl) +static inline ATT_TYPE get_attribute(ATT_TYPE *att, BurpGlobals* tdgbl) { *att = (ATT_TYPE) get(tdgbl); return *att; } -static inline rec_type get_record(rec_type *rec, TGBL tdgbl) +static inline rec_type get_record(rec_type *rec, BurpGlobals* tdgbl) { *rec = (rec_type) get(tdgbl); return *rec; @@ -186,12 +186,12 @@ static inline rec_type get_record(rec_type *rec, TGBL tdgbl) #define GET_TEXT(text) get_text((text), sizeof(text)) -static inline void get_skip(tgbl* tdgbl, ULONG n) +static inline void get_skip(BurpGlobals* tdgbl, ULONG n) { MVOL_skip_block(tdgbl, n); } -static inline UCHAR* get_block(tgbl* tdgbl, UCHAR* p, ULONG n) +static inline UCHAR* get_block(BurpGlobals* tdgbl, UCHAR* p, ULONG n) { return MVOL_read_block(tdgbl, p, n); } @@ -246,7 +246,7 @@ int RESTORE_restore (const TEXT* file_name, isc_req_handle req_handle4 = 0; BASED_ON RDB$INDICES.RDB$INDEX_NAME index_name; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); tdgbl->io_ptr = NULL; tdgbl->io_cnt = 0; @@ -664,7 +664,7 @@ void add_files (const UCHAR* file_name) **************************************/ isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // store the RDB$FILES records @@ -740,7 +740,7 @@ void bad_attribute (scan_attr_t scan_next_attr, * look for next valid attribute to continue the process. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); SLONG skip_count = 0; @@ -788,7 +788,7 @@ USHORT check_db_version() **************************************/ isc_req_handle req_handle1 = 0, req_handle2 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); USHORT db_version = DB_VERSION_DDL4; FOR (REQUEST_HANDLE req_handle1) @@ -827,7 +827,7 @@ void create_database (const TEXT* file_name) * things to do. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // Get (physical) database record @@ -1046,7 +1046,7 @@ void decompress(UCHAR* buffer, * Get a number of compressed bytes. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); UCHAR* p = buffer; const UCHAR* const end = p + length; @@ -1102,7 +1102,7 @@ void eat_blob() * Discard a blob from backup file * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); const SLONG length = get_numeric(); @@ -1122,7 +1122,7 @@ burp_rel* find_relation (const TEXT* name) * one, produce a fatal error. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // Why isn't strcmp used here? for (burp_rel* relation = tdgbl->relations; relation; @@ -1152,7 +1152,7 @@ void general_on_error() * Handle any general ON_ERROR clause during restore. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); BURP_print_status (isc_status); BURP_abort (); @@ -1183,7 +1183,7 @@ bool get_acl (const TEXT *owner_nm, isc_info_blob_total_length, isc_info_blob_num_segments}; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // If the blob is null, don't store it. It will be restored as null. @@ -1385,7 +1385,7 @@ void get_array (burp_rel* relation, UCHAR blr_buffer[200]; // enough for a sdl with 16 dimensions lstring xdr_slice; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // don't free something you don't allocate lstring xdr_buffer; @@ -1881,7 +1881,7 @@ void get_blob (const burp_fld* fields, * shiny, new blob. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // Pick up attributes @@ -1998,7 +1998,7 @@ void get_blr_blob (ISC_QUAD *blob_id, ISC_STATUS_ARRAY status_vector; UCHAR *buffer, static_buffer[1024], *p; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); ULONG length = (ULONG)get_numeric(); @@ -2068,7 +2068,7 @@ bool get_character_set() ATT_TYPE attribute; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_character_sets_req_handle1) X IN RDB$CHARACTER_SETS @@ -2164,7 +2164,7 @@ bool get_chk_constraint() ATT_TYPE attribute; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_chk_constraint_req_handle1) X IN RDB$CHECK_CONSTRAINTS @@ -2214,7 +2214,7 @@ bool get_collation() ATT_TYPE attribute; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_collation_req_handle1) X IN RDB$COLLATIONS @@ -2303,7 +2303,7 @@ rec_type get_data (burp_rel* relation) isc_req_handle req_handle = 0; BASED_ON RDB$INDICES.RDB$INDEX_NAME index_name; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // If we're only doing meta-data, ignore data records @@ -2718,7 +2718,7 @@ bool get_exception(void) ULONG l; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_exception_req_handle1) X IN RDB$EXCEPTIONS @@ -2781,7 +2781,7 @@ burp_fld* get_field (burp_rel* relation) ATT_TYPE attribute; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // If it is a view and there is a global transaction then use it bool global_tr = false; @@ -3003,7 +3003,7 @@ bool get_field_dimensions() ATT_TYPE attribute; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_field_dimensions_req_handle1) X IN RDB$FIELD_DIMENSIONS @@ -3058,7 +3058,7 @@ bool get_files() ATT_TYPE attribute; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_files_req_handle1) X IN RDB$FILES @@ -3126,7 +3126,7 @@ bool get_filter() ATT_TYPE attribute; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_filter_req_handle1) X IN RDB$FILTERS @@ -3200,7 +3200,7 @@ bool get_function() SSHORT l; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_function_req_handle1) X IN RDB$FUNCTIONS @@ -3280,7 +3280,7 @@ void get_function_arg() TEXT temp[GDS_NAME_LEN]; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); if (tdgbl->RESTORE_format >= 6) { @@ -3432,7 +3432,7 @@ bool get_generator() name[0] = 0; // just in case. ATT_TYPE attribute; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); skip_init(&scan_next_attr); while (skip_scan(&scan_next_attr), get_attribute(&attribute, tdgbl) != att_end) @@ -3482,7 +3482,7 @@ bool get_global_field() SSHORT l; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); GFLD gfield = NULL; @@ -4073,7 +4073,7 @@ bool get_index (const burp_rel* relation) bool foreign_index = false; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); SSHORT count = 0, segments = 0; @@ -4232,7 +4232,7 @@ void get_misc_blob (ISC_QUAD *blob_id, **************************************/ ISC_STATUS_ARRAY status_vector; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); const USHORT length = (USHORT)get_numeric(); @@ -4350,7 +4350,7 @@ bool get_procedure() SSHORT l; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans; @@ -4465,7 +4465,7 @@ bool get_procedure_prm (GDS_NAME procptr) TEXT temp[GDS_NAME_LEN]; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans; @@ -4538,7 +4538,7 @@ bool get_ref_constraint() ATT_TYPE attribute; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_ref_constraint_req_handle1) X IN RDB$REF_CONSTRAINTS @@ -4631,7 +4631,7 @@ bool get_relation() ext_file_name[0] = '\0'; bool ext_file_name_null = true; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // Pick up relation attributes @@ -4855,7 +4855,7 @@ bool get_rel_constraint() ATT_TYPE attribute; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_rel_constraint_req_handle1) X IN RDB$RELATION_CONSTRAINTS @@ -4932,7 +4932,7 @@ bool get_relation_data() ATT_TYPE attribute; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); burp_rel* relation = NULL; @@ -5018,7 +5018,7 @@ bool get_sql_roles() TEXT temp[GDS_NAME_LEN]; SSHORT l; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_sql_roles_req_handle1) X IN RDB$ROLES @@ -5108,7 +5108,7 @@ bool get_security_class() scan_attr_t scan_next_attr; bool is_valid_sec_class = false; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_security_class_req_handle1) X IN RDB$SECURITY_CLASSES @@ -5193,7 +5193,7 @@ void get_source_blob ( **************************************/ ISC_STATUS_ARRAY status_vector; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); SLONG length = get_numeric(); @@ -5259,7 +5259,7 @@ USHORT get_text ( * Move a text attribute to a string and fill. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); const ULONG l = get(tdgbl); @@ -5293,7 +5293,7 @@ bool get_trigger_old ( TEXT name[GDS_NAME_LEN]; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_trigger_old_req_handle1) X IN RDB$TRIGGERS @@ -5413,7 +5413,7 @@ bool get_trigger() BASED_ON RDB$TRIGGERS.RDB$TRIGGER_NAME name; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans; @@ -5540,7 +5540,7 @@ bool get_trigger_message() BASED_ON RDB$TRIGGER_MESSAGES.RDB$MESSAGE_NUMBER number; BASED_ON RDB$TRIGGER_MESSAGES.RDB$MESSAGE message; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); bool flag = false; skip_init(&scan_next_attr); @@ -5633,7 +5633,7 @@ bool get_type() TEXT temp[GDS_NAME_LEN]; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_get_type_req_handle1) X IN RDB$TYPES @@ -5716,7 +5716,7 @@ bool get_user_privilege() BASED_ON RDB$USER_PRIVILEGES.RDB$USER_TYPE user_type; BASED_ON RDB$USER_PRIVILEGES.RDB$OBJECT_TYPE object_type; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); user_type = obj_user; object_type = obj_relation; @@ -5908,7 +5908,7 @@ bool get_view (burp_rel* relation) ATT_TYPE attribute; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // If there is a global transaction then use it @@ -5969,7 +5969,7 @@ void ignore_array (burp_rel* relation) USHORT field_number; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // Pick up attributes @@ -6057,7 +6057,7 @@ void ignore_blob() ATT_TYPE attribute; scan_attr_t scan_next_attr; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // Pick up attributes @@ -6114,7 +6114,7 @@ rec_type ignore_data (burp_rel* relation) * Ignore data records for a relation. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); ULONG records = 0; rec_type record; @@ -6183,7 +6183,7 @@ void realign(UCHAR* buffer, * than the new. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); for (const burp_fld* field = relation->rel_fields; field; field = field->fld_next) { @@ -6244,7 +6244,7 @@ USHORT recompute_length (burp_rel* relation) ULONG offset = 0; // there was garbage, possibly nobody uses sparc define? const SSHORT* alignments = old_sparcs; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); for (burp_fld* field = relation->rel_fields; field; field = field->fld_next) { @@ -6310,7 +6310,7 @@ bool restore (const TEXT* file_name, isc_req_handle req_handle1 = 0, req_handle2 = 0, req_handle3 = 0, req_handle5 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); // Read burp record first @@ -6640,7 +6640,7 @@ void restore_security_class (const TEXT *owner_nm, **************************************/ isc_req_handle req_handle2 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); isc_tr_handle local_trans = gds_trans; FOR (REQUEST_HANDLE req_handle2) @@ -6694,7 +6694,7 @@ USHORT get_view_base_relation_count (const TEXT* current_view_name, isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); USHORT result = 0; @@ -6739,7 +6739,7 @@ void store_blr_gen_id (const TEXT* gen_name, // TEXT GDS_NAME[GDS_NAME_LEN] * Store the blr_gen_id for the relation. * **************************************/ - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); STORE (REQUEST_HANDLE tdgbl->handles_store_blr_gen_id_req_handle1) X IN RDB$GENERATORS @@ -6855,7 +6855,7 @@ void update_global_field() USHORT length; isc_req_handle req_handle1 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); for (gfld* gfield = tdgbl->gbl_global_fields; gfield; ) { @@ -6942,7 +6942,7 @@ void update_view_dbkey_lengths() **************************************/ isc_req_handle req_handle2 = 0; - TGBL tdgbl = BURP_get_thread_data(); + BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle2) R IN RDB$RELATIONS