mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 21:23:04 +01:00
Fixed CORE-5791: ODS for windows builds and linux-x64 (on the one side) and linux-x86 (on the other side) does not match
This commit is contained in:
parent
943b9407e8
commit
affb39894b
@ -204,10 +204,10 @@ $(TOMCRYPT_LIB): $(TOM_Objs)
|
||||
$(STATICLIB_LINK) $@ $^
|
||||
|
||||
#___________________________________________________________________________
|
||||
# main build target for both debug abd release builds
|
||||
# main build target for both debug and release builds
|
||||
#
|
||||
|
||||
.PHONY: cross1 cross2 boot yvalve engine fbintl gpre utilities plugins rest codes ids examples cross_rest
|
||||
.PHONY: cross1 cross2 boot yvalve engine fbintl gpre utilities plugins rest codes ids examples cross_rest preliminaryCheck
|
||||
|
||||
master_process:
|
||||
ln -sf $(SRC_ROOT)/include/gen/autoconfig.auto $(SRC_ROOT)/include/gen/autoconfig.h
|
||||
@ -215,6 +215,7 @@ master_process:
|
||||
$(MAKE) export_lists
|
||||
$(MAKE) external
|
||||
$(MAKE) updateCloopInterfaces
|
||||
$(MAKE) preliminaryCheck
|
||||
$(MAKE) boot
|
||||
$(MAKE) yvalve
|
||||
ifeq ($(IsDeveloper), Y)
|
||||
@ -285,6 +286,26 @@ cross2:
|
||||
$(MAKE) -f Makefile.plugins_examples
|
||||
$(MAKE) cross_rest
|
||||
|
||||
|
||||
#___________________________________________________________________________
|
||||
# preliminary checks - make sure platform is OK to build FB
|
||||
#
|
||||
|
||||
STD_SIZES:=$(SRC_ROOT)/misc/ods.txt
|
||||
RUN_SIZES:=$(GEN_ROOT)/ods.txt
|
||||
ODS_H:=$(SRC_ROOT)/jrd/ods.h
|
||||
ODS_AWK:=$(SRC_ROOT)/misc/ods.awk
|
||||
ODS_TEST_CPP:=$(GEN_ROOT)/odstest.cpp
|
||||
ODS_TEST:=$(GEN_ROOT)/odstest$(EXEC_EXT)
|
||||
|
||||
preliminaryCheck: $(STD_SIZES) $(RUN_SIZES)
|
||||
diff -u $^
|
||||
|
||||
$(RUN_SIZES): $(ODS_H) $(ODS_AWK)
|
||||
gawk -f $(ODS_AWK) <$(ODS_H) >$(ODS_TEST_CPP)
|
||||
$(CXX) -o $(ODS_TEST) $(WCXXFLAGS) $(ODS_TEST_CPP)
|
||||
$(ODS_TEST) >$(RUN_SIZES)
|
||||
|
||||
#___________________________________________________________________________
|
||||
# static library - various common code, used in different FB projects
|
||||
#
|
||||
|
@ -41,7 +41,6 @@ public:
|
||||
DbImplementation (UCHAR p_cpu, UCHAR p_os, UCHAR p_cc, UCHAR p_flags)
|
||||
: di_cpu(p_cpu), di_os(p_os), di_cc(p_cc), di_flags(p_flags)
|
||||
{ }
|
||||
DbImplementation (UCHAR p_compatImpl);
|
||||
~DbImplementation() { }
|
||||
|
||||
private:
|
||||
|
@ -36,8 +36,10 @@ namespace
|
||||
|
||||
namespace Ods {
|
||||
|
||||
bool isSupported(USHORT majorVersion, USHORT minorVersion)
|
||||
bool isSupported(const header_page* hdr)
|
||||
{
|
||||
USHORT majorVersion = hdr->hdr_ods_version;
|
||||
USHORT minorVersion = hdr->hdr_ods_minor;
|
||||
const bool isFirebird = (majorVersion & ODS_FIREBIRD_FLAG);
|
||||
majorVersion &= ~ODS_FIREBIRD_FLAG;
|
||||
|
||||
|
@ -33,8 +33,10 @@
|
||||
#ifndef JRD_ODS_H
|
||||
#define JRD_ODS_H
|
||||
|
||||
#ifndef ODS_TESTING
|
||||
#include "../jrd/RecordNumber.h"
|
||||
#include "../common/classes/fb_string.h"
|
||||
#endif //ODS_TESTING
|
||||
|
||||
// This macro enables the ability of the engine to connect to databases
|
||||
// from ODS 8 up to the latest. If this macro is undefined, the engine
|
||||
@ -316,7 +318,9 @@ struct index_root_page
|
||||
USHORT irt_count; // Number of indices
|
||||
struct irt_repeat
|
||||
{
|
||||
#ifndef ODS_TESTING
|
||||
private:
|
||||
#endif //ODS_TESTING
|
||||
ULONG irt_root; // page number of index root if irt_in_progress is NOT set, or
|
||||
// highest 32 bit of transaction if irt_in_progress is set
|
||||
ULONG irt_transaction; // transaction in progress (lowest 32 bits)
|
||||
@ -325,6 +329,7 @@ struct index_root_page
|
||||
UCHAR irt_keys; // number of keys in index
|
||||
UCHAR irt_flags;
|
||||
|
||||
#ifndef ODS_TESTING
|
||||
ULONG getRoot() const;
|
||||
void setRoot(ULONG root_page);
|
||||
|
||||
@ -332,6 +337,7 @@ struct index_root_page
|
||||
void setTransaction(TraNumber traNumber);
|
||||
|
||||
bool isUsed() const;
|
||||
#endif //ODS_TESTING
|
||||
} irt_rpt[1];
|
||||
};
|
||||
|
||||
@ -352,6 +358,7 @@ const USHORT irt_foreign = 8;
|
||||
const USHORT irt_primary = 16;
|
||||
const USHORT irt_expression = 32;
|
||||
|
||||
#ifndef ODS_TESTING
|
||||
inline ULONG index_root_page::irt_repeat::getRoot() const
|
||||
{
|
||||
return (irt_flags & irt_in_progress) ? 0 : irt_root;
|
||||
@ -379,6 +386,7 @@ inline bool index_root_page::irt_repeat::isUsed() const
|
||||
{
|
||||
return (irt_flags & irt_in_progress) || (irt_root != 0);
|
||||
}
|
||||
#endif //ODS_TESTING
|
||||
|
||||
|
||||
const int STUFF_COUNT = 4;
|
||||
@ -567,6 +575,7 @@ struct generator_page
|
||||
{
|
||||
pag gpg_header;
|
||||
ULONG gpg_sequence; // Sequence number
|
||||
ULONG gpg_dummy1; // Alignment enforced
|
||||
SINT64 gpg_values[1]; // Generator vector
|
||||
};
|
||||
|
||||
@ -631,9 +640,11 @@ struct blh
|
||||
ULONG blh_length; // Total length of data
|
||||
USHORT blh_sub_type; // Blob sub-type
|
||||
UCHAR blh_charset; // Blob charset (since ODS 11.1)
|
||||
#ifndef ODS_TESTING
|
||||
#ifdef CHECK_BLOB_FIELD_ACCESS_FOR_SELECT
|
||||
USHORT blh_fld_id; // Field ID
|
||||
#endif
|
||||
#endif //ODS_TESTING
|
||||
UCHAR blh_unused;
|
||||
ULONG blh_page[1]; // Page vector for blob pages
|
||||
};
|
||||
@ -705,10 +716,13 @@ inline int IAD_LEN(int count)
|
||||
#define IAD_LEN(count) (sizeof (Ods::InternalArrayDesc) + \
|
||||
(count ? count - 1: count) * sizeof (Ods::InternalArrayDesc::iad_repeat))
|
||||
|
||||
#ifndef ODS_TESTING
|
||||
Firebird::string pagtype(UCHAR type);
|
||||
#endif //ODS_TESTING
|
||||
|
||||
} //namespace Ods
|
||||
|
||||
#ifndef ODS_TESTING
|
||||
// alignment for raw page access
|
||||
const USHORT PAGE_ALIGNMENT = 1024;
|
||||
|
||||
@ -720,5 +734,6 @@ const int MAX_TABLE_VERSIONS = 255;
|
||||
|
||||
// max number of view formats (aka versions), limited by "SSHORT RDB$FORMAT"
|
||||
const int MAX_VIEW_VERSIONS = MAX_SSHORT;
|
||||
#endif //ODS_TESTING
|
||||
|
||||
#endif // JRD_ODS_H
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
namespace Ods {
|
||||
|
||||
bool isSupported(USHORT, USHORT);
|
||||
bool isSupported(const header_page* hdr);
|
||||
|
||||
// NS: ODS code logic should never depend on host platform pointer size.
|
||||
// this is why data type for these things is ULONG (32-bit unsigned integer)
|
||||
|
@ -1230,7 +1230,7 @@ static bool raw_devices_validate_database(int desc, const PathName& file_name)
|
||||
if (hp->hdr_header.pag_type != pag_header /*|| hp->hdr_sequence*/)
|
||||
goto quit;
|
||||
|
||||
if (!Ods::isSupported(hp->hdr_ods_version, hp->hdr_ods_minor))
|
||||
if (!Ods::isSupported(hp))
|
||||
goto quit;
|
||||
|
||||
if (hp->hdr_page_size < MIN_PAGE_SIZE || hp->hdr_page_size > MAX_PAGE_SIZE)
|
||||
|
@ -1264,7 +1264,7 @@ void PAG_header_init(thread_db* tdbb)
|
||||
|
||||
const USHORT ods_version = header->hdr_ods_version & ~ODS_FIREBIRD_FLAG;
|
||||
|
||||
if (!Ods::isSupported(header->hdr_ods_version, header->hdr_ods_minor))
|
||||
if (!Ods::isSupported(header))
|
||||
{
|
||||
ERR_post(Arg::Gds(isc_wrong_ods) << Arg::Str(attachment->att_filename) <<
|
||||
Arg::Num(ods_version) <<
|
||||
|
112
src/misc/ods.awk
Normal file
112
src/misc/ods.awk
Normal file
@ -0,0 +1,112 @@
|
||||
#
|
||||
# PROGRAM: ODS sizes and offsets validation
|
||||
# MODULE: ods.awk
|
||||
# DESCRIPTION: Generates c++ code printing reference sample for ODS strctures
|
||||
#
|
||||
# The contents of this file are subject to the Initial
|
||||
# Developer's Public License Version 1.0 (the "License");
|
||||
# you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
# http://www.firebirdsql.org/en/initial-developer-s-public-license-version-1-0/
|
||||
#
|
||||
# Software distributed under the License is distributed AS IS,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing rights
|
||||
# and limitations under the License.
|
||||
#
|
||||
# The Original Code was created by Alexander Peshkoff
|
||||
# for the Firebird Open Source RDBMS project.
|
||||
#
|
||||
# Copyright (c) 2018 Alexander Peshkoff <peshkoff@mail.ru>
|
||||
# and all contributors signed below.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
# Contributor(s): ______________________________________.
|
||||
#
|
||||
|
||||
BEGIN {
|
||||
st = 0;
|
||||
nm = "";
|
||||
nm2 = "";
|
||||
v2 = "";
|
||||
skip = 0;
|
||||
|
||||
print "#include <stdio.h>"
|
||||
print "#ifdef _MSC_VER"
|
||||
print "#include \"gen/autoconfig_msvc.h\""
|
||||
print "#else"
|
||||
print "#include \"gen/autoconfig.h\""
|
||||
print "#endif"
|
||||
print ""
|
||||
print "#if SIZEOF_VOID_P == 8"
|
||||
print "#define FMT \"l\""
|
||||
print "#else"
|
||||
print "#define FMT \"\""
|
||||
print "#endif"
|
||||
print ""
|
||||
print "#include \"fb_types.h\""
|
||||
print "#define ODS_TESTING"
|
||||
print "#include \"../jrd/ods.h\""
|
||||
print ""
|
||||
print "using namespace Ods;"
|
||||
print ""
|
||||
print "int main() {"
|
||||
}
|
||||
|
||||
($1 == "struct") {
|
||||
++st;
|
||||
if (st <= 2)
|
||||
{
|
||||
if (st == 1)
|
||||
{
|
||||
nm = $2;
|
||||
nm2 = nm;
|
||||
}
|
||||
else
|
||||
{
|
||||
nm2 = nm "::" $2;
|
||||
}
|
||||
v2 = $2 "_";
|
||||
|
||||
print "\tprintf(\"\\n *** " $0 " %\" FMT \"u\\n\", sizeof(" nm2 "));";
|
||||
print "\t" nm2 " " v2 ";";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
($1 == "};") {
|
||||
if (st > 1)
|
||||
{
|
||||
v2 = nm "_";
|
||||
}
|
||||
st--;
|
||||
}
|
||||
|
||||
($1 == "}") {
|
||||
if (st > 1)
|
||||
{
|
||||
st--;
|
||||
v2 = nm "_";
|
||||
}
|
||||
}
|
||||
|
||||
($2 == "ODS_TESTING") { skip = 1; }
|
||||
|
||||
(st > 0 && substr($1, 1, 1) != "#" && $1 != "struct" && skip == 0 && $1 != "//") {
|
||||
m = $2;
|
||||
i = index(m, "[");
|
||||
if (i == 0)
|
||||
i = index(m, ";");
|
||||
if (i > 0)
|
||||
m = substr(m, 1, i - 1);
|
||||
|
||||
if (length(m) > 0)
|
||||
print "\tprintf(\"" m " %\" FMT \"d\\n\", (char*)&" v2 "." m " - (char*)&" v2 ");"
|
||||
}
|
||||
|
||||
($2 == "//ODS_TESTING") { skip = 0; }
|
||||
|
||||
END {
|
||||
print "}"
|
||||
}
|
||||
|
185
src/misc/ods.txt
Normal file
185
src/misc/ods.txt
Normal file
@ -0,0 +1,185 @@
|
||||
|
||||
*** struct pag 16
|
||||
pag_type 0
|
||||
pag_flags 1
|
||||
pag_reserved 2
|
||||
pag_generation 4
|
||||
pag_scn 8
|
||||
pag_pageno 12
|
||||
|
||||
*** struct blob_page 32
|
||||
blp_header 0
|
||||
blp_lead_page 16
|
||||
blp_sequence 20
|
||||
blp_length 24
|
||||
blp_pad 26
|
||||
blp_page 28
|
||||
|
||||
*** struct btree_page 40
|
||||
btr_header 0
|
||||
btr_sibling 16
|
||||
btr_left_sibling 20
|
||||
btr_prefix_total 24
|
||||
btr_relation 28
|
||||
btr_length 30
|
||||
btr_id 32
|
||||
btr_level 33
|
||||
btr_jump_interval 34
|
||||
btr_jump_size 36
|
||||
btr_jump_count 38
|
||||
btr_nodes 39
|
||||
|
||||
*** struct data_page 28
|
||||
dpg_header 0
|
||||
dpg_sequence 16
|
||||
dpg_relation 20
|
||||
dpg_count 22
|
||||
|
||||
*** struct dpg_repeat 4
|
||||
dpg_offset 0
|
||||
dpg_length 2
|
||||
dpg_rpt 24
|
||||
|
||||
*** struct index_root_page 32
|
||||
irt_header 0
|
||||
irt_relation 16
|
||||
irt_count 18
|
||||
|
||||
*** struct irt_repeat 12
|
||||
irt_root 0
|
||||
irt_transaction 4
|
||||
irt_desc 8
|
||||
irt_keys 10
|
||||
irt_flags 11
|
||||
irt_rpt 20
|
||||
|
||||
*** struct irtd 8
|
||||
irtd_field 0
|
||||
irtd_itype 2
|
||||
irtd_selectivity 4
|
||||
|
||||
*** struct header_page 132
|
||||
hdr_header 0
|
||||
hdr_page_size 16
|
||||
hdr_ods_version 18
|
||||
hdr_PAGES 20
|
||||
hdr_next_page 24
|
||||
hdr_oldest_transaction 28
|
||||
hdr_oldest_active 32
|
||||
hdr_next_transaction 36
|
||||
hdr_sequence 40
|
||||
hdr_flags 42
|
||||
hdr_creation_date 44
|
||||
hdr_attachment_id 52
|
||||
hdr_shadow_count 56
|
||||
hdr_cpu 60
|
||||
hdr_os 61
|
||||
hdr_cc 62
|
||||
hdr_compatibility_flags 63
|
||||
hdr_ods_minor 64
|
||||
hdr_end 66
|
||||
hdr_page_buffers 68
|
||||
hdr_oldest_snapshot 72
|
||||
hdr_backup_pages 76
|
||||
hdr_crypt_page 80
|
||||
hdr_crypt_plugin 84
|
||||
hdr_att_high 116
|
||||
hdr_tra_high 120
|
||||
hdr_data 128
|
||||
|
||||
*** struct page_inv_page 32
|
||||
pip_header 0
|
||||
pip_min 16
|
||||
pip_extent 20
|
||||
pip_used 24
|
||||
pip_bits 28
|
||||
|
||||
*** struct scns_page 24
|
||||
scn_header 0
|
||||
scn_sequence 16
|
||||
scn_pages 20
|
||||
|
||||
*** struct pointer_page 36
|
||||
ppg_header 0
|
||||
ppg_sequence 16
|
||||
ppg_next 20
|
||||
ppg_count 24
|
||||
ppg_relation 26
|
||||
ppg_min_space 28
|
||||
ppg_page 32
|
||||
|
||||
*** struct tx_inv_page 24
|
||||
tip_header 0
|
||||
tip_next 16
|
||||
tip_transactions 20
|
||||
|
||||
*** struct generator_page 32
|
||||
gpg_header 0
|
||||
gpg_sequence 16
|
||||
gpg_dummy1 20
|
||||
gpg_values 24
|
||||
|
||||
*** struct rhd 16
|
||||
rhd_transaction 0
|
||||
rhd_b_page 4
|
||||
rhd_b_line 8
|
||||
rhd_flags 10
|
||||
rhd_format 12
|
||||
rhd_data 13
|
||||
|
||||
*** struct rhde 20
|
||||
rhde_transaction 0
|
||||
rhde_b_page 4
|
||||
rhde_b_line 8
|
||||
rhde_flags 10
|
||||
rhde_format 12
|
||||
rhde_tra_high 14
|
||||
rhde_data 16
|
||||
|
||||
*** struct rhdf 24
|
||||
rhdf_transaction 0
|
||||
rhdf_b_page 4
|
||||
rhdf_b_line 8
|
||||
rhdf_flags 10
|
||||
rhdf_format 12
|
||||
rhdf_tra_high 14
|
||||
rhdf_f_page 16
|
||||
rhdf_f_line 20
|
||||
rhdf_data 22
|
||||
|
||||
*** struct blh 32
|
||||
blh_lead_page 0
|
||||
blh_max_sequence 4
|
||||
blh_max_segment 8
|
||||
blh_flags 10
|
||||
blh_level 12
|
||||
blh_count 16
|
||||
blh_length 20
|
||||
blh_sub_type 24
|
||||
blh_charset 26
|
||||
blh_unused 27
|
||||
blh_page 28
|
||||
|
||||
*** struct Descriptor 12
|
||||
dsc_dtype 0
|
||||
dsc_scale 1
|
||||
dsc_length 2
|
||||
dsc_sub_type 4
|
||||
dsc_flags 6
|
||||
dsc_offset 8
|
||||
|
||||
*** struct InternalArrayDesc 40
|
||||
iad_version 0
|
||||
iad_dimensions 1
|
||||
iad_struct_count 2
|
||||
iad_element_length 4
|
||||
iad_length 6
|
||||
iad_count 8
|
||||
iad_total_length 12
|
||||
|
||||
*** struct iad_repeat 24
|
||||
iad_desc 0
|
||||
iad_length 12
|
||||
iad_lower 16
|
||||
iad_upper 20
|
||||
iad_rpt 16
|
@ -620,7 +620,7 @@ int gstat(Firebird::UtilSvc* uSvc)
|
||||
|
||||
uSvc->started();
|
||||
|
||||
if (!Ods::isSupported(header->hdr_ods_version, header->hdr_ods_minor))
|
||||
if (!Ods::isSupported(header))
|
||||
{
|
||||
const int oversion = (header->hdr_ods_version & ~ODS_FIREBIRD_FLAG);
|
||||
dba_error(3, SafeArg() << ODS_VERSION << oversion);
|
||||
|
@ -1089,7 +1089,7 @@ void NBackup::backup_database(int level, Guid& guid, const PathName& fname)
|
||||
if (read_file(dbase, header, SECTOR_ALIGNMENT/*sizeof(*header)*/) != SECTOR_ALIGNMENT/*sizeof(*header)*/)
|
||||
status_exception::raise(Arg::Gds(isc_nbackup_err_eofhdrdb) << dbname.c_str() << Arg::Num(1));
|
||||
|
||||
if (!Ods::isSupported(header->hdr_ods_version, header->hdr_ods_minor))
|
||||
if (!Ods::isSupported(header))
|
||||
{
|
||||
const USHORT ods_version = header->hdr_ods_version & ~ODS_FIREBIRD_FLAG;
|
||||
status_exception::raise(Arg::Gds(isc_wrong_ods) << Arg::Str(database.c_str()) <<
|
||||
|
Loading…
Reference in New Issue
Block a user