Debian Codegraph @

unittest/gunit/innodb/lob/lot0buf.h

raw symbols SCIP
1 /*****************************************************************************
2
3 Copyright (c) 2016, 2026, Oracle and/or its affiliates.
4
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License, version 2.0, as published by the
7 Free Software Foundation.
8
9 This program is designed to work with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation. The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have either included with
15 the program or referenced in the documentation.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20 for more details.
21
22 You should have received a copy of the GNU General Public License along with
23 this program; if not, write to the Free Software Foundation, Inc.,
24 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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 /** Get the specified page number.
86 @param[in] page_no the requested page number. */
87 buf_block_t *buf_page_get(page_no_t page_no);
88
89 /** Allocate a new page.
90 @return the newly allocated buffer block. */
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 // _lot0buf_h_