1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <signaldata/SignalData.hpp>
#include "diskpage.hpp"
#include <NdbOut.hpp>
#include <version.h>
#include <time.h>
void
File_formats::Zero_page_header::init(File_type ft,
Uint32 node_id,
Uint32 version,
Uint32 now)
{
memcpy(m_magic, "NDBDISK", 8);
m_byte_order = 0x12345678;
m_page_size = File_formats::NDB_PAGE_SIZE;
m_ndb_version = version;
m_node_id = node_id;
m_file_type = ft;
m_time = now;
}
int
File_formats::Zero_page_header::validate(File_type ft,
Uint32 node_id,
Uint32 version,
Uint32 now)
{
return 0; // TODO Check header
}
NdbOut&
operator<<(NdbOut& out, const File_formats::Zero_page_header& obj)
{
char buf[256];
out << "page size: " << obj.m_page_size << endl;
out << "ndb version: " << obj.m_ndb_version << ", " <<
getVersionString(obj.m_ndb_version, 0, buf, sizeof(buf)) << endl;
out << "ndb node id: " << obj.m_node_id << endl;
out << "file type: " << obj.m_file_type << endl;
out << "time: " << obj.m_time << ", "
<< ctime((time_t*)&obj.m_time)<< endl;
return out;
}
NdbOut&
operator<<(NdbOut& out, const File_formats::Datafile::Zero_page& obj)
{
out << obj.m_page_header << endl;
out << "m_file_no: " << obj.m_file_no << endl;
out << "m_tablespace_id: " << obj.m_tablespace_id << endl;
out << "m_tablespace_version: " << obj.m_tablespace_version << endl;
out << "m_data_pages: " << obj.m_data_pages << endl;
out << "m_extent_pages: " << obj.m_extent_pages << endl;
out << "m_extent_size: " << obj.m_extent_size << endl;
out << "m_extent_count: " << obj.m_extent_count << endl;
out << "m_extent_headers_per_page: " << obj.m_extent_headers_per_page << endl;
out << "m_extent_header_words: " << obj.m_extent_header_words << endl;
out << "m_extent_header_bits_per_page: " << obj.m_extent_header_bits_per_page << endl;
return out;
}
NdbOut&
operator<<(NdbOut& out, const File_formats::Undofile::Zero_page& obj)
{
out << obj.m_page_header << endl;
out << "m_file_id: " << obj.m_file_id << endl;
out << "m_logfile_group_id: " << obj.m_logfile_group_id << endl;
out << "m_logfile_group_version: " << obj.m_logfile_group_version << endl;
out << "m_undo_pages: " << obj.m_undo_pages << endl;
return out;
}
|