summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5ACprivate.h2
-rw-r--r--src/H5C.c468
-rw-r--r--src/H5Cpkg.h19
-rw-r--r--src/H5Cprivate.h27
-rw-r--r--src/H5Dchunk.c4
-rw-r--r--src/H5Doh.c2
-rw-r--r--src/H5Eint.c10
-rw-r--r--src/H5FD.c142
-rw-r--r--src/H5FDcore.c12
-rw-r--r--src/H5FDdirect.c2
-rw-r--r--src/H5FDfamily.c121
-rw-r--r--src/H5FDlog.c2
-rw-r--r--src/H5FDmpi.c19
-rw-r--r--src/H5FDmpio.c200
-rw-r--r--src/H5FDmpiposix.c1088
-rw-r--r--src/H5FDmpiposix.h9
-rw-r--r--src/H5FDmulti.c407
-rw-r--r--src/H5FDprivate.h2
-rw-r--r--src/H5FDsec2.c2
-rw-r--r--src/H5FDstdio.c2
-rw-r--r--src/H5FS.c129
-rw-r--r--src/H5FScache.c33
-rw-r--r--src/H5FSprivate.h2
-rw-r--r--src/H5FSsection.c117
-rw-r--r--src/H5Fint.c13
-rw-r--r--src/H5Fsuper.c2
-rw-r--r--src/H5Fsuper_cache.c44
-rw-r--r--src/H5HF.c14
-rw-r--r--src/H5HFman.c38
-rw-r--r--src/H5HFpkg.h2
-rw-r--r--src/H5HFsection.c12
-rw-r--r--src/H5HFtiny.c162
-rw-r--r--src/H5HG.c2
-rw-r--r--src/H5MF.c154
-rw-r--r--src/H5MFaggr.c161
-rw-r--r--src/H5MFpkg.h1
-rw-r--r--src/H5MFprivate.h1
-rw-r--r--src/H5MFsection.c4
-rw-r--r--src/H5Ocopy.c21
-rw-r--r--src/H5Otest.c2
-rw-r--r--src/H5P.c11
-rw-r--r--src/H5Pacpl.c1
-rw-r--r--src/H5Pdapl.c8
-rw-r--r--src/H5Pdcpl.c3
-rw-r--r--src/H5Pdxpl.c506
-rw-r--r--src/H5Pfapl.c355
-rw-r--r--src/H5Pfcpl.c1
-rw-r--r--src/H5Pfmpl.c1
-rw-r--r--src/H5Pgcpl.c1
-rw-r--r--src/H5Pint.c102
-rw-r--r--src/H5Plapl.c43
-rw-r--r--src/H5Plcpl.c3
-rw-r--r--src/H5Pocpl.c7
-rw-r--r--src/H5Pocpypl.c7
-rw-r--r--src/H5Ppkg.h30
-rw-r--r--src/H5Pprivate.h24
-rw-r--r--src/H5Pstrcpl.c1
-rw-r--r--src/H5Shyper.c2
-rw-r--r--src/H5Spoint.c2
-rw-r--r--src/H5Sselect.c2
-rw-r--r--src/H5Tarray.c3
-rw-r--r--src/H5Zscaleoffset.c6
-rw-r--r--src/H5public.h4
-rw-r--r--src/H5trace.c1
-rw-r--r--src/Makefile.in2
65 files changed, 2460 insertions, 2120 deletions
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 456eb0d..26fa051 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -321,6 +321,8 @@ H5_DLLVAR hid_t H5AC_ind_dxpl_id;
#define H5AC__FLUSH_IGNORE_PROTECTED_FLAG H5C__FLUSH_IGNORE_PROTECTED_FLAG
#define H5AC__FREE_FILE_SPACE_FLAG H5C__FREE_FILE_SPACE_FLAG
#define H5AC__TAKE_OWNERSHIP_FLAG H5C__TAKE_OWNERSHIP_FLAG
+#define H5AC__FLUSH_LAST_FLAG H5C__FLUSH_LAST_FLAG
+#define H5AC__FLUSH_COLLECTIVELY_FLAG H5C__FLUSH_COLLECTIVELY_FLAG
/* #defines of flags used to report entry status in the
diff --git a/src/H5C.c b/src/H5C.c
index f651fb2..c229a46 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -414,12 +414,6 @@ done:
* Programmer: John Mainzer
* 3/17/10
*
- * Modifications:
- *
- * Heavily reworked to have each process flush a group of
- * adjacent entries.
- * JRM -- 4/15/10
- *
*-------------------------------------------------------------------------
*/
#ifdef H5_HAVE_PARALLEL
@@ -442,8 +436,13 @@ H5C_apply_candidate_list(H5F_t * f,
int last_entry_to_flush;
int entries_to_clear = 0;
int entries_to_flush = 0;
+ int entries_to_flush_or_clear_last = 0;
+ int entries_to_flush_collectively = 0;
int entries_cleared = 0;
int entries_flushed = 0;
+ int entries_delayed = 0;
+ int entries_flushed_or_cleared_last = 0;
+ int entries_flushed_collectively = 0;
int entries_examined = 0;
int initial_list_len;
int * candidate_assignment_table = NULL;
@@ -451,6 +450,7 @@ H5C_apply_candidate_list(H5F_t * f,
H5C_cache_entry_t * clear_ptr = NULL;
H5C_cache_entry_t * entry_ptr = NULL;
H5C_cache_entry_t * flush_ptr = NULL;
+ H5C_cache_entry_t * delayed_ptr = NULL;
#if H5C_DO_SANITY_CHECKS
haddr_t last_addr;
#endif /* H5C_DO_SANITY_CHECKS */
@@ -612,12 +612,28 @@ H5C_apply_candidate_list(H5F_t * f,
(int)(cache_ptr->LRU_list_len));
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
+ /* ====================================================================== *
+ * Now scan the LRU and PEL lists, flushing or clearing entries as
+ * needed.
+ *
+ * The flush_me_last and flush_me_collectively flags may dictate how or
+ * when some entries can be flushed, and should be addressed here.
+ * However, in their initial implementation, these flags only apply to the
+ * superblock, so there's only a relatively small change to this function
+ * to account for this one case where they come into play. If these flags
+ * are ever expanded upon, this function and the following flushing steps
+ * should be reworked to account for additional cases.
+ * ====================================================================== */
+
entries_examined = 0;
initial_list_len = cache_ptr->LRU_list_len;
entry_ptr = cache_ptr->LRU_tail_ptr;
+ /* Examine each entry in the LRU list */
while((entry_ptr != NULL) && (entries_examined <= initial_list_len) &&
((entries_cleared + entries_flushed) < num_candidates)) {
+
+ /* If this process needs to clear this entry. */
if(entry_ptr->clear_on_unprotect) {
entry_ptr->clear_on_unprotect = FALSE;
clear_ptr = entry_ptr;
@@ -625,7 +641,7 @@ H5C_apply_candidate_list(H5F_t * f,
entries_cleared++;
#if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 )
- HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank,
+ HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank,
(long long)clear_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
@@ -638,14 +654,18 @@ H5C_apply_candidate_list(H5F_t * f,
&first_flush,
TRUE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
- } else if(entry_ptr->flush_immediately) {
+ } /* end if */
+
+ /* Else, if this process needs to flush this entry. */
+ else if (entry_ptr->flush_immediately) {
+
entry_ptr->flush_immediately = FALSE;
flush_ptr = entry_ptr;
entry_ptr = entry_ptr->prev;
entries_flushed++;
#if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 )
- HDfprintf(stdout, "%s:%d: flushing 0x%llx.\n", FUNC, mpi_rank,
+ HDfprintf(stdout, "%s:%d: flushing 0x%llx.\n", FUNC, mpi_rank,
(long long)flush_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
@@ -657,17 +677,20 @@ H5C_apply_candidate_list(H5F_t * f,
H5C__NO_FLAGS_SET,
&first_flush,
TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
- } else {
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry.")
+ } /* end else-if */
+
+ /* Otherwise, no action to be taken on this entry. Grab the next. */
+ else {
entry_ptr = entry_ptr->prev;
- }
+ } /* end else */
entries_examined++;
} /* end while */
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
- HDfprintf(stdout, "%s:%d: entries examined/cleared/flushed = %d/%d/%d.\n",
- FUNC, mpi_rank, entries_examined,
+ HDfprintf(stdout, "%s:%d: entries examined/cleared/flushed = %d/%d/%d.\n",
+ FUNC, mpi_rank, entries_examined,
entries_cleared, entries_flushed);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
@@ -676,69 +699,168 @@ H5C_apply_candidate_list(H5F_t * f,
*/
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
- HDfprintf(stdout, "%s:%d: scanning pinned entry list. len = %d\n",
+ HDfprintf(stdout, "%s:%d: scanning pinned entry list. len = %d\n",
FUNC, mpi_rank, (int)(cache_ptr->pel_len));
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
entry_ptr = cache_ptr->pel_head_ptr;
while((entry_ptr != NULL) &&
- ((entries_cleared + entries_flushed) < num_candidates)) {
- if(entry_ptr->clear_on_unprotect) {
- entry_ptr->clear_on_unprotect = FALSE;
- clear_ptr = entry_ptr;
- entry_ptr = entry_ptr->next;
- entries_cleared++;
+ ((entries_cleared + entries_flushed + entries_delayed)
+ < num_candidates)) {
+
+ /* If entry is marked for flush or for clear */
+ if((entry_ptr->clear_on_unprotect||entry_ptr->flush_immediately)) {
+
+ /* If this entry needs to be flushed last */
+ if (entry_ptr->flush_me_last) {
+
+ /* At this time, only the superblock supports being
+ flushed last. Conveniently, it also happens to be the only
+ entry that supports being flushed collectively, as well. Also
+ conveniently, it's always pinned, so we only need to check
+ for it while scanning the PEL here. Finally, it's never
+ included in a candidate list that excludes other dirty
+ entries in a cache, so we can handle this relatively simple
+ case here.
+
+ For now, this function asserts this and saves the entry
+ to flush it after scanning the rest of the PEL list.
+
+ If there are ever more entries that either need to be
+ flushed last and/or flushed collectively, this whole routine
+ will need to be reworked to handle all additional cases. As
+ it is the simple case of a single pinned entry needing
+ flushed last and collectively is just a minor addition to
+ this routine, but signficantly buffing up the usage of
+ flush_me_last or flush_me_collectively will require a more
+ intense rework of this function and potentially the function
+ of candidate lists as a whole. */
+
+ HDassert(entry_ptr->flush_me_collectively);
+ entries_to_flush_or_clear_last++;
+ entries_to_flush_collectively++;
+ HDassert(entries_to_flush_or_clear_last == 1);
+ HDassert(entries_to_flush_collectively == 1);
+
+ /* Delay the entry. It will be flushed later. */
+ delayed_ptr = entry_ptr;
+ entries_delayed++;
+ HDassert(entries_delayed == 1);
+
+ } /* end if */
+
+ /* Else, this process needs to clear this entry. */
+ else if (entry_ptr->clear_on_unprotect) {
+ HDassert(!entry_ptr->flush_immediately);
+ entry_ptr->clear_on_unprotect = FALSE;
+ clear_ptr = entry_ptr;
+ entry_ptr = entry_ptr->next;
+ entries_cleared++;
#if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 )
- HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank,
+ HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank,
(long long)clear_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
- if(H5C_flush_single_entry(f,
- primary_dxpl_id,
- secondary_dxpl_id,
- clear_ptr->type,
- clear_ptr->addr,
- H5C__FLUSH_CLEAR_ONLY_FLAG,
- &first_flush,
- TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
- } else if(entry_ptr->flush_immediately) {
- entry_ptr->flush_immediately = FALSE;
- flush_ptr = entry_ptr;
- entry_ptr = entry_ptr->next;
- entries_flushed++;
+ if(H5C_flush_single_entry(f,
+ primary_dxpl_id,
+ secondary_dxpl_id,
+ clear_ptr->type,
+ clear_ptr->addr,
+ H5C__FLUSH_CLEAR_ONLY_FLAG,
+ &first_flush,
+ TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
+ } /* end else-if */
+
+ /* Else, if this process needs to independently flush this entry. */
+ else if (entry_ptr->flush_immediately) {
+ entry_ptr->flush_immediately = FALSE;
+ flush_ptr = entry_ptr;
+ entry_ptr = entry_ptr->next;
+ entries_flushed++;
#if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 )
- HDfprintf(stdout, "%s:%d: flushing 0x%llx.\n", FUNC, mpi_rank,
+ HDfprintf(stdout, "%s:%d: flushing 0x%llx.\n", FUNC, mpi_rank,
(long long)flush_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
- if(H5C_flush_single_entry(f,
- primary_dxpl_id,
- secondary_dxpl_id,
- flush_ptr->type,
- flush_ptr->addr,
- H5C__NO_FLAGS_SET,
- &first_flush,
- TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
- } else {
+ if(H5C_flush_single_entry(f,
+ primary_dxpl_id,
+ secondary_dxpl_id,
+ flush_ptr->type,
+ flush_ptr->addr,
+ H5C__NO_FLAGS_SET,
+ &first_flush,
+ TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry.")
+ } /* end else-if */
+ } /* end if */
+
+ /* Otherwise, this entry is not marked for flush or clear. Grab the next. */
+ else {
entry_ptr = entry_ptr->next;
- }
+ } /* end else */
+
} /* end while */
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
- HDfprintf(stdout,
- "%s:%d: pel entries examined/cleared/flushed = %d/%d/%d.\n",
- FUNC, mpi_rank, entries_examined,
+ HDfprintf(stdout,
+ "%s:%d: pel entries examined/cleared/flushed = %d/%d/%d.\n",
+ FUNC, mpi_rank, entries_examined,
entries_cleared, entries_flushed);
HDfprintf(stdout, "%s:%d: done.\n", FUNC, mpi_rank);
fsync(stdout);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
- if((entries_flushed != entries_to_flush) || (entries_cleared != entries_to_clear))
+ /* ====================================================================== *
+ * Now, handle all delayed entries. *
+ * *
+ * This can *only* be the superblock at this time, so it's relatively *
+ * easy to deal with. We're collectively flushing the entry saved from *
+ * above. This will need to be handled differently if there are ever more *
+ * than one entry needing this special treatment.) *
+ * ====================================================================== */
+
+ if (delayed_ptr) {
+
+ if (delayed_ptr->clear_on_unprotect) {
+ entry_ptr->clear_on_unprotect = FALSE;
+ entries_cleared++;
+ } else if (delayed_ptr->flush_immediately) {
+ entry_ptr->flush_immediately = FALSE;
+ entries_flushed++;
+ } /* end if */
+
+ if(H5C_flush_single_entry(f,
+ primary_dxpl_id,
+ secondary_dxpl_id,
+ delayed_ptr->type,
+ delayed_ptr->addr,
+ H5C__NO_FLAGS_SET,
+ &first_flush,
+ TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL,
+ "Can't flush entry collectively.")
+
+ entries_flushed_collectively++;
+ entries_flushed_or_cleared_last++;
+ } /* end if */
+
+ /* ====================================================================== *
+ * Finished flushing everything. *
+ * ====================================================================== */
+
+ HDassert((entries_flushed == entries_to_flush));
+ HDassert((entries_cleared == entries_to_clear));
+ HDassert((entries_flushed_or_cleared_last == entries_to_flush_or_clear_last));
+ HDassert((entries_flushed_collectively == entries_to_flush_collectively));
+
+ if((entries_flushed != entries_to_flush) ||
+ (entries_cleared != entries_to_clear) ||
+ (entries_flushed_or_cleared_last != entries_to_flush_or_clear_last) ||
+ (entries_flushed_collectively != entries_to_flush_collectively))
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry count mismatch.")
done:
@@ -924,7 +1046,8 @@ H5C_construct_candidate_list__min_clean(H5C_t * cache_ptr)
entry_ptr = cache_ptr->dLRU_tail_ptr;
while((nominated_entries_size < space_needed) &&
(nominated_entries_count < cache_ptr->slist_len) &&
- (entry_ptr != NULL)) {
+ (entry_ptr != NULL) &&
+ (!entry_ptr->flush_me_last)) {
haddr_t nominated_addr;
HDassert( ! (entry_ptr->is_protected) );
@@ -1771,8 +1894,12 @@ H5C_flush_cache(H5F_t *f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, unsign
HDassert( entry_ptr != NULL );
HDassert( entry_ptr->in_slist );
- if ( ( ! flush_marked_entries ) ||
- ( entry_ptr->flush_marker ) ) {
+ if ( ( ( ! flush_marked_entries ) ||
+ ( entry_ptr->flush_marker ) ) &&
+ ( ( ! entry_ptr->flush_me_last ) ||
+ ( ( entry_ptr->flush_me_last ) &&
+ ( cache_ptr->num_last_entries >=
+ cache_ptr->slist_len ) ) ) ) {
if ( entry_ptr->is_protected ) {
@@ -2524,6 +2651,10 @@ H5C_insert_entry(H5F_t * f,
herr_t result;
hbool_t first_flush = TRUE;
hbool_t insert_pinned;
+ hbool_t flush_last;
+#ifdef H5_HAVE_PARALLEL
+ hbool_t flush_collectively;
+#endif
hbool_t set_flush_marker;
hbool_t write_permitted = TRUE;
size_t empty_space;
@@ -2562,8 +2693,12 @@ H5C_insert_entry(H5F_t * f,
}
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
- set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 );
- insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 );
+ set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 );
+ insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 );
+ flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 );
+#ifdef H5_HAVE_PARALLEL
+ flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 );
+#endif
entry_ptr = (H5C_cache_entry_t *)thing;
@@ -2604,6 +2739,10 @@ H5C_insert_entry(H5F_t * f,
entry_ptr->is_pinned = insert_pinned;
entry_ptr->pinned_from_client = insert_pinned;
+ entry_ptr->flush_me_last = flush_last;
+#ifdef H5_HAVE_PARALLEL
+ entry_ptr->flush_me_collectively = flush_collectively;
+#endif
/* newly inserted entries are assumed to be dirty */
entry_ptr->is_dirty = TRUE;
@@ -7710,85 +7849,91 @@ H5C_flush_invalidate_cache(H5F_t * f,
HDassert( entry_ptr != NULL );
HDassert( entry_ptr->in_slist );
-#if H5C_DO_SANITY_CHECKS
- /* update actual_slist_len & actual_slist_size before
- * the flush. Note that the entry will be removed
- * from the slist after the flush, and thus may be
- * resized by the flush callback. This is OK, as
- * we will catch the size delta in
- * cache_ptr->slist_size_increase.
- *
- * Note that we include pinned entries in this count, even
- * though we will not actually flush them.
- */
- actual_slist_len++;
- actual_slist_size += entry_ptr->size;
-#endif /* H5C_DO_SANITY_CHECKS */
+ if ( ( ! entry_ptr->flush_me_last ) ||
+ ( ( entry_ptr->flush_me_last ) &&
+ ( cache_ptr->num_last_entries >=
+ cache_ptr->slist_len ) ) ) {
+
+ #if H5C_DO_SANITY_CHECKS
+ /* update actual_slist_len & actual_slist_size before
+ * the flush. Note that the entry will be removed
+ * from the slist after the flush, and thus may be
+ * resized by the flush callback. This is OK, as
+ * we will catch the size delta in
+ * cache_ptr->slist_size_increase.
+ *
+ * Note that we include pinned entries in this count, even
+ * though we will not actually flush them.
+ */
+ actual_slist_len++;
+ actual_slist_size += entry_ptr->size;
+ #endif /* H5C_DO_SANITY_CHECKS */
- if ( entry_ptr->is_protected ) {
+ if ( entry_ptr->is_protected ) {
- /* we have major problems -- but lets flush
- * everything we can before we flag an error.
- */
- protected_entries++;
+ /* we have major problems -- but lets flush
+ * everything we can before we flag an error.
+ */
+ protected_entries++;
- } else if ( entry_ptr->is_pinned ) {
+ } else if ( entry_ptr->is_pinned ) {
- /* Test to see if we are can flush the entry now.
- * If we can, go ahead and flush, but don't tell
- * H5C_flush_single_entry() to destroy the entry
- * as pinned entries can't be evicted.
- */
- if(entry_ptr->flush_dep_height == curr_flush_dep_height ) {
- status = H5C_flush_single_entry(f,
- primary_dxpl_id,
- secondary_dxpl_id,
- NULL,
- entry_ptr->addr,
- H5C__NO_FLAGS_SET,
- &first_flush,
- FALSE);
- if ( status < 0 ) {
-
- /* This shouldn't happen -- if it does, we are toast
- * so just scream and die.
- */
+ /* Test to see if we are can flush the entry now.
+ * If we can, go ahead and flush, but don't tell
+ * H5C_flush_single_entry() to destroy the entry
+ * as pinned entries can't be evicted.
+ */
+ if(entry_ptr->flush_dep_height == curr_flush_dep_height ) {
+ status = H5C_flush_single_entry(f,
+ primary_dxpl_id,
+ secondary_dxpl_id,
+ NULL,
+ entry_ptr->addr,
+ H5C__NO_FLAGS_SET,
+ &first_flush,
+ FALSE);
+ if ( status < 0 ) {
+
+ /* This shouldn't happen -- if it does, we are toast
+ * so just scream and die.
+ */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "dirty pinned entry flush failed.")
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
+ "dirty pinned entry flush failed.")
+ } /* end if */
+ flushed_during_dep_loop = TRUE;
} /* end if */
- flushed_during_dep_loop = TRUE;
+ else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
+ /* This shouldn't happen -- if it does, just scream and die. */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.")
} /* end if */
- else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
- /* This shouldn't happen -- if it does, just scream and die. */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.")
- } /* end if */
- else {
- if(entry_ptr->flush_dep_height == curr_flush_dep_height ){
+ else {
+ if(entry_ptr->flush_dep_height == curr_flush_dep_height ){
- status = H5C_flush_single_entry(f,
- primary_dxpl_id,
- secondary_dxpl_id,
- NULL,
- entry_ptr->addr,
- (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG),
- &first_flush,
- TRUE);
- if ( status < 0 ) {
-
- /* This shouldn't happen -- if it does, we are toast so
- * just scream and die.
- */
+ status = H5C_flush_single_entry(f,
+ primary_dxpl_id,
+ secondary_dxpl_id,
+ NULL,
+ entry_ptr->addr,
+ (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG),
+ &first_flush,
+ TRUE);
+ if ( status < 0 ) {
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "dirty entry flush destroy failed.")
+ /* This shouldn't happen -- if it does, we are toast so
+ * just scream and die.
+ */
+
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
+ "dirty entry flush destroy failed.")
+ } /* end if */
+ flushed_during_dep_loop = TRUE;
} /* end if */
- flushed_during_dep_loop = TRUE;
- } /* end if */
- else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
- /* This shouldn't happen -- if it does, just scream and die. */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.")
- } /* end else */
+ else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
+ /* This shouldn't happen -- if it does, just scream and die. */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.")
+ } /* end else */
+ } /* end if */
} /* end while loop scanning skip list */
#if H5C_DO_SANITY_CHECKS
@@ -7835,45 +7980,52 @@ H5C_flush_invalidate_cache(H5F_t * f,
next_entry_ptr = entry_ptr->ht_next;
HDassert ( ( next_entry_ptr == NULL ) ||
( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ) );
- if ( entry_ptr->is_protected ) {
-
- /* we have major problems -- but lets flush and destroy
- * everything we can before we flag an error.
- */
- protected_entries++;
- if ( ! entry_ptr->in_slist ) {
+ if ( ( ! entry_ptr->flush_me_last ) ||
+ ( ( entry_ptr->flush_me_last ) &&
+ ( cache_ptr->num_last_entries >=
+ cache_ptr->slist_len ) ) ) {
- HDassert( !(entry_ptr->is_dirty) );
- }
- } else if ( ! ( entry_ptr->is_pinned ) ) {
+ if ( entry_ptr->is_protected ) {
- /* Test to see if we are can flush the entry now.
- * If we can, go ahead and flush.
- */
- if(entry_ptr->flush_dep_height == curr_flush_dep_height ){
- status = H5C_flush_single_entry(f,
- primary_dxpl_id,
- secondary_dxpl_id,
- NULL,
- entry_ptr->addr,
- (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG),
- &first_flush,
- TRUE);
- if ( status < 0 ) {
+ /* we have major problems -- but lets flush and destroy
+ * everything we can before we flag an error.
+ */
+ protected_entries++;
- /* This shouldn't happen -- if it does, we are toast so
- * just scream and die.
- */
+ if ( ! entry_ptr->in_slist ) {
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Entry flush destroy failed.")
+ HDassert( !(entry_ptr->is_dirty) );
}
- flushed_during_dep_loop = TRUE;
+ } else if ( ! ( entry_ptr->is_pinned ) ) {
+
+ /* Test to see if we are can flush the entry now.
+ * If we can, go ahead and flush.
+ */
+ if(entry_ptr->flush_dep_height == curr_flush_dep_height ){
+ status = H5C_flush_single_entry(f,
+ primary_dxpl_id,
+ secondary_dxpl_id,
+ NULL,
+ entry_ptr->addr,
+ (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG),
+ &first_flush,
+ TRUE);
+ if ( status < 0 ) {
+
+ /* This shouldn't happen -- if it does, we are toast so
+ * just scream and die.
+ */
+
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
+ "Entry flush destroy failed.")
+ }
+ flushed_during_dep_loop = TRUE;
+ } /* end if */
+ else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
+ /* This shouldn't happen -- if it does, just scream and die. */
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.")
} /* end if */
- else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
- /* This shouldn't happen -- if it does, just scream and die. */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.")
} /* end if */
/* We can't do anything if the entry is pinned. The
* hope is that the entry will be unpinned as the
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index 37068f1..909578b 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -282,6 +282,16 @@
* don't use this at present, I hope that this will allow
* some optimizations when I get to it.
*
+ * num_last_entries: The number of entries in the cache that can only be
+ * flushed after all other entries in the cache have
+ * been flushed. At this time, this will only ever be
+ * one entry (the superblock), and the code has been
+ * protected with HDasserts to enforce this. This restraint
+ * can certainly be relaxed in the future if the need for
+ * multiple entries being flushed last arises, though
+ * explicit tests for that case should be added when said
+ * HDasserts are removed.
+ *
* With the addition of the fractal heap, the cache must now deal with
* the case in which entries may be dirtied, moved, or have their sizes
* changed during a flush. To allow sanity checks in this situation, the
@@ -878,6 +888,7 @@ struct H5C_t
int32_t slist_len;
size_t slist_size;
H5SL_t * slist_ptr;
+ int32_t num_last_entries;
#if H5C_DO_SANITY_CHECKS
int64_t slist_len_increase;
int64_t slist_size_increase;
@@ -1964,6 +1975,10 @@ if ( (cache_ptr)->index_size != \
} else { \
(cache_ptr)->clean_index_size += (entry_ptr)->size; \
} \
+ if ((entry_ptr)->flush_me_last) { \
+ (cache_ptr)->num_last_entries++; \
+ HDassert((cache_ptr)->num_last_entries == 1); \
+ } \
H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \
}
@@ -1993,6 +2008,10 @@ if ( (cache_ptr)->index_size != \
} else { \
(cache_ptr)->clean_index_size -= (entry_ptr)->size; \
} \
+ if ((entry_ptr)->flush_me_last) { \
+ (cache_ptr)->num_last_entries--; \
+ HDassert((cache_ptr)->num_last_entries == 0); \
+ } \
H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) \
}
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 0c7631a..7fde69b 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -371,6 +371,23 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t * cache_ptr,
* H5C__FLUSH_MARKED_ENTRIES_FLAG. The flag is reset when
* the entry is flushed for whatever reason.
*
+ * flush_me_last: Boolean flag indicating that this entry should not be
+ * flushed from the cache until all other entries without
+ * the flush_me_last flag set have been flushed.
+ *
+ * flush_me_collectively: Boolean flag indicating that this entry needs
+ * to be flushed collectively when in a parallel
+ * situation.
+ *
+ * Note: At this time, the flush_me_last and flush_me_collectively
+ * flags will only be applied to one entry, the superblock,
+ * and the code utilizing these flags is protected with HDasserts
+ * to enforce this. This restraint can certainly be relaxed in
+ * the future if the the need for multiple entries getting flushed
+ * last or collectively arises, though the code allowing for that
+ * will need to be expanded and tested appropriately if that
+ * functionality is desired.
+ *
* clear_on_unprotect: Boolean flag used only in PHDF5. When H5C is used
* to implement the metadata cache In the parallel case, only
* the cache with mpi rank 0 is allowed to actually write to
@@ -578,7 +595,7 @@ typedef struct H5C_cache_entry_t
haddr_t addr;
size_t size;
const H5C_class_t * type;
- haddr_t tag;
+ haddr_t tag;
hbool_t is_dirty;
hbool_t dirtied;
hbool_t is_protected;
@@ -587,13 +604,15 @@ typedef struct H5C_cache_entry_t
hbool_t is_pinned;
hbool_t in_slist;
hbool_t flush_marker;
+ hbool_t flush_me_last;
#ifdef H5_HAVE_PARALLEL
+ hbool_t flush_me_collectively;
hbool_t clear_on_unprotect;
- hbool_t flush_immediately;
+ hbool_t flush_immediately;
#endif /* H5_HAVE_PARALLEL */
hbool_t flush_in_progress;
hbool_t destroy_in_progress;
- hbool_t free_file_space_on_destroy;
+ hbool_t free_file_space_on_destroy;
/* fields supporting the 'flush dependency' feature: */
@@ -1042,6 +1061,8 @@ typedef struct H5C_auto_size_ctl_t
#define H5C__READ_ONLY_FLAG 0x0200
#define H5C__FREE_FILE_SPACE_FLAG 0x0800
#define H5C__TAKE_OWNERSHIP_FLAG 0x1000
+#define H5C__FLUSH_LAST_FLAG 0x2000
+#define H5C__FLUSH_COLLECTIVELY_FLAG 0x4000
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5C_apply_candidate_list(H5F_t * f,
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 93e8869..7a06477 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -3798,7 +3798,9 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim)
/*
* Determine the chunks which need to be filled or removed
*/
- for(op_dim=0; op_dim<space_ndims; op_dim++) {
+ HDmemset(min_mod_chunk_off, 0, sizeof(min_mod_chunk_off));
+ HDmemset(max_mod_chunk_off, 0, sizeof(max_mod_chunk_off));
+ for(op_dim = 0; op_dim < space_ndims; op_dim++) {
/* Calculate the largest offset of chunks that might need to be
* modified in this dimension */
max_mod_chunk_off[op_dim] = chunk_dim[op_dim] * ((old_dim[op_dim] - 1)
diff --git a/src/H5Doh.c b/src/H5Doh.c
index 641c8b8..2dab247 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -447,7 +447,7 @@ done:
static herr_t
H5O__dset_flush(H5G_loc_t *obj_loc, hid_t dxpl_id)
{
- H5D_t *dset; /* Dataset opened */
+ H5D_t *dset = NULL; /* Dataset opened */
H5O_type_t obj_type; /* Type of object at location */
herr_t ret_value = SUCCEED; /* Return value */
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 594a69a..76eaaf5 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -264,7 +264,10 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
if(cls_ptr->lib_vers)
eprint->cls.lib_vers = cls_ptr->lib_vers;
- fprintf(stream, "%s-DIAG: Error detected in %s (%s) ", cls_ptr->cls_name, cls_ptr->lib_name, cls_ptr->lib_vers);
+ fprintf(stream, "%s-DIAG: Error detected in %s (%s) ",
+ (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"),
+ (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"),
+ (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)"));
/* try show the process or thread id in multiple processes cases*/
#ifdef H5_HAVE_PARALLEL
@@ -387,7 +390,10 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
if(cls_ptr->lib_vers)
eprint->cls.lib_vers = cls_ptr->lib_vers;
- fprintf(stream, "%s-DIAG: Error detected in %s (%s) ", cls_ptr->cls_name, cls_ptr->lib_name, cls_ptr->lib_vers);
+ fprintf(stream, "%s-DIAG: Error detected in %s (%s) ",
+ (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"),
+ (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"),
+ (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)"));
/* try show the process or thread id in multiple processes cases*/
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5FD.c b/src/H5FD.c
index e5fec54..0c375ed 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -71,7 +71,6 @@ static herr_t H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *),
void *pl);
static herr_t H5FD_free_cls(H5FD_class_t *cls);
static herr_t H5FD_fapl_copy(hid_t driver_id, const void *fapl, void **copied_fapl);
-static herr_t H5FD_dxpl_copy(hid_t driver_id, const void *dxpl, void **copied_dxpl);
static int H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/);
static int H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/);
@@ -457,13 +456,9 @@ H5FD_get_class(hid_t id)
if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID")
ret_value = H5FD_get_class(driver_id);
- } else if(TRUE == H5P_isa_class(id, H5P_DATASET_XFER)) {
- if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID")
- ret_value = H5FD_get_class(driver_id);
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver id, file access property list or data transfer property list")
- }
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver id or file access property list")
} /* end if */
done:
@@ -827,125 +822,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_dxpl_open
- *
- * Purpose: Mark a driver as used by a data transfer property list
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Thursday, October 23, 2003
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5FD_dxpl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info)
-{
- void *copied_driver_info = NULL; /* Temporary VFL driver info */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Increment the reference count on the driver and copy the driver info */
- if(H5I_inc_ref(driver_id, FALSE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "can't increment VFL driver ID")
- if(H5FD_dxpl_copy(driver_id, driver_info, &copied_driver_info) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "can't copy VFL driver")
-
- /* Set the driver information for the new property list */
- if(H5P_set(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VFL driver ID")
- if(H5P_set(plist, H5D_XFER_VFL_INFO_NAME, &copied_driver_info) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VFL driver info")
-
-done:
- if(ret_value < 0)
- if(copied_driver_info && H5FD_dxpl_close(driver_id, copied_driver_info) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_dxpl_open() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5FD_dxpl_copy
- *
- * Purpose: Copies the driver-specific part of the data transfer property
- * list.
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Robb Matzke
- * Tuesday, August 3, 1999
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5FD_dxpl_copy(hid_t driver_id, const void *old_dxpl, void **copied_dxpl)
-{
- H5FD_class_t *driver;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
-
- /* Copy the file access property list */
- if(H5FD_pl_copy(driver->dxpl_copy, driver->dxpl_size, old_dxpl, copied_dxpl) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't copy driver data transfer property list")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_dxpl_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5FD_dxpl_close
- *
- * Purpose: Closes a driver for a dataset transfer property list
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Robb Matzke
- * Tuesday, August 3, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5FD_dxpl_close(hid_t driver_id, void *dxpl)
-{
- H5FD_class_t *driver;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check args */
- if(driver_id > 0) {
- if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID")
-
- /* Close the driver for the property list */
- if(H5FD_pl_close(driver_id, driver->dxpl_free, dxpl) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver fapl_free request failed")
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_dxpl_close() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5FDopen
*
* Purpose: Opens a file named NAME for the type(s) of access described
@@ -1457,9 +1333,9 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
if(size == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request")
if(H5P_DEFAULT == dxpl_id)
- dxpl_id= H5P_DATASET_XFER_DEFAULT;
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
- if(TRUE != H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list")
/* Do the real work */
@@ -1509,9 +1385,9 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz
if(type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type")
if(H5P_DEFAULT == dxpl_id)
- dxpl_id= H5P_DATASET_XFER_DEFAULT;
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
- if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
/* Do the real work */
@@ -1797,7 +1673,7 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size
/* Get the default dataset transfer property list if the user didn't provide one */
if(H5P_DEFAULT == dxpl_id)
- dxpl_id= H5P_DATASET_XFER_DEFAULT;
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
@@ -1966,7 +1842,7 @@ H5FDtruncate(H5FD_t *file, hid_t dxpl_id, unsigned closing)
if(H5P_DEFAULT == dxpl_id)
dxpl_id = H5P_DATASET_XFER_DEFAULT;
else
- if(TRUE != H5P_isa_class(dxpl_id,H5P_DATASET_XFER))
+ if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list")
/* Do the real work */
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 1fef36c..932e2af 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -184,7 +184,7 @@ static const H5FD_class_t H5FD_core_g = {
H5FD_core_truncate, /*truncate */
NULL, /*lock */
NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ H5FD_FLMAP_DICHOTOMY /*fl_map */
};
@@ -427,8 +427,9 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id,
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "maxaddr overflow")
HDassert(H5P_DEFAULT != fapl_id);
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- fa = (H5FD_core_fapl_t *)H5P_get_driver_info(plist);
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
+ if(NULL == (fa = (H5FD_core_fapl_t *)H5P_get_driver_info(plist)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
/* Build the open flags */
o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY;
@@ -443,6 +444,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id,
/* If the file image exists and this is an open, make sure the file doesn't exist */
HDassert(((file_image_info.buffer != NULL) && (file_image_info.size > 0)) ||
((file_image_info.buffer == NULL) && (file_image_info.size == 0)));
+ HDmemset(&sb, 0, sizeof(sb));
if((file_image_info.buffer != NULL) && !(H5F_ACC_CREAT & flags)) {
if(HDopen(name, o_flags, 0666) >= 0)
HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file already exists")
@@ -462,7 +464,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id,
* store is off is when the backing_store flag is off and H5F_ACC_CREAT is
* on. */
else if(fa->backing_store || !(H5F_ACC_CREAT & flags)) {
- if(fa && (fd = HDopen(name, o_flags, 0666)) < 0)
+ if((fd = HDopen(name, o_flags, 0666)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
if(HDfstat(fd, &sb) < 0)
HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file")
@@ -479,7 +481,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id,
* default value. But if the file access property list was zero then use
* the default value instead.
*/
- file->increment = (fa && fa->increment>0) ? fa->increment : H5FD_CORE_INCREMENT;
+ file->increment = (fa->increment>0) ? fa->increment : H5FD_CORE_INCREMENT;
/* If save data in backing store. */
file->backing_store = fa->backing_store;
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 218a1dd..4721a44 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -205,7 +205,7 @@ static const H5FD_class_t H5FD_direct_g = {
H5FD_direct_truncate, /*truncate */
NULL, /*lock */
NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ H5FD_FLMAP_DICHOTOMY /*fl_map */
};
/* Declare a free list to manage the H5FD_direct_t struct */
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 6f6d757..f051269 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -82,18 +82,11 @@ typedef struct H5FD_family_fapl_t {
hid_t memb_fapl_id; /*file access property list of each memb*/
} H5FD_family_fapl_t;
-/* Driver specific data transfer properties */
-typedef struct H5FD_family_dxpl_t {
- hid_t memb_dxpl_id; /*data xfer property list of each memb */
-} H5FD_family_dxpl_t;
-
/* Callback prototypes */
static herr_t H5FD_family_term(void);
static void *H5FD_family_fapl_get(H5FD_t *_file);
static void *H5FD_family_fapl_copy(const void *_old_fa);
static herr_t H5FD_family_fapl_free(void *_fa);
-static void *H5FD_family_dxpl_copy(const void *_old_dx);
-static herr_t H5FD_family_dxpl_free(void *_dx);
static hsize_t H5FD_family_sb_size(H5FD_t *_file);
static herr_t H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/,
unsigned char *buf/*out*/);
@@ -128,9 +121,9 @@ static const H5FD_class_t H5FD_family_g = {
H5FD_family_fapl_get, /*fapl_get */
H5FD_family_fapl_copy, /*fapl_copy */
H5FD_family_fapl_free, /*fapl_free */
- sizeof(H5FD_family_dxpl_t), /*dxpl_size */
- H5FD_family_dxpl_copy, /*dxpl_copy */
- H5FD_family_dxpl_free, /*dxpl_free */
+ 0, /*dxpl_size */
+ NULL, /*dxpl_copy */
+ NULL, /*dxpl_free */
H5FD_family_open, /*open */
H5FD_family_close, /*close */
H5FD_family_cmp, /*cmp */
@@ -148,7 +141,7 @@ static const H5FD_class_t H5FD_family_g = {
H5FD_family_truncate, /*truncate */
NULL, /*lock */
NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ H5FD_FLMAP_DICHOTOMY /*fl_map */
};
@@ -482,92 +475,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_family_dxpl_copy
- *
- * Purpose: Copes the family-specific data transfer properties.
- *
- * Return: Success: Ptr to new property list
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5FD_family_dxpl_copy(const void *_old_dx)
-{
- const H5FD_family_dxpl_t *old_dx = (const H5FD_family_dxpl_t*)_old_dx;
- H5FD_family_dxpl_t *new_dx = NULL;
- H5P_genplist_t *plist; /* Property list pointer */
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- if(NULL == (new_dx = (H5FD_family_dxpl_t *)H5MM_malloc(sizeof(H5FD_family_dxpl_t))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
-
- HDmemcpy(new_dx, old_dx, sizeof(H5FD_family_dxpl_t));
-
- if(old_dx->memb_dxpl_id == H5P_DATASET_XFER_DEFAULT) {
- if(H5I_inc_ref(new_dx->memb_dxpl_id, FALSE)<0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver")
- } /* end if */
- else {
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(old_dx->memb_dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- new_dx->memb_dxpl_id = H5P_copy_plist(plist, FALSE);
- } /* end else */
-
- /* Set return value */
- ret_value=new_dx;
-
-done:
- if(ret_value==NULL) {
- if(new_dx!=NULL)
- H5MM_xfree(new_dx);
- } /* end if */
- FUNC_LEAVE_NOAPI(ret_value)
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5FD_family_dxpl_free
- *
- * Purpose: Frees the family-specific data transfer properties.
- *
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5FD_family_dxpl_free(void *_dx)
-{
- H5FD_family_dxpl_t *dx = (H5FD_family_dxpl_t*)_dx;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- if(H5I_dec_ref(dx->memb_dxpl_id) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID")
- H5MM_xfree(dx);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-}
-
-
-/*-------------------------------------------------------------------------
* Function: H5FD_family_sb_size
*
* Purpose: Returns the size of the private information to be stored in
@@ -1239,7 +1146,6 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si
{
H5FD_family_t *file = (H5FD_family_t*)_file;
unsigned char *buf = (unsigned char*)_buf;
- hid_t memb_dxpl_id = H5P_DATASET_XFER_DEFAULT;
haddr_t sub;
size_t req;
hsize_t tempreq;
@@ -1255,13 +1161,6 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si
*/
if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- if(H5P_DATASET_XFER_DEFAULT != dxpl_id && H5FD_FAMILY == H5P_get_driver(plist)) {
- H5FD_family_dxpl_t *dx = (H5FD_family_dxpl_t *)H5P_get_driver_info(plist);
-
- HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
- assert(dx);
- memb_dxpl_id = dx->memb_dxpl_id;
- } /* end if */
/* Read from each member */
while(size > 0) {
@@ -1279,7 +1178,7 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si
assert(u<file->nmembs);
- if (H5FDread(file->memb[u], type, memb_dxpl_id, sub, req, buf)<0)
+ if (H5FDread(file->memb[u], type, dxpl_id, sub, req, buf)<0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "member file read failed")
addr += req;
@@ -1316,7 +1215,6 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s
{
H5FD_family_t *file = (H5FD_family_t*)_file;
const unsigned char *buf = (const unsigned char*)_buf;
- hid_t memb_dxpl_id = H5P_DATASET_XFER_DEFAULT;
haddr_t sub;
size_t req;
hsize_t tempreq;
@@ -1332,13 +1230,6 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s
*/
if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- if(H5P_DATASET_XFER_DEFAULT != dxpl_id && H5FD_FAMILY == H5P_get_driver(plist)) {
- H5FD_family_dxpl_t *dx = (H5FD_family_dxpl_t *)H5P_get_driver_info(plist);
-
- HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER));
- HDassert(dx);
- memb_dxpl_id = dx->memb_dxpl_id;
- } /* end if */
/* Write to each member */
while (size>0) {
@@ -1356,7 +1247,7 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s
assert(u<file->nmembs);
- if (H5FDwrite(file->memb[u], type, memb_dxpl_id, sub, req, buf)<0)
+ if (H5FDwrite(file->memb[u], type, dxpl_id, sub, req, buf)<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "member file write failed")
addr += req;
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index b2c6398..6a2425c 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -233,7 +233,7 @@ static const H5FD_class_t H5FD_log_g = {
H5FD_log_truncate, /*truncate */
NULL, /*lock */
NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ H5FD_FLMAP_DICHOTOMY /*fl_map */
};
/* Declare a free list to manage the H5FD_log_t struct */
diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c
index 01c28e6..866a2cf 100644
--- a/src/H5FDmpi.c
+++ b/src/H5FDmpi.c
@@ -56,12 +56,15 @@ char H5FD_mpi_native_g[] = "native";
int
H5FD_mpi_get_rank(const H5FD_t *file)
{
- const H5FD_class_mpi_t *cls=(const H5FD_class_mpi_t *)(file->cls);
+ const H5FD_class_mpi_t *cls;
+
int ret_value;
FUNC_ENTER_NOAPI(FAIL)
- assert(file && cls);
+ assert(file);
+ cls = (const H5FD_class_mpi_t *)(file->cls);
+ assert(cls);
assert(cls->get_rank); /* All MPI drivers must implement this */
/* Dispatch to driver */
@@ -92,12 +95,14 @@ done:
int
H5FD_mpi_get_size(const H5FD_t *file)
{
- const H5FD_class_mpi_t *cls=(const H5FD_class_mpi_t *)(file->cls);
+ const H5FD_class_mpi_t *cls;
int ret_value;
FUNC_ENTER_NOAPI(FAIL)
- assert(file && cls);
+ assert(file);
+ cls = (const H5FD_class_mpi_t *)(file->cls);
+ assert(cls);
assert(cls->get_size); /* All MPI drivers must implement this */
/* Dispatch to driver */
@@ -128,12 +133,14 @@ done:
MPI_Comm
H5FD_mpi_get_comm(const H5FD_t *file)
{
- const H5FD_class_mpi_t *cls=(const H5FD_class_mpi_t *)(file->cls);
+ const H5FD_class_mpi_t *cls;
MPI_Comm ret_value;
FUNC_ENTER_NOAPI(MPI_COMM_NULL)
- assert(file && cls);
+ assert(file);
+ cls = (const H5FD_class_mpi_t *)(file->cls);
+ assert(cls);
assert(cls->get_comm); /* All MPI drivers must implement this */
/* Dispatch to driver */
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 6dbe831..cac101b 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -127,7 +127,7 @@ static const H5FD_class_mpi_t H5FD_mpio_g = {
H5FD_mpio_truncate, /*truncate */
NULL, /*lock */
NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ H5FD_FLMAP_DICHOTOMY /*fl_map */
}, /* End of superclass information */
H5FD_mpio_mpi_rank, /*get_rank */
H5FD_mpio_mpi_size, /*get_size */
@@ -449,27 +449,23 @@ done:
* Use collective I/O access.
*
* Return: Success: Non-negative
- *
* Failure: Negative
*
* Programmer: Albert Cheng
* April 2, 1998
*
- * Modifications:
- * Robb Matzke, 1999-08-06
- * Modified to work with the virtual file layer.
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iDt", dxpl_id, xfer_mode);
- if(dxpl_id==H5P_DEFAULT)
+ if(dxpl_id == H5P_DEFAULT)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list")
/* Check arguments */
@@ -479,15 +475,12 @@ H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incorrect xfer_mode")
/* Set the transfer mode */
- if (H5P_set(plist,H5D_XFER_IO_XFER_MODE_NAME,&xfer_mode)<0)
+ if(H5P_set(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- /* Initialize driver-specific properties */
- ret_value= H5P_set_driver(plist, H5FD_MPIO, NULL);
-
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_dxpl_mpio() */
/*-------------------------------------------------------------------------
@@ -505,63 +498,54 @@ done:
* Programmer: Albert Cheng
* April 2, 1998
*
- * Modifications:
- * Robb Matzke, 1999-08-06
- * Modified to work with the virtual file layer.
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode/*out*/)
{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dxpl_id, xfer_mode);
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
- if(H5FD_MPIO != H5P_get_driver(plist))
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver")
/* Get the transfer mode */
- if (xfer_mode)
- if (H5P_get(plist,H5D_XFER_IO_XFER_MODE_NAME,xfer_mode)<0)
+ if(xfer_mode)
+ if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, xfer_mode) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_dxpl_mpio() */
+
/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_mpio_collective_opt
-
-Purpose:
- To set a flag to choose linked chunk IO or multi-chunk IO without
- involving decision-making inside HDF5
-
-Description:
- The library will do linked chunk IO or multi-chunk IO without
- involving communications for decision-making process.
- The library won't behave as it asks for only when we find
- that the low-level MPI-IO package doesn't support this.
-
-Parameters:
- hid_t dxpl_id in: Data transfer property list identifier
- H5FD_mpio_chunk_opt_t in: The optimization flag for linked chunk IO
- or multi-chunk IO.
-
-
-Returns:
-Returns a non-negative value if successful. Otherwise returns a negative value.
-*
+ *
+ * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O
+ * without involving decision-making inside HDF5
+ *
+ * Note: The library will do linked chunk I/O or multi-chunk I/O without
+ * involving communications for decision-making process.
+ * The library won't behave as it asks for only when we find
+ * that the low-level MPI-IO package doesn't support this.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Kent Yang
+ * ? ?, ?
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mode)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iDc", dxpl_id, opt_mode);
@@ -577,9 +561,6 @@ H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mo
if(H5P_set(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &opt_mode) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- /* Initialize driver-specific properties */
- ret_value = H5P_set_driver(plist, H5FD_MPIO, NULL);
-
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_dxpl_mpio_collective_opt() */
@@ -587,33 +568,28 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_mpio_chunk_opt
-
-Purpose:
- To set a flag to choose linked chunk IO or multi-chunk IO without
- involving decision-making inside HDF5
-
-Description:
- The library will do linked chunk IO or multi-chunk IO without
- involving communications for decision-making process.
- The library won't behave as it asks for only when we find
- that the low-level MPI-IO package doesn't support this.
-
-Parameters:
- hid_t dxpl_id in: Data transfer property list identifier
- H5FD_mpio_chunk_opt_t in: The optimization flag for linked chunk IO
- or multi-chunk IO.
-
-
-Returns:
-Returns a non-negative value if successful. Otherwise returns a negative value.
-*
+ *
+ * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O
+ * without involving decision-making inside HDF5
+ *
+ * Note: The library will do linked chunk I/O or multi-chunk I/O without
+ * involving communications for decision-making process.
+ * The library won't behave as it asks for only when we find
+ * that the low-level MPI-IO package doesn't support this.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Kent Yang
+ * ? ?, ?
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iDh", dxpl_id, opt_mode);
@@ -626,41 +602,36 @@ H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Set the transfer mode */
- if (H5P_set(plist,H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME,&opt_mode)<0)
+ if(H5P_set(plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, &opt_mode) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- /* Initialize driver-specific properties */
- ret_value= H5P_set_driver(plist, H5FD_MPIO, NULL);
-
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_dxpl_mpio_chunk_opt() */
/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_mpio_chunk_opt_num
-
-Purpose:
- To set a threshold for doing linked chunk IO
-
-Description:
- If the number is greater than the threshold set by the user,
- the library will do linked chunk IO; otherwise, IO will be done for every chunk.
-
-Parameters:
- hid_t dxpl_id in: Data transfer property list identifier
- unsigned num_proc_per_chunk in: the threshold of the average number of chunks selected by each process
-
-Returns:
-Returns a non-negative value if successful. Otherwise returns a negative value.
-*
+ *
+ * Purpose: To set a threshold for doing linked chunk IO
+ *
+ * Note: If the number is greater than the threshold set by the user,
+ * the library will do linked chunk I/O; otherwise, I/O will be
+ * done for every chunk.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Kent Yang
+ * ? ?, ?
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iIu", dxpl_id, num_chunk_per_proc);
@@ -673,41 +644,39 @@ H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Set the transfer mode */
- if (H5P_set(plist,H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME,&num_chunk_per_proc)<0)
+ if(H5P_set(plist, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, &num_chunk_per_proc) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- /* Initialize driver-specific properties */
- ret_value= H5P_set_driver(plist, H5FD_MPIO, NULL);
-
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_dxpl_mpio_chunk_opt_num() */
/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_mpio_chunk_opt_ratio
-
-Purpose:
- To set a threshold for doing collective IO for each chunk
-Description:
- The library will calculate the percentage of the number of process holding selections at each chunk. If that percentage of number of process in the individual chunk is greater than the threshold set by the user, the library will do collective chunk IO for this chunk; otherwise, independent IO will be done for this chunk.
-Parameters:
- hid_t dxpl_id
- in: Data transfer property list identifier
- unsigned percent_num_proc_per_chunk
- in: the threshold of the percentage of the number of process holding selections per chunk
-Returns:
-Returns a non-negative value if successful. Otherwise returns a negative value.
-
-
-*
+ *
+ * Purpose: To set a threshold for doing collective I/O for each chunk
+ *
+ * Note: The library will calculate the percentage of the number of
+ * process holding selections at each chunk. If that percentage
+ * of number of process in the individual chunk is greater than
+ * the threshold set by the user, the library will do collective
+ * chunk I/O for this chunk; otherwise, independent I/O will be
+ * done for this chunk.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Kent Yang
+ * ? ?, ?
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_chunk)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iIu", dxpl_id, percent_num_proc_per_chunk);
@@ -720,15 +689,12 @@ H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_ch
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl")
/* Set the transfer mode */
- if (H5P_set(plist,H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME,&percent_num_proc_per_chunk)<0)
+ if(H5P_set(plist, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, &percent_num_proc_per_chunk) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- /* Initialize driver-specific properties */
- ret_value= H5P_set_driver(plist, H5FD_MPIO, NULL);
-
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_dxpl_mpio_chunk_opt_ratio() */
/*-------------------------------------------------------------------------
@@ -745,10 +711,6 @@ done:
* Programmer: Robb Matzke
* Friday, August 13, 1999
*
- * Modifications:
- * Albert Cheng, 2003-04-17
- * Duplicate the communicator and Info object so that the new
- * property list is insulated from the old one.
*-------------------------------------------------------------------------
*/
static void *
@@ -790,8 +752,6 @@ done:
* Programmer: Albert Cheng
* Jan 8, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void *
diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c
index e6c23f0..261f427 100644
--- a/src/H5FDmpiposix.c
+++ b/src/H5FDmpiposix.c
@@ -37,15 +37,15 @@
#define H5_INTERFACE_INIT_FUNC H5FD_mpiposix_init_interface
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5FDmpi.h" /* MPI-based file drivers */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FDmpi.h" /* MPI-based file drivers */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
/* Features:
* H5_HAVE_GPFS -- issue gpfs_fcntl() calls to hopefully improve
@@ -71,107 +71,101 @@
*/
static hid_t H5FD_MPIPOSIX_g = 0;
-/* File operations */
-#define OP_UNKNOWN 0
-#define OP_READ 1
-#define OP_WRITE 2
+/* Since Windows doesn't follow the rest of the world when it comes
+ * to POSIX I/O types, some typedefs and constants are needed to avoid
+ * making the code messy with #ifdefs.
+ */
+#ifdef H5_HAVE_WIN32_API
+typedef unsigned int h5_mpiposix_io_t;
+typedef int h5_mpiposix_io_ret_t;
+static int H5_MPIPOSIX_MAX_IO_BYTES_g = INT_MAX;
+#else
+/* Unix, everyone else */
+typedef size_t h5_mpiposix_io_t;
+typedef ssize_t h5_mpiposix_io_ret_t;
+static size_t H5_MPIPOSIX_MAX_IO_BYTES_g = SSIZET_MAX;
+#endif /* H5_HAVE_WIN32_API */
/*
* The description of a file belonging to this driver.
- * The EOF value
- * is only used just after the file is opened in order for the library to
- * determine whether the file is empty, truncated, or okay. The MPIPOSIX driver
- * doesn't bother to keep it updated since it's an expensive operation.
+ * The EOF value is only used just after the file is opened in order for the
+ * library to determine whether the file is empty, truncated, or okay. The
+ * MPIPOSIX driver doesn't bother to keep it updated since it's an expensive
+ * operation.
*/
typedef struct H5FD_mpiposix_t {
- H5FD_t pub; /*public stuff, must be first */
- int fd; /*the unix file handle */
- MPI_Comm comm; /*communicator */
- int mpi_rank; /* This process's rank */
- int mpi_size; /* Total number of processes */
- haddr_t eof; /*end-of-file marker */
- haddr_t eoa; /*end-of-address marker */
- haddr_t last_eoa; /* Last known end-of-address marker */
- haddr_t pos; /* Current file I/O position */
- int op; /* Last file I/O operation */
- hsize_t naccess; /* Number of (write) accesses to file */
+ H5FD_t pub; /* public stuff, must be first */
+ int fd; /* the unix file handle */
+ MPI_Comm comm; /* communicator */
+ int mpi_rank; /* This process's rank */
+ int mpi_size; /* Total number of processes */
+ haddr_t eof; /* end-of-file marker */
+ haddr_t eoa; /* end-of-address marker */
+ haddr_t last_eoa; /* Last known end-of-address marker */
+ haddr_t pos; /* Current file I/O position */
+ H5FD_file_op_t op; /* Last file I/O operation */
+ hsize_t naccess; /* Number of (write) accesses to file */
#ifdef H5_HAVE_GPFS
- size_t blksize; /* Block size of file system */
+ size_t blksize; /* Block size of file system */
#endif
- hbool_t use_gpfs; /* Use GPFS to write things */
+ hbool_t use_gpfs; /* Use GPFS to write things */
#ifndef H5_HAVE_WIN32_API
- /*
- * On most systems the combination of device and i-node number uniquely
- * identify a file.
+ /* On most systems the combination of device and i-node number uniquely
+ * identify a file. Note that Cygwin, MinGW and other Windows POSIX
+ * environments have the stat function (which fakes inodes)
+ * and will use the 'device + inodes' scheme as opposed to the
+ * Windows code further below.
*/
- dev_t device; /*file device number */
- ino_t inode; /*file i-node number */
+ dev_t device; /* file device number */
+#ifdef H5_VMS
+ ino_t inode[3]; /* file i-node number */
#else
- /*
- * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the
- * file and the volume serial number uniquely identify a file. This number
- * (which, both? -rpm) may change when the system is restarted or when the
- * file is opened. After a process opens a file, the identifier is
- * constant until the file is closed. An application can use this
- * identifier and the volume serial number to determine whether two
- * handles refer to the same file.
+ ino_t inode; /* file i-node number */
+#endif /* H5_VMS */
+#else
+ /* Files in windows are uniquely identified by the volume serial
+ * number and the file index (both low and high parts).
+ *
+ * There are caveats where these numbers can change, especially
+ * on FAT file systems. On NTFS, however, a file should keep
+ * those numbers the same until renamed or deleted (though you
+ * can use ReplaceFile() on NTFS to keep the numbers the same
+ * while renaming).
+ *
+ * See the MSDN "BY_HANDLE_FILE_INFORMATION Structure" entry for
+ * more information.
+ *
+ * http://msdn.microsoft.com/en-us/library/aa363788(v=VS.85).aspx
*/
- int fileindexlo;
- int fileindexhi;
-#endif
+ DWORD nFileIndexLow;
+ DWORD nFileIndexHigh;
+ DWORD dwVolumeSerialNumber;
+
+ HANDLE hFile; /* Native windows file handle */
+#endif /* H5_HAVE_WIN32_API */
} H5FD_mpiposix_t;
/*
- * This driver supports systems that have the lseek64() function by defining
- * some macros here so we don't have to have conditional compilations later
- * throughout the code.
- *
- * file_offset_t: The datatype for file offsets, the second argument of
- * the lseek() or lseek64() call.
- *
- * file_seek: The function which adjusts the current file position,
- * either lseek() or lseek64().
- */
-/* adding for windows NT file system support. */
-
-#ifdef H5_HAVE_LSEEK64
-# define file_offset_t off64_t
-# define file_seek lseek64
-# define file_truncate ftruncate64
-#elif defined (H5_HAVE_WIN32_API)
-# /*MSVC*/
-# define file_offset_t __int64
-# define file_seek _lseeki64
-# define file_truncate _ftruncatei64
-#else
-# define file_offset_t off_t
-# define file_seek HDlseek
-# define file_truncate HDftruncate
-#endif
-
-/*
* These macros check for overflow of various quantities. These macros
- * assume that file_offset_t is signed and haddr_t and size_t are unsigned.
+ * assume that HDoff_t is signed and haddr_t and size_t are unsigned.
*
- * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t'
- * is too large to be represented by the second argument
- * of the file seek function.
+ * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t'
+ * is too large to be represented by the second argument
+ * of the file seek function.
*
- * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too
- * large to be represented by the `size_t' type.
+ * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too
+ * large to be represented by the `size_t' type.
*
- * REGION_OVERFLOW: Checks whether an address and size pair describe data
- * which can be addressed entirely by the second
- * argument of the file seek function.
+ * REGION_OVERFLOW: Checks whether an address and size pair describe data
+ * which can be addressed entirely by the second
+ * argument of the file seek function.
*/
-#define MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1)
-#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \
- ((A) & ~(haddr_t)MAXADDR))
-#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR)
-#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \
- sizeof(file_offset_t)<sizeof(size_t) || \
- HADDR_UNDEF==(A)+(Z) || \
- (file_offset_t)((A)+(Z))<(file_offset_t)(A))
+#define MAXADDR (((haddr_t)1 << (8*sizeof(HDoff_t) - 1)) - 1)
+#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR))
+#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR)
+#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \
+ HADDR_UNDEF == (A) + (Z) || \
+ (HDoff_t)((A) + (Z)) < (HDoff_t)(A))
/* Callbacks */
static herr_t H5FD_mpiposix_term(void);
@@ -198,49 +192,49 @@ static MPI_Comm H5FD_mpiposix_communicator(const H5FD_t *_file);
/* MPIPOSIX-specific file access properties */
typedef struct H5FD_mpiposix_fapl_t {
- hbool_t use_gpfs; /*use GPFS hints */
- MPI_Comm comm; /*communicator */
+ hbool_t use_gpfs; /* use GPFS hints */
+ MPI_Comm comm; /* communicator */
} H5FD_mpiposix_fapl_t;
/* The MPIPOSIX file driver information */
static const H5FD_class_mpi_t H5FD_mpiposix_g = {
{ /* Start of superclass information */
- "mpiposix", /*name */
- MAXADDR, /*maxaddr */
- H5F_CLOSE_SEMI, /* fc_degree */
- H5FD_mpiposix_term, /*terminate */
- NULL, /*sb_size */
- NULL, /*sb_encode */
- NULL, /*sb_decode */
- sizeof(H5FD_mpiposix_fapl_t), /*fapl_size */
- H5FD_mpiposix_fapl_get, /*fapl_get */
- H5FD_mpiposix_fapl_copy, /*fapl_copy */
- H5FD_mpiposix_fapl_free, /*fapl_free */
- 0, /*dxpl_size */
- NULL, /*dxpl_copy */
- NULL, /*dxpl_free */
- H5FD_mpiposix_open, /*open */
- H5FD_mpiposix_close, /*close */
- H5FD_mpiposix_cmp, /*cmp */
- H5FD_mpiposix_query, /*query */
- NULL, /*get_type_map */
- NULL, /*alloc */
- NULL, /*free */
- H5FD_mpiposix_get_eoa, /*get_eoa */
- H5FD_mpiposix_set_eoa, /*set_eoa */
- H5FD_mpiposix_get_eof, /*get_eof */
- H5FD_mpiposix_get_handle, /*get_handle */
- H5FD_mpiposix_read, /*read */
- H5FD_mpiposix_write, /*write */
- NULL, /*flush */
- H5FD_mpiposix_truncate, /*truncate */
- NULL, /*lock */
- NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ "mpiposix", /* name */
+ MAXADDR, /* maxaddr */
+ H5F_CLOSE_SEMI, /* fc_degree */
+ H5FD_mpiposix_term, /* terminate */
+ NULL, /* sb_size */
+ NULL, /* sb_encode */
+ NULL, /* sb_decode */
+ sizeof(H5FD_mpiposix_fapl_t), /* fapl_size */
+ H5FD_mpiposix_fapl_get, /* fapl_get */
+ H5FD_mpiposix_fapl_copy, /* fapl_copy */
+ H5FD_mpiposix_fapl_free, /* fapl_free */
+ 0, /* dxpl_size */
+ NULL, /* dxpl_copy */
+ NULL, /* dxpl_free */
+ H5FD_mpiposix_open, /* open */
+ H5FD_mpiposix_close, /* close */
+ H5FD_mpiposix_cmp, /* cmp */
+ H5FD_mpiposix_query, /* query */
+ NULL, /* get_type_map */
+ NULL, /* alloc */
+ NULL, /* free */
+ H5FD_mpiposix_get_eoa, /* get_eoa */
+ H5FD_mpiposix_set_eoa, /* set_eoa */
+ H5FD_mpiposix_get_eof, /* get_eof */
+ H5FD_mpiposix_get_handle, /* get_handle */
+ H5FD_mpiposix_read, /* read */
+ H5FD_mpiposix_write, /* write */
+ NULL, /* flush */
+ H5FD_mpiposix_truncate, /* truncate */
+ NULL, /* lock */
+ NULL, /* unlock */
+ H5FD_FLMAP_SINGLE /* fl_map */
}, /* End of superclass information */
- H5FD_mpiposix_mpi_rank, /*get_rank */
- H5FD_mpiposix_mpi_size, /*get_size */
- H5FD_mpiposix_communicator /*get_comm */
+ H5FD_mpiposix_mpi_rank, /* get_rank */
+ H5FD_mpiposix_mpi_size, /* get_size */
+ H5FD_mpiposix_communicator /* get_comm */
};
@@ -267,34 +261,31 @@ H5FD_mpiposix_init_interface(void)
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_init
- *
- * Purpose: Initialize this driver by registering the driver with the
- * library.
+ * Function: H5FD_mpiposix_init
*
- * Return: Success: The driver ID for the mpiposix driver.
+ * Purpose: Initialize this driver by registering the driver with the
+ * library.
*
- * Failure: Negative.
+ * Return: Success: The driver ID for the mpiposix driver.
+ * Failure: Negative.
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
H5FD_mpiposix_init(void)
{
- hid_t ret_value=H5FD_MPIPOSIX_g; /* Return value */
+ hid_t ret_value = H5FD_MPIPOSIX_g; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if (H5I_VFL!=H5Iget_type(H5FD_MPIPOSIX_g))
+ if (H5I_VFL != H5Iget_type(H5FD_MPIPOSIX_g))
H5FD_MPIPOSIX_g = H5FD_register((const H5FD_class_t *)&H5FD_mpiposix_g,sizeof(H5FD_class_mpi_t),FALSE);
/* Set return value */
- ret_value=H5FD_MPIPOSIX_g;
+ ret_value = H5FD_MPIPOSIX_g;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -302,11 +293,11 @@ done:
/*---------------------------------------------------------------------------
- * Function: H5FD_mpiposix_term
+ * Function: H5FD_mpiposix_term
*
- * Purpose: Shut down the VFD
+ * Purpose: Shut down the VFD
*
- * Returns: Non-negative on success or negative on failure
+ * Returns: SUCCEED (can't fail)
*
* Programmer: Quincey Koziol
* Friday, Jan 30, 2004
@@ -319,52 +310,41 @@ H5FD_mpiposix_term(void)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Reset VFL ID */
- H5FD_MPIPOSIX_g=0;
+ H5FD_MPIPOSIX_g = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD_mpiposix_term() */
/*-------------------------------------------------------------------------
- * Function: H5Pset_fapl_mpiposix
+ * Function: H5Pset_fapl_mpiposix
*
- * Purpose: Store the user supplied MPI communicator COMM in
- * the file access property list FAPL_ID which can then be used
- * to create and/or open the file. This function is available
- * only in the parallel HDF5 library and is not collective.
+ * Purpose: Store the user supplied MPI communicator COMM in
+ * the file access property list FAPL_ID which can then be used
+ * to create and/or open the file. This function is available
+ * only in the parallel HDF5 library and is not collective.
*
- * comm is the MPI communicator to be used for file open as
- * defined in MPI_FILE_OPEN of MPI-2. This function makes a
- * duplicate of comm. Any modification to comm after this function
- * call returns has no effect on the access property list.
+ * comm is the MPI communicator to be used for file open as
+ * defined in MPI_FILE_OPEN of MPI-2. This function makes a
+ * duplicate of comm. Any modification to comm after this function
+ * call returns has no effect on the access property list.
*
* If fapl_id has previously set comm value, it will be replaced
* and the old communicator is freed.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
- * Thursday, July 11, 2002
- *
- * Modifications:
- * Albert Cheng, 2003-04-24
- * Modified the description of the function that it now stores
- * a duplicate of the communicator. Free the old duplicate if
- * previously set. (Work is actually done by H5P_set_driver.)
- *
- * Bill Wendling, 2003-05-01
- * Modified to take an extra flag indicating that we should
- * use the GPFS hints (if available) for this file.
+ * Thursday, July 11, 2002
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_fapl_mpiposix(hid_t fapl_id, MPI_Comm comm, hbool_t use_gpfs)
{
- H5FD_mpiposix_fapl_t fa;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value;
+ H5FD_mpiposix_fapl_t fa;
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value;
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iMcb", fapl_id, comm, use_gpfs);
@@ -373,14 +353,14 @@ H5Pset_fapl_mpiposix(hid_t fapl_id, MPI_Comm comm, hbool_t use_gpfs)
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list")
if (MPI_COMM_NULL == comm)
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator")
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator")
/* Initialize driver specific properties */
fa.comm = comm;
fa.use_gpfs = use_gpfs;
/* duplication is done during driver setting. */
- ret_value= H5P_set_driver(plist, H5FD_MPIPOSIX, &fa);
+ ret_value = H5P_set_driver(plist, H5FD_MPIPOSIX, &fa);
done:
FUNC_LEAVE_API(ret_value)
@@ -388,57 +368,49 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Pget_fapl_mpiposix
- *
- * Purpose: If the file access property list is set to the H5FD_MPIPOSIX
- * driver then this function returns a duplicate of the MPI
- * communicator through the comm pointer. It is the responsibility
- * of the application to free the returned communicator.
- *
- * Return: Success: Non-negative with the communicator and
- * information returned through the COMM
- * argument if non-null. Since it is a duplicate
- * of the stored object, future modifications to
- * the access property list do not affect it and
- * it is the responsibility of the application to
- * free it.
- *
- * Failure: Negative
+ * Function: H5Pget_fapl_mpiposix
+ *
+ * Purpose: If the file access property list is set to the H5FD_MPIPOSIX
+ * driver then this function returns a duplicate of the MPI
+ * communicator through the comm pointer. It is the responsibility
+ * of the application to free the returned communicator.
+ *
+ * Return: Success: Non-negative with the communicator and
+ * information returned through the COMM
+ * argument if non-null. Since it is a duplicate
+ * of the stored object, future modifications to
+ * the access property list do not affect it and
+ * it is the responsibility of the application to
+ * free it.
+ * Failure: Negative
*
* Programmer: Quincey Koziol
- * Thursday, July 11, 2002
- *
- * Modifications:
- * Albert Cheng, 2003-04-24
- * Return duplicate of the stored communicator.
- *
- * Bill Wendling, 2003-05-01
- * Return the USE_GPFS flag.
+ * Thursday, July 11, 2002
*
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/, hbool_t *use_gpfs/*out*/)
{
- H5FD_mpiposix_fapl_t *fa;
- H5P_genplist_t *plist; /* Property list pointer */
- int mpi_code; /* mpi return code */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5FD_mpiposix_fapl_t *fa;
+ H5P_genplist_t *plist; /* Property list pointer */
+ int mpi_code; /* mpi return code */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixx", fapl_id, comm, use_gpfs);
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list")
- if (H5FD_MPIPOSIX!=H5P_get_driver(plist))
+ if (H5FD_MPIPOSIX != H5P_get_driver(plist))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver")
- if (NULL==(fa=H5P_get_driver_info(plist)))
+ if (NULL == (fa = H5P_get_driver_info(plist)))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info")
/* Get MPI Communicator */
if (comm){
- if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, comm)))
- HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code)
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_dup(fa->comm, comm)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code)
}
if (use_gpfs)
@@ -450,45 +422,39 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_fapl_get
- *
- * Purpose: Returns a file access property list which could be used to
- * create another file the same as this one.
+ * Function: H5FD_mpiposix_fapl_get
*
- * Return: Success: Ptr to new file access property list with all
- * fields copied from the file pointer.
+ * Purpose: Returns a file access property list which could be used to
+ * create another file the same as this one.
*
- * Failure: NULL
+ * Return: Success: Ptr to new file access property list with all
+ * fields copied from the file pointer.
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- * Albert Cheng, 2003-04-24
- * Duplicate the communicator object so that the new
- * property list is insulated from the old one.
- *
*-------------------------------------------------------------------------
*/
static void *
H5FD_mpiposix_fapl_get(H5FD_t *_file)
{
- H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
- H5FD_mpiposix_fapl_t *fa = NULL;
- int mpi_code; /* MPI return code */
- void *ret_value; /* Return value */
+ H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
+ H5FD_mpiposix_fapl_t *fa = NULL;
+ int mpi_code; /* MPI return code */
+ void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
- if (NULL==(fa=H5MM_calloc(sizeof(H5FD_mpiposix_fapl_t))))
+ if (NULL == (fa = H5MM_calloc(sizeof(H5FD_mpiposix_fapl_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Duplicate the communicator. */
if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(file->comm, &fa->comm)))
- HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code)
+ HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code)
fa->use_gpfs = file->use_gpfs;
@@ -501,19 +467,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_fapl_copy
+ * Function: H5FD_mpiposix_fapl_copy
*
- * Purpose: Copies the mpiposix-specific file access properties.
+ * Purpose: Copies the mpiposix-specific file access properties.
*
- * Return: Success: Ptr to a new property list
- *
- * Failure: NULL
+ * Return: Success: Ptr to a new property list
+ * Failure: NULL
*
* Programmer: Albert Cheng
* Apr 24, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void *
@@ -526,24 +489,24 @@ H5FD_mpiposix_fapl_copy(const void *_old_fa)
FUNC_ENTER_NOAPI_NOINIT
- if (NULL==(new_fa=H5MM_malloc(sizeof(H5FD_mpiposix_fapl_t))))
+ if (NULL == (new_fa = H5MM_malloc(sizeof(H5FD_mpiposix_fapl_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the general information */
HDmemcpy(new_fa, old_fa, sizeof(H5FD_mpiposix_fapl_t));
/* Duplicate communicator. */
- if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(old_fa->comm, &new_fa->comm)))
- HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code)
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_dup(old_fa->comm, &new_fa->comm)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code)
new_fa->use_gpfs = old_fa->use_gpfs;
ret_value = new_fa;
done:
if (NULL == ret_value){
- /* cleanup */
- if (new_fa)
- H5MM_xfree(new_fa);
+ /* cleanup */
+ if (new_fa)
+ H5MM_xfree(new_fa);
}
FUNC_LEAVE_NOAPI(ret_value)
@@ -551,19 +514,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_fapl_free
+ * Function: H5FD_mpiposix_fapl_free
*
- * Purpose: Frees the mpiposix-specific file access properties.
+ * Purpose: Frees the mpiposix-specific file access properties.
*
- * Return: Success: 0
- *
- * Failure: -1
+ * Return: SUCCEED (can't fail)
*
* Programmer: Albert Cheng
* Apr 24, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -573,10 +532,10 @@ H5FD_mpiposix_fapl_free(void *_fa)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(fa);
+ HDassert(fa);
/* Free the internal communicator */
- assert(MPI_COMM_NULL!=fa->comm);
+ HDassert(MPI_COMM_NULL != fa->comm);
MPI_Comm_free(&fa->comm);
H5MM_xfree(fa);
@@ -588,53 +547,46 @@ H5FD_mpiposix_fapl_free(void *_fa)
* Function: H5FD_mpiposix_open
*
* Purpose: Opens a file with name NAME. The FLAGS are a bit field with
- * purpose similar to the second argument of open(2) and which
- * are defined in H5Fpublic.h. The file access property list
- * FAPL_ID contains the properties driver properties and MAXADDR
- * is the largest address which this file will be expected to
- * access. This is collective.
+ * purpose similar to the second argument of open(2) and which
+ * are defined in H5Fpublic.h. The file access property list
+ * FAPL_ID contains the properties driver properties and MAXADDR
+ * is the largest address which this file will be expected to
+ * access. This is collective.
*
- * Return: Success: A new file pointer.
- * Failure: NULL
+ * Return: Success: A new file pointer.
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- * Albert Cheng, 2003-04-24
- * Duplicate the communicator so that file is insulated from the
- * old one.
- *
*-------------------------------------------------------------------------
*/
static H5FD_t *
H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr)
{
- H5FD_mpiposix_t *file=NULL; /* New MPIPOSIX file struct */
- int o_flags; /* Flags for file open call */
- int fd=(-1); /* File handle for file opened */
- int mpi_rank; /* MPI rank of this process */
- int mpi_size; /* Total number of MPI processes */
- int mpi_code; /* mpi return code */
- const H5FD_mpiposix_fapl_t *fa=NULL; /* MPIPOSIX file access property list information */
- H5FD_mpiposix_fapl_t _fa; /* Private copy of default file access property list information */
- H5P_genplist_t *plist; /* Property list pointer */
- h5_stat_t sb; /* Portable 'stat' struct */
+ H5FD_mpiposix_t *file = NULL; /* New MPIPOSIX file struct */
+ int o_flags; /* Flags for file open call */
+ int fd = -1; /* File handle for file opened */
+ int mpi_rank; /* MPI rank of this process */
+ int mpi_size; /* Total number of MPI processes */
+ int mpi_code; /* mpi return code */
+ const H5FD_mpiposix_fapl_t *fa = NULL; /* MPIPOSIX file access property list information */
+ H5FD_mpiposix_fapl_t _fa; /* Private copy of default file access property list information */
+ H5P_genplist_t *plist; /* Property list pointer */
+ h5_stat_t sb; /* Portable 'stat' struct */
#ifdef H5_HAVE_WIN32_API
- HFILE filehandle;
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
- int results;
#endif
- H5FD_t *ret_value=NULL; /* Return value */
- MPI_Comm comm_dup=MPI_COMM_NULL;
+ H5FD_t *ret_value = NULL; /* Return value */
+ MPI_Comm comm_dup = MPI_COMM_NULL;
FUNC_ENTER_NOAPI_NOINIT
/* Check arguments */
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name")
- if (0==maxaddr || HADDR_UNDEF==maxaddr)
+ if (0 == maxaddr || HADDR_UNDEF == maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr")
if (ADDR_OVERFLOW(maxaddr))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr")
@@ -642,31 +594,31 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
/* Obtain a pointer to mpiposix-specific file access properties */
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- if (H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_MPIPOSIX!=H5P_get_driver(plist)) {
- _fa.comm = MPI_COMM_SELF; /*default*/
+ if (H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIPOSIX != H5P_get_driver(plist)) {
+ _fa.comm = MPI_COMM_SELF; /*default*/
_fa.use_gpfs = FALSE;
- fa = &_fa;
+ fa = &_fa;
} /* end if */
else {
- fa = H5P_get_driver_info(plist);
- assert(fa);
+ fa = H5P_get_driver_info(plist);
+ HDassert(fa);
} /* end else */
/* Duplicate the communicator for use by this file. */
- if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, &comm_dup)))
- HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code)
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_dup(fa->comm, &comm_dup)))
+ HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code)
/* Get the MPI rank of this process and the total number of processes */
- if (MPI_SUCCESS != (mpi_code=MPI_Comm_rank (comm_dup, &mpi_rank)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank (comm_dup, &mpi_rank)))
HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code)
- if (MPI_SUCCESS != (mpi_code=MPI_Comm_size (comm_dup, &mpi_size)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Comm_size (comm_dup, &mpi_size)))
HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code)
/* Build the open flags */
o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY;
/* Only set the creation flag(s) for process 0 */
- if(mpi_rank==0) {
+ if(0 == mpi_rank) {
if (H5F_ACC_TRUNC & flags)
o_flags |= O_TRUNC;
if (H5F_ACC_CREAT & flags)
@@ -680,13 +632,14 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
* open (never create) the file and all processes proceed.
*/
/* Process 0 opens (or creates) file and broadcasts result to other processes */
- if(mpi_rank==0) {
+ if(0 == mpi_rank) {
/* Open the file */
- fd=HDopen(name, o_flags, 0666);
+ fd = HDopen(name, o_flags, 0666);
} /* end if */
- /* Broadcast the results of the open() from process 0 */
- /* This is necessary because of the "tentative open" code in H5F_open()
+ /* Broadcast the results of the open() from process 0
+ *
+ * This is necessary because of the "tentative open" code in H5F_open()
* where the file is attempted to be opened with different flags from the
* user's, in order to check for the file's existence, etc. Here, process 0
* gets different flags from the other processes (since it is in charge of
@@ -698,34 +651,36 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
/* If the file open on process 0 failed, bail out on all processes now */
- if(fd<0)
+ if(fd < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
/* Other processes (non 0) wait for broadcast result from process 0 and then open file */
- if(mpi_rank!=0) {
+ if(mpi_rank != 0) {
/* Open the file */
- if ((fd=HDopen(name, o_flags, 0666))<0)
+ if ((fd = HDopen(name, o_flags, 0666)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
} /* end if */
/* Process 0 fstat()s the file and broadcasts the results to the other processes */
- if(mpi_rank==0) {
+ if(0 == mpi_rank) {
/* Get the stat information */
- if (HDfstat(fd, &sb)<0)
+ if (HDfstat(fd, &sb) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file")
} /* end if */
/* Broadcast the results of the fstat() from process 0 */
- if (MPI_SUCCESS != (mpi_code= MPI_Bcast(&sb, sizeof(h5_stat_t), MPI_BYTE, 0, comm_dup)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Bcast(&sb, sizeof(h5_stat_t), MPI_BYTE, 0, comm_dup)))
HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code)
#ifdef H5_HAVE_GPFS
if (fa->use_gpfs) {
/*
- * Free all byte range tokens. This is a good thing to do if raw data is aligned on 256kB boundaries (a GPFS page is
- * 256kB). Care should be taken that there aren't too many sub-page writes, or the mmfsd may become overwhelmed. This
- * should probably eventually be passed down here as a property. The gpfs_fcntl() will most likely fail if `fd' isn't
- * on a GPFS file system. */
+ * Free all byte range tokens. This is a good thing to do if raw data
+ * is aligned on 256kB boundaries (a GPFS page is 256kB). Care should
+ * be taken that there aren't too many sub-page writes, or the mmfsd
+ * may become overwhelmed. This should probably eventually be passed
+ * down here as a property. The gpfs_fcntl() will most likely fail if
+ * 'fd' isn't on a GPFS file system. */
struct {
gpfsFcntlHeader_t hdr;
gpfsFreeRange_t fr;
@@ -738,13 +693,13 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
hint.fr.start = 0;
hint.fr.length = 0;
- if (gpfs_fcntl(fd, &hint)<0)
+ if (gpfs_fcntl(fd, &hint) < 0)
HGOTO_ERROR(H5E_FILE, H5E_FCNTL, NULL, "failed to send hints to GPFS")
}
#endif /* H5_HAVE_GPFS */
/* Build the file struct and initialize it */
- if (NULL==(file=H5MM_calloc(sizeof(H5FD_mpiposix_t))))
+ if (NULL == (file=H5MM_calloc(sizeof(H5FD_mpiposix_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
#ifdef REPORT_IO
@@ -755,8 +710,9 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
file->fd = fd;
file->eof = sb.st_size;
- /* for H5_HAVE_WIN32_API support. H5_HAVE_WIN32_API 'stat' does not have st_blksize and st_blksize
- is only used for the H5_HAVE_GPFS case */
+ /* for H5_HAVE_WIN32_API support. H5_HAVE_WIN32_API 'stat' does not have
+ * st_blksize and st_blksize is only used for the H5_HAVE_GPFS case.
+ */
#ifdef H5_HAVE_GPFS
file->blksize = sb.st_blksize;
#endif
@@ -775,26 +731,38 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id,
/* Set the information for the file's device and inode */
#ifdef H5_HAVE_WIN32_API
- filehandle = _get_osfhandle(fd);
- results = GetFileInformationByHandle((HANDLE)filehandle, &fileinfo);
- file->fileindexhi = fileinfo.nFileIndexHigh;
- file->fileindexlo = fileinfo.nFileIndexLow;
-#else
+ file->hFile = (HANDLE)_get_osfhandle(fd);
+ if(INVALID_HANDLE_VALUE == file->hFile)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file handle")
+
+ if(!GetFileInformationByHandle((HANDLE)file->hFile, &fileinfo))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file information")
+
+ file->nFileIndexHigh = fileinfo.nFileIndexHigh;
+ file->nFileIndexLow = fileinfo.nFileIndexLow;
+ file->dwVolumeSerialNumber = fileinfo.dwVolumeSerialNumber;
+#else /* H5_HAVE_WIN32_API */
file->device = sb.st_dev;
+#ifdef H5_VMS
+ file->inode[0] = sb.st_ino[0];
+ file->inode[1] = sb.st_ino[1];
+ file->inode[2] = sb.st_ino[2];
+#else /* H5_VMS */
file->inode = sb.st_ino;
-#endif
+#endif /* H5_VMS */
+#endif /* H5_HAVE_WIN32_API */
/* Indicate success */
- ret_value=(H5FD_t *)file;
+ ret_value = (H5FD_t *)file;
done:
/* Error cleanup */
- if(ret_value==NULL) {
+ if(NULL == ret_value) {
/* Close the file if it was left open */
- if(fd!=(-1))
+ if(fd != -1)
HDclose(fd);
- if (MPI_COMM_NULL != comm_dup)
- MPI_Comm_free(&comm_dup);
+ if (MPI_COMM_NULL != comm_dup)
+ MPI_Comm_free(&comm_dup);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -806,30 +774,26 @@ done:
*
* Purpose: Closes a file.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- * Albert Cheng, 2003-04-24
- * Free the communicator stored.
*-------------------------------------------------------------------------
*/
static herr_t
H5FD_mpiposix_close(H5FD_t *_file)
{
- H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
- herr_t ret_value=SUCCEED; /* Return value */
+ H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
/* Close the unix file */
- if (HDclose(file->fd)<0)
+ if(HDclose(file->fd) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
/* make sure all processes have closed the file before returning. */
@@ -844,20 +808,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_cmp
+ * Function: H5FD_mpiposix_cmp
*
- * Purpose: Compares two files belonging to this driver using an
- * arbitrary (but consistent) ordering.
+ * Purpose: Compares two files belonging to this driver using an
+ * arbitrary (but consistent) ordering.
*
- * Return: Success: A value like strcmp()
- * Failure: never fails (arguments were checked by the
- * caller).
+ * Return: Success: A value like strcmp()
+ * Failure: never fails (arguments were checked by the caller).
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -865,33 +826,39 @@ H5FD_mpiposix_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
{
const H5FD_mpiposix_t *f1 = (const H5FD_mpiposix_t*)_f1;
const H5FD_mpiposix_t *f2 = (const H5FD_mpiposix_t*)_f2;
- int ret_value=0;
+ int ret_value = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
#ifdef H5_HAVE_WIN32_API
- if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1)
- if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1)
+ if(f1->dwVolumeSerialNumber < f2->dwVolumeSerialNumber) HGOTO_DONE(-1)
+ if(f1->dwVolumeSerialNumber > f2->dwVolumeSerialNumber) HGOTO_DONE(1)
- if (f1->fileindexlo < f2->fileindexlo) HGOTO_DONE(-1)
- if (f1->fileindexlo > f2->fileindexlo) HGOTO_DONE(1)
+ if(f1->nFileIndexHigh < f2->nFileIndexHigh) HGOTO_DONE(-1)
+ if(f1->nFileIndexHigh > f2->nFileIndexHigh) HGOTO_DONE(1)
-#else
+ if(f1->nFileIndexLow < f2->nFileIndexLow) HGOTO_DONE(-1)
+ if(f1->nFileIndexLow > f2->nFileIndexLow) HGOTO_DONE(1)
+#else /* H5_HAVE_WIN32_API */
#ifdef H5_DEV_T_IS_SCALAR
- if (f1->device < f2->device) HGOTO_DONE(-1)
- if (f1->device > f2->device) HGOTO_DONE(1)
+ if(f1->device < f2->device) HGOTO_DONE(-1)
+ if(f1->device > f2->device) HGOTO_DONE(1)
#else /* H5_DEV_T_IS_SCALAR */
/* If dev_t isn't a scalar value on this system, just use memcmp to
* determine if the values are the same or not. The actual return value
* shouldn't really matter...
*/
- if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))<0) HGOTO_DONE(-1)
- if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))>0) HGOTO_DONE(1)
+ if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t)) < 0) HGOTO_DONE(-1)
+ if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t)) > 0) HGOTO_DONE(1)
#endif /* H5_DEV_T_IS_SCALAR */
-
- if (f1->inode < f2->inode) HGOTO_DONE(-1)
- if (f1->inode > f2->inode) HGOTO_DONE(1)
-#endif
+#ifdef H5_VMS
+ if(HDmemcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) < 0) HGOTO_DONE(-1)
+ if(HDmemcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) > 0) HGOTO_DONE(1)
+#else /* H5_VMS */
+ if(f1->inode < f2->inode) HGOTO_DONE(-1)
+ if(f1->inode > f2->inode) HGOTO_DONE(1)
+#endif /* H5_VMS */
+#endif /* H5_HAVE_WIN32_API */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -899,25 +866,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_query
+ * Function: H5FD_mpiposix_query
*
- * Purpose: Set the flags that this VFL driver is capable of supporting.
+ * Purpose: Set the flags that this VFL driver is capable of supporting.
* (listed in H5FDpublic.h)
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED (can't fail)
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
- * John Mainzer -- 9/21/05
- * Modified code to turn off the
- * H5FD_FEAT_ACCUMULATE_METADATA_WRITE flag.
- * With the movement of all cache writes to process 0,
- * this flag has become problematic in PHDF5.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -928,10 +886,10 @@ H5FD_mpiposix_query(const H5FD_t UNUSED *_file, unsigned long *flags /* out */)
/* Set the VFL feature flags that this driver supports */
if(flags) {
*flags=0;
- *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
- *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
- *flags|=H5FD_FEAT_HAS_MPI; /* This driver uses MPI */
- *flags|=H5FD_FEAT_ALLOCATE_EARLY; /* Allocate space early instead of late */
+ *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
+ *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
+ *flags |= H5FD_FEAT_HAS_MPI; /* This driver uses MPI */
+ *flags |= H5FD_FEAT_ALLOCATE_EARLY; /* Allocate space early instead of late */
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -939,23 +897,18 @@ H5FD_mpiposix_query(const H5FD_t UNUSED *_file, unsigned long *flags /* out */)
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_get_eoa
+ * Function: H5FD_mpiposix_get_eoa
*
- * Purpose: Gets the end-of-address marker for the file. The EOA marker
- * is the first address past the last byte allocated in the
- * format address space.
+ * Purpose: Gets the end-of-address marker for the file. The EOA marker
+ * is the first address past the last byte allocated in the
+ * format address space.
*
- * Return: Success: The end-of-address marker.
- * Failure: HADDR_UNDEF
+ * Return: Success: The end-of-address marker.
+ * Failure: HADDR_UNDEF
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- * Raymond Lu
- * 21 Dec. 2006
- * Added the parameter TYPE. It's only used for MULTI driver.
- *
*-------------------------------------------------------------------------
*/
static haddr_t
@@ -965,31 +918,25 @@ H5FD_mpiposix_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->eoa)
} /* end H5FD_mpiposix_get_eoa() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_set_eoa
+ * Function: H5FD_mpiposix_set_eoa
*
- * Purpose: Set the end-of-address marker for the file. This function is
- * called shortly after an existing HDF5 file is opened in order
- * to tell the driver where the end of the HDF5 data is located.
+ * Purpose: Set the end-of-address marker for the file. This function is
+ * called shortly after an existing HDF5 file is opened in order
+ * to tell the driver where the end of the HDF5 data is located.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED (can't fail)
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- * Raymond Lu
- * 21 Dec. 2006
- * Added the parameter TYPE. It's only used for MULTI driver.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -999,8 +946,8 @@ H5FD_mpiposix_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
file->eoa = addr;
@@ -1009,25 +956,23 @@ H5FD_mpiposix_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr)
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_get_eof
+ * Function: H5FD_mpiposix_get_eof
*
- * Purpose: Gets the end-of-file marker for the file. The EOF marker
- * is the real size of the file.
+ * Purpose: Gets the end-of-file marker for the file. The EOF marker
+ * is the real size of the file.
*
- * The MPIPOSIX driver doesn't bother keeping this field updated
- * since that's a relatively expensive operation. Fortunately
- * the library only needs the EOF just after the file is opened
- * in order to determine whether the file is empty, truncated,
- * or okay.
+ * The MPIPOSIX driver doesn't bother keeping this field updated
+ * since that's a relatively expensive operation. Fortunately
+ * the library only needs the EOF just after the file is opened
+ * in order to determine whether the file is empty, truncated,
+ * or okay.
*
- * Return: Success: The end-of-address marker.
- * Failure: HADDR_UNDEF
+ * Return: Success: The end-of-address marker.
+ * Failure: HADDR_UNDEF
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static haddr_t
@@ -1037,10 +982,10 @@ H5FD_mpiposix_get_eof(const H5FD_t *_file)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
- FUNC_LEAVE_NOAPI(MAX(file->eof,file->eoa))
+ FUNC_LEAVE_NOAPI(MAX(file->eof, file->eoa))
} /* end H5FD_mpiposix_get_eof() */
@@ -1049,13 +994,11 @@ H5FD_mpiposix_get_eof(const H5FD_t *_file)
*
* Purpose: Returns the file handle of MPI-POSIX file driver.
*
- * Returns: Non-negative if succeed or negative if fails.
+ * Returns: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Sept. 16, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1077,43 +1020,41 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_read
+ * Function: H5FD_mpiposix_read
*
- * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR
- * into buffer BUF according to data transfer properties in
- * DXPL_ID using potentially complex file and buffer types to
- * effect the transfer.
+ * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR
+ * into buffer BUF according to data transfer properties in
+ * DXPL_ID using potentially complex file and buffer types to
+ * effect the transfer.
*
- * Reading past the end of the file returns zeros instead of
- * failing.
+ * Reading past the end of the file returns zeros instead of
+ * failing.
*
- * Return: Success: Non-negative. Result is stored in caller-supplied
- * buffer BUF.
- * Failure: Negative, Contents of buffer BUF are undefined.
+ * Return: Success: Non-negative. Result is stored in caller-supplied
+ * buffer BUF.
+ * Failure: Negative, Contents of buffer BUF are undefined.
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, size_t size,
- void *buf/*out*/)
+H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id,
+ haddr_t addr, size_t size, void *buf/*out*/)
{
- H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
- ssize_t nbytes; /* Number of bytes read each I/O call */
- herr_t ret_value=SUCCEED;
+ H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
+ ssize_t nbytes; /* Number of bytes read each I/O call */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
- assert(buf);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
+ HDassert(buf);
/* Check for overflow conditions */
- if (HADDR_UNDEF==addr)
+ if (HADDR_UNDEF == addr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined")
if (REGION_OVERFLOW(addr, size))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
@@ -1130,31 +1071,52 @@ H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id,
#endif
/* Seek to the correct location */
- if ((addr!=file->pos || OP_READ!=file->op) &&
- file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0)
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+ if(addr != file->pos || OP_READ != file->op) {
+ if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+ } /* end if */
- /*
- * Read data, being careful of interrupted system calls, partial results,
+ /* Read data, being careful of interrupted system calls, partial results,
* and the end of the file.
*/
- while (size>0) {
+ while(size > 0) {
+
+ h5_mpiposix_io_t bytes_in = 0; /* # of bytes to read */
+ h5_mpiposix_io_ret_t bytes_read = -1; /* # of bytes actually read */
+
+ /* Trying to read more bytes than the return type can handle is
+ * undefined behavior in POSIX.
+ */
+ if(size > H5_MPIPOSIX_MAX_IO_BYTES_g)
+ bytes_in = H5_MPIPOSIX_MAX_IO_BYTES_g;
+ else
+ bytes_in = (h5_mpiposix_io_t)size;
+
do {
- nbytes = HDread(file->fd, buf, size);
- } while (-1==nbytes && EINTR==errno);
- if (-1==nbytes)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
- if (0==nbytes) {
+ bytes_read = HDread(file->fd, buf, bytes_in);
+ } while(-1 == bytes_read && EINTR == errno);
+
+ if(-1 == bytes_read) { /* error */
+ int myerrno = errno;
+ time_t mytime = HDtime(NULL);
+ HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset);
+ } /* end if */
+
+ if(0 == bytes_read) {
/* end of file but not end of format address space */
HDmemset(buf, 0, size);
break;
} /* end if */
- assert(nbytes>=0);
- assert((size_t)nbytes<=size);
- size -= nbytes;
- addr += (haddr_t)nbytes;
- buf = (char*)buf + nbytes;
- }
+
+ HDassert(bytes_read >= 0);
+ HDassert((size_t)bytes_read <= size);
+
+ size -= (size_t)bytes_read;
+ addr += (haddr_t)bytes_read;
+ buf = (char *)buf + bytes_read;
+ } /* end while */
/* Update current position */
file->pos = addr;
@@ -1162,7 +1124,7 @@ H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id,
done:
/* Check for error */
- if(ret_value<0) {
+ if(ret_value < 0) {
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
@@ -1173,55 +1135,46 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_write
+ * Function: H5FD_mpiposix_write
*
- * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR
- * from buffer BUF according to data transfer properties in
- * DXPL_ID using potentially complex file and buffer types to
- * effect the transfer.
+ * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR
+ * from buffer BUF according to data transfer properties in
+ * DXPL_ID using potentially complex file and buffer types to
+ * effect the transfer.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
- * Quincey Koziol - 2002/07/18
- * Added "block_before_meta_write" dataset transfer flag, which
- * is set during writes from a metadata cache flush and indicates
- * that all the processes must sync up before (one of them)
- * writing metadata.
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
size_t size, const void *buf)
{
- H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
+ H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
#if 0 /* JRM */
int mpi_code; /* MPI return code */
#endif /* JRM */
- ssize_t nbytes; /* Number of bytes written each I/O call */
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
+ ssize_t nbytes; /* Number of bytes written each I/O call */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
- assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
- assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
- assert(buf);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
+ HDassert(H5I_GENPROP_LST == H5I_get_type(dxpl_id));
+ HDassert(TRUE == H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
+ HDassert(buf);
/* Check for overflow conditions */
- if (HADDR_UNDEF==addr)
+ if (HADDR_UNDEF == addr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined")
if (REGION_OVERFLOW(addr, size))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
- if (addr+size>file->eoa)
+ if ((addr + size) > file->eoa)
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
/* Obtain the data transfer properties */
@@ -1237,26 +1190,26 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
* metadata.
* -- JRM 9/1/05
*/
- if(type!=H5FD_MEM_DRAW) {
- unsigned block_before_meta_write=0; /* Whether to block before a metadata write */
-
- /* Check if we need to syncronize all processes before attempting metadata write
- * (Prevents race condition where the process writing the metadata goes ahead
- * and writes the metadata to the file before all the processes have
- * read the data, "transmitting" data from the "future" to the reading
- * process. -QAK )
+ if(type != H5FD_MEM_DRAW) {
+ unsigned block_before_meta_write = 0; /* Whether to block before a metadata write */
+
+ /* Check if we need to synchronize all processes before attempting
+ * metadata write (Prevents race condition where the process writing
+ * the metadata goes ahead and writes the metadata to the file before
+ * all the processes have read the data, "transmitting" data from the
+ * "future" to the reading process. -QAK )
*
* The only time we don't want to block before a metadata write is when
* we are flushing out a bunch of metadata. Then, we block before the
* first write and don't block for further writes in the sequence.
*/
- if(H5P_exist_plist(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME)>0)
- if(H5P_get(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,&block_before_meta_write)<0)
+ if(H5P_exist_plist(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME) > 0)
+ if(H5P_get(plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,&block_before_meta_write) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get H5AC property")
#if 0 /* JRM */
if(block_before_meta_write)
- if (MPI_SUCCESS!= (mpi_code=MPI_Barrier(file->comm)))
+ if (MPI_SUCCESS != (mpi_code = MPI_Barrier(file->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code)
#endif /* JRM */
@@ -1273,11 +1226,11 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
MPI_Comm_rank(MPI_COMM_WORLD, &commrank);
HDfprintf(stderr, "write: rank=%d file=0x%08lx type=%d, addr=%a size=%Zu %s\n",
commrank, (unsigned long)file, (int)type, addr, size,
- 0==file->naccess?"(FIRST ACCESS)":"");
+ 0 == file->naccess ? "(FIRST ACCESS)" : "");
}
#endif
- if (0==file->naccess++) {
+ if (0 == file->naccess++) {
/* First write access to this file */
#ifdef H5_HAVE_GPFS
if (file->use_gpfs) {
@@ -1302,50 +1255,76 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
}
/* Seek to the correct location */
- if ((addr!=file->pos || OP_WRITE!=file->op) &&
- file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0)
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+ if(addr != file->pos || OP_WRITE != file->op) {
+ if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+ } /* end if */
- /*
- * Write the data, being careful of interrupted system calls and partial
- * results
+ /* Write data, being careful of interrupted system calls, partial results,
+ * and the end of the file.
*/
- while (size>0) {
+ while(size > 0) {
+
+ h5_mpiposix_io_t bytes_in = 0; /* # of bytes to write */
+ h5_mpiposix_io_ret_t bytes_wrote = -1; /* # of bytes actually written */
+
+ /* Trying to write more bytes than the return type can handle is
+ * undefined behavior in POSIX.
+ */
+ if(size > H5_MPIPOSIX_MAX_IO_BYTES_g)
+ bytes_in = H5_MPIPOSIX_MAX_IO_BYTES_g;
+ else
+ bytes_in = (h5_mpiposix_io_t)size;
+
do {
- nbytes = HDwrite(file->fd, buf, size);
- } while (-1==nbytes && EINTR==errno);
- if (-1==nbytes)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
- assert(nbytes>0);
- assert((size_t)nbytes<=size);
- size -= nbytes;
- addr += (haddr_t)nbytes;
- buf = (const char*)buf + nbytes;
+ bytes_wrote = HDwrite(file->fd, buf, bytes_in);
+ } while(-1 == bytes_wrote && EINTR == errno);
+
+ if(-1 == bytes_wrote) { /* error */
+ int myerrno = errno;
+ time_t mytime = HDtime(NULL);
+ HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file write failed: time = %s, file descriptor = %d, errno = %d, error message = '%s', buf = %p, size = %lu, offset = %llu", HDctime(&mytime), file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long)size, (unsigned long long)myoffset);
+ } /* end if */
+
+ if(0 == bytes_wrote) {
+ /* end of file but not end of format address space */
+ HDmemset(buf, 0, size);
+ break;
+ } /* end if */
+
+ HDassert(bytes_wrote >= 0);
+ HDassert((size_t)bytes_wrote <= size);
+
+ size -= (size_t)bytes_wrote;
+ addr += (haddr_t)bytes_wrote;
+ buf = (char *)buf + bytes_wrote;
} /* end while */
- /* Update current last file I/O information */
+ /* Update current position */
file->pos = addr;
file->op = OP_WRITE;
done:
/* Check for error */
- if(ret_value<0) {
+ if(ret_value < 0) {
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
} /* end if */
#if 0 /* JRM */
- /* Since metadata writes are now done by process 0 only, this broadcast
- * is no longer needed. I leave it in and commented out to remind us
- * that we need to re-work this function to reflect this reallity.
- *
- * -- JRM 9/1/05
- */
+ /* Since metadata writes are now done by process 0 only, this broadcast
+ * is no longer needed. I leave it in and commented out to remind us
+ * that we need to re-work this function to reflect this reallity.
+ *
+ * -- JRM 9/1/05
+ */
/* Guard against getting into metadata broadcast in failure cases */
else {
/* when only one process writes, need to broadcast the ret_value to other processes */
- if (type!=H5FD_MEM_DRAW) {
+ if (type != H5FD_MEM_DRAW) {
if (MPI_SUCCESS != (mpi_code= MPI_Bcast(&ret_value, sizeof(ret_value), MPI_BYTE, H5_PAR_META_WRITE, file->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code)
} /* end if */
@@ -1359,11 +1338,10 @@ done:
/*-------------------------------------------------------------------------
* Function: H5FD_mpiposix_truncate
*
- * Purpose: Makes sure that the true file size is the same (or larger)
- * than the end-of-address.
+ * Purpose: Makes sure that the true file size is the same (or larger)
+ * than the end-of-address.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
@@ -1374,12 +1352,8 @@ static herr_t
H5FD_mpiposix_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing)
{
H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file;
-#ifdef H5_HAVE_WIN32_API
- HFILE filehandle; /* Windows file handle */
- LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */
-#endif /* H5_HAVE_WIN32_API */
- int mpi_code; /* MPI return code */
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
+ int mpi_code; /* MPI return code */
FUNC_ENTER_NOAPI_NOINIT
@@ -1390,19 +1364,42 @@ H5FD_mpiposix_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closi
if(file->eoa > file->last_eoa) {
/* Use the round-robin process to truncate (extend) the file */
if(file->mpi_rank == H5_PAR_META_WRITE) {
+
#ifdef H5_HAVE_WIN32_API
- /* Map the posix file handle to a Windows file handle */
- filehandle = _get_osfhandle(file->fd);
-
- /* Translate 64-bit integers into form Windows wants */
- /* [This algorithm is from the Windows documentation for SetFilePointer()] */
- li.QuadPart = file->eoa;
- SetFilePointer((HANDLE)filehandle, li.LowPart, &li.HighPart, FILE_BEGIN);
- if(SetEndOfFile((HANDLE)filehandle) == 0)
+ LARGE_INTEGER li; /* 64-bit (union) integer for SetFilePointer() call */
+ DWORD dwPtrLow; /* Low-order pointer bits from SetFilePointer()
+ * Only used as an error code here.
+ */
+ DWORD dwError; /* DWORD error code from GetLastError() */
+ BOOL bError; /* Boolean error flag */
+
+ /* Windows uses this odd QuadPart union for 32/64-bit portability */
+ li.QuadPart = (__int64)file->eoa;
+
+ /* Extend the file to make sure it's large enough.
+ *
+ * Since INVALID_SET_FILE_POINTER can technically be a valid return value
+ * from SetFilePointer(), we also need to check GetLastError().
+ */
+ dwPtrLow = SetFilePointer(file->hFile, li.LowPart, &li.HighPart, FILE_BEGIN);
+ if(INVALID_SET_FILE_POINTER == dwPtrLow) {
+ dwError = GetLastError();
+ if(dwError != NO_ERROR )
+ HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer")
+ }
+
+ bError = SetEndOfFile(file->hFile);
+ if(0 == bError)
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#else /* H5_HAVE_WIN32_API */
- if(-1==file_truncate(file->fd, (file_offset_t)file->eoa))
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
+#ifdef H5_VMS
+ /* Reset seek offset to the beginning of the file, so that the file isn't
+ * re-extended later. This may happen on Open VMS. */
+ if(-1 == HDlseek(file->fd, (HDoff_t)0, SEEK_SET))
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+#endif /* H5_VMS */
+ if(-1 == HDftruncate(file->fd, (HDoff_t)file->eoa))
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#endif /* H5_HAVE_WIN32_API */
} /* end if */
@@ -1430,18 +1427,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_mpi_rank
+ * Function: H5FD_mpiposix_mpi_rank
*
- * Purpose: Returns the MPI rank for a process
+ * Purpose: Returns the MPI rank for a process
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: MPI rank. Cannot report failure.
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -1451,26 +1445,23 @@ H5FD_mpiposix_mpi_rank(const H5FD_t *_file)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->mpi_rank)
} /* end H5FD_mpiposix_mpi_rank() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_mpi_size
+ * Function: H5FD_mpiposix_mpi_size
*
- * Purpose: Returns the number of MPI processes
+ * Purpose: Returns the number of MPI processes
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: The number of MPI processes. Cannot report failure.
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -1480,27 +1471,23 @@ H5FD_mpiposix_mpi_size(const H5FD_t *_file)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->mpi_size)
} /* end H5FD_mpiposix_mpi_size() */
/*-------------------------------------------------------------------------
- * Function: H5FD_mpiposix_communicator
- *
- * Purpose: Returns the MPI communicator for the file.
+ * Function: H5FD_mpiposix_communicator
*
- * Return: Success: The communicator
+ * Purpose: Returns the MPI communicator for the file.
*
- * Failure: NULL
+ * Return: The MPI communicator. Cannot report failure.
*
* Programmer: Quincey Koziol
* Thursday, July 11, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static MPI_Comm
@@ -1510,11 +1497,10 @@ H5FD_mpiposix_communicator(const H5FD_t *_file)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIPOSIX==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIPOSIX == file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->comm)
} /* end H5FD_mpi_posix_communicator() */
#endif /*H5_HAVE_PARALLEL*/
-
diff --git a/src/H5FDmpiposix.h b/src/H5FDmpiposix.h
index af13fad..e3764e1 100644
--- a/src/H5FDmpiposix.h
+++ b/src/H5FDmpiposix.h
@@ -14,7 +14,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol <koziol@hdfgroup.org>
* Thursday, July 11, 2002
*
* Purpose: The public header file for the mpiposix driver.
@@ -24,14 +24,14 @@
#define __H5FDmpiposix_H
#ifdef H5_HAVE_PARALLEL
-# define H5FD_MPIPOSIX (H5FD_mpiposix_init())
+# define H5FD_MPIPOSIX (H5FD_mpiposix_init())
#else
-# define H5FD_MPIPOSIX (-1)
+# define H5FD_MPIPOSIX (-1)
#endif
/* Macros */
-#define IS_H5FD_MPIPOSIX(f) /* (H5F_t *f) */ \
+#define IS_H5FD_MPIPOSIX(f) /* (H5F_t *f) */ \
(H5FD_MPIPOSIX==H5F_DRIVER_ID(f))
#ifdef H5_HAVE_PARALLEL
@@ -52,4 +52,3 @@ H5_DLL herr_t H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/, hbool_t
#endif /*H5_HAVE_PARALLEL*/
#endif /* __H5FDmpiposix_H */
-
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index b1d312f..08529e2 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -74,6 +74,10 @@
#define END_MEMBERS }}
+#define H5FD_MULTI_DXPL_PROP_NAME "H5FD_MULTI_DXPL"
+#define H5FD_MULTI_DXPL_PROP_SIZE sizeof(H5FD_multi_dxpl_t)
+
+
/* The driver identification number, initialized at runtime */
static hid_t H5FD_MULTI_g = 0;
@@ -126,8 +130,6 @@ static herr_t H5FD_multi_sb_decode(H5FD_t *file, const char *name,
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);
-static void *H5FD_multi_dxpl_copy(const void *_old_dx);
-static herr_t H5FD_multi_dxpl_free(void *_dx);
static H5FD_t *H5FD_multi_open(const char *name, unsigned flags,
hid_t fapl_id, haddr_t maxaddr);
static herr_t H5FD_multi_close(H5FD_t *_file);
@@ -161,9 +163,9 @@ static const H5FD_class_t H5FD_multi_g = {
H5FD_multi_fapl_get, /*fapl_get */
H5FD_multi_fapl_copy, /*fapl_copy */
H5FD_multi_fapl_free, /*fapl_free */
- sizeof(H5FD_multi_dxpl_t), /*dxpl_size */
- H5FD_multi_dxpl_copy, /*dxpl_copy */
- H5FD_multi_dxpl_free, /*dxpl_free */
+ 0, /*dxpl_size */
+ NULL, /*dxpl_copy */
+ NULL, /*dxpl_free */
H5FD_multi_open, /*open */
H5FD_multi_close, /*close */
H5FD_multi_cmp, /*cmp */
@@ -590,6 +592,127 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/,
/*-------------------------------------------------------------------------
+ * Function: H5FD_multi_dxpl_copy_cb
+ *
+ * Purpose: Multi VFD DXPL property 'copy' callback
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD_multi_dxpl_copy_cb(const char *name, size_t size, void *_dx)
+{
+ H5FD_multi_dxpl_t *dx = (H5FD_multi_dxpl_t *)_dx;
+ static const char *func = "H5FD_multi_dxpl_copy_cb"; /* Function Name for error reporting */
+
+ /* Shut compiler up */
+ name = name;
+
+ /* Sanity check */
+ assert(size == sizeof(H5FD_multi_dxpl_t));
+
+ ALL_MEMBERS(mt) {
+ if(dx->memb_dxpl[mt] >= 0)
+ if(H5Iinc_ref(dx->memb_dxpl[mt]) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTINC, "can't increment ref. count for multi VFD property", -1)
+ } END_MEMBERS;
+
+ return 0;
+} /* end H5FD_multi_dxpl_copy_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_multi_dxpl_cmp_cb
+ *
+ * Purpose: Multi VFD DXPL property 'compare' callback
+ *
+ * Return: Success: same as memcmp()
+ * Failure: <can't fail>
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5FD_multi_dxpl_cmp_cb(const void *_dx1, const void *_dx2, size_t size)
+{
+ const H5FD_multi_dxpl_t *dx1 = (const H5FD_multi_dxpl_t *)_dx1;
+ const H5FD_multi_dxpl_t *dx2 = (const H5FD_multi_dxpl_t *)_dx2;
+ int cmp_status;
+
+ /* Sanity check */
+ assert(size == sizeof(H5FD_multi_dxpl_t));
+
+ ALL_MEMBERS(mt) {
+ if(dx1->memb_dxpl[mt] >= 0) {
+ if(dx2->memb_dxpl[mt] >= 0) {
+ cmp_status = H5Pequal(dx1->memb_dxpl[mt], dx2->memb_dxpl[mt]);
+ if(cmp_status != 0)
+ return(cmp_status);
+ } /* end if */
+ else
+ return(1);
+ } /* end if */
+ else {
+ if(dx2->memb_dxpl[mt] >= 0)
+ return(-1);
+ else
+ if(dx1->memb_dxpl[mt] > dx2->memb_dxpl[mt])
+ return(1);
+ else if(dx1->memb_dxpl[mt] < dx2->memb_dxpl[mt])
+ return(-1);
+ else
+ continue;
+ } /* end else */
+ } END_MEMBERS;
+
+ return 0;
+} /* end H5FD_multi_dxpl_cmp_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_multi_dxpl_cls_cb
+ *
+ * Purpose: Multi VFD DXPL property 'close' callback
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, August 15, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD_multi_dxpl_cls_cb(const char *name, size_t size, void *_dx)
+{
+ H5FD_multi_dxpl_t *dx = (H5FD_multi_dxpl_t *)_dx;
+ static const char *func = "H5FD_multi_dxpl_cls_cb"; /* Function Name for error reporting */
+
+ /* Shut compiler up */
+ name = name;
+
+ /* Sanity check */
+ assert(size == sizeof(H5FD_multi_dxpl_t));
+
+ ALL_MEMBERS(mt) {
+ if(dx->memb_dxpl[mt] >= 0)
+ if(H5Idec_ref(dx->memb_dxpl[mt]) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTDEC, "can't increment ref. count for multi VFD property", -1)
+ } END_MEMBERS;
+
+ return 0;
+} /* end H5FD_multi_dxpl_cls_cb() */
+
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pset_dxpl_multi
*
* Purpose: Set the data transfer property list DXPL_ID to use the multi
@@ -613,7 +736,8 @@ H5Pset_dxpl_multi(hid_t dxpl_id, const hid_t *memb_dxpl)
{
H5FD_multi_dxpl_t dx;
H5FD_mem_t mt;
- static const char *func="H5FDset_dxpl_multi"; /* Function Name for error reporting */
+ htri_t prop_exists; /* Whether the multi VFD DXPL property already exists */
+ static const char *func = "H5FDset_dxpl_multi"; /* Function Name for error reporting */
/*NO TRACE*/
@@ -621,26 +745,56 @@ H5Pset_dxpl_multi(hid_t dxpl_id, const hid_t *memb_dxpl)
H5Eclear2(H5E_DEFAULT);
/* Check arguments */
- if (TRUE!=H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
+ if(TRUE != H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1)
- if (!memb_dxpl)
+ if(!memb_dxpl)
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "invalid pointer", -1)
- for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) {
- if (memb_dxpl[mt]!=H5P_DEFAULT && TRUE!=H5Pisa_class(memb_dxpl[mt], H5P_DATASET_XFER))
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
+ if(memb_dxpl[mt] != H5P_DEFAULT && TRUE != H5Pisa_class(memb_dxpl[mt], H5P_DATASET_XFER))
H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1)
- }
+ } /* end for */
+
+ /* Check for existence of multi VFD DXPL property in DXPL */
+ if((prop_exists = H5Pexist(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME)) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't check for multi VFD property", -1)
+
+ /* Copy the DXPLs to internal property, converting "generic" default
+ * property lists into default dataset transfer property lists */
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
+ if(memb_dxpl[mt] == H5P_DEFAULT)
+ dx.memb_dxpl[mt] = H5P_DATASET_XFER_DEFAULT;
+ else {
+ if((dx.memb_dxpl[mt] = H5Pcopy(memb_dxpl[mt])) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTCOPY, "can't copy dataset transfer property list", -1)
+ } /* end else */
+ } /* end for */
+
+ /* Clear previous property, if it exists */
+ if(prop_exists) {
+ H5FD_multi_dxpl_t old_dx;
+
+ /* Get the old DXPL value */
+ if(H5Pget(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, &old_dx) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't get previous property value", -1)
- /* Initialize the data transfer property list */
- memcpy(dx.memb_dxpl, memb_dxpl, H5FD_MEM_NTYPES*sizeof(hid_t));
+ ALL_MEMBERS(mt) {
+ if(old_dx.memb_dxpl[mt] >= 0)
+ if(H5Pclose(old_dx.memb_dxpl[mt]) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTCLOSEOBJ, "can't close property list", -1)
+ } END_MEMBERS;
- /* Convert "generic" default property lists into default dataset transfer property lists */
- for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) {
- if (dx.memb_dxpl[mt]==H5P_DEFAULT)
- dx.memb_dxpl[mt]=H5P_DATASET_XFER_DEFAULT;
- }
+ /* Set the new value */
+ if(H5Pset(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, &dx) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't get previous property value", -1)
+ } /* end if */
+ else {
+ /* Insert multi VFD DXPL property into property list */
+ if(H5Pinsert2(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, H5FD_MULTI_DXPL_PROP_SIZE, &dx, NULL, NULL, NULL, H5FD_multi_dxpl_copy_cb, H5FD_multi_dxpl_cmp_cb, H5FD_multi_dxpl_cls_cb) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTINSERT, "can't insert multi VFD DXPL property", -1)
+ } /* end else */
- return H5Pset_driver(dxpl_id, H5FD_MULTI, &dx);
-}
+ return 0;
+} /* end H5Pset_dxpl_multi() */
/*-------------------------------------------------------------------------
@@ -663,33 +817,42 @@ H5Pset_dxpl_multi(hid_t dxpl_id, const hid_t *memb_dxpl)
herr_t
H5Pget_dxpl_multi(hid_t dxpl_id, hid_t *memb_dxpl/*out*/)
{
- H5FD_multi_dxpl_t *dx;
+ H5FD_multi_dxpl_t dx;
H5FD_mem_t mt;
- static const char *func="H5FDget_dxpl_multi"; /* Function Name for error reporting */
+ htri_t prop_exists; /* Whether the multi VFD DXPL property already exists */
+ static const char *func = "H5FDget_dxpl_multi"; /* Function Name for error reporting */
/*NO TRACE*/
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- if (TRUE!=H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
+ /* Argument checking */
+ if(TRUE != H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1)
- if (H5FD_MULTI!=H5Pget_driver(dxpl_id))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1)
- if(NULL == (dx = (H5FD_multi_dxpl_t *)H5Pget_driver_info(dxpl_id)))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1)
- if (memb_dxpl) {
- for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) {
- if (dx->memb_dxpl[mt]>=0)
- memb_dxpl[mt] = H5Pcopy(dx->memb_dxpl[mt]);
+ if(memb_dxpl) {
+ /* Check for existence of multi VFD DXPL property in DXPL */
+ if((prop_exists = H5Pexist(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME)) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't check for multi VFD property", -1)
+ if(!prop_exists)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "multi VFD DXPL property not set", -1)
+
+ /* Get the DXPL value */
+ if(H5Pget(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, &dx) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't get property value", -1)
+
+ /* Deep copy the multi VFD DXPL value */
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
+ if(dx.memb_dxpl[mt] >= 0)
+ memb_dxpl[mt] = H5Pcopy(dx.memb_dxpl[mt]);
else
- memb_dxpl[mt] = dx->memb_dxpl[mt]; /*default or bad ID */
- }
- }
+ memb_dxpl[mt] = dx.memb_dxpl[mt]; /*default or bad ID */
+ } /* end for */
+ } /* end if */
return 0;
-}
+} /* end H5Pget_dxpl_multi() */
/*-------------------------------------------------------------------------
@@ -1106,90 +1269,6 @@ H5FD_multi_fapl_free(void *_fa)
/*-------------------------------------------------------------------------
- * Function: H5FD_multi_dxpl_copy
- *
- * Purpose: Copes the multi-specific data transfer properties.
- *
- * Return: Success: Ptr to new property list
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5FD_multi_dxpl_copy(const void *_old_dx)
-{
- const H5FD_multi_dxpl_t *old_dx = (const H5FD_multi_dxpl_t*)_old_dx;
- H5FD_multi_dxpl_t *new_dx = (H5FD_multi_dxpl_t *)malloc(sizeof(H5FD_multi_dxpl_t));
- int nerrors = 0;
- static const char *func="H5FD_multi_dxpl_copy"; /* Function Name for error reporting */
-
- assert(new_dx);
-
- /* Clear the error stack */
- H5Eclear2(H5E_DEFAULT);
-
- memcpy(new_dx, old_dx, sizeof(H5FD_multi_dxpl_t));
- ALL_MEMBERS(mt) {
- if (old_dx->memb_dxpl[mt]>=0) {
- new_dx->memb_dxpl[mt] = H5Pcopy(old_dx->memb_dxpl[mt]);
- if (new_dx->memb_dxpl[mt]<0) nerrors++;
- }
- } END_MEMBERS;
-
- if (nerrors) {
- ALL_MEMBERS(mt) {
- (void)H5Pclose(new_dx->memb_dxpl[mt]);
- } END_MEMBERS;
- free(new_dx);
- H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "invalid freespace objects", NULL)
- }
- return new_dx;
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5FD_multi_dxpl_free
- *
- * Purpose: Frees the multi-specific data transfer properties.
- *
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5FD_multi_dxpl_free(void *_dx)
-{
- H5FD_multi_dxpl_t *dx = (H5FD_multi_dxpl_t*)_dx;
- static const char *func="H5FD_multi_dxpl_free"; /* Function Name for error reporting */
-
- /* Clear the error stack */
- H5Eclear2(H5E_DEFAULT);
-
- ALL_MEMBERS(mt) {
- if (dx->memb_dxpl[mt]>=0)
- if(H5Pclose(dx->memb_dxpl[mt])<0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", -1)
- } END_MEMBERS;
-
- free(dx);
- return 0;
-}
-
-
-/*-------------------------------------------------------------------------
* Function: H5FD_multi_open
*
* Purpose: Creates and/or opens a multi HDF5 file.
@@ -1823,25 +1902,33 @@ H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsi
* Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
- void *_buf/*out*/)
+H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
+ size_t size, void *_buf/*out*/)
{
H5FD_multi_t *file = (H5FD_multi_t*)_file;
- H5FD_multi_dxpl_t *dx=NULL;
- H5FD_mem_t mt, mmt, hi=H5FD_MEM_DEFAULT;
- haddr_t start_addr=0;
+ H5FD_multi_dxpl_t dx;
+ htri_t prop_exists = FALSE; /* Whether the multi VFD DXPL property already exists */
+ H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT;
+ haddr_t start_addr = 0;
+ static const char *func = "H5FD_multi_read"; /* Function Name for error reporting */
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
/* Get the data transfer properties */
- if(H5P_FILE_ACCESS_DEFAULT != dxpl_id && H5FD_MULTI == H5Pget_driver(dxpl_id))
- dx = (H5FD_multi_dxpl_t *)H5Pget_driver_info(dxpl_id);
+ if(H5P_FILE_ACCESS_DEFAULT != dxpl_id) {
+ /* Check for existence of multi VFD DXPL property in DXPL */
+ if((prop_exists = H5Pexist(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME)) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't check for multi VFD property", -1)
+
+ /* Get the DXPL value, if it exists */
+ if(prop_exists)
+ if(H5Pget(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, &dx) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't get property value", -1)
+ } /* end if */
/* Find the file to which this address belongs */
for(mt = H5FD_MEM_SUPER; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
@@ -1850,18 +1937,19 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
mmt = mt;
assert(mmt > 0 && mmt < H5FD_MEM_NTYPES);
- if (file->fa.memb_addr[mmt]>addr) continue;
- if (file->fa.memb_addr[mmt]>=start_addr) {
+ if(file->fa.memb_addr[mmt] > addr)
+ continue;
+ if(file->fa.memb_addr[mmt] >= start_addr) {
start_addr = file->fa.memb_addr[mmt];
hi = mmt;
- }
- }
- assert(hi>0);
+ } /* end if */
+ } /* end for */
+ assert(hi > 0);
/* Read from that member */
- return H5FDread(file->memb[hi], type, dx?dx->memb_dxpl[hi]:H5P_DEFAULT,
- addr-start_addr, size, _buf);
-}
+ return H5FDread(file->memb[hi], type, (prop_exists ? dx.memb_dxpl[hi] : H5P_DEFAULT),
+ addr - start_addr, size, _buf);
+} /* end H5FD_multi_read() */
/*-------------------------------------------------------------------------
@@ -1878,45 +1966,54 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
* Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
- const void *_buf)
+H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
+ size_t size, const void *_buf)
{
H5FD_multi_t *file = (H5FD_multi_t*)_file;
- H5FD_multi_dxpl_t *dx=NULL;
- H5FD_mem_t mt, mmt, hi=H5FD_MEM_DEFAULT;
- haddr_t start_addr=0;
+ H5FD_multi_dxpl_t dx;
+ htri_t prop_exists = FALSE; /* Whether the multi VFD DXPL property already exists */
+ H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT;
+ haddr_t start_addr = 0;
+ static const char *func = "H5FD_multi_read"; /* Function Name for error reporting */
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
/* Get the data transfer properties */
- if(H5P_FILE_ACCESS_DEFAULT != dxpl_id && H5FD_MULTI == H5Pget_driver(dxpl_id))
- dx = (H5FD_multi_dxpl_t *)H5Pget_driver_info(dxpl_id);
+ if(H5P_FILE_ACCESS_DEFAULT != dxpl_id) {
+ /* Check for existence of multi VFD DXPL property in DXPL */
+ if((prop_exists = H5Pexist(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME)) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't check for multi VFD property", -1)
+
+ /* Get the DXPL value, if it exists */
+ if(prop_exists)
+ if(H5Pget(dxpl_id, H5FD_MULTI_DXPL_PROP_NAME, &dx) < 0)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_CANTGET, "can't get property value", -1)
+ } /* end if */
/* Find the file to which this address belongs */
for(mt = H5FD_MEM_SUPER; mt < H5FD_MEM_NTYPES; mt = (H5FD_mem_t)(mt + 1)) {
mmt = file->fa.memb_map[mt];
if(H5FD_MEM_DEFAULT == mmt)
mmt = mt;
- assert(mmt>0 && mmt<H5FD_MEM_NTYPES);
+ assert(mmt > 0 && mmt<H5FD_MEM_NTYPES);
- if (file->fa.memb_addr[mmt]>addr) continue;
- if (file->fa.memb_addr[mmt]>=start_addr) {
+ if(file->fa.memb_addr[mmt] > addr)
+ continue;
+ if(file->fa.memb_addr[mmt] >= start_addr) {
start_addr = file->fa.memb_addr[mmt];
hi = mmt;
- }
- }
- assert(hi>0);
+ } /* end if */
+ } /* end for */
+ assert(hi > 0);
/* Write to that member */
- return H5FDwrite(file->memb[hi], type, dx?dx->memb_dxpl[hi]:H5P_DEFAULT,
- addr-start_addr, size, _buf);
-}
+ return H5FDwrite(file->memb[hi], type, (prop_exists ? dx.memb_dxpl[hi] : H5P_DEFAULT),
+ addr - start_addr, size, _buf);
+} /* end H5FD_multi_write() */
/*-------------------------------------------------------------------------
@@ -1931,8 +2028,6 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si
* Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 9c19562..64b71d4 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -96,8 +96,6 @@ H5_DLL herr_t H5FD_sb_decode(H5FD_t *file, const char *name, const uint8_t *buf)
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_close(hid_t driver_id, void *fapl);
-H5_DLL herr_t H5FD_dxpl_open(struct H5P_genplist_t *plist, hid_t driver_id, const void *driver_info);
-H5_DLL herr_t H5FD_dxpl_close(hid_t driver_id, void *dxpl);
H5_DLL hid_t H5FD_register(const void *cls, size_t size, hbool_t app_ref);
H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr);
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 4201e07..241609d 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -191,7 +191,7 @@ static const H5FD_class_t H5FD_sec2_g = {
H5FD_sec2_truncate, /*truncate */
NULL, /*lock */
NULL, /*unlock */
- H5FD_FLMAP_SINGLE /*fl_map */
+ H5FD_FLMAP_DICHOTOMY /*fl_map */
};
/* Declare a free list to manage the H5FD_sec2_t struct */
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 4733eba..43bf6b9 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -226,7 +226,7 @@ static const H5FD_class_t H5FD_stdio_g = {
H5FD_stdio_truncate, /* truncate */
NULL, /* lock */
NULL, /* unlock */
- H5FD_FLMAP_SINGLE /* fl_map */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
diff --git a/src/H5FS.c b/src/H5FS.c
index fc1285f..7c09beb 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -284,6 +284,50 @@ HDfprintf(stderr, "%s: Deleting free space manager, fs_addr = %a\n", FUNC, fs_ad
cache_udata.cls_init_udata = NULL;
cache_udata.addr = fs_addr;
+#ifdef H5FS_DEBUG
+{
+ unsigned fspace_status = 0; /* Free space section info's status in the metadata cache */
+
+ /* Sanity check */
+ HDassert(H5F_addr_defined(fs_addr));
+
+ /* Check the free space section info's status in the metadata cache */
+ if(H5AC_get_entry_status(f, fs_addr, &fspace_status) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to check metadata cache status for free space section info")
+
+ HDfprintf(stderr, "%s: fspace_status = %0x: ", FUNC, fspace_status);
+ if(fspace_status) {
+ hbool_t printed = FALSE;
+
+ if(fspace_status & H5AC_ES__IN_CACHE) {
+ HDfprintf(stderr, "H5AC_ES__IN_CACHE");
+ printed = TRUE;
+ } /* end if */
+ if(fspace_status & H5AC_ES__IS_DIRTY) {
+ HDfprintf(stderr, "%sH5AC_ES__IS_DIRTY", (printed ? " | " : ""));
+ printed = TRUE;
+ } /* end if */
+ if(fspace_status & H5AC_ES__IS_PROTECTED) {
+ HDfprintf(stderr, "%sH5AC_ES__IS_PROTECTED", (printed ? " | " : ""));
+ printed = TRUE;
+ } /* end if */
+ if(fspace_status & H5AC_ES__IS_PINNED) {
+ HDfprintf(stderr, "%sH5AC_ES__IS_PINNED", (printed ? " | " : ""));
+ printed = TRUE;
+ } /* end if */
+ if(fspace_status & H5AC_ES__IS_FLUSH_DEP_PARENT) {
+ HDfprintf(stderr, "%sH5AC_ES__IS_FLUSH_DEP_PARENT", (printed ? " | " : ""));
+ printed = TRUE;
+ } /* end if */
+ if(fspace_status & H5AC_ES__IS_FLUSH_DEP_CHILD) {
+ HDfprintf(stderr, "%sH5AC_ES__IS_FLUSH_DEP_CHILD", (printed ? " | " : ""));
+ printed = TRUE;
+ } /* end if */
+ } /* end if */
+ HDfprintf(stderr, "\n");
+}
+#endif /* H5FS_DEBUG */
+
/* Protect the free space header */
if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC_WRITE)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space header")
@@ -324,9 +368,14 @@ HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", FUN
#endif /* H5FS_DEBUG */
} /* end if */
else {
+#ifdef H5FS_DEBUG
+HDfprintf(stderr, "%s: Deleting free space section info from file\n", FUNC);
+#endif /* H5FS_DEBUG */
/* Release the space in the file */
- if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_addr, fspace->alloc_sect_size) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections")
+ if(!H5F_IS_TMP_ADDR(f, fspace->sect_addr)) {
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_addr, fspace->alloc_sect_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections")
+ } /* end if */
} /* end else */
} /* end if */
@@ -387,8 +436,14 @@ HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC);
HDassert(fspace->sect_size > 0);
/* Allocate space for the section info in file */
- if(HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size)))
- HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections")
+ if(H5F_USE_TMP_SPACE(f)) {
+ if(HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc_tmp(f, fspace->sect_size)))
+ HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections")
+ } /* end if */
+ else {
+ if(HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size)))
+ HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections")
+ } /* end if */
fspace->alloc_sect_size = (size_t)fspace->sect_size;
/* Mark free space header as dirty */
@@ -430,19 +485,9 @@ HDfprintf(stderr, "%s: Section info allocated though\n", FUNC);
HDfprintf(stderr, "%s: Section info is for file free space\n", FUNC);
#endif /* H5FS_DEBUG */
/* Try to shrink the file or absorb the section info into a block aggregator */
- if((status = H5MF_try_shrink(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_addr, fspace->alloc_sect_size)) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't check for absorbing section info")
- else if(status == FALSE) {
- /* Section info can't "go away", but it's free. Allow
- * header to record it
- */
-#ifdef H5FS_DEBUG
-HDfprintf(stderr, "%s: Section info can't 'go away', header will own it\n", FUNC);
-#endif /* H5FS_DEBUG */
- } /* end if */
- else {
+ if(H5F_IS_TMP_ADDR(f, fspace->sect_addr)) {
#ifdef H5FS_DEBUG
-HDfprintf(stderr, "%s: Section info went 'go away'\n", FUNC);
+HDfprintf(stderr, "%s: Section info in temp. address space went 'go away'\n", FUNC);
#endif /* H5FS_DEBUG */
/* Reset section info in header */
fspace->sect_addr = HADDR_UNDEF;
@@ -451,6 +496,30 @@ HDfprintf(stderr, "%s: Section info went 'go away'\n", FUNC);
/* Mark free space header as dirty */
if(H5AC_mark_entry_dirty(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
+ } /* end if */
+ else {
+ if((status = H5MF_try_shrink(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_addr, fspace->alloc_sect_size)) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't check for absorbing section info")
+ else if(status == FALSE) {
+ /* Section info can't "go away", but it's free. Allow
+ * header to record it
+ */
+#ifdef H5FS_DEBUG
+ HDfprintf(stderr, "%s: Section info can't 'go away', header will own it\n", FUNC);
+#endif /* H5FS_DEBUG */
+ } /* end if */
+ else {
+#ifdef H5FS_DEBUG
+ HDfprintf(stderr, "%s: Section info went 'go away'\n", FUNC);
+#endif /* H5FS_DEBUG */
+ /* Reset section info in header */
+ fspace->sect_addr = HADDR_UNDEF;
+ fspace->alloc_sect_size = 0;
+
+ /* Mark free space header as dirty */
+ if(H5AC_mark_entry_dirty(fspace) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
+ } /* end else */
} /* end else */
} /* end if */
else {
@@ -469,10 +538,12 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC);
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
/* Free previous serialized sections disk space */
- if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, old_sect_addr, old_alloc_sect_size) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections")
- } /* end if */
- } /* end else */
+ if(!H5F_IS_TMP_ADDR(f, old_sect_addr)) {
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, old_sect_addr, old_alloc_sect_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections")
+ } /* end if */
+ } /* end else */
+ } /* end if */
/* Destroy section info */
if(H5FS_sinfo_dest(fspace->sinfo) < 0)
@@ -802,11 +873,11 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id)
HDassert(fspace);
if(!H5F_addr_defined(fspace->sect_addr) && fspace->sinfo && fspace->serial_sect_count > 0) {
- /* Allocate space for section info from aggregator/vfd */
- /* (The original version called H5MF_alloc(), but that may cause sect_size to change again) */
- if(HADDR_UNDEF == (fspace->sect_addr = H5MF_aggr_vfd_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size)))
- HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for section info")
-
+ /* Allocate space for section info from aggregator/vfd (or temp. address space) */
+ /* (The original version called H5MF_alloc(), but that may cause sect_size to change again) */
+ /* (This routine is only called during file close operations, so don't allocate from temp. address space) */
+ if(HADDR_UNDEF == (fspace->sect_addr = H5MF_aggr_vfd_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size)))
+ HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for section info")
fspace->alloc_sect_size = fspace->sect_size;
/* Mark free-space header as dirty */
@@ -882,8 +953,10 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id)
fspace->alloc_sect_size = 0;
/* Free space for the free-space manager section info */
- if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, saved_addr, saved_size) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections")
+ if(!H5F_IS_TMP_ADDR(f, saved_addr)) {
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, saved_addr, saved_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections")
+ } /* end if */
/* Mark free-space manager header as dirty */
if(H5FS_dirty(fspace) < 0)
@@ -1120,7 +1193,7 @@ herr_t
H5FS_assert(const H5FS_t *fspace)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
-#ifndef QAK
+#ifdef QAK
HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS_assert", fspace->tot_sect_count);
#endif /* QAK */
diff --git a/src/H5FScache.c b/src/H5FScache.c
index d186404..e441398 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -306,7 +306,7 @@ H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F
if(fspace->sinfo->dirty) {
if(fspace->serial_sect_count > 0) {
/* Check if we need to allocate space for section info */
- if(!H5F_addr_defined(fspace->sect_addr)) {
+ if(H5F_IS_TMP_ADDR(f, fspace->sect_addr) || !H5F_addr_defined(fspace->sect_addr)) {
/* Sanity check */
HDassert(fspace->sect_size > 0);
@@ -884,6 +884,32 @@ H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H
HDassert((size_t)(p - buf) == sinfo->fspace->sect_size);
HDassert(sinfo->fspace->sect_size <= sinfo->fspace->alloc_sect_size);
+ /* Check for section info at temporary address */
+ if(H5F_IS_TMP_ADDR(f, sinfo->fspace->sect_addr)) {
+ /* Sanity check */
+ HDassert(sinfo->fspace->sect_size > 0);
+ HDassert(H5F_addr_eq(sinfo->fspace->sect_addr, addr));
+
+ /* Allocate space for the section info in file */
+ if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, sinfo->fspace->sect_size)))
+ HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections")
+ sinfo->fspace->alloc_sect_size = (size_t)sinfo->fspace->sect_size;
+
+ /* Sanity check */
+ HDassert(!H5F_addr_eq(sinfo->fspace->sect_addr, addr));
+
+ /* Let the metadata cache know the section info moved */
+ if(H5AC_move_entry(f, H5AC_FSPACE_SINFO, sinfo->fspace->sect_addr, addr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move indirect block")
+
+ /* Update the internal address for the section info */
+ sinfo->fspace->sect_addr = addr;
+
+ /* Mark free space header as dirty */
+ if(H5AC_mark_entry_dirty(sinfo->fspace) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
+ } /* end if */
+
/* Write buffer to disk */
if(H5F_block_write(f, H5FD_MEM_FSPACE_SINFO, sinfo->fspace->sect_addr, (size_t)sinfo->fspace->sect_size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to save free space sections to disk")
@@ -936,8 +962,9 @@ H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo)
/* Release the space on disk */
/* (XXX: Nasty usage of internal DXPL value! -QAK) */
- if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, H5AC_dxpl_id, sinfo->cache_info.addr, (hsize_t)sinfo->fspace->alloc_sect_size) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space section info")
+ if(!H5F_IS_TMP_ADDR(f, sinfo->cache_info.addr))
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, H5AC_dxpl_id, sinfo->cache_info.addr, (hsize_t)sinfo->fspace->alloc_sect_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space section info")
} /* end if */
/* Destroy free space info */
diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h
index f6a0034..8cb3f95 100644
--- a/src/H5FSprivate.h
+++ b/src/H5FSprivate.h
@@ -200,6 +200,8 @@ H5_DLL herr_t H5FS_sect_stats(const H5FS_t *fspace, hsize_t *tot_space,
hsize_t *nsects);
H5_DLL herr_t H5FS_sect_change_class(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
H5FS_section_info_t *sect, unsigned new_class);
+H5_DLL htri_t H5FS_sect_try_shrink_eoa(const H5F_t *f, hid_t dxpl_id, const H5FS_t *fspace, void *op_data);
+H5_DLL herr_t H5FS_sect_query_last_sect(const H5FS_t *fspace, haddr_t *sect_addr, hsize_t *sect_size);
/* Statistics routine */
H5_DLL herr_t H5FS_stat_info(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *stats);
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index 0f126c2..fa24f85 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -445,8 +445,10 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC);
HDfprintf(stderr, "%s: Freeing section info on disk, old_sect_addr = %a, old_alloc_sect_size = %Hu\n", FUNC, old_sect_addr, old_alloc_sect_size);
#endif /* H5FS_SINFO_DEBUG */
/* Release space for section info in file */
- if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, old_sect_addr, old_alloc_sect_size) < 0)
- HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections")
+ if(!H5F_IS_TMP_ADDR(f, old_sect_addr)) {
+ if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, old_sect_addr, old_alloc_sect_size) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections")
+ } /* end if */
} /* end if */
} /* end if */
@@ -2375,3 +2377,114 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", "H
} /* end H5FS_sect_assert() */
#endif /* H5FS_DEBUG_ASSERT */
+
+/*-------------------------------------------------------------------------
+ * Function: H5FS_sect_try_shrink_eoa
+ *
+ * Purpose: To shrink the last section on the merge list if the section
+ * is at EOF.
+ *
+ * Return: Success: non-negative (TRUE/FALSE)
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5FS_sect_try_shrink_eoa(const H5F_t *f, hid_t dxpl_id, const H5FS_t *fspace, void *op_data)
+{
+ hbool_t sinfo_valid = FALSE; /* Whether the section info is valid */
+ hbool_t section_removed = FALSE; /* Whether a section was removed */
+ htri_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments. */
+ HDassert(fspace);
+
+ if(H5FS_sinfo_lock(f, dxpl_id, fspace, H5AC_WRITE) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info")
+ sinfo_valid = TRUE;
+
+ if(fspace->sinfo && fspace->sinfo->merge_list) {
+ H5SL_node_t *last_node; /* Last node in merge list */
+
+ /* Check for last node in the merge list */
+ if(NULL != (last_node = H5SL_last(fspace->sinfo->merge_list))) {
+ H5FS_section_info_t *tmp_sect; /* Temporary free space section */
+ H5FS_section_class_t *tmp_sect_cls; /* Temporary section's class */
+
+ /* Get the pointer to the last section, from the last node */
+ tmp_sect = (H5FS_section_info_t *)H5SL_item(last_node);
+ HDassert(tmp_sect);
+ tmp_sect_cls = &fspace->sect_cls[tmp_sect->type];
+ if(tmp_sect_cls->can_shrink) {
+ /* Check if the section can be shrunk away */
+ if((ret_value = (*tmp_sect_cls->can_shrink)(tmp_sect, op_data)) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container")
+ if(ret_value > 0) {
+ HDassert(tmp_sect_cls->shrink);
+
+ /* Remove section from free space manager */
+ if(H5FS_sect_remove_real(fspace, tmp_sect) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures")
+ section_removed = TRUE;
+
+ /* Shrink away section */
+ if((*tmp_sect_cls->shrink)(&tmp_sect, op_data) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container")
+ } /* end if */
+ } /* end if */
+ } /* end if */
+ } /* end if */
+
+done:
+ /* Release the section info */
+ if(sinfo_valid && H5FS_sinfo_unlock(f, dxpl_id, fspace, section_removed) < 0)
+ HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5FS_sect_try_shrink_eoa() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FS_sect_query_last_sect
+ *
+ * Purpose: Retrieve info about the last section on the merge list
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FS_sect_query_last_sect(const H5FS_t *fspace, haddr_t *sect_addr, hsize_t *sect_size)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Check arguments. */
+ HDassert(fspace);
+
+ if(fspace->sinfo && fspace->sinfo->merge_list) {
+ H5SL_node_t *last_node; /* Last node in merge list */
+
+ /* Check for last node in the merge list */
+ if(NULL != (last_node = H5SL_last(fspace->sinfo->merge_list))) {
+ H5FS_section_info_t *tmp_sect; /* Temporary free space section */
+
+ /* Get the pointer to the last section, from the last node */
+ tmp_sect = (H5FS_section_info_t *)H5SL_item(last_node);
+ HDassert(tmp_sect);
+ if(sect_addr)
+ *sect_addr = tmp_sect->addr;
+ if(sect_size)
+ *sect_size = tmp_sect->size;
+ } /* end if */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5FS_sect_query_last_sect() */
+
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 65b5b08..538a22a 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -608,7 +608,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_is_hdf5() */
-
/*-------------------------------------------------------------------------
* Function: H5F_new
*
@@ -808,13 +807,15 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
* Only try to flush the file if it was opened with write access, and if
* the caller requested a flush.
*/
- if((f->shared->flags & H5F_ACC_RDWR) && flush)
+ if((H5F_ACC_RDWR & H5F_INTENT(f)) && flush)
if(H5F_flush(f, dxpl_id, TRUE) < 0)
+ /* Push error, but keep going*/
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
/* Release the external file cache */
if(f->shared->efc) {
if(H5F_efc_destroy(f->shared->efc) < 0)
+ /* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't destroy external file cache")
f->shared->efc = NULL;
} /* end if */
@@ -832,6 +833,14 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
if(H5MF_close(f, dxpl_id) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info")
+
+ /* Flush the file again (if requested), as shutting down the
+ * free space manager may dirty some data structures again.
+ */
+ if(flush)
+ if(H5F_flush(f, dxpl_id, TRUE) < 0)
+ /* Push error, but keep going*/
+ HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
} /* end if */
/* Unpin the superblock, since we're about to destroy the cache */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 8bf4405..8205392 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -516,7 +516,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set EOA value for superblock")
/* Insert superblock into cache, pinned */
- if(H5AC_insert_entry(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, H5AC__PIN_ENTRY_FLAG) < 0)
+ if(H5AC_insert_entry(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, H5AC__PIN_ENTRY_FLAG | H5AC__FLUSH_LAST_FLAG | H5AC__FLUSH_COLLECTIVELY_FLAG) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "can't add superblock to cache")
sblock_in_cache = TRUE;
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index cc1137b..48fd139 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -153,6 +153,12 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata)
if(NULL == (sblock = H5FL_CALLOC(H5F_super_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ /* The superblock must be flushed last (and collectively in parallel) */
+ sblock->cache_info.flush_me_last = TRUE;
+#ifdef H5_HAVE_PARALLEL
+ sblock->cache_info.flush_me_collectively = TRUE;
+#endif
+
/* Read fixed-size portion of the superblock */
p = sbuf;
H5_CHECK_OVERFLOW(fixed_size, size_t, haddr_t);
@@ -638,6 +644,15 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
HDassert(f);
HDassert(H5F_addr_eq(addr, 0));
HDassert(sblock);
+
+ /* Assert that the superblock is marked as being flushed last (and
+ collectively in parallel) */
+ /* (We'll rely on the cache to make sure it actually *is* flushed
+ last (and collectively in parallel), but this check doesn't hurt) */
+ HDassert(sblock->cache_info.flush_me_last);
+#ifdef H5_HAVE_PARALLEL
+ HDassert(sblock->cache_info.flush_me_collectively);
+#endif
if(sblock->cache_info.is_dirty) {
uint8_t buf[H5F_MAX_SUPERBLOCK_SIZE + H5F_MAX_DRVINFOBLOCK_SIZE]; /* Superblock & driver info blockencoding buffer */
@@ -677,10 +692,15 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
*p++ = 0; /*reserved */
} /* end if */
+ /* Encode the base address */
H5F_addr_encode(f, &p, sblock->base_addr);
+
+ /* Encode the address of global free-space index */
H5F_addr_encode(f, &p, sblock->ext_addr);
rel_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_SUPER);
H5F_addr_encode(f, &p, (rel_eoa + sblock->base_addr));
+
+ /* Encode the driver informaton block address */
H5F_addr_encode(f, &p, sblock->driver_addr);
/* Encode the root group object entry, including the cached stab info */
@@ -731,9 +751,12 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
*p++ = (uint8_t)H5F_SIZEOF_SIZE(f);
*p++ = sblock->status_flags;
- /* Base, superblock extension & end of file addresses */
+ /* Encode the base address */
H5F_addr_encode(f, &p, sblock->base_addr);
+
+ /* Encode the address of the superblock extension */
H5F_addr_encode(f, &p, sblock->ext_addr);
+
rel_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_SUPER);
H5F_addr_encode(f, &p, (rel_eoa + sblock->base_addr));
@@ -767,13 +790,18 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
/* Check for newer version of superblock format & superblock extension */
if(sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2 && H5F_addr_defined(sblock->ext_addr)) {
+ H5O_loc_t ext_loc; /* "Object location" for superblock extension */
+
+ /* Open the superblock extension's object header */
+ if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension")
+
/* Check for ignoring the driver info for this file */
if(!H5F_HAS_FEATURE(f, H5FD_FEAT_IGNORE_DRVRINFO)) {
/* Check for driver info message */
H5_ASSIGN_OVERFLOW(driver_size, H5FD_sb_size(f->shared->lf), hsize_t, size_t);
if(driver_size > 0) {
H5O_drvinfo_t drvinfo; /* Driver info */
- H5O_loc_t ext_loc; /* "Object location" for superblock extension */
uint8_t dbuf[H5F_MAX_DRVINFOBLOCK_SIZE]; /* Driver info block encoding buffer */
/* Sanity check */
@@ -783,21 +811,19 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr,
if(H5FD_sb_encode(f->shared->lf, drvinfo.name, dbuf) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information")
- /* Open the superblock extension's object header */
- if(H5F_super_ext_open(f, sblock->ext_addr, &ext_loc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension")
-
/* Write driver info information to the superblock extension */
drvinfo.len = driver_size;
drvinfo.buf = dbuf;
if(H5O_msg_write(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &drvinfo, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "unable to update driver info header message")
- /* Close the superblock extension object header */
- if(H5F_super_ext_close(f, &ext_loc, dxpl_id, FALSE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close file's superblock extension")
} /* end if */
+
} /* end if */
+
+ /* Close the superblock extension object header */
+ if(H5F_super_ext_close(f, &ext_loc, dxpl_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close file's superblock extension")
} /* end if */
/* Reset the dirty flag. */
diff --git a/src/H5HF.c b/src/H5HF.c
index a9750c9..64e8af2 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -439,14 +439,8 @@ H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *_id, size_t *obj_len_p)
/* Check type of object in heap */
if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) {
- /* Skip over the flag byte */
- id++;
-
- /* Skip over object offset */
- id += fh->hdr->heap_off_size;
-
- /* Retrieve the entry length */
- UINT64DECODE_VAR(id, *obj_len_p, fh->hdr->heap_len_size);
+ if(H5HF_man_get_obj_len(fh->hdr, id, obj_len_p) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'managed' object's length")
} /* end if */
else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) {
if(H5HF_huge_get_obj_len(fh->hdr, dxpl_id, id, obj_len_p) < 0)
@@ -457,8 +451,8 @@ H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *_id, size_t *obj_len_p)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'tiny' object's length")
} /* end if */
else {
-HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
-HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
+ HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
done:
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 62f5580..58e3318 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -218,6 +218,44 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HF_man_get_obj_len
+ *
+ * Purpose: Get the size of a managed heap object
+ *
+ * Return: SUCCEED (Can't fail)
+ *
+ * Programmer: Dana Robinson (derobins@hdfgroup.org)
+ * August 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p)
+{
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /*
+ * Check arguments.
+ */
+ HDassert(hdr);
+ HDassert(id);
+ HDassert(obj_len_p);
+
+ /* Skip over the flag byte */
+ id++;
+
+ /* Skip over object offset */
+ id += hdr->heap_off_size;
+
+ /* Retrieve the entry length */
+ UINT64DECODE_VAR(id, *obj_len_p, hdr->heap_len_size);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HF_man_get_obj_len() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_man_op_real
*
* Purpose: Internal routine to perform an operation on a managed heap
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index 498c45e..e0deca7 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -662,6 +662,8 @@ H5_DLL herr_t H5HF_man_dblock_dest(H5HF_direct_t *dblock);
/* Managed object routines */
H5_DLL herr_t H5HF_man_insert(H5HF_hdr_t *fh, hid_t dxpl_id, size_t obj_size,
const void *obj, void *id);
+H5_DLL herr_t H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id,
+ size_t *obj_len_p);
H5_DLL herr_t H5HF_man_read(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id,
void *obj);
H5_DLL herr_t H5HF_man_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
diff --git a/src/H5HFsection.c b/src/H5HFsection.c
index e9ea7e0..72ea100 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -2398,7 +2398,10 @@ H5HF_sect_indirect_init_rows(H5HF_hdr_t *hdr, hid_t dxpl_id,
HDassert(sect->u.indirect.span_size > 0);
/* Reset reference count for indirect section */
+ /* (Also reset the direct & indirect row pointers */
sect->u.indirect.rc = 0;
+ sect->u.indirect.dir_rows = NULL;
+ sect->u.indirect.indir_ents = NULL;
/* Set up direct block information, if necessary */
if(start_row < hdr->man_dtable.max_direct_rows) {
@@ -2424,7 +2427,6 @@ H5HF_sect_indirect_init_rows(H5HF_hdr_t *hdr, hid_t dxpl_id,
/* No rows of direct blocks covered, reset direct row information */
dir_nrows = 0;
sect->u.indirect.dir_nrows = 0;
- sect->u.indirect.dir_rows = NULL;
} /* end else */
/* Set up indirect block information, if necessary */
@@ -2459,7 +2461,6 @@ H5HF_sect_indirect_init_rows(H5HF_hdr_t *hdr, hid_t dxpl_id,
else {
/* No indirect block entries covered, reset indirect row information */
sect->u.indirect.indir_nents = 0;
- sect->u.indirect.indir_ents = NULL;
} /* end else */
/* Set up initial row information */
@@ -2598,6 +2599,13 @@ H5HF_sect_indirect_init_rows(H5HF_hdr_t *hdr, hid_t dxpl_id,
(sect->u.indirect.indir_nents + sect->u.indirect.dir_nrows));
done:
+ if(ret_value < 0) {
+ if(sect->u.indirect.indir_ents)
+ H5MM_xfree(sect->u.indirect.indir_ents);
+ if(sect->u.indirect.dir_rows)
+ H5MM_xfree(sect->u.indirect.dir_rows);
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_sect_indirect_init_rows() */
diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c
index a4cbdc1..27ab443 100644
--- a/src/H5HFtiny.c
+++ b/src/H5HFtiny.c
@@ -15,11 +15,11 @@
/*-------------------------------------------------------------------------
*
- * Created: H5HFtiny.c
- * Aug 14 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Created: H5HFtiny.c
+ * Aug 14 2006
+ * Quincey Koziol <koziol@hdfgroup.org>
*
- * Purpose: Routines for "tiny" objects in fractal heap
+ * Purpose: Routines for "tiny" objects in fractal heap
*
*-------------------------------------------------------------------------
*/
@@ -28,15 +28,15 @@
/* Module Setup */
/****************/
-#define H5HF_PACKAGE /*suppress error about including H5HFpkg */
+#define H5HF_PACKAGE /* suppress error about including H5HFpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5HFpkg.h" /* Fractal heaps */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5HFpkg.h" /* Fractal heaps */
/****************/
@@ -44,11 +44,11 @@
/****************/
/* Tiny object length information */
-#define H5HF_TINY_LEN_SHORT 16 /* Max. length able to be encoded in first heap ID byte */
-#define H5HF_TINY_MASK_SHORT 0x0F /* Mask for length in first heap ID byte */
-#define H5HF_TINY_MASK_EXT 0x0FFF /* Mask for length in two heap ID bytes */
-#define H5HF_TINY_MASK_EXT_1 0x0F00 /* Mask for length in first byte of two heap ID bytes */
-#define H5HF_TINY_MASK_EXT_2 0x00FF /* Mask for length in second byte of two heap ID bytes */
+#define H5HF_TINY_LEN_SHORT 16 /* Max. length able to be encoded in first heap ID byte */
+#define H5HF_TINY_MASK_SHORT 0x0F /* Mask for length in first heap ID byte */
+#define H5HF_TINY_MASK_EXT 0x0FFF /* Mask for length in two heap ID bytes */
+#define H5HF_TINY_MASK_EXT_1 0x0F00 /* Mask for length in first byte of two heap ID bytes */
+#define H5HF_TINY_MASK_EXT_2 0x00FF /* Mask for length in second byte of two heap ID bytes */
/******************/
@@ -84,15 +84,15 @@ static herr_t H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id,
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_init
+ * Function: H5HF_tiny_init
*
- * Purpose: Initialize information for tracking 'tiny' objects
+ * Purpose: Initialize information for tracking 'tiny' objects
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Aug 14 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 14 2006
*
*-------------------------------------------------------------------------
*/
@@ -131,15 +131,15 @@ H5HF_tiny_init(H5HF_hdr_t *hdr)
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_insert
+ * Function: H5HF_tiny_insert
*
- * Purpose: Pack a 'tiny' object in a heap ID
+ * Purpose: Pack a 'tiny' object in a heap ID
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Aug 14 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 14 2006
*
*-------------------------------------------------------------------------
*/
@@ -196,15 +196,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_get_obj_len
+ * Function: H5HF_tiny_get_obj_len
*
- * Purpose: Get the size of a 'tiny' object in a fractal heap
+ * Purpose: Get the size of a 'tiny' object in a fractal heap
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED (Can't fail)
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Aug 14 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 14 2006
*
*-------------------------------------------------------------------------
*/
@@ -226,9 +226,9 @@ H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p)
if(!hdr->tiny_len_extended)
enc_obj_size = *id & H5HF_TINY_MASK_SHORT;
else
- /* (performed in this odd way to avoid compiler bug on tg-login3 with
- * gcc 3.2.2 - QAK)
- */
+ /* (performed in this odd way to avoid compiler bug on tg-login3 with
+ * gcc 3.2.2 - QAK)
+ */
enc_obj_size = *(id + 1) | ((*id & H5HF_TINY_MASK_EXT_1) << 8);
/* Set the object's length */
@@ -239,15 +239,15 @@ H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p)
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_op_real
+ * Function: H5HF_tiny_op_real
*
- * Purpose: Internal routine to perform operation on 'tiny' object
+ * Purpose: Internal routine to perform operation on 'tiny' object
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Sep 11 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2006
*
*-------------------------------------------------------------------------
*/
@@ -266,31 +266,23 @@ H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op,
HDassert(hdr);
HDassert(id);
HDassert(op);
-
- /* Check if 'tiny' object ID is in extended form */
- if(!hdr->tiny_len_extended) {
- /* Retrieve the object's encoded length */
- enc_obj_size = *id & H5HF_TINY_MASK_SHORT;
-
- /* Advance past flag byte(s) */
+
+ /* Get the object's encoded length */
+ /* H5HF_tiny_obj_len can't fail */
+ ret_value = H5HF_tiny_get_obj_len(hdr, id, &enc_obj_size);
+
+ /* Advance past flag byte(s) */
+ if(!hdr->tiny_len_extended)
id++;
- } /* end if */
else {
- /* Retrieve the object's encoded length */
- /* (performed in this odd way to avoid compiler bug on tg-login3 with
- * gcc 3.2.2 - QAK)
- */
- enc_obj_size = *(id + 1) | ((*id & H5HF_TINY_MASK_EXT_1) << 8);
-
- /* Advance past flag byte(s) */
- /* (performed in two steps to avoid compiler bug on tg-login3 with
- * gcc 3.2.2 - QAK)
- */
+ /* (performed in two steps to avoid compiler bug on tg-login3 with
+ * gcc 3.2.2 - QAK)
+ */
id++; id++;
- } /* end else */
+ }
/* Call the user's 'op' callback */
- if(op(id, (enc_obj_size + 1), op_data) < 0)
+ if(op(id, enc_obj_size, op_data) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "application's callback failed")
done:
@@ -299,15 +291,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_read
+ * Function: H5HF_tiny_read
*
- * Purpose: Read a 'tiny' object from the heap
+ * Purpose: Read a 'tiny' object from the heap
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Aug 8 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 8 2006
*
*-------------------------------------------------------------------------
*/
@@ -335,15 +327,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_op
+ * Function: H5HF_tiny_op
*
- * Purpose: Operate directly on a 'tiny' object
+ * Purpose: Operate directly on a 'tiny' object
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Sept 11 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sept 11 2006
*
*-------------------------------------------------------------------------
*/
@@ -372,15 +364,15 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5HF_tiny_remove
+ * Function: H5HF_tiny_remove
*
- * Purpose: Remove a 'tiny' object from the heap statistics
+ * Purpose: Remove a 'tiny' object from the heap statistics
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Aug 14 2006
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 14 2006
*
*-------------------------------------------------------------------------
*/
@@ -398,17 +390,12 @@ H5HF_tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id)
HDassert(hdr);
HDassert(id);
- /* Check if 'tiny' object ID is in extended form */
- if(!hdr->tiny_len_extended)
- enc_obj_size = *id & H5HF_TINY_MASK_SHORT;
- else
- /* (performed in this odd way to avoid compiler bug on tg-login3 with
- * gcc 3.2.2 - QAK)
- */
- enc_obj_size = *(id + 1) | ((*id & H5HF_TINY_MASK_EXT_1) << 8);
+ /* Get the object's encoded length */
+ /* H5HF_tiny_obj_len can't fail */
+ ret_value = H5HF_tiny_get_obj_len(hdr, id, &enc_obj_size);
/* Update statistics about heap */
- hdr->tiny_size -= (enc_obj_size + 1);
+ hdr->tiny_size -= enc_obj_size;
hdr->tiny_nobjs--;
/* Mark heap header as modified */
@@ -418,4 +405,3 @@ H5HF_tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_tiny_remove() */
-
diff --git a/src/H5HG.c b/src/H5HG.c
index 0a97e47..7a90475 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -136,7 +136,7 @@ H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size)
{
H5HG_heap_t *heap = NULL;
uint8_t *p = NULL;
- haddr_t addr;
+ haddr_t addr = HADDR_UNDEF;
size_t n;
haddr_t ret_value = HADDR_UNDEF; /* Return value */
diff --git a/src/H5MF.c b/src/H5MF.c
index 5b4505f..4b0668f 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -245,6 +245,7 @@ H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type)
*/
HDassert(f);
HDassert(f->shared);
+ HDassert(type != H5FD_MEM_NOLIST);
HDassert(H5F_addr_defined(f->shared->fs_addr[type]));
HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED);
@@ -292,6 +293,7 @@ H5MF_alloc_create(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type)
*/
HDassert(f);
HDassert(f->shared);
+ HDassert(type != H5FD_MEM_NOLIST);
HDassert(!H5F_addr_defined(f->shared->fs_addr[type]));
HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED);
@@ -342,6 +344,7 @@ H5MF_alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type)
*/
HDassert(f);
HDassert(f->shared);
+ HDassert(type != H5FD_MEM_NOLIST);
/* Check if the free space manager exists already */
if(H5F_addr_defined(f->shared->fs_addr[type])) {
@@ -384,6 +387,7 @@ H5MF_alloc_close(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type)
*/
HDassert(f);
HDassert(f->shared);
+ HDassert(type != H5FD_MEM_NOLIST);
HDassert(f->shared->fs_man[type]);
HDassert(f->shared->fs_state[type] != H5F_FS_STATE_CLOSED);
@@ -483,6 +487,7 @@ HDfprintf(stderr, "%s: Check 1.6, freeing node\n", FUNC);
udata.dxpl_id = dxpl_id;
udata.alloc_type = alloc_type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Check 1.7, re-adding node, node->sect_info.size = %Hu\n", FUNC, node->sect_info.size);
@@ -688,6 +693,7 @@ HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, a
udata.dxpl_id = dxpl_id;
udata.alloc_type = alloc_type;
udata.allow_sect_absorb = TRUE;
+ udata.allow_eoa_shrink_only = FALSE;
/* If size of section freed is larger than threshold, add it to the free space manager */
if(size >= f->shared->fs_threshold) {
@@ -819,6 +825,11 @@ H5MF_sects_dump(f, dxpl_id, stderr);
* Programmer: Quincey Koziol
* Monday, October 6, 2003
*
+ * Modifications:
+ * Vailin Choi; July 2012
+ * As the default free-list mapping is changed to H5FD_FLMAP_DICHOTOMY,
+ * checks are added to account for the last section of each free-space manager
+ * and the remaining space in the two aggregators are at EOF.
*-------------------------------------------------------------------------
*/
herr_t
@@ -832,6 +843,8 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si
hsize_t tot_fs_size = 0; /* Amount of all free space managed */
hsize_t tot_meta_size = 0; /* Amount of metadata for free space managers */
H5FD_mem_t type; /* Memory type for iteration */
+ H5FD_mem_t fs_started[H5FD_MEM_NTYPES]; /* Indicate whether the free-space manager has been started */
+ hbool_t eoa_shrank; /* Whether an EOA shrink occurs */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -855,14 +868,15 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si
/* Iterate over all the free space types that have managers and get each free list's space */
for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
- hbool_t fs_started = FALSE;
+
+ fs_started[type] = FALSE;
/* Check if the free space for the file has been initialized */
if(!f->shared->fs_man[type] && H5F_addr_defined(f->shared->fs_addr[type])) {
if(H5MF_alloc_open(f, dxpl_id, type) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space")
HDassert(f->shared->fs_man[type]);
- fs_started = TRUE;
+ fs_started[type] = TRUE;
} /* end if */
/* Check if there's free space of this type */
@@ -880,32 +894,54 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si
tot_fs_size += type_fs_size;
tot_meta_size += type_meta_size;
} /* end if */
+ } /* end for */
- /* Close the free space manager, if we opened it here */
- if(fs_started)
+ /* Iterate until no more EOA shrink occurs */
+ do {
+ eoa_shrank = FALSE;
+
+ /* Check the last section of each free-space manager */
+ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
+ haddr_t sect_addr = HADDR_UNDEF;
+ hsize_t sect_size = 0;
+
+ if(f->shared->fs_man[type]) {
+ if(H5FS_sect_query_last_sect(f->shared->fs_man[type], &sect_addr, &sect_size) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query last section on merge list")
+
+ /* Deduct space from previous accumulation if the section is at EOA */
+ if(H5F_addr_eq(sect_addr + sect_size, eoa)) {
+ eoa = sect_addr;
+ eoa_shrank = TRUE;
+ tot_fs_size -= sect_size;
+ } /* end if */
+ } /* end if */
+ } /* end for */
+
+ /* Check the metadata and raw data aggregators */
+ if(ma_size > 0 && H5F_addr_eq(ma_addr + ma_size, eoa)) {
+ eoa = ma_addr;
+ eoa_shrank = TRUE;
+ ma_size = 0;
+ } /* end if */
+ if(sda_size > 0 && H5F_addr_eq(sda_addr + sda_size, eoa)) {
+ eoa = sda_addr;
+ eoa_shrank = TRUE;
+ sda_size = 0;
+ } /* end if */
+ } while(eoa_shrank);
+
+ /* Close the free-space managers if they were opened earlier in this routine */
+ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
+ if(fs_started[type])
if(H5MF_alloc_close(f, dxpl_id, type) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't close file free space")
} /* end for */
- /* Check for aggregating metadata allocations */
- if(ma_size > 0) {
- /* Add in the reserved space for metadata to the available free space */
- /* (if it's not at the tail of the file) */
- if(H5F_addr_ne(ma_addr + ma_size, eoa))
- tot_fs_size += ma_size;
- } /* end if */
-
- /* Check for aggregating small data allocations */
- if(sda_size > 0) {
- /* Add in the reserved space for metadata to the available free space */
- /* (if it's not at the tail of the file) */
- if(H5F_addr_ne(sda_addr + sda_size, eoa))
- tot_fs_size += sda_size;
- } /* end if */
-
/* Set the value(s) to return */
+ /* (The metadata & small data aggregators count as free space now, since they aren't at EOA) */
if(tot_space)
- *tot_space = tot_fs_size;
+ *tot_space = tot_fs_size + ma_size + sda_size;
if(meta_size)
*meta_size = tot_meta_size;
@@ -957,6 +993,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN
udata.dxpl_id = dxpl_id;
udata.alloc_type = alloc_type;
udata.allow_sect_absorb = FALSE; /* Force section to be absorbed into aggregator */
+ udata.allow_eoa_shrink_only = FALSE;
/* Call the "can shrink" callback for the section */
if((ret_value = H5MF_sect_simple_can_shrink((const H5FS_section_info_t *)node, &udata)) < 0)
@@ -980,6 +1017,66 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
/*-------------------------------------------------------------------------
+ * Function: H5MF_close_shrink_eoa
+ *
+ * Purpose: Shrink the EOA while closing
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, July 7, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5MF_close_shrink_eoa(H5F_t *f, hid_t dxpl_id)
+{
+ H5FD_mem_t type; /* Memory type for iteration */
+ hbool_t eoa_shrank; /* Whether an EOA shrink occurs */
+ htri_t status; /* Status value */
+ H5MF_sect_ud_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* check args */
+ HDassert(f);
+ HDassert(f->shared);
+
+ /* Construct user data for callbacks */
+ udata.f = f;
+ udata.dxpl_id = dxpl_id;
+ udata.allow_sect_absorb = FALSE;
+ udata.allow_eoa_shrink_only = TRUE;
+
+ /* Iterate until no more EOA shrinking occurs */
+ do {
+ eoa_shrank = FALSE;
+
+ /* Check the last section of each free-space manager */
+ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
+ if(f->shared->fs_man[type]) {
+ udata.alloc_type = type;
+ if((status = H5FS_sect_try_shrink_eoa(f, dxpl_id, f->shared->fs_man[type], &udata)) < 0)
+ HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
+ else if(status > 0)
+ eoa_shrank = TRUE;
+ } /* end if */
+ } /* end for */
+
+ /* check the two aggregators */
+ if((status = H5MF_aggrs_try_shrink_eoa(f, dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
+ else if(status > 0)
+ eoa_shrank = TRUE;
+ } while(eoa_shrank);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5MF_close_shrink_eoa() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5MF_close
*
* Purpose: Close the free space tracker(s) for a file
@@ -989,6 +1086,12 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
* Programmer: Quincey Koziol
* Tuesday, January 22, 2008
*
+ * Modifications:
+ * Vailin Choi; July 2012
+ * As the default free-list mapping is changed to H5FD_FLMAP_DICHOTOMY,
+ * modifications are needed to shrink EOA if the last section of each free-space manager
+ * and the remaining space in the two aggregators are at EOA.
+
*-------------------------------------------------------------------------
*/
herr_t
@@ -1013,6 +1116,10 @@ HDfprintf(stderr, "%s: Entering\n", FUNC);
if(H5MF_free_aggrs(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't free aggregators")
+ /* Trying shrinking the EOA for the file */
+ if(H5MF_close_shrink_eoa(f, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa")
+
/* Making free-space managers persistent for superblock version >= 2 */
if(f->shared->sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2
&& f->shared->fs_strategy == H5F_FILE_SPACE_ALL_PERSIST) {
@@ -1160,6 +1267,11 @@ HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC);
if(H5MF_free_aggrs(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't free aggregators")
+ /* Trying shrinking the EOA for the file */
+ /* (in case any free space is now at the EOA) */
+ if(H5MF_close_shrink_eoa(f, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa")
+
done:
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: Leaving\n", FUNC);
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index 6f68fd7..f015b19 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -57,6 +57,8 @@
/********************/
/* Local Prototypes */
/********************/
+static herr_t H5MF_aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
+ H5F_blk_aggr_t *aggr);
/*********************/
@@ -231,15 +233,14 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
if(H5F_addr_gt((eoa + size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
+ /* Release "other" aggregator, if it exists, is at the end of the allocated space,
+ * has allocated more than one block and the unallocated space is greater than its
+ * allocation block size.
+ */
if ((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) &&
- ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
-
- if(H5FD_free(f->shared->lf, dxpl_id, other_alloc_type, f, other_aggr->addr, other_aggr->size) < 0)
+ (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
+ if(H5MF_aggr_free(f, dxpl_id, other_alloc_type, other_aggr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block")
-
- other_aggr->addr = 0;
- other_aggr->tot_size = 0;
- other_aggr->size = 0;
} /* end if */
/* Allocate space from the VFD (i.e. at the end of the file) */
@@ -275,14 +276,14 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
if(H5F_addr_gt((eoa + aggr->alloc_size), f->shared->tmp_addr))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
+ /* Release "other" aggregator, if it exists, is at the end of the allocated space,
+ * has allocated more than one block and the unallocated space is greater than its
+ * allocation block size.
+ */
if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) &&
- ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
-
- if(H5FD_free(f->shared->lf, dxpl_id, other_alloc_type, f, other_aggr->addr, other_aggr->size) < 0)
+ (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
+ if(H5MF_aggr_free(f, dxpl_id, other_alloc_type, other_aggr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block")
- other_aggr->addr = 0;
- other_aggr->tot_size = 0;
- other_aggr->size = 0;
} /* end if */
/* Allocate space from the VFD (i.e. at the end of the file) */
@@ -633,8 +634,10 @@ H5MF_aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr,
/* Check if this aggregator is active */
if(f->shared->feature_flags & aggr->feature_flag) {
- *addr = aggr->addr;
- *size = aggr->size;
+ if(addr)
+ *addr = aggr->addr;
+ if(size)
+ *size = aggr->size;
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -766,3 +769,131 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_free_aggrs() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5MF_aggr_can_shrink_eoa
+ *
+ * Purpose: Check if the remaining space in the aggregator is at EOA
+ *
+ * Return: Success: non-negative (TRUE/FALSE)
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi
+ *
+ *-------------------------------------------------------------------------
+ */
+static htri_t
+H5MF_aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr)
+{
+ haddr_t eoa = HADDR_UNDEF; /* EOA for the file */
+ htri_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(aggr);
+ HDassert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA);
+
+ /* Get the EOA for the file */
+ if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa")
+
+ /* Check if the aggregator is at EOA */
+ if(aggr->size > 0 && H5F_addr_defined(aggr->addr))
+ ret_value = H5F_addr_eq(eoa, aggr->addr + aggr->size);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5MF_aggr_can_shrink_eoa() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5MF_aggr_free
+ *
+ * Purpose: Free the aggregator's space in the file.
+ *
+ * Note: Does _not_ put the space on a free list
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Vailin Choi
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5MF_aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, H5F_blk_aggr_t *aggr)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(f->shared->lf);
+ HDassert(aggr);
+ HDassert(H5F_addr_defined(aggr->addr));
+ HDassert(aggr->size > 0);
+ HDassert(H5F_INTENT(f) & H5F_ACC_RDWR);
+ HDassert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA);
+ HDassert(f->shared->feature_flags & aggr->feature_flag);
+
+ /* Free the remaining space at EOA in the aggregator */
+ if(H5FD_free(f->shared->lf, dxpl_id, type, f, aggr->addr, aggr->size) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free aggregation block")
+
+ /* Reset the aggregator */
+ aggr->tot_size = 0;
+ aggr->addr = HADDR_UNDEF;
+ aggr->size = 0;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5MF_aggr_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5MF_aggrs_try_shrink_eoa
+ *
+ * Purpose: Check the metadata & small block aggregators to see if
+ * EOA shrink is possible; if so, shrink each aggregator
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Vailin Choi
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5MF_aggrs_try_shrink_eoa(H5F_t *f, hid_t dxpl_id)
+{
+ htri_t ma_status; /* Whether the metadata aggregator can shrink the EOA */
+ htri_t sda_status; /* Whether the small data aggregator can shrink the EOA */
+ htri_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check args */
+ HDassert(f);
+ HDassert(f->shared);
+
+ if((ma_status = H5MF_aggr_can_shrink_eoa(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr))) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats")
+ if(ma_status > 0)
+ if(H5MF_aggr_free(f, dxpl_id, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
+
+ if((sda_status = H5MF_aggr_can_shrink_eoa(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr))) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats")
+ if(sda_status > 0)
+ if(H5MF_aggr_free(f, dxpl_id, H5FD_MEM_DRAW, &(f->shared->sdata_aggr)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa")
+
+ ret_value = (ma_status || sda_status);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5MF_aggrs_try_shrink_eoa() */
+
diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h
index 25785ae..2071a0a 100644
--- a/src/H5MFpkg.h
+++ b/src/H5MFpkg.h
@@ -122,6 +122,7 @@ typedef struct H5MF_sect_ud_t {
hid_t dxpl_id; /* DXPL for VFD operations */
H5FD_mem_t alloc_type; /* Type of memory being allocated */
hbool_t allow_sect_absorb; /* Whether sections are allowed to absorb a block aggregator */
+ hbool_t allow_eoa_shrink_only; /* Whether shrinking eoa is allowed only for the section */
/* Up */
H5MF_shrink_type_t shrink; /* Type of shrink operation to perform */
diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h
index b471aa3..ad5e385 100644
--- a/src/H5MFprivate.h
+++ b/src/H5MFprivate.h
@@ -81,6 +81,7 @@ H5_DLL haddr_t H5MF_alloc_tmp(H5F_t *f, hsize_t size);
/* 'block aggregator' routines */
H5_DLL herr_t H5MF_free_aggrs(H5F_t *f, hid_t dxpl_id);
+H5_DLL htri_t H5MF_aggrs_try_shrink_eoa(H5F_t *f, hid_t dxpl_id);
/* Debugging routines */
#ifdef H5MF_DEBUGGING
diff --git a/src/H5MFsection.c b/src/H5MFsection.c
index 89b2219..0572def 100644
--- a/src/H5MFsection.c
+++ b/src/H5MFsection.c
@@ -328,6 +328,10 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect-
HGOTO_DONE(TRUE)
} /* end if */
else {
+ /* Shrinking can't occur if the 'eoa_shrink_only' flag is set and we're not shrinking the EOA */
+ if(udata->allow_eoa_shrink_only)
+ HGOTO_DONE(FALSE)
+
/* Check if this section is allowed to merge with metadata aggregation block */
if(udata->f->shared->fs_aggr_merge[udata->alloc_type] & H5F_FS_MERGE_METADATA) {
htri_t status; /* Status from aggregator adjoin */
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 98d8d95..149199f 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -1106,11 +1106,15 @@ H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
FUNC_ENTER_NOAPI_NOINIT
+ /* Sanity check */
HDassert(oloc_src);
HDassert(oloc_src->file);
HDassert(H5F_addr_defined(oloc_src->addr));
HDassert(oloc_dst->file);
+ /* Intialize copy info before errors can be thrown */
+ HDmemset(&cpy_info, 0, sizeof(H5O_copy_t));
+
/* Get the copy property list */
if(NULL == (ocpy_plist = (H5P_genplist_t *)H5I_object(ocpypl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
@@ -1128,7 +1132,6 @@ H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info")
/* Convert copy flags into copy struct */
- HDmemset(&cpy_info, 0, sizeof(H5O_copy_t));
if((cpy_option & H5O_COPY_SHALLOW_HIERARCHY_FLAG) > 0) {
cpy_info.copy_shallow = TRUE;
cpy_info.max_depth = 1;
@@ -1602,6 +1605,10 @@ done:
* Programmer: Neil Fortner
* Nov 3 2011
*
+ * Modifications:
+ * Vailin Choi; August 2012
+ * Use H5O_obj_class to get object type instead of
+ * H5O_get_info(...TRUE....) saving time in traversing metadata.
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1611,8 +1618,8 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc,
H5O_copy_search_comm_dt_key_t *key = NULL; /* Skiplist key */
haddr_t *addr = NULL; /* Destination address */
hbool_t obj_inserted = FALSE; /* Object inserted into skip list */
- H5O_info_t oinfo; /* Object info */
H5A_attr_iter_op_t attr_op; /* Attribute iteration operator */
+ const H5O_obj_class_t *obj_class = NULL; /* Type of object */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1623,13 +1630,13 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc,
HDassert(udata->dst_dt_list);
HDassert(udata->dst_root_loc);
- /* Get the object's info */
- if(H5O_get_info(obj_oloc, udata->dxpl_id, TRUE, &oinfo) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info")
+ /* Get pointer to object class for this object */
+ if((obj_class = H5O_obj_class(obj_oloc, udata->dxpl_id)) == NULL)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
/* Check if the object is a datatype, a dataset using a committed
* datatype, or contains an attribute using a committed datatype */
- if(oinfo.type == H5O_TYPE_NAMED_DATATYPE) {
+ if(obj_class->type == H5O_TYPE_NAMED_DATATYPE) {
/* Allocate key */
if(NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
@@ -1654,7 +1661,7 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc,
obj_inserted = TRUE;
} /* end if */
} /* end if */
- else if(oinfo.type == H5O_TYPE_DATASET) {
+ else if(obj_class->type == H5O_TYPE_DATASET) {
/* Allocate key */
if(NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
diff --git a/src/H5Otest.c b/src/H5Otest.c
index 705f716..d1627ef 100644
--- a/src/H5Otest.c
+++ b/src/H5Otest.c
@@ -516,7 +516,7 @@ H5O_expunge_chunks_test(const H5O_loc_t *loc, hid_t dxpl_id)
/* Safety check */
nchunks = oh->nchunks;
- HDassert(nchunks < NELMTS(chk_addr));
+ HDassert(0 < nchunks && nchunks < NELMTS(chk_addr));
/* Iterate over all the chunks, saving the chunk addresses */
for(u = 0; u < oh->nchunks; u++)
diff --git a/src/H5P.c b/src/H5P.c
index abbfe4b..ba286fb 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -118,7 +118,7 @@ H5P_init_pub_interface(void)
hid_t
H5Pcopy(hid_t id)
{
- void *obj; /* Property object to copy */
+ void *obj; /* Property object to copy */
hid_t ret_value=FALSE; /* return value */
FUNC_ENTER_API(FAIL)
@@ -224,7 +224,7 @@ H5Pcreate_class(hid_t parent, const char *name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't retrieve parent class")
/* Create the new property list class */
- if(NULL == (pclass = H5P_create_class(par_class, name, FALSE, cls_create, create_data, cls_copy, copy_data, cls_close, close_data)))
+ if(NULL == (pclass = H5P_create_class(par_class, name, H5P_TYPE_USER, cls_create, create_data, cls_copy, copy_data, cls_close, close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list class")
/* Get an atom for the class */
@@ -1147,6 +1147,7 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data)
{
H5P_iter_ud_t udata; /* User data for internal iterator callback */
int fake_idx = 0; /* Index when user doesn't provide one */
+ void *obj; /* Property object to copy */
int ret_value; /* return value */
FUNC_ENTER_API(FAIL)
@@ -1155,6 +1156,8 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data)
/* Check arguments. */
if(H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property object");
+ if(NULL == (obj = H5I_object(id)))
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist");
if(iter_func == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration callback");
@@ -1165,13 +1168,13 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data)
if(H5I_GENPROP_LST == H5I_get_type(id)) {
/* Iterate over a property list */
- if((ret_value = H5P_iterate_plist(id, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
+ if((ret_value = H5P_iterate_plist((H5P_genplist_t *)obj, TRUE, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list");
} /* end if */
else
if(H5I_GENPROP_CLS == H5I_get_type(id)) {
/* Iterate over a property class */
- if((ret_value = H5P_iterate_pclass(id, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
+ if((ret_value = H5P_iterate_pclass((H5P_genclass_t *)obj, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over class");
} /* end if */
else
diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c
index be61bfc..206c1d3 100644
--- a/src/H5Pacpl.c
+++ b/src/H5Pacpl.c
@@ -70,6 +70,7 @@ static herr_t H5P_acrt_reg_prop(H5P_genclass_t *pclass);
/* Attribute creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_ACRT[1] = {{
"attribute create", /* Class name for debugging */
+ H5P_TYPE_ATTRIBUTE_CREATE, /* Class type */
&H5P_CLS_STRING_CREATE_g, /* Parent class ID */
&H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class ID */
&H5P_LST_ATTRIBUTE_CREATE_g, /* Pointer to default property list ID */
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index 9e75eaa..d21cdbf 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -82,15 +82,16 @@ static herr_t H5P__dacc_reg_prop(H5P_genclass_t *pclass);
/* Dataset access property list class library initialization object */
const H5P_libclass_t H5P_CLS_DACC[1] = {{
"dataset access", /* Class name for debugging */
+ H5P_TYPE_DATASET_ACCESS, /* Class type */
&H5P_CLS_LINK_ACCESS_g, /* Parent class ID */
&H5P_CLS_DATASET_ACCESS_g, /* Pointer to class ID */
&H5P_LST_DATASET_ACCESS_g, /* Pointer to default property list ID */
H5P__dacc_reg_prop, /* Default property registration routine */
- NULL, /* Class creation callback */
+ NULL, /* Class creation callback */
NULL, /* Class creation callback info */
- NULL, /* Class copy callback */
+ NULL, /* Class copy callback */
NULL, /* Class copy callback info */
- NULL, /* Class close callback */
+ NULL, /* Class close callback */
NULL /* Class close callback info */
}};
@@ -271,3 +272,4 @@ H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots, size_t *rdcc_nbytes, doub
done:
FUNC_LEAVE_API(ret_value)
}
+
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index a9b8079..ba5fa9e 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -128,6 +128,7 @@ static int H5P__dcrt_ext_file_list_cmp(const void *value1, const void *value2, s
/* Dataset creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_DCRT[1] = {{
"dataset create", /* Class name for debugging */
+ H5P_TYPE_DATASET_CREATE, /* Class type */
&H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */
&H5P_CLS_DATASET_CREATE_g, /* Pointer to class ID */
&H5P_LST_DATASET_CREATE_g, /* Pointer to default property list ID */
@@ -1526,7 +1527,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/,
+H5P_get_fill_value(H5P_genplist_t *plist, H5T_t *type, void *value/*out*/,
hid_t dxpl_id)
{
H5O_fill_t fill; /* Fill value to retrieve */
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index a4fc749..3eeb7d5 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -47,50 +47,46 @@
/* ======== Data transfer properties ======== */
/* Definitions for maximum temp buffer size property */
-#define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(size_t)
-#define H5D_XFER_MAX_TEMP_BUF_DEF H5D_TEMP_BUF_SIZE
+#define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(size_t)
+#define H5D_XFER_MAX_TEMP_BUF_DEF H5D_TEMP_BUF_SIZE
/* Definitions for type conversion buffer property */
-#define H5D_XFER_TCONV_BUF_SIZE sizeof(void *)
-#define H5D_XFER_TCONV_BUF_DEF NULL
+#define H5D_XFER_TCONV_BUF_SIZE sizeof(void *)
+#define H5D_XFER_TCONV_BUF_DEF NULL
/* Definitions for background buffer property */
-#define H5D_XFER_BKGR_BUF_SIZE sizeof(void *)
-#define H5D_XFER_BKGR_BUF_DEF NULL
+#define H5D_XFER_BKGR_BUF_SIZE sizeof(void *)
+#define H5D_XFER_BKGR_BUF_DEF NULL
/* Definitions for background buffer type property */
-#define H5D_XFER_BKGR_BUF_TYPE_SIZE sizeof(H5T_bkg_t)
+#define H5D_XFER_BKGR_BUF_TYPE_SIZE sizeof(H5T_bkg_t)
#define H5D_XFER_BKGR_BUF_TYPE_DEF H5T_BKG_NO
/* Definitions for B-tree node splitting ratio property */
/* (These default B-tree node splitting ratios are also used for splitting
* group's B-trees as well as chunked dataset's B-trees - QAK)
*/
-#define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3])
-#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1, 0.5, 0.9}
+#define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3])
+#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1, 0.5, 0.9}
/* Definitions for vlen allocation function property */
-#define H5D_XFER_VLEN_ALLOC_SIZE sizeof(H5MM_allocate_t)
-#define H5D_XFER_VLEN_ALLOC_DEF H5D_VLEN_ALLOC
+#define H5D_XFER_VLEN_ALLOC_SIZE sizeof(H5MM_allocate_t)
+#define H5D_XFER_VLEN_ALLOC_DEF H5D_VLEN_ALLOC
/* Definitions for vlen allocation info property */
-#define H5D_XFER_VLEN_ALLOC_INFO_SIZE sizeof(void *)
-#define H5D_XFER_VLEN_ALLOC_INFO_DEF H5D_VLEN_ALLOC_INFO
+#define H5D_XFER_VLEN_ALLOC_INFO_SIZE sizeof(void *)
+#define H5D_XFER_VLEN_ALLOC_INFO_DEF H5D_VLEN_ALLOC_INFO
/* Definitions for vlen free function property */
-#define H5D_XFER_VLEN_FREE_SIZE sizeof(H5MM_free_t)
-#define H5D_XFER_VLEN_FREE_DEF H5D_VLEN_FREE
+#define H5D_XFER_VLEN_FREE_SIZE sizeof(H5MM_free_t)
+#define H5D_XFER_VLEN_FREE_DEF H5D_VLEN_FREE
/* Definitions for vlen free info property */
-#define H5D_XFER_VLEN_FREE_INFO_SIZE sizeof(void *)
-#define H5D_XFER_VLEN_FREE_INFO_DEF H5D_VLEN_FREE_INFO
-/* Definitions for file driver ID property */
-#define H5D_XFER_VFL_ID_SIZE sizeof(hid_t)
-#define H5D_XFER_VFL_ID_DEF H5FD_VFD_DEFAULT
-/* Definitions for file driver info property */
-#define H5D_XFER_VFL_INFO_SIZE sizeof(void *)
-#define H5D_XFER_VFL_INFO_DEF NULL
+#define H5D_XFER_VLEN_FREE_INFO_SIZE sizeof(void *)
+#define H5D_XFER_VLEN_FREE_INFO_DEF H5D_VLEN_FREE_INFO
/* Definitions for hyperslab vector size property */
/* (Be cautious about increasing the default size, there are arrays allocated
* on the stack which depend on it - QAK)
*/
-#define H5D_XFER_HYPER_VECTOR_SIZE_SIZE sizeof(size_t)
-#define H5D_XFER_HYPER_VECTOR_SIZE_DEF H5D_IO_VECTOR_SIZE
+#define H5D_XFER_HYPER_VECTOR_SIZE_SIZE sizeof(size_t)
+#define H5D_XFER_HYPER_VECTOR_SIZE_DEF H5D_IO_VECTOR_SIZE
+
+#ifdef H5_HAVE_PARALLEL
/* Definitions for I/O transfer mode property */
-#define H5D_XFER_IO_XFER_MODE_SIZE sizeof(H5FD_mpio_xfer_t)
-#define H5D_XFER_IO_XFER_MODE_DEF H5FD_MPIO_INDEPENDENT
+#define H5D_XFER_IO_XFER_MODE_SIZE sizeof(H5FD_mpio_xfer_t)
+#define H5D_XFER_IO_XFER_MODE_DEF H5FD_MPIO_INDEPENDENT
/* Definitions for optimization of MPI-IO transfer mode property */
#define H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE sizeof(H5FD_mpio_collective_opt_t)
#define H5D_XFER_MPIO_COLLECTIVE_OPT_DEF H5FD_MPIO_COLLECTIVE_IO
@@ -106,6 +102,14 @@
/* Definitions for chunk io mode property. */
#define H5D_MPIO_ACTUAL_IO_MODE_SIZE sizeof(H5D_mpio_actual_io_mode_t)
#define H5D_MPIO_ACTUAL_IO_MODE_DEF H5D_MPIO_NO_COLLECTIVE
+/* Definitions for memory MPI type property */
+#define H5FD_MPI_XFER_MEM_MPI_TYPE_SIZE sizeof(MPI_Datatype)
+#define H5FD_MPI_XFER_MEM_MPI_TYPE_DEF MPI_DATATYPE_NULL
+/* Definitions for file MPI type property */
+#define H5FD_MPI_XFER_FILE_MPI_TYPE_SIZE sizeof(MPI_Datatype)
+#define H5FD_MPI_XFER_FILE_MPI_TYPE_DEF MPI_DATATYPE_NULL
+#endif /* H5_HAVE_PARALLEL */
+
/* Definitions for EDC property */
#define H5D_XFER_EDC_SIZE sizeof(H5Z_EDC_t)
#define H5D_XFER_EDC_DEF H5Z_ENABLE_EDC
@@ -118,15 +122,9 @@
/* Definitions for data transform property */
#define H5D_XFER_XFORM_SIZE sizeof(void *)
#define H5D_XFER_XFORM_DEF NULL
-#define H5D_XFER_XFORM_DEL H5P_dxfr_xform_del
-#define H5D_XFER_XFORM_COPY H5P_dxfr_xform_copy
-#define H5D_XFER_XFORM_CLOSE H5P_dxfr_xform_close
-/* Definitions for memory MPI type property */
-#define H5FD_MPI_XFER_MEM_MPI_TYPE_SIZE sizeof(MPI_Datatype)
-#define H5FD_MPI_XFER_MEM_MPI_TYPE_DEF MPI_DATATYPE_NULL
-/* Definitions for file MPI type property */
-#define H5FD_MPI_XFER_FILE_MPI_TYPE_SIZE sizeof(MPI_Datatype)
-#define H5FD_MPI_XFER_FILE_MPI_TYPE_DEF MPI_DATATYPE_NULL
+#define H5D_XFER_XFORM_DEL H5P__dxfr_xform_del
+#define H5D_XFER_XFORM_COPY H5P__dxfr_xform_copy
+#define H5D_XFER_XFORM_CLOSE H5P__dxfr_xform_close
/******************/
/* Local Typedefs */
@@ -143,15 +141,12 @@
/********************/
/* Property class callbacks */
-static herr_t H5P_dxfr_reg_prop(H5P_genclass_t *pclass);
-static herr_t H5P_dxfr_create(hid_t dxpl_id, void *create_data);
-static herr_t H5P_dxfr_copy(hid_t dst_dxpl_id, hid_t src_dxpl_id, void *copy_data);
-static herr_t H5P_dxfr_close(hid_t dxpl_id, void *close_data);
+static herr_t H5P__dxfr_reg_prop(H5P_genclass_t *pclass);
/* Property list callbacks */
-static herr_t H5P_dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value);
-static herr_t H5P_dxfr_xform_copy(const char* name, size_t size, void* value);
-static herr_t H5P_dxfr_xform_close(const char* name, size_t size, void* value);
+static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value);
+static herr_t H5P__dxfr_xform_copy(const char* name, size_t size, void* value);
+static herr_t H5P__dxfr_xform_close(const char* name, size_t size, void* value);
/*********************/
@@ -161,15 +156,16 @@ static herr_t H5P_dxfr_xform_close(const char* name, size_t size, void* value);
/* Data transfer property list class library initialization object */
const H5P_libclass_t H5P_CLS_DXFR[1] = {{
"data transfer", /* Class name for debugging */
+ H5P_TYPE_DATASET_XFER, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_DATASET_XFER_g, /* Pointer to class ID */
&H5P_LST_DATASET_XFER_g, /* Pointer to default property list ID */
- H5P_dxfr_reg_prop, /* Default property registration routine */
- H5P_dxfr_create, /* Class creation callback */
+ H5P__dxfr_reg_prop, /* Default property registration routine */
+ NULL, /* Class creation callback */
NULL, /* Class creation callback info */
- H5P_dxfr_copy, /* Class copy callback */
+ NULL, /* Class copy callback */
NULL, /* Class copy callback info */
- H5P_dxfr_close, /* Class close callback */
+ NULL, /* Class close callback */
NULL /* Class close callback info */
}};
@@ -181,7 +177,7 @@ const H5P_libclass_t H5P_CLS_DXFR[1] = {{
/*-------------------------------------------------------------------------
- * Function: H5P_dxfr_reg_prop
+ * Function: H5P__dxfr_reg_prop
*
* Purpose: Register the data transfer property list class's properties
*
@@ -192,7 +188,7 @@ const H5P_libclass_t H5P_CLS_DXFR[1] = {{
*-------------------------------------------------------------------------
*/
static herr_t
-H5P_dxfr_reg_prop(H5P_genclass_t *pclass)
+H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
{
size_t def_max_temp_buf = H5D_XFER_MAX_TEMP_BUF_DEF; /* Default value for maximum temp buffer size */
void *def_tconv_buf = H5D_XFER_TCONV_BUF_DEF; /* Default value for type conversion buffer */
@@ -203,8 +199,6 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass)
void *def_vlen_alloc_info = H5D_XFER_VLEN_ALLOC_INFO_DEF; /* Default value for vlen allocation information */
H5MM_free_t def_vlen_free = H5D_XFER_VLEN_FREE_DEF; /* Default value for vlen free function */
void *def_vlen_free_info = H5D_XFER_VLEN_FREE_INFO_DEF; /* Default value for vlen free information */
- hid_t def_vfl_id = H5D_XFER_VFL_ID_DEF; /* Default value for file driver ID */
- void *def_vfl_info = H5D_XFER_VFL_INFO_DEF; /* Default value for file driver info */
size_t def_hyp_vec_size = H5D_XFER_HYPER_VECTOR_SIZE_DEF; /* Default value for vector size */
haddr_t metadata_tag = H5AC_METADATA_TAG_DEF; /* Default value for metadata tag */
#ifdef H5_HAVE_PARALLEL
@@ -224,7 +218,7 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass)
void *def_xfer_xform = H5D_XFER_XFORM_DEF; /* Default value for data transform */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Register the max. temp buffer size property */
if(H5P_register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &def_max_temp_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
@@ -266,14 +260,6 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass)
if(H5P_register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &def_vlen_free_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the file driver ID property */
- if(H5P_register_real(pclass, H5D_XFER_VFL_ID_NAME, H5D_XFER_VFL_ID_SIZE, &def_vfl_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
- /* Register the file driver info property */
- if(H5P_register_real(pclass, H5D_XFER_VFL_INFO_NAME, H5D_XFER_VFL_INFO_SIZE, &def_vfl_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
-
/* Register the vector size property */
if(H5P_register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &def_hyp_vec_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -295,7 +281,7 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass)
if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &def_mpio_actual_chunk_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the actual io mode property. */
+ /* Register the actual I/O mode property. */
if(H5P_register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &def_mpio_actual_io_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -329,157 +315,9 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_reg_prop() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5P_dxfr_create
- *
- * Purpose: Callback routine which is called whenever any dataset transfer
- * property list is created. This routine performs any generic
- * initialization needed on the properties the library put into
- * the list.
- * Right now, it's just allocating the driver-specific dataset
- * transfer information.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Thursday, August 2, 2001
- *
- *-------------------------------------------------------------------------
- */
-/* ARGSUSED */
-static herr_t
-H5P_dxfr_create(hid_t dxpl_id, void UNUSED *create_data)
-{
- hid_t driver_id; /* VFL driver ID */
- void *driver_info; /* VFL driver info */
- H5P_genplist_t *plist; /* Property list */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check arguments */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
-
- /* Get the driver information */
- if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID")
- if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver info")
-
- /* Check if we have a valid driver ID */
- if(driver_id > 0) {
- /* Set the driver for the property list */
- if(H5FD_dxpl_open(plist, driver_id, driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_create() */
+} /* end H5P__dxfr_reg_prop() */
-/*-------------------------------------------------------------------------
- * Function: H5P_dxfr_copy
- *
- * Purpose: Callback routine which is called whenever any dataset
- * transfer property list is copied. This routine copies
- * the properties from the old list to the new list.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Raymond Lu
- * Tuesday, October 2, 2001
- *
- *-------------------------------------------------------------------------
- */
-/* ARGSUSED */
-static herr_t
-H5P_dxfr_copy(hid_t dst_dxpl_id, hid_t src_dxpl_id, void UNUSED *copy_data)
-{
- hid_t driver_id;
- void* driver_info;
- H5P_genplist_t *dst_plist; /* Destination property list */
- H5P_genplist_t *src_plist; /* Source property list */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
- if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
-
- /* Get values from old property list */
- if(H5P_get(src_plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID")
- if(H5P_get(src_plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver info")
-
- if(driver_id > 0) {
- /* Set the driver for the property list */
- if(H5FD_dxpl_open(dst_plist, driver_id, driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5P_dxfr_close
- *
- * Purpose: Callback routine which is called whenever any dataset transfer
- * property list is closed. This routine performs any generic
- * cleanup needed on the properties the library put into the list.
- * Right now, it's just freeing the driver-specific dataset
- * transfer information.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Wednesday, July 11, 2001
- *
- *-------------------------------------------------------------------------
- */
-/* ARGSUSED */
-static herr_t
-H5P_dxfr_close(hid_t dxpl_id, void UNUSED *close_data)
-{
- hid_t driver_id; /* VFL driver ID */
- void *driver_info; /* VFL driver info */
- H5P_genplist_t *plist; /* Property list */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check arguments */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
-
- if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID")
- if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info")
- if(driver_id > 0) {
- /* Close the driver for the property list */
- if(H5FD_dxpl_close(driver_id, driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset driver")
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_close() */
/*-------------------------------------------------------------------------
@@ -497,11 +335,11 @@ done:
*/
/* ARGSUSED */
static herr_t
-H5P_dxfr_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED size, void *value)
+H5P__dxfr_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED size, void *value)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(value);
@@ -510,11 +348,11 @@ H5P_dxfr_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_xform_del() */
+} /* end H5P__dxfr_xform_del() */
/*-------------------------------------------------------------------------
- * Function: H5P_dxfr_xform_copy
+ * Function: H5P__dxfr_xform_copy
*
* Purpose: Creates a copy of the user's data transform string and its
* associated parse tree.
@@ -529,11 +367,11 @@ done:
*/
/* ARGSUSED */
static herr_t
-H5P_dxfr_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value)
+H5P__dxfr_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(value);
@@ -542,11 +380,11 @@ H5P_dxfr_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_xform_copy() */
+} /* end H5P__dxfr_xform_copy() */
/*-------------------------------------------------------------------------
- * Function: H5P_dxfr_xform_close
+ * Function: H5P__dxfr_xform_close
*
* Purpose: Frees memory allocated by H5P_dxfr_xform_set
*
@@ -560,11 +398,11 @@ done:
*/
/* ARGSUSED */
static herr_t
-H5P_dxfr_xform_close(const char UNUSED *name, size_t UNUSED size, void *value)
+H5P__dxfr_xform_close(const char UNUSED *name, size_t UNUSED size, void *value)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(value);
@@ -573,18 +411,15 @@ H5P_dxfr_xform_close(const char UNUSED *name, size_t UNUSED size, void *value)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P_dxfr_xform_close() */
+} /* end H5P__dxfr_xform_close() */
/*-------------------------------------------------------------------------
* Function: H5Pset_data_transform
*
- * Purpose:
- * Sets data transform expression.
- *
- *
- * Return: Returns a non-negative value if successful; otherwise returns a negative value.
+ * Purpose: Sets data transform expression.
*
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Leon Arber
* Monday, March 07, 2004
@@ -606,7 +441,7 @@ H5Pset_data_transform(hid_t plist_id, const char *expression)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "expression cannot be NULL")
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* See if a data transform is already set, and free it if it is */
@@ -623,9 +458,8 @@ H5Pset_data_transform(hid_t plist_id, const char *expression)
done:
if(ret_value < 0) {
- if(data_xform_prop)
- if(H5Z_xform_destroy(data_xform_prop) < 0)
- HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
+ if(data_xform_prop && H5Z_xform_destroy(data_xform_prop) < 0)
+ HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
} /* end if */
FUNC_LEAVE_API(ret_value)
@@ -635,10 +469,9 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Pget_data_transform
*
- * Purpose:
- * Gets data transform expression.
+ * Purpose: Gets data transform expression.
*
- * Return: Returns a non-negative value if successful; otherwise returns a negative value.
+ * Return: Non-negative on success/Negative on failure
*
* Comments:
* If `expression' is non-NULL then write up to `size' bytes into that
@@ -678,9 +511,7 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "data transform has not been set")
/* Get the data transform string */
- pexp = H5Z_xform_extract_xform_str(data_xform_prop);
-
- if(!pexp)
+ if(NULL == (pexp = H5Z_xform_extract_xform_str(data_xform_prop)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "failed to retrieve transform expression")
len = HDstrlen(pexp);
@@ -694,9 +525,8 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size)
done:
if(ret_value < 0) {
- if(data_xform_prop)
- if(H5Z_xform_destroy(data_xform_prop) < 0)
- HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
+ if(data_xform_prop && H5Z_xform_destroy(data_xform_prop) < 0)
+ HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
} /* end if */
FUNC_LEAVE_API(ret_value)
@@ -722,21 +552,19 @@ done:
* Programmer: Robb Matzke
* Monday, March 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iz*x*x", plist_id, size, tconv, bkg);
/* Check arguments */
- if (size<=0)
+ if(size == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero")
/* Get the plist structure */
@@ -744,16 +572,16 @@ H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
- if(H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
+ if(H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size")
- if(H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv)<0)
+ if(H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer")
- if(H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg)<0)
+ if(H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_buffer() */
/*-------------------------------------------------------------------------
@@ -768,8 +596,6 @@ done:
* Programmer: Robb Matzke
* Monday, March 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
size_t
@@ -783,27 +609,27 @@ H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/)
H5TRACE3("z", "ixx", plist_id, tconv, bkg);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 0, "can't find object for ID")
/* Return values */
- if (tconv)
- if(H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv)<0)
+ if(tconv)
+ if(H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer")
- if (bkg)
- if(H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg)<0)
+ if(bkg)
+ if(H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer")
/* Get the size */
- if(H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
+ if(H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size")
/* Set the return value */
- ret_value=size;
+ ret_value = size;
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_buffer() */
/*-------------------------------------------------------------------------
@@ -820,32 +646,30 @@ done:
* Programmer: Robb Matzke
* Tuesday, March 17, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_preserve(hid_t plist_id, hbool_t status)
{
- H5T_bkg_t need_bkg; /* Value for background buffer type */
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ H5T_bkg_t need_bkg; /* Value for background buffer type */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", plist_id, status);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
need_bkg = status ? H5T_BKG_YES : H5T_BKG_NO;
- if (H5P_set(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0)
+ if(H5P_set(plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_preserve() */
/*-------------------------------------------------------------------------
@@ -860,8 +684,6 @@ done:
* Programmer: Robb Matzke
* Tuesday, March 17, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -875,19 +697,19 @@ H5Pget_preserve(hid_t plist_id)
H5TRACE1("Is", "i", plist_id);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get value */
- if (H5P_get(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0)
+ if(H5P_get(plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
/* Set return value */
- ret_value= need_bkg ? TRUE : FALSE;
+ ret_value = need_bkg ? TRUE : FALSE;
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_preserve() */
/*-------------------------------------------------------------------------
@@ -903,21 +725,19 @@ done:
* Programmer: Raymond Lu
* Jan 3, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iZe", plist_id, check);
/* Check argument */
- if (check != H5Z_ENABLE_EDC && check != H5Z_DISABLE_EDC)
+ if(check != H5Z_ENABLE_EDC && check != H5Z_DISABLE_EDC)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid value")
/* Get the plist structure */
@@ -925,12 +745,12 @@ H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
- if (H5P_set(plist,H5D_XFER_EDC_NAME,&check)<0)
+ if(H5P_set(plist, H5D_XFER_EDC_NAME, &check) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_edc_check() */
/*-------------------------------------------------------------------------
@@ -946,15 +766,13 @@ done:
* Programmer: Raymond Lu
* Jan 3, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5Z_EDC_t
H5Pget_edc_check(hid_t plist_id)
{
H5P_genplist_t *plist; /* Property list pointer */
- H5Z_EDC_t ret_value; /* return value */
+ H5Z_EDC_t ret_value; /* Return value */
FUNC_ENTER_API(H5Z_ERROR_EDC)
H5TRACE1("Ze", "i", plist_id);
@@ -964,16 +782,12 @@ H5Pget_edc_check(hid_t plist_id)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_ERROR_EDC, "can't find object for ID")
/* Update property list */
- if (H5P_get(plist,H5D_XFER_EDC_NAME,&ret_value)<0)
+ if(H5P_get(plist, H5D_XFER_EDC_NAME, &ret_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5Z_ERROR_EDC, "unable to set value")
- /* check valid value */
- if (ret_value != H5Z_ENABLE_EDC && ret_value != H5Z_DISABLE_EDC)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_ERROR_EDC, "not a valid value")
-
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_edc_check() */
/*-------------------------------------------------------------------------
@@ -1116,40 +930,38 @@ done:
* Programmer: Robb Matzke
* Monday, September 28, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_btree_ratios(hid_t plist_id, double *left/*out*/, double *middle/*out*/,
- double *right/*out*/)
+ double *right/*out*/)
{
+ H5P_genplist_t *plist; /* Property list pointer */
double btree_split_ratio[3]; /* B-tree node split ratios */
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "ixxx", plist_id, left, middle, right);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get the split ratios */
- if (H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&btree_split_ratio)<0)
+ if(H5P_get(plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &btree_split_ratio) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
/* Get values */
- if (left)
+ if(left)
*left = btree_split_ratio[0];
- if (middle)
+ if(middle)
*middle = btree_split_ratio[1];
- if (right)
+ if(right)
*right = btree_split_ratio[2];
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_btree_ratios() */
/*-------------------------------------------------------------------------
@@ -1170,28 +982,26 @@ done:
* Programmer: Robb Matzke
* Monday, September 28, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_btree_ratios(hid_t plist_id, double left, double middle,
- double right)
+ double right)
{
- double split_ratio[3]; /* B-tree node split ratios */
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ double split_ratio[3]; /* B-tree node split ratios */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iddd", plist_id, left, middle, right);
/* Check arguments */
- if (left<0.0 || left>1.0 || middle<0.0 || middle>1.0 ||
- right<0.0 || right>1.0)
+ if(left < 0.0 || left > 1.0 || middle < 0.0 || middle > 1.0 ||
+ right < 0.0 || right > 1.0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0")
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set values */
@@ -1200,12 +1010,12 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle,
split_ratio[2] = right;
/* Set the split ratios */
- if (H5P_set(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&split_ratio)<0)
+ if(H5P_set(plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &split_ratio) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_btree_ratios() */
/*-------------------------------------------------------------------------
@@ -1225,28 +1035,26 @@ done:
* Programmer: Quincey Koziol
* Thursday, July 1, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func,
- void *alloc_info, H5MM_free_t free_func, void *free_info)
+ void *alloc_info, H5MM_free_t free_func, void *free_info)
{
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- assert(plist);
+ HDassert(plist);
/* Update property list */
- if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0)
+ if(H5P_set(plist, H5D_XFER_VLEN_ALLOC_NAME, &alloc_func) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0)
+ if(H5P_set(plist, H5D_XFER_VLEN_ALLOC_INFO_NAME, &alloc_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- if (H5P_set(plist,H5D_XFER_VLEN_FREE_NAME,&free_func)<0)
+ if(H5P_set(plist, H5D_XFER_VLEN_FREE_NAME, &free_func) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
- if (H5P_set(plist,H5D_XFER_VLEN_FREE_INFO_NAME,&free_info)<0)
+ if(H5P_set(plist, H5D_XFER_VLEN_FREE_INFO_NAME, &free_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
@@ -1271,27 +1079,25 @@ done:
* Programmer: Quincey Koziol
* Thursday, July 1, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func,
- void *alloc_info, H5MM_free_t free_func, void *free_info)
+ void *alloc_info, H5MM_free_t free_func, void *free_info)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ix*xx*x", plist_id, alloc_func, alloc_info, free_func,
free_info);
/* Check arguments */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/* Update property list */
- if (H5P_set_vlen_mem_manager(plist,alloc_func,alloc_info,free_func,free_info)<0)
+ if(H5P_set_vlen_mem_manager(plist, alloc_func, alloc_info, free_func, free_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set values")
done:
@@ -1309,42 +1115,38 @@ done:
* Programmer: Quincey Koziol
* Thursday, July 1, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func/*out*/,
- void **alloc_info/*out*/,
- H5MM_free_t *free_func/*out*/,
- void **free_info/*out*/)
+ void **alloc_info/*out*/, H5MM_free_t *free_func/*out*/, void **free_info/*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ixxxx", plist_id, alloc_func, alloc_info, free_func, free_info);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- if(alloc_func!=NULL)
- if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,alloc_func)<0)
+ if(alloc_func)
+ if(H5P_get(plist, H5D_XFER_VLEN_ALLOC_NAME, alloc_func) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
- if(alloc_info!=NULL)
- if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,alloc_info)<0)
+ if(alloc_info)
+ if(H5P_get(plist, H5D_XFER_VLEN_ALLOC_INFO_NAME, alloc_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
- if(free_func!=NULL)
- if (H5P_get(plist,H5D_XFER_VLEN_FREE_NAME,free_func)<0)
+ if(free_func)
+ if(H5P_get(plist, H5D_XFER_VLEN_FREE_NAME, free_func) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
- if(free_info!=NULL)
- if (H5P_get(plist,H5D_XFER_VLEN_FREE_INFO_NAME,free_info)<0)
+ if(free_info)
+ if(H5P_get(plist, H5D_XFER_VLEN_FREE_INFO_NAME, free_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_vlen_mem_manager() */
/*-------------------------------------------------------------------------
@@ -1366,29 +1168,27 @@ done:
* Programmer: Quincey Koziol
* Monday, July 9, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_hyper_vector_size(hid_t plist_id, size_t vector_size)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "iz", plist_id, vector_size);
/* Check arguments */
- if (vector_size<1)
+ if(vector_size < 1)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "vector size too small")
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
- if (H5P_set(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0)
+ if(H5P_set(plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &vector_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
@@ -1406,34 +1206,32 @@ done:
* Programmer: Quincey Koziol
* Monday, July 9, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_hyper_vector_size(hid_t plist_id, size_t *vector_size/*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", plist_id, vector_size);
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Return values */
- if (vector_size)
- if (H5P_get(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,vector_size)<0)
+ if(vector_size)
+ if(H5P_get(plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, vector_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_hyper_vector_size() */
-
#ifdef H5_HAVE_PARALLEL
+
/*-------------------------------------------------------------------------
* Function: H5Pget_mpio_actual_chunk_opt_mode
*
@@ -1443,6 +1241,7 @@ done:
*
* Programmer: Jacob Gruber
* Wednesday, May 4, 2011
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1478,6 +1277,7 @@ done:
*
* Programmer: Jacob Gruber
* Wednesday, May 4, 2011
+ *
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 1479cd5..26b6862 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -178,6 +178,7 @@ static herr_t H5P_file_image_info_close(const char *name, size_t size, void *val
/* File access property list class library initialization object */
const H5P_libclass_t H5P_CLS_FACC[1] = {{
"file access", /* Class name for debugging */
+ H5P_TYPE_FILE_ACCESS, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_FILE_ACCESS_g, /* Pointer to class ID */
&H5P_LST_FILE_ACCESS_g, /* Pointer to default property list ID */
@@ -609,47 +610,40 @@ done:
* Programmer: Robb Matzke
* Tuesday, June 9, 1998
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_alignment(hid_t fapl_id, hsize_t *threshold/*out*/,
- hsize_t *alignment/*out*/)
+ hsize_t *alignment/*out*/)
{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixx", fapl_id, threshold, alignment);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get values */
- if (threshold)
+ if(threshold)
if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, threshold) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get threshold");
- if (alignment)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get threshold")
+ if(alignment)
if(H5P_get(plist, H5F_ACS_ALIGN_NAME, alignment) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_alignment() */
/*-------------------------------------------------------------------------
* Function: H5P_set_driver
*
- * Purpose: Set the file driver (DRIVER_ID) for a file access or data
- * transfer property list (PLIST_ID) and supply an optional
+ * Purpose: Set the file driver (DRIVER_ID) for a file access
+ * property list (PLIST_ID) and supply an optional
* struct containing the driver-specific properites
* (DRIVER_INFO). The driver properties will be copied into the
* property list and the reference count on the driver will be
@@ -657,19 +651,11 @@ done:
* still use the property list.
*
* Return: Success: Non-negative
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Tuesday, August 3, 1999
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -677,7 +663,7 @@ H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_drive
{
hid_t driver_id; /* VFL driver ID */
void *driver_info; /* VFL driver info */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -692,29 +678,15 @@ H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_drive
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL,"can't get driver info")
/* Close the driver for the property list */
- if(H5FD_fapl_close(driver_id, driver_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset driver")
-
- /* Set the driver for the property list */
- if(H5FD_fapl_open(plist, new_driver_id, new_driver_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
- } else if(TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER)) {
- /* Get the current driver information */
- if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID")
- if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver info")
-
- /* Close the driver for the property list */
- if(H5FD_dxpl_close(driver_id, driver_info) < 0)
+ if(H5FD_fapl_close(driver_id, driver_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset driver")
/* Set the driver for the property list */
- if(H5FD_dxpl_open(plist, new_driver_id, new_driver_info) < 0)
+ if(H5FD_fapl_open(plist, new_driver_id, new_driver_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver")
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list")
- }
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -724,8 +696,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Pset_driver
*
- * Purpose: Set the file driver (DRIVER_ID) for a file access or data
- * transfer property list (PLIST_ID) and supply an optional
+ * Purpose: Set the file driver (DRIVER_ID) for a file access
+ * property list (PLIST_ID) and supply an optional
* struct containing the driver-specific properites
* (DRIVER_INFO). The driver properties will be copied into the
* property list and the reference count on the driver will be
@@ -733,19 +705,11 @@ done:
* still use the property list.
*
* Return: Success: Non-negative
- *
* Failure: Negative
*
* Programmer: Robb Matzke
* Tuesday, August 3, 1999
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -776,7 +740,7 @@ done:
* Function: H5P_get_driver
*
* Purpose: Return the ID of the low-level file driver. PLIST_ID should
- * be a file access property list or data transfer propert list.
+ * be a file access property list.
*
* Return: Success: A low-level driver ID which is the same ID
* used when the driver was set for the property
@@ -788,54 +752,36 @@ done:
* Programmer: Robb Matzke
* Thursday, February 26, 1998
*
- * Modifications:
- * Robb Matzke, 1999-08-03
- * Rewritten to use the virtual file layer.
- *
- * Robb Matzke, 1999-08-05
- * If the driver ID is H5FD_VFD_DEFAULT then substitute the
- * current value of H5FD_SEC2.
- *
- * Quincey Koziol 2000-11-28
- * Added internal function..
- *
- * Raymond Lu, 2001-10-23
- * Changed the file access list design to the new generic
- * property list.
- *
*-------------------------------------------------------------------------
*/
hid_t
H5P_get_driver(H5P_genplist_t *plist)
{
- hid_t ret_value=FAIL; /* Return value */
+ hid_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Get the current driver ID */
- if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &ret_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID");
- } else if( TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER) ) {
- if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &ret_value)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list");
- }
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
- if (H5FD_VFD_DEFAULT==ret_value)
+ if(H5FD_VFD_DEFAULT == ret_value)
ret_value = H5_DEFAULT_VFD;
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5P_get_driver() */
/*-------------------------------------------------------------------------
* Function: H5Pget_driver
*
* Purpose: Return the ID of the low-level file driver. PLIST_ID should
- * be a file access property list or data transfer propert list.
+ * be a file access property list.
*
* Return: Success: A low-level driver ID which is the same ID
* used when the driver was set for the property
@@ -847,16 +793,6 @@ done:
* Programmer: Robb Matzke
* Thursday, February 26, 1998
*
- * Modifications:
- * Robb Matzke, 1999-08-03
- * Rewritten to use the virtual file layer.
- *
- * Robb Matzke, 1999-08-05
- * If the driver ID is H5FD_VFD_DEFAULT then substitute the current value of
- * H5FD_SEC2.
- *
- * Quincey Koziol 2000-11-28
- * Added internal function..
*-------------------------------------------------------------------------
*/
hid_t
@@ -871,7 +807,9 @@ H5Pget_driver(hid_t plist_id)
if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
- ret_value = H5P_get_driver(plist);
+ /* Get the driver */
+ if((ret_value = H5P_get_driver(plist)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver")
done:
FUNC_LEAVE_API(ret_value)
@@ -882,7 +820,7 @@ done:
* Function: H5P_get_driver_info
*
* Purpose: Returns a pointer directly to the file driver-specific
- * information of a file access or data transfer property list.
+ * information of a file access.
*
* Return: Success: Ptr to *uncopied* driver specific data
* structure if any.
@@ -895,32 +833,22 @@ done:
* Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
*-------------------------------------------------------------------------
*/
void *
H5P_get_driver_info(H5P_genplist_t *plist)
{
- void *ret_value=NULL;
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
/* Get the current driver info */
- if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &ret_value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,NULL,"can't get driver info");
- } else if( TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER) ) {
- if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &ret_value)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, NULL, "Can't retrieve VFL driver ID");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access or data transfer property list");
- }
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -931,7 +859,7 @@ done:
* Function: H5Pget_driver_info
*
* Purpose: Returns a pointer directly to the file driver-specific
- * information of a file access or data transfer property list.
+ * information of a file access.
*
* Return: Success: Ptr to *uncopied* driver specific data
* structure if any.
@@ -944,26 +872,20 @@ done:
* Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
*-------------------------------------------------------------------------
*/
void *
H5Pget_driver_info(hid_t plist_id)
{
H5P_genplist_t *plist; /* Property list pointer */
- void *ret_value; /* Return value */
+ void *ret_value; /* Return value */
FUNC_ENTER_API(NULL)
if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list")
+ /* Get the driver info */
if(NULL == (ret_value = H5P_get_driver_info(plist)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info")
@@ -980,37 +902,35 @@ done:
* to retrieve VFD file handle.
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_family_offset(hid_t fapl_id, hsize_t offset)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ih", fapl_id, offset);
/* Get the plist structure */
if(H5P_DEFAULT == fapl_id)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list");
- if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- /* Set values */
- if((ret_value=H5P_set_family_offset(plist, offset)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set family offset");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list")
+ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Set value */
+ if((ret_value = H5P_set_family_offset(plist, offset)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set family offset")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_family_offset() */
/*-------------------------------------------------------------------------
@@ -1020,33 +940,30 @@ done:
* H5Pset_family_offset
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5P_set_family_offset(H5P_genplist_t *plist, hsize_t offset)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
if(H5P_set(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't set offset for family file");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list");
- }
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set offset for family file")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5P_set_family_offset() */
/*-------------------------------------------------------------------------
@@ -1057,37 +974,35 @@ done:
* to retrieve VFD file handle.
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_family_offset(hid_t fapl_id, hsize_t *offset)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", fapl_id, offset);
/* Get the plist structure */
if(H5P_DEFAULT == fapl_id)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list");
- if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- /* Set values */
- if((ret_value=H5P_get_family_offset(plist, offset)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get family offset");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list")
+ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get value */
+ if((ret_value = H5P_get_family_offset(plist, offset)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get family offset")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_family_offset() */
/*-------------------------------------------------------------------------
@@ -1097,33 +1012,30 @@ done:
* H5Pget_family_offset
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5P_get_family_offset(H5P_genplist_t *plist, hsize_t *offset)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
if(H5P_get(plist, H5F_ACS_FAMILY_OFFSET_NAME, offset) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't set offset for family file");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list");
- }
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set offset for family file")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5P_get_family_offset() */
/*-------------------------------------------------------------------------
@@ -1134,14 +1046,11 @@ done:
* to retrieve VFD file handle.
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1155,16 +1064,17 @@ H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type)
/* Get the plist structure */
if(H5P_DEFAULT == fapl_id)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list");
- if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- /* Set values */
- if((ret_value=H5P_set_multi_type(plist, type)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data type for multi driver");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list")
+ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Set value */
+ if((ret_value = H5P_set_multi_type(plist, type)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data type for multi driver")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_multi_type() */
/*-------------------------------------------------------------------------
@@ -1174,33 +1084,30 @@ done:
* H5Pset_multi_type.
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5P_set_multi_type(H5P_genplist_t *plist, H5FD_mem_t type)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
if(H5P_set(plist, H5F_ACS_MULTI_TYPE_NAME, &type) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't set type for multi driver");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list");
- }
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set type for multi driver")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5P_set_multi_type() */
/*-------------------------------------------------------------------------
@@ -1211,37 +1118,35 @@ done:
* to retrieve VFD file handle.
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*Mt", fapl_id, type);
/* Get the plist structure */
if(H5P_DEFAULT == fapl_id)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list");
- if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- /* Set values */
- if((ret_value=H5P_get_multi_type(plist, type)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get data type for multi driver");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list")
+ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get value */
+ if((ret_value = H5P_get_multi_type(plist, type)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get data type for multi driver")
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_multi_type() */
/*-------------------------------------------------------------------------
@@ -1251,33 +1156,30 @@ done:
* H5Pget_multi_type.
*
* Return: Success: Non-negative value.
- *
* Failure: Negative value.
*
* Programmer: Raymond Lu
* Sep 17, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5P_get_multi_type(H5P_genplist_t *plist, H5FD_mem_t *type)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
if(H5P_get(plist, H5F_ACS_MULTI_TYPE_NAME, type) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't get type for multi driver");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
- }
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get type for multi driver")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5P_get_multi_type() */
/*-------------------------------------------------------------------------
@@ -2724,12 +2626,13 @@ done:
herr_t
H5P_file_image_info_copy(const char UNUSED *name, size_t UNUSED size, void *value)
{
- H5FD_file_image_info_t *info; /* Image info struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
if(value) {
+ H5FD_file_image_info_t *info; /* Image info struct */
+
info = (H5FD_file_image_info_t *)value;
/* verify file image field consistancy */
@@ -2763,16 +2666,17 @@ H5P_file_image_info_copy(const char UNUSED *name, size_t UNUSED size, void *valu
else
HDmemcpy(info->buffer, old_buffer, info->size);
} /* end if */
- } /* end if */
- /* Copy udata if it exists */
- if(info->callbacks.udata) {
- void *old_udata = info->callbacks.udata;
+ /* Copy udata if it exists */
+ if(info->callbacks.udata) {
+ void *old_udata = info->callbacks.udata;
- if(NULL == info->callbacks.udata_copy)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_copy not defined")
+ if(NULL == info->callbacks.udata_copy)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_copy not defined")
+
+ info->callbacks.udata = info->callbacks.udata_copy(old_udata);
+ } /* end if */
- info->callbacks.udata = info->callbacks.udata_copy(old_udata);
} /* end if */
done:
@@ -2797,32 +2701,33 @@ done:
herr_t
H5P_file_image_info_close(const char UNUSED *name, size_t UNUSED size, void *value)
{
- H5FD_file_image_info_t info; /* Image info struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
if(value) {
- info = *(H5FD_file_image_info_t *)value;
+ H5FD_file_image_info_t *info; /* Image info struct */
+
+ info = (H5FD_file_image_info_t *)value;
- if(info.buffer != NULL && info.size > 0) {
+ if(info->buffer != NULL && info->size > 0) {
/* Free buffer */
- if(info.callbacks.image_free) {
- if(info.callbacks.image_free(info.buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE,
- info.callbacks.udata) < 0)
+ if(info->callbacks.image_free) {
+ if(info->callbacks.image_free(info->buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE,
+ info->callbacks.udata) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "image_free callback failed")
} /* end if */
else
- H5MM_xfree(info.buffer);
+ H5MM_xfree(info->buffer);
} /* end if */
- } /* end if */
- /* Free udata if it exists */
- if(info.callbacks.udata) {
- if(NULL == info.callbacks.udata_free)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_free not defined")
- if(info.callbacks.udata_free(info.callbacks.udata) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed")
+ /* Free udata if it exists */
+ if(info->callbacks.udata) {
+ if(NULL == info->callbacks.udata_free)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_free not defined")
+ if(info->callbacks.udata_free(info->callbacks.udata) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed")
+ } /* end if */
} /* end if */
done:
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index 2e8cf1e..7351beb 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -106,6 +106,7 @@ static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass);
/* File creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_FCRT[1] = {{
"file create", /* Class name for debugging */
+ H5P_TYPE_FILE_CREATE, /* Class type */
&H5P_CLS_GROUP_CREATE_g, /* Parent class ID */
&H5P_CLS_FILE_CREATE_g, /* Pointer to class ID */
&H5P_LST_FILE_CREATE_g, /* Pointer to default property list ID */
diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c
index 7828fb2..0158bf1 100644
--- a/src/H5Pfmpl.c
+++ b/src/H5Pfmpl.c
@@ -74,6 +74,7 @@ static herr_t H5P_fmnt_reg_prop(H5P_genclass_t *pclass);
/* File mount property list class library initialization object */
const H5P_libclass_t H5P_CLS_FMNT[1] = {{
"file mount", /* Class name for debugging */
+ H5P_TYPE_FILE_MOUNT, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_FILE_MOUNT_g, /* Pointer to class ID */
&H5P_LST_FILE_MOUNT_g, /* Pointer to default property list ID */
diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c
index 4947029..90e8d8c 100644
--- a/src/H5Pgcpl.c
+++ b/src/H5Pgcpl.c
@@ -68,6 +68,7 @@ static herr_t H5P_gcrt_reg_prop(H5P_genclass_t *pclass);
/* Group creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_GCRT[1] = {{
"group create", /* Class name for debugging */
+ H5P_TYPE_GROUP_CREATE, /* Class type */
&H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */
&H5P_CLS_GROUP_CREATE_g, /* Pointer to class ID */
&H5P_LST_GROUP_CREATE_g, /* Pointer to default property list ID */
diff --git a/src/H5Pint.c b/src/H5Pint.c
index d17903f..63862ef 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -132,6 +132,7 @@ hid_t H5P_LST_LINK_ACCESS_g = FAIL;
/* Root property list class library initialization object */
const H5P_libclass_t H5P_CLS_ROOT[1] = {{
"root", /* Class name for debugging */
+ H5P_TYPE_ROOT, /* Class type */
NULL, /* Parent class ID */
&H5P_CLS_ROOT_g, /* Pointer to class ID */
NULL, /* Pointer to default property list ID */
@@ -148,6 +149,7 @@ const H5P_libclass_t H5P_CLS_ROOT[1] = {{
/* (move to proper source code file when used for real) */
const H5P_libclass_t H5P_CLS_GACC[1] = {{
"group access", /* Class name for debugging */
+ H5P_TYPE_GROUP_ACCESS, /* Class type */
&H5P_CLS_LINK_ACCESS_g, /* Parent class ID */
&H5P_CLS_GROUP_ACCESS_g, /* Pointer to class ID */
&H5P_LST_GROUP_ACCESS_g, /* Pointer to default property list ID */
@@ -164,6 +166,7 @@ const H5P_libclass_t H5P_CLS_GACC[1] = {{
/* (move to proper source code file when used for real) */
const H5P_libclass_t H5P_CLS_TCRT[1] = {{
"datatype create", /* Class name for debugging */
+ H5P_TYPE_DATATYPE_CREATE, /* Class type */
&H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */
&H5P_CLS_DATATYPE_CREATE_g, /* Pointer to class ID */
&H5P_LST_DATATYPE_CREATE_g, /* Pointer to default property list ID */
@@ -180,6 +183,7 @@ const H5P_libclass_t H5P_CLS_TCRT[1] = {{
/* (move to proper source code file when used for real) */
const H5P_libclass_t H5P_CLS_TACC[1] = {{
"datatype access", /* Class name for debugging */
+ H5P_TYPE_DATATYPE_ACCESS, /* Class type */
&H5P_CLS_LINK_ACCESS_g, /* Parent class ID */
&H5P_CLS_DATATYPE_ACCESS_g, /* Pointer to class ID */
&H5P_LST_DATATYPE_ACCESS_g, /* Pointer to default property list ID */
@@ -436,7 +440,7 @@ H5P_init_interface(void)
} /* end if */
/* Allocate the new class */
- if(NULL == (new_pclass = H5P_create_class(par_pclass, lib_class->name, 1, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data)))
+ if(NULL == (new_pclass = H5P_create_class(par_pclass, lib_class->name, lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed")
/* Call routine to register properties for class */
@@ -602,11 +606,11 @@ H5P_copy_pclass(H5P_genclass_t *pclass)
*/
/* Create the new property list class */
- if(NULL==(new_pclass=H5P_create_class(pclass->parent, pclass->name, 0, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data)))
+ if(NULL == (new_pclass = H5P_create_class(pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "unable to create property list class")
/* Copy the properties registered for this class */
- if(pclass->nprops>0) {
+ if(pclass->nprops > 0) {
H5SL_node_t *curr_node; /* Current node in skip list */
/* Walk through the properties in the old class */
@@ -1095,7 +1099,7 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5P_find_prop_plist
+ H5P__find_prop_plist
PURPOSE
Internal routine to check for a property in a property list's skip list
USAGE
@@ -1111,12 +1115,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static H5P_genprop_t *
-H5P_find_prop_plist(H5P_genplist_t *plist, const char *name)
+H5P_genprop_t *
+H5P__find_prop_plist(H5P_genplist_t *plist, const char *name)
{
H5P_genprop_t *ret_value; /* Property pointer return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
HDassert(plist);
HDassert(name);
@@ -1150,7 +1154,7 @@ H5P_find_prop_plist(H5P_genplist_t *plist, const char *name)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5P_find_prop_plist() */
+} /* H5P__find_prop_plist() */
/*--------------------------------------------------------------------------
@@ -1451,11 +1455,11 @@ H5P_open_class_path_cb(void *_obj, hid_t UNUSED id, void *_key)
PURPOSE
Internal routine to create a new property list class.
USAGE
- H5P_genclass_t H5P_create_class(par_class, name, internal,
+ H5P_genclass_t H5P_create_class(par_class, name, type,
cls_create, create_data, cls_close, close_data)
H5P_genclass_t *par_class; IN: Pointer to parent class
const char *name; IN: Name of class we are creating
- hbool_t internal; IN: Whether this is an internal class or not
+ H5P_plist_type_t type; IN: Type of class we are creating
H5P_cls_create_func_t; IN: The callback function to call when each
property list in this class is created.
void *create_data; IN: Pointer to user data to pass along to class
@@ -1479,7 +1483,7 @@ H5P_open_class_path_cb(void *_obj, hid_t UNUSED id, void *_key)
REVISION LOG
--------------------------------------------------------------------------*/
H5P_genclass_t *
-H5P_create_class(H5P_genclass_t *par_class, const char *name, hbool_t internal,
+H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type,
H5P_cls_create_func_t cls_create, void *create_data,
H5P_cls_copy_func_t cls_copy, void *copy_data,
H5P_cls_close_func_t cls_close, void *close_data)
@@ -1492,7 +1496,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, hbool_t internal,
HDassert(name);
/* Allow internal classes to break some rules */
/* (This allows the root of the tree to be created with this routine -QAK) */
- if(!internal)
+ if(type == H5P_TYPE_USER)
HDassert(par_class);
/* Allocate room for the class */
@@ -1503,11 +1507,11 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, hbool_t internal,
pclass->parent = par_class;
if(NULL == (pclass->name = H5MM_xstrdup(name)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "propery list class name allocation failed")
+ pclass->type = type;
pclass->nprops = 0; /* Classes are created without properties initially */
pclass->plists = 0; /* No properties lists of this class yet */
pclass->classes = 0; /* No classes derived from this class yet */
pclass->ref_count = 1; /* This is the first reference to the new class */
- pclass->internal = internal;
pclass->deleted = FALSE; /* Not deleted yet... :-) */
pclass->revision = H5P_GET_NEXT_REV; /* Get a revision number for the class */
@@ -2144,7 +2148,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size,
*/
if(pclass->plists > 0 || pclass->classes > 0) {
if(NULL == (new_class = H5P_create_class(pclass->parent, pclass->name,
- pclass->internal, pclass->create_func, pclass->create_data,
+ pclass->type, pclass->create_func, pclass->create_data,
pclass->copy_func, pclass->copy_data,
pclass->close_func, pclass->close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy class")
@@ -2714,11 +2718,11 @@ H5P_get_size_plist(H5P_genplist_t *plist, const char *name, size_t *size)
HDassert(size);
/* Find property */
- if((prop=H5P_find_prop_plist(plist,name)) == NULL)
+ if(NULL == (prop = H5P__find_prop_plist(plist, name)))
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist")
/* Get property size */
- *size=prop->size;
+ *size = prop->size;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3035,9 +3039,9 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2)
if(pclass1->ref_count < pclass2->ref_count) HGOTO_DONE(-1);
if(pclass1->ref_count > pclass2->ref_count) HGOTO_DONE(1);
- /* Check whether they are internal or not */
- if(pclass1->internal < pclass2->internal) HGOTO_DONE(-1);
- if(pclass1->internal > pclass2->internal) HGOTO_DONE(1);
+ /* Check the property list types */
+ if(pclass1->type < pclass2->type) HGOTO_DONE(-1);
+ if(pclass1->type > pclass2->type) HGOTO_DONE(1);
/* Check whether they are deleted or not */
if(pclass1->deleted < pclass2->deleted) HGOTO_DONE(-1);
@@ -3441,8 +3445,11 @@ H5P__iterate_plist_pclass_cb(void *_item, void *_key, void *_udata)
PURPOSE
Internal routine to iterate over the properties in a property list
USAGE
- int H5P_iterate_plist(plist_id, idx, cb_func, iter_data)
- hid_t plist_id; IN: ID of property list to iterate over
+ int H5P_iterate_plist(plist, iter_all_prop, idx, cb_func, iter_data)
+ const H5P_genplist_t *plist; IN: Property list to iterate over
+ hbool_t iter_all_prop; IN: Whether to iterate over all properties
+ (TRUE), or just non-default (i.e. changed)
+ properties (FALSE).
int *idx; IN/OUT: Index of the property to begin with
H5P_iterate_t cb_func; IN: Function pointer to function to be
called with each property iterated over.
@@ -3487,10 +3494,10 @@ iteration, the function's behavior is undefined.
REVISION LOG
--------------------------------------------------------------------------*/
int
-H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t cb_func, void *udata)
+H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx,
+ H5P_iterate_int_t cb_func, void *udata)
{
H5P_genclass_t *tclass; /* Temporary class pointer */
- H5P_genplist_t *plist; /* Property list pointer */
H5P_iter_plist_ud_t udata_int; /* User data for skip list iterator */
H5SL_t *seen = NULL; /* Skip list to hold names of properties already seen */
int curr_idx = 0; /* Current iteration index */
@@ -3498,13 +3505,11 @@ H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t cb_func, void *uda
FUNC_ENTER_NOAPI_NOINIT
+ /* Sanity check */
+ HDassert(plist);
HDassert(idx);
HDassert(cb_func);
- /* Get the property list object */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
-
/* Create the skip list to hold names of properties already seen */
if(NULL == (seen = H5SL_create(H5SL_TYPE_STR, NULL)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't create skip list for seen properties")
@@ -3523,17 +3528,20 @@ H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t cb_func, void *uda
if(ret_value != 0)
HGOTO_DONE(ret_value);
- /* Walk up the class hiearchy */
- tclass = plist->pclass;
- while(tclass != NULL) {
- /* Iterate over properties in property list class */
- ret_value = H5SL_iterate(tclass->props, H5P__iterate_plist_pclass_cb, &udata_int);
- if(ret_value != 0)
- HGOTO_DONE(ret_value);
+ /* Check for iterating over all properties, or just non-default ones */
+ if(iter_all_prop) {
+ /* Walk up the class hiearchy */
+ tclass = plist->pclass;
+ while(tclass != NULL) {
+ /* Iterate over properties in property list class */
+ ret_value = H5SL_iterate(tclass->props, H5P__iterate_plist_pclass_cb, &udata_int);
+ if(ret_value != 0)
+ HGOTO_DONE(ret_value);
- /* Go up to parent class */
- tclass = tclass->parent;
- } /* end while */
+ /* Go up to parent class */
+ tclass = tclass->parent;
+ } /* end while */
+ } /* end if */
done:
/* Set the index we stopped at */
@@ -3604,8 +3612,8 @@ done:
PURPOSE
Internal routine to iterate over the properties in a property class
USAGE
- herr_t H5P_iterate_pclass(pclass_id, idx, cb_func, iter_data)
- hid_t pclass_id; IN: ID of property class to iterate over
+ herr_t H5P_iterate_pclass(pclass, idx, cb_func, iter_data)
+ const H5P_genpclass_t *pclass; IN: Property list class to iterate over
int *idx; IN/OUT: Index of the property to begin with
H5P_iterate_t cb_func; IN: Function pointer to function to be
called with each property iterated over.
@@ -3650,22 +3658,20 @@ iteration, the function's behavior is undefined.
REVISION LOG
--------------------------------------------------------------------------*/
int
-H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_int_t cb_func, void *udata)
+H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx,
+ H5P_iterate_int_t cb_func, void *udata)
{
- H5P_genclass_t *pclass; /* Property list pointer */
H5P_iter_pclass_ud_t udata_int; /* User data for skip list iterator */
int curr_idx = 0; /* Current iteration index */
int ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
+ /* Sanity check */
+ HDassert(pclass);
HDassert(idx);
HDassert(cb_func);
- /* Get the property list object */
- if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class")
-
/* Set up iterator callback info */
udata_int.cb_func = cb_func;
udata_int.udata = udata;
@@ -4193,13 +4199,13 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist")
/* If the property exists in the destination alread */
- if(H5P_find_prop_plist(dst_plist,name)!=NULL) {
+ if(NULL != H5P__find_prop_plist(dst_plist, name)) {
/* Delete the property from the destination list, calling the 'close' callback if necessary */
if(H5P_remove(dst_id,dst_plist,name) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property")
/* Get the pointer to the source property */
- prop=H5P_find_prop_plist(src_plist,name);
+ prop = H5P__find_prop_plist(src_plist, name);
/* Make a copy of the source property */
if((new_prop=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL)
@@ -4221,7 +4227,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
/* If not, get the information required to do an H5Pinsert2 with the property into the destination list */
else {
/* Get the pointer to the source property */
- prop = H5P_find_prop_plist(src_plist, name);
+ prop = H5P__find_prop_plist(src_plist, name);
/* Create property object from parameters */
if(NULL == (new_prop = H5P_create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value,
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index 6c80493..ba5f9d7 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -53,6 +53,7 @@
#define H5L_ACS_ELINK_PREFIX_DEF NULL /*default is no prefix */
#define H5L_ACS_ELINK_PREFIX_DEL H5P_lacc_elink_pref_del
#define H5L_ACS_ELINK_PREFIX_COPY H5P_lacc_elink_pref_copy
+#define H5L_ACS_ELINK_PREFIX_CMP H5P_lacc_elink_pref_cmp
#define H5L_ACS_ELINK_PREFIX_CLOSE H5P_lacc_elink_pref_close
/* Definitions for setting fapl of external link access */
@@ -70,6 +71,7 @@
#define H5L_ACS_ELINK_CB_SIZE sizeof(H5L_elink_cb_t)
#define H5L_ACS_ELINK_CB_DEF {NULL,NULL}
+
/******************/
/* Local Typedefs */
/******************/
@@ -90,8 +92,8 @@ static herr_t H5P_lacc_reg_prop(H5P_genclass_t *pclass);
/* Property list callbacks */
static herr_t H5P_lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value);
static herr_t H5P_lacc_elink_pref_copy(const char* name, size_t size, void* value);
+static int H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t size);
static herr_t H5P_lacc_elink_pref_close(const char* name, size_t size, void* value);
-
static herr_t H5P_lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value);
static herr_t H5P_lacc_elink_fapl_copy(const char* name, size_t size, void* value);
static herr_t H5P_lacc_elink_fapl_close(const char* name, size_t size, void* value);
@@ -104,6 +106,7 @@ static herr_t H5P_lacc_elink_fapl_close(const char* name, size_t size, void* val
/* Dataset creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_LACC[1] = {{
"link access", /* Class name for debugging */
+ H5P_TYPE_LINK_ACCESS, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_LINK_ACCESS_g, /* Pointer to class ID */
&H5P_LST_LINK_ACCESS_g, /* Pointer to default property list ID */
@@ -162,7 +165,7 @@ H5P_lacc_reg_prop(H5P_genclass_t *pclass)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for external link prefix */
- if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &elink_prefix, NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, NULL, H5L_ACS_ELINK_PREFIX_CLOSE) < 0)
+ if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &elink_prefix, NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register fapl for link access */
@@ -343,6 +346,41 @@ H5P_lacc_elink_pref_copy(const char UNUSED *name, size_t UNUSED size, void *valu
/*-------------------------------------------------------------------------
+ * Function: H5P_lacc_elink_pref_cmp
+ *
+ * Purpose: Callback routine which is called whenever the elink prefix
+ * property in the dataset creation property list is
+ * compared.
+ *
+ * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise.
+ *
+ * Programmer: Mohamad Chaarawi
+ * Thursday, November 3, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t UNUSED size)
+{
+ const char *pref1 = *(const char **)value1;
+ const char *pref2 = *(const char **)value2;
+ int ret_value = 0;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ if(NULL == pref1 && NULL != pref2)
+ HGOTO_DONE(1);
+ if(NULL != pref1 && NULL == pref2)
+ HGOTO_DONE(-1);
+ if(NULL != pref1 && NULL != pref2)
+ ret_value = HDstrcmp(pref1, pref2);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5P_lacc_elink_pref_cmp() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5P_lacc_elink_pref_close
*
* Purpose: Frees memory used to store the external link prefix string
@@ -815,3 +853,4 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_elink_cb() */
+
diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c
index 0129f39..bc045be 100644
--- a/src/H5Plcpl.c
+++ b/src/H5Plcpl.c
@@ -98,6 +98,7 @@ static herr_t H5P_lcrt_reg_prop(H5P_genclass_t *pclass);
/* Link creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_LCRT[1] = {{
"link create", /* Class name for debugging */
+ H5P_TYPE_LINK_CREATE, /* Class type */
&H5P_CLS_STRING_CREATE_g, /* Parent class ID */
&H5P_CLS_LINK_CREATE_g, /* Pointer to class ID */
&H5P_LST_LINK_CREATE_g, /* Pointer to default property list ID */
@@ -149,7 +150,7 @@ H5P_lcrt_reg_prop(H5P_genclass_t *pclass)
/* Register create intermediate groups property */
if(H5P_register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &intmd_group, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
if(H5P_register_real(pclass, H5VL_LINK_TARGET, H5L_CRT_TARGET_SIZE, &target,
NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index 7a52f11..024f79b 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -87,6 +87,7 @@ static int H5P_ocrt_pipeline_cmp(const void *value1, const void *value2, size_t
/* Object creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_OCRT[1] = {{
"object create", /* Class name for debugging */
+ H5P_TYPE_OBJECT_CREATE, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_OBJECT_CREATE_g, /* Pointer to class ID */
NULL, /* Pointer to default property list ID */
@@ -137,15 +138,15 @@ H5P_ocrt_reg_prop(H5P_genclass_t *pclass)
/* Register max. compact attribute storage property */
if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &attr_max_compact, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register min. dense attribute storage property */
if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &attr_min_dense, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register object header flags property */
if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &ohdr_flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the pipeline property */
if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0)
diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c
index 23f8e4b..adea906 100644
--- a/src/H5Pocpypl.c
+++ b/src/H5Pocpypl.c
@@ -91,6 +91,7 @@ static int H5P_ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value
/* Object copy property list class library initialization object */
const H5P_libclass_t H5P_CLS_OCPY[1] = {{
"object copy", /* Class name for debugging */
+ H5P_TYPE_OBJECT_COPY, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_OBJECT_COPY_g, /* Pointer to class ID */
&H5P_LST_OBJECT_COPY_g, /* Pointer to default property list ID */
@@ -141,15 +142,15 @@ H5P_ocpy_reg_prop(H5P_genclass_t *pclass)
/* Register copy options property */
if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &ocpy_option, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register merge named dtype list property */
if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &merge_comm_dtype_list, NULL, NULL, NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_CMP, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for callback when completing the search for a matching named datatype from the named dtype list */
if(H5P_register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &mcdt_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index 65d314e..803abfd 100644
--- a/src/H5Ppkg.h
+++ b/src/H5Ppkg.h
@@ -84,23 +84,23 @@ typedef struct H5P_genprop_t {
/* Define structure to hold class information */
struct H5P_genclass_t {
struct H5P_genclass_t *parent; /* Pointer to parent class */
- char *name; /* Name of property list class */
- size_t nprops; /* Number of properties in class */
+ char *name; /* Name of property list class */
+ H5P_plist_type_t type; /* Type of property */
+ size_t nprops; /* Number of properties in class */
unsigned plists; /* Number of property lists that have been created since the last modification to the class */
unsigned classes; /* Number of classes that have been derived since the last modification to the class */
unsigned ref_count; /* Number of oustanding ID's open on this class object */
- hbool_t internal; /* Whether this class is internal to the library or not */
hbool_t deleted; /* Whether this class has been deleted and is waiting for dependent classes & proplists to close */
unsigned revision; /* Revision number of a particular class (global) */
- H5SL_t *props; /* Skip list containing properties */
+ H5SL_t *props; /* Skip list containing properties */
/* Callback function pointers & info */
H5P_cls_create_func_t create_func; /* Function to call when a property list is created */
- void *create_data; /* Pointer to user data to pass along to create callback */
- H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */
- void *copy_data; /* Pointer to user data to pass along to copy callback */
- H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */
- void *close_data; /* Pointer to user data to pass along to close callback */
+ void *create_data; /* Pointer to user data to pass along to create callback */
+ H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */
+ void *copy_data; /* Pointer to user data to pass along to copy callback */
+ H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */
+ void *close_data; /* Pointer to user data to pass along to close callback */
};
/* Define structure to hold property list information */
@@ -123,6 +123,7 @@ typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass);
*/
typedef struct H5P_libclass_t {
const char *name; /* Class name */
+ H5P_plist_type_t type; /* Class type */
hid_t const * const par_class_id; /* Pointer to global parent class property list class ID */
hid_t * const class_id; /* Pointer to global property list class ID */
@@ -152,7 +153,7 @@ typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata);
/* Private functions, not part of the publicly documented API */
H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class,
- const char *name, unsigned internal,
+ const char *name, H5P_plist_type_t type,
H5P_cls_create_func_t cls_create, void *create_data,
H5P_cls_copy_func_t cls_copy, void *copy_data,
H5P_cls_close_func_t cls_close, void *close_data);
@@ -178,10 +179,10 @@ H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist);
H5_DLL herr_t H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops);
H5_DLL int H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2);
H5_DLL int H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2);
-H5_DLL int H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t iter_func,
- void *iter_data);
-H5_DLL int H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_int_t iter_func,
- void *iter_data);
+H5_DLL int H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop,
+ int *idx, H5P_iterate_int_t iter_func, void *iter_data);
+H5_DLL int H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx,
+ H5P_iterate_int_t iter_func, void *iter_data);
H5_DLL herr_t H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name);
H5_DLL herr_t H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name);
H5_DLL herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name);
@@ -192,6 +193,7 @@ H5_DLL herr_t H5P_close_class(void *_pclass);
H5_DLL herr_t H5P_get_filter(const H5Z_filter_info_t *filter,
unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[],
size_t namelen, char name[], unsigned *filter_config);
+H5_DLL H5P_genprop_t *H5P__find_prop_plist(H5P_genplist_t *plist, const char *name);
/* Testing functions */
#ifdef H5P_TESTING
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 45e9ada..0332079 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -44,6 +44,28 @@
typedef struct H5P_genplist_t H5P_genplist_t;
typedef struct H5P_genclass_t H5P_genclass_t;
+typedef enum H5P_plist_type_t {
+ H5P_TYPE_USER = 0,
+ H5P_TYPE_ROOT = 1,
+ H5P_TYPE_OBJECT_CREATE = 2,
+ H5P_TYPE_FILE_CREATE = 3,
+ H5P_TYPE_FILE_ACCESS = 4,
+ H5P_TYPE_DATASET_CREATE = 5,
+ H5P_TYPE_DATASET_ACCESS = 6,
+ H5P_TYPE_DATASET_XFER = 7,
+ H5P_TYPE_FILE_MOUNT = 8,
+ H5P_TYPE_GROUP_CREATE = 9,
+ H5P_TYPE_GROUP_ACCESS = 10,
+ H5P_TYPE_DATATYPE_CREATE = 11,
+ H5P_TYPE_DATATYPE_ACCESS = 12,
+ H5P_TYPE_STRING_CREATE = 13,
+ H5P_TYPE_ATTRIBUTE_CREATE = 14,
+ H5P_TYPE_OBJECT_COPY = 15,
+ H5P_TYPE_LINK_CREATE = 16,
+ H5P_TYPE_LINK_ACCESS = 17,
+ H5P_TYPE_MAX_TYPE
+} H5P_plist_type_t;
+
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -103,7 +125,7 @@ H5_DLL size_t H5P_peek_size_t(H5P_genplist_t *plist, const char *name);
/* Private DCPL routines */
H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist,
H5D_fill_value_t *status);
-H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type,
+H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, H5T_t *type,
void *value, hid_t dxpl_id);
#endif /* _H5Pprivate_H */
diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c
index 188fdd2..8573985 100644
--- a/src/H5Pstrcpl.c
+++ b/src/H5Pstrcpl.c
@@ -73,6 +73,7 @@ static herr_t H5P_strcrt_reg_prop(H5P_genclass_t *pclass);
/* String creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_STRCRT[1] = {{
"string create", /* Class name for debugging */
+ H5P_TYPE_STRING_CREATE, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_STRING_CREATE_g, /* Pointer to class ID */
NULL, /* Pointer to default property list ID */
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index d9b306d..d88ac35 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -2784,7 +2784,7 @@ H5S_hyper_offset(const H5S_t *space, hsize_t *offset)
FUNC_ENTER_NOAPI(FAIL)
- HDassert(space);
+ HDassert(space && space->extent.rank>0);
HDassert(offset);
/* Start at linear offset 0 */
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 817b2f2..b758a92 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -643,7 +643,7 @@ H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t UNUSED share_selection)
} /* end while */
done:
- if(ret_value < 0) {
+ if(ret_value < 0 && dst->select.sel_info.pnt_lst) {
/* Traverse the (incomplete?) dst list, freeing all memory */
curr = dst->select.sel_info.pnt_lst->head;
while(curr) {
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 91aed1e..9a993a5 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -67,7 +67,7 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset)
/* Check args */
HDassert(space);
- HDassert(space->extent.rank);
+ HDassert(0 < space->extent.rank && space->extent.rank <= H5S_MAX_RANK);
HDassert(offset);
/* Copy the offset over */
diff --git a/src/H5Tarray.c b/src/H5Tarray.c
index 9986631..c73b934 100644
--- a/src/H5Tarray.c
+++ b/src/H5Tarray.c
@@ -194,7 +194,8 @@ H5T__array_create(H5T_t *base, unsigned ndims, const hsize_t dim[/* ndims */])
ret_value->shared->type = H5T_ARRAY;
/* Copy the base type of the array */
- ret_value->shared->parent = H5T_copy(base, H5T_COPY_ALL);
+ if(NULL == (ret_value->shared->parent = H5T_copy(base, H5T_COPY_ALL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy base datatype")
/* Set the array parameters */
ret_value->shared->u.array.ndims = ndims;
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index e6ae53e..1538765 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -45,7 +45,7 @@ static htri_t H5Z_can_apply_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t spac
static enum H5Z_scaleoffset_t H5Z_scaleoffset_get_type(unsigned dtype_class,
unsigned dtype_size, unsigned dtype_sign);
static herr_t H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist,
- const H5T_t *type, enum H5Z_scaleoffset_t scale_type, unsigned cd_values[],
+ H5T_t *type, enum H5Z_scaleoffset_t scale_type, unsigned cd_values[],
int need_convert, hid_t dxpl_id);
static herr_t H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id);
static size_t H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts,
@@ -804,7 +804,7 @@ done:
*/
static herr_t
H5Z_scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist,
- const H5T_t *type, enum H5Z_scaleoffset_t scale_type,
+ H5T_t *type, enum H5Z_scaleoffset_t scale_type,
unsigned cd_values[], int need_convert, hid_t dxpl_id)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -861,7 +861,7 @@ static herr_t
H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id)
{
H5P_genplist_t *dcpl_plist; /* Property list pointer */
- const H5T_t *type; /* Datatype */
+ H5T_t *type; /* Datatype */
const H5S_t *ds; /* Dataspace */
unsigned flags; /* Filter flags */
size_t cd_nelmts = H5Z_SCALEOFFSET_USER_NPARMS; /* Number of filter parameters */
diff --git a/src/H5public.h b/src/H5public.h
index b6ee623..e3919c7 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 124 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 127 /* 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.124" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.9.127" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/H5trace.c b/src/H5trace.c
index b711f40..b559669 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -212,6 +212,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
if('[' == *type) {
if('a' == type[1]) {
asize_idx = (int)HDstrtol(type + 2, &rest, 10);
+ HDassert(0 <= asize_idx && asize_idx < (int) NELMTS(asize));
HDassert(']'==*rest);
type = rest + 1;
} else {
diff --git a/src/Makefile.in b/src/Makefile.in
index 09dda4e..1d199dc 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -485,7 +485,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 = 114
+LT_VERS_REVISION = 117
LT_VERS_AGE = 0
H5detect_CFLAGS = -g $(AM_CFLAGS)