summaryrefslogtreecommitdiff
path: root/storage/innobase/fil
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-05-07 17:15:34 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-05-07 17:15:34 +0300
commit18a62eb76df0cc0bece66ba29c354c613f58e944 (patch)
tree7bd7c36be88a9cc5a1f5181938de58f8b775575b /storage/innobase/fil
parentba573c4736f908a6525acddb7573cc7d818eaa25 (diff)
downloadmariadb-git-18a62eb76df0cc0bece66ba29c354c613f58e944.tar.gz
MDEV-21133 follow-up: Use fil_page_get_type()
Let us use the common accessor function fil_page_get_type() instead of accessing the page header field FIL_PAGE_TYPE directly.
Diffstat (limited to 'storage/innobase/fil')
-rw-r--r--storage/innobase/fil/fil0crypt.cc14
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc3
2 files changed, 7 insertions, 10 deletions
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index fa643e88a68..e253b692778 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -455,8 +455,8 @@ static byte* fil_encrypt_buf_for_non_full_checksum(
ut_ad(!ut_align_offset(src_frame, 8));
ut_ad(!ut_align_offset(dst_frame, 8));
- ulint orig_page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
- ibool page_compressed = (orig_page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
+ const bool page_compressed = fil_page_get_type(src_frame)
+ == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED;
uint header_len = FIL_PAGE_DATA;
if (page_compressed) {
@@ -609,9 +609,9 @@ byte* fil_encrypt_buf(
@return true if it is valid page type */
static bool fil_space_encrypt_valid_page_type(
const fil_space_t* space,
- byte* src_frame)
+ const byte* src_frame)
{
- switch (mach_read_from_2(src_frame+FIL_PAGE_TYPE)) {
+ switch (fil_page_get_type(src_frame)) {
case FIL_PAGE_RTREE:
return space->full_crc32();
case FIL_PAGE_TYPE_FSP_HDR:
@@ -735,10 +735,9 @@ static bool fil_space_decrypt_for_non_full_checksum(
byte* src_frame,
dberr_t* err)
{
- ulint page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
uint key_version = mach_read_from_4(
src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
- bool page_compressed = (page_type
+ bool page_compressed = (fil_page_get_type(src_frame)
== FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
uint offset = mach_read_from_4(src_frame + FIL_PAGE_OFFSET);
uint space = mach_read_from_4(
@@ -2439,8 +2438,7 @@ bool fil_space_verify_crypt_checksum(const byte* page, ulint zip_size)
/* Compressed and encrypted pages do not have checksum. Assume not
corrupted. Page verification happens after decompression in
buf_page_io_complete() using buf_page_is_corrupted(). */
- if (mach_read_from_2(page + FIL_PAGE_TYPE)
- == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
+ if (fil_page_get_type(page) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
return true;
}
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index b800f12d6c7..d3cdacf5125 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -581,10 +581,9 @@ ulint fil_page_decompress_for_non_full_crc32(
byte* tmp_buf,
byte* buf)
{
- const unsigned ptype = mach_read_from_2(buf+FIL_PAGE_TYPE);
ulint header_len;
uint comp_algo;
- switch (ptype) {
+ switch (fil_page_get_type(buf)) {
case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED:
header_len= FIL_PAGE_DATA + FIL_PAGE_ENCRYPT_COMP_METADATA_LEN;
comp_algo = mach_read_from_2(