summaryrefslogtreecommitdiffstats
path: root/src/H5Olayout.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-07-31 03:08:12 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-07-31 03:08:12 (GMT)
commit0eb775f3583f05b41fdab359d53bbc70c9a13db0 (patch)
tree0bb23f0ad2a9e5f6bf620b991d655bd380c979a7 /src/H5Olayout.c
parent361586a90e00fb4f13fcb85dff669f13ff872b94 (diff)
downloadhdf5-0eb775f3583f05b41fdab359d53bbc70c9a13db0.zip
hdf5-0eb775f3583f05b41fdab359d53bbc70c9a13db0.tar.gz
hdf5-0eb775f3583f05b41fdab359d53bbc70c9a13db0.tar.bz2
[svn-r17281] Description:
Further refactoring of the dataset layout information, to separate the storage information from the layout info. 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
Diffstat (limited to 'src/H5Olayout.c')
-rw-r--r--src/H5Olayout.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index b8a56f7..13e095e 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -375,7 +375,7 @@ H5O_layout_copy(const void *_mesg, void *_dest)
/* check args */
HDassert(mesg);
if(!dest && NULL == (dest = H5FL_MALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "memory allocation failed")
/* copy */
*dest = *mesg;
@@ -384,7 +384,7 @@ H5O_layout_copy(const void *_mesg, void *_dest)
if(mesg->type == H5D_COMPACT && mesg->storage.u.compact.size > 0) {
/* Allocate memory for the raw data */
if(NULL == (dest->storage.u.compact.buf = H5MM_malloc(dest->storage.u.compact.size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset")
+ HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset")
/* Copy over the raw data */
HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size);
@@ -588,23 +588,18 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
/* Allocate space for the destination layout */
if(NULL == (layout_dst = H5FL_MALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Copy the "top level" information */
- HDmemcpy(layout_dst, layout_src, sizeof(H5O_layout_t));
+ *layout_dst = *layout_src;
/* Copy the layout type specific information */
switch(layout_src->type) {
case H5D_COMPACT:
if(layout_src->storage.u.compact.buf) {
- if(NULL == (layout_dst->storage.u.compact.buf = H5MM_malloc(layout_src->storage.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->storage.u.compact.dirty = TRUE;
+ if(H5D_compact_copy(file_src, &layout_src->storage.u.compact, file_dst, &layout_dst->storage.u.compact, udata->src_dtype, cpy_info, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
} /* end if */
break;
@@ -617,18 +612,18 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
layout_dst->storage.u.contig.size = H5S_extent_nelem(udata->src_space_extent) *
H5T_get_size(udata->src_dtype);
- if(H5F_addr_defined(layout_src->storage.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(H5D_contig_is_space_alloc(&layout_src->storage)) {
+ /* copy contiguous raw data */
+ if(H5D_contig_copy(file_src, &layout_src->storage.u.contig, file_dst, &layout_dst->storage.u.contig, udata->src_dtype, cpy_info, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy contiguous storage")
} /* end if */
break;
case H5D_CHUNKED:
- if(H5D_chunk_is_space_alloc(layout_src)) {
+ if(H5D_chunk_is_space_alloc(&layout_src->storage)) {
/* 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(H5D_chunk_copy(file_src, &layout_src->storage.u.chunk, &layout_src->u.chunk, file_dst, &layout_dst->storage.u.chunk, &layout_dst->u.chunk, udata->src_space_extent, udata->src_dtype, udata->src_pline, cpy_info, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
} /* end if */
break;