From 9236c9a148aaf206294be0554cf78e7ab769bd51 Mon Sep 17 00:00:00 2001 From: James Laird Date: Fri, 15 Dec 2006 16:28:17 -0500 Subject: [svn-r13065] Added support for copying shared messages (including turning unshared messages to shared messages and vice versa). Extended objcopy test to test all "permutations" of shared/unshared and new/old group format. If this proves to take a long time to test, I'll go back and have it run fewer tests when HDF5_TEST_EXPRESS is enabled. Tested on smirom, kagiso, copper, and Windows. --- src/H5A.c | 6 +- src/H5Adense.c | 2 +- src/H5Apkg.h | 2 +- src/H5Oattr.c | 134 +++++++++++------- src/H5Oattribute.c | 2 +- src/H5Ocopy.c | 28 +++- src/H5Odtype.c | 36 ++--- src/H5Ofill.c | 12 +- src/H5Omessage.c | 93 ++++++++++-- src/H5Opkg.h | 5 +- src/H5Opline.c | 12 +- src/H5Oprivate.h | 2 +- src/H5Osdspace.c | 12 +- src/H5Oshared.c | 48 ++++--- src/H5SM.c | 15 +- src/H5SMcache.c | 16 ++- test/objcopy.c | 405 +++++++++++++++++++++++++++++------------------------ 17 files changed, 498 insertions(+), 332 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index ca75372..e678d58 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -28,11 +28,11 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5Apkg.h" /* Attributes */ +#include "H5Opkg.h" /* Object headers */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ #include "H5Sprivate.h" /* Dataspace functions */ #include "H5SMprivate.h" /* Shared Object Header Messages */ @@ -384,7 +384,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, else if(tri_ret > 0) { /* Message is shared. Use size of shared message */ - if(H5O_msg_get_share(H5O_DTYPE_ID, attr->dt, &sh_mesg) < 0) + if(NULL == H5O_msg_get_share(H5O_DTYPE_ID, attr->dt, &sh_mesg)) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "couldn't get size of shared message") attr->dt_size = H5O_msg_raw_size(attr->oloc.file, H5O_SHARED_ID, &sh_mesg); @@ -402,7 +402,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, else if(tri_ret > 0) { /* Message is shared. Use size of shared message */ - if(H5O_msg_get_share(H5O_SDSPACE_ID, attr->ds, &sh_mesg) < 0) + if(NULL == H5O_msg_get_share(H5O_SDSPACE_ID, attr->ds, &sh_mesg)) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "couldn't get size of shared message") attr->ds_size = H5O_msg_raw_size(attr->oloc.file, H5O_SHARED_ID, &sh_mesg); diff --git a/src/H5Adense.c b/src/H5Adense.c index 3258019..d235512 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -662,7 +662,7 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_t *oh, unsigned mesg_flags, /* Get the shared information for the attribute */ HDmemset(&sh_mesg, 0, sizeof(sh_mesg)); - if(H5O_attr_get_share(attr, &sh_mesg) < 0) + if(NULL == H5O_attr_get_share(attr, &sh_mesg)) HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't get shared message") /* Use heap ID for shared message heap */ diff --git a/src/H5Apkg.h b/src/H5Apkg.h index a3b0e70..5f8d477 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -184,7 +184,7 @@ H5_DLL herr_t H5A_attr_release_table(H5A_attr_table_t *atable); /* Attribute object header routines */ H5_DLL herr_t H5O_attr_reset(void *_mesg); H5_DLL herr_t H5O_attr_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link); -H5_DLL herr_t H5O_attr_get_share(const void *_mesg, H5O_shared_t *sh); +H5_DLL void *H5O_attr_get_share(const void *_mesg, H5O_shared_t *sh); #endif /* _H5Apkg_H */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index bc2b81f..8b8edc5 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -392,7 +392,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) HDmemset(&sh_mesg, 0, sizeof(H5O_shared_t)); /* Get shared message information from datatype */ - if((H5O_MSG_DTYPE->get_share)(attr->dt, &sh_mesg/*out*/) < 0) + if(NULL == (H5O_MSG_DTYPE->get_share)(attr->dt, &sh_mesg/*out*/)) HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode shared attribute datatype") /* Encode shared message information for datatype */ @@ -418,7 +418,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) HDmemset(&sh_mesg, 0, sizeof(H5O_shared_t)); /* Get shared message information from dataspace */ - if((H5O_MSG_SDSPACE->get_share)(attr->ds, &sh_mesg/*out*/) < 0) + if(NULL == (H5O_MSG_SDSPACE->get_share)(attr->ds, &sh_mesg/*out*/)) HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode shared attribute dataspace") /* Encode shared message information for dataspace */ @@ -650,6 +650,8 @@ herr_t H5O_attr_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link) { const H5A_t *attr = (const H5A_t *) _mesg; + htri_t tri_ret; + H5O_shared_t sh_mesg; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_attr_delete) @@ -658,37 +660,33 @@ H5O_attr_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link) HDassert(f); HDassert(attr); - /* Check if we are adjusting link count on components in the file */ - if(adj_link) { - htri_t tri_ret; - H5O_shared_t sh_mesg; - - /* Remove both the datatype and dataspace from the SOHM heap if they're - * shared there. - */ - if((tri_ret = H5O_msg_is_shared(H5O_DTYPE_ID, attr->dt)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't tell if datatype is shared") - if(tri_ret > 0) - { - if(H5O_msg_get_share(H5O_DTYPE_ID, attr->dt, &sh_mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't get shared message from datatype") - if(H5SM_try_delete(f, H5AC_dxpl_id, H5O_DTYPE_ID, &sh_mesg) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "can't remove datatype from SOHM heap") - } /* end if */ - - if((tri_ret = H5O_msg_is_shared(H5O_SDSPACE_ID, attr->ds)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't tell if dataspace is shared") - if(tri_ret > 0) - { - if(H5O_msg_get_share(H5O_SDSPACE_ID, attr->ds, &sh_mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't get shared message from dataspace") - if(H5SM_try_delete(f, H5AC_dxpl_id, H5O_SDSPACE_ID, &sh_mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_SOHM, FAIL, "can't remove dataspace from SOHM heap") - } /* end if */ - - /* Check whether datatype is shared */ - if(H5T_committed(attr->dt)) - /* Decrement the reference count on the shared datatype */ + /* Remove both the datatype and dataspace from the SOHM heap if they're + * shared there. + */ + if((tri_ret = H5O_msg_is_shared(H5O_DTYPE_ID, attr->dt)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't tell if datatype is shared") + if(tri_ret > 0) + { + if(NULL == H5O_msg_get_share(H5O_DTYPE_ID, attr->dt, &sh_mesg)) + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't get shared message from datatype") + if(H5SM_try_delete(f, H5AC_dxpl_id, H5O_DTYPE_ID, &sh_mesg) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "can't remove datatype from SOHM heap") + } /* end if */ + + if((tri_ret = H5O_msg_is_shared(H5O_SDSPACE_ID, attr->ds)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't tell if dataspace is shared") + if(tri_ret > 0) + { + if(NULL == H5O_msg_get_share(H5O_SDSPACE_ID, attr->ds, &sh_mesg)) + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't get shared message from dataspace") + if(H5SM_try_delete(f, H5AC_dxpl_id, H5O_SDSPACE_ID, &sh_mesg) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_SOHM, FAIL, "can't remove dataspace from SOHM heap") + } /* end if */ + + /* Check whether datatype is shared */ + if(H5T_committed(attr->dt)) { + /* Decrement the reference count on the shared datatype, if requested */ + if(adj_link) if(H5T_link(attr->dt, -1, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared datatype link count") } /* end if */ @@ -808,6 +806,9 @@ H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *mesg_type, void *reclaim_buf = NULL; /* Buffer for reclaiming data */ hid_t buf_sid = -1; /* ID for buffer dataspace */ + H5O_shared_t sh_mesg; /* Shared message information */ + htri_t tri_ret; /* htri_t return value */ + void *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_attr_copy_file) @@ -847,7 +848,6 @@ H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *mesg_type, if(H5T_committed(attr_src->dt)) { H5O_loc_t *src_oloc; /* Pointer to source datatype's object location */ H5O_loc_t *dst_oloc; /* Pointer to dest. datatype's object location */ - H5O_shared_t sh_mesg; /* Get group entries for source & destination */ src_oloc = H5T_oloc(attr_src->dt); @@ -862,12 +862,32 @@ H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *mesg_type, /* Copy the shared object from source to destination */ if(H5O_copy_header_map(src_oloc, dst_oloc, dxpl_id, cpy_info, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object") + } /* end if */ + + /* Copy the dataspace for the attribute */ + /* JAMES: does this need to be copy_file? */ + attr_dst->ds = H5S_copy(attr_src->ds, FALSE); + HDassert(attr_dst->ds); + /* Try to share both the datatype and dataset. This does nothing if the + * datatype is committed or sharing is disabled. + */ + if(H5SM_try_share(file_dst, dxpl_id, H5O_DTYPE_ID, attr_dst->dt) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype") + if(H5SM_try_share(file_dst, dxpl_id, H5O_SDSPACE_ID, attr_dst->ds) <0) + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace") + + /* Compute the sizes of the datatype and dataspace. This is their raw + * size unless they're shared. + */ + if((tri_ret = H5O_msg_is_shared(H5O_DTYPE_ID, attr_dst->dt)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "unable to determine if datatype is shared") + if(tri_ret == TRUE) { /* Reset shared message information */ HDmemset(&sh_mesg, 0, sizeof(H5O_shared_t)); /* Get shared message information for datatype */ - if(H5O_msg_get_share(H5O_DTYPE_ID, attr_src->dt, &sh_mesg/*out*/) < 0) + if(NULL == H5O_msg_get_share(H5O_DTYPE_ID, attr_dst->dt, &sh_mesg/*out*/)) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to get shared message") /* Compute shared message size for datatype */ @@ -876,12 +896,24 @@ H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *mesg_type, else attr_dst->dt_size = H5O_msg_raw_size(file_dst, H5O_DTYPE_ID, attr_src->dt); HDassert(attr_dst->dt_size > 0); - attr_dst->ds_size = H5S_raw_size(file_dst, attr_src->ds); - HDassert(attr_dst->ds_size > 0); - /* Copy the dataspace for the attribute */ - attr_dst->ds = H5S_copy(attr_src->ds, FALSE); - HDassert(attr_dst->ds); + if((tri_ret = H5O_msg_is_shared(H5O_SDSPACE_ID, attr_dst->ds)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "unable to determine if dataspace is shared") + if(tri_ret == TRUE) { + /* Reset shared message information */ + HDmemset(&sh_mesg, 0, sizeof(H5O_shared_t)); + + /* Get shared message information for dataspace */ + if(NULL == H5O_msg_get_share(H5O_SDSPACE_ID, attr_dst->ds, &sh_mesg/*out*/)) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to get shared message") + + /* Compute shared message size for dataspace */ + attr_dst->ds_size = H5O_msg_raw_size(file_dst, H5O_SHARED_ID, &sh_mesg); + } + else { + attr_dst->ds_size = H5O_msg_raw_size(file_dst, H5O_SDSPACE_ID, attr_src->ds); + } + HDassert(attr_dst->ds_size > 0); /* Compute the size of the data */ H5_ASSIGN_OVERFLOW(attr_dst->data_size, H5S_GET_EXTENT_NPOINTS(attr_dst->ds) * H5T_get_size(attr_dst->dt), hsize_t, size_t); @@ -1045,26 +1077,24 @@ done: * * Purpose: Gets sharing information from the message * - * Return: Non-negative on success/Negative on failure + * Return: Shared message on success/NULL on failure * * Programmer: James Laird * Tuesday, October 17, 2006 * *------------------------------------------------------------------------- */ -herr_t +void * H5O_attr_get_share(const void *_mesg, H5O_shared_t *sh /*out*/) { const H5A_t *mesg = (const H5A_t *)_mesg; - herr_t ret_value = SUCCEED; + void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_get_share) HDassert (mesg); - HDassert (sh); - if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh)) - ret_value = FAIL; + ret_value = H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_get_share() */ @@ -1119,6 +1149,7 @@ static htri_t H5O_attr_is_shared(const void *_mesg) { const H5A_t *mesg = (const H5A_t *)_mesg; + htri_t ret_value; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_is_shared) @@ -1128,8 +1159,13 @@ H5O_attr_is_shared(const void *_mesg) * library read a "committed attribute" if we ever create one in * the future. */ - FUNC_LEAVE_NOAPI(H5O_IS_SHARED(mesg->sh_loc.flags)) -} /* end H5O_attr_is_shared() */ + if(mesg->sh_loc.flags & (H5O_COMMITTED_FLAG | H5O_SHARED_IN_HEAP_FLAG)) + ret_value = TRUE; + else + ret_value = FALSE; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_attr_is_shared */ /*-------------------------------------------------------------------------- @@ -1194,7 +1230,7 @@ H5O_attr_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int in HDmemset(&sh_mesg, 0, sizeof(H5O_shared_t)); /* Get shared message information from datatype */ - if((H5O_MSG_DTYPE->get_share)(mesg->dt, &sh_mesg/*out*/) < 0) + if(NULL == (H5O_MSG_DTYPE->get_share)(mesg->dt, &sh_mesg/*out*/)) HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't retrieve shared message information") debug = H5O_MSG_SHARED->debug; diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 17d6dcd..aaf91f6 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -501,7 +501,7 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, H5_ITER_ERROR, "unable to delete shared attribute in shared storage") /* Extract shared message info from current attribute */ - if(H5O_attr_get_share(udata->attr, mesg->native) < 0) + if(NULL == H5O_attr_get_share(udata->attr, mesg->native)) HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, H5_ITER_ERROR, "can't get shared info") /* Indicate that we found the correct attribute */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index e48f29c..cce2d6d 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -302,6 +302,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, size_t dst_oh_size; /* Total size of the destination OH */ uint8_t *current_pos; /* Current position in destination image */ size_t msghdr_size; + hbool_t shared; /* Whether copy_file callback created a shared message */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT(H5O_copy_header_real) @@ -506,9 +507,32 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, /* Copy the source message */ if((mesg_dst->native = H5O_msg_copy_file(copy_type, mesg_dst->type, oloc_src->file, mesg_src->native, oloc_dst->file, dxpl_id, - cpy_info, udata)) == NULL) + &shared, cpy_info, udata)) == NULL) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object header message") + /* In being copied, the message may have become shared or stopped + * being shared. If its sharing status has changed, recalculate + * its size and set/unset its sharing flag. + */ + if(shared == TRUE && !(mesg_dst->flags & H5O_MSG_FLAG_SHARED)) { + /* Set shared flag */ + mesg_dst->flags |= H5O_MSG_FLAG_SHARED; + + /* Recompute shared message size (mesg_dst->native is really + * an H5O_shared_t) + */ + mesg_dst->raw_size = H5O_ALIGN_OH(oh_dst, + H5O_msg_raw_size(oloc_dst->file, H5O_SHARED_ID, mesg_dst->native)); + } + else if(shared == FALSE && (mesg_dst->flags & H5O_MSG_FLAG_SHARED)) { + /* Unset shared flag */ + mesg_dst->flags &= ~H5O_MSG_FLAG_SHARED; + + /* Recompute native message size */ + mesg_dst->raw_size = H5O_ALIGN_OH(oh_dst, + H5O_msg_raw_size(oloc_dst->file, mesg_dst->type->id, mesg_dst->native)); + } + /* Mark the message in the destination as dirty, so it'll get encoded when the object header is flushed */ mesg_dst->dirty = TRUE; } /* end if (mesg_src->type->copy_file) */ @@ -528,7 +552,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, /* Add space for messages. */ for(mesgno = 0; mesgno < oh_dst->nmesgs; mesgno++) { dst_oh_size += H5O_SIZEOF_MSGHDR_OH(oh_dst); - dst_oh_size += H5O_ALIGN_OH(oh_dst, oh_dst->mesg[mesgno].raw_size); + dst_oh_size += oh_dst->mesg[mesgno].raw_size; } /* end for */ /* Allocate space for chunk in destination file */ diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 73f8686..429db74 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -33,7 +33,7 @@ static void *H5O_dtype_copy(const void *_mesg, void *_dest); static size_t H5O_dtype_size(const H5F_t *f, const void *_mesg); static herr_t H5O_dtype_reset(void *_mesg); static herr_t H5O_dtype_free(void *_mesg); -static herr_t H5O_dtype_get_share(const void *_mesg, H5O_shared_t *sh); +static void *H5O_dtype_get_share(const void *_mesg, H5O_shared_t *sh); static herr_t H5O_dtype_set_share(void *_mesg, const H5O_shared_t *sh); static herr_t H5O_dtype_is_shared(const void *_mesg); static herr_t H5O_dtype_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t *type, @@ -1264,39 +1264,39 @@ H5O_dtype_free(void *mesg) * Purpose: Returns information about where the shared message is located * by filling in the SH shared message struct. * - * Return: Non-negative on success/Negative on failure + * Return: Shared message on success/NULL on failure * * Programmer: Robb Matzke * Monday, June 1, 1998 * *------------------------------------------------------------------------- */ -static herr_t +static void * H5O_dtype_get_share(const void *_mesg, H5O_shared_t *sh/*out*/) { const H5T_t *dt = (const H5T_t *)_mesg; - herr_t ret_value = SUCCEED; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_dtype_get_share) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_dtype_get_share) HDassert(dt); - HDassert(sh); - /* Make sure the datatype is shared */ - HDassert(dt->sh_loc.flags & (H5O_SHARED_IN_HEAP_FLAG | H5O_COMMITTED_FLAG)); + /* Make sure the shared struct is initialized to some reasonable value */ + HDassert((dt->sh_loc.flags & (H5O_SHARED_IN_HEAP_FLAG | H5O_COMMITTED_FLAG)) || dt->sh_loc.flags == H5O_NOT_SHARED); +#ifndef NDEBUG /* Make sure datatype state is correct: committed datatypes must have - * state NAMED or OPEN and datatypes in the heap cannot be NAMED or OPEN. */ - if(dt->sh_loc.flags & H5O_SHARED_IN_HEAP_FLAG) - HDassert(! (H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state)); - else + * state NAMED or OPEN and neither unshared datatypes nor datatypes + * shared in the heap can be NAMED or OPEN. */ + if(dt->sh_loc.flags & H5O_COMMITTED_FLAG) HDassert(H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state); + else + HDassert(! (H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state)); +#endif /* NDEBUG */ /* Do actual copy of shared information */ - if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(dt->sh_loc), sh)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get shared information") + ret_value = H5O_msg_copy(H5O_SHARED_ID, &(dt->sh_loc), sh); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_dtype_get_share() */ @@ -1324,8 +1324,10 @@ H5O_dtype_set_share(void *_mesg/*in,out*/, const H5O_shared_t *sh) HDassert(dt); HDassert(sh); - /* Make sure the shared message location is initialized*/ - HDassert(sh->flags & (H5O_SHARED_IN_HEAP_FLAG | H5O_COMMITTED_FLAG)); + /* Make sure the shared message location is initialized, so that it + * either has valid sharing information or is set to 0. + */ + HDassert(sh->flags & (H5O_SHARED_IN_HEAP_FLAG | H5O_COMMITTED_FLAG) || sh->flags == H5O_NOT_SHARED); /* Make sure we're not sharing a committed type in the heap */ HDassert(sh->flags & H5O_COMMITTED_FLAG || diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 2c6158b..78b5c77 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -45,7 +45,7 @@ static void *H5O_fill_copy(const void *_mesg, void *_dest); static size_t H5O_fill_size(const H5F_t *f, const void *_mesg); static herr_t H5O_fill_reset(void *_mesg); static herr_t H5O_fill_free(void *_mesg); -static herr_t H5O_fill_new_get_share(const void *_mesg, H5O_shared_t *sh); +static void *H5O_fill_new_get_share(const void *_mesg, H5O_shared_t *sh); static herr_t H5O_fill_new_set_share(void *_mesg, const H5O_shared_t *sh); static htri_t H5O_fill_new_is_shared(const void *_mesg); static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, @@ -673,26 +673,24 @@ H5O_fill_free (void *mesg) * * Purpose: Gets sharing information from the message * - * Return: Non-negative on success/Negative on failure + * Return: Shared message on success/NULL on failure * * Programmer: James Laird * Tuesday, October 10, 2006 * *------------------------------------------------------------------------- */ -static herr_t +static void * H5O_fill_new_get_share(const void *_mesg, H5O_shared_t *sh /*out*/) { const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg; - herr_t ret_value = SUCCEED; + void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_get_share) HDassert (mesg); - HDassert (sh); - if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh)) - ret_value = FAIL; + ret_value = H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_fill_new_get_share() */ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index cb827f4..0fafac7 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -446,7 +446,7 @@ H5O_msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, * replacement messages that aren't shared, too. */ /* Extract shared message info from current message */ - if(H5O_msg_get_share(type->id, mesg, &sh_mesg) < 0) + if(NULL == H5O_msg_get_share(type->id, mesg, &sh_mesg)) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't get shared message") /* Instead of writing the original message, write a shared message */ @@ -1509,12 +1509,17 @@ done: * Function: H5O_msg_get_share * * Purpose: Call the 'get_share' method for a - * particular class of object header. + * particular class of object header. Fills SHARE + * with the shared object, or allocated an H5O_shared_t + * message and returns it. * - * Return: Success: Non-negative, and SHARE describes the shared - * object. + * If SHARE is NULL, the return value must be freed + * with H5O_msg_free. * - * Failure: Negative + * Return: Success: H5O_shared_t describing the shared information + * for the message. + * + * Failure: NULL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -1522,13 +1527,13 @@ done: * *------------------------------------------------------------------------- */ -herr_t +void * H5O_msg_get_share(unsigned type_id, const void *mesg, H5O_shared_t *share) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value; /* Return value */ + void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_msg_get_share, FAIL) + FUNC_ENTER_NOAPI(H5O_msg_get_share, NULL) /* Check args */ HDassert(type_id < NELMTS(H5O_msg_class_g)); @@ -1536,11 +1541,10 @@ H5O_msg_get_share(unsigned type_id, const void *mesg, H5O_shared_t *share) HDassert(type); HDassert(type->get_share); HDassert(mesg); - HDassert(share); /* Get shared data for the mesg */ - if((ret_value = (type->get_share)(mesg, share)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve shared message information") + if((ret_value = (type->get_share)(mesg, share)) == NULL) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to retrieve shared message information") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1761,6 +1765,9 @@ done: * Purpose: Copies a message to file. If MESG is is the null pointer then a null * pointer is returned with no error. * + * Attempts to share the message in the destination and sets + * SHARED to TRUE or FALSE depending on whether this succeeds. + * * Return: Success: Ptr to the new message * * Failure: NULL @@ -1772,8 +1779,12 @@ done: */ void * H5O_msg_copy_file(const H5O_msg_class_t *copy_type, const H5O_msg_class_t *mesg_type, H5F_t *file_src, void *native_src, - H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata) + H5F_t *file_dst, hid_t dxpl_id, hbool_t *shared, H5O_copy_t *cpy_info, void *udata) { + void *native_mesg=NULL; + void *shared_mesg=NULL; + hbool_t committed; /* TRUE if message is a committed message */ + htri_t try_share_ret; /* Value returned from H5SM_try_share */ void *ret_value; FUNC_ENTER_NOAPI_NOINIT(H5O_msg_copy_file) @@ -1787,10 +1798,64 @@ H5O_msg_copy_file(const H5O_msg_class_t *copy_type, const H5O_msg_class_t *mesg_ HDassert(file_dst); HDassert(cpy_info); - if(NULL == (ret_value = (copy_type->copy_file)(file_src, mesg_type, native_src, file_dst, dxpl_id, cpy_info, udata))) + /* Check if this message is committed. We'll need to know this later. */ + committed = FALSE; + if(copy_type->id == H5O_SHARED_ID) { + H5O_shared_t *shared_mesg = (H5O_shared_t *) native_src; + + if( shared_mesg->flags & H5O_COMMITTED_FLAG) { + HDassert(!(shared_mesg->flags & H5O_SHARED_IN_HEAP_FLAG)); + committed = TRUE; + } + } + + /* The copy_file callback will return an H5O_shared_t only if the message + * to be copied is a committed datatype. + */ + if(NULL == (native_mesg = (copy_type->copy_file)(file_src, mesg_type, native_src, file_dst, dxpl_id, cpy_info, udata))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy object header message to file") + /* Committed messages are always committed in the destination. Messages in + * the heap are not shared by default--they need to be "re-shared" in the + * destination. + */ + if(committed == TRUE) + *shared = TRUE; + else + *shared = FALSE; + + /* If message isn't committed but can be shared, handle with implicit sharing. */ + if(committed == FALSE && (mesg_type->set_share)) { + /* Try to share it in the destination file. */ + if((try_share_ret = H5SM_try_share(file_dst, dxpl_id, mesg_type->id, native_mesg)) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_WRITEERROR, NULL, "unable to determine if message should be shared") + + /* If it isn't shared, reset its sharing information. If it is + * shared, its sharing information will have been overwritten by + * H5SM_try_share. + */ + if(try_share_ret == FALSE) { + if(H5O_msg_reset_share(mesg_type->id, native_mesg) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_WRITEERROR, NULL, "unable to reset sharing information in message") + } + else { + /* Get shared message from native message */ + if(NULL == (shared_mesg = H5O_msg_get_share(mesg_type->id, native_mesg, NULL))) + HGOTO_ERROR(H5E_SOHM, H5E_READERROR, NULL, "unable to get shared location from message") + + /* Free native message; the shared message is all we need to return */ + H5O_msg_free(mesg_type->id, native_mesg); + + native_mesg = shared_mesg; + *shared = TRUE; + } + } + + ret_value = native_mesg; done: + if(NULL == ret_value) { + H5O_msg_free(mesg_type->id, native_mesg); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_copy_file() */ @@ -1846,7 +1911,7 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *mesg_flags, const H5O_msg_class_t *o /* Message is shared. Get shared message, change message type, * and use shared information */ HDmemset(sh_mesg, 0, sizeof(H5O_shared_t)); - if((orig_type->get_share)(orig_mesg, sh_mesg/*out*/) < 0) + if(NULL == (orig_type->get_share)(orig_mesg, sh_mesg/*out*/)) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, UFAIL, "can't get shared message") *new_type = H5O_MSG_SHARED; diff --git a/src/H5Opkg.h b/src/H5Opkg.h index a87c3ba..8b52c2e 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -165,7 +165,7 @@ struct H5O_msg_class_t { herr_t (*free)(void *); /*free main data struct */ herr_t (*del)(H5F_t *, hid_t, const void *, hbool_t); /* Delete space in file referenced by this message */ herr_t (*link)(H5F_t *, hid_t, const void *); /* Increment any links in file reference by this message */ - herr_t (*get_share)(const void*, struct H5O_shared_t*); /* Get shared information */ + void *(*get_share)(const void*, struct H5O_shared_t*); /* Get shared information */ herr_t (*set_share)(void*, const struct H5O_shared_t*); /* Set shared information */ htri_t (*is_shared)(const void*); /* Is message shared? */ herr_t (*pre_copy_file)(H5F_t *, const H5O_msg_class_t *, const void *, hbool_t *, const H5O_copy_t *, void *); /*"pre copy" action when copying native value to file */ @@ -403,7 +403,7 @@ H5_DLL herr_t H5O_msg_free_mesg(H5O_mesg_t *mesg); H5_DLL htri_t H5O_msg_exists_oh(struct H5O_t *oh, unsigned type_id, int sequence); H5_DLL void * H5O_msg_copy_file(const H5O_msg_class_t *copy_type, const H5O_msg_class_t *mesg_type, H5F_t *file_src, void *mesg_src, - H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata); + H5F_t *file_dst, hid_t dxpl_id, hbool_t *shared, H5O_copy_t *cpy_info, void *udata); H5_DLL herr_t H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, hbool_t internal, H5O_mesg_operator_t op, void *op_data, hid_t dxpl_id, unsigned *oh_flags_ptr); @@ -453,3 +453,4 @@ H5_DLL herr_t H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, F #endif /* _H5Opkg_H */ + diff --git a/src/H5Opline.c b/src/H5Opline.c index ccbddd0..abd7471 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -35,7 +35,7 @@ static void *H5O_pline_copy(const void *_mesg, void *_dest); static size_t H5O_pline_size(const H5F_t *f, const void *_mesg); static herr_t H5O_pline_reset(void *_mesg); static herr_t H5O_pline_free(void *_mesg); -static herr_t H5O_pline_get_share(const void *_mesg, H5O_shared_t *sh); +static void *H5O_pline_get_share(const void *_mesg, H5O_shared_t *sh); static herr_t H5O_pline_set_share(void *_mesg, const H5O_shared_t *sh); static htri_t H5O_pline_is_shared(const void *_mesg); static herr_t H5O_pline_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t *type, @@ -599,26 +599,24 @@ done: * * Purpose: Gets sharing information from the message * - * Return: Non-negative on success/Negative on failure + * Return: Shared message on success/NULL on failure * * Programmer: James Laird * Tuesday, October 10, 2006 * *------------------------------------------------------------------------- */ -static herr_t +static void * H5O_pline_get_share(const void *_mesg, H5O_shared_t *sh /*out*/) { const H5O_pline_t *mesg = (const H5O_pline_t *)_mesg; - herr_t ret_value = SUCCEED; + void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_pline_get_share) HDassert (mesg); - HDassert (sh); - if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh)) - ret_value = FAIL; + ret_value = H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_pline_get_share() */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index cd68ae5..27e2bdf 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -425,7 +425,7 @@ H5_DLL herr_t H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, H5O_operat H5_DLL size_t H5O_msg_raw_size(const H5F_t *f, unsigned type_id, const void *mesg); H5_DLL size_t H5O_msg_mesg_size(const H5F_t *f, unsigned type_id, const void *mesg, size_t extra_raw); -H5_DLL herr_t H5O_msg_get_share(unsigned type_id, const void *mesg, H5O_shared_t *share); +H5_DLL void *H5O_msg_get_share(unsigned type_id, const void *mesg, H5O_shared_t *share); H5_DLL htri_t H5O_msg_is_shared(unsigned type_id, const void *mesg); H5_DLL herr_t H5O_msg_set_share(unsigned type_id, H5O_shared_t *share, void *mesg); H5_DLL herr_t H5O_msg_reset_share(unsigned type_id, void *mesg); diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 9b4c473..e5af3a6 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -31,7 +31,7 @@ static void *H5O_sdspace_copy(const void *_mesg, void *_dest); static size_t H5O_sdspace_size(const H5F_t *f, const void *_mesg); static herr_t H5O_sdspace_reset(void *_mesg); static herr_t H5O_sdspace_free (void *_mesg); -static herr_t H5O_sdspace_get_share(const void *_mesg, H5O_shared_t *sh); +static void *H5O_sdspace_get_share(const void *_mesg, H5O_shared_t *sh); static herr_t H5O_sdspace_set_share(void *_mesg, const H5O_shared_t *sh); static htri_t H5O_sdspace_is_shared(const void *_mesg); static herr_t H5O_sdspace_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t *type, @@ -452,26 +452,24 @@ H5O_sdspace_free (void *mesg) * * Purpose: Gets sharing information from the message * - * Return: Non-negative on success/Negative on failure + * Return: Shared message on success/NULL on failure * * Programmer: James Laird * Tuesday, October 10, 2006 * *------------------------------------------------------------------------- */ -static herr_t +static void * H5O_sdspace_get_share(const void *_mesg, H5O_shared_t *sh /*out*/) { const H5S_extent_t *mesg = (const H5S_extent_t *)_mesg; - herr_t ret_value = SUCCEED; + void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_get_share) HDassert (mesg); - HDassert (sh); - if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh)) - ret_value = FAIL; + ret_value = H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_sdspace_get_share() */ diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 963e8f4..d1f6577 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -293,10 +293,10 @@ H5O_shared_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *buf) /* Get the shared information flags * Flags are unused before version 3. */ - if(version >= H5O_SHARED_VERSION_2) + if(version >= H5O_SHARED_VERSION_2) { mesg->flags = *buf++; - else - { + } + else { mesg->flags = H5O_COMMITTED_FLAG; buf++; } /* end else */ @@ -306,20 +306,18 @@ H5O_shared_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *buf) buf += 6; /* Body */ - if(version == H5O_SHARED_VERSION_1) + if(version == H5O_SHARED_VERSION_1) { H5G_obj_ent_decode(f, &buf, &(mesg->u.oloc)); - else if (version >= H5O_SHARED_VERSION_2) - { + } + else if (version >= H5O_SHARED_VERSION_2) { /* If this message is in the heap, copy a heap ID. * Otherwise, it is a named datatype, so copy an H5O_loc_t. */ - if(mesg->flags & H5O_SHARED_IN_HEAP_FLAG) - { + if(mesg->flags & H5O_SHARED_IN_HEAP_FLAG) { HDassert(version >= H5O_SHARED_VERSION_3 ); HDmemcpy(&(mesg->u.heap_id), buf, (size_t) H5SM_FHEAP_ID_LEN); } - else - { + else { /* The H5O_COMMITTED_FLAG should be set if this message * is from an older version before the flag existed. */ @@ -337,9 +335,10 @@ H5O_shared_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *buf) ret_value = mesg; done: - if(ret_value == NULL) + if(ret_value == NULL) { if(mesg != NULL) H5MM_xfree(mesg); + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_shared_decode() */ @@ -377,9 +376,10 @@ H5O_shared_encode(H5F_t *f, uint8_t *buf/*out*/, const void *_mesg) /* If this message is shared in the heap, we need to use version 3 of the * encoding and encode the SHARED_IN_HEAP flag. */ - /* JAMES: also use "use latest version" flag here? */ - if(mesg->flags & H5O_SHARED_IN_HEAP_FLAG) + /* JAMES: also use "use latest version" flag here */ + if(mesg->flags & H5O_SHARED_IN_HEAP_FLAG) { version = H5O_SHARED_VERSION; + } else { HDassert(mesg->flags & H5O_COMMITTED_FLAG); version = H5O_SHARED_VERSION_2; /* version 1 is no longer used */ @@ -391,10 +391,12 @@ H5O_shared_encode(H5F_t *f, uint8_t *buf/*out*/, const void *_mesg) /* Encode either the heap ID of the message or the address of the * object header that holds it. */ - if(mesg->flags & H5O_SHARED_IN_HEAP_FLAG) - HDmemcpy(buf, &(mesg->u.heap_id), (size_t)H5SM_FHEAP_ID_LEN); - else + if(mesg->flags & H5O_SHARED_IN_HEAP_FLAG) { + HDmemcpy(buf, &(mesg->u.heap_id), (size_t) H5SM_FHEAP_ID_LEN); + } + else { H5F_addr_encode(f, &buf, mesg->u.oloc.addr); + } FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_shared_encode() */ @@ -484,8 +486,8 @@ H5O_shared_size(const H5F_t *f, const void *_mesg) H5SM_FHEAP_ID_LEN; /* Shared in the heap */ } - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shared_size() */ + FUNC_LEAVE_NOAPI(ret_value); +} /*------------------------------------------------------------------------- @@ -692,9 +694,9 @@ H5O_shared_copy_file(H5F_t *file_src, const H5O_msg_class_t *mesg_type, HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "unable to read shared message") if(mesg_type->copy_file) { - /* Copy the original, un-shared message and return it */ - ret_value = H5O_msg_copy_file(mesg_type, mesg_type, file_src, dst_mesg, file_dst, dxpl_id, cpy_info, udata); - H5MM_xfree(dst_mesg); + /* Copy the original, un-shared message and return it */ + ret_value = (mesg_type->copy_file)(file_src, mesg_type, dst_mesg, file_dst, dxpl_id, cpy_info, udata); + H5O_msg_free(mesg_type->id, dst_mesg); } else { ret_value = dst_mesg; @@ -705,9 +707,9 @@ done: if(!ret_value) { if(shared_dst) - H5MM_xfree(shared_dst); + H5O_msg_free(H5O_SHARED_ID, shared_dst); if(dst_mesg) - H5MM_xfree(dst_mesg); + H5O_msg_free(mesg_type->id, dst_mesg); } FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5SM.c b/src/H5SM.c index 0e7ba0e..de9bddb 100755 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -720,6 +720,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header, HGOTO_ERROR(H5E_OHDR, H5E_BADSIZE, FAIL, "can't find message size") if(NULL == (encoding_buf = H5MM_calloc(buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding") + if(H5O_msg_encode(f, type_id, encoding_buf, mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "can't encode message to be shared") @@ -1153,23 +1154,15 @@ H5SM_get_info(H5F_t *f, unsigned *index_flags, unsigned *minsizes, FUNC_ENTER_NOAPI(H5SM_get_info, FAIL) - HDassert(f); + HDassert(f && f->shared); + HDassert(f->shared->sohm_addr != HADDR_UNDEF); /* Convenience variables */ table_addr = f->shared->sohm_addr; - HDassert(table_addr != HADDR_UNDEF); - HDassert(f->shared->sohm_nindexes > 0); - - /* Allocate and initialize the master table structure */ - if(NULL == (table = H5MM_calloc(sizeof(H5SM_master_table_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - table->version = f->shared->sohm_vers; - table->num_indexes = f->shared->sohm_nindexes; /* Read the rest of the SOHM table information from the cache */ - if (NULL == (table = H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, NULL, table, H5AC_READ))) + if (NULL == (table = H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") /* Return info */ diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 6c9118e..155a3ab 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -57,7 +57,7 @@ /* Local Prototypes */ /********************/ static herr_t H5SM_flush_table(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_master_table_t *table); -static H5SM_master_table_t *H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, H5SM_master_table_t *table); +static H5SM_master_table_t *H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, void *table); static herr_t H5SM_clear_table(H5F_t *f, H5SM_master_table_t *table, hbool_t destroy); static herr_t H5SM_dest_table(H5F_t *f, H5SM_master_table_t* table); static herr_t H5SM_table_size(const H5F_t *f, const H5SM_master_table_t *table, size_t *size_ptr); @@ -191,8 +191,9 @@ done: *------------------------------------------------------------------------- */ static H5SM_master_table_t * -H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, H5SM_master_table_t *table) +H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1, void UNUSED *udata2) { + H5SM_master_table_t *table = NULL; size_t table_size; /* Size of SOHM master table on disk */ uint8_t *buf=NULL; /* Reading buffer */ const uint8_t *p; /* Pointer into input buffer */ @@ -203,7 +204,16 @@ H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1 FUNC_ENTER_NOAPI(H5SM_load_table, NULL) - HDassert(table); + /* Allocate space for the master table in memory */ + if(NULL == (table = H5MM_calloc(sizeof(H5SM_master_table_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + + /* Read number of indexes and version from file superblock */ + table->num_indexes = f->shared->sohm_nindexes; + table->version = f->shared->sohm_vers; + + HDassert(addr == f->shared->sohm_addr); + HDassert(addr != HADDR_UNDEF); HDassert(table->num_indexes > 0); /* Compute the size of the SOHM table header on disk. This is the "table" itself diff --git a/test/objcopy.c b/test/objcopy.c index 21b4546..767535a 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -40,6 +40,14 @@ const char *FILENAME[] = { NULL }; +/* Configuration, really a series of bit flags. Maximum value is all three + * bit flags enabled. + */ +#define CONFIG_SHARE_SRC 1 +#define CONFIG_SHARE_DST 2 +#define CONFIG_NEW_FORMAT 4 +#define MAX_CONFIGURATION 7 + #define FILE_EXT "objcopy_ext.dat" /* The fill_old.h5 is generated from gen_old_fill.c in HDF5 'test' directory * for version 1.4(after 1.4.3). To get this data file, simply compile @@ -1301,7 +1309,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_named_datatype(hid_t fapl) +test_copy_named_datatype(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1, tid2 = -1; /* Datatype IDs */ @@ -1318,7 +1326,7 @@ test_copy_named_datatype(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR @@ -1337,7 +1345,7 @@ test_copy_named_datatype(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -1394,7 +1402,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_named_datatype_vl(hid_t fapl) +test_copy_named_datatype_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1, tid2 = -1; /* Datatype IDs */ @@ -1411,7 +1419,7 @@ test_copy_named_datatype_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* create datatype */ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR @@ -1430,7 +1438,7 @@ test_copy_named_datatype_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -1487,7 +1495,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_named_datatype_vl_vl(hid_t fapl) +test_copy_named_datatype_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1, tid2 = -1; /* Datatype IDs */ @@ -1504,7 +1512,7 @@ test_copy_named_datatype_vl_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* create first vlen datatype */ if((tid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR @@ -1529,7 +1537,7 @@ test_copy_named_datatype_vl_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -1588,7 +1596,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_simple(hid_t fapl) +test_copy_dataset_simple(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -1614,7 +1622,7 @@ test_copy_dataset_simple(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim2d[0] = DIM_SIZE_1; @@ -1646,7 +1654,7 @@ test_copy_dataset_simple(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -1705,7 +1713,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_simple_empty(hid_t fapl) +test_copy_dataset_simple_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -1724,7 +1732,7 @@ test_copy_dataset_simple_empty(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim2d[0] = DIM_SIZE_1; @@ -1753,7 +1761,7 @@ test_copy_dataset_simple_empty(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -1813,7 +1821,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_compound(hid_t fapl) +test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -1844,7 +1852,7 @@ test_copy_dataset_compound(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0] = DIM_SIZE_1; @@ -1883,7 +1891,7 @@ test_copy_dataset_compound(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -1944,7 +1952,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_chunked(hid_t fapl) +test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -1972,7 +1980,7 @@ test_copy_dataset_chunked(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim2d[0]=DIM_SIZE_1; @@ -2011,7 +2019,7 @@ test_copy_dataset_chunked(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -2071,7 +2079,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_chunked_empty(hid_t fapl) +test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -2092,7 +2100,7 @@ test_copy_dataset_chunked_empty(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim2d[0]=DIM_SIZE_1; @@ -2128,7 +2136,7 @@ test_copy_dataset_chunked_empty(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -2188,7 +2196,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_chunked_sparse(hid_t fapl) +test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -2218,7 +2226,7 @@ test_copy_dataset_chunked_sparse(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim2d[0]=DIM_SIZE_1; @@ -2266,7 +2274,7 @@ test_copy_dataset_chunked_sparse(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -2325,7 +2333,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_compressed(hid_t fapl) +test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { #ifdef H5_HAVE_FILTER_DEFLATE hid_t fid_src = -1, fid_dst = -1; /* File IDs */ @@ -2359,7 +2367,7 @@ test_copy_dataset_compressed(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim2d[0]=DIM_SIZE_1; @@ -2399,7 +2407,7 @@ test_copy_dataset_compressed(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -2461,7 +2469,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_compact(hid_t fapl) +test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -2488,7 +2496,7 @@ test_copy_dataset_compact(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim2d[0]=DIM_SIZE_1; @@ -2527,7 +2535,7 @@ test_copy_dataset_compact(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -2588,7 +2596,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_external(hid_t fapl) +test_copy_dataset_external(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -2618,7 +2626,7 @@ test_copy_dataset_external(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0]=DIM_SIZE_1; @@ -2654,7 +2662,7 @@ test_copy_dataset_external(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -2714,7 +2722,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_named_dtype(hid_t fapl) +test_copy_dataset_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1; /* Datatype ID */ @@ -2740,7 +2748,7 @@ test_copy_dataset_named_dtype(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0]=DIM_SIZE_1; @@ -2775,7 +2783,7 @@ test_copy_dataset_named_dtype(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -2835,7 +2843,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_named_dtype_hier(hid_t fapl) +test_copy_dataset_named_dtype_hier(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1; /* Datatype ID */ @@ -2862,7 +2870,7 @@ test_copy_dataset_named_dtype_hier(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Create group to place all objects in */ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR @@ -2912,7 +2920,7 @@ test_copy_dataset_named_dtype_hier(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -2974,7 +2982,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_named_dtype_hier_outside(hid_t fapl) +test_copy_dataset_named_dtype_hier_outside(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1; /* Datatype ID */ @@ -3001,7 +3009,7 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Create group to place all objects in */ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR @@ -3051,7 +3059,7 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -3113,7 +3121,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_multi_ohdr_chunks(hid_t fapl) +test_copy_dataset_multi_ohdr_chunks(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -3139,7 +3147,7 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Create group to place all objects in */ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR @@ -3185,7 +3193,7 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -3246,7 +3254,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_attr_named_dtype(hid_t fapl) +test_copy_dataset_attr_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1; /* Datatype ID */ @@ -3273,7 +3281,7 @@ test_copy_dataset_attr_named_dtype(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Create group to place all objects in */ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR @@ -3326,7 +3334,7 @@ test_copy_dataset_attr_named_dtype(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -3388,7 +3396,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_contig_vl(hid_t fapl) +test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1; /* Datatype ID */ @@ -3418,7 +3426,7 @@ test_copy_dataset_contig_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0]=DIM_SIZE_1; @@ -3446,7 +3454,7 @@ test_copy_dataset_contig_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -3517,7 +3525,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_chunked_vl(hid_t fapl) +test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1; /* Datatype ID */ @@ -3549,7 +3557,7 @@ test_copy_dataset_chunked_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0]=DIM_SIZE_1; @@ -3584,7 +3592,7 @@ test_copy_dataset_chunked_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -3655,7 +3663,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_compact_vl(hid_t fapl) +test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1; /* Datatype ID */ @@ -3686,7 +3694,7 @@ test_copy_dataset_compact_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0]=DIM_SIZE_1; @@ -3721,7 +3729,7 @@ test_copy_dataset_compact_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -3792,7 +3800,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_attribute_vl(hid_t fapl) +test_copy_attribute_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -3812,7 +3820,7 @@ test_copy_attribute_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim2d[0] = DIM_SIZE_1; @@ -3841,7 +3849,7 @@ test_copy_attribute_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -3907,7 +3915,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_compressed_vl(hid_t fapl) +test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { #ifdef H5_HAVE_FILTER_DEFLATE hid_t fid_src = -1, fid_dst = -1; /* File IDs */ @@ -3947,7 +3955,7 @@ test_copy_dataset_compressed_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim2d[0]=DIM_SIZE_1; @@ -3984,7 +3992,7 @@ test_copy_dataset_compressed_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -4059,7 +4067,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_group_empty(hid_t fapl) +test_copy_group_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t gid = -1, gid2 = -1; /* Group IDs */ @@ -4076,7 +4084,7 @@ test_copy_group_empty(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* create group at the SRC file */ if((gid = H5Gcreate(fid_src, NAME_GROUP_EMPTY, (size_t)0)) < 0) TEST_ERROR @@ -4095,7 +4103,7 @@ test_copy_group_empty(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -4154,7 +4162,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_group(hid_t fapl) +test_copy_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -4182,7 +4190,7 @@ test_copy_group(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* create group at the SRC file */ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR @@ -4226,7 +4234,7 @@ test_copy_group(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -4288,7 +4296,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_root_group(hid_t fapl) +test_copy_root_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -4316,7 +4324,7 @@ test_copy_root_group(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* create group at the SRC file */ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR @@ -4359,7 +4367,7 @@ test_copy_root_group(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -4419,7 +4427,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_group_deep(hid_t fapl) +test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -4448,7 +4456,7 @@ test_copy_group_deep(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* create group at the SRC file */ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR @@ -4501,7 +4509,7 @@ test_copy_group_deep(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -4561,7 +4569,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_group_loop(hid_t fapl) +test_copy_group_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t gid = -1, gid2 = -1; /* Group IDs */ @@ -4579,7 +4587,7 @@ test_copy_group_loop(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* create group at the SRC file */ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR @@ -4612,7 +4620,7 @@ test_copy_group_loop(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -4676,7 +4684,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_group_wide_loop(hid_t fapl) +test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t gid = -1, gid2 = -1; /* Group IDs */ @@ -4696,7 +4704,7 @@ test_copy_group_wide_loop(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* create group at the SRC file */ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR @@ -4741,7 +4749,7 @@ test_copy_group_wide_loop(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -4802,7 +4810,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_group_links(hid_t fapl) +test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -4829,7 +4837,7 @@ test_copy_group_links(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* create group at the SRC file */ if((gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR @@ -4877,7 +4885,7 @@ test_copy_group_links(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -4937,7 +4945,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_soft_link(hid_t fapl) +test_copy_soft_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -4964,7 +4972,7 @@ test_copy_soft_link(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* create group at the SRC file */ if((gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR @@ -5003,7 +5011,7 @@ test_copy_soft_link(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -5062,7 +5070,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_ext_link(hid_t fapl) +test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -5091,7 +5099,7 @@ test_copy_ext_link(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* create group at the SRC file */ if((gid = H5Gcreate(fid_src, NAME_GROUP_LINK, (size_t)0)) < 0) TEST_ERROR @@ -5134,7 +5142,7 @@ test_copy_ext_link(hid_t fapl) if((fid_ext = H5Fopen(ext_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -5197,7 +5205,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_exist(hid_t fapl) +test_copy_exist(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -5224,7 +5232,7 @@ test_copy_exist(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim2d[0] = DIM_SIZE_1; @@ -5256,7 +5264,7 @@ test_copy_exist(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -5305,7 +5313,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_path(hid_t fapl) +test_copy_path(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -5333,7 +5341,7 @@ test_copy_path(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim2d[0] = DIM_SIZE_1; @@ -5365,7 +5373,7 @@ test_copy_path(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -5440,7 +5448,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_same_file_named_datatype(hid_t fapl) +test_copy_same_file_named_datatype(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid = -1; /* File ID */ hid_t tid = -1, tid2 = -1; /* Datatype IDs */ @@ -5513,7 +5521,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_old_layout(hid_t fapl) +test_copy_old_layout(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t did = -1, did2 = -1; /* Dataset IDs */ @@ -5540,7 +5548,7 @@ test_copy_old_layout(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -5622,7 +5630,7 @@ test_copy_mount(hid_t UNUSED fapl) *------------------------------------------------------------------------- */ static int -test_copy_dataset_compact_named_vl(hid_t fapl) +test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1, tid_copy=-1; /* Datatype ID */ @@ -5653,7 +5661,7 @@ test_copy_dataset_compact_named_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0]=DIM_SIZE_1; @@ -5697,7 +5705,7 @@ test_copy_dataset_compact_named_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -5770,7 +5778,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_contig_named_vl(hid_t fapl) +test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1, tid_copy=-1; /* Datatype ID */ @@ -5800,7 +5808,7 @@ test_copy_dataset_contig_named_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0]=DIM_SIZE_1; @@ -5837,7 +5845,7 @@ test_copy_dataset_contig_named_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -5909,7 +5917,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_chunked_named_vl(hid_t fapl) +test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1, tid_copy=-1; /* Datatype ID */ @@ -5941,7 +5949,7 @@ test_copy_dataset_chunked_named_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0]=DIM_SIZE_1; @@ -5985,7 +5993,7 @@ test_copy_dataset_chunked_named_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -6058,7 +6066,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_compressed_named_vl(hid_t fapl) +test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1, tid_copy=-1; /* Datatype ID */ @@ -6090,7 +6098,7 @@ test_copy_dataset_compressed_named_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0]=DIM_SIZE_1; @@ -6135,7 +6143,7 @@ test_copy_dataset_compressed_named_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -6208,7 +6216,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_compact_vl_vl(hid_t fapl) +test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid=-1, tid2=-1; /* Datatype ID */ @@ -6253,7 +6261,7 @@ test_copy_dataset_compact_vl_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0]=DIM_SIZE_1; @@ -6291,7 +6299,7 @@ test_copy_dataset_compact_vl_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -6363,7 +6371,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_contig_vl_vl(hid_t fapl) +test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid=-1, tid2=-1; /* Datatype ID */ @@ -6408,7 +6416,7 @@ test_copy_dataset_contig_vl_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0]=DIM_SIZE_1; @@ -6445,7 +6453,7 @@ test_copy_dataset_contig_vl_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -6517,7 +6525,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_chunked_vl_vl(hid_t fapl) +test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1, tid2=-1; /* Datatype ID */ @@ -6562,7 +6570,7 @@ test_copy_dataset_chunked_vl_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0]=DIM_SIZE_1; @@ -6600,7 +6608,7 @@ test_copy_dataset_chunked_vl_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -6673,7 +6681,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_dataset_compressed_vl_vl(hid_t fapl) +test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t tid = -1, tid2=-1; /* Datatype ID */ @@ -6718,7 +6726,7 @@ test_copy_dataset_compressed_vl_vl(hid_t fapl) addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* Set dataspace dimensions */ dim1d[0]=DIM_SIZE_1; @@ -6757,7 +6765,7 @@ test_copy_dataset_compressed_vl_vl(hid_t fapl) if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR if(H5Gclose(H5Gcreate(fid_dst, NAME_GROUP_UNCOPIED, (size_t)0)) < 0) TEST_ERROR @@ -6831,7 +6839,7 @@ error: *------------------------------------------------------------------------- */ static int -test_copy_option(hid_t fapl, unsigned flag, hbool_t crt_intermediate_grp, const char* test_desciption) +test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl, unsigned flag, hbool_t crt_intermediate_grp, const char* test_desciption) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t sid = -1; /* Dataspace ID */ @@ -6862,7 +6870,7 @@ test_copy_option(hid_t fapl, unsigned flag, hbool_t crt_intermediate_grp, const addr_reset(); /* create source file */ - if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR /* create group at the SRC file */ if((gid = H5Gcreate(fid_src, NAME_GROUP_TOP, (size_t)0)) < 0) TEST_ERROR @@ -6949,7 +6957,7 @@ test_copy_option(hid_t fapl, unsigned flag, hbool_t crt_intermediate_grp, const if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* create destination file */ - if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */ @@ -7065,6 +7073,10 @@ error: * * Purpose: Test H5Ocopy() * + * Tests a number of cases: messages can be stored in the + * new or old format, messages can be shared in either, + * both, or neither of the source and destination files. + * * Return: Non-negative on success/Negative on failure * * Programmer: Peter Cao @@ -7087,7 +7099,8 @@ main(void) if(HDstrcmp(envval, "stdio") && HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { int nerrors = 0; hid_t fapl, fapl2; - hbool_t new_format; + hid_t fcpl_shared; + int configuration; /* Configuration of tests. */ /* Setup */ h5_reset(); @@ -7099,13 +7112,38 @@ main(void) /* Set the "use the latest version of the format" flag for creating objects in the file */ if(H5Pset_latest_format(fapl2, TRUE) < 0) TEST_ERROR - /* Test with old & new format groups */ - for(new_format = FALSE; new_format <= TRUE; new_format++) { + /* Create an FCPL with sharing enabled */ + if((fcpl_shared = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR + if(H5Pset_shared_mesg_nindexes(fcpl_shared, 1) < 0) TEST_ERROR + if(H5Pset_shared_mesg_index(fcpl_shared, 1, H5O_MESG_ALL_FLAG, (size_t) 10) < 0) TEST_ERROR + + /* Test in all configurations */ + for(configuration = 0; configuration <= MAX_CONFIGURATION; configuration++) { hid_t my_fapl; + hid_t fcpl_src; + hid_t fcpl_dst; + + /* Test with and without shared messages */ + if(configuration & CONFIG_SHARE_SRC) { + puts("\nTesting with shared src messages:"); + fcpl_src = fcpl_shared; + } + else { + puts("\nTesting without shared src messages:"); + fcpl_src = H5P_DEFAULT; + } + if(configuration & CONFIG_SHARE_DST) { + puts("Testing with shared dst messages:"); + fcpl_dst = fcpl_shared; + } + else { + puts("Testing without shared dst messages:"); + fcpl_dst = H5P_DEFAULT; + } /* Set the FAPL for the type of format */ - if(new_format) { - puts("\nTesting with new group format:"); + if(configuration & CONFIG_NEW_FORMAT) { + puts("Testing with new group format:"); my_fapl = fapl2; } /* end if */ else { @@ -7113,58 +7151,59 @@ main(void) my_fapl = fapl; } /* end else */ + /* The tests... */ - nerrors += test_copy_named_datatype(my_fapl); - nerrors += test_copy_named_datatype_vl(my_fapl); - nerrors += test_copy_named_datatype_vl_vl(my_fapl); - nerrors += test_copy_dataset_simple(my_fapl); - nerrors += test_copy_dataset_simple_empty(my_fapl); - nerrors += test_copy_dataset_compound(my_fapl); - nerrors += test_copy_dataset_chunked(my_fapl); - nerrors += test_copy_dataset_chunked_empty(my_fapl); - nerrors += test_copy_dataset_chunked_sparse(my_fapl); - nerrors += test_copy_dataset_compressed(my_fapl); - nerrors += test_copy_dataset_compact(my_fapl); - nerrors += test_copy_dataset_external(my_fapl); - nerrors += test_copy_dataset_named_dtype(my_fapl); - nerrors += test_copy_dataset_named_dtype_hier(my_fapl); - nerrors += test_copy_dataset_named_dtype_hier_outside(my_fapl); - nerrors += test_copy_dataset_multi_ohdr_chunks(my_fapl); - nerrors += test_copy_dataset_attr_named_dtype(my_fapl); - nerrors += test_copy_dataset_contig_vl(my_fapl); - nerrors += test_copy_dataset_chunked_vl(my_fapl); - nerrors += test_copy_dataset_compact_vl(my_fapl); - nerrors += test_copy_dataset_compressed_vl(my_fapl); - nerrors += test_copy_attribute_vl(my_fapl); - nerrors += test_copy_dataset_compact_named_vl(my_fapl); - nerrors += test_copy_dataset_contig_named_vl(my_fapl); - nerrors += test_copy_dataset_chunked_named_vl(my_fapl); - nerrors += test_copy_dataset_compressed_named_vl(my_fapl); - nerrors += test_copy_dataset_compact_vl_vl(my_fapl); - nerrors += test_copy_dataset_contig_vl_vl(my_fapl); - nerrors += test_copy_dataset_chunked_vl_vl(my_fapl); - nerrors += test_copy_dataset_compressed_vl_vl(my_fapl); - nerrors += test_copy_group_empty(my_fapl); - nerrors += test_copy_root_group(my_fapl); - nerrors += test_copy_group(my_fapl); - nerrors += test_copy_group_deep(my_fapl); - nerrors += test_copy_group_loop(my_fapl); - nerrors += test_copy_group_wide_loop(my_fapl); - nerrors += test_copy_group_links(my_fapl); - nerrors += test_copy_soft_link(my_fapl); + nerrors += test_copy_named_datatype(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_named_datatype_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_named_datatype_vl_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_simple(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_simple_empty(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compound(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_chunked(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_chunked_empty(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_chunked_sparse(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compressed(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compact(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_external(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_named_dtype(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_named_dtype_hier(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_named_dtype_hier_outside(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_multi_ohdr_chunks(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_attr_named_dtype(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_contig_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_chunked_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compact_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compressed_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_attribute_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compact_named_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_contig_named_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_chunked_named_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compressed_named_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compact_vl_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_contig_vl_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_chunked_vl_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compressed_vl_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_group_empty(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_root_group(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_group(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_group_deep(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_group_loop(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_group_wide_loop(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_group_links(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_soft_link(fcpl_src, fcpl_dst, my_fapl); #ifndef H5_CANNOT_OPEN_TWICE - nerrors += test_copy_ext_link(my_fapl); + nerrors += test_copy_ext_link(fcpl_src, fcpl_dst, my_fapl); #endif /* H5_CANNOT_OPEN_TWICE */ - nerrors += test_copy_exist(my_fapl); - nerrors += test_copy_path(my_fapl); - nerrors += test_copy_same_file_named_datatype(my_fapl); - nerrors += test_copy_old_layout(my_fapl); - nerrors += test_copy_option(my_fapl, H5O_COPY_WITHOUT_ATTR_FLAG, FALSE, "H5Ocopy(): without attributes"); - nerrors += test_copy_option(my_fapl, 0, TRUE, "H5Ocopy(): with missing groups"); - nerrors += test_copy_option(my_fapl, H5O_COPY_EXPAND_SOFT_LINK_FLAG, FALSE, "H5Ocopy(): expand soft link"); - nerrors += test_copy_option(my_fapl, H5O_COPY_SHALLOW_HIERARCHY_FLAG, FALSE, "H5Ocopy(): shallow group copy"); - nerrors += test_copy_option(my_fapl, H5O_COPY_EXPAND_REFERENCE_FLAG, FALSE, "H5Ocopy(): expand object reference"); - nerrors += test_copy_option(my_fapl, H5O_COPY_PRESERVE_NULL_FLAG, FALSE, "H5Ocopy(): preserve NULL messages"); + nerrors += test_copy_exist(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_path(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_same_file_named_datatype(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_old_layout(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_WITHOUT_ATTR_FLAG, FALSE, "H5Ocopy(): without attributes"); + nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, 0, TRUE, "H5Ocopy(): with missing groups"); + nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_EXPAND_SOFT_LINK_FLAG, FALSE, "H5Ocopy(): expand soft link"); + nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_SHALLOW_HIERARCHY_FLAG, FALSE, "H5Ocopy(): shallow group copy"); + nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_EXPAND_REFERENCE_FLAG, FALSE, "H5Ocopy(): expand object reference"); + nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_PRESERVE_NULL_FLAG, FALSE, "H5Ocopy(): preserve NULL messages"); /* TODO: not implemented nerrors += test_copy_option(my_fapl, H5O_COPY_EXPAND_EXT_LINK_FLAG, FALSE, "H5Ocopy: expand external link"); -- cgit v0.12