diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-04-01 20:14:11 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-04-01 20:14:11 (GMT) |
commit | 4659f50b832958636db672d9025a610eb70b04f1 (patch) | |
tree | 4d6f3e9c523dcd89e1b6d1f07f3cf184a3b007a7 /src/H5Oshared.c | |
parent | 1cd1d6956a9d00ea5eaf57fcfad87b2c8651cf9c (diff) | |
download | hdf5-4659f50b832958636db672d9025a610eb70b04f1.zip hdf5-4659f50b832958636db672d9025a610eb70b04f1.tar.gz hdf5-4659f50b832958636db672d9025a610eb70b04f1.tar.bz2 |
[svn-r12189] Purpose:
New/expanded features
Description:
Check in Peter's changed for the object copy code:
- Allow/fix copying datasets using named variable-length datatypes
- Start adding framework for property list to control how object
copying occurs.
Platforms tested:
FreeBSD 4.11 (sleipnir)
Too minor to require h5committest
Diffstat (limited to 'src/H5Oshared.c')
-rw-r--r-- | src/H5Oshared.c | 58 |
1 files changed, 53 insertions, 5 deletions
diff --git a/src/H5Oshared.c b/src/H5Oshared.c index cdba678..ccdb61c 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -42,8 +42,10 @@ static void *H5O_shared_copy(const void *_mesg, void *_dest, unsigned update_fla static size_t H5O_shared_size (const H5F_t*, const void *_mesg); static herr_t H5O_shared_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link); static herr_t H5O_shared_link(H5F_t *f, hid_t dxpl_id, const void *_mesg); +static herr_t H5O_shared_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t *type, + void *mesg_src, void *_udata); static void *H5O_shared_copy_file(H5F_t *file_src, void *native_src, - H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void *udata); + H5F_t *file_dst, hid_t dxpl_id, unsigned cpy_option, H5SL_t *map_list, void *udata); static herr_t H5O_shared_debug (H5F_t*, hid_t dxpl_id, const void*, FILE*, int, int); /* This message derives from H5O message class */ @@ -61,7 +63,7 @@ const H5O_msg_class_t H5O_MSG_SHARED[1] = {{ H5O_shared_link, /*link method */ NULL, /*get share method */ NULL, /*set share method */ - NULL, /* pre copy native value to file */ + H5O_shared_pre_copy_file, /* pre copy native value to file */ H5O_shared_copy_file, /* copy native value to file */ NULL, /* post copy native value to file */ H5O_shared_debug /*debug method */ @@ -426,8 +428,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_shared_copy_file(H5F_t UNUSED *file_src, void *native_src, - H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void UNUSED *udata) +H5O_shared_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst, + hid_t dxpl_id, unsigned cpy_option, H5SL_t *map_list, void UNUSED *udata) { H5O_shared_t *shared_src = (H5O_shared_t *)native_src; H5O_shared_t *shared_dst = NULL; @@ -449,7 +451,7 @@ H5O_shared_copy_file(H5F_t UNUSED *file_src, void *native_src, shared_dst->oloc.file = file_dst; /* Copy the shared object from source to destination */ - if(H5O_copy_header_map(&(shared_src->oloc), &(shared_dst->oloc), dxpl_id, map_list) < 0) + if(H5O_copy_header_map(&(shared_src->oloc), &(shared_dst->oloc), dxpl_id, cpy_option, map_list) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object") /* Set return value */ @@ -465,6 +467,52 @@ done: /*------------------------------------------------------------------------- + * Function: H5O_shared_pre_copy_file + * + * Purpose: Perform any necessary actions before copying message between + * files for shared messages. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: Peter Cao + * Saturday, February 11, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5O_shared_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t *type, void *native_src, void *udata) +{ + H5O_shared_t *shared_src = (H5O_shared_t *)native_src; + void *mesg_native = NULL; + hid_t dxpl_id = H5AC_dxpl_id; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5O_shared_pre_copy_file) + + if(type->pre_copy_file) { + if((mesg_native = H5O_read_real(&(shared_src->oloc), type, 0, NULL, dxpl_id)) == NULL) + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, FAIL, "unable to load object header") + + /* Perform "pre copy" operation on messge */ + if((type->pre_copy_file)(file_src, type, mesg_native, udata) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to perform 'pre copy' operation on message") + } /* end of if */ + + /* check args */ + HDassert(file_src); + HDassert(type); + +done: + if(mesg_native) + H5O_free_real(type, mesg_native); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_shared_pre_copy_file() */ + + +/*------------------------------------------------------------------------- * Function: H5O_shared_debug * * Purpose: Prints debugging info for the message |