summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5Dint.c17
-rw-r--r--src/H5FD.c35
-rw-r--r--src/H5FDfamily.c27
-rw-r--r--src/H5FDmpio.c94
-rw-r--r--src/H5FDmulti.c26
-rw-r--r--src/H5FDnull.c80
-rw-r--r--src/H5FDprivate.h2
-rw-r--r--src/H5FDpublic.h2
-rw-r--r--src/H5Fmpi.c82
-rw-r--r--src/H5Fpublic.h4
-rw-r--r--src/H5Fsuper_cache.c17
-rw-r--r--src/H5Oalloc.c46
-rw-r--r--src/H5Ocopy.c3
-rw-r--r--src/H5Odbg.c31
-rw-r--r--src/H5Olayout.c10
-rw-r--r--src/H5Omessage.c5
-rw-r--r--src/H5S.c9
-rw-r--r--src/H5Ztrans.c201
-rw-r--r--src/H5public.h4
-rw-r--r--src/Makefile.in2
20 files changed, 519 insertions, 178 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index f105e0a..9a80bfc 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -1596,15 +1596,20 @@ H5D_alloc_storage(H5D_t *dset/*in,out*/, hid_t dxpl_id, H5D_time_alloc_t time_al
switch(layout->type) {
case H5D_CONTIGUOUS:
if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) {
- /* Reserve space in the file for the entire array */
- if(H5D_contig_alloc(f, dxpl_id, &layout->storage.u.contig/*out*/) < 0)
- HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage")
+ /* Check if we have a zero-sized dataset */
+ if(layout->storage.u.contig.size > 0) {
+ /* Reserve space in the file for the entire array */
+ if(H5D_contig_alloc(f, dxpl_id, &layout->storage.u.contig/*out*/) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage")
+
+ /* Indicate that we should initialize storage space */
+ must_init_space = TRUE;
+ } /* end if */
+ else
+ layout->storage.u.contig.addr = HADDR_UNDEF;
/* Indicate that we set the storage addr */
addr_set = TRUE;
-
- /* Indicate that we should initialize storage space */
- must_init_space = TRUE;
} /* end if */
break;
diff --git a/src/H5FD.c b/src/H5FD.c
index b778a46..8689dde 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -559,15 +559,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_null_sb_verify
+ * Function: H5FD_sb_verify
*
* Purpose: Verify that the driver is compatable with the driver
- * that created the file. driver_id is the driver identifier
- * field stored in the superblock. This is called when
- * reopening a file and ensures that the driver is able to
- * decode the superblock info.
- *
- * Return: Success: Non-negative
+ * that created the file. During file creation, drivers that
+ * modify the HDF5 file structure when interacting with the
+ * filesystem identify themselves in the file superblock.
+ * When the file is reopened, the opening driver must verify
+ * that it can reconstruct a logical HDF5 file from the
+ * modified structure in the filesystem.
+ *
+ * Return: Success: TRUE if the driver is compatable, else FALSE
* Failure: Negative
*
* Programmer: Jacob Gruber
@@ -575,25 +577,24 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5FD_sb_verify(H5FD_t *file, const char *driver_id)
+htri_t
+H5FD_sb_verify(H5FD_t *file, const char *sb_driver_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_sb_verify, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
HDassert(file && file->cls);
/* Delegate to the driver if possible. If driver doesn't implement
- * this function, it means that it can't support files with driver info
- * in the superblock.
+ * an sb_verify callback, the default return valyue is used,
+ * indicating incompatablility.
*/
if(file->cls->sb_verify) {
- if((file->cls->sb_verify)(file, driver_id) < 0)
+ ret_value = (file->cls->sb_verify)(file, sb_driver_id);
+ if(ret_value < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_verify request failed")
- }
- else
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver doesn't support sb_verify")
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index f8261b1..f38ec86 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -99,7 +99,7 @@ static herr_t H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/,
unsigned char *buf/*out*/);
static herr_t H5FD_family_sb_decode(H5FD_t *_file, const char *name,
const unsigned char *buf);
-static herr_t H5FD_family_sb_verify(H5FD_t *_file, const char *driver_id);
+static htri_t H5FD_family_sb_verify(H5FD_t *_file, const char *driver_id);
static H5FD_t *H5FD_family_open(const char *name, unsigned flags,
hid_t fapl_id, haddr_t maxaddr);
static herr_t H5FD_family_close(H5FD_t *_file);
@@ -706,12 +706,9 @@ done:
* Function: H5FD_family_sb_verify
*
* Purpose: Verify that the family driver is compatable with the driver
- * that created the file. driver_id is the driver identifier
- * field stored in the superblock. This is called when
- * reopening a file and ensures that the driver is able to
- * decode the superblock info.
+ * that created the file.
*
- * Return: Success: Non-negative
+ * Return: Success: TRUE if the driver is compatible, esle FALSE
* Failure: Negative
*
* Programmer: Jacob Gruber
@@ -719,20 +716,16 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5FD_family_sb_verify(H5FD_t UNUSED *_file, const char *driver_id)
+static htri_t
+H5FD_family_sb_verify(H5FD_t UNUSED *_file, const char *sb_driver_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_family_sb_verify, FAIL)
-
- if(HDstrncmp(driver_id, "NCSAfami", (size_t)8)) {
- char err_msg[128];
-
- HDsnprintf(err_msg, sizeof(err_msg), "File type %s not supported by the family driver",
- driver_id);
+ FUNC_ENTER_NOAPI(FAIL)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, err_msg)
+ /* Check if the suerblock was written by a family driver. */
+ if(HDstrncmp(sb_driver_id, "NCSAfami", (size_t)8) == 0) {
+ ret_value = TRUE;
}
done:
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 9bf972b..d4fdd4d 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -877,6 +877,100 @@ fprintf(stderr, "leaving H5FD_mpio_fapl_free\n");
/*-------------------------------------------------------------------------
+ * Function: H5FD_set_mpio_atomicity
+ *
+ * Purpose: Sets the atomicity mode
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag)
+{
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+ int mpi_code; /* MPI return code */
+ int temp_flag;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_Debug[(int)'t'])
+ fprintf(stdout, "Entering H5FD_set_mpio_atomicity\n");
+#endif
+
+ if (FALSE == flag)
+ temp_flag = 0;
+ else
+ temp_flag = 1;
+
+ /* set atomicity value */
+ if (MPI_SUCCESS != (mpi_code=MPI_File_set_atomicity(file->f, temp_flag)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_set_atomicity", mpi_code)
+
+done:
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_Debug[(int)'t'])
+ fprintf(stdout, "Leaving H5FD_set_mpio_atomicity\n");
+#endif
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_get_mpio_atomicity
+ *
+ * Purpose: Returns the atomicity mode
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag)
+{
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+ int mpi_code; /* MPI return code */
+ int temp_flag;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_Debug[(int)'t'])
+ fprintf(stdout, "Entering H5FD_get_mpio_atomicity\n");
+#endif
+
+ /* get atomicity value */
+ if (MPI_SUCCESS != (mpi_code=MPI_File_get_atomicity(file->f, &temp_flag)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_get_atomicity", mpi_code)
+
+ if (0 != temp_flag)
+ *flag = TRUE;
+ else
+ *flag = FALSE;
+
+done:
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_Debug[(int)'t'])
+ fprintf(stdout, "Leaving H5FD_get_mpio_atomicity\n");
+#endif
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5FD_mpio_open
*
* Purpose: Opens a file with name NAME. The FLAGS are a bit field with
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 03978fa..6e0df1b 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -123,7 +123,7 @@ static herr_t H5FD_multi_sb_encode(H5FD_t *file, char *name/*out*/,
unsigned char *buf/*out*/);
static herr_t H5FD_multi_sb_decode(H5FD_t *file, const char *name,
const unsigned char *buf);
-static herr_t H5FD_multi_sb_verify(H5FD_t *file, const char *driver_id);
+static htri_t H5FD_multi_sb_verify(H5FD_t *file, const char *driver_id);
static void *H5FD_multi_fapl_get(H5FD_t *file);
static void *H5FD_multi_fapl_copy(const void *_old_fa);
static herr_t H5FD_multi_fapl_free(void *_fa);
@@ -987,12 +987,9 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
* Function: H5FD_multi_sb_verify
*
* Purpose: Verify that the multi driver is compatable with the driver
- * that created the file. driver_id is the driver identifier
- * field stored in the superblock. This is called when
- * reopening a file and ensures that the driver is able to
- * decode the superblock info.
+ * that created the file.
*
- * Return: Success: Non-negative
+ * Return: Success: TRUE if the driver is compatible, else FALSE
* Failure: Negative
*
* Programmer: Jacob Gruber
@@ -1000,20 +997,17 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5FD_multi_sb_verify(H5FD_t *_file, const char *driver_id)
+static htri_t
+H5FD_multi_sb_verify(H5FD_t *_file, const char *sb_driver_id)
{
static const char *func = "H5FD_multi_sb_verify";
- if(strncmp(driver_id, "NCSAmult", (size_t)8)) {
- char err_msg[128];
-
- snprintf(err_msg, sizeof(err_msg), "File type %s not supported by the multi driver",
- driver_id);
-
- H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, err_msg, -1);
+ /* Check that the superblock was written by the multi driver */
+ if(strncmp(sb_driver_id, "NCSAmult", (size_t)8) == 0) {
+ return 1;
}
- return 0;
+
+ return 0;
} /* end H5FD_family_sb_verify() */
diff --git a/src/H5FDnull.c b/src/H5FDnull.c
index c940786..c43b3b2 100644
--- a/src/H5FDnull.c
+++ b/src/H5FDnull.c
@@ -71,7 +71,7 @@ static herr_t H5FD_null_sb_encode(H5FD_t *_file, char *name/*out*/,
unsigned char *buf/*out*/);
static herr_t H5FD_null_sb_decode(H5FD_t *_file, const char *name,
const unsigned char *buf);
-static herr_t H5FD_null_sb_verify(H5FD_t *_file, const char *driver_id);
+static htri_t H5FD_null_sb_verify(H5FD_t *_file, const char *sb_driver_id);
static H5FD_t *H5FD_null_open(const char *name, unsigned flags,
hid_t fapl_id, haddr_t maxaddr);
static herr_t H5FD_null_close(H5FD_t *_file);
@@ -149,7 +149,7 @@ static const H5FD_class_t H5FD_null_g = {
static herr_t
H5FD_null_init_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_null_init_interface)
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_LEAVE_NOAPI(H5FD_null_init())
} /* H5FD_null_init_interface() */
@@ -176,7 +176,7 @@ H5FD_null_init(void)
{
hid_t ret_value=H5FD_NULL_g; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_init, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
if (H5I_VFL!=H5Iget_type(H5FD_NULL_g))
H5FD_NULL_g = H5FD_register(&H5FD_null_g,sizeof(H5FD_class_t),FALSE);
@@ -205,7 +205,7 @@ done:
static herr_t
H5FD_null_term(void)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_null_term)
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Reset VFL ID */
H5FD_NULL_g=0;
@@ -238,7 +238,7 @@ H5Pset_fapl_null(hid_t fapl_id, hid_t inner_fapl_id)
H5FD_null_fapl_t fa={0};
H5P_genplist_t *plist; /* Property list pointer */
- FUNC_ENTER_API(H5Pset_fapl_null, FAIL)
+ FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ii", fapl_id, inner_fapl_id);
/* Check arguments */
@@ -289,7 +289,7 @@ H5Pget_fapl_null(hid_t fapl_id, hid_t *inner_fapl_id/*out*/)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pget_fapl_null, FAIL)
+ FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", fapl_id, inner_fapl_id);
/* Check arguments */
@@ -335,7 +335,7 @@ H5FD_null_fapl_get(H5FD_t *_file)
H5P_genplist_t *plist; /* Property list pointer */
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_fapl_get, NULL)
+ FUNC_ENTER_NOAPI(NULL)
/* Check agruments */
if(NULL == (fa = (H5FD_null_fapl_t *)H5MM_calloc(sizeof(H5FD_null_fapl_t))))
@@ -380,7 +380,7 @@ H5FD_null_fapl_copy(const void *_old_fa)
H5P_genplist_t *plist; /* Property list pointer */
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_fapl_copy, NULL)
+ FUNC_ENTER_NOAPI(NULL)
/* Allocate memory for copy */
if(NULL == (new_fa = (H5FD_null_fapl_t *)H5MM_malloc(sizeof(H5FD_null_fapl_t))))
@@ -433,7 +433,7 @@ H5FD_null_fapl_free(void *_fa)
H5FD_null_fapl_t *fa = (H5FD_null_fapl_t*)_fa;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_fapl_free, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
/* Free the iner FAPL */
if(H5I_dec_ref(fa->inner_fapl_id) < 0)
@@ -468,7 +468,7 @@ H5FD_null_dxpl_copy(const void *_old_dx)
H5P_genplist_t *plist; /* Property list pointer */
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_dxpl_copy, NULL)
+ FUNC_ENTER_NOAPI(NULL)
/* Allocate memoryfor copy */
if(NULL == (new_dx = (H5FD_null_dxpl_t *)H5MM_malloc(sizeof(H5FD_null_dxpl_t))))
@@ -520,7 +520,7 @@ H5FD_null_dxpl_free(void *_dx)
H5FD_null_dxpl_t *dx = (H5FD_null_dxpl_t*)_dx;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_dxpl_free, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
/* Free the DXPL */
if(H5I_dec_ref(dx->inner_dxpl_id) < 0)
@@ -557,7 +557,7 @@ H5FD_null_sb_size(H5FD_t *_file)
H5FD_null_t *file = (H5FD_null_t*)_file;
hsize_t ret_value = 0; /*size of header*/
- FUNC_ENTER_NOAPI(H5FD_null_sb_size, UFAIL)
+ FUNC_ENTER_NOAPI(UFAIL)
HDassert(file);
@@ -591,7 +591,7 @@ H5FD_null_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/)
H5FD_null_t *file = (H5FD_null_t*)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5FD_null_sb_encode, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
HDassert(file);
@@ -624,7 +624,7 @@ H5FD_null_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
H5FD_null_t *file = (H5FD_null_t*)_file;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_sb_decode, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
HDassert(file);
@@ -641,13 +641,10 @@ done:
/*-------------------------------------------------------------------------
* Function: H5FD_null_sb_verify
*
- * Purpose: Verify that the inner driver is compatable with the driver
- * that created the file. driver_id is the driver identifier
- * field stored in the superblock. This is called when
- * reopening a file and ensures that the driver is able to
- * decode the superblock info.
+ * Purpose: Verify that the inner driver is compatible with the driver
+ * that created the file.
*
- * Return: Success: Non-negative
+ * Return: Success: TRUE if the driver is compatible, else FALSE
* Failure: Negative
*
* Programmer: Jacob Gruber
@@ -655,18 +652,19 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5FD_null_sb_verify(H5FD_t *_file, const char *driver_id)
+static htri_t
+H5FD_null_sb_verify(H5FD_t *_file, const char *sb_driver_id)
{
H5FD_null_t *file = (H5FD_null_t*)_file;
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_sb_verify, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
HDassert(file);
/* Delegate to the inner driver */
- if(H5FD_sb_verify(file->inner_file, driver_id) < 0)
+ ret_value = H5FD_sb_verify(file->inner_file, sb_driver_id);
+ if(ret_value < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "inner driver sb_verify failed")
done:
@@ -699,7 +697,7 @@ H5FD_null_open(const char *name, unsigned flags, hid_t fapl_id,
H5FD_null_t *file=NULL;
H5FD_t *ret_value=NULL;
- FUNC_ENTER_NOAPI(H5FD_null_open, NULL)
+ FUNC_ENTER_NOAPI(NULL)
/* Check arguments */
if(!name || !*name)
@@ -781,7 +779,7 @@ H5FD_null_close(H5FD_t *_file)
H5FD_null_t *file = (H5FD_null_t*)_file;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_close, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
/* Close the inner file */
if (H5FD_close(file->inner_file) < 0)
@@ -822,8 +820,8 @@ H5FD_null_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
const H5FD_null_t *f2 = (const H5FD_null_t*)_f2;
int ret_value = 0;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_null_cmp)
-
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
HDassert(f1);
HDassert(f2);
@@ -853,7 +851,7 @@ H5FD_null_query(const H5FD_t * _file, unsigned long *flags /* out */)
{
const H5FD_null_t *file = (const H5FD_null_t*)_file;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_null_query)
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Query the inner driver */
if(flags) {
@@ -885,7 +883,7 @@ H5FD_null_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map)
const H5FD_null_t *file = (const H5FD_null_t*)_file;
herr_t ret_value;
- FUNC_ENTER_NOAPI(H5FD_null_get_type_map, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
HDassert(file);
@@ -917,7 +915,7 @@ H5FD_null_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
hid_t inner_dxpl_id = H5P_DATASET_XFER_DEFAULT;
herr_t ret_value;
- FUNC_ENTER_NOAPI(H5FD_null_alloc, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
/*
* Get the inner data transfer property list.
@@ -966,7 +964,7 @@ H5FD_null_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsiz
hid_t inner_dxpl_id = H5P_DATASET_XFER_DEFAULT;
herr_t ret_value;
- FUNC_ENTER_NOAPI(H5FD_null_free, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
/*
* Get the inner data transfer property list.
@@ -1018,7 +1016,7 @@ H5FD_null_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
const H5FD_null_t *file = (const H5FD_null_t*)_file;
haddr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_get_eoa, HADDR_UNDEF)
+ FUNC_ENTER_NOAPI(HADDR_UNDEF)
HDassert(file);
@@ -1051,7 +1049,7 @@ H5FD_null_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
H5FD_null_t *file = (H5FD_null_t*)_file;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_set_eoa, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
HDassert(file);
@@ -1084,7 +1082,7 @@ H5FD_null_get_eof(const H5FD_t *_file)
const H5FD_null_t *file = (const H5FD_null_t*)_file;
haddr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_get_eof, HADDR_UNDEF)
+ FUNC_ENTER_NOAPI(HADDR_UNDEF)
HDassert(file);
@@ -1116,7 +1114,7 @@ H5FD_null_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle)
H5FD_null_t *file = (H5FD_null_t *)_file;
herr_t ret_value;
- FUNC_ENTER_NOAPI(H5FD_null_get_handle, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
HDassert(file);
@@ -1152,7 +1150,7 @@ H5FD_null_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size
hid_t inner_dxpl_id = H5P_DATASET_XFER_DEFAULT;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_read, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
/*
* Get the inner data transfer property list.
@@ -1204,7 +1202,7 @@ H5FD_null_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
hid_t inner_dxpl_id = H5P_DATASET_XFER_DEFAULT;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_write, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
/*
* Get the inner data transfer property list.
@@ -1253,7 +1251,7 @@ H5FD_null_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing)
hid_t inner_dxpl_id = H5P_DATASET_XFER_DEFAULT;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_flush, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
/*
* Get the inner data transfer property list.
@@ -1302,7 +1300,7 @@ H5FD_null_truncate(H5FD_t *_file, hid_t dxpl_id, unsigned closing)
hid_t inner_dxpl_id = H5P_DATASET_XFER_DEFAULT;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_null_truncate, FAIL)
+ FUNC_ENTER_NOAPI(FAIL)
/*
* Get the inner data transfer property list.
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 61538dc..4234898 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -70,7 +70,7 @@ H5_DLL H5FD_class_t *H5FD_get_class(hid_t id);
H5_DLL hsize_t H5FD_sb_size(H5FD_t *file);
H5_DLL herr_t H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf);
H5_DLL herr_t H5FD_sb_decode(H5FD_t *file, const char *name, const uint8_t *buf);
-H5_DLL herr_t H5FD_sb_verify(H5FD_t *file, const char *driver_id);
+H5_DLL herr_t H5FD_sb_verify(H5FD_t *file, const char *sb_driver_id);
H5_DLL void *H5FD_fapl_get(H5FD_t *file);
H5_DLL herr_t H5FD_fapl_open(struct H5P_genplist_t *plist, hid_t driver_id, const void *driver_info);
H5_DLL herr_t H5FD_fapl_copy(hid_t driver_id, const void *fapl, void **copied_fapl);
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index a5d8ed9..bded08e 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -236,7 +236,7 @@ typedef struct H5FD_class_t {
herr_t (*sb_encode)(H5FD_t *file, char *name/*out*/,
unsigned char *p/*out*/);
herr_t (*sb_decode)(H5FD_t *f, const char *name, const unsigned char *p);
- herr_t (*sb_verify)(H5FD_t *f, const char *name);
+ htri_t (*sb_verify)(H5FD_t *file, const char *sb_driver_id);
size_t fapl_size;
void * (*fapl_get)(H5FD_t *file);
void * (*fapl_copy)(const void *fapl);
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c
index 4fd04f6..0f612be 100644
--- a/src/H5Fmpi.c
+++ b/src/H5Fmpi.c
@@ -38,6 +38,8 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FDmpi.h" /* MPI-based file drivers */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Iprivate.h" /* IDs */
/****************/
@@ -177,5 +179,85 @@ H5F_mpi_get_size(const H5F_t *f)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_mpi_get_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fset_mpi_atomicity
+ *
+ * Purpose: Sets the atomicity mode
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag)
+{
+ H5F_t *file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "iMi", file_id, flag);
+
+ /* Check args */
+ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+
+ /* Check VFD */
+ if(!IS_H5FD_MPIO(file))
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, must use MPI-I/O driver")
+
+ /* set atomicity value */
+ if (H5FD_set_mpio_atomicity (file->shared->lf, flag) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set atomicity flag")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fget_mpi_atomicity
+ *
+ * Purpose: Returns the atomicity mode
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * Feb 14, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag)
+{
+ H5F_t *file;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "iMi", file_id, flag);
+
+ /* Check args */
+ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+
+ /* Check VFD */
+ if(!IS_H5FD_MPIO(file))
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, must use MPI-I/O driver")
+
+ /* get atomicity value */
+ if (H5FD_get_mpio_atomicity (file->shared->lf, flag) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get atomicity flag")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+}
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 75a3547..d88538b 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -208,6 +208,10 @@ H5_DLL herr_t H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo);
H5_DLL ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type,
size_t nsects, H5F_sect_info_t *sect_info/*out*/);
H5_DLL herr_t H5Fclear_elink_file_cache(hid_t file_id);
+#ifdef H5_HAVE_PARALLEL
+H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
+H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
+#endif /* H5_HAVE_PARALLEL */
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index da914b4..10ee11f 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -128,6 +128,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
uint8_t *p; /* Temporary pointer into encoding buffer */
unsigned super_vers; /* Superblock version */
hbool_t *dirtied = (hbool_t *)_udata; /* Set up dirtied out value */
+ htri_t sb_verify_result; /* Result of sb_verify call */
H5F_super_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -360,10 +361,10 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
drv_name[8] = '\0';
p += 8; /* advance past name/version */
- /* Check if driver matches driver information saved. Unfortunately, we can't push this
- * function to each specific driver because we're checking if the driver is correct.
- */
- if(H5FD_sb_verify(lf, drv_name) < 0)
+ /* Check if the driver is compatible with the driver information saved. */
+ if((sb_verify_result = H5FD_sb_verify(lf, drv_name)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine driver compatability")
+ else if(sb_verify_result == 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "driver does not support this file")
/* Read in variable-sized portion of driver info block */
@@ -520,10 +521,10 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
if(NULL == H5O_msg_read(&ext_loc, H5O_DRVINFO_ID, &drvinfo, dxpl_id))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "driver info message not present")
- /* Check if driver matches driver information saved. Unfortunately, we can't push this
- * function to each specific driver because we're checking if the driver is correct.
- */
- if(H5FD_sb_verify(lf, drvinfo.name) < 0)
+ /* Check if the driver is compatible with the driver information saved. */
+ if((sb_verify_result = H5FD_sb_verify(lf, drvinfo.name)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine driver compatability")
+ else if(sb_verify_result == 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "driver does not support this file")
/* Decode driver information */
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index a21c2b8..05322af 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -559,26 +559,27 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
/* Check for changing the chunk #0 data size enough to need adjusting the flags */
if(oh->version > H5O_VERSION_1 && chunkno == 0) {
uint64_t chunk0_size; /* Size of chunk 0's data */
+ size_t orig_prfx_size = (size_t)1 << (oh->flags & H5O_HDR_CHUNK0_SIZE); /* Original prefix size */
HDassert(oh->chunk[0].size >= (size_t)H5O_SIZEOF_HDR(oh));
chunk0_size = oh->chunk[0].size - (size_t)H5O_SIZEOF_HDR(oh);
- /* Check for moving from a 1-byte to a 2-byte size encoding */
- if(chunk0_size <= 255 && (chunk0_size + delta) > 255) {
- extra_prfx_size = 1;
- new_size_flags = H5O_HDR_CHUNK0_2;
+ /* Check for moving to a 8-byte size encoding */
+ if(orig_prfx_size < 8 && (chunk0_size + delta) > 4294967295) {
+ extra_prfx_size = 8 - orig_prfx_size;
+ new_size_flags = H5O_HDR_CHUNK0_8;
adjust_size_flags = TRUE;
} /* end if */
- /* Check for moving from a 2-byte to a 4-byte size encoding */
- else if(chunk0_size <= 65535 && (chunk0_size + delta) > 65535) {
- extra_prfx_size = 2;
+ /* Check for moving to a 4-byte size encoding */
+ else if(orig_prfx_size < 4 && (chunk0_size + delta) > 65535) {
+ extra_prfx_size = 4 - orig_prfx_size;
new_size_flags = H5O_HDR_CHUNK0_4;
adjust_size_flags = TRUE;
} /* end if */
- /* Check for moving from a 4-byte to a 8-byte size encoding */
- else if(chunk0_size <= 4294967295 && (chunk0_size + delta) > 4294967295) {
- extra_prfx_size = 4;
- new_size_flags = H5O_HDR_CHUNK0_8;
+ /* Check for moving to a 2-byte size encoding */
+ else if(orig_prfx_size < 2 && (chunk0_size + delta) > 255) {
+ extra_prfx_size = 2 - orig_prfx_size;
+ new_size_flags = H5O_HDR_CHUNK0_2;
adjust_size_flags = TRUE;
} /* end if */
} /* end if */
@@ -646,17 +647,18 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
/* Wipe new space for chunk */
HDmemset(oh->chunk[chunkno].image + old_size, 0, oh->chunk[chunkno].size - old_size);
+ /* Move chunk 0 data up if the size flags changed */
+ if(adjust_size_flags)
+ HDmemmove(oh->chunk[0].image + H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh),
+ oh->chunk[0].image + H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh) - extra_prfx_size,
+ old_size - (size_t)H5O_SIZEOF_HDR(oh) + extra_prfx_size);
+
/* Spin through existing messages, adjusting them */
for(u = 0; u < oh->nmesgs; u++) {
/* Adjust raw addresses for messages in this chunk to reflect new 'image' address */
- if(oh->mesg[u].chunkno == chunkno) {
+ if(oh->mesg[u].chunkno == chunkno)
oh->mesg[u].raw = oh->chunk[chunkno].image + extra_prfx_size + (oh->mesg[u].raw - old_image);
- /* Flag message as dirty directly */
- /* (we mark the entire chunk dirty when we update its size) */
- oh->mesg[u].dirty = TRUE;
- } /* endif */
-
/* Find continuation message which points to this chunk and adjust chunk's size */
/* (Chunk 0 doesn't have a continuation message that points to it and
* it's size is directly encoded in the object header) */
@@ -1330,8 +1332,9 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u)
move_end = cont_msg->raw + cont_msg->raw_size;
cont_chunkno = cont_msg->chunkno;
- /* Convert continuation message into a null message */
- if(H5O_release_mesg(f, dxpl_id, oh, cont_msg, TRUE) < 0)
+ /* Convert continuation message into a null message. Do not delete
+ * the target chunk yet, so we can still copy messages from it. */
+ if(H5O_release_mesg(f, dxpl_id, oh, cont_msg, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message")
/* Protect chunk */
@@ -1353,7 +1356,6 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u)
HDmemcpy(move_start, curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), move_size);
curr_msg->raw = move_start + H5O_SIZEOF_MSGHDR_OH(oh);
curr_msg->chunkno = cont_chunkno;
- curr_msg->dirty = TRUE;
chk_dirtied = TRUE;
/* Adjust location to move messages to */
@@ -1361,6 +1363,10 @@ H5O_move_cont(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned cont_u)
} /* end else */
} /* end if */
+ /* Delete the target chunk */
+ if(H5O_chunk_delete(f, dxpl_id, oh, deleted_chunkno) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove chunk from cache")
+
HDassert(move_start <= (move_end + gap_size));
/* Check if there is space remaining in the continuation message */
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 337287d..dd649ff 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -974,8 +974,7 @@ H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
HGOTO_ERROR(H5E_SLIST, H5E_CANTCREATE, FAIL, "cannot make skip list")
/* copy the object from the source file to the destination file */
- if(H5O_copy_header_real(oloc_src, oloc_dst, dxpl_id, &cpy_info, NULL, NULL)
- < 0)
+ if(H5O_copy_header_real(oloc_src, oloc_dst, dxpl_id, &cpy_info, NULL, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
done:
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index bd30b90..5c07b64 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -106,7 +106,7 @@ H5O_assert(const H5O_t *oh)
/* Initialize the tracking variables */
hdr_size = 0;
- meta_space = H5O_SIZEOF_HDR(oh) + (H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
+ meta_space = (size_t)H5O_SIZEOF_HDR(oh) + (size_t)(H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
mesg_space = 0;
free_space = 0;
@@ -140,7 +140,7 @@ H5O_assert(const H5O_t *oh)
/* Check for correct chunk #0 size flags */
if(oh->version > H5O_VERSION_1) {
- uint64_t chunk0_size = oh->chunk[0].size - H5O_SIZEOF_HDR(oh);
+ uint64_t chunk0_size = oh->chunk[0].size - (size_t)H5O_SIZEOF_HDR(oh);
if(chunk0_size <= 255)
HDassert((oh->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_1);
@@ -154,13 +154,21 @@ H5O_assert(const H5O_t *oh)
/* Loop over all messages in object header */
for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
+ uint8_t *curr_hdr; /* Start of current message header */
+ size_t curr_tot_size; /* Total size of current message (including header) */
+
+ curr_hdr = curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh);
+ curr_tot_size = curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
+
/* Accumulate information, based on the type of message */
if(H5O_NULL_ID == curr_msg->type->id)
- free_space += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ free_space += curr_tot_size;
else if(H5O_CONT_ID == curr_msg->type->id) {
H5O_cont_t *cont = (H5O_cont_t *)curr_msg->native;
hbool_t found_chunk = FALSE; /* Found a chunk that matches */
+ HDassert(cont);
+
/* Increment # of continuation messages found */
cont_msgs_found++;
@@ -175,11 +183,14 @@ H5O_assert(const H5O_t *oh)
} /* end for */
HDassert(found_chunk);
- meta_space += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ meta_space += curr_tot_size;
} /* end if */
else {
- meta_space += H5O_SIZEOF_MSGHDR_OH(oh);
+ meta_space += (size_t)H5O_SIZEOF_MSGHDR_OH(oh);
mesg_space += curr_msg->raw_size;
+
+ /* Make sure the message has a native form if it is marked dirty */
+ HDassert(curr_msg->native || !curr_msg->dirty);
} /* end else */
/* Make certain that the message is in a valid chunk */
@@ -190,17 +201,19 @@ H5O_assert(const H5O_t *oh)
HDassert(oh->chunk[curr_msg->chunkno].gap == 0);
/* Make certain that the message is completely in a chunk message area */
- HDassert(curr_msg->raw_size <= (oh->chunk[curr_msg->chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[curr_msg->chunkno].gap));
+ HDassert(curr_tot_size <= (oh->chunk[curr_msg->chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[curr_msg->chunkno].gap));
if(curr_msg->chunkno == 0)
- HDassert(curr_msg->raw >= oh->chunk[curr_msg->chunkno].image + (H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)));
+ HDassert(curr_hdr >= oh->chunk[curr_msg->chunkno].image + (H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)));
else
- HDassert(curr_msg->raw >= oh->chunk[curr_msg->chunkno].image + (H5O_SIZEOF_CHKHDR_OH(oh) - H5O_SIZEOF_CHKSUM_OH(oh)));
+ HDassert(curr_hdr >= oh->chunk[curr_msg->chunkno].image + (H5O_SIZEOF_CHKHDR_OH(oh) - H5O_SIZEOF_CHKSUM_OH(oh)));
HDassert(curr_msg->raw + curr_msg->raw_size <= (oh->chunk[curr_msg->chunkno].image + oh->chunk[curr_msg->chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[curr_msg->chunkno].gap));
/* Make certain that no other messages overlap this message */
for(v = 0, tmp_msg = &oh->mesg[0]; v < oh->nmesgs; v++, tmp_msg++) {
if(u != v)
- HDassert(!(tmp_msg->raw >= curr_msg->raw && tmp_msg->raw < (curr_msg->raw + curr_msg->raw_size)));
+ HDassert(!((tmp_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh)) >= curr_hdr
+ && (tmp_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh))
+ < (curr_hdr + curr_tot_size)));
} /* end for */
} /* end for */
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index e4d6486..1b17bff 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -241,6 +241,8 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
mesg->ops = H5D_LOPS_CHUNK;
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class")
} /* end switch */
@@ -342,6 +344,8 @@ H5O_layout_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const voi
UINT32ENCODE(p, mesg->u.chunk.dim[u]);
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid layout class")
} /* end switch */
@@ -556,6 +560,8 @@ H5O_layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg)
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 */
@@ -641,6 +647,8 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
} /* end if */
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class")
} /* end switch */
@@ -737,6 +745,8 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg,
"Data Size:", mesg->storage.u.compact.size);
break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
default:
HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
"Type:", "Unknown", (unsigned)mesg->type);
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index a3d02d1..f12c835 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -2161,9 +2161,8 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg)
/* Make certain that null messages aren't in chunks w/gaps */
if(H5O_NULL_ID == msg_id)
HDassert(oh->chunk[mesg->chunkno].gap == 0);
-
- /* Unknown messages should always have a native pointer */
- if(mesg->type == H5O_MSG_UNKNOWN)
+ else
+ /* Non-null messages should always have a native pointer */
HDassert(mesg->native);
#endif /* NDEBUG */
diff --git a/src/H5S.c b/src/H5S.c
index 59f3085..5d99066 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -86,7 +86,7 @@ H5S_init_interface(void)
/* Allow MPI buf-and-file-type optimizations? */
const char *s = HDgetenv ("HDF5_MPI_OPT_TYPES");
if (s && HDisdigit(*s))
- H5S_mpi_opt_types_g = (int)HDstrtol (s, NULL, 0);
+ H5S_mpi_opt_types_g = (hbool_t)HDstrtol (s, NULL, 0);
}
#endif /* H5_HAVE_PARALLEL */
@@ -186,6 +186,7 @@ H5S_create(H5S_class_t type)
new_ds->extent.nelem = 0;
break;
+ case H5S_NO_CLASS:
default:
HDassert("unknown dataspace (extent) type" && 0);
break;
@@ -512,6 +513,7 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max)
dst->max = NULL;
break;
+ case H5S_NO_CLASS:
default:
HDassert("unknown dataspace type" && 0);
break;
@@ -712,6 +714,7 @@ H5S_get_npoints_max(const H5S_t *ds)
}
break;
+ case H5S_NO_CLASS:
default:
assert("unknown dataspace class" && 0);
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, 0, "internal error (unknown dataspace class)")
@@ -796,6 +799,7 @@ H5S_get_simple_extent_ndims(const H5S_t *ds)
ret_value = (int)ds->extent.rank;
break;
+ case H5S_NO_CLASS:
default:
HDassert("unknown dataspace class" && 0);
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "internal error (unknown dataspace class)")
@@ -894,6 +898,7 @@ H5S_extent_get_dims(const H5S_extent_t *ext, hsize_t dims[], hsize_t max_dims[])
} /* end for */
break;
+ case H5S_NO_CLASS:
default:
HDassert("unknown dataspace class" && 0);
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "internal error (unknown dataspace class)")
@@ -1827,7 +1832,7 @@ H5S_set_extent(H5S_t *space, const hsize_t *size)
/* Check for invalid dimension size modification */
if(space->extent.max && H5S_UNLIMITED != space->extent.max[u] &&
space->extent.max[u] < size[u])
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "dimension cannot exceed the existing maximal size")
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "dimension cannot exceed the existing maximal size (new: %llu max: %llu)", (unsigned long long)size[u], (unsigned long long)space->extent.max[u])
/* Indicate that dimension size can be modified */
ret_value = TRUE;
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index 5a707b5..48948a7 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -94,6 +94,8 @@ static H5Z_node *H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_poi
static H5Z_node *H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers);
static H5Z_node *H5Z_new_node(H5Z_token_type type);
static void H5Z_do_op(H5Z_node* tree);
+static hbool_t H5Z_op_is_numbs(H5Z_node* _tree);
+static hbool_t H5Z_op_is_numbs2(H5Z_node* _tree);
static hid_t H5Z_xform_find_type(const H5T_t* type);
static herr_t H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_type, H5Z_result* res);
static void H5Z_xform_destroy_parse_tree(H5Z_node *tree);
@@ -105,41 +107,57 @@ static void H5Z_XFORM_DEBUG(H5Z_node *tree);
static void H5Z_print(H5Z_node *tree, FILE *stream);
#endif /* H5Z_XFORM_DEBUG */
-
+/* PGCC (11.8-0) has trouble with the command *p++ = *p OP tree_val. It increments P first before
+ * doing the operation. So I break down the command into two lines:
+ * *p = *p OP tree_val; p++;
+ * Actually, the behavior of *p++ = *p OP tree_val is undefined. (SLU - 2012/3/19)
+ */
#define H5Z_XFORM_DO_OP1(RESL,RESR,TYPE,OP,SIZE) \
{ \
- if( (((RESL).type == H5Z_XFORM_SYMBOL) && ((RESR).type != H5Z_XFORM_SYMBOL)) || (((RESR).type == H5Z_XFORM_SYMBOL) && ((RESL).type != H5Z_XFORM_SYMBOL))) \
+ size_t u; \
+ \
+ if(((RESL).type == H5Z_XFORM_SYMBOL) && ((RESR).type != H5Z_XFORM_SYMBOL)) \
+ { \
+ TYPE* p; \
+ double tree_val; \
+ \
+ tree_val = ((RESR).type==H5Z_XFORM_INTEGER ? (double)(RESR).value.int_val : (RESR).value.float_val); \
+ p = (TYPE*)(RESL).value.dat_val; \
+ \
+ for(u=0; u<(SIZE); u++) { \
+ *p = *p OP tree_val; \
+ p++; \
+ } \
+ } \
+ else if(((RESR).type == H5Z_XFORM_SYMBOL) && ((RESL).type != H5Z_XFORM_SYMBOL)) \
{ \
- size_t u; \
TYPE* p; \
double tree_val; \
\
- if((RESL).type == H5Z_XFORM_SYMBOL) \
- { \
- tree_val = ((RESR).type==H5Z_XFORM_INTEGER ? (double)(RESR).value.int_val : (RESR).value.float_val); \
- p = (TYPE*)(RESL).value.dat_val; \
- } \
+ /* The case that the left operand is nothing, like -x or +x */ \
+ if((RESL).type == H5Z_XFORM_ERROR) \
+ tree_val = 0; \
else \
- { \
tree_val = ((RESL).type==H5Z_XFORM_INTEGER ? (double)(RESL).value.int_val : (RESL).value.float_val); \
- p = (TYPE*)(RESR).value.dat_val; \
- } \
- \
- for(u=0; u<(SIZE); u++) \
- *p++ OP tree_val; \
- } \
+ \
+ p = (TYPE*)(RESR).value.dat_val; \
+ for(u=0; u<(SIZE); u++) { \
+ *p = tree_val OP *p; \
+ p++; \
+ } \
+ } \
else if( ((RESL).type == H5Z_XFORM_SYMBOL) && ((RESR).type==H5Z_XFORM_SYMBOL)) \
{ \
- size_t u; \
TYPE* pl = (TYPE*)(RESL).value.dat_val; \
TYPE* pr = (TYPE*)(RESR).value.dat_val; \
\
- for(u=0; u<(SIZE); u++) \
- *pl++ OP *pr++; \
+ for(u=0; u<(SIZE); u++) { \
+ *pl = *pl OP *pr; \
+ pl++; pr++; \
+ } \
} \
else \
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unexpected type conversion operation") \
- \
}
/* Due to the undefined nature of embedding macros/conditionals within macros, we employ
@@ -277,7 +295,47 @@ static void H5Z_print(H5Z_node *tree, FILE *stream);
H5V_array_fill(array, &val, sizeof(TYPE), (SIZE)); \
}
-
+/* The difference of this macro from H5Z_XFORM_DO_OP3 is that it handles the operations when the left operand is empty, like -x or +x.
+ * The reason that it's seperated from H5Z_XFORM_DO_OP3 is because compilers don't accept operations like *x or /x. So in H5Z_do_op,
+ * these two macros are called in different ways. (SLU 2012/3/20)
+ */
+#define H5Z_XFORM_DO_OP6(OP) \
+{ \
+ if(!tree->lchild && (tree->rchild->type==H5Z_XFORM_INTEGER)) \
+ { \
+ tree->type = H5Z_XFORM_INTEGER; \
+ tree->value.int_val = OP tree->rchild->value.int_val; \
+ H5MM_xfree(tree->rchild); \
+ tree->rchild = NULL; \
+ } \
+ else if(!tree->lchild && (tree->rchild->type==H5Z_XFORM_FLOAT)) \
+ { \
+ tree->type = H5Z_XFORM_FLOAT; \
+ tree->value.float_val = OP tree->rchild->value.float_val; \
+ H5MM_xfree(tree->rchild); \
+ tree->rchild = NULL; \
+ } \
+ else if((tree->lchild->type == H5Z_XFORM_INTEGER) && (tree->rchild->type==H5Z_XFORM_INTEGER)) \
+ { \
+ tree->type = H5Z_XFORM_INTEGER; \
+ tree->value.int_val = tree->lchild->value.int_val OP tree->rchild->value.int_val; \
+ H5MM_xfree(tree->lchild); \
+ H5MM_xfree(tree->rchild); \
+ tree->lchild = NULL; \
+ tree->rchild = NULL; \
+ } \
+ else if( ( (tree->lchild->type == H5Z_XFORM_FLOAT) || (tree->lchild->type == H5Z_XFORM_INTEGER)) && \
+ ( (tree->rchild->type == H5Z_XFORM_FLOAT) || (tree->rchild->type == H5Z_XFORM_INTEGER))) \
+ { \
+ tree->type = H5Z_XFORM_FLOAT; \
+ tree->value.float_val = ((tree->lchild->type == H5Z_XFORM_FLOAT) ? tree->lchild->value.float_val : (double)tree->lchild->value.int_val) OP \
+ ((tree->rchild->type == H5Z_XFORM_FLOAT) ? tree->rchild->value.float_val : (double)tree->rchild->value.int_val); \
+ H5MM_xfree(tree->lchild); \
+ H5MM_xfree(tree->rchild); \
+ tree->lchild = NULL; \
+ tree->rchild = NULL; \
+ } \
+}
/*
* Programmer: Bill Wendling <wendling@ncsa.uiuc.edu>
@@ -1027,6 +1085,9 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_
/* check args */
HDassert(tree);
+ HDmemset(&resl, 0, sizeof(H5Z_result));
+ HDmemset(&resr, 0, sizeof(H5Z_result));
+
if (tree->type == H5Z_XFORM_INTEGER) {
res->type = H5Z_XFORM_INTEGER;
res->value.int_val = tree->value.int_val;
@@ -1044,7 +1105,7 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_
res->value.dat_val = *((void**)(tree->value.dat_val));
} /* end if */
else {
- if(H5Z_xform_eval_full(tree->lchild, array_size, array_type, &resl) < 0)
+ if(tree->lchild && H5Z_xform_eval_full(tree->lchild, array_size, array_type, &resl) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform")
if(H5Z_xform_eval_full(tree->rchild, array_size, array_type, &resr) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform")
@@ -1059,19 +1120,19 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_
switch (tree->type) {
case H5Z_XFORM_PLUS:
- H5Z_XFORM_TYPE_OP(resl, resr, array_type, +=, array_size)
+ H5Z_XFORM_TYPE_OP(resl, resr, array_type, +, array_size)
break;
case H5Z_XFORM_MINUS:
- H5Z_XFORM_TYPE_OP(resl, resr, array_type, -=, array_size)
+ H5Z_XFORM_TYPE_OP(resl, resr, array_type, -, array_size)
break;
case H5Z_XFORM_MULT:
- H5Z_XFORM_TYPE_OP(resl, resr, array_type, *=, array_size)
+ H5Z_XFORM_TYPE_OP(resl, resr, array_type, *, array_size)
break;
case H5Z_XFORM_DIVIDE:
- H5Z_XFORM_TYPE_OP(resl, resr, array_type, /=, array_size)
+ H5Z_XFORM_TYPE_OP(resl, resr, array_type, /, array_size)
break;
default:
@@ -1257,6 +1318,63 @@ H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z_datva
/*-------------------------------------------------------------------------
+ * Function: H5Z_op_is_numbs
+ * Purpose: Internal function to facilitate the condition check in
+ * H5Z_xform_reduce_tree to reduce the bulkiness of the code.
+ * Return: TRUE or FALSE
+ * Programmer: Raymond Lu
+ * 15 March 2012
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+H5Z_op_is_numbs(H5Z_node* _tree)
+{
+ hbool_t ret_value = FALSE;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ assert(_tree);
+
+ if(((_tree->lchild->type == H5Z_XFORM_INTEGER) || (_tree->lchild->type == H5Z_XFORM_FLOAT)) && ((_tree->rchild->type == H5Z_XFORM_INTEGER) || (_tree->rchild->type == H5Z_XFORM_FLOAT)))
+ ret_value = TRUE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Z_op_is_numbs2
+ * Purpose: Internal function to facilitate the condition check in
+ * H5Z_xform_reduce_tree to reduce the bulkiness of the code.
+ * The difference from H5Z_op_is_numbs is that the left child
+ * can be empty, like -x or +x.
+ * Return: TRUE or FALSE
+ * Programmer: Raymond Lu
+ * 15 March 2012
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+H5Z_op_is_numbs2(H5Z_node* _tree)
+{
+ hbool_t ret_value = FALSE;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ assert(_tree);
+
+ if((!_tree->lchild && ((_tree->rchild->type == H5Z_XFORM_INTEGER) || (_tree->rchild->type == H5Z_XFORM_FLOAT))) ||
+ ((_tree->lchild && ((_tree->lchild->type == H5Z_XFORM_INTEGER) || (_tree->lchild->type == H5Z_XFORM_FLOAT))) && (_tree->rchild && ((_tree->rchild->type == H5Z_XFORM_INTEGER) || (_tree->rchild->type == H5Z_XFORM_FLOAT)))))
+ ret_value = TRUE;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5Z_xform_reduce_tree
* Purpose: Simplifies parse tree passed in by performing any obvious
* and trivial arithemtic calculations.
@@ -1274,22 +1392,37 @@ H5Z_xform_reduce_tree(H5Z_node* tree)
FUNC_ENTER_NOAPI_NOINIT_NOERR
if(tree) {
- if((tree->type == H5Z_XFORM_PLUS) || (tree->type == H5Z_XFORM_DIVIDE) ||(tree->type == H5Z_XFORM_MULT) ||(tree->type == H5Z_XFORM_MINUS))
+ if((tree->type == H5Z_XFORM_DIVIDE) || (tree->type == H5Z_XFORM_MULT))
{
- if(((tree->lchild->type == H5Z_XFORM_INTEGER) || (tree->lchild->type == H5Z_XFORM_FLOAT)) && ((tree->rchild->type == H5Z_XFORM_INTEGER) || (tree->rchild->type == H5Z_XFORM_FLOAT)))
+ if(H5Z_op_is_numbs(tree))
+ H5Z_do_op(tree);
+ else
+ {
+ H5Z_xform_reduce_tree(tree->lchild);
+ if(H5Z_op_is_numbs(tree))
+ H5Z_do_op(tree);
+ else {
+ H5Z_xform_reduce_tree(tree->rchild);
+ if(H5Z_op_is_numbs(tree))
+ H5Z_do_op(tree);
+ }
+ }
+ } else if((tree->type == H5Z_XFORM_PLUS) || (tree->type == H5Z_XFORM_MINUS)) {
+ if(H5Z_op_is_numbs2(tree))
H5Z_do_op(tree);
else
{
H5Z_xform_reduce_tree(tree->lchild);
- if(((tree->lchild->type == H5Z_XFORM_INTEGER) || (tree->lchild->type == H5Z_XFORM_FLOAT)) && ((tree->rchild->type == H5Z_XFORM_INTEGER) || (tree->rchild->type == H5Z_XFORM_FLOAT)))
+ if(H5Z_op_is_numbs2(tree))
H5Z_do_op(tree);
else {
H5Z_xform_reduce_tree(tree->rchild);
- if(((tree->lchild->type == H5Z_XFORM_INTEGER) || (tree->lchild->type == H5Z_XFORM_FLOAT)) && ((tree->rchild->type == H5Z_XFORM_INTEGER) || (tree->rchild->type == H5Z_XFORM_FLOAT)))
+ if(H5Z_op_is_numbs2(tree))
H5Z_do_op(tree);
}
}
}
+
}
FUNC_LEAVE_NOAPI_VOID;
@@ -1307,7 +1440,11 @@ H5Z_xform_reduce_tree(H5Z_node* tree)
* Programmer: Leon Arber
* April 1, 2004.
* Modifications:
-*
+ * Raymond Lu
+ * 15 March 2012
+ * I added a new macro H5Z_XFORM_DO_OP6 to handle the special
+ * operations like -x or +x when the left operand is empty.
+ *
*-------------------------------------------------------------------------
*/
static void
@@ -1320,9 +1457,9 @@ H5Z_do_op(H5Z_node* tree)
else if(tree->type == H5Z_XFORM_MULT)
H5Z_XFORM_DO_OP3(*)
else if(tree->type == H5Z_XFORM_PLUS)
- H5Z_XFORM_DO_OP3(+)
+ H5Z_XFORM_DO_OP6(+)
else if(tree->type == H5Z_XFORM_MINUS)
- H5Z_XFORM_DO_OP3(-)
+ H5Z_XFORM_DO_OP6(-)
FUNC_LEAVE_NOAPI_VOID;
}
diff --git a/src/H5public.h b/src/H5public.h
index 634decc..1f44ff3 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -75,10 +75,10 @@ extern "C" {
/* Version numbers */
#define H5_VERS_MAJOR 1 /* For major interface/format changes */
#define H5_VERS_MINOR 9 /* For minor interface/format changes */
-#define H5_VERS_RELEASE 109 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 112 /* For tweaks, bug-fixes, or development */
#define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */
/* Empty string for real releases. */
-#define H5_VERS_INFO "HDF5 library version: 1.9.109" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.9.112" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/Makefile.in b/src/Makefile.in
index cc0da91..36f0755 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -484,7 +484,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 99
+LT_VERS_REVISION = 102
LT_VERS_AGE = 0
H5detect_CFLAGS = -g $(AM_CFLAGS)