mirror of
https://github.com/MariaDB/server.git
synced 2025-01-28 17:54:16 +01:00
Cleanup: Replace ut_crc32c(x,y) with my_crc32c(0,x,y)
This commit is contained in:
parent
685d958e38
commit
5d54fd611f
7 changed files with 20 additions and 61 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2014, 2021, MariaDB Corporation.
|
||||
Copyright (c) 2014, 2022, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -48,7 +48,6 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */
|
|||
#include "buf0buf.h" /* buf_page_is_corrupted */
|
||||
#include "page0zip.h" /* page_zip_*() */
|
||||
#include "trx0undo.h" /* TRX_* */
|
||||
#include "ut0crc32.h" /* ut_crc32_init() */
|
||||
#include "fil0crypt.h" /* fil_space_verify_crypt_checksum */
|
||||
|
||||
#include <string.h>
|
||||
|
@ -629,7 +628,7 @@ static bool update_checksum(byte* page, uint32_t flags)
|
|||
} else if (use_full_crc32) {
|
||||
ulint payload = buf_page_full_crc32_size(page, NULL, NULL)
|
||||
- FIL_PAGE_FCRC32_CHECKSUM;
|
||||
checksum = ut_crc32(page, payload);
|
||||
checksum = my_crc32c(0, page, payload);
|
||||
byte* c = page + payload;
|
||||
if (mach_read_from_4(c) == checksum) return false;
|
||||
mach_write_to_4(c, checksum);
|
||||
|
|
|
@ -36,10 +36,11 @@ Created 11/5/1995 Heikki Tuuri
|
|||
#include "mach0data.h"
|
||||
#include "buf0buf.h"
|
||||
#include "buf0checksum.h"
|
||||
#include "ut0crc32.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
#include "my_sys.h"
|
||||
#else
|
||||
#include "my_cpu.h"
|
||||
#include "mem0mem.h"
|
||||
#include "btr0btr.h"
|
||||
|
@ -608,8 +609,8 @@ bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf,
|
|||
}
|
||||
});
|
||||
|
||||
if (crc32 != ut_crc32(read_buf,
|
||||
size - FIL_PAGE_FCRC32_CHECKSUM)) {
|
||||
if (crc32 != my_crc32c(0, read_buf,
|
||||
size - FIL_PAGE_FCRC32_CHECKSUM)) {
|
||||
return true;
|
||||
}
|
||||
static_assert(FIL_PAGE_FCRC32_KEY_VERSION == 0, "alignment");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2021, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2022, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -26,7 +26,6 @@ Created Aug 11, 2011 Vasil Dimov
|
|||
|
||||
#include "buf0checksum.h"
|
||||
#include "fil0fil.h"
|
||||
#include "ut0crc32.h"
|
||||
#include "ut0rnd.h"
|
||||
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
|
@ -46,12 +45,12 @@ uint32_t buf_calc_page_crc32(const byte* page)
|
|||
should be combined with the CRC-32 function, not with
|
||||
exclusive OR. We stick to the current algorithm in order to
|
||||
remain compatible with old data files. */
|
||||
return ut_crc32(page + FIL_PAGE_OFFSET,
|
||||
FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
|
||||
- FIL_PAGE_OFFSET)
|
||||
^ ut_crc32(page + FIL_PAGE_DATA,
|
||||
srv_page_size
|
||||
- (FIL_PAGE_DATA + FIL_PAGE_END_LSN_OLD_CHKSUM));
|
||||
return my_crc32c(0, page + FIL_PAGE_OFFSET,
|
||||
FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
|
||||
- FIL_PAGE_OFFSET)
|
||||
^ my_crc32c(0, page + FIL_PAGE_DATA,
|
||||
srv_page_size
|
||||
- (FIL_PAGE_DATA + FIL_PAGE_END_LSN_OLD_CHKSUM));
|
||||
}
|
||||
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2016, 2020, MariaDB Corporation.
|
||||
|
||||
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 Street, Fifth Floor, Boston, MA 02110-1335 USA
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/**************************************************//**
|
||||
@file include/ut0crc32.h
|
||||
CRC32 implementation
|
||||
|
||||
Created Aug 10, 2011 Vasil Dimov
|
||||
*******************************************************/
|
||||
|
||||
#ifndef ut0crc32_h
|
||||
#define ut0crc32_h
|
||||
|
||||
#include "univ.i"
|
||||
#include <my_sys.h>
|
||||
static inline uint32_t ut_crc32(const byte *s, size_t size)
|
||||
{
|
||||
return my_crc32c(0, s, size);
|
||||
}
|
||||
|
||||
#endif /* ut0crc32_h */
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2012, Facebook Inc.
|
||||
Copyright (c) 2014, 2021, MariaDB Corporation.
|
||||
Copyright (c) 2014, 2022, MariaDB Corporation.
|
||||
|
||||
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
|
||||
|
@ -29,7 +29,6 @@ Created June 2005 by Marko Makela
|
|||
#include "fsp0types.h"
|
||||
#include "page0page.h"
|
||||
#include "buf0checksum.h"
|
||||
#include "ut0crc32.h"
|
||||
#include "zlib.h"
|
||||
#include "span.h"
|
||||
|
||||
|
@ -4605,11 +4604,11 @@ uint32_t page_zip_calc_checksum(const void *data, size_t size, bool use_adler)
|
|||
ut_ad(size > FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
|
||||
|
||||
if (!use_adler) {
|
||||
return ut_crc32(s + FIL_PAGE_OFFSET,
|
||||
FIL_PAGE_LSN - FIL_PAGE_OFFSET)
|
||||
^ ut_crc32(s + FIL_PAGE_TYPE, 2)
|
||||
^ ut_crc32(s + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
|
||||
size - FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
|
||||
return my_crc32c(0, s + FIL_PAGE_OFFSET,
|
||||
FIL_PAGE_LSN - FIL_PAGE_OFFSET)
|
||||
^ my_crc32c(0, s + FIL_PAGE_TYPE, 2)
|
||||
^ my_crc32c(0, s + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
|
||||
size - FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
|
||||
} else {
|
||||
adler = adler32(0L, s + FIL_PAGE_OFFSET,
|
||||
FIL_PAGE_LSN - FIL_PAGE_OFFSET);
|
||||
|
|
|
@ -61,7 +61,6 @@ Created 10/8/1995 Heikki Tuuri
|
|||
#include "srv0start.h"
|
||||
#include "trx0i_s.h"
|
||||
#include "trx0purge.h"
|
||||
#include "ut0crc32.h"
|
||||
#include "btr0defragment.h"
|
||||
#include "ut0mem.h"
|
||||
#include "fil0fil.h"
|
||||
|
|
|
@ -97,7 +97,6 @@ Created 2/16/1996 Heikki Tuuri
|
|||
#include "row0mysql.h"
|
||||
#include "btr0pcur.h"
|
||||
#include "zlib.h"
|
||||
#include "ut0crc32.h"
|
||||
#include "log.h"
|
||||
|
||||
/** We are prepared for a situation that we have this many threads waiting for
|
||||
|
|
Loading…
Add table
Reference in a new issue