summaryrefslogtreecommitdiffstats
path: root/src/H5Ocopy_ref.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Ocopy_ref.c')
-rw-r--r--src/H5Ocopy_ref.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/H5Ocopy_ref.c b/src/H5Ocopy_ref.c
index f53eb4a..0de661f 100644
--- a/src/H5Ocopy_ref.c
+++ b/src/H5Ocopy_ref.c
@@ -38,6 +38,8 @@
#include "H5Opkg.h" /* Object headers */
#include "H5Rpkg.h" /* References */
+#include "H5VLnative_private.h" /* Native VOL connector */
+
/****************/
/* Local Macros */
@@ -165,7 +167,7 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src,
size_t buf_size = H5R_OBJ_REF_BUF_SIZE;
size_t i; /* Local index variable */
size_t token_size = H5F_SIZEOF_ADDR(src_oloc->file);
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -173,8 +175,7 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src,
for(i = 0; i < ref_count; i++) {
const unsigned char *src_buf = (const unsigned char *)&src_ref[i];
unsigned char *dst_buf = (unsigned char *)&dst_ref[i];
- H5VL_token_t tmp_token = { 0 };
- uint8_t *p;
+ H5O_token_t tmp_token = { 0 };
/* If data is not initialized, copy zeros and skip */
if(0 == HDmemcmp(src_buf, zeros, buf_size)) {
@@ -185,8 +186,9 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src,
/* Set up for the object copy for the reference */
if(H5R__decode_token_obj_compat(src_buf, &buf_size, &tmp_token, token_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode src object address")
- p = (uint8_t *)&tmp_token;
- H5F_addr_decode(src_oloc->file, (const uint8_t **)&p, &src_oloc->addr);
+ if(H5VL_native_token_to_addr(src_oloc->file, H5I_FILE, tmp_token, &src_oloc->addr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
+
if(!H5F_addr_defined(src_oloc->addr) || src_oloc->addr == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer")
dst_oloc->addr = HADDR_UNDEF;
@@ -196,9 +198,9 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src,
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
/* Set the object reference info for the destination file */
- p = (uint8_t *)&tmp_token;
- H5F_addr_encode(dst_oloc->file, &p, dst_oloc->addr);
- if(H5R__encode_token_obj_compat((const H5VL_token_t *)&tmp_token, token_size, dst_buf, &buf_size) < 0)
+ if(H5VL_native_addr_to_token(dst_oloc->file, H5I_FILE, dst_oloc->addr, &tmp_token) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token")
+ if(H5R__encode_token_obj_compat((const H5O_token_t *)&tmp_token, token_size, dst_buf, &buf_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to encode dst object address")
} /* end for */
@@ -365,23 +367,22 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, H5T_t *dt_src,
for(i = 0; i < ref_count; i++) {
H5R_ref_t *ref_ptr = (H5R_ref_t *)conv_buf;
H5R_ref_priv_t *ref = (H5R_ref_priv_t *)&ref_ptr[i];
- H5VL_token_t tmp_token = { 0 };
- uint8_t *p;
+ H5O_token_t tmp_token = { 0 };
/* Get src object address */
if(H5R__get_obj_token(ref, &tmp_token, &token_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object token")
- p = (uint8_t *)&tmp_token;
- H5F_addr_decode(src_oloc->file, (const uint8_t **)&p, &src_oloc->addr);
+ if(H5VL_native_token_to_addr(src_oloc->file, H5I_FILE, tmp_token, &src_oloc->addr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address")
/* Attempt to copy object from source to destination file */
if(H5O__copy_obj_by_ref(src_oloc, dst_oloc, dst_root_loc, cpy_info) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
/* Set dst object address */
- p = (uint8_t *)&tmp_token;
- H5F_addr_encode(dst_oloc->file, &p, dst_oloc->addr);
- if(H5R__set_obj_token(ref, (const H5VL_token_t *)&tmp_token, token_size) < 0)
+ if(H5VL_native_addr_to_token(dst_oloc->file, H5I_FILE, dst_oloc->addr, &tmp_token) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token")
+ if(H5R__set_obj_token(ref, (const H5O_token_t *)&tmp_token, token_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set object token")
/* Do not set app_ref since references are released once the copy is done */
if(H5R__set_loc_id(ref, dst_loc_id, TRUE, FALSE) < 0)