summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkmu <kmu@hdfgroup.org>2019-12-02 16:46:22 (GMT)
committerkmu <kmu@hdfgroup.org>2019-12-02 16:46:22 (GMT)
commit463199464f2b5c9f798b23ffe3f1db139b68f4d2 (patch)
tree9df3e9cafae901d462a14a6689caa93507a515e7 /src
parentea0759d047dc6421da90375a9c27f7cde0a8e117 (diff)
parent0772b975d1d2bfa15aedeb4b6e2c2aac78c61a2f (diff)
downloadhdf5-463199464f2b5c9f798b23ffe3f1db139b68f4d2.zip
hdf5-463199464f2b5c9f798b23ffe3f1db139b68f4d2.tar.gz
hdf5-463199464f2b5c9f798b23ffe3f1db139b68f4d2.tar.bz2
Merge branch 'develop' of https://git.hdfgroup.org/scm/hdffv/hdf5 into develop
Diffstat (limited to 'src')
-rw-r--r--src/H5Cdbg.c5
-rw-r--r--src/H5Cpkg.h2
-rw-r--r--src/H5Dchunk.c35
-rw-r--r--src/H5FDhdfs.c1
-rw-r--r--src/H5FDlog.c4
-rw-r--r--src/H5FSsection.c10
-rw-r--r--src/H5Fint.c65
-rw-r--r--src/H5Fpkg.h1
-rw-r--r--src/H5Fprivate.h2
-rw-r--r--src/H5Fsuper_cache.c26
-rw-r--r--src/H5HFcache.c8
-rw-r--r--src/H5HFtiny.c2
-rw-r--r--src/H5HGcache.c8
-rw-r--r--src/H5I.c9
-rw-r--r--src/H5O.c2
-rw-r--r--src/H5Ocopy_ref.c5
-rw-r--r--src/H5Oint.c1
-rw-r--r--src/H5Pmapl.c3
-rw-r--r--src/H5R.c6
-rw-r--r--src/H5Rdeprec.c14
-rw-r--r--src/H5Rint.c11
-rw-r--r--src/H5Rpkg.h2
-rw-r--r--src/H5Rpublic.h8
-rw-r--r--src/H5SL.c4
-rw-r--r--src/H5SM.c4
-rw-r--r--src/H5Sselect.c130
-rw-r--r--src/H5T.c2
-rw-r--r--src/H5Tconv.c71
-rw-r--r--src/H5Tpkg.h4
-rw-r--r--src/H5Tprivate.h2
-rw-r--r--src/H5Tref.c365
-rw-r--r--src/H5VLcallback.c74
-rw-r--r--src/H5VLconnector.h4
-rw-r--r--src/H5VLint.c6
-rw-r--r--src/H5VLnative.h37
-rw-r--r--src/H5VLnative_file.c27
-rw-r--r--src/H5VLnative_object.c22
-rw-r--r--src/H5trace.c3
-rw-r--r--src/libhdf5.settings.in2
39 files changed, 714 insertions, 273 deletions
diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c
index cb1d0e2..1f55e86 100644
--- a/src/H5Cdbg.c
+++ b/src/H5Cdbg.c
@@ -319,8 +319,9 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn)
(int)(entry_ptr->is_dirty),
entry_ptr->type->name);
- HDfprintf(stdout, " node_ptr = %p, item = %p\n",
- node_ptr, H5SL_item(node_ptr));
+ HDfprintf(stdout, " node_ptr = 0x%llx, item = %p\n",
+ (unsigned long long)node_ptr,
+ H5SL_item(node_ptr));
/* increment node_ptr before we delete its target */
node_ptr = H5SL_next(node_ptr);
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index b8648f0..9156c0d 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -4694,7 +4694,7 @@ struct H5C_t {
uint32_t num_last_entries;
#if H5C_DO_SANITY_CHECKS
int32_t slist_len_increase;
- int64_t slist_size_increase;
+ ssize_t slist_size_increase;
#endif /* H5C_DO_SANITY_CHECKS */
/* Fields for maintaining list of tagged entries */
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 4d139c7..381ca4a 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -284,8 +284,7 @@ static int H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *
static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims,
const hsize_t *curr_dims, const hsize_t *max_dims);
static void *H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline);
-static void *H5D__chunk_mem_xfree(void *chk, void *pline);
-static void H5D__chunk_mem_xfree_wrapper(void *chk, void *pline);
+static void *H5D__chunk_mem_xfree(void *chk, const void *pline);
static void *H5D__chunk_mem_realloc(void *chk, size_t size,
const H5O_pline_t *pline);
static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last);
@@ -1101,10 +1100,14 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
H5D_chunk_map_t *fm)
{
const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */
+ H5S_t *tmp_mspace = NULL; /* Temporary memory dataspace */
hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */
htri_t file_space_normalized = FALSE; /* File dataspace was normalized */
+ H5T_t *file_type = NULL; /* Temporary copy of file datatype for iteration */
+ hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
unsigned f_ndims; /* The number of dimensions of the file's dataspace */
int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */
+ char bogus; /* "bogus" buffer to pass to selection iterator */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1428,7 +1431,7 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline)
*-------------------------------------------------------------------------
*/
static void *
-H5D__chunk_mem_xfree(void *chk, void *_pline)
+H5D__chunk_mem_xfree(void *chk, const void *_pline)
{
const H5O_pline_t *pline = (const H5O_pline_t *)_pline;
@@ -1444,17 +1447,6 @@ H5D__chunk_mem_xfree(void *chk, void *_pline)
FUNC_LEAVE_NOAPI(NULL)
} /* H5D__chunk_mem_xfree() */
-/* H5D__chunk_mem_xfree_wrapper() safely adapts the type of
- * H5D__chunk_mem_xfree() to an H5MM_free_t callback, without making
- * compilers warn. It is used with H5D__chunk_mem_xfree_wrapper(), for
- * example.
- */
-static void
-H5D__chunk_mem_xfree_wrapper(void *chk, void *_pline)
-{
- (void)H5D__chunk_mem_xfree(chk, _pline);
-}
-
/*-------------------------------------------------------------------------
* Function: H5D__chunk_mem_realloc
@@ -2147,6 +2139,12 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm)
{
H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */
H5SL_node_t *curr_node; /* Current node in skip list */
+ hsize_t file_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
+ hsize_t file_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
+ hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
+ hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
+ hssize_t adjust[H5S_MAX_RANK]; /* Adjustment to make to all file chunks */
+ unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2171,18 +2169,17 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm)
chunk_info->mspace_shared = TRUE;
} /* end if */
else {
+ HDassert(fm->m_ndims == 1);
hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */
hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */
- HDassert(fm->m_ndims == 1);
-
if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Iterate over each chunk in the chunk list */
curr_node = H5SL_first(fm->sel_chunks);
while(curr_node) {
- hsize_t schunk_points; /* Number of elements in chunk selection */
+ hssize_t schunk_points; /* Number of elements in chunk selection */
hsize_t tmp_count = 1;
/* Get pointer to chunk's information */
@@ -4453,7 +4450,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
/* (delay allocating fill buffer for VL datatypes until refilling) */
/* (casting away const OK - QAK) */
if(H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc,
- (void *)pline, H5D__chunk_mem_xfree_wrapper, (void *)pline,
+ (void *)pline, (H5MM_free_t)H5D__chunk_mem_xfree, (void *)pline,
&dset->shared->dcpl_cache.fill, dset->shared->type,
dset->shared->type_id, (size_t)0, orig_chunk_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
@@ -7155,6 +7152,7 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
hsize_t num_chunks = 0; /* Number of written chunks */
H5D_rdcc_ent_t *ent; /* Cache entry */
const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */
+ const H5O_layout_t *layout; /* Dataset layout */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
@@ -7164,6 +7162,7 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_
HDassert(space);
HDassert(nchunks);
+ layout = &(dset->shared->layout); /* Dataset layout */
rdcc = &(dset->shared->cache.chunk); /* raw data chunk cache */
HDassert(rdcc);
diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c
index 0b954cf..819d200 100644
--- a/src/H5FDhdfs.c
+++ b/src/H5FDhdfs.c
@@ -581,6 +581,7 @@ hid_t
H5FD_hdfs_init(void)
{
hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ unsigned int bin_i;
FUNC_ENTER_NOAPI(FAIL)
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 1c7d549..ac5667f 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -489,8 +489,8 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
#endif
#ifdef H5_HAVE_GETTIMEOFDAY
struct timeval timeval_start;
- struct timeval open_timeval_diff = {0, 0};
- struct timeval stat_timeval_diff = {0, 0};
+ struct timeval open_timeval_diff;
+ struct timeval stat_timeval_diff;
#endif /* H5_HAVE_GETTIMEOFDAY */
h5_stat_t sb;
H5FD_t *ret_value = NULL; /* Return value */
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index cf4a587..df67bd9 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -371,10 +371,10 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n"
/* Check if section info lock count dropped to zero */
if(fspace->sinfo_lock_count == 0) {
hbool_t release_sinfo_space = FALSE; /* Flag to indicate section info space in file should be released */
- hbool_t closing_or_flushing = f->shared->closing; /* Is closing or flushing in progress */
+ hbool_t flush_in_progress = FALSE; /* Is flushing in progress */
- /* Check whether cache-flush is in progress if closing is not. */
- if(!closing_or_flushing && H5AC_get_cache_flush_in_progress(f->shared->cache, &closing_or_flushing) < 0)
+ /* Check whether cache is flush_in_progress */
+ if(H5AC_get_cache_flush_in_progress(f->shared->cache, &flush_in_progress) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get flush_in_progress")
/* Check if we actually protected the section info */
@@ -390,7 +390,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n"
cache_flags |= H5AC__DIRTIED_FLAG;
/* On file close or flushing, does not allow section info to shrink in size */
- if(closing_or_flushing) {
+ if(f->shared->closing || flush_in_progress) {
if(fspace->sect_size > fspace->alloc_sect_size)
cache_flags |= H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG;
else
@@ -441,7 +441,7 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC);
/* Set flag to release section info space in file */
/* On file close or flushing, only need to release section info with size
bigger than previous section */
- if(closing_or_flushing) {
+ if(f->shared->closing || flush_in_progress) {
if(fspace->sect_size > fspace->alloc_sect_size)
release_sinfo_space = TRUE;
else
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 435c1be..153ec2f 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -3654,9 +3654,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__get_file_id
+ * Function: H5F_get_file_id
*
- * Purpose: The package version of H5Iget_file_id(), obtains the file
+ * Purpose: The private version of H5Iget_file_id(), obtains the file
* ID given an object ID.
*
* Return: Success: The file ID associated with the object
@@ -3665,22 +3665,31 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5F__get_file_id(H5F_t *file, hbool_t app_ref)
+H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref)
{
- hid_t file_id = H5I_INVALID_HID; /* File ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void *vol_obj_file = NULL; /* File object pointer */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ hid_t file_id = H5I_INVALID_HID; /* File ID for object */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = obj_type;
+
+ /* Retrieve VOL file from object */
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vol_obj_file) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file from object")
/* Check if the file's ID already exists */
- if(H5I_find_id(file, H5I_FILE, &file_id) < 0)
+ if(H5I_find_id(vol_obj_file, H5I_FILE, &file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed")
/* If the ID does not exist, register it with the VOL connector */
if(H5I_INVALID_HID == file_id) {
- if((file_id = H5VL_wrap_register(H5I_FILE, file, app_ref)) < 0)
+ if((file_id = H5VL_register(H5I_FILE, vol_obj_file, vol_obj->connector, app_ref)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
- file->id_exists = TRUE;
} /* end if */
else {
/* Increment ref count on existing ID */
@@ -3693,44 +3702,6 @@ H5F__get_file_id(H5F_t *file, hbool_t app_ref)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F__get_file_id() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F_get_file_id
- *
- * Purpose: The private version of H5Iget_file_id(), obtains the file
- * ID given an object ID.
- *
- * Return: Success: The file ID associated with the object
- * Failure: H5I_INVALID_HID
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5F_get_file_id(hid_t obj_id, H5I_type_t type, hbool_t app_ref)
-{
- H5VL_object_t *vol_obj; /* File info */
- hid_t file_id = H5I_INVALID_HID; /* File ID for object */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
-
- FUNC_ENTER_NOAPI(H5I_INVALID_HID)
-
- /* Get the object pointer */
- if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier")
-
- /* Get the file through the VOL */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_ID, (int)type, (int)app_ref, &file_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file ID")
- if(H5I_INVALID_HID == file_id)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file ID through the VOL")
-
- /* Set return value */
- ret_value = file_id;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_get_file_id() */
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 7d9a090..6e2c994 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -412,7 +412,6 @@ H5_DLL herr_t H5F__start_swmr_write(H5F_t *f);
H5_DLL herr_t H5F__close(H5F_t *f);
H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high);
H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type);
-H5_DLL hid_t H5F__get_file_id(H5F_t *file, hbool_t app_ref);
H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info);
/* File mount related routines */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index e1a8a2f..cfb796c 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -732,7 +732,7 @@ typedef enum H5F_prefix_open_t {
/* Private functions */
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/);
-H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type, hbool_t app_ref);
+H5_DLL hid_t H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref);
/* Functions that retrieve values from the file struct */
H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index ce216a2..125d6cf 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -347,9 +347,9 @@ static herr_t
H5F__cache_superblock_get_final_load_size(const void *_image, size_t image_len,
void *_udata, size_t *actual_len)
{
- const uint8_t *image = _image; /* Pointer into raw data buffer */
+ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */
- H5F_super_t sblock; /* Temporary file superblock */
+ H5F_super_t sblock; /* Temporary file superblock */
htri_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -361,15 +361,6 @@ H5F__cache_superblock_get_final_load_size(const void *_image, size_t image_len,
HDassert(*actual_len == image_len);
HDassert(image_len >= H5F_SUPERBLOCK_FIXED_SIZE + 6);
- /* Initialize because GCC 5.5 does not realize that
- * H5F__superblock_prefix_decode() initializes it.
- *
- * TBD condition on compiler version.
- */
- sblock.super_vers = 0;
- sblock.sizeof_addr = 0;
- sblock.sizeof_size = 0;
-
/* Deserialize the file superblock's prefix */
if(H5F__superblock_prefix_decode(&sblock, &image, udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't decode file superblock prefix")
@@ -402,7 +393,7 @@ done:
static htri_t
H5F__cache_superblock_verify_chksum(const void *_image, size_t len, void *_udata)
{
- const uint8_t *image = _image; /* Pointer into raw data buffer */
+ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
@@ -448,7 +439,7 @@ H5F__cache_superblock_deserialize(const void *_image, size_t len, void *_udata,
{
H5F_super_t *sblock = NULL; /* File's superblock */
H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */
- const uint8_t *image = _image; /* Pointer into raw data buffer */
+ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
H5F_super_t *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -673,7 +664,7 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU
void *_thing)
{
H5F_super_t *sblock = (H5F_super_t *)_thing; /* Pointer to the object */
- uint8_t *image = _image; /* Pointer into raw data buffer */
+ uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
haddr_t rel_eof; /* Relative EOF for file */
herr_t ret_value = SUCCEED; /* Return value */
@@ -879,7 +870,7 @@ static herr_t
H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t image_len,
void *_udata, size_t *actual_len)
{
- const uint8_t *image = _image; /* Pointer into raw data buffer */
+ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */
H5O_drvinfo_t drvrinfo; /* Driver info */
herr_t ret_value = SUCCEED; /* Return value */
@@ -893,7 +884,6 @@ H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t image_len,
HDassert(*actual_len == image_len);
HDassert(image_len == H5F_DRVINFOBLOCK_HDR_SIZE);
- drvrinfo.len = 0;
/* Deserialize the file driver info's prefix */
if(H5F__drvrinfo_prefix_decode(&drvrinfo, NULL, &image, udata, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't decode file driver info prefix")
@@ -926,7 +916,7 @@ H5F__cache_drvrinfo_deserialize(const void *_image, size_t len, void *_udata,
{
H5O_drvinfo_t *drvinfo = NULL; /* Driver info */
H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */
- const uint8_t *image = _image; /* Pointer into raw data buffer */
+ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */
char drv_name[9]; /* Name of driver */
H5O_drvinfo_t *ret_value = NULL; /* Return value */
@@ -1020,7 +1010,7 @@ H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t len,
void *_thing)
{
H5O_drvinfo_t *drvinfo = (H5O_drvinfo_t *)_thing; /* Pointer to the object */
- uint8_t *image = _image; /* Pointer into raw data buffer */
+ uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */
uint8_t *dbuf; /* Pointer to beginning of driver info */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index ab448ef..2d1c1f2 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -406,7 +406,7 @@ static herr_t
H5HF__cache_hdr_get_final_load_size(const void *_image, size_t image_len,
void *_udata, size_t *actual_len)
{
- H5HF_hdr_t hdr; /* Temporary fractal heap header */
+ H5HF_hdr_t hdr; /* Temporary fractal heap header */
const uint8_t *image = (const uint8_t *)_image; /* Pointer into into supplied image */
H5HF_hdr_cache_ud_t *udata = (H5HF_hdr_cache_ud_t *)_udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -419,12 +419,6 @@ H5HF__cache_hdr_get_final_load_size(const void *_image, size_t image_len,
HDassert(actual_len);
HDassert(*actual_len == image_len);
- /* Initialize because GCC 5.5 does not realize that the
- * H5HF__hdr_prefix_decode() call is sufficient to initialize.
- * GCC 8 is clever enough to see that the variable is initialized.
- * TBD condition on compiler version.
- */
- hdr.filter_len = 0;
/* Deserialize the fractal heap header's prefix */
if(H5HF__hdr_prefix_decode(&hdr, &image) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode fractal heap header prefix")
diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c
index 79d790b..0c27180 100644
--- a/src/H5HFtiny.c
+++ b/src/H5HFtiny.c
@@ -377,7 +377,7 @@ done:
herr_t
H5HF_tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id)
{
- size_t enc_obj_size = 0; /* Encoded object size */
+ size_t enc_obj_size; /* Encoded object size */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index 9f6e73f..29e88df 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -205,7 +205,7 @@ static herr_t
H5HG__cache_heap_get_final_load_size(const void *image, size_t image_len,
void *udata, size_t *actual_len)
{
- H5HG_heap_t heap; /* Global heap */
+ H5HG_heap_t heap; /* Global heap */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -217,12 +217,6 @@ H5HG__cache_heap_get_final_load_size(const void *image, size_t image_len,
HDassert(*actual_len == image_len);
HDassert(image_len == H5HG_MINSIZE);
- /* Initialize because GCC 5.5 cannot see that
- * H5HG__hdr_deserialize() initializes.
- *
- * TBD condition on compiler version.
- */
- heap.size = 0;
/* Deserialize the heap's header */
if(H5HG__hdr_deserialize(&heap, (const uint8_t *)image, (const H5F_t *)udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode global heap prefix")
diff --git a/src/H5I.c b/src/H5I.c
index 76faab1..c3c2d46 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -2270,7 +2270,14 @@ H5Iget_file_id(hid_t obj_id)
/* Call internal function */
if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) {
- if ((ret_value = H5F_get_file_id(obj_id, type, TRUE)) < 0)
+ H5VL_object_t *vol_obj = NULL; /* Object token of obj_id */
+
+ /* Get the VOL object */
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+
+ /* Get the file ID */
+ if ((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID")
} /* end if */
else
diff --git a/src/H5O.c b/src/H5O.c
index b79914c..7e5694a 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -278,7 +278,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Get the file for the object */
- if((file_id = H5F_get_file_id(loc_id, vol_obj_type, FALSE)) < 0)
+ if((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file or file object")
/* Retrieve VOL object */
diff --git a/src/H5Ocopy_ref.c b/src/H5Ocopy_ref.c
index d8efeb5..20b8454 100644
--- a/src/H5Ocopy_ref.c
+++ b/src/H5Ocopy_ref.c
@@ -24,7 +24,6 @@
/****************/
#include "H5Omodule.h" /* This source code file is part of the H5O module */
-#define H5F_FRIEND /* Suppress error about including H5Fpkg */
#define H5R_FRIEND /* Suppress error about including H5Rpkg */
@@ -32,7 +31,7 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
-#include "H5Fpkg.h" /* File */
+#include "H5Fprivate.h" /* File */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
@@ -359,7 +358,7 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, H5T_t *dt_src,
HGOTO_ERROR(H5E_OHDR, H5E_CANTCONVERT, FAIL, "datatype conversion failed")
/* Retrieve loc ID */
- if((dst_loc_id = H5F__get_file_id(dst_oloc->file, FALSE)) < 0)
+ if((dst_loc_id = H5F_get_id(dst_oloc->file)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Making equivalent references in the destination file */
diff --git a/src/H5Oint.c b/src/H5Oint.c
index 0029976..b97ff30 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -31,7 +31,6 @@
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
-#include "H5CXprivate.h" /* API contexts */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
#include "H5FLprivate.h" /* Free lists */
diff --git a/src/H5Pmapl.c b/src/H5Pmapl.c
index 59da91a..fe5be0f 100644
--- a/src/H5Pmapl.c
+++ b/src/H5Pmapl.c
@@ -138,7 +138,6 @@ done:
} /* end H5P__macc_reg_prop() */
-#ifdef H5_HAVE_MAP_API
/*-------------------------------------------------------------------------
* Function: H5Pset_map_iterate_hints
*
@@ -215,4 +214,4 @@ H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size, size_t *key_a
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_map_iterate_hints() */
-#endif /* H5_HAVE_MAP_API */
+
diff --git a/src/H5R.c b/src/H5R.c
index 11b75ca..31b2bcd 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -103,7 +103,7 @@ H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the file for the object */
- if((file_id = H5F_get_file_id(loc_id, obj_type, FALSE)) < 0)
+ if((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Retrieve VOL file object */
@@ -186,7 +186,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the file for the object */
- if((file_id = H5F_get_file_id(loc_id, obj_type, FALSE)) < 0)
+ if((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Retrieve VOL file object */
@@ -265,7 +265,7 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the file for the object */
- if((file_id = H5F_get_file_id(loc_id, obj_type, FALSE)) < 0)
+ if((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Retrieve VOL file object */
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index b9bdffa..0636da9 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -123,7 +123,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier")
/* Get object token */
- if(H5R__decode_token_compat(id, vol_obj_type, ref_type, buf, &obj_token) < 0)
+ if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5G_UNKNOWN, "unable to get object token")
/* Set location parameters */
@@ -183,7 +183,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Get object token */
- if(H5R__decode_token_compat(obj_id, vol_obj_type, ref_type, buf, &obj_token) < 0)
+ if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5I_INVALID_HID, "unable to get object token")
/* Set location parameters */
@@ -265,7 +265,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type,
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token")
/* Get the file for the object */
- if((file_id = H5F_get_file_id(loc_id, vol_obj_type, FALSE)) < 0)
+ if((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Retrieve VOL object */
@@ -351,7 +351,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get object token */
- if(H5R__decode_token_compat(id, vol_obj_type, ref_type, buf, &obj_token) < 0)
+ if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object token")
/* Set location parameters */
@@ -415,7 +415,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Get object token */
- if(H5R__decode_token_compat(obj_id, vol_obj_type, ref_type, buf, &obj_token) < 0)
+ if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5I_INVALID_HID, "unable to get object token")
/* Set location parameters */
@@ -479,7 +479,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Get the file for the object */
- if((file_id = H5F_get_file_id(id, vol_obj_type, FALSE)) < 0)
+ if((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file or file object")
/* Retrieve VOL object */
@@ -548,7 +548,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Get object token */
- if(H5R__decode_token_compat(id, vol_obj_type, ref_type, buf, &obj_token) < 0)
+ if(H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, (-1), "unable to get object token")
/* Set location parameters */
diff --git a/src/H5Rint.c b/src/H5Rint.c
index 9fbc7ef..558c095 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -413,6 +413,7 @@ H5R__destroy(H5R_ref_priv_t *ref)
break;
case H5R_OBJECT1:
case H5R_DATASET_REGION1:
+ break;
case H5R_BADTYPE:
case H5R_MAXTYPE:
HDassert("invalid reference type" && 0);
@@ -423,7 +424,7 @@ H5R__destroy(H5R_ref_priv_t *ref)
} /* end switch */
/* Decrement refcount of attached loc_id */
- if((ref->loc_id != H5I_INVALID_HID) && (H5I_dec_ref(ref->loc_id) < 0))
+ if(ref->type && (ref->loc_id != H5I_INVALID_HID) && (H5I_dec_ref(ref->loc_id) < 0))
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed")
done:
@@ -1169,8 +1170,8 @@ H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc)
/* Don't encode if buffer size isn't big enough or buffer is empty */
if(buf && *nalloc >= ((size_t)buf_size + 2 * H5_SIZEOF_UINT32_T)) {
- int rank;
p = (uint8_t *)buf;
+ int rank;
/* Encode the size for safety check */
UINT32ENCODE(p, (uint32_t)buf_size);
@@ -1479,18 +1480,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5R__decode_token_compat(hid_t id, H5I_type_t type, H5R_type_t ref_type,
+H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type,
const unsigned char *buf, H5VL_token_t *obj_token)
{
hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
- void *vol_obj_file = NULL;
+ H5VL_object_t *vol_obj_file = NULL;
H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
herr_t ret_value = SUCCEED;
FUNC_ENTER_PACKAGE
/* Get the file for the object */
- if((file_id = H5F_get_file_id(id, type, FALSE)) < 0)
+ if((file_id = H5F_get_file_id(vol_obj, type, FALSE)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Retrieve VOL object */
diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h
index 19f3115..7471487 100644
--- a/src/H5Rpkg.h
+++ b/src/H5Rpkg.h
@@ -118,7 +118,7 @@ H5_DLL herr_t H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, c
H5_DLL herr_t H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes, unsigned char **data_ptr, size_t *data_size);
H5_DLL herr_t H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes);
-H5_DLL herr_t H5R__decode_token_compat(hid_t id, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5VL_token_t *obj_token);
+H5_DLL herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5VL_token_t *obj_token);
H5_DLL herr_t H5R__encode_token_obj_compat(const H5VL_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc);
H5_DLL herr_t H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, H5VL_token_t *obj_token, size_t token_size);
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
index 045e04a..ce54ac4 100644
--- a/src/H5Rpublic.h
+++ b/src/H5Rpublic.h
@@ -70,18 +70,14 @@ typedef haddr_t hobj_ref_t;
* machine (8 bytes currently) plus an int.
* Note! This type can only be used with the "native" HDF5 VOL connector.
*/
-typedef struct {
- unsigned char content[H5R_DSET_REG_REF_BUF_SIZE];
-} hdset_reg_ref_t;
+typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE];
/**
* Opaque reference type. The same reference type is used for object,
* dataset region and attribute references. This is the type that
* should always be used with the current reference API.
*/
-typedef struct {
- unsigned char content[H5R_REF_BUF_SIZE];
-} H5R_ref_t;
+typedef unsigned char H5R_ref_t[H5R_REF_BUF_SIZE];
/********************/
/* Public Variables */
diff --git a/src/H5SL.c b/src/H5SL.c
index ec06395..5f00fb8 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -1394,7 +1394,7 @@ H5SL_search(H5SL_t *slist, const void *key)
{
H5SL_node_t *x; /* Current node to examine */
uint32_t hashval = 0; /* Hash value for key */
- void *ret_value = NULL; /* Return value */
+ void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1695,7 +1695,7 @@ H5SL_find(H5SL_t *slist, const void *key)
{
H5SL_node_t *x; /* Current node to examine */
uint32_t hashval = 0; /* Hash value for key */
- H5SL_node_t *ret_value = NULL; /* Return value */
+ H5SL_node_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
diff --git a/src/H5SM.c b/src/H5SM.c
index 91ef98b..290e575 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -313,7 +313,7 @@ ssize_t
H5SM_get_index(const H5SM_master_table_t *table, unsigned type_id)
{
size_t x;
- unsigned type_flag = 0;
+ unsigned type_flag;
ssize_t ret_value = FAIL;
FUNC_ENTER_NOAPI_NOINIT
@@ -353,7 +353,7 @@ htri_t
H5SM_type_shared(H5F_t *f, unsigned type_id)
{
H5SM_master_table_t *table = NULL; /* Shared object master table */
- unsigned type_flag = 0; /* Flag corresponding to message type */
+ unsigned type_flag; /* Flag corresponding to message type */
size_t u; /* Local index variable */
htri_t ret_value = FALSE; /* Return value */
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index bf0441f..664f4b5 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -2599,7 +2599,12 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
const H5S_t *src_intersect_space, H5S_t **new_space_ptr,
hbool_t share_selection)
{
- H5S_t *new_space = NULL; /* New dataspace constructed */
+ H5S_t *new_space = NULL; /* New dataspace constructed */
+ H5S_t *tmp_src_intersect_space = NULL; /* Temporary SIS converted from points->hyperslabs */
+ H5S_sel_iter_t ss_iter; /* Selection iterator for src_space */
+ hbool_t ss_iter_init = FALSE; /* Whether ss_iter has been initialized */
+ H5S_sel_iter_t ds_iter; /* Selection iterator for dst_space */
+ hbool_t ds_iter_init = FALSE; /* Whether ds_iter has been initialized */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2609,6 +2614,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HDassert(dst_space);
HDassert(src_intersect_space);
HDassert(new_space_ptr);
+ HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space));
/* Create new space, using dst extent. Start with "all" selection. */
if(NULL == (new_space = H5S_create(H5S_SIMPLE)))
@@ -2618,7 +2624,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* If the intersecting space is "all", the intersection must be equal to the
* source space and the projection must be equal to the destination space */
- if(src_intersect_space->select.type->type == H5S_SEL_ALL) {
+ if(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_ALL) {
/* Copy the destination selection. */
if(H5S_select_copy(new_space, dst_space, FALSE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination space selection")
@@ -2632,20 +2638,99 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
if(H5S_select_none(new_space) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
} /* end if */
- /* If any of the spaces use point selection, fall back to general algorithm */
- else if((src_intersect_space->select.type->type == H5S_SEL_POINTS)
- || (src_space->select.type->type == H5S_SEL_POINTS)
- || (dst_space->select.type->type == H5S_SEL_POINTS))
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported")
else {
- HDassert(src_intersect_space->select.type->type == H5S_SEL_HYPERSLABS);
- HDassert(src_space->select.type->type != H5S_SEL_NONE);
- HDassert(dst_space->select.type->type != H5S_SEL_NONE);
-
- /* Intersecting space is hyperslab selection. Call the hyperslab
- * routine to project to another hyperslab selection. */
- if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space, share_selection) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab onto destination selection")
+ /* If the source intersect space is a point selection, convert it to a
+ * hyperslab (discarding ordering). We can get away with this because
+ * the order does not matter for the source intersect space */
+ /* Maybe we should just leave it as a point selection for the point by
+ * point algorithm? The search through the selection in
+ * H5S_SELECT_INTERSECT_BLOCK will likely be O(N) either way. -NAF */
+ if(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_POINTS) {
+ H5S_pnt_node_t *curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head;
+
+ /* Create dataspace and copy extent */
+ if(NULL == (tmp_src_intersect_space = H5S_create(H5S_SIMPLE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create temporary source intersect dataspace")
+ if(H5S__extent_copy_real(&tmp_src_intersect_space->extent, &src_intersect_space->extent, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy source intersect space extent")
+
+ /* Iterate over points */
+ for(curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head; curr_pnt; curr_pnt = curr_pnt->next)
+ /* Add point to hyperslab selection */
+ if(H5S_hyper_add_span_element(tmp_src_intersect_space, src_intersect_space->extent.rank, curr_pnt->pnt) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to temporary dataspace selection")
+
+ /* Redirect local src_intersect_space pointer (will not affect
+ * calling function) */
+ src_intersect_space = tmp_src_intersect_space;
+ } /* end for */
+
+ /* By this point, src_intersect_space must be a hyperslab selection */
+ HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS);
+
+ /* If either the source space or the destination space is a point
+ * selection, iterate element by element */
+ if((H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_POINTS)
+ || (H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_POINTS)) {
+ hsize_t coords[H5S_MAX_RANK];
+ htri_t intersect;
+
+ /* Start with "none" selection */
+ if(H5S_select_none(new_space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
+
+ /* Initialize iterators */
+ if(H5S_select_iter_init(&ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize source space selection iterator")
+ ss_iter_init = TRUE;
+ if(H5S_select_iter_init(&ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize destination space selection iterator")
+ ds_iter_init = TRUE;
+
+ /* Iterate over points */
+ do {
+ HDassert(ss_iter.elmt_left > 0);
+ HDassert(ss_iter.elmt_left > 0);
+
+ /* Get SS coords */
+ if(H5S_SELECT_ITER_COORDS(&ss_iter, coords) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source selection coordinates")
+
+ /* Check for intersection */
+ if((intersect = H5S_SELECT_INTERSECT_BLOCK(src_intersect_space, coords, coords)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection")
+
+ /* Add point if it intersects */
+ if(intersect) {
+ /* Get DS coords */
+ if(H5S_SELECT_ITER_COORDS(&ds_iter, coords) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get destination selection coordinates")
+
+ /* Add point to new_space */
+ if(H5S_select_elements(new_space, H5S_SELECT_APPEND, 1, coords) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to new selection")
+ } /* end if */
+
+ /* Advance iterators */
+ if(H5S_SELECT_ITER_NEXT(&ss_iter, 1) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne source selection iterator")
+ ss_iter.elmt_left--;
+ if(H5S_SELECT_ITER_NEXT(&ds_iter, 1) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne destination selection iterator")
+ ds_iter.elmt_left--;
+ } while(ss_iter.elmt_left > 0);
+ HDassert(H5S_SELECT_ITER_NELMTS(&ds_iter) == 0);
+ } /* end if */
+ else {
+ HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_NONE);
+ HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_NONE);
+
+ /* Source and destination selections are all or hyperslab,
+ * intersecting selection is hyperslab. Call the hyperslab routine
+ * to project to another hyperslab selection. */
+ if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space, share_selection) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab onto destination selection")
+ } /* end else */
} /* end else */
/* load the address of the new space into *new_space_ptr */
@@ -2657,6 +2742,14 @@ done:
if(new_space && H5S_close(new_space) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
+ /* General cleanup */
+ if(tmp_src_intersect_space && H5S_close(tmp_src_intersect_space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release temporary dataspace")
+ if(ss_iter_init && H5S_SELECT_ITER_RELEASE(&ss_iter) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release source selection iterator")
+ if(ds_iter_init && H5S_SELECT_ITER_RELEASE(&ds_iter) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release destination selection iterator")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_project_intersection() */
@@ -2668,8 +2761,7 @@ done:
PURPOSE
Projects the intersection of of the selections of src_space_id and
src_intersect_space_id within the selection of src_space_id as a
- selection within the selection of dst_space_id. Currently does not
- support point selections.
+ selection within the selection of dst_space_id.
USAGE
hid_t H5Sselect_project_intersection(src_space_id,dst_space_d,src_intersect_space_id)
@@ -2712,6 +2804,10 @@ H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id,
if(NULL == (src_intersect_space = (H5S_t *)H5I_object_verify(src_intersect_space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace")
+ /* Check numbbers of points selected matches in source and destination */
+ if(H5S_GET_SELECT_NPOINTS(src_space) != H5S_GET_SELECT_NPOINTS(dst_space))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "number of points selected in source space does not match that in destination space")
+
/* Perform operation */
if(H5S_select_project_intersection(src_space, dst_space,
src_intersect_space, &proj_space, FALSE) < 0)
diff --git a/src/H5T.c b/src/H5T.c
index 3fc59d0..9263158 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -3320,7 +3320,7 @@ done:
*-------------------------------------------------------------------------
*/
H5T_t *
-H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
+H5T_copy(H5T_t *old_dt, H5T_copy_t method)
{
H5T_t *new_dt = NULL, *tmp = NULL;
H5T_shared_t *reopened_fo = NULL;
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 6aea00e..4cc5f3c 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -3609,39 +3609,52 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
for(elmtno = 0; elmtno < safe; elmtno++) {
size_t buf_size;
hbool_t dst_copy = FALSE;
+ hbool_t is_nil; /* Whether sequence is "nil" */
- /* Get size of references */
- if(0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize(
- src->shared->u.atomic.u.r.file, s, src->shared->size,
- dst->shared->u.atomic.u.r.file, &dst_copy)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect size")
-
- /* Check if conversion buffer is large enough, resize if necessary. */
- if(conv_buf_size < buf_size) {
- conv_buf_size = buf_size;
- if(NULL == (conv_buf = H5FL_BLK_REALLOC(ref_seq, conv_buf, conv_buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
- HDmemset(conv_buf, 0, conv_buf_size);
- } /* end if */
+ /* Check for "nil" source sequence */
+ if((*(src->shared->u.atomic.u.r.cls->isnull))(src->shared->u.atomic.u.r.file, s, &is_nil) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if reference data is 'nil'")
- if(dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) {
- H5MM_memcpy(conv_buf, s, buf_size);
- } else {
- /* Read reference */
- if(src->shared->u.atomic.u.r.cls->read(
+ if(is_nil) {
+
+ /* Write "nil" sequence to destination location */
+ if((*(dst->shared->u.atomic.u.r.cls->setnull))(dst->shared->u.atomic.u.r.file, d, b) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set reference data to 'nil'")
+ } /* end else-if */
+ else {
+ /* Get size of references */
+ if(0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize(
src->shared->u.atomic.u.r.file, s, src->shared->size,
- dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data")
- }
+ dst->shared->u.atomic.u.r.file, &dst_copy)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect size")
+
+ /* Check if conversion buffer is large enough, resize if necessary. */
+ if(conv_buf_size < buf_size) {
+ conv_buf_size = buf_size;
+ if(NULL == (conv_buf = H5FL_BLK_REALLOC(ref_seq, conv_buf, conv_buf_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HDmemset(conv_buf, 0, conv_buf_size);
+ } /* end if */
- if(dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) {
- H5MM_memcpy(d, conv_buf, buf_size);
- } else {
- /* Write reference to destination location */
- if(dst->shared->u.atomic.u.r.cls->write(
- src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype,
- dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data")
+ if(dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) {
+ H5MM_memcpy(conv_buf, s, buf_size);
+ } else {
+ /* Read reference */
+ if(src->shared->u.atomic.u.r.cls->read(
+ src->shared->u.atomic.u.r.file, s, src->shared->size,
+ dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data")
+ }
+
+ if(dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) {
+ H5MM_memcpy(d, conv_buf, buf_size);
+ } else {
+ /* Write reference to destination location */
+ if(dst->shared->u.atomic.u.r.cls->write(
+ src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype,
+ dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data")
+ }
}
/* Advance pointers */
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 1dbc229..39bff15 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -182,11 +182,15 @@ struct H5T_path_t {
};
/* Reference function pointers */
+typedef herr_t (*H5T_ref_isnullfunc_t)(const H5VL_object_t *file, const void *src_buf, hbool_t *isnull);
+typedef herr_t (*H5T_ref_setnullfunc_t)(H5VL_object_t *file, void *dst_buf, void *bg_buf);
typedef size_t (*H5T_ref_getsizefunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
typedef herr_t (*H5T_ref_readfunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
typedef herr_t (*H5T_ref_writefunc_t)(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf);
typedef struct H5T_ref_class_t {
+ H5T_ref_isnullfunc_t isnull; /* check if reference value is NIL */
+ H5T_ref_setnullfunc_t setnull; /* set a reference value to NIL */
H5T_ref_getsizefunc_t getsize; /* get reference size (bytes) */
H5T_ref_readfunc_t read; /* read reference into buffer */
H5T_ref_writefunc_t write; /* write reference from buffer */
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 86bc174..d8e98af 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -109,7 +109,7 @@ H5_DLLVAR H5T_order_t H5T_native_order_g;
/* Private functions */
H5_DLL herr_t H5T_init(void);
-H5_DLL H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method);
+H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method);
H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable);
H5_DLL herr_t H5T_close(H5T_t *dt);
H5_DLL herr_t H5T_close_real(H5T_t *dt);
diff --git a/src/H5Tref.c b/src/H5Tref.c
index b1bc9e8..6f21363 100644
--- a/src/H5Tref.c
+++ b/src/H5Tref.c
@@ -54,18 +54,24 @@ struct H5Tref_dsetreg {
/* Local Prototypes */
/********************/
+static herr_t H5T__ref_mem_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull);
+static herr_t H5T__ref_mem_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf);
static size_t H5T__ref_mem_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
static herr_t H5T__ref_mem_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
static herr_t H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf);
+static herr_t H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull);
+static herr_t H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf);
static size_t H5T__ref_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
static herr_t H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
static herr_t H5T__ref_disk_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, void *bg_buf);
/* For compatibility */
+static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull);
static size_t H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
static herr_t H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
+static herr_t H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull);
static size_t H5T__ref_dsetreg_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, hbool_t *dst_copy);
static herr_t H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size);
@@ -75,24 +81,32 @@ static herr_t H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *sr
/* Class for reference in memory */
static const H5T_ref_class_t H5T_ref_mem_g = {
+ H5T__ref_mem_isnull, /* 'isnull' */
+ H5T__ref_mem_setnull, /* 'setnull' */
H5T__ref_mem_getsize, /* 'getsize' */
H5T__ref_mem_read, /* 'read' */
H5T__ref_mem_write /* 'write' */
};
static const H5T_ref_class_t H5T_ref_disk_g = {
+ H5T__ref_disk_isnull, /* 'isnull' */
+ H5T__ref_disk_setnull, /* 'setnull' */
H5T__ref_disk_getsize, /* 'getsize' */
H5T__ref_disk_read, /* 'read' */
H5T__ref_disk_write /* 'write' */
};
static const H5T_ref_class_t H5T_ref_obj_disk_g = {
+ H5T__ref_obj_disk_isnull, /* 'isnull' */
+ NULL, /* 'setnull' */
H5T__ref_obj_disk_getsize, /* 'getsize' */
H5T__ref_obj_disk_read, /* 'read' */
NULL /* 'write' */
};
static const H5T_ref_class_t H5T_ref_dsetreg_disk_g = {
+ H5T__ref_dsetreg_disk_isnull, /* 'isnull' */
+ NULL, /* 'setnull' */
H5T__ref_dsetreg_disk_getsize, /* 'getsize' */
H5T__ref_dsetreg_disk_read, /* 'read' */
NULL /* 'write' */
@@ -268,6 +282,57 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5T__ref_mem_isnull
+ *
+ * Purpose: Check if it's a NULL / uninitialized reference.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file,
+ const void *src_buf, hbool_t *isnull)
+{
+ const unsigned char zeros[H5T_REF_MEM_SIZE] = { 0 };
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check parameters */
+ HDassert(src_buf);
+ HDassert(isnull);
+
+ *isnull = (0 == HDmemcmp(src_buf, zeros, H5T_REF_MEM_SIZE)) ? TRUE : FALSE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_mem_isnull() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_mem_setnull
+ *
+ * Purpose: Set a reference as NULL / uninitialized.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf,
+ H5_ATTR_UNUSED void *bg_buf)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ HDmemset(dst_buf, 0, H5T_REF_MEM_SIZE);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_mem_setnull() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5T__ref_mem_getsize
*
* Purpose: Retrieves the size of a memory based reference.
@@ -280,10 +345,12 @@ static size_t
H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, hbool_t *dst_copy)
{
- H5F_t *src_f;
- H5F_t *dst_f;
H5VL_object_t *vol_obj = NULL;
const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf;
+ hbool_t files_equal = FALSE;
+ char file_name_buf_static[256];
+ char *file_name_buf_dyn = NULL;
+ ssize_t file_name_len;
unsigned flags = 0;
size_t ret_value = 0;
@@ -296,27 +363,43 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf
if(NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier")
- /* We should assert here that the terminal connector is H5VL_NATIVE once
- * there is a facility to do so -NAF 2019/10/30 */
-
- /* Retrieve files from VOL objects */
- if(NULL == (src_f = (H5F_t *)H5VL_object_data(vol_obj)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
- if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
-
/* Set external flag if referenced file is not destination file */
- flags |= (src_f->shared != dst_f->shared) ? H5R_IS_EXTERNAL : 0;
+ if(H5VL_file_specific(vol_obj, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, dst_file, &files_equal) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, 0, "can't check if files are equal")
+ flags |= !files_equal ? H5R_IS_EXTERNAL : 0;
/* Force re-calculating encoding size if any flags are set */
if(flags || !src_ref->encode_size) {
/* Pass the correct encoding version for the selection depending on the
* file libver bounds, this is later retrieved in H5S hyper encode */
- if(src_ref->type == (int8_t)H5R_DATASET_REGION2)
- H5CX_set_libver_bounds(dst_f);
+ if(src_ref->type == (int8_t)H5R_DATASET_REGION2) {
+ /* Temporary hack to check if this is the native connector. We need to
+ * add a way to check if the terminal connector is native. For now this
+ * will break passthroughs, but it's needed for other VOL connectors to
+ * work. -NAF */
+ if(dst_file->connector->cls->value == H5VL_NATIVE_VALUE) {
+ H5F_t *dst_f;
+
+ if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
+ H5CX_set_libver_bounds(dst_f);
+ } /* end if */
+ else
+ H5CX_set_libver_bounds(NULL);
+ } /* end if */
+
+ /* Get file name */
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
+ if(file_name_len >= (ssize_t)sizeof(file_name_buf_static)) {
+ if(NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name")
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
+ } /* end if */
/* Determine encoding size */
- if(H5R__encode(H5F_ACTUAL_NAME(src_f), src_ref, NULL, &ret_value, flags) < 0)
+ if(H5R__encode(file_name_buf_dyn ? file_name_buf_dyn : file_name_buf_static, src_ref, NULL, &ret_value, flags) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, 0, "unable to determine encoding size")
} else {
/* Can do a direct copy and skip blob decoding */
@@ -328,6 +411,8 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf
}
done:
+ H5MM_xfree(file_name_buf_dyn);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__ref_mem_getsize() */
@@ -346,10 +431,12 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, void *dst_buf,
size_t dst_size)
{
- H5F_t *src_f;
- H5F_t *dst_f;
H5VL_object_t *vol_obj = NULL;
const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf;
+ hbool_t files_equal = FALSE;
+ char file_name_buf_static[256];
+ char *file_name_buf_dyn = NULL;
+ ssize_t file_name_len;
unsigned flags = 0;
herr_t ret_value = SUCCEED;
@@ -365,28 +452,46 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
if(NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier")
- /* We should assert here that the terminal connector is H5VL_NATIVE once
- * there is a facility to do so -NAF 2019/10/30 */
-
- /* Retrieve files from VOL objects */
- if(NULL == (src_f = (H5F_t *)H5VL_object_data(vol_obj)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
- if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
-
/* Set external flag if referenced file is not destination file */
- flags |= (src_f->shared != dst_f->shared) ? H5R_IS_EXTERNAL : 0;
+ if(H5VL_file_specific(vol_obj, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, dst_file, &files_equal) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "can't check if files are equal")
+ flags |= !files_equal ? H5R_IS_EXTERNAL : 0;
/* Pass the correct encoding version for the selection depending on the
* file libver bounds, this is later retrieved in H5S hyper encode */
- if(src_ref->type == (int8_t)H5R_DATASET_REGION2)
- H5CX_set_libver_bounds(dst_f);
+ if(src_ref->type == (int8_t)H5R_DATASET_REGION2) {
+ /* Temporary hack to check if this is the native connector. We need to
+ * add a way to check if the terminal connector is native. For now this
+ * will break passthroughs, but it's needed for other VOL connectors to
+ * work. -NAF */
+ if(dst_file->connector->cls->value == H5VL_NATIVE_VALUE) {
+ H5F_t *dst_f;
+
+ if(NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
+ H5CX_set_libver_bounds(dst_f);
+ } /* end if */
+ else
+ H5CX_set_libver_bounds(NULL);
+ } /* end if */
+
+ /* Get file name */
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
+ if(file_name_len >= (ssize_t)sizeof(file_name_buf_static)) {
+ if(NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name")
+ if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE, (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0)
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
+ } /* end if */
/* Encode reference */
- if(H5R__encode(H5F_ACTUAL_NAME(src_f), src_ref, (unsigned char *)dst_buf, &dst_size, flags) < 0)
+ if(H5R__encode(file_name_buf_dyn ? file_name_buf_dyn : file_name_buf_static, src_ref, (unsigned char *)dst_buf, &dst_size, flags) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "Cannot encode reference")
done:
+ H5MM_xfree(file_name_buf_dyn);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__ref_mem_read() */
@@ -468,7 +573,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size
/* If no filename set, this is not an external reference */
if(NULL == H5R_REF_FILENAME(dst_ref)) {
/* TODO temporary hack to retrieve file object */
- if((file_id = H5F__get_file_id(src_f, FALSE)) < 0)
+ if((file_id = H5F_get_file_id(src_file, H5I_FILE, FALSE)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Attach loc ID to reference and hold reference to it */
@@ -484,6 +589,96 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5T__ref_disk_isnull
+ *
+ * Purpose: Check if it's a NULL / uninitialized reference.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf,
+ hbool_t *isnull)
+{
+ const uint8_t *p = (const uint8_t *)src_buf;
+ H5R_type_t ref_type;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Check parameters */
+ HDassert(src_file);
+ HDassert(src_buf);
+ HDassert(isnull);
+
+ /* Try to check encoded reference type */
+ ref_type = (H5R_type_t)*p++;
+ if(ref_type) {
+ /* This is a valid reference */
+ *isnull = FALSE;
+ } else {
+ /* Skip the size / header */
+ p = (const uint8_t *)src_buf + H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T;
+
+ /* Check if blob ID is "nil" */
+ if(H5VL_blob_specific(src_file, (void *)p, H5VL_BLOB_ISNULL, isnull) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_disk_isnull() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T__ref_disk_setnull
+ *
+ * Purpose: Set a reference as NULL / uninitialized.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf)
+{
+ uint8_t *q = (uint8_t *)dst_buf;
+ uint8_t *p_bg = (uint8_t *)bg_buf;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(dst_file);
+ HDassert(dst_buf);
+
+ /* TODO Should get rid of bg stuff */
+ if(p_bg) {
+ /* Skip the size / header */
+ p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
+
+ /* Remove blob for old data */
+ if(H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
+ } /* end if */
+
+ /* Copy header manually so that it does not get encoded into the blob */
+ HDmemset(q, 0, H5R_ENCODE_HEADER_SIZE);
+ q += H5R_ENCODE_HEADER_SIZE;
+
+ /* Set the size */
+ UINT32ENCODE(q, 0);
+
+ /* Set blob ID to "nil" */
+ if(H5VL_blob_specific(dst_file, q, H5VL_BLOB_SETNULL) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_disk_setnull() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5T__ref_disk_getsize
*
* Purpose: Retrieves the length of a disk based reference.
@@ -562,7 +757,7 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size
q += H5R_ENCODE_HEADER_SIZE;
blob_size -= H5R_ENCODE_HEADER_SIZE;
- /* Skip the length of the sequence */
+ /* Skip the size */
p += H5_SIZEOF_UINT32_T;
HDassert(src_size > (H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T));
@@ -606,10 +801,10 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
if(p_bg) {
size_t p_buf_size_left = dst_size;
- /* Skip the length of the reference */
- p_bg += H5_SIZEOF_UINT32_T;
- HDassert(p_buf_size_left > H5_SIZEOF_UINT32_T);
- p_buf_size_left -= H5_SIZEOF_UINT32_T;
+ /* Skip the size / header */
+ p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
+ HDassert(p_buf_size_left > (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE));
+ p_buf_size_left -= (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
/* Remove blob for old data */
if(H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0)
@@ -638,6 +833,48 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5T__ref_obj_disk_isnull
+ *
+ * Purpose: Check if it's a NULL / uninitialized reference.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file,
+ const void *src_buf, hbool_t *isnull)
+{
+ H5F_t *src_f;
+ const uint8_t *p = (const uint8_t *)src_buf;
+ haddr_t addr;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Check parameters */
+ HDassert(src_file);
+ HDassert(src_buf);
+ HDassert(isnull);
+
+ /* We should assert here that the terminal connector is H5VL_NATIVE once
+ * there is a facility to do so -NAF 2019/10/30 */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
+ /* Get the object address */
+ H5F_addr_decode(src_f, &p, &addr);
+
+ /* Check if heap address is 'nil' */
+ *isnull = (addr == 0) ? TRUE : FALSE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_obj_disk_isnull() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5T__ref_obj_disk_getsize
*
* Purpose: Retrieves the length of a disk based reference.
@@ -718,6 +955,49 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5T__ref_dsetreg_disk_isnull
+ *
+ * Purpose: Check if it's a NULL / uninitialized reference.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf,
+ hbool_t *isnull)
+{
+ H5F_t *src_f;
+ const uint8_t *p = (const uint8_t *)src_buf;
+ haddr_t addr;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Check parameters */
+ HDassert(src_file);
+ HDassert(src_buf);
+ HDassert(isnull);
+
+ /* We should assert here that the terminal connector is H5VL_NATIVE once
+ * there is a facility to do so -NAF 2019/10/30 */
+
+ /* Retrieve file from VOL object */
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object")
+
+ /* Get the heap address */
+ H5F_addr_decode(src_f, &p, &addr);
+
+ /* Check if heap address is 'nil' */
+ *isnull = (addr == 0) ? TRUE : FALSE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__ref_dsetreg_disk_isnull() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5T__ref_dsetreg_disk_getsize
*
* Purpose: Retrieves the length of a disk based reference.
@@ -727,28 +1007,28 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *file,
- const void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size,
+H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file,
+ const void H5_ATTR_UNUSED *src_buf, size_t H5_ATTR_UNUSED src_size,
H5VL_object_t H5_ATTR_UNUSED *dst_file, hbool_t H5_ATTR_UNUSED *dst_copy)
{
size_t ret_value = sizeof(struct H5Tref_dsetreg);
FUNC_ENTER_STATIC
- HDassert(buf);
+ HDassert(src_buf);
#ifndef NDEBUG
{
- H5F_t *f;
+ H5F_t *src_f;
/* We should assert here that the terminal connector is H5VL_NATIVE once
* there is a facility to do so -NAF 2019/10/30 */
/* Retrieve file from VOL object */
- if(NULL == (f = (H5F_t *)H5VL_object_data(file)))
+ if(NULL == (src_f = (H5F_t *)H5VL_object_data(src_file)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object")
- HDassert(buf_size == H5T_REF_DSETREG_DISK_SIZE(f));
+ HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f));
} /* end block */
#endif /* NDEBUG */
@@ -827,3 +1107,4 @@ H5T_ref_reclaim(void *elem, const H5T_t *dt)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_ref_reclaim() */
+
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index 8d7368b..77df207 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -101,6 +101,8 @@ static void * H5VL__file_open(const H5VL_class_t *cls, const char *name,
unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type,
hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__file_specific_wrap_va_list(void *obj, const H5VL_class_t *cls,
+ H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...);
static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type,
hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id,
@@ -2989,6 +2991,43 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5VL__file_specific_wrap_va_list
+ *
+ * Purpose: Perform File specific operations through the VOL. Just
+ * starts a va_list and passes it to the connector's
+ * callback. Needed when the VOL layer needs to replace one
+ * of the variable arguments.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__file_specific_wrap_va_list(void *obj, const H5VL_class_t *cls,
+ H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...)
+{
+ va_list arguments; /* Argument list passed from the API call */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Start access to the varargs, so they are available in all situations below */
+ HDva_start(arguments, req);
+
+ /* Call the corresponding VOL callback */
+ if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
+
+done:
+ /* End access to the va_list */
+ HDva_end(arguments);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__file_specific_wrap_va_list() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5VL__file_specific
*
* Purpose: Perform File specific operations through the VOL
@@ -3010,9 +3049,38 @@ H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t spe
if(NULL == cls->file_cls.specific)
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method")
- /* Call the corresponding VOL callback */
- if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
+ /* Special handling for file is equal */
+ if(specific_type == H5VL_FILE_IS_EQUAL) {
+ va_list tmp_args; /* Argument list passed from the API call */
+ H5VL_object_t *vol_obj2; /* Second VOL object */
+ hbool_t *is_equal; /* Output variable */
+ int cmp_value; /* Comparison result */
+
+ /* Get parameters */
+ HDva_copy(tmp_args, arguments);
+ vol_obj2 = HDva_arg(tmp_args, H5VL_object_t *);
+ is_equal = HDva_arg(tmp_args, hbool_t *);
+ HDva_end(tmp_args);
+
+ HDassert(vol_obj2);
+
+ /* Compare connector classes */
+ if(H5VL_cmp_connector_cls(&cmp_value, cls, vol_obj2->connector->cls) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+
+ /* If the classes are different the files are different */
+ if(cmp_value)
+ *is_equal = FALSE;
+ else
+ /* Make callback (need to extract data from vol_obj2 and redo the
+ * va_list) */
+ if(H5VL__file_specific_wrap_va_list(obj, cls, specific_type, dxpl_id, req, vol_obj2->data, is_equal) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
+ } /* end if */
+ else
+ /* Call the corresponding VOL callback */
+ if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h
index 13cb2b5..f0925bf 100644
--- a/src/H5VLconnector.h
+++ b/src/H5VLconnector.h
@@ -122,7 +122,8 @@ typedef enum H5VL_file_specific_t {
H5VL_FILE_MOUNT, /* Mount a file */
H5VL_FILE_UNMOUNT, /* Unmount a file */
H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */
- H5VL_FILE_DELETE /* Delete a file */
+ H5VL_FILE_DELETE, /* Delete a file */
+ H5VL_FILE_IS_EQUAL /* Check if two files are the same */
} H5VL_file_specific_t;
/* types for group GET callback */
@@ -160,6 +161,7 @@ typedef enum H5VL_link_specific_t {
/* types for object GET callback */
typedef enum H5VL_object_get_t {
+ H5VL_OBJECT_GET_FILE, /* object file */
H5VL_OBJECT_GET_NAME, /* object name */
H5VL_OBJECT_GET_TYPE /* object type */
} H5VL_object_get_t;
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 733a2b5..284b266 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -1639,6 +1639,12 @@ H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_clas
HDassert(cls1);
HDassert(cls2);
+ /* If the pointers are the same the classes are the same */
+ if(cls1 == cls2) {
+ *cmp_value = 0;
+ HGOTO_DONE(SUCCEED);
+ } /* end if */
+
/* Compare connector "values" */
if(cls1->value < cls2->value) {
*cmp_value = -1;
diff --git a/src/H5VLnative.h b/src/H5VLnative.h
index 5b51e66..73cec8d 100644
--- a/src/H5VLnative.h
+++ b/src/H5VLnative.h
@@ -57,25 +57,24 @@ typedef int H5VL_native_file_optional_t;
#define H5VL_NATIVE_FILE_GET_MDC_SIZE 7 /* H5Fget_mdc_size */
#define H5VL_NATIVE_FILE_GET_SIZE 8 /* H5Fget_filesize */
#define H5VL_NATIVE_FILE_GET_VFD_HANDLE 9 /* H5Fget_vfd_handle */
-#define H5VL_NATIVE_FILE_GET_FILE_ID 10 /* H5Fget_file_id */
-#define H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE 11 /* H5Freset_mdc_hit_rate_stats */
-#define H5VL_NATIVE_FILE_SET_MDC_CONFIG 12 /* H5Fset_mdc_config */
-#define H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO 13 /* H5Fget_metadata_read_retry_info */
-#define H5VL_NATIVE_FILE_START_SWMR_WRITE 14 /* H5Fstart_swmr_write */
-#define H5VL_NATIVE_FILE_START_MDC_LOGGING 15 /* H5Fstart_mdc_logging */
-#define H5VL_NATIVE_FILE_STOP_MDC_LOGGING 16 /* H5Fstop_mdc_logging */
-#define H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS 17 /* H5Fget_mdc_logging_status */
-#define H5VL_NATIVE_FILE_FORMAT_CONVERT 18 /* H5Fformat_convert */
-#define H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS 19 /* H5Freset_page_buffering_stats */
-#define H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS 20 /* H5Fget_page_buffering_stats */
-#define H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO 21 /* H5Fget_mdc_image_info */
-#define H5VL_NATIVE_FILE_GET_EOA 22 /* H5Fget_eoa */
-#define H5VL_NATIVE_FILE_INCR_FILESIZE 23 /* H5Fincrement_filesize */
-#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 24 /* H5Fset_latest_format/libver_bounds */
-#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 25 /* H5Fget_dset_no_attrs_hint */
-#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 26 /* H5Fset_dset_no_attrs_hint */
-#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 27 /* H5Fget_mpi_atomicity */
-#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 28 /* H5Fset_mpi_atomicity */
+#define H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE 10 /* H5Freset_mdc_hit_rate_stats */
+#define H5VL_NATIVE_FILE_SET_MDC_CONFIG 11 /* H5Fset_mdc_config */
+#define H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO 12 /* H5Fget_metadata_read_retry_info */
+#define H5VL_NATIVE_FILE_START_SWMR_WRITE 13 /* H5Fstart_swmr_write */
+#define H5VL_NATIVE_FILE_START_MDC_LOGGING 14 /* H5Fstart_mdc_logging */
+#define H5VL_NATIVE_FILE_STOP_MDC_LOGGING 15 /* H5Fstop_mdc_logging */
+#define H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS 16 /* H5Fget_mdc_logging_status */
+#define H5VL_NATIVE_FILE_FORMAT_CONVERT 17 /* H5Fformat_convert */
+#define H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS 18 /* H5Freset_page_buffering_stats */
+#define H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS 19 /* H5Fget_page_buffering_stats */
+#define H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO 20 /* H5Fget_mdc_image_info */
+#define H5VL_NATIVE_FILE_GET_EOA 21 /* H5Fget_eoa */
+#define H5VL_NATIVE_FILE_INCR_FILESIZE 22 /* H5Fincrement_filesize */
+#define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 23 /* H5Fset_latest_format/libver_bounds */
+#define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 24 /* H5Fget_dset_no_attrs_hint */
+#define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 25 /* H5Fset_dset_no_attrs_hint */
+#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 26 /* H5Fget_mpi_atomicity */
+#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 27 /* H5Fset_mpi_atomicity */
/* Typedef and values for native VOL connector group optional VOL operations */
typedef int H5VL_native_group_optional_t;
diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c
index 094722e..588d59f 100644
--- a/src/H5VLnative_file.c
+++ b/src/H5VLnative_file.c
@@ -418,6 +418,19 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type,
break;
}
+ /* Check if two files are the same */
+ case H5VL_FILE_IS_EQUAL:
+ {
+ H5F_t *file2 = (H5F_t *)HDva_arg(arguments, void *);
+ hbool_t *is_equal = HDva_arg(arguments, hbool_t *);
+
+ if(!obj || !file2)
+ *is_equal = FALSE;
+ else
+ *is_equal = (((H5F_t *)obj)->shared == file2->shared);
+ break;
+ }
+
default:
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
} /* end switch */
@@ -578,20 +591,6 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR
break;
}
- /* H5Iget_file_id */
- case H5VL_NATIVE_FILE_GET_FILE_ID:
- {
- H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
- hbool_t app_ref = (hbool_t)HDva_arg(arguments, int);
- hid_t *file_id = HDva_arg(arguments, hid_t *);
-
- if(NULL == (f = H5F__get_file(obj, type)))
- HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file or file object")
- if((*file_id = H5F__get_file_id(f, app_ref)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file ID")
- break;
- }
-
/* H5Fclear_elink_file_cache */
case H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE:
{
diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c
index 675d8cf..dfa4eab 100644
--- a/src/H5VLnative_object.c
+++ b/src/H5VLnative_object.c
@@ -16,10 +16,11 @@
*/
#define H5O_FRIEND /* Suppress error about including H5Opkg */
+#define H5F_FRIEND /* Suppress error about including H5Fpkg */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
+#include "H5Fpkg.h" /* Files (pkg needed for id_exists) */
#include "H5Gprivate.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
#include "H5Opkg.h" /* Object headers */
@@ -150,6 +151,25 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
switch(get_type) {
+
+ /* Object file */
+ case H5VL_OBJECT_GET_FILE:
+ {
+ void **ret = HDva_arg(arguments, void **);
+
+ if(loc_params->type == H5VL_OBJECT_BY_SELF) {
+ *ret = (void *)loc.oloc->file;
+
+ /* TODO we currently need to set id_exists to TRUE because
+ * the upper layer will create an ID from the returned
+ * object. In theory this should not be needed and id_exists
+ * should be removed once the H5Fmount code gets fixed. */
+ loc.oloc->file->id_exists = TRUE;
+ } else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_file parameters")
+ break;
+ }
+
/* Object name */
case H5VL_OBJECT_GET_NAME:
{
diff --git a/src/H5trace.c b/src/H5trace.c
index 79dfbc8..65e267e 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -3000,6 +3000,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
H5VL_object_get_t get = (H5VL_object_get_t)HDva_arg(ap, int);
switch(get) {
+ case H5VL_OBJECT_GET_FILE:
+ HDfprintf(out, "H5VL_OBJECT_GET_FILE");
+ break;
case H5VL_OBJECT_GET_NAME:
HDfprintf(out, "H5VL_OBJECT_GET_NAME");
break;
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index 0c2be75..1591bed 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -39,7 +39,7 @@ Languages:
H5_CPPFLAGS: @H5_CPPFLAGS@
AM_CPPFLAGS: @AM_CPPFLAGS@
C Flags: @CFLAGS@
- H5 C Flags: @H5_CFLAGS@ @H5_ECFLAGS@
+ H5 C Flags: @H5_CFLAGS@
AM C Flags: @AM_CFLAGS@
Shared C Library: @enable_shared@
Static C Library: @enable_static@