summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-11-05 19:16:15 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-11-05 19:16:15 (GMT)
commit401f0c995f4c28d3bf4c15c859f0195bba70bdd3 (patch)
tree11b7d937ca665e7d78a6a38096b2f6b9129ee497 /src
parent30a52dd1a26f507f240cf48a9342e5a1d6023983 (diff)
downloadhdf5-401f0c995f4c28d3bf4c15c859f0195bba70bdd3.zip
hdf5-401f0c995f4c28d3bf4c15c859f0195bba70bdd3.tar.gz
hdf5-401f0c995f4c28d3bf4c15c859f0195bba70bdd3.tar.bz2
[svn-r17842] Description:
Further refactor v2 B-tree code toward being able to pass context info down to encode/decode client callbacks: - Separate H5B2_create call to return H5B2_t structure - Make loading the v2 B-tree header pick up the client class from the ID stored in the file. Simplify some internal API calls as a result. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.1 (amazon) in debug mode Mac OS X/32 10.6.1 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'src')
-rw-r--r--src/H5Adense.c4
-rw-r--r--src/H5B2.c173
-rw-r--r--src/H5B2cache.c12
-rw-r--r--src/H5B2pkg.h3
-rw-r--r--src/H5B2private.h10
-rw-r--r--src/H5B2stat.c6
-rw-r--r--src/H5Gdense.c6
-rw-r--r--src/H5HF.c2
-rw-r--r--src/H5HFhuge.c10
-rw-r--r--src/H5HFprivate.h2
-rwxr-xr-xsrc/H5SM.c4
11 files changed, 180 insertions, 52 deletions
diff --git a/src/H5Adense.c b/src/H5Adense.c
index ccc4e0f..d3ebe6d 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -1787,7 +1787,7 @@ H5A_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo)
udata.found_op_data = NULL;
/* Delete name index v2 B-tree */
- if(H5B2_delete(f, dxpl_id, H5A_BT2_NAME, ainfo->name_bt2_addr, H5A_dense_delete_bt2_cb, &udata) < 0)
+ if(H5B2_delete(f, dxpl_id, ainfo->name_bt2_addr, H5A_dense_delete_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index")
ainfo->name_bt2_addr = HADDR_UNDEF;
@@ -1799,7 +1799,7 @@ H5A_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo)
/* Check if we should delete the creation order index v2 B-tree */
if(H5F_addr_defined(ainfo->corder_bt2_addr)) {
/* Delete the creation order index, without adjusting the ref. count on the attributes */
- if(H5B2_delete(f, dxpl_id, H5A_BT2_CORDER, ainfo->corder_bt2_addr, NULL, NULL) < 0)
+ if(H5B2_delete(f, dxpl_id, ainfo->corder_bt2_addr, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for creation order index")
ainfo->corder_bt2_addr = HADDR_UNDEF;
} /* end if */
diff --git a/src/H5B2.c b/src/H5B2.c
index 1bdfe2a..ec9931d 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -61,9 +61,7 @@
/********************/
/* Local Prototypes */
/********************/
-static H5B2_t *H5B2_open(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls,
- haddr_t addr);
-static herr_t H5B2_close(H5B2_t *bt2, hid_t dxpl_id);
+static H5B2_t *H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr);
static herr_t H5B2_insert_2(H5B2_t *bt2, hid_t dxpl_id, void *udata);
static herr_t H5B2_iterate_2(H5B2_t *bt2, hid_t dxpl_id, H5B2_operator_t op,
void *op_data);
@@ -82,12 +80,42 @@ static herr_t H5B2_modify_2(H5B2_t *bt2, hid_t dxpl_id, void *udata,
H5B2_modify_t op, void *op_data);
static herr_t H5B2_iterate_size_2(H5B2_t *bt2, hid_t dxpl_id,
hsize_t *btree_size);
+static herr_t H5B2_close(H5B2_t *bt2, hid_t dxpl_id);
/*********************/
/* Package Variables */
/*********************/
+/* v2 B-tree client ID to class mapping */
+
+/* Remember to add client ID to H5B2_subid_t in H5B2private.h when adding a new
+ * client class..
+ */
+extern const H5B2_class_t H5B2_TEST[1];
+extern const H5B2_class_t H5HF_BT2_INDIR[1];
+extern const H5B2_class_t H5HF_BT2_FILT_INDIR[1];
+extern const H5B2_class_t H5HF_BT2_DIR[1];
+extern const H5B2_class_t H5HF_BT2_FILT_DIR[1];
+extern const H5B2_class_t H5G_BT2_NAME[1];
+extern const H5B2_class_t H5G_BT2_CORDER[1];
+extern const H5B2_class_t H5SM_INDEX[1];
+extern const H5B2_class_t H5A_BT2_NAME[1];
+extern const H5B2_class_t H5A_BT2_CORDER[1];
+
+const H5B2_class_t *const H5B2_client_class_g[] = {
+ H5B2_TEST, /* 0 - H5B2_TEST_ID */
+ H5HF_BT2_INDIR, /* 1 - H5B2_FHEAP_HUGE_INDIR_ID */
+ H5HF_BT2_FILT_INDIR, /* 2 - H5B2_FHEAP_HUGE_FILT_INDIR_ID */
+ H5HF_BT2_DIR, /* 3 - H5B2_FHEAP_HUGE_DIR_ID */
+ H5HF_BT2_FILT_DIR, /* 4 - H5B2_FHEAP_HUGE_FILT_DIR_ID */
+ H5G_BT2_NAME, /* 5 - H5B2_GRP_DENSE_NAME_ID */
+ H5G_BT2_CORDER, /* 6 - H5B2_GRP_DENSE_CORDER_ID */
+ H5SM_INDEX, /* 7 - H5B2_SOHM_INDEX_ID */
+ H5A_BT2_NAME, /* 8 - H5B2_ATTR_DENSE_NAME_ID */
+ H5A_BT2_CORDER, /* 9 - H5B2_ATTR_DENSE_CORDER_ID */
+};
+
/*****************************/
/* Library Private Variables */
@@ -104,6 +132,77 @@ H5FL_DEFINE_STATIC(H5B2_t);
/*-------------------------------------------------------------------------
+ * Function: H5B2_create_2
+ *
+ * Purpose: Creates a new empty B-tree in the file.
+ *
+ * Return: Non-negative on success (with address of new B-tree
+ * filled in), negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Jan 31 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+H5B2_t *
+H5B2_create_2(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam)
+{
+ H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
+ H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
+ haddr_t hdr_addr; /* B-tree header address */
+ H5B2_t *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5B2_create_2, NULL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(f);
+ HDassert(cparam);
+
+ /* H5B2 interface sanity check */
+ HDcompile_assert(H5B2_NUM_BTREE_ID == NELMTS(H5B2_client_class_g));
+
+ /* Create shared v2 B-tree header */
+ if(HADDR_UNDEF == (hdr_addr = H5B2_hdr_create(f, dxpl_id, cparam)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't create v2 B-tree header")
+
+ /* Create v2 B-tree wrapper */
+ if(NULL == (bt2 = H5FL_MALLOC(H5B2_t)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for v2 B-tree info")
+
+ /* Look up the B-tree header */
+ if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, NULL, NULL, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load B-tree header")
+
+ /* Point v2 B-tree wrapper at header and bump it's ref count */
+ bt2->hdr = hdr;
+ if(H5B2_hdr_incr(bt2->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment reference count on shared v2 B-tree header")
+
+ /* Increment # of files using this v2 B-tree header */
+ if(H5B2_hdr_fuse_incr(bt2->hdr) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment file reference count on shared v2 B-tree header")
+
+ /* Set file pointer for this v2 B-tree open context */
+ bt2->f = f;
+
+ /* Set the return value */
+ ret_value = bt2;
+
+done:
+ if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to release v2 B-tree header")
+ if(!ret_value && bt2)
+ if(H5B2_close(bt2, dxpl_id) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, NULL, "unable to close v2 B-tree")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5B2_create_2() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5B2_create
*
* Purpose: Creates a new empty B-tree in the file.
@@ -160,7 +259,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5B2_t *
-H5B2_open(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr)
+H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr)
{
H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
@@ -170,11 +269,10 @@ H5B2_open(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr)
/* Check arguments. */
HDassert(f);
- HDassert(cls);
HDassert(H5F_addr_defined(addr));
/* Look up the B-tree header */
- if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, cls, NULL, H5AC_READ)))
+ if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load B-tree header")
/* Check for pending heap deletion */
@@ -302,7 +400,7 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
HDassert(H5F_addr_defined(addr));
/* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, cls, addr)))
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
/* Insert the new record */
@@ -319,6 +417,37 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5B2_get_addr
+ *
+ * Purpose: Get the address of a v2 B-tree
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Nov 5 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr_p)
+{
+ FUNC_ENTER_NOAPI_NOFUNC(H5B2_get_addr)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(bt2);
+ HDassert(addr_p);
+
+ /* Retrieve the header address for this v2 B-tree */
+ *addr_p = bt2->hdr->addr;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5B2_get_addr() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5B2_iterate_2
*
* Purpose: Iterate over all the records in the B-tree, in "in-order"
@@ -397,7 +526,7 @@ H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
HDassert(op);
/* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, cls, addr)))
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
/* Iterate through records */
@@ -593,7 +722,7 @@ H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
HDassert(H5F_addr_defined(addr));
/* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, cls, addr)))
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
/* Operate on record */
@@ -804,7 +933,7 @@ H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
HDassert(op);
/* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, cls, addr)))
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
/* Locate and operate on record */
@@ -921,7 +1050,7 @@ H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
HDassert(H5F_addr_defined(addr));
/* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, cls, addr)))
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
/* Attempt to remove record from B-tree */
@@ -1047,7 +1176,7 @@ H5B2_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls,
HDassert(H5F_addr_defined(addr));
/* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, cls, addr)))
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
/* Attempt to remove record from B-tree */
@@ -1121,7 +1250,7 @@ H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
HDassert(nrec);
/* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, cls, addr)))
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
/* Get the number of records in the B-tree */
@@ -1241,7 +1370,7 @@ H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
HDassert(op);
/* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, cls, addr)))
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
/* Attempt to find neighbor record in B-tree */
@@ -1456,7 +1585,7 @@ H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
HDassert(op);
/* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, cls, addr)))
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
/* Locate & modify record */
@@ -1551,7 +1680,7 @@ H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls,
HDassert(btree_size);
/* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, cls, addr)))
+ if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
/* Iterate through B-tree, collective size info */
@@ -1583,7 +1712,6 @@ done:
static herr_t
H5B2_close(H5B2_t *bt2, hid_t dxpl_id)
{
- const H5B2_class_t *cls = NULL; /* Class of v2 B-tree client */
haddr_t bt2_addr = HADDR_UNDEF; /* Address of v2 B-tree (for deletion) */
hbool_t pending_delete = FALSE; /* Whether the v2 B-tree is pending deletion */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1606,7 +1734,6 @@ H5B2_close(H5B2_t *bt2, hid_t dxpl_id)
*/
pending_delete = TRUE;
bt2_addr = bt2->hdr->addr;
- cls = bt2->hdr->cls;
} /* end if */
} /* end if */
@@ -1623,10 +1750,9 @@ H5B2_close(H5B2_t *bt2, hid_t dxpl_id)
/* Sanity check */
HDassert(H5F_addr_defined(bt2_addr));
- HDassert(cls);
/* Lock the v2 B-tree header into memory */
- if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(bt2->f, dxpl_id, H5AC_BT2_HDR, bt2_addr, cls, NULL, H5AC_WRITE)))
+ if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(bt2->f, dxpl_id, H5AC_BT2_HDR, bt2_addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header")
/* Set the shared v2 B-tree header's file context for this operation */
@@ -1668,8 +1794,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
- H5B2_remove_t op, void *op_data)
+H5B2_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5B2_remove_t op,
+ void *op_data)
{
H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1678,14 +1804,13 @@ H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
/* Check arguments. */
HDassert(f);
- HDassert(cls);
HDassert(H5F_addr_defined(addr));
/* Lock the v2 B-tree header into memory */
#ifdef QAK
HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr);
#endif /* QAK */
- if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, cls, NULL, H5AC_WRITE)))
+ if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header")
/* Remember the callback & context for later */
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index aa39adb..31c28af 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -147,10 +147,10 @@ const H5AC_class_t H5AC_BT2_LEAF[1] = {{
*-------------------------------------------------------------------------
*/
static H5B2_hdr_t *
-H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, void UNUSED *udata)
+H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, void UNUSED *udata2)
{
- const H5B2_class_t *cls = (const H5B2_class_t *) _cls; /* Class of B-tree client */
H5B2_create_t cparam; /* B-tree creation parameters */
+ H5B2_subid_t id; /* ID of B-tree class, as found in file */
unsigned depth; /* Depth of B-tree */
H5B2_hdr_t *hdr = NULL; /* B-tree header */
size_t size; /* Header size */
@@ -167,7 +167,6 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, voi
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(cls);
/* Allocate new B-tree header and reset cache info */
if(NULL == (hdr = H5B2_hdr_alloc(f)))
@@ -201,8 +200,9 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, voi
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header version")
/* B-tree class */
- if(*p++ != (uint8_t)cls->id)
- HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type")
+ id = *p++;
+ if(id >= H5B2_NUM_BTREE_ID)
+ HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "invalid B-tree type")
/* Node size (in bytes) */
UINT32DECODE(p, cparam.node_size);
@@ -236,7 +236,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, voi
HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "incorrect metadata checksum for v2 B-tree header")
/* Initialize B-tree header info */
- cparam.cls = cls;
+ cparam.cls = H5B2_client_class_g[id];
if(H5B2_hdr_init(f, hdr, &cparam, depth) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't initialize B-tree header info")
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index 6323989..c4f3f55 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -240,6 +240,9 @@ H5FL_EXTERN(H5B2_leaf_t);
H5_DLLVAR const H5B2_class_t H5B2_TEST[1];
#endif /* H5B2_TESTING */
+/* Array of v2 B-tree client ID -> client class mappings */
+extern const H5B2_class_t *const H5B2_client_class_g[];
+
/******************************/
/* Package Private Prototypes */
diff --git a/src/H5B2private.h b/src/H5B2private.h
index 481f910..a97e332 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -130,6 +130,8 @@ typedef struct H5B2_t H5B2_t;
/***************************************/
H5_DLL herr_t H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam,
haddr_t *addr_p);
+H5_DLL H5B2_t *H5B2_create_2(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam);
+H5_DLL herr_t H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr/*out*/);
H5_DLL herr_t H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
haddr_t addr, void *udata);
H5_DLL herr_t H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
@@ -153,12 +155,12 @@ H5_DLL herr_t H5B2_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *ty
void *op_data);
H5_DLL herr_t H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
haddr_t addr, hsize_t *nrec);
-H5_DLL herr_t H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5B2_remove_t op, void *op_data);
+H5_DLL herr_t H5B2_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ H5B2_remove_t op, void *op_data);
/* Statistics routines */
-H5_DLL herr_t H5B2_stat_info(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5B2_stat_t *info);
+H5_DLL herr_t H5B2_stat_info(H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ H5B2_stat_t *info);
#endif /* _H5B2private_H */
diff --git a/src/H5B2stat.c b/src/H5B2stat.c
index 5fc7659..a5301de 100644
--- a/src/H5B2stat.c
+++ b/src/H5B2stat.c
@@ -85,8 +85,7 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_stat_info(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
- H5B2_stat_t *info)
+H5B2_stat_info(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5B2_stat_t *info)
{
H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED; /* Return value */
@@ -95,12 +94,11 @@ H5B2_stat_info(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
/* Check arguments. */
HDassert(f);
- HDassert(cls);
HDassert(H5F_addr_defined(addr));
HDassert(info);
/* Look up the B-tree header */
- if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, cls, NULL, H5AC_READ)))
+ if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get information about the B-tree */
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index a9219e9..a0aca7e 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -1709,7 +1709,7 @@ H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link)
udata.replace_names = FALSE;
/* Delete the name index, adjusting the ref. count on links removed */
- if(H5B2_delete(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, H5G_dense_remove_bt2_cb, &udata) < 0)
+ if(H5B2_delete(f, dxpl_id, linfo->name_bt2_addr, H5G_dense_remove_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index")
/* Close the fractal heap */
@@ -1718,7 +1718,7 @@ H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link)
} /* end if */
else {
/* Delete the name index, without adjusting the ref. count on the links */
- if(H5B2_delete(f, dxpl_id, H5G_BT2_NAME, linfo->name_bt2_addr, NULL, NULL) < 0)
+ if(H5B2_delete(f, dxpl_id, linfo->name_bt2_addr, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index")
} /* end else */
linfo->name_bt2_addr = HADDR_UNDEF;
@@ -1727,7 +1727,7 @@ H5G_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hbool_t adj_link)
if(linfo->index_corder) {
/* Delete the creation order index, without adjusting the ref. count on the links */
HDassert(H5F_addr_defined(linfo->corder_bt2_addr));
- if(H5B2_delete(f, dxpl_id, H5G_BT2_CORDER, linfo->corder_bt2_addr, NULL, NULL) < 0)
+ if(H5B2_delete(f, dxpl_id, linfo->corder_bt2_addr, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for creation order index")
linfo->corder_bt2_addr = HADDR_UNDEF;
} /* end if */
diff --git a/src/H5HF.c b/src/H5HF.c
index c1f0b2e..539a14f 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -322,7 +322,7 @@ H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p)
*-------------------------------------------------------------------------
*/
herr_t
-H5HF_get_heap_addr(H5HF_t *fh, haddr_t *heap_addr_p)
+H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr_p)
{
FUNC_ENTER_NOAPI_NOFUNC(H5HF_get_heap_addr)
diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c
index 71a3d61..161542b 100644
--- a/src/H5HFhuge.c
+++ b/src/H5HFhuge.c
@@ -987,7 +987,7 @@ H5HF_huge_term(H5HF_hdr_t *hdr, hid_t dxpl_id)
/* Delete the v2 B-tree */
/* (any v2 B-tree class will work here) */
- if(H5B2_delete(hdr->f, dxpl_id, H5HF_BT2_INDIR, hdr->huge_bt2_addr, NULL, NULL) < 0)
+ if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, NULL, NULL) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
/* Reset the information about 'huge' objects in the file */
@@ -1042,21 +1042,21 @@ H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id)
/* Delete the v2 B-tree */
if(hdr->huge_ids_direct) {
if(hdr->filter_len > 0) {
- if(H5B2_delete(hdr->f, dxpl_id, H5HF_BT2_FILT_DIR, hdr->huge_bt2_addr, H5HF_huge_bt2_filt_dir_remove, &udata) < 0)
+ if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, H5HF_huge_bt2_filt_dir_remove, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
} /* end if */
else {
- if(H5B2_delete(hdr->f, dxpl_id, H5HF_BT2_DIR, hdr->huge_bt2_addr, H5HF_huge_bt2_dir_remove, &udata) < 0)
+ if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, H5HF_huge_bt2_dir_remove, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
} /* end else */
} /* end if */
else {
if(hdr->filter_len > 0) {
- if(H5B2_delete(hdr->f, dxpl_id, H5HF_BT2_FILT_INDIR, hdr->huge_bt2_addr, H5HF_huge_bt2_filt_indir_remove, &udata) < 0)
+ if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, H5HF_huge_bt2_filt_indir_remove, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
} /* end if */
else {
- if(H5B2_delete(hdr->f, dxpl_id, H5HF_BT2_INDIR, hdr->huge_bt2_addr, H5HF_huge_bt2_indir_remove, &udata) < 0)
+ if(H5B2_delete(hdr->f, dxpl_id, hdr->huge_bt2_addr, H5HF_huge_bt2_indir_remove, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
} /* end else */
} /* end else */
diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h
index 790f5ea..55daa30 100644
--- a/src/H5HFprivate.h
+++ b/src/H5HFprivate.h
@@ -111,7 +111,7 @@ typedef herr_t (*H5HF_operator_t)(const void *obj/*in*/, size_t obj_len,
H5_DLL H5HF_t *H5HF_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam);
H5_DLL H5HF_t *H5HF_open(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr);
H5_DLL herr_t H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p/*out*/);
-H5_DLL herr_t H5HF_get_heap_addr(H5HF_t *fh, haddr_t *heap_addr/*out*/);
+H5_DLL herr_t H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr/*out*/);
H5_DLL herr_t H5HF_insert(H5HF_t *fh, hid_t dxpl_id, size_t size,
const void *obj, void *id/*out*/);
H5_DLL herr_t H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *id,
diff --git a/src/H5SM.c b/src/H5SM.c
index 56d00e3..d05c73d 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -564,7 +564,7 @@ H5SM_delete_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id,
HDassert(header->index_type == H5SM_BTREE);
/* Delete from the B-tree. */
- if(H5B2_delete(f, dxpl_id, H5SM_INDEX, header->index_addr, NULL, NULL) < 0)
+ if(H5B2_delete(f, dxpl_id, header->index_addr, NULL, NULL) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree")
/* Revert to list unless B-trees can have zero records */
@@ -810,7 +810,7 @@ H5SM_convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header, hid_t dxpl_i
/* Delete the B-tree and have messages copy themselves to the
* list as they're deleted
*/
- if(H5B2_delete(f, dxpl_id, H5SM_INDEX, btree_addr, H5SM_btree_convert_to_list_op, list) < 0)
+ if(H5B2_delete(f, dxpl_id, btree_addr, H5SM_btree_convert_to_list_op, list) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree")
done: