~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/fut0lst.h

Merge Stewart's dead code removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (C) 1995, 2009, Innobase Oy. All Rights Reserved.
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 as published by the Free Software
7
 
Foundation; version 2 of the License.
8
 
 
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.
12
 
 
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., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/******************************************************************//**
20
 
@file include/fut0lst.h
21
 
File-based list utilities
22
 
 
23
 
Created 11/28/1995 Heikki Tuuri
24
 
***********************************************************************/
25
 
 
26
 
#ifndef fut0lst_h
27
 
#define fut0lst_h
28
 
 
29
 
#include "univ.i"
30
 
 
31
 
#include "fil0fil.h"
32
 
#include "mtr0mtr.h"
33
 
 
34
 
 
35
 
/* The C 'types' of base node and list node: these should be used to
36
 
write self-documenting code. Of course, the sizeof macro cannot be
37
 
applied to these types! */
38
 
 
39
 
typedef byte    flst_base_node_t;
40
 
typedef byte    flst_node_t;
41
 
 
42
 
/* The physical size of a list base node in bytes */
43
 
#define FLST_BASE_NODE_SIZE     (4 + 2 * FIL_ADDR_SIZE)
44
 
 
45
 
/* The physical size of a list node in bytes */
46
 
#define FLST_NODE_SIZE          (2 * FIL_ADDR_SIZE)
47
 
 
48
 
#ifndef UNIV_HOTBACKUP
49
 
/********************************************************************//**
50
 
Initializes a list base node. */
51
 
UNIV_INLINE
52
 
void
53
 
flst_init(
54
 
/*======*/
55
 
        flst_base_node_t*       base,   /*!< in: pointer to base node */
56
 
        mtr_t*                  mtr);   /*!< in: mini-transaction handle */
57
 
/********************************************************************//**
58
 
Adds a node as the last node in a list. */
59
 
UNIV_INTERN
60
 
void
61
 
flst_add_last(
62
 
/*==========*/
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
 
/********************************************************************//**
67
 
Adds a node as the first node in a list. */
68
 
UNIV_INTERN
69
 
void
70
 
flst_add_first(
71
 
/*===========*/
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
 
/********************************************************************//**
76
 
Inserts a node after another in a list. */
77
 
UNIV_INTERN
78
 
void
79
 
flst_insert_after(
80
 
/*==============*/
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
 
/********************************************************************//**
86
 
Inserts a node before another in a list. */
87
 
UNIV_INTERN
88
 
void
89
 
flst_insert_before(
90
 
/*===============*/
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
 
/********************************************************************//**
96
 
Removes a node. */
97
 
UNIV_INTERN
98
 
void
99
 
flst_remove(
100
 
/*========*/
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
 
/********************************************************************//**
105
 
Cuts off the tail of the list, including the node given. The number of
106
 
nodes which will be removed must be provided by the caller, as this function
107
 
does not measure the length of the tail. */
108
 
UNIV_INTERN
109
 
void
110
 
flst_cut_end(
111
 
/*=========*/
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,
115
 
                                        must be >= 1 */
116
 
        mtr_t*                  mtr);   /*!< in: mini-transaction handle */
117
 
/********************************************************************//**
118
 
Cuts off the tail of the list, not including the given node. The number of
119
 
nodes which will be removed must be provided by the caller, as this function
120
 
does not measure the length of the tail. */
121
 
UNIV_INTERN
122
 
void
123
 
flst_truncate_end(
124
 
/*==============*/
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
 
/********************************************************************//**
130
 
Gets list length.
131
 
@return length */
132
 
UNIV_INLINE
133
 
ulint
134
 
flst_get_len(
135
 
/*=========*/
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 */
141
 
UNIV_INLINE
142
 
fil_addr_t
143
 
flst_get_first(
144
 
/*===========*/
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 */
150
 
UNIV_INLINE
151
 
fil_addr_t
152
 
flst_get_last(
153
 
/*==========*/
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 */
159
 
UNIV_INLINE
160
 
fil_addr_t
161
 
flst_get_next_addr(
162
 
/*===============*/
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 */
168
 
UNIV_INLINE
169
 
fil_addr_t
170
 
flst_get_prev_addr(
171
 
/*===============*/
172
 
        const flst_node_t*      node,   /*!< in: pointer to node */
173
 
        mtr_t*                  mtr);   /*!< in: mini-transaction handle */
174
 
/********************************************************************//**
175
 
Writes a file address. */
176
 
UNIV_INLINE
177
 
void
178
 
flst_write_addr(
179
 
/*============*/
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 */
186
 
UNIV_INLINE
187
 
fil_addr_t
188
 
flst_read_addr(
189
 
/*===========*/
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 */
195
 
UNIV_INTERN
196
 
ibool
197
 
flst_validate(
198
 
/*==========*/
199
 
        const flst_base_node_t* base,   /*!< in: pointer to base node of list */
200
 
        mtr_t*                  mtr1);  /*!< in: mtr */
201
 
/********************************************************************//**
202
 
Prints info of a file-based list. */
203
 
UNIV_INTERN
204
 
void
205
 
flst_print(
206
 
/*=======*/
207
 
        const flst_base_node_t* base,   /*!< in: pointer to base node of list */
208
 
        mtr_t*                  mtr);   /*!< in: mtr */
209
 
 
210
 
 
211
 
#ifndef UNIV_NONINL
212
 
#include "fut0lst.ic"
213
 
#endif
214
 
 
215
 
#endif /* !UNIV_HOTBACKUP */
216
 
 
217
 
#endif