~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2008-12-08 01:15:27 UTC
  • mto: This revision was merged to the branch mainline in revision 670.
  • Revision ID: monty@inaugust.com-20081208011527-lq9m47jsmiiqn999
Replaced my hacked up m4/ac_system_extensions.m4 with the one from gnulib.

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., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/******************************************************************//**
20
 
@file include/fut0lst.h
 
1
/**********************************************************************
21
2
File-based list utilities
22
3
 
 
4
(c) 1995 Innobase Oy
 
5
 
23
6
Created 11/28/1995 Heikki Tuuri
24
7
***********************************************************************/
25
8
 
45
28
/* The physical size of a list node in bytes */
46
29
#define FLST_NODE_SIZE          (2 * FIL_ADDR_SIZE)
47
30
 
48
 
#ifndef UNIV_HOTBACKUP
49
 
/********************************************************************//**
 
31
 
 
32
/************************************************************************
50
33
Initializes a list base node. */
51
34
UNIV_INLINE
52
35
void
53
36
flst_init(
54
37
/*======*/
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. */
59
42
UNIV_INTERN
60
43
void
61
44
flst_add_last(
62
45
/*==========*/
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. */
68
51
UNIV_INTERN
69
52
void
70
53
flst_add_first(
71
54
/*===========*/
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. */
77
60
UNIV_INTERN
78
61
void
79
62
flst_insert_after(
80
63
/*==============*/
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. */
87
70
UNIV_INTERN
88
71
void
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
/************************************************************************
96
79
Removes a node. */
97
80
UNIV_INTERN
98
81
void
99
82
flst_remove(
100
83
/*========*/
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. */
109
92
void
110
93
flst_cut_end(
111
94
/*=========*/
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,
115
98
                                        must be >= 1 */
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. */
122
105
void
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
 
/********************************************************************//**
130
 
Gets list length.
131
 
@return length */
 
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
/************************************************************************
 
113
Gets list length. */
132
114
UNIV_INLINE
133
115
ulint
134
116
flst_get_len(
135
117
/*=========*/
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 */
 
118
                                        /* out: length */
 
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. */
141
123
UNIV_INLINE
142
124
fil_addr_t
143
125
flst_get_first(
144
126
/*===========*/
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. */
150
132
UNIV_INLINE
151
133
fil_addr_t
152
134
flst_get_last(
153
135
/*==========*/
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. */
159
141
UNIV_INLINE
160
142
fil_addr_t
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. */
168
150
UNIV_INLINE
169
151
fil_addr_t
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. */
176
159
UNIV_INLINE
177
160
void
178
161
flst_write_addr(
179
162
/*============*/
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. */
186
168
UNIV_INLINE
187
169
fil_addr_t
188
170
flst_read_addr(
189
171
/*===========*/
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. */
195
177
UNIV_INTERN
196
178
ibool
197
179
flst_validate(
198
180
/*==========*/
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. */
203
186
UNIV_INTERN
204
187
void
205
188
flst_print(
206
189
/*=======*/
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 */
209
192
 
210
193
 
211
194
#ifndef UNIV_NONINL
212
195
#include "fut0lst.ic"
213
196
#endif
214
197
 
215
 
#endif /* !UNIV_HOTBACKUP */
216
 
 
217
198
#endif