Commit 6ee593b1 authored by marko's avatar marko

branches/zip: Add const qualifiers to read-only pointers.

rec_get_nth_field_offs_old(): Split from rec_get_nth_field_old().

rec_get_nth_field_old(): Reimplement as a constness-preserving macro.

dict_drop_index_tree(), dict_truncate_index_tree(): Note that rec is
an in/out parameter, as the B-tree root page number will be updated.
parent 92f2a680
...@@ -2831,8 +2831,8 @@ static ...@@ -2831,8 +2831,8 @@ static
void void
btr_index_rec_validate_report( btr_index_rec_validate_report(
/*==========================*/ /*==========================*/
page_t* page, /* in: index page */ const page_t* page, /* in: index page */
rec_t* rec, /* in: index record */ const rec_t* rec, /* in: index record */
dict_index_t* index) /* in: index */ dict_index_t* index) /* in: index */
{ {
fputs("InnoDB: Record in ", stderr); fputs("InnoDB: Record in ", stderr);
......
...@@ -647,13 +647,13 @@ Drops the index tree associated with a row in SYS_INDEXES table. */ ...@@ -647,13 +647,13 @@ Drops the index tree associated with a row in SYS_INDEXES table. */
void void
dict_drop_index_tree( dict_drop_index_tree(
/*=================*/ /*=================*/
rec_t* rec, /* in: record in the clustered index of SYS_INDEXES rec_t* rec, /* in/out: record in the clustered index
table */ of SYS_INDEXES table */
mtr_t* mtr) /* in: mtr having the latch on the record page */ mtr_t* mtr) /* in: mtr having the latch on the record page */
{ {
ulint root_page_no; ulint root_page_no;
ulint space; ulint space;
byte* ptr; const byte* ptr;
ulint len; ulint len;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -714,7 +714,7 @@ dict_truncate_index_tree( ...@@ -714,7 +714,7 @@ dict_truncate_index_tree(
/* out: new root page number, or /* out: new root page number, or
FIL_NULL on failure */ FIL_NULL on failure */
dict_table_t* table, /* in: the table the index belongs to */ dict_table_t* table, /* in: the table the index belongs to */
rec_t* rec, /* in: record in the clustered index of rec_t* rec, /* in/out: record in the clustered index of
SYS_INDEXES table */ SYS_INDEXES table */
mtr_t* mtr) /* in: mtr having the latch mtr_t* mtr) /* in: mtr having the latch
on the record page. The mtr may be on the record page. The mtr may be
...@@ -724,7 +724,7 @@ dict_truncate_index_tree( ...@@ -724,7 +724,7 @@ dict_truncate_index_tree(
ulint space; ulint space;
ulint type; ulint type;
dulint index_id; dulint index_id;
byte* ptr; const byte* ptr;
ulint len; ulint len;
ulint comp; ulint comp;
dict_index_t* index; dict_index_t* index;
......
...@@ -62,8 +62,8 @@ dict_get_first_table_name_in_db( ...@@ -62,8 +62,8 @@ dict_get_first_table_name_in_db(
dtuple_t* tuple; dtuple_t* tuple;
mem_heap_t* heap; mem_heap_t* heap;
dfield_t* dfield; dfield_t* dfield;
rec_t* rec; const rec_t* rec;
byte* field; const byte* field;
ulint len; ulint len;
mtr_t mtr; mtr_t mtr;
...@@ -143,8 +143,8 @@ dict_print(void) ...@@ -143,8 +143,8 @@ dict_print(void)
dict_index_t* sys_index; dict_index_t* sys_index;
dict_table_t* table; dict_table_t* table;
btr_pcur_t pcur; btr_pcur_t pcur;
rec_t* rec; const rec_t* rec;
byte* field; const byte* field;
ulint len; ulint len;
mtr_t mtr; mtr_t mtr;
...@@ -233,9 +233,9 @@ dict_sys_tables_get_zip_size( ...@@ -233,9 +233,9 @@ dict_sys_tables_get_zip_size(
/* out: compressed page size in kilobytes; /* out: compressed page size in kilobytes;
or 0 if the tablespace is uncompressed, or 0 if the tablespace is uncompressed,
ULINT_UNDEFINED on error */ ULINT_UNDEFINED on error */
rec_t* rec) /* in: a record of SYS_TABLES */ const rec_t* rec) /* in: a record of SYS_TABLES */
{ {
byte* field; const byte* field;
ulint len; ulint len;
ulint n_cols; ulint n_cols;
ulint table_type; ulint table_type;
...@@ -280,7 +280,7 @@ dict_check_tablespaces_and_store_max_id( ...@@ -280,7 +280,7 @@ dict_check_tablespaces_and_store_max_id(
dict_table_t* sys_tables; dict_table_t* sys_tables;
dict_index_t* sys_index; dict_index_t* sys_index;
btr_pcur_t pcur; btr_pcur_t pcur;
rec_t* rec; const rec_t* rec;
ulint max_space_id = 0; ulint max_space_id = 0;
mtr_t mtr; mtr_t mtr;
...@@ -320,7 +320,7 @@ dict_check_tablespaces_and_store_max_id( ...@@ -320,7 +320,7 @@ dict_check_tablespaces_and_store_max_id(
if (!rec_get_deleted_flag(rec, 0)) { if (!rec_get_deleted_flag(rec, 0)) {
/* We found one */ /* We found one */
byte* field; const byte* field;
ulint len; ulint len;
ulint space_id; ulint space_id;
ulint zip_size_in_k; ulint zip_size_in_k;
...@@ -386,8 +386,8 @@ dict_load_columns( ...@@ -386,8 +386,8 @@ dict_load_columns(
btr_pcur_t pcur; btr_pcur_t pcur;
dtuple_t* tuple; dtuple_t* tuple;
dfield_t* dfield; dfield_t* dfield;
rec_t* rec; const rec_t* rec;
byte* field; const byte* field;
ulint len; ulint len;
byte* buf; byte* buf;
char* name; char* name;
...@@ -515,8 +515,8 @@ dict_load_fields( ...@@ -515,8 +515,8 @@ dict_load_fields(
dfield_t* dfield; dfield_t* dfield;
ulint pos_and_prefix_len; ulint pos_and_prefix_len;
ulint prefix_len; ulint prefix_len;
rec_t* rec; const rec_t* rec;
byte* field; const byte* field;
ulint len; ulint len;
byte* buf; byte* buf;
ulint i; ulint i;
...@@ -616,8 +616,8 @@ dict_load_indexes( ...@@ -616,8 +616,8 @@ dict_load_indexes(
btr_pcur_t pcur; btr_pcur_t pcur;
dtuple_t* tuple; dtuple_t* tuple;
dfield_t* dfield; dfield_t* dfield;
rec_t* rec; const rec_t* rec;
byte* field; const byte* field;
ulint len; ulint len;
ulint name_len; ulint name_len;
char* name_buf; char* name_buf;
...@@ -789,8 +789,8 @@ dict_load_table( ...@@ -789,8 +789,8 @@ dict_load_table(
dtuple_t* tuple; dtuple_t* tuple;
mem_heap_t* heap; mem_heap_t* heap;
dfield_t* dfield; dfield_t* dfield;
rec_t* rec; const rec_t* rec;
byte* field; const byte* field;
ulint len; ulint len;
ulint space; ulint space;
ulint n_cols; ulint n_cols;
...@@ -967,8 +967,8 @@ dict_load_table_on_id( ...@@ -967,8 +967,8 @@ dict_load_table_on_id(
dfield_t* dfield; dfield_t* dfield;
dict_index_t* sys_table_ids; dict_index_t* sys_table_ids;
dict_table_t* sys_tables; dict_table_t* sys_tables;
rec_t* rec; const rec_t* rec;
byte* field; const byte* field;
ulint len; ulint len;
dict_table_t* table; dict_table_t* table;
mtr_t mtr; mtr_t mtr;
...@@ -1083,8 +1083,8 @@ dict_load_foreign_cols( ...@@ -1083,8 +1083,8 @@ dict_load_foreign_cols(
btr_pcur_t pcur; btr_pcur_t pcur;
dtuple_t* tuple; dtuple_t* tuple;
dfield_t* dfield; dfield_t* dfield;
rec_t* rec; const rec_t* rec;
byte* field; const byte* field;
ulint len; ulint len;
ulint i; ulint i;
mtr_t mtr; mtr_t mtr;
...@@ -1161,8 +1161,8 @@ dict_load_foreign( ...@@ -1161,8 +1161,8 @@ dict_load_foreign(
dtuple_t* tuple; dtuple_t* tuple;
mem_heap_t* heap2; mem_heap_t* heap2;
dfield_t* dfield; dfield_t* dfield;
rec_t* rec; const rec_t* rec;
byte* field; const byte* field;
ulint len; ulint len;
mtr_t mtr; mtr_t mtr;
...@@ -1289,8 +1289,8 @@ dict_load_foreigns( ...@@ -1289,8 +1289,8 @@ dict_load_foreigns(
dfield_t* dfield; dfield_t* dfield;
dict_index_t* sec_index; dict_index_t* sec_index;
dict_table_t* sys_foreign; dict_table_t* sys_foreign;
rec_t* rec; const rec_t* rec;
byte* field; const byte* field;
ulint len; ulint len;
char* id ; char* id ;
ulint err; ulint err;
......
...@@ -4688,13 +4688,13 @@ fil_addr_is_null( ...@@ -4688,13 +4688,13 @@ fil_addr_is_null(
Accessor functions for a file page */ Accessor functions for a file page */
ulint ulint
fil_page_get_prev(byte* page) fil_page_get_prev(const byte* page)
{ {
return(mach_read_from_4(page + FIL_PAGE_PREV)); return(mach_read_from_4(page + FIL_PAGE_PREV));
} }
ulint ulint
fil_page_get_next(byte* page) fil_page_get_next(const byte* page)
{ {
return(mach_read_from_4(page + FIL_PAGE_NEXT)); return(mach_read_from_4(page + FIL_PAGE_NEXT));
} }
......
...@@ -981,7 +981,7 @@ ulint ...@@ -981,7 +981,7 @@ ulint
fsp_header_get_space_id( fsp_header_get_space_id(
/*====================*/ /*====================*/
/* out: space id, ULINT UNDEFINED if error */ /* out: space id, ULINT UNDEFINED if error */
page_t* page) /* in: first page of a tablespace */ const page_t* page) /* in: first page of a tablespace */
{ {
ulint fsp_id; ulint fsp_id;
ulint id; ulint id;
...@@ -1008,8 +1008,9 @@ Reads the compressed page size from the first page of a tablespace. */ ...@@ -1008,8 +1008,9 @@ Reads the compressed page size from the first page of a tablespace. */
ulint ulint
fsp_header_get_zip_size( fsp_header_get_zip_size(
/*=====================*/ /*=====================*/
/* out: compressed page size, or 0 if uncompressed */ /* out: compressed page size in bytes,
page_t* page) /* in: first page of a tablespace */ or 0 if uncompressed */
const page_t* page) /* in: first page of a tablespace */
{ {
return(mach_read_from_4(FSP_HEADER_OFFSET + FSP_PAGE_ZIP_SIZE + page)); return(mach_read_from_4(FSP_HEADER_OFFSET + FSP_PAGE_ZIP_SIZE + page));
} }
......
...@@ -414,11 +414,11 @@ ibool ...@@ -414,11 +414,11 @@ ibool
flst_validate( flst_validate(
/*==========*/ /*==========*/
/* out: TRUE if ok */ /* out: TRUE if ok */
flst_base_node_t* base, /* in: pointer to base node of list */ const flst_base_node_t* base, /* in: pointer to base node of list */
mtr_t* mtr1) /* in: mtr */ mtr_t* mtr1) /* in: mtr */
{ {
ulint space; ulint space;
flst_node_t* node; const flst_node_t* node;
fil_addr_t node_addr; fil_addr_t node_addr;
fil_addr_t base_addr; fil_addr_t base_addr;
ulint len; ulint len;
...@@ -476,15 +476,15 @@ Prints info of a file-based list. */ ...@@ -476,15 +476,15 @@ Prints info of a file-based list. */
void void
flst_print( flst_print(
/*=======*/ /*=======*/
flst_base_node_t* base, /* in: pointer to base node of list */ const flst_base_node_t* base, /* in: pointer to base node of list */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
buf_frame_t* frame; const buf_frame_t* frame;
ulint len; ulint len;
ut_ad(base && mtr); ut_ad(base && mtr);
ut_ad(mtr_memo_contains_page(mtr, base, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains_page(mtr, base, MTR_MEMO_PAGE_X_FIX));
frame = page_align(base); frame = page_align((byte*) base);
len = flst_get_len(base, mtr); len = flst_get_len(base, mtr);
...@@ -493,5 +493,5 @@ flst_print( ...@@ -493,5 +493,5 @@ flst_print(
"Base node in space %lu page %lu byte offset %lu; len %lu\n", "Base node in space %lu page %lu byte offset %lu; len %lu\n",
(ulong) page_get_space_id(frame), (ulong) page_get_space_id(frame),
(ulong) page_get_page_no(frame), (ulong) page_get_page_no(frame),
(ulong) (base - frame), (ulong) len); (ulong) page_offset(base), (ulong) len);
} }
...@@ -238,7 +238,7 @@ ha_remove_all_nodes_to_page( ...@@ -238,7 +238,7 @@ ha_remove_all_nodes_to_page(
/*========================*/ /*========================*/
hash_table_t* table, /* in: hash table */ hash_table_t* table, /* in: hash table */
ulint fold, /* in: fold value */ ulint fold, /* in: fold value */
page_t* page) /* in: buffer page */ const page_t* page) /* in: buffer page */
{ {
ha_node_t* node; ha_node_t* node;
......
...@@ -412,7 +412,7 @@ void ...@@ -412,7 +412,7 @@ void
ibuf_data_sizes_update( ibuf_data_sizes_update(
/*===================*/ /*===================*/
ibuf_data_t* data, /* in: ibuf data struct */ ibuf_data_t* data, /* in: ibuf data struct */
page_t* root, /* in: ibuf tree root */ const page_t* root, /* in: ibuf tree root */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
ulint old_size; ulint old_size;
...@@ -617,14 +617,15 @@ ulint ...@@ -617,14 +617,15 @@ ulint
ibuf_bitmap_page_get_bits( ibuf_bitmap_page_get_bits(
/*======================*/ /*======================*/
/* out: value of bits */ /* out: value of bits */
page_t* page, /* in: bitmap page */ const page_t* page, /* in: bitmap page */
ulint page_no,/* in: page whose bits to get */ ulint page_no,/* in: page whose bits to get */
ulint zip_size,/* in: compressed page size in bytes; ulint zip_size,/* in: compressed page size in bytes;
0 for uncompressed pages */ 0 for uncompressed pages */
ulint bit, /* in: IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ... */ ulint bit, /* in: IBUF_BITMAP_FREE,
mtr_t* mtr __attribute__((unused))) /* in: mtr containing an IBUF_BITMAP_BUFFERED, ... */
x-latch to the bitmap mtr_t* mtr __attribute__((unused)))
page */ /* in: mtr containing an
x-latch to the bitmap page */
{ {
ulint byte_offset; ulint byte_offset;
ulint bit_offset; ulint bit_offset;
...@@ -1073,9 +1074,9 @@ ulint ...@@ -1073,9 +1074,9 @@ ulint
ibuf_rec_get_page_no( ibuf_rec_get_page_no(
/*=================*/ /*=================*/
/* out: page number */ /* out: page number */
rec_t* rec) /* in: ibuf record */ const rec_t* rec) /* in: ibuf record */
{ {
byte* field; const byte* field;
ulint len; ulint len;
ut_ad(ibuf_inside()); ut_ad(ibuf_inside());
...@@ -1108,9 +1109,9 @@ ulint ...@@ -1108,9 +1109,9 @@ ulint
ibuf_rec_get_space( ibuf_rec_get_space(
/*===============*/ /*===============*/
/* out: space id */ /* out: space id */
rec_t* rec) /* in: ibuf record */ const rec_t* rec) /* in: ibuf record */
{ {
byte* field; const byte* field;
ulint len; ulint len;
ut_ad(ibuf_inside()); ut_ad(ibuf_inside());
...@@ -1213,7 +1214,7 @@ ibuf_build_entry_from_ibuf_rec( ...@@ -1213,7 +1214,7 @@ ibuf_build_entry_from_ibuf_rec(
ibuf_rec, the caller must hold a ibuf_rec, the caller must hold a
latch to the ibuf_rec page as long latch to the ibuf_rec page as long
as the entry is used! */ as the entry is used! */
rec_t* ibuf_rec, /* in: record in an insert buffer */ const rec_t* ibuf_rec, /* in: record in an insert buffer */
mem_heap_t* heap, /* in: heap where built */ mem_heap_t* heap, /* in: heap where built */
dict_index_t** pindex) /* out, own: dummy index that dict_index_t** pindex) /* out, own: dummy index that
describes the entry */ describes the entry */
...@@ -1221,7 +1222,7 @@ ibuf_build_entry_from_ibuf_rec( ...@@ -1221,7 +1222,7 @@ ibuf_build_entry_from_ibuf_rec(
dtuple_t* tuple; dtuple_t* tuple;
dfield_t* field; dfield_t* field;
ulint n_fields; ulint n_fields;
byte* types; const byte* types;
const byte* data; const byte* data;
ulint len; ulint len;
ulint i; ulint i;
...@@ -1307,16 +1308,17 @@ static ...@@ -1307,16 +1308,17 @@ static
ulint ulint
ibuf_rec_get_volume( ibuf_rec_get_volume(
/*================*/ /*================*/
/* out: size of index record in bytes + an upper /* out: size of index record in bytes
limit of the space taken in the page directory */ + an upper limit of the space taken in the
rec_t* ibuf_rec)/* in: ibuf record */ page directory */
const rec_t* ibuf_rec)/* in: ibuf record */
{ {
dtype_t dtype; dtype_t dtype;
ibool new_format = FALSE; ibool new_format = FALSE;
ulint data_size = 0; ulint data_size = 0;
ulint n_fields; ulint n_fields;
byte* types; const byte* types;
byte* data; const byte* data;
ulint len; ulint len;
ulint i; ulint i;
...@@ -2355,7 +2357,6 @@ ibuf_get_volume_buffered( ...@@ -2355,7 +2357,6 @@ ibuf_get_volume_buffered(
volume = 0; volume = 0;
rec = btr_pcur_get_rec(pcur); rec = btr_pcur_get_rec(pcur);
page = page_align(rec); page = page_align(rec);
if (page_rec_is_supremum(rec)) { if (page_rec_is_supremum(rec)) {
...@@ -2503,8 +2504,8 @@ ibuf_update_max_tablespace_id(void) ...@@ -2503,8 +2504,8 @@ ibuf_update_max_tablespace_id(void)
/*===============================*/ /*===============================*/
{ {
ulint max_space_id; ulint max_space_id;
rec_t* rec; const rec_t* rec;
byte* field; const byte* field;
ulint len; ulint len;
ibuf_data_t* ibuf_data; ibuf_data_t* ibuf_data;
dict_index_t* ibuf_index; dict_index_t* ibuf_index;
...@@ -2999,7 +3000,7 @@ ibuf_delete_rec( ...@@ -2999,7 +3000,7 @@ ibuf_delete_rec(
should belong */ should belong */
btr_pcur_t* pcur, /* in: pcur positioned on the record to btr_pcur_t* pcur, /* in: pcur positioned on the record to
delete, having latch mode BTR_MODIFY_LEAF */ delete, having latch mode BTR_MODIFY_LEAF */
dtuple_t* search_tuple, const dtuple_t* search_tuple,
/* in: search tuple for entries of page_no */ /* in: search tuple for entries of page_no */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
...@@ -3576,7 +3577,7 @@ ibuf_is_empty(void) ...@@ -3576,7 +3577,7 @@ ibuf_is_empty(void)
{ {
ibuf_data_t* data; ibuf_data_t* data;
ibool is_empty; ibool is_empty;
page_t* root; const page_t* root;
mtr_t mtr; mtr_t mtr;
ibuf_enter(); ibuf_enter();
......
...@@ -62,7 +62,7 @@ dict_truncate_index_tree( ...@@ -62,7 +62,7 @@ dict_truncate_index_tree(
/* out: new root page number, or /* out: new root page number, or
FIL_NULL on failure */ FIL_NULL on failure */
dict_table_t* table, /* in: the table the index belongs to */ dict_table_t* table, /* in: the table the index belongs to */
rec_t* rec, /* in: record in the clustered index of rec_t* rec, /* in/out: record in the clustered index of
SYS_INDEXES table */ SYS_INDEXES table */
mtr_t* mtr); /* in: mtr having the latch mtr_t* mtr); /* in: mtr having the latch
on the record page. The mtr may be on the record page. The mtr may be
...@@ -73,8 +73,8 @@ Drops the index tree associated with a row in SYS_INDEXES table. */ ...@@ -73,8 +73,8 @@ Drops the index tree associated with a row in SYS_INDEXES table. */
void void
dict_drop_index_tree( dict_drop_index_tree(
/*=================*/ /*=================*/
rec_t* rec, /* in: record in the clustered index of SYS_INDEXES rec_t* rec, /* in/out: record in the clustered index
table */ of SYS_INDEXES table */
mtr_t* mtr); /* in: mtr having the latch on the record page */ mtr_t* mtr); /* in: mtr having the latch on the record page */
/******************************************************************** /********************************************************************
Creates the foreign key constraints system tables inside InnoDB Creates the foreign key constraints system tables inside InnoDB
......
...@@ -662,9 +662,9 @@ fil_addr_is_null( ...@@ -662,9 +662,9 @@ fil_addr_is_null(
Accessor functions for a file page */ Accessor functions for a file page */
ulint ulint
fil_page_get_prev(byte* page); fil_page_get_prev(const byte* page);
ulint ulint
fil_page_get_next(byte* page); fil_page_get_next(const byte* page);
/************************************************************************* /*************************************************************************
Sets the file page type. */ Sets the file page type. */
......
...@@ -81,15 +81,16 @@ ulint ...@@ -81,15 +81,16 @@ ulint
fsp_header_get_space_id( fsp_header_get_space_id(
/*====================*/ /*====================*/
/* out: space id, ULINT UNDEFINED if error */ /* out: space id, ULINT UNDEFINED if error */
page_t* page); /* in: first page of a tablespace */ const page_t* page); /* in: first page of a tablespace */
/************************************************************************** /**************************************************************************
Reads the compressed page size from the first page of a tablespace. */ Reads the compressed page size from the first page of a tablespace. */
ulint ulint
fsp_header_get_zip_size( fsp_header_get_zip_size(
/*=====================*/ /*=====================*/
/* out: compressed page size, or 0 if uncompressed */ /* out: compressed page size in bytes,
page_t* page); /* in: first page of a tablespace */ or 0 if uncompressed */
const page_t* page); /* in: first page of a tablespace */
/************************************************************************** /**************************************************************************
Writes the space id and compressed page size to a tablespace header. Writes the space id and compressed page size to a tablespace header.
This function is used past the buffer pool when we in fil0fil.c create This function is used past the buffer pool when we in fil0fil.c create
......
...@@ -116,7 +116,7 @@ ulint ...@@ -116,7 +116,7 @@ ulint
flst_get_len( flst_get_len(
/*=========*/ /*=========*/
/* out: length */ /* out: length */
flst_base_node_t* base, /* in: pointer to base node */ const flst_base_node_t* base, /* in: pointer to base node */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/************************************************************************ /************************************************************************
Gets list first node address. */ Gets list first node address. */
...@@ -125,7 +125,7 @@ fil_addr_t ...@@ -125,7 +125,7 @@ fil_addr_t
flst_get_first( flst_get_first(
/*===========*/ /*===========*/
/* out: file address */ /* out: file address */
flst_base_node_t* base, /* in: pointer to base node */ const flst_base_node_t* base, /* in: pointer to base node */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/************************************************************************ /************************************************************************
Gets list last node address. */ Gets list last node address. */
...@@ -134,7 +134,7 @@ fil_addr_t ...@@ -134,7 +134,7 @@ fil_addr_t
flst_get_last( flst_get_last(
/*==========*/ /*==========*/
/* out: file address */ /* out: file address */
flst_base_node_t* base, /* in: pointer to base node */ const flst_base_node_t* base, /* in: pointer to base node */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/************************************************************************ /************************************************************************
Gets list next node address. */ Gets list next node address. */
...@@ -143,7 +143,7 @@ fil_addr_t ...@@ -143,7 +143,7 @@ fil_addr_t
flst_get_next_addr( flst_get_next_addr(
/*===============*/ /*===============*/
/* out: file address */ /* out: file address */
flst_node_t* node, /* in: pointer to node */ const flst_node_t* node, /* in: pointer to node */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/************************************************************************ /************************************************************************
Gets list prev node address. */ Gets list prev node address. */
...@@ -152,7 +152,7 @@ fil_addr_t ...@@ -152,7 +152,7 @@ fil_addr_t
flst_get_prev_addr( flst_get_prev_addr(
/*===============*/ /*===============*/
/* out: file address */ /* out: file address */
flst_node_t* node, /* in: pointer to node */ const flst_node_t* node, /* in: pointer to node */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/************************************************************************ /************************************************************************
Writes a file address. */ Writes a file address. */
...@@ -170,7 +170,7 @@ fil_addr_t ...@@ -170,7 +170,7 @@ fil_addr_t
flst_read_addr( flst_read_addr(
/*===========*/ /*===========*/
/* out: file address */ /* out: file address */
fil_faddr_t* faddr, /* in: pointer to file faddress */ const fil_faddr_t* faddr, /* in: pointer to file faddress */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/************************************************************************ /************************************************************************
Validates a file-based list. */ Validates a file-based list. */
...@@ -179,7 +179,7 @@ ibool ...@@ -179,7 +179,7 @@ ibool
flst_validate( flst_validate(
/*==========*/ /*==========*/
/* out: TRUE if ok */ /* out: TRUE if ok */
flst_base_node_t* base, /* in: pointer to base node of list */ const flst_base_node_t* base, /* in: pointer to base node of list */
mtr_t* mtr1); /* in: mtr */ mtr_t* mtr1); /* in: mtr */
/************************************************************************ /************************************************************************
Prints info of a file-based list. */ Prints info of a file-based list. */
...@@ -187,7 +187,7 @@ Prints info of a file-based list. */ ...@@ -187,7 +187,7 @@ Prints info of a file-based list. */
void void
flst_print( flst_print(
/*=======*/ /*=======*/
flst_base_node_t* base, /* in: pointer to base node of list */ const flst_base_node_t* base, /* in: pointer to base node of list */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
......
...@@ -51,7 +51,7 @@ fil_addr_t ...@@ -51,7 +51,7 @@ fil_addr_t
flst_read_addr( flst_read_addr(
/*===========*/ /*===========*/
/* out: file address */ /* out: file address */
fil_faddr_t* faddr, /* in: pointer to file faddress */ const fil_faddr_t* faddr, /* in: pointer to file faddress */
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
fil_addr_t addr; fil_addr_t addr;
...@@ -87,7 +87,7 @@ ulint ...@@ -87,7 +87,7 @@ ulint
flst_get_len( flst_get_len(
/*=========*/ /*=========*/
/* out: length */ /* out: length */
flst_base_node_t* base, /* in: pointer to base node */ const flst_base_node_t* base, /* in: pointer to base node */
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
return(mtr_read_ulint(base + FLST_LEN, MLOG_4BYTES, mtr)); return(mtr_read_ulint(base + FLST_LEN, MLOG_4BYTES, mtr));
...@@ -100,7 +100,7 @@ fil_addr_t ...@@ -100,7 +100,7 @@ fil_addr_t
flst_get_first( flst_get_first(
/*===========*/ /*===========*/
/* out: file address */ /* out: file address */
flst_base_node_t* base, /* in: pointer to base node */ const flst_base_node_t* base, /* in: pointer to base node */
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
return(flst_read_addr(base + FLST_FIRST, mtr)); return(flst_read_addr(base + FLST_FIRST, mtr));
...@@ -113,7 +113,7 @@ fil_addr_t ...@@ -113,7 +113,7 @@ fil_addr_t
flst_get_last( flst_get_last(
/*==========*/ /*==========*/
/* out: file address */ /* out: file address */
flst_base_node_t* base, /* in: pointer to base node */ const flst_base_node_t* base, /* in: pointer to base node */
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
return(flst_read_addr(base + FLST_LAST, mtr)); return(flst_read_addr(base + FLST_LAST, mtr));
...@@ -126,7 +126,7 @@ fil_addr_t ...@@ -126,7 +126,7 @@ fil_addr_t
flst_get_next_addr( flst_get_next_addr(
/*===============*/ /*===============*/
/* out: file address */ /* out: file address */
flst_node_t* node, /* in: pointer to node */ const flst_node_t* node, /* in: pointer to node */
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
return(flst_read_addr(node + FLST_NEXT, mtr)); return(flst_read_addr(node + FLST_NEXT, mtr));
...@@ -139,7 +139,7 @@ fil_addr_t ...@@ -139,7 +139,7 @@ fil_addr_t
flst_get_prev_addr( flst_get_prev_addr(
/*===============*/ /*===============*/
/* out: file address */ /* out: file address */
flst_node_t* node, /* in: pointer to node */ const flst_node_t* node, /* in: pointer to node */
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
return(flst_read_addr(node + FLST_PREV, mtr)); return(flst_read_addr(node + FLST_PREV, mtr));
......
...@@ -95,7 +95,7 @@ ha_remove_all_nodes_to_page( ...@@ -95,7 +95,7 @@ ha_remove_all_nodes_to_page(
/*========================*/ /*========================*/
hash_table_t* table, /* in: hash table */ hash_table_t* table, /* in: hash table */
ulint fold, /* in: fold value */ ulint fold, /* in: fold value */
page_t* page); /* in: buffer page */ const page_t* page); /* in: buffer page */
/***************************************************************** /*****************************************************************
Validates a given range of the cells in hash table. */ Validates a given range of the cells in hash table. */
......
...@@ -223,7 +223,7 @@ ulint ...@@ -223,7 +223,7 @@ ulint
mtr_read_ulint( mtr_read_ulint(
/*===========*/ /*===========*/
/* out: value read */ /* out: value read */
byte* ptr, /* in: pointer from where to read */ const byte* ptr, /* in: pointer from where to read */
ulint type, /* in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */ ulint type, /* in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/************************************************************ /************************************************************
...@@ -233,7 +233,7 @@ dulint ...@@ -233,7 +233,7 @@ dulint
mtr_read_dulint( mtr_read_dulint(
/*============*/ /*============*/
/* out: value read */ /* out: value read */
byte* ptr, /* in: pointer from where to read */ const byte* ptr, /* in: pointer from where to read */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/************************************************************************* /*************************************************************************
This macro locks an rw-lock in s-mode. */ This macro locks an rw-lock in s-mode. */
......
...@@ -372,17 +372,19 @@ rec_offs_make_valid( ...@@ -372,17 +372,19 @@ rec_offs_make_valid(
ulint* offsets);/* in: array returned by rec_get_offsets() */ ulint* offsets);/* in: array returned by rec_get_offsets() */
/**************************************************************** /****************************************************************
The following function is used to get a pointer to the nth The following function is used to get the offset to the nth
data field in an old-style record. */ data field in an old-style record. */
byte* ulint
rec_get_nth_field_old( rec_get_nth_field_offs_old(
/*==================*/ /*=======================*/
/* out: pointer to the field */ /* out: offset to the field */
rec_t* rec, /* in: record */ const rec_t* rec, /* in: record */
ulint n, /* in: index of the field */ ulint n, /* in: index of the field */
ulint* len); /* out: length of the field; UNIV_SQL_NULL ulint* len); /* out: length of the field; UNIV_SQL_NULL
if SQL null */ if SQL null */
#define rec_get_nth_field_old(rec, n, len) \
((rec) + rec_get_nth_field_offs_old(rec, n, len))
/**************************************************************** /****************************************************************
Gets the physical size of an old-style field. Gets the physical size of an old-style field.
Also an SQL null may have a field of size > 0, Also an SQL null may have a field of size > 0,
...@@ -407,7 +409,7 @@ rec_get_nth_field_offs( ...@@ -407,7 +409,7 @@ rec_get_nth_field_offs(
ulint* len); /* out: length of the field; UNIV_SQL_NULL ulint* len); /* out: length of the field; UNIV_SQL_NULL
if SQL null */ if SQL null */
#define rec_get_nth_field(rec, offsets, n, len) \ #define rec_get_nth_field(rec, offsets, n, len) \
(rec + rec_get_nth_field_offs(offsets, n, len)) ((rec) + rec_get_nth_field_offs(offsets, n, len))
/********************************************************** /**********************************************************
Determine if the offsets are for a record in the new Determine if the offsets are for a record in the new
compact format. */ compact format. */
......
...@@ -275,7 +275,7 @@ ulint ...@@ -275,7 +275,7 @@ ulint
mtr_read_ulint( mtr_read_ulint(
/*===========*/ /*===========*/
/* out: value read */ /* out: value read */
byte* ptr, /* in: pointer from where to read */ const byte* ptr, /* in: pointer from where to read */
ulint type, /* in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */ ulint type, /* in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */
mtr_t* mtr __attribute__((unused))) mtr_t* mtr __attribute__((unused)))
/* in: mini-transaction handle */ /* in: mini-transaction handle */
...@@ -300,7 +300,7 @@ dulint ...@@ -300,7 +300,7 @@ dulint
mtr_read_dulint( mtr_read_dulint(
/*============*/ /*============*/
/* out: value read */ /* out: value read */
byte* ptr, /* in: pointer from where to read */ const byte* ptr, /* in: pointer from where to read */
mtr_t* mtr __attribute__((unused))) mtr_t* mtr __attribute__((unused)))
/* in: mini-transaction handle */ /* in: mini-transaction handle */
{ {
......
...@@ -552,17 +552,17 @@ rec_get_offsets_reverse( ...@@ -552,17 +552,17 @@ rec_get_offsets_reverse(
} }
/**************************************************************** /****************************************************************
The following function is used to get a pointer to the nth The following function is used to get the offset to the nth
data field in an old-style record. */ data field in an old-style record. */
byte* ulint
rec_get_nth_field_old( rec_get_nth_field_offs_old(
/*==================*/ /*=======================*/
/* out: pointer to the field */ /* out: offset to the field */
rec_t* rec, /* in: record */ const rec_t* rec, /* in: record */
ulint n, /* in: index of the field */ ulint n, /* in: index of the field */
ulint* len) /* out: length of the field; UNIV_SQL_NULL if SQL ulint* len) /* out: length of the field;
null */ UNIV_SQL_NULL if SQL null */
{ {
ulint os; ulint os;
ulint next_os; ulint next_os;
...@@ -589,7 +589,7 @@ rec_get_nth_field_old( ...@@ -589,7 +589,7 @@ rec_get_nth_field_old(
if (next_os & REC_1BYTE_SQL_NULL_MASK) { if (next_os & REC_1BYTE_SQL_NULL_MASK) {
*len = UNIV_SQL_NULL; *len = UNIV_SQL_NULL;
return(rec + os); return(os);
} }
next_os = next_os & ~REC_1BYTE_SQL_NULL_MASK; next_os = next_os & ~REC_1BYTE_SQL_NULL_MASK;
...@@ -601,7 +601,7 @@ rec_get_nth_field_old( ...@@ -601,7 +601,7 @@ rec_get_nth_field_old(
if (next_os & REC_2BYTE_SQL_NULL_MASK) { if (next_os & REC_2BYTE_SQL_NULL_MASK) {
*len = UNIV_SQL_NULL; *len = UNIV_SQL_NULL;
return(rec + os); return(os);
} }
next_os = next_os & ~(REC_2BYTE_SQL_NULL_MASK next_os = next_os & ~(REC_2BYTE_SQL_NULL_MASK
...@@ -612,7 +612,7 @@ rec_get_nth_field_old( ...@@ -612,7 +612,7 @@ rec_get_nth_field_old(
ut_ad(*len < UNIV_PAGE_SIZE); ut_ad(*len < UNIV_PAGE_SIZE);
return(rec + os); return(os);
} }
/************************************************************** /**************************************************************
...@@ -1334,7 +1334,7 @@ rec_validate_old( ...@@ -1334,7 +1334,7 @@ rec_validate_old(
} }
for (i = 0; i < n_fields; i++) { for (i = 0; i < n_fields; i++) {
data = rec_get_nth_field_old((rec_t*) rec, i, &len); data = rec_get_nth_field_old(rec, i, &len);
if (!((len < UNIV_PAGE_SIZE) || (len == UNIV_SQL_NULL))) { if (!((len < UNIV_PAGE_SIZE) || (len == UNIV_SQL_NULL))) {
fprintf(stderr, fprintf(stderr,
...@@ -1461,7 +1461,7 @@ rec_print_old( ...@@ -1461,7 +1461,7 @@ rec_print_old(
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
data = rec_get_nth_field_old((rec_t*) rec, i, &len); data = rec_get_nth_field_old(rec, i, &len);
fprintf(file, " %lu:", (ulong) i); fprintf(file, " %lu:", (ulong) i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment