diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-08-17 15:49:06 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-08-17 15:49:06 (GMT) |
commit | 832305699d1ef7c43ac93bc83dc3bb724249f240 (patch) | |
tree | 526437dadbe6e614580850327786adf9f46fed70 /src | |
parent | 7fd5028f7ccfa34bec0e46c21113dbc664c4b850 (diff) | |
download | hdf5-832305699d1ef7c43ac93bc83dc3bb724249f240.zip hdf5-832305699d1ef7c43ac93bc83dc3bb724249f240.tar.gz hdf5-832305699d1ef7c43ac93bc83dc3bb724249f240.tar.bz2 |
[svn-r12589] Description:
Revert passing the v2 B-tree class to callbacks, it turns out to be
unnecessary. Also revert have a "class private" pointer for each v2 B-tree
class.
Add in support for the different flavors of fractal heap 'huge' objects
also.
Tested on:
FreeBSD/32 4.11 (sleipnir)
Linux/64 2.4 (mir)
Solaris/64 2.9 (shanti)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5B2cache.c | 8 | ||||
-rw-r--r-- | src/H5B2dbg.c | 28 | ||||
-rw-r--r-- | src/H5B2int.c | 4 | ||||
-rw-r--r-- | src/H5B2private.h | 18 | ||||
-rw-r--r-- | src/H5B2test.c | 25 |
5 files changed, 48 insertions, 35 deletions
diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 1e35804..684ea7b 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -497,7 +497,7 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v native = leaf->leaf_native; for(u = 0; u < leaf->nrec; u++) { /* Decode record */ - if((shared->type->decode)(f, shared->type, p, native) < 0) + if((shared->type->decode)(f, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record") /* Move to next record */ @@ -569,7 +569,7 @@ H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5 native = leaf->leaf_native; for(u = 0; u < leaf->nrec; u++) { /* Encode record */ - if((shared->type->encode)(f, shared->type, p, native) < 0) + if((shared->type->encode)(f, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record") /* Move to next record */ @@ -796,7 +796,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nre native = internal->int_native; for(u = 0; u < internal->nrec; u++) { /* Decode record */ - if((shared->type->decode)(f, shared->type, p, native) < 0) + if((shared->type->decode)(f, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record") /* Move to next record */ @@ -881,7 +881,7 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr native = internal->int_native; for(u = 0; u < internal->nrec; u++) { /* Encode record */ - if((shared->type->encode)(f, shared->type, p, native) < 0) + if((shared->type->encode)(f, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record") /* Move to next record */ diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index 88e6852..6f1799f 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -123,8 +123,12 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Tree type ID:", - ((shared->type->id) == H5B2_TEST_ID ? "H5B2_TEST_ID" : - "Unknown!")); + (shared->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" : + (shared->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" : + (shared->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" : + (shared->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" : + (shared->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" : + "Unknown!")))))); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of node:", shared->node_size); @@ -246,8 +250,12 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Tree type ID:", - ((shared->type->id)==H5B2_TEST_ID ? "H5B2_TEST_ID" : - "Unknown!")); + (shared->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" : + (shared->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" : + (shared->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" : + (shared->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" : + (shared->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" : + "Unknown!")))))); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of node:", shared->node_size); @@ -277,7 +285,7 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, temp_str); HDassert(H5B2_INT_NREC(internal, shared, u)); (void)(type->debug)(stream, f, dxpl_id, indent + 6, MAX (0, fwidth-6), - shared->type, H5B2_INT_NREC(internal,shared,u), NULL); + H5B2_INT_NREC(internal,shared,u), NULL); } /* end for */ /* Print final node pointer */ @@ -363,8 +371,12 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Tree type ID:", - ((shared->type->id)==H5B2_TEST_ID ? "H5B2_TEST_ID" : - "Unknown!")); + (shared->type->id == H5B2_TEST_ID ? "H5B2_TEST_ID" : + (shared->type->id == H5B2_FHEAP_HUGE_INDIR_ID ? "H5B2_FHEAP_HUGE_INDIR_ID" : + (shared->type->id == H5B2_FHEAP_HUGE_FILT_INDIR_ID ? "H5B2_FHEAP_HUGE_FILT_INDIR_ID" : + (shared->type->id == H5B2_FHEAP_HUGE_DIR_ID ? "H5B2_FHEAP_HUGE_DIR_ID" : + (shared->type->id == H5B2_FHEAP_HUGE_FILT_DIR_ID ? "H5B2_FHEAP_HUGE_FILT_DIR_ID" : + "Unknown!")))))); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of node:", shared->node_size); @@ -386,7 +398,7 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, temp_str); HDassert(H5B2_LEAF_NREC(leaf, shared, u)); (void)(type->debug)(stream, f, dxpl_id, indent+6, MAX (0, fwidth-6), - shared->type, H5B2_LEAF_NREC(leaf,shared,u), NULL); + H5B2_LEAF_NREC(leaf,shared,u), NULL); } /* end for */ done: diff --git a/src/H5B2int.c b/src/H5B2int.c index 8c6f515..16e87a6 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -303,7 +303,7 @@ H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off, hi = nrec; while(lo < hi && cmp) { my_idx = (lo + hi) / 2; - if((cmp = (type->compare)(type, udata, native + rec_off[my_idx])) < 0) + if((cmp = (type->compare)(udata, native + rec_off[my_idx])) < 0) hi = my_idx; else lo = my_idx + 1; @@ -2239,7 +2239,7 @@ H5B2_insert_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared, } /* end else */ /* Make callback to store record in native form */ - if((shared->type->store)(shared->type, H5B2_LEAF_NREC(leaf,shared,idx), udata) < 0) + if((shared->type->store)(H5B2_LEAF_NREC(leaf,shared,idx), udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node") /* Update record count for node pointer to current node */ diff --git a/src/H5B2private.h b/src/H5B2private.h index f71a256..cda4df0 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -52,7 +52,10 @@ /* B-tree IDs for various internal things. */ typedef enum H5B2_subid_t { H5B2_TEST_ID = 0, /* B-tree is for testing (do not use for actual data) */ - H5B2_FHEAP_ID, /* B-tree is for fractal heap */ + H5B2_FHEAP_HUGE_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, non-filtered 'huge' objects */ + H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, filtered 'huge' objects */ + H5B2_FHEAP_HUGE_DIR_ID, /* B-tree is for fractal heap directly accessed, non-filtered 'huge' objects */ + H5B2_FHEAP_HUGE_FILT_DIR_ID, /* B-tree is for fractal heap directly accessed, filtered 'huge' objects */ H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */ } H5B2_subid_t; @@ -82,22 +85,21 @@ typedef struct H5B2_class_t H5B2_class_t; struct H5B2_class_t { H5B2_subid_t id; /* ID of B-tree class, as found in file */ size_t nrec_size; /* Size of native (memory) record */ - void *cls_private; /* Pointer to class-private information */ /* Store & retrieve record from application to B-tree 'native' form */ - herr_t (*store)(const H5B2_class_t *cls, void *nrecord, const void *udata); /* Store record in native record table */ - herr_t (*retrieve)(const H5B2_class_t *cls, void *udata, const void *nrecord); /* Retrieve record in native record table */ + herr_t (*store)(void *nrecord, const void *udata); /* Store record in native record table */ + herr_t (*retrieve)(void *udata, const void *nrecord); /* Retrieve record in native record table */ /* Compare records, according to a key */ - herr_t (*compare)(const H5B2_class_t *cls, const void *rec1, const void *rec2); /* Compare two native records */ + herr_t (*compare)(const void *rec1, const void *rec2); /* Compare two native records */ /* Encode & decode record values */ - herr_t (*encode)(const H5F_t *f, const H5B2_class_t *cls, uint8_t *raw, const void *record); /* Encode record from native form to disk storage form */ - herr_t (*decode)(const H5F_t *f, const H5B2_class_t *cls, const uint8_t *raw, void *record); /* Decode record from disk storage form to native form */ + herr_t (*encode)(const H5F_t *f, uint8_t *raw, const void *record); /* Encode record from native form to disk storage form */ + herr_t (*decode)(const H5F_t *f, const uint8_t *raw, void *record); /* Decode record from disk storage form to native form */ /* Debug record values */ herr_t (*debug)(FILE *stream, const H5F_t *f, hid_t dxpl_id, /* Print a record for debugging */ - int indent, int fwidth, const H5B2_class_t *cls, const void *record, + int indent, int fwidth, const void *record, const void *udata); }; diff --git a/src/H5B2test.c b/src/H5B2test.c index 68f26ee..1844e75 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -51,15 +51,15 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5B2_test_store(const H5B2_class_t *cls, void *nrecord, const void *udata); -static herr_t H5B2_test_retrieve(const H5B2_class_t *cls, void *udata, const void *nrecord); -static herr_t H5B2_test_compare(const H5B2_class_t *cls, const void *rec1, const void *rec2); -static herr_t H5B2_test_encode(const H5F_t *f, const H5B2_class_t *cls, uint8_t *raw, +static herr_t H5B2_test_store(void *nrecord, const void *udata); +static herr_t H5B2_test_retrieve(void *udata, const void *nrecord); +static herr_t H5B2_test_compare(const void *rec1, const void *rec2); +static herr_t H5B2_test_encode(const H5F_t *f, uint8_t *raw, const void *nrecord); -static herr_t H5B2_test_decode(const H5F_t *f, const H5B2_class_t *cls, const uint8_t *raw, +static herr_t H5B2_test_decode(const H5F_t *f, const uint8_t *raw, void *nrecord); static herr_t H5B2_test_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, - int indent, int fwidth, const H5B2_class_t *cls, const void *record, const void *_udata); + int indent, int fwidth, const void *record, const void *_udata); /*********************/ /* Package Variables */ @@ -67,7 +67,6 @@ static herr_t H5B2_test_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id, const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */ H5B2_TEST_ID, /* Type of B-tree */ sizeof(hsize_t), /* Size of native record */ - NULL, /* Class private information */ H5B2_test_store, /* Record storage callback */ H5B2_test_retrieve, /* Record retrieval callback */ H5B2_test_compare, /* Record comparison callback */ @@ -101,7 +100,7 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */ *------------------------------------------------------------------------- */ static herr_t -H5B2_test_store(const H5B2_class_t UNUSED *cls, void *nrecord, const void *udata) +H5B2_test_store(void *nrecord, const void *udata) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_store) @@ -126,7 +125,7 @@ H5B2_test_store(const H5B2_class_t UNUSED *cls, void *nrecord, const void *udata *------------------------------------------------------------------------- */ static herr_t -H5B2_test_retrieve(const H5B2_class_t UNUSED *cls, void *udata, const void *nrecord) +H5B2_test_retrieve(void *udata, const void *nrecord) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_retrieve) @@ -151,7 +150,7 @@ H5B2_test_retrieve(const H5B2_class_t UNUSED *cls, void *udata, const void *nrec *------------------------------------------------------------------------- */ static herr_t -H5B2_test_compare(const H5B2_class_t UNUSED *cls, const void *rec1, const void *rec2) +H5B2_test_compare(const void *rec1, const void *rec2) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_compare) @@ -174,7 +173,7 @@ H5B2_test_compare(const H5B2_class_t UNUSED *cls, const void *rec1, const void * *------------------------------------------------------------------------- */ static herr_t -H5B2_test_encode(const H5F_t *f, const H5B2_class_t UNUSED *cls, uint8_t *raw, const void *nrecord) +H5B2_test_encode(const H5F_t *f, uint8_t *raw, const void *nrecord) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_encode) @@ -199,7 +198,7 @@ H5B2_test_encode(const H5F_t *f, const H5B2_class_t UNUSED *cls, uint8_t *raw, c *------------------------------------------------------------------------- */ static herr_t -H5B2_test_decode(const H5F_t *f, const H5B2_class_t UNUSED *cls, const uint8_t *raw, void *nrecord) +H5B2_test_decode(const H5F_t *f, const uint8_t *raw, void *nrecord) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_decode) @@ -225,7 +224,7 @@ H5B2_test_decode(const H5F_t *f, const H5B2_class_t UNUSED *cls, const uint8_t * */ static herr_t H5B2_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, - int indent, int fwidth, const H5B2_class_t UNUSED *cls, const void *record, + int indent, int fwidth, const void *record, const void UNUSED *_udata) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_debug) |