summaryrefslogtreecommitdiffstats
path: root/src/H5Oshared.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2018-03-15 21:54:30 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2018-03-15 21:54:30 (GMT)
commit4a17aff4085ad6ee265b95730aca3f493056dec8 (patch)
tree8bfb665c6d95a2e3520fa1bb0ff54d95aff3923f /src/H5Oshared.c
parent853ae26333592faf69cd8c454ef92ffea8549df5 (diff)
downloadhdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.zip
hdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.tar.gz
hdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.tar.bz2
Add API context interface and use it throughout the library.
Diffstat (limited to 'src/H5Oshared.c')
-rw-r--r--src/H5Oshared.c104
1 files changed, 51 insertions, 53 deletions
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index db2d0cc..c1957b4 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -104,7 +104,7 @@
*-------------------------------------------------------------------------
*/
static void *
-H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags,
+H5O_shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags,
const H5O_shared_t *shared, const H5O_msg_class_t *type)
{
H5HF_t *fheap = NULL;
@@ -132,15 +132,15 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags,
size_t mesg_size; /* Size of message */
/* Retrieve the fractal heap address for shared messages */
- if(H5SM_get_fheap_addr(f, dxpl_id, type->id, &fheap_addr) < 0)
+ if(H5SM_get_fheap_addr(f, type->id, &fheap_addr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "can't get fheap address for shared messages")
/* Open the fractal heap */
- if(NULL == (fheap = H5HF_open(f, dxpl_id, fheap_addr)))
+ if(NULL == (fheap = H5HF_open(f, fheap_addr)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open fractal heap")
/* Get the size of the message in the heap */
- if(H5HF_get_obj_len(fheap, dxpl_id, &(shared->u.heap_id), &mesg_size) < 0)
+ if(H5HF_get_obj_len(fheap, &(shared->u.heap_id), &mesg_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "can't get message size from fractal heap.")
/* Wrap the local buffer for serialized message */
@@ -152,11 +152,11 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags,
HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "can't get actual buffer")
/* Retrieve the message from the heap */
- if(H5HF_read(fheap, dxpl_id, &(shared->u.heap_id), mesg_ptr) < 0)
+ if(H5HF_read(fheap, &(shared->u.heap_id), mesg_ptr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "can't read message from fractal heap.")
/* Decode the message */
- if(NULL == (ret_value = (type->decode)(f, dxpl_id, open_oh, 0, ioflags, mesg_ptr)))
+ if(NULL == (ret_value = (type->decode)(f, open_oh, 0, ioflags, mesg_ptr)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't decode shared message.")
} /* end if */
else {
@@ -174,11 +174,11 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags,
* is possible, for example, if an attribute's datatype is shared in
* the same object header the attribute is in. Read the message
* directly. */
- if(NULL == (ret_value = H5O_msg_read_oh(f, dxpl_id, open_oh, type->id, NULL)))
+ if(NULL == (ret_value = H5O_msg_read_oh(f, open_oh, type->id, NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message")
} else
/* The shared message is in another object header */
- if(NULL == (ret_value = H5O_msg_read(&oloc, type->id, NULL, dxpl_id)))
+ if(NULL == (ret_value = H5O_msg_read(&oloc, type->id, NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message")
} /* end else */
@@ -188,7 +188,7 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags,
done:
/* Release resources */
- if(fheap && H5HF_close(fheap, dxpl_id) < 0)
+ if(fheap && H5HF_close(fheap) < 0)
HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "can't close fractal heap")
if(wb && H5WB_unwrap(wb) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, NULL, "can't close wrapped buffer")
@@ -198,7 +198,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_shared_link_adj
+ * Function: H5O__shared_link_adj
*
* Purpose: Changes the link count for the object referenced by a shared
* message.
@@ -219,12 +219,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_shared_link_adj(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- const H5O_msg_class_t *type, H5O_shared_t *shared, int adjust)
+H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
+ H5O_shared_t *shared, int adjust)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(f);
@@ -262,15 +262,15 @@ H5O_shared_link_adj(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
* is possible, for example, if an attribute's datatype is shared in
* the same object header the attribute is in. Adjust the link
* count directly. */
- hbool_t deleted = FALSE; /* This is used only to satisfy H5O_link_oh */
+ hbool_t deleted = FALSE; /* This is used only to satisfy H5O__link_oh */
- if(H5O_link_oh(f, adjust, dxpl_id, open_oh, &deleted) < 0)
+ if(H5O__link_oh(f, adjust, open_oh, &deleted) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count")
HDassert(!deleted);
} else
/* The shared message is in another object header */
- if(H5O_link(&oloc, adjust, dxpl_id) < 0)
+ if(H5O_link(&oloc, adjust) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count")
} /* end if */
else {
@@ -278,19 +278,19 @@ H5O_shared_link_adj(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* Check for decrementing reference count on shared message */
if(adjust < 0) {
- if(H5SM_delete(f, dxpl_id, open_oh, shared) < 0)
+ if(H5SM_delete(f, open_oh, shared) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to delete message from SOHM table")
} /* end if */
/* Check for incrementing reference count on message */
else if(adjust > 0) {
- if(H5SM_try_share(f, dxpl_id, open_oh, 0, type->id, shared, NULL) < 0)
+ if(H5SM_try_share(f, open_oh, 0, type->id, shared, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "error trying to share message")
} /* end if */
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_shared_link_adj() */
+} /* end H5O__shared_link_adj() */
/*-------------------------------------------------------------------------
@@ -306,8 +306,8 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5O_shared_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags,
- const uint8_t *buf, const H5O_msg_class_t *type)
+H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *buf,
+ const H5O_msg_class_t *type)
{
H5O_shared_t sh_mesg; /* Shared message info */
unsigned version; /* Shared message version */
@@ -373,7 +373,7 @@ H5O_shared_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags,
sh_mesg.msg_type_id = type->id;
/* Retrieve actual message, through decoded shared message info */
- if(NULL == (ret_value = H5O_shared_read(f, dxpl_id, open_oh, ioflags, &sh_mesg, type)))
+ if(NULL == (ret_value = H5O_shared_read(f, open_oh, ioflags, &sh_mesg, type)))
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to retrieve native message")
done:
@@ -496,7 +496,7 @@ H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
/*-------------------------------------------------------------------------
- * Function: H5O_shared_delete
+ * Function: H5O__shared_delete
*
* Purpose: Free file space referenced by message
*
@@ -508,12 +508,12 @@ H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg)
*-------------------------------------------------------------------------
*/
herr_t
-H5O_shared_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- const H5O_msg_class_t *type, H5O_shared_t *sh_mesg)
+H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
+ H5O_shared_t *sh_mesg)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@@ -521,24 +521,24 @@ H5O_shared_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/*
* Committed datatypes increment the OH of the original message when they
- * are written (in H5O_shared_link) and decrement it here.
+ * are written (in H5O__shared_link) and decrement it here.
* SOHMs in the heap behave differently; their refcount is incremented
* during H5SM_share when they are going to be written (in H5O_msg_append
* or H5O_msg_write). Their refcount in the SOHM indexes still needs to
- * be decremented when they're deleted (in H5O_shared_link_adj).
+ * be decremented when they're deleted (in H5O__shared_link_adj).
*/
/* Decrement the reference count on the shared object */
- if(H5O_shared_link_adj(f, dxpl_id, open_oh, type, sh_mesg, -1) < 0)
+ if(H5O__shared_link_adj(f, open_oh, type, sh_mesg, -1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_shared_delete() */
+} /* end H5O__shared_delete() */
/*-------------------------------------------------------------------------
- * Function: H5O_shared_link
+ * Function: H5O__shared_link
*
* Purpose: Increment reference count on any objects referenced by
* message
@@ -551,28 +551,28 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_shared_link(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- const H5O_msg_class_t *type, H5O_shared_t *sh_mesg)
+H5O__shared_link(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type,
+ H5O_shared_t *sh_mesg)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
HDassert(sh_mesg);
/* Increment the reference count on the shared object */
- if(H5O_shared_link_adj(f, dxpl_id, open_oh, type, sh_mesg, 1) < 0)
+ if(H5O__shared_link_adj(f, open_oh, type, sh_mesg, 1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_shared_link() */
+} /* end H5O__shared_link() */
/*-------------------------------------------------------------------------
- * Function: H5O_shared_copy_file
+ * Function: H5O__shared_copy_file
*
* Purpose: Copies a message from _MESG to _DEST in file
*
@@ -585,16 +585,16 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_shared_copy_file(H5F_t *file_src, H5F_t *file_dst,
+H5O__shared_copy_file(H5F_t *file_src, H5F_t *file_dst,
const H5O_msg_class_t *mesg_type, const void *_native_src, void *_native_dst,
hbool_t H5_ATTR_UNUSED *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info,
- void H5_ATTR_UNUSED *udata, hid_t dxpl_id)
+ void H5_ATTR_UNUSED *udata)
{
const H5O_shared_t *shared_src = (const H5O_shared_t *)_native_src; /* Alias to shared info in native source */
H5O_shared_t *shared_dst = (H5O_shared_t *)_native_dst; /* Alias to shared info in native destination message */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(file_src);
@@ -617,13 +617,13 @@ H5O_shared_copy_file(H5F_t *file_src, H5F_t *file_dst,
if(shared_src->type != H5O_SHARE_TYPE_COMMITTED) {
/* Simulate trying to share new message in the destination file. */
/* Set copied metadata tag */
- H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, FAIL);
+ H5_BEGIN_TAG(H5AC__COPIED_TAG);
- if(H5SM_try_share(file_dst, dxpl_id, NULL, H5SM_DEFER, mesg_type->id, _native_dst, mesg_flags) < 0)
+ if(H5SM_try_share(file_dst, NULL, H5SM_DEFER, mesg_type->id, _native_dst, mesg_flags) < 0)
HGOTO_ERROR_TAG(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to determine if message should be shared")
/* Reset metadata tag */
- H5_END_TAG(FAIL);
+ H5_END_TAG
} /* end if */
else {
/* Mark the message as committed - as it will be committed in post copy
@@ -634,11 +634,11 @@ H5O_shared_copy_file(H5F_t *file_src, H5F_t *file_dst,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_shared_copy_file() */
+} /* H5O__shared_copy_file() */
/*-------------------------------------------------------------------------
- * Function: H5O_shared_post_copy_file
+ * Function: H5O__shared_post_copy_file
*
* Purpose: Delate a shared message and replace with a new one.
* The function is needed at cases such as coping a shared reg_ref attribute.
@@ -656,13 +656,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_shared_post_copy_file(H5F_t *f, const H5O_msg_class_t *mesg_type,
+H5O__shared_post_copy_file(H5F_t *f, const H5O_msg_class_t *mesg_type,
const H5O_shared_t *shared_src, H5O_shared_t *shared_dst,
- unsigned *mesg_flags, hid_t dxpl_id, H5O_copy_t *cpy_info)
+ unsigned *mesg_flags, H5O_copy_t *cpy_info)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@@ -679,8 +679,7 @@ H5O_shared_post_copy_file(H5F_t *f, const H5O_msg_class_t *mesg_type,
dst_oloc.file = f;
src_oloc.file = shared_src->file;
src_oloc.addr = shared_src->u.loc.oh_addr;
- if(H5O_copy_header_map(&src_oloc, &dst_oloc, dxpl_id, cpy_info, FALSE,
- NULL, NULL) < 0)
+ if(H5O_copy_header_map(&src_oloc, &dst_oloc, cpy_info, FALSE, NULL, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
/* Set up destination message's shared info */
@@ -688,13 +687,12 @@ H5O_shared_post_copy_file(H5F_t *f, const H5O_msg_class_t *mesg_type,
} /* end if */
else
/* Share the message */
- if(H5SM_try_share(f, dxpl_id, NULL, H5SM_WAS_DEFERRED, mesg_type->id,
- shared_dst, mesg_flags) < 0)
+ if(H5SM_try_share(f, NULL, H5SM_WAS_DEFERRED, mesg_type->id, shared_dst, mesg_flags) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't share message")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_shared_post_copy_file() */
+} /* end H5O__shared_post_copy_file() */
/*-------------------------------------------------------------------------