summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5EA.c9
-rw-r--r--src/H5EAcache.c4
-rw-r--r--src/H5EAhdr.c9
-rw-r--r--src/H5EApkg.h6
-rw-r--r--src/H5EAprivate.h7
-rw-r--r--src/H5EAtest.c5
-rw-r--r--test/earray.c36
7 files changed, 40 insertions, 36 deletions
diff --git a/src/H5EA.c b/src/H5EA.c
index 85ae821..e35738d 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -110,7 +110,7 @@ H5FL_DEFINE_STATIC(H5EA_t);
*/
BEGIN_FUNC(PRIV, ERR,
H5EA_t *, NULL, NULL,
-H5EA_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam))
+H5EA_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam, void *ctx_udata))
/* Local variables */
H5EA_t *ea = NULL; /* Pointer to new extensible array */
@@ -128,7 +128,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
HDassert(cparam);
/* Create extensible array header */
- if(HADDR_UNDEF == (ea_addr = H5EA__hdr_create(f, dxpl_id, cparam)))
+ if(HADDR_UNDEF == (ea_addr = H5EA__hdr_create(f, dxpl_id, cparam, ctx_udata)))
H5E_THROW(H5E_CANTINIT, "can't create extensible array header")
/* Allocate extensible array wrapper */
@@ -181,7 +181,8 @@ END_FUNC(PRIV) /* end H5EA_create() */
*/
BEGIN_FUNC(PRIV, ERR,
H5EA_t *, NULL, NULL,
-H5EA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, const H5EA_class_t *cls))
+H5EA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, const H5EA_class_t *cls,
+ void *ctx_udata))
/* Local variables */
H5EA_t *ea = NULL; /* Pointer to new extensible array wrapper */
@@ -198,7 +199,7 @@ H5EA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, const H5EA_class_t *cls))
#ifdef QAK
HDfprintf(stderr, "%s: ea_addr = %a\n", FUNC, ea_addr);
#endif /* QAK */
- if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, cls, NULL, H5AC_READ)))
+ if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, cls, ctx_udata, H5AC_READ)))
H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header, address = %llu", (unsigned long long)ea_addr)
/* Check for pending array deletion */
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index 8947960..00d3089 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -199,7 +199,7 @@ const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1] = {{
BEGIN_FUNC(STATIC, ERR,
H5EA_hdr_t *, NULL, NULL,
H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls,
- void UNUSED *udata2))
+ void *ctx_udata))
/* Local variables */
const H5EA_class_t *cls = (const H5EA_class_t *)_cls; /* Extensible array class */
@@ -217,7 +217,7 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls,
HDassert(H5F_addr_defined(addr));
/* Allocate space for the extensible array data structure */
- if(NULL == (hdr = H5EA__hdr_alloc(f, cls)))
+ if(NULL == (hdr = H5EA__hdr_alloc(f, cls, ctx_udata)))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
/* Set the extensible array header's address */
diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c
index 0a7ddef..1e01601 100644
--- a/src/H5EAhdr.c
+++ b/src/H5EAhdr.c
@@ -116,7 +116,7 @@ H5FL_SEQ_DEFINE_STATIC(H5EA_sblk_info_t);
*/
BEGIN_FUNC(PKG, ERR,
H5EA_hdr_t *, NULL, NULL,
-H5EA__hdr_alloc(H5F_t *f, const H5EA_class_t *cls))
+H5EA__hdr_alloc(H5F_t *f, const H5EA_class_t *cls, void *udata))
/* Local variables */
H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
@@ -141,7 +141,7 @@ H5EA__hdr_alloc(H5F_t *f, const H5EA_class_t *cls))
hdr->cparam.cls = cls;
/* Create the callback context */
- if(NULL == (hdr->cb_ctx = (*cls->crt_context)(f)))
+ if(NULL == (hdr->cb_ctx = (*cls->crt_context)(udata)))
H5E_THROW(H5E_CANTCREATE, "unable to create extensible array client callback context")
/* Set the return value */
@@ -368,7 +368,8 @@ END_FUNC(PKG) /* end H5EA__hdr_free_elmts() */
*/
BEGIN_FUNC(PKG, ERR,
haddr_t, HADDR_UNDEF, HADDR_UNDEF,
-H5EA__hdr_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam))
+H5EA__hdr_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam,
+ void *ctx_udata))
/* Local variables */
H5EA_hdr_t *hdr = NULL; /* Extensible array header */
@@ -416,7 +417,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
#endif /* NDEBUG */
/* Allocate space for the shared information */
- if(NULL == (hdr = H5EA__hdr_alloc(f, cparam->cls)))
+ if(NULL == (hdr = H5EA__hdr_alloc(f, cparam->cls, ctx_udata)))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header")
/* Set the internal parameters for the array */
diff --git a/src/H5EApkg.h b/src/H5EApkg.h
index 3f32b19..b2f837a 100644
--- a/src/H5EApkg.h
+++ b/src/H5EApkg.h
@@ -652,9 +652,11 @@ H5_DLL herr_t H5EA__destroy_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_en
H5AC_info_t *child_entry);
/* Header routines */
-H5_DLL H5EA_hdr_t *H5EA__hdr_alloc(H5F_t *f, const H5EA_class_t *cls);
+H5_DLL H5EA_hdr_t *H5EA__hdr_alloc(H5F_t *f, const H5EA_class_t *cls,
+ void *ctx_udata);
H5_DLL herr_t H5EA__hdr_init(H5EA_hdr_t *hdr);
-H5_DLL haddr_t H5EA__hdr_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam);
+H5_DLL haddr_t H5EA__hdr_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam,
+ void *ctx_udata);
H5_DLL void *H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts);
H5_DLL herr_t H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts);
H5_DLL herr_t H5EA__hdr_incr(H5EA_hdr_t *hdr);
diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h
index 9e3fa48..f525a01 100644
--- a/src/H5EAprivate.h
+++ b/src/H5EAprivate.h
@@ -62,7 +62,7 @@ typedef struct H5EA_class_t {
size_t nat_elmt_size; /* Size of native (memory) element */
/* Extensible array client callback methods */
- void *(*crt_context)(const H5F_t *f); /* Create context for other callbacks */
+ void *(*crt_context)(void *udata); /* Create context for other callbacks */
herr_t (*dst_context)(void *ctx); /* Destroy context */
herr_t (*fill)(void *nat_blk, size_t nelmts); /* Fill array of elements with encoded form of "missing element" value */
herr_t (*encode)(void *raw, const void *elmt, size_t nelmts, void *ctx); /* Encode elements from native form to disk storage form */
@@ -118,9 +118,10 @@ typedef struct H5EA_t H5EA_t;
/***************************************/
/* General routines */
-H5_DLL H5EA_t *H5EA_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam);
+H5_DLL H5EA_t *H5EA_create(H5F_t *f, hid_t dxpl_id, const H5EA_create_t *cparam,
+ void *ctx_udata);
H5_DLL H5EA_t *H5EA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr,
- const H5EA_class_t *cls);
+ const H5EA_class_t *cls, void *ctx_udata);
H5_DLL herr_t H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts);
H5_DLL herr_t H5EA_get_addr(const H5EA_t *ea, haddr_t *addr);
H5_DLL herr_t H5EA_set(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, const void *elmt);
diff --git a/src/H5EAtest.c b/src/H5EAtest.c
index 58e8bc2..93cd518 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -69,7 +69,7 @@ typedef struct H5EA__test_ctx_t {
/********************/
/* Extensible array class callbacks */
-static void *H5EA__test_crt_context(const H5F_t *f);
+static void *H5EA__test_crt_context(void *udata);
static herr_t H5EA__test_dst_context(void *ctx);
static herr_t H5EA__test_fill(void *nat_blk, size_t nelmts);
static herr_t H5EA__test_encode(void *raw, const void *elmt, size_t nelmts,
@@ -126,13 +126,12 @@ H5FL_DEFINE_STATIC(H5EA__test_ctx_t);
*/
BEGIN_FUNC(STATIC, ERR,
void *, NULL, NULL,
-H5EA__test_crt_context(const H5F_t UNUSED *f))
+H5EA__test_crt_context(void UNUSED *udata))
/* Local variables */
H5EA__test_ctx_t *ctx; /* Context for callbacks */
/* Sanity checks */
- HDassert(f);
/* Allocate new context structure */
if(NULL == (ctx = H5FL_MALLOC(H5EA__test_ctx_t)))
diff --git a/test/earray.c b/test/earray.c
index cccb5a0..5b8ac1a 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -411,7 +411,7 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl,
/* Re-open array, if given */
if(ea) {
- if(NULL == (*ea = H5EA_open(*f, dxpl, ea_addr, ea_cls)))
+ if(NULL == (*ea = H5EA_open(*f, dxpl, ea_addr, ea_cls, NULL)))
FAIL_STACK_ERROR
} /* end if */
} /* end if */
@@ -445,7 +445,7 @@ create_array(H5F_t *f, hid_t dxpl, const H5EA_create_t *cparam,
earray_state_t state; /* State of extensible array */
/* Create array */
- if(NULL == (*ea = H5EA_create(f, dxpl, cparam)))
+ if(NULL == (*ea = H5EA_create(f, dxpl, cparam, NULL)))
FAIL_STACK_ERROR
/* Check status of array */
@@ -598,7 +598,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED *tpara
HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
test_cparam.raw_elmt_size = 0;
H5E_BEGIN_TRY {
- ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam);
+ ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL);
} H5E_END_TRY;
if(ea) {
/* Close opened extensible array */
@@ -613,7 +613,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED *tpara
HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
test_cparam.max_nelmts_bits = 0;
H5E_BEGIN_TRY {
- ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam);
+ ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL);
} H5E_END_TRY;
if(ea) {
/* Close opened extensible array */
@@ -627,7 +627,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED *tpara
HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
test_cparam.max_nelmts_bits = 65;
H5E_BEGIN_TRY {
- ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam);
+ ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL);
} H5E_END_TRY;
if(ea) {
/* Close opened extensible array */
@@ -642,7 +642,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED *tpara
HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
test_cparam.sup_blk_min_data_ptrs = 0;
H5E_BEGIN_TRY {
- ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam);
+ ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL);
} H5E_END_TRY;
if(ea) {
/* Close opened extensible array */
@@ -655,7 +655,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED *tpara
HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
test_cparam.sup_blk_min_data_ptrs = 1;
H5E_BEGIN_TRY {
- ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam);
+ ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL);
} H5E_END_TRY;
if(ea) {
/* Close opened extensible array */
@@ -668,7 +668,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED *tpara
HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
test_cparam.sup_blk_min_data_ptrs = 6;
H5E_BEGIN_TRY {
- ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam);
+ ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL);
} H5E_END_TRY;
if(ea) {
/* Close opened extensible array */
@@ -683,7 +683,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED *tpara
HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
test_cparam.data_blk_min_elmts = 0;
H5E_BEGIN_TRY {
- ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam);
+ ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL);
} H5E_END_TRY;
if(ea) {
/* Close opened extensible array */
@@ -699,7 +699,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED *tpara
HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
test_cparam.max_dblk_page_nelmts_bits = H5V_log2_gen((uint64_t)test_cparam.idx_blk_elmts) - 1;
H5E_BEGIN_TRY {
- ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam);
+ ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL);
} H5E_END_TRY;
if(ea) {
/* Close opened extensible array */
@@ -713,7 +713,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED *tpara
HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
test_cparam.max_dblk_page_nelmts_bits = 4; /* corresponds to 16 elements in data block page, which is less than the 64 elements for the default settings */
H5E_BEGIN_TRY {
- ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam);
+ ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL);
} H5E_END_TRY;
if(ea) {
/* Close opened extensible array */
@@ -726,7 +726,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED *tpara
HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
test_cparam.max_dblk_page_nelmts_bits = test_cparam.max_nelmts_bits + 1;
H5E_BEGIN_TRY {
- ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam);
+ ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL);
} H5E_END_TRY;
if(ea) {
/* Close opened extensible array */
@@ -825,7 +825,7 @@ test_reopen(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
TEST_ERROR
/* Re-open the array */
- if(NULL == (ea = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls)))
+ if(NULL == (ea = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
@@ -890,7 +890,7 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
TEST_ERROR
/* Open the array again, through the first file handle */
- if(NULL == (ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls)))
+ if(NULL == (ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
@@ -917,7 +917,7 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
FAIL_STACK_ERROR
/* Open the extensible array through the second file handle */
- if(NULL == (ea2 = H5EA_open(f2, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls)))
+ if(NULL == (ea2 = H5EA_open(f2, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls, NULL)))
FAIL_STACK_ERROR
/* Verify the creation parameters */
@@ -996,7 +996,7 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
TEST_ERROR
/* Open the array again */
- if(NULL == (ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls)))
+ if(NULL == (ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls, NULL)))
FAIL_STACK_ERROR
/* Request that the array be deleted */
@@ -1016,7 +1016,7 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
/* Try re-opening the array again (should fail, as array will be deleted) */
H5E_BEGIN_TRY {
- ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls);
+ ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls, NULL);
} H5E_END_TRY;
if(ea2) {
/* Close opened array */
@@ -1037,7 +1037,7 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
/* Try re-opening the array again (should fail, as array is now deleted) */
H5E_BEGIN_TRY {
- ea = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls);
+ ea = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, cparam->cls, NULL);
} H5E_END_TRY;
if(ea) {
/* Close opened array */