diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-29 21:39:14 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-29 21:39:14 (GMT) |
commit | 913adc97563247edb3e41ccaf827aae30a885b23 (patch) | |
tree | f3b496d60139c37a6dcbdc69005635e73ae3a579 | |
parent | 7b93d00cd6446633d1d45705cf66d1353e241d1e (diff) | |
download | hdf5-913adc97563247edb3e41ccaf827aae30a885b23.zip hdf5-913adc97563247edb3e41ccaf827aae30a885b23.tar.gz hdf5-913adc97563247edb3e41ccaf827aae30a885b23.tar.bz2 |
[svn-r17261] Description:
Refactoring dataset layout information to segregate the constant items
from the variable items (at least from a storage standpoint).
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
-rw-r--r-- | src/H5Dbtree.c | 34 | ||||
-rw-r--r-- | src/H5Dcompact.c | 36 | ||||
-rw-r--r-- | src/H5Dcontig.c | 18 | ||||
-rw-r--r-- | src/H5Ddbg.c | 2 | ||||
-rw-r--r-- | src/H5Dint.c | 20 | ||||
-rw-r--r-- | src/H5Olayout.c | 94 | ||||
-rw-r--r-- | src/H5Oprivate.h | 41 | ||||
-rw-r--r-- | src/H5Pdcpl.c | 39 |
8 files changed, 157 insertions, 127 deletions
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 523156f..6d9038d 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -898,13 +898,13 @@ H5D_btree_idx_create(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(!H5F_addr_defined(idx_info->layout->u.chunk.u.btree.addr)); + HDassert(!H5F_addr_defined(idx_info->layout->store.u.chunk.u.btree.addr)); /* Initialize "user" data for B-tree callbacks, etc. */ udata.mesg = idx_info->layout; /* Create the v1 B-tree for the chunk index */ - if(H5B_create(idx_info->f, idx_info->dxpl_id, H5B_BTREE, &udata, &(idx_info->layout->u.chunk.u.btree.addr)/*out*/) < 0) + if(H5B_create(idx_info->f, idx_info->dxpl_id, H5B_BTREE, &udata, &(idx_info->layout->store.u.chunk.u.btree.addr)/*out*/) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree") done: @@ -935,7 +935,7 @@ H5D_btree_idx_is_space_alloc(const H5O_layout_t *layout) HDassert(layout); /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(layout->u.chunk.u.btree.addr); + ret_value = (hbool_t)H5F_addr_defined(layout->store.u.chunk.u.btree.addr); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_btree_idx_is_space_alloc() */ @@ -965,14 +965,14 @@ H5D_btree_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->u.chunk.u.btree.addr)); + HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.u.btree.addr)); HDassert(udata); /* * Create the chunk it if it doesn't exist, or reallocate the chunk if * its size changed. */ - if(H5B_insert(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.u.btree.addr, udata) < 0) + if(H5B_insert(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->store.u.chunk.u.btree.addr, udata) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk") done: @@ -1009,7 +1009,7 @@ H5D_btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata HDassert(udata); /* Go get the chunk information from the B-tree */ - if(H5B_find(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.u.btree.addr, udata) < 0) + if(H5B_find(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->store.u.chunk.u.btree.addr, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") done: @@ -1091,7 +1091,7 @@ H5D_btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->u.chunk.u.btree.addr)); + HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.u.btree.addr)); HDassert(chunk_cb); HDassert(chunk_udata); @@ -1102,7 +1102,7 @@ H5D_btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, udata.udata = chunk_udata; /* Iterate over existing chunks */ - if((ret_value = H5B_iterate(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.u.btree.addr, H5D_btree_idx_iterate_cb, &udata)) < 0) + if((ret_value = H5B_iterate(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->store.u.chunk.u.btree.addr, H5D_btree_idx_iterate_cb, &udata)) < 0) HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over chunk B-tree"); FUNC_LEAVE_NOAPI(ret_value) @@ -1132,13 +1132,13 @@ H5D_btree_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t * HDassert(idx_info->f); HDassert(idx_info->pline); HDassert(idx_info->layout); - HDassert(H5F_addr_defined(idx_info->layout->u.chunk.u.btree.addr)); + HDassert(H5F_addr_defined(idx_info->layout->store.u.chunk.u.btree.addr)); HDassert(udata); /* Remove the chunk from the v1 B-tree index and release the space for the * chunk (in the B-tree callback). */ - if(H5B_remove(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.u.btree.addr, udata) < 0) + if(H5B_remove(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->store.u.chunk.u.btree.addr, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to remove chunk entry") done: @@ -1174,7 +1174,7 @@ H5D_btree_idx_delete(const H5D_chk_idx_info_t *idx_info) HDassert(idx_info->layout); /* Check if the index data structure has been allocated */ - if(H5F_addr_defined(idx_info->layout->u.chunk.u.btree.addr)) { + if(H5F_addr_defined(idx_info->layout->store.u.chunk.u.btree.addr)) { H5O_layout_t tmp_layout; /* Local copy of layout info */ H5D_btree_ud0_t udata; /* User data for B-tree iterator call */ @@ -1188,7 +1188,7 @@ H5D_btree_idx_delete(const H5D_chk_idx_info_t *idx_info) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") /* Delete entire B-tree */ - if(H5B_delete(idx_info->f, idx_info->dxpl_id, H5B_BTREE, tmp_layout.u.chunk.u.btree.addr, &udata) < 0) + if(H5B_delete(idx_info->f, idx_info->dxpl_id, H5B_BTREE, tmp_layout.store.u.chunk.u.btree.addr, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk B-tree") /* Free the raw B-tree node buffer */ @@ -1231,7 +1231,7 @@ H5D_btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, HDassert(idx_info_dst->f); HDassert(idx_info_dst->pline); HDassert(idx_info_dst->layout); - HDassert(!H5F_addr_defined(idx_info_dst->layout->u.chunk.u.btree.addr)); + HDassert(!H5F_addr_defined(idx_info_dst->layout->store.u.chunk.u.btree.addr)); /* Create shared B-tree info for each file */ if(H5D_btree_shared_create(idx_info_src->f, idx_info_src->layout) < 0) @@ -1242,7 +1242,7 @@ H5D_btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, /* Create the root of the B-tree that describes chunked storage in the dest. file */ if(H5D_btree_idx_create(idx_info_dst) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") - HDassert(H5F_addr_defined(idx_info_dst->layout->u.chunk.u.btree.addr)); + HDassert(H5F_addr_defined(idx_info_dst->layout->store.u.chunk.u.btree.addr)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1323,7 +1323,7 @@ H5D_btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) udata.mesg = idx_info->layout; /* Get metadata information for B-tree */ - if(H5B_get_info(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->u.chunk.u.btree.addr, &bt_info, NULL, &udata) < 0) + if(H5B_get_info(idx_info->f, idx_info->dxpl_id, H5B_BTREE, idx_info->layout->store.u.chunk.u.btree.addr, &bt_info, NULL, &udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to iterate over chunk B-tree") /* Set the size of the B-tree */ @@ -1362,7 +1362,7 @@ H5D_btree_idx_reset(H5O_layout_t *layout, hbool_t reset_addr) /* Reset index info */ if(reset_addr) - layout->u.chunk.u.btree.addr = HADDR_UNDEF; + layout->store.u.chunk.u.btree.addr = HADDR_UNDEF; layout->u.chunk.u.btree.shared = NULL; FUNC_LEAVE_NOAPI(SUCCEED) @@ -1392,7 +1392,7 @@ H5D_btree_idx_dump(const H5D_chk_idx_info_t *idx_info, FILE *stream) HDassert(idx_info->layout); HDassert(stream); - HDfprintf(stream, " Address: %a\n", idx_info->layout->u.chunk.u.btree.addr); + HDfprintf(stream, " Address: %a\n", idx_info->layout->store.u.chunk.u.btree.addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_btree_idx_dump() */ diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index a1f5044..7639c2e 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -127,16 +127,16 @@ H5D_compact_fill(H5D_t *dset, hid_t dxpl_id) /* Check args */ HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); HDassert(dset && H5D_COMPACT == dset->shared->layout.type); - HDassert(dset->shared->layout.u.compact.buf); + HDassert(dset->shared->layout.store.u.compact.buf); HDassert(dset->shared->type); HDassert(dset->shared->space); /* Initialize the fill value buffer */ /* (use the compact dataset storage buffer as the fill value buffer) */ - if(H5D_fill_init(&fb_info, dset->shared->layout.u.compact.buf, FALSE, + if(H5D_fill_init(&fb_info, dset->shared->layout.store.u.compact.buf, FALSE, NULL, NULL, NULL, NULL, &dset->shared->dcpl_cache.fill, dset->shared->type, - dset->shared->type_id, (size_t)0, dset->shared->layout.u.compact.size, dxpl_id) < 0) + dset->shared->type_id, (size_t)0, dset->shared->layout.store.u.compact.size, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") fb_info_init = TRUE; @@ -186,13 +186,13 @@ H5D_compact_construct(H5F_t *f, H5D_t *dset) * layout. */ tmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space) * H5T_get_size(dset->shared->type); - H5_ASSIGN_OVERFLOW(dset->shared->layout.u.compact.size, tmp_size, hssize_t, size_t); + H5_ASSIGN_OVERFLOW(dset->shared->layout.store.u.compact.size, tmp_size, hssize_t, size_t); /* Verify data size is smaller than maximum header message size * (64KB) minus other layout message fields. */ comp_data_size = H5O_MESG_MAX_SIZE - H5O_layout_meta_size(f, &(dset->shared->layout)); - if(dset->shared->layout.u.compact.size > comp_data_size) + if(dset->shared->layout.store.u.compact.size > comp_data_size) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "compact dataset size is bigger than header message maximum size") done: @@ -244,8 +244,8 @@ H5D_compact_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t UNUSED * { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_compact_io_init) - io_info->store->compact.buf = io_info->dset->shared->layout.u.compact.buf; - io_info->store->compact.dirty = &io_info->dset->shared->layout.u.compact.dirty; + io_info->store->compact.buf = io_info->dset->shared->layout.store.u.compact.buf; + io_info->store->compact.dirty = &io_info->dset->shared->layout.store.u.compact.dirty; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_compact_io_init() */ @@ -356,10 +356,10 @@ H5D_compact_flush(H5D_t *dset, hid_t dxpl_id, unsigned UNUSED flags) HDassert(dset); /* Check if the buffered compact information is dirty */ - if(dset->shared->layout.u.compact.dirty) { + if(dset->shared->layout.store.u.compact.dirty) { if(H5O_msg_write(&(dset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dset->shared->layout), dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message") - dset->shared->layout.u.compact.dirty = FALSE; + dset->shared->layout.store.u.compact.dirty = FALSE; } /* end if */ done: @@ -449,7 +449,7 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, max_dt_size = MAX(max_dt_size, tmp_dt_size); /* Set number of whole elements that fit in buffer */ - if(0 == (nelmts = layout_src->u.compact.size / src_dt_size)) + if(0 == (nelmts = layout_src->store.u.compact.size / src_dt_size)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "element size too large") /* Set up number of bytes to copy, and initial buffer size */ @@ -476,7 +476,7 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, if(NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - HDmemcpy(buf, layout_src->u.compact.buf, layout_src->u.compact.size); + HDmemcpy(buf, layout_src->store.u.compact.buf, layout_src->store.u.compact.size); /* Convert from source file to memory */ if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, NULL, dxpl_id) < 0) @@ -492,7 +492,7 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") - HDmemcpy(layout_dst->u.compact.buf, buf, layout_dst->u.compact.size); + HDmemcpy(layout_dst->store.u.compact.buf, buf, layout_dst->store.u.compact.size); if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data") @@ -504,24 +504,24 @@ H5D_compact_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, size_t ref_count; /* Determine # of reference elements to copy */ - ref_count = layout_src->u.compact.size / H5T_get_size(dt_src); + ref_count = layout_src->store.u.compact.size / H5T_get_size(dt_src); /* Copy objects referenced in source buffer to destination file and set destination elements */ - if(H5O_copy_expand_ref(f_src, layout_src->u.compact.buf, dxpl_id, f_dst, - layout_dst->u.compact.buf, ref_count, H5T_get_ref_type(dt_src), cpy_info) < 0) + if(H5O_copy_expand_ref(f_src, layout_src->store.u.compact.buf, dxpl_id, f_dst, + layout_dst->store.u.compact.buf, ref_count, H5T_get_ref_type(dt_src), cpy_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute") } /* end if */ else /* Reset value to zero */ - HDmemset(layout_dst->u.compact.buf, 0, layout_src->u.compact.size); + HDmemset(layout_dst->store.u.compact.buf, 0, layout_src->store.u.compact.size); } /* end if */ else /* Type conversion not necessary */ - HDmemcpy(layout_dst->u.compact.buf, layout_src->u.compact.buf, layout_src->u.compact.size); + HDmemcpy(layout_dst->store.u.compact.buf, layout_src->store.u.compact.buf, layout_src->store.u.compact.size); } /* end if */ else /* Type conversion not necessary */ - HDmemcpy(layout_dst->u.compact.buf, layout_src->u.compact.buf, layout_src->u.compact.size); + HDmemcpy(layout_dst->store.u.compact.buf, layout_src->store.u.compact.buf, layout_src->store.u.compact.size); done: if(buf_sid > 0 && H5I_dec_ref(buf_sid, FALSE) < 0) diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 11ba22c..a2b1f59 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -132,7 +132,7 @@ H5D_contig_alloc(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ ) HDassert(layout); /* Allocate space for the contiguous data */ - if(HADDR_UNDEF == (layout->u.contig.addr = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, layout->u.contig.size))) + if(HADDR_UNDEF == (layout->store.u.contig.addr = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, layout->u.contig.size))) HGOTO_ERROR(H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space") done: @@ -179,7 +179,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) /* Check args */ HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); HDassert(dset && H5D_CONTIGUOUS == dset->shared->layout.type); - HDassert(H5F_addr_defined(dset->shared->layout.u.contig.addr)); + HDassert(H5F_addr_defined(dset->shared->layout.store.u.contig.addr)); HDassert(dset->shared->layout.u.contig.size > 0); HDassert(dset->shared->space); HDassert(dset->shared->type); @@ -214,7 +214,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") /* Initialize storage info for this dataset */ - store.contig.dset_addr = dset->shared->layout.u.contig.addr; + store.contig.dset_addr = dset->shared->layout.store.u.contig.addr; store.contig.dset_size = dset->shared->layout.u.contig.size; /* Get the number of elements in the dataset's dataspace */ @@ -328,7 +328,7 @@ H5D_contig_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) HDassert(layout); /* Free the file space for the chunk */ - if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, layout->u.contig.addr, layout->u.contig.size) < 0) + if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, layout->store.u.contig.addr, layout->u.contig.size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object header") done: @@ -357,7 +357,7 @@ H5D_contig_get_addr(const H5D_t *dset) HDassert(dset); HDassert(dset->shared->layout.type == H5D_CONTIGUOUS); - FUNC_LEAVE_NOAPI(dset->shared->layout.u.contig.addr) + FUNC_LEAVE_NOAPI(dset->shared->layout.store.u.contig.addr) } /* end H5D_contig_get_addr() */ @@ -456,7 +456,7 @@ H5D_contig_is_space_alloc(const H5O_layout_t *layout) HDassert(layout); /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(layout->u.contig.addr); + ret_value = (hbool_t)H5F_addr_defined(layout->store.u.contig.addr); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_contig_is_space_alloc() */ @@ -481,7 +481,7 @@ H5D_contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t UNUSED *t { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_contig_io_init) - io_info->store->contig.dset_addr = io_info->dset->shared->layout.u.contig.addr; + io_info->store->contig.dset_addr = io_info->dset->shared->layout.store.u.contig.addr; io_info->store->contig.dset_size = io_info->dset->shared->layout.u.contig.size; FUNC_LEAVE_NOAPI(SUCCEED) @@ -1365,8 +1365,8 @@ H5D_contig_copy(H5F_t *f_src, const H5O_layout_t *layout_src, H5F_t *f_dst, } /* end if */ /* Loop over copying data */ - addr_src = layout_src->u.contig.addr; - addr_dst = layout_dst->u.contig.addr; + addr_src = layout_src->store.u.contig.addr; + addr_dst = layout_dst->store.u.contig.addr; while(total_src_nbytes > 0) { /* Check if we should reduce the number of bytes to transfer */ if(total_src_nbytes < src_nbytes) { diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index 714c2e3..a7e7fa9 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -115,7 +115,7 @@ H5Ddebug(hid_t dset_id) if(H5D_CHUNKED == dset->shared->layout.type) (void)H5D_chunk_dump_index(dset, H5AC_dxpl_id, stdout); else if(H5D_CONTIGUOUS == dset->shared->layout.type) - HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.u.contig.addr); + HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.store.u.contig.addr); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Dint.c b/src/H5Dint.c index 93d0e1d..77050e4 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -784,7 +784,7 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) /* Add the dataset's raw data size to the size of the header, if the raw data will be stored as compact */ if(layout->type == H5D_COMPACT) - ohdr_size += layout->u.compact.size; + ohdr_size += layout->store.u.compact.size; /* Create an object header for the dataset */ if(H5O_create(file, dxpl_id, ohdr_size, dset->shared->dcpl_id, oloc/*out*/) < 0) @@ -1403,7 +1403,7 @@ H5D_close(H5D_t *dataset) case H5D_COMPACT: /* Free the buffer for the raw data for compact datasets */ - dataset->shared->layout.u.compact.buf = H5MM_xfree(dataset->shared->layout.u.compact.buf); + dataset->shared->layout.store.u.compact.buf = H5MM_xfree(dataset->shared->layout.store.u.compact.buf); break; default: @@ -1617,14 +1617,14 @@ H5D_alloc_storage(H5D_t *dset/*in,out*/, hid_t dxpl_id, H5D_time_alloc_t time_al case H5D_COMPACT: /* Check if space is already allocated */ - if(layout->u.compact.buf==NULL) { + if(NULL == layout->store.u.compact.buf) { /* Reserve space in layout header message for the entire array. */ - HDassert(layout->u.compact.size > 0); - if(NULL == (layout->u.compact.buf = H5MM_malloc(layout->u.compact.size))) + HDassert(layout->store.u.compact.size > 0); + if(NULL == (layout->store.u.compact.buf = H5MM_malloc(layout->store.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for compact dataset") if(!full_overwrite) - HDmemset(layout->u.compact.buf, 0, layout->u.compact.size); - layout->u.compact.dirty = TRUE; + HDmemset(layout->store.u.compact.buf, 0, layout->store.u.compact.size); + layout->store.u.compact.dirty = TRUE; /* Indicate that we should initialize storage space */ must_init_space = TRUE; @@ -1790,7 +1790,7 @@ H5D_get_storage_size(H5D_t *dset, hid_t dxpl_id) break; case H5D_COMPACT: - ret_value = dset->shared->layout.u.compact.size; + ret_value = dset->shared->layout.store.u.compact.size; break; default: @@ -1834,9 +1834,9 @@ H5D_get_offset(const H5D_t *dset) case H5D_CONTIGUOUS: /* If dataspace hasn't been allocated or dataset is stored in * an external file, the value will be HADDR_UNDEF. */ - if(dset->shared->dcpl_cache.efl.nused == 0 || H5F_addr_defined(dset->shared->layout.u.contig.addr)) + if(dset->shared->dcpl_cache.efl.nused == 0 || H5F_addr_defined(dset->shared->layout.store.u.contig.addr)) /* Return the absolute dataset offset from the beginning of file. */ - ret_value = dset->shared->layout.u.contig.addr + H5F_BASE_ADDR(dset->oloc.file); + ret_value = dset->shared->layout.store.u.contig.addr + H5F_BASE_ADDR(dset->oloc.file); break; default: diff --git a/src/H5Olayout.c b/src/H5Olayout.c index aca3693..9eb005d 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -131,13 +131,13 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, /* Address */ if(mesg->type == H5D_CONTIGUOUS) { - H5F_addr_decode(f, &p, &(mesg->u.contig.addr)); + H5F_addr_decode(f, &p, &(mesg->store.u.contig.addr)); /* Set the layout operations */ mesg->ops = H5D_LOPS_CONTIG; } /* end if */ else if(mesg->type == H5D_CHUNKED) { - H5F_addr_decode(f, &p, &(mesg->u.chunk.u.btree.addr)); + H5F_addr_decode(f, &p, &(mesg->store.u.chunk.u.btree.addr)); /* Set the layout operations */ mesg->ops = H5D_LOPS_CHUNK; @@ -176,12 +176,12 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, } /* end if */ if(mesg->type == H5D_COMPACT) { - UINT32DECODE(p, mesg->u.compact.size); - if(mesg->u.compact.size > 0) { - if(NULL == (mesg->u.compact.buf = H5MM_malloc(mesg->u.compact.size))) + UINT32DECODE(p, mesg->store.u.compact.size); + if(mesg->store.u.compact.size > 0) { + if(NULL == (mesg->store.u.compact.buf = H5MM_malloc(mesg->store.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer") - HDmemcpy(mesg->u.compact.buf, p, mesg->u.compact.size); - p += mesg->u.compact.size; + HDmemcpy(mesg->store.u.compact.buf, p, mesg->store.u.compact.size); + p += mesg->store.u.compact.size; } /* end if */ } /* end if */ } /* end if */ @@ -192,12 +192,12 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, /* Interpret the rest of the message according to the layout class */ switch(mesg->type) { case H5D_COMPACT: - UINT16DECODE(p, mesg->u.compact.size); - if(mesg->u.compact.size > 0) { - if(NULL == (mesg->u.compact.buf = H5MM_malloc(mesg->u.compact.size))) + UINT16DECODE(p, mesg->store.u.compact.size); + if(mesg->store.u.compact.size > 0) { + if(NULL == (mesg->store.u.compact.buf = H5MM_malloc(mesg->store.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer") - HDmemcpy(mesg->u.compact.buf, p, mesg->u.compact.size); - p += mesg->u.compact.size; + HDmemcpy(mesg->store.u.compact.buf, p, mesg->store.u.compact.size); + p += mesg->store.u.compact.size; } /* end if */ /* Set the layout operations */ @@ -205,7 +205,7 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, break; case H5D_CONTIGUOUS: - H5F_addr_decode(f, &p, &(mesg->u.contig.addr)); + H5F_addr_decode(f, &p, &(mesg->store.u.contig.addr)); H5F_DECODE_LENGTH(f, p, mesg->u.contig.size); /* Set the layout operations */ @@ -219,7 +219,7 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large") /* B-tree address */ - H5F_addr_decode(f, &p, &(mesg->u.chunk.u.btree.addr)); + H5F_addr_decode(f, &p, &(mesg->store.u.chunk.u.btree.addr)); /* Chunk dimensions */ for(u = 0; u < mesg->u.chunk.ndims; u++) @@ -309,20 +309,20 @@ H5O_layout_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi switch(mesg->type) { case H5D_COMPACT: /* Size of raw data */ - UINT16ENCODE(p, mesg->u.compact.size); + UINT16ENCODE(p, mesg->store.u.compact.size); /* Raw data */ - if(mesg->u.compact.size > 0) { - if(mesg->u.compact.buf) - HDmemcpy(p, mesg->u.compact.buf, mesg->u.compact.size); + if(mesg->store.u.compact.size > 0) { + if(mesg->store.u.compact.buf) + HDmemcpy(p, mesg->store.u.compact.buf, mesg->store.u.compact.size); else - HDmemset(p, 0, mesg->u.compact.size); - p += mesg->u.compact.size; + HDmemset(p, 0, mesg->store.u.compact.size); + p += mesg->store.u.compact.size; } /* end if */ break; case H5D_CONTIGUOUS: - H5F_addr_encode(f, &p, mesg->u.contig.addr); + H5F_addr_encode(f, &p, mesg->store.u.contig.addr); H5F_ENCODE_LENGTH(f, p, mesg->u.contig.size); break; @@ -332,7 +332,7 @@ H5O_layout_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi *p++ = (uint8_t)mesg->u.chunk.ndims; /* B-tree address */ - H5F_addr_encode(f, &p, mesg->u.chunk.u.btree.addr); + H5F_addr_encode(f, &p, mesg->store.u.chunk.u.btree.addr); /* Dimension sizes */ for(u = 0; u < mesg->u.chunk.ndims; u++) @@ -381,13 +381,13 @@ H5O_layout_copy(const void *_mesg, void *_dest) *dest = *mesg; /* Deep copy the buffer for compact datasets also */ - if(mesg->type == H5D_COMPACT && mesg->u.compact.size > 0) { + if(mesg->type == H5D_COMPACT && mesg->store.u.compact.size > 0) { /* Allocate memory for the raw data */ - if(NULL == (dest->u.compact.buf = H5MM_malloc(dest->u.compact.size))) + if(NULL == (dest->store.u.compact.buf = H5MM_malloc(dest->store.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset") /* Copy over the raw data */ - HDmemcpy(dest->u.compact.buf, mesg->u.compact.buf, dest->u.compact.size); + HDmemcpy(dest->store.u.compact.buf, mesg->store.u.compact.buf, dest->store.u.compact.size); } /* end if */ /* Reset the pointer of the chunked storage index but not the address */ @@ -431,8 +431,8 @@ H5O_layout_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg HDassert(mesg); ret_value = H5O_layout_meta_size(f, mesg); - if(mesg->type == H5D_COMPACT) - ret_value += mesg->u.compact.size;/* data for compact dataset */ + if(H5D_COMPACT == mesg->type) + ret_value += mesg->store.u.compact.size;/* data for compact dataset */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_layout_size() */ @@ -449,28 +449,26 @@ H5O_layout_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg * Programmer: Quincey Koziol * Friday, September 13, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5O_layout_reset (void *_mesg) +H5O_layout_reset(void *_mesg) { - H5O_layout_t *mesg = (H5O_layout_t *) _mesg; + H5O_layout_t *mesg = (H5O_layout_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_layout_reset); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_layout_reset) if(mesg) { /* Free the compact storage buffer */ - if(mesg->type==H5D_COMPACT) - mesg->u.compact.buf=H5MM_xfree(mesg->u.compact.buf); + if(H5D_COMPACT == mesg->type) + mesg->store.u.compact.buf = H5MM_xfree(mesg->store.u.compact.buf); /* Reset the message */ - mesg->type=H5D_CONTIGUOUS; + mesg->type = H5D_CONTIGUOUS; } /* end if */ - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5O_layout_reset() */ /*------------------------------------------------------------------------- @@ -497,8 +495,8 @@ H5O_layout_free(void *_mesg) HDassert(mesg); /* Free the compact storage buffer */ - if(mesg->type == H5D_COMPACT) - mesg->u.compact.buf = H5MM_xfree(mesg->u.compact.buf); + if(H5D_COMPACT == mesg->type) + mesg->store.u.compact.buf = H5MM_xfree(mesg->store.u.compact.buf); (void)H5FL_FREE(H5O_layout_t, mesg); @@ -600,15 +598,15 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, /* Copy the layout type specific information */ switch(layout_src->type) { case H5D_COMPACT: - if(layout_src->u.compact.buf) { - if(NULL == (layout_dst->u.compact.buf = H5MM_malloc(layout_src->u.compact.size))) + if(layout_src->store.u.compact.buf) { + if(NULL == (layout_dst->store.u.compact.buf = H5MM_malloc(layout_src->store.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset") /* copy compact raw data */ if(H5D_compact_copy(file_src, layout_src, file_dst, layout_dst, udata->src_dtype, cpy_info, dxpl_id) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to copy chunked storage") - layout_dst->u.compact.dirty = TRUE; + layout_dst->store.u.compact.dirty = TRUE; } /* end if */ break; @@ -621,11 +619,11 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, layout_dst->u.contig.size = H5S_extent_nelem(udata->src_space_extent) * H5T_get_size(udata->src_dtype); - if(H5F_addr_defined(layout_src->u.contig.addr)) { + if(H5F_addr_defined(layout_src->store.u.contig.addr)) { /* create contig layout */ if(H5D_contig_copy(file_src, layout_src, file_dst, layout_dst, udata->src_dtype, cpy_info, dxpl_id) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to copy contiguous storage") - } /* if ( H5F_addr_defined(layout_src->u.contig.addr)) */ + } /* end if */ break; case H5D_CHUNKED: @@ -633,7 +631,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, /* Create chunked layout */ 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)) */ + } /* end if */ break; default: @@ -707,7 +705,7 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "v1 B-tree"); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "B-tree address:", mesg->u.chunk.u.btree.addr); + "B-tree address:", mesg->store.u.chunk.u.btree.addr); break; default: @@ -721,7 +719,7 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Contiguous"); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Data address:", mesg->u.contig.addr); + "Data address:", mesg->store.u.contig.addr); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Data Size:", mesg->u.contig.size); break; @@ -730,7 +728,7 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Compact"); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Data Size:", mesg->u.compact.size); + "Data Size:", mesg->store.u.compact.size); break; default: diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 0835e6f..acd8036 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -321,6 +321,7 @@ typedef struct H5O_efl_t { H5O_efl_entry_t *slot; /*array of external file entries */ } H5O_efl_t; + /* * Data Layout Message. * (Data structure in file) @@ -352,13 +353,41 @@ typedef struct H5O_efl_t { struct H5D_layout_ops_t; /* Defined in H5Dpkg.h */ struct H5D_chunk_ops_t; /* Defined in H5Dpkg.h */ -typedef struct H5O_layout_contig_t { +typedef struct H5O_storage_contig_t { haddr_t addr; /* File address of data */ +} H5O_storage_contig_t; + +typedef struct H5O_storage_chunk_btree_t { + haddr_t addr; /* File address of B-tree */ +} H5O_storage_chunk_btree_t; + +typedef struct H5O_storage_chunk_t { + H5D_chunk_index_t idx_type; /* Type of chunk index */ + union { + H5O_storage_chunk_btree_t btree; /* Information for v1 B-tree index */ + } u; +} H5O_storage_chunk_t; + +typedef struct H5O_storage_compact_t { + hbool_t dirty; /* Dirty flag for compact dataset */ + size_t size; /* Size of buffer in bytes */ + void *buf; /* Buffer for compact dataset */ +} H5O_storage_compact_t; + +typedef struct H5O_storage_t { + H5D_layout_t type; /* Type of layout */ + union { + H5O_storage_contig_t contig; /* Information for contiguous storage */ + H5O_storage_chunk_t chunk; /* Information for chunked storage */ + H5O_storage_compact_t compact; /* Information for compact storage */ + } u; +} H5O_storage_t; + +typedef struct H5O_layout_contig_t { hsize_t size; /* Size of data in bytes */ } H5O_layout_contig_t; typedef struct H5O_layout_chunk_btree_t { - haddr_t addr; /* File address of B-tree */ H5RC_t *shared; /* Ref-counted shared info for B-tree nodes */ } H5O_layout_chunk_btree_t; @@ -376,12 +405,6 @@ typedef struct H5O_layout_chunk_t { } u; } H5O_layout_chunk_t; -typedef struct H5O_layout_compact_t { - hbool_t dirty; /* Dirty flag for compact dataset */ - size_t size; /* Size of buffer in bytes */ - void *buf; /* Buffer for compact dataset */ -} H5O_layout_compact_t; - typedef struct H5O_layout_t { H5D_layout_t type; /* Type of layout */ unsigned version; /* Version of message */ @@ -389,8 +412,8 @@ typedef struct H5O_layout_t { union { H5O_layout_contig_t contig; /* Information for contiguous layout */ H5O_layout_chunk_t chunk; /* Information for chunked layout */ - H5O_layout_compact_t compact; /* Information for compact layout */ } u; + H5O_storage_t store; /* Information for storing dataset elements */ } H5O_layout_t; /* Enable reading/writing "bogus" messages */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 7ed1b96..0762fbf 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -48,22 +48,27 @@ /****************/ /* Define default layout information */ -#define H5D_DEF_LAYOUT_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL} -#define H5D_DEF_LAYOUT_CONTIG_INIT {HADDR_UNDEF, (hsize_t)0} -#define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_BTREE, (unsigned)1, {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, (uint32_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL, {{HADDR_UNDEF, NULL}}} +#define H5D_DEF_STORAGE_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL} +#define H5D_DEF_STORAGE_CONTIG_INIT {HADDR_UNDEF} +#define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_BTREE, {{HADDR_UNDEF}}} +#define H5D_DEF_LAYOUT_CONTIG_INIT {(hsize_t)0} +#define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_BTREE, (unsigned)1, {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, (uint32_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, NULL, {{NULL}}} #ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER -#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, { .compact = H5D_DEF_LAYOUT_COMPACT_INIT }} -#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, { .contig = H5D_DEF_LAYOUT_CONTIG_INIT }} -#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, NULL, { .chunk = H5D_DEF_LAYOUT_CHUNK_INIT }} +#define H5D_DEF_STORAGE_COMPACT {H5D_COMPACT, { .compact = H5D_DEF_STORAGE_COMPACT_INIT }} +#define H5D_DEF_STORAGE_CONTIG {H5D_CONTIGUOUS, { .contig = H5D_DEF_STORAGE_CONTIG_INIT }} +#define H5D_DEF_STORAGE_CHUNK {H5D_CHUNKED, { .chunk = H5D_DEF_STORAGE_CHUNK_INIT }} +#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, { .contig = H5D_DEF_LAYOUT_CONTIG_INIT }, H5D_DEF_STORAGE_COMPACT} +#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, { .contig = H5D_DEF_LAYOUT_CONTIG_INIT }, H5D_DEF_STORAGE_CONTIG} +#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, NULL, { .chunk = H5D_DEF_LAYOUT_CHUNK_INIT }, H5D_DEF_STORAGE_CHUNK} #else /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ /* Note that the compact & chunked layout initialization values are using the * contiguous layout initialization in the union, because the contiguous * layout is first in the union. These values are overridden in the * H5P_init_def_layout() routine. -QAK */ -#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CONTIG_INIT}} -#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CONTIG_INIT}} -#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CONTIG_INIT}} +#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CONTIG_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG}} +#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CONTIG_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG}} +#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CONTIG_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG}} #endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ /* ======== Dataset creation properties ======== */ @@ -264,12 +269,12 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) dst_layout.ops = NULL; switch(dst_layout.type) { case H5D_COMPACT: - dst_layout.u.compact.buf = H5MM_xfree(dst_layout.u.compact.buf); - HDmemset(&dst_layout.u.compact, 0, sizeof(dst_layout.u.compact)); + dst_layout.store.u.compact.buf = H5MM_xfree(dst_layout.store.u.compact.buf); + HDmemset(&dst_layout.store.u.compact, 0, sizeof(dst_layout.store.u.compact)); break; case H5D_CONTIGUOUS: - dst_layout.u.contig.addr = HADDR_UNDEF; + dst_layout.store.u.contig.addr = HADDR_UNDEF; dst_layout.u.contig.size = 0; break; @@ -762,14 +767,18 @@ done: static herr_t H5P_init_def_layout(void) { - const H5O_layout_compact_t def_compact = H5D_DEF_LAYOUT_COMPACT_INIT; - const H5O_layout_chunk_t def_chunk = H5D_DEF_LAYOUT_CHUNK_INIT; + const H5O_layout_compact_t def_layout_compact = H5D_DEF_LAYOUT_COMPACT_INIT; + const H5O_layout_chunk_t def_layout_chunk = H5D_DEF_LAYOUT_CHUNK_INIT; + const H5O_storage_compact_t def_store_compact = H5D_DEF_STORAGE_COMPACT_INIT; + const H5O_storage_chunk_t def_store_chunk = H5D_DEF_STORAGE_CHUNK_INIT; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_init_def_layout) /* Initialize the default layout info for non-contigous layouts */ - H5D_def_layout_compact_g.u.compact = def_compact; + H5D_def_layout_compact_g.u.compact = def_layout_compact; + H5D_def_layout_compact_g.store.u.compact = def_store_compact; H5D_def_layout_chunk_g.u.chunk = def_chunk; + H5D_def_layout_compact_g.store.u.chunk = def_store_chunk; /* Note that we've initialized the default values */ H5P_dcrt_def_layout_init_g = TRUE; |