summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-10-16 01:19:09 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-10-16 01:19:09 (GMT)
commit31683703d9bf394cef27805c50fc89efa29361b9 (patch)
treef6a1b03413e666625207930cd2b687f5b997ef8a
parent23a31f45b2d0c3885fd09966a3adb0a43e292445 (diff)
downloadhdf5-31683703d9bf394cef27805c50fc89efa29361b9.zip
hdf5-31683703d9bf394cef27805c50fc89efa29361b9.tar.gz
hdf5-31683703d9bf394cef27805c50fc89efa29361b9.tar.bz2
[svn-r28092] Description:
Merge the storage message back into the layout message. Tested on: MacOSX/64 10.10.5 (amazon) w/serial & parallel (h5committest not required on this branch)
-rw-r--r--MANIFEST1
-rw-r--r--hl/test/test_ld.h5bin42955 -> 42931 bytes
-rw-r--r--src/H5Dcompact.c20
-rw-r--r--src/H5Dcontig.c5
-rw-r--r--src/H5Dint.c4
-rw-r--r--src/H5Dlayout.c66
-rw-r--r--src/H5Doh.c9
-rw-r--r--src/H5O.c3
-rw-r--r--src/H5Olayout.c462
-rw-r--r--src/H5Oprivate.h3
-rw-r--r--src/H5Ostorage.c753
-rw-r--r--src/Makefile.am1
-rw-r--r--test/earray.c1
-rw-r--r--tools/h5format_convert/testfiles/h5fc_all.h5bin7672 -> 7672 bytes
-rw-r--r--tools/h5format_convert/testfiles/h5fc_edge.h5bin2526 -> 2526 bytes
-rw-r--r--tools/h5format_convert/testfiles/h5fc_new.h5bin6130 -> 6130 bytes
-rw-r--r--tools/h5stat/testfiles/h5stat_idx.ddl2
-rw-r--r--tools/h5stat/testfiles/h5stat_idx.h5bin2206 -> 2206 bytes
18 files changed, 224 insertions, 1106 deletions
diff --git a/MANIFEST b/MANIFEST
index e8ec506..002be41 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -693,7 +693,6 @@
./src/H5Oshared.h
./src/H5Oshmesg.c
./src/H5Ostab.c
-./src/H5Ostorage.c
./src/H5Otest.c
./src/H5Ounknown.c
./src/H5P.c
diff --git a/hl/test/test_ld.h5 b/hl/test/test_ld.h5
index db34c25..bdf1182 100644
--- a/hl/test/test_ld.h5
+++ b/hl/test/test_ld.h5
Binary files differ
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 3ec3f44..8fe8e81 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -204,10 +204,7 @@ H5D__compact_construct(H5F_t *f, H5D_t *dset)
/* Verify data size is smaller than maximum header message size
* (64KB) minus other layout message fields.
*/
- if(dset->shared->layout.version < H5O_LAYOUT_VERSION_4)
- max_comp_data_size = H5O_MESG_MAX_SIZE - H5D__layout_meta_size(f, &(dset->shared->layout), FALSE);
- else
- max_comp_data_size = H5O_MESG_MAX_SIZE - H5O_storage_meta_size(f, &(dset->shared->layout.storage), FALSE);
+ max_comp_data_size = H5O_MESG_MAX_SIZE - H5D__layout_meta_size(f, &(dset->shared->layout), FALSE);
if(dset->shared->layout.storage.u.compact.size > max_comp_data_size)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "compact dataset size is bigger than header message maximum size")
@@ -373,15 +370,8 @@ H5D__compact_flush(H5D_t *dset, hid_t dxpl_id)
/* Check if the buffered compact information is dirty */
if(dset->shared->layout.storage.u.compact.dirty) {
- /* Check whether compact data is storage in layout or storage message */
- if(dset->shared->layout.version < H5O_LAYOUT_VERSION_4) {
- 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")
- } /* end if */
- else {
- if(H5O_msg_write(&(dset->oloc), H5O_STORAGE_ID, 0, H5O_UPDATE_TIME, &(dset->shared->layout.storage), dxpl_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message")
- } /* end else */
+ 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.storage.u.compact.dirty = FALSE;
} /* end if */
@@ -452,10 +442,6 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src, H5F_t *f_dst
HDassert(storage_dst);
HDassert(dt_src);
- /* Allocate space for destination data */
- if(NULL == (storage_dst->buf = H5MM_malloc(storage_src->size)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate memory for compact dataset")
-
/* Create datatype ID for src datatype, so it gets freed */
if((tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register source file datatype")
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 1f6cd68..2331af4 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -370,8 +370,9 @@ H5D__contig_delete(H5F_t *f, hid_t dxpl_id, const H5O_storage_t *storage)
HDassert(storage);
/* Free the file space for the chunk */
- if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, storage->u.contig.addr, storage->u.contig.size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free contiguous storage space")
+ if(H5F_addr_defined(storage->u.contig.addr))
+ if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, storage->u.contig.addr, storage->u.contig.size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free contiguous storage space")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 9b748e7..a4caf3b 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -2823,9 +2823,7 @@ H5D__format_convert(H5D_t *dataset, hid_t dxpl_id)
(dataset->shared->layout.storage.u.chunk.ops->dest)(&idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
- /* Delete the "storage" and "layout" messages */
- if(H5O_msg_remove(&dataset->oloc, H5O_STORAGE_ID, H5O_ALL, TRUE, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete storage message")
+ /* Delete the "layout" message */
if(H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, TRUE, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message")
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index 058391b..e61cb7c 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -170,20 +170,16 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
switch(layout->type) {
case H5D_COMPACT:
/* This information only present in older versions of message */
- if(layout->version < H5O_LAYOUT_VERSION_4) {
- /* Size of raw data */
- ret_value += 2;
- if(include_compact_data)
- ret_value += layout->storage.u.compact.size;/* data for compact dataset */
- } /* end if */
+ /* Size of raw data */
+ ret_value += 2;
+ if(include_compact_data)
+ ret_value += layout->storage.u.compact.size; /* data for compact dataset */
break;
case H5D_CONTIGUOUS:
/* This information only present in older versions of message */
- if(layout->version < H5O_LAYOUT_VERSION_4) {
- ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
- ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */
- } /* end if */
+ ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
+ ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */
break;
case H5D_CHUNKED:
@@ -239,6 +235,9 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
default:
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid chunk index type")
} /* end switch */
+
+ /* Chunk index address */
+ ret_value += H5F_SIZEOF_ADDR(f);
} /* end else */
break;
@@ -510,24 +509,11 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message")
} /* end if */
- /* Check what version of the layout message to write */
- if(layout->version < H5O_LAYOUT_VERSION_4) {
- /* Create layout message */
- /* (Don't make layout message constant unless allocation time is early, since space may not be allocated) */
- /* (Note: this is relying on H5D_alloc_storage not calling H5O_msg_write during dataset creation) */
- if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_LAYOUT_ID, ((fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type) ? H5O_MSG_FLAG_CONSTANT : 0), 0, layout) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout")
- } /* end if */
- else {
- /* Create layout message */
- /* (Note: this is relying on H5D_alloc_storage not calling H5O_msg_write during dataset creation) */
- if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_LAYOUT_ID, H5O_MSG_FLAG_CONSTANT, 0, layout) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout")
-
- /* Create storage message */
- if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_STORAGE_ID, 0, 0, &layout->storage) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update storage")
- } /* end else */
+ /* Create layout message */
+ /* (Don't make layout message constant unless allocation time is early, since space may not be allocated) */
+ /* (Note: this is relying on H5D_alloc_storage not calling H5O_msg_write during dataset creation) */
+ if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_LAYOUT_ID, ((fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type) ? H5O_MSG_FLAG_CONSTANT : 0), 0, layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout")
done:
/* Error cleanup */
@@ -588,15 +574,6 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t
if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout), dxpl_id))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message")
- /* Check for newer version of the layout message, which indicates that some
- * information is stored in the 'storage' message.
- */
- if(dataset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
- /* Retrieve the storage information */
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_STORAGE_ID, &(dataset->shared->layout.storage), dxpl_id))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data storage message")
- } /* end if */
-
/* Check for external file list message (which might not exist) */
if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_EFL_ID, dxpl_id)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists")
@@ -659,18 +636,9 @@ H5D__layout_oh_write(H5D_t *dataset, hid_t dxpl_id, H5O_t *oh, unsigned update_f
HDassert(dataset);
HDassert(oh);
- /* Determine which message to write, based on the version of the layout info */
- if(dataset->shared->layout.version < H5O_LAYOUT_VERSION_4) {
- /* Write the layout message to the dataset's header */
- if(H5O_msg_write_oh(dataset->oloc.file, dxpl_id, oh, H5O_LAYOUT_ID, H5O_MSG_FLAG_CONSTANT, update_flags, &dataset->shared->layout) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout message")
- } /* end if */
- else {
- /* Write the storage message to the dataset's header */
- if(H5O_msg_write_oh(dataset->oloc.file, dxpl_id, oh, H5O_STORAGE_ID, 0, update_flags, &dataset->shared->layout.storage) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update storage message")
- } /* end else */
-
+ /* Write the layout message to the dataset's header */
+ if(H5O_msg_write_oh(dataset->oloc.file, dxpl_id, oh, H5O_LAYOUT_ID, H5O_MSG_FLAG_CONSTANT, update_flags, &dataset->shared->layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout message")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Doh.c b/src/H5Doh.c
index b7706b3..8f32e15 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -386,15 +386,6 @@ H5O__dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find layout message")
layout_read = TRUE;
- /* Check for newer version of the layout message, which indicates that some
- * information is stored in the 'storage' message.
- */
- if(layout.version >= H5O_LAYOUT_VERSION_4) {
- /* Retrieve the storage information */
- if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_STORAGE_ID, &(layout.storage)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to read data storage message")
- } /* end if */
-
/* Check for chunked dataset storage */
if(layout.type == H5D_CHUNKED && H5D__chunk_is_space_alloc(&layout.storage)) {
/* Check for I/O pipeline message */
diff --git a/src/H5O.c b/src/H5O.c
index 52f06d5..a708141 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -129,8 +129,7 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
H5O_MSG_AINFO, /*0x0015 Attribute information */
H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */
H5O_MSG_FSINFO, /*0x0017 Free-space manager info message */
- H5O_MSG_STORAGE, /*0x0018 Data storage */
- H5O_MSG_UNKNOWN, /*0x0019 Placeholder for unknown message */
+ H5O_MSG_UNKNOWN, /*0x0018 Placeholder for unknown message */
};
/* Declare a free list to manage the H5O_t struct */
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index c67cddb..767c4fb 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -37,21 +37,19 @@
/* PRIVATE PROTOTYPES */
-static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
+static void *H5O__layout_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
-static herr_t H5O_layout_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
-static void *H5O_layout_copy(const void *_mesg, void *_dest);
-static size_t H5O_layout_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
-static herr_t H5O_layout_reset(void *_mesg);
-static herr_t H5O_layout_free(void *_mesg);
-static herr_t H5O_layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
+static herr_t H5O__layout_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
+static void *H5O__layout_copy(const void *_mesg, void *_dest);
+static size_t H5O__layout_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
+static herr_t H5O__layout_reset(void *_mesg);
+static herr_t H5O__layout_free(void *_mesg);
+static herr_t H5O__layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
void *_mesg);
-static herr_t H5O_layout_pre_copy_file(H5F_t *file_src,
- const void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *_udata);
-static void *H5O_layout_copy_file(H5F_t *file_src, void *mesg_src,
+static void *H5O__layout_copy_file(H5F_t *file_src, void *mesg_src,
H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags,
H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id);
-static herr_t H5O_layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
+static herr_t H5O__layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
int indent, int fwidth);
/* This message derives from H5O message class */
@@ -60,22 +58,22 @@ const H5O_msg_class_t H5O_MSG_LAYOUT[1] = {{
"layout", /*message name for debugging */
sizeof(H5O_layout_t), /*native message size */
0, /* messages are sharable? */
- H5O_layout_decode, /*decode message */
- H5O_layout_encode, /*encode message */
- H5O_layout_copy, /*copy the native value */
- H5O_layout_size, /*size of message on disk */
- H5O_layout_reset, /*reset method */
- H5O_layout_free, /*free the struct */
- H5O_layout_delete, /* file delete method */
+ H5O__layout_decode, /*decode message */
+ H5O__layout_encode, /*encode message */
+ H5O__layout_copy, /*copy the native value */
+ H5O__layout_size, /*size of message on disk */
+ H5O__layout_reset, /*reset method */
+ H5O__layout_free, /*free the struct */
+ H5O__layout_delete, /* file delete method */
NULL, /* link method */
NULL, /*set share method */
NULL, /*can share method */
- H5O_layout_pre_copy_file, /* pre copy native value to file */
- H5O_layout_copy_file, /* copy native value to file */
+ NULL, /* pre copy native value to file */
+ H5O__layout_copy_file, /* copy native value to file */
NULL, /* post copy native value to file */
NULL, /* get creation index */
NULL, /* set creation index */
- H5O_layout_debug /*debug the message */
+ H5O__layout_debug /*debug the message */
}};
@@ -84,7 +82,7 @@ H5FL_DEFINE(H5O_layout_t);
/*-------------------------------------------------------------------------
- * Function: H5O_layout_decode
+ * Function: H5O__layout_decode
*
* Purpose: Decode an data layout message and return a pointer to a
* new one created with malloc().
@@ -99,14 +97,14 @@ H5FL_DEFINE(H5O_layout_t);
*-------------------------------------------------------------------------
*/
static void *
-H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
+H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
{
H5O_layout_t *mesg = NULL;
unsigned u;
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(f);
@@ -196,27 +194,23 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *
} /* end if */
} /* end if */
else {
- /* Layout class */
+ /* Layout & storage class */
mesg->type = mesg->storage.type = (H5D_layout_t)*p++;
/* Interpret the rest of the message according to the layout class */
switch(mesg->type) {
case H5D_COMPACT:
- /* Check which version to decode */
- /* (layout versions >= 4 have the compact data in the 'storage' message) */
- if(mesg->version < H5O_LAYOUT_VERSION_4) {
- /* Set the storage type */
- mesg->storage.type = mesg->type;
-
- /* Compact data size */
- UINT16DECODE(p, mesg->storage.u.compact.size);
-
- if(mesg->storage.u.compact.size > 0) {
- if(NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer")
- HDmemcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size);
- p += mesg->storage.u.compact.size;
- } /* end if */
+ /* Compact data size */
+ UINT16DECODE(p, mesg->storage.u.compact.size);
+
+ if(mesg->storage.u.compact.size > 0) {
+ /* Allocate space for compact data */
+ if(NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed for compact data buffer")
+
+ /* Compact data */
+ HDmemcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size);
+ p += mesg->storage.u.compact.size;
} /* end if */
/* Set the layout operations */
@@ -224,18 +218,11 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *
break;
case H5D_CONTIGUOUS:
- /* Check which version to decode */
- /* (layout versions >= 4 have the contiguous storage address in the 'storage' message) */
- if(mesg->version < H5O_LAYOUT_VERSION_4) {
- /* Set the storage type */
- mesg->storage.type = mesg->type;
-
- /* Contiguous storage address */
- H5F_addr_decode(f, &p, &(mesg->storage.u.contig.addr));
+ /* Contiguous storage address */
+ H5F_addr_decode(f, &p, &(mesg->storage.u.contig.addr));
- /* Contiguous storage size */
- H5F_DECODE_LENGTH(f, p, mesg->storage.u.contig.size);
- } /* end if */
+ /* Contiguous storage size */
+ H5F_DECODE_LENGTH(f, p, mesg->storage.u.contig.size);
/* Set the layout operations */
mesg->ops = H5D_LOPS_CONTIG;
@@ -243,9 +230,6 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *
case H5D_CHUNKED:
if(mesg->version < H5O_LAYOUT_VERSION_4) {
- /* Set the storage type */
- mesg->storage.type = mesg->type;
-
/* Set the chunked layout flags */
mesg->u.chunk.flags = (uint8_t)0;
@@ -279,17 +263,17 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *
* until features are added for the flags)
*/
if(mesg->u.chunk.flags & ~H5O_LAYOUT_ALL_CHUNK_FLAGS)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad flag value for message")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "bad flag value for message")
/* Dimensionality */
mesg->u.chunk.ndims = *p++;
if(mesg->u.chunk.ndims > H5O_LAYOUT_NDIMS)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "dimensionality is too large")
/* Encoded # of bytes for each chunk dimension */
mesg->u.chunk.enc_bytes_per_dim = *p++;
if(mesg->u.chunk.enc_bytes_per_dim == 0 || mesg->u.chunk.enc_bytes_per_dim > 8)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "encoded chunk dimension size is too large")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "encoded chunk dimension size is too large")
/* Chunk dimensions */
for(u = 0; u < mesg->u.chunk.ndims; u++)
@@ -302,11 +286,17 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *
/* Chunk index type */
mesg->u.chunk.idx_type = (H5D_chunk_index_t)*p++;
if(mesg->u.chunk.idx_type >= H5D_CHUNK_IDX_NTYPES)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unknown chunk index type")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "unknown chunk index type")
mesg->storage.u.chunk.idx_type = mesg->u.chunk.idx_type;
switch(mesg->u.chunk.idx_type) {
+ case H5D_CHUNK_IDX_BTREE:
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "v1 B-tree index type should never be in a v4 layout message")
+ break;
+
case H5D_CHUNK_IDX_NONE: /* Non Index */
+ /* Set the chunk operations */
+ mesg->storage.u.chunk.ops = H5D_COPS_NONE;
break;
case H5D_CHUNK_IDX_FARRAY:
@@ -314,6 +304,9 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *
mesg->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits = *p++;
if(0 == mesg->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid fixed array creation parameter")
+
+ /* Set the chunk operations */
+ mesg->storage.u.chunk.ops = H5D_COPS_FARRAY;
break;
case H5D_CHUNK_IDX_EARRAY:
@@ -333,17 +326,27 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *
mesg->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits = *p++;
if(0 == mesg->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid extensible array creation parameter")
+
+ /* Set the chunk operations */
+ mesg->storage.u.chunk.ops = H5D_COPS_EARRAY;
break;
case H5D_CHUNK_IDX_BT2: /* v2 B-tree index */
UINT32DECODE(p, mesg->u.chunk.u.btree2.cparam.node_size);
mesg->u.chunk.u.btree2.cparam.split_percent = *p++;
mesg->u.chunk.u.btree2.cparam.merge_percent = *p++;
+
+ /* Set the chunk operations */
+ mesg->storage.u.chunk.ops = H5D_COPS_BT2;
break;
+ case H5D_CHUNK_IDX_NTYPES:
default:
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid chunk index type")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "Invalid chunk index type")
} /* end switch */
+
+ /* Chunk index address */
+ H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr));
} /* end else */
/* Set the layout operations */
@@ -366,11 +369,11 @@ done:
mesg = H5FL_FREE(H5O_layout_t, mesg);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_layout_decode() */
+} /* end H5O__layout_decode() */
/*-------------------------------------------------------------------------
- * Function: H5O_layout_encode
+ * Function: H5O__layout_encode
*
* Purpose: Encodes a message.
*
@@ -383,34 +386,16 @@ done:
* Quincey Koziol, 2004-5-21
* We write out version 3 messages by default now.
*
- * Modifications:
- * Robb Matzke, 1998-07-20
- * Rearranged the message to add a version number at the beginning.
- *
- * Raymond Lu, 2002-2-26
- * Added version number 2 case depends on if space has been allocated
- * at the moment when layout header message is updated.
- *
- * Quincey Koziol, 2004-5-21
- * Added version number 3 case to straighten out problems with contiguous
- * layout's sizes (was encoding them as 4-byte values when they were
- * really n-byte values (where n usually is 8)) and additionally clean up
- * the information written out.
- *
- * Quincey Koziol, 2009-3-31
- * Added version number 4 case to allow different kinds of indices for
- * looking up chunks.
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
+H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg;
unsigned u;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(f);
@@ -427,31 +412,25 @@ H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c
/* Write out layout class specific information */
switch(mesg->type) {
case H5D_COMPACT:
- /* This information is stored in 'storage' message when version >= 4 */
- if(mesg->version < H5O_LAYOUT_VERSION_4) {
- /* Size of raw data */
- UINT16ENCODE(p, mesg->storage.u.compact.size);
+ /* Size of raw data */
+ UINT16ENCODE(p, mesg->storage.u.compact.size);
- /* Raw data */
- if(mesg->storage.u.compact.size > 0) {
- if(mesg->storage.u.compact.buf)
- HDmemcpy(p, mesg->storage.u.compact.buf, mesg->storage.u.compact.size);
- else
- HDmemset(p, 0, mesg->storage.u.compact.size);
- p += mesg->storage.u.compact.size;
- } /* end if */
+ /* Raw data */
+ if(mesg->storage.u.compact.size > 0) {
+ if(mesg->storage.u.compact.buf)
+ HDmemcpy(p, mesg->storage.u.compact.buf, mesg->storage.u.compact.size);
+ else
+ HDmemset(p, 0, mesg->storage.u.compact.size);
+ p += mesg->storage.u.compact.size;
} /* end if */
break;
case H5D_CONTIGUOUS:
- /* This information is stored in 'storage' message when version >= 4 */
- if(mesg->version < H5O_LAYOUT_VERSION_4) {
- /* Contiguous storage address */
- H5F_addr_encode(f, &p, mesg->storage.u.contig.addr);
+ /* Contiguous storage address */
+ H5F_addr_encode(f, &p, mesg->storage.u.contig.addr);
- /* Contiguous storage size */
- H5F_ENCODE_LENGTH(f, p, mesg->storage.u.contig.size);
- } /* end if */
+ /* Contiguous storage size */
+ H5F_ENCODE_LENGTH(f, p, mesg->storage.u.contig.size);
break;
case H5D_CHUNKED:
@@ -487,6 +466,10 @@ H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c
*p++ = (uint8_t)mesg->u.chunk.idx_type;
switch(mesg->u.chunk.idx_type) {
+ case H5D_CHUNK_IDX_BTREE:
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "v1 B-tree index type should never be in a v4 layout message")
+ break;
+
case H5D_CHUNK_IDX_NONE: /* Non Index */
break;
@@ -510,9 +493,13 @@ H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c
*p++ = mesg->u.chunk.u.btree2.cparam.merge_percent;
break;
+ case H5D_CHUNK_IDX_NTYPES:
default:
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid chunk index type")
} /* end switch */
+
+ /* Chunk index address */
+ H5F_addr_encode(f, &p, mesg->storage.u.chunk.idx_addr);
} /* end else */
break;
@@ -524,11 +511,11 @@ H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_layout_encode() */
+} /* end H5O__layout_encode() */
/*-------------------------------------------------------------------------
- * Function: H5O_layout_copy
+ * Function: H5O__layout_copy
*
* Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
* necessary.
@@ -543,13 +530,13 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5O_layout_copy(const void *_mesg, void *_dest)
+H5O__layout_copy(const void *_mesg, void *_dest)
{
const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg;
H5O_layout_t *dest = (H5O_layout_t *) _dest;
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(mesg);
@@ -576,6 +563,8 @@ H5O_layout_copy(const void *_mesg, void *_dest)
/* Copy over the raw data */
HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size);
} /* end if */
+ else
+ HDassert(dest->storage.u.compact.buf == NULL);
break;
case H5D_CONTIGUOUS:
@@ -603,11 +592,11 @@ done:
dest = H5FL_FREE(H5O_layout_t, dest);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_layout_copy() */
+} /* end H5O__layout_copy() */
/*-------------------------------------------------------------------------
- * Function: H5O_layout_size
+ * Function: H5O__layout_size
*
* Purpose: Returns the size of the raw message in bytes. If it's
* compact dataset, the data part is also included.
@@ -623,12 +612,12 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg)
+H5O__layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg)
{
const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg;
size_t ret_value;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(f);
@@ -639,11 +628,11 @@ H5O_layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi
ret_value = H5D__layout_meta_size(f, mesg, TRUE);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_layout_size() */
+} /* end H5O__layout_size() */
/*-------------------------------------------------------------------------
- * Function: H5O_layout_reset
+ * Function: H5O__layout_reset
*
* Purpose: Frees resources within a data type message, but doesn't free
* the message itself.
@@ -656,31 +645,28 @@ H5O_layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_layout_reset(void *_mesg)
+H5O__layout_reset(void *_mesg)
{
H5O_layout_t *mesg = (H5O_layout_t *)_mesg;
- herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC_NOERR
if(mesg) {
- /* Reset associated storage information, if it's been initialized */
- if(H5D_LAYOUT_ERROR != mesg->storage.type)
- if(H5O_storage_reset(&mesg->storage) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free message resources")
+ /* Free the compact storage buffer */
+ if(H5D_COMPACT == mesg->type)
+ mesg->storage.u.compact.buf = H5MM_xfree(mesg->storage.u.compact.buf);
/* Reset the message */
mesg->type = H5D_CONTIGUOUS;
mesg->version = H5O_LAYOUT_VERSION_DEFAULT;
} /* end if */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_layout_reset() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O__layout_reset() */
/*-------------------------------------------------------------------------
- * Function: H5O_layout_free
+ * Function: H5O__layout_free
*
* Purpose: Free's the message
*
@@ -692,28 +678,25 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_layout_free(void *_mesg)
+H5O__layout_free(void *_mesg)
{
H5O_layout_t *mesg = (H5O_layout_t *) _mesg;
- herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC_NOERR
HDassert(mesg);
/* Free resources within the message */
- if(H5O_layout_reset(mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free message resources")
+ H5O__layout_reset(mesg);
- mesg = H5FL_FREE(H5O_layout_t, mesg);
+ (void)H5FL_FREE(H5O_layout_t, mesg);
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_layout_free() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O__layout_free() */
/*-------------------------------------------------------------------------
- * Function: H5O_layout_delete
+ * Function: H5O__layout_delete
*
* Purpose: Free file space referenced by message
*
@@ -725,93 +708,49 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg)
+H5O__layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg)
{
H5O_layout_t *mesg = (H5O_layout_t *) _mesg;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(f);
HDassert(open_oh);
HDassert(mesg);
- /* Check version #, older versions are in charge of storage also */
- if(mesg->version < H5O_LAYOUT_VERSION_4) {
- /* Perform different actions, depending on the type of storage */
- switch(mesg->type) {
- case H5D_COMPACT: /* Compact data storage */
- /* Nothing required */
- break;
-
- case H5D_CONTIGUOUS: /* Contiguous block on disk */
- /* Free the file space for the raw data */
- if(H5D__contig_delete(f, dxpl_id, &mesg->storage) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data")
- break;
-
- case H5D_CHUNKED: /* Chunked blocks on disk */
- /* Free the file space for the index & chunk raw data */
- if(H5D__chunk_delete(f, dxpl_id, open_oh, &mesg->storage) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data")
- break;
-
- case H5D_LAYOUT_ERROR:
- case H5D_NLAYOUTS:
- default:
- HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not valid storage type")
- } /* end switch */
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_layout_delete() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_layout_pre_copy_file
- *
- * Purpose: Perform any necessary actions before copying message between
- * files
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * July 30, 2009
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_layout_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
- hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info, void *_udata)
-{
- const H5O_layout_t *layout_src = (const H5O_layout_t *)mesg_src; /* Source layout */
- H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */
- herr_t ret_value = SUCCEED; /* Return value */
+ /* Perform different actions, depending on the type of storage */
+ switch(mesg->type) {
+ case H5D_COMPACT: /* Compact data storage */
+ /* Nothing required */
+ break;
- FUNC_ENTER_NOAPI_NOINIT
+ case H5D_CONTIGUOUS: /* Contiguous block on disk */
+ /* Free the file space for the raw data */
+ if(H5D__contig_delete(f, dxpl_id, &mesg->storage) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data")
+ break;
- /* check args */
- HDassert(layout_src);
+ case H5D_CHUNKED: /* Chunked blocks on disk */
+ /* Free the file space for the index & chunk raw data */
+ if(H5D__chunk_delete(f, dxpl_id, open_oh, &mesg->storage) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data")
+ break;
- /* If the user data is non-NULL, assume we are copying a dataset
- * and make a copy of the layout for later in the object copying process,
- * if the layout version is late enough that we know it will be needed
- * by the 'storage' message.
- */
- if(udata && layout_src->version >= H5O_LAYOUT_VERSION_4)
- if(NULL == (udata->src_layout = (H5O_layout_t *)H5O_layout_copy(layout_src, NULL)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy layout")
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
+ default:
+ HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not valid storage type")
+ } /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_layout_pre_copy_file() */
+} /* end H5O__layout_delete() */
/*-------------------------------------------------------------------------
- * Function: H5O_layout_copy_file
+ * Function: H5O__layout_copy_file
*
* Purpose: Copies a message from _MESG to _DEST in file
*
@@ -825,7 +764,7 @@ done:
*-------------------------------------------------------------------------
*/
static void *
-H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
+H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
hbool_t H5_ATTR_UNUSED *recompute_size, unsigned H5_ATTR_UNUSED *mesg_flags,
H5O_copy_t *cpy_info, void *_udata, hid_t dxpl_id)
{
@@ -835,7 +774,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
hbool_t copied = FALSE; /* Whether the data was copied */
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(file_src);
@@ -843,59 +782,51 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
HDassert(file_dst);
/* Copy the layout information */
- if(NULL == (layout_dst = (H5O_layout_t *)H5O_layout_copy(layout_src, NULL)))
+ if(NULL == (layout_dst = (H5O_layout_t *)H5O__layout_copy(layout_src, NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy layout")
- /* Check if using version of layout message that encodes storage info */
- if(layout_src->version < H5O_LAYOUT_VERSION_4) {
- /* Copy the layout type specific information */
- switch(layout_src->type) {
- case H5D_COMPACT:
- if(layout_src->storage.u.compact.buf) {
- /* copy compact raw data */
- 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")
- copied = TRUE;
- } /* end if */
- break;
+ /* Copy the layout type specific information */
+ switch(layout_src->type) {
+ case H5D_COMPACT:
+ if(layout_src->storage.u.compact.buf) {
+ /* copy compact raw data */
+ 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")
+ copied = TRUE;
+ } /* end if */
+ break;
- case H5D_CONTIGUOUS:
- /* Compute the size of the contiguous storage for versions of the
- * layout message less than version 3 because versions 1 & 2 would
- * truncate the dimension sizes to 32-bits of information. - QAK 5/26/04
- */
- if(layout_src->version < H5O_LAYOUT_VERSION_3)
- layout_dst->storage.u.contig.size = H5S_extent_nelem(udata->src_space_extent) *
- H5T_get_size(udata->src_dtype);
-
- 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")
- copied = TRUE;
- } /* end if */
- break;
+ case H5D_CONTIGUOUS:
+ /* Compute the size of the contiguous storage for versions of the
+ * layout message less than version 3 because versions 1 & 2 would
+ * truncate the dimension sizes to 32-bits of information. - QAK 5/26/04
+ */
+ if(layout_src->version < H5O_LAYOUT_VERSION_3)
+ layout_dst->storage.u.contig.size = H5S_extent_nelem(udata->src_space_extent) *
+ H5T_get_size(udata->src_dtype);
+
+ 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")
+ copied = TRUE;
+ } /* end if */
+ break;
- case H5D_CHUNKED:
- if(H5D__chunk_is_space_alloc(&layout_src->storage)) {
- /* Create chunked layout */
- if(H5D__chunk_copy(file_src, &layout_src->storage.u.chunk, &layout_src->u.chunk, file_dst, &layout_dst->storage.u.chunk, udata->src_space_extent, udata->src_dtype, udata->common.src_pline, cpy_info, dxpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
- copied = TRUE;
- } /* end if */
- break;
+ case H5D_CHUNKED:
+ if(H5D__chunk_is_space_alloc(&layout_src->storage)) {
+ /* Create chunked layout */
+ if(H5D__chunk_copy(file_src, &layout_src->storage.u.chunk, &layout_src->u.chunk, file_dst, &layout_dst->storage.u.chunk, udata->src_space_extent, udata->src_dtype, udata->common.src_pline, cpy_info, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
+ copied = TRUE;
+ } /* end if */
+ break;
- case H5D_LAYOUT_ERROR:
- case H5D_NLAYOUTS:
- default:
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class")
- } /* end switch */
- } /* end if */
- else {
- /* Dataset's raw data will be copied using the 'storage' message, reset storage her */
- if(H5O_storage_reset(&layout_dst->storage) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "unable to free message resources")
- } /* end else */
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
+ default:
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class")
+ } /* end switch */
/* Check if copy routine was invoked (which frees the source datatype) */
if(copied)
@@ -910,11 +841,11 @@ done:
layout_dst = H5FL_FREE(H5O_layout_t, layout_dst);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_layout_copy_file() */
+} /* end H5O__layout_copy_file() */
/*-------------------------------------------------------------------------
- * Function: H5O_layout_debug
+ * Function: H5O__layout_debug
*
* Purpose: Prints debugging info for a message.
*
@@ -926,13 +857,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void *_mesg,
+H5O__layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void *_mesg,
FILE * stream, int indent, int fwidth)
{
const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg;
size_t u;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* check args */
HDassert(f);
@@ -972,16 +903,19 @@ H5O_layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const vo
case H5D_CHUNK_IDX_FARRAY:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Index Type:", "Fixed Array");
+ /* (Should print the fixed array creation parameters) */
break;
case H5D_CHUNK_IDX_EARRAY:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Index Type:", "Extensible Array");
+ /* (Should print the extensible array creation parameters) */
break;
case H5D_CHUNK_IDX_BT2:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Index Type:", "v2 B-tree");
+ /* (Should print the v2-Btree creation parameters) */
break;
case H5D_CHUNK_IDX_NTYPES:
@@ -990,28 +924,24 @@ H5O_layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const vo
"Index Type:", "Unknown", (unsigned)mesg->u.chunk.idx_type);
break;
} /* end switch */
- if(mesg->version < H5O_LAYOUT_VERSION_4)
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
- "Index address:", mesg->storage.u.chunk.idx_addr);
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Index address:", mesg->storage.u.chunk.idx_addr);
break;
case H5D_CONTIGUOUS:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Type:", "Contiguous");
- if(mesg->version < H5O_LAYOUT_VERSION_4) {
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
- "Data address:", mesg->storage.u.contig.addr);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
- "Data Size:", mesg->storage.u.contig.size);
- } /* end if */
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Data address:", mesg->storage.u.contig.addr);
+ HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ "Data Size:", mesg->storage.u.contig.size);
break;
case H5D_COMPACT:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Type:", "Compact");
- if(mesg->version < H5O_LAYOUT_VERSION_4)
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
- "Data Size:", mesg->storage.u.compact.size);
+ HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ "Data Size:", mesg->storage.u.compact.size);
break;
case H5D_LAYOUT_ERROR:
@@ -1023,5 +953,5 @@ H5O_layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const vo
} /* end switch */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_layout_debug() */
+} /* end H5O__layout_debug() */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 8790780..21cf49a 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -198,8 +198,7 @@ typedef struct H5O_copy_t {
#define H5O_AINFO_ID 0x0015 /* Attribute info message. */
#define H5O_REFCOUNT_ID 0x0016 /* Reference count message. */
#define H5O_FSINFO_ID 0x0017 /* Free-space manager info message. */
-#define H5O_STORAGE_ID 0x0018 /* Data Storage message. */
-#define H5O_UNKNOWN_ID 0x0019 /* Placeholder message ID for unknown message. */
+#define H5O_UNKNOWN_ID 0x0018 /* Placeholder message ID for unknown message. */
/* (this should never exist in a file) */
/* Shared object message types.
diff --git a/src/H5Ostorage.c b/src/H5Ostorage.c
deleted file mode 100644
index 04a91d8..0000000
--- a/src/H5Ostorage.c
+++ /dev/null
@@ -1,753 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
- * Wednesday, July 29, 2009
- *
- * Purpose: Message related to data storage.
- */
-
-#define H5D_PACKAGE /*suppress error about including H5Dpkg */
-#define H5O_PACKAGE /*suppress error about including H5Opkg */
-
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Dataset functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-
-
-/* Local macros */
-
-/* Current version of storage information */
-#define H5O_STORAGE_VERSION 0
-
-/* Flags for chunked storage feature encoding */
-#ifdef NOT_YET
-#define H5O_STORAGE_CHUNK_HAVE_ELEM_INDEX 0x02
-#define H5O_STORAGE_ALL_CHUNK_FLAGS ( \
- H5O_STORAGE_CHUNK_HAVE_ELEM_INDEX \
- | H5O_STORAGE_CHUNK_HAVE_CHUNK_INDEX \
- )
-#else /* NOT_YET */
-#define H5O_STORAGE_CHUNK_HAVE_CHUNK_INDEX 0x01
-#define H5O_STORAGE_ALL_CHUNK_FLAGS H5O_STORAGE_CHUNK_HAVE_CHUNK_INDEX
-#endif /* NOT_YET */
-
-
-/* PRIVATE PROTOTYPES */
-static void *H5O_storage_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
-static herr_t H5O_storage_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
-static size_t H5O_storage_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
-static herr_t H5O_storage_free(void *_mesg);
-static herr_t H5O_storage_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- void *_mesg);
-static void *H5O_storage_copy_file(H5F_t *file_src, void *mesg_src,
- H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags,
- H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id);
-static herr_t H5O_storage_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
- int indent, int fwidth);
-
-/* This message derives from H5O message class */
-const H5O_msg_class_t H5O_MSG_STORAGE[1] = {{
- H5O_STORAGE_ID, /*message id number */
- "storage", /*message name for debugging */
- sizeof(H5O_storage_t), /*native message size */
- 0, /* messages are sharable? */
- H5O_storage_decode, /*decode message */
- H5O_storage_encode, /*encode message */
- H5O_storage_copy, /*copy the native value */
- H5O_storage_size, /*size of message on disk */
- H5O_storage_reset, /*reset method */
- H5O_storage_free, /*free the struct */
- H5O_storage_delete, /* file delete method */
- NULL, /* link method */
- NULL, /*set share method */
- NULL, /*can share method */
- NULL, /* pre copy native value to file */
- H5O_storage_copy_file, /* copy native value to file */
- NULL, /* post copy native value to file */
- NULL, /* get creation index */
- NULL, /* set creation index */
- H5O_storage_debug /*debug the message */
-}};
-
-
-/* Declare a free list to manage the H5O_storage_t struct */
-H5FL_DEFINE_STATIC(H5O_storage_t);
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_storage_decode
- *
- * Purpose: Decode a data storage message and return a pointer to a
- * new one created with malloc().
- *
- * Return: Success: Ptr to new message in native order.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Wednesday, July 29, 2009
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5O_storage_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
-{
- H5O_storage_t *mesg = NULL; /* Message decoded */
- uint8_t version; /* Version of message decoded */
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* check args */
- HDassert(f);
- HDassert(p);
-
- /* Allocate new message */
- if(NULL == (mesg = H5FL_CALLOC(H5O_storage_t)))
- HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "memory allocation failed")
-
- /* decode */
- version = *p++;
- if(H5O_STORAGE_VERSION != version)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")
-
- /* Layout class */
- mesg->type = (H5D_layout_t)*p++;
-
- /* Interpret the rest of the message according to the layout class */
- switch(mesg->type) {
- case H5D_COMPACT:
- /* Compact data size */
- UINT16DECODE(p, mesg->u.compact.size);
-
- /* Check for any data stored */
- if(mesg->u.compact.size > 0) {
- /* Allocate space for compact data */
- if(NULL == (mesg->u.compact.buf = H5MM_malloc(mesg->u.compact.size)))
- HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer")
-
- /* Compact data */
- HDmemcpy(mesg->u.compact.buf, p, mesg->u.compact.size);
- p += mesg->u.compact.size;
- } /* end if */
- break;
-
- case H5D_CONTIGUOUS:
- /* Contiguous storage address */
- H5F_addr_decode(f, &p, &(mesg->u.contig.addr));
-
- /* Contiguous storage size */
- H5F_DECODE_LENGTH(f, p, mesg->u.contig.size);
- break;
-
- case H5D_CHUNKED:
- {
- uint8_t flags; /* Flags for decoding chunk feature info */
-
- /* Get the chunked layout flags */
- flags = *p++;
-
- /* Check for valid flags */
- if(flags & ~H5O_STORAGE_ALL_CHUNK_FLAGS)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad flag value for message")
-
- /* Check for chunk index */
- if(flags & H5O_STORAGE_CHUNK_HAVE_CHUNK_INDEX) {
- /* Chunk index type */
- mesg->u.chunk.idx_type = (H5D_chunk_index_t)*p++;
- switch(mesg->u.chunk.idx_type) {
- case H5D_CHUNK_IDX_NONE:
- /* Set the chunk operations */
- mesg->u.chunk.ops = H5D_COPS_NONE;
- break;
-
- case H5D_CHUNK_IDX_FARRAY:
- /* Set the chunk operations */
- mesg->u.chunk.ops = H5D_COPS_FARRAY;
- break;
-
- case H5D_CHUNK_IDX_EARRAY:
- /* Set the chunk operations */
- mesg->u.chunk.ops = H5D_COPS_EARRAY;
- break;
-
- case H5D_CHUNK_IDX_BT2: /* v2 B-tree index */
- /* Set the chunk operations */
- mesg->u.chunk.ops = H5D_COPS_BT2;
- break;
-
- default:
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid chunk index type")
- } /* end switch */
-
- /* Chunk index address */
- H5F_addr_decode(f, &p, &(mesg->u.chunk.idx_addr));
- } /* end if */
- } /* end block */
- break;
-
- default:
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class")
- } /* end switch */
-
- /* Set return value */
- ret_value = mesg;
-
-done:
- if(ret_value == NULL)
- if(mesg)
- (void)H5FL_FREE(H5O_storage_t, mesg);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_storage_decode() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_storage_encode
- *
- * Purpose: Encodes a message.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Wednesday, July 29, 2009
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_storage_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p,
- const void *_mesg)
-{
- const H5O_storage_t *mesg = (const H5O_storage_t *) _mesg;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* check args */
- HDassert(f);
- HDassert(mesg);
- HDassert(p);
-
- /* Message version */
- *p++ = (uint8_t)H5O_STORAGE_VERSION;
-
- /* Layout class */
- *p++ = mesg->type;
-
- /* Write out layout class specific information */
- switch(mesg->type) {
- case H5D_COMPACT:
- /* Size of raw data */
- UINT16ENCODE(p, mesg->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);
- else
- HDmemset(p, 0, mesg->u.compact.size);
- p += mesg->u.compact.size;
- } /* end if */
- break;
-
- case H5D_CONTIGUOUS:
- /* Contiguous storage address */
- H5F_addr_encode(f, &p, mesg->u.contig.addr);
-
- /* Contiguous storage size */
- H5F_ENCODE_LENGTH(f, p, mesg->u.contig.size);
- break;
-
- case H5D_CHUNKED:
- {
- /* Chunk feature flags */
- *p++ = (uint8_t)H5O_STORAGE_CHUNK_HAVE_CHUNK_INDEX;
-
- /* Chunk index type */
- *p++ = (uint8_t)mesg->u.chunk.idx_type;
-
- /* Chunk index address */
- H5F_addr_encode(f, &p, mesg->u.chunk.idx_addr);
- } /* end block */
- break;
-
- default:
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid layout class")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_storage_encode() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_storage_copy
- *
- * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
- * necessary.
- *
- * Return: Success: Ptr to _DEST
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Wednesday, July 29, 2009
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5O_storage_copy(const void *_mesg, void *_dest)
-{
- const H5O_storage_t *mesg = (const H5O_storage_t *) _mesg;
- H5O_storage_t *dest = (H5O_storage_t *) _dest;
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* check args */
- HDassert(mesg);
- if(!dest && NULL == (dest = H5FL_MALLOC(H5O_storage_t)))
- HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "memory allocation failed")
-
- /* copy */
- *dest = *mesg;
-
- /* Deep copy the buffer for compact datasets also */
- if(mesg->type == H5D_COMPACT) {
- if(mesg->u.compact.size > 0) {
- /* Allocate memory for the raw data */
- if(NULL == (dest->u.compact.buf = H5MM_malloc(dest->u.compact.size)))
- HGOTO_ERROR(H5E_OHDR, 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);
- } /* end if */
- else
- HDassert(dest->u.compact.buf == NULL);
- } /* end if */
-
- /* Reset the pointer of the chunked storage index but not the address */
- if(dest->type == H5D_CHUNKED && dest->u.chunk.ops)
- H5D_chunk_idx_reset(&dest->u.chunk, FALSE);
-
- /* Set return value */
- ret_value = dest;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_storage_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_storage_size
- *
- * Purpose: Returns the size of the raw message in bytes. If it's
- * compact dataset, the data part is also included.
- * This function doesn't take into account message alignment.
- *
- * Return: Success: Message data size in bytes
- * Failure: 0
- *
- * Programmer: Quincey Koziol
- * Wednesday, July 29, 2009
- *
- *-------------------------------------------------------------------------
- */
-static size_t
-H5O_storage_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg)
-{
- const H5O_storage_t *mesg = (const H5O_storage_t *) _mesg;
- size_t ret_value;
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* check args */
- HDassert(f);
- HDassert(mesg);
-
- /* Compute the storage message's encoded size in the file */
- /* (including possible compact data) */
- ret_value = H5O_storage_meta_size(f, mesg, TRUE);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_storage_size() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_storage_reset
- *
- * Purpose: Frees resources within a message, but doesn't free
- * the message itself.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Wednesday, July 29, 2009
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_storage_reset(void *_mesg)
-{
- H5O_storage_t *mesg = (H5O_storage_t *)_mesg;
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- if(mesg) {
- /* Free the compact storage buffer */
- if(H5D_COMPACT == mesg->type)
- mesg->u.compact.buf = H5MM_xfree(mesg->u.compact.buf);
-
- /* Reset the message */
- mesg->type = H5D_CONTIGUOUS;
- } /* end if */
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_storage_reset() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_storage_free
- *
- * Purpose: Free's the message
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Wednesday, July 29, 2009
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_storage_free(void *_mesg)
-{
- H5O_storage_t *mesg = (H5O_storage_t *) _mesg;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(mesg);
-
- /* Free resources within the message */
- if(H5O_storage_reset(mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free message resources")
-
- (void)H5FL_FREE(H5O_storage_t, mesg);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_storage_free() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_storage_delete
- *
- * Purpose: Free file space referenced by message
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, July 30, 2009
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_storage_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg)
-{
- H5O_storage_t *mesg = (H5O_storage_t *) _mesg;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* check args */
- HDassert(f);
- HDassert(open_oh);
- HDassert(mesg);
-
- /* Perform different actions, depending on the type of storage */
- switch(mesg->type) {
- case H5D_COMPACT: /* Compact data storage */
- /* Nothing required */
- break;
-
- case H5D_CONTIGUOUS: /* Contiguous block on disk */
- /* Free the file space for the raw data */
- if(H5D__contig_delete(f, dxpl_id, mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data")
- break;
-
- case H5D_CHUNKED: /* Chunked blocks on disk */
- /* Free the file space for the index & chunk raw data */
- if(H5D__chunk_delete(f, dxpl_id, open_oh, mesg) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data")
- break;
-
- default:
- HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not valid storage type")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_storage_delete() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_storage_copy_file
- *
- * Purpose: Copies a message from _MESG to _DEST in file
- *
- * Return: Success: Ptr to _DEST
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Thursday, July 30, 2009
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5O_storage_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
- hbool_t H5_ATTR_UNUSED *recompute_size, unsigned H5_ATTR_UNUSED *mesg_flags,
- H5O_copy_t *cpy_info, void *_udata, hid_t dxpl_id)
-{
- H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */
- H5O_storage_t *storage_src = (H5O_storage_t *)mesg_src;
- H5O_storage_t *storage_dst = NULL;
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* check args */
- HDassert(file_src);
- HDassert(storage_src);
- HDassert(file_dst);
- HDassert(cpy_info);
- HDassert(udata);
- HDassert(udata->src_layout);
- HDassert(udata->src_layout->version >= H5O_LAYOUT_VERSION_4 );
-
- /* Allocate space for the destination storage */
- if(NULL == (storage_dst = H5FL_MALLOC(H5O_storage_t)))
- HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "memory allocation failed")
-
- /* Copy the "top level" information */
- *storage_dst = *storage_src;
-
- /* Copy the storage type specific information */
- switch(storage_src->type) {
- case H5D_COMPACT:
- if(storage_src->u.compact.buf) {
- if(NULL == (storage_dst->u.compact.buf = H5MM_malloc(storage_src->u.compact.size)))
- HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset")
-
- /* Copy compact raw data */
- if(H5D__compact_copy(file_src, &storage_src->u.compact, file_dst, &storage_dst->u.compact, udata->src_dtype, cpy_info, dxpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
-
- storage_dst->u.compact.dirty = TRUE;
- } /* end if */
- break;
-
- case H5D_CONTIGUOUS:
- if(H5D__contig_is_space_alloc(storage_src)) {
- /* Copy contiguous raw data */
- if(H5D__contig_copy(file_src, &storage_src->u.contig, file_dst, &storage_dst->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(storage_src)) {
- /* Create chunked layout */
- if(H5D__chunk_copy(file_src, &storage_src->u.chunk, &udata->src_layout->u.chunk, file_dst, &storage_dst->u.chunk, udata->src_space_extent, udata->src_dtype, udata->common.src_pline, cpy_info, dxpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage")
- } /* end if */
- break;
-
- default:
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class")
- } /* end switch */
-
- /* Freed by copy routine */
- udata->src_dtype = NULL;
-
- /* Set return value */
- ret_value = storage_dst;
-
-done:
- if(!ret_value)
- if(storage_dst)
- (void)H5FL_FREE(H5O_storage_t, storage_dst);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_storage_copy_file() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_storage_debug
- *
- * Purpose: Prints debugging info for a message.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, July 30, 2009
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_storage_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void *_mesg,
- FILE * stream, int indent, int fwidth)
-{
- const H5O_storage_t *mesg = (const H5O_storage_t *) _mesg;
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* check args */
- HDassert(f);
- HDassert(mesg);
- HDassert(stream);
- HDassert(indent >= 0);
- HDassert(fwidth >= 0);
-
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "Version:", (unsigned)H5O_STORAGE_VERSION);
- switch(mesg->type) {
- case H5D_CHUNKED:
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Type:", "Chunked");
-
- /* Index information */
- switch(mesg->u.chunk.idx_type) {
- case H5D_CHUNK_IDX_BTREE:
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Index Type:", "v1 B-tree");
- break;
-
- case H5D_CHUNK_IDX_NONE:
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Index Type:", "None");
- break;
-
- case H5D_CHUNK_IDX_FARRAY:
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Index Type:", "Fixed Array");
- break;
-
- case H5D_CHUNK_IDX_EARRAY:
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Index Type:", "Extensible Array");
- break;
-
- case H5D_CHUNK_IDX_BT2:
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Index Type:", "v2 B-tree");
- break;
-
- default:
- HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
- "Index Type:", "Unknown", (unsigned)mesg->u.chunk.idx_type);
- break;
- } /* end switch */
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
- "Index address:", mesg->u.chunk.idx_addr);
- break;
-
- case H5D_CONTIGUOUS:
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Type:", "Contiguous");
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
- "Data address:", mesg->u.contig.addr);
- HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
- "Data Size:", mesg->u.contig.size);
- break;
-
- case H5D_COMPACT:
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Type:", "Compact");
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
- "Data Size:", mesg->u.compact.size);
- break;
-
- default:
- HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
- "Type:", "Unknown", (unsigned)mesg->type);
- break;
- } /* end switch */
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_storage_debug() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_storage_meta_size
- *
- * Purpose: Returns the size of the raw message in bytes except raw data
- * part for compact dataset. This function doesn't take into
- * account message alignment.
- *
- * Return: Success: Message data size in bytes
- * Failure: 0
- *
- * Programmer: Quincey Koziol
- * July 29, 2009
- *
- *-------------------------------------------------------------------------
- */
-size_t
-H5O_storage_meta_size(const H5F_t *f, const H5O_storage_t *storage,
- hbool_t include_compact_data)
-{
- size_t ret_value;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* check args */
- HDassert(f);
- HDassert(storage);
-
- ret_value = 1 + /* Version number */
- 1; /* Layout class type */
-
- switch(storage->type) {
- case H5D_COMPACT:
- /* Size of raw data */
- ret_value += 2;
- if(include_compact_data)
- ret_value += storage->u.compact.size;/* data for compact dataset */
- break;
-
- case H5D_CONTIGUOUS:
- ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
- ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */
- break;
-
- case H5D_CHUNKED:
- ret_value += 1 + /* Chunk feature flags */
- 1; /* Chunk index type */
- ret_value += H5F_SIZEOF_ADDR(f); /* Chunk index address or data address */
- break;
-
- default:
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid layout class")
- } /* end switch */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_storage_meta_size() */
-
diff --git a/src/Makefile.am b/src/Makefile.am
index 83eeaef..77c8ee5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -88,7 +88,6 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Osdspace.c H5Oshared.c \
H5Oshmesg.c \
H5Ostab.c \
- H5Ostorage.c \
H5Otest.c H5Ounknown.c \
H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \
H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \
diff --git a/test/earray.c b/test/earray.c
index 983e6b9..44ad901 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -201,6 +201,7 @@ const H5AC_class_t H5AC_EARRAY_TEST[1] = {{
/* mem_type */ H5FD_MEM_DEFAULT,
/* flags */ H5AC__CLASS_NO_IO_FLAG,
/* get_load_size */ (H5AC_get_load_size_func_t)earray_cache_test_get_load_size,
+ /* varify_chksum */ (H5AC_verify_chksum_func_t)NULL,
/* deserialize */ (H5AC_deserialize_func_t)earray_cache_test_deserialize,
/* image_len */ (H5AC_image_len_func_t)earray_cache_test_image_len,
/* pre_serialize */ (H5AC_pre_serialize_func_t)NULL,
diff --git a/tools/h5format_convert/testfiles/h5fc_all.h5 b/tools/h5format_convert/testfiles/h5fc_all.h5
index 26e682d..23cc077 100644
--- a/tools/h5format_convert/testfiles/h5fc_all.h5
+++ b/tools/h5format_convert/testfiles/h5fc_all.h5
Binary files differ
diff --git a/tools/h5format_convert/testfiles/h5fc_edge.h5 b/tools/h5format_convert/testfiles/h5fc_edge.h5
index 2a1ab10..b3d4b37 100644
--- a/tools/h5format_convert/testfiles/h5fc_edge.h5
+++ b/tools/h5format_convert/testfiles/h5fc_edge.h5
Binary files differ
diff --git a/tools/h5format_convert/testfiles/h5fc_new.h5 b/tools/h5format_convert/testfiles/h5fc_new.h5
index fe910fa..aa9c7eb 100644
--- a/tools/h5format_convert/testfiles/h5fc_new.h5
+++ b/tools/h5format_convert/testfiles/h5fc_new.h5
Binary files differ
diff --git a/tools/h5stat/testfiles/h5stat_idx.ddl b/tools/h5stat/testfiles/h5stat_idx.ddl
index f4403d1..fe53b4a 100644
--- a/tools/h5stat/testfiles/h5stat_idx.ddl
+++ b/tools/h5stat/testfiles/h5stat_idx.ddl
@@ -13,7 +13,7 @@ File space information for file metadata (in bytes):
User block: 0
Object headers: (total/unused)
Groups: 147/47
- Datasets(exclude compact data): 568/346
+ Datasets(exclude compact data): 568/362
Datatypes: 0/0
Groups:
B-tree/List: 0
diff --git a/tools/h5stat/testfiles/h5stat_idx.h5 b/tools/h5stat/testfiles/h5stat_idx.h5
index f667a6f..76e4ba3 100644
--- a/tools/h5stat/testfiles/h5stat_idx.h5
+++ b/tools/h5stat/testfiles/h5stat_idx.h5
Binary files differ