1
/*****************************************************************************
3
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
5
This program is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free Software
7
Foundation; version 2 of the License.
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
Place, Suite 330, Boston, MA 02111-1307 USA
17
*****************************************************************************/
19
/******************************************************************//**
20
@file include/fut0lst.h
1
/**********************************************************************
21
2
File-based list utilities
23
6
Created 11/28/1995 Heikki Tuuri
24
7
***********************************************************************/
45
28
/* The physical size of a list node in bytes */
46
29
#define FLST_NODE_SIZE (2 * FIL_ADDR_SIZE)
48
#ifndef UNIV_HOTBACKUP
49
/********************************************************************//**
32
/************************************************************************
50
33
Initializes a list base node. */
55
flst_base_node_t* base, /*!< in: pointer to base node */
56
mtr_t* mtr); /*!< in: mini-transaction handle */
57
/********************************************************************//**
38
flst_base_node_t* base, /* in: pointer to base node */
39
mtr_t* mtr); /* in: mini-transaction handle */
40
/************************************************************************
58
41
Adds a node as the last node in a list. */
63
flst_base_node_t* base, /*!< in: pointer to base node of list */
64
flst_node_t* node, /*!< in: node to add */
65
mtr_t* mtr); /*!< in: mini-transaction handle */
66
/********************************************************************//**
46
flst_base_node_t* base, /* in: pointer to base node of list */
47
flst_node_t* node, /* in: node to add */
48
mtr_t* mtr); /* in: mini-transaction handle */
49
/************************************************************************
67
50
Adds a node as the first node in a list. */
72
flst_base_node_t* base, /*!< in: pointer to base node of list */
73
flst_node_t* node, /*!< in: node to add */
74
mtr_t* mtr); /*!< in: mini-transaction handle */
75
/********************************************************************//**
55
flst_base_node_t* base, /* in: pointer to base node of list */
56
flst_node_t* node, /* in: node to add */
57
mtr_t* mtr); /* in: mini-transaction handle */
58
/************************************************************************
76
59
Inserts a node after another in a list. */
81
flst_base_node_t* base, /*!< in: pointer to base node of list */
82
flst_node_t* node1, /*!< in: node to insert after */
83
flst_node_t* node2, /*!< in: node to add */
84
mtr_t* mtr); /*!< in: mini-transaction handle */
85
/********************************************************************//**
64
flst_base_node_t* base, /* in: pointer to base node of list */
65
flst_node_t* node1, /* in: node to insert after */
66
flst_node_t* node2, /* in: node to add */
67
mtr_t* mtr); /* in: mini-transaction handle */
68
/************************************************************************
86
69
Inserts a node before another in a list. */
89
72
flst_insert_before(
90
73
/*===============*/
91
flst_base_node_t* base, /*!< in: pointer to base node of list */
92
flst_node_t* node2, /*!< in: node to insert */
93
flst_node_t* node3, /*!< in: node to insert before */
94
mtr_t* mtr); /*!< in: mini-transaction handle */
95
/********************************************************************//**
74
flst_base_node_t* base, /* in: pointer to base node of list */
75
flst_node_t* node2, /* in: node to insert */
76
flst_node_t* node3, /* in: node to insert before */
77
mtr_t* mtr); /* in: mini-transaction handle */
78
/************************************************************************
101
flst_base_node_t* base, /*!< in: pointer to base node of list */
102
flst_node_t* node2, /*!< in: node to remove */
103
mtr_t* mtr); /*!< in: mini-transaction handle */
104
/********************************************************************//**
84
flst_base_node_t* base, /* in: pointer to base node of list */
85
flst_node_t* node2, /* in: node to remove */
86
mtr_t* mtr); /* in: mini-transaction handle */
87
/************************************************************************
105
88
Cuts off the tail of the list, including the node given. The number of
106
89
nodes which will be removed must be provided by the caller, as this function
107
90
does not measure the length of the tail. */
112
flst_base_node_t* base, /*!< in: pointer to base node of list */
113
flst_node_t* node2, /*!< in: first node to remove */
114
ulint n_nodes,/*!< in: number of nodes to remove,
95
flst_base_node_t* base, /* in: pointer to base node of list */
96
flst_node_t* node2, /* in: first node to remove */
97
ulint n_nodes,/* in: number of nodes to remove,
116
mtr_t* mtr); /*!< in: mini-transaction handle */
117
/********************************************************************//**
99
mtr_t* mtr); /* in: mini-transaction handle */
100
/************************************************************************
118
101
Cuts off the tail of the list, not including the given node. The number of
119
102
nodes which will be removed must be provided by the caller, as this function
120
103
does not measure the length of the tail. */
123
106
flst_truncate_end(
124
107
/*==============*/
125
flst_base_node_t* base, /*!< in: pointer to base node of list */
126
flst_node_t* node2, /*!< in: first node not to remove */
127
ulint n_nodes,/*!< in: number of nodes to remove */
128
mtr_t* mtr); /*!< in: mini-transaction handle */
129
/********************************************************************//**
108
flst_base_node_t* base, /* in: pointer to base node of list */
109
flst_node_t* node2, /* in: first node not to remove */
110
ulint n_nodes,/* in: number of nodes to remove */
111
mtr_t* mtr); /* in: mini-transaction handle */
112
/************************************************************************
136
const flst_base_node_t* base, /*!< in: pointer to base node */
137
mtr_t* mtr); /*!< in: mini-transaction handle */
138
/********************************************************************//**
139
Gets list first node address.
140
@return file address */
119
const flst_base_node_t* base, /* in: pointer to base node */
120
mtr_t* mtr); /* in: mini-transaction handle */
121
/************************************************************************
122
Gets list first node address. */
145
const flst_base_node_t* base, /*!< in: pointer to base node */
146
mtr_t* mtr); /*!< in: mini-transaction handle */
147
/********************************************************************//**
148
Gets list last node address.
149
@return file address */
127
/* out: file address */
128
const flst_base_node_t* base, /* in: pointer to base node */
129
mtr_t* mtr); /* in: mini-transaction handle */
130
/************************************************************************
131
Gets list last node address. */
154
const flst_base_node_t* base, /*!< in: pointer to base node */
155
mtr_t* mtr); /*!< in: mini-transaction handle */
156
/********************************************************************//**
157
Gets list next node address.
158
@return file address */
136
/* out: file address */
137
const flst_base_node_t* base, /* in: pointer to base node */
138
mtr_t* mtr); /* in: mini-transaction handle */
139
/************************************************************************
140
Gets list next node address. */
161
143
flst_get_next_addr(
162
144
/*===============*/
163
const flst_node_t* node, /*!< in: pointer to node */
164
mtr_t* mtr); /*!< in: mini-transaction handle */
165
/********************************************************************//**
166
Gets list prev node address.
167
@return file address */
145
/* out: file address */
146
const flst_node_t* node, /* in: pointer to node */
147
mtr_t* mtr); /* in: mini-transaction handle */
148
/************************************************************************
149
Gets list prev node address. */
170
152
flst_get_prev_addr(
171
153
/*===============*/
172
const flst_node_t* node, /*!< in: pointer to node */
173
mtr_t* mtr); /*!< in: mini-transaction handle */
174
/********************************************************************//**
154
/* out: file address */
155
const flst_node_t* node, /* in: pointer to node */
156
mtr_t* mtr); /* in: mini-transaction handle */
157
/************************************************************************
175
158
Writes a file address. */
180
fil_faddr_t* faddr, /*!< in: pointer to file faddress */
181
fil_addr_t addr, /*!< in: file address */
182
mtr_t* mtr); /*!< in: mini-transaction handle */
183
/********************************************************************//**
184
Reads a file address.
185
@return file address */
163
fil_faddr_t* faddr, /* in: pointer to file faddress */
164
fil_addr_t addr, /* in: file address */
165
mtr_t* mtr); /* in: mini-transaction handle */
166
/************************************************************************
167
Reads a file address. */
190
const fil_faddr_t* faddr, /*!< in: pointer to file faddress */
191
mtr_t* mtr); /*!< in: mini-transaction handle */
192
/********************************************************************//**
193
Validates a file-based list.
194
@return TRUE if ok */
172
/* out: file address */
173
const fil_faddr_t* faddr, /* in: pointer to file faddress */
174
mtr_t* mtr); /* in: mini-transaction handle */
175
/************************************************************************
176
Validates a file-based list. */
199
const flst_base_node_t* base, /*!< in: pointer to base node of list */
200
mtr_t* mtr1); /*!< in: mtr */
201
/********************************************************************//**
181
/* out: TRUE if ok */
182
const flst_base_node_t* base, /* in: pointer to base node of list */
183
mtr_t* mtr1); /* in: mtr */
184
/************************************************************************
202
185
Prints info of a file-based list. */
207
const flst_base_node_t* base, /*!< in: pointer to base node of list */
208
mtr_t* mtr); /*!< in: mtr */
190
const flst_base_node_t* base, /* in: pointer to base node of list */
191
mtr_t* mtr); /* in: mtr */
211
194
#ifndef UNIV_NONINL
212
195
#include "fut0lst.ic"
215
#endif /* !UNIV_HOTBACKUP */