summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5D.c16
-rw-r--r--src/H5Ofill.c335
-rw-r--r--src/H5Oprivate.h22
-rw-r--r--src/H5Pdcpl.c2
4 files changed, 193 insertions, 182 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 13dad99..a6b9a52 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1499,13 +1499,17 @@ H5D_create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
/* Get the dataset's external file list information */
if(H5P_get(dc_plist, H5D_CRT_EXT_FILE_LIST_NAME, &new_dset->shared->dcpl_cache.efl) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve external file list")
+ } /* end if */
- /* Set the latest version of the pline & fill messages, if requested */
- if(H5F_USE_LATEST_FORMAT(file)) {
- /* Set the latest version for the I/O pipeline message */
- if(H5Z_set_latest_version(pline) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline")
- } /* end if */
+ /* Set the latest version of the pline & fill messages, if requested */
+ if(H5F_USE_LATEST_FORMAT(file)) {
+ /* Set the latest version for the I/O pipeline message */
+ if(H5Z_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline")
+
+ /* Set the latest version for the fill value message */
+ if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value")
} /* end if */
/* Check if this dataset is going into a parallel file and set space allocation time */
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index e54ae44..08f0d39 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -148,18 +148,6 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
H5O_fill_new_shared_debug /*debug the message */
}};
-/* Initial version of the "old" fill value information */
-/* (It doesn't look like this value was ever used in the file -QAK) */
-#define H5O_FILL_VERSION_1 1
-/* Revised version of the "new" fill value information */
-#define H5O_FILL_VERSION_2 2
-/* Version of the "new" fill value information with smaller default format */
-#define H5O_FILL_VERSION_3 3
-
-/* The latest version of the format. Look through the 'encode', 'decode'
- * and 'size' callback for places to change when updating this. */
-#define H5O_FILL_VERSION_LATEST H5O_FILL_VERSION_3
-
/* Masks, shift values & flags for fill value message */
#define H5O_FILL_MASK_ALLOC_TIME 0x03
#define H5O_FILL_SHIFT_ALLOC_TIME 0
@@ -195,8 +183,7 @@ static void *
H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags,
const uint8_t *p)
{
- H5O_fill_t *mesg = NULL;
- unsigned version; /* Version of format */
+ H5O_fill_t *fill = NULL;
void *ret_value;
FUNC_ENTER_NOAPI_NOINIT(H5O_fill_new_decode)
@@ -204,37 +191,37 @@ H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_
HDassert(f);
HDassert(p);
- if(NULL == (mesg = H5FL_CALLOC(H5O_fill_t)))
+ if(NULL == (fill = H5FL_CALLOC(H5O_fill_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
/* Version */
- version = *p++;
- if(version < H5O_FILL_VERSION_1 || version > H5O_FILL_VERSION_LATEST)
+ fill->version = *p++;
+ if(fill->version < H5O_FILL_VERSION_1 || fill->version > H5O_FILL_VERSION_LATEST)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for fill value message")
/* Decode each version */
- if(version < H5O_FILL_VERSION_3) {
+ if(fill->version < H5O_FILL_VERSION_3) {
/* Space allocation time */
- mesg->alloc_time = (H5D_alloc_time_t)*p++;
+ fill->alloc_time = (H5D_alloc_time_t)*p++;
/* Fill value write time */
- mesg->fill_time = (H5D_fill_time_t)*p++;
+ fill->fill_time = (H5D_fill_time_t)*p++;
/* Whether fill value is defined */
- mesg->fill_defined = *p++;
+ fill->fill_defined = *p++;
/* Only decode fill value information if one is defined */
- if(mesg->fill_defined) {
- INT32DECODE(p, mesg->size);
- if(mesg->size > 0) {
- H5_CHECK_OVERFLOW(mesg->size, ssize_t, size_t);
- if(NULL == (mesg->buf = H5MM_malloc((size_t)mesg->size)))
+ if(fill->fill_defined) {
+ INT32DECODE(p, fill->size);
+ if(fill->size > 0) {
+ H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t);
+ if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(mesg->buf, p, (size_t)mesg->size);
+ HDmemcpy(fill->buf, p, (size_t)fill->size);
} /* end if */
} /* end if */
else
- mesg->size = (-1);
+ fill->size = (-1);
} /* end if */
else {
unsigned flags; /* Status flags */
@@ -247,10 +234,10 @@ H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unknown flag for fill value message")
/* Space allocation time */
- mesg->alloc_time = (flags >> H5O_FILL_SHIFT_ALLOC_TIME) & H5O_FILL_MASK_ALLOC_TIME;
+ fill->alloc_time = (flags >> H5O_FILL_SHIFT_ALLOC_TIME) & H5O_FILL_MASK_ALLOC_TIME;
/* Fill value write time */
- mesg->fill_time = (flags >> H5O_FILL_SHIFT_FILL_TIME) & H5O_FILL_MASK_FILL_TIME;
+ fill->fill_time = (flags >> H5O_FILL_SHIFT_FILL_TIME) & H5O_FILL_MASK_FILL_TIME;
/* Check for undefined fill value */
if(flags & H5O_FILL_FLAG_UNDEFINED_VALUE) {
@@ -258,35 +245,35 @@ H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_
HDassert(!(flags & H5O_FILL_FLAG_HAVE_VALUE));
/* Set value for "undefined" fill value */
- mesg->size = (-1);
+ fill->size = (-1);
} /* end if */
else if(flags & H5O_FILL_FLAG_HAVE_VALUE) {
/* Fill value size */
- UINT32DECODE(p, mesg->size);
+ UINT32DECODE(p, fill->size);
/* Fill value */
- H5_CHECK_OVERFLOW(mesg->size, ssize_t, size_t);
- if(NULL == (mesg->buf = H5MM_malloc((size_t)mesg->size)))
+ H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t);
+ if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(mesg->buf, p, (size_t)mesg->size);
+ HDmemcpy(fill->buf, p, (size_t)fill->size);
/* Set the "defined" flag */
- mesg->fill_defined = TRUE;
+ fill->fill_defined = TRUE;
} /* end else */
else {
/* Set the "defined" flag */
- mesg->fill_defined = TRUE;
+ fill->fill_defined = TRUE;
} /* end else */
} /* end else */
/* Set return value */
- ret_value = (void *)mesg;
+ ret_value = (void *)fill;
done:
- if(!ret_value && mesg) {
- if(mesg->buf)
- H5MM_xfree(mesg->buf);
- H5FL_FREE(H5O_fill_t, mesg);
+ if(!ret_value && fill) {
+ if(fill->buf)
+ H5MM_xfree(fill->buf);
+ H5FL_FREE(H5O_fill_t, fill);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -310,7 +297,7 @@ static void *
H5O_fill_old_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags,
const uint8_t *p)
{
- H5O_fill_t *mesg = NULL; /* Decoded fill value message */
+ H5O_fill_t *fill = NULL; /* Decoded fill value message */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_fill_old_decode)
@@ -318,34 +305,35 @@ H5O_fill_old_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_
HDassert(f);
HDassert(p);
- if(NULL == (mesg = H5FL_CALLOC(H5O_fill_t)))
+ if(NULL == (fill = H5FL_CALLOC(H5O_fill_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
/* Set non-zero default fields */
- mesg->alloc_time = H5D_ALLOC_TIME_LATE;
- mesg->fill_time = H5D_FILL_TIME_IFSET;
+ fill->version = H5O_FILL_VERSION_2;
+ fill->alloc_time = H5D_ALLOC_TIME_LATE;
+ fill->fill_time = H5D_FILL_TIME_IFSET;
/* Fill value size */
- UINT32DECODE(p, mesg->size);
+ UINT32DECODE(p, fill->size);
/* Only decode the fill value itself if there is one */
- if(mesg->size > 0) {
- if(NULL == (mesg->buf = H5MM_malloc((size_t)mesg->size)))
+ if(fill->size > 0) {
+ if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(mesg->buf, p, (size_t)mesg->size);
- mesg->fill_defined = TRUE;
+ HDmemcpy(fill->buf, p, (size_t)fill->size);
+ fill->fill_defined = TRUE;
} /* end if */
else
- mesg->size = (-1);
+ fill->size = (-1);
/* Set return value */
- ret_value = (void*)mesg;
+ ret_value = (void*)fill;
done:
- if(!ret_value && mesg) {
- if(mesg->buf)
- H5MM_xfree(mesg->buf);
- H5FL_FREE(H5O_fill_t, mesg);
+ if(!ret_value && fill) {
+ if(fill->buf)
+ H5MM_xfree(fill->buf);
+ H5FL_FREE(H5O_fill_t, fill);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -367,47 +355,36 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg)
+H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_fill)
{
- unsigned version; /* Version of format */
- hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
- const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
+ const H5O_fill_t *fill = (const H5O_fill_t *)_fill;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_encode)
HDassert(f);
HDassert(p);
- HDassert(mesg && NULL == mesg->type);
-
- /* Get the file's 'use the latest version of the format' flag */
- use_latest_format = H5F_USE_LATEST_FORMAT(f);
-
- /* Check which version to write out */
- if(use_latest_format)
- version = H5O_FILL_VERSION_LATEST; /* Write out latest version of format */
- else
- version = H5O_FILL_VERSION_2;
+ HDassert(fill && NULL == fill->type);
/* Version */
- *p++ = (uint8_t)version;
+ *p++ = (uint8_t)fill->version;
- if(version < H5O_FILL_VERSION_3) {
+ if(fill->version < H5O_FILL_VERSION_3) {
/* Space allocation time */
- *p++ = mesg->alloc_time;
+ *p++ = fill->alloc_time;
/* Fill value writing time */
- *p++ = mesg->fill_time;
+ *p++ = fill->fill_time;
/* Whether fill value is defined */
- *p++ = mesg->fill_defined;
+ *p++ = fill->fill_defined;
/* Only write out the size and fill value if it is defined */
- if(mesg->fill_defined) {
- UINT32ENCODE(p, mesg->size);
- if(mesg->size > 0)
- if(mesg->buf) {
- H5_CHECK_OVERFLOW(mesg->size, ssize_t, size_t);
- HDmemcpy(p, mesg->buf, (size_t)mesg->size);
+ if(fill->fill_defined) {
+ UINT32ENCODE(p, fill->size);
+ if(fill->size > 0)
+ if(fill->buf) {
+ H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t);
+ HDmemcpy(p, fill->buf, (size_t)fill->size);
} /* end if */
} /* end if */
} /* end if */
@@ -415,15 +392,15 @@ H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg)
uint8_t flags = 0; /* Fill value setting flags */
/* Encode space allocation time */
- HDassert(mesg->alloc_time == (H5O_FILL_MASK_ALLOC_TIME & mesg->alloc_time));
- flags |= (H5O_FILL_MASK_ALLOC_TIME & mesg->alloc_time) << H5O_FILL_SHIFT_ALLOC_TIME;
+ HDassert(fill->alloc_time == (H5O_FILL_MASK_ALLOC_TIME & fill->alloc_time));
+ flags |= (H5O_FILL_MASK_ALLOC_TIME & fill->alloc_time) << H5O_FILL_SHIFT_ALLOC_TIME;
/* Encode fill value writing time */
- HDassert(mesg->fill_time == (H5O_FILL_MASK_FILL_TIME & mesg->fill_time));
- flags |= (H5O_FILL_MASK_FILL_TIME & mesg->fill_time) << H5O_FILL_SHIFT_FILL_TIME;
+ HDassert(fill->fill_time == (H5O_FILL_MASK_FILL_TIME & fill->fill_time));
+ flags |= (H5O_FILL_MASK_FILL_TIME & fill->fill_time) << H5O_FILL_SHIFT_FILL_TIME;
/* Check if we need to encode a fill value size */
- if(mesg->size < 0) {
+ if(fill->size < 0) {
/* Indicate that the fill value has been "undefined" by the user */
flags |= H5O_FILL_FLAG_UNDEFINED_VALUE;
@@ -431,9 +408,9 @@ H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg)
*p++ = (uint8_t)flags;
/* Sanity check */
- HDassert(!mesg->buf);
+ HDassert(!fill->buf);
} /* end if */
- else if(mesg->size > 0) {
+ else if(fill->size > 0) {
/* Indicate that a fill value size is present */
flags |= H5O_FILL_FLAG_HAVE_VALUE;
@@ -441,19 +418,19 @@ H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg)
*p++ = (uint8_t)flags;
/* Encode the size of fill value */
- INT32ENCODE(p, mesg->size);
+ INT32ENCODE(p, fill->size);
/* Encode the fill value */
- HDassert(mesg->buf);
- H5_CHECK_OVERFLOW(mesg->size, ssize_t, size_t);
- HDmemcpy(p, mesg->buf, (size_t)mesg->size);
+ HDassert(fill->buf);
+ H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t);
+ HDmemcpy(p, fill->buf, (size_t)fill->size);
} /* end if */
else {
/* Flags */
*p++ = (uint8_t)flags;
/* Sanity check */
- HDassert(!mesg->buf);
+ HDassert(!fill->buf);
} /* end else */
} /* end else */
@@ -474,19 +451,19 @@ H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_fill_old_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
+H5O_fill_old_encode(H5F_t UNUSED *f, uint8_t *p, const void *_fill)
{
- const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
+ const H5O_fill_t *fill = (const H5O_fill_t *)_fill;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_old_encode)
HDassert(f);
HDassert(p);
- HDassert(mesg && NULL == mesg->type);
+ HDassert(fill && NULL == fill->type);
- UINT32ENCODE(p, mesg->size);
- if(mesg->buf)
- HDmemcpy(p, mesg->buf, (size_t)mesg->size);
+ UINT32ENCODE(p, fill->size);
+ if(fill->buf)
+ HDmemcpy(p, fill->buf, (size_t)fill->size);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_fill_old_encode() */
@@ -509,44 +486,44 @@ H5O_fill_old_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
*-------------------------------------------------------------------------
*/
static void *
-H5O_fill_copy(const void *_mesg, void *_dest)
+H5O_fill_copy(const void *_src, void *_dst)
{
- const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
- H5O_fill_t *dest = (H5O_fill_t *)_dest;
+ const H5O_fill_t *src = (const H5O_fill_t *)_src;
+ H5O_fill_t *dst = (H5O_fill_t *)_dst;
void *ret_value;
FUNC_ENTER_NOAPI_NOINIT(H5O_fill_copy)
- HDassert(mesg);
+ HDassert(src);
- if(!dest && NULL == (dest = H5FL_MALLOC(H5O_fill_t)))
+ if(!dst && NULL == (dst = H5FL_MALLOC(H5O_fill_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
/* Shallow copy basic fields */
- *dest = *mesg;
+ *dst = *src;
/* Copy data type of fill value */
- if(mesg->type) {
- if(NULL == (dest->type = H5T_copy(mesg->type, H5T_COPY_TRANSIENT)))
+ if(src->type) {
+ if(NULL == (dst->type = H5T_copy(src->type, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy fill value data type")
} /* end if */
else
- dest->type = NULL;
+ dst->type = NULL;
/* Copy fill value and its size */
- if(mesg->buf) {
- H5_CHECK_OVERFLOW(mesg->size, ssize_t, size_t);
- if(NULL == (dest->buf = H5MM_malloc((size_t)mesg->size)))
+ if(src->buf) {
+ H5_CHECK_OVERFLOW(src->size, ssize_t, size_t);
+ if(NULL == (dst->buf = H5MM_malloc((size_t)src->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(dest->buf, mesg->buf, (size_t)mesg->size);
+ HDmemcpy(dst->buf, src->buf, (size_t)src->size);
/* Check for needing to convert/copy fill value */
- if(mesg->type) {
+ if(src->type) {
H5T_path_t *tpath; /* Conversion information */
/* Set up type conversion function */
- if(NULL == (tpath = H5T_path_find(mesg->type, dest->type, NULL, NULL, H5AC_ind_dxpl_id, FALSE)))
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "unable to convert between src and dest data types")
+ if(NULL == (tpath = H5T_path_find(src->type, dst->type, NULL, NULL, H5AC_ind_dxpl_id, FALSE)))
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "unable to convert between src and dst data types")
/* If necessary, convert fill value datatypes (which copies VL components, etc.) */
if(!H5T_path_noop(tpath)) {
@@ -555,17 +532,17 @@ H5O_fill_copy(const void *_mesg, void *_dest)
size_t bkg_size; /* Size of background buffer */
/* Wrap copies of types to convert */
- dst_id = H5I_register(H5I_DATATYPE, H5T_copy(dest->type, H5T_COPY_TRANSIENT));
+ dst_id = H5I_register(H5I_DATATYPE, H5T_copy(dst->type, H5T_COPY_TRANSIENT));
if(dst_id < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy/register datatype")
- src_id = H5I_register(H5I_DATATYPE, H5T_copy(mesg->type, H5T_COPY_ALL));
+ src_id = H5I_register(H5I_DATATYPE, H5T_copy(src->type, H5T_COPY_ALL));
if(src_id < 0) {
H5I_dec_ref(dst_id);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy/register datatype")
} /* end if */
/* Allocate a background buffer */
- bkg_size = MAX(H5T_get_size(dest->type), H5T_get_size(mesg->type));
+ bkg_size = MAX(H5T_get_size(dst->type), H5T_get_size(src->type));
if(H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size))) {
H5I_dec_ref(src_id);
H5I_dec_ref(dst_id);
@@ -573,7 +550,7 @@ H5O_fill_copy(const void *_mesg, void *_dest)
} /* end if */
/* Convert fill value */
- if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, dest->buf, bkg_buf, H5AC_ind_dxpl_id) < 0) {
+ if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, dst->buf, bkg_buf, H5AC_ind_dxpl_id) < 0) {
H5I_dec_ref(src_id);
H5I_dec_ref(dst_id);
if(bkg_buf)
@@ -590,19 +567,19 @@ H5O_fill_copy(const void *_mesg, void *_dest)
} /* end if */
} /* end if */
else
- dest->buf = NULL;
+ dst->buf = NULL;
/* Set return value */
- ret_value = dest;
+ ret_value = dst;
done:
- if(!ret_value && dest) {
- if(dest->buf)
- H5MM_xfree(dest->buf);
- if(dest->type)
- H5T_close(dest->type);
- if(!_dest)
- H5FL_FREE(H5O_fill_t, dest);
+ if(!ret_value && dst) {
+ if(dst->buf)
+ H5MM_xfree(dst->buf);
+ if(dst->type)
+ H5T_close(dst->type);
+ if(!_dst)
+ H5FL_FREE(H5O_fill_t, dst);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -627,43 +604,32 @@ done:
*-------------------------------------------------------------------------
*/
static size_t
-H5O_fill_new_size(const H5F_t *f, const void *_mesg)
+H5O_fill_new_size(const H5F_t *f, const void *_fill)
{
- const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
- unsigned version; /* Version of format */
- hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
+ const H5O_fill_t *fill = (const H5O_fill_t *)_fill;
size_t ret_value;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_size)
HDassert(f);
- HDassert(mesg);
-
- /* Get the file's 'use the latest version of the format' flag */
- use_latest_format = H5F_USE_LATEST_FORMAT(f);
-
- /* Check which version to write out */
- if(use_latest_format)
- version = H5O_FILL_VERSION_LATEST; /* Write out latest version of format */
- else
- version = H5O_FILL_VERSION_2;
+ HDassert(fill);
/* Determine size for different versions */
- if(version < H5O_FILL_VERSION_3) {
+ if(fill->version < H5O_FILL_VERSION_3) {
ret_value = 1 + /* Version number */
1 + /* Space allocation time */
1 + /* Fill value write time */
1; /* Fill value defined */
- if(mesg->fill_defined)
+ if(fill->fill_defined)
ret_value += 4 + /* Fill value size */
- (mesg->size > 0 ? mesg->size : 0); /* Size of fill value */
+ (fill->size > 0 ? fill->size : 0); /* Size of fill value */
} /* end if */
else {
ret_value = 1 + /* Version number */
1; /* Status flags */
- if(mesg->size > 0)
+ if(fill->size > 0)
ret_value += 4 + /* Fill value size */
- mesg->size; /* Size of fill value */
+ fill->size; /* Size of fill value */
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
@@ -686,15 +652,15 @@ H5O_fill_new_size(const H5F_t *f, const void *_mesg)
*-------------------------------------------------------------------------
*/
static size_t
-H5O_fill_old_size(const H5F_t UNUSED *f, const void *_mesg)
+H5O_fill_old_size(const H5F_t UNUSED *f, const void *_fill)
{
- const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
+ const H5O_fill_t *fill = (const H5O_fill_t *)_fill;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_old_size)
- HDassert(mesg);
+ HDassert(fill);
- FUNC_LEAVE_NOAPI(4 + mesg->size)
+ FUNC_LEAVE_NOAPI(4 + fill->size)
} /* end H5O_fill_old_size() */
@@ -776,21 +742,21 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_fill_reset(void *_mesg)
+H5O_fill_reset(void *_fill)
{
- H5O_fill_t *mesg = (H5O_fill_t *)_mesg;
+ H5O_fill_t *fill = (H5O_fill_t *)_fill;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_reset)
- HDassert(mesg);
+ HDassert(fill);
/* Reset dynamic fields */
- H5O_fill_reset_dyn(mesg);
+ H5O_fill_reset_dyn(fill);
/* Reset value fields */
- mesg->alloc_time = H5D_ALLOC_TIME_LATE;
- mesg->fill_time = H5D_FILL_TIME_IFSET;
- mesg->fill_defined = FALSE;
+ fill->alloc_time = H5D_ALLOC_TIME_LATE;
+ fill->fill_time = H5D_FILL_TIME_IFSET;
+ fill->fill_defined = FALSE;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_fill_reset() */
@@ -809,13 +775,13 @@ H5O_fill_reset(void *_mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_fill_free(void *mesg)
+H5O_fill_free(void *fill)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_free)
- HDassert(mesg);
+ HDassert(fill);
- H5FL_FREE(H5O_fill_t, mesg);
+ H5FL_FREE(H5O_fill_t, fill);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_fill_free() */
@@ -834,22 +800,22 @@ H5O_fill_free(void *mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *stream,
+H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_fill, FILE *stream,
int indent, int fwidth)
{
- const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
+ const H5O_fill_t *fill = (const H5O_fill_t *)_fill;
H5D_fill_value_t fill_status; /* Whether the fill value is defined */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_debug)
HDassert(f);
- HDassert(mesg);
+ HDassert(fill);
HDassert(stream);
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Space Allocation Time:");
- switch(mesg->alloc_time) {
+ switch(fill->alloc_time) {
case H5D_ALLOC_TIME_EARLY:
fprintf(stream,"Early\n");
break;
@@ -868,7 +834,7 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *s
} /* end switch */
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Time:");
- switch(mesg->fill_time) {
+ switch(fill->fill_time) {
case H5D_FILL_TIME_ALLOC:
fprintf(stream,"On Allocation\n");
break;
@@ -887,7 +853,7 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *s
} /* end switch */
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Value Defined:");
- H5P_is_fill_value_defined((const H5O_fill_t *)mesg, &fill_status);
+ H5P_is_fill_value_defined((const H5O_fill_t *)fill, &fill_status);
switch(fill_status) {
case H5D_FILL_VALUE_UNDEFINED:
fprintf(stream,"Undefined\n");
@@ -907,10 +873,10 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *s
} /* end switch */
HDfprintf(stream, "%*s%-*s %Zd\n", indent, "", fwidth,
- "Size:", mesg->size);
+ "Size:", fill->size);
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:");
- if(mesg->type) {
- H5T_debug(mesg->type, stream);
+ if(fill->type) {
+ H5T_debug(fill->type, stream);
fprintf(stream, "\n");
} /* end if */
else
@@ -1021,3 +987,30 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5O_fill_convert() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_fill_set_latest_version
+ *
+ * Purpose: Set the encoding for a fill value to the latest version.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, July 24, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_fill_set_latest_version(H5O_fill_t *fill)
+{
+ FUNC_ENTER_NOAPI_NOFUNC(H5O_fill_set_latest_version)
+
+ /* Sanity check */
+ HDassert(fill);
+
+ /* Set encoding of fill value to latest version */
+ fill->version = H5O_FILL_VERSION_LATEST;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_fill_set_latest_version() */
+
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 737237b..06c5ebf 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -232,18 +232,31 @@ typedef struct H5O_linfo_t {
haddr_t name_bt2_addr; /* Address of v2 B-tree for indexing names of links */
} H5O_linfo_t;
+/* Initial version of the "old" fill value information */
+/* (It doesn't look like this value was ever used in the file -QAK) */
+#define H5O_FILL_VERSION_1 1
+/* Revised version of the "new" fill value information */
+#define H5O_FILL_VERSION_2 2
+/* Version of the "new" fill value information with smaller default format */
+#define H5O_FILL_VERSION_3 3
+
+/* The latest version of the format. Look through the 'encode', 'decode'
+ * and 'size' callback for places to change when updating this. */
+#define H5O_FILL_VERSION_LATEST H5O_FILL_VERSION_3
+
/*
- * New Fill Value Message.
+ * Fill Value Message.
* (Data structure in memory for both "old" and "new" fill value messages)
*
- * The new fill value message is fill value plus
- * space allocation time, fill value writing time, whether fill
- * value is defined, and the location of the message if it's shared
+ * The fill value message is fill value plus space allocation time, fill value
+ * writing time, whether fill value is defined, and the location of the
+ * message if it's shared.
*/
typedef struct H5O_fill_t {
H5O_shared_t sh_loc; /* Shared message info (must be first) */
+ unsigned version; /* Encoding version number */
H5T_t *type; /*type. Null implies same as dataset */
ssize_t size; /*number of bytes in the fill value */
void *buf; /*the fill value */
@@ -609,6 +622,7 @@ H5_DLL hsize_t H5O_efl_total_size(H5O_efl_t *efl);
/* Fill value operators */
H5_DLL herr_t H5O_fill_reset_dyn(H5O_fill_t *fill);
H5_DLL herr_t H5O_fill_convert(H5O_fill_t *fill, H5T_t *type, hbool_t *fill_changed, hid_t dxpl_id);
+H5_DLL herr_t H5O_fill_set_latest_version(H5O_fill_t *fill);
/* Link operators */
H5_DLL herr_t H5O_link_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 17c019a..e9ed6c5 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -61,7 +61,7 @@
/* Definitions for fill value. size=0 means fill value will be 0 as
* library default; size=-1 means fill value is undefined. */
#define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t)
-#define H5D_CRT_FILL_VALUE_DEF {{0, NULL, H5O_NULL_ID, {{0, HADDR_UNDEF}}}, NULL, 0, NULL, H5D_ALLOC_TIME_LATE, H5D_FILL_TIME_IFSET, FALSE}
+#define H5D_CRT_FILL_VALUE_DEF {{0, NULL, H5O_NULL_ID, {{0, HADDR_UNDEF}}}, H5O_FILL_VERSION_2, NULL, 0, NULL, H5D_ALLOC_TIME_LATE, H5D_FILL_TIME_IFSET, FALSE}
#define H5D_CRT_FILL_VALUE_CMP H5P_fill_value_cmp
/* Definitions for space allocation time state */
#define H5D_CRT_ALLOC_TIME_STATE_SIZE sizeof(unsigned)