00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef H5B2_PACKAGE
00025 #error "Do not include this file outside the H5B2 package!"
00026 #endif
00027
00028 #ifndef _H5B2pkg_H
00029 #define _H5B2pkg_H
00030
00031
00032 #include "H5B2private.h"
00033
00034
00035 #include "H5ACprivate.h"
00036 #include "H5FLprivate.h"
00037 #include "H5RCprivate.h"
00038
00039
00040
00041
00042
00043
00044 #define H5B2_SIZEOF_RECORDS_PER_NODE 2
00045
00046
00047
00048 #define H5B2_TREE_POINTER_SIZE(f) (H5F_SIZEOF_ADDR(f)+H5B2_SIZEOF_RECORDS_PER_NODE+H5F_SIZEOF_SIZE(f))
00049
00050
00051 #define H5B2_INT_POINTER_SIZE(f, s, d) ( \
00052 H5F_SIZEOF_ADDR(f) \
00053 + (s)->max_nrec_size \
00054 + (s)->node_info[(d) - 1].cum_max_nrec_size \
00055 )
00056
00057
00058 #define H5B2_SIZEOF_CHKSUM 4
00059
00060
00061 #define H5B2_METADATA_PREFIX_SIZE ( \
00062 H5_SIZEOF_MAGIC \
00063 + 1 \
00064 + 1 \
00065 + H5B2_SIZEOF_CHKSUM \
00066 )
00067
00068
00069 #define H5B2_HEADER_SIZE(f) ( \
00070 \
00071 H5B2_METADATA_PREFIX_SIZE \
00072 \
00073 \
00074 + 4 \
00075 + 2 \
00076 + 2 \
00077 + 1 \
00078 + 1 \
00079 + H5B2_TREE_POINTER_SIZE(f) \
00080 )
00081
00082
00083 #define H5B2_INT_PREFIX_SIZE ( \
00084 \
00085 H5B2_METADATA_PREFIX_SIZE \
00086 \
00087 \
00088 \
00089 )
00090
00091
00092 #define H5B2_LEAF_PREFIX_SIZE ( \
00093 \
00094 H5B2_METADATA_PREFIX_SIZE \
00095 \
00096 \
00097 \
00098 )
00099
00100
00101 #define H5B2_NAT_NREC(b, shared, idx) ((b) + (shared)->nat_off[(idx)])
00102
00103
00104 #define H5B2_INT_NREC(i, shared, idx) H5B2_NAT_NREC((i)->int_native, (shared), (idx))
00105
00106
00107 #define H5B2_LEAF_NREC(l, shared, idx) H5B2_NAT_NREC((l)->leaf_native, (shared), (idx))
00108
00109
00110
00111
00112
00113
00114
00115 typedef struct {
00116 haddr_t addr;
00117 unsigned node_nrec;
00118 hsize_t all_nrec;
00119 } H5B2_node_ptr_t;
00120
00121
00122 typedef struct {
00123 unsigned max_nrec;
00124 unsigned split_nrec;
00125 unsigned merge_nrec;
00126 hsize_t cum_max_nrec;
00127 unsigned char cum_max_nrec_size;
00128 H5FL_fac_head_t *nat_rec_fac;
00129 H5FL_fac_head_t *node_ptr_fac;
00130 } H5B2_node_info_t;
00131
00132
00133
00134
00135 typedef struct H5B2_shared_t {
00136
00137 const H5B2_class_t *type;
00138 uint8_t *page;
00139 size_t *nat_off;
00140 H5B2_node_info_t *node_info;
00141
00142
00143 unsigned split_percent;
00144 unsigned merge_percent;
00145 size_t node_size;
00146 size_t rrec_size;
00147
00148
00149 unsigned depth;
00150
00151
00152 unsigned char max_nrec_size;
00153 } H5B2_shared_t;
00154
00155
00156 typedef struct H5B2_t {
00157
00158 H5AC_info_t cache_info;
00159
00160
00161 H5B2_node_ptr_t root;
00162 H5RC_t *shared;
00163 } H5B2_t;
00164
00165
00166 typedef struct H5B2_leaf_t {
00167
00168 H5AC_info_t cache_info;
00169
00170
00171 H5RC_t *shared;
00172 uint8_t *leaf_native;
00173 unsigned nrec;
00174 } H5B2_leaf_t;
00175
00176
00177 typedef struct H5B2_internal_t {
00178
00179 H5AC_info_t cache_info;
00180
00181
00182 H5RC_t *shared;
00183 uint8_t *int_native;
00184 H5B2_node_ptr_t *node_ptrs;
00185 unsigned nrec;
00186 unsigned depth;
00187 } H5B2_internal_t;
00188
00189
00190 typedef struct {
00191 H5RC_t *bt2_shared;
00192 unsigned nrec;
00193 unsigned depth;
00194 } H5B2_int_load_ud1_t;
00195
00196 #ifdef H5B2_TESTING
00197
00198 typedef struct {
00199 unsigned depth;
00200 unsigned nrec;
00201 } H5B2_node_info_test_t;
00202 #endif
00203
00204
00205
00206
00207
00208
00209
00210 H5_DLLVAR const H5AC_class_t H5AC_BT2_HDR[1];
00211
00212
00213 H5_DLLVAR const H5AC_class_t H5AC_BT2_INT[1];
00214
00215
00216 H5_DLLVAR const H5AC_class_t H5AC_BT2_LEAF[1];
00217
00218
00219 H5FL_EXTERN(H5B2_t);
00220
00221
00222 H5FL_EXTERN(H5B2_internal_t);
00223
00224
00225 H5FL_EXTERN(H5B2_leaf_t);
00226
00227
00228 #ifdef H5B2_TESTING
00229 H5_DLLVAR const H5B2_class_t H5B2_TEST[1];
00230 #endif
00231
00232
00233
00234
00235
00236
00237
00238 H5_DLL herr_t H5B2_shared_init(H5F_t *f, H5B2_t *bt2, const H5B2_class_t *type,
00239 unsigned depth, size_t node_size, size_t rrec_size,
00240 unsigned split_percent, unsigned merge_percent);
00241
00242
00243 H5_DLL H5B2_internal_t *H5B2_protect_internal(H5F_t *f, hid_t dxpl_id,
00244 H5RC_t *bt2_shared, haddr_t addr, unsigned nrec, unsigned depth,
00245 H5AC_protect_t rw);
00246
00247
00248 H5_DLL herr_t H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2,
00249 unsigned *bt2_flags_ptr);
00250 H5_DLL herr_t H5B2_create_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
00251 H5B2_node_ptr_t *node_ptr);
00252
00253
00254 H5_DLL herr_t H5B2_insert_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
00255 unsigned depth, unsigned *parent_cache_info_flags_ptr,
00256 H5B2_node_ptr_t *curr_node_ptr, void *udata);
00257 H5_DLL herr_t H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
00258 H5B2_node_ptr_t *curr_node_ptr, void *udata);
00259
00260
00261 H5_DLL herr_t H5B2_iterate_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
00262 unsigned depth, const H5B2_node_ptr_t *curr_node, H5B2_operator_t op,
00263 void *op_data);
00264 H5_DLL herr_t H5B2_iterate_size_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
00265 unsigned depth, const H5B2_node_ptr_t *curr_node, hsize_t *op_data);
00266
00267
00268 H5_DLL int H5B2_locate_record(const H5B2_class_t *type, unsigned nrec,
00269 size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx);
00270 H5_DLL herr_t H5B2_neighbor_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
00271 unsigned depth, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
00272 H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data);
00273 H5_DLL herr_t H5B2_neighbor_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
00274 H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
00275 H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data);
00276
00277
00278 H5_DLL herr_t H5B2_remove_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
00279 hbool_t *depth_decreased, void *swap_loc, unsigned depth, H5AC_info_t *parent_cache_info,
00280 hbool_t * parent_cache_info_dirtied_ptr, H5B2_node_ptr_t *curr_node_ptr, void *udata,
00281 H5B2_remove_t op, void *op_data);
00282 H5_DLL herr_t H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
00283 H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op,
00284 void *op_data);
00285 H5_DLL herr_t H5B2_remove_internal_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
00286 hbool_t *depth_decreased, void *swap_loc, unsigned depth, H5AC_info_t *parent_cache_info,
00287 hbool_t * parent_cache_info_dirtied_ptr, H5B2_node_ptr_t *curr_node_ptr, hsize_t idx,
00288 H5B2_remove_t op, void *op_data);
00289 H5_DLL herr_t H5B2_remove_leaf_by_idx(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
00290 H5B2_node_ptr_t *curr_node_ptr, unsigned idx, H5B2_remove_t op,
00291 void *op_data);
00292
00293
00294 H5_DLL herr_t H5B2_delete_node(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
00295 unsigned depth, const H5B2_node_ptr_t *curr_node, H5B2_remove_t op,
00296 void *op_data);
00297
00298
00299 H5_DLL herr_t H5B2_cache_hdr_dest(H5F_t *f, H5B2_t *b);
00300 H5_DLL herr_t H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *l);
00301 H5_DLL herr_t H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *i);
00302
00303
00304 H5_DLL herr_t H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
00305 FILE *stream, int indent, int fwidth, const H5B2_class_t *type);
00306 H5_DLL herr_t H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
00307 FILE *stream, int indent, int fwidth, const H5B2_class_t *type,
00308 haddr_t hdr_addr, unsigned nrec, unsigned depth);
00309 H5_DLL herr_t H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
00310 FILE *stream, int indent, int fwidth, const H5B2_class_t *type,
00311 haddr_t hdr_addr, unsigned nrec);
00312
00313
00314 #ifdef H5B2_TESTING
00315 H5_DLL herr_t H5B2_get_root_addr_test(H5F_t *f, hid_t dxpl_id,
00316 const H5B2_class_t *type, haddr_t addr, haddr_t *root_addr);
00317 H5_DLL int H5B2_get_node_depth_test(H5F_t *f, hid_t dxpl_id,
00318 const H5B2_class_t *type, haddr_t addr, void *udata);
00319 H5_DLL herr_t H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id,
00320 const H5B2_class_t *type, haddr_t addr, void *udata,
00321 H5B2_node_info_test_t *ninfo);
00322 #endif
00323
00324 #endif
00325