Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop lying about H5S_t const-ness #1209

Merged
merged 1 commit into from
Nov 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 24 additions & 16 deletions src/H5Dchunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,13 @@ typedef struct H5D_chunk_iter_ud_t {
static herr_t H5D__chunk_construct(H5F_t *f, H5D_t *dset);
static herr_t H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id);
static herr_t H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
H5D_chunk_map_t *fm);
hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm);
static herr_t H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
H5D_chunk_map_t *fm);
static herr_t H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm);
static herr_t H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm);
H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm);
static herr_t H5D__chunk_flush(H5D_t *dset);
static herr_t H5D__chunk_io_term(const H5D_chunk_map_t *fm);
static herr_t H5D__chunk_dest(H5D_t *dset);
Expand Down Expand Up @@ -329,13 +328,24 @@ static int H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_uda
/*********************/

/* Chunked storage layout I/O ops */
const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {
{H5D__chunk_construct, H5D__chunk_init, H5D__chunk_is_space_alloc, H5D__chunk_is_data_cached,
H5D__chunk_io_init, H5D__chunk_read, H5D__chunk_write,
const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{
H5D__chunk_construct, /* construct */
H5D__chunk_init, /* init */
H5D__chunk_is_space_alloc, /* is_space_alloc */
H5D__chunk_is_data_cached, /* is_data_cached */
H5D__chunk_io_init, /* io_init */
H5D__chunk_read, /* ser_read */
H5D__chunk_write, /* ser_write */
#ifdef H5_HAVE_PARALLEL
H5D__chunk_collective_read, H5D__chunk_collective_write,
#endif /* H5_HAVE_PARALLEL */
NULL, NULL, H5D__chunk_flush, H5D__chunk_io_term, H5D__chunk_dest}};
H5D__chunk_collective_read, /* par_read */
H5D__chunk_collective_write, /* par_write */
#endif
NULL, /* readvv */
NULL, /* writevv */
H5D__chunk_flush, /* flush */
H5D__chunk_io_term, /* io_term */
H5D__chunk_dest /* dest */
}};

/*******************/
/* Local Variables */
Expand Down Expand Up @@ -1057,7 +1067,7 @@ H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset)
*/
static herr_t
H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm)
H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm)
{
const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */
hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */
Expand Down Expand Up @@ -1088,7 +1098,7 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
* speed up hyperslab calculations by removing the extra checks and/or
* additions involving the offset and the hyperslab selection -QAK)
*/
if ((file_space_normalized = H5S_hyper_normalize_offset((H5S_t *)file_space, old_offset)) < 0)
if ((file_space_normalized = H5S_hyper_normalize_offset(file_space, old_offset)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to normalize selection")

/* Decide the number of chunks in each dimension */
Expand Down Expand Up @@ -2464,8 +2474,7 @@ H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_
*/
static herr_t
H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t H5_ATTR_UNUSED nelmts,
const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space,
H5D_chunk_map_t *fm)
H5S_t H5_ATTR_UNUSED *file_space, H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm)
{
H5SL_node_t * chunk_node; /* Current node in chunk skip list */
H5D_io_info_t nonexistent_io_info; /* "nonexistent" I/O info object */
Expand Down Expand Up @@ -2615,8 +2624,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_
*/
static herr_t
H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t H5_ATTR_UNUSED nelmts,
const H5S_t H5_ATTR_UNUSED *file_space, const H5S_t H5_ATTR_UNUSED *mem_space,
H5D_chunk_map_t *fm)
H5S_t H5_ATTR_UNUSED *file_space, H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm)
{
H5SL_node_t * chunk_node; /* Current node in chunk skip list */
H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */
Expand Down
30 changes: 20 additions & 10 deletions src/H5Dcompact.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ typedef struct H5D_compact_iovv_memmanage_ud_t {
static herr_t H5D__compact_construct(H5F_t *f, H5D_t *dset);
static hbool_t H5D__compact_is_space_alloc(const H5O_storage_t *storage);
static herr_t H5D__compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
H5D_chunk_map_t *cm);
hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *cm);
static herr_t H5D__compact_iovv_memmanage_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata);
static ssize_t H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
Expand All @@ -81,13 +80,24 @@ static herr_t H5D__compact_dest(H5D_t *dset);
/*********************/

/* Compact storage layout I/O ops */
const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {
{H5D__compact_construct, NULL, H5D__compact_is_space_alloc, NULL, H5D__compact_io_init, H5D__contig_read,
H5D__contig_write,
const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{
H5D__compact_construct, /* construct */
NULL, /* init */
H5D__compact_is_space_alloc, /* is_space_alloc */
NULL, /* is_data_cached */
H5D__compact_io_init, /* io_init */
H5D__contig_read, /* ser_read */
H5D__contig_write, /* ser_write */
#ifdef H5_HAVE_PARALLEL
NULL, NULL,
#endif /* H5_HAVE_PARALLEL */
H5D__compact_readvv, H5D__compact_writevv, H5D__compact_flush, NULL, H5D__compact_dest}};
NULL, /* par_read */
NULL, /* par_write */
#endif
H5D__compact_readvv, /* readvv */
H5D__compact_writevv, /* writevv */
H5D__compact_flush, /* flush */
NULL, /* io_term */
H5D__compact_dest /* dest */
}};

/*******************/
/* Local Variables */
Expand Down Expand Up @@ -238,8 +248,8 @@ H5D__compact_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
*/
static herr_t
H5D__compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space,
const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space,
H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
{
FUNC_ENTER_STATIC_NOERR

Expand Down
38 changes: 24 additions & 14 deletions src/H5Dcontig.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ typedef struct H5D_contig_writevv_ud_t {
static herr_t H5D__contig_construct(H5F_t *f, H5D_t *dset);
static herr_t H5D__contig_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id);
static herr_t H5D__contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
H5D_chunk_map_t *cm);
hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *cm);
static ssize_t H5D__contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
Expand All @@ -109,13 +108,24 @@ static herr_t H5D__contig_write_one(H5D_io_info_t *io_info, hsize_t offset, size
/*********************/

/* Contiguous storage layout I/O ops */
const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {
{H5D__contig_construct, H5D__contig_init, H5D__contig_is_space_alloc, H5D__contig_is_data_cached,
H5D__contig_io_init, H5D__contig_read, H5D__contig_write,
const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{
H5D__contig_construct, /* construct */
H5D__contig_init, /* init */
H5D__contig_is_space_alloc, /* is_space_alloc */
H5D__contig_is_data_cached, /* is_data_cached */
H5D__contig_io_init, /* io_init */
H5D__contig_read, /* ser_read */
H5D__contig_write, /* ser_write */
#ifdef H5_HAVE_PARALLEL
H5D__contig_collective_read, H5D__contig_collective_write,
#endif /* H5_HAVE_PARALLEL */
H5D__contig_readvv, H5D__contig_writevv, H5D__contig_flush, NULL, NULL}};
H5D__contig_collective_read, /* par_read */
H5D__contig_collective_write, /* par_write */
#endif
H5D__contig_readvv, /* readvv */
H5D__contig_writevv, /* writevv */
H5D__contig_flush, /* flush */
NULL, /* io_term */
NULL /* dest */
}};

/*******************/
/* Local Variables */
Expand Down Expand Up @@ -550,8 +560,8 @@ H5D__contig_is_data_cached(const H5D_shared_t *shared_dset)
*/
static herr_t
H5D__contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space,
const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space,
H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
{
FUNC_ENTER_STATIC_NOERR

Expand All @@ -574,8 +584,8 @@ H5D__contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_
*-------------------------------------------------------------------------
*/
herr_t
H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, H5S_t *file_space,
H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
herr_t ret_value = SUCCEED; /*return value */

Expand Down Expand Up @@ -609,8 +619,8 @@ H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize
*-------------------------------------------------------------------------
*/
herr_t
H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, H5S_t *file_space,
H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm)
{
herr_t ret_value = SUCCEED; /*return value */

Expand Down
28 changes: 20 additions & 8 deletions src/H5Defl.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ typedef struct H5D_efl_writevv_ud_t {
/* Layout operation callbacks */
static herr_t H5D__efl_construct(H5F_t *f, H5D_t *dset);
static herr_t H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts,
const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm);
H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *cm);
static ssize_t H5D__efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq,
size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq,
size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
Expand All @@ -80,12 +80,24 @@ static herr_t H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t ad
/*********************/

/* External File List (EFL) storage layout I/O ops */
const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{H5D__efl_construct, NULL, H5D__efl_is_space_alloc, NULL,
H5D__efl_io_init, H5D__contig_read, H5D__contig_write,
const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{
H5D__efl_construct, /* construct */
NULL, /* init */
H5D__efl_is_space_alloc, /* is_space_alloc */
NULL, /* is_data_cached */
H5D__efl_io_init, /* io_init */
H5D__contig_read, /* ser_read */
H5D__contig_write, /* ser_write */
#ifdef H5_HAVE_PARALLEL
NULL, NULL,
#endif /* H5_HAVE_PARALLEL */
H5D__efl_readvv, H5D__efl_writevv, NULL, NULL, NULL}};
NULL, /* par_read */
NULL, /* par_write */
#endif
H5D__efl_readvv, /* readvv */
H5D__efl_writevv, /* writevv */
NULL, /* flush */
NULL, /* io_term */
NULL /* dest */
}};

/*******************/
/* Local Variables */
Expand Down Expand Up @@ -198,8 +210,8 @@ H5D__efl_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage)
*/
static herr_t
H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info,
hsize_t H5_ATTR_UNUSED nelmts, const H5S_t H5_ATTR_UNUSED *file_space,
const H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space,
H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm)
{
FUNC_ENTER_STATIC_NOERR

Expand Down
2 changes: 1 addition & 1 deletion src/H5Dfill.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ H5FL_EXTERN(H5S_sel_iter_t);
on each element so that each of them has a copy of the VL data.
--------------------------------------------------------------------------*/
herr_t
H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_type, const H5S_t *space)
H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_type, H5S_t *space)
{
H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
hbool_t mem_iter_init = FALSE; /* Whether the memory selection iterator has been initialized */
Expand Down
6 changes: 2 additions & 4 deletions src/H5Dio.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ H5FL_DEFINE(H5D_chunk_map_t);
*-------------------------------------------------------------------------
*/
herr_t
H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space,
void *buf /*out*/)
H5D__read(H5D_t *dataset, hid_t mem_type_id, H5S_t *mem_space, H5S_t *file_space, void *buf /*out*/)
{
H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */
H5D_io_info_t io_info; /* Dataset I/O info */
Expand Down Expand Up @@ -295,8 +294,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t
*-------------------------------------------------------------------------
*/
herr_t
H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space,
const void *buf)
H5D__write(H5D_t *dataset, hid_t mem_type_id, H5S_t *mem_space, H5S_t *file_space, const void *buf)
{
H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */
H5D_io_info_t io_info; /* Dataset I/O info */
Expand Down
Loading