diff --git a/src/jrd/idx.h b/src/jrd/idx.h index fd00404635..8cd25bfc07 100644 --- a/src/jrd/idx.h +++ b/src/jrd/idx.h @@ -46,11 +46,14 @@ struct ini_idx_t { /* Encoded descriptions of system indices */ +using Jrd::idx_unique; +using Jrd::idx_metadata; +using Jrd::idx_numeric; +using Jrd::idx_descending; + #define INDEX(id,flag,rel,unique,count) {(id),(flag),(UCHAR) (rel),(unique),(count),{ #define SEGMENT(fld,type) {(fld),(type)} -using namespace Jrd; - static const struct ini_idx_t indices[] = { /* define index RDB$INDEX_0 for RDB$RELATIONS unique RDB$RELATION_NAME; */ diff --git a/src/jrd/jlx.c b/src/jrd/jlx.c index 28f3d9aa51..7137a168b5 100644 --- a/src/jrd/jlx.c +++ b/src/jrd/jlx.c @@ -29,12 +29,12 @@ #include #include "../jrd/common.h" -const int CHR_LETTER = 1; -const int CHR_DIGIT = 2; -const int CHR_IDENT = 4; -const int CHR_QUOTE = 8; -const int CHR_WHITE = 16; -const int CHR_HEX = 32; +const UCHAR CHR_LETTER = 1; +const UCHAR CHR_DIGIT = 2; +const UCHAR CHR_IDENT = 4; +const UCHAR CHR_QUOTE = 8; +const UCHAR CHR_WHITE = 16; +const UCHAR CHR_HEX = 32; extern struct symb dbt_symbols[]; diff --git a/src/jrd/jrd.h b/src/jrd/jrd.h index bb61f65f5d..c173840bb1 100644 --- a/src/jrd/jrd.h +++ b/src/jrd/jrd.h @@ -329,16 +329,16 @@ const ULONG DBB_being_opened = 0x400000L; /* database is being attached to */ // // dbb_ast_flags // -const ULONG DBB_blocking = 0x1L; // Exclusive mode is blocking -const ULONG DBB_get_shadows = 0x2L; // Signal received to check for new shadows -const ULONG DBB_assert_locks = 0x4L; // Locks are to be asserted -const ULONG DBB_shutdown = 0x8L; // Database is shutdown -const ULONG DBB_shut_attach = 0x10L; // no new attachments accepted -const ULONG DBB_shut_tran = 0x20L; // no new transactions accepted -const ULONG DBB_shut_force = 0x40L; // forced shutdown in progress -const ULONG DBB_shutdown_locks = 0x80L; // Database locks release by shutdown -const ULONG DBB_shutdown_full = 0x100L; // Database fully shut down -const ULONG DBB_shutdown_single = 0x200L; // Database is in single-user maintenance mode +const UATOM DBB_blocking = 0x1L; // Exclusive mode is blocking +const UATOM DBB_get_shadows = 0x2L; // Signal received to check for new shadows +const UATOM DBB_assert_locks = 0x4L; // Locks are to be asserted +const UATOM DBB_shutdown = 0x8L; // Database is shutdown +const UATOM DBB_shut_attach = 0x10L; // no new attachments accepted +const UATOM DBB_shut_tran = 0x20L; // no new transactions accepted +const UATOM DBB_shut_force = 0x40L; // forced shutdown in progress +const UATOM DBB_shutdown_locks = 0x80L; // Database locks release by shutdown +const UATOM DBB_shutdown_full = 0x100L; // Database fully shut down +const UATOM DBB_shutdown_single = 0x200L; // Database is in single-user maintenance mode // // Database attachments @@ -484,33 +484,33 @@ public: /* Attachment flags */ -const int ATT_no_cleanup = 1; // Don't expunge, purge, or garbage collect -const int ATT_shutdown = 2; // attachment has been shutdown -const int ATT_shutdown_notify = 4; // attachment has notified client of shutdown -const int ATT_shutdown_manager = 8; // attachment requesting shutdown -const int ATT_lck_init_done = 16; // LCK_init() called for the attachment -const int ATT_exclusive = 32; // attachment wants exclusive database access -const int ATT_attach_pending = 64; // Indicate attachment is only pending -const int ATT_exclusive_pending = 128; // Indicate exclusive attachment pending -const int ATT_gbak_attachment = 256; // Indicate GBAK attachment -const int ATT_security_db = 512; // Indicates an implicit attachment to the security db +const ULONG ATT_no_cleanup = 1; // Don't expunge, purge, or garbage collect +const ULONG ATT_shutdown = 2; // attachment has been shutdown +const ULONG ATT_shutdown_notify = 4; // attachment has notified client of shutdown +const ULONG ATT_shutdown_manager = 8; // attachment requesting shutdown +const ULONG ATT_lck_init_done = 16; // LCK_init() called for the attachment +const ULONG ATT_exclusive = 32; // attachment wants exclusive database access +const ULONG ATT_attach_pending = 64; // Indicate attachment is only pending +const ULONG ATT_exclusive_pending = 128; // Indicate exclusive attachment pending +const ULONG ATT_gbak_attachment = 256; // Indicate GBAK attachment +const ULONG ATT_security_db = 512; // Indicates an implicit attachment to the security db #ifdef GARBAGE_THREAD -const int ATT_notify_gc = 1024; // Notify garbage collector to expunge, purge .. -const int ATT_disable_notify_gc = 2048; // Temporarily perform own garbage collection -const int ATT_garbage_collector = 4096; // I'm a garbage collector +const ULONG ATT_notify_gc = 1024; // Notify garbage collector to expunge, purge .. +const ULONG ATT_disable_notify_gc = 2048; // Temporarily perform own garbage collection +const ULONG ATT_garbage_collector = 4096; // I'm a garbage collector -const int ATT_NO_CLEANUP = (ATT_no_cleanup | ATT_notify_gc); +const ULONG ATT_NO_CLEANUP = (ATT_no_cleanup | ATT_notify_gc); #else -const int ATT_NO_CLEANUP = ATT_no_cleanup; +const ULONG ATT_NO_CLEANUP = ATT_no_cleanup; #endif #ifdef CANCEL_OPERATION -const int ATT_cancel_raise = 8192; // Cancel currently running operation -const int ATT_cancel_disable = 16384; // Disable cancel operations +const ULONG ATT_cancel_raise = 8192; // Cancel currently running operation +const ULONG ATT_cancel_disable = 16384; // Disable cancel operations #endif -const int ATT_gfix_attachment = 32768; // Indicate a GFIX attachment -const int ATT_gstat_attachment = 65536; // Indicate a GSTAT attachment +const ULONG ATT_gfix_attachment = 32768; // Indicate a GFIX attachment +const ULONG ATT_gstat_attachment = 65536; // Indicate a GSTAT attachment /* Procedure block */ @@ -546,21 +546,23 @@ class jrd_prc : public pool_alloc_rpt explicit jrd_prc(MemoryPool& p) : prc_security_name(p), prc_name(p) {} }; -const int PRC_scanned = 1; /* Field expressions scanned */ -const int PRC_system = 2; -const int PRC_obsolete = 4; /* Procedure known gonzo */ -const int PRC_being_scanned = 8; /* New procedure needs dependencies during scan */ -const int PRC_blocking = 16; /* Blocking someone from dropping procedure */ -const int PRC_create = 32; /* Newly created */ -const int PRC_being_altered = 64; /* Procedure is getting altered */ +// prc_flags + +const USHORT PRC_scanned = 1; /* Field expressions scanned */ +const USHORT PRC_system = 2; +const USHORT PRC_obsolete = 4; /* Procedure known gonzo */ +const USHORT PRC_being_scanned = 8; /* New procedure needs dependencies during scan */ +const USHORT PRC_blocking = 16; /* Blocking someone from dropping procedure */ +const USHORT PRC_create = 32; /* Newly created */ +const USHORT PRC_being_altered = 64; /* Procedure is getting altered */ // This flag is used to make sure that MET_remove_procedure // does not delete and remove procedure block from cache // so dfw.epp:modify_procedure() can flip procedure body without // invalidating procedure pointers from other parts of metadata cache -const int PRC_check_existence = 128; /* Existence lock released */ +const USHORT PRC_check_existence = 128; /* Existence lock released */ -const int MAX_PROC_ALTER = 64; /* No. of times an in-cache procedure can be altered */ +const USHORT MAX_PROC_ALTER = 64; /* No. of times an in-cache procedure can be altered */ @@ -674,19 +676,21 @@ public: frgn rel_foreign_refs; /* foreign references to other relations' primary keys */ }; -const int REL_scanned = 1; /* Field expressions scanned (or being scanned) */ -const int REL_system = 2; -const int REL_deleted = 4; /* Relation known gonzo */ -const int REL_get_dependencies = 8; /* New relation needs dependencies during scan */ -const int REL_force_scan = 16; /* system relation has been updated since ODS change, force a scan */ -const int REL_check_existence = 32; /* Existence lock released pending drop of relation */ -const int REL_blocking = 64; /* Blocking someone from dropping relation */ -const int REL_sys_triggers = 128; /* The relation has system triggers to compile */ -const int REL_sql_relation = 256; /* Relation defined as sql table */ -const int REL_check_partners = 512; /* Rescan primary dependencies and foreign references */ -const int REL_being_scanned = 1024; /* relation scan in progress */ -const int REL_sys_trigs_being_loaded = 2048; /* System triggers being loaded */ -const int REL_deleting = 4096; /* relation delete in progress */ +// rel_flags + +const USHORT REL_scanned = 1; /* Field expressions scanned (or being scanned) */ +const USHORT REL_system = 2; +const USHORT REL_deleted = 4; /* Relation known gonzo */ +const USHORT REL_get_dependencies = 8; /* New relation needs dependencies during scan */ +const USHORT REL_force_scan = 16; /* system relation has been updated since ODS change, force a scan */ +const USHORT REL_check_existence = 32; /* Existence lock released pending drop of relation */ +const USHORT REL_blocking = 64; /* Blocking someone from dropping relation */ +const USHORT REL_sys_triggers = 128; /* The relation has system triggers to compile */ +const USHORT REL_sql_relation = 256; /* Relation defined as sql table */ +const USHORT REL_check_partners = 512; /* Rescan primary dependencies and foreign references */ +const USHORT REL_being_scanned = 1024; /* relation scan in progress */ +const USHORT REL_sys_trigs_being_loaded = 2048; /* System triggers being loaded */ +const USHORT REL_deleting = 4096; /* relation delete in progress */ /* Field block, one for each field in a scanned relation */ @@ -881,11 +885,12 @@ struct win_for_array: public win win_for_array() : win(-1) {} }; +// win_flags -const int WIN_large_scan = 1; /* large sequential scan */ -const int WIN_secondary = 2; /* secondary stream */ -const int WIN_garbage_collector = 4; /* garbage collector's window */ -const int WIN_garbage_collect = 8; /* scan left a page for garbage collector */ +const USHORT WIN_large_scan = 1; /* large sequential scan */ +const USHORT WIN_secondary = 2; /* secondary stream */ +const USHORT WIN_garbage_collector = 4; /* garbage collector's window */ +const USHORT WIN_garbage_collect = 8; /* scan left a page for garbage collector */ // Thread specific database block @@ -911,11 +916,13 @@ struct thread_db #endif }; -const int TDBB_sweeper = 1; /* Thread sweeper or garbage collector */ -const int TDBB_no_cache_unwind = 2; /* Don't unwind page buffer cache */ -const int TDBB_prc_being_dropped = 4; /* Dropping a procedure */ -const int TDBB_set_backup_state = 8; /* Setting state for backup lock */ -const int TDBB_backup_merge = 16; /* Merging changes from difference file */ +// tdbb_flags + +const USHORT TDBB_sweeper = 1; /* Thread sweeper or garbage collector */ +const USHORT TDBB_no_cache_unwind = 2; /* Don't unwind page buffer cache */ +const USHORT TDBB_prc_being_dropped = 4; /* Dropping a procedure */ +const USHORT TDBB_set_backup_state = 8; /* Setting state for backup lock */ +const USHORT TDBB_backup_merge = 16; /* Merging changes from difference file */ /* List of internal database handles */ diff --git a/src/jrd/met.h b/src/jrd/met.h index 09965a9d7a..15a180bba6 100644 --- a/src/jrd/met.h +++ b/src/jrd/met.h @@ -63,12 +63,17 @@ class TemporaryField : public pool_alloc DSC tfb_desc; }; +// tfb_flags + const int TFB_computed = 1; const int TFB_array = 2; -const int MET_object_active = 0; -const int MET_object_inactive = 1; -const int MET_object_unknown = 2; +// index status + +const SSHORT MET_object_active = 0; +const SSHORT MET_object_inactive = 1; +const SSHORT MET_object_unknown = 2; + const int TRIGGER_PRE_STORE = 1; const int TRIGGER_POST_STORE = 2; diff --git a/src/jrd/req.h b/src/jrd/req.h index 07fcdb4d24..6e7503b92a 100644 --- a/src/jrd/req.h +++ b/src/jrd/req.h @@ -82,19 +82,19 @@ struct record_param { /* Record flags must be an exact replica of ODS record header flags */ -const int rpb_deleted = 1; -const int rpb_chained = 2; -const int rpb_fragment = 4; -const int rpb_incomplete= 8; -const int rpb_blob = 16; -const int rpb_delta = 32; /* prior version is a differences record */ -const int rpb_damaged = 128; /* record is busted */ -const int rpb_gc_active = 256; /* garbage collecting dead record version */ +const USHORT rpb_deleted = 1; +const USHORT rpb_chained = 2; +const USHORT rpb_fragment = 4; +const USHORT rpb_incomplete = 8; +const USHORT rpb_blob = 16; +const USHORT rpb_delta = 32; /* prior version is a differences record */ +const USHORT rpb_damaged = 128; /* record is busted */ +const USHORT rpb_gc_active = 256; /* garbage collecting dead record version */ /* Stream flags */ -const int RPB_s_refetch = 0x1; /* re-fetch required due to sort */ -const int RPB_s_update = 0x2; /* input stream fetched for update */ +const USHORT RPB_s_refetch = 0x1; /* re-fetch required due to sort */ +const USHORT RPB_s_update = 0x2; /* input stream fetched for update */ #define SET_NULL(record, id) record->rec_data [id >> 3] |= (1 << (id & 7)) #define CLEAR_NULL(record, id) record->rec_data [id >> 3] &= ~(1 << (id & 7)) @@ -105,9 +105,9 @@ const int MAX_DIFFERENCES = 1024; /* Max length of generated Differences string /* Store allocation policy types. Parameter to DPM_store() */ -const int DPM_primary = 1; /* New primary record */ -const int DPM_secondary = 2; /* Chained version of primary record */ -const int DPM_other = 3; /* Independent (or don't care) record */ +const USHORT DPM_primary = 1; /* New primary record */ +const USHORT DPM_secondary = 2; /* Chained version of primary record */ +const USHORT DPM_other = 3; /* Independent (or don't care) record */ /* Record block (holds data, remember data?) */ @@ -126,9 +126,11 @@ public: UCHAR rec_data[1]; /* THIS VARIABLE MUST BE ALIGNED ON A DOUBLE BOUNDARY */ }; -const int REC_same_tx = 1; /* record inserted/updated and deleted by same tx */ -const int REC_gc_active = 2; /* relation garbage collect record block in use */ -const int REC_new_version = 4; /* savepoint created new record version and deleted it */ +// rec_flags + +const UCHAR REC_same_tx = 1; /* record inserted/updated and deleted by same tx */ +const UCHAR REC_gc_active = 2; /* relation garbage collect record block in use */ +const UCHAR REC_new_version = 4; /* savepoint created new record version and deleted it */ /* save record_param block */ diff --git a/src/jrd/sch.cpp b/src/jrd/sch.cpp index 20ac6ad8e7..6f4e24399d 100644 --- a/src/jrd/sch.cpp +++ b/src/jrd/sch.cpp @@ -58,10 +58,12 @@ typedef struct thread { USHORT thread_flags; /* Flags */ } *THREAD; -const int THREAD_hiber = 1; /* Thread is hibernating */ -const int THREAD_ast_disabled = 2; /* Disable AST delivery */ -const int THREAD_ast_active = 4; /* Disable AST preemption while AST active */ -const int THREAD_ast_pending = 8; /* AST waiting to be delivered */ +// thread_flags + +const USHORT THREAD_hiber = 1; /* Thread is hibernating */ +const USHORT THREAD_ast_disabled = 2; /* Disable AST delivery */ +const USHORT THREAD_ast_active = 4; /* Disable AST preemption while AST active */ +const USHORT THREAD_ast_pending = 8; /* AST waiting to be delivered */ static THREAD alloc_thread(void); static bool ast_enable(void); diff --git a/src/jrd/sdw.h b/src/jrd/sdw.h index 172e050bcd..112795b28b 100644 --- a/src/jrd/sdw.h +++ b/src/jrd/sdw.h @@ -40,21 +40,23 @@ class Shadow : public pool_alloc USHORT sdw_flags; }; -const int SDW_dumped = 1; /* bit set when file has been copied */ -const int SDW_shutdown = 2; /* stop shadowing on next cache flush */ -const int SDW_manual = 4; /* shadow is a manual shadow--don't delete */ -const int SDW_delete = 8; /* delete the shadow at the next shutdown */ -const int SDW_found = 16; /* flag to mark shadow found in database */ -const int SDW_rollover = 32; /* this shadow was rolled over to when the main db file went away */ -const int SDW_conditional = 64; /* shadow to be used if another shadow becomes unavailable */ +// sdw_flags + +const USHORT SDW_dumped = 1; /* bit set when file has been copied */ +const USHORT SDW_shutdown = 2; /* stop shadowing on next cache flush */ +const USHORT SDW_manual = 4; /* shadow is a manual shadow--don't delete */ +const USHORT SDW_delete = 8; /* delete the shadow at the next shutdown */ +const USHORT SDW_found = 16; /* flag to mark shadow found in database */ +const USHORT SDW_rollover = 32; /* this shadow was rolled over to when the main db file went away */ +const USHORT SDW_conditional = 64; /* shadow to be used if another shadow becomes unavailable */ /* these macros are a convenient combination of switches: the first specifies the shadow is invalid for writing to; the second specifies that the shadow no SLONGer exists and the shadow block simply hasn't been cleared out yet */ -const int SDW_INVALID = (SDW_shutdown | SDW_delete | SDW_rollover | SDW_conditional); -const int SDW_IGNORE = (SDW_shutdown | SDW_delete); +const USHORT SDW_INVALID = (SDW_shutdown | SDW_delete | SDW_rollover | SDW_conditional); +const USHORT SDW_IGNORE = (SDW_shutdown | SDW_delete); } //namespace Jrd diff --git a/src/jrd/sort.cpp b/src/jrd/sort.cpp index 968ab646a1..1eb89cebc6 100644 --- a/src/jrd/sort.cpp +++ b/src/jrd/sort.cpp @@ -19,7 +19,7 @@ * * All Rights Reserved. * Contributor(s): ______________________________________. - * $Id: sort.cpp,v 1.61 2004-04-28 22:39:05 brodsom Exp $ + * $Id: sort.cpp,v 1.62 2004-05-03 22:42:46 brodsom Exp $ * * 2001-09-24 SJL - Temporary fix for large sort file bug * @@ -64,12 +64,6 @@ #include #endif -/* RITTER - declare seek and off_t - :ATTENTION: for 64bit I/O we might need stdio.h ! */ - -#ifdef SOLARIS -#include -#endif - #ifdef WIN_NT /* for SEEK_SET */ #include // lseek, read, write, close diff --git a/src/jrd/sort.h b/src/jrd/sort.h index 4869307d65..6230c9b5f4 100644 --- a/src/jrd/sort.h +++ b/src/jrd/sort.h @@ -171,10 +171,10 @@ const int SKD_date = SKD_timestamp1; /* skd_flags */ -const int SKD_ascending = 0; /* default initializer */ -const int SKD_descending = 1; -const int SKD_insensitive = 2; -const int SKD_binary = 4; +const UCHAR SKD_ascending = 0; /* default initializer */ +const UCHAR SKD_descending = 1; +const UCHAR SKD_insensitive = 2; +const UCHAR SKD_binary = 4; const int TYPE_RUN = 0; const int TYPE_MRG = 1; diff --git a/src/jrd/val.cpp b/src/jrd/val.cpp index 86c88e624c..722e8a6d55 100644 --- a/src/jrd/val.cpp +++ b/src/jrd/val.cpp @@ -600,9 +600,11 @@ typedef struct vdr SparseBitmap* vdr_idx_records; /* 1 bit per index item */ } *VDR; -const int vdr_update = 2; /* fix simple things */ -const int vdr_repair = 4; /* fix non-simple things (-mend) */ -const int vdr_records = 8; /* Walk all records */ +// vdr_flags + +const USHORT vdr_update = 2; /* fix simple things */ +const USHORT vdr_repair = 4; /* fix non-simple things (-mend) */ +const USHORT vdr_records = 8; /* Walk all records */ typedef enum { fetch_ok,