summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5.c310
-rw-r--r--src/H5Dmpio.c23
-rw-r--r--src/H5FDmpio.c2
-rw-r--r--src/H5FDonion.c3
-rw-r--r--src/H5MMprivate.h6
-rw-r--r--src/H5Spoint.c26
-rw-r--r--src/H5Tref.c6
-rw-r--r--src/H5mpi.c5
8 files changed, 185 insertions, 196 deletions
diff --git a/src/H5.c b/src/H5.c
index 7949504..cdb3872 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -243,33 +243,35 @@ H5_init_library(void)
* The dataspace interface needs to be initialized so that future IDs for
* dataspaces work.
*/
- /* clang-format off */
- struct {
- herr_t (*func)(void);
- const char *descr;
- } initializer[] = {
- {H5E_init, "error"}
- , {H5VL_init_phase1, "VOL"}
- , {H5SL_init, "skip lists"}
- , {H5FD_init, "VFD"}
- , {H5_default_vfd_init, "default VFD"}
- , {H5P_init_phase1, "property list"}
- , {H5AC_init, "metadata caching"}
- , {H5L_init, "link"}
- , {H5S_init, "dataspace"}
- , {H5PL_init, "plugins"}
- /* Finish initializing interfaces that depend on the interfaces above */
- , {H5P_init_phase2, "property list"}
- , {H5VL_init_phase2, "VOL"}
- };
-
- for (i = 0; i < NELMTS(initializer); i++) {
- if (initializer[i].func() < 0) {
- HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL,
- "unable to initialize %s interface", initializer[i].descr)
+ {
+ /* clang-format off */
+ struct {
+ herr_t (*func)(void);
+ const char *descr;
+ } initializer[] = {
+ {H5E_init, "error"}
+ , {H5VL_init_phase1, "VOL"}
+ , {H5SL_init, "skip lists"}
+ , {H5FD_init, "VFD"}
+ , {H5_default_vfd_init, "default VFD"}
+ , {H5P_init_phase1, "property list"}
+ , {H5AC_init, "metadata caching"}
+ , {H5L_init, "link"}
+ , {H5S_init, "dataspace"}
+ , {H5PL_init, "plugins"}
+ /* Finish initializing interfaces that depend on the interfaces above */
+ , {H5P_init_phase2, "property list"}
+ , {H5VL_init_phase2, "VOL"}
+ };
+
+ for (i = 0; i < NELMTS(initializer); i++) {
+ if (initializer[i].func() < 0) {
+ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL,
+ "unable to initialize %s interface", initializer[i].descr)
+ }
}
+ /* clang-format on */
}
- /* clang-format on */
/* Debugging? */
H5__debug_mask("-all");
@@ -349,139 +351,141 @@ H5_term_library(void)
* way that would necessitate some cleanup work in the other interface.
*/
-#define TERMINATOR(module, wait) { \
- .func = H5##module##_term_package \
- , .name = #module \
- , .completed = false \
- , .await_prior = wait \
- }
+ {
+#define TERMINATOR(module, wait) { \
+ .func = H5##module##_term_package \
+ , .name = #module \
+ , .completed = false \
+ , .await_prior = wait \
+ }
- /*
- * Termination is ordered by the `terminator` table so the "higher" level
- * packages are shut down before "lower" level packages that they
- * rely on:
- */
- struct {
- int (*func)(void); /* function to terminate the module; returns 0
- * on success, >0 if termination was not
- * completed and we should try to terminate
- * some dependent modules, first.
- */
- const char *name; /* name of the module */
- hbool_t completed; /* true iff this terminator was already
- * completed
- */
- const hbool_t await_prior; /* true iff all prior terminators in the
- * list must complete before this
- * terminator is attempted
- */
- } terminator[] = {
- /* Close the event sets first, so that all asynchronous operations
- * complete before anything else attempts to shut down.
- */
- TERMINATOR(ES, false)
- /* Do not attempt to close down package L until after event sets
- * have finished closing down.
- */
- , TERMINATOR(L, true)
- /* Close the "top" of various interfaces (IDs, etc) but don't shut
- * down the whole interface yet, so that the object header messages
- * get serialized correctly for entries in the metadata cache and the
- * symbol table entry in the superblock gets serialized correctly, etc.
- * all of which is performed in the 'F' shutdown.
- *
- * The tops of packages A, D, G, M, S, T do not need to wait for L
- * or previous packages to finish closing down.
- */
- , TERMINATOR(A_top, false)
- , TERMINATOR(D_top, false)
- , TERMINATOR(G_top, false)
- , TERMINATOR(M_top, false)
- , TERMINATOR(S_top, false)
- , TERMINATOR(T_top, false)
- /* Don't shut down the file code until objects in files are shut down */
- , TERMINATOR(F, true)
- /* Don't shut down the property list code until all objects that might
- * use property lists are shut down
- */
- , TERMINATOR(P, true)
- /* Wait to shut down the "bottom" of various interfaces until the
- * files are closed, so pieces of the file can be serialized
- * correctly.
- *
- * Shut down the "bottom" of the attribute, dataset, group,
- * reference, dataspace, and datatype interfaces, fully closing
- * out the interfaces now.
- */
- , TERMINATOR(A, true)
- , TERMINATOR(D, false)
- , TERMINATOR(G, false)
- , TERMINATOR(M, false)
- , TERMINATOR(S, false)
- , TERMINATOR(T, false)
- /* Wait to shut down low-level packages like AC until after
- * the preceding high-level packages have shut down. This prevents
- * low-level objects from closing "out from underneath" their
- * reliant high-level objects.
- */
- , TERMINATOR(AC, true)
- /* Shut down the "pluggable" interfaces, before the plugin framework */
- , TERMINATOR(Z, false)
- , TERMINATOR(FD, false)
- , TERMINATOR(VL, false)
- /* Don't shut down the plugin code until all "pluggable" interfaces
- * (Z, FD, PL) are shut down
- */
- , TERMINATOR(PL, true)
- /* Shut down the following packages in strictly the order given
- * by the table.
+ /*
+ * Termination is ordered by the `terminator` table so the "higher" level
+ * packages are shut down before "lower" level packages that they
+ * rely on:
*/
- , TERMINATOR(E, true)
- , TERMINATOR(I, true)
- , TERMINATOR(SL, true)
- , TERMINATOR(FL, true)
- , TERMINATOR(CX, true)
- };
-
- do {
- pending = 0;
- for (i = 0; i < NELMTS(terminator); i++) {
- if (terminator[i].completed)
- continue;
- if (pending != 0 && terminator[i].await_prior)
- break;
- if (terminator[i].func() == 0) {
- terminator[i].completed = true;
- continue;
+ struct {
+ int (*func)(void); /* function to terminate the module; returns 0
+ * on success, >0 if termination was not
+ * completed and we should try to terminate
+ * some dependent modules, first.
+ */
+ const char *name; /* name of the module */
+ hbool_t completed; /* true iff this terminator was already
+ * completed
+ */
+ const hbool_t await_prior; /* true iff all prior terminators in the
+ * list must complete before this
+ * terminator is attempted
+ */
+ } terminator[] = {
+ /* Close the event sets first, so that all asynchronous operations
+ * complete before anything else attempts to shut down.
+ */
+ TERMINATOR(ES, false)
+ /* Do not attempt to close down package L until after event sets
+ * have finished closing down.
+ */
+ , TERMINATOR(L, true)
+ /* Close the "top" of various interfaces (IDs, etc) but don't shut
+ * down the whole interface yet, so that the object header messages
+ * get serialized correctly for entries in the metadata cache and the
+ * symbol table entry in the superblock gets serialized correctly, etc.
+ * all of which is performed in the 'F' shutdown.
+ *
+ * The tops of packages A, D, G, M, S, T do not need to wait for L
+ * or previous packages to finish closing down.
+ */
+ , TERMINATOR(A_top, false)
+ , TERMINATOR(D_top, false)
+ , TERMINATOR(G_top, false)
+ , TERMINATOR(M_top, false)
+ , TERMINATOR(S_top, false)
+ , TERMINATOR(T_top, false)
+ /* Don't shut down the file code until objects in files are shut down */
+ , TERMINATOR(F, true)
+ /* Don't shut down the property list code until all objects that might
+ * use property lists are shut down
+ */
+ , TERMINATOR(P, true)
+ /* Wait to shut down the "bottom" of various interfaces until the
+ * files are closed, so pieces of the file can be serialized
+ * correctly.
+ *
+ * Shut down the "bottom" of the attribute, dataset, group,
+ * reference, dataspace, and datatype interfaces, fully closing
+ * out the interfaces now.
+ */
+ , TERMINATOR(A, true)
+ , TERMINATOR(D, false)
+ , TERMINATOR(G, false)
+ , TERMINATOR(M, false)
+ , TERMINATOR(S, false)
+ , TERMINATOR(T, false)
+ /* Wait to shut down low-level packages like AC until after
+ * the preceding high-level packages have shut down. This prevents
+ * low-level objects from closing "out from underneath" their
+ * reliant high-level objects.
+ */
+ , TERMINATOR(AC, true)
+ /* Shut down the "pluggable" interfaces, before the plugin framework */
+ , TERMINATOR(Z, false)
+ , TERMINATOR(FD, false)
+ , TERMINATOR(VL, false)
+ /* Don't shut down the plugin code until all "pluggable" interfaces
+ * (Z, FD, PL) are shut down
+ */
+ , TERMINATOR(PL, true)
+ /* Shut down the following packages in strictly the order given
+ * by the table.
+ */
+ , TERMINATOR(E, true)
+ , TERMINATOR(I, true)
+ , TERMINATOR(SL, true)
+ , TERMINATOR(FL, true)
+ , TERMINATOR(CX, true)
+ };
+
+ do {
+ pending = 0;
+ for (i = 0; i < NELMTS(terminator); i++) {
+ if (terminator[i].completed)
+ continue;
+ if (pending != 0 && terminator[i].await_prior)
+ break;
+ if (terminator[i].func() == 0) {
+ terminator[i].completed = true;
+ continue;
+ }
+
+ /* log a package when its terminator needs to be retried */
+ pending++;
+ nprinted = HDsnprintf(next, nleft, "%s%s",
+ (next != loop) ? "," : "", terminator[i].name);
+ if (nprinted < 0)
+ continue;
+ if ((size_t)nprinted >= nleft)
+ nprinted = HDsnprintf(next, nleft, "...");
+ if (nprinted < 0 || (size_t)nprinted >= nleft)
+ continue;
+ nleft -= (size_t)nprinted;
+ next += nprinted;
}
+ } while (pending && ntries++ < 100);
- /* log a package when its terminator needs to be retried */
- pending++;
- nprinted = HDsnprintf(next, nleft, "%s%s",
- (next != loop) ? "," : "", terminator[i].name);
- if (nprinted < 0)
- continue;
- if ((size_t)nprinted >= nleft)
- nprinted = HDsnprintf(next, nleft, "...");
- if (nprinted < 0 || (size_t)nprinted >= nleft)
- continue;
- nleft -= (size_t)nprinted;
- next += nprinted;
- }
- } while (pending && ntries++ < 100);
-
- /* clang-format on */
+ /* clang-format on */
- if (pending) {
- /* Only display the error message if the user is interested in them. */
- if (func) {
- fprintf(stderr, "HDF5: infinite loop closing library\n");
- fprintf(stderr, " %s\n", loop);
+ if (pending) {
+ /* Only display the error message if the user is interested in them. */
+ if (func) {
+ fprintf(stderr, "HDF5: infinite loop closing library\n");
+ fprintf(stderr, " %s\n", loop);
#ifndef NDEBUG
- HDabort();
-#endif /* NDEBUG */
- } /* end if */
- } /* end if */
+ HDabort();
+#endif /* NDEBUG */
+ } /* end if */
+ } /* end if */
+ }
/* Free open debugging streams */
while (H5_debug_g.open_stream) {
@@ -1116,7 +1120,7 @@ H5close(void)
*
*-------------------------------------------------------------------------
*/
-void *
+void *H5_ATTR_MALLOC
H5allocate_memory(size_t size, hbool_t clear)
{
void *ret_value = NULL;
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index c52299f..17809e9 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -48,29 +48,6 @@
#define H5D_MULTI_CHUNK_IO 1
#define H5D_ONE_LINK_CHUNK_IO_MORE_OPT 2
#define H5D_MULTI_CHUNK_IO_MORE_OPT 3
-#define H5D_NO_IO 4
-
-/***** Macros for One linked collective IO case. *****/
-/* The default value to do one linked collective IO for all chunks.
- * If the average number of chunks per process is greater than this
- * value, the library will create an MPI derived datatype to link all
- * chunks to do collective IO. The user can set this value through an
- * API.
- */
-
-/* Macros to represent options on how to obtain chunk address for one linked-chunk IO case */
-#define H5D_OBTAIN_ONE_CHUNK_ADDR_IND 0
-#define H5D_OBTAIN_ALL_CHUNK_ADDR_COL 2
-
-/* Macros to define the default ratio of obtaining all chunk addresses for one linked-chunk IO case */
-#define H5D_ALL_CHUNK_ADDR_THRES_COL 30
-#define H5D_ALL_CHUNK_ADDR_THRES_COL_NUM 10000
-
-/***** Macros for multi-chunk collective IO case. *****/
-/* The default value of the threshold to do collective IO for this
- * chunk. If the average number of processes per chunk is greater
- * than the default value, collective IO is done for this chunk.
- */
/* Macros to represent different IO modes(NONE, Independent or collective)for multiple chunk IO case */
#define H5D_CHUNK_IO_MODE_COL 1
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index b72b892..d90264d 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -229,6 +229,8 @@ H5FD__mem_t_to_str(H5FD_mem_t mem_type)
return "H5FD_MEM_LHEAP";
case H5FD_MEM_OHDR:
return "H5FD_MEM_OHDR";
+ case H5FD_MEM_NTYPES:
+ return "H5FD_MEM_NTYPES";
default:
return "(Unknown)";
}
diff --git a/src/H5FDonion.c b/src/H5FDonion.c
index aec018d..bb1fd1b 100644
--- a/src/H5FDonion.c
+++ b/src/H5FDonion.c
@@ -911,6 +911,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
const H5FD_onion_fapl_info_t *fa = NULL;
H5FD_onion_fapl_info_t *new_fa = NULL;
const char *config_str = NULL;
+ double log2_page_size = 0.0;
hid_t backing_fapl_id = H5I_INVALID_HID;
char *name_onion = NULL;
char *recovery_file_nameery = NULL;
@@ -994,7 +995,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "page size is not a power of two")
/* Assign the page size */
- double log2_page_size = HDlog2((double)(fa->page_size));
+ log2_page_size = HDlog2((double)(fa->page_size));
file->curr_rev_record.archival_index.page_size_log2 = (uint32_t)log2_page_size;
/* Proceed with open. */
diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h
index 84656ad..f94a433 100644
--- a/src/H5MMprivate.h
+++ b/src/H5MMprivate.h
@@ -34,9 +34,9 @@
H5_DLL void *H5MM_malloc(size_t size) H5_ATTR_MALLOC;
H5_DLL void *H5MM_calloc(size_t size) H5_ATTR_MALLOC;
H5_DLL void *H5MM_realloc(void *mem, size_t size);
-H5_DLL char *H5MM_xstrdup(const char *s);
-H5_DLL char *H5MM_strdup(const char *s);
-H5_DLL char *H5MM_strndup(const char *s, size_t n);
+H5_DLL char *H5MM_xstrdup(const char *s) H5_ATTR_MALLOC;
+H5_DLL char *H5MM_strdup(const char *s) H5_ATTR_MALLOC;
+H5_DLL char *H5MM_strndup(const char *s, size_t n) H5_ATTR_MALLOC;
H5_DLL void *H5MM_xfree(void *mem);
H5_DLL void *H5MM_xfree_const(const void *mem);
H5_DLL void *H5MM_memcpy(void *dest, const void *src, size_t n);
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 50346ae..7f50ce8 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -1339,16 +1339,18 @@ done:
static herr_t
H5S__point_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size, hbool_t skip)
{
- H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use,
- either *space or a newly allocated one */
- hsize_t dims[H5S_MAX_RANK]; /* Dimension sizes */
- uint32_t version; /* Version number */
- uint8_t enc_size = 0; /* Encoded size of selection info */
- hsize_t *coord = NULL, *tcoord; /* Pointer to array of elements */
- const uint8_t *pp; /* Local pointer for decoding */
- uint64_t num_elem = 0; /* Number of elements in selection */
- unsigned rank; /* Rank of points */
- unsigned i, j; /* local counting variables */
+ H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use,
+ either *space or a newly allocated one */
+ hsize_t dims[H5S_MAX_RANK]; /* Dimension sizes */
+ uint32_t version; /* Version number */
+ uint8_t enc_size = 0; /* Encoded size of selection info */
+ hsize_t *coord = NULL, *tcoord; /* Pointer to array of elements */
+ const uint8_t *pp; /* Local pointer for decoding */
+ uint64_t num_elem = 0; /* Number of elements in selection */
+ unsigned rank; /* Rank of points */
+ unsigned i, j; /* local counting variables */
+ size_t enc_type_size;
+ size_t coordinate_buffer_requirement;
herr_t ret_value = SUCCEED; /* Return value */
const uint8_t *p_end = *p + p_size - 1; /* Pointer to last valid byte in buffer */
FUNC_ENTER_PACKAGE
@@ -1446,7 +1448,7 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size, hb
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information")
/* Determine necessary size of buffer for coordinates */
- size_t enc_type_size = 0;
+ enc_type_size = 0;
switch (enc_size) {
case H5S_SELECT_INFO_ENC_SIZE_2:
@@ -1463,7 +1465,7 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size, hb
break;
}
- size_t coordinate_buffer_requirement = num_elem * rank * enc_type_size;
+ coordinate_buffer_requirement = num_elem * rank * enc_type_size;
if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, coordinate_buffer_requirement, p_end))
HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding selection coordinates")
diff --git a/src/H5Tref.c b/src/H5Tref.c
index f0cdb29..f508dfb 100644
--- a/src/H5Tref.c
+++ b/src/H5Tref.c
@@ -1004,8 +1004,10 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
src_size -= H5R_ENCODE_HEADER_SIZE;
#ifndef NDEBUG
- size_t buf_size_left = dst_size - sizeof(uint32_t);
- assert(buf_size_left > sizeof(uint32_t));
+ {
+ size_t buf_size_left = dst_size - sizeof(uint32_t);
+ assert(buf_size_left > sizeof(uint32_t));
+ }
#endif
/* Set the size */
diff --git a/src/H5mpi.c b/src/H5mpi.c
index 4a4287d..12f635c 100644
--- a/src/H5mpi.c
+++ b/src/H5mpi.c
@@ -66,7 +66,7 @@ H5_mpi_set_bigio_count(hsize_t new_count)
*
*-------------------------------------------------------------------------
*/
-hsize_t
+H5_ATTR_PURE hsize_t
H5_mpi_get_bigio_count(void)
{
return bigio_count_g;
@@ -795,6 +795,7 @@ H5_mpio_get_file_sync_required(MPI_File fh, hbool_t *file_sync_required)
{
MPI_Info info_used;
int flag;
+ char *sync_env_var;
char value[MPI_MAX_INFO_VAL];
herr_t ret_value = SUCCEED;
@@ -818,7 +819,7 @@ H5_mpio_get_file_sync_required(MPI_File fh, hbool_t *file_sync_required)
HGOTO_ERROR(H5E_LIB, H5E_CANTFREE, FAIL, "can't free MPI info")
/* Force setting the flag via env variable (temp solution before the flag is implemented in MPI) */
- char *sync_env_var = HDgetenv("HDF5_DO_MPI_FILE_SYNC");
+ sync_env_var = HDgetenv("HDF5_DO_MPI_FILE_SYNC");
if (sync_env_var && (!HDstrcmp(sync_env_var, "TRUE") || !HDstrcmp(sync_env_var, "1")))
*file_sync_required = TRUE;
if (sync_env_var && (!HDstrcmp(sync_env_var, "FALSE") || !HDstrcmp(sync_env_var, "0")))