summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5Dbtree.c6
-rw-r--r--src/H5Dchunk.c56
-rw-r--r--src/H5Dpkg.h11
-rw-r--r--src/H5I.c27
-rw-r--r--src/H5Iprivate.h2
-rw-r--r--src/H5Ipublic.h2
-rw-r--r--src/H5Olayout.c23
7 files changed, 74 insertions, 53 deletions
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index a22b0b1..523156f 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -136,7 +136,7 @@ static herr_t H5D_btree_debug_key(FILE *stream, H5F_t *f, hid_t dxpl_id,
/* Chunked layout indexing callbacks */
static herr_t H5D_btree_idx_init(const H5D_chk_idx_info_t *idx_info,
- haddr_t dset_ohdr_addr);
+ const H5S_t *space, haddr_t dset_ohdr_addr);
static herr_t H5D_btree_idx_create(const H5D_chk_idx_info_t *idx_info);
static hbool_t H5D_btree_idx_is_space_alloc(const H5O_layout_t *layout);
static herr_t H5D_btree_idx_insert(const H5D_chk_idx_info_t *idx_info,
@@ -171,6 +171,7 @@ const H5D_chunk_ops_t H5D_COPS_BTREE[1] = {{
H5D_btree_idx_is_space_alloc,
H5D_btree_idx_insert,
H5D_btree_idx_get_addr,
+ NULL,
H5D_btree_idx_iterate,
H5D_btree_idx_remove,
H5D_btree_idx_delete,
@@ -843,7 +844,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D_btree_idx_init(const H5D_chk_idx_info_t *idx_info, haddr_t UNUSED dset_ohdr_addr)
+H5D_btree_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t UNUSED *space,
+ haddr_t UNUSED dset_ohdr_addr)
{
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index fe05de2..9e6e540 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -143,7 +143,7 @@ typedef struct H5D_chunk_it_ud3_t {
hid_t tid_src; /* Datatype ID for source datatype */
hid_t tid_dst; /* Datatype ID for destination datatype */
hid_t tid_mem; /* Datatype ID for memory datatype */
- H5T_t *dt_src; /* Source datatype */
+ const H5T_t *dt_src; /* Source datatype */
H5T_path_t *tpath_src_mem; /* Datatype conversion path from source file to memory */
H5T_path_t *tpath_mem_dst; /* Datatype conversion path from memory to dest. file */
void *reclaim_buf; /* Buffer for reclaiming data */
@@ -152,7 +152,7 @@ typedef struct H5D_chunk_it_ud3_t {
H5S_t *buf_space; /* Dataspace describing buffer */
/* needed for compressed variable-length data */
- H5O_pline_t *pline; /* Filter pipeline */
+ const H5O_pline_t *pline; /* Filter pipeline */
/* needed for copy object pointed by refs */
H5O_copy_t *cpy_info; /* Copy options */
@@ -190,6 +190,8 @@ H5D_nonexistent_readvv(const H5D_io_info_t *io_info,
size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
/* Helper routines */
+static herr_t H5D_chunk_set_info_real(H5O_layout_t *layout, unsigned ndims,
+ const hsize_t *curr_dims);
static void *H5D_chunk_alloc(size_t size, const H5O_pline_t *pline);
static void *H5D_chunk_xfree(void *chk, const H5O_pline_t *pline);
static herr_t H5D_chunk_cinfo_cache_update(H5D_chunk_cached_t *last,
@@ -340,10 +342,14 @@ H5D_chunk_set_info(const H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions")
H5_ASSIGN_OVERFLOW(ndims, sndims, int, unsigned);
- /* Set the layout information */
+ /* Set the base layout information */
if(H5D_chunk_set_info_real(&dset->shared->layout, ndims, curr_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info")
+ /* Call the index's "resize" callback */
+ if(dset->shared->layout.u.chunk.ops->resize && (dset->shared->layout.u.chunk.ops->resize)(&dset->shared->layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to resize chunk index information")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_chunk_set_info() */
@@ -487,10 +493,6 @@ H5D_chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id)
H5D_chunk_cinfo_cache_reset(&(rdcc->last));
} /* end else */
- /* Set the number of chunks in dataset */
- if(H5D_chunk_set_info(dset) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set # of chunks for dataset")
-
/* Compose chunked index info struct */
idx_info.f = f;
idx_info.dxpl_id = dxpl_id;
@@ -498,9 +500,13 @@ H5D_chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id)
idx_info.layout = &dset->shared->layout;
/* Allocate any indexing structures */
- if(dset->shared->layout.u.chunk.ops->init && (dset->shared->layout.u.chunk.ops->init)(&idx_info, dset->oloc.addr) < 0)
+ if(dset->shared->layout.u.chunk.ops->init && (dset->shared->layout.u.chunk.ops->init)(&idx_info, dset->shared->space, dset->oloc.addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information")
+ /* Set the number of chunks in dataset */
+ if(H5D_chunk_set_info(dset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set # of chunks for dataset")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_chunk_init() */
@@ -4077,7 +4083,7 @@ H5D_chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
void *bkg = udata->bkg; /* Background buffer for datatype conversion */
void *buf = udata->buf; /* Chunk buffer for I/O & datatype conversions */
size_t buf_size = udata->buf_size; /* Size of chunk buffer */
- H5O_pline_t *pline = udata->pline; /* I/O pipeline for applying filters */
+ const H5O_pline_t *pline = udata->pline; /* I/O pipeline for applying filters */
/* needed for commpressed variable length data */
hbool_t has_filters = FALSE; /* Whether chunk has filters */
@@ -4239,14 +4245,15 @@ done:
*/
herr_t
H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst,
- H5O_layout_t *layout_dst, H5T_t *dt_src, H5O_copy_t *cpy_info,
- H5O_pline_t *pline_src, hid_t dxpl_id)
+ H5O_layout_t *layout_dst, const H5S_extent_t *ds_extent_src,
+ const H5T_t *dt_src, const H5O_pline_t *pline_src,
+ H5O_copy_t *cpy_info, hid_t dxpl_id)
{
H5D_chunk_it_ud3_t udata; /* User data for iteration callback */
H5D_chk_idx_info_t idx_info_dst; /* Dest. chunked index info */
H5D_chk_idx_info_t idx_info_src; /* Source chunked index info */
H5O_pline_t _pline; /* Temporary pipeline info */
- H5O_pline_t *pline; /* Pointer to pipeline info to use */
+ const H5O_pline_t *pline; /* Pointer to pipeline info to use */
H5T_path_t *tpath_src_mem = NULL, *tpath_mem_dst = NULL; /* Datatype conversion paths */
hid_t tid_src = -1; /* Datatype ID for source datatype */
hid_t tid_dst = -1; /* Datatype ID for destination datatype */
@@ -4270,6 +4277,7 @@ H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst,
HDassert(f_dst);
HDassert(layout_src && H5D_CHUNKED == layout_src->type);
HDassert(layout_dst && H5D_CHUNKED == layout_dst->type);
+ HDassert(ds_extent_src);
HDassert(dt_src);
/* Initialize the temporary pipeline info */
@@ -4280,6 +4288,30 @@ H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst,
else
pline = pline_src;
+ /* Layout is not created in the destination file, reset index address */
+ if(H5D_chunk_idx_reset(layout_dst, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest")
+
+ /* Initialize layout information */
+ {
+ hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /* Curr. size of dataset dimensions */
+ int sndims; /* Rank of dataspace */
+ unsigned ndims; /* Rank of dataspace */
+
+ /* Get the dim info for dataset */
+ if((sndims = H5S_extent_get_dims(ds_extent_src, curr_dims, NULL)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions")
+ H5_ASSIGN_OVERFLOW(ndims, sndims, int, unsigned);
+
+ /* Set the source layout chunk information */
+ if(H5D_chunk_set_info_real(layout_src, ndims, curr_dims) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info")
+
+ /* Set the dest. layout chunk info also */
+ if(H5D_chunk_set_info_real(layout_dst, ndims, curr_dims) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info")
+ } /* end block */
+
/* Compose source & dest chunked index info structs */
idx_info_src.f = f_src;
idx_info_src.dxpl_id = dxpl_id;
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 215b7ca..43b7e15 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -266,13 +266,14 @@ typedef int (*H5D_chunk_cb_func_t)(const H5D_chunk_rec_t *chunk_rec,
/* Typedefs for chunk operations */
typedef herr_t (*H5D_chunk_init_func_t)(const H5D_chk_idx_info_t *idx_info,
- haddr_t dset_ohdr_addr);
+ const H5S_t *space, haddr_t dset_ohdr_addr);
typedef herr_t (*H5D_chunk_create_func_t)(const H5D_chk_idx_info_t *idx_info);
typedef hbool_t (*H5D_chunk_is_space_alloc_func_t)(const H5O_layout_t *layout);
typedef herr_t (*H5D_chunk_insert_func_t)(const H5D_chk_idx_info_t *idx_info,
H5D_chunk_ud_t *udata);
typedef herr_t (*H5D_chunk_get_addr_func_t)(const H5D_chk_idx_info_t *idx_info,
H5D_chunk_ud_t *udata);
+typedef herr_t (*H5D_chunk_resize_func_t)(H5O_layout_t *layout);
typedef int (*H5D_chunk_iterate_func_t)(const H5D_chk_idx_info_t *idx_info,
H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
typedef herr_t (*H5D_chunk_remove_func_t)(const H5D_chk_idx_info_t *idx_info,
@@ -296,6 +297,7 @@ typedef struct H5D_chunk_ops_t {
H5D_chunk_is_space_alloc_func_t is_space_alloc; /* Query routine to determine if storage/index is allocated */
H5D_chunk_insert_func_t insert; /* Routine to insert a chunk into an index */
H5D_chunk_get_addr_func_t get_addr; /* Routine to retrieve address of chunk in file */
+ H5D_chunk_resize_func_t resize; /* Routine to update chunk index info after resizing dataset */
H5D_chunk_iterate_func_t iterate; /* Routine to iterate over chunks */
H5D_chunk_remove_func_t remove; /* Routine to remove a chunk from an index */
H5D_chunk_delete_func_t idx_delete; /* Routine to delete index & all chunks from file*/
@@ -576,8 +578,6 @@ H5_DLL htri_t H5D_chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr,
H5_DLL herr_t H5D_chunk_cinfo_cache_reset(H5D_chunk_cached_t *last);
H5_DLL herr_t H5D_chunk_create(H5D_t *dset /*in,out*/, hid_t dxpl_id);
H5_DLL herr_t H5D_chunk_set_info(const H5D_t *dset);
-H5_DLL herr_t H5D_chunk_set_info_real(H5O_layout_t *layout, unsigned ndims,
- const hsize_t *curr_dims);
H5_DLL herr_t H5D_chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset,
hid_t dapl_id);
H5_DLL hbool_t H5D_chunk_is_space_alloc(const H5O_layout_t *layout);
@@ -598,8 +598,9 @@ H5_DLL herr_t H5D_chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr
#endif /* H5_HAVE_PARALLEL */
H5_DLL herr_t H5D_chunk_update_cache(H5D_t *dset, hid_t dxpl_id);
H5_DLL herr_t H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src,
- H5F_t *f_dst, H5O_layout_t *layout_dst, H5T_t *src_dtype,
- H5O_copy_t *cpy_info, H5O_pline_t *pline, hid_t dxpl_id);
+ H5F_t *f_dst, H5O_layout_t *layout_dst, const H5S_extent_t *ds_extent_src,
+ const H5T_t *dt_src, const H5O_pline_t *pline_src,
+ H5O_copy_t *cpy_info, hid_t dxpl_id);
H5_DLL herr_t H5D_chunk_bh_info(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout,
const H5O_pline_t *pline, hsize_t *btree_size);
H5_DLL herr_t H5D_chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream);
diff --git a/src/H5I.c b/src/H5I.c
index 841b491..b116424 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -91,7 +91,7 @@ typedef struct H5I_id_info_t {
hid_t id; /* ID for this info */
unsigned count; /* ref. count for this atom */
unsigned app_count; /* ref. count of application visible atoms */
- void *obj_ptr; /* pointer associated with the atom */
+ const void *obj_ptr; /* pointer associated with the atom */
struct H5I_id_info_t *next; /* link to next atom (in case of hash-clash)*/
} H5I_id_info_t;
@@ -609,7 +609,8 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref)
} /* end if */
/* Check for a 'free' function and call it, if it exists */
- if(type_ptr->free_func && (type_ptr->free_func)(cur->obj_ptr) < 0) {
+ /* (Casting away const OK -QAK) */
+ if(type_ptr->free_func && (type_ptr->free_func)((void *)cur->obj_ptr) < 0) {
if(force) {
#ifdef H5I_DEBUG
if(H5DEBUG(I)) {
@@ -782,7 +783,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5Iregister(H5I_type_t type, void *object)
+H5Iregister(H5I_type_t type, const void *object)
{
hid_t ret_value; /* Return value */
@@ -826,7 +827,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5I_register(H5I_type_t type, void *object, hbool_t app_ref)
+H5I_register(H5I_type_t type, const void *object, hbool_t app_ref)
{
H5I_id_type_t *type_ptr; /*ptr to the type */
H5I_id_info_t *id_ptr; /*ptr to the new ID information */
@@ -949,7 +950,8 @@ H5I_object(hid_t id)
/* General lookup of the ID */
if(NULL != (id_ptr = H5I_find_id(id))) {
/* Get the object pointer to return */
- ret_value = id_ptr->obj_ptr;
+ /* (Casting away const OK -QAK) */
+ ret_value = (void *)id_ptr->obj_ptr;
} /* end if */
done:
@@ -1028,7 +1030,8 @@ H5I_object_verify(hid_t id, H5I_type_t id_type)
/* Verify that the type of the ID is correct & lookup the ID */
if(id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I_find_id(id))) {
/* Get the object pointer to return */
- ret_value = id_ptr->obj_ptr;
+ /* (Casting away const OK -QAK) */
+ ret_value = (void *)id_ptr->obj_ptr;
} /* end if */
done:
@@ -1244,7 +1247,8 @@ H5I_remove(hid_t id)
} else {
last_id->next = curr_id->next;
}
- ret_value = curr_id->obj_ptr;
+ /* (Casting away const OK -QAK) */
+ ret_value = (void *)curr_id->obj_ptr;
(void)H5FL_FREE(H5I_id_info_t, curr_id);
} else {
/* couldn't find the ID in the proper place */
@@ -1376,7 +1380,8 @@ H5I_dec_ref(hid_t id, hbool_t app_ref)
* Beware: the free method may call other H5I functions.
*/
if(1 == id_ptr->count) {
- if(!type_ptr->free_func || (type_ptr->free_func)(id_ptr->obj_ptr) >= 0) {
+ /* (Casting away const OK -QAK) */
+ if(!type_ptr->free_func || (type_ptr->free_func)((void *)id_ptr->obj_ptr) >= 0) {
H5I_remove(id);
ret_value = 0;
} else {
@@ -1982,8 +1987,10 @@ H5I_search(H5I_type_t type, H5I_search_func_t func, void *key, hbool_t app_ref)
id_ptr = type_ptr->id_list[i];
while(id_ptr) {
next_id = id_ptr->next; /* Protect against ID being deleted in callback */
- if((!app_ref || id_ptr->app_count) && (*func)(id_ptr->obj_ptr, id_ptr->id, key))
- HGOTO_DONE(id_ptr->obj_ptr); /*found the item*/
+ /* (Casting away const OK -QAK) */
+ if((!app_ref || id_ptr->app_count) && (*func)((void *)id_ptr->obj_ptr, id_ptr->id, key))
+ /* (Casting away const OK -QAK) */
+ HGOTO_DONE((void *)id_ptr->obj_ptr); /*found the item*/
id_ptr = next_id;
} /* end while */
} /* end for */
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index 0923af7..475871b 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -54,7 +54,7 @@ H5_DLL H5I_type_t H5I_register_type(H5I_type_t type_id, size_t hash_size, unsign
H5_DLL int H5I_nmembers(H5I_type_t type);
H5_DLL herr_t H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref);
H5_DLL int H5I_destroy_type(H5I_type_t type);
-H5_DLL hid_t H5I_register(H5I_type_t type, void *object, hbool_t app_ref);
+H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref);
H5_DLL void *H5I_object(hid_t id);
H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type);
H5_DLL H5I_type_t H5I_get_type(hid_t id);
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index 608bc9c..d630556 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -77,7 +77,7 @@ extern "C" {
/* Public API functions */
-H5_DLL hid_t H5Iregister(H5I_type_t type, void *object);
+H5_DLL hid_t H5Iregister(H5I_type_t type, const void *object);
H5_DLL void *H5Iobject_verify(hid_t id, H5I_type_t id_type);
H5_DLL void *H5Iremove_verify(hid_t id, H5I_type_t id_type);
H5_DLL H5I_type_t H5Iget_type(hid_t id);
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 3483c3e..aca3693 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -630,29 +630,8 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
case H5D_CHUNKED:
if(H5D_chunk_is_space_alloc(layout_src)) {
- hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /* Curr. size of dataset dimensions */
- int sndims; /* Rank of dataspace */
- unsigned ndims; /* Rank of dataspace */
-
- /* Layout is not created in the destination file, reset index address */
- if(H5D_chunk_idx_reset(layout_dst, TRUE) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to reset chunked storage index in dest")
-
- /* Get the dim info for dataset */
- if((sndims = H5S_extent_get_dims(udata->src_space_extent, curr_dims, NULL)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "can't get dataspace dimensions")
- H5_ASSIGN_OVERFLOW(ndims, sndims, int, unsigned);
-
- /* Set the source layout chunk information */
- if(H5D_chunk_set_info_real(layout_src, ndims, curr_dims) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, NULL, "can't set layout's chunk info")
-
- /* Set the dest. layout chunk info also */
- if(H5D_chunk_set_info_real(layout_dst, ndims, curr_dims) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, NULL, "can't set layout's chunk info")
-
/* Create chunked layout */
- if(H5D_chunk_copy(file_src, layout_src, file_dst, layout_dst, udata->src_dtype, cpy_info, udata->src_pline, dxpl_id) < 0)
+ if(H5D_chunk_copy(file_src, layout_src, file_dst, layout_dst, udata->src_space_extent, udata->src_dtype, udata->src_pline, cpy_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy chunked storage")
} /* if ( H5F_addr_defined(layout_srct->u.chunk.addr)) */
break;