1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00
pgbackrest/libc/xs/postgres/pageChecksum.xs
David Steele 9d78948a14 Improvements to page checksum module and tests:
* Page checksum module uses new C error handler.
* Convert page checksum tests into C unit tests.
2017-10-16 11:03:06 -04:00

62 lines
1.5 KiB
Plaintext

# ----------------------------------------------------------------------------------------------------------------------------------
# Page Checksum Perl Exports
# ----------------------------------------------------------------------------------------------------------------------------------
MODULE = pgBackRest::LibC PACKAGE = pgBackRest::LibC
U16
pageChecksum(page, blockNo, pageSize)
const char *page
U32 blockNo
U32 pageSize
CODE:
RETVAL = 0;
ERROR_XS_BEGIN()
{
RETVAL = pageChecksum(
(const unsigned char *)page, blockNo, pageSize);
}
ERROR_XS_END();
OUTPUT:
RETVAL
bool
pageChecksumTest(page, blockNo, pageSize, ignoreWalId, ignoreWalOffset)
const char *page
U32 blockNo
U32 pageSize
U32 ignoreWalId
U32 ignoreWalOffset
CODE:
RETVAL = false;
ERROR_XS_BEGIN()
{
RETVAL = pageChecksumTest(
(const unsigned char *)page, blockNo, pageSize, ignoreWalId, ignoreWalOffset);
}
ERROR_XS_END();
OUTPUT:
RETVAL
bool
pageChecksumBufferTest(pageBuffer, pageBufferSize, blockNoBegin, pageSize, ignoreWalId, ignoreWalOffset)
const char *pageBuffer
U32 pageBufferSize
U32 blockNoBegin
U32 pageSize
U32 ignoreWalId
U32 ignoreWalOffset
CODE:
RETVAL = false;
ERROR_XS_BEGIN()
{
RETVAL = pageChecksumBufferTest(
(const unsigned char *)pageBuffer, pageBufferSize, blockNoBegin, pageSize, ignoreWalId, ignoreWalOffset);
}
ERROR_XS_END();
OUTPUT:
RETVAL