/*------------------------------------------------------------------------- * Function: H5D__single_idx_copy_setup * * Purpose: Set up any necessary information for copying the single chunk * * Return: Non-negative on success/Negative on failure * * Programmer: Vailin Choi; Sept 2011 * *------------------------------------------------------------------------- */ static herr_t H5D__single_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_idx_info_t *idx_info_dst) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Check args */ HDassert(idx_info_src); HDassert(idx_info_src->f); HDassert(idx_info_src->pline); HDassert(idx_info_src->layout); HDassert(idx_info_src->storage); HDassert(H5F_addr_defined(idx_info_src->storage->idx_addr)); HDassert(idx_info_dst); HDassert(idx_info_dst->f); HDassert(idx_info_dst->pline); HDassert(idx_info_dst->layout); HDassert(idx_info_dst->storage); /* Set copied metadata tag */ H5_BEGIN_TAG(idx_info_dst->dxpl_id, H5AC__COPIED_TAG, FAIL); /* Set up information at the destination file */ if(H5D__single_idx_create(idx_info_dst) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") /* Reset metadata tag */ H5_END_TAG(FAIL); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__single_idx_copy_setup() */
/*------------------------------------------------------------------------- * Function: H5O_ainfo_copy_file * * Purpose: Copies a message from _MESG to _DEST in file * * Return: Success: Ptr to _DEST * Failure: NULL * * Programmer: Peter Cao * July 18, 2007 * *------------------------------------------------------------------------- */ static void * H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hbool_t H5_ATTR_UNUSED *recompute_size, unsigned H5_ATTR_UNUSED *mesg_flags, H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata, hid_t dxpl_id) { H5O_ainfo_t *ainfo_src = (H5O_ainfo_t *)mesg_src; H5O_ainfo_t *ainfo_dst = NULL; void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* check args */ HDassert(file_src); HDassert(ainfo_src); HDassert(file_dst); HDassert(cpy_info); HDassert(!cpy_info->copy_without_attr); /* Allocate space for the destination message */ if(NULL == (ainfo_dst = H5FL_MALLOC(H5O_ainfo_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the top level of the information */ *ainfo_dst = *ainfo_src; if(H5F_addr_defined(ainfo_src->fheap_addr)) { /* Prepare to copy dense attributes - actual copy in post_copy */ /* Set copied metadata tag */ H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, NULL); if(H5A_dense_create(file_dst, dxpl_id, ainfo_dst) < 0) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes") /* Reset metadata tag */ H5_END_TAG(NULL); } /* end if */ /* Set return value */ ret_value = ainfo_dst; done: /* Release destination attribute information on failure */ if(!ret_value && ainfo_dst) ainfo_dst = H5FL_FREE(H5O_ainfo_t, ainfo_dst); FUNC_LEAVE_NOAPI(ret_value) } /* H5O_ainfo_copy_file() */