| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
#ifndef _lot0buf_h_ |
| 28 |
#define _lot0buf_h_ |
| 29 |
|
| 30 |
#include "buf0types.h" |
| 31 |
#include "fil0fil.h" |
| 32 |
#include "lot0types.h" |
| 33 |
#include "mach0data.h" |
| 34 |
|
| 35 |
struct buf_block_t { |
| 36 |
byte *m_frame; |
| 37 |
|
| 38 |
void set_next_page(page_no_t num) { |
| 39 |
mach_write_to_4(m_frame + FIL_PAGE_NEXT, num); |
| 40 |
} |
| 41 |
|
| 42 |
page_no_t get_next_page() { |
| 43 |
return (mach_read_from_4(m_frame + FIL_PAGE_NEXT)); |
| 44 |
} |
| 45 |
|
| 46 |
void set_page_no(page_no_t num) { |
| 47 |
mach_write_to_4(m_frame + FIL_PAGE_OFFSET, num); |
| 48 |
} |
| 49 |
|
| 50 |
void set_next_page_no(page_no_t num) { |
| 51 |
mach_write_to_4(m_frame + FIL_PAGE_NEXT, num); |
| 52 |
} |
| 53 |
|
| 54 |
page_no_t get_page_no() { |
| 55 |
return (mach_read_from_4(m_frame + FIL_PAGE_OFFSET)); |
| 56 |
} |
| 57 |
|
| 58 |
ulint get_page_type() { return (mach_read_from_2(m_frame + FIL_PAGE_TYPE)); } |
| 59 |
|
| 60 |
const char *get_page_type_str() { |
| 61 |
ulint type = get_page_type(); |
| 62 |
switch (type) { |
| 63 |
case FIL_PAGE_TYPE_LOB_INDEX: |
| 64 |
return ("FIL_PAGE_TYPE_LOB_INDEX"); |
| 65 |
case FIL_PAGE_TYPE_LOB_DATA: |
| 66 |
return ("FIL_PAGE_TYPE_LOB_DATA"); |
| 67 |
case FIL_PAGE_TYPE_LOB_FIRST: |
| 68 |
return ("FIL_PAGE_TYPE_LOB_FIRST"); |
| 69 |
case FIL_PAGE_TYPE_ZLOB_FIRST: |
| 70 |
return ("FIL_PAGE_TYPE_ZLOB_FIRST"); |
| 71 |
case FIL_PAGE_TYPE_ZLOB_DATA: |
| 72 |
return ("FIL_PAGE_TYPE_ZLOB_DATA"); |
| 73 |
case FIL_PAGE_TYPE_ZLOB_INDEX: |
| 74 |
return ("FIL_PAGE_TYPE_ZLOB_INDEX"); |
| 75 |
case FIL_PAGE_TYPE_ZLOB_FRAG: |
| 76 |
return ("FIL_PAGE_TYPE_ZLOB_FRAG"); |
| 77 |
case FIL_PAGE_TYPE_ZLOB_FRAG_ENTRY: |
| 78 |
return ("FIL_PAGE_TYPE_ZLOB_FRAG_ENTRY"); |
| 79 |
default: |
| 80 |
return ("UNKNOWN"); |
| 81 |
} |
| 82 |
} |
| 83 |
}; |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
buf_block_t *buf_page_get(page_no_t page_no); |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
buf_block_t *btr_page_alloc(); |
| 92 |
|
| 93 |
void btr_page_free(buf_block_t *block); |
| 94 |
|
| 95 |
inline buf_frame_t *buf_block_get_frame(const buf_block_t *block) { |
| 96 |
return (block->m_frame); |
| 97 |
} |
| 98 |
|
| 99 |
void buf_pool_reset(); |
| 100 |
|
| 101 |
#endif |