diff options
Diffstat (limited to 'src/H5Gbtree2.c')
-rw-r--r-- | src/H5Gbtree2.c | 156 |
1 files changed, 66 insertions, 90 deletions
diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index ee0b26e..dd147ae 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -6,7 +6,7 @@ * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -15,7 +15,7 @@ * * Created: H5Gbtree2.c * Sep 9 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: v2 B-tree callbacks for indexing fields on links * @@ -70,23 +70,23 @@ typedef struct H5G_fh_ud_cmp_t { /* v2 B-tree function callbacks */ /* v2 B-tree driver callbacks for 'creation order' index */ -static herr_t H5G_dense_btree2_corder_store(void *native, const void *udata); -static herr_t H5G_dense_btree2_corder_compare(const void *rec1, const void *rec2, int *result); -static herr_t H5G_dense_btree2_corder_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5G_dense_btree2_corder_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record, - const void *_udata); +static herr_t H5G__dense_btree2_corder_store(void *native, const void *udata); +static herr_t H5G__dense_btree2_corder_compare(const void *rec1, const void *rec2, int *result); +static herr_t H5G__dense_btree2_corder_encode(uint8_t *raw, const void *native, void *ctx); +static herr_t H5G__dense_btree2_corder_decode(const uint8_t *raw, void *native, void *ctx); +static herr_t H5G__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record, + const void *_udata); /* v2 B-tree driver callbacks for 'name' index */ -static herr_t H5G_dense_btree2_name_store(void *native, const void *udata); +static herr_t H5G__dense_btree2_name_store(void *native, const void *udata); static herr_t H5G__dense_btree2_name_compare(const void *rec1, const void *rec2, int *result); -static herr_t H5G_dense_btree2_name_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5G_dense_btree2_name_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record, - const void *_udata); +static herr_t H5G__dense_btree2_name_encode(uint8_t *raw, const void *native, void *ctx); +static herr_t H5G__dense_btree2_name_decode(const uint8_t *raw, void *native, void *ctx); +static herr_t H5G__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record, + const void *_udata); /* Fractal heap function callbacks */ -static herr_t H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data); +static herr_t H5G__dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data); /*********************/ /* Package Variables */ @@ -99,11 +99,11 @@ const H5B2_class_t H5G_BT2_NAME[1] = {{ sizeof(H5G_dense_bt2_name_rec_t), /* Size of native record */ NULL, /* Create client callback context */ NULL, /* Destroy client callback context */ - H5G_dense_btree2_name_store, /* Record storage callback */ + H5G__dense_btree2_name_store, /* Record storage callback */ H5G__dense_btree2_name_compare, /* Record comparison callback */ - H5G_dense_btree2_name_encode, /* Record encoding callback */ - H5G_dense_btree2_name_decode, /* Record decoding callback */ - H5G_dense_btree2_name_debug /* Record debugging callback */ + H5G__dense_btree2_name_encode, /* Record encoding callback */ + H5G__dense_btree2_name_decode, /* Record decoding callback */ + H5G__dense_btree2_name_debug /* Record debugging callback */ }}; /* v2 B-tree class for indexing 'creation order' field of links */ @@ -114,11 +114,11 @@ const H5B2_class_t H5G_BT2_CORDER[1] = {{ sizeof(H5G_dense_bt2_corder_rec_t), /* Size of native record */ NULL, /* Create client callback context */ NULL, /* Destroy client callback context */ - H5G_dense_btree2_corder_store, /* Record storage callback */ - H5G_dense_btree2_corder_compare, /* Record comparison callback */ - H5G_dense_btree2_corder_encode, /* Record encoding callback */ - H5G_dense_btree2_corder_decode, /* Record decoding callback */ - H5G_dense_btree2_corder_debug /* Record debugging callback */ + H5G__dense_btree2_corder_store, /* Record storage callback */ + H5G__dense_btree2_corder_compare, /* Record comparison callback */ + H5G__dense_btree2_corder_encode, /* Record encoding callback */ + H5G__dense_btree2_corder_decode, /* Record decoding callback */ + H5G__dense_btree2_corder_debug /* Record debugging callback */ }}; /*****************************/ @@ -130,7 +130,7 @@ const H5B2_class_t H5G_BT2_CORDER[1] = {{ /*******************/ /*------------------------------------------------------------------------- - * Function: H5G_dense_fh_name_cmp + * Function: H5G__dense_fh_name_cmp * * Purpose: Compares the name of a link in a fractal heap to another * name @@ -138,19 +138,18 @@ const H5B2_class_t H5G_BT2_CORDER[1] = {{ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) +H5G__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) { H5G_fh_ud_cmp_t *udata = (H5G_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */ H5O_link_t * lnk; /* Pointer to link created from heap object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Decode link information */ if (NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, @@ -171,10 +170,10 @@ H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_fh_name_cmp() */ +} /* end H5G__dense_fh_name_cmp() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_name_store + * Function: H5G__dense_btree2_name_store * * Purpose: Store user information into native record for v2 B-tree * @@ -187,19 +186,19 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_store(void *_nrecord, const void *_udata) +H5G__dense_btree2_name_store(void *_nrecord, const void *_udata) { const H5G_bt2_ud_ins_t * udata = (const H5G_bt2_ud_ins_t *)_udata; H5G_dense_bt2_name_rec_t *nrecord = (H5G_dense_bt2_name_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Copy user information info native record */ nrecord->hash = udata->common.name_hash; H5MM_memcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_name_store() */ +} /* H5G__dense_btree2_name_store() */ /*------------------------------------------------------------------------- * Function: H5G__dense_btree2_name_compare @@ -228,17 +227,6 @@ H5G__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int HDassert(bt2_udata); HDassert(bt2_rec); -#ifdef QAK - { - unsigned u; - - HDfprintf(stderr, "%s: bt2_udata = {'%s', %x}\n", "H5G__dense_btree2_name_compare", bt2_udata->name, - (unsigned)bt2_udata->name_hash); - HDfprintf(stderr, "%s: bt2_rec = {%x, ", "H5G__dense_btree2_name_compare", (unsigned)bt2_rec->hash); - for (u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) - HDfprintf(stderr, "%02x%s", bt2_rec->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); - } -#endif /* QAK */ /* Check hash value */ if (bt2_udata->name_hash < bt2_rec->hash) *result = (-1); @@ -261,7 +249,7 @@ H5G__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int fh_udata.cmp = 0; /* Check if the user's link and the B-tree's link have the same name */ - if (H5HF_op(bt2_udata->fheap, bt2_rec->id, H5G_dense_fh_name_cmp, &fh_udata) < 0) + if (H5HF_op(bt2_udata->fheap, bt2_rec->id, H5G__dense_fh_name_cmp, &fh_udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") /* Callback will set comparison value */ @@ -273,7 +261,7 @@ done: } /* H5G__dense_btree2_name_compare() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_name_encode + * Function: H5G__dense_btree2_name_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -286,21 +274,21 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UNUSED *ctx) +H5G__dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UNUSED *ctx) { const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Encode the record's fields */ UINT32ENCODE(raw, nrecord->hash) H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_name_encode() */ +} /* H5G__dense_btree2_name_encode() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_name_decode + * Function: H5G__dense_btree2_name_decode * * Purpose: Decode raw disk form of record into native form * @@ -313,21 +301,21 @@ H5G_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UN *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UNUSED *ctx) +H5G__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UNUSED *ctx) { H5G_dense_bt2_name_rec_t *nrecord = (H5G_dense_bt2_name_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Decode the record's fields */ UINT32DECODE(raw, nrecord->hash) H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_name_decode() */ +} /* H5G__dense_btree2_name_decode() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_name_debug + * Function: H5G__dense_btree2_name_debug * * Purpose: Debug native form of record * @@ -340,23 +328,23 @@ H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UN *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord, - const void H5_ATTR_UNUSED *_udata) +H5G__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord, + const void H5_ATTR_UNUSED *_udata) { const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord; unsigned u; /* Local index variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%x, ", indent, "", fwidth, "Record:", (unsigned)nrecord->hash); for (u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_name_debug() */ +} /* H5G__dense_btree2_name_debug() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_store + * Function: H5G__dense_btree2_corder_store * * Purpose: Store user information into native record for v2 B-tree * @@ -369,22 +357,22 @@ H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_n *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_store(void *_nrecord, const void *_udata) +H5G__dense_btree2_corder_store(void *_nrecord, const void *_udata) { const H5G_bt2_ud_ins_t * udata = (const H5G_bt2_ud_ins_t *)_udata; H5G_dense_bt2_corder_rec_t *nrecord = (H5G_dense_bt2_corder_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Copy user information info native record */ nrecord->corder = udata->common.corder; H5MM_memcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_store() */ +} /* H5G__dense_btree2_corder_store() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_compare + * Function: H5G__dense_btree2_corder_compare * * Purpose: Compare two native information records, according to some key * @@ -398,29 +386,17 @@ H5G_dense_btree2_corder_store(void *_nrecord, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, int *result) +H5G__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, int *result) { const H5G_bt2_ud_common_t * bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata; const H5G_dense_bt2_corder_rec_t *bt2_rec = (const H5G_dense_bt2_corder_rec_t *)_bt2_rec; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(bt2_udata); HDassert(bt2_rec); -#ifdef QAK - { - unsigned u; - - HDfprintf(stderr, "%s: bt2_udata->corder = %Hd\n", "H5G_dense_btree2_corder_compare", - (hsize_t)bt2_udata->corder); - HDfprintf(stderr, "%s: bt2_rec = {%Hu, ", "H5G_dense_btree2_corder_compare", - (hsize_t)bt2_rec->corder); - for (u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) - HDfprintf(stderr, "%02x%s", bt2_rec->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); - } -#endif /* QAK */ /* Check creation order value */ if (bt2_udata->corder < bt2_rec->corder) *result = -1; @@ -430,10 +406,10 @@ H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, in *result = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_compare() */ +} /* H5G__dense_btree2_corder_compare() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_encode + * Function: H5G__dense_btree2_corder_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -446,21 +422,21 @@ H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, in *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UNUSED *ctx) +H5G__dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UNUSED *ctx) { const H5G_dense_bt2_corder_rec_t *nrecord = (const H5G_dense_bt2_corder_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Encode the record's fields */ INT64ENCODE(raw, nrecord->corder) H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_encode() */ +} /* H5G__dense_btree2_corder_encode() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_decode + * Function: H5G__dense_btree2_corder_decode * * Purpose: Decode raw disk form of record into native form * @@ -473,21 +449,21 @@ H5G_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_ *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UNUSED *ctx) +H5G__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UNUSED *ctx) { H5G_dense_bt2_corder_rec_t *nrecord = (H5G_dense_bt2_corder_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Decode the record's fields */ INT64DECODE(raw, nrecord->corder) H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_decode() */ +} /* H5G__dense_btree2_corder_decode() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_debug + * Function: H5G__dense_btree2_corder_debug * * Purpose: Debug native form of record * @@ -500,17 +476,17 @@ H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_ *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord, - const void H5_ATTR_UNUSED *_udata) +H5G__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord, + const void H5_ATTR_UNUSED *_udata) { const H5G_dense_bt2_corder_rec_t *nrecord = (const H5G_dense_bt2_corder_rec_t *)_nrecord; unsigned u; /* Local index variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%llu, ", indent, "", fwidth, "Record:", (unsigned long long)nrecord->corder); for (u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_debug() */ +} /* H5G__dense_btree2_corder_debug() */ |