summaryrefslogtreecommitdiff
path: root/storage/innobase/include/mach0data.h
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/include/mach0data.h')
-rw-r--r--storage/innobase/include/mach0data.h141
1 files changed, 61 insertions, 80 deletions
diff --git a/storage/innobase/include/mach0data.h b/storage/innobase/include/mach0data.h
index 9859def0adc..07e23139542 100644
--- a/storage/innobase/include/mach0data.h
+++ b/storage/innobase/include/mach0data.h
@@ -30,7 +30,7 @@ Created 11/28/1995 Heikki Tuuri
#ifndef UNIV_INNOCHECKSUM
#include "univ.i"
-#include "ut0byte.h"
+#include "mtr0types.h"
/* The data and all fields are always stored in a database file
in the same format: ascii, big-endian, ... .
@@ -47,7 +47,7 @@ mach_write_to_1(
ulint n); /*!< in: ulint integer to be stored, >= 0, < 256 */
/********************************************************//**
The following function is used to fetch data from one byte.
-@return ulint integer, >= 0, < 256 */
+@return ulint integer, >= 0, < 256 */
UNIV_INLINE
ulint
mach_read_from_1(
@@ -66,7 +66,7 @@ mach_write_to_2(
/********************************************************//**
The following function is used to fetch data from two consecutive
bytes. The most significant byte is at the lowest address.
-@return ulint integer, >= 0, < 64k */
+@return ulint integer, >= 0, < 64k */
UNIV_INLINE
ulint
mach_read_from_2(
@@ -78,7 +78,7 @@ mach_read_from_2(
The following function is used to convert a 16-bit data item
to the canonical format, for fast bytewise equality test
against memory.
-@return 16-bit integer in canonical format */
+@return 16-bit integer in canonical format */
UNIV_INLINE
uint16
mach_encode_2(
@@ -89,7 +89,7 @@ mach_encode_2(
The following function is used to convert a 16-bit data item
from the canonical format, for fast bytewise equality test
against memory.
-@return integer in machine-dependent format */
+@return integer in machine-dependent format */
UNIV_INLINE
ulint
mach_decode_2(
@@ -108,7 +108,7 @@ mach_write_to_3(
/********************************************************//**
The following function is used to fetch data from 3 consecutive
bytes. The most significant byte is at the lowest address.
-@return ulint integer */
+@return ulint integer */
UNIV_INLINE
ulint
mach_read_from_3(
@@ -127,7 +127,7 @@ mach_write_to_4(
/********************************************************//**
The following function is used to fetch data from 4 consecutive
bytes. The most significant byte is at the lowest address.
-@return ulint integer */
+@return ulint integer */
UNIV_INLINE
ulint
mach_read_from_4(
@@ -136,7 +136,7 @@ mach_read_from_4(
MY_ATTRIBUTE((nonnull, pure));
/*********************************************************//**
Writes a ulint in a compressed form (1..5 bytes).
-@return stored size in bytes */
+@return stored size in bytes */
UNIV_INLINE
ulint
mach_write_compressed(
@@ -145,21 +145,21 @@ mach_write_compressed(
ulint n); /*!< in: ulint integer to be stored */
/*********************************************************//**
Returns the size of an ulint when written in the compressed form.
-@return compressed size in bytes */
+@return compressed size in bytes */
UNIV_INLINE
ulint
mach_get_compressed_size(
/*=====================*/
ulint n) /*!< in: ulint integer to be stored */
MY_ATTRIBUTE((const));
-/*********************************************************//**
-Reads a ulint in a compressed form.
-@return read integer */
-UNIV_INLINE
-ulint
-mach_read_compressed(
-/*=================*/
- const byte* b) /*!< in: pointer to memory from where to read */
+/** Read a 32-bit integer in a compressed form.
+@param[in,out] b pointer to memory where to read;
+advanced by the number of bytes consumed
+@return unsigned value */
+UNIV_INLINE
+ib_uint32_t
+mach_read_next_compressed(
+ const byte** b)
MY_ATTRIBUTE((nonnull, pure));
/*******************************************************//**
The following function is used to store data in 6 consecutive
@@ -173,7 +173,7 @@ mach_write_to_6(
/********************************************************//**
The following function is used to fetch data from 6 consecutive
bytes. The most significant byte is at the lowest address.
-@return 48-bit integer */
+@return 48-bit integer */
UNIV_INLINE
ib_uint64_t
mach_read_from_6(
@@ -192,7 +192,7 @@ mach_write_to_7(
/********************************************************//**
The following function is used to fetch data from 7 consecutive
bytes. The most significant byte is at the lowest address.
-@return 56-bit integer */
+@return 56-bit integer */
UNIV_INLINE
ib_uint64_t
mach_read_from_7(
@@ -211,7 +211,7 @@ mach_write_to_8(
/********************************************************//**
The following function is used to fetch data from 8 consecutive
bytes. The most significant byte is at the lowest address.
-@return 64-bit integer */
+@return 64-bit integer */
UNIV_INLINE
ib_uint64_t
mach_read_from_8(
@@ -220,82 +220,62 @@ mach_read_from_8(
MY_ATTRIBUTE((nonnull, pure));
/*********************************************************//**
Writes a 64-bit integer in a compressed form (5..9 bytes).
-@return size in bytes */
+@return size in bytes */
UNIV_INLINE
ulint
-mach_ull_write_compressed(
+mach_u64_write_compressed(
/*======================*/
byte* b, /*!< in: pointer to memory where to store */
ib_uint64_t n); /*!< in: 64-bit integer to be stored */
-/*********************************************************//**
-Returns the size of a 64-bit integer when written in the compressed form.
-@return compressed size in bytes */
-UNIV_INLINE
-ulint
-mach_ull_get_compressed_size(
-/*=========================*/
- ib_uint64_t n); /*!< in: 64-bit integer to be stored */
-/*********************************************************//**
-Reads a 64-bit integer in a compressed form.
-@return the value read */
+/** Read a 64-bit integer in a compressed form.
+@param[in,out] b pointer to memory where to read;
+advanced by the number of bytes consumed
+@return unsigned value */
UNIV_INLINE
ib_uint64_t
-mach_ull_read_compressed(
-/*=====================*/
- const byte* b) /*!< in: pointer to memory from where to read */
- MY_ATTRIBUTE((nonnull, pure));
+mach_u64_read_next_compressed(
+ const byte** b);
/*********************************************************//**
Writes a 64-bit integer in a compressed form (1..11 bytes).
-@return size in bytes */
+@return size in bytes */
UNIV_INLINE
ulint
-mach_ull_write_much_compressed(
+mach_u64_write_much_compressed(
/*===========================*/
byte* b, /*!< in: pointer to memory where to store */
ib_uint64_t n); /*!< in: 64-bit integer to be stored */
/*********************************************************//**
-Returns the size of a 64-bit integer when written in the compressed form.
-@return compressed size in bytes */
-UNIV_INLINE
-ulint
-mach_ull_get_much_compressed_size(
-/*==============================*/
- ib_uint64_t n) /*!< in: 64-bit integer to be stored */
- MY_ATTRIBUTE((const));
-/*********************************************************//**
Reads a 64-bit integer in a compressed form.
-@return the value read */
+@return the value read */
UNIV_INLINE
ib_uint64_t
-mach_ull_read_much_compressed(
+mach_u64_read_much_compressed(
/*==========================*/
const byte* b) /*!< in: pointer to memory from where to read */
MY_ATTRIBUTE((nonnull, pure));
-/*********************************************************//**
-Reads a ulint in a compressed form if the log record fully contains it.
-@return pointer to end of the stored field, NULL if not complete */
-UNIV_INTERN
-byte*
+/** Read a 32-bit integer in a compressed form.
+@param[in,out] ptr pointer to memory where to read;
+advanced by the number of bytes consumed, or set NULL if out of space
+@param[in] end_ptr end of the buffer
+@return unsigned value */
+ib_uint32_t
mach_parse_compressed(
-/*==================*/
- byte* ptr, /*!< in: pointer to buffer from where to read */
- byte* end_ptr,/*!< in: pointer to end of the buffer */
- ulint* val); /*!< out: read value */
-/*********************************************************//**
-Reads a 64-bit integer in a compressed form
-if the log record fully contains it.
-@return pointer to end of the stored field, NULL if not complete */
+ const byte** ptr,
+ const byte* end_ptr);
+/** Read a 64-bit integer in a compressed form.
+@param[in,out] ptr pointer to memory where to read;
+advanced by the number of bytes consumed, or set NULL if out of space
+@param[in] end_ptr end of the buffer
+@return unsigned value */
UNIV_INLINE
-byte*
-mach_ull_parse_compressed(
-/*======================*/
- byte* ptr, /*!< in: pointer to buffer from where to read */
- byte* end_ptr,/*!< in: pointer to end of the buffer */
- ib_uint64_t* val); /*!< out: read value */
+ib_uint64_t
+mach_u64_parse_compressed(
+ const byte** ptr,
+ const byte* end_ptr);
#ifndef UNIV_HOTBACKUP
/*********************************************************//**
Reads a double. It is stored in a little-endian format.
-@return double read */
+@return double read */
UNIV_INLINE
double
mach_double_read(
@@ -312,7 +292,7 @@ mach_double_write(
double d); /*!< in: double */
/*********************************************************//**
Reads a float. It is stored in a little-endian format.
-@return float read */
+@return float read */
UNIV_INLINE
float
mach_float_read(
@@ -329,7 +309,7 @@ mach_float_write(
float d); /*!< in: float */
/*********************************************************//**
Reads a ulint stored in the little-endian format.
-@return unsigned long int */
+@return unsigned long int */
UNIV_INLINE
ulint
mach_read_from_n_little_endian(
@@ -348,7 +328,7 @@ mach_write_to_n_little_endian(
ulint n); /*!< in: unsigned long int to write */
/*********************************************************//**
Reads a ulint stored in the little-endian format.
-@return unsigned long int */
+@return unsigned long int */
UNIV_INLINE
ulint
mach_read_from_2_little_endian(
@@ -366,7 +346,7 @@ mach_write_to_2_little_endian(
/*********************************************************//**
Convert integral type from storage byte order (big endian) to
host byte order.
-@return integer value */
+@return integer value */
UNIV_INLINE
ib_uint64_t
mach_read_int_type(
@@ -398,15 +378,16 @@ mach_write_ulonglong(
ulint len, /*!< in: length of dest */
bool usign); /*!< in: signed or unsigned flag */
-/********************************************************//**
-Reads 1 - 4 bytes from a file page buffered in the buffer pool.
-@return value read */
+/** Read 1 to 4 bytes from a file page buffered in the buffer pool.
+@param[in] ptr pointer where to read
+@param[in] type MLOG_1BYTE, MLOG_2BYTES, or MLOG_4BYTES
+@return value read */
UNIV_INLINE
ulint
mach_read_ulint(
-/*============*/
- const byte* ptr, /*!< in: pointer from where to read */
- ulint type); /*!< in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */
+ const byte* ptr,
+ mlog_id_t type)
+ __attribute__((warn_unused_result));
#endif /* !UNIV_HOTBACKUP */
#endif /* !UNIV_INNOCHECKSUM */