diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-30 18:50:14 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-30 18:50:14 (GMT) |
commit | d96e6789c0be7046b1f191864efc02a2aeed645e (patch) | |
tree | fe0ce334a5c06be2d8fd448b1c5908637078d623 /src/H5Dchunk.c | |
parent | aaa84b4542fba4b3d8424bf494b311a8ab0dbd4c (diff) | |
download | hdf5-d96e6789c0be7046b1f191864efc02a2aeed645e.zip hdf5-d96e6789c0be7046b1f191864efc02a2aeed645e.tar.gz hdf5-d96e6789c0be7046b1f191864efc02a2aeed645e.tar.bz2 |
[svn-r17277] Description:
Bring r17275 and r17276 from trunk to 1.8 branch.
Tested on:
Mac OS X/32 10.5.7 (amazon) w/debug & production
(too minor to require h5committest)
Diffstat (limited to 'src/H5Dchunk.c')
-rw-r--r-- | src/H5Dchunk.c | 171 |
1 files changed, 104 insertions, 67 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 51c14e6..4b19e73 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -353,7 +353,7 @@ H5D_chunk_set_info(const H5D_t *dset) 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) + if(dset->shared->layout.storage.u.chunk.ops->resize && (dset->shared->layout.storage.u.chunk.ops->resize)(&dset->shared->layout.u.chunk) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to resize chunk index information") done: @@ -433,7 +433,7 @@ H5D_chunk_construct(H5F_t *f, H5D_t *dset) H5_ASSIGN_OVERFLOW(dset->shared->layout.u.chunk.size, chunk_size, uint64_t, uint32_t); /* Reset address and pointer of the array struct for the chunked storage index */ - if(H5D_chunk_idx_reset(&dset->shared->layout, TRUE) < 0) + if(H5D_chunk_idx_reset(&dset->shared->layout.storage.u.chunk, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index") done: @@ -503,10 +503,11 @@ H5D_chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id) idx_info.f = f; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Allocate any indexing structures */ - if(dset->shared->layout.u.chunk.ops->init && (dset->shared->layout.u.chunk.ops->init)(&idx_info, dset->shared->space, dset->oloc.addr) < 0) + if(dset->shared->layout.storage.u.chunk.ops->init && (dset->shared->layout.storage.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 */ @@ -541,7 +542,7 @@ H5D_chunk_is_space_alloc(const H5O_layout_t *layout) HDassert(layout); /* Query index layer */ - ret_value = (layout->u.chunk.ops->is_space_alloc)(layout); + ret_value = (layout->storage.u.chunk.ops->is_space_alloc)(&layout->storage.u.chunk); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_chunk_is_space_alloc() */ @@ -1883,13 +1884,14 @@ H5D_chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, idx_info.f = io_info->dset->oloc.file; idx_info.dxpl_id = io_info->dxpl_id; idx_info.pline = &(io_info->dset->shared->dcpl_cache.pline); - idx_info.layout = &(io_info->dset->shared->layout); + idx_info.layout = &(io_info->dset->shared->layout.u.chunk); + idx_info.storage = &(io_info->dset->shared->layout.storage.u.chunk); /* Set up the size of chunk for user data */ udata.nbytes = io_info->dset->shared->layout.u.chunk.size; /* Create the chunk */ - if((io_info->dset->shared->layout.u.chunk.ops->insert)(&idx_info, &udata) < 0) + if((io_info->dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk") /* Make sure the address of the chunk is returned. */ @@ -2047,18 +2049,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D_chunk_idx_reset(H5O_layout_t *layout, hbool_t reset_addr) +H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5D_chunk_idx_reset, FAIL) /* Sanity checks */ - HDassert(layout); - HDassert(layout->u.chunk.ops); + HDassert(storage); + HDassert(storage->ops); /* Reset index structures */ - if((layout->u.chunk.ops->reset)(layout, reset_addr) < 0) + if((storage->ops->reset)(storage, reset_addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset chunk index info") done: @@ -2115,11 +2117,12 @@ H5D_chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *uda /* Sanity check */ HDassert(last); HDassert(udata); - HDassert(udata->common.mesg); + HDassert(udata->common.layout); + HDassert(udata->common.storage); HDassert(udata->common.offset); /* Stored the information to cache */ - for(u = 0; u < udata->common.mesg->u.chunk.ndims; u++) + for(u = 0; u < udata->common.layout->ndims; u++) last->offset[u] = udata->common.offset[u]; last->nbytes = udata->nbytes; last->filter_mask = udata->filter_mask; @@ -2154,7 +2157,8 @@ H5D_chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *udat /* Sanity check */ HDassert(last); HDassert(udata); - HDassert(udata->common.mesg); + HDassert(udata->common.layout); + HDassert(udata->common.storage); HDassert(udata->common.offset); /* Check if the cached information is what is desired */ @@ -2162,7 +2166,7 @@ H5D_chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *udat unsigned u; /* Local index variable */ /* Check that the offset is the same */ - for(u = 0; u < udata->common.mesg->u.chunk.ndims; u++) + for(u = 0; u < udata->common.layout->ndims; u++) if(last->offset[u] != udata->common.offset[u]) HGOTO_DONE(FALSE) @@ -2220,10 +2224,11 @@ H5D_chunk_create(H5D_t *dset /*in,out*/, hid_t dxpl_id) idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Create the index for the chunks */ - if((dset->shared->layout.u.chunk.ops->create)(&idx_info) < 0) + if((dset->shared->layout.storage.u.chunk.ops->create)(&idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index") done: @@ -2259,7 +2264,8 @@ H5D_chunk_get_info(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset HDassert(udata); /* Initialize the query information about the chunk we are looking for */ - udata->common.mesg = &(dset->shared->layout); + udata->common.layout = &(dset->shared->layout.u.chunk); + udata->common.storage = &(dset->shared->layout.storage.u.chunk); udata->common.offset = chunk_offset; /* Reset information about the chunk we are looking for */ @@ -2275,10 +2281,11 @@ H5D_chunk_get_info(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Go get the chunk information */ - if((dset->shared->layout.u.chunk.ops->get_addr)(&idx_info, udata) < 0) + if((dset->shared->layout.storage.u.chunk.ops->get_addr)(&idx_info, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address") /* Cache the information retrieved */ @@ -2327,7 +2334,8 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * hbool_t must_insert = FALSE; /* Whether the chunk must go through the "insert" method */ /* Set up user data for index callbacks */ - udata.common.mesg = &dset->shared->layout; + udata.common.layout = &dset->shared->layout.u.chunk; + udata.common.storage = &dset->shared->layout.storage.u.chunk; udata.common.offset = ent->offset; udata.filter_mask = 0; udata.nbytes = dset->shared->layout.u.chunk.size; @@ -2388,12 +2396,13 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Create the chunk it if it doesn't exist, or reallocate the chunk * if its size changed. */ - if((dset->shared->layout.u.chunk.ops->insert)(&idx_info, &udata) < 0) + if((dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk") /* Update the chunk entry's address, in case it was allocated or relocated */ @@ -3045,10 +3054,11 @@ H5D_chunk_allocated(H5D_t *dset, hid_t dxpl_id, hsize_t *nbytes) idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Iterate over the chunks */ - if((dset->shared->layout.u.chunk.ops->iterate)(&idx_info, H5D_chunk_allocated_cb, &chunk_bytes) < 0) + if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D_chunk_allocated_cb, &chunk_bytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index") /* Set number of bytes for caller */ @@ -3077,7 +3087,7 @@ herr_t H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) { H5D_chk_idx_info_t idx_info; /* Chunked index info */ - const H5D_chunk_ops_t *ops = dset->shared->layout.u.chunk.ops; /* Chunk operations */ + const H5D_chunk_ops_t *ops = dset->shared->layout.storage.u.chunk.ops; /* Chunk operations */ hsize_t chunk_offset[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */ size_t orig_chunk_size; /* Original size of chunk in bytes */ unsigned filter_mask = 0; /* Filter mask for chunks that have them */ @@ -3196,7 +3206,8 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Reset the chunk offset indices */ HDmemset(chunk_offset, 0, (layout->u.chunk.ndims * sizeof(chunk_offset[0]))); @@ -3270,7 +3281,8 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) chunk_size = orig_chunk_size; /* Initialize the chunk information */ - udata.common.mesg = layout; + udata.common.layout = &layout->u.chunk; + udata.common.storage = &layout->storage.u.chunk; udata.common.offset = chunk_offset; H5_ASSIGN_OVERFLOW(udata.nbytes, chunk_size, size_t, uint32_t); udata.filter_mask = filter_mask; @@ -3371,7 +3383,7 @@ H5D_chunk_prune_fill(const H5D_chunk_rec_t *chunk_rec, H5D_chunk_it_ud1_t *udata const H5D_io_info_t *io_info = udata->io_info; /* Local pointer to I/O info */ H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset's layout */ - unsigned rank = udata->common.mesg->u.chunk.ndims - 1; /* Dataset rank */ + unsigned rank = udata->common.layout->ndims - 1; /* Dataset rank */ H5S_sel_iter_t chunk_iter; /* Memory selection iteration info */ hssize_t sel_nelmts; /* Number of elements in selection */ hsize_t count[H5O_LAYOUT_NDIMS]; /* Element count of hyperslab */ @@ -3416,7 +3428,8 @@ H5D_chunk_prune_fill(const H5D_chunk_rec_t *chunk_rec, H5D_chunk_it_ud1_t *udata /* Lock the chunk into the cache, to get a pointer to the chunk buffer */ /* (Casting away const OK -QAK) */ io_info->store->chunk.offset = (hsize_t *)chunk_rec->offset; - chk_udata.common.mesg = layout; + chk_udata.common.layout = &layout->u.chunk; + chk_udata.common.storage = &layout->storage.u.chunk; chk_udata.common.offset = chunk_rec->offset; chk_udata.nbytes = chunk_rec->nbytes; chk_udata.filter_mask = chunk_rec->filter_mask; @@ -3498,7 +3511,7 @@ H5D_chunk_prune_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_prune_cb) /* Figure out what chunks are no longer in use for the specified extent and release them */ - rank = udata->common.mesg->u.chunk.ndims - 1; + rank = udata->common.layout->ndims - 1; for(u = 0; u < rank; u++) /* The chunk record points to a chunk of storage that contains the * beginning of the logical address space represented by UDATA. @@ -3512,7 +3525,7 @@ H5D_chunk_prune_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) break; } /* end if */ /* Check for chunk that overlaps new extent and will need fill values */ - else if((chunk_rec->offset[u] + udata->common.mesg->u.chunk.dim[u]) > udata->dims[u]) + else if((chunk_rec->offset[u] + udata->common.layout->dim[u]) > udata->dims[u]) /* Indicate that the chunk needs filling */ /* (but continue in loop, since it could be outside the extent in * another dimension -QAK) @@ -3721,11 +3734,13 @@ H5D_chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dims) idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Initialize the user data for the iteration */ HDmemset(&udata, 0, sizeof udata); - udata.common.mesg = layout; + udata.common.layout = &layout->u.chunk; + udata.common.storage = &layout->storage.u.chunk; udata.io_info = &chk_io_info; udata.idx_info = &idx_info; udata.dims = curr_dims; @@ -3794,19 +3809,20 @@ H5D_chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dims) } /* end while */ /* Iterate over the chunks */ - if((dset->shared->layout.u.chunk.ops->iterate)(&idx_info, H5D_chunk_prune_cb, &udata) < 0) + if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D_chunk_prune_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve prune chunks from index") /* Traverse the stack of chunks to be deleted, removing each. We will free * the nodes later in the "done" section. */ - idx_udata.mesg = layout; + idx_udata.layout = &layout->u.chunk; + idx_udata.storage = &layout->storage.u.chunk; tmp_stack = udata.rm_stack; while(tmp_stack) { /* Update the offset in idx_udata */ idx_udata.offset = tmp_stack->rec.offset; /* Remove the chunk from disk */ - if((layout->u.chunk.ops->remove)(&idx_info, &idx_udata) < 0) + if((layout->storage.u.chunk.ops->remove)(&idx_info, &idx_udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, H5_ITER_ERROR, "unable to remove chunk entry from index") /* Advance the stack pointer */ @@ -3865,14 +3881,14 @@ static int H5D_chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) { H5D_chunk_it_ud2_t *udata = (H5D_chunk_it_ud2_t *)_udata; /* User data for callback */ - unsigned rank = udata->common.mesg->u.chunk.ndims - 1; /* # of dimensions of dataset */ + unsigned rank = udata->common.layout->ndims - 1; /* # of dimensions of dataset */ hsize_t chunk_index; int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_addrmap_cb) /* Compute the index for this chunk */ - if(H5V_chunk_index(rank, chunk_rec->offset, udata->common.mesg->u.chunk.dim, udata->common.mesg->u.chunk.down_chunks, &chunk_index) < 0) + if(H5V_chunk_index(rank, chunk_rec->offset, udata->common.layout->dim, udata->common.layout->down_chunks, &chunk_index) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, H5_ITER_ERROR, "can't get chunk index") /* Set it in the userdata to return */ @@ -3912,17 +3928,19 @@ H5D_chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]) /* Set up user data for B-tree callback */ HDmemset(&udata, 0, sizeof(udata)); - udata.common.mesg = &dset->shared->layout; + udata.common.layout = &dset->shared->layout.u.chunk; + udata.common.storage = &dset->shared->layout.storage.u.chunk; udata.chunk_addr = chunk_addr; /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; idx_info.dxpl_id = io_info->dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Iterate over chunks to build mapping of chunk addresses */ - if((dset->shared->layout.u.chunk.ops->iterate)(&idx_info, H5D_chunk_addrmap_cb, &udata) < 0) + if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D_chunk_addrmap_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to iterate over chunk index to build address map") done: @@ -3945,9 +3963,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_layout_t *layout) +H5D_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *storage) { H5D_chk_idx_info_t idx_info; /* Chunked index info */ + H5O_layout_t layout; /* Dataset layout message */ H5O_pline_t pline; /* I/O pipeline message */ htri_t exists; /* Flag if header message of interest exists */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3957,26 +3976,37 @@ H5D_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_layout_t *layout) /* Sanity check */ HDassert(f); HDassert(oh); - HDassert(layout); + HDassert(storage); /* Check for I/O pipeline message */ if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to check for object header message") else if(exists) { if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_PLINE_ID, &pline)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find I/O pipeline message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O pipeline message") } /* end else if */ else HDmemset(&pline, 0, sizeof(pline)); + /* Retrieve dataset layout message */ + if((exists = H5O_msg_exists_oh(oh, H5O_LAYOUT_ID)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to check for object header message") + else if(exists) { + if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_LAYOUT_ID, &layout)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout message") + } /* end else if */ + else + HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "can't find layout message") + /* Compose chunked index info struct */ idx_info.f = f; idx_info.dxpl_id = dxpl_id; idx_info.pline = &pline; - idx_info.layout = layout; + idx_info.layout = &layout.u.chunk; + idx_info.storage = &storage->u.chunk; /* Delete the chunked storage information in the file */ - if((layout->u.chunk.ops->idx_delete)(&idx_info) < 0) + if((storage->u.chunk.ops->idx_delete)(&idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk index") done: @@ -4209,7 +4239,8 @@ H5D_chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) } /* end if */ /* Set up destination chunk callback information for insertion */ - udata_dst.common.mesg = udata->idx_info_dst->layout; + udata_dst.common.layout = udata->idx_info_dst->layout; + udata_dst.common.storage = udata->idx_info_dst->storage; udata_dst.common.offset = chunk_rec->offset; udata_dst.nbytes = chunk_rec->nbytes; udata_dst.filter_mask = chunk_rec->filter_mask; @@ -4230,7 +4261,7 @@ H5D_chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) } /* end if */ /* Insert chunk into the destination index */ - if((udata->idx_info_dst->layout->u.chunk.ops->insert)(udata->idx_info_dst, &udata_dst) < 0) + if((udata->idx_info_dst->storage->ops->insert)(udata->idx_info_dst, &udata_dst) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk into index") /* Write chunk data to destination file */ @@ -4302,7 +4333,7 @@ H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, pline = pline_src; /* Layout is not created in the destination file, reset index address */ - if(H5D_chunk_idx_reset(layout_dst, TRUE) < 0) + if(H5D_chunk_idx_reset(&layout_dst->storage.u.chunk, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest") /* Initialize layout information */ @@ -4329,15 +4360,17 @@ H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, idx_info_src.f = f_src; idx_info_src.dxpl_id = dxpl_id; idx_info_src.pline = pline; - idx_info_src.layout = layout_src; + idx_info_src.layout = &layout_src->u.chunk; + idx_info_src.storage = &layout_src->storage.u.chunk; idx_info_dst.f = f_dst; idx_info_dst.dxpl_id = dxpl_id; idx_info_dst.pline = pline; /* Use same I/O filter pipeline for dest. */ - idx_info_dst.layout = layout_dst; + idx_info_dst.layout = &layout_dst->u.chunk; + idx_info_dst.storage = &layout_dst->storage.u.chunk; /* Call the index-specific "copy setup" routine */ - if((layout_src->u.chunk.ops->copy_setup)(&idx_info_src, &idx_info_dst) < 0) + if((layout_src->storage.u.chunk.ops->copy_setup)(&idx_info_src, &idx_info_dst) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up index-specific chunk copying information") copy_setup_done = TRUE; @@ -4441,7 +4474,8 @@ H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, /* Initialize the callback structure for the source */ HDmemset(&udata, 0, sizeof udata); - udata.common.mesg = layout_src; + udata.common.layout = &layout_src->u.chunk; + udata.common.storage = &layout_src->storage.u.chunk; udata.file_src = f_src; udata.idx_info_dst = &idx_info_dst; udata.buf = buf; @@ -4462,7 +4496,7 @@ H5D_chunk_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, udata.cpy_info = cpy_info; /* Iterate over chunks to copy data */ - if((layout_src->u.chunk.ops->iterate)(&idx_info_src, H5D_chunk_copy_cb, &udata) < 0) + if((layout_src->storage.u.chunk.ops->iterate)(&idx_info_src, H5D_chunk_copy_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to copy data") /* I/O buffers may have been re-allocated */ @@ -4490,7 +4524,7 @@ done: /* Clean up any index information */ if(copy_setup_done) - if((layout_src->u.chunk.ops->copy_shutdown)(layout_src, layout_dst, dxpl_id) < 0) + if((layout_src->storage.u.chunk.ops->copy_shutdown)(&layout_src->storage.u.chunk, &layout_dst->storage.u.chunk, dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to shut down index copying info") FUNC_LEAVE_NOAPI(ret_value) @@ -4529,10 +4563,11 @@ H5D_chunk_bh_info(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, idx_info.f = f; idx_info.dxpl_id = dxpl_id; idx_info.pline = pline; - idx_info.layout = layout; + idx_info.layout = &layout->u.chunk; + idx_info.storage = &layout->storage.u.chunk; /* Get size of index structure */ - if((layout->u.chunk.ops->size)(&idx_info, index_size) < 0) + if((layout->storage.u.chunk.ops->size)(&idx_info, index_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve chunk index info") done: @@ -4615,15 +4650,16 @@ H5D_chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream) H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_chunk_it_ud4_t udata; /* User data for callback */ + /* Display info for index */ + if((dset->shared->layout.storage.u.chunk.ops->dump)(&dset->shared->layout.storage.u.chunk, stream) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to dump chunk index info") + /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; - - /* Display info for index */ - if((dset->shared->layout.u.chunk.ops->dump)(&idx_info, stream) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to dump chunk index info") + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Set up user data for callback */ udata.stream = stream; @@ -4631,7 +4667,7 @@ H5D_chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream) udata.ndims = dset->shared->layout.u.chunk.ndims; /* Iterate over index and dump chunk info */ - if((dset->shared->layout.u.chunk.ops->iterate)(&idx_info, H5D_chunk_dump_index_cb, &udata) < 0) + if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D_chunk_dump_index_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to dump chunk info") } /* end if */ @@ -4691,10 +4727,11 @@ H5D_chunk_dest(H5F_t *f, hid_t dxpl_id, H5D_t *dset) idx_info.f = f; idx_info.dxpl_id = dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Free any index structures */ - if((dset->shared->layout.u.chunk.ops->dest)(&idx_info) < 0) + if((dset->shared->layout.storage.u.chunk.ops->dest)(&idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") done: |