1
/**********************************************************************
2
File-based list utilities
6
Created 11/28/1995 Heikki Tuuri
7
***********************************************************************/
18
/* The C 'types' of base node and list node: these should be used to
19
write self-documenting code. Of course, the sizeof macro cannot be
20
applied to these types! */
22
typedef byte flst_base_node_t;
23
typedef byte flst_node_t;
25
/* The physical size of a list base node in bytes */
26
#define FLST_BASE_NODE_SIZE (4 + 2 * FIL_ADDR_SIZE)
28
/* The physical size of a list node in bytes */
29
#define FLST_NODE_SIZE (2 * FIL_ADDR_SIZE)
32
/************************************************************************
33
Initializes a list base node. */
38
flst_base_node_t* base, /* in: pointer to base node */
39
mtr_t* mtr); /* in: mini-transaction handle */
40
/************************************************************************
41
Adds a node as the last node in a list. */
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
/************************************************************************
50
Adds a node as the first node in a list. */
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
/************************************************************************
59
Inserts a node after another in a list. */
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
/************************************************************************
69
Inserts a node before another in a list. */
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
/************************************************************************
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
/************************************************************************
88
Cuts off the tail of the list, including the node given. The number of
89
nodes which will be removed must be provided by the caller, as this function
90
does not measure the length of the tail. */
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,
99
mtr_t* mtr); /* in: mini-transaction handle */
100
/************************************************************************
101
Cuts off the tail of the list, not including the given node. The number of
102
nodes which will be removed must be provided by the caller, as this function
103
does not measure the length of the tail. */
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
/************************************************************************
119
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. */
127
/* out: file address */
128
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. */
136
/* out: file address */
137
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. */
145
/* out: file address */
146
flst_node_t* node, /* in: pointer to node */
147
mtr_t* mtr); /* in: mini-transaction handle */
148
/************************************************************************
149
Gets list prev node address. */
154
/* out: file address */
155
flst_node_t* node, /* in: pointer to node */
156
mtr_t* mtr); /* in: mini-transaction handle */
157
/************************************************************************
158
Writes a 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. */
172
/* out: file address */
173
fil_faddr_t* faddr, /* in: pointer to file faddress */
174
mtr_t* mtr); /* in: mini-transaction handle */
175
/************************************************************************
176
Validates a file-based list. */
181
/* out: TRUE if ok */
182
flst_base_node_t* base, /* in: pointer to base node of list */
183
mtr_t* mtr1); /* in: mtr */
184
/************************************************************************
185
Prints info of a file-based list. */
190
flst_base_node_t* base, /* in: pointer to base node of list */
191
mtr_t* mtr); /* in: mtr */
195
#include "fut0lst.ic"