summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5A.c8
-rw-r--r--src/H5AC.c529
-rw-r--r--src/H5ACprivate.h33
-rw-r--r--src/H5B.c810
-rw-r--r--src/H5B2cache.c32
-rw-r--r--src/H5B2hdr.c9
-rw-r--r--src/H5Bcache.c65
-rw-r--r--src/H5Bdbg.c152
-rw-r--r--src/H5Bpkg.h1
-rw-r--r--src/H5C.c408
-rw-r--r--src/H5Cpkg.h2
-rw-r--r--src/H5Cprivate.h46
-rw-r--r--src/H5Dbtree.c8
-rw-r--r--src/H5Dchunk.c8
-rw-r--r--src/H5Dcompact.c12
-rw-r--r--src/H5Dcontig.c12
-rw-r--r--src/H5Dearray.c4
-rw-r--r--src/H5Dint.c15
-rw-r--r--src/H5Dio.c15
-rw-r--r--src/H5Dlayout.c6
-rw-r--r--src/H5Dpkg.h3
-rw-r--r--src/H5Dproxy.c6
-rw-r--r--src/H5Dtest.c14
-rw-r--r--src/H5E.c67
-rw-r--r--src/H5EA.c18
-rw-r--r--src/H5EAcache.c16
-rw-r--r--src/H5EAhdr.c19
-rw-r--r--src/H5EAint.c12
-rw-r--r--src/H5EApkg.h4
-rw-r--r--src/H5Edeprec.c36
-rw-r--r--src/H5Eint.c24
-rw-r--r--src/H5Eprivate.h2
-rw-r--r--src/H5F.c107
-rw-r--r--src/H5FAhdr.c20
-rw-r--r--src/H5FD.c33
-rw-r--r--src/H5FDcore.c2
-rw-r--r--src/H5FDfamily.c1
-rw-r--r--src/H5FDlog.c157
-rw-r--r--src/H5FDstdio.c4
-rw-r--r--src/H5FL.c55
-rw-r--r--src/H5FO.c2
-rw-r--r--src/H5FS.c26
-rw-r--r--src/H5FScache.c139
-rw-r--r--src/H5FSsection.c12
-rw-r--r--src/H5Fdbg.c5
-rw-r--r--src/H5Ffake.c2
-rw-r--r--src/H5Fprivate.h12
-rw-r--r--src/H5Fpublic.h2
-rw-r--r--src/H5Fsuper.c16
-rw-r--r--src/H5Fsuper_cache.c1
-rw-r--r--src/H5Gcache.c53
-rw-r--r--src/H5Gent.c12
-rw-r--r--src/H5Glink.c60
-rw-r--r--src/H5Gnode.c141
-rw-r--r--src/H5Gobj.c4
-rw-r--r--src/H5Gpkg.h25
-rw-r--r--src/H5Gprivate.h5
-rw-r--r--src/H5Groot.c2
-rw-r--r--src/H5Gstab.c107
-rw-r--r--src/H5Gtest.c2
-rw-r--r--src/H5HF.c2
-rw-r--r--src/H5HFcache.c124
-rw-r--r--src/H5HFdblock.c105
-rw-r--r--src/H5HFhdr.c192
-rw-r--r--src/H5HFiblock.c122
-rw-r--r--src/H5HFiter.c16
-rw-r--r--src/H5HFman.c82
-rw-r--r--src/H5HFsection.c367
-rw-r--r--src/H5HG.c167
-rw-r--r--src/H5HGcache.c22
-rw-r--r--src/H5HL.c736
-rw-r--r--src/H5HLcache.c821
-rw-r--r--src/H5HLdbg.c72
-rw-r--r--src/H5HLint.c417
-rw-r--r--src/H5HLpkg.h98
-rw-r--r--src/H5HLprivate.h4
-rw-r--r--src/H5I.c4
-rw-r--r--src/H5L.c2
-rw-r--r--src/H5Lexternal.c6
-rw-r--r--src/H5O.c135
-rw-r--r--src/H5Oainfo.c8
-rw-r--r--src/H5Oalloc.c56
-rw-r--r--src/H5Oattr.c2
-rw-r--r--src/H5Oattribute.c51
-rw-r--r--src/H5Ocache.c38
-rw-r--r--src/H5Ocopy.c21
-rw-r--r--src/H5Odbg.c8
-rw-r--r--src/H5Oefl.c10
-rw-r--r--src/H5Ofill.c4
-rw-r--r--src/H5Olayout.c10
-rw-r--r--src/H5Olink.c10
-rw-r--r--src/H5Omessage.c49
-rw-r--r--src/H5Opkg.h6
-rw-r--r--src/H5Oprivate.h4
-rw-r--r--src/H5Otest.c76
-rw-r--r--src/H5Pdcpl.c4
-rw-r--r--src/H5Pfapl.c60
-rw-r--r--src/H5S.c163
-rwxr-xr-xsrc/H5SM.c2
-rw-r--r--src/H5SMcache.c6
-rw-r--r--src/H5Sall.c6
-rw-r--r--src/H5Shyper.c209
-rw-r--r--src/H5Snone.c2
-rw-r--r--src/H5Spoint.c194
-rw-r--r--src/H5Sprivate.h2
-rw-r--r--src/H5T.c364
-rw-r--r--src/H5Tcommit.c4
-rw-r--r--src/H5Tconv.c12
-rw-r--r--src/H5Tcset.c8
-rw-r--r--src/H5Tdeprec.c2
-rw-r--r--src/H5Tnative.c190
-rw-r--r--src/H5Toffset.c6
-rw-r--r--src/H5Znbit.c79
-rw-r--r--src/H5Ztrans.c117
-rw-r--r--src/H5detect.c3
-rw-r--r--src/H5private.h9
-rw-r--r--src/H5public.h4
-rwxr-xr-xsrc/Makefile.am2
-rw-r--r--src/Makefile.in29
119 files changed, 4134 insertions, 4593 deletions
diff --git a/src/H5A.c b/src/H5A.c
index d359130..c958bbd 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -1034,9 +1034,9 @@ done:
if(dst_id >= 0)
(void)H5I_dec_ref(dst_id, FALSE);
if(tconv_buf && !tconv_owned)
- (void)H5FL_BLK_FREE(attr_buf, tconv_buf);
+ tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf);
if(bkg_buf)
- (void)H5FL_BLK_FREE(attr_buf, bkg_buf);
+ bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A_write() */
@@ -1180,9 +1180,9 @@ done:
if(dst_id >= 0)
(void)H5I_dec_ref(dst_id, FALSE);
if(tconv_buf)
- (void)H5FL_BLK_FREE(attr_buf, tconv_buf);
+ tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf);
if(bkg_buf)
- (void)H5FL_BLK_FREE(attr_buf, bkg_buf);
+ bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5A_read() */
diff --git a/src/H5AC.c b/src/H5AC.c
index 8e2ced6..659c4e6 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -154,8 +154,7 @@ static herr_t H5AC_log_deleted_entry(H5AC_t * cache_ptr,
haddr_t addr,
unsigned int flags);
-static herr_t H5AC_log_dirtied_entry(H5AC_t * cache_ptr,
- H5C_cache_entry_t * entry_ptr,
+static herr_t H5AC_log_dirtied_entry(const H5C_cache_entry_t *entry_ptr,
haddr_t addr,
hbool_t size_changed,
size_t new_size);
@@ -190,7 +189,7 @@ static herr_t H5AC_receive_and_apply_clean_list(H5F_t * f,
hid_t secondary_dxpl_id,
H5AC_t * cache_ptr);
-static herr_t H5AC_log_renamed_entry(H5AC_t * cache_ptr,
+static herr_t H5AC_log_renamed_entry(const H5F_t * f,
haddr_t old_addr,
haddr_t new_addr);
@@ -480,7 +479,8 @@ static const char * H5AC_entry_type_names[H5AC_NTYPES] =
{
"B-tree nodes",
"symbol table nodes",
- "local heaps",
+ "local heap prefixes",
+ "local heap data blocks",
"global heaps",
"object headers",
"v2 B-tree headers",
@@ -522,11 +522,11 @@ H5AC_create(const H5F_t *f,
FUNC_ENTER_NOAPI(H5AC_create, FAIL)
- HDassert ( f );
- HDassert ( NULL == f->shared->cache );
- HDassert ( config_ptr != NULL ) ;
- HDassert ( NELMTS(H5AC_entry_type_names) == H5AC_NTYPES);
- HDassert ( H5C__MAX_NUM_TYPE_IDS == H5AC_NTYPES);
+ HDassert(f);
+ HDassert(NULL == f->shared->cache);
+ HDassert(config_ptr != NULL) ;
+ HDcompile_assert(NELMTS(H5AC_entry_type_names) == H5AC_NTYPES);
+ HDcompile_assert(H5C__MAX_NUM_TYPE_IDS == H5AC_NTYPES);
result = H5AC_validate_config(config_ptr);
@@ -744,25 +744,6 @@ done:
* matzke@llnl.gov
* Jul 9 1997
*
- * Modifications:
- *
- * Complete re-design and re-write to support the re-designed
- * metadata cache.
- * JRM - 5/12/04
- *
- * Abstracted the guts of the function to H5C_dest() in H5C.c,
- * and then re-wrote the function as a wrapper for H5C_dest().
- *
- * JRM - 6/7/04
- *
- * Added code to free the auxiliary structure and its
- * associated slist if present.
- * JRM - 6/28/05
- *
- * Added code to close the trace file if it is present.
- *
- * JRM - 6/8/06
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -796,7 +777,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id)
#endif /* H5_HAVE_PARALLEL */
/* Destroy the cache */
- if(H5C_dest(f, dxpl_id, H5AC_noblock_dxpl_id, f->shared->cache) < 0)
+ if(H5C_dest(f, dxpl_id, H5AC_noblock_dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't destroy cache")
f->shared->cache = NULL;
@@ -845,7 +826,6 @@ H5AC_expunge_entry(H5F_t *f,
unsigned flags)
{
herr_t result;
- H5AC_t * cache_ptr = NULL;
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
@@ -862,11 +842,13 @@ H5AC_expunge_entry(H5F_t *f,
HDassert(type->dest);
HDassert(H5F_addr_defined(addr));
- cache_ptr = f->shared->cache;
-
#if H5AC__TRACE_FILE_ENABLED
- /* For the expunge entry call, only the addr, and type id are really
- * necessary in the trace file. Write the return value to catch occult
+{
+ H5AC_t * cache_ptr = f->shared->cache;
+
+
+ /* For the expunge entry call, only the addr, and type id are really
+ * necessary in the trace file. Write the return value to catch occult
* errors.
*/
if ( ( cache_ptr != NULL ) &&
@@ -877,12 +859,12 @@ H5AC_expunge_entry(H5F_t *f,
(unsigned long)addr,
(int)(type->id));
}
+}
#endif /* H5AC__TRACE_FILE_ENABLED */
result = H5C_expunge_entry(f,
dxpl_id,
H5AC_noblock_dxpl_id,
- cache_ptr,
type,
addr,
flags);
@@ -960,7 +942,7 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id)
#endif /* H5_HAVE_PARALLEL */
/* Flush the cache */
- if(H5C_flush_cache(f, dxpl_id, H5AC_noblock_dxpl_id, f->shared->cache, H5AC__NO_FLAGS_SET) < 0)
+ if(H5C_flush_cache(f, dxpl_id, H5AC_noblock_dxpl_id, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache.")
done:
@@ -998,14 +980,12 @@ done:
*
*-------------------------------------------------------------------------
*/
-
herr_t
-H5AC_get_entry_status(H5F_t * f,
+H5AC_get_entry_status(const H5F_t *f,
haddr_t addr,
unsigned * status_ptr)
{
H5C_t *cache_ptr = f->shared->cache;
- herr_t ret_value = SUCCEED; /* Return value */
herr_t result;
hbool_t in_cache;
hbool_t is_dirty;
@@ -1015,6 +995,7 @@ H5AC_get_entry_status(H5F_t * f,
hbool_t is_flush_dep_parent;
size_t entry_size;
unsigned status = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_get_entry_status, FAIL)
@@ -1026,7 +1007,7 @@ H5AC_get_entry_status(H5F_t * f,
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry.")
}
- result = H5C_get_entry_status(cache_ptr, addr, &entry_size, &in_cache,
+ result = H5C_get_entry_status(f, addr, &entry_size, &in_cache,
&is_dirty, &is_protected, &is_pinned, &is_flush_dep_parent,
&is_flush_dep_child);
@@ -1135,7 +1116,6 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
{
herr_t result;
H5AC_info_t *info;
- H5AC_t *cache;
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
@@ -1182,7 +1162,6 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
#endif /* H5AC__TRACE_FILE_ENABLED */
/* Get local copy of this information */
- cache = f->shared->cache;
info = (H5AC_info_t *)thing;
info->addr = addr;
@@ -1209,7 +1188,6 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
result = H5C_insert_entry(f,
dxpl_id,
H5AC_noblock_dxpl_id,
- cache,
type,
addr,
thing,
@@ -1274,109 +1252,66 @@ done:
* Programmer: John Mainzer
* 4/11/06
*
- * Modifications:
- *
- * Added trace file support. JRM -- 6/6/06
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_mark_pinned_entry_dirty(H5F_t * f,
- void * thing,
- hbool_t size_changed,
- size_t new_size)
+H5AC_mark_pinned_entry_dirty(void *thing, hbool_t size_changed, size_t new_size)
{
- H5C_t *cache_ptr = f->shared->cache;
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_mark_pinned_entry_dirty, FAIL)
+ /* Sanity check */
+ HDassert(thing);
+
#if H5AC__TRACE_FILE_ENABLED
/* For the mark pinned entry dirty call, only the addr, size_changed,
* and new_size are really necessary in the trace file. Write the result
* to catch occult errors.
*/
- if ( ( f != NULL ) &&
- ( f->shared != NULL ) &&
- ( f->shared->cache != NULL ) &&
- ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
-
- sprintf(trace, "H5AC_mark_pinned_entry_dirty 0x%lx %d %d",
+ if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
+ sprintf(trace, "%s 0x%lx %d %d", FUNC,
(unsigned long)(((H5C_cache_entry_t *)thing)->addr),
(int)size_changed,
(int)new_size);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
#ifdef H5_HAVE_PARALLEL
+{
+ H5AC_info_t *entry_ptr = (H5AC_info_t *)thing;
+ H5C_t *cache_ptr = entry_ptr->cache_ptr;
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
-
- if ( ( ((H5AC_info_t *)thing)->is_dirty == FALSE ) &&
- ( NULL != cache_ptr->aux_ptr) ) {
-
- H5AC_info_t * entry_ptr;
-
- HDassert( ( size_changed == TRUE ) || ( size_changed == FALSE ) );
-
- entry_ptr = (H5AC_info_t *)thing;
-
- if ( ! ( entry_ptr->is_pinned ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Entry isn't pinned??")
- }
-
- if ( entry_ptr->is_protected ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Entry is protected??")
- }
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- result = H5AC_log_dirtied_entry(cache_ptr,
- entry_ptr,
- entry_ptr->addr,
- size_changed,
- new_size);
+ if((!entry_ptr->is_dirty) && (NULL != cache_ptr->aux_ptr)) {
+ /* Check for usage errors */
+ if(!entry_ptr->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry isn't pinned??")
+ if(entry_ptr->is_protected)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry is protected??")
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "H5AC_log_dirtied_entry() failed.")
- }
- }
+ if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, size_changed, new_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry")
+ } /* end if */
+}
#endif /* H5_HAVE_PARALLEL */
- result = H5C_mark_pinned_entry_dirty(cache_ptr,
- thing,
- size_changed,
- new_size);
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "H5C_mark_pinned_entry_dirty() failed.")
-
- }
+ if(H5C_mark_pinned_entry_dirty(thing, size_changed, new_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned entry dirty")
done:
-
#if H5AC__TRACE_FILE_ENABLED
- if ( trace_file_ptr != NULL ) {
-
+ if(trace_file_ptr)
HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_mark_pinned_entry_dirty() */
@@ -1394,92 +1329,59 @@ done:
* Programmer: John Mainzer
* 5/16/06
*
- * Modifications:
- *
- * Added trace file support. JRM -- 6/6/06
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_mark_pinned_or_protected_entry_dirty(H5F_t * f,
- void * thing)
+H5AC_mark_pinned_or_protected_entry_dirty(void *thing)
{
- H5C_t * cache_ptr = f->shared->cache;
-#ifdef H5_HAVE_PARALLEL
- H5AC_info_t * info_ptr;
-#endif /* H5_HAVE_PARALLEL */
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_mark_pinned_or_protected_entry_dirty, FAIL)
+ /* Sanity check */
+ HDassert(thing);
+
#if H5AC__TRACE_FILE_ENABLED
/* For the mark pinned or protected entry dirty call, only the addr
* is really necessary in the trace file. Write the result to catch
* occult errors.
*/
- if ( ( f != NULL ) &&
- ( f->shared != NULL ) &&
- ( f->shared->cache != NULL ) &&
- ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
-
- sprintf(trace, "H5AC_mark_pinned_or_protected_entry_dirty %lx",
+ if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
+ sprintf(trace, "%s %lx", FUNC,
(unsigned long)(((H5C_cache_entry_t *)thing)->addr));
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
#ifdef H5_HAVE_PARALLEL
+{
+ H5AC_info_t *entry_ptr = (H5AC_info_t *)thing;
+ H5C_t *cache_ptr = entry_ptr->cache_ptr;
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
-
- info_ptr = (H5AC_info_t *)thing;
-
- if ( ( info_ptr->is_dirty == FALSE ) &&
- ( ! ( info_ptr->is_protected ) ) &&
- ( info_ptr->is_pinned ) &&
- ( NULL != cache_ptr->aux_ptr) ) {
-
- result = H5AC_log_dirtied_entry(cache_ptr,
- info_ptr,
- info_ptr->addr,
- FALSE,
- 0);
-
- if ( result < 0 ) {
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "H5AC_log_dirtied_entry() failed.")
- }
- }
+ if((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) &&
+ (entry_ptr->is_pinned) && (NULL != cache_ptr->aux_ptr)) {
+ if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, FALSE, 0) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry")
+ } /* end if */
+}
#endif /* H5_HAVE_PARALLEL */
- result = H5C_mark_pinned_or_protected_entry_dirty(cache_ptr, thing);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "H5C_mark_pinned_entry_dirty() failed.")
-
- }
+ if(H5C_mark_pinned_or_protected_entry_dirty(thing) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned or protected entry dirty")
done:
-
#if H5AC__TRACE_FILE_ENABLED
- if ( trace_file_ptr != NULL ) {
-
+ if(trace_file_ptr)
HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_mark_pinned_or_protected_entry_dirty() */
@@ -1570,16 +1472,8 @@ H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_ad
#ifdef H5_HAVE_PARALLEL
if ( NULL != (aux_ptr = f->shared->cache->aux_ptr) ) {
-
- result = H5AC_log_renamed_entry(f->shared->cache,
- old_addr,
- new_addr);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "H5AC_log_renamed_entry() failed.")
- }
+ if(H5AC_log_renamed_entry(f, old_addr, new_addr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log renamed entry")
}
#endif /* H5_HAVE_PARALLEL */
@@ -1635,60 +1529,42 @@ done:
* Programmer: John Mainzer
* 4/27/06
*
- * Modifications:
- *
- * Added trace file support. 6/6/06
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_pin_protected_entry(H5F_t * f,
- void * thing)
+H5AC_pin_protected_entry(void *thing)
{
- H5C_t *cache_ptr = f->shared->cache;
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_pin_protected_entry, FAIL)
+ /* Sanity check */
+ HDassert(thing);
+
#if H5AC__TRACE_FILE_ENABLED
/* For the pin protected entry call, only the addr is really necessary
* in the trace file. Also write the result to catch occult errors.
*/
- if ( ( f != NULL ) &&
- ( f->shared != NULL ) &&
- ( f->shared->cache != NULL ) &&
- ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
-
- sprintf(trace, "H5AC_pin_protected_entry %lx",
+ if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
+ sprintf(trace, "%s %lx", FUNC,
(unsigned long)(((H5C_cache_entry_t *)thing)->addr));
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
- result = H5C_pin_protected_entry(cache_ptr, thing);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, \
- "H5C_pin_protected_entry() failed.")
- }
+ if(H5C_pin_protected_entry(thing) < 0 )
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "can't pin entry")
done:
-
#if H5AC__TRACE_FILE_ENABLED
- if ( trace_file_ptr != NULL ) {
-
+ if(trace_file_ptr)
HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_pin_protected_entry() */
@@ -1706,9 +1582,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_create_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing)
+H5AC_create_flush_dependency(void * parent_thing, void * child_thing)
{
- H5C_t *cache_ptr = f->shared->cache;
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
@@ -1718,13 +1593,12 @@ H5AC_create_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing)
FUNC_ENTER_NOAPI(H5AC_create_flush_dependency, FAIL)
/* Sanity check */
- HDassert(cache_ptr);
HDassert(parent_thing);
HDassert(child_thing);
#if H5AC__TRACE_FILE_ENABLED
- if ( ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
+ if((H5C_get_trace_file_ptr_from_entry(parent_thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
sprintf(trace, "%s %lx %lx",
FUNC,
(unsigned long)(((H5C_cache_entry_t *)parent_thing)->addr),
@@ -1732,7 +1606,7 @@ H5AC_create_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing)
} /* end if */
#endif /* H5AC__TRACE_FILE_ENABLED */
- if(H5C_create_flush_dependency(cache_ptr, parent_thing, child_thing) < 0)
+ if(H5C_create_flush_dependency(parent_thing, child_thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "H5C_create_flush_dependency() failed.")
done:
@@ -1891,7 +1765,6 @@ H5AC_protect(H5F_t *f,
thing = H5C_protect(f,
dxpl_id,
H5AC_noblock_dxpl_id,
- f->shared->cache,
type,
addr,
udata1,
@@ -1941,104 +1814,65 @@ done:
* Programmer: John Mainzer
* 7/5/06
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_resize_pinned_entry(H5F_t * f,
- void * thing,
- size_t new_size)
+H5AC_resize_pinned_entry(void *thing, size_t new_size)
{
- H5C_t *cache_ptr = f->shared->cache;
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_resize_pinned_entry, FAIL)
+ /* Sanity check */
+ HDassert(thing);
+
#if H5AC__TRACE_FILE_ENABLED
/* For the resize pinned entry call, only the addr, and new_size are
* really necessary in the trace file. Write the result to catch
* occult errors.
*/
- if ( ( f != NULL ) &&
- ( f->shared != NULL ) &&
- ( f->shared->cache != NULL ) &&
- ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
-
- sprintf(trace, "H5AC_resize_pinned_entry 0x%lx %d",
+ if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
+ sprintf(trace, "%s 0x%lx %d", FUNC,
(unsigned long)(((H5C_cache_entry_t *)thing)->addr),
(int)new_size);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
#ifdef H5_HAVE_PARALLEL
+{
+ H5AC_info_t * entry_ptr = (H5AC_info_t *)thing;
+ H5C_t *cache_ptr = entry_ptr->cache_ptr;
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
-
- if ( ( ((H5AC_info_t *)thing)->is_dirty == FALSE ) &&
- ( NULL != cache_ptr->aux_ptr) ) {
-
- H5AC_info_t * entry_ptr;
-
- entry_ptr = (H5AC_info_t *)thing;
-
- if ( ! ( entry_ptr->is_pinned ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \
- "Entry isn't pinned??")
- }
-
- if ( entry_ptr->is_protected ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \
- "Entry is protected??")
- }
-
- result = H5AC_log_dirtied_entry(cache_ptr,
- entry_ptr,
- entry_ptr->addr,
- TRUE,
- new_size);
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- if ( result < 0 ) {
+ if((!entry_ptr->is_dirty) && (NULL != cache_ptr->aux_ptr)) {
+ /* Check for usage errors */
+ if(!entry_ptr->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry isn't pinned??")
+ if(entry_ptr->is_protected)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry is protected??")
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "H5AC_log_dirtied_entry() failed.")
- }
- }
+ if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, TRUE, new_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry")
+ } /* end if */
+}
#endif /* H5_HAVE_PARALLEL */
- result = H5C_resize_pinned_entry(cache_ptr,
- thing,
- new_size);
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \
- "H5C_resize_pinned_entry() failed.")
-
- }
+ if(H5C_resize_pinned_entry(thing, new_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry")
done:
-
#if H5AC__TRACE_FILE_ENABLED
- if ( trace_file_ptr != NULL ) {
-
+ if(trace_file_ptr)
HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_resize_pinned_entry() */
@@ -2053,59 +1887,42 @@ done:
* Programmer: John Mainzer
* 4/11/06
*
- * Modifications:
- *
- * Added code supporting the trace file. JRM -- 6/7/06
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_unpin_entry(H5F_t * f,
- void * thing)
+H5AC_unpin_entry(void * thing)
{
- H5C_t *cache_ptr = f->shared->cache;
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_unpin_entry, FAIL)
+ /* Sanity check */
+ HDassert(thing);
+
#if H5AC__TRACE_FILE_ENABLED
/* For the unpin entry call, only the addr is really necessary
* in the trace file. Also write the result to catch occult errors.
*/
- if ( ( f != NULL ) &&
- ( f->shared != NULL ) &&
- ( f->shared->cache != NULL ) &&
- ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
-
- sprintf(trace, "H5AC_unpin_entry %lx",
+ if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
+ sprintf(trace, "%s %lx", FUNC,
(unsigned long)(((H5C_cache_entry_t *)thing)->addr));
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
- result = H5C_unpin_entry(cache_ptr, thing);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "H5C_unpin_entry() failed.")
- }
+ if(H5C_unpin_entry(thing) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry")
done:
-
#if H5AC__TRACE_FILE_ENABLED
- if ( trace_file_ptr != NULL ) {
-
+ if(trace_file_ptr)
HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
- }
#endif /* H5AC__TRACE_FILE_ENABLED */
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5AC_unpin_entry() */
@@ -2122,9 +1939,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_destroy_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing)
+H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing)
{
- H5C_t *cache_ptr = f->shared->cache;
#if H5AC__TRACE_FILE_ENABLED
char trace[128] = "";
FILE * trace_file_ptr = NULL;
@@ -2134,13 +1950,12 @@ H5AC_destroy_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing
FUNC_ENTER_NOAPI(H5AC_destroy_flush_dependency, FAIL)
/* Sanity check */
- HDassert(cache_ptr);
HDassert(parent_thing);
HDassert(child_thing);
#if H5AC__TRACE_FILE_ENABLED
- if ( ( H5C_get_trace_file_ptr(f->shared->cache, &trace_file_ptr) >= 0 ) &&
- ( trace_file_ptr != NULL ) ) {
+ if((H5C_get_trace_file_ptr_from_entry(parent_thing, &trace_file_ptr) >= 0) &&
+ (NULL != trace_file_ptr))
sprintf(trace, "%s %lx",
FUNC,
(unsigned long)(((H5C_cache_entry_t *)parent_thing)->addr),
@@ -2148,7 +1963,7 @@ H5AC_destroy_flush_dependency(H5F_t * f, void * parent_thing, void * child_thing
} /* end if */
#endif /* H5AC__TRACE_FILE_ENABLED */
- if(H5C_destroy_flush_dependency(cache_ptr, parent_thing, child_thing) < 0)
+ if(H5C_destroy_flush_dependency(parent_thing, child_thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "H5C_destroy_flush_dependency() failed.")
done:
@@ -2331,18 +2146,8 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
#ifdef H5_HAVE_PARALLEL
if ( ( dirtied ) && ( ((H5AC_info_t *)thing)->is_dirty == FALSE ) &&
( NULL != (aux_ptr = f->shared->cache->aux_ptr) ) ) {
-
- result = H5AC_log_dirtied_entry(f->shared->cache,
- (H5AC_info_t *)thing,
- addr,
- size_changed,
- new_size);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "H5AC_log_dirtied_entry() failed.")
- }
+ if(H5AC_log_dirtied_entry((H5AC_info_t *)thing, addr, size_changed, new_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log dirtied entry")
}
if ( ( (flags & H5C__DELETED_FLAG) != 0 ) &&
@@ -2365,7 +2170,6 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
result = H5C_unprotect(f,
dxpl_id,
H5AC_noblock_dxpl_id,
- f->shared->cache,
type,
addr,
thing,
@@ -2541,7 +2345,7 @@ done:
*/
herr_t
-H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr,
+H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr,
H5AC_cache_config_t *config_ptr)
{
herr_t result;
@@ -2573,7 +2377,7 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr,
}
- result = H5C_get_cache_auto_resize_config((H5C_t *)cache_ptr,
+ result = H5C_get_cache_auto_resize_config((const H5C_t *)cache_ptr,
&internal_config);
if ( result < 0 ) {
@@ -2582,7 +2386,7 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr,
"H5C_get_cache_auto_resize_config() failed.")
}
- result = H5C_get_evictions_enabled((H5C_t *)cache_ptr, &evictions_enabled);
+ result = H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled);
if ( result < 0 ) {
@@ -2818,10 +2622,9 @@ done:
*/
herr_t
-H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr,
+H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr,
H5AC_cache_config_t *config_ptr)
{
- /* const char * fcn_name = "H5AC_set_cache_auto_resize_config"; */
herr_t result;
herr_t ret_value = SUCCEED; /* Return value */
H5C_auto_size_ctl_t internal_config;
@@ -2832,6 +2635,8 @@ H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr,
FUNC_ENTER_NOAPI(H5AC_set_cache_auto_resize_config, FAIL)
+ HDassert( cache_ptr );
+
#if H5AC__TRACE_FILE_ENABLED
/* Make note of the new configuration. Don't look up the trace file
* pointer, as that may change before we use it.
@@ -2922,30 +2727,14 @@ H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr,
}
}
- if ( H5AC_ext_config_2_int_config(config_ptr, &internal_config) !=
- SUCCEED ) {
+ if(H5AC_ext_config_2_int_config(config_ptr, &internal_config) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_ext_config_2_int_config() failed.")
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5AC_ext_config_2_int_config() failed.")
- }
+ if(H5C_set_cache_auto_resize_config(cache_ptr, &internal_config) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_cache_auto_resize_config() failed.")
- result = H5C_set_cache_auto_resize_config((H5C_t *)cache_ptr,
- &internal_config);
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5C_set_cache_auto_resize_config() failed.")
- }
-
-
- result = H5C_set_evictions_enabled((H5C_t *)cache_ptr,
- config_ptr->evictions_enabled);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5C_set_evictions_enabled() failed.")
- }
+ if(H5C_set_evictions_enabled(cache_ptr, config_ptr->evictions_enabled) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_evictions_enabled() failed.")
#ifdef H5_HAVE_PARALLEL
if ( cache_ptr->aux_ptr != NULL ) {
@@ -3817,26 +3606,28 @@ done:
*
* Programmer: John Mainzer, 6/29/05
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-
#ifdef H5_HAVE_PARALLEL
static herr_t
-H5AC_log_dirtied_entry(H5AC_t * cache_ptr,
- H5AC_info_t * entry_ptr,
+H5AC_log_dirtied_entry(const H5AC_info_t * entry_ptr,
haddr_t addr,
hbool_t size_changed,
size_t new_size)
{
- herr_t ret_value = SUCCEED; /* Return value */
size_t entry_size;
- H5AC_aux_t * aux_ptr = NULL;
- H5AC_slist_entry_t * slist_entry_ptr = NULL;
+ H5AC_t * cache_ptr;
+ H5AC_aux_t * aux_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5AC_log_dirtied_entry, FAIL)
+ HDassert( entry_ptr != NULL );
+ HDassert( entry_ptr->addr == addr );
+ HDassert( entry_ptr->is_dirty == FALSE );
+
+ cache_ptr = entry_ptr->cache_ptr;
+
HDassert( cache_ptr != NULL );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
@@ -3845,10 +3636,6 @@ H5AC_log_dirtied_entry(H5AC_t * cache_ptr,
HDassert( aux_ptr != NULL );
HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC );
- HDassert( entry_ptr != NULL );
- HDassert( entry_ptr->addr == addr );
- HDassert( entry_ptr->is_dirty == FALSE );
-
if ( size_changed ) {
entry_size = new_size;
@@ -3859,6 +3646,7 @@ H5AC_log_dirtied_entry(H5AC_t * cache_ptr,
}
if ( aux_ptr->mpi_rank == 0 ) {
+ H5AC_slist_entry_t * slist_entry_ptr;
HDassert( aux_ptr->d_slist_ptr != NULL );
HDassert( aux_ptr->c_slist_ptr != NULL );
@@ -4266,10 +4054,11 @@ done:
#ifdef H5_HAVE_PARALLEL
static herr_t
-H5AC_log_renamed_entry(H5AC_t * cache_ptr,
+H5AC_log_renamed_entry(const H5F_t *f,
haddr_t old_addr,
haddr_t new_addr)
{
+ H5AC_t * cache_ptr;
herr_t ret_value = SUCCEED; /* Return value */
hbool_t entry_in_cache;
hbool_t entry_dirty;
@@ -4279,7 +4068,12 @@ H5AC_log_renamed_entry(H5AC_t * cache_ptr,
FUNC_ENTER_NOAPI(H5AC_log_renamed_entry, FAIL)
- HDassert( cache_ptr != NULL );
+ HDassert( f );
+ HDassert( f->shared );
+
+ cache_ptr = (H5AC_t *)f->shared->cache;
+
+ HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
aux_ptr = cache_ptr->aux_ptr;
@@ -4288,7 +4082,7 @@ H5AC_log_renamed_entry(H5AC_t * cache_ptr,
HDassert( aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC );
/* get entry status, size, etc here */
- if ( H5C_get_entry_status(cache_ptr, old_addr, &entry_size, &entry_in_cache,
+ if ( H5C_get_entry_status(f, old_addr, &entry_size, &entry_in_cache,
&entry_dirty, NULL, NULL, NULL, NULL) < 0 ) {
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get entry status.")
@@ -4800,7 +4594,6 @@ H5AC_flush_entries(H5F_t *f)
status = H5C_flush_cache(f,
H5AC_noblock_dxpl_id,
H5AC_noblock_dxpl_id,
- f->shared->cache,
H5AC__NO_FLAGS_SET);
aux_ptr->write_permitted = FALSE;
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 208dde1..f049a3b 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -49,7 +49,8 @@
typedef enum {
H5AC_BT_ID = 0, /*B-tree nodes */
H5AC_SNODE_ID, /*symbol table nodes */
- H5AC_LHEAP_ID, /*local heap */
+ H5AC_LHEAP_PRFX_ID, /*local heap prefix */
+ H5AC_LHEAP_DBLK_ID, /*local heap data block */
H5AC_GHEAP_ID, /*global heap */
H5AC_OHDR_ID, /*object header */
H5AC_BT2_HDR_ID, /*v2 B-tree header */
@@ -324,33 +325,25 @@ extern hid_t H5AC_ind_dxpl_id;
H5_DLL herr_t H5AC_init(void);
H5_DLL herr_t H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr);
-H5_DLL herr_t H5AC_get_entry_status(H5F_t * f, haddr_t addr,
+H5_DLL herr_t H5AC_get_entry_status(const H5F_t * f, haddr_t addr,
unsigned * status_ptr);
H5_DLL herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
haddr_t addr, void *thing, unsigned int flags);
-H5_DLL herr_t H5AC_pin_protected_entry(H5F_t * f, void * thing);
-H5_DLL herr_t H5AC_create_flush_dependency(H5F_t *f, void *parent_thing,
- void *child_thing);
+H5_DLL herr_t H5AC_pin_protected_entry(void *thing);
+H5_DLL herr_t H5AC_create_flush_dependency(void *parent_thing, void *child_thing);
H5_DLL void * H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type,
haddr_t addr, const void *udata1, void *udata2,
H5AC_protect_t rw);
-H5_DLL herr_t H5AC_resize_pinned_entry(H5F_t * f,
- void * thing,
- size_t new_size);
-H5_DLL herr_t H5AC_unpin_entry(H5F_t * f,
- void * thing);
-H5_DLL herr_t H5AC_destroy_flush_dependency(H5F_t *f, void *parent_thing,
- void *child_thing);
+H5_DLL herr_t H5AC_resize_pinned_entry(void *thing, size_t new_size);
+H5_DLL herr_t H5AC_unpin_entry(void *thing);
+H5_DLL herr_t H5AC_destroy_flush_dependency(void *parent_thing, void *child_thing);
H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id,
const H5AC_class_t *type, haddr_t addr,
void *thing, unsigned flags);
H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id);
-H5_DLL herr_t H5AC_mark_pinned_entry_dirty(H5F_t * f,
- void * thing,
- hbool_t size_changed,
- size_t new_size);
-H5_DLL herr_t H5AC_mark_pinned_or_protected_entry_dirty(H5F_t * f,
- void * thing);
+H5_DLL herr_t H5AC_mark_pinned_entry_dirty(void *thing, hbool_t size_changed,
+ size_t new_size);
+H5_DLL herr_t H5AC_mark_pinned_or_protected_entry_dirty(void *thing);
H5_DLL herr_t H5AC_rename(H5F_t *f, const H5AC_class_t *type,
haddr_t old_addr, haddr_t new_addr);
@@ -364,7 +357,7 @@ H5_DLL herr_t H5AC_set_write_done_callback(H5C_t * cache_ptr,
void (* write_done)(void));
H5_DLL herr_t H5AC_stats(const H5F_t *f);
-H5_DLL herr_t H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr,
+H5_DLL herr_t H5AC_get_cache_auto_resize_config(const H5AC_t * cache_ptr,
H5AC_cache_config_t *config_ptr);
H5_DLL herr_t H5AC_get_cache_size(H5AC_t * cache_ptr,
@@ -378,7 +371,7 @@ H5_DLL herr_t H5AC_get_cache_hit_rate(H5AC_t * cache_ptr,
H5_DLL herr_t H5AC_reset_cache_hit_rate_stats(H5AC_t * cache_ptr);
-H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr,
+H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr,
H5AC_cache_config_t *config_ptr);
H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t * config_ptr);
diff --git a/src/H5B.c b/src/H5B.c
index d915b01..591b974 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -202,19 +202,6 @@ H5FL_SEQ_DEFINE_STATIC(size_t);
* matzke@llnl.gov
* Jun 23 1997
*
- * Modifications:
- * Robb Matzke, 1999-07-28
- * Changed the name of the ADDR argument to ADDR_P to make it
- * obvious that the address is passed by reference unlike most
- * other functions that take addresses.
- *
- * John Mainzer 6/9/05
- * Removed code setting the is_dirty field of the cache info.
- * This is no longer pemitted, as the cache code is now
- * manageing this field. Since this function uses a call to
- * H5AC_set() (which marks the entry dirty automaticly), no
- * other change is required.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -230,29 +217,29 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata,
/*
* Check arguments.
*/
- assert(f);
- assert(type);
- assert(addr_p);
+ HDassert(f);
+ HDassert(type);
+ HDassert(addr_p);
/*
* Allocate file and memory data structures.
*/
- if (NULL==(bt = H5FL_MALLOC(H5B_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree root node")
- HDmemset(&bt->cache_info,0,sizeof(H5AC_info_t));
+ if(NULL == (bt = H5FL_MALLOC(H5B_t)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node")
+ HDmemset(&bt->cache_info, 0, sizeof(H5AC_info_t));
bt->level = 0;
bt->left = HADDR_UNDEF;
bt->right = HADDR_UNDEF;
bt->nchildren = 0;
- if((bt->rc_shared=(type->get_shared)(f, udata))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't retrieve B-tree node buffer")
+ if(NULL == (bt->rc_shared = (type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree node buffer")
shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
- if (NULL==(bt->native=H5FL_BLK_MALLOC(native_block,shared->sizeof_keys)) ||
- NULL==(bt->child=H5FL_SEQ_MALLOC(haddr_t,(size_t)shared->two_k)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree root node")
- if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree root node")
+ if(NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) ||
+ NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node")
+ if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "file allocation failed for B-tree root node")
/*
* Cache the new B-tree node.
@@ -264,14 +251,14 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata,
#endif
done:
- if (ret_value<0) {
+ if(ret_value < 0) {
if(shared && shared->sizeof_rnode>0) {
H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t);
(void)H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, *addr_p, (hsize_t)shared->sizeof_rnode);
} /* end if */
- if (bt)
- (void)H5B_dest(f,bt);
- }
+ if(bt)
+ (void)H5B_dest(f, bt);
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_create() */ /*lint !e818 Can't make udata a pointer to const */
@@ -298,9 +285,6 @@ done:
* matzke@llnl.gov
* Jun 23 1997
*
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
htri_t
@@ -329,7 +313,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u
* the thing for which we're searching.
*/
if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
@@ -349,7 +333,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u
/*
* Follow the link to the subtree or to the data node.
*/
- assert(idx < bt->nchildren);
+ HDassert(idx < bt->nchildren);
if(bt->level > 0) {
if((ret_value = H5B_find(f, dxpl_id, type, bt->child[idx], udata)) < 0)
@@ -362,7 +346,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u
done:
if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node")
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_find() */
@@ -388,20 +372,6 @@ done:
* matzke@llnl.gov
* Jul 3 1997
*
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The OLD_ADDR argument is passed by value. The NEW_ADDR
- * argument has been renamed to NEW_ADDR_P
- *
- * John Mainzer, 6/9/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- * In this case, that required adding the new
- * old_bt_dirtied_ptr parameter to the function's argument
- * list.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -421,39 +391,38 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags,
/*
* Check arguments.
*/
- assert(f);
- assert(old_bt);
- assert(old_bt_flags);
- assert(H5F_addr_defined(old_addr));
+ HDassert(f);
+ HDassert(old_bt);
+ HDassert(old_bt_flags);
+ HDassert(H5F_addr_defined(old_addr));
/*
* Initialize variables.
*/
- shared=(H5B_shared_t *)H5RC_GET_OBJ(old_bt->rc_shared);
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(old_bt->rc_shared);
HDassert(shared);
- assert(old_bt->nchildren == shared->two_k);
+ HDassert(old_bt->nchildren == shared->two_k);
/* Get the dataset transfer property list */
- if (NULL == (dx_plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
+ if(NULL == (dx_plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/* Get B-tree split ratios */
- if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &split_ratios[0])<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios")
+ if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &split_ratios[0]) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree split ratios")
#ifdef H5B_DEBUG
- if (H5DEBUG(B)) {
+ if(H5DEBUG(B)) {
const char *side;
- if (!H5F_addr_defined(old_bt->left) &&
- !H5F_addr_defined(old_bt->right)) {
+
+ if(!H5F_addr_defined(old_bt->left) && !H5F_addr_defined(old_bt->right))
side = "ONLY";
- } else if (!H5F_addr_defined(old_bt->right)) {
+ else if(!H5F_addr_defined(old_bt->right))
side = "RIGHT";
- } else if (!H5F_addr_defined(old_bt->left)) {
+ else if(!H5F_addr_defined(old_bt->left))
side = "LEFT";
- } else {
+ else
side = "MIDDLE";
- }
fprintf(H5DEBUG(B), "H5B_split: %3u {%5.3f,%5.3f,%5.3f} %6s",
shared->two_k, split_ratios[0], split_ratios[1], split_ratios[2], side);
}
@@ -463,37 +432,35 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags,
* Decide how to split the children of the old node among the old node
* and the new node.
*/
- if (!H5F_addr_defined(old_bt->right)) {
+ if(!H5F_addr_defined(old_bt->right))
nleft = (unsigned)((double)shared->two_k * split_ratios[2]); /*right*/
- } else if (!H5F_addr_defined(old_bt->left)) {
+ else if(!H5F_addr_defined(old_bt->left))
nleft = (unsigned)((double)shared->two_k * split_ratios[0]); /*left*/
- } else {
+ else
nleft = (unsigned)((double)shared->two_k * split_ratios[1]); /*middle*/
- }
/*
* Keep the new child in the same node as the child that split. This can
* result in nodes that have an unused child when data is written
* sequentially, but it simplifies stuff below.
*/
- if (idx<nleft && nleft==shared->two_k) {
+ if(idx < nleft && nleft == shared->two_k)
--nleft;
- } else if (idx>=nleft && 0==nleft) {
+ else if(idx >= nleft && 0 == nleft)
nleft++;
- }
nright = shared->two_k - nleft;
#ifdef H5B_DEBUG
- if (H5DEBUG(B))
+ if(H5DEBUG(B))
fprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright);
#endif
/*
* Create the new B-tree node.
*/
- if (H5B_create(f, dxpl_id, shared->type, udata, new_addr_p/*out*/) < 0)
+ if(H5B_create(f, dxpl_id, shared->type, udata, new_addr_p/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree")
- if (NULL==(new_bt=(H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, shared->type, udata, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to protect B-tree")
+ if(NULL == (new_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, shared->type, udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree")
new_bt->level = old_bt->level;
/*
@@ -510,10 +477,10 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags,
new_bt_flags |= H5AC__DIRTIED_FLAG;
HDmemcpy(new_bt->native,
old_bt->native + nleft * shared->type->sizeof_nkey,
- (nright+1) * shared->type->sizeof_nkey);
+ (nright + 1) * shared->type->sizeof_nkey);
HDmemcpy(new_bt->child,
&old_bt->child[nleft],
- nright*sizeof(haddr_t));
+ nright * sizeof(haddr_t));
new_bt->nchildren = nright;
@@ -529,25 +496,23 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags,
new_bt->left = old_addr;
new_bt->right = old_bt->right;
- if (H5F_addr_defined(old_bt->right)) {
+ if(H5F_addr_defined(old_bt->right)) {
H5B_t *tmp_bt;
- if (NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, shared->type, udata, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load right sibling")
+ if(NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, shared->type, udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load right sibling")
tmp_bt->left = *new_addr_p;
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT, old_bt->right, tmp_bt,
- H5AC__DIRTIED_FLAG) != SUCCEED)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
- }
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, old_bt->right, tmp_bt, H5AC__DIRTIED_FLAG) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
+ } /* end if */
old_bt->right = *new_addr_p;
done:
- if (new_bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_addr_p, new_bt,
- new_bt_flags) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
+ if(new_bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_addr_p, new_bt, new_bt_flags) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_split() */
@@ -565,25 +530,6 @@ done:
* matzke@llnl.gov
* Jun 23 1997
*
- * Modifications:
- * Robb Matzke, 28 Sep 1998
- * The optional SPLIT_RATIOS[] indicates what percent of the child
- * pointers should go in the left node when a node splits. There are
- * three possibilities and a separate split ratio can be specified for
- * each: [0] The node that split is the left-most node at its level of
- * the tree, [1] the node that split has left and right siblings, [2]
- * the node that split is the right-most node at its level of the tree.
- * When a node is an only node at its level then we use the right-most
- * rule. If SPLIT_RATIOS is null then default values are used.
- *
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
- *
- * John Mainzer, 6/9/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -610,42 +556,42 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
FUNC_ENTER_NOAPI(H5B_insert, FAIL)
/* Check arguments. */
- assert(f);
- assert(type);
- assert(type->sizeof_nkey <= sizeof _lt_key);
- assert(H5F_addr_defined(addr));
+ HDassert(f);
+ HDassert(type);
+ HDassert(type->sizeof_nkey <= sizeof _lt_key);
+ HDassert(H5F_addr_defined(addr));
- if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, addr, type, lt_key,
- &lt_key_changed, md_key, udata, rt_key, &rt_key_changed, &child/*out*/))<0)
+ if((int)(my_ins = H5B_insert_helper(f, dxpl_id, addr, type, lt_key,
+ &lt_key_changed, md_key, udata, rt_key, &rt_key_changed, &child/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key")
- if (H5B_INS_NOOP == my_ins)
+ if(H5B_INS_NOOP == my_ins)
HGOTO_DONE(SUCCEED)
- assert(H5B_INS_RIGHT == my_ins);
+ HDassert(H5B_INS_RIGHT == my_ins);
/* the current root */
- if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to locate root of B-tree")
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to locate root of B-tree")
shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
level = bt->level;
- if (!lt_key_changed)
+ if(!lt_key_changed)
HDmemcpy(lt_key, H5B_NKEY(bt,shared,0), type->sizeof_nkey);
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) != SUCCEED)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child")
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child")
bt = NULL;
/* the new node */
- if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new node")
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_READ)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new node")
- if (!rt_key_changed)
+ if(!rt_key_changed)
HDmemcpy(rt_key, H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey);
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__NO_FLAGS_SET) != SUCCEED)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child")
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child")
bt = NULL;
/*
@@ -654,46 +600,46 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
* from "moving".
*/
H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t);
- if (HADDR_UNDEF==(old_root=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file space to move root")
+ if(HADDR_UNDEF == (old_root = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)shared->sizeof_rnode)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move root")
/* update the new child's left pointer */
- if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child")
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new child")
bt->left = old_root;
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__DIRTIED_FLAG) != SUCCEED)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child")
- bt=NULL; /* Make certain future references will be caught */
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__DIRTIED_FLAG) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child")
+ bt = NULL; /* Make certain future references will be caught */
/*
* Move the node to the new location by checking it out & checking it in
* at the new location -QAK
*/
/* Bring the old root into the cache if it's not already */
- if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child")
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load new child")
/* Make certain the old root info is marked as dirty before moving it, */
/* so it is certain to be written out at the new location */
/* Make a copy of the old root information */
- if (NULL == (new_bt = H5B_copy(bt))) {
- HCOMMON_ERROR(H5E_BTREE, H5E_CANTLOAD, "unable to copy old root");
+ if(NULL == (new_bt = H5B_copy(bt))) {
+ HCOMMON_ERROR(H5E_BTREE, H5E_CANTCOPY, "unable to copy old root");
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) != SUCCEED)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child")
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child")
HGOTO_DONE(FAIL)
- }
+ } /* end if */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) != SUCCEED)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child")
- bt=NULL; /* Make certain future references will be caught */
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release new child")
+ bt = NULL; /* Make certain future references will be caught */
/* Move the location of the old root on the disk */
- if (H5AC_rename(f, H5AC_BT, addr, old_root) < 0)
+ if(H5AC_rename(f, H5AC_BT, addr, old_root) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node")
/* clear the old root info at the old address (we already copied it) */
@@ -738,18 +684,6 @@ done:
* matzke@llnl.gov
* Jul 8 1997
*
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The CHILD argument is passed by value.
- *
- * John Mainzer, 6/9/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- * In this case, that required adding the new dirtied_ptr
- * parameter to the function's argument list.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -761,28 +695,28 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B_insert_child)
- assert(bt);
- assert(bt_flags);
- shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
+ HDassert(bt);
+ HDassert(bt_flags);
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
- assert(bt->nchildren<shared->two_k);
+ HDassert(bt->nchildren < shared->two_k);
/* Check for inserting right-most key into node (common when just appending
* records to an unlimited dimension chunked dataset)
*/
- base=H5B_NKEY(bt,shared,(idx+1));
- if((idx+1)==bt->nchildren) {
+ base = H5B_NKEY(bt, shared, (idx + 1));
+ if((idx + 1) == bt->nchildren) {
/* Make room for the new key */
HDmemcpy(base + shared->type->sizeof_nkey, base,
shared->type->sizeof_nkey); /* No overlap possible - memcpy() OK */
HDmemcpy(base, md_key, shared->type->sizeof_nkey);
/* The MD_KEY is the left key of the new node */
- if (H5B_INS_RIGHT == anchor)
+ if(H5B_INS_RIGHT == anchor)
idx++; /* Don't have to memmove() child addresses down, just add new child */
else
/* Make room for the new child address */
- bt->child[idx+1] = bt->child[idx];
+ bt->child[idx + 1] = bt->child[idx];
} /* end if */
else {
/* Make room for the new key */
@@ -791,7 +725,7 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
HDmemcpy(base, md_key, shared->type->sizeof_nkey);
/* The MD_KEY is the left key of the new node */
- if (H5B_INS_RIGHT == anchor)
+ if(H5B_INS_RIGHT == anchor)
idx++;
/* Make room for the new child address */
@@ -838,27 +772,6 @@ H5B_insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
* matzke@llnl.gov
* Jul 9 1997
*
- * Modifications:
- *
- * Robb Matzke, 28 Sep 1998
- * The optional SPLIT_RATIOS[] indicates what percent of the child
- * pointers should go in the left node when a node splits. There are
- * three possibilities and a separate split ratio can be specified for
- * each: [0] The node that split is the left-most node at its level of
- * the tree, [1] the node that split has left and right siblings, [2]
- * the node that split is the right-most node at its level of the tree.
- * When a node is an only node at its level then we use the right-most
- * rule. If SPLIT_RATIOS is null then default values are used.
- *
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value. The NEW_NODE argument is
- * renamed NEW_NODE_P
- *
- * John Mainzer, 6/9/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
static H5B_ins_t
@@ -882,17 +795,17 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
/*
* Check arguments
*/
- assert(f);
- assert(H5F_addr_defined(addr));
- assert(type);
- assert(type->decode);
- assert(type->cmp3);
- assert(type->new_node);
- assert(lt_key);
- assert(lt_key_changed);
- assert(rt_key);
- assert(rt_key_changed);
- assert(new_node_p);
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(type);
+ HDassert(type->decode);
+ HDassert(type->cmp3);
+ HDassert(type->new_node);
+ HDassert(lt_key);
+ HDassert(lt_key_changed);
+ HDassert(rt_key);
+ HDassert(rt_key_changed);
+ HDassert(new_node_p);
*lt_key_changed = FALSE;
*rt_key_changed = FALSE;
@@ -902,65 +815,62 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* data. When the search completes IDX points to the child that
* should get the new data.
*/
- if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node")
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node")
shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
rt = bt->nchildren;
- while (lt < rt && cmp) {
+ while(lt < rt && cmp) {
idx = (lt + rt) / 2;
- if ((cmp = (type->cmp3) (f, dxpl_id, H5B_NKEY(bt,shared,idx), udata,
- H5B_NKEY(bt,shared,idx+1))) < 0) {
+ if((cmp = (type->cmp3)(f, dxpl_id, H5B_NKEY(bt, shared, idx), udata, H5B_NKEY(bt, shared, idx + 1))) < 0)
rt = idx;
- } else {
+ else
lt = idx + 1;
- }
- }
+ } /* end while */
- if (0 == bt->nchildren) {
+ if(0 == bt->nchildren) {
/*
* The value being inserted will be the only value in this tree. We
* must necessarily be at level zero.
*/
- assert(0 == bt->level);
- if ((type->new_node)(f, dxpl_id, H5B_INS_FIRST, H5B_NKEY(bt,shared,0), udata,
- H5B_NKEY(bt,shared,1), bt->child + 0/*out*/) < 0)
+ HDassert(0 == bt->level);
+ if((type->new_node)(f, dxpl_id, H5B_INS_FIRST, H5B_NKEY(bt, shared, 0), udata,
+ H5B_NKEY(bt, shared, 1), bt->child + 0/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR, "unable to create leaf node")
bt->nchildren = 1;
bt_flags |= H5AC__DIRTIED_FLAG;
idx = 0;
- if (type->follow_min) {
- if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx),
- lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1),
+ if(type->follow_min) {
+ if((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt, shared, idx),
+ lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1),
rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert first leaf node")
- } else {
+ } /* end if */
+ else
my_ins = H5B_INS_NOOP;
- }
-
- } else if (cmp < 0 && idx == 0 && bt->level > 0) {
+ } else if(cmp < 0 && idx == 0 && bt->level > 0) {
/*
* The value being inserted is less than any value in this tree.
* Follow the minimum branch out of this node to a subtree.
*/
- if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
+ if((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
H5B_NKEY(bt,shared,idx), lt_key_changed, md_key,
- udata, H5B_NKEY(bt,shared,idx+1), rt_key_changed,
- &child_addr/*out*/))<0)
+ udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed,
+ &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum subtree")
- } else if (cmp < 0 && idx == 0 && type->follow_min) {
+ } else if(cmp < 0 && idx == 0 && type->follow_min) {
/*
* The value being inserted is less than any leaf node out of this
* current node. Follow the minimum branch to a leaf node and let the
* subclass handle the problem.
*/
- if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx),
- lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1),
+ if((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt, shared, idx),
+ lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1),
rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node")
- } else if (cmp < 0 && idx == 0) {
+ } else if(cmp < 0 && idx == 0) {
/*
* The value being inserted is less than any leaf node out of the
* current node. Create a new minimum leaf node out of this B-tree
@@ -968,33 +878,32 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
*/
my_ins = H5B_INS_LEFT;
HDmemcpy(md_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey);
- if ((type->new_node)(f, dxpl_id, H5B_INS_LEFT, H5B_NKEY(bt,shared,idx), udata,
- md_key, &child_addr/*out*/) < 0)
+ if((type->new_node)(f, dxpl_id, H5B_INS_LEFT, H5B_NKEY(bt, shared, idx), udata,
+ md_key, &child_addr/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node")
*lt_key_changed = TRUE;
-
- } else if (cmp > 0 && idx + 1 >= bt->nchildren && bt->level > 0) {
+ } else if(cmp > 0 && idx + 1 >= bt->nchildren && bt->level > 0) {
/*
* The value being inserted is larger than any value in this tree.
* Follow the maximum branch out of this node to a subtree.
*/
idx = bt->nchildren - 1;
- if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
- H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata,
- H5B_NKEY(bt,shared,idx+1), rt_key_changed, &child_addr/*out*/)) < 0)
+ if((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
+ H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata,
+ H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum subtree")
- } else if (cmp > 0 && idx + 1 >= bt->nchildren && type->follow_max) {
+ } else if(cmp > 0 && idx + 1 >= bt->nchildren && type->follow_max) {
/*
* The value being inserted is larger than any leaf node out of the
* current node. Follow the maximum branch to a leaf node and let the
* subclass handle the problem.
*/
idx = bt->nchildren - 1;
- if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx),
- lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1),
+ if((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt, shared, idx),
+ lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1),
rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node")
- } else if (cmp > 0 && idx + 1 >= bt->nchildren) {
+ } else if(cmp > 0 && idx + 1 >= bt->nchildren) {
/*
* The value being inserted is larger than any leaf node out of the
* current node. Create a new maximum leaf node out of this B-tree
@@ -1002,80 +911,78 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
*/
idx = bt->nchildren - 1;
my_ins = H5B_INS_RIGHT;
- HDmemcpy(md_key, H5B_NKEY(bt,shared,idx+1), type->sizeof_nkey);
- if ((type->new_node)(f, dxpl_id, H5B_INS_RIGHT, md_key, udata,
- H5B_NKEY(bt,shared,idx+1), &child_addr/*out*/) < 0)
+ HDmemcpy(md_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
+ if((type->new_node)(f, dxpl_id, H5B_INS_RIGHT, md_key, udata,
+ H5B_NKEY(bt, shared, idx + 1), &child_addr/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node")
*rt_key_changed = TRUE;
-
- } else if (cmp) {
+ } else if(cmp) {
/*
* We couldn't figure out which branch to follow out of this node. THIS
* IS A MAJOR PROBLEM THAT NEEDS TO BE FIXED --rpm.
*/
- assert("INTERNAL HDF5 ERROR (contact rpm)" && 0);
+ HDassert("INTERNAL HDF5 ERROR (contact rpm)" && 0);
#ifdef NDEBUG
HDabort();
#endif /* NDEBUG */
- } else if (bt->level > 0) {
+ } else if(bt->level > 0) {
/*
* Follow a branch out of this node to another subtree.
*/
- assert(idx < bt->nchildren);
- if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
- H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata,
- H5B_NKEY(bt,shared,idx+1), rt_key_changed, &child_addr/*out*/)) < 0)
+ HDassert(idx < bt->nchildren);
+ if((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
+ H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata,
+ H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert subtree")
} else {
/*
* Follow a branch out of this node to a leaf node of some other type.
*/
- assert(idx < bt->nchildren);
- if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx),
- lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1),
+ HDassert(idx < bt->nchildren);
+ if((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt, shared, idx),
+ lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1),
rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert leaf node")
}
- assert((int)my_ins >= 0);
+ HDassert((int)my_ins >= 0);
/*
* Update the left and right keys of the current node.
*/
- if (*lt_key_changed) {
+ if(*lt_key_changed) {
bt_flags |= H5AC__DIRTIED_FLAG;
- if (idx > 0)
+ if(idx > 0)
*lt_key_changed = FALSE;
else
- HDmemcpy(lt_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey);
- }
- if (*rt_key_changed) {
+ HDmemcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
+ } /* end if */
+ if(*rt_key_changed) {
bt_flags |= H5AC__DIRTIED_FLAG;
- if (idx+1 < bt->nchildren)
+ if(idx + 1 < bt->nchildren)
*rt_key_changed = FALSE;
else
- HDmemcpy(rt_key, H5B_NKEY(bt,shared,idx+1), type->sizeof_nkey);
- }
- if (H5B_INS_CHANGE == my_ins) {
+ HDmemcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
+ } /* end if */
+ if(H5B_INS_CHANGE == my_ins) {
/*
* The insertion simply changed the address for the child.
*/
bt->child[idx] = child_addr;
bt_flags |= H5AC__DIRTIED_FLAG;
ret_value = H5B_INS_NOOP;
-
- } else if (H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins) {
+ } else if(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins) {
hbool_t *tmp_bt_flags_ptr = NULL;
H5B_t *tmp_bt;
/*
* If this node is full then split it before inserting the new child.
*/
- if (bt->nchildren == shared->two_k) {
- if (H5B_split(f, dxpl_id, bt, &bt_flags, addr, idx, udata, new_node_p/*out*/)<0)
+ if(bt->nchildren == shared->two_k) {
+ if(H5B_split(f, dxpl_id, bt, &bt_flags, addr, idx, udata, new_node_p/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, "unable to split node")
- if (NULL == (twin = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, type, udata, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node")
- if (idx<bt->nchildren) {
+ if(NULL == (twin = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, type, udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node")
+ if(idx < bt->nchildren) {
tmp_bt = bt;
tmp_bt_flags_ptr = &bt_flags;
} else {
@@ -1083,13 +990,14 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
tmp_bt = twin;
tmp_bt_flags_ptr = &twin_flags;
}
- } else {
+ } /* end if */
+ else {
tmp_bt = bt;
tmp_bt_flags_ptr = &bt_flags;
- }
+ } /* end else */
/* Insert the child */
- if (H5B_insert_child(tmp_bt, tmp_bt_flags_ptr, idx, child_addr, my_ins, md_key) < 0)
+ if(H5B_insert_child(tmp_bt, tmp_bt_flags_ptr, idx, child_addr, my_ins, md_key) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert child")
}
@@ -1097,30 +1005,28 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* If this node split, return the mid key (the one that is shared
* by the left and right node).
*/
- if (twin) {
- HDmemcpy(md_key, H5B_NKEY(twin,shared,0), type->sizeof_nkey);
+ if(twin) {
+ HDmemcpy(md_key, H5B_NKEY(twin, shared, 0), type->sizeof_nkey);
ret_value = H5B_INS_RIGHT;
#ifdef H5B_DEBUG
/*
* The max key in the original left node must be equal to the min key
* in the new node.
*/
- cmp = (type->cmp2) (f, dxpl_id, H5B_NKEY(bt,shared,bt->nchildren), udata,
- H5B_NKEY(twin,shared,0));
- assert(0 == cmp);
+ cmp = (type->cmp2)(f, dxpl_id, H5B_NKEY(bt, shared, bt->nchildren), udata,
+ H5B_NKEY(twin, shared, 0));
+ HDassert(0 == cmp);
#endif
- } else {
+ } /* end if */
+ else
ret_value = H5B_INS_NOOP;
- }
done:
{
- herr_t e1 = (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt,
- bt_flags) < 0);
- herr_t e2 = (twin && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_node_p,
- twin, twin_flags)<0);
- if (e1 || e2) /*use vars to prevent short-circuit of side effects */
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node(s)")
+ herr_t e1 = (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) < 0);
+ herr_t e2 = (twin && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_node_p, twin, twin_flags) < 0);
+ if(e1 || e2) /*use vars to prevent short-circuit of side effects */
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node(s)")
}
FUNC_LEAVE_NOAPI(ret_value)
@@ -1163,14 +1069,14 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add
/* Protect the initial/current node */
if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load B-tree node")
if(bt->level > 0) {
haddr_t left_child = bt->child[0]; /* Address of left-most child in node */
/* Release current node */
if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5_ITER_ERROR, "unable to release B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release B-tree node")
bt = NULL;
/* Keep following the left-most child until we reach a leaf node. */
@@ -1188,9 +1094,9 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add
/* Allocate space for a copy of the native records & child pointers */
if(NULL == (native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)))
- HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for shared B-tree native records")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, H5_ITER_ERROR, "memory allocation failed for shared B-tree native records")
if(NULL == (child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k)))
- HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed for shared B-tree child addresses")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, H5_ITER_ERROR, "memory allocation failed for shared B-tree child addresses")
/* Cache information from this node */
nchildren = bt->nchildren;
@@ -1202,7 +1108,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add
/* Release current node */
if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5_ITER_ERROR, "unable to release B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release B-tree node")
bt = NULL;
/*
@@ -1232,7 +1138,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add
/* Protect the next node to the right */
addr = next_addr;
if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5_ITER_ERROR, "B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5_ITER_ERROR, "B-tree node")
/* Cache information from this node */
nchildren = bt->nchildren;
@@ -1244,7 +1150,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add
/* Unprotect node */
if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5_ITER_ERROR, "unable to release B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release B-tree node")
bt = NULL;
} /* end if */
else
@@ -1256,7 +1162,7 @@ H5B_iterate_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t add
done:
if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5_ITER_ERROR, "unable to release B-tree node")
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release B-tree node")
if(native)
(void)H5FL_BLK_FREE(native_block, native);
if(child)
@@ -1327,15 +1233,6 @@ H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
* Programmer: Robb Matzke
* Wednesday, September 16, 1998
*
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
- *
- * John Mainzer, 6/10/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
static H5B_ins_t
@@ -1346,65 +1243,63 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
{
H5B_t *bt = NULL, *sibling = NULL;
unsigned bt_flags = H5AC__NO_FLAGS_SET;
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
- unsigned idx=0, lt=0, rt; /* Final, left & right indices */
- int cmp=1; /* Key comparison value */
+ H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ unsigned idx = 0, lt = 0, rt; /* Final, left & right indices */
+ int cmp = 1; /* Key comparison value */
H5B_ins_t ret_value = H5B_INS_ERROR;
FUNC_ENTER_NOAPI(H5B_remove_helper, H5B_INS_ERROR)
- assert(f);
- assert(H5F_addr_defined(addr));
- assert(type);
- assert(type->decode);
- assert(type->cmp3);
- assert(lt_key && lt_key_changed);
- assert(udata);
- assert(rt_key && rt_key_changed);
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(type);
+ HDassert(type->decode);
+ HDassert(type->cmp3);
+ HDassert(lt_key && lt_key_changed);
+ HDassert(udata);
+ HDassert(rt_key && rt_key_changed);
/*
* Perform a binary search to locate the child which contains the thing
* for which we're searching.
*/
- if (NULL==(bt=(H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load B-tree node")
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load B-tree node")
shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
rt = bt->nchildren;
- while (lt<rt && cmp) {
- idx = (lt+rt)/2;
- if ((cmp=(type->cmp3)(f, dxpl_id, H5B_NKEY(bt,shared,idx), udata,
- H5B_NKEY(bt,shared,idx+1)))<0) {
+ while(lt < rt && cmp) {
+ idx = (lt + rt) / 2;
+ if((cmp = (type->cmp3)(f, dxpl_id, H5B_NKEY(bt, shared, idx), udata, H5B_NKEY(bt, shared, idx + 1))) < 0)
rt = idx;
- } else {
- lt = idx+1;
- }
- }
- if (cmp)
+ else
+ lt = idx + 1;
+ } /* end while */
+ if(cmp)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "B-tree key not found")
/*
* Follow the link to the subtree or to the data node. The return value
* will be one of H5B_INS_ERROR, H5B_INS_NOOP, or H5B_INS_REMOVE.
*/
- assert(idx<bt->nchildren);
- if (bt->level>0) {
+ HDassert(idx < bt->nchildren);
+ if(bt->level > 0) {
/* We're at an internal node -- call recursively */
- if ((int)(ret_value=H5B_remove_helper(f, dxpl_id,
- bt->child[idx], type, level+1, H5B_NKEY(bt,shared,idx)/*out*/,
- lt_key_changed/*out*/, udata, H5B_NKEY(bt,shared,idx+1)/*out*/,
- rt_key_changed/*out*/))<0)
+ if((int)(ret_value = H5B_remove_helper(f, dxpl_id,
+ bt->child[idx], type, level + 1, H5B_NKEY(bt, shared, idx)/*out*/,
+ lt_key_changed/*out*/, udata, H5B_NKEY(bt, shared, idx + 1)/*out*/,
+ rt_key_changed/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in subtree")
- } else if (type->remove) {
+ } else if(type->remove) {
/*
* We're at a leaf node but the leaf node points to an object that
* has a removal method. Pass the removal request to the pointed-to
* object and let it decide how to progress.
*/
- if ((int)(ret_value=(type->remove)(f, dxpl_id,
- bt->child[idx], H5B_NKEY(bt,shared,idx), lt_key_changed, udata,
- H5B_NKEY(bt,shared,idx+1), rt_key_changed))<0)
+ if((int)(ret_value = (type->remove)(f, dxpl_id,
+ bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed, udata,
+ H5B_NKEY(bt, shared, idx + 1), rt_key_changed)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in leaf node")
} else {
/*
@@ -1425,49 +1320,49 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* key changed and it's the right most key of this node we must update
* our right key and indicate that it changed.
*/
- if (*lt_key_changed) {
+ if(*lt_key_changed) {
bt_flags |= H5AC__DIRTIED_FLAG;
- if (idx>0)
+ if(idx > 0)
/* Don't propagate change out of this B-tree node */
*lt_key_changed = FALSE;
else
- HDmemcpy(lt_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey);
- }
- if (*rt_key_changed) {
+ HDmemcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
+ } /* end if */
+ if(*rt_key_changed) {
bt_flags |= H5AC__DIRTIED_FLAG;
- if (idx+1<bt->nchildren) {
+ if(idx + 1 < bt->nchildren) {
/* Don't propagate change out of this B-tree node */
*rt_key_changed = FALSE;
- } else {
- HDmemcpy(rt_key, H5B_NKEY(bt,shared,idx+1), type->sizeof_nkey);
+ } /* end if */
+ else {
+ HDmemcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
/* Since our right key was changed, we must check for a right
* sibling and change it's left-most key as well.
* (Handle the ret_value==H5B_INS_REMOVE case below)
*/
- if (ret_value!=H5B_INS_REMOVE && level>0) {
- if (H5F_addr_defined(bt->right)) {
- if (NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree")
+ if(ret_value != H5B_INS_REMOVE && level > 0) {
+ if(H5F_addr_defined(bt->right)) {
+ if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to unlink node from tree")
/* Make certain the native key for the right sibling is set up */
- HDmemcpy(H5B_NKEY(sibling,shared,0), H5B_NKEY(bt,shared,idx+1), type->sizeof_nkey);
-
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling,
- H5AC__DIRTIED_FLAG) != SUCCEED)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree")
- sibling=NULL; /* Make certain future references will be caught */
- }
- }
- }
- }
+ HDmemcpy(H5B_NKEY(sibling, shared, 0), H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
+
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree")
+ sibling = NULL; /* Make certain future references will be caught */
+ } /* end if */
+ } /* end if */
+ } /* end else */
+ } /* end if */
/*
* If the subtree returned H5B_INS_REMOVE then we should remove the
* subtree entry from the current node. There are four cases:
*/
- if (H5B_INS_REMOVE==ret_value && 1==bt->nchildren) {
+ if(H5B_INS_REMOVE == ret_value && 1 == bt->nchildren) {
/*
* The subtree is the only child of this node. Discard both
* keys and the subtree pointer. Free this node (unless it's the
@@ -1475,44 +1370,42 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
*/
bt_flags |= H5AC__DIRTIED_FLAG;
bt->nchildren = 0;
- if (level>0) {
- if (H5F_addr_defined(bt->left)) {
- if (NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->left, type, udata, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node from tree")
+ if(level > 0) {
+ if(H5F_addr_defined(bt->left)) {
+ if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->left, type, udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node from tree")
sibling->right = bt->right;
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->left, sibling,
- H5AC__DIRTIED_FLAG) != SUCCEED)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree")
- sibling=NULL; /* Make certain future references will be caught */
- }
- if (H5F_addr_defined(bt->right)) {
- if (NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree")
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->left, sibling, H5AC__DIRTIED_FLAG) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree")
+ sibling = NULL; /* Make certain future references will be caught */
+ } /* end if */
+ if(H5F_addr_defined(bt->right)) {
+ if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to unlink node from tree")
/* Copy left-most key from deleted node to left-most key in it's right neighbor */
- HDmemcpy(H5B_NKEY(sibling,shared,0), H5B_NKEY(bt,shared,0), type->sizeof_nkey);
+ HDmemcpy(H5B_NKEY(sibling, shared, 0), H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
sibling->left = bt->left;
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling,
- H5AC__DIRTIED_FLAG) != SUCCEED)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree")
- sibling=NULL; /* Make certain future references will be caught */
- }
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree")
+ sibling = NULL; /* Make certain future references will be caught */
+ } /* end if */
bt->left = HADDR_UNDEF;
bt->right = HADDR_UNDEF;
- H5_CHECK_OVERFLOW(shared->sizeof_rnode,size_t,hsize_t);
+ H5_CHECK_OVERFLOW(shared->sizeof_rnode, size_t, hsize_t);
if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) {
bt = NULL;
bt_flags = H5AC__NO_FLAGS_SET;
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to free B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to free B-tree node")
} /* end if */
bt = NULL;
bt_flags = H5AC__NO_FLAGS_SET;
} /* end if */
- } else if (H5B_INS_REMOVE==ret_value && 0==idx) {
+ } else if(H5B_INS_REMOVE == ret_value && 0 == idx) {
/*
* The subtree is the left-most child of this node. We discard the
* left-most key and the left-most child (the child has already been
@@ -1525,15 +1418,14 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
HDmemmove(bt->native,
bt->native + type->sizeof_nkey,
- (bt->nchildren+1) * type->sizeof_nkey);
+ (bt->nchildren + 1) * type->sizeof_nkey);
HDmemmove(bt->child,
- bt->child+1,
+ bt->child + 1,
bt->nchildren * sizeof(haddr_t));
- HDmemcpy(lt_key, H5B_NKEY(bt,shared,0), type->sizeof_nkey);
+ HDmemcpy(lt_key, H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
*lt_key_changed = TRUE;
ret_value = H5B_INS_NOOP;
-
- } else if (H5B_INS_REMOVE==ret_value && idx+1==bt->nchildren) {
+ } else if(H5B_INS_REMOVE == ret_value && idx + 1 == bt->nchildren) {
/*
* The subtree is the right-most child of this node. We discard the
* right-most key and the right-most child (the child has already been
@@ -1542,30 +1434,28 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
*/
bt_flags |= H5AC__DIRTIED_FLAG;
bt->nchildren -= 1;
- HDmemcpy(rt_key, H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey);
+ HDmemcpy(rt_key, H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey);
*rt_key_changed = TRUE;
/* Since our right key was changed, we must check for a right
* sibling and change it's left-most key as well.
* (Handle the ret_value==H5B_INS_REMOVE case below)
*/
- if (level>0) {
- if (H5F_addr_defined(bt->right)) {
- if (NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree")
+ if(level > 0) {
+ if(H5F_addr_defined(bt->right)) {
+ if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to unlink node from tree")
- HDmemcpy(H5B_NKEY(sibling,shared,0), H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey);
+ HDmemcpy(H5B_NKEY(sibling, shared, 0), H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey);
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling,
- H5AC__DIRTIED_FLAG) != SUCCEED)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree")
- sibling=NULL; /* Make certain future references will be caught */
- }
- }
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree")
+ sibling = NULL; /* Make certain future references will be caught */
+ } /* end if */
+ } /* end if */
ret_value = H5B_INS_NOOP;
-
- } else if (H5B_INS_REMOVE==ret_value) {
+ } else if(H5B_INS_REMOVE == ret_value) {
/*
* There are subtrees out of this node to both the left and right of
* the subtree being removed. The key to the left of the subtree and
@@ -1577,20 +1467,18 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
bt->nchildren -= 1;
HDmemmove(bt->native + idx * type->sizeof_nkey,
- bt->native + (idx+1) * type->sizeof_nkey,
- (bt->nchildren+1-idx) * type->sizeof_nkey);
- HDmemmove(bt->child+idx,
- bt->child+idx+1,
- (bt->nchildren-idx) * sizeof(haddr_t));
+ bt->native + (idx + 1) * type->sizeof_nkey,
+ (bt->nchildren + 1 - idx) * type->sizeof_nkey);
+ HDmemmove(bt->child + idx,
+ bt->child + idx + 1,
+ (bt->nchildren - idx) * sizeof(haddr_t));
ret_value = H5B_INS_NOOP;
-
- } else {
+ } else
ret_value = H5B_INS_NOOP;
- }
done:
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags)<0)
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node")
+ if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node")
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -1610,15 +1498,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, September 16, 1998
*
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
- *
- * John Mainzer, 6/8/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1637,31 +1516,31 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void
FUNC_ENTER_NOAPI(H5B_remove, FAIL)
/* Check args */
- assert(f);
- assert(type);
- assert(type->sizeof_nkey <= sizeof _lt_key);
- assert(H5F_addr_defined(addr));
+ HDassert(f);
+ HDassert(type);
+ HDassert(type->sizeof_nkey <= sizeof _lt_key);
+ HDassert(H5F_addr_defined(addr));
/* The actual removal */
- if (H5B_remove_helper(f, dxpl_id, addr, type, 0, lt_key, &lt_key_changed,
- udata, rt_key, &rt_key_changed)==H5B_INS_ERROR)
+ if(H5B_remove_helper(f, dxpl_id, addr, type, 0, lt_key, &lt_key_changed,
+ udata, rt_key, &rt_key_changed) == H5B_INS_ERROR)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to remove entry from B-tree")
/*
* If the B-tree is now empty then make sure we mark the root node as
* being at level zero
*/
- if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree root node")
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree root node")
- if (0==bt->nchildren && 0!=bt->level) {
+ if(0 == bt->nchildren && 0 != bt->level) {
bt->level = 0;
bt_flags |= H5AC__DIRTIED_FLAG;
- }
+ } /* end if */
- if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) != SUCCEED)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node")
- bt=NULL; /* Make certain future references will be caught */
+ if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release node")
+ bt = NULL; /* Make certain future references will be caught */
#ifdef H5B_DEBUG
H5B_assert(f, dxpl_id, addr, type, udata);
@@ -1682,62 +1561,56 @@ done:
* Programmer: Quincey Koziol
* Thursday, March 20, 2003
*
- * Modifications:
- *
- * John Mainzer, 6/10/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *udata)
{
- H5B_t *bt; /* B-tree node being operated on */
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_t *bt = NULL; /* B-tree node being operated on */
+ H5B_shared_t *shared; /* Pointer to shared B-tree info */
unsigned u; /* Local index variable */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B_delete, FAIL)
/* Check args */
- assert(f);
- assert(type);
- assert(H5F_addr_defined(addr));
+ HDassert(f);
+ HDassert(type);
+ HDassert(H5F_addr_defined(addr));
/* Lock this B-tree node into memory for now */
- if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
/* Iterate over all children in tree, deleting them */
- if (bt->level > 0) {
+ if(bt->level > 0) {
/* Iterate over all children in node, deleting them */
- for (u=0; u<bt->nchildren; u++)
- if (H5B_delete(f, dxpl_id, type, bt->child[u], udata)<0)
+ for(u = 0; u < bt->nchildren; u++)
+ if(H5B_delete(f, dxpl_id, type, bt->child[u], udata) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "unable to delete B-tree node")
- } else {
+ } /* end if */
+ else {
hbool_t lt_key_changed, rt_key_changed; /* Whether key changed (unused here, just for callback) */
/* Check for removal callback */
if(type->remove) {
/* Iterate over all entries in node, calling callback */
- for (u=0; u<bt->nchildren; u++) {
+ for(u = 0; u < bt->nchildren; u++) {
/* Call user's callback for each entry */
- if ((type->remove)(f, dxpl_id,
- bt->child[u], H5B_NKEY(bt,shared,u), &lt_key_changed, udata,
- H5B_NKEY(bt,shared,u+1), &rt_key_changed)<H5B_INS_NOOP)
+ if((type->remove)(f, dxpl_id,
+ bt->child[u], H5B_NKEY(bt, shared, u), &lt_key_changed, udata,
+ H5B_NKEY(bt, shared, u + 1), &rt_key_changed) < H5B_INS_NOOP)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't remove B-tree node")
} /* end for */
} /* end if */
} /* end else */
done:
- if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG)<0)
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node in cache")
+ if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node in cache")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_delete() */
@@ -1861,8 +1734,6 @@ H5B_shared_free(void *_shared)
* koziol@ncsa.uiuc.edu
* Apr 18 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static H5B_t *
@@ -1883,14 +1754,17 @@ H5B_copy(const H5B_t *old_bt)
/* Allocate memory for the new H5B_t object */
if(NULL == (new_node = H5FL_MALLOC(H5B_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree root node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node")
/* Copy the main structure */
HDmemcpy(new_node, old_bt, sizeof(H5B_t));
+ /* Reset cache info */
+ HDmemset(&new_node->cache_info, 0, sizeof(H5AC_info_t));
+
if(NULL == (new_node->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) ||
NULL == (new_node->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree root node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node")
/* Copy the other structures */
HDmemcpy(new_node->native, old_bt->native, shared->sizeof_keys);
@@ -1905,9 +1779,9 @@ H5B_copy(const H5B_t *old_bt)
done:
if(NULL == ret_value) {
if(new_node) {
- (void)H5FL_BLK_FREE(native_block, new_node->native);
+ new_node->native = H5FL_BLK_FREE(native_block, new_node->native);
new_node->child = H5FL_SEQ_FREE(haddr_t, new_node->child);
- (void)H5FL_FREE(H5B_t, new_node);
+ new_node = H5FL_FREE(H5B_t, new_node);
} /* end if */
} /* end if */
@@ -1954,7 +1828,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad
/* Protect the initial/current node */
if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, info_udata->udata, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
/* Get the shared B-tree information */
shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
@@ -1974,7 +1848,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad
/* Release current node */
if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
bt = NULL;
/*
@@ -1985,7 +1859,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad
/* Protect the next node to the right */
addr = next_addr;
if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, info_udata->udata, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "B-tree node")
/* Cache information from this node */
next_addr = bt->right;
@@ -1996,7 +1870,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad
/* Unprotect node */
if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
bt = NULL;
} /* end while */
@@ -2009,7 +1883,7 @@ H5B_get_info_helper(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t ad
done:
if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_get_info_helper() */
@@ -2082,7 +1956,7 @@ done:
htri_t
H5B_valid(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr)
{
- H5B_t *bt; /* The btree */
+ H5B_t *bt = NULL; /* The btree */
htri_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B_valid, FAIL)
@@ -2094,17 +1968,17 @@ H5B_valid(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr)
HDassert(type);
if(!H5F_addr_defined(addr))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "address is undefined")
+ HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "address is undefined")
/* Protect the node */
if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
+done:
/* Release the node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
+ if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_valid() */
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 15dcb26..1d795ec 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -160,10 +160,10 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud
H5WB_t *wb = NULL; /* Wrapped buffer for header data */
uint8_t hdr_buf[H5B2_HDR_BUF_SIZE]; /* Buffer for header */
uint8_t *buf; /* Pointer to header buffer */
- uint8_t *p; /* Pointer into raw data buffer */
+ const uint8_t *p; /* Pointer into raw data buffer */
H5B2_hdr_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_cache_hdr_load, NULL)
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_hdr_load)
/* Check arguments */
HDassert(f);
@@ -227,7 +227,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud
UINT32DECODE(p, stored_chksum);
/* Sanity check */
- HDassert((size_t)(p - buf) == size);
+ HDassert((size_t)(p - (const uint8_t *)buf) == size);
/* Compute checksum on entire header */
computed_chksum = H5_checksum_metadata(buf, (size - H5B2_SIZEOF_CHKSUM), 0);
@@ -280,7 +280,7 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
uint8_t hdr_buf[H5B2_HDR_BUF_SIZE]; /* Buffer for header */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_cache_hdr_flush, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_hdr_flush)
/* check arguments */
HDassert(f);
@@ -487,7 +487,7 @@ H5B2_cache_hdr_size(const H5F_t UNUSED *f, const H5B2_hdr_t *hdr, size_t *size_p
* Purpose: Loads a B-tree internal node from the disk.
*
* Return: Success: Pointer to a new B-tree internal node.
- * Failure: NULL
+ * Failure: NULL
*
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
@@ -500,7 +500,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda
{
const H5B2_int_load_ud1_t *udata = (const H5B2_int_load_ud1_t *)_udata; /* Pointer to user data */
H5B2_internal_t *internal = NULL; /* Internal node read */
- uint8_t *p; /* Pointer into raw data buffer */
+ const uint8_t *p; /* Pointer into raw data buffer */
uint8_t *native; /* Pointer to native record info */
H5B2_node_ptr_t *int_node_ptr; /* Pointer to node pointer info */
uint32_t stored_chksum; /* Stored metadata checksum value */
@@ -508,7 +508,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda
unsigned u; /* Local index variable */
H5B2_internal_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_cache_internal_load, NULL)
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_internal_load)
/* Check arguments */
HDassert(f);
@@ -589,13 +589,13 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda
} /* end for */
/* Compute checksum on internal node */
- computed_chksum = H5_checksum_metadata(udata->hdr->page, (size_t)(p - udata->hdr->page), 0);
+ computed_chksum = H5_checksum_metadata(udata->hdr->page, (size_t)(p - (const uint8_t *)udata->hdr->page), 0);
/* Metadata checksum */
UINT32DECODE(p, stored_chksum);
/* Sanity check parsing */
- HDassert((size_t)(p - udata->hdr->page) <= udata->hdr->node_size);
+ HDassert((size_t)(p - (const uint8_t *)udata->hdr->page) <= udata->hdr->node_size);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -607,6 +607,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda
done:
if(!ret_value && internal)
(void)H5B2_cache_internal_dest(f, internal);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_cache_internal_load() */ /*lint !e818 Can't make udata a pointer to const */
@@ -629,7 +630,7 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_cache_internal_flush, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_internal_flush)
/* check arguments */
HDassert(f);
@@ -858,14 +859,14 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
const uint16_t *nrec = (const uint16_t *)_nrec;
H5B2_hdr_t *hdr = (H5B2_hdr_t *)_hdr; /* B-tree header information */
H5B2_leaf_t *leaf = NULL; /* Pointer to lead node loaded */
- uint8_t *p; /* Pointer into raw data buffer */
+ const uint8_t *p; /* Pointer into raw data buffer */
uint8_t *native; /* Pointer to native keys */
uint32_t stored_chksum; /* Stored metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
unsigned u; /* Local index variable */
H5B2_leaf_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_cache_leaf_load, NULL)
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_leaf_load)
/* Check arguments */
HDassert(f);
@@ -926,13 +927,13 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
} /* end for */
/* Compute checksum on internal node */
- computed_chksum = H5_checksum_metadata(hdr->page, (size_t)(p - hdr->page), 0);
+ computed_chksum = H5_checksum_metadata(hdr->page, (size_t)(p - (const uint8_t *)hdr->page), 0);
/* Metadata checksum */
UINT32DECODE(p, stored_chksum);
/* Sanity check parsing */
- HDassert((size_t)(p - hdr->page) <= hdr->node_size);
+ HDassert((size_t)(p - (const uint8_t *)hdr->page) <= hdr->node_size);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -944,6 +945,7 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
done:
if(!ret_value && leaf)
(void)H5B2_cache_leaf_dest(f, leaf);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_cache_leaf_load() */ /*lint !e818 Can't make udata a pointer to const */
@@ -966,7 +968,7 @@ H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_cache_leaf_flush, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_leaf_flush)
/* check arguments */
HDassert(f);
diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c
index f1d5d84..696eb89 100644
--- a/src/H5B2hdr.c
+++ b/src/H5B2hdr.c
@@ -350,11 +350,10 @@ H5B2_hdr_incr(H5B2_hdr_t *hdr)
/* Sanity checks */
HDassert(hdr);
- HDassert(hdr->f);
/* Mark header as un-evictable when a B-tree node is depending on it */
if(hdr->rc == 0)
- if(H5AC_pin_protected_entry(hdr->f, hdr) < 0)
+ if(H5AC_pin_protected_entry(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTPIN, FAIL, "unable to pin v2 B-tree header")
/* Increment reference count on B-tree header */
@@ -387,7 +386,6 @@ H5B2_hdr_decr(H5B2_hdr_t *hdr)
/* Sanity check */
HDassert(hdr);
- HDassert(hdr->f);
HDassert(hdr->rc > 0);
/* Decrement reference count on B-tree header */
@@ -395,7 +393,7 @@ H5B2_hdr_decr(H5B2_hdr_t *hdr)
/* Mark header as evictable again when no nodes depend on it */
if(hdr->rc == 0)
- if(H5AC_unpin_entry(hdr->f, hdr) < 0)
+ if(H5AC_unpin_entry(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin v2 B-tree header")
done:
@@ -482,10 +480,9 @@ H5B2_hdr_dirty(H5B2_hdr_t *hdr)
/* Sanity check */
HDassert(hdr);
- HDassert(hdr->f);
/* Mark B-tree header as dirty in cache */
- if(H5AC_mark_pinned_or_protected_entry_dirty(hdr->f, hdr) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(hdr) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark v2 B-tree header as dirty")
done:
diff --git a/src/H5Bcache.c b/src/H5Bcache.c
index 0424134..cc5bbbf 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -39,14 +39,17 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5MFprivate.h" /* File memory management */
+
/****************/
/* Local Macros */
/****************/
+
/******************/
/* Local Typedefs */
/******************/
+
/********************/
/* Local Prototypes */
/********************/
@@ -60,6 +63,7 @@ static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
static herr_t H5B_clear(H5F_t *f, H5B_t *b, hbool_t destroy);
static herr_t H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr);
+
/*********************/
/* Package Variables */
/*********************/
@@ -79,14 +83,14 @@ const H5AC_class_t H5AC_BT[1] = {{
/* Local Variables */
/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5B_serialize
*
* Purpose: Serialize the data structure for writing to disk.
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Bill Wendling
* wendling@ncsa.uiuc.edu
@@ -159,7 +163,6 @@ done:
* Purpose: Loads a B-tree node from the disk.
*
* Return: Success: Pointer to a new B-tree node.
- *
* Failure: NULL
*
* Programmer: Robb Matzke
@@ -173,13 +176,13 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
{
const H5B_class_t *type = (const H5B_class_t *) _type;
H5B_t *bt = NULL;
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
- uint8_t *p; /* Pointer into raw data buffer */
- uint8_t *native; /* Pointer to native keys */
- unsigned u; /* Local index variable */
- H5B_t *ret_value;
+ H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ const uint8_t *p; /* Pointer into raw data buffer */
+ uint8_t *native; /* Pointer to native keys */
+ unsigned u; /* Local index variable */
+ H5B_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5B_load, NULL)
+ FUNC_ENTER_NOAPI_NOINIT(H5B_load)
/* Check arguments */
HDassert(f);
@@ -188,19 +191,24 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
HDassert(type->get_shared);
if(NULL == (bt = H5FL_MALLOC(H5B_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemset(&bt->cache_info,0,sizeof(H5AC_info_t));
- if(NULL == (bt->rc_shared=(type->get_shared)(f, udata)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't retrieve B-tree node buffer")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate B-tree struct")
+ HDmemset(&bt->cache_info, 0, sizeof(H5AC_info_t));
+
+ if(NULL == (bt->rc_shared = (type->get_shared)(f, udata)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't retrieve B-tree node buffer")
shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
- if(NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) ||
- NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- if(H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page)<0)
+ /* Allocate space for the native keys and child addresses */
+ if(NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for native keys")
+ if(NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for child addresses")
+
+ if(H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree node")
+ /* Set the pointer into the raw data buffer */
p = shared->page;
/* magic number */
@@ -217,8 +225,8 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
UINT16DECODE(p, bt->nchildren);
/* sibling pointers */
- H5F_addr_decode(f, (const uint8_t **) &p, &(bt->left));
- H5F_addr_decode(f, (const uint8_t **) &p, &(bt->right));
+ H5F_addr_decode(f, (const uint8_t **)&p, &(bt->left));
+ H5F_addr_decode(f, (const uint8_t **)&p, &(bt->right));
/* the child/key pairs */
native = bt->native;
@@ -230,7 +238,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
native += type->sizeof_nkey;
/* Decode address value */
- H5F_addr_decode(f, (const uint8_t **) &p, bt->child + u);
+ H5F_addr_decode(f, (const uint8_t **)&p, bt->child + u);
} /* end for */
/* Decode final key */
@@ -246,6 +254,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
done:
if(!ret_value && bt)
(void)H5B_dest(f, bt);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_load() */ /*lint !e818 Can't make udata a pointer to const */
@@ -255,33 +264,27 @@ done:
*
* Purpose: Flushes a dirty B-tree node to disk.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* matzke@llnl.gov
* Jun 23 1997
*
- * Changes: JRM -- 8/21/06
- * Added the flags_ptr parameter. This parameter exists to
- * allow the flush routine to report to the cache if the
- * entry is resized or renamed as a result of the flush.
- * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry.
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt, unsigned UNUSED * flags_ptr)
{
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_shared_t *shared; /* Pointer to shared B-tree info */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5B_flush, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5B_flush)
/* check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
HDassert(bt);
- shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
HDassert(shared->type);
HDassert(shared->type->encode);
@@ -302,7 +305,7 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt, uns
} /* end if */
if(destroy)
- if(H5B_dest(f,bt) < 0)
+ if(H5B_dest(f, bt) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node")
done:
diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c
index c31b4c3..aafb999 100644
--- a/src/H5Bdbg.c
+++ b/src/H5Bdbg.c
@@ -30,6 +30,7 @@
#define H5B_PACKAGE /*suppress error about including H5Bpkg */
+
/***********/
/* Headers */
/***********/
@@ -38,6 +39,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5MMprivate.h" /* Memory management */
+
/*-------------------------------------------------------------------------
* Function: H5B_debug
@@ -50,9 +52,6 @@
* matzke@llnl.gov
* Aug 4 1997
*
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
@@ -60,28 +59,28 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
const H5B_class_t *type, void *udata)
{
H5B_t *bt = NULL;
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_shared_t *shared; /* Pointer to shared B-tree info */
unsigned u; /* Local index variable */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B_debug, FAIL)
/*
* Check arguments.
*/
- assert(f);
- assert(H5F_addr_defined(addr));
- assert(stream);
- assert(indent >= 0);
- assert(fwidth >= 0);
- assert(type);
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(stream);
+ HDassert(indent >= 0);
+ HDassert(fwidth >= 0);
+ HDassert(type);
/*
* Load the tree node.
*/
- if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node")
- shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
+ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node")
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
/*
@@ -89,8 +88,8 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
*/
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Tree type ID:",
- ((shared->type->id)==H5B_SNODE_ID ? "H5B_SNODE_ID" :
- ((shared->type->id)==H5B_CHUNK_ID ? "H5B_CHUNK_ID" : "Unknown!")));
+ ((shared->type->id) == H5B_SNODE_ID ? "H5B_SNODE_ID" :
+ ((shared->type->id) == H5B_CHUNK_ID ? "H5B_CHUNK_ID" : "Unknown!")));
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of node:",
shared->sizeof_rnode);
@@ -103,15 +102,12 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Level:",
bt->level);
-
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Address of left sibling:",
bt->left);
-
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Address of right sibling:",
bt->right);
-
HDfprintf(stream, "%*s%-*s %u (%u)\n", indent, "", fwidth,
"Number of children (max):",
bt->nchildren, shared->two_k);
@@ -119,35 +115,35 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
/*
* Print the child addresses
*/
- for (u = 0; u < bt->nchildren; u++) {
+ for(u = 0; u < bt->nchildren; u++) {
HDfprintf(stream, "%*sChild %d...\n", indent, "", u);
HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3),
"Address:", bt->child[u]);
/* If there is a key debugging routine, use it to display the left & right keys */
- if (type->debug_key) {
+ if(type->debug_key) {
/* Decode the 'left' key & print it */
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
"Left Key:");
- assert(H5B_NKEY(bt,shared,u));
- (void)(type->debug_key)(stream, f, dxpl_id, indent+6, MAX (0, fwidth-6),
- H5B_NKEY(bt,shared,u), udata);
+ HDassert(H5B_NKEY(bt,shared,u));
+ (void)(type->debug_key)(stream, f, dxpl_id, indent + 6, MAX(0, fwidth - 6),
+ H5B_NKEY(bt, shared, u), udata);
/* Decode the 'right' key & print it */
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
"Right Key:");
- assert(H5B_NKEY(bt,shared,u+1));
- (void)(type->debug_key)(stream, f, dxpl_id, indent+6, MAX (0, fwidth-6),
- H5B_NKEY(bt,shared,u+1), udata);
- }
- }
+ HDassert(H5B_NKEY(bt, shared, u + 1));
+ (void)(type->debug_key)(stream, f, dxpl_id, indent + 6, MAX (0, fwidth - 6),
+ H5B_NKEY(bt, shared, u + 1), udata);
+ } /* end if */
+ } /* end for */
done:
- if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
+ if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5B_debug() */
/*-------------------------------------------------------------------------
@@ -162,15 +158,6 @@ done:
* Programmer: Robb Matzke
* Tuesday, November 4, 1997
*
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
- *
- * John Mainzer, 6/8/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
#ifdef H5B_DEBUG
@@ -178,11 +165,11 @@ herr_t
H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void *udata)
{
H5B_t *bt = NULL;
- H5B_shared_t *shared; /* Pointer to shared B-tree info */
+ H5B_shared_t *shared; /* Pointer to shared B-tree info */
int i, ncell, cmp;
static int ncalls = 0;
herr_t status;
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
/* A queue of child data */
struct child_t {
@@ -193,25 +180,25 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
FUNC_ENTER_NOAPI_NOFUNC(H5B_assert)
- if (0==ncalls++) {
- if (H5DEBUG(B)) {
+ if(0 == ncalls++) {
+ if(H5DEBUG(B))
fprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n");
- }
- }
+ } /* end if */
+
/* Initialize the queue */
bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ);
- assert(bt);
- shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
+ HDassert(bt);
+ shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared);
HDassert(shared);
cur = H5MM_calloc(sizeof(struct child_t));
- assert (cur);
+ HDassert(cur);
cur->addr = addr;
cur->level = bt->level;
head = tail = cur;
status = H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET);
- assert(status >= 0);
- bt=NULL; /* Make certain future references will be caught */
+ HDassert(status >= 0);
+ bt = NULL; /* Make certain future references will be caught */
/*
* Do a breadth-first search of the tree. New nodes are added to the end
@@ -219,66 +206,63 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void
* remove any nodes from the queue because we need them in the uniqueness
* test.
*/
- for (ncell = 0; cur; ncell++) {
+ for(ncell = 0; cur; ncell++) {
bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, cur->addr, type, udata, H5AC_READ);
- assert(bt);
+ HDassert(bt);
/* Check node header */
- assert(bt->level == cur->level);
- if (cur->next && cur->next->level == bt->level) {
- assert(H5F_addr_eq(bt->right, cur->next->addr));
- } else {
- assert(!H5F_addr_defined(bt->right));
- }
- if (prev && prev->level == bt->level) {
- assert(H5F_addr_eq(bt->left, prev->addr));
- } else {
- assert(!H5F_addr_defined(bt->left));
- }
-
- if (cur->level > 0) {
- for (i = 0; i < bt->nchildren; i++) {
-
+ HDassert(bt->level == cur->level);
+ if(cur->next && cur->next->level == bt->level)
+ HDassert(H5F_addr_eq(bt->right, cur->next->addr));
+ else
+ HDassert(!H5F_addr_defined(bt->right));
+ if(prev && prev->level == bt->level)
+ HDassert(H5F_addr_eq(bt->left, prev->addr));
+ else
+ HDassert(!H5F_addr_defined(bt->left));
+
+ if(cur->level > 0) {
+ for(i = 0; i < bt->nchildren; i++) {
/*
* Check that child nodes haven't already been seen. If they
* have then the tree has a cycle.
*/
- for (tmp = head; tmp; tmp = tmp->next) {
- assert(H5F_addr_ne(tmp->addr, bt->child[i]));
- }
+ for(tmp = head; tmp; tmp = tmp->next)
+ HDassert(H5F_addr_ne(tmp->addr, bt->child[i]));
/* Add the child node to the end of the queue */
tmp = H5MM_calloc(sizeof(struct child_t));
- assert (tmp);
+ HDassert(tmp);
tmp->addr = bt->child[i];
tmp->level = bt->level - 1;
tail->next = tmp;
tail = tmp;
/* Check that the keys are monotonically increasing */
- cmp = (type->cmp2) (f, dxpl_id, H5B_NKEY(bt,shared,i), udata,
- H5B_NKEY(bt,shared,i+1));
- assert(cmp < 0);
- }
- }
+ cmp = (type->cmp2)(f, dxpl_id, H5B_NKEY(bt, shared, i), udata,
+ H5B_NKEY(bt, shared, i + 1));
+ HDassert(cmp < 0);
+ } /* end for */
+ } /* end if */
+
/* Release node */
status = H5AC_unprotect(f, dxpl_id, H5AC_BT, cur->addr, bt, H5AC__NO_FLAGS_SET);
- assert(status >= 0);
- bt=NULL; /* Make certain future references will be caught */
+ HDassert(status >= 0);
+ bt = NULL; /* Make certain future references will be caught */
/* Advance current location in queue */
prev = cur;
cur = cur->next;
- }
+ } /* end for */
/* Free all entries from queue */
- while (head) {
+ while(head) {
tmp = head->next;
H5MM_xfree(head);
head = tmp;
- }
+ } /* end while */
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5B_assert() */
#endif /* H5B_DEBUG */
diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h
index ddabf52..7aedd00 100644
--- a/src/H5Bpkg.h
+++ b/src/H5Bpkg.h
@@ -33,6 +33,7 @@
/* Other private headers needed by this file */
+
/**************************/
/* Package Private Macros */
/**************************/
diff --git a/src/H5C.c b/src/H5C.c
index ef58012..d8688b2 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -3439,9 +3439,9 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr,
herr_t
H5C_dest(H5F_t * f,
hid_t primary_dxpl_id,
- hid_t secondary_dxpl_id,
- H5C_t * cache_ptr)
+ hid_t secondary_dxpl_id)
{
+ H5C_t * cache_ptr = f->shared->cache;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_dest, FAIL)
@@ -3463,7 +3463,7 @@ H5C_dest(H5F_t * f,
cache_ptr->magic = 0;
- (void)H5FL_FREE(H5C_t, cache_ptr);
+ cache_ptr = H5FL_FREE(H5C_t, cache_ptr);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -3489,32 +3489,33 @@ done:
*
*-------------------------------------------------------------------------
*/
-
herr_t
H5C_expunge_entry(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t addr,
unsigned flags)
{
+ H5C_t * cache_ptr;
herr_t result;
hbool_t first_flush = TRUE;
- hbool_t free_file_space;
H5C_cache_entry_t * entry_ptr = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_expunge_entry, FAIL)
- free_file_space = ( (flags & H5C__FREE_FILE_SPACE_FLAG) != 0 );
+ HDassert( f );
+ HDassert( f->shared );
+
+ cache_ptr = f->shared->cache;
- HDassert( H5F_addr_defined(addr) );
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
HDassert( type );
HDassert( type->clear );
HDassert( type->dest );
+ HDassert( H5F_addr_defined(addr) );
#if H5C_DO_EXTREME_SANITY_CHECKS
if ( H5C_validate_lru_list(cache_ptr) < 0 ) {
@@ -3548,15 +3549,12 @@ H5C_expunge_entry(H5F_t * f,
}
/* Pass along 'free file space' flag to cache client */
-
- entry_ptr->free_file_space_on_destroy = free_file_space;
-
+ entry_ptr->free_file_space_on_destroy = ( (flags & H5C__FREE_FILE_SPACE_FLAG) != 0 );
/* If we get this far, call H5C_flush_single_entry() with the
* H5C__FLUSH_INVALIDATE_FLAG and the H5C__FLUSH_CLEAR_ONLY_FLAG.
* This will clear the entry, and then delete it from the cache.
*/
-
result = H5C_flush_single_entry(f,
primary_dxpl_id,
secondary_dxpl_id,
@@ -3690,9 +3688,9 @@ herr_t
H5C_flush_cache(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
unsigned flags)
{
+ H5C_t * cache_ptr = f->shared->cache;
herr_t status;
herr_t ret_value = SUCCEED;
hbool_t destroy;
@@ -4244,8 +4242,7 @@ H5C_flush_to_min_clean(H5F_t * f,
/* Flush the marked entries */
result = H5C_flush_cache(f, primary_dxpl_id, secondary_dxpl_id,
- cache_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG |
- H5C__FLUSH_IGNORE_PROTECTED_FLAG);
+ H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG);
if ( result < 0 ) {
@@ -4301,7 +4298,7 @@ done:
*/
herr_t
-H5C_get_cache_auto_resize_config(H5C_t * cache_ptr,
+H5C_get_cache_auto_resize_config(const H5C_t * cache_ptr,
H5C_auto_size_ctl_t *config_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4483,7 +4480,7 @@ done:
*/
herr_t
-H5C_get_entry_status(H5C_t * cache_ptr,
+H5C_get_entry_status(const H5F_t *f,
haddr_t addr,
size_t * size_ptr,
hbool_t * in_cache_ptr,
@@ -4493,11 +4490,17 @@ H5C_get_entry_status(H5C_t * cache_ptr,
hbool_t * is_flush_dep_parent_ptr,
hbool_t * is_flush_dep_child_ptr)
{
+ H5C_t * cache_ptr;
H5C_cache_entry_t * entry_ptr = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_get_entry_status, FAIL)
+ HDassert( f );
+ HDassert( f->shared );
+
+ cache_ptr = f->shared->cache;
+
HDassert( cache_ptr != NULL );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
HDassert( H5F_addr_defined(addr) );
@@ -4581,7 +4584,7 @@ done:
*/
herr_t
-H5C_get_evictions_enabled(H5C_t * cache_ptr,
+H5C_get_evictions_enabled(const H5C_t * cache_ptr,
hbool_t * evictions_enabled_ptr)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4622,38 +4625,55 @@ done:
* Programmer: John Mainzer
* 1/20/06
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-
herr_t
-H5C_get_trace_file_ptr(H5C_t * cache_ptr,
- FILE ** trace_file_ptr_ptr)
+H5C_get_trace_file_ptr(const H5C_t *cache_ptr, FILE **trace_file_ptr_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ FUNC_ENTER_NOAPI_NOFUNC(H5C_get_trace_file_ptr)
- FUNC_ENTER_NOAPI(H5C_get_trace_file_ptr, FAIL)
-
- /* This would normally be an assert, but we need to use an HGOTO_ERROR
- * call to shut up the compiler.
- */
- if ( ( ! cache_ptr ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {
+ /* Sanity checks */
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(trace_file_ptr_ptr);
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr")
- }
+ *trace_file_ptr_ptr = cache_ptr->trace_file_ptr;
- if ( trace_file_ptr_ptr == NULL ) {
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5C_get_trace_file_ptr() */
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL trace_file_ptr_ptr")
- }
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_get_trace_file_ptr_from_entry
+ *
+ * Purpose: Get the trace_file_ptr field from the cache, via an entry.
+ *
+ * This field will either be NULL (which indicates that trace
+ * file logging is turned off), or contain a pointer to the
+ * open file to which trace file data is to be written.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * 6/9/08
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr,
+ FILE **trace_file_ptr_ptr)
+{
+ FUNC_ENTER_NOAPI_NOFUNC(H5C_get_trace_file_ptr_from_entry)
- *trace_file_ptr_ptr = cache_ptr->trace_file_ptr;
+ /* Sanity checks */
+ HDassert(entry_ptr);
+ HDassert(entry_ptr->cache_ptr);
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ /* Go get the trace file pointer for the cache */
+ H5C_get_trace_file_ptr(entry_ptr->cache_ptr, trace_file_ptr_ptr);
-} /* H5C_get_trace_file_ptr() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5C_get_trace_file_ptr_from_entry() */
/*-------------------------------------------------------------------------
@@ -4768,12 +4788,12 @@ herr_t
H5C_insert_entry(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t addr,
void * thing,
unsigned int flags)
{
+ H5C_t * cache_ptr;
herr_t result;
hbool_t first_flush = TRUE;
hbool_t insert_pinned;
@@ -4787,6 +4807,11 @@ H5C_insert_entry(H5F_t * f,
FUNC_ENTER_NOAPI(H5C_insert_entry, FAIL)
+ HDassert( f );
+ HDassert( f->shared );
+
+ cache_ptr = f->shared->cache;
+
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
HDassert( cache_ptr->skip_file_checks || f );
@@ -4839,6 +4864,7 @@ H5C_insert_entry(H5F_t * f,
#ifndef NDEBUG
entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
#endif /* NDEBUG */
+ entry_ptr->cache_ptr = cache_ptr;
entry_ptr->addr = addr;
entry_ptr->type = type;
@@ -5372,59 +5398,31 @@ done:
* Programmer: John Mainzer
* 3/22/06
*
- * Modifications:
- *
- * Added code to do a flash cache size increase if
- * appropriate.
- * JRM -- 1/11/08
- *
- *
- * Added code to update the clean_index_size and
- * dirty_index_size fields of H5C_t in cases where the
- * the entry was clean on protect, was marked dirty in
- * this call, and did not change its size. Do this via
- * a call to H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY().
- *
- * If the size changed, this case is already dealt with by
- * by the pre-existing call to
- * H5C__UPDATE_INDEX_FOR_SIZE_CHANGE().
- *
- * JRM -- 11/5/08
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr,
- void * thing,
- hbool_t size_changed,
- size_t new_size)
+H5C_mark_pinned_entry_dirty(void *thing, hbool_t size_changed, size_t new_size)
{
- herr_t ret_value = SUCCEED; /* Return value */
- herr_t result;
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing;
hbool_t was_clean;
size_t size_increase;
- H5C_cache_entry_t * entry_ptr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_mark_pinned_entry_dirty, FAIL)
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
- HDassert( ( size_changed == TRUE ) || ( size_changed == FALSE ) );
-
- entry_ptr = (H5C_cache_entry_t *)thing;
-
- if ( ! ( entry_ptr->is_pinned ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Entry isn't pinned??")
- }
-
- if ( entry_ptr->is_protected ) {
+ /* Sanity checks */
+ HDassert(entry_ptr);
+ HDassert(H5F_addr_defined(entry_ptr->addr));
+ cache_ptr = entry_ptr->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
- "Entry is protected??")
- }
+ /* Check for usage errors */
+ if(!entry_ptr->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry isn't pinned??")
+ if(entry_ptr->is_protected)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry is protected??")
/* make note of whether the entry was dirty to begin with */
was_clean = ! ( entry_ptr->is_dirty );
@@ -5443,17 +5441,9 @@ H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr,
size_increase = new_size - entry_ptr->size;
if ( size_increase >=
- cache_ptr->flash_size_increase_threshold ) {
-
- result = H5C__flash_increase_cache_size(cache_ptr,
- entry_ptr->size,
- new_size);
-
- if ( result < 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "H5C__flash_increase_cache_size failed.")
- }
+ cache_ptr->flash_size_increase_threshold ) {
+ if(H5C__flash_increase_cache_size(cache_ptr, entry_ptr->size, new_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "flash cache increase failed")
}
}
}
@@ -5494,9 +5484,7 @@ H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr,
H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr)
done:
-
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_mark_pinned_entry_dirty() */
@@ -5521,16 +5509,6 @@ done:
* Programmer: John Mainzer
* 5/15/06
*
- * Modifications:
- *
- * JRM -- 3/29/07
- * Added sanity check to verify that the pinned entry
- * is not protected read only.
- *
- * This sanity check is commented out for now -- uncomment
- * it once we deal with the problem of entries being protected
- * read only, and then dirtied.
- *
* JRM -- 11/5/08
* Added call to H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY() to
* update the new clean_index_size and dirty_index_size
@@ -5540,20 +5518,20 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr,
- void * thing)
+H5C_mark_pinned_or_protected_entry_dirty(void *thing)
{
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing;
herr_t ret_value = SUCCEED; /* Return value */
- hbool_t was_pinned_unprotected_and_clean;
- H5C_cache_entry_t * entry_ptr;
FUNC_ENTER_NOAPI(H5C_mark_pinned_or_protected_entry_dirty, FAIL)
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
-
- entry_ptr = (H5C_cache_entry_t *)thing;
+ /* Sanity checks */
+ HDassert(entry_ptr);
+ HDassert(H5F_addr_defined(entry_ptr->addr));
+ cache_ptr = entry_ptr->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
if ( entry_ptr->is_protected ) {
#if 0 /* JRM - uncomment this when possible */
@@ -5563,6 +5541,7 @@ H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr,
entry_ptr->dirtied = TRUE;
} else if ( entry_ptr->is_pinned ) {
+ hbool_t was_pinned_unprotected_and_clean;
was_pinned_unprotected_and_clean = ! ( entry_ptr->is_dirty );
@@ -5588,9 +5567,7 @@ H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr,
}
done:
-
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_mark_pinned_or_protected_entry_dirty() */
@@ -5810,64 +5787,33 @@ done:
* Programmer: John Mainzer
* 7/5/06
*
- * Modifications:
- *
- * Added code to apply a flash cache size increment if
- * appropriate.
- * JRM -- 1/11/08
- *
- * Added code to update the clean_index_size and
- * dirty_index_size fields of H5C_t in cases where the
- * the entry was clean prior to this call, was marked dirty,
- * and did not change its size. Do this via a call to
- * H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY().
- *
- * If the size changed, this case is already dealt with by
- * by the pre-existing call to
- * H5C__UPDATE_INDEX_FOR_SIZE_CHANGE().
- *
- * JRM -- 11/5/08
- *
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5C_resize_pinned_entry(H5C_t * cache_ptr,
- void * thing,
- size_t new_size)
+H5C_resize_pinned_entry(void *thing, size_t new_size)
{
- /* const char * fcn_name = "H5C_resize_pinned_entry()"; */
- herr_t ret_value = SUCCEED; /* Return value */
- herr_t result;
- hbool_t was_clean;
- H5C_cache_entry_t * entry_ptr;
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing;
size_t size_increase;
+ hbool_t was_clean;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_resize_pinned_entry, FAIL)
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
-
- entry_ptr = (H5C_cache_entry_t *)thing;
-
- if ( new_size <= 0 ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \
- "New size is non-positive.")
- }
-
- if ( ! ( entry_ptr->is_pinned ) ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \
- "Entry isn't pinned??")
- }
-
- if ( entry_ptr->is_protected ) {
+ /* Sanity checks */
+ HDassert(entry_ptr);
+ HDassert(H5F_addr_defined(entry_ptr->addr));
+ cache_ptr = entry_ptr->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
- HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, \
- "Entry is protected??")
- }
+ /* Check for usage errors */
+ if(new_size <= 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "New size is non-positive.")
+ if(!entry_ptr->is_pinned)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry isn't pinned??")
+ if(entry_ptr->is_protected)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "Entry is protected??")
/* make note of whether the entry was clean to begin with */
was_clean = ! ( entry_ptr->is_dirty );
@@ -5890,15 +5836,11 @@ H5C_resize_pinned_entry(H5C_t * cache_ptr,
if ( size_increase >=
cache_ptr->flash_size_increase_threshold ) {
- result = H5C__flash_increase_cache_size(cache_ptr,
- entry_ptr->size,
- new_size);
-
- if ( result < 0 ) {
- HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \
- "H5C__flash_increase_cache_size failed.")
- }
+ if(H5C__flash_increase_cache_size(cache_ptr,
+ entry_ptr->size,
+ new_size) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "flash cache increase failed")
}
}
}
@@ -5940,9 +5882,7 @@ H5C_resize_pinned_entry(H5C_t * cache_ptr,
H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr)
done:
-
FUNC_LEAVE_NOAPI(ret_value)
-
} /* H5C_resize_pinned_entry() */
@@ -6007,38 +5947,23 @@ done:
* Programmer: John Mainzer
* 4/26/06
*
- * Modifications:
- *
- * JRM -- 4/26/06
- * Modified routine to allow it to operate on protected
- * entries.
- *
- * JRM -- 2/16/07
- * Added conditional compile to avoid unused parameter
- * warning in production compile.
- *
- * JRM -- 4/4/07
- * Fixed typo -- canged macro call to
- * H5C__UPDATE_STATS_FOR_UNPIN to call to
- * H5C__UPDATE_STATS_FOR_PIN.
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5C_pin_protected_entry(H5C_t * cache_ptr,
- void * thing)
+H5C_pin_protected_entry(void *thing)
{
- H5C_cache_entry_t * entry_ptr; /* Pointer to entry to pin */
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; /* Pointer to entry to pin */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_pin_protected_entry, FAIL)
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
- entry_ptr = (H5C_cache_entry_t *)thing;
- HDassert( entry_ptr );
- HDassert( H5F_addr_defined(entry_ptr->addr) );
+ /* Sanity checks */
+ HDassert(entry_ptr);
+ HDassert(H5F_addr_defined(entry_ptr->addr));
+ cache_ptr = entry_ptr->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Only protected entries can be pinned */
if(!entry_ptr->is_protected)
@@ -6160,7 +6085,6 @@ void *
H5C_protect(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t addr,
const void * udata1,
@@ -6168,6 +6092,7 @@ H5C_protect(H5F_t * f,
unsigned flags)
{
/* const char * fcn_name = "H5C_protect()"; */
+ H5C_t * cache_ptr;
hbool_t hit;
hbool_t first_flush;
hbool_t have_write_permitted = FALSE;
@@ -6182,6 +6107,9 @@ H5C_protect(H5F_t * f,
FUNC_ENTER_NOAPI(H5C_protect, NULL)
/* check args */
+ HDassert( f );
+ HDassert( f->shared );
+ cache_ptr = f->shared->cache;
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
HDassert( cache_ptr->skip_file_checks || f );
@@ -6609,14 +6537,13 @@ done:
*/
herr_t
-H5C_set_cache_auto_resize_config(H5C_t * cache_ptr,
+H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
H5C_auto_size_ctl_t *config_ptr)
{
- /* const char *fcn_name = "H5C_set_cache_auto_resize_config()"; */
- herr_t ret_value = SUCCEED; /* Return value */
herr_t result;
size_t new_max_cache_size;
size_t new_min_clean_size;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_set_cache_auto_resize_config, FAIL)
@@ -6892,7 +6819,7 @@ done:
*/
herr_t
-H5C_set_evictions_enabled(H5C_t * cache_ptr,
+H5C_set_evictions_enabled(H5C_t *cache_ptr,
hbool_t evictions_enabled)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -7756,20 +7683,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_unpin_entry(H5C_t * cache_ptr,
- void * thing)
+H5C_unpin_entry(void *thing)
{
- H5C_cache_entry_t * entry_ptr; /* Pointer to entry to unpin */
+ H5C_t * cache_ptr;
+ H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; /* Pointer to entry to unpin */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5C_unpin_entry, FAIL)
- /* Sanity checking */
- HDassert( cache_ptr );
- HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( thing );
- entry_ptr = (H5C_cache_entry_t *)thing;
- HDassert( entry_ptr );
+ /* Sanity check */
+ HDassert(entry_ptr);
+ cache_ptr = entry_ptr->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
/* Unpin the entry */
if(H5C_unpin_entry_from_client(cache_ptr, entry_ptr, TRUE) < 0)
@@ -7900,13 +7826,13 @@ herr_t
H5C_unprotect(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t addr,
void * thing,
unsigned int flags,
size_t new_size)
{
+ H5C_t * cache_ptr;
hbool_t deleted;
hbool_t dirtied;
hbool_t set_flush_marker;
@@ -7942,6 +7868,11 @@ H5C_unprotect(H5F_t * f,
dirtied |= size_changed;
+ HDassert( f );
+ HDassert( f->shared );
+
+ cache_ptr = f->shared->cache;
+
HDassert( cache_ptr );
HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
HDassert( cache_ptr->skip_file_checks || f );
@@ -8665,16 +8596,10 @@ H5C_adjust_flush_dependency_rc(H5C_cache_entry_t * cache_entry,
*
*-------------------------------------------------------------------------
*/
-#ifndef NDEBUG
-herr_t
-H5C_create_flush_dependency(H5C_t * cache_ptr, void * parent_thing,
- void * child_thing)
-#else
herr_t
-H5C_create_flush_dependency(H5C_t UNUSED * cache_ptr, void * parent_thing,
- void * child_thing)
-#endif
+H5C_create_flush_dependency(void * parent_thing, void * child_thing)
{
+ H5C_t * cache_ptr;
H5C_cache_entry_t * parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent thing's entry */
H5C_cache_entry_t * child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child thing's entry */
#ifndef NDEBUG
@@ -8685,8 +8610,6 @@ H5C_create_flush_dependency(H5C_t UNUSED * cache_ptr, void * parent_thing,
FUNC_ENTER_NOAPI(H5C_create_flush_dependency, FAIL)
/* Sanity checks */
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(parent_entry);
HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(parent_entry->flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS);
@@ -8695,6 +8618,10 @@ H5C_create_flush_dependency(H5C_t UNUSED * cache_ptr, void * parent_thing,
HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(H5F_addr_defined(child_entry->addr));
HDassert(child_entry->flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS);
+ cache_ptr = parent_entry->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr == child_entry->cache_ptr);
/* More sanity checks */
if(child_entry == parent_entry)
@@ -8783,9 +8710,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_destroy_flush_dependency(H5C_t * cache_ptr, void *parent_thing,
- void * child_thing)
+H5C_destroy_flush_dependency(void *parent_thing, void * child_thing)
{
+ H5C_t * cache_ptr;
H5C_cache_entry_t * parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent entry */
H5C_cache_entry_t * child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child entry */
#ifndef NDEBUG
@@ -8796,8 +8723,6 @@ H5C_destroy_flush_dependency(H5C_t * cache_ptr, void *parent_thing,
FUNC_ENTER_NOAPI(H5C_destroy_flush_dependency, FAIL)
/* Sanity checks */
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
HDassert(parent_entry);
HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(H5F_addr_defined(parent_entry->addr));
@@ -8806,6 +8731,10 @@ H5C_destroy_flush_dependency(H5C_t * cache_ptr, void *parent_thing,
HDassert(child_entry->flush_dep_parent != child_entry);
HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC);
HDassert(H5F_addr_defined(child_entry->addr));
+ cache_ptr = parent_entry->cache_ptr;
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert(cache_ptr == child_entry->cache_ptr);
/* Usage checks */
if(!parent_entry->is_pinned)
@@ -11170,17 +11099,18 @@ H5C_flush_single_entry(H5F_t * f,
/* Clear the dirty flag only, if requested */
if ( clear_only ) {
-#ifndef NDEBUG
if ( destroy ) {
- /* we are about to call the clear callback with the
+#ifndef NDEBUG
+ /* we are about to call the clear callback with the
* destroy flag set -- this will result in *entry_ptr
* being freed. Set the magic field to bad magic
* so we can detect a freed cache entry if we see
* one.
*/
entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
- }
#endif /* NDEBUG */
+ entry_ptr->cache_ptr = NULL;
+ }
/* Call the callback routine to clear all dirty flags for object */
if ( (entry_ptr->type->clear)(f, entry_ptr, destroy_entry) < 0 ) {
@@ -11198,17 +11128,18 @@ H5C_flush_single_entry(H5F_t * f,
}
#endif /* H5C_DO_SANITY_CHECKS */
-#ifndef NDEBUG
if ( destroy ) {
- /* we are about to call the flush callback with the
+#ifndef NDEBUG
+ /* we are about to call the flush callback with the
* destroy flag set -- this will result in *entry_ptr
* being freed. Set the magic field to bad magic
* so we can detect a freed cache entry if we see
* one.
*/
entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC;
- }
#endif /* NDEBUG */
+ entry_ptr->cache_ptr = NULL;
+ }
/* Only block for all the processes on the first piece of metadata
*/
@@ -11477,9 +11408,9 @@ H5C_load_entry(H5F_t * f,
*
* with:
*
- * HDassert( ( entry_ptr->is_dirty == FALSE ) || ( type->id == 4 ) );
+ * HDassert( ( entry_ptr->is_dirty == FALSE ) || ( type->id == 5 ) );
*
- * Note that type id 4 is associated with object headers in the metadata
+ * Note that type id 5 is associated with object headers in the metadata
* cache.
*
* When we get to using H5C for other purposes, we may wish to
@@ -11487,10 +11418,11 @@ H5C_load_entry(H5F_t * f,
* metadata cache.
*/
- HDassert( ( entry_ptr->is_dirty == FALSE ) || ( type->id == 4 ) );
+ HDassert( ( entry_ptr->is_dirty == FALSE ) || ( type->id == 5 ) );
#ifndef NDEBUG
entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
#endif /* NDEBUG */
+ entry_ptr->cache_ptr = f->shared->cache;
entry_ptr->addr = addr;
entry_ptr->type = type;
entry_ptr->is_protected = FALSE;
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index 719dec9..b7a348b 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -857,7 +857,7 @@
****************************************************************************/
#define H5C__H5C_T_MAGIC 0x005CAC0E
-#define H5C__MAX_NUM_TYPE_IDS 26
+#define H5C__MAX_NUM_TYPE_IDS 27
#define H5C__PREFIX_LEN 32
struct H5C_t
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 5c7fe9f..dc8d7b1 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -535,6 +535,7 @@ typedef struct H5C_cache_entry_t
#ifndef NDEBUG
uint32_t magic;
#endif /* NDEBUG */
+ H5C_t * cache_ptr;
haddr_t addr;
size_t size;
const H5C_class_t * type;
@@ -1023,13 +1024,11 @@ H5_DLL void H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr,
H5_DLL herr_t H5C_dest(H5F_t * f,
hid_t primary_dxpl_id,
- hid_t secondary_dxpl_id,
- H5C_t * cache_ptr);
+ hid_t secondary_dxpl_id);
H5_DLL herr_t H5C_expunge_entry(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t addr,
unsigned flags);
@@ -1037,7 +1036,6 @@ H5_DLL herr_t H5C_expunge_entry(H5F_t * f,
H5_DLL herr_t H5C_flush_cache(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
unsigned flags);
H5_DLL herr_t H5C_flush_to_min_clean(H5F_t * f,
@@ -1045,7 +1043,7 @@ H5_DLL herr_t H5C_flush_to_min_clean(H5F_t * f,
hid_t secondary_dxpl_id,
H5C_t * cache_ptr);
-H5_DLL herr_t H5C_get_cache_auto_resize_config(H5C_t * cache_ptr,
+H5_DLL herr_t H5C_get_cache_auto_resize_config(const H5C_t * cache_ptr,
H5C_auto_size_ctl_t *config_ptr);
H5_DLL herr_t H5C_get_cache_size(H5C_t * cache_ptr,
@@ -1057,7 +1055,7 @@ H5_DLL herr_t H5C_get_cache_size(H5C_t * cache_ptr,
H5_DLL herr_t H5C_get_cache_hit_rate(H5C_t * cache_ptr,
double * hit_rate_ptr);
-H5_DLL herr_t H5C_get_entry_status(H5C_t * cache_ptr,
+H5_DLL herr_t H5C_get_entry_status(const H5F_t *f,
haddr_t addr,
size_t * size_ptr,
hbool_t * in_cache_ptr,
@@ -1067,16 +1065,17 @@ H5_DLL herr_t H5C_get_entry_status(H5C_t * cache_ptr,
hbool_t * is_flush_dep_parent_ptr,
hbool_t * is_flush_dep_child_ptr);
-H5_DLL herr_t H5C_get_evictions_enabled(H5C_t * cache_ptr,
+H5_DLL herr_t H5C_get_evictions_enabled(const H5C_t * cache_ptr,
hbool_t * evictions_enabled_ptr);
-H5_DLL herr_t H5C_get_trace_file_ptr(H5C_t * cache_ptr,
- FILE ** trace_file_ptr_ptr);
+H5_DLL herr_t H5C_get_trace_file_ptr(const H5C_t *cache_ptr,
+ FILE **trace_file_ptr_ptr);
+H5_DLL herr_t H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr,
+ FILE **trace_file_ptr_ptr);
H5_DLL herr_t H5C_insert_entry(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t addr,
void * thing,
@@ -1089,29 +1088,24 @@ H5_DLL herr_t H5C_mark_entries_as_clean(H5F_t * f,
int32_t ce_array_len,
haddr_t * ce_array_ptr);
-H5_DLL herr_t H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr,
- void * thing,
+H5_DLL herr_t H5C_mark_pinned_entry_dirty(void * thing,
hbool_t size_changed,
size_t new_size);
-H5_DLL herr_t H5C_mark_pinned_or_protected_entry_dirty(H5C_t * cache_ptr,
- void * thing);
+H5_DLL herr_t H5C_mark_pinned_or_protected_entry_dirty(void *thing);
H5_DLL herr_t H5C_rename_entry(H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t old_addr,
haddr_t new_addr);
-H5_DLL herr_t H5C_pin_protected_entry(H5C_t * cache_ptr,
- void * thing);
+H5_DLL herr_t H5C_pin_protected_entry(void *thing);
-H5_DLL herr_t H5C_create_flush_dependency(H5C_t *cache_ptr, void *parent_thing,
- void *child_thing);
+H5_DLL herr_t H5C_create_flush_dependency(void *parent_thing, void *child_thing);
H5_DLL void * H5C_protect(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t addr,
const void * udata1,
@@ -1120,14 +1114,12 @@ H5_DLL void * H5C_protect(H5F_t * f,
H5_DLL herr_t H5C_reset_cache_hit_rate_stats(H5C_t * cache_ptr);
-H5_DLL herr_t H5C_resize_pinned_entry(H5C_t * cache_ptr,
- void * thing,
- size_t new_size);
+H5_DLL herr_t H5C_resize_pinned_entry(void *thing, size_t new_size);
-H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t * cache_ptr,
+H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t *cache_ptr,
H5C_auto_size_ctl_t *config_ptr);
-H5_DLL herr_t H5C_set_evictions_enabled(H5C_t * cache_ptr,
+H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr,
hbool_t evictions_enabled);
H5_DLL herr_t H5C_set_prefix(H5C_t * cache_ptr, char * prefix);
@@ -1145,15 +1137,13 @@ H5_DLL herr_t H5C_stats(H5C_t * cache_ptr,
H5_DLL void H5C_stats__reset(H5C_t * cache_ptr);
-H5_DLL herr_t H5C_unpin_entry(H5C_t * cache_ptr, void * thing);
+H5_DLL herr_t H5C_unpin_entry(void *thing);
-H5_DLL herr_t H5C_destroy_flush_dependency(H5C_t *cache_ptr, void *parent_thing,
- void *child_thing);
+H5_DLL herr_t H5C_destroy_flush_dependency(void *parent_thing, void *child_thing);
H5_DLL herr_t H5C_unprotect(H5F_t * f,
hid_t primary_dxpl_id,
hid_t secondary_dxpl_id,
- H5C_t * cache_ptr,
const H5C_class_t * type,
haddr_t addr,
void * thing,
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index d9cde4b..5eec112 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -337,7 +337,7 @@ done:
/* ARGSUSED */
static int
H5D_btree_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata,
- void *_rt_key)
+ void *_rt_key)
{
H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key;
H5D_btree_key_t *rt_key = (H5D_btree_key_t *) _rt_key;
@@ -388,7 +388,7 @@ H5D_btree_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udat
/* ARGSUSED */
static int
H5D_btree_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata,
- void *_rt_key)
+ void *_rt_key)
{
H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key;
H5D_btree_key_t *rt_key = (H5D_btree_key_t *) _rt_key;
@@ -761,8 +761,8 @@ H5D_btree_encode_key(const H5F_t UNUSED *f, const H5B_t *bt, uint8_t *raw, void
*/
/* ARGSUSED */
static herr_t
-H5D_btree_debug_key(FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth,
- const void *_key, const void *_udata)
+H5D_btree_debug_key(FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent,
+ int fwidth, const void *_key, const void *_udata)
{
const H5D_btree_key_t *key = (const H5D_btree_key_t *)_key;
const unsigned *ndims = (const unsigned *)_udata;
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 95334af..296d79a 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -2460,7 +2460,7 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *
/* Check for SWMR writes to the file */
if(dset->shared->layout.storage.u.chunk.ops->can_swim && H5F_INTENT(dset->oloc.file) & H5F_ACC_SWMR_WRITE) {
/* Mark the proxy entry in the cache as clean */
- if(H5D_chunk_proxy_mark(dset, ent, FALSE) < 0)
+ if(H5D_chunk_proxy_mark(ent, FALSE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTMARKDIRTY, FAIL, "can't mark proxy for chunk from metadata cache as clean")
} /* end if */
@@ -2480,7 +2480,6 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *
done:
/* Free the temp buffer only if it's different than the entry chunk */
if(buf != ent->chunk)
- /* coverity["double_free"] */
H5MM_xfree(buf);
/*
@@ -2989,7 +2988,6 @@ H5D_chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
{
const H5O_layout_t *layout = &(io_info->dset->shared->layout); /* Dataset layout */
const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk);
- H5D_rdcc_ent_t *ent = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_unlock)
@@ -3023,6 +3021,8 @@ H5D_chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
} /* end else */
} /* end if */
else {
+ H5D_rdcc_ent_t *ent; /* Chunk's entry in the cache */
+
/* Sanity check */
HDassert(idx_hint < rdcc->nslots);
HDassert(rdcc->slot[idx_hint]);
@@ -3041,7 +3041,7 @@ H5D_chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata,
if(io_info->dset->shared->layout.storage.u.chunk.ops->can_swim
&& H5F_INTENT(io_info->dset->oloc.file) & H5F_ACC_SWMR_WRITE) {
/* Mark the proxy entry in the cache as dirty */
- if(H5D_chunk_proxy_mark(io_info->dset, ent, TRUE) < 0)
+ if(H5D_chunk_proxy_mark(ent, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTMARKDIRTY, FAIL, "can't mark proxy for chunk from metadata cache as dirty")
} /* end if */
} /* end if */
diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c
index 22f29e8..c87d94a 100644
--- a/src/H5Dcompact.c
+++ b/src/H5Dcompact.c
@@ -437,16 +437,22 @@ H5D_compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src, H5F_t *f_dst,
/* create a memory copy of the variable-length datatype */
if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0)
+ if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) {
+ H5T_close(dt_mem);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
+ } /* end if */
/* create variable-length datatype at the destinaton file */
if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) {
+ H5T_close(dt_dst);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
- if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0)
+ } /* end if */
+ if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) {
+ H5T_close(dt_dst);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype")
+ } /* end if */
/* Set up the conversion functions */
if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem, NULL, NULL, dxpl_id, FALSE)))
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 282cecb..e2fe420 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -1279,16 +1279,22 @@ H5D_contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
/* create a memory copy of the variable-length datatype */
if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0)
+ if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) {
+ H5T_close(dt_mem);
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
+ } /* end if */
/* create variable-length datatype at the destinaton file */
if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) {
+ H5T_close(dt_dst);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
- if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0)
+ } /* end if */
+ if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) {
+ H5T_close(dt_dst);
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype")
+ } /* end if */
/* Set up the conversion functions */
if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem, NULL, NULL, dxpl_id, FALSE)))
diff --git a/src/H5Dearray.c b/src/H5Dearray.c
index 2215951..0440416 100644
--- a/src/H5Dearray.c
+++ b/src/H5Dearray.c
@@ -642,7 +642,7 @@ H5D_earray_idx_depend(const H5D_chk_idx_info_t *idx_info)
done:
/* Unpin the dataset's object header */
- if(oh && H5O_unpin(&oloc, oh) < 0)
+ if(oh && H5O_unpin(oh) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header")
FUNC_LEAVE_NOAPI(ret_value)
@@ -699,7 +699,7 @@ H5D_earray_idx_undepend(const H5D_chk_idx_info_t *idx_info)
done:
/* Unpin the dataset's object header */
- if(oh && H5O_unpin(&oloc, oh) < 0)
+ if(oh && H5O_unpin(oh) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dint.c b/src/H5Dint.c
index f9329b6..da73890 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -58,7 +58,8 @@ typedef struct {
/* General stuff */
static herr_t H5D_init_storage(H5D_t *dataset, hbool_t full_overwrite, hid_t dxpl_id);
static herr_t H5D_get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache);
-static H5D_shared_t *H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type);
+static H5D_shared_t *H5D_new(hid_t dcpl_id, hbool_t creating,
+ hbool_t vl_type);
static herr_t H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id,
const H5T_t *type);
static herr_t H5D_init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space);
@@ -522,8 +523,8 @@ done:
static H5D_shared_t *
H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type)
{
- H5P_genplist_t *plist; /* Property list created */
H5D_shared_t *new_dset = NULL; /* New dataset object */
+ H5P_genplist_t *plist; /* Property list created */
H5D_shared_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5D_new)
@@ -540,7 +541,7 @@ H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type)
*/
if(!vl_type && creating && dcpl_id == H5P_DATASET_CREATE_DEFAULT) {
if(H5I_inc_ref(dcpl_id, FALSE) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "Can't increment default DCPL ID")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment default DCPL ID")
new_dset->dcpl_id = dcpl_id;
} /* end if */
else {
@@ -861,8 +862,8 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
done:
/* Release pointer to object header itself */
- if(oloc != NULL && oh != NULL)
- if(H5O_unpin(oloc, oh) < 0)
+ if(oh != NULL)
+ if(H5O_unpin(oh) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header")
/* Error cleanup */
@@ -2236,7 +2237,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5D_flush_real(H5D_t *dataset, hid_t dxpl_id)
{
H5O_t *oh = NULL; /* Pointer to dataset's object header */
@@ -2287,7 +2288,7 @@ H5D_flush_real(H5D_t *dataset, hid_t dxpl_id)
done:
/* Release pointer to object header */
if(oh != NULL)
- if(H5O_unpin(&(dataset->oloc), oh) < 0)
+ if(H5O_unpin(oh) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 406b5ce..5723847 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -211,7 +211,7 @@ done:
*/
herr_t
H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
- hid_t file_space_id, hid_t plist_id, const void *buf)
+ hid_t file_space_id, hid_t dxpl_id, const void *buf)
{
H5D_t *dset = NULL;
const H5S_t *mem_space = NULL;
@@ -221,7 +221,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
FUNC_ENTER_API(H5Dwrite, FAIL)
H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id,
- plist_id, buf);
+ dxpl_id, buf);
/* check arguments */
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
@@ -246,10 +246,10 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
} /* end if */
/* Get the default dataset transfer property list if the user didn't provide one */
- if(H5P_DEFAULT == plist_id)
- plist_id= H5P_DATASET_XFER_DEFAULT;
+ if(H5P_DEFAULT == dxpl_id)
+ dxpl_id= H5P_DATASET_XFER_DEFAULT;
else
- if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER))
+ if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
if(!buf && (NULL == file_space || H5S_GET_SELECT_NPOINTS(file_space) != 0))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer")
@@ -262,7 +262,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
buf = &fake_char;
/* write raw data */
- if(H5D_write(dset, mem_type_id, mem_space, file_space, plist_id, buf) < 0)
+ if(H5D_write(dset, mem_type_id, mem_space, file_space, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
done:
@@ -583,6 +583,9 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
* independent access, causing the metadata cache to get corrupted. Its been
* disabled for all types of access (serial as well as parallel) to make the
* modification time consistent for all programs. -QAK
+ *
+ * We should set a value in the dataset's shared information instead and flush
+ * it to the file when the dataset is being closed. -QAK
*/
/*
* Update modification time. We have to do this explicitly because
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index c0a4aa3..c76bfc8 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -414,7 +414,7 @@ H5D_layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
/* Insert "empty" name first */
if((size_t)(-1) == H5HL_insert(file, dxpl_id, heap, (size_t)1, "")) {
- H5HL_unprotect(file, dxpl_id, heap, efl->heap_addr);
+ H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
} /* end if */
@@ -424,7 +424,7 @@ H5D_layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
/* Insert file name into heap */
if((size_t)(-1) == (offset = H5HL_insert(file, dxpl_id, heap,
HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name))) {
- H5HL_unprotect(file, dxpl_id, heap, efl->heap_addr);
+ H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
} /* end if */
@@ -434,7 +434,7 @@ H5D_layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
} /* end for */
/* Release the heap */
- if(H5HL_unprotect(file, dxpl_id, heap, efl->heap_addr) < 0)
+ if(H5HL_unprotect(heap) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to unprotect EFL file name heap")
heap = NULL;
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 4596b05..3e03ffd 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -692,8 +692,7 @@ H5_DLL herr_t H5D_chunk_proxy_create(H5D_t *dset, hid_t dxpl_id,
H5D_chunk_common_ud_t *udata, H5D_rdcc_ent_t *ent);
H5_DLL herr_t H5D_chunk_proxy_remove(const H5D_t *dset, hid_t dxpl_it,
H5D_rdcc_ent_t *ent);
-H5_DLL herr_t H5D_chunk_proxy_mark(const H5D_t *dset, const H5D_rdcc_ent_t *ent,
- hbool_t dirty);
+H5_DLL herr_t H5D_chunk_proxy_mark(const H5D_rdcc_ent_t *ent, hbool_t dirty);
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5Dproxy.c b/src/H5Dproxy.c
index 429500e..592bdaf 100644
--- a/src/H5Dproxy.c
+++ b/src/H5Dproxy.c
@@ -472,14 +472,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D_chunk_proxy_mark(const H5D_t *dset, const H5D_rdcc_ent_t *ent,
- hbool_t dirty)
+H5D_chunk_proxy_mark(const H5D_rdcc_ent_t *ent, hbool_t dirty)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_proxy_mark)
- HDassert(dset);
HDassert(ent);
#ifdef QAK
HDfprintf(stderr, "%s: ent->proxy_addr = %a, dirty = %t\n", FUNC, ent->proxy_addr, dirty);
@@ -487,7 +485,7 @@ HDfprintf(stderr, "%s: ent->proxy_addr = %a, dirty = %t\n", FUNC, ent->proxy_add
/* Check whether to mark the proxy as dirty */
if(dirty) {
- if(H5AC_mark_pinned_or_protected_entry_dirty(dset->oloc.file, ent->proxy) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(ent->proxy) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTMARKDIRTY, FAIL, "can't mark chunk proxy entry in metadata cache as dirty")
} /* end if */
diff --git a/src/H5Dtest.c b/src/H5Dtest.c
index 485f98f..49b0986 100644
--- a/src/H5Dtest.c
+++ b/src/H5Dtest.c
@@ -35,26 +35,32 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
+
/****************/
/* Local Macros */
/****************/
+
/******************/
/* Local Typedefs */
/******************/
+
/********************/
/* Local Prototypes */
/********************/
+
/*********************/
/* Package Variables */
/*********************/
+
/*******************/
/* Local Variables */
/*******************/
+
/*--------------------------------------------------------------------------
NAME
@@ -79,13 +85,13 @@ herr_t
H5D_layout_version_test(hid_t did, unsigned *version)
{
H5D_t *dset; /* Pointer to dataset to query */
- herr_t ret_value = SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_NOAPI(H5D_layout_version_test, FAIL)
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset")
if(version)
*version = dset->shared->layout.version;
@@ -118,13 +124,13 @@ herr_t
H5D_layout_contig_size_test(hid_t did, hsize_t *size)
{
H5D_t *dset; /* Pointer to dataset to query */
- herr_t ret_value = SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_NOAPI(H5D_layout_contig_size_test, FAIL)
/* Check args */
if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset")
if(size) {
HDassert(dset->shared->layout.type == H5D_CONTIGUOUS);
diff --git a/src/H5E.c b/src/H5E.c
index 5a80787..4591223 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -361,6 +361,36 @@ H5E_get_stack(void)
/*-------------------------------------------------------------------------
+ * Function: H5E_free_class
+ *
+ * Purpose: Private function to free an error class.
+ *
+ * Return: Non-negative value on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, January 22, 2009
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5E_free_class(H5E_cls_t *cls)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_free_class)
+
+ /* Check arguments */
+ HDassert(cls);
+
+ /* Free error class structure */
+ cls->cls_name = (char *)H5MM_xfree((void*)cls->cls_name);
+ cls->lib_name = (char *)H5MM_xfree((void*)cls->lib_name);
+ cls->lib_vers = (char *)H5MM_xfree((void*)cls->lib_vers);
+ cls = H5FL_FREE(H5E_cls_t, cls);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5E_free_class() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Eregister_class
*
* Purpose: Registers an error class.
@@ -413,7 +443,7 @@ done:
static H5E_cls_t *
H5E_register_class(const char *cls_name, const char *lib_name, const char *version)
{
- H5E_cls_t *cls; /* Pointer to error class */
+ H5E_cls_t *cls = NULL; /* Pointer to error class */
H5E_cls_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5E_register_class)
@@ -424,7 +454,7 @@ H5E_register_class(const char *cls_name, const char *lib_name, const char *versi
HDassert(version);
/* Allocate space for new error class */
- if(NULL == (cls = H5FL_MALLOC(H5E_cls_t)))
+ if(NULL == (cls = H5FL_CALLOC(H5E_cls_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Duplicate string information */
@@ -439,6 +469,10 @@ H5E_register_class(const char *cls_name, const char *lib_name, const char *versi
ret_value = cls;
done:
+ if(!ret_value)
+ if(cls && H5E_free_class(cls) < 0)
+ HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_register_class() */
@@ -494,7 +528,9 @@ done:
static herr_t
H5E_unregister_class(H5E_cls_t *cls)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_unregister_class)
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5E_unregister_class)
/* Check arguments */
HDassert(cls);
@@ -504,15 +540,11 @@ H5E_unregister_class(H5E_cls_t *cls)
(void)H5I_search(H5I_ERROR_MSG, H5E_close_msg_cb, cls, FALSE);
/* Free error class structure */
- if(cls->cls_name)
- H5MM_xfree((void*)cls->cls_name);
- if(cls->lib_name)
- H5MM_xfree((void*)cls->lib_name);
- if(cls->lib_vers)
- H5MM_xfree((void*)cls->lib_vers);
- (void)H5FL_FREE(H5E_cls_t, cls);
+ if(H5E_free_class(cls) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "unable to free error class")
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_unregister_class() */
@@ -680,11 +712,10 @@ H5E_close_msg(H5E_msg_t *err)
/* Check arguments */
HDassert(err);
- if(err->msg)
- H5MM_xfree((void*)err->msg);
+ /* Release message */
+ err->msg = (char *)H5MM_xfree((void *)err->msg);
/* Don't free err->cls here */
-
- (void)H5FL_FREE(H5E_msg_t, err);
+ err = H5FL_FREE(H5E_msg_t, err);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5E_close_msg() */
@@ -749,7 +780,7 @@ done:
static H5E_msg_t *
H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str)
{
- H5E_msg_t *msg; /* Pointer to new error message */
+ H5E_msg_t *msg = NULL; /* Pointer to new error message */
H5E_msg_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5E_create_msg)
@@ -773,6 +804,10 @@ H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str)
ret_value = msg;
done:
+ if(!ret_value)
+ if(msg && H5E_close_msg(msg) < 0)
+ HDONE_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, NULL, "unable to close error message")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_create_msg() */
diff --git a/src/H5EA.c b/src/H5EA.c
index 1850b0e..2af407d 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -825,7 +825,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
hdr->f = ea->f;
/* Set up flush dependency between child_entry and metadata array 'thing' */
- if(H5EA__create_flush_depend(hdr, parent_entry, (H5AC_info_t *)hdr) < 0)
+ if(H5EA__create_flush_depend(parent_entry, (H5AC_info_t *)hdr) < 0)
H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency on file metadata")
CATCH
@@ -868,7 +868,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC);
hdr->f = ea->f;
/* Remove flush dependency between child_entry and metadata array 'thing' */
- if(H5EA__destroy_flush_depend(hdr, parent_entry, (H5AC_info_t *)hdr) < 0)
+ if(H5EA__destroy_flush_depend(parent_entry, (H5AC_info_t *)hdr) < 0)
H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency on file metadata")
CATCH
@@ -895,7 +895,6 @@ herr_t, SUCCEED, FAIL,
H5EA_support(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, H5AC_info_t *child_entry))
/* Local variables */
- H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */
uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */
hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */
@@ -910,10 +909,6 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx);
* Check arguments.
*/
HDassert(ea);
- HDassert(hdr);
-
- /* Set the shared array header's file context for this operation */
- hdr->f = ea->f;
/* Look up the array metadata containing the element we want to set */
if(H5EA__lookup_elmt(ea, dxpl_id, idx, H5AC_WRITE, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0)
@@ -925,7 +920,7 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx);
HDassert(thing_unprot_func);
/* Set up flush dependency between child_entry and metadata array 'thing' */
- if(H5EA__create_flush_depend(hdr, (H5AC_info_t *)thing, child_entry) < 0)
+ if(H5EA__create_flush_depend((H5AC_info_t *)thing, child_entry) < 0)
H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency on array metadata")
CATCH
@@ -955,7 +950,6 @@ herr_t, SUCCEED, FAIL,
H5EA_unsupport(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, H5AC_info_t *child_entry))
/* Local variables */
- H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */
void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */
uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */
hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */
@@ -970,10 +964,6 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx);
* Check arguments.
*/
HDassert(ea);
- HDassert(hdr);
-
- /* Set the shared array header's file context for this operation */
- hdr->f = ea->f;
/* Look up the array metadata containing the element we want to set */
if(H5EA__lookup_elmt(ea, dxpl_id, idx, H5AC_READ, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0)
@@ -985,7 +975,7 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx);
HDassert(thing_unprot_func);
/* Remove flush dependency between child_entry and metadata array 'thing' */
- if(H5EA__destroy_flush_depend(hdr, (H5AC_info_t *)thing, child_entry) < 0)
+ if(H5EA__destroy_flush_depend((H5AC_info_t *)thing, child_entry) < 0)
H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency on array metadata")
CATCH
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index 2e1c632..69a311f 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -865,13 +865,13 @@ H5EA__cache_iblock_notify(H5AC_notify_action_t action, H5EA_iblock_t *iblock))
switch(action) {
case H5AC_NOTIFY_ACTION_AFTER_INSERT:
/* Create flush dependency on extensible array header */
- if(H5EA__create_flush_depend(iblock->hdr, (H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0)
+ if(H5EA__create_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0)
H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between index block and header, address = %llu", (unsigned long long)iblock->addr)
break;
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on extensible array header */
- if(H5EA__destroy_flush_depend(iblock->hdr, (H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0)
+ if(H5EA__destroy_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0)
H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between index block and header, address = %llu", (unsigned long long)iblock->addr)
break;
@@ -1299,13 +1299,13 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, H5EA_sblock_t *sblock))
switch(action) {
case H5AC_NOTIFY_ACTION_AFTER_INSERT:
/* Create flush dependency on index block */
- if(H5EA__create_flush_depend(sblock->hdr, (H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0)
+ if(H5EA__create_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0)
H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr)
break;
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on index block */
- if(H5EA__destroy_flush_depend(sblock->hdr, (H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0)
+ if(H5EA__destroy_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0)
H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr)
break;
@@ -1667,13 +1667,13 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, H5EA_dblock_t *dblock))
switch(action) {
case H5AC_NOTIFY_ACTION_AFTER_INSERT:
/* Create flush dependency on parent */
- if(H5EA__create_flush_depend(dblock->hdr, (H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0)
+ if(H5EA__create_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0)
H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block and parent, address = %llu", (unsigned long long)dblock->addr)
break;
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on parent */
- if(H5EA__destroy_flush_depend(dblock->hdr, (H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0)
+ if(H5EA__destroy_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0)
H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block and parent, address = %llu", (unsigned long long)dblock->addr)
break;
@@ -2024,13 +2024,13 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, H5EA_dblk_page_t *dblk
switch(action) {
case H5AC_NOTIFY_ACTION_AFTER_INSERT:
/* Create flush dependency on parent */
- if(H5EA__create_flush_depend(dblk_page->hdr, (H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0)
+ if(H5EA__create_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0)
H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr)
break;
case H5AC_NOTIFY_ACTION_BEFORE_EVICT:
/* Destroy flush dependency on parent */
- if(H5EA__destroy_flush_depend(dblk_page->hdr, (H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0)
+ if(H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0)
H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr)
break;
diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c
index 4280767..6967413 100644
--- a/src/H5EAhdr.c
+++ b/src/H5EAhdr.c
@@ -479,7 +479,7 @@ H5EA__hdr_incr(H5EA_hdr_t *hdr))
/* Mark header as un-evictable when something is depending on it */
if(hdr->rc == 0)
- if(H5AC_pin_protected_entry(hdr->f, hdr) < 0)
+ if(H5AC_pin_protected_entry(hdr) < 0)
H5E_THROW(H5E_CANTPIN, "unable to pin extensible array header")
/* Increment reference count on shared header */
@@ -517,7 +517,7 @@ H5EA__hdr_decr(H5EA_hdr_t *hdr))
/* Mark header as evictable again when nothing depend on it */
if(hdr->rc == 0) {
HDassert(hdr->file_rc == 0);
- if(H5AC_unpin_entry(hdr->f, hdr) < 0)
+ if(H5AC_unpin_entry(hdr) < 0)
H5E_THROW(H5E_CANTUNPIN, "unable to unpin extensible array header")
} /* end if */
@@ -604,7 +604,7 @@ H5EA__hdr_modified(H5EA_hdr_t *hdr))
HDassert(hdr->f);
/* Mark header as dirty in cache */
- if(H5AC_mark_pinned_or_protected_entry_dirty(hdr->f, hdr) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(hdr) < 0)
H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as dirty")
CATCH
@@ -629,6 +629,9 @@ BEGIN_FUNC(PKG, ERR,
herr_t, SUCCEED, FAIL,
H5EA__hdr_delete(H5EA_hdr_t *hdr, hid_t dxpl_id))
+ /* Local variables */
+ unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */
+
/* Sanity check */
HDassert(hdr);
HDassert(!hdr->file_rc);
@@ -657,15 +660,13 @@ HDfprintf(stderr, "%s: hdr->idx_blk_addr = %a\n", FUNC, hdr->idx_blk_addr);
H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array index block")
} /* end if */
- /* Finished deleting header */
- if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
- hdr = NULL;
+ /* Set flags to finish deleting header on unprotect */
+ cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
CATCH
- /* Unprotect the header, if an error occurred */
- if(hdr && H5AC_unprotect(hdr->f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ /* Unprotect the header, deleting it if an error hasn't occurred */
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, cache_flags) < 0)
H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
END_FUNC(PKG) /* end H5EA__hdr_delete() */
diff --git a/src/H5EAint.c b/src/H5EAint.c
index 28681e8..12a9cda 100644
--- a/src/H5EAint.c
+++ b/src/H5EAint.c
@@ -95,16 +95,14 @@
*/
BEGIN_FUNC(PKG, ERR,
herr_t, SUCCEED, FAIL,
-H5EA__create_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_entry,
- H5AC_info_t *child_entry))
+H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
/* Sanity check */
- HDassert(hdr);
HDassert(parent_entry);
HDassert(child_entry);
/* Create a flush dependency between parent and child entry */
- if(H5AC_create_flush_dependency(hdr->f, parent_entry, child_entry) < 0)
+ if(H5AC_create_flush_dependency(parent_entry, child_entry) < 0)
H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency")
CATCH
@@ -127,16 +125,14 @@ END_FUNC(PKG) /* end H5EA__create_flush_depend() */
*/
BEGIN_FUNC(PKG, ERR,
herr_t, SUCCEED, FAIL,
-H5EA__destroy_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_entry,
- H5AC_info_t *child_entry))
+H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry))
/* Sanity check */
- HDassert(hdr);
HDassert(parent_entry);
HDassert(child_entry);
/* Destroy a flush dependency between parent and child entry */
- if(H5AC_destroy_flush_dependency(hdr->f, parent_entry, child_entry) < 0)
+ if(H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0)
H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency")
CATCH
diff --git a/src/H5EApkg.h b/src/H5EApkg.h
index f729b69..39e6546 100644
--- a/src/H5EApkg.h
+++ b/src/H5EApkg.h
@@ -363,9 +363,9 @@ extern const H5EA_class_t *const H5EA_client_class_g[];
/******************************/
/* Generic routines */
-H5_DLL herr_t H5EA__create_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_entry,
+H5_DLL herr_t H5EA__create_flush_depend(H5AC_info_t *parent_entry,
H5AC_info_t *child_entry);
-H5_DLL herr_t H5EA__destroy_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_entry,
+H5_DLL herr_t H5EA__destroy_flush_depend(H5AC_info_t *parent_entry,
H5AC_info_t *child_entry);
/* Header routines */
diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c
index 0997f3c..30f3ae9 100644
--- a/src/H5Edeprec.c
+++ b/src/H5Edeprec.c
@@ -122,10 +122,10 @@ char *
H5Eget_major(H5E_major_t maj)
{
H5E_msg_t *msg; /* Pointer to error message */
- ssize_t size = 0; /* Return value */
+ ssize_t size;
H5E_type_t type;
- char *msg_str;
- char *ret_value = NULL;
+ char *msg_str = NULL;
+ char *ret_value; /* Return value */
FUNC_ENTER_API_NOCLEAR(H5Eget_major, NULL)
@@ -133,22 +133,26 @@ H5Eget_major(H5E_major_t maj)
if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(maj, H5I_ERROR_MSG)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID")
- /* Get the message's text */
+ /* Get the size & type of the message's text */
if((size = H5E_get_msg(msg, &type, NULL, (size_t)0)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
-
if(type != H5E_MAJOR)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a major one")
- /* Don't know who is going to free it */
- msg_str = (char *)H5MM_malloc((size_t)(++size) * sizeof(char));
+ /* Application will free this */
+ size++;
+ msg_str = (char *)H5MM_malloc((size_t)size);
+ /* Get the text for the message */
if(H5E_get_msg(msg, NULL, msg_str, (size_t)size) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
ret_value = msg_str;
done:
+ if(!ret_value)
+ msg_str = (char *)H5MM_xfree(msg_str);
+
FUNC_LEAVE_API(ret_value)
} /* end H5Eget_major() */
@@ -170,10 +174,10 @@ char *
H5Eget_minor(H5E_minor_t min)
{
H5E_msg_t *msg; /* Pointer to error message */
- ssize_t size = 0; /* Return value */
+ ssize_t size;
H5E_type_t type;
- char *msg_str;
- char *ret_value = NULL;
+ char *msg_str = NULL;
+ char *ret_value; /* Return value */
FUNC_ENTER_API_NOCLEAR(H5Eget_minor, NULL)
@@ -181,22 +185,26 @@ H5Eget_minor(H5E_minor_t min)
if(NULL == (msg = (H5E_msg_t *)H5I_object_verify(min, H5I_ERROR_MSG)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID")
- /* Get the message's text */
+ /* Get the size & type of the message's text */
if((size = H5E_get_msg(msg, &type, NULL, (size_t)0)) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
-
if(type != H5E_MINOR)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a minor one")
- /* Don't know who is going to free it */
- msg_str = (char *)H5MM_malloc((size_t)(++size) * sizeof(char));
+ /* Application will free this */
+ size++;
+ msg_str = (char *)H5MM_malloc((size_t)size);
+ /* Get the text for the message */
if(H5E_get_msg(msg, NULL, msg_str, (size_t)size) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text")
ret_value = msg_str;
done:
+ if(!ret_value)
+ msg_str = (char *)H5MM_xfree(msg_str);
+
FUNC_LEAVE_API(ret_value)
} /* end H5Eget_minor() */
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 831d51b..d64fcbd 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -225,8 +225,9 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
const char *maj_str = "No major description"; /* Major error description */
const char *min_str = "No minor description"; /* Minor error description */
unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk1_cb)
+ FUNC_ENTER_NOAPI_NOINIT(H5E_walk1_cb)
/* Check arguments */
HDassert(err_desc);
@@ -240,7 +241,11 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
/* Get descriptions for the major and minor error numbers */
maj_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->maj_num, H5I_ERROR_MSG);
min_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->min_num, H5I_ERROR_MSG);
- HDassert(maj_ptr && min_ptr);
+
+ /* Check for bad pointer(s), but can't issue error, just leave */
+ if(!maj_ptr || !min_ptr)
+ HGOTO_DONE(FAIL)
+
if(maj_ptr->msg)
maj_str = maj_ptr->msg;
if(min_ptr->msg)
@@ -294,7 +299,8 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str);
fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str);
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_walk1_cb() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -341,8 +347,9 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
const char *maj_str = "No major description"; /* Major error description */
const char *min_str = "No minor description"; /* Minor error description */
unsigned have_desc = 1; /* Flag to indicate whether the error has a "real" description */
+ herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_walk2_cb)
+ FUNC_ENTER_NOAPI_NOINIT(H5E_walk2_cb)
/* Check arguments */
HDassert(err_desc);
@@ -356,7 +363,11 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
/* Get descriptions for the major and minor error numbers */
maj_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->maj_num, H5I_ERROR_MSG);
min_ptr = (H5E_msg_t *)H5I_object_verify(err_desc->min_num, H5I_ERROR_MSG);
- HDassert(maj_ptr && min_ptr);
+
+ /* Check for bad pointer(s), but can't issue error, just leave */
+ if(!maj_ptr || !min_ptr)
+ HGOTO_DONE(FAIL)
+
if(maj_ptr->msg)
maj_str = maj_ptr->msg;
if(min_ptr->msg)
@@ -411,7 +422,8 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str);
fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str);
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5E_walk2_cb() */
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index 4c226d0..1e5ada1 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -156,7 +156,7 @@ extern int H5E_mpi_error_str_len;
/* Macro for "catching" flow of control when an error occurs. Note that the
* H5_LEAVE macro won't jump back here once it's past this point.
*/
-#define CATCH past_catch = TRUE; catch_except:;
+#define CATCH catch_except:; past_catch = TRUE;
/* Library-private functions defined in H5E package */
diff --git a/src/H5F.c b/src/H5F.c
index a4eedd5..efa4091 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1003,7 +1003,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
} /* end if */
/* Unpin the superblock, since we're about to destroy the cache */
- if(H5AC_unpin_entry(f, f->shared->sblock) < 0)
+ if(H5AC_unpin_entry(f->shared->sblock) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin superblock")
f->shared->sblock = NULL;
@@ -2537,21 +2537,13 @@ done:
* Programmer: John Mainzer
* 3/24/05
*
- * Modifications:
- *
- * Reworked for the addition of the config_ptr parameter.
- * JRM -- 4/7/05
- *
*-------------------------------------------------------------------------
*/
-
herr_t
-H5Fget_mdc_config(hid_t file_id,
- H5AC_cache_config_t *config_ptr)
+H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
{
H5F_t *file; /* File object for file ID */
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Fget_mdc_config, FAIL)
H5TRACE2("e", "i*x", file_id, config_ptr);
@@ -2563,18 +2555,11 @@ H5Fget_mdc_config(hid_t file_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr")
/* Go get the resize configuration */
- result = H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr);
-
- if ( result != SUCCEED ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5AC_get_cache_auto_resize_config() failed.");
- }
+ if(H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.")
done:
-
FUNC_LEAVE_API(ret_value)
-
} /* H5Fget_mdc_config() */
@@ -2591,20 +2576,13 @@ done:
* Programmer: John Mainzer
* 3/24/05
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
-H5Fset_mdc_config(hid_t file_id,
- H5AC_cache_config_t *config_ptr)
+H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
{
H5F_t *file; /* File object for file ID */
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Fset_mdc_config, FAIL)
H5TRACE2("e", "i*x", file_id, config_ptr);
@@ -2614,18 +2592,11 @@ H5Fset_mdc_config(hid_t file_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* set the resize configuration */
- result = H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr);
-
- if ( result != SUCCEED ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "H5AC_set_cache_auto_resize_config() failed.");
- }
+ if(H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed.")
done:
-
FUNC_LEAVE_API(ret_value)
-
} /* H5Fset_mdc_config() */
@@ -2643,20 +2614,13 @@ done:
* Programmer: John Mainzer
* 3/24/05
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
-H5Fget_mdc_hit_rate(hid_t file_id,
- double *hit_rate_ptr)
+H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr)
{
H5F_t *file; /* File object for file ID */
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Fget_mdc_hit_rate, FAIL)
H5TRACE2("e", "i*d", file_id, hit_rate_ptr);
@@ -2669,18 +2633,11 @@ H5Fget_mdc_hit_rate(hid_t file_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer")
/* Go get the current hit rate */
- result = H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr);
-
- if ( result != SUCCEED ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5AC_get_cache_hit_rate() failed.");
- }
+ if(H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.")
done:
-
FUNC_LEAVE_API(ret_value)
-
} /* H5Fget_mdc_hit_rate() */
@@ -2699,24 +2656,15 @@ done:
* Programmer: John Mainzer
* 3/24/05
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
-
herr_t
-H5Fget_mdc_size(hid_t file_id,
- size_t *max_size_ptr,
- size_t *min_clean_size_ptr,
- size_t *cur_size_ptr,
- int *cur_num_entries_ptr)
+H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
+ size_t *cur_size_ptr, int *cur_num_entries_ptr)
{
H5F_t *file; /* File object for file ID */
int32_t cur_num_entries;
- herr_t result;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Fget_mdc_size, FAIL)
H5TRACE5("e", "i*z*z*z*Is", file_id, max_size_ptr, min_clean_size_ptr,
@@ -2727,26 +2675,15 @@ H5Fget_mdc_size(hid_t file_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Go get the size data */
- result = H5AC_get_cache_size(file->shared->cache,
- max_size_ptr,
- min_clean_size_ptr,
- cur_size_ptr,
- &cur_num_entries);
-
- if ( result != SUCCEED ) {
-
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
- "H5AC_get_cache_size() failed.");
-
- } else if ( cur_num_entries_ptr != NULL ) {
+ if(H5AC_get_cache_size(file->shared->cache, max_size_ptr,
+ min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.")
+ if(cur_num_entries_ptr != NULL)
*cur_num_entries_ptr = (int)cur_num_entries;
- }
done:
-
FUNC_LEAVE_API(ret_value)
-
} /* H5Fget_mdc_size() */
@@ -2768,10 +2705,6 @@ done:
* Programmer: John Mainzer
* 3/24/05
*
- * Modifications:
- *
- * None.
- *
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c
index 94fb7b2..372caf8 100644
--- a/src/H5FAhdr.c
+++ b/src/H5FAhdr.c
@@ -264,7 +264,7 @@ H5FA__hdr_incr(H5FA_hdr_t *hdr))
/* Mark header as un-evictable when something is depending on it */
if(hdr->rc == 0)
- if(H5AC_pin_protected_entry(hdr->f, hdr) < 0)
+ if(H5AC_pin_protected_entry(hdr) < 0)
H5E_THROW(H5E_CANTPIN, "unable to pin fixed array header")
/* Increment reference count on shared header */
@@ -301,7 +301,7 @@ H5FA__hdr_decr(H5FA_hdr_t *hdr))
/* Mark header as evictable again when nothing depend on it */
if(hdr->rc == 0) {
HDassert(hdr->file_rc == 0);
- if(H5AC_unpin_entry(hdr->f, hdr) < 0)
+ if(H5AC_unpin_entry(hdr) < 0)
H5E_THROW(H5E_CANTUNPIN, "unable to unpin fixed array header")
} /* end if */
@@ -382,10 +382,9 @@ H5FA__hdr_modified(H5FA_hdr_t *hdr))
/* Sanity check */
HDassert(hdr);
- HDassert(hdr->f);
/* Mark header as dirty in cache */
- if(H5AC_mark_pinned_or_protected_entry_dirty(hdr->f, hdr) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(hdr) < 0)
H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark fixed array header as dirty")
CATCH
@@ -409,6 +408,9 @@ BEGIN_FUNC(PKG, ERR,
herr_t, SUCCEED, FAIL,
H5FA__hdr_delete(H5FA_hdr_t *hdr, hid_t dxpl_id))
+ /* Local variables */
+ unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */
+
/* Sanity check */
HDassert(hdr);
HDassert(!hdr->file_rc);
@@ -438,15 +440,13 @@ HDfprintf(stderr, "%s: hdr->dblk_addr = %a\n", FUNC, hdr->dblk_addr);
H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array data block")
} /* end if */
- /* Finished deleting header */
- if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
- H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
- hdr = NULL;
+ /* Set flags to finish deleting header on unprotect */
+ cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
CATCH
- /* Unprotect the header, if an error occurred */
- if(hdr && H5AC_unprotect(hdr->f, dxpl_id, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0)
+ /* Unprotect the header, deleting it if an error hasn't occurred */
+ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0)
H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header")
END_FUNC(PKG) /* end H5FA__hdr_delete() */
diff --git a/src/H5FD.c b/src/H5FD.c
index 4c0da40..99f2e3c 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -730,8 +730,8 @@ done:
herr_t
H5FD_fapl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info)
{
- void *copied_driver_info; /* Temporary VFL driver info */
- herr_t ret_value=SUCCEED; /* Return value */
+ void *copied_driver_info = NULL; /* Temporary VFL driver info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_fapl_open, FAIL)
@@ -739,15 +739,20 @@ H5FD_fapl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info)
if(H5I_inc_ref(driver_id, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver")
if(H5FD_fapl_copy(driver_id, driver_info, &copied_driver_info) < 0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VFL driver info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "can't copy VFL driver info")
/* Set the driver properties for the list */
if(H5P_set(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver ID")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set driver ID")
if(H5P_set(plist, H5F_ACS_FILE_DRV_INFO_NAME, &copied_driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set driver info")
+ copied_driver_info = NULL;
done:
+ if(ret_value < 0)
+ if(copied_driver_info && H5FD_fapl_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_fapl_open() */
@@ -847,24 +852,28 @@ done:
herr_t
H5FD_dxpl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info)
{
- void *copied_driver_info; /* Temporary VFL driver info */
- herr_t ret_value=SUCCEED; /* Return value */
+ void *copied_driver_info = NULL; /* Temporary VFL driver info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_dxpl_open, FAIL)
/* Increment the reference count on the driver and copy the driver info */
if(H5I_inc_ref(driver_id, FALSE) < 0)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINC, FAIL, "can't increment VFL driver ID")
+ 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_DATASET, H5E_CANTCOPY, FAIL, "can't copy VFL driver")
+ 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_PLIST, H5E_CANTSET, FAIL, "can't set VFL driver ID")
+ 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_PLIST, H5E_CANTSET, FAIL, "can't set VFL driver info")
+ 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() */
@@ -1060,7 +1069,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
/* Get file access property list */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
/* Get the VFD to open the file with */
if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 15f4094..7324afb 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -762,7 +762,7 @@ H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle)
/* Get property */
if(H5P_get(plist, H5F_ACS_WANT_POSIX_FD_NAME, &want_posix_fd) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of retrieving file descriptor")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get property of retrieving file descriptor")
/* If property is set, pass back the file descriptor instead of the memory address */
if(want_posix_fd)
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 87e5e84..3c25426 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -821,7 +821,6 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
H5FD_t **x;
HDassert(n > 0);
- /* coverity["freed_arg"] */
if(NULL == (x = (H5FD_t **)H5MM_realloc(file->memb, n * sizeof(H5FD_t *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to reallocate members")
file->amembs = n;
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index fe15005..373f064 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -412,39 +412,47 @@ done:
* Purpose: Copies the log-specific file access properties.
*
* Return: Success: Ptr to a new property list
- *
* Failure: NULL
*
* Programmer: Quincey Koziol
* Thursday, April 20, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void *
H5FD_log_fapl_copy(const void *_old_fa)
{
const H5FD_log_fapl_t *old_fa = (const H5FD_log_fapl_t*)_old_fa;
- H5FD_log_fapl_t *new_fa = (H5FD_log_fapl_t *)H5MM_malloc(sizeof(H5FD_log_fapl_t));
+ H5FD_log_fapl_t *new_fa = NULL; /* New FAPL info */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5FD_log_fapl_copy, NULL)
- HDassert(new_fa);
+ HDassert(old_fa);
+
+ /* Allocate the new FAPL info */
+ if(NULL == (new_fa = (H5FD_log_fapl_t *)H5MM_calloc(sizeof(H5FD_log_fapl_t))))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL")
/* Copy the general information */
HDmemcpy(new_fa, old_fa, sizeof(H5FD_log_fapl_t));
/* Deep copy the log file name */
- if(old_fa->logfile!=NULL)
- if (NULL==(new_fa->logfile=H5MM_xstrdup(old_fa->logfile)))
+ if(old_fa->logfile != NULL)
+ if(NULL == (new_fa->logfile = H5MM_xstrdup(old_fa->logfile)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate log file name")
/* Set return value */
- ret_value=new_fa;
+ ret_value = new_fa;
done:
+ if(NULL == ret_value)
+ if(new_fa) {
+ if(new_fa->logfile)
+ H5MM_free(new_fa->logfile);
+ H5MM_free(new_fa);
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_log_fapl_copy() */
@@ -455,31 +463,26 @@ done:
* Purpose: Frees the log-specific file access properties.
*
* Return: Success: 0
- *
* Failure: -1
*
* Programmer: Quincey Koziol
* Thursday, April 20, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5FD_log_fapl_free(void *_fa)
{
H5FD_log_fapl_t *fa = (H5FD_log_fapl_t*)_fa;
- herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_log_fapl_free, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_fapl_free)
/* Free the fapl information */
if(fa->logfile)
H5MM_xfree(fa->logfile);
H5MM_xfree(fa);
-done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD_log_fapl_free() */
@@ -491,52 +494,52 @@ done:
* Return: Success: A pointer to a new file data structure. The
* public fields will be initialized by the
* caller, which is always H5FD_open().
- *
* Failure: NULL
*
* Programmer: Robb Matzke
* Thursday, July 29, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static H5FD_t *
H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr)
{
- int o_flags;
- int fd=(-1);
- H5FD_log_t *file=NULL;
+ int o_flags;
+ int fd = (-1);
+ H5FD_log_t *file = NULL;
H5FD_log_fapl_t *fa; /* File access property list information */
#ifdef _WIN32
HFILE filehandle;
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
#endif
- h5_stat_t sb;
+ h5_stat_t sb;
H5P_genplist_t *plist; /* Property list */
H5FD_t *ret_value;
FUNC_ENTER_NOAPI(H5FD_log_open, NULL)
/* Check arguments */
- if (!name || !*name)
+ 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))
+ if(ADDR_OVERFLOW(maxaddr))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr")
/* Build the open flags */
o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY;
- if (H5F_ACC_TRUNC & flags) o_flags |= O_TRUNC;
- if (H5F_ACC_CREAT & flags) o_flags |= O_CREAT;
- if (H5F_ACC_EXCL & flags) o_flags |= O_EXCL;
+ if(H5F_ACC_TRUNC & flags)
+ o_flags |= O_TRUNC;
+ if(H5F_ACC_CREAT & flags)
+ o_flags |= O_CREAT;
+ if(H5F_ACC_EXCL & flags)
+ o_flags |= O_EXCL;
/* 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")
- if (HDfstat(fd, &sb)<0)
+ if(HDfstat(fd, &sb) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file")
/* Create the new file struct */
@@ -544,7 +547,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct")
/* Get the driver specific information */
- if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
+ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
fa = (H5FD_log_fapl_t *)H5P_get_driver_info(plist);
HDassert(fa);
@@ -564,7 +567,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id,
#endif
/* Get the flags for logging */
- file->fa.flags=fa->flags;
+ file->fa.flags = fa->flags;
/* Check if we are doing any logging at all */
if(file->fa.flags != 0) {
@@ -598,6 +601,7 @@ done:
if(NULL == ret_value) {
if(fd >= 0)
HDclose(fd);
+ file = (H5FD_log_t *)H5MM_xfree(file);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -610,14 +614,11 @@ done:
* Purpose: Closes a Unix file.
*
* Return: Success: 0
- *
* Failure: -1, file not closed.
*
* Programmer: Robb Matzke
* Thursday, July 29, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -628,7 +629,7 @@ H5FD_log_close(H5FD_t *_file)
struct timeval timeval_start,timeval_stop;
struct timeval timeval_diff;
#endif /* H5_HAVE_GETTIMEOFDAY */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_log_close, FAIL)
@@ -636,7 +637,7 @@ H5FD_log_close(H5FD_t *_file)
if(file->fa.flags&H5FD_LOG_TIME_CLOSE)
HDgettimeofday(&timeval_start,NULL);
#endif /* H5_HAVE_GETTIMEOFDAY */
- if (HDclose(file->fd)<0)
+ if(HDclose(file->fd) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
#ifdef H5_HAVE_GETTIMEOFDAY
if(file->fa.flags&H5FD_LOG_TIME_CLOSE)
@@ -644,73 +645,73 @@ H5FD_log_close(H5FD_t *_file)
#endif /* H5_HAVE_GETTIMEOFDAY */
/* Dump I/O information */
- if(file->fa.flags!=0) {
+ if(file->fa.flags != 0) {
haddr_t addr;
haddr_t last_addr;
unsigned char last_val;
#ifdef H5_HAVE_GETTIMEOFDAY
- if(file->fa.flags&H5FD_LOG_TIME_CLOSE) {
+ if(file->fa.flags & H5FD_LOG_TIME_CLOSE) {
/* Calculate the elapsed gettimeofday time */
- timeval_diff.tv_usec=timeval_stop.tv_usec-timeval_start.tv_usec;
- timeval_diff.tv_sec=timeval_stop.tv_sec-timeval_start.tv_sec;
- if(timeval_diff.tv_usec<0) {
- timeval_diff.tv_usec+=1000000;
+ timeval_diff.tv_usec = timeval_stop.tv_usec - timeval_start.tv_usec;
+ timeval_diff.tv_sec = timeval_stop.tv_sec - timeval_start.tv_sec;
+ if(timeval_diff.tv_usec < 0) {
+ timeval_diff.tv_usec += 1000000;
timeval_diff.tv_sec--;
} /* end if */
- HDfprintf(file->logfp,"Close took: (%f s)\n",(double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0));
+ HDfprintf(file->logfp, "Close took: (%f s)\n", (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0));
} /* end if */
#endif /* H5_HAVE_GETTIMEOFDAY */
/* Dump the write I/O information */
- if(file->fa.flags&H5FD_LOG_FILE_WRITE) {
- HDfprintf(file->logfp,"Dumping write I/O information:\n");
- last_val=file->nwrite[0];
- last_addr=0;
- addr=1;
- while(addr<file->eoa) {
- if(file->nwrite[addr]!=last_val) {
- HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) written to %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val);
- last_val=file->nwrite[addr];
- last_addr=addr;
+ if(file->fa.flags & H5FD_LOG_FILE_WRITE) {
+ HDfprintf(file->logfp, "Dumping write I/O information:\n");
+ last_val = file->nwrite[0];
+ last_addr = 0;
+ addr = 1;
+ while(addr < file->eoa) {
+ if(file->nwrite[addr] != last_val) {
+ HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) written to %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
+ last_val = file->nwrite[addr];
+ last_addr = addr;
} /* end if */
addr++;
} /* end while */
- HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) written to %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val);
+ HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) written to %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
} /* end if */
/* Dump the read I/O information */
- if(file->fa.flags&H5FD_LOG_FILE_READ) {
- HDfprintf(file->logfp,"Dumping read I/O information:\n");
- last_val=file->nread[0];
- last_addr=0;
- addr=1;
- while(addr<file->eoa) {
- if(file->nread[addr]!=last_val) {
- HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) read from %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val);
- last_val=file->nread[addr];
- last_addr=addr;
+ if(file->fa.flags & H5FD_LOG_FILE_READ) {
+ HDfprintf(file->logfp, "Dumping read I/O information:\n");
+ last_val = file->nread[0];
+ last_addr = 0;
+ addr = 1;
+ while(addr < file->eoa) {
+ if(file->nread[addr] != last_val) {
+ HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) read from %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
+ last_val = file->nread[addr];
+ last_addr = addr;
} /* end if */
addr++;
} /* end while */
- HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) read from %3d times\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),(int)last_val);
+ HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) read from %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val);
} /* end if */
/* Dump the I/O flavor information */
- if(file->fa.flags&H5FD_LOG_FLAVOR) {
- HDfprintf(file->logfp,"Dumping I/O flavor information:\n");
- last_val=file->flavor[0];
- last_addr=0;
- addr=1;
- while(addr<file->eoa) {
- if(file->flavor[addr]!=last_val) {
- HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) flavor is %s\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),flavors[last_val]);
- last_val=file->flavor[addr];
- last_addr=addr;
+ if(file->fa.flags & H5FD_LOG_FLAVOR) {
+ HDfprintf(file->logfp, "Dumping I/O flavor information:\n");
+ last_val = file->flavor[0];
+ last_addr = 0;
+ addr = 1;
+ while(addr < file->eoa) {
+ if(file->flavor[addr] != last_val) {
+ HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) flavor is %s\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]);
+ last_val = file->flavor[addr];
+ last_addr = addr;
} /* end if */
addr++;
} /* end while */
- HDfprintf(file->logfp,"\tAddr %10a-%10a (%10lu bytes) flavor is %s\n",last_addr,(addr-1),(unsigned long)(addr-last_addr),flavors[last_val]);
+ HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) flavor is %s\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]);
} /* end if */
/* Free the logging information */
@@ -728,7 +729,7 @@ H5FD_log_close(H5FD_t *_file)
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_log_close() */
/*-------------------------------------------------------------------------
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 2070b1a..9928cf9 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -378,8 +378,10 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id,
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL)
/* Build the return value */
- if(NULL == (file = (H5FD_stdio_t *)calloc((size_t)1, sizeof(H5FD_stdio_t))))
+ if(NULL == (file = (H5FD_stdio_t *)calloc((size_t)1, sizeof(H5FD_stdio_t)))) {
+ fclose(f);
H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL)
+ } /* end if */
file->fp = f;
file->op = H5FD_STDIO_OP_SEEK;
file->pos = HADDR_UNDEF;
diff --git a/src/H5FL.c b/src/H5FL.c
index c72491d..8ac442a 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -380,7 +380,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
/* Make certain the list is initialized first */
if(!head->init)
if(H5FL_reg_init(head)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'regular' blocks")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'regular' blocks")
/* Check for nodes available on the free list first */
if(head->list!=NULL) {
@@ -399,7 +399,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
/* Otherwise allocate a node */
else {
if (NULL==(ret_value = H5FL_malloc(head->size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Increment the number of blocks allocated in list */
head->allocated++;
@@ -456,7 +456,7 @@ H5FL_reg_calloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
/* Allocate the block */
if (NULL==(ret_value = H5FL_reg_malloc(head H5FL_TRACK_INFO_INT)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Clear to zeros */
/* (Accomodate tracking information, if present) */
@@ -864,7 +864,7 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS)
/* Make certain the list is initialized first */
if(!head->init)
if(H5FL_blk_init(head)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'block' list")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'block' list")
/* check if there is a free list for blocks of this size */
/* and if there are any blocks available on the list */
@@ -953,7 +953,7 @@ H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS)
/* Allocate the block */
if (NULL==(ret_value = H5FL_blk_malloc(head,size H5FL_TRACK_INFO_INT)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Clear the block to zeros */
HDmemset(ret_value,0,size);
@@ -1335,7 +1335,7 @@ H5FL_arr_init(H5FL_arr_head_t *head)
/* Allocate a new garbage collection node */
if(NULL == (new_node = (H5FL_gc_arr_node_t *)H5MM_malloc(sizeof(H5FL_gc_arr_node_t))))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize the new garbage collection node */
new_node->list = head;
@@ -1346,7 +1346,7 @@ H5FL_arr_init(H5FL_arr_head_t *head)
/* Allocate room for the free lists */
if(NULL == (head->list_arr = (H5FL_arr_node_t *)H5MM_calloc((size_t)head->maxelem*sizeof(H5FL_arr_node_t))))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize the size of each array */
for(u = 0; u < (size_t)head->maxelem; u++)
@@ -1469,7 +1469,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem)
/* Make certain the list is initialized first */
if(!head->init)
if(H5FL_arr_init(head)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'array' blocks")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'array' blocks")
/* Sanity check that the number of elements is supported */
HDassert(elem<=(unsigned) head->maxelem);
@@ -1496,7 +1496,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem)
/* Otherwise allocate a node */
else {
if(NULL == (new_obj = (H5FL_arr_list_t *)H5FL_malloc(sizeof(H5FL_arr_list_t)+mem_size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Increment the number of blocks allocated in list */
head->allocated++;
@@ -1540,11 +1540,11 @@ H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem)
HDassert(elem);
/* Allocate the array */
- if (NULL==(ret_value = H5FL_arr_malloc(head,elem)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if(NULL == (ret_value = H5FL_arr_malloc(head, elem)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Clear to zeros */
- HDmemset(ret_value,0,head->list_arr[elem].size);
+ HDmemset(ret_value, 0, head->list_arr[elem].size);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1938,21 +1938,21 @@ done:
H5FL_fac_head_t *
H5FL_fac_init(size_t size)
{
- H5FL_fac_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */
- H5FL_fac_head_t *factory; /* Pointer to new block factory */
+ H5FL_fac_gc_node_t *new_node = NULL; /* Pointer to the node for the new list to garbage collect */
+ H5FL_fac_head_t *factory = NULL; /* Pointer to new block factory */
H5FL_fac_head_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5FL_fac_init, NULL)
/* Sanity check */
- HDassert(size>0);
+ HDassert(size > 0);
/* Allocate room for the new factory */
if(NULL == (factory = (H5FL_fac_head_t *)H5FL_CALLOC(H5FL_fac_head_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for factory object")
/* Set size of blocks for factory */
- factory->size=size;
+ factory->size = size;
/* Allocate a new garbage collection node */
if(NULL == (new_node = (H5FL_fac_gc_node_t *)H5FL_MALLOC(H5FL_fac_gc_node_t)))
@@ -1962,15 +1962,15 @@ H5FL_fac_init(size_t size)
new_node->list = factory;
/* Link in to the garbage collection list */
- new_node->next=H5FL_fac_gc_head.first;
- H5FL_fac_gc_head.first=new_node;
+ new_node->next = H5FL_fac_gc_head.first;
+ H5FL_fac_gc_head.first = new_node;
if(new_node->next)
new_node->next->list->prev_gc=new_node;
/* The new factory's prev_gc field will be set to NULL */
/* Make certain that the space allocated is large enough to store a free list pointer (eventually) */
- if(factory->size<sizeof(H5FL_fac_node_t))
- factory->size=sizeof(H5FL_fac_node_t);
+ if(factory->size < sizeof(H5FL_fac_node_t))
+ factory->size = sizeof(H5FL_fac_node_t);
/* Make certain there's room for tracking information, if any */
#ifdef H5FL_TRACK
@@ -1978,12 +1978,19 @@ H5FL_fac_init(size_t size)
#endif /* H5FL_TRACK */
/* Indicate that the free list is initialized */
- factory->init=1;
+ factory->init = 1;
/* Set return value */
- ret_value=factory;
+ ret_value = factory;
done:
+ if(!ret_value) {
+ if(factory)
+ factory = H5FL_FREE(H5FL_fac_head_t, factory);
+ if(new_node)
+ new_node = H5FL_FREE(H5FL_fac_gc_node_t, new_node);
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FL_fac_init() */
@@ -2123,7 +2130,7 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS)
/* Otherwise allocate a node */
else {
if (NULL==(ret_value = H5FL_malloc(head->size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Increment the number of blocks allocated in list */
head->allocated++;
@@ -2184,7 +2191,7 @@ H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS)
/* Allocate the block */
if (NULL==(ret_value = H5FL_fac_malloc(head H5FL_TRACK_INFO_INT)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Clear to zeros */
/* (Accomodate tracking information, if present) */
diff --git a/src/H5FO.c b/src/H5FO.c
index 6982e36..bbc3b7d 100644
--- a/src/H5FO.c
+++ b/src/H5FO.c
@@ -320,7 +320,7 @@ H5FO_marked(const H5F_t *f, haddr_t addr)
/* Get the object node from the container */
if(NULL != (open_obj = (H5FO_open_obj_t *)H5SL_search(f->shared->open_objs, &addr)))
- ret_value = (htri_t)open_obj->deleted;
+ ret_value = open_obj->deleted;
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FO_marked() */
diff --git a/src/H5FS.c b/src/H5FS.c
index 5e3392e..8ee6db4 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -382,7 +382,7 @@ HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC);
fspace->alloc_sect_size = (size_t)fspace->sect_size;
/* Mark free space header as dirty */
- if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
} /* end if */
} /* end if */
@@ -439,7 +439,7 @@ HDfprintf(stderr, "%s: Section info went 'go away'\n", FUNC);
fspace->alloc_sect_size = 0;
/* Mark free space header as dirty */
- if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
} /* end else */
} /* end if */
@@ -455,7 +455,7 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC);
fspace->alloc_sect_size = 0;
/* Mark free space header as dirty */
- if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
/* Free previous serialized sections disk space */
@@ -508,7 +508,7 @@ H5FS_t *
H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[],
void *cls_init_udata)
{
- H5FS_t *fspace; /* Free space manager */
+ H5FS_t *fspace = NULL; /* Free space manager */
size_t u; /* Local index variable */
H5FS_t *ret_value; /* Return value */
@@ -556,6 +556,16 @@ H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[],
ret_value = fspace;
done:
+ if(!ret_value)
+ if(fspace) {
+ /* Should probably call the class 'term' callback for all classes
+ * that have had their 'init' callback called... -QAK
+ */
+ if(fspace->sect_cls)
+ fspace->sect_cls = (H5FS_section_class_t *)H5FL_SEQ_FREE(H5FS_section_class_t, fspace->sect_cls);
+ fspace = H5FL_FREE(H5FS_t, fspace);
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS_new() */
@@ -623,7 +633,7 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp
/* Check if we should pin the header in the cache */
if(fspace->rc == 0 && H5F_addr_defined(fspace->addr))
- if(H5AC_pin_protected_entry(f, fspace) < 0)
+ if(H5AC_pin_protected_entry(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPIN, FAIL, "unable to pin free space header")
/* Increment reference count on header */
@@ -669,7 +679,7 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp
/* Check if we should unpin the header in the cache */
if(fspace->rc == 0) {
if(H5F_addr_defined(fspace->addr)) {
- if(H5AC_unpin_entry(f, fspace) < 0)
+ if(H5AC_unpin_entry(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space header")
} /* end if */
else {
@@ -713,7 +723,7 @@ HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC);
/* Check if the free space manager is persistant */
if(H5F_addr_defined(fspace->addr))
/* Mark header as dirty in cache */
- if(H5AC_mark_pinned_or_protected_entry_dirty(f, fspace) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty")
done:
@@ -874,7 +884,7 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id)
if(hdr_status & H5AC_ES__IN_CACHE) {
/* Unpin the free-space manager header */
- if(H5AC_unpin_entry(f, fspace) < 0)
+ if(H5AC_unpin_entry(fspace) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header")
/* Load the free-space manager header */
diff --git a/src/H5FScache.c b/src/H5FScache.c
index 482b9cb..1761adf 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -89,6 +89,7 @@ static herr_t H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, h
static herr_t H5FS_cache_sinfo_clear(H5F_t *f, H5FS_sinfo_t *sinfo, hbool_t destroy);
static herr_t H5FS_cache_sinfo_size(const H5F_t *f, const H5FS_sinfo_t *sinfo, size_t *size_ptr);
+
/*********************/
/* Package Variables */
/*********************/
@@ -135,12 +136,12 @@ H5FL_BLK_DEFINE_STATIC(sect_block);
*
* Purpose: Loads a free space manager header from the disk.
*
- * Return: Success: Pointer to a new free space header
- * Failure: NULL
+ * Return: Success: Pointer to a new free space header
+ * Failure: NULL
*
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * May 2 2006
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * May 2 2006
*
*-------------------------------------------------------------------------
*/
@@ -160,9 +161,6 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_fs_prot,
H5FS_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_load)
-#ifdef QAK
-HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr);
-#endif /* QAK */
/* Check arguments */
HDassert(f);
@@ -247,12 +245,12 @@ HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr);
H5F_DECODE_LENGTH(f, p, fspace->alloc_sect_size);
/* Compute checksum on indirect block */
- computed_chksum = H5_checksum_metadata(hdr, (size_t)(p - hdr), 0);
+ computed_chksum = H5_checksum_metadata(hdr, (size_t)(p - (const uint8_t *)hdr), 0);
/* Metadata checksum */
UINT32DECODE(p, stored_chksum);
- HDassert((size_t)(p - hdr) == size);
+ HDassert((size_t)(p - (const uint8_t *)hdr) == size);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -279,9 +277,9 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * May 2 2006
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * May 2 2006
*
*-------------------------------------------------------------------------
*/
@@ -293,11 +291,6 @@ H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_flush)
-#ifdef QAK
-HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy);
-HDfprintf(stderr, "%s: fspace->sect_addr = %a, fspace->sinfo = %p\n", FUNC, fspace->sect_addr, fspace->sinfo);
-HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size);
-#endif /* QAK */
/* check arguments */
HDassert(f);
@@ -335,12 +328,6 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n"
HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to save free space section info to disk")
} /* end if */
-#ifdef QAK
-HDfprintf(stderr, "%s: Check 2.0\n", FUNC);
-HDfprintf(stderr, "%s: fspace->sect_addr = %a, fspace->sinfo = %p\n", FUNC, fspace->sect_addr, fspace->sinfo);
-HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size);
-#endif /* QAK */
-
/* Mark section info clean */
fspace->sinfo->dirty = FALSE;
} /* end if */
@@ -416,7 +403,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n"
H5F_ENCODE_LENGTH(f, p, fspace->alloc_sect_size);
/* Compute checksum */
- metadata_chksum = H5_checksum_metadata(hdr, (size_t)(p - hdr), 0);
+ metadata_chksum = H5_checksum_metadata(hdr, (size_t)(p - (uint8_t *)hdr), 0);
/* Metadata checksum */
UINT32ENCODE(p, metadata_chksum);
@@ -579,12 +566,12 @@ H5FS_cache_hdr_size(const H5F_t *f, const H5FS_t UNUSED *fspace, size_t *size_pt
*
* Purpose: Loads free space sections from the disk.
*
- * Return: Success: Pointer to a new free space section info
- * Failure: NULL
+ * Return: Success: Pointer to a new free space section info
+ * Failure: NULL
*
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * July 31 2006
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * July 31 2006
*
*-------------------------------------------------------------------------
*/
@@ -602,9 +589,6 @@ H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *
H5FS_sinfo_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_load)
-#ifdef QAK
-HDfprintf(stderr, "%s: Load free space sections, addr = %a\n", FUNC, addr);
-#endif /* QAK */
/* Check arguments */
HDassert(f);
@@ -621,9 +605,6 @@ HDfprintf(stderr, "%s: Load free space sections, addr = %a\n", FUNC, addr);
/* Allocate space for the buffer to serialize the sections into */
H5_ASSIGN_OVERFLOW(/* To: */ old_sect_size, /* From: */ fspace->sect_size, /* From: */ hsize_t, /* To: */ size_t);
-#ifdef QAK
-HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size);
-#endif /* QAK */
if(NULL == (buf = H5FL_BLK_MALLOC(sect_block, (size_t)fspace->sect_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
@@ -645,9 +626,6 @@ HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size);
/* Address of free space header for these sections */
H5F_addr_decode(f, &p, &fs_addr);
-#ifdef QAK
-HDfprintf(stderr, "%s: fspace->addr = %a, fs_addr = %a\n", FUNC, fspace->addr, fs_addr);
-#endif /* QAK */
if(H5F_addr_ne(fs_addr, fspace->addr))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "incorrect header address for free space sections")
@@ -661,22 +639,12 @@ HDfprintf(stderr, "%s: fspace->addr = %a, fs_addr = %a\n", FUNC, fspace->addr, f
/* Compute the size of the section counts */
sect_cnt_size = H5V_limit_enc_size((uint64_t)fspace->serial_sect_count);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect_cnt_size = %u\n", FUNC, sect_cnt_size);
-HDfprintf(stderr, "%s: fspace->sect_len_size = %u\n", FUNC, fspace->sect_len_size);
-#endif /* QAK */
/* Reset the section count, the "add" routine will update it */
old_tot_sect_count = fspace->tot_sect_count;
old_serial_sect_count = fspace->serial_sect_count;
old_ghost_sect_count = fspace->ghost_sect_count;
old_tot_space = fspace->tot_space;
-#ifdef QAK
-HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_count);
-HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", FUNC, fspace->serial_sect_count);
-HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_sect_count);
-HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space);
-#endif /* QAK */
fspace->tot_sect_count = 0;
fspace->serial_sect_count = 0;
fspace->ghost_sect_count = 0;
@@ -690,16 +658,10 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space);
/* The number of sections of this node's size */
UINT64DECODE_VAR(p, node_count, sect_cnt_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: node_count = %Zu\n", FUNC, node_count);
-#endif /* QAK */
HDassert(node_count);
/* The size of the sections for this node */
UINT64DECODE_VAR(p, sect_size, sinfo->sect_len_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect_size = %Hu\n", FUNC, sect_size);
-#endif /* QAK */
HDassert(sect_size);
/* Loop over nodes of this size */
@@ -711,15 +673,9 @@ HDfprintf(stderr, "%s: sect_size = %Hu\n", FUNC, sect_size);
/* The address of the section */
UINT64DECODE_VAR(p, sect_addr, sinfo->sect_off_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect_addr = %a\n", FUNC, sect_addr);
-#endif /* QAK */
/* The type of this section */
sect_type = *p++;
-#ifdef QAK
-HDfprintf(stderr, "%s: sect_type = %u\n", FUNC, sect_type);
-#endif /* QAK */
/* Call 'deserialize' callback for this section */
des_flags = 0;
@@ -729,9 +685,6 @@ HDfprintf(stderr, "%s: sect_type = %u\n", FUNC, sect_type);
/* Update offset in serialization buffer */
p += fspace->sect_cls[sect_type].serial_size;
-#ifdef QAK
-HDfprintf(stderr, "%s: fspace->sect_cls[%u].serial_size = %Zu\n", FUNC, sect_type, fspace->sect_cls[sect_type].serial_size);
-#endif /* QAK */
/* Insert section in free space manager, unless requested not to */
if(!(des_flags & H5FS_DESERIALIZE_NO_ADD))
@@ -750,18 +703,18 @@ HDfprintf(stderr, "%s: fspace->sect_cls[%u].serial_size = %Zu\n", FUNC, sect_typ
} /* end if */
/* Compute checksum on indirect block */
- computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0);
+ computed_chksum = H5_checksum_metadata(buf, (size_t)(p - (const uint8_t *)buf), 0);
/* Metadata checksum */
UINT32DECODE(p, stored_chksum);
- /* Sanity check */
- HDassert((size_t)(p - buf) == old_sect_size);
-
/* Verify checksum */
if(stored_chksum != computed_chksum)
HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap indirect block")
+ /* Sanity check */
+ HDassert((size_t)(p - (const uint8_t *)buf) == old_sect_size);
+
/* Set return value */
ret_value = sinfo;
@@ -781,8 +734,7 @@ done:
* Purpose: Skip list iterator callback to serialize free space sections
* of a particular size
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Monday, May 8, 2006
@@ -811,15 +763,9 @@ H5FS_sinfo_serialize_sect_cb(void *_item, void UNUSED *key, void *_udata)
if(!(sect_cls->flags & H5FS_CLS_GHOST_OBJ)) {
/* The address of the section */
UINT64ENCODE_VAR(*udata->p, sect->addr, udata->sinfo->sect_off_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->addr = %a\n", FUNC, sect->addr);
-#endif /* QAK */
/* The type of this section */
*(*udata->p)++ = (uint8_t)sect->type;
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->type = %u\n", FUNC, (unsigned)sect->type);
-#endif /* QAK */
/* Call 'serialize' callback for this section */
if(sect_cls->serialize) {
@@ -844,8 +790,7 @@ done:
* Purpose: Skip list iterator callback to serialize free space sections
* in a bin
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Monday, May 8, 2006
@@ -870,15 +815,9 @@ H5FS_sinfo_serialize_node_cb(void *_item, void UNUSED *key, void *_udata)
if(fspace_node->serial_count > 0) {
/* The number of serializable sections of this node's size */
UINT64ENCODE_VAR(*udata->p, fspace_node->serial_count, udata->sect_cnt_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: fspace_node->serial_count = %Zu\n", FUNC, fspace_node->serial_count);
-#endif /* QAK */
/* The size of the sections for this node */
UINT64ENCODE_VAR(*udata->p, fspace_node->sect_size, udata->sinfo->sect_len_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect_size = %Hu\n", FUNC, fspace_node->sect_size);
-#endif /* QAK */
/* Iterate through all the sections of this size */
HDassert(fspace_node->sect_list);
@@ -898,15 +837,10 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * July 31 2006
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * July 31 2006
*
- * Changes: JRM -- 8/21/06
- * Added the flags_ptr parameter. This parameter exists to
- * allow the flush routine to report to the cache if the
- * entry is resized or renamed as a result of the flush.
- * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry.
*-------------------------------------------------------------------------
*/
static herr_t
@@ -915,9 +849,6 @@ H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_flush)
-#ifdef QAK
-HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy);
-#endif /* QAK */
/* check arguments */
HDassert(f);
@@ -951,23 +882,14 @@ HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", F
*p++ = H5FS_SINFO_VERSION;
/* Address of free space header for these sections */
-#ifdef QAK
-HDfprintf(stderr, "%s: sinfo->fspace->addr = %a\n", FUNC, sinfo->fspace->addr);
-#endif /* QAK */
H5F_addr_encode(f, &p, sinfo->fspace->addr);
/* Set up user data for iterator */
udata.sinfo = sinfo;
udata.p = &p;
udata.sect_cnt_size = H5V_limit_enc_size((uint64_t)sinfo->fspace->serial_sect_count);
-#ifdef QAK
-HDfprintf(stderr, "%s: udata.sect_cnt_size = %u\n", FUNC, udata.sect_cnt_size);
-#endif /* QAK */
/* Iterate over all the bins */
-#ifdef QAK
-HDfprintf(stderr, "%s: Serializing section bins\n", FUNC);
-#endif /* QAK */
for(bin = 0; bin < sinfo->nbins; bin++) {
/* Check if there are any sections in this bin */
if(sinfo->bins[bin].bin_list) {
@@ -986,10 +908,6 @@ HDfprintf(stderr, "%s: Serializing section bins\n", FUNC);
/* Sanity check */
HDassert((size_t)(p - buf) == sinfo->fspace->sect_size);
HDassert(sinfo->fspace->sect_size <= sinfo->fspace->alloc_sect_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: sinfo->fspace->sect_size = %Hu\n", FUNC, sinfo->fspace->sect_size);
-HDfprintf(stderr, "%s: sinfo->fspace->alloc_sect_size = %Hu\n", FUNC, sinfo->fspace->alloc_sect_size);
-#endif /* QAK */
/* 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)
@@ -1094,15 +1012,12 @@ H5FS_sinfo_free_node_cb(void *item, void UNUSED *key, void *op_data)
*-------------------------------------------------------------------------
*/
herr_t
-H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo)
+H5FS_cache_sinfo_dest(H5F_t UNUSED *f, H5FS_sinfo_t *sinfo)
{
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_dest)
-#ifdef QAK
-HDfprintf(stderr, "%s: Destroying section info, sinfo->fspace->addr = %a\n", FUNC, sinfo->fspace->addr);
-#endif /* QAK */
/*
* Check arguments.
diff --git a/src/H5FSsection.c b/src/H5FSsection.c
index 30885a9..26aac37 100644
--- a/src/H5FSsection.c
+++ b/src/H5FSsection.c
@@ -939,7 +939,8 @@ static herr_t
H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls,
H5FS_section_info_t *sect)
{
- H5FS_node_t *fspace_node = NULL; /* Pointer to free space node of the correct size */
+ H5FS_node_t *fspace_node = NULL; /* Pointer to free space node of the correct size */
+ hbool_t fspace_node_alloc = FALSE; /* Whether the free space node was allocated */
unsigned bin; /* Bin to put the free space section in */
herr_t ret_value = SUCCEED; /* Return value */
@@ -971,6 +972,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s
/* Allocate new free list size node */
if(NULL == (fspace_node = H5FL_MALLOC(H5FS_node_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for free space node")
+ fspace_node_alloc = TRUE;
/* Initialize the free list size node */
fspace_node->sect_size = sect->size;
@@ -981,6 +983,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s
/* Insert new free space size node into bin's list */
if(H5SL_insert(sinfo->bins[bin].bin_list, fspace_node, &fspace_node->sect_size) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space node into skip list")
+ fspace_node_alloc = FALSE; /* (owned by the bin skip list now, don't need to free on error) */
/* Increment number of section sizes */
sinfo->tot_size_count++;
@@ -1016,6 +1019,13 @@ HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bi
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space node into skip list")
done:
+ if(ret_value < 0)
+ if(fspace_node && fspace_node_alloc) {
+ if(fspace_node->sect_list && H5SL_close(fspace_node->sect_list) < 0)
+ HDONE_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "can't destroy size free space node's skip list")
+ fspace_node = H5FL_FREE(H5FS_node_t, fspace_node);
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS_sect_link_size() */
diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c
index 723005e..ba55b8f 100644
--- a/src/H5Fdbg.c
+++ b/src/H5Fdbg.c
@@ -123,8 +123,7 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth)
f->shared->root_grp ? "" : "(none)");
if(f->shared->root_grp) {
if(f->shared->sblock->root_ent) /* Use real root group symbol table entry */
- H5G_ent_debug(f, f->shared->sblock->root_ent, stream, indent + 3,
- MAX(0, fwidth - 3), NULL);
+ H5G_ent_debug(f->shared->sblock->root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL);
else {
H5O_loc_t *root_oloc; /* Root object location */
H5G_entry_t root_ent; /* Constructed root symbol table entry */
@@ -140,7 +139,7 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth)
root_ent.file = f;
/* Display root group symbol table entry info */
- H5G_ent_debug(f, &root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL);
+ H5G_ent_debug(&root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL);
} /* end else */
} /* end if */
diff --git a/src/H5Ffake.c b/src/H5Ffake.c
index 09e87f2..e96aedf 100644
--- a/src/H5Ffake.c
+++ b/src/H5Ffake.c
@@ -67,7 +67,7 @@ H5F_init_fake_interface(void)
*-------------------------------------------------------------------------
*/
H5F_t *
-H5F_fake_alloc(size_t sizeof_size)
+H5F_fake_alloc(uint8_t sizeof_size)
{
H5F_t *f = NULL; /* Pointer to fake file struct */
H5F_t *ret_value; /* Return value */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 29f3aa7..2952bac 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -526,12 +526,10 @@ H5_DLL herr_t H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr,
size_t size, hid_t dxpl_id, const void *buf);
/* Address-related functions */
-H5_DLL void H5F_addr_encode(const H5F_t *, uint8_t** /*in,out*/, haddr_t);
-H5_DLL void H5F_addr_encode_len(size_t addr_len, uint8_t** /*in,out*/, haddr_t);
-H5_DLL void H5F_addr_decode(const H5F_t *, const uint8_t** /*in,out*/,
- haddr_t* /*out*/);
-H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t** /*in,out*/,
- haddr_t* /*out*/);
+H5_DLL void H5F_addr_encode(const H5F_t *f, uint8_t **pp, haddr_t addr);
+H5_DLL void H5F_addr_encode_len(size_t addr_len, uint8_t **pp, haddr_t addr);
+H5_DLL void H5F_addr_decode(const H5F_t *f, const uint8_t **pp, haddr_t *addr_p);
+H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *addr_p);
/* File access property list callbacks */
H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data);
@@ -540,7 +538,7 @@ H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data);
H5_DLL herr_t H5F_sfile_assert_num(unsigned n);
/* Routines for creating & destroying "fake" file structures */
-H5_DLL H5F_t *H5F_fake_alloc(size_t sizeof_size);
+H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size);
H5_DLL herr_t H5F_fake_free(H5F_t *f);
/* Superblock related routines */
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 0f79660..71d9fef 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -21,8 +21,8 @@
/* Public header files needed by this file */
#include "H5public.h"
-#include "H5Cpublic.h"
#include "H5ACpublic.h"
+#include "H5Cpublic.h"
#include "H5Ipublic.h"
/* When this header is included from a private header, don't make calls to H5check() */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index c24cfa1..eb739dc 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -74,6 +74,7 @@ H5FL_DEFINE(H5F_super_t);
/* Local Variables */
/*******************/
+
/*--------------------------------------------------------------------------
NAME
@@ -263,7 +264,7 @@ H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr)
/* Twiddle the number of open objects to avoid closing the file. */
f->nopen_objs++;
if(H5O_close(ext_ptr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "unable to close superblock extension")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close superblock extension")
f->nopen_objs--;
done:
@@ -326,7 +327,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id)
sblock_flags |= H5AC__DIRTIED_FLAG;
/* Pin the superblock in the cache */
- if(H5AC_pin_protected_entry(f, sblock) < 0)
+ if(H5AC_pin_protected_entry(sblock) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPIN, FAIL, "unable to pin superblock")
/* Set the pointer to the pinned superblock */
@@ -528,7 +529,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
/* Create the superblock extension for "extra" superblock data, if necessary. */
if(need_ext) {
- H5O_loc_t ext_loc; /* Superblock extension object location */
+ H5O_loc_t ext_loc; /* Superblock extension object location */
/* The superblock extension isn't actually a group, but the
* default group creation list should work fine.
@@ -539,7 +540,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
* extension.
*/
if(H5F_super_ext_create(f, dxpl_id, &ext_loc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to start file's superblock extension")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create superblock extension")
/* Create the Shared Object Header Message table and register it with
* the metadata cache, if this file supports shared messages.
@@ -608,7 +609,7 @@ done:
/* Check if we've cached it already */
if(sblock_in_cache) {
/* Unpin superblock in cache */
- if(H5AC_unpin_entry(f, sblock) < 0)
+ if(H5AC_unpin_entry(sblock) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTUNPIN, FAIL, "unable to unpin superblock")
/* Evict the superblock from the cache */
@@ -654,7 +655,7 @@ H5F_super_dirty(H5F_t *f)
HDassert(f->shared->sblock);
/* Mark superblock dirty in cache, so change to EOA will get encoded */
- if(H5AC_mark_pinned_or_protected_entry_dirty(f, f->shared->sblock) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(f->shared->sblock) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty")
done:
@@ -787,7 +788,7 @@ H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_
done:
/* Mark superblock dirty in cache, if necessary */
if(sblock_dirty)
- if(H5AC_mark_pinned_or_protected_entry_dirty(f, f->shared->sblock) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(f->shared->sblock) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty")
FUNC_LEAVE_NOAPI(ret_value)
@@ -803,6 +804,7 @@ done:
*
* Programmer: Vailin Choi; Feb 2009
*
+ *
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c
index f7a35b9..e6e980b 100644
--- a/src/H5Fsuper_cache.c
+++ b/src/H5Fsuper_cache.c
@@ -155,6 +155,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, const void UNUSED
/* Read fixed-size portion of the superblock */
p = sbuf;
+ H5_CHECK_OVERFLOW(fixed_size, size_t, haddr_t);
if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, (haddr_t)fixed_size) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "set end of space allocation request failed")
if(H5FD_read(lf, dxpl_id, H5FD_MEM_SUPER, (haddr_t)0, fixed_size, p) < 0)
diff --git a/src/H5Gcache.c b/src/H5Gcache.c
index 6d497b6..1b352ca 100644
--- a/src/H5Gcache.c
+++ b/src/H5Gcache.c
@@ -119,13 +119,6 @@ H5FL_SEQ_EXTERN(H5G_entry_t);
* matzke@llnl.gov
* Jun 23 1997
*
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
- *
- * Quincey Koziol, 2002-7-180
- * Added dxpl parameter to allow more control over I/O from metadata
- * cache.
*-------------------------------------------------------------------------
*/
static H5G_node_t *
@@ -223,26 +216,6 @@ done:
* matzke@llnl.gov
* Jun 23 1997
*
- * Modifications:
- * rky, 1998-08-28
- * Only p0 writes metadata to disk.
- *
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
- *
- * Quincey Koziol, 2002-7-180
- * Added dxpl parameter to allow more control over I/O from metadata
- * cache.
- *
- * Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002
- * Added `id to name' support.
- *
- * JRM -- 8/21/06
- * Added the flags_ptr parameter. This parameter exists to
- * allow the flush routine to report to the cache if the
- * entry is resized or renamed as a result of the flush.
- * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -350,8 +323,6 @@ done:
* koziol@ncsa.uiuc.edu
* Jan 15 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -384,7 +355,7 @@ H5G_node_dest(H5F_t *f, H5G_node_t *sym)
/* Release resources */
if(sym->entry)
sym->entry = (H5G_entry_t *)H5FL_SEQ_FREE(H5G_entry_t, sym->entry);
- (void)H5FL_FREE(H5G_node_t, sym);
+ sym = H5FL_FREE(H5G_node_t, sym);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -402,8 +373,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 20 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -412,28 +381,28 @@ H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy)
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT(H5G_node_clear);
+ FUNC_ENTER_NOAPI_NOINIT(H5G_node_clear)
/*
* Check arguments.
*/
- assert(sym);
+ HDassert(sym);
/* Look for dirty entries and reset their dirty flag. */
for(u = 0; u < sym->nsyms; u++)
- sym->entry[u].dirty=FALSE;
+ sym->entry[u].dirty = FALSE;
sym->cache_info.is_dirty = FALSE;
/*
* Destroy the symbol node? This might happen if the node is being
* preempted from the cache.
*/
- if (destroy)
- if (H5G_node_dest(f, sym) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node");
+ if(destroy)
+ if(H5G_node_dest(f, sym) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_node_clear() */
@@ -449,14 +418,12 @@ done:
* Programmer: John Mainzer
* 5/13/04
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5G_node_size(const H5F_t *f, const H5G_node_t UNUSED *sym, size_t *size_ptr)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_size);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_size)
/*
* Check arguments.
@@ -466,6 +433,6 @@ H5G_node_size(const H5F_t *f, const H5G_node_t UNUSED *sym, size_t *size_ptr)
*size_ptr = H5G_node_size_real(f);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5G_node_size() */
diff --git a/src/H5Gent.c b/src/H5Gent.c
index 65f302c..18883ac 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -55,7 +55,7 @@ H5FL_BLK_EXTERN(str_buf);
*-------------------------------------------------------------------------
*/
herr_t
-H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n)
+H5G_ent_decode_vec(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n)
{
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -94,7 +94,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent)
+H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent)
{
const uint8_t *p_ret = *pp;
uint32_t tmp;
@@ -161,7 +161,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n)
+H5G_ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n)
{
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -422,8 +422,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_ent_debug(H5F_t UNUSED *f, const H5G_entry_t *ent, FILE *stream,
- int indent, int fwidth, H5HL_t *heap)
+H5G_ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth,
+ H5HL_t *heap)
{
const char *lval = NULL;
int nested_indent, nested_fwidth;
@@ -471,7 +471,7 @@ H5G_ent_debug(H5F_t UNUSED *f, const H5G_entry_t *ent, FILE *stream,
"Link value offset:",
(unsigned long)(ent->cache.slink.lval_offset));
if(heap) {
- lval = (const char *)H5HL_offset_into(ent->file, heap, ent->cache.slink.lval_offset);
+ lval = (const char *)H5HL_offset_into(heap, ent->cache.slink.lval_offset);
HDfprintf(stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
"Link value:",
lval);
diff --git a/src/H5Glink.c b/src/H5Glink.c
index 488c05b..f5ad7d9 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -218,13 +218,12 @@ H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2)
*-------------------------------------------------------------------------
*/
herr_t
-H5G_ent_to_link(H5F_t *f, H5O_link_t *lnk, const H5HL_t *heap,
+H5G_ent_to_link(H5O_link_t *lnk, const H5HL_t *heap,
const H5G_entry_t *ent, const char *name)
{
FUNC_ENTER_NOAPI_NOFUNC(H5G_ent_to_link)
/* check arguments */
- HDassert(f);
HDassert(lnk);
HDassert(heap);
HDassert(ent);
@@ -241,7 +240,7 @@ H5G_ent_to_link(H5F_t *f, H5O_link_t *lnk, const H5HL_t *heap,
if(ent->type == H5G_CACHED_SLINK) {
const char *s; /* Pointer to link value */
- s = (const char *)H5HL_offset_into(f, heap, ent->cache.slink.lval_offset);
+ s = (const char *)H5HL_offset_into(heap, ent->cache.slink.lval_offset);
HDassert(s);
/* Copy the link value */
@@ -263,61 +262,6 @@ H5G_ent_to_link(H5F_t *f, H5O_link_t *lnk, const H5HL_t *heap,
/*-------------------------------------------------------------------------
- * Function: H5G_ent_to_info
- *
- * Purpose: Make link info for a symbol table entry
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Nov 16 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5G_ent_to_info(H5F_t *f, H5L_info_t *info, const H5HL_t *heap,
- const H5G_entry_t *ent)
-{
- FUNC_ENTER_NOAPI_NOFUNC(H5G_ent_to_info)
-
- /* check arguments */
- HDassert(f);
- HDassert(info);
- HDassert(heap);
- HDassert(ent);
-
- /* Set (default) common info for info */
- info->cset = H5F_DEFAULT_CSET;
- info->corder = 0;
- info->corder_valid = FALSE; /* Creation order not valid for this link */
-
- /* Object is a symbolic or hard link */
- if(ent->type == H5G_CACHED_SLINK) {
- const char *s; /* Pointer to link value */
-
- s = (const char *)H5HL_offset_into(f, heap, ent->cache.slink.lval_offset);
- HDassert(s);
-
- /* Get the link value size */
- info->u.val_size = HDstrlen(s) + 1;
-
- /* Set link type */
- info->type = H5L_TYPE_SOFT;
- } /* end if */
- else {
- /* Set address of object */
- info->u.address = ent->header;
-
- /* Set link type */
- info->type = H5L_TYPE_HARD;
- } /* end else */
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5G_ent_to_info() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G_link_to_info
*
* Purpose: Retrieve information from a link object
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index a58c66a..18125df 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -51,6 +51,7 @@ typedef struct H5G_node_key_t {
size_t offset; /*offset into heap for name */
} H5G_node_key_t;
+
/* Private macros */
#define H5G_NODE_SIZEOF_HDR(F) (H5_SIZEOF_MAGIC + 4)
@@ -131,16 +132,16 @@ H5G_node_get_shared(const H5F_t *f, const void UNUSED *_udata)
{
H5RC_t *rc;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_get_shared);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_get_shared)
- assert(f);
+ HDassert(f);
/* Increment reference count on shared B-tree node */
- rc=H5F_GRP_BTREE_SHARED(f);
+ rc = H5F_GRP_BTREE_SHARED(f);
H5RC_INC(rc);
/* Return the pointer to the ref-count object */
- FUNC_LEAVE_NOAPI(rc);
+ FUNC_LEAVE_NOAPI(rc)
} /* end H5G_node_get_shared() */
@@ -155,8 +156,6 @@ H5G_node_get_shared(const H5F_t *f, const void UNUSED *_udata)
* matzke@llnl.gov
* Jul 8 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -164,16 +163,16 @@ H5G_node_decode_key(const H5F_t *f, const H5B_t UNUSED *bt, const uint8_t *raw,
{
H5G_node_key_t *key = (H5G_node_key_t *) _key;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_decode_key);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_decode_key)
- assert(f);
- assert(raw);
- assert(key);
+ HDassert(f);
+ HDassert(raw);
+ HDassert(key);
H5F_DECODE_LENGTH(f, raw, key->offset);
- FUNC_LEAVE_NOAPI(SUCCEED);
-}
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5G_node_decode_key() */
/*-------------------------------------------------------------------------
@@ -187,8 +186,6 @@ H5G_node_decode_key(const H5F_t *f, const H5B_t UNUSED *bt, const uint8_t *raw,
* matzke@llnl.gov
* Jul 8 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -196,16 +193,16 @@ H5G_node_encode_key(const H5F_t *f, const H5B_t UNUSED *bt, uint8_t *raw, void *
{
H5G_node_key_t *key = (H5G_node_key_t *) _key;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_encode_key);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_encode_key)
- assert(f);
- assert(raw);
- assert(key);
+ HDassert(f);
+ HDassert(raw);
+ HDassert(key);
H5F_ENCODE_LENGTH(f, raw, key->offset);
- FUNC_LEAVE_NOAPI(SUCCEED);
-}
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5G_node_encode_key() */
/*-------------------------------------------------------------------------
@@ -221,8 +218,8 @@ H5G_node_encode_key(const H5F_t *f, const H5B_t UNUSED *bt, uint8_t *raw, void *
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_node_debug_key(FILE *stream, H5F_t *f, hid_t UNUSED dxpl_id, int indent,
- int fwidth, const void *_key, const void *_udata)
+H5G_node_debug_key(FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
+ int indent, int fwidth, const void *_key, const void *_udata)
{
const H5G_node_key_t *key = (const H5G_node_key_t *) _key;
const H5G_bt_common_t *udata = (const H5G_bt_common_t *) _udata;
@@ -239,7 +236,7 @@ H5G_node_debug_key(FILE *stream, H5F_t *f, hid_t UNUSED dxpl_id, int indent,
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Name:");
- s = (const char *)H5HL_offset_into(f, udata->heap, key->offset);
+ s = (const char *)H5HL_offset_into(udata->heap, key->offset);
HDfprintf(stream, "%s\n", s);
} /* end if */
else
@@ -262,8 +259,6 @@ H5G_node_debug_key(FILE *stream, H5F_t *f, hid_t UNUSED dxpl_id, int indent,
* matzke@llnl.gov
* Jun 23 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
size_t
@@ -273,7 +268,7 @@ H5G_node_size_real(const H5F_t *f)
FUNC_LEAVE_NOAPI(H5G_NODE_SIZEOF_HDR(f) +
(2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY(f));
-}
+} /* end H5G_node_size_real() */
/*-------------------------------------------------------------------------
@@ -305,7 +300,7 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key,
hsize_t size = 0;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5G_node_create);
+ FUNC_ENTER_NOAPI_NOINIT(H5G_node_create)
/*
* Check arguments.
@@ -316,12 +311,12 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key,
if(NULL == (sym = H5FL_CALLOC(H5G_node_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
size = H5G_node_size_real(f);
+ HDassert(size);
if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space")
+ if(NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f)))))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "memory allocation failed")
- sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f)));
- if(NULL == sym->entry)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
if(H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node")
/*
@@ -372,7 +367,7 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5G_node_cmp2(H5F_t *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata,
+H5G_node_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata,
void *_rt_key)
{
H5G_bt_common_t *udata = (H5G_bt_common_t *) _udata;
@@ -390,7 +385,7 @@ H5G_node_cmp2(H5F_t *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata,
HDassert(rt_key);
/* Get base address of heap */
- base = (const char *)H5HL_offset_into(f, udata->heap, (size_t)0);
+ base = (const char *)H5HL_offset_into(udata->heap, (size_t)0);
HDassert(base);
/* Get pointers to string names */
@@ -432,7 +427,7 @@ H5G_node_cmp2(H5F_t *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata,
*-------------------------------------------------------------------------
*/
static int
-H5G_node_cmp3(H5F_t *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata,
+H5G_node_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata,
void *_rt_key)
{
H5G_bt_common_t *udata = (H5G_bt_common_t *) _udata;
@@ -450,7 +445,7 @@ H5G_node_cmp3(H5F_t *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata,
HDassert(rt_key);
/* Get base address of heap */
- base = (const char *)H5HL_offset_into(f, udata->heap, (size_t)0);
+ base = (const char *)H5HL_offset_into(udata->heap, (size_t)0);
HDassert(base);
/* left side */
@@ -522,7 +517,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table node")
/* Get base address of heap */
- base = (const char *)H5HL_offset_into(f, udata->common.heap, (size_t)0);
+ base = (const char *)H5HL_offset_into(udata->common.heap, (size_t)0);
HDassert(base);
/*
@@ -628,7 +623,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node")
/* Get base address of heap */
- base = (const char *)H5HL_offset_into(f, udata->common.heap, (size_t)0);
+ base = (const char *)H5HL_offset_into(udata->common.heap, (size_t)0);
HDassert(base);
/*
@@ -796,7 +791,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
const char *base; /* Base of heap */
/* Get base address of heap */
- base = (const char *)H5HL_offset_into(f, udata->common.heap, (size_t)0);
+ base = (const char *)H5HL_offset_into(udata->common.heap, (size_t)0);
/* Find the name with a binary search */
rt = sn->nsyms;
@@ -816,7 +811,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "name not found")
/* Get a pointer to the name of the link */
- if(NULL == (lnk.name = (char *)H5HL_offset_into(f, udata->common.heap, sn->entry[idx].name_off)))
+ if(NULL == (lnk.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get link name")
/* Set up rest of link structure */
@@ -825,7 +820,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
lnk.cset = H5T_CSET_ASCII;
if(sn->entry[idx].type == H5G_CACHED_SLINK) {
lnk.type = H5L_TYPE_SOFT;
- lnk.u.soft.name = (char *)H5HL_offset_into(f, udata->common.heap, sn->entry[idx].cache.slink.lval_offset);
+ lnk.u.soft.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].cache.slink.lval_offset);
} /* end if */
else {
lnk.type = H5L_TYPE_HARD;
@@ -997,11 +992,11 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad
const char *name; /* Pointer to link name in heap */
/* Get the pointer to the name of the link in the heap */
- name = (const char *)H5HL_offset_into(f, udata->heap, ents[u].name_off);
+ name = (const char *)H5HL_offset_into(udata->heap, ents[u].name_off);
HDassert(name);
/* Convert the entry to a link */
- if(H5G_ent_to_link(f, &lnk, udata->heap, &ents[u], name) < 0)
+ if(H5G_ent_to_link(&lnk, udata->heap, &ents[u], name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5_ITER_ERROR, "unable to convert symbol table entry to link")
/* Make the callback */
@@ -1022,7 +1017,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad
done:
/* Release resources */
- if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
+ if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1066,7 +1061,7 @@ H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr
*num_objs += sn->nsyms;
done:
- if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
+ if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1095,7 +1090,7 @@ H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t add
H5G_node_t *sn = NULL;
int ret_value = H5_ITER_CONT;
- FUNC_ENTER_NOAPI(H5G_node_by_idx, H5_ITER_ERROR);
+ FUNC_ENTER_NOAPI(H5G_node_by_idx, H5_ITER_ERROR)
/*
* Check arguments.
@@ -1127,10 +1122,10 @@ H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t add
udata->num_objs += sn->nsyms;
done:
- if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
+ if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header")
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_node_by_idx() */
@@ -1155,7 +1150,7 @@ H5G_node_init(H5F_t *f)
size_t sizeof_rkey; /* Size of raw (disk) key */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5G_node_init, FAIL);
+ FUNC_ENTER_NOAPI(H5G_node_init, FAIL)
/* Check arguments. */
HDassert(f);
@@ -1175,7 +1170,7 @@ H5G_node_init(H5F_t *f)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_node_init() */
@@ -1200,13 +1195,13 @@ H5G_node_close(const H5F_t *f)
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_close)
/* Check arguments. */
- assert(f);
+ HDassert(f);
/* Free the raw B-tree node buffer */
- if (H5F_GRP_BTREE_SHARED(f))
+ if(H5F_GRP_BTREE_SHARED(f))
H5RC_DEC(H5F_GRP_BTREE_SHARED(f));
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5G_node_close */
@@ -1227,13 +1222,13 @@ int
H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
const void UNUSED *_rt_key, void *_udata)
{
- H5G_bt_it_cpy_t *udata = (H5G_bt_it_cpy_t *)_udata;
- const H5O_loc_t *src_oloc = udata->src_oloc;
- H5O_copy_t *cpy_info = udata->cpy_info;
- H5HL_t *heap = NULL;
- H5G_node_t *sn = NULL;
- unsigned int i; /* Local index variable */
- int ret_value = H5_ITER_CONT;
+ H5G_bt_it_cpy_t *udata = (H5G_bt_it_cpy_t *)_udata;
+ const H5O_loc_t *src_oloc = udata->src_oloc;
+ H5O_copy_t *cpy_info = udata->cpy_info;
+ H5HL_t *heap = NULL;
+ H5G_node_t *sn = NULL;
+ unsigned int i; /* Local index variable */
+ int ret_value = H5_ITER_CONT;
FUNC_ENTER_NOAPI(H5G_node_copy, H5_ITER_ERROR)
@@ -1273,7 +1268,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
grp_loc.oloc = (H5O_loc_t *)src_oloc;
/* Get pointer to link value in local heap */
- link_name = (char *)H5HL_offset_into(f, heap, tmp_src_ent.cache.slink.lval_offset);
+ link_name = (char *)H5HL_offset_into(heap, tmp_src_ent.cache.slink.lval_offset);
/* Check if the object pointed by the soft link exists in the source file */
if(H5G_loc_info(&grp_loc, link_name, FALSE, &oinfo, H5P_DEFAULT, dxpl_id) >= 0) {
@@ -1311,7 +1306,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
/* Construct link information for eventual insertion */
lnk.type = H5L_TYPE_SOFT;
- lnk.u.soft.name = (char *)H5HL_offset_into(f, heap, src_ent->cache.slink.lval_offset);
+ lnk.u.soft.name = (char *)H5HL_offset_into(heap, src_ent->cache.slink.lval_offset);
} /* else if */
else
HDassert(0 && "Unknown entry type");
@@ -1323,7 +1318,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
/* lnk.name = name; */ /* This will be set in callback */
/* Determine name of source object */
- name = (const char *)H5HL_offset_into(f, heap, src_ent->name_off);
+ name = (const char *)H5HL_offset_into(heap, src_ent->name_off);
HDassert(name);
/* Insert the new object in the destination file's group */
@@ -1333,10 +1328,10 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
} /* end of for (i=0; i<sn->nsyms; i++) */
done:
- if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->src_heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to unprotect symbol name")
- if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
+ if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1398,20 +1393,20 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_
unsigned linkno; /* Link allocated */
/* Get pointer to link's name in the heap */
- name = (const char *)H5HL_offset_into(f, udata->heap, sn->entry[u].name_off);
+ name = (const char *)H5HL_offset_into(udata->heap, sn->entry[u].name_off);
HDassert(name);
/* Determine the link to operate on in the table */
linkno = udata->ltable->nlinks++;
/* Convert the entry to a link */
- if(H5G_ent_to_link(f, &udata->ltable->lnks[linkno], udata->heap, &sn->entry[u], name) < 0)
+ if(H5G_ent_to_link(&udata->ltable->lnks[linkno], udata->heap, &sn->entry[u], name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5_ITER_ERROR, "unable to convert symbol table entry to link")
} /* end for */
done:
/* Release the locked items */
- if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
+ if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1467,10 +1462,10 @@ herr_t
H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
int fwidth, haddr_t heap_addr)
{
- H5G_node_t *sn = NULL;
- H5HL_t *heap = NULL;
- unsigned u;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5G_node_t *sn = NULL;
+ H5HL_t *heap = NULL;
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_node_debug, FAIL)
@@ -1517,7 +1512,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
fprintf(stream, "%*sSymbol %u:\n", indent - 3, "", u);
if(heap) {
- const char *s = (const char *)H5HL_offset_into(f, heap, sn->entry[u].name_off);
+ const char *s = (const char *)H5HL_offset_into(heap, sn->entry[u].name_off);
if(s)
fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, "Name:", s);
@@ -1525,14 +1520,14 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
else
fprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Warning: Invalid heap address given, name not displayed!");
- H5G_ent_debug(f, sn->entry + u, stream, indent, fwidth, heap);
+ H5G_ent_debug(sn->entry + u, stream, indent, fwidth, heap);
} /* end for */
} /* end if */
done:
if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node")
- if(heap && H5HL_unprotect(f, dxpl_id, heap, heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 271501f..7766280 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -921,7 +921,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id)
for(u = 0; u < linfo->nlinks; u++)
if(H5O_msg_append_oh(oloc->file, dxpl_id, oh, H5O_LINK_ID, 0, H5O_UPDATE_TIME, &(ltable.lnks[u])) < 0) {
/* Release object header */
- if(H5O_unpin(oloc, oh) < 0)
+ if(H5O_unpin(oh) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTUNPIN, FAIL, "unable to unpin group object header")
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
@@ -933,7 +933,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id)
} /* end if */
/* Release object header */
- if(H5O_unpin(oloc, oh) < 0)
+ if(H5O_unpin(oh) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTUNPIN, FAIL, "unable to unpin group object header")
/* Free link table information */
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 80c4a7b..33ec680 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -197,8 +197,8 @@ typedef struct H5G_bt_ins_t {
*/
typedef struct H5G_bt_rm_t {
/* downward */
- H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */
- H5RS_str_t *grp_full_path_r; /* Full path of group where link is removed */
+ H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */
+ H5RS_str_t *grp_full_path_r; /* Full path of group where link is removed */
} H5G_bt_rm_t;
/* Typedef for B-tree 'find' operation */
@@ -210,9 +210,9 @@ typedef herr_t (*H5G_bt_find_op_t)(const H5G_entry_t *ent/*in*/, void *operator_
*/
typedef struct H5G_bt_lkp_t {
/* downward */
- H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */
- H5G_bt_find_op_t op; /* Operator to call when correct entry is found */
- void *op_data; /* Data to pass to operator */
+ H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */
+ H5G_bt_find_op_t op; /* Operator to call when correct entry is found */
+ void *op_data; /* Data to pass to operator */
/* upward */
} H5G_bt_lkp_t;
@@ -244,7 +244,6 @@ typedef struct H5G_bt_it_cpy_t {
/* Common information for "by index" lookups in symbol tables */
typedef struct H5G_bt_it_idx_common_t {
/* downward */
- H5F_t *f; /* Pointer to file that symbol table is in */
hsize_t idx; /* Index of group member to be queried */
hsize_t num_objs; /* The number of objects having been traversed */
H5G_bt_find_op_t op; /* Operator to call when correct entry is found */
@@ -254,7 +253,7 @@ typedef struct H5G_bt_it_idx_common_t {
typedef struct H5G_bt_it_bt_t {
/* downward */
size_t alloc_nlinks; /* Number of links allocated in table */
- H5HL_t *heap; /*symbol table heap */
+ H5HL_t *heap; /* Symbol table heap */
/* upward */
H5G_link_table_t *ltable; /* Link table to add information to */
@@ -426,14 +425,14 @@ H5_DLL H5G_obj_t H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx,
H5_DLL herr_t H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src,
H5_copy_depth_t depth);
H5_DLL herr_t H5G_ent_reset(H5G_entry_t *ent);
-H5_DLL herr_t H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp,
+H5_DLL herr_t H5G_ent_decode_vec(const H5F_t *f, const uint8_t **pp,
H5G_entry_t *ent, unsigned n);
-H5_DLL herr_t H5G_ent_encode_vec(H5F_t *f, uint8_t **pp,
+H5_DLL herr_t H5G_ent_encode_vec(const H5F_t *f, uint8_t **pp,
const H5G_entry_t *ent, unsigned n);
H5_DLL herr_t H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap,
const char *name, const H5O_link_t *lnk, H5G_entry_t *ent);
-H5_DLL herr_t H5G_ent_debug(H5F_t *f, const H5G_entry_t *ent,
- FILE * stream, int indent, int fwidth, H5HL_t *heap);
+H5_DLL herr_t H5G_ent_debug(const H5G_entry_t *ent, FILE * stream, int indent,
+ int fwidth, H5HL_t *heap);
/* Functions that understand symbol table nodes */
H5_DLL herr_t H5G_node_init(H5F_t *f);
@@ -456,10 +455,8 @@ H5_DLL int H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2);
H5_DLL int H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2);
H5_DLL int H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2);
H5_DLL int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2);
-H5_DLL herr_t H5G_ent_to_link(H5F_t *f, H5O_link_t *lnk, const H5HL_t *heap,
+H5_DLL herr_t H5G_ent_to_link(H5O_link_t *lnk, const H5HL_t *heap,
const H5G_entry_t *ent, const char *name);
-H5_DLL herr_t H5G_ent_to_info(H5F_t *f, H5L_info_t *info, const H5HL_t *heap,
- const H5G_entry_t *ent);
H5_DLL herr_t H5G_link_to_info(const H5O_link_t *lnk, H5L_info_t *linfo);
H5_DLL herr_t H5G_link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
H5G_loc_t *obj_loc);
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 526fa82..dec40f3 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -184,9 +184,8 @@ H5_DLL herr_t H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream
/*
* These functions operate on group object locations.
*/
-H5_DLL herr_t H5G_ent_encode(const H5F_t *f, uint8_t **pp,
- const H5G_entry_t *ent);
-H5_DLL herr_t H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent/*out*/);
+H5_DLL herr_t H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent);
+H5_DLL herr_t H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent);
/*
* These functions operate on group hierarchy names.
diff --git a/src/H5Groot.c b/src/H5Groot.c
index 7dc98d1..e4cdc46 100644
--- a/src/H5Groot.c
+++ b/src/H5Groot.c
@@ -261,7 +261,7 @@ done:
/* Mark superblock dirty in cache, if necessary */
if(sblock_dirty)
- if(H5AC_mark_pinned_or_protected_entry_dirty(f, f->shared->sblock) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(f->shared->sblock) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 52c9d07..cba725f 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -33,9 +33,8 @@
/* User data for finding link information from B-tree */
typedef struct {
/* downward */
- H5F_t *file; /* Pointer to file for query */
const char *name; /* Name to search for */
- H5HL_t *heap; /* Local heap for group */
+ H5HL_t *heap; /* Local heap for group */
/* upward */
H5O_link_t *lnk; /* Caller's link location */
@@ -45,7 +44,7 @@ typedef struct {
typedef struct H5G_bt_it_gnbi_t {
/* downward */
H5G_bt_it_idx_common_t common; /* Common information for "by index" lookup */
- H5HL_t *heap; /*symbol table heap */
+ H5HL_t *heap; /*symbol table heap */
/* upward */
char *name; /*member name to be returned */
@@ -56,6 +55,7 @@ typedef struct H5G_bt_it_gnbi_t {
typedef struct H5G_bt_it_gtbi_t {
/* downward */
H5G_bt_it_idx_common_t common; /* Common information for "by index" lookup */
+ H5F_t *f; /* Pointer to file that symbol table is in */
hid_t dxpl_id; /* DXPL for operation */
/* upward */
@@ -67,7 +67,7 @@ typedef struct H5G_bt_it_gtbi_t {
typedef struct H5G_bt_it_lbi_t {
/* downward */
H5G_bt_it_idx_common_t common; /* Common information for "by index" lookup */
- H5HL_t *heap; /*symbol table heap */
+ H5HL_t *heap; /*symbol table heap */
/* upward */
H5O_link_t *lnk; /*link to be returned */
@@ -99,9 +99,9 @@ typedef struct H5G_bt_it_lbi_t {
herr_t
H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t dxpl_id)
{
- H5HL_t *heap = NULL; /* Pointer to local heap */
- size_t name_offset; /* Offset of "" name */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ size_t name_offset; /* Offset of "" name */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_create_components, FAIL)
@@ -136,7 +136,7 @@ H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t d
done:
/* Release resources */
- if(heap && H5HL_unprotect(f, dxpl_id, heap, stab->heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -223,9 +223,9 @@ herr_t
H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name,
H5O_link_t *obj_lnk, hid_t dxpl_id)
{
- H5HL_t *heap = NULL; /* Pointer to local heap */
- H5G_bt_ins_t udata; /* Data to pass through B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ H5G_bt_ins_t udata; /* Data to pass through B-tree */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_insert_real, FAIL)
@@ -250,7 +250,7 @@ H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name,
done:
/* Release resources */
- if(heap && H5HL_unprotect(f, dxpl_id, heap, stab->heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -315,9 +315,9 @@ H5G_stab_remove(H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r,
const char *name)
{
H5HL_t *heap = NULL; /* Pointer to local heap */
- H5O_stab_t stab; /*symbol table message */
- H5G_bt_rm_t udata; /*data to pass through B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_stab_t stab; /*symbol table message */
+ H5G_bt_rm_t udata; /*data to pass through B-tree */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_remove, FAIL)
@@ -343,7 +343,7 @@ H5G_stab_remove(H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r,
done:
/* Release resources */
- if(heap && H5HL_unprotect(loc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -367,11 +367,11 @@ H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_
H5_iter_order_t order, hsize_t n)
{
H5HL_t *heap = NULL; /* Pointer to local heap */
- H5O_stab_t stab; /* Symbol table message */
- H5G_bt_rm_t udata; /* Data to pass through B-tree */
- H5O_link_t obj_lnk; /* Object's link within group */
- hbool_t lnk_copied = FALSE; /* Whether the link was copied */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_stab_t stab; /* Symbol table message */
+ H5G_bt_rm_t udata; /* Data to pass through B-tree */
+ H5O_link_t obj_lnk; /* Object's link within group */
+ hbool_t lnk_copied = FALSE; /* Whether the link was copied */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_remove_by_idx, FAIL)
@@ -401,7 +401,7 @@ H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_
done:
/* Release resources */
- if(heap && H5HL_unprotect(grp_oloc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
/* Reset the link information, if we have a copy */
@@ -429,9 +429,9 @@ done:
herr_t
H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab)
{
- H5HL_t *heap = NULL; /* Pointer to local heap */
- H5G_bt_rm_t udata; /*data to pass through B-tree */
- herr_t ret_value = SUCCEED;
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ H5G_bt_rm_t udata; /*data to pass through B-tree */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_delete, FAIL)
@@ -453,7 +453,7 @@ H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table B-tree")
/* Release resources */
- if(H5HL_unprotect(f, dxpl_id, heap, stab->heap_addr) < 0)
+ if(H5HL_unprotect(heap) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
heap = NULL;
@@ -463,7 +463,7 @@ H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab)
done:
/* Release resources */
- if(heap && H5HL_unprotect(f, dxpl_id, heap, stab->heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -486,10 +486,10 @@ herr_t
H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order,
hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data)
{
- H5HL_t *heap = NULL; /* Local heap for group */
- H5O_stab_t stab; /* Info about symbol table */
+ H5HL_t *heap = NULL; /* Local heap for group */
+ H5O_stab_t stab; /* Info about symbol table */
H5G_link_table_t ltable = {0, NULL}; /* Link table */
- herr_t ret_value;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_iterate, FAIL)
@@ -553,7 +553,7 @@ H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order,
done:
/* Release resources */
- if(heap && H5HL_unprotect(oloc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
if(ltable.lnks && H5G_link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
@@ -677,7 +677,7 @@ H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata)
/* Get name offset in heap */
name_off = ent->name_off;
- name = (const char *)H5HL_offset_into(udata->common.f, udata->heap, name_off);
+ name = (const char *)H5HL_offset_into(udata->heap, name_off);
HDassert(name);
udata->name = H5MM_strdup(name);
HDassert(udata->name);
@@ -703,10 +703,10 @@ ssize_t
H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n,
char* name, size_t size, hid_t dxpl_id)
{
- H5HL_t *heap = NULL; /* Pointer to local heap */
- H5O_stab_t stab; /* Info about local heap & B-tree */
- H5G_bt_it_gnbi_t udata; /* Iteration information */
- ssize_t ret_value; /* Return value */
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ H5O_stab_t stab; /* Info about local heap & B-tree */
+ H5G_bt_it_gnbi_t udata; /* Iteration information */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_get_name_by_idx, FAIL)
@@ -734,7 +734,6 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n,
} /* end if */
/* Set iteration information */
- udata.common.f = oloc->file;
udata.common.idx = n;
udata.common.num_objs = 0;
udata.common.op = H5G_stab_get_name_by_idx_cb;
@@ -761,7 +760,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n,
done:
/* Release resources */
- if(heap && H5HL_unprotect(oloc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
/* Free the duplicated name */
@@ -797,7 +796,7 @@ H5G_stab_lookup_cb(const H5G_entry_t *ent, void *_udata)
/* Check for setting link info */
if(udata->lnk)
/* Convert the entry to a link */
- if(H5G_ent_to_link(udata->file, udata->lnk, udata->heap, ent, udata->name) < 0)
+ if(H5G_ent_to_link(udata->lnk, udata->heap, ent, udata->name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link")
done:
@@ -822,10 +821,10 @@ htri_t
H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk,
hid_t dxpl_id)
{
- H5HL_t *heap = NULL; /* Pointer to local heap */
- H5G_bt_lkp_t bt_udata; /* Data to pass through B-tree */
- H5G_stab_fnd_ud_t udata; /* 'User data' to give to callback */
- H5O_stab_t stab; /* Symbol table message */
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ H5G_bt_lkp_t bt_udata; /* Data to pass through B-tree */
+ H5G_stab_fnd_ud_t udata; /* 'User data' to give to callback */
+ H5O_stab_t stab; /* Symbol table message */
htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_lookup, FAIL)
@@ -844,7 +843,6 @@ H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk,
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap")
/* Set up user data to pass to 'find' operation callback */
- udata.file = grp_oloc->file;
udata.name = name;
udata.lnk = lnk;
udata.heap = heap;
@@ -861,7 +859,7 @@ H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk,
done:
/* Release resources */
- if(heap && H5HL_unprotect(grp_oloc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -896,11 +894,11 @@ H5G_stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata)
HDassert(udata && udata->heap);
/* Get a pointer to the link name */
- name = (const char *)H5HL_offset_into(udata->common.f, udata->heap, ent->name_off);
+ name = (const char *)H5HL_offset_into(udata->heap, ent->name_off);
HDassert(name);
/* Convert the entry to a link */
- if(H5G_ent_to_link(udata->common.f, udata->lnk, udata->heap, ent, name) < 0)
+ if(H5G_ent_to_link(udata->lnk, udata->heap, ent, name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link")
udata->found = TRUE;
@@ -926,10 +924,10 @@ herr_t
H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n,
H5O_link_t *lnk, hid_t dxpl_id)
{
- H5HL_t *heap = NULL; /* Pointer to local heap */
- H5G_bt_it_lbi_t udata; /* Iteration information */
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ H5G_bt_it_lbi_t udata; /* Iteration information */
H5O_stab_t stab; /* Symbol table message */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_lookup_by_idx, FAIL)
@@ -958,7 +956,6 @@ H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n,
} /* end if */
/* Set iteration information */
- udata.common.f = grp_oloc->file;
udata.common.idx = n;
udata.common.num_objs = 0;
udata.common.op = H5G_stab_lookup_by_idx_cb;
@@ -976,7 +973,7 @@ H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n,
done:
/* Release resources */
- if(heap && H5HL_unprotect(grp_oloc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1051,7 +1048,7 @@ H5G_stab_valid(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5O_stab_t *alt_stab)
done:
/* Release resources */
- if(heap && H5HL_unprotect(grp_oloc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1098,7 +1095,7 @@ H5G_stab_get_type_by_idx_cb(const H5G_entry_t *ent, void *_udata)
H5O_type_t obj_type; /* Type of object at location */
/* Build temporary object location */
- tmp_oloc.file = udata->common.f;
+ tmp_oloc.file = udata->f;
HDassert(H5F_addr_defined(ent->header));
tmp_oloc.addr = ent->header;
@@ -1147,10 +1144,10 @@ H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address")
/* Set iteration information */
- udata.common.f = oloc->file;
udata.common.idx = idx;
udata.common.num_objs = 0;
udata.common.op = H5G_stab_get_type_by_idx_cb;
+ udata.f = oloc->file;
udata.dxpl_id = dxpl_id;
udata.type = H5G_UNKNOWN;
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index 26de267..62c6bab 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -616,7 +616,7 @@ H5G_verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent)
done:
/* Release resources */
- if(heap && H5HL_unprotect(grp_oloc->file, H5AC_ind_dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5HF.c b/src/H5HF.c
index 539a14f..0856d89 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -785,7 +785,7 @@ H5HF_close(H5HF_t *fh, hid_t dxpl_id)
{
hbool_t pending_delete = FALSE; /* Whether the heap is pending deletion */
haddr_t heap_addr = HADDR_UNDEF; /* Address of heap (for deletion) */
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HF_close, FAIL)
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 6669853..f96e876 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -250,7 +250,6 @@ H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable)
* Purpose: Loads a fractal heap header from the disk.
*
* Return: Success: Pointer to a new fractal heap
- *
* Failure: NULL
*
* Programmer: Quincey Koziol
@@ -274,9 +273,6 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud
H5HF_hdr_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_hdr_load)
-#ifdef QAK
-HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
-#endif /* QAK */
/* Check arguments */
HDassert(f);
@@ -352,7 +348,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
/* Sanity check */
/* (allow for checksum not decoded yet) */
- HDassert((size_t)(p - buf) == (size - H5HF_SIZEOF_CHKSUM));
+ HDassert((size_t)(p - (const uint8_t *)buf) == (size - H5HF_SIZEOF_CHKSUM));
/* Check for I/O filter information to decode */
if(hdr->filter_len > 0) {
@@ -361,7 +357,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
H5O_pline_t *pline; /* Pipeline information from the header on disk */
/* Compute the offset of the filter info in the header */
- filter_info_off = (size_t)(p - buf);
+ filter_info_off = (size_t)(p - (const uint8_t *)buf);
/* Compute the size of the extra filter information */
filter_info_size = (size_t)(hdr->sizeof_size /* Size of size for filtered root direct block */
@@ -407,13 +403,13 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
/* Compute checksum on entire header */
/* (including the filter information, if present) */
- computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0);
+ computed_chksum = H5_checksum_metadata(buf, (size_t)(p - (const uint8_t *)buf), 0);
/* Metadata checksum */
UINT32DECODE(p, stored_chksum);
/* Sanity check */
- HDassert((size_t)(p - buf) == hdr->heap_size);
+ HDassert((size_t)(p - (const uint8_t *)buf) == hdr->heap_size);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -422,9 +418,6 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
/* Finish initialization of heap header */
if(H5HF_hdr_finish_init(hdr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't finish initializing shared fractal heap header")
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->fspace = %p\n", FUNC, hdr->fspace);
-#endif /* QAK */
/* Set return value */
ret_value = hdr;
@@ -451,11 +444,6 @@ done:
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
* Feb 24 2006
- * Changes: JRM -- 8/21/06
- * Added the flags_ptr parameter. This parameter exists to
- * allow the flush routine to report to the cache if the
- * entry is resized or renamed as a result of the flush.
- * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry.
*
*-------------------------------------------------------------------------
*/
@@ -467,9 +455,6 @@ H5HF_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5H
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_hdr_flush)
-#ifdef QAK
-HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy);
-#endif /* QAK */
/* check arguments */
HDassert(f);
@@ -685,7 +670,7 @@ H5HF_cache_hdr_size(const H5F_t UNUSED *f, const H5HF_hdr_t *hdr, size_t *size_p
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_hdr_size)
- /* check arguments */
+ /* Check arguments */
HDassert(f);
HDassert(hdr);
HDassert(size_ptr);
@@ -730,9 +715,6 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows
H5HF_indirect_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_iblock_load)
-#ifdef QAK
-HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr);
-#endif /* QAK */
/* Check arguments */
HDassert(f);
@@ -858,22 +840,19 @@ HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr);
iblock->nchildren++;
iblock->max_child = u;
} /* end if */
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].addr);
-#endif /* QAK */
} /* end for */
/* Sanity check */
HDassert(iblock->nchildren); /* indirect blocks w/no children should have been deleted */
/* Compute checksum on indirect block */
- computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0);
+ computed_chksum = H5_checksum_metadata(buf, (size_t)(p - (const uint8_t *)buf), 0);
/* Metadata checksum */
UINT32DECODE(p, stored_chksum);
/* Sanity check */
- HDassert((size_t)(p - buf) == iblock->size);
+ HDassert((size_t)(p - (const uint8_t *)buf) == iblock->size);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -918,12 +897,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 6 2006
*
- * Changes: JRM -- 8/21/06
- * Added the flags_ptr parameter. This parameter exists to
- * allow the flush routine to report to the cache if the
- * entry is resized or renamed as a result of the flush.
- * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -934,9 +907,6 @@ H5HF_cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_iblock_flush)
-#ifdef QAK
-HDfprintf(stderr, "%s: Flushing indirect block, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy);
-#endif /* QAK */
/* check arguments */
HDassert(f);
@@ -956,12 +926,6 @@ HDfprintf(stderr, "%s: Flushing indirect block, addr = %a, destroy = %u\n", FUNC
/* Get the pointer to the shared heap header */
hdr = iblock->hdr;
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows);
-HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size);
-HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off);
-HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtable.cparam.width);
-#endif /* QAK */
/* Set the shared heap header's file context for this operation */
hdr->f = f;
@@ -992,9 +956,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtab
/* Encode indirect block-specific fields */
for(u = 0; u < (iblock->nrows * hdr->man_dtable.cparam.width); u++) {
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].addr);
-#endif /* QAK */
/* Encode child block address */
H5F_addr_encode(f, &p, iblock->ents[u].addr);
@@ -1005,9 +966,6 @@ HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].add
/* Encode extra information for direct blocks */
if(u < (hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width)) {
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->filt_ents[%Zu] = {%Zu, %x}\n", FUNC, u, iblock->filt_ents[u].size, iblock->filt_ents[u].filter_mask);
-#endif /* QAK */
/* Sanity check */
/* (either both the address & size are defined or both are
* not defined)
@@ -1048,9 +1006,6 @@ HDfprintf(stderr, "%s: iblock->filt_ents[%Zu] = {%Zu, %x}\n", FUNC, u, iblock->f
/* Check for needing to re-allocate indirect block from 'temp.' to 'normal' file space */
if(H5F_IS_TMP_ADDR(f, addr)) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Re-allocating indirect block in temporary space - addr = %a\n", FUNC, addr);
-#endif /* QAK */
/* Sanity check */
HDassert(H5F_addr_eq(iblock->addr, addr));
@@ -1144,9 +1099,6 @@ H5HF_cache_iblock_dest(H5F_t *f, H5HF_indirect_t *iblock)
HDassert(iblock);
HDassert(iblock->rc == 0);
HDassert(iblock->hdr);
-#ifdef QAK
-HDfprintf(stderr, "%s: Destroying indirect block\n", FUNC);
-#endif /* QAK */
/* If we're going to free the space on disk, the address must be valid */
HDassert(!iblock->cache_info.free_file_space_on_destroy || H5F_addr_defined(iblock->cache_info.addr));
@@ -1246,7 +1198,7 @@ H5HF_cache_iblock_size(const H5F_t UNUSED *f, const H5HF_indirect_t *iblock, siz
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_iblock_size)
- /* check arguments */
+ /* Check arguments */
HDassert(iblock);
HDassert(size_ptr);
@@ -1312,7 +1264,7 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size,
/* Allocate block buffer */
/* XXX: Change to using free-list factories */
- if((dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size)) == NULL)
+ if(NULL == (dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Check for I/O filters on this heap */
@@ -1325,10 +1277,6 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size,
/* Check for root direct block */
if(par_info->iblock == NULL) {
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu, hdr->pline_root_direct_filter_mask = %x\n", FUNC, hdr->pline_root_direct_size, hdr->pline_root_direct_filter_mask);
-HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr->man_dtable.table_addr, addr);
-#endif /* QAK */
/* Sanity check */
HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr));
@@ -1337,11 +1285,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr-
filter_mask = hdr->pline_root_direct_filter_mask;
} /* end if */
else {
-#ifdef QAK
-HDfprintf(stderr, "%s: par_info->iblock = %p, par_info->entry = %u\n", FUNC, par_info->iblock, par_info->entry);
-HDfprintf(stderr, "%s: par_info->iblock->filt_ents[%u].size = %Zu, par_info->iblock->filt_ents[%u].filter_mask = %x\n", FUNC, par_info->entry, par_info->iblock->filt_ents[par_info->entry].size, par_info->entry, par_info->iblock->filt_ents[par_info->entry].filter_mask);
-HDfprintf(stderr, "%s: par_info->iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_info->entry, par_info->iblock->ents[par_info->entry].addr, addr);
-#endif /* QAK */
/* Sanity check */
HDassert(H5F_addr_eq(par_info->iblock->ents[par_info->entry].addr, addr));
@@ -1353,9 +1296,6 @@ HDfprintf(stderr, "%s: par_info->iblock->ents[%u].addr = %a, addr = %a\n", FUNC,
/* Allocate buffer to perform I/O filtering on */
if(NULL == (read_buf = H5MM_malloc(read_size)))
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for pipeline buffer")
-#ifdef QAK
-HDfprintf(stderr, "%s: read_size = %Zu, read_buf = %p\n", FUNC, read_size, read_buf);
-#endif /* QAK */
/* Read filtered direct block from disk */
if(H5F_block_read(f, H5FD_MEM_FHEAP_DBLOCK, addr, read_size, dxpl_id, read_buf) < 0)
@@ -1363,12 +1303,8 @@ HDfprintf(stderr, "%s: read_size = %Zu, read_buf = %p\n", FUNC, read_size, read_
/* Push direct block data through I/O filter pipeline */
nbytes = read_size;
- if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC,
- filter_cb, &nbytes, &read_size, &read_buf) < 0)
+ if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &read_size, &read_buf) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, NULL, "output pipeline failed")
-#ifdef QAK
-HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nbytes, read_size, read_buf);
-#endif /* QAK */
/* Sanity check */
HDassert(nbytes == dblock->size);
@@ -1414,7 +1350,7 @@ HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nb
/* Offset of heap within the heap's address space */
UINT64DECODE_VAR(p, dblock->block_off, hdr->heap_off_size);
- /* Encode checksum on direct block, if requested */
+ /* Decode checksum on direct block, if requested */
if(hdr->checksum_dblocks) {
uint32_t stored_chksum; /* Metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
@@ -1459,12 +1395,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 27 2006
*
- * Changes: JRM -- 8/21/06
- * Added the flags_ptr parameter. This parameter exists to
- * allow the flush routine to report to the cache if the
- * entry is resized or renamed as a result of the flush.
- * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1539,15 +1469,8 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Push direct block data through I/O filter pipeline */
nbytes = write_size;
- if(H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_ENABLE_EDC,
- filter_cb, &nbytes, &write_size, &write_buf) < 0)
+ if(H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &write_size, &write_buf) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "output pipeline failed")
-#ifdef QAK
-HDfprintf(stderr, "%s: nbytes = %Zu, write_size = %Zu, write_buf = %p\n", FUNC, nbytes, write_size, write_buf);
-HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
-HDfprintf(stderr, "%s: dblock->size = %Zu, dblock->blk = %p\n", FUNC, dblock->size, dblock->blk);
-HDfprintf(stderr, "%s: dblock->parent = %p, dblock->par_entry = %u\n", FUNC, dblock->parent, dblock->par_entry);
-#endif /* QAK */
/* Use the compressed number of bytes as the size to write */
write_size = nbytes;
@@ -1556,10 +1479,6 @@ HDfprintf(stderr, "%s: dblock->parent = %p, dblock->par_entry = %u\n", FUNC, dbl
if(dblock->parent == NULL) {
hbool_t hdr_changed = FALSE; /* Whether the header information changed */
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu, hdr->pline_root_direct_filter_mask = %x\n", FUNC, hdr->pline_root_direct_size, hdr->pline_root_direct_filter_mask);
-HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr->man_dtable.table_addr, addr);
-#endif /* QAK */
/* Sanity check */
HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr));
HDassert(hdr->pline_root_direct_size > 0);
@@ -1572,9 +1491,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr-
/* Check if we need to re-size the block on disk */
if(hdr->pline_root_direct_size != write_size || at_tmp_addr) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Need to re-allocate root direct block!\n", FUNC);
-#endif /* QAK */
/* Check if the direct block is NOT currently allocated in temp. file space */
/* (temp. file space does not need to be freed) */
if(!at_tmp_addr) {
@@ -1614,10 +1530,6 @@ HDfprintf(stderr, "%s: Need to re-allocate root direct block!\n", FUNC);
par_iblock = dblock->parent;
par_entry = dblock->par_entry;
-#ifdef QAK
-HDfprintf(stderr, "%s: par_iblock->filt_ents[%u].size = %Zu, par_iblock->filt_ents[%u].filter_mask = %x\n", FUNC, par_entry, par_iblock->filt_ents[par_entry].size, par_entry, par_iblock->filt_ents[par_entry].filter_mask);
-HDfprintf(stderr, "%s: par_iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_entry, par_iblock->ents[par_entry].addr, addr);
-#endif /* QAK */
/* Sanity check */
HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, addr));
HDassert(par_iblock->filt_ents[par_entry].size > 0);
@@ -1630,9 +1542,6 @@ HDfprintf(stderr, "%s: par_iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_e
/* Check if we need to re-size the block on disk */
if(par_iblock->filt_ents[par_entry].size != write_size || at_tmp_addr) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Need to re-allocate non-root direct block!\n", FUNC);
-#endif /* QAK */
/* Check if the direct block is NOT currently allocated in temp. file space */
/* (temp. file space does not need to be freed) */
if(!at_tmp_addr) {
@@ -1670,9 +1579,6 @@ HDfprintf(stderr, "%s: Need to re-allocate non-root direct block!\n", FUNC);
/* Check for needing to re-allocate direct block from 'temp.' to 'normal' file space */
if(at_tmp_addr) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Re-allocating direct block in temporary space - addr = %a, write_size = %Zu\n", FUNC, addr, write_size);
-#endif /* QAK */
/* Check for root direct block */
if(NULL == dblock->parent) {
/* Sanity check */
@@ -1732,9 +1638,6 @@ HDfprintf(stderr, "%s: Re-allocating direct block in temporary space - addr = %a
HDassert(!H5F_IS_TMP_ADDR(f, addr));
/* Write the direct block */
-#ifdef QAK
-HDfprintf(stderr, "%s: addr = %a, write_size = %Zu\n", FUNC, addr, write_size);
-#endif /* QAK */
if(H5F_block_write(f, H5FD_MEM_FHEAP_DBLOCK, addr, write_size, dxpl_id, write_buf) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFLUSH, FAIL, "unable to save fractal heap direct block to disk")
@@ -1778,9 +1681,6 @@ H5HF_cache_dblock_dest(H5F_t *f, H5HF_direct_t *dblock)
* Check arguments.
*/
HDassert(dblock);
-#ifdef QAK
-HDfprintf(stderr, "%s: Destroying direct block, dblock = %p\n", FUNC, dblock);
-#endif /* QAK */
/* If we're going to free the space on disk, the address must be valid */
HDassert(!dblock->cache_info.free_file_space_on_destroy || H5F_addr_defined(dblock->cache_info.addr));
diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c
index e0a1069..027146c 100644
--- a/src/H5HFdblock.c
+++ b/src/H5HFdblock.c
@@ -158,9 +158,6 @@ HDmemset(dblock->blk, 0, dblock->size);
if(HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)dblock->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block")
} /* end else */
-#ifdef QAK
-HDfprintf(stderr, "%s: direct block address = %a\n", FUNC, dblock_addr);
-#endif /* QAK */
/* Attach to parent indirect block, if there is one */
dblock->parent = par_iblock;
@@ -231,11 +228,6 @@ H5HF_man_dblock_destroy(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_direct_t *dblock,
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_destroy)
-#ifdef QAK
-HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
-HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size);
-HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr);
-#endif /* QAK */
/*
* Check arguments.
@@ -266,9 +258,6 @@ HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr);
/* Check for root direct block */
if(hdr->man_dtable.curr_root_rows == 0) {
-#ifdef QAK
-HDfprintf(stderr, "%s: root direct block\n", FUNC);
-#endif /* QAK */
/* Sanity check */
HDassert(hdr->man_dtable.table_addr == dblock_addr);
HDassert(hdr->man_dtable.cparam.start_block_size == dblock->size);
@@ -284,25 +273,11 @@ HDfprintf(stderr, "%s: root direct block\n", FUNC);
HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty")
} /* end if */
else {
-#ifdef QAK
-HDfprintf(stderr, "%s: root indirect block\n", FUNC);
-#endif /* QAK */
-
/* Adjust heap statistics */
hdr->man_alloc_size -= dblock->size;
-#ifdef QAK
-HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
-HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size);
-HDfprintf(stderr, "%s: dblock->parent->nchildren = %u\n", FUNC, dblock->parent->nchildren);
-HDfprintf(stderr, "%s: dblock->par_entry = %u\n", FUNC, dblock->par_entry);
-HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off);
-#endif /* QAK */
/* Check for this direct block being the highest in the heap */
if((dblock->block_off + dblock->size) == hdr->man_iter_off) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Reversing iterator\n", FUNC);
-#endif /* QAK */
/* Move 'next block' iterator backwards (may shrink heap) */
if(H5HF_hdr_reverse_iter(hdr, dxpl_id, dblock_addr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reverse 'next block' iterator")
@@ -323,16 +298,14 @@ HDfprintf(stderr, "%s: Reversing iterator\n", FUNC);
#endif /* 0 */
/* Detach from parent indirect block */
- if(H5HF_man_iblock_detach(dblock->parent, dxpl_id, dblock->par_entry) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block")
- dblock->parent = NULL;
- dblock->par_entry = 0;
+ if(dblock->parent) {
+ if(H5HF_man_iblock_detach(dblock->parent, dxpl_id, dblock->par_entry) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block");
+ dblock->parent = NULL;
+ dblock->par_entry = 0;
+ } /* end if */
} /* end else */
-#ifdef QAK
-HDfprintf(stderr, "%s: Before releasing direct block's space, dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr, dblock_size);
-#endif /* QAK */
-
/* Indicate that the indirect block should be deleted & file space freed */
dblock->file_size = dblock_size;
cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
@@ -369,9 +342,6 @@ H5HF_man_dblock_new(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t request,
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_new)
-#ifdef QAK
-HDfprintf(stderr, "%s: request = %Zu\n", FUNC, request);
-#endif /* QAK */
/*
* Check arguments.
@@ -388,15 +358,8 @@ HDfprintf(stderr, "%s: request = %Zu\n", FUNC, request);
} /* end else */
/* Adjust the size of block needed to fulfill request, with overhead */
-#ifdef QAK
-HDfprintf(stderr, "%s: Check 1 - min_dblock_size = %Zu\n", FUNC, min_dblock_size);
-HDfprintf(stderr, "%s: H5HF_MAN_ABS_DIRECT_OVERHEAD= %u\n", FUNC, H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr));
-#endif /* QAK */
if((min_dblock_size - request) < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr))
min_dblock_size *= 2;
-#ifdef QAK
-HDfprintf(stderr, "%s: Check 2 - min_dblock_size = %Zu\n", FUNC, min_dblock_size);
-#endif /* QAK */
/* Check if this is the first block in the heap */
if(!H5F_addr_defined(hdr->man_dtable.table_addr) &&
@@ -405,10 +368,6 @@ HDfprintf(stderr, "%s: Check 2 - min_dblock_size = %Zu\n", FUNC, min_dblock_size
if(H5HF_man_dblock_create(dxpl_id, hdr, NULL, 0, &dblock_addr, ret_sec_node) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block")
-#ifdef QAK
-HDfprintf(stderr, "%s: root direct block, dblock_addr = %a\n", FUNC, dblock_addr);
-#endif /* QAK */
-
/* Point root at new direct block */
hdr->man_dtable.curr_root_rows = 0;
hdr->man_dtable.table_addr = dblock_addr;
@@ -428,16 +387,10 @@ HDfprintf(stderr, "%s: root direct block, dblock_addr = %a\n", FUNC, dblock_addr
unsigned next_entry; /* Iterator's next block entry */
size_t next_size; /* Size of next direct block to create */
-#ifdef QAK
-HDfprintf(stderr, "%s: before updating iterator, hdr->man_iter_off = %Hu, hdr->man_size = %Hu\n", FUNC, hdr->man_iter_off, hdr->man_size);
-#endif /* QAK */
/* Update iterator to reflect any previous increments as well as allow for requested direct block size */
if(H5HF_hdr_update_iter(hdr, dxpl_id, min_dblock_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTUPDATE, FAIL, "unable to update block iterator")
-#ifdef QAK
-HDfprintf(stderr, "%s: after updating iterator, hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off);
-#endif /* QAK */
/* Retrieve information about current iterator position */
if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location")
@@ -454,18 +407,9 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not su
if(H5HF_hdr_inc_iter(hdr, (hsize_t)next_size, 1) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment 'next block' iterator")
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock);
-HDfprintf(stderr, "%s: iblock->addr = %a\n", FUNC, iblock->addr);
-HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry);
-#endif /* QAK */
-
/* Create new direct block at current location*/
if(H5HF_man_dblock_create(dxpl_id, hdr, iblock, next_entry, &dblock_addr, ret_sec_node) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block")
-#ifdef QAK
-HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr);
-#endif /* QAK */
} /* end else */
done:
@@ -492,14 +436,11 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr,
size_t dblock_size, H5HF_indirect_t *par_iblock, unsigned par_entry,
H5AC_protect_t rw)
{
- H5HF_parent_t par_info; /* Parent info for loading block */
- H5HF_direct_t *dblock; /* Direct block from cache */
- H5HF_direct_t *ret_value; /* Return value */
+ H5HF_parent_t par_info; /* Parent info for loading block */
+ H5HF_direct_t *dblock; /* Direct block from cache */
+ H5HF_direct_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_protect)
-#ifdef QAK
-HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Zu\n", FUNC, dblock_addr, dblock_size);
-#endif /* QAK */
/*
* Check arguments.
@@ -551,9 +492,6 @@ H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off,
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_locate)
-#ifdef QAK
-HDfprintf(stderr, "%s: obj_off = %Hu\n", FUNC, obj_off);
-#endif /* QAK */
/*
* Check arguments.
@@ -566,15 +504,9 @@ HDfprintf(stderr, "%s: obj_off = %Hu\n", FUNC, obj_off);
/* Look up row & column for object */
if(H5HF_dtable_lookup(&hdr->man_dtable, obj_off, &row, &col) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object")
-#ifdef QAK
-HDfprintf(stderr, "%s: row = %u, col = %u\n", FUNC, row, col);
-#endif /* QAK */
/* Set initial indirect block info */
iblock_addr = hdr->man_dtable.table_addr;
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr);
-#endif /* QAK */
/* Lock root indirect block */
if(NULL == (iblock = H5HF_man_iblock_protect(hdr, dxpl_id, iblock_addr, hdr->man_dtable.curr_root_rows, NULL, 0, FALSE, rw, &did_protect)))
@@ -593,9 +525,6 @@ HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr);
/* Compute indirect block's entry */
entry = (row * hdr->man_dtable.cparam.width) + col;
-#ifdef QAK
-HDfprintf(stderr, "%s: entry = %Zu\n", FUNC, entry);
-#endif /* QAK */
/* Locate child indirect block */
iblock_addr = iblock->ents[entry].addr;
@@ -620,18 +549,11 @@ HDfprintf(stderr, "%s: entry = %Zu\n", FUNC, entry);
/* Switch variables to use new indirect block */
iblock = new_iblock;
did_protect = new_did_protect;
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->addr = %a\n", FUNC, iblock->addr);
-HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off);
-#endif /* QAK */
/* Look up row & column in new indirect block for object */
if(H5HF_dtable_lookup(&hdr->man_dtable, (obj_off - iblock->block_off), &row, &col) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object")
HDassert(row < iblock->nrows); /* child must be smaller than parent */
-#ifdef QAK
-HDfprintf(stderr, "%s: row = %u, col = %u\n", FUNC, row, col);
-#endif /* QAK */
} /* end while */
/* Set return parameters */
@@ -671,9 +593,6 @@ H5HF_man_dblock_delete(H5F_t *f, hid_t dxpl_id, haddr_t dblock_addr,
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_delete)
-#ifdef QAK
-HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr, dblock_size);
-#endif /* QAK */
/*
* Check arguments.
@@ -691,15 +610,9 @@ HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr
HDassert(!(dblock_status & H5AC_ES__IS_PINNED));
HDassert(!(dblock_status & H5AC_ES__IS_PROTECTED));
-#ifdef QAK
-HDfprintf(stderr, "%s: Expunging direct block from cache\n", FUNC);
-#endif /* QAK */
/* Evict the direct block from the metadata cache */
if(H5AC_expunge_entry(f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "unable to remove direct block from cache")
-#ifdef QAK
-HDfprintf(stderr, "%s: Done expunging direct block from cache\n", FUNC);
-#endif /* QAK */
} /* end if */
/* Check if the direct block is NOT currently allocated in temp. file space */
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index c326a59..8652f90 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -132,10 +132,6 @@ H5HF_hdr_alloc(H5F_t *f)
ret_value = hdr;
done:
- if(!ret_value && hdr)
- if(H5HF_hdr_free(hdr) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to release fractal heap header")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_hdr_alloc() */
@@ -271,12 +267,6 @@ H5HF_hdr_finish_init_phase2(H5HF_hdr_t *hdr)
else
if(H5HF_hdr_compute_free_space(hdr, u) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize direct block free space for indirect block")
-#ifdef QAK
-HDfprintf(stderr, "%s: row_block_size[%Zu] = %Hu\n", FUNC, u, hdr->man_dtable.row_block_size[u]);
-HDfprintf(stderr, "%s: row_block_off[%Zu] = %Hu\n", FUNC, u, hdr->man_dtable.row_block_off[u]);
-HDfprintf(stderr, "%s: row_tot_dblock_free[%Zu] = %Hu\n", FUNC, u, hdr->man_dtable.row_tot_dblock_free[u]);
-HDfprintf(stderr, "%s: row_max_dblock_free[%Zu] = %Zu\n", FUNC, u, hdr->man_dtable.row_max_dblock_free[u]);
-#endif /* QAK */
} /* end for */
/* Initialize the block iterator for searching for free space */
@@ -444,9 +434,6 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
/* Compute the I/O filters' encoded size */
if(0 == (hdr->filter_len = H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, FALSE, &(hdr->pline))))
HGOTO_ERROR(H5E_HEAP, H5E_CANTGETSIZE, HADDR_UNDEF, "can't get I/O filter pipeline size")
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->filter_len = %u\n", FUNC, hdr->filter_len);
-#endif /* QAK */
/* Compute size of header on disk */
hdr->heap_size = H5HF_HEADER_SIZE(hdr) /* Base header size */
@@ -496,9 +483,6 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", FUNC, hdr->filter_len);
hdr->id_len = cparam->id_len;
break;
} /* end switch */
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->id_len = %Zu\n", FUNC, hdr->id_len);
-#endif /* QAK */
/* Second phase of header final initialization */
/* (needs ID and filter lengths set up) */
@@ -556,7 +540,7 @@ H5HF_hdr_incr(H5HF_hdr_t *hdr)
/* Mark header as un-evictable when a block is depending on it */
if(hdr->rc == 0)
- if(H5AC_pin_protected_entry(hdr->f, hdr) < 0)
+ if(H5AC_pin_protected_entry(hdr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin fractal heap header")
/* Increment reference count on shared header */
@@ -597,7 +581,7 @@ H5HF_hdr_decr(H5HF_hdr_t *hdr)
/* Mark header as evictable again when no child blocks depend on it */
if(hdr->rc == 0) {
HDassert(hdr->file_rc == 0);
- if(H5AC_unpin_entry(hdr->f, hdr) < 0)
+ if(H5AC_unpin_entry(hdr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header")
} /* end if */
@@ -682,15 +666,12 @@ H5HF_hdr_dirty(H5HF_hdr_t *hdr)
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_dirty)
-#ifdef QAK
-HDfprintf(stderr, "%s: Marking heap header as dirty\n", FUNC);
-#endif /* QAK */
/* Sanity check */
HDassert(hdr);
/* Mark header as dirty in cache */
- if(H5AC_mark_pinned_or_protected_entry_dirty(hdr->f, hdr) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(hdr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap header as dirty")
done:
@@ -717,9 +698,6 @@ H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt)
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_adj_free)
-#ifdef QAK
-HDfprintf(stderr, "%s: amt = %Zd\n", FUNC, amt);
-#endif /* QAK */
/*
* Check arguments.
@@ -729,9 +707,6 @@ HDfprintf(stderr, "%s: amt = %Zd\n", FUNC, amt);
/* Update heap header */
HDassert(amt > 0 || hdr->total_man_free >= (hsize_t)-amt);
hdr->total_man_free += amt;
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free);
-#endif /* QAK */
/* Mark heap header as modified */
if(H5HF_hdr_dirty(hdr) < 0)
@@ -766,12 +741,6 @@ H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free)
* Check arguments.
*/
HDassert(hdr);
-#ifdef QAK
-HDfprintf(stderr, "%s; new_size = %Hu, extra_free = %Hd\n", FUNC, new_size, extra_free);
-HDfprintf(stderr, "%s; hdr->total_size = %Hu\n", FUNC, hdr->total_size);
-HDfprintf(stderr, "%s; hdr->man_size = %Hu\n", FUNC, hdr->man_size);
-HDfprintf(stderr, "%s; hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free);
-#endif /* QAK */
/* Set the total managed space in heap */
hdr->man_size = new_size;
@@ -814,9 +783,6 @@ H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size)
/* Update the "allocated" size within the heap */
hdr->man_alloc_size += alloc_size;
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->man_alloc_size = %Hu\n", "H5HF_hdr_inc_alloc", hdr->man_alloc_size);
-#endif /* QAK */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_hdr_inc_alloc() */
@@ -890,9 +856,6 @@ H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator")
/* Set the offset of the iterator in the heap */
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu, curr_off = %Hu\n", FUNC, hdr->man_iter_off, curr_off);
-#endif /* QAK */
hdr->man_iter_off = curr_off;
done:
@@ -922,9 +885,6 @@ H5HF_hdr_skip_blocks(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_indirect_t *iblock,
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_skip_blocks)
-#ifdef QAK
-HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, nentries);
-#endif /* QAK */
/*
* Check arguments.
@@ -937,17 +897,11 @@ HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, ne
row = start_entry / hdr->man_dtable.cparam.width;
col = start_entry % hdr->man_dtable.cparam.width;
sect_size = H5HF_dtable_span_size(&hdr->man_dtable, row, col, nentries);
-#ifdef QAK
-HDfprintf(stderr, "%s: Check 1.0 - hdr->man_iter_off = %Hu, sect_size = %Hu\n", FUNC, hdr->man_iter_off, sect_size);
-#endif /* QAK */
HDassert(sect_size > 0);
/* Advance the new block iterator */
if(H5HF_hdr_inc_iter(hdr, sect_size, nentries) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't increase allocated heap size")
-#ifdef QAK
-HDfprintf(stderr, "%s: Check 2.0 - hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off);
-#endif /* QAK */
/* Add 'indirect' section for blocks skipped in this row */
if(H5HF_sect_indirect_add(hdr, dxpl_id, iblock, start_entry, nentries) < 0)
@@ -980,9 +934,6 @@ H5HF_hdr_update_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_size)
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_update_iter)
-#ifdef QAK
-HDfprintf(stderr, "%s: min_dblock_size = %Zu\n", FUNC, min_dblock_size);
-#endif /* QAK */
/*
* Check arguments.
@@ -992,9 +943,6 @@ HDfprintf(stderr, "%s: min_dblock_size = %Zu\n", FUNC, min_dblock_size);
/* Check for creating first indirect block */
if(hdr->man_dtable.curr_root_rows == 0) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Creating root direct block\n", FUNC);
-#endif /* QAK */
if(H5HF_man_iblock_root_create(hdr, dxpl_id, min_dblock_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "unable to create root indirect block")
} /* end if */
@@ -1005,21 +953,11 @@ HDfprintf(stderr, "%s: Creating root direct block\n", FUNC);
unsigned next_entry; /* Iterator's next block entry */
unsigned min_dblock_row; /* Minimum row for direct block size request */
-#ifdef QAK
-HDfprintf(stderr, "%s: searching root indirect block\n", FUNC);
-#endif /* QAK */
/* Compute min. row for direct block requested */
min_dblock_row = H5HF_dtable_size_to_row(&hdr->man_dtable, min_dblock_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: min_dblock_size = %Zu, min_dblock_row = %u\n", FUNC, min_dblock_size, min_dblock_row);
-HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off);
-#endif /* QAK */
/* Initialize block iterator, if necessary */
if(!H5HF_man_iter_ready(&hdr->next_block)) {
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off);
-#endif /* QAK */
/* Start iterator with previous offset of iterator */
if(H5HF_man_iter_start_offset(hdr, dxpl_id, &hdr->next_block, hdr->man_iter_off) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to set block iterator location")
@@ -1029,14 +967,6 @@ HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off);
if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location")
-#ifdef QAK
-HDfprintf(stderr, "%s: Check 1.0\n", FUNC);
-HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock);
-HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off);
-HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows);
-HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row);
-HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry);
-#endif /* QAK */
/* Check for skipping over blocks in the current block */
if(min_dblock_row > next_row && next_row < iblock->nrows) {
unsigned min_entry; /* Min entry for direct block requested */
@@ -1048,9 +978,6 @@ HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry);
skip_entries = (iblock->nrows * hdr->man_dtable.cparam.width) - next_entry;
else
skip_entries = min_entry - next_entry;
-#ifdef QAK
-HDfprintf(stderr, "%s: min_entry = %u, skip_entries = %u\n", FUNC, min_entry, skip_entries);
-#endif /* QAK */
/* Add skipped direct blocks to heap's free space */
if(H5HF_hdr_skip_blocks(hdr, dxpl_id, iblock, next_entry, skip_entries) < 0)
@@ -1065,33 +992,15 @@ HDfprintf(stderr, "%s: min_entry = %u, skip_entries = %u\n", FUNC, min_entry, sk
/* Reset conditions for leaving loop */
walked_up = walked_down = FALSE;
-#ifdef QAK
-HDfprintf(stderr, "%s: Check 2.0\n", FUNC);
-HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock);
-HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off);
-HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows);
-HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row);
-HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry);
-#endif /* QAK */
-
/* Check for walking off end of indirect block */
/* (walk up iterator) */
while(next_row >= iblock->nrows) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Off the end of a block, next_row = %u, iblock->nrows = %u\n", FUNC, next_row, iblock->nrows);
-#endif /* QAK */
/* Check for needing to expand root indirect block */
if(iblock->parent == NULL) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Doubling root block\n", FUNC);
-#endif /* QAK */
if(H5HF_man_iblock_root_double(hdr, dxpl_id, min_dblock_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "unable to double root indirect block")
} /* end if */
else {
-#ifdef QAK
-HDfprintf(stderr, "%s: Walking up a level\n", FUNC);
-#endif /* QAK */
/* Move iterator up one level */
if(H5HF_man_iter_up(&hdr->next_block) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location")
@@ -1108,36 +1017,16 @@ HDfprintf(stderr, "%s: Walking up a level\n", FUNC);
/* Indicate that we walked up */
walked_up = TRUE;
} /* end while */
-#ifdef QAK
-HDfprintf(stderr, "%s: Check 3.0\n", FUNC);
-HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock);
-HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows);
-HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row);
-HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry);
-#endif /* QAK */
/* Check for walking into child indirect block */
/* (walk down iterator) */
if(next_row >= hdr->man_dtable.max_direct_rows) {
unsigned child_nrows; /* Number of rows in new indirect block */
-#ifdef QAK
-HDfprintf(stderr, "%s: Walking down into child indirect block\n", FUNC);
-#endif /* QAK */
-#ifdef QAK
-HDfprintf(stderr, "%s: Check 3.1\n", FUNC);
-HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock);
-HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows);
-HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row);
-HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry);
-#endif /* QAK */
HDassert(!H5F_addr_defined(iblock->ents[next_entry].addr));
/* Compute # of rows in next child indirect block to use */
child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[next_row]);
-#ifdef QAK
-HDfprintf(stderr, "%s: child_nrows = %u\n", FUNC, child_nrows);
-#endif /* QAK */
/* Check for skipping over indirect blocks */
/* (that don't have direct blocks large enough to hold direct block size requested) */
@@ -1145,19 +1034,12 @@ HDfprintf(stderr, "%s: child_nrows = %u\n", FUNC, child_nrows);
unsigned child_rows_needed; /* Number of rows needed to hold direct block */
unsigned child_entry; /* Entry of child indirect block */
-#ifdef QAK
-HDfprintf(stderr, "%s: Skipping indirect block row that is too small\n", FUNC);
-#endif /* QAK */
/* Compute # of rows needed in child indirect block */
child_rows_needed = (H5V_log2_of2((uint32_t)min_dblock_size) - H5V_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size)) + 2;
HDassert(child_rows_needed > child_nrows);
child_entry = (next_row + (child_rows_needed - child_nrows)) * hdr->man_dtable.cparam.width;
if(child_entry > (iblock->nrows * hdr->man_dtable.cparam.width))
child_entry = iblock->nrows * hdr->man_dtable.cparam.width;
-#ifdef QAK
-HDfprintf(stderr, "%s: child_rows_needed = %u\n", FUNC, child_rows_needed);
-HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry);
-#endif /* QAK */
/* Add skipped indirect blocks to heap's free space */
if(H5HF_hdr_skip_blocks(hdr, dxpl_id, iblock, next_entry, (child_entry - next_entry)) < 0)
@@ -1168,9 +1050,6 @@ HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry);
hbool_t did_protect; /* Whether we protected the indirect block or not */
haddr_t new_iblock_addr; /* New indirect block's address */
-#ifdef QAK
-HDfprintf(stderr, "%s: Allocating new child indirect block\n", FUNC);
-#endif /* QAK */
/* Allocate new indirect block */
if(H5HF_man_iblock_create(hdr, dxpl_id, iblock, next_entry, child_nrows, child_nrows, &new_iblock_addr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block")
@@ -1189,9 +1068,6 @@ HDfprintf(stderr, "%s: Allocating new child indirect block\n", FUNC);
/* Compute entry for direct block size requested */
new_entry = hdr->man_dtable.cparam.width * min_dblock_row;
-#ifdef QAK
-HDfprintf(stderr, "%s: Skipping rows in new child indirect block - new_entry = %u\n", FUNC, new_entry);
-#endif /* QAK */
/* Add skipped blocks to heap's free space */
if(H5HF_hdr_skip_blocks(hdr, dxpl_id, new_iblock, 0, new_entry) < 0)
@@ -1243,9 +1119,6 @@ H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries)
*/
HDassert(hdr);
HDassert(nentries);
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu, adv_size = %Hu\n", FUNC, hdr->man_iter_off, adv_size);
-#endif /* QAK */
/* Advance the iterator for the current location within the indirect block */
if(hdr->next_block.curr)
@@ -1301,11 +1174,6 @@ H5HF_hdr_reverse_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr)
/* Get information about current iterator location */
if(H5HF_man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator information")
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->nchildren = %u\n", FUNC, iblock->nchildren);
-HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent);
-HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry);
-#endif /* QAK */
/* Move current iterator position backwards once */
curr_entry--;
@@ -1321,23 +1189,14 @@ HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry);
/* Walk backwards through entries, until we find one that has a child */
/* (Skip direct block that will be deleted, if we find it) */
tmp_entry = curr_entry;
-#ifdef QAK
-HDfprintf(stderr, "%s: tmp_entry = %d\n", FUNC, tmp_entry);
-#endif /* QAK */
while(tmp_entry >= 0 &&
(H5F_addr_eq(iblock->ents[tmp_entry].addr, dblock_addr) ||
!H5F_addr_defined(iblock->ents[tmp_entry].addr)))
tmp_entry--;
-#ifdef QAK
-HDfprintf(stderr, "%s: check 2.0 - tmp_entry = %d\n", FUNC, tmp_entry);
-#endif /* QAK */
/* Check for no earlier blocks in this indirect block */
if(tmp_entry < 0) {
/* Check for parent of current indirect block */
if(iblock->parent) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Walking up a block\n", FUNC);
-#endif /* QAK */
/* Move iterator to parent of current block */
if(H5HF_man_iter_up(&hdr->next_block) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to move current block iterator location up")
@@ -1345,11 +1204,6 @@ HDfprintf(stderr, "%s: Walking up a block\n", FUNC);
/* Get information about current iterator location */
if(H5HF_man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator information")
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->nchildren = %u\n", FUNC, iblock->nchildren);
-HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent);
-HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry);
-#endif /* QAK */
/* Move current iterator position backwards once */
curr_entry--;
@@ -1358,9 +1212,6 @@ HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry);
walked_up = TRUE;
} /* end if */
else {
-#ifdef QAK
-HDfprintf(stderr, "%s: Heap empty\n", FUNC);
-#endif /* QAK */
/* Reset iterator offset */
hdr->man_iter_off = 0;
@@ -1376,14 +1227,7 @@ HDfprintf(stderr, "%s: Heap empty\n", FUNC);
/* Check if entry is for a direct block */
row = curr_entry / hdr->man_dtable.cparam.width;
-#ifdef QAK
-HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry);
-HDfprintf(stderr, "%s: row = %u\n", FUNC, row);
-#endif /* QAK */
if(row < hdr->man_dtable.max_direct_rows) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Found direct block\n", FUNC);
-#endif /* QAK */
/* Increment entry to empty location */
curr_entry++;
@@ -1395,19 +1239,12 @@ HDfprintf(stderr, "%s: Found direct block\n", FUNC);
hdr->man_iter_off = iblock->block_off;
hdr->man_iter_off += hdr->man_dtable.row_block_off[curr_entry / hdr->man_dtable.cparam.width];
hdr->man_iter_off += hdr->man_dtable.row_block_size[curr_entry / hdr->man_dtable.cparam.width] * (curr_entry % hdr->man_dtable.cparam.width);
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off);
-HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry);
-#endif /* QAK */
} /* end if */
else {
H5HF_indirect_t *child_iblock; /* Pointer to child indirect block */
hbool_t did_protect; /* Whether we protected the indirect block or not */
unsigned child_nrows; /* # of rows in child block */
-#ifdef QAK
-HDfprintf(stderr, "%s: Walking down into child block\n", FUNC);
-#endif /* QAK */
/* Compute # of rows in next child indirect block to use */
child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[row]);
@@ -1426,11 +1263,6 @@ HDfprintf(stderr, "%s: Walking down into child block\n", FUNC);
/* Update iterator location */
iblock = child_iblock;
curr_entry = (child_iblock->nrows * hdr->man_dtable.cparam.width) - 1;
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->nchildren = %u\n", FUNC, iblock->nchildren);
-HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent);
-HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry);
-#endif /* QAK */
/* Unprotect child indirect block */
if(H5HF_man_iblock_unprotect(child_iblock, dxpl_id, H5AC__NO_FLAGS_SET, did_protect) < 0)
@@ -1466,18 +1298,12 @@ H5HF_hdr_empty(H5HF_hdr_t *hdr)
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_empty)
-#ifdef QAK
-HDfprintf(stderr, "%s: Resetting heap header to empty\n", FUNC);
-#endif /* QAK */
/* Sanity check */
HDassert(hdr);
/* Reset block iterator, if necessary */
if(H5HF_man_iter_ready(&hdr->next_block)) {
-#ifdef QAK
-HDfprintf(stderr, "%s: 'next block' iterator is ready\n", FUNC);
-#endif /* QAK */
if(H5HF_man_iter_reset(&hdr->next_block) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator")
} /* end if */
@@ -1584,9 +1410,6 @@ H5HF_hdr_delete(H5HF_hdr_t *hdr, hid_t dxpl_id)
* will get unpinned)
*/
if(H5F_addr_defined(hdr->fs_addr)) {
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->fs_addr = %a\n", FUNC, hdr->fs_addr);
-#endif /* QAK */
/* Delete free space manager for heap */
if(H5HF_space_delete(hdr, dxpl_id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap free space manager")
@@ -1594,18 +1417,12 @@ HDfprintf(stderr, "%s: hdr->fs_addr = %a\n", FUNC, hdr->fs_addr);
/* Check for root direct/indirect block */
if(H5F_addr_defined(hdr->man_dtable.table_addr)) {
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a\n", FUNC, hdr->man_dtable.table_addr);
-#endif /* QAK */
if(hdr->man_dtable.curr_root_rows == 0) {
hsize_t dblock_size; /* Size of direct block */
/* Check for I/O filters on this heap */
if(hdr->filter_len > 0) {
dblock_size = (hsize_t)hdr->pline_root_direct_size;
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu\n", FUNC, hdr->pline_root_direct_size);
-#endif /* QAK */
/* Reset the header's pipeline information */
hdr->pline_root_direct_size = 0;
@@ -1627,9 +1444,6 @@ HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu\n", FUNC, hdr->pline_ro
/* Check for 'huge' objects in heap */
if(H5F_addr_defined(hdr->huge_bt2_addr)) {
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->huge_bt2_addr = %a\n", FUNC, hdr->huge_bt2_addr);
-#endif /* QAK */
/* Delete huge objects in heap and their tracker */
if(H5HF_huge_delete(hdr, dxpl_id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap 'huge' objects and tracker")
diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c
index 8969aae..809a720 100644
--- a/src/H5HFiblock.c
+++ b/src/H5HFiblock.c
@@ -116,7 +116,7 @@ H5HF_iblock_pin(H5HF_indirect_t *iblock)
HDassert(iblock);
/* Mark block as un-evictable */
- if(H5AC_pin_protected_entry(iblock->hdr->f, iblock) < 0)
+ if(H5AC_pin_protected_entry(iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin fractal heap indirect block")
/* If this indirect block has a parent, update it's child iblock pointer */
@@ -200,7 +200,7 @@ H5HF_iblock_unpin(H5HF_indirect_t *iblock)
} /* end if */
/* Mark block as evictable again */
- if(H5AC_unpin_entry(iblock->hdr->f, iblock) < 0)
+ if(H5AC_unpin_entry(iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block")
done:
@@ -239,10 +239,6 @@ H5HF_iblock_incr(H5HF_indirect_t *iblock)
/* Increment reference count on shared indirect block */
iblock->rc++;
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->addr = %a, iblock->rc = %Zu\n", FUNC, iblock->addr, iblock->rc);
-HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off);
-#endif /* QAK */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -274,23 +270,13 @@ H5HF_iblock_decr(H5HF_indirect_t *iblock)
/* Decrement reference count on shared indirect block */
iblock->rc--;
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->addr = %a, iblock->rc = %Zu\n", FUNC, iblock->addr, iblock->rc);
-HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off);
-#endif /* QAK */
/* Mark block as evictable again when no child blocks depend on it */
if(iblock->rc == 0) {
-#ifdef QAK
-HDfprintf(stderr, "%s: indirect block ref. count at zero, iblock->addr = %a\n", FUNC, iblock->addr);
-#endif /* QAK */
if(H5HF_iblock_unpin(iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block")
if(iblock->nchildren == 0) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Removing indirect block from cache, iblock->addr = %a\n", FUNC, iblock->addr);
-#endif /* QAK */
/* Check for deleting root indirect block (and no root direct block) */
if(iblock->block_off == 0 && iblock->hdr->man_dtable.curr_root_rows > 0) {
/* Reset root pointer information */
@@ -341,15 +327,12 @@ H5HF_iblock_dirty(H5HF_indirect_t *iblock)
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_iblock_dirty)
-#ifdef QAK
-HDfprintf(stderr, "%s: Marking indirect block as dirty\n", FUNC);
-#endif /* QAK */
/* Sanity check */
HDassert(iblock);
/* Mark indirect block as dirty in cache */
- if(H5AC_mark_pinned_or_protected_entry_dirty(iblock->hdr->f, iblock) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap indirect block as dirty")
done:
@@ -384,10 +367,6 @@ H5HF_man_iblock_root_create(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_root_create)
-#ifdef QAK
-HDfprintf(stderr, "%s: Creating root indirect block\n", FUNC);
-#endif /* QAK */
-
/* Check for allocating entire root indirect block initially */
if(hdr->man_dtable.cparam.start_root_rows == 0)
nrows = hdr->man_dtable.max_root_rows;
@@ -404,16 +383,10 @@ HDfprintf(stderr, "%s: Creating root indirect block\n", FUNC);
if(nrows < rows_needed)
nrows = rows_needed;
} /* end else */
-#ifdef QAK
-HDfprintf(stderr, "%s: nrows = %u\n", FUNC, nrows);
-#endif /* QAK */
/* Allocate root indirect block */
if(H5HF_man_iblock_create(hdr, dxpl_id, NULL, 0, nrows, hdr->man_dtable.max_root_rows, &iblock_addr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block")
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr);
-#endif /* QAK */
/* Move current direct block (used as root) into new indirect block */
@@ -423,9 +396,6 @@ HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr);
/* Check if there's already a direct block as root) */
have_direct_block = H5F_addr_defined(hdr->man_dtable.table_addr);
-#ifdef QAK
-HDfprintf(stderr, "%s: have_direct_block = %u\n", FUNC, (unsigned)have_direct_block);
-#endif /* QAK */
if(have_direct_block) {
H5HF_direct_t *dblock; /* Pointer to direct block to query */
@@ -527,14 +497,10 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si
unsigned new_nrows; /* New # of rows */
hbool_t skip_direct_rows = FALSE; /* Whether we are skipping direct rows */
size_t u; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_root_double)
-#ifdef QAK
-HDfprintf(stderr, "%s: Extending root indirect block, min_dblock_size = %Zu\n", FUNC, min_dblock_size);
-#endif /* QAK */
-
/* Get "new block" iterator information */
if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location")
@@ -542,19 +508,10 @@ HDfprintf(stderr, "%s: Extending root indirect block, min_dblock_size = %Zu\n",
/* Make certain the iterator is at the root indirect block */
HDassert(iblock->parent == NULL);
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off);
-#endif /* QAK */
HDassert(iblock->block_off == 0);
/* Keep this for later */
old_nrows = iblock->nrows;
-#ifdef QAK
-HDfprintf(stderr, "%s: old_nrows = %u\n", FUNC, old_nrows);
-HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry);
-HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row);
-HDfprintf(stderr, "%s: next_size = %Hu\n", FUNC, next_size);
-#endif /* QAK */
/* Check for skipping over direct block rows */
if(iblock->nrows < hdr->man_dtable.max_direct_rows && min_dblock_size > next_size) {
@@ -573,11 +530,6 @@ HDfprintf(stderr, "%s: next_size = %Hu\n", FUNC, next_size);
/* Compute new # of rows in indirect block */
new_nrows = MAX(min_nrows, MIN(2 * iblock->nrows, iblock->max_rows));
-#ifdef QAK
-HDfprintf(stderr, "%s: min_nrows = %u, new_nrows = %u\n", FUNC, min_nrows, new_nrows);
-HDfprintf(stderr, "%s: iblock->nrows = %u, iblock->max_rows = %u\n", FUNC, iblock->nrows, iblock->max_rows);
-HDfprintf(stderr, "%s: new_next_entry = %u\n", FUNC, new_next_entry);
-#endif /* QAK */
/* Check if the indirect block is NOT currently allocated in temp. file space */
/* (temp. file space does not need to be freed) */
@@ -609,9 +561,6 @@ HDfprintf(stderr, "%s: new_next_entry = %u\n", FUNC, new_next_entry);
if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size)))
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block")
} /* end else */
-#ifdef QAK
-HDfprintf(stderr, "%s: Check 1.0 - iblock->addr = %a, new_addr = %a\n", FUNC, iblock->addr, new_addr);
-#endif /* QAK */
/* Move object in cache, if it actually was relocated */
if(H5F_addr_ne(iblock->addr, new_addr)) {
@@ -691,11 +640,6 @@ HDfprintf(stderr, "%s: Check 1.0 - iblock->addr = %a, new_addr = %a\n", FUNC, ib
hdr->man_dtable.table_addr = new_addr;
/* Extend heap to cover new root indirect block */
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows - 1] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows - 1]);
-HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows]);
-HDfprintf(stderr, "%s: acc_dblock_free = %Hu\n", FUNC, acc_dblock_free);
-#endif /* QAK */
if(H5HF_hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], (hssize_t)acc_dblock_free) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block")
@@ -736,19 +680,11 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id)
HDassert(iblock->parent == NULL);
HDassert(hdr);
-#ifdef QAK
-HDfprintf(stderr, "%s: Reducing root indirect block\n", FUNC);
-#endif /* QAK */
-
/* Compute maximum row used by child of indirect block */
max_child_row = iblock->max_child / hdr->man_dtable.cparam.width;
/* Compute new # of rows in root indirect block */
new_nrows = 1 << (1 + H5V_log2_gen((uint64_t)max_child_row));
-#ifdef QAK
-HDfprintf(stderr, "%s: new_nrows = %u\n", FUNC, new_nrows);
-HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows);
-#endif /* QAK */
/* Check if the indirect block is NOT currently allocated in temp. file space */
/* (temp. file space does not need to be freed) */
@@ -786,9 +722,6 @@ HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows);
if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size)))
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block")
} /* end else */
-#ifdef QAK
-HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr);
-#endif /* QAK */
/* Move object in cache, if it actually was relocated */
if(H5F_addr_ne(iblock->addr, new_addr)) {
@@ -834,11 +767,6 @@ HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr);
hdr->man_dtable.table_addr = new_addr;
/* Shrink heap to only cover new root indirect block */
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows - 1] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows - 1]);
-HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows]);
-HDfprintf(stderr, "%s: acc_dblock_free = %Hu\n", FUNC, acc_dblock_free);
-#endif /* QAK */
if(H5HF_hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], -(hssize_t)acc_dblock_free) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce space to cover root direct block")
@@ -879,10 +807,6 @@ H5HF_man_iblock_root_revert(H5HF_indirect_t *root_iblock, hid_t dxpl_id)
*/
HDassert(root_iblock);
-#ifdef QAK
-HDfprintf(stderr, "%s: Reverting root indirect block\n", FUNC);
-#endif /* QAK */
-
/* Set up local convenience variables */
hdr = root_iblock->hdr;
dblock_addr = root_iblock->ents[0].addr;
@@ -972,13 +896,6 @@ H5HF_man_iblock_alloc_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t **
if(NULL == (iblock = H5HF_sect_row_get_iblock(old_sec_node)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve indirect block for row section")
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->addr = %a\n", FUNC, iblock->addr);
-HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off);
-HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent);
-HDfprintf(stderr, "%s: iblock->rc = %Zu\n", FUNC, iblock->rc);
-#endif /* QAK */
-
/* Hold indirect block in memory, until direct block can point to it */
if(H5HF_iblock_incr(iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block")
@@ -989,9 +906,6 @@ HDfprintf(stderr, "%s: iblock->rc = %Zu\n", FUNC, iblock->rc);
HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce row section node")
/* Create direct block & single section */
-#ifdef QAK
-HDfprintf(stderr, "%s: Allocating direct block, dblock_entry = %u\n", FUNC, dblock_entry);
-#endif /* QAK */
if(H5HF_man_dblock_create(dxpl_id, hdr, iblock, dblock_entry, NULL, sec_node) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block")
@@ -1049,9 +963,6 @@ H5HF_man_iblock_create(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_indirect_t *par_iblo
if(H5HF_hdr_incr(hdr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header")
-#ifdef QAK
-HDfprintf(stderr, "%s: nrows = %u, max_rows = %u\n", FUNC, nrows, max_rows);
-#endif /* QAK */
/* Set info for direct block */
iblock->rc = 0;
iblock->nrows = nrows;
@@ -1074,9 +985,6 @@ HDfprintf(stderr, "%s: nrows = %u, max_rows = %u\n", FUNC, nrows, max_rows);
/* Compute the number of direct rows for this indirect block */
dir_rows = MIN(iblock->nrows, hdr->man_dtable.max_direct_rows);
-#ifdef QAK
-HDfprintf(stderr, "%s: dir_rows = %u\n", FUNC, dir_rows);
-#endif /* QAK */
/* Allocate & initialize indirect block filtered entry array */
if(NULL == (iblock->filt_ents = H5FL_SEQ_CALLOC(H5HF_indirect_filt_ent_t, (size_t)(dir_rows * hdr->man_dtable.cparam.width))))
@@ -1147,7 +1055,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5HF_man_iblock_protect
*
- * Purpose: Convenience wrapper around H5AC_protect on a indirect block
+ * Purpose: Convenience wrapper around H5AC_protect on an indirect block
*
* Return: Pointer to indirect block on success, NULL on failure
*
@@ -1168,9 +1076,6 @@ H5HF_man_iblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr,
H5HF_indirect_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_protect)
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock_addr = %a, iblock_nrows = %u\n", FUNC, iblock_addr, iblock_nrows);
-#endif /* QAK */
/*
* Check arguments.
@@ -1241,7 +1146,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5HF_man_iblock_unprotect
*
- * Purpose: Convenience wrapper around H5AC_unprotect on a indirect block
+ * Purpose: Convenience wrapper around H5AC_unprotect on an indirect block
*
* Return: SUCCEED/FAIL
*
@@ -1296,10 +1201,6 @@ H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_ad
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_attach)
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock = %p, entry = %u, child_addr = %a\n", FUNC, iblock, entry, child_addr);
-HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, iblock->block_off, iblock->nchildren);
-#endif /* QAK */
/*
* Check arguments.
@@ -1365,10 +1266,6 @@ H5HF_man_iblock_detach(H5HF_indirect_t *iblock, hid_t dxpl_id, unsigned entry)
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_detach)
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock = %p, entry = %u\n", FUNC, iblock, entry);
-HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, iblock->block_off, iblock->nchildren);
-#endif /* QAK */
/*
* Check arguments.
@@ -1449,10 +1346,6 @@ HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC,
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
done:
-#ifdef QAK
-HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
-HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, iblock->block_off, iblock->nchildren);
-#endif /* QAK */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_man_iblock_detach() */
@@ -1517,9 +1410,6 @@ H5HF_man_iblock_delete(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr,
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_delete)
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock_addr = %a, iblock_nrows = %u\n", FUNC, iblock_addr, iblock_nrows);
-#endif /* QAK */
/*
* Check arguments.
diff --git a/src/H5HFiter.c b/src/H5HFiter.c
index e0f7142..a3c61d7 100644
--- a/src/H5HFiter.c
+++ b/src/H5HFiter.c
@@ -139,9 +139,6 @@ H5HF_man_iter_start_offset(H5HF_hdr_t *hdr, hid_t dxpl_id,
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iter_start_offset)
-#ifdef QAK
-HDfprintf(stderr, "%s: offset = %Hu\n", FUNC, offset);
-#endif /* QAK */
/*
* Check arguments.
@@ -185,19 +182,11 @@ HDfprintf(stderr, "%s: offset = %Hu\n", FUNC, offset);
/* Compute column */
H5_CHECK_OVERFLOW((curr_offset / hdr->man_dtable.row_block_size[row]), hsize_t, unsigned);
col = (unsigned)(curr_offset / hdr->man_dtable.row_block_size[row]);
-#ifdef QAK
-HDfprintf(stderr, "%s: row = %u, col = %u\n", FUNC, row, col);
-HDfprintf(stderr, "%s: offset = %Hu\n", FUNC, offset);
-HDfprintf(stderr, "%s: curr_offset = %Hu\n", FUNC, curr_offset);
-#endif /* QAK */
/* Set the current level's context */
biter->curr->row = row;
biter->curr->col = col;
biter->curr->entry = (row * hdr->man_dtable.cparam.width) + col;
-#ifdef QAK
-HDfprintf(stderr, "%s: biter->curr->entry = %u\n", FUNC, biter->curr->entry);
-#endif /* QAK */
/* Get the context indirect block's information */
if(root_block) {
@@ -457,11 +446,6 @@ H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries)
biter->curr->row = biter->curr->entry / hdr->man_dtable.cparam.width;
biter->curr->col = biter->curr->entry % hdr->man_dtable.cparam.width;
/* HDassert(biter->curr->row <= biter->curr->context->nrows); */
-#ifdef QAK
-HDfprintf(stderr, "%s: biter->curr->entry = %u\n", "H5HF_man_iter_next", biter->curr->entry);
-HDfprintf(stderr, "%s: biter->curr->row = %u\n", "H5HF_man_iter_next", biter->curr->row);
-HDfprintf(stderr, "%s: biter->curr->col = %u\n", "H5HF_man_iter_next", biter->curr->col);
-#endif /* QAK */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_man_iter_next() */
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 3fb0cfb..47478e6 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -117,9 +117,6 @@ H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_insert)
-#ifdef QAK
-HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size);
-#endif /* QAK */
/*
* Check arguments.
@@ -135,9 +132,6 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size);
/* Look for free space */
if((node_found = H5HF_space_find(hdr, dxpl_id, (hsize_t)obj_size, &sec_node)) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap")
-#ifdef QAK
-HDfprintf(stderr, "%s: After H5HF_space_find(), node_found = %t\n", FUNC, node_found);
-#endif /* QAK */
/* If we didn't find a node, go create a direct block big enough to hold the requested block */
if(!node_found)
@@ -148,15 +142,6 @@ HDfprintf(stderr, "%s: After H5HF_space_find(), node_found = %t\n", FUNC, node_f
/* Check for row section */
if(sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW ||
sec_node->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW) {
-#ifdef QAK
-HDfprintf(stderr, "%s: sec_node->sect_info.addr = %a\n", FUNC, sec_node->sect_info.addr);
-HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size);
-HDfprintf(stderr, "%s: sec_node->sect_info.type = %s\n", FUNC, (sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW ? "H5HF_FSPACE_SECT_FIRST_ROW" : "H5HF_FSPACE_SECT_NORMAL_ROW"));
-HDfprintf(stderr, "%s: sec_node->u.row.under = %p\n", FUNC, sec_node->u.row.under);
-HDfprintf(stderr, "%s: sec_node->u.row.row = %u\n", FUNC, sec_node->u.row.row);
-HDfprintf(stderr, "%s: sec_node->u.row.col = %u\n", FUNC, sec_node->u.row.col);
-HDfprintf(stderr, "%s: sec_node->u.row.num_entries = %u\n", FUNC, sec_node->u.row.num_entries);
-#endif /* QAK */
/* Allocate 'single' selection out of 'row' selection */
if(H5HF_man_iblock_alloc_row(hdr, dxpl_id, &sec_node) < 0)
@@ -174,14 +159,6 @@ HDfprintf(stderr, "%s: sec_node->u.row.num_entries = %u\n", FUNC, sec_node->u.ro
/* Retrieve direct block address from section */
if(H5HF_sect_single_dblock_info(hdr, dxpl_id, sec_node, &dblock_addr, &dblock_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information")
-#ifdef QAK
-HDfprintf(stderr, "%s: sec_node->sect_info.addr = %a\n", FUNC, sec_node->sect_info.addr);
-HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size);
-HDfprintf(stderr, "%s: sec_node->u.single.parent = %p\n", FUNC, sec_node->u.single.parent);
-if(sec_node->u.single.parent)
- HDfprintf(stderr, "%s: sec_node->u.single.parent->addr = %a\n", FUNC, sec_node->u.single.parent->addr);
-HDfprintf(stderr, "%s: sec_node->u.single.par_entry = %u\n", FUNC, sec_node->u.single.par_entry);
-#endif /* QAK */
/* Lock direct block */
if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sec_node->u.single.parent, sec_node->u.single.par_entry, H5AC_WRITE)))
@@ -192,16 +169,8 @@ HDfprintf(stderr, "%s: sec_node->u.single.par_entry = %u\n", FUNC, sec_node->u.s
/* Get the offset of the object within the block */
H5_CHECK_OVERFLOW((sec_node->sect_info.addr - dblock->block_off), hsize_t, size_t);
blk_off = (size_t)(sec_node->sect_info.addr - dblock->block_off);
-#ifdef QAK
-HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off);
-HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
-#endif /* QAK */
/* Sanity checks */
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free);
-HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
-#endif /* QAK */
HDassert(sec_node->sect_info.size >= obj_size);
/* Reduce (& possibly re-add) single section */
@@ -224,13 +193,7 @@ HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
} /* end block */
/* Set the heap ID for the new object (heap offset & obj length) */
-#ifdef QAK
-HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
-#endif /* QAK */
H5HF_MAN_ID_ENCODE(id, hdr, (dblock->block_off + blk_off), obj_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, (dblock->block_off + blk_off), obj_size);
-#endif /* QAK */
/* Update statistics about heap */
hdr->man_nobjs++;
@@ -303,16 +266,8 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
id++;
/* Decode the object offset within the heap & its length */
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->heap_off_size = %u, hdr->heap_len_size = %u\n", FUNC, (unsigned)hdr->heap_off_size, (unsigned)hdr->heap_len_size);
-#endif /* QAK */
UINT64DECODE_VAR(id, obj_off, hdr->heap_off_size);
UINT64DECODE_VAR(id, obj_len, hdr->heap_len_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len);
-HDfprintf(stderr, "%s: hdr->man_size = %Hu, hdr->max_man_size = %u\n", FUNC, hdr->man_size, (unsigned)hdr->max_man_size);
-HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hdr->man_dtable.cparam.max_direct_size);
-#endif /* QAK */
HDassert(obj_off > 0);
HDassert(obj_len > 0);
@@ -342,9 +297,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hd
/* Look up indirect block containing direct block */
if(H5HF_man_dblock_locate(hdr, dxpl_id, obj_off, &iblock, &entry, &did_protect, H5AC_READ) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section")
-#ifdef QAK
-HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[entry].addr);
-#endif /* QAK */
/* Set direct block info */
dblock_addr = iblock->ents[entry].addr;
@@ -374,9 +326,6 @@ HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[entry].addr);
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block")
iblock = NULL;
} /* end else */
-#ifdef QAK
-HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Zu\n", FUNC, dblock_addr, dblock_size);
-#endif /* QAK */
/* Compute offset of object within block */
HDassert((obj_off - dblock->block_off) < (hsize_t)dblock_size);
@@ -559,16 +508,8 @@ H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id)
id++;
/* Decode the object offset within the heap & it's length */
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->heap_off_size = %u, hdr->heap_len_size = %u\n", FUNC, (unsigned)hdr->heap_off_size, (unsigned)hdr->heap_len_size);
-#endif /* QAK */
UINT64DECODE_VAR(id, obj_off, hdr->heap_off_size);
UINT64DECODE_VAR(id, obj_len, hdr->heap_len_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len);
-HDfprintf(stderr, "%s: hdr->man_size = %Hu, hdr->max_man_size = %u\n", FUNC, hdr->man_size, (unsigned)hdr->max_man_size);
-HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hdr->man_dtable.cparam.max_direct_size);
-#endif /* QAK */
HDassert(obj_off > 0);
HDassert(obj_len > 0);
@@ -582,24 +523,15 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hd
/* Check for root direct block */
if(hdr->man_dtable.curr_root_rows == 0) {
-#ifdef QAK
-HDfprintf(stderr, "%s: direct root block\n", FUNC);
-#endif /* QAK */
/* Set direct block info */
dblock_size = hdr->man_dtable.cparam.start_block_size;
dblock_block_off = 0;
dblock_entry = 0;
} /* end if */
else {
-#ifdef QAK
-HDfprintf(stderr, "%s: indirect root block\n", FUNC);
-#endif /* QAK */
/* Look up indirect block containing direct block */
if(H5HF_man_dblock_locate(hdr, dxpl_id, obj_off, &iblock, &dblock_entry, &did_protect, H5AC_WRITE) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section")
-#ifdef QAK
-HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[dblock_entry].addr);
-#endif /* QAK */
/* Check for offset of invalid direct block */
if(!H5F_addr_defined(iblock->ents[dblock_entry].addr))
@@ -615,16 +547,10 @@ HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[dblock_entry].a
dblock_block_off += hdr->man_dtable.row_block_off[dblock_entry / hdr->man_dtable.cparam.width];
dblock_block_off += hdr->man_dtable.row_block_size[dblock_entry / hdr->man_dtable.cparam.width] * (dblock_entry % hdr->man_dtable.cparam.width);
} /* end else */
-#ifdef QAK
-HDfprintf(stderr, "%s: dblock_size = %Zu\n", FUNC, dblock_size);
-#endif /* QAK */
/* Compute offset of object within block */
HDassert((obj_off - dblock_block_off) < (hsize_t)dblock_size);
blk_off = (size_t)(obj_off - dblock_block_off);
-#ifdef QAK
-HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off);
-#endif /* QAK */
/* Check for object's offset in the direct block prefix information */
if(blk_off < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr))
@@ -637,14 +563,6 @@ HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off);
/* Create free space section node */
if(NULL == (sec_node = H5HF_sect_single_new(obj_off, obj_len, iblock, dblock_entry)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create section for direct block's free space")
-#ifdef QAK
-HDfprintf(stderr, "%s: sec_node->sect_info.addr = %a\n", FUNC, sec_node->sect_info.addr);
-HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size);
-HDfprintf(stderr, "%s: sec_node->u.single.parent = %p\n", FUNC, sec_node->u.single.parent);
-if(sec_node->u.single.parent)
- HDfprintf(stderr, "%s: sec_node->u.single.parent->addr = %a\n", FUNC, sec_node->u.single.parent->addr);
-HDfprintf(stderr, "%s: sec_node->u.single.par_entry = %u\n", FUNC, sec_node->u.single.par_entry);
-#endif /* QAK */
/* Unlock indirect block */
if(iblock) {
diff --git a/src/H5HFsection.c b/src/H5HFsection.c
index 91031be..102dc7c 100644
--- a/src/H5HFsection.c
+++ b/src/H5HFsection.c
@@ -490,7 +490,6 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size,
H5HF_indirect_t *parent, unsigned par_entry)
{
H5HF_free_section_t *sect = NULL; /* 'Single' free space section to add */
- hbool_t par_incr = FALSE; /* Indicate that parent iblock has been incremented */
H5HF_free_section_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_single_new)
@@ -509,7 +508,6 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size,
if(sect->u.single.parent) {
if(H5HF_iblock_incr(sect->u.single.parent) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block")
- par_incr = TRUE;
} /* end if */
sect->u.single.par_entry = par_entry;
@@ -518,13 +516,6 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size,
done:
if(!ret_value && sect) {
- /* Check if we should decrement parent ref. count */
- if(par_incr) {
- HDassert(sect->u.single.parent);
- if(H5HF_iblock_decr(sect->u.single.parent) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CANTDEC, NULL, "can't decrement reference count on parent indirect block")
- } /* end if */
-
/* Release the section */
(void)H5FL_FREE(H5HF_free_section_t, sect);
} /* end if */
@@ -814,10 +805,6 @@ H5HF_sect_single_full_dblock(H5HF_hdr_t *hdr, hid_t dxpl_id,
HDassert(sect->sect_info.state == H5FS_SECT_LIVE);
HDassert(hdr);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-#endif /* QAK */
-
/* Retrieve direct block address from section */
if(H5HF_sect_single_dblock_info(hdr, dxpl_id, sect, &dblock_addr, &dblock_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information")
@@ -825,18 +812,10 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_
/* Check for section occupying entire direct block */
/* (and not the root direct block) */
dblock_overhead = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr);
-#ifdef QAK
-HDfprintf(stderr, "%s: dblock_size = %u\n", FUNC, dblock_size);
-HDfprintf(stderr, "%s: dblock_overhead = %Zu\n", FUNC, dblock_overhead);
-HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", FUNC, hdr->man_dtable.curr_root_rows);
-#endif /* QAK */
if((dblock_size - dblock_overhead) == sect->sect_info.size &&
hdr->man_dtable.curr_root_rows > 0) {
H5HF_direct_t *dblock; /* Pointer to direct block for section */
-#ifdef QAK
-HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr);
-#endif /* QAK */
if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sect->u.single.parent, sect->u.single.par_entry, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block")
HDassert(H5F_addr_eq(dblock->block_off + dblock_overhead, sect->sect_info.addr));
@@ -845,11 +824,6 @@ HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr);
if(H5HF_sect_row_from_single(hdr, sect, dblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCONVERT, FAIL, "can't convert single section into row section")
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out);
-#endif /* QAK */
-
/* Destroy direct block */
if(H5HF_man_dblock_destroy(hdr, dxpl_id, dblock, dblock_addr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release direct block")
@@ -895,10 +869,6 @@ H5HF_sect_single_add(H5FS_section_info_t *_sect, unsigned *flags, void *_udata)
HDassert(sect);
HDassert(hdr);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_add", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-#endif /* QAK */
-
/* Check if single section covers entire direct block it's in */
/* (converts to row section possibly) */
if(H5HF_sect_single_full_dblock(hdr, dxpl_id, sect) < 0)
@@ -988,11 +958,6 @@ H5HF_sect_single_can_merge(const H5FS_section_info_t *_sect1,
HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */
HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr));
-#ifdef QAK
-HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_can_merge", sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_can_merge", sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-#endif /* QAK */
-
/* Check if second section adjoins first section */
/* (This can only occur within a direct block, due to the direct block
* overhead at the beginning of a block, so no need to check if sections
@@ -1042,11 +1007,6 @@ H5HF_sect_single_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2,
HDassert(sect2->sect_info.type == H5HF_FSPACE_SECT_SINGLE);
HDassert(H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr));
-#ifdef QAK
-HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-#endif /* QAK */
-
/* Add second section's size to first section */
sect1->sect_info.size += sect2->sect_info.size;
@@ -1100,11 +1060,6 @@ H5HF_sect_single_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
/* Check arguments. */
HDassert(sect);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_can_shrink", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", "H5HF_sect_single_can_shrink", hdr->man_dtable.curr_root_rows);
-#endif /* QAK */
-
/* Check for section occupying entire root direct block */
/* (We shouldn't ever have a single section that occupies an entire
* direct block, unless it's in the root direct block (because it
@@ -1117,10 +1072,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", "H5HF_sect_single
dblock_size = hdr->man_dtable.cparam.start_block_size;
dblock_overhead = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr);
-#ifdef QAK
-HDfprintf(stderr, "%s: dblock_size = %Zu\n", "H5HF_sect_single_can_shrink", dblock_size);
-HDfprintf(stderr, "%s: dblock_overhead = %Zu\n", "H5HF_sect_single_can_shrink", dblock_overhead);
-#endif /* QAK */
if((dblock_size - dblock_overhead) == sect->sect_info.size)
HGOTO_DONE(TRUE)
} /* end if */
@@ -1170,10 +1121,6 @@ H5HF_sect_single_shrink(H5FS_section_info_t **_sect, void UNUSED *_udata)
HDassert(*sect);
HDassert((*sect)->sect_info.type == H5HF_FSPACE_SECT_SINGLE);
-#ifdef QAK
-HDfprintf(stderr, "%s: (*sect).sect_info = {%a, %Hu, %u}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size, (*sect)->sect_info.type);
-#endif /* QAK */
-
/* Check to see if we should revive section */
if((*sect)->sect_info.state != H5FS_SECT_LIVE)
if(H5HF_sect_single_revive(hdr, dxpl_id, (*sect)) < 0)
@@ -1186,9 +1133,6 @@ HDfprintf(stderr, "%s: (*sect).sect_info = {%a, %Hu, %u}\n", FUNC, (*sect)->sect
/* Protect the direct block for the section */
/* (should be a root direct block) */
HDassert(dblock_addr == hdr->man_dtable.table_addr);
-#ifdef QAK
-HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr);
-#endif /* QAK */
if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr,
dblock_size, (*sect)->u.single.parent, (*sect)->u.single.par_entry, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block")
@@ -1276,9 +1220,6 @@ H5HF_sect_single_valid(const H5FS_section_class_t UNUSED *cls, const H5FS_sectio
/* Check arguments. */
HDassert(sect);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_valid", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-#endif /* QAK */
if(sect->sect_info.state == H5FS_SECT_LIVE) {
/* Check if this section is not in a direct block that is the root direct block */
/* (not enough information to check on a single section in a root direct block) */
@@ -1290,9 +1231,6 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single
unsigned dblock_status = 0; /* Direct block's status in the metadata cache */
herr_t status; /* Generic status value */
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->u.single = {%p, %u, %a, %Zu}\n", "H5HF_sect_single_valid", sect->u.single.parent, sect->u.single.par_entry);
-#endif /* QAK */
/* Sanity check settings for section's direct block's parent */
iblock = sect->u.single.parent;
HDassert(H5F_addr_defined(iblock->ents[sect->u.single.par_entry].addr));
@@ -1419,11 +1357,6 @@ H5HF_sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect,
HDassert(hdr);
HDassert(sect);
HDassert(dblock);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect.sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: dblock->parent = %p\n", FUNC, dblock->parent);
-HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", FUNC, hdr->man_dtable.curr_root_rows);
-#endif /* QAK */
/* Convert 'single' section information to 'row' section info */
sect->sect_info.addr = dblock->block_off;
@@ -1517,10 +1450,6 @@ H5HF_sect_row_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *sect,
sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW);
HDassert(sect->sect_info.state == H5FS_SECT_LIVE);
HDassert(entry_p);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out);
-#endif /* QAK */
/* Mark the row as checked out from the free space manager */
HDassert(sect->u.row.checked_out == FALSE);
@@ -1538,9 +1467,6 @@ HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect->u.row.
/* Check for eliminating the section */
if(sect->u.row.num_entries == 1) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Freeing row section\n", FUNC);
-#endif /* QAK */
/* Free row section */
if(H5HF_sect_row_free((H5FS_section_info_t *)sect) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free row section node")
@@ -1844,16 +1770,6 @@ H5HF_sect_row_can_merge(const H5FS_section_info_t *_sect1,
HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */
HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr));
-#ifdef QAK
-HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_can_merge", sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_can_merge", sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-#endif /* QAK */
-
-#ifdef QAK
-HDfprintf(stderr, "%s: sect1->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_can_merge", sect1->u.row.under, sect1->u.row.row, sect1->u.row.col, sect1->u.row.num_entries, sect1->u.row.checked_out);
-HDfprintf(stderr, "%s: sect2->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_can_merge", sect2->u.row.under, sect2->u.row.row, sect2->u.row.col, sect2->u.row.num_entries, sect2->u.row.checked_out);
-#endif /* QAK */
-
/* Get the top indirect section underlying each row */
top_indir_sect1 = H5HF_sect_indirect_top(sect1->u.row.under);
HDassert(top_indir_sect1);
@@ -1866,11 +1782,6 @@ HDfprintf(stderr, "%s: sect2->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_ca
*/
if(top_indir_sect1 != top_indir_sect2) {
if(H5HF_sect_indirect_iblock_off(top_indir_sect1) == H5HF_sect_indirect_iblock_off(top_indir_sect2)) {
-#ifdef QAK
-HDfprintf(stderr, "%s: top_indir_sect1->sect_info.addr = %a\n", "H5HF_sect_row_can_merge", top_indir_sect1->sect_info.addr);
-HDfprintf(stderr, "%s: top_indir_sect1->u.indirect.span_size = %Hu\n", "H5HF_sect_row_can_merge", top_indir_sect1->u.indirect.span_size);
-HDfprintf(stderr, "%s: top_indir_sect2->sect_info.addr = %a\n", "H5HF_sect_row_can_merge", top_indir_sect2->sect_info.addr);
-#endif /* QAK */
/* Check if second section adjoins first section */
if(H5F_addr_eq((top_indir_sect1->sect_info.addr + top_indir_sect1->u.indirect.span_size), top_indir_sect2->sect_info.addr))
HGOTO_DONE(TRUE)
@@ -1878,9 +1789,6 @@ HDfprintf(stderr, "%s: top_indir_sect2->sect_info.addr = %a\n", "H5HF_sect_row_c
} /* end if */
done:
-#ifdef QAK
-HDfprintf(stderr, "%s: ret_value = %t\n", "H5HF_sect_row_can_merge", ret_value);
-#endif /* QAK */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5HF_sect_row_can_merge() */
@@ -1920,15 +1828,7 @@ H5HF_sect_row_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2,
HDassert(sect2);
HDassert(sect2->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-#endif /* QAK */
-
/* Check if second section is past end of "next block" iterator */
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", "H5HF_sect_row_can_shrink", hdr->man_iter_off);
-#endif /* QAK */
if(sect2->sect_info.addr >= hdr->man_iter_off) {
H5HF_free_section_t *top_indir_sect; /* Top indirect section for row */
@@ -1949,10 +1849,6 @@ HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", "H5HF_sect_row_can_shrink", h
if(sect2->sect_info.state != H5FS_SECT_LIVE)
if(H5HF_sect_row_revive(hdr, dxpl_id, sect2) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section")
-#ifdef QAK
-HDfprintf(stderr, "%s: sect1->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect1->u.row.under, sect1->u.row.row, sect1->u.row.col, sect1->u.row.num_entries, sect1->u.row.checked_out);
-HDfprintf(stderr, "%s: sect2->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect2->u.row.under, sect2->u.row.row, sect2->u.row.col, sect2->u.row.num_entries, sect2->u.row.checked_out);
-#endif /* QAK */
/* Merge rows' underlying indirect sections together */
if(H5HF_sect_indirect_merge_row(hdr, dxpl_id, sect1, sect2) < 0)
@@ -1996,15 +1892,7 @@ H5HF_sect_row_can_shrink(const H5FS_section_info_t *_sect, void UNUSED *_udata)
HDassert(sect);
HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_can_shrink", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_can_shrink", sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out);
-#endif /* QAK */
-
/* Check if section is past end of "next block" iterator */
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", "H5HF_sect_row_can_shrink", hdr->man_iter_off);
-#endif /* QAK */
if(sect->sect_info.addr >= hdr->man_iter_off)
HGOTO_DONE(TRUE)
@@ -2044,11 +1932,6 @@ H5HF_sect_row_shrink(H5FS_section_info_t **_sect, void *_udata)
HDassert(*sect);
HDassert((*sect)->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW);
-#ifdef QAK
-HDfprintf(stderr, "%s: (*sect)->sect_info = {%a, %Hu, %u, %s}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size, (*sect)->sect_info.type, ((*sect)->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: (*sect)->u.row = {%p, %u, %u, %u}\n", FUNC, (*sect)->u.row.under, (*sect)->u.row.row, (*sect)->u.row.col, (*sect)->u.row.num_entries);
-#endif /* QAK */
-
/* Get the top indirect section underlying each row */
top_indir_sect = H5HF_sect_indirect_top((*sect)->u.row.under);
@@ -2166,19 +2049,12 @@ H5HF_sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *
cls_prvt = (H5HF_sect_private_t *)cls->cls_private;
hdr = cls_prvt->hdr;
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_valid", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_valid", sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out);
-#endif /* QAK */
/* Sanity checking on the row */
HDassert(sect->u.row.under);
HDassert(sect->u.row.num_entries);
HDassert(sect->u.row.checked_out == FALSE);
indir_sect = sect->u.row.under;
indir_idx = sect->u.row.row - indir_sect->u.indirect.row;
-#ifdef QAK
-HDfprintf(stderr, "%s: indir_idx = %u\n", "H5HF_sect_row_valid", indir_idx);
-#endif /* QAK */
HDassert(indir_sect->u.indirect.dir_rows[indir_idx] == sect);
/* Check if the section is actually within the heap */
@@ -2277,9 +2153,6 @@ H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect)
ret_value = sect->sect_info.state == H5FS_SECT_LIVE ? sect->u.indirect.u.iblock->block_off : sect->u.indirect.u.iblock_off;
-#ifdef QAK
-HDfprintf(stderr, "%s: Leaving, ret_value = %Hu\n", "H5HF_sect_indirect_iblock_off", ret_value);
-#endif /* QAK */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_sect_indirect_iblock_off() */
@@ -2309,17 +2182,11 @@ H5HF_sect_indirect_top(H5HF_free_section_t *sect)
*/
HDassert(sect);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect1->u.indirect.parent = %p\n", "H5HF_sect_indirect_top", sect->u.indirect.parent);
-#endif /* QAK */
if(sect->u.indirect.parent)
ret_value = H5HF_sect_indirect_top(sect->u.indirect.parent);
else
ret_value = sect;
-#ifdef QAK
-HDfprintf(stderr, "%s: Leaving, ret_value = %p\n", "H5HF_sect_indirect_top", ret_value);
-#endif /* QAK */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_sect_indirect_top() */
@@ -2415,7 +2282,6 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size,
unsigned nentries)
{
H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */
- hbool_t iblock_incr = FALSE; /* Indicate that parent iblock has been incremented */
H5HF_free_section_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_new)
@@ -2438,7 +2304,6 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size,
sect->u.indirect.u.iblock->max_rows;
if(H5HF_iblock_incr(sect->u.indirect.u.iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block")
- iblock_incr = TRUE;
} /* end if */
else {
sect->u.indirect.u.iblock_off = iblock_off;
@@ -2462,13 +2327,8 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size,
done:
if(!ret_value && sect) {
- /* Check if we should decrement parent ref. count */
- if(iblock_incr)
- if(H5HF_iblock_decr(sect->u.indirect.u.iblock) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CANTDEC, NULL, "can't decrement reference count on shared indirect block")
-
/* Release the section */
- (void)H5FL_FREE(H5HF_free_section_t, sect);
+ sect = H5FL_FREE(H5HF_free_section_t, sect);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -2504,9 +2364,6 @@ H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock,
HDassert(iblock);
HDassert(row_sect);
HDassert(row_sect->u.row.row < hdr->man_dtable.max_direct_rows);
-#ifdef QAK
-HDfprintf(stderr, "%s: Entering\n", FUNC);
-#endif /* QAK */
/* Create free space section node */
if(NULL == (sect = H5HF_sect_indirect_new(hdr, row_sect->sect_info.addr,
@@ -2537,9 +2394,6 @@ done:
if(H5HF_sect_indirect_free(sect) < 0)
HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "can't free indirect section node")
-#ifdef QAK
-HDfprintf(stderr, "%s: Leaving\n", FUNC);
-#endif /* QAK */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_sect_indirect_for_row() */
@@ -2576,12 +2430,6 @@ H5HF_sect_indirect_init_rows(H5HF_hdr_t *hdr, hid_t dxpl_id,
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_init_rows)
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: first_child = %t\n", FUNC, first_child);
-HDfprintf(stderr, "%s: start_row = %u, start_col = %u\n", FUNC, start_row, start_col);
-HDfprintf(stderr, "%s: end_row = %u, end_col = %u\n", FUNC, end_row, end_col);
-#endif /* QAK */
/*
* Check arguments.
@@ -2671,9 +2519,6 @@ HDfprintf(stderr, "%s: end_row = %u, end_col = %u\n", FUNC, end_row, end_col);
if(u < hdr->man_dtable.max_direct_rows) {
H5HF_free_section_t *row_sect = NULL; /* 'Row' free space section to add */
-#ifdef QAK
-HDfprintf(stderr, "%s: Creating direct row, row_col = %u, row_entries = %u\n", FUNC, row_col, row_entries);
-#endif /* QAK */
/* Create 'row' free space section node */
if(NULL == (row_sect = H5HF_sect_row_create(curr_off,
(hdr->man_dtable.row_block_size[u] - dblock_overhead), first_child, u, row_col,
@@ -2715,11 +2560,6 @@ HDfprintf(stderr, "%s: Creating direct row, row_col = %u, row_entries = %u\n", F
/* Compute info about row's indirect blocks for child section */
child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[u]);
child_nentries = child_nrows * hdr->man_dtable.cparam.width;
-#ifdef QAK
-HDfprintf(stderr, "%s: child_nrows = %u\n", FUNC, child_nrows);
-HDfprintf(stderr, "%s: child_nentries = %u\n", FUNC, child_nentries);
-HDfprintf(stderr, "%s: row_entries = %u\n", FUNC, row_entries);
-#endif /* QAK */
/* Add an indirect section for each indirect block in the row */
for(v = 0; v < row_entries; v++) {
@@ -2732,9 +2572,6 @@ HDfprintf(stderr, "%s: row_entries = %u\n", FUNC, row_entries);
/* Get the address of the child indirect block */
if(H5HF_man_iblock_entry_addr(sect->u.indirect.u.iblock, curr_entry, &child_iblock_addr) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve child indirect block's address")
-#ifdef QAK
-HDfprintf(stderr, "%s: child_iblock_addr = %a\n", FUNC, child_iblock_addr);
-#endif /* QAK */
/* If the child indirect block's address is defined, protect it */
if(H5F_addr_defined(child_iblock_addr)) {
@@ -2835,9 +2672,6 @@ H5HF_sect_indirect_add(H5HF_hdr_t *hdr, hid_t dxpl_id,
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_add)
-#ifdef QAK
-HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, nentries);
-#endif /* QAK */
/*
* Check arguments.
@@ -2860,9 +2694,6 @@ HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, ne
for(u = 0; u < start_row; u++)
sect_off += hdr->man_dtable.row_block_size[u] * hdr->man_dtable.cparam.width;
sect_off += hdr->man_dtable.row_block_size[start_row] * start_col;
-#ifdef QAK
-HDfprintf(stderr, "%s: sect_off = %Hu\n", FUNC, sect_off);
-#endif /* QAK */
/* Create free space section node */
if(NULL == (sect = H5HF_sect_indirect_new(hdr, sect_off, (hsize_t)0, iblock,
@@ -2915,9 +2746,6 @@ H5HF_sect_indirect_decr(H5HF_free_section_t *sect)
*/
HDassert(sect);
HDassert(sect->u.indirect.rc);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->u.indirect.rc = %u\n", FUNC, sect->u.indirect.rc);
-#endif /* QAK */
/* Decrement ref. count for indirect section */
sect->u.indirect.rc--;
@@ -2975,10 +2803,6 @@ H5HF_sect_indirect_revive_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_
HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED);
/* Look up indirect block containing indirect blocks for section */
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info.addr = %a\n", FUNC, sect->sect_info.addr);
-HDfprintf(stderr, "%s: sect->u.indirect.u.iblock_off = %Hu\n", FUNC, sect->u.indirect.u.iblock_off);
-#endif /* QAK */
if(H5HF_man_dblock_locate(hdr, dxpl_id, sect->sect_info.addr, &sec_iblock, NULL, &did_protect, H5AC_READ) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section")
@@ -3045,10 +2869,6 @@ H5HF_sect_indirect_revive(H5HF_hdr_t *hdr, hid_t dxpl_id,
HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED);
HDassert(sect_iblock);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info.addr = %a\n", FUNC, sect->sect_info.addr);
-HDfprintf(stderr, "%s: sect->u.indirect.u.iblock_off = %Hu\n", FUNC, sect->u.indirect.u.iblock_off);
-#endif /* QAK */
/* Increment reference count on indirect block that free section is in */
if(H5HF_iblock_incr(sect_iblock) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
@@ -3118,11 +2938,6 @@ H5HF_sect_indirect_reduce_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_
/* Compute starting & ending information for row section */
row_start_entry = (row_sect->u.row.row * hdr->man_dtable.cparam.width) + row_sect->u.row.col;
row_end_entry = (row_start_entry + row_sect->u.row.num_entries) - 1;
-#ifdef QAK
-HDfprintf(stderr, "%s: row_sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, row_sect->sect_info.addr, row_sect->sect_info.size, row_sect->sect_info.type, (row_sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: row_sect->u.row.row = %u, row_sect->u.row.col = %u, row_sect->u.row.num_entries = %u\n", FUNC, row_sect->u.row.row, row_sect->u.row.col, row_sect->u.row.num_entries);
-HDfprintf(stderr, "%s: row_start_entry = %u, row_end_entry = %u\n", FUNC, row_start_entry, row_end_entry);
-#endif /* QAK */
/* Compute starting & ending information for indirect section */
sect = row_sect->u.row.under;
@@ -3138,31 +2953,16 @@ HDfprintf(stderr, "%s: row_start_entry = %u, row_end_entry = %u\n", FUNC, row_st
HDassert(sect->u.indirect.dir_nrows > 0);
HDassert(sect->u.indirect.dir_rows);
HDassert(sect->u.indirect.dir_rows[(row_sect->u.row.row - start_row)] == row_sect);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: sect->u.indirect.parent = %p, sect->u.indirect.par_entry = %u\n", FUNC, sect->u.indirect.parent, sect->u.indirect.par_entry);
-HDfprintf(stderr, "%s: start_entry = %u, start_row = %u, start_col = %u\n", FUNC, start_entry, start_row, start_col);
-HDfprintf(stderr, "%s: end_entry = %u, end_row = %u\n", FUNC, end_entry, end_row);
-#endif /* QAK */
/* Check if we should allocate from end of indirect section */
if(row_end_entry == end_entry && start_row != end_row) {
*alloc_from_start = FALSE;
row_entry = row_end_entry;
-#ifdef QAK
-HDfprintf(stderr, "%s: Row is at end of indirect section\n", FUNC);
-#endif /* QAK */
} /* end if */
else {
*alloc_from_start = TRUE;
row_entry = row_start_entry;
-#ifdef QAK
-HDfprintf(stderr, "%s: Row is NOT at end of indirect section\n", FUNC);
-#endif /* QAK */
} /* end else */
-#ifdef QAK
-HDfprintf(stderr, "%s: row_entry = %u\n", FUNC, row_entry);
-#endif /* QAK */
/* Check if we have a parent section to be detached from */
if(sect->u.indirect.parent) {
@@ -3189,9 +2989,6 @@ HDfprintf(stderr, "%s: row_entry = %u\n", FUNC, row_entry);
/* Check how to adjust section for allocated entry */
if(sect->u.indirect.num_entries > 1) {
if(row_entry == start_entry) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Entry is at start of indirect section\n", FUNC);
-#endif /* QAK */
/* Adjust section start */
sect->sect_info.addr += hdr->man_dtable.row_block_size[sect->u.indirect.row];
@@ -3206,9 +3003,6 @@ HDfprintf(stderr, "%s: Entry is at start of indirect section\n", FUNC);
/* Adjust direct row information */
sect->u.indirect.dir_nrows--;
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->u.indirect.dir_nrows = %u\n", FUNC, sect->u.indirect.dir_nrows);
-#endif /* QAK */
/* Adjust direct row sections for indirect section */
if(sect->u.indirect.dir_nrows > 0) {
@@ -3244,9 +3038,6 @@ HDfprintf(stderr, "%s: sect->u.indirect.dir_nrows = %u\n", FUNC, sect->u.indirec
else if(row_entry == end_entry) {
unsigned new_end_row; /* New end row for entries */
-#ifdef QAK
-HDfprintf(stderr, "%s: Entry is at end of indirect section\n", FUNC);
-#endif /* QAK */
/* Sanity check */
HDassert(sect->u.indirect.indir_nents == 0);
HDassert(sect->u.indirect.indir_ents == NULL);
@@ -3271,9 +3062,6 @@ HDfprintf(stderr, "%s: Entry is at end of indirect section\n", FUNC);
unsigned new_start_row; /* New starting row for current indirect section */
unsigned u; /* Local index variable */
-#ifdef QAK
-HDfprintf(stderr, "%s: Entry is in middle of indirect section\n", FUNC);
-#endif /* QAK */
/* Sanity checks */
HDassert(row_sect->u.row.col == 0);
HDassert(row_sect->u.row.row > 0);
@@ -3285,10 +3073,6 @@ HDfprintf(stderr, "%s: Entry is in middle of indirect section\n", FUNC);
new_start_row = row_sect->u.row.row;
peer_nentries = row_entry - start_entry;
peer_dir_nrows = new_start_row - start_row;
-#ifdef QAK
-HDfprintf(stderr, "%s: peer_nentries = %u, peer_dir_nrows = %u\n", FUNC, peer_nentries, peer_dir_nrows);
-HDfprintf(stderr, "%s: new_start_row = %u\n", FUNC, new_start_row);
-#endif /* QAK */
/* Get indirect block information for peer */
if(sect->sect_info.state == H5FS_SECT_LIVE) {
@@ -3299,9 +3083,6 @@ HDfprintf(stderr, "%s: new_start_row = %u\n", FUNC, new_start_row);
iblock = NULL;
iblock_off = sect->u.indirect.u.iblock_off;
} /* end else */
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock = %p, iblock_off = %Hu\n", FUNC, iblock, iblock_off);
-#endif /* QAK */
/* Create peer indirect section */
if(NULL == (peer_sect = H5HF_sect_indirect_new(hdr, sect->sect_info.addr,
@@ -3409,9 +3190,6 @@ H5HF_sect_indirect_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s
HDassert(sect);
HDassert(sect->u.indirect.span_size > 0);
HDassert(sect->u.indirect.iblock_entries > 0);
-#ifdef QAK
-HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry);
-#endif /* QAK */
/* Compute starting & ending information for indirect section */
start_row = sect->u.indirect.row;
@@ -3419,12 +3197,6 @@ HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry);
start_entry = (start_row * hdr->man_dtable.cparam.width) + start_col;
end_entry = (start_entry + sect->u.indirect.num_entries) - 1;
end_row = end_entry / hdr->man_dtable.cparam.width;
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: sect->u.indirect.parent = %p, sect->u.indirect.par_entry = %u\n", FUNC, sect->u.indirect.parent, sect->u.indirect.par_entry);
-HDfprintf(stderr, "%s: start_entry = %u, start_row = %u, start_col = %u\n", FUNC, start_entry, start_row, start_col);
-HDfprintf(stderr, "%s: end_entry = %u, end_row = %u\n", FUNC, end_entry, end_row);
-#endif /* QAK */
/* Check how to adjust section for allocated entry */
if(sect->u.indirect.num_entries > 1) {
@@ -3449,9 +3221,6 @@ HDfprintf(stderr, "%s: end_entry = %u, end_row = %u\n", FUNC, end_entry, end_row
/* Check if we can allocate from start of indirect section */
if(child_entry == start_entry) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Child is at start of indirect section\n", FUNC);
-#endif /* QAK */
/* Sanity check */
HDassert(sect->u.indirect.dir_nrows == 0);
HDassert(sect->u.indirect.dir_rows == NULL);
@@ -3482,9 +3251,6 @@ HDfprintf(stderr, "%s: Child is at start of indirect section\n", FUNC);
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't make new 'first row' for child indirect section")
} /* end if */
else if(child_entry == end_entry) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Child is at end of indirect section\n", FUNC);
-#endif /* QAK */
/* Sanity check */
HDassert(sect->u.indirect.indir_nents > 0);
HDassert(sect->u.indirect.indir_ents);
@@ -3510,9 +3276,6 @@ HDfprintf(stderr, "%s: Child is at end of indirect section\n", FUNC);
unsigned new_nentries; /* New number of entries for current indirect section */
unsigned u; /* Local index variable */
-#ifdef QAK
-HDfprintf(stderr, "%s: Child is in middle of indirect section\n", FUNC);
-#endif /* QAK */
/* Sanity check */
HDassert(sect->u.indirect.indir_nents > 0);
HDassert(sect->u.indirect.indir_ents);
@@ -3523,10 +3286,6 @@ HDfprintf(stderr, "%s: Child is in middle of indirect section\n", FUNC);
peer_start_col = (child_entry + 1) % hdr->man_dtable.cparam.width;
child_row = child_entry / hdr->man_dtable.cparam.width;
new_nentries = sect->u.indirect.num_entries - (peer_nentries + 1);
-#ifdef QAK
-HDfprintf(stderr, "%s: peer_nentries = %u, peer_start_row = %u, peer_start_col = %u\n", FUNC, peer_nentries, peer_start_row, peer_start_col);
-HDfprintf(stderr, "%s: new_nentries = %u\n", FUNC, new_nentries);
-#endif /* QAK */
HDassert(child_row >= hdr->man_dtable.max_direct_rows);
/* Get indirect block information for peer */
@@ -3538,27 +3297,18 @@ HDfprintf(stderr, "%s: new_nentries = %u\n", FUNC, new_nentries);
iblock = NULL;
iblock_off = sect->u.indirect.u.iblock_off;
} /* end else */
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock = %p, iblock_off = %Hu\n", FUNC, iblock, iblock_off);
-#endif /* QAK */
/* Update the number of entries in current section & calculate it's span size */
/* (Will use this to compute the section address for the peer section */
sect->u.indirect.num_entries = new_nentries;
sect->u.indirect.span_size = H5HF_dtable_span_size(&hdr->man_dtable,
sect->u.indirect.row, sect->u.indirect.col, new_nentries);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->u.indirect.span_size = %Hu\n", FUNC, sect->u.indirect.span_size);
-#endif /* QAK */
HDassert(sect->u.indirect.span_size > 0);
/* Compute address of peer indirect section */
peer_sect_addr = sect->sect_info.addr;
peer_sect_addr += sect->u.indirect.span_size;
peer_sect_addr += hdr->man_dtable.row_block_size[child_row];
-#ifdef QAK
-HDfprintf(stderr, "%s: peer_sect_addr = %a\n", FUNC, peer_sect_addr);
-#endif /* QAK */
/* Create peer indirect section */
if(NULL == (peer_sect = H5HF_sect_indirect_new(hdr, peer_sect_addr,
@@ -3582,9 +3332,6 @@ HDfprintf(stderr, "%s: peer_sect_addr = %a\n", FUNC, peer_sect_addr);
/* Eliminate indirect entries for this section, if appropriate */
if(sect->u.indirect.indir_nents == 0)
sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.indir_ents);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->u.indirect.indir_nents = %u\n", FUNC, sect->u.indirect.indir_nents);
-#endif /* QAK */
/* Re-target transferred row sections to point to new underlying indirect section */
for(u = 0; u < peer_nentries; u++)
@@ -3597,10 +3344,6 @@ HDfprintf(stderr, "%s: sect->u.indirect.indir_nents = %u\n", FUNC, sect->u.indir
/* Adjust reference counts for current & peer sections */
peer_sect->u.indirect.rc = peer_nentries;
sect->u.indirect.rc -= peer_nentries;
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->u.indirect.rc = %u\n", FUNC, sect->u.indirect.rc);
-HDfprintf(stderr, "%s: peer_sect->u.indirect.rc = %u\n", FUNC, peer_sect->u.indirect.rc);
-#endif /* QAK */
/* Transfer cached information about indirect block */
peer_sect->u.indirect.iblock_entries = sect->u.indirect.iblock_entries;
@@ -3798,10 +3541,6 @@ H5HF_sect_indirect_merge_row(H5HF_hdr_t *hdr, hid_t dxpl_id,
HDassert(sect1);
sect2 = H5HF_sect_indirect_top(row_sect2->u.row.under);
HDassert(sect2);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-#endif /* QAK */
/* Sanity check some assumptions about the indirect sections */
HDassert(sect1->sect_info.state == H5FS_SECT_LIVE);
@@ -3818,18 +3557,7 @@ HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sec
start_entry1 = (start_row1 * hdr->man_dtable.cparam.width) + start_col1;
end_entry1 = (start_entry1 + sect1->u.indirect.num_entries) - 1;
end_row1 = end_entry1 / hdr->man_dtable.cparam.width;
-#ifdef QAK
-HDfprintf(stderr, "%s: sect1->u.indirect.dir_nrows = %u\n", FUNC, sect1->u.indirect.dir_nrows);
-HDfprintf(stderr, "%s: start_row1 = %u, start_col1 = %u, start_entry1 = %u\n", FUNC, start_row1, start_col1, start_entry1);
-HDfprintf(stderr, "%s: sect1->u.indirect.num_entries = %u\n", FUNC, sect1->u.indirect.num_entries);
-HDfprintf(stderr, "%s: end_row1 = %u, end_entry1 = %u\n", FUNC, end_row1, end_entry1);
-#endif /* QAK */
start_row2 = sect2->u.indirect.row;
-#ifdef QAK
-HDfprintf(stderr, "%s: sect2->u.indirect.dir_nrows = %u\n", FUNC, sect2->u.indirect.dir_nrows);
-HDfprintf(stderr, "%s: start_row2 = %u\n", FUNC, start_row2);
-HDfprintf(stderr, "%s: sect2->u.indirect.num_entries = %u\n", FUNC, sect2->u.indirect.num_entries);
-#endif /* QAK */
/* Check for direct sections in second section */
/* (second indirect section can be parent of indirect section for second
@@ -3853,9 +3581,6 @@ HDfprintf(stderr, "%s: sect2->u.indirect.num_entries = %u\n", FUNC, sect2->u.ind
if(row_sect1->u.row.under->u.indirect.u.iblock->block_off == row_sect2->u.row.under->u.indirect.u.iblock->block_off
&& end_row1 == start_row2) {
H5HF_free_section_t *last_row_sect1; /* Last row in first indirect section */
-#ifdef QAK
-HDfprintf(stderr, "%s: Sections share a row\n", FUNC);
-#endif /* QAK */
/* Locate the last row section in first indirect section, if we don't already have it */
if(row_sect1->u.row.row != end_row1)
@@ -3878,9 +3603,6 @@ HDfprintf(stderr, "%s: Sections share a row\n", FUNC);
merged_rows = TRUE;
} /* end if */
else {
-#ifdef QAK
-HDfprintf(stderr, "%s: Sections don't share a row\n", FUNC);
-#endif /* QAK */
/* Set up parameters for transfer of rows */
src_row2 = 0;
@@ -3890,11 +3612,6 @@ HDfprintf(stderr, "%s: Sections don't share a row\n", FUNC);
/* Indicate that the rows were _not_ merged */
merged_rows = FALSE;
} /* end else */
-#ifdef QAK
-HDfprintf(stderr, "%s: new_dir_nrows1 = %u\n", FUNC, new_dir_nrows1);
-HDfprintf(stderr, "%s: src_row2 = %u\n", FUNC, src_row2);
-HDfprintf(stderr, "%s: nrows_moved2 = %u\n", FUNC, nrows_moved2);
-#endif /* QAK */
/* Check if we need to move additional rows */
if(nrows_moved2 > 0) {
@@ -3980,9 +3697,6 @@ HDfprintf(stderr, "%s: nrows_moved2 = %u\n", FUNC, nrows_moved2);
/* Wrap up, freeing or re-inserting second row section */
/* (want this to be after the first indirection section is consistent again) */
if(merged_rows) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Finishing sections share a row\n", FUNC);
-#endif /* QAK */
/* Release second row section */
/* (indirectly releases second indirect section, since all of it's
* other dependents are gone)
@@ -3992,9 +3706,6 @@ HDfprintf(stderr, "%s: Finishing sections share a row\n", FUNC);
HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free row section")
} /* end if */
else {
-#ifdef QAK
-HDfprintf(stderr, "%s: Finishing sections don't share a row\n", FUNC);
-#endif /* QAK */
/* Decrement ref. count on second indirect section's parent */
HDassert(sect2->u.indirect.rc == 0);
if(sect2->u.indirect.parent)
@@ -4009,27 +3720,14 @@ HDfprintf(stderr, "%s: Finishing sections don't share a row\n", FUNC);
/* (it's already been added to first indirect section, but it's been removed
* from the free space manager and needs to be re-added)
*/
-#ifdef QAK
-HDfprintf(stderr, "%s: Re-inserting second row section\n", FUNC);
-#endif /* QAK */
row_sect2->sect_info.type = H5HF_FSPACE_SECT_NORMAL_ROW;
if(H5HF_space_add(hdr, dxpl_id, row_sect2, H5FS_ADD_SKIP_VALID) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't re-add second row section to free space")
-#ifdef QAK
-HDfprintf(stderr, "%s: Done re-inserting second row section\n", FUNC);
-#endif /* QAK */
} /* end else */
-#ifdef QAK
-HDfprintf(stderr, "%s: sect1->u.indirect.iblock_entries = %u\n", FUNC, sect1->u.indirect.iblock_entries);
-HDfprintf(stderr, "%s: sect1->u.indirect.num_entries = %u\n", FUNC, sect1->u.indirect.num_entries);
-#endif /* QAK */
/* Check if we can create parent indirect section for first section */
/* (i.e. merged indirect sections cover an entire indirect block) */
if(sect1->u.indirect.iblock_entries == sect1->u.indirect.num_entries) {
-#ifdef QAK
-HDfprintf(stderr, "%s: creating parent indirect section\n", FUNC);
-#endif /* QAK */
/* Build parent section for fully populated indirect section */
HDassert(sect1->u.indirect.parent == NULL);
if(H5HF_sect_indirect_build_parent(hdr, sect1) < 0)
@@ -4064,9 +3762,6 @@ H5HF_sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect)
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_build_parent)
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-#endif /* QAK */
/* Sanity check parameters */
HDassert(hdr);
@@ -4076,18 +3771,12 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_
HDassert(sect->u.indirect.iblock_entries == sect->u.indirect.num_entries);
HDassert(sect->u.indirect.u.iblock);
HDassert(sect->u.indirect.parent == NULL);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->u.indirect = {%p, %u, %u, %u}\n", FUNC, sect->u.indirect.u.iblock, sect->u.indirect.row, sect->u.indirect.col, sect->u.indirect.num_entries);
-#endif /* QAK */
/* Get information for creating parent indirect section */
par_entry = sect->u.indirect.u.iblock->par_entry;
par_row = par_entry / hdr->man_dtable.cparam.width;
par_col = par_entry % hdr->man_dtable.cparam.width;
HDassert(par_row >= hdr->man_dtable.max_direct_rows);
-#ifdef QAK
-HDfprintf(stderr, "%s: par_entry = %u, par_row = %u, par_col = %u\n", FUNC, par_entry, par_row, par_col);
-#endif /* QAK */
par_iblock = sect->u.indirect.u.iblock->parent;
HDassert(par_iblock);
@@ -4144,12 +3833,6 @@ H5HF_sect_indirect_shrink(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s
/* Sanity check some assumptions about the indirect section */
HDassert(sect->u.indirect.dir_nrows > 0 || sect->u.indirect.indir_nents > 0);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-HDfprintf(stderr, "%s: sect->u.indirect = {%p, %u, %u, %u}\n", FUNC, sect->u.indirect.u.iblock, sect->u.indirect.row, sect->u.indirect.col, sect->u.indirect.num_entries);
-HDfprintf(stderr, "%s: sect->u.indirect.span_size = %Hu\n", FUNC, sect->u.indirect.span_size);
-HDfprintf(stderr, "%s: sect->u.indirect.parent = %p\n", FUNC, sect->u.indirect.parent);
-#endif /* QAK */
/* Walk through direct rows, freeing them */
for(u = 0; u < sect->u.indirect.dir_nrows; u++) {
@@ -4205,9 +3888,6 @@ H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect,
HDassert(hdr);
HDassert(sect);
HDassert(buf);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-#endif /* QAK */
/* Check if this indirect section has a parent & forward if this section is first */
if(sect->u.indirect.parent) {
@@ -4220,35 +3900,18 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_
if(sect->sect_info.state == H5FS_SECT_LIVE) {
HDassert(sect->u.indirect.u.iblock);
UINT64ENCODE_VAR(buf, sect->u.indirect.u.iblock->block_off, hdr->heap_off_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->u.indirect.u.iblock->block_off = %Hu\n", FUNC, sect->u.indirect.u.iblock->block_off);
-#endif /* QAK */
} /* end if */
else
-{
UINT64ENCODE_VAR(buf, sect->u.indirect.u.iblock_off, hdr->heap_off_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->u.indirect.u.iblock_off = %Hu\n", FUNC, sect->u.indirect.u.iblock_off);
-#endif /* QAK */
-}
/* Indirect range's row */
UINT16ENCODE(buf, sect->u.indirect.row);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->u.indirect.row = %u\n", FUNC, sect->u.indirect.row);
-#endif /* QAK */
/* Indirect range's column */
UINT16ENCODE(buf, sect->u.indirect.col);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->u.indirect.col = %u\n", FUNC, sect->u.indirect.col);
-#endif /* QAK */
/* Indirect range's # of entries */
UINT16ENCODE(buf, sect->u.indirect.num_entries);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->u.indirect.num_entries = %u\n", FUNC, sect->u.indirect.num_entries);
-#endif /* QAK */
} /* end else */
done:
@@ -4293,33 +3956,18 @@ H5HF_sect_indirect_deserialize(H5HF_hdr_t *hdr, hid_t dxpl_id,
HDassert(buf);
HDassert(H5F_addr_defined(sect_addr));
HDassert(sect_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect_addr = %a, sect_size = %Hu\n", FUNC, sect_addr, sect_size);
-#endif /* QAK */
/* Indirect range's indirect block's block offset */
UINT64DECODE_VAR(buf, iblock_off, hdr->heap_off_size);
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock_off = %Hu\n", FUNC, iblock_off);
-#endif /* QAK */
/* Indirect section's row */
UINT16DECODE(buf, start_row);
-#ifdef QAK
-HDfprintf(stderr, "%s: start_row = %u\n", FUNC, start_row);
-#endif /* QAK */
/* Indirect section's column */
UINT16DECODE(buf, start_col);
-#ifdef QAK
-HDfprintf(stderr, "%s: start_col = %u\n", FUNC, start_col);
-#endif /* QAK */
/* Indirect section's # of entries */
UINT16DECODE(buf, nentries);
-#ifdef QAK
-HDfprintf(stderr, "%s: nentries = %u\n", FUNC, nentries);
-#endif /* QAK */
/* Create free space section node */
if(NULL == (new_sect = H5HF_sect_indirect_new(hdr, sect_addr, sect_size,
@@ -4426,15 +4074,6 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect)
HDassert(hdr);
HDassert(sect);
-#ifdef QAK
-HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_indirect_valid", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
-if(sect->sect_info.state == H5FS_SECT_LIVE)
- HDfprintf(stderr, "%s: sect->u.indirect = {%p, ", "H5HF_sect_indirect_valid", sect->u.indirect.u.iblock);
-else
- HDfprintf(stderr, "%s: sect->u.indirect = {%Hu, ", "H5HF_sect_indirect_valid", sect->u.indirect.u.iblock_off);
-HDfprintf(stderr, "%u, %u, %u}\n", sect->u.indirect.row, sect->u.indirect.col, sect->u.indirect.num_entries);
-#endif /* QAK */
-
/* Compute starting entry, column & row */
start_row = sect->u.indirect.row;
start_col = sect->u.indirect.col;
@@ -4443,10 +4082,6 @@ HDfprintf(stderr, "%u, %u, %u}\n", sect->u.indirect.row, sect->u.indirect.col, s
/* Compute ending entry, column & row */
end_entry = (start_entry + sect->u.indirect.num_entries) - 1;
end_row = end_entry / hdr->man_dtable.cparam.width;
-#ifdef QAK
-HDfprintf(stderr, "%s: start_row = %u, start_col = %u, start_entry = %u\n", "H5HF_sect_indirect_valid", start_row, start_col, start_entry);
-HDfprintf(stderr, "%s: end_row = %u, end_entry = %u\n", "H5HF_sect_indirect_valid", end_row, end_entry);
-#endif /* QAK */
/* Sanity check any direct rows */
if(sect->u.indirect.dir_nrows > 0) {
diff --git a/src/H5HG.c b/src/H5HG.c
index 520f2eb..0e3f0e9 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -99,6 +99,15 @@ static haddr_t H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size);
/* Package Variables */
/*********************/
+/* Declare a free list to manage the H5HG_t struct */
+H5FL_DEFINE(H5HG_heap_t);
+
+/* Declare a free list to manage sequences of H5HG_obj_t's */
+H5FL_SEQ_DEFINE(H5HG_obj_t);
+
+/* Declare a PQ free list to manage heap chunks */
+H5FL_BLK_DEFINE(gheap_chunk);
+
/*****************************/
/* Library Private Variables */
@@ -109,15 +118,6 @@ static haddr_t H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size);
/* Local Variables */
/*******************/
-/* Declare a free list to manage the H5HG_t struct */
-H5FL_DEFINE(H5HG_heap_t);
-
-/* Declare a free list to manage sequences of H5HG_obj_t's */
-H5FL_SEQ_DEFINE(H5HG_obj_t);
-
-/* Declare a PQ free list to manage heap chunks */
-H5FL_BLK_DEFINE(gheap_chunk);
-
/*-------------------------------------------------------------------------
@@ -137,52 +137,31 @@ H5FL_BLK_DEFINE(gheap_chunk);
* Programmer: Robb Matzke
* Friday, March 27, 1998
*
- * Modifications:
- *
- * John Mainzer 5/26/04
- * Modified function to return the disk address of the new
- * global heap collection, or HADDR_UNDEF on failure. This
- * is necessary, as in some cases (i.e. flexible parallel)
- * H5AC_set() will imediately flush and destroy the in memory
- * version of the new collection. For the same reason, I
- * moved the code which places the new collection on the cwfs
- * list to just before the call to H5AC_set().
- *
- * John Mainzer 6/8/05
- * Removed code setting the is_dirty field of the cache info.
- * This is no longer pemitted, as the cache code is now
- * manageing this field. Since this function uses a call to
- * H5AC_set() (which marks the entry dirty automaticly), no
- * other change is required.
- *
*-------------------------------------------------------------------------
*/
static haddr_t
-H5HG_create (H5F_t *f, hid_t dxpl_id, size_t size)
+H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size)
{
H5HG_heap_t *heap = NULL;
- haddr_t ret_value = HADDR_UNDEF;
uint8_t *p = NULL;
haddr_t addr;
size_t n;
+ haddr_t ret_value = HADDR_UNDEF; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HG_create)
/* Check args */
- assert (f);
- if (size<H5HG_MINSIZE)
+ HDassert(f);
+ if(size < H5HG_MINSIZE)
size = H5HG_MINSIZE;
size = H5HG_ALIGN(size);
/* Create it */
- H5_CHECK_OVERFLOW(size,size_t,hsize_t);
- if ( HADDR_UNDEF==
- (addr=H5MF_alloc(f, H5FD_MEM_GHEAP, dxpl_id, (hsize_t)size)))
- HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, \
- "unable to allocate file space for global heap");
- if (NULL==(heap = H5FL_MALLOC (H5HG_heap_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, \
- "memory allocation failed");
+ H5_CHECK_OVERFLOW(size, size_t, hsize_t);
+ if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_GHEAP, dxpl_id, (hsize_t)size)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap")
+ if(NULL == (heap = H5FL_MALLOC(H5HG_heap_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed")
heap->addr = addr;
heap->size = size;
@@ -203,14 +182,14 @@ HDmemset(heap->chunk, 0, size);
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/
- H5F_ENCODE_LENGTH (f, p, size);
+ H5F_ENCODE_LENGTH(f, p, size);
/*
* Padding so free space object is aligned. If malloc returned memory
* which was always at least H5HG_ALIGNMENT aligned then we could just
* align the pointer, but this might not be the case.
*/
- n = H5HG_ALIGN(p-heap->chunk) - (p-heap->chunk);
+ n = H5HG_ALIGN(p - heap->chunk) - (p - heap->chunk);
#ifdef OLD_WAY
/* Don't bother zeroing out the rest of the info in the heap -QAK */
HDmemset(p, 0, n);
@@ -225,7 +204,7 @@ HDmemset(heap->chunk, 0, size);
UINT16ENCODE(p, 0); /*object ID*/
UINT16ENCODE(p, 0); /*reference count*/
UINT32ENCODE(p, 0); /*reserved*/
- H5F_ENCODE_LENGTH (f, p, heap->obj[0].size);
+ H5F_ENCODE_LENGTH(f, p, heap->obj[0].size);
#ifdef OLD_WAY
/* Don't bother zeroing out the rest of the info in the heap -QAK */
HDmemset (p, 0, (size_t)((heap->chunk+heap->size) - p));
@@ -244,7 +223,7 @@ HDmemset(heap->chunk, 0, size);
MIN(f->shared->ncwfs, H5HG_NCWFS - 1) * sizeof(H5HG_heap_t *));
f->shared->cwfs[0] = heap;
f->shared->ncwfs = MIN(H5HG_NCWFS, f->shared->ncwfs+1);
- }
+ } /* end else */
/* Add the heap to the cache */
if(H5AC_set(f, dxpl_id, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0)
@@ -253,11 +232,20 @@ HDmemset(heap->chunk, 0, size);
ret_value = addr;
done:
- if ( ! ( H5F_addr_defined(addr) ) && heap) {
- if ( H5HG_dest(f,heap) < 0 )
- HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, \
- "unable to destroy global heap collection");
- }
+ /* Cleanup on error */
+ if(!H5F_addr_defined(ret_value)) {
+ if(H5F_addr_defined(addr)) {
+ /* Release the space on disk */
+ if(H5MF_xfree(f, H5FD_MEM_GHEAP, dxpl_id, addr, (hsize_t)size) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, HADDR_UNDEF, "unable to free global heap")
+
+ /* Check if the heap object was allocated */
+ if(heap)
+ /* Destroy the heap object */
+ if(H5HG_dest(f, heap) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy global heap collection")
+ } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value);
} /* H5HG_create() */
@@ -279,16 +267,6 @@ done:
* Programmer: Robb Matzke
* Friday, March 27, 1998
*
- * Modifications:
- *
- * John Mainzer, 6/8/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- * In this case, that required adding the new heap_dirtied_ptr
- * parameter to the function's argument list.
- *
*-------------------------------------------------------------------------
*/
static size_t
@@ -501,30 +479,6 @@ done:
* Programmer: Robb Matzke
* Friday, March 27, 1998
*
- * Modifications:
- *
- * John Mainzer -- 5/24/04
- * The function used to modify the heap without protecting
- * the relevant collection first. I did a half assed job
- * of fixing the problem, which should hold until we try to
- * support multi-threading. At that point it will have to
- * be done right.
- *
- * See in line comment of this date for more details.
- *
- * John Mainzer - 5/26/04
- * Modified H5HG_create() to return the disk address of the
- * new collection, instead of the address of its
- * representation in core. This was necessary as in FP
- * mode, the cache will immediately flush and destroy any
- * entry inserted in it via H5AC_set(). I then modified
- * this function to account for the change in H5HG_create().
- *
- * John Mainzer - 6/8/05
- * Modified function to use the dirtied parameter of
- * H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -635,7 +589,6 @@ H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*/
--cwfsno;
} /* end if */
} /* end else */
-
HDassert(H5F_addr_defined(addr));
if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap")
@@ -759,54 +712,47 @@ done:
* Programmer: Robb Matzke
* Monday, March 30, 1998
*
- * Modifications:
- *
- * John Mainzer - 6/8/05
- * Modified function to use the dirtied parameter of
- * H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
int
-H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust)
+H5HG_link(H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust)
{
H5HG_heap_t *heap = NULL;
unsigned heap_flags = H5AC__NO_FLAGS_SET;
int ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5HG_link, FAIL);
+ FUNC_ENTER_NOAPI(H5HG_link, FAIL)
/* Check args */
- assert (f);
- assert (hobj);
- if (0==(f->intent & H5F_ACC_RDWR))
+ HDassert(f);
+ HDassert(hobj);
+ if(0 == (f->intent & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
- if(adjust!=0) {
- /* Load the heap */
- if (NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap")
-
- assert (hobj->idx<heap->nused);
- assert (heap->obj[hobj->idx].begin);
- if (heap->obj[hobj->idx].nrefs+adjust<0)
- HGOTO_ERROR (H5E_HEAP, H5E_BADRANGE, FAIL, "new link count would be out of range")
- if (heap->obj[hobj->idx].nrefs+adjust>H5HG_MAXLINK)
- HGOTO_ERROR (H5E_HEAP, H5E_BADVALUE, FAIL, "new link count would be out of range")
+ /* Load the heap */
+ if(NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap")
+
+ if(adjust != 0) {
+ HDassert(hobj->idx < heap->nused);
+ HDassert(heap->obj[hobj->idx].begin);
+ if((heap->obj[hobj->idx].nrefs + adjust) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "new link count would be out of range")
+ if((heap->obj[hobj->idx].nrefs + adjust) > H5HG_MAXLINK)
+ HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "new link count would be out of range")
heap->obj[hobj->idx].nrefs += adjust;
heap_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
/* Set return value */
- ret_value=heap->obj[hobj->idx].nrefs;
+ ret_value = heap->obj[hobj->idx].nrefs;
done:
- if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, heap_flags)<0)
+ if(heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, heap_flags) < 0)
HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header")
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HG_link() */
/*-------------------------------------------------------------------------
@@ -884,7 +830,6 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj)
* The collection is empty. Remove it from the CWFS list and return it
* to the file free list.
*/
- H5_CHECK_OVERFLOW(heap->size, size_t, hsize_t);
flags |= H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; /* Indicate that the object was deleted, for the unprotect call */
} /* end if */
else {
diff --git a/src/H5HGcache.c b/src/H5HGcache.c
index ee318aa..b7a701a 100644
--- a/src/H5HGcache.c
+++ b/src/H5HGcache.c
@@ -75,16 +75,6 @@ static herr_t H5HG_size(const H5F_t *f, const H5HG_heap_t *heap, size_t *size_pt
/* Package Variables */
/*********************/
-
-/*****************************/
-/* Library Private Variables */
-/*****************************/
-
-
-/*******************/
-/* Local Variables */
-/*******************/
-
/* H5HG inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_GHEAP[1] = {{
H5AC_GHEAP_ID,
@@ -97,6 +87,16 @@ const H5AC_class_t H5AC_GHEAP[1] = {{
}};
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
/*-------------------------------------------------------------------------
* Function: H5HG_load
@@ -381,7 +381,7 @@ H5HG_dest(H5F_t *f, H5HG_heap_t *heap)
heap->chunk = H5FL_BLK_FREE(gheap_chunk, heap->chunk);
if(heap->obj)
heap->obj = H5FL_SEQ_FREE(H5HG_obj_t, heap->obj);
- (void)H5FL_FREE(H5HG_heap_t, heap);
+ heap = H5FL_FREE(H5HG_heap_t, heap);
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5HL.c b/src/H5HL.c
index a69eb16..f7c1f22 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -72,6 +72,12 @@ static herr_t H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap);
/* Package Variables */
/*********************/
+/* Declare a free list to manage the H5HL_free_t struct */
+H5FL_DEFINE(H5HL_free_t);
+
+/* Declare a PQ free list to manage the heap chunk information */
+H5FL_BLK_DEFINE(lheap_chunk);
+
/*****************************/
/* Library Private Variables */
@@ -82,15 +88,6 @@ static herr_t H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap);
/* Local Variables */
/*******************/
-/* Declare a free list to manage the H5HL_free_t struct */
-H5FL_DEFINE(H5HL_free_t);
-
-/* Declare a free list to manage the H5HL_t struct */
-H5FL_DEFINE(H5HL_t);
-
-/* Declare a PQ free list to manage the heap chunk information */
-H5FL_BLK_DEFINE(lheap_chunk);
-
/*-------------------------------------------------------------------------
@@ -117,10 +114,10 @@ H5FL_BLK_DEFINE(lheap_chunk);
herr_t
H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/)
{
- H5HL_t *heap = NULL;
- hsize_t total_size; /*total heap size on disk */
- size_t sizeof_hdr; /* Cache H5HL header size for file */
- herr_t ret_value = SUCCEED;
+ H5HL_t *heap = NULL; /* Heap created */
+ H5HL_prfx_t *prfx = NULL; /* Heap prefix */
+ hsize_t total_size; /* Total heap size on disk */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HL_create, FAIL)
@@ -128,30 +125,32 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/)
HDassert(f);
HDassert(addr_p);
+ /* Adjust size hint as necessary */
if(size_hint && size_hint < H5HL_SIZEOF_FREE(f))
size_hint = H5HL_SIZEOF_FREE(f);
size_hint = H5HL_ALIGN(size_hint);
- /* Cache this for later */
- sizeof_hdr = H5HL_SIZEOF_HDR(f);
+ /* Allocate memory structure */
+ if(NULL == (heap = H5HL_new(H5F_SIZEOF_SIZE(f), H5F_SIZEOF_ADDR(f), H5HL_SIZEOF_HDR(f))))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed")
- /* allocate file version */
- total_size = sizeof_hdr + size_hint;
- if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, total_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file memory")
+ /* Allocate file space */
+ total_size = heap->prfx_size + size_hint;
+ if(HADDR_UNDEF == (heap->prfx_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, total_size)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file memory")
- /* allocate memory version */
- if(NULL == (heap = H5FL_CALLOC(H5HL_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- heap->addr = *addr_p + (hsize_t)sizeof_hdr;
- heap->heap_alloc = size_hint;
- if(NULL == (heap->chunk = H5FL_BLK_CALLOC(lheap_chunk, (sizeof_hdr + size_hint))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ /* Initialize info */
+ heap->single_cache_obj = TRUE;
+ heap->dblk_addr = heap->prfx_addr + (hsize_t)heap->prfx_size;
+ heap->dblk_size = size_hint;
+ if(size_hint)
+ if(NULL == (heap->dblk_image = H5FL_BLK_CALLOC(lheap_chunk, size_hint)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed")
/* free list */
if(size_hint) {
if(NULL == (heap->freelist = H5FL_MALLOC(H5HL_free_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed")
heap->freelist->offset = 0;
heap->freelist->size = size_hint;
heap->freelist->prev = heap->freelist->next = NULL;
@@ -159,17 +158,32 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/)
else
heap->freelist = NULL;
- /* add to cache */
- if(H5AC_set(f, dxpl_id, H5AC_LHEAP, *addr_p, heap, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache heap")
+ /* Allocate the heap prefix */
+ if(NULL == (prfx = H5HL_prfx_new(heap)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed")
+
+ /* Add to cache */
+ if(H5AC_set(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap prefix")
+
+ /* Set address to return */
+ *addr_p = heap->prfx_addr;
done:
if(ret_value < 0) {
- if(H5F_addr_defined(*addr_p))
- H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, *addr_p, total_size);
- if(heap)
- if(H5HL_dest(f,heap) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap collection")
+ if(prfx) {
+ if(H5HL_prfx_dest(prfx) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap prefix")
+ } /* end if */
+ else {
+ if(heap) {
+ if(H5F_addr_defined(heap->prfx_addr))
+ if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, heap->prfx_addr, total_size) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't release heap data?")
+ if(H5HL_dest(heap) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap")
+ } /* end if */
+ } /* end else */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -177,6 +191,110 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HL_dblk_realloc
+ *
+ * Purpose: Reallocate data block for heap
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 12 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HL_dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size)
+{
+ H5HL_dblk_t *dblk; /* Local heap data block */
+ haddr_t old_addr; /* Old location of heap data block */
+ haddr_t new_addr; /* New location of heap data block */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5HL_dblk_realloc)
+
+ /* check arguments */
+ HDassert(heap);
+ HDassert(new_heap_size > 0);
+
+ /* Release old space on disk */
+ old_addr = heap->dblk_addr;
+ H5_CHECK_OVERFLOW(heap->dblk_size, size_t, hsize_t);
+ if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, old_addr, (hsize_t)heap->dblk_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't release old heap data?")
+
+ /* Allocate new space on disk */
+ H5_CHECK_OVERFLOW(new_heap_size, size_t, hsize_t);
+ if(HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, (hsize_t)new_heap_size)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file space for heap")
+
+ /* Check if heap data block actually moved in the file */
+ if(H5F_addr_eq(old_addr, new_addr)) {
+ /* Check if heap data block is contiguous w/prefix */
+ if(heap->single_cache_obj) {
+ /* Sanity check */
+ HDassert(H5F_addr_eq(heap->prfx_addr + heap->prfx_size, heap->dblk_addr));
+ HDassert(heap->prfx);
+
+ /* Resize the heap prefix in the cache */
+ if(H5AC_resize_pinned_entry(heap->prfx, (size_t)(heap->prfx_size + new_heap_size)) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap in cache")
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(H5F_addr_ne(heap->prfx_addr + heap->prfx_size, heap->dblk_addr));
+ HDassert(heap->dblk);
+
+ /* Resize the heap data block in the cache */
+ if(H5AC_resize_pinned_entry(heap->dblk, (size_t)new_heap_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap in cache")
+ } /* end else */
+ } /* end if */
+ else {
+ /* Check if heap data block was contiguous w/prefix previously */
+ if(heap->single_cache_obj) {
+ /* Create new heap data block */
+ if(NULL == (dblk = H5HL_dblk_new(heap)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate local heap data block")
+
+ /* Resize current heap prefix */
+ heap->prfx_size = H5HL_SIZEOF_HDR(f);
+ if(H5AC_resize_pinned_entry(heap->prfx, (size_t)heap->prfx_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap prefix in cache")
+
+ /* Insert data block into cache (pinned) */
+ if(H5AC_set(f, dxpl_id, H5AC_LHEAP_DBLK, new_addr, dblk, H5AC__PIN_ENTRY_FLAG) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache local heap data block")
+ dblk = NULL;
+
+ /* Reset 'single cache object' flag */
+ heap->single_cache_obj = FALSE;
+ } /* end if */
+ else {
+ /* Resize the heap data block in the cache */
+ /* (ignore [unlikely] case where heap data block ends up
+ * contiguous w/heap prefix again.
+ */
+ if(H5AC_resize_pinned_entry(heap->dblk, (size_t)new_heap_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize heap data block in cache")
+
+ /* Relocate the heap data block in the cache */
+ if(H5AC_rename(f, H5AC_LHEAP_DBLK, old_addr, new_addr) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRENAME, FAIL, "unable to move heap data block in cache")
+ } /* end else */
+ } /* end else */
+
+ /* Update heap info*/
+ heap->dblk_addr = new_addr;
+ heap->dblk_size = new_heap_size;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_dblk_realloc() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HL_minimize_heap_space
*
* Purpose: Go through the heap's freelist and determine if we can
@@ -194,9 +312,8 @@ done:
static herr_t
H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)
{
- size_t new_heap_size = heap->heap_alloc; /* New size of heap */
- size_t sizeof_hdr;
- herr_t ret_value = SUCCEED;
+ size_t new_heap_size = heap->dblk_size; /* New size of heap */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HL_minimize_heap_space, FAIL)
@@ -204,8 +321,6 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)
HDassert(f);
HDassert(heap);
- sizeof_hdr = H5HL_SIZEOF_HDR(f); /* cache H5HL header size for file */
-
/*
* Check to see if we can reduce the size of the heap in memory by
* eliminating free blocks at the tail of the buffer before flushing the
@@ -218,7 +333,7 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)
/* Search for a free block at the end of the buffer */
for(tmp_fl = heap->freelist; tmp_fl; tmp_fl = tmp_fl->next)
/* Check if the end of this free block is at the end of the buffer */
- if(tmp_fl->offset + tmp_fl->size == heap->heap_alloc) {
+ if(tmp_fl->offset + tmp_fl->size == heap->dblk_size) {
last_fl = tmp_fl;
break;
} /* end if */
@@ -233,7 +348,7 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)
* buffer size (and the memory buffer is larger than the
* minimum size), reduce or eliminate it.
*/
- if(last_fl->size >= (heap->heap_alloc / 2) && heap->heap_alloc > H5HL_MIN_HEAP) {
+ if(last_fl->size >= (heap->dblk_size / 2) && heap->dblk_size > H5HL_MIN_HEAP) {
/*
* Reduce size of buffer until it's too small or would
* eliminate the free block
@@ -255,8 +370,9 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)
/* Truncate the free block */
last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset);
new_heap_size = last_fl->offset + last_fl->size;
- assert(last_fl->size >= H5HL_SIZEOF_FREE(f));
- } else {
+ HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f));
+ } /* end if */
+ else {
/*
* Set the size of the memory buffer to the start
* of the free list
@@ -266,12 +382,13 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)
/* Eliminate the free block from the list */
last_fl = H5HL_remove_free(heap, last_fl);
} /* end else */
- } else {
+ } /* end if */
+ else {
/* Truncate the free block */
last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset);
new_heap_size = last_fl->offset + last_fl->size;
- assert(last_fl->size >= H5HL_SIZEOF_FREE(f));
- assert(last_fl->size == H5HL_ALIGN(last_fl->size));
+ HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f));
+ HDassert(last_fl->size == H5HL_ALIGN(last_fl->size));
} /* end else */
} /* end if */
} /* end if */
@@ -282,31 +399,16 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap)
* data segment of the heap to another contiguous block of disk
* storage.
*/
- if(new_heap_size != heap->heap_alloc) {
- haddr_t old_addr = heap->addr,
- new_addr;
-
- HDassert(new_heap_size < heap->heap_alloc);
+ if(new_heap_size != heap->dblk_size) {
+ HDassert(new_heap_size < heap->dblk_size);
/* Resize the memory buffer */
- heap->chunk = H5FL_BLK_REALLOC(lheap_chunk, heap->chunk, (sizeof_hdr + new_heap_size));
- if(!heap->chunk)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- /* Release old space on disk */
- /* (Should be safe to free old heap space first, since it's shrinking -QAK) */
- H5_CHECK_OVERFLOW(heap->heap_alloc, size_t, hsize_t);
- if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, old_addr, (hsize_t)heap->heap_alloc) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap")
-
- /* Allocate new space on disk */
- H5_CHECK_OVERFLOW(new_heap_size, size_t, hsize_t);
- if(HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, (hsize_t)new_heap_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file space for heap")
-
- /* Update heap info*/
- heap->addr = new_addr;
- heap->heap_alloc = new_heap_size;
+ if(NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, new_heap_size)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed")
+
+ /* Reallocate data block in file */
+ if(H5HL_dblk_realloc(f, dxpl_id, heap, new_heap_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "reallocating data block failed")
} /* end if */
done:
@@ -317,26 +419,9 @@ done:
/*-------------------------------------------------------------------------
* Function: H5HL_protect
*
- * Purpose: This function is a wrapper for the H5AC_protect call. The
- * old H5HL_peek call (which this once was) wasn't "safe"
- * for FPHDF5. (It'd get a read lock on an object but once
- * it got that object, it'd release it keeping the old
- * pointer value, which is no longer valid. This won't work
- * since the pointer into some metdata block can become
- * invalid.)
- *
- * N.B.: This function is always called in conjunction with
- * the H5HL_offset_into function. The return from that
- * function is the proper pointer to the heap's object. This
- * is done so that the return from this function can be sent
- * to H5HL_unprotect.
- *
- * Return: Success: Ptr to the object. The pointer points to a
- * chunk of memory large enough to hold the
- * object from the specified offset (usually the
- * beginning of the object) to the end of the
- * object. Do not attempt to read past the end
- * of the object.
+ * Purpose: This function is a wrapper for the H5AC_protect call.
+ *
+ * Return: Success: Non-NULL pointer to the local heap prefix.
* Failure: NULL
*
* Programmer: Bill Wendling
@@ -348,7 +433,13 @@ done:
H5HL_t *
H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw)
{
- H5HL_t *ret_value;
+ H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
+ H5HL_prfx_t *prfx = NULL; /* Local heap prefix */
+ H5HL_dblk_t *dblk = NULL; /* Local heap data block */
+ H5HL_t *heap; /* Heap data structure */
+ unsigned prfx_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting prefix entry */
+ unsigned dblk_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting data block entry */
+ H5HL_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5HL_protect, NULL)
@@ -356,10 +447,65 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw)
HDassert(f);
HDassert(H5F_addr_defined(addr));
- if(NULL == (ret_value = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, rw)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap")
+ /* Construct the user data for protect callback */
+ prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f);
+ prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f);
+ prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f);
+ prfx_udata.loaded = FALSE;
+ prfx_udata.free_block = H5HL_FREE_NULL;
+
+ /* Protect the local heap prefix */
+ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, NULL, &prfx_udata, rw)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap prefix")
+
+ /* Get the pointer to the heap */
+ heap = prfx->heap;
+
+ /* Check if the heap is already pinned in memory */
+ /* (for re-entrant situation) */
+ if(heap->prots == 0) {
+ /* Check if heap has separate data block */
+ if(heap->single_cache_obj) {
+ /* Set the flag for pinning the prefix when unprotecting it */
+ prfx_cache_flags |= H5AC__PIN_ENTRY_FLAG;
+ } /* end if */
+ else {
+ H5HL_cache_dblk_ud_t dblk_udata; /* User data for protecting local heap data block */
+
+ /* Construct the user data for protect callback */
+ dblk_udata.heap = heap;
+ dblk_udata.free_block = prfx_udata.loaded ? prfx_udata.free_block :
+ (heap->freelist ? heap->freelist->offset : H5HL_FREE_NULL);
+ dblk_udata.loaded = FALSE;
+
+ /* Protect the local heap data block */
+ if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, NULL, &dblk_udata, rw)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to load heap data block")
+
+ /* Pin the prefix, if the data block was loaded from file */
+ if(dblk_udata.loaded)
+ prfx_cache_flags |= H5AC__PIN_ENTRY_FLAG;
+
+ /* Set the flag for pinning the data block when unprotecting it */
+ dblk_cache_flags |= H5AC__PIN_ENTRY_FLAG;
+ } /* end if */
+ } /* end if */
+
+ /* Increment # of times heap is protected */
+ heap->prots++;
+
+ /* Set return value */
+ ret_value = heap;
done:
+ /* Release the prefix from the cache, now pinned */
+ if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, prfx_cache_flags) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap prefix")
+
+ /* Release the data block from the cache, now pinned */
+ if(dblk && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, dblk_cache_flags) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap data block")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_protect() */
@@ -380,7 +526,7 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5HL_offset_into(H5F_t *f, const H5HL_t *heap, size_t offset)
+H5HL_offset_into(const H5HL_t *heap, size_t offset)
{
/*
* We need to have called some other function before this to get a
@@ -388,11 +534,11 @@ H5HL_offset_into(H5F_t *f, const H5HL_t *heap, size_t offset)
*/
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_offset_into)
- HDassert(f);
+ /* Sanity check */
HDassert(heap);
- HDassert(offset < heap->heap_alloc);
+ HDassert(offset < heap->dblk_size);
- FUNC_LEAVE_NOAPI(heap->chunk + H5HL_SIZEOF_HDR(f) + offset)
+ FUNC_LEAVE_NOAPI(heap->dblk_image + offset)
} /* end H5HL_offset_into() */
@@ -411,19 +557,36 @@ H5HL_offset_into(H5F_t *f, const H5HL_t *heap, size_t offset)
*-------------------------------------------------------------------------
*/
herr_t
-H5HL_unprotect(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, haddr_t addr)
+H5HL_unprotect(H5HL_t *heap)
{
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5HL_unprotect, FAIL)
/* check arguments */
- HDassert(f);
HDassert(heap);
- HDassert(H5F_addr_defined(addr));
- if(H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, (void *)heap, H5AC__NO_FLAGS_SET) != SUCCEED)
- HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header")
+ /* Decrement # of times heap is protected */
+ heap->prots--;
+
+ /* Check for last unprotection of heap */
+ if(heap->prots == 0) {
+ /* Check for separate heap data block */
+ if(heap->single_cache_obj) {
+ /* Mark local heap prefix as evictable again */
+ if(H5AC_unpin_entry(heap->prfx) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block")
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(heap->dblk);
+
+ /* Mark local heap data block as evictable again */
+ /* (data block still pins prefix) */
+ if(H5AC_unpin_entry(heap->dblk) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap data block")
+ } /* end else */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -462,13 +625,55 @@ H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl)
/*-------------------------------------------------------------------------
+ * Function: H5HL_dirty
+ *
+ * Purpose: Mark heap as dirty
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 12 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HL_dirty(H5HL_t *heap)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5HL_dirty)
+
+ /* check arguments */
+ HDassert(heap);
+ HDassert(heap->prfx);
+
+ /* Mark heap data block as dirty, if there is one */
+ if(!heap->single_cache_obj) {
+ /* Sanity check */
+ HDassert(heap->dblk);
+
+ if(H5AC_mark_pinned_or_protected_entry_dirty(heap->dblk) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap data block as dirty")
+ } /* end if */
+
+ /* Mark heap prefix as dirty */
+ if(H5AC_mark_pinned_or_protected_entry_dirty(heap->prfx) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap prefix as dirty")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_dirty() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HL_insert
*
* Purpose: Inserts a new item into the heap.
*
* Return: Success: Offset of new item within heap.
- *
- * Failure: (size_t)(-1)
+ * Failure: UFAIL
*
* Programmer: Robb Matzke
* matzke@llnl.gov
@@ -483,10 +688,9 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void *
size_t offset = 0;
size_t need_size;
hbool_t found;
- size_t sizeof_hdr; /* Cache H5HL header size for file */
size_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5HL_insert, (size_t)(-1))
+ FUNC_ENTER_NOAPI(H5HL_insert, UFAIL)
/* check arguments */
HDassert(f);
@@ -500,11 +704,8 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void *
* so we just accept that an extra flush of the heap info could occur
* if an error occurs -QAK)
*/
- if(H5AC_mark_pinned_or_protected_entry_dirty(f, heap) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, (size_t)(-1), "unable to mark heap as dirty")
-
- /* Cache this for later */
- sizeof_hdr = H5HL_SIZEOF_HDR(f);
+ if(H5HL_dirty(heap) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, UFAIL, "unable to mark heap as dirty")
/*
* In order to keep the free list descriptors aligned on word boundaries,
@@ -548,12 +749,13 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void *
*/
if(found == FALSE) {
size_t need_more; /* How much more space we need */
- size_t new_heap_alloc; /* Final size of space allocated for heap */
+ size_t new_dblk_size; /* Final size of space allocated for heap data block */
+ size_t old_dblk_size; /* Previous size of space allocated for heap data block */
htri_t extended; /* Whether the local heap's data segment on disk was extended */
/* At least double the heap's size, making certain there's enough room
* for the new object */
- need_more = MAX(need_size, heap->heap_alloc);
+ need_more = MAX(need_size, heap->dblk_size);
/* If there is no last free block or it's not at the end of the heap,
* and the amount of space to allocate is not big enough to include at
@@ -561,72 +763,46 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void *
* space requested to just the amount of space needed. (Generally
* speaking, this only occurs when the heap is small -QAK)
*/
- if(!(last_fl && last_fl->offset + last_fl->size == heap->heap_alloc)
+ if(!(last_fl && last_fl->offset + last_fl->size == heap->dblk_size)
&& (need_more < (need_size + H5HL_SIZEOF_FREE(f))))
need_more = need_size;
- new_heap_alloc = heap->heap_alloc + need_more;
-#if 0 /* JRM */ /* delete this once we are convinced that the general
- * fix will do the job.
- */
-/*
- * XXX: This is a _total_ hack, a real kludge. :-/ The metadata cache currently
- * responds very poorly when an object is inserted into the cache (or
- * resized) that is larger than the current cache size. It waits through
- * an entire 'epoch' of cache operations to resize the cache larger (getting
- * _very_ poor performance), instead of immediately accommodating the large
- * object by increasing the cache size.
- *
- * So, what we are doing here is to look at the current cache size, check
- * if the new local heap will overwhelm the cache and, if so, resize the
- * cache to be large enough to hold the new local heap block along with
- * leaving room for other objects in the cache.
- *
- * John will be working on a fix inside the cache itself, so this special
- * case code here can be removed when he's finished. - QAK, 2007/12/21
- */
-{
- H5AC_cache_config_t mdc_config;
-
- /* Retrieve the current cache information */
- mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- if(H5AC_get_cache_auto_resize_config(f->shared->cache, &mdc_config) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (size_t)-1, "H5AC_get_cache_auto_resize_config() failed.")
-
- /* Check if the current cache will get blown out by adding this heap
- * block and resize it if so.
- */
- if((2 * new_heap_alloc) >= mdc_config.initial_size) {
- mdc_config.set_initial_size = TRUE;
- mdc_config.initial_size = 2 * new_heap_alloc;
-
- if(H5AC_set_cache_auto_resize_config(f->shared->cache, &mdc_config) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (size_t)-1, "H5AC_set_cache_auto_resize_config() failed.")
- } /* end if */
-}
-#endif /* JRM */
- HDassert(heap->heap_alloc < new_heap_alloc);
- H5_CHECK_OVERFLOW(heap->heap_alloc, size_t, hsize_t);
- H5_CHECK_OVERFLOW(new_heap_alloc, size_t, hsize_t);
+ new_dblk_size = heap->dblk_size + need_more;
+ HDassert(heap->dblk_size < new_dblk_size);
+ old_dblk_size = heap->dblk_size;
+ H5_CHECK_OVERFLOW(heap->dblk_size, size_t, hsize_t);
+ H5_CHECK_OVERFLOW(new_dblk_size, size_t, hsize_t);
/* Extend current heap if possible */
- extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_LHEAP, heap->addr, (hsize_t)(heap->heap_alloc), (hsize_t)need_more);
+ extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_LHEAP, heap->dblk_addr, (hsize_t)(heap->dblk_size), (hsize_t)need_more);
if(extended < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, (size_t)(-1), "error trying to extend heap")
-
- /* If we couldn't extend the heap, release old chunk and allocate a new one */
- if(extended == FALSE) {
- /* Release old space on disk */
- if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, heap->addr, (hsize_t)heap->heap_alloc) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, (size_t)(-1), "unable to free local heap")
-
- /* allocate new disk space for the heap */
- if((heap->addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, (hsize_t)new_heap_alloc)) == HADDR_UNDEF)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, (size_t)(-1), "unable to allocate file space for heap")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, UFAIL, "error trying to extend heap")
+
+ /* Check if we extended the heap data block in file */
+ if(extended == TRUE) {
+ /* Check for prefix & data block contiguous */
+ if(heap->single_cache_obj) {
+ /* Resize prefix+data block */
+ if(H5AC_resize_pinned_entry(heap->prfx, (size_t)(heap->prfx_size + new_dblk_size)) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, UFAIL, "unable to resize heap prefix in cache")
+ } /* end if */
+ else {
+ /* Resize 'standalone' data block */
+ if(H5AC_resize_pinned_entry(heap->dblk, (size_t)new_dblk_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, UFAIL, "unable to resize heap data block in cache")
+ } /* end else */
+
+ /* Note new size */
+ heap->dblk_size = new_dblk_size;
+ } /* end if */
+ else { /* ...if we can't, allocate a new chunk & release the old */
+ /* Reallocate data block in file */
+ if(H5HL_dblk_realloc(f, dxpl_id, heap, new_dblk_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, UFAIL, "reallocating data block failed")
} /* end if */
/* If the last free list in the heap is at the end of the heap, extend it */
- if(last_fl && last_fl->offset + last_fl->size == heap->heap_alloc) {
+ if(last_fl && last_fl->offset + last_fl->size == old_dblk_size) {
/*
* Increase the size of the last free block.
*/
@@ -651,17 +827,18 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void *
* Create a new free list element large enough that we can
* take some space out of it right away.
*/
- offset = heap->heap_alloc;
+ offset = old_dblk_size;
if(need_more - need_size >= H5HL_SIZEOF_FREE(f)) {
if(NULL == (fl = H5FL_MALLOC(H5HL_free_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, (size_t)(-1), "memory allocation failed")
- fl->offset = heap->heap_alloc + need_size;
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, UFAIL, "memory allocation failed")
+ fl->offset = old_dblk_size + need_size;
fl->size = need_more - need_size;
HDassert(fl->offset == H5HL_ALIGN(fl->offset));
HDassert(fl->size == H5HL_ALIGN(fl->size));
fl->prev = NULL;
fl->next = heap->freelist;
- if (heap->freelist) heap->freelist->prev = fl;
+ if(heap->freelist)
+ heap->freelist->prev = fl;
heap->freelist = fl;
#ifdef H5HL_DEBUG
} else if (H5DEBUG(HL) && need_more > need_size) {
@@ -676,24 +853,20 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void *
if (H5DEBUG(HL)) {
fprintf(H5DEBUG(HL),
"H5HL: resize mem buf from %lu to %lu bytes\n",
- (unsigned long)(heap->heap_alloc),
- (unsigned long)(heap->heap_alloc + need_more));
+ (unsigned long)(old_dblk_size),
+ (unsigned long)(old_dblk_size + need_more));
}
#endif
- heap->heap_alloc = new_heap_alloc;
- heap->chunk = H5FL_BLK_REALLOC(lheap_chunk, heap->chunk, (sizeof_hdr + heap->heap_alloc));
- if(NULL == heap->chunk)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, (size_t)(-1), "memory allocation failed")
+ if(NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, heap->dblk_size)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, UFAIL, "memory allocation failed")
/* Clear new section so junk doesn't appear in the file */
/* (Avoid clearing section which will be overwritten with newly inserted data) */
- HDmemset(heap->chunk + sizeof_hdr + offset + buf_size, 0, (new_heap_alloc - (offset + buf_size)));
+ HDmemset(heap->dblk_image + offset + buf_size, 0, (new_dblk_size - (offset + buf_size)));
} /* end if */
- /*
- * Copy the data into the heap
- */
- HDmemcpy(heap->chunk + sizeof_hdr + offset, buf, buf_size);
+ /* Copy the data into the heap */
+ HDmemcpy(heap->dblk_image + offset, buf, buf_size);
/* Set return value */
ret_value = offset;
@@ -743,8 +916,8 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size)
size = H5HL_ALIGN(size);
- HDassert(offset < heap->heap_alloc);
- HDassert(offset + size <= heap->heap_alloc);
+ HDassert(offset < heap->dblk_size);
+ HDassert(offset + size <= heap->dblk_size);
/* Mark heap as dirty in cache */
/* (A bit early in the process, but it's difficult to determine in the
@@ -752,7 +925,7 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size)
* so we just accept that an extra flush of the heap info could occur
* if an error occurs -QAK)
*/
- if(H5AC_mark_pinned_or_protected_entry_dirty(f, heap) < 0)
+ if(H5HL_dirty(heap) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap as dirty")
/*
@@ -767,56 +940,56 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size)
if((offset + size) == fl->offset) {
fl->offset = offset;
fl->size += size;
- HDassert(fl->offset==H5HL_ALIGN (fl->offset));
- HDassert(fl->size==H5HL_ALIGN (fl->size));
+ HDassert(fl->offset == H5HL_ALIGN(fl->offset));
+ HDassert(fl->size == H5HL_ALIGN(fl->size));
fl2 = fl->next;
while(fl2) {
if((fl2->offset + fl2->size) == fl->offset) {
fl->offset = fl2->offset;
fl->size += fl2->size;
- HDassert(fl->offset == H5HL_ALIGN (fl->offset));
- HDassert(fl->size == H5HL_ALIGN (fl->size));
+ HDassert(fl->offset == H5HL_ALIGN(fl->offset));
+ HDassert(fl->size == H5HL_ALIGN(fl->size));
fl2 = H5HL_remove_free(heap, fl2);
- if(((fl->offset + fl->size) == heap->heap_alloc ) &&
- ((2 * fl->size) > heap->heap_alloc )) {
+ if(((fl->offset + fl->size) == heap->dblk_size) &&
+ ((2 * fl->size) > heap->dblk_size)) {
if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
}
fl2 = fl2->next;
}
- if(((fl->offset + fl->size) == heap->heap_alloc) &&
- ((2 * fl->size) > heap->heap_alloc)) {
+ if(((fl->offset + fl->size) == heap->dblk_size) &&
+ ((2 * fl->size) > heap->dblk_size)) {
if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed")
}
HGOTO_DONE(SUCCEED);
} else if(fl->offset + fl->size == offset) {
fl->size += size;
fl2 = fl->next;
- HDassert(fl->size==H5HL_ALIGN (fl->size));
+ HDassert(fl->size == H5HL_ALIGN(fl->size));
while(fl2) {
if(fl->offset + fl->size == fl2->offset) {
fl->size += fl2->size;
- HDassert(fl->size==H5HL_ALIGN (fl->size));
+ HDassert(fl->size == H5HL_ALIGN(fl->size));
fl2 = H5HL_remove_free(heap, fl2);
- if(((fl->offset + fl->size) == heap->heap_alloc) &&
- ((2 * fl->size) > heap->heap_alloc)) {
+ if(((fl->offset + fl->size) == heap->dblk_size) &&
+ ((2 * fl->size) > heap->dblk_size)) {
if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
- }
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed")
+ } /* end if */
HGOTO_DONE(SUCCEED);
- }
+ } /* end if */
fl2 = fl2->next;
- }
- if(((fl->offset + fl->size) == heap->heap_alloc) &&
- ((2 * fl->size) > heap->heap_alloc)) {
+ } /* end while */
+ if(((fl->offset + fl->size) == heap->dblk_size) &&
+ ((2 * fl->size) > heap->dblk_size)) {
if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
- }
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed")
+ } /* end if */
HGOTO_DONE(SUCCEED);
- }
+ } /* end if */
fl = fl->next;
} /* end while */
@@ -839,7 +1012,7 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size)
* Add an entry to the free list.
*/
if(NULL == (fl = H5FL_MALLOC(H5HL_free_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed")
fl->offset = offset;
fl->size = size;
HDassert(fl->offset == H5HL_ALIGN(fl->offset));
@@ -850,10 +1023,10 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size)
heap->freelist->prev = fl;
heap->freelist = fl;
- if(((fl->offset + fl->size) == heap->heap_alloc) &&
- ((2 * fl->size) > heap->heap_alloc)) {
+ if(((fl->offset + fl->size) == heap->dblk_size) &&
+ ((2 * fl->size) > heap->dblk_size)) {
if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed")
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed")
} /* end if */
done:
@@ -877,9 +1050,12 @@ done:
herr_t
H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
{
- H5HL_t *heap = NULL; /* Local heap to delete */
+ H5HL_t *heap; /* Local heap to delete */
+ H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
+ H5HL_prfx_t *prfx = NULL; /* Local heap prefix */
+ H5HL_dblk_t *dblk = NULL; /* Local heap data block */
unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting heap */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HL_delete, FAIL)
@@ -887,16 +1063,71 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
HDassert(f);
HDassert(H5F_addr_defined(addr));
- /* Get heap pointer */
- if(NULL == (heap = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap")
+ /* Construct the user data for protect callback */
+ prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f);
+ prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f);
+ prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f);
+ prfx_udata.loaded = FALSE;
+ prfx_udata.free_block = H5HL_FREE_NULL;
+
+ /* Protect the local heap prefix */
+ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, NULL, &prfx_udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix")
+
+ /* Get the pointer to the heap */
+ heap = prfx->heap;
+
+ /* Check if heap has separate data block */
+ if(!heap->single_cache_obj) {
+ H5HL_cache_dblk_ud_t dblk_udata; /* User data for protecting local heap data block */
+
+ /* Construct the user data for protect callback */
+ dblk_udata.heap = heap;
+ dblk_udata.free_block = prfx_udata.loaded ? prfx_udata.free_block :
+ (heap->freelist ? heap->freelist->offset : H5HL_FREE_NULL);
+ dblk_udata.loaded = FALSE;
+
+ /* Protect the local heap data block */
+ if(NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, NULL, &dblk_udata, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap data block")
+
+ /* Pin the prefix, if the data block was loaded from file */
+ if(dblk_udata.loaded) {
+ if(H5AC_pin_protected_entry(prfx) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin local heap prefix")
+ } /* end if */
+ } /* end if */
- /* Set the cache flags to delete the heap & free its file space */
+ /* Check if the heap is contiguous on disk */
+ if(heap->single_cache_obj) {
+ /* Free the contiguous local heap in one call */
+ H5_CHECK_OVERFLOW(heap->prfx_size + heap->dblk_size, size_t, hsize_t);
+ if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, addr, (hsize_t)(heap->prfx_size + heap->dblk_size)) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free contiguous local heap")
+ } /* end if */
+ else {
+ /* Free the local heap's prefix */
+ H5_CHECK_OVERFLOW(heap->prfx_size, size_t, hsize_t);
+ if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, heap->prfx_addr, (hsize_t)heap->prfx_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap header")
+
+ /* Free the local heap's data block */
+ H5_CHECK_OVERFLOW(heap->dblk_size, size_t, hsize_t);
+ if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, heap->dblk_addr, (hsize_t)heap->dblk_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap data")
+ } /* end else */
+
+ /* Set the flags for releasing the prefix and data block */
cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
done:
- if(heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, cache_flags) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap")
+ /* Release the data block from the cache, now deleted */
+ if(dblk && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, cache_flags) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap data block")
+
+ /* Release the prefix from the cache, now deleted */
+ if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, cache_flags) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_delete() */
@@ -918,8 +1149,10 @@ done:
herr_t
H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size)
{
- H5HL_t *heap = NULL; /* Heap to query */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
+ H5HL_prfx_t *prfx = NULL; /* Local heap prefix */
+ H5HL_t *heap; /* Heap data structure */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HL_get_size, FAIL)
@@ -928,16 +1161,26 @@ H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size)
HDassert(H5F_addr_defined(addr));
HDassert(size);
- /* Get heap pointer */
- if(NULL == (heap = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap")
+ /* Construct the user data for protect callback */
+ prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f);
+ prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f);
+ prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f);
+ prfx_udata.loaded = FALSE;
+ prfx_udata.free_block = H5HL_FREE_NULL;
+
+ /* Protect the local heap prefix */
+ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, NULL, &prfx_udata, H5AC_READ)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix")
+
+ /* Get the pointer to the heap */
+ heap = prfx->heap;
/* Set the size to return */
- *size = heap->heap_alloc;
+ *size = heap->dblk_size;
done:
- if(heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap")
+ if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_get_size() */
@@ -959,9 +1202,10 @@ done:
herr_t
H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size)
{
- H5HL_t *heap = NULL; /* Heap to query */
- size_t local_heap_size = 0;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
+ H5HL_prfx_t *prfx = NULL; /* Local heap prefix */
+ H5HL_t *heap; /* Heap data structure */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5HL_heapsize, FAIL)
@@ -970,20 +1214,26 @@ H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size)
HDassert(H5F_addr_defined(addr));
HDassert(heap_size);
- /* Get heap pointer */
- if(NULL == (heap = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap")
+ /* Construct the user data for protect callback */
+ prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f);
+ prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f);
+ prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f);
+ prfx_udata.loaded = FALSE;
+ prfx_udata.free_block = H5HL_FREE_NULL;
+
+ /* Protect the local heap prefix */
+ if(NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP_PRFX, addr, NULL, &prfx_udata, H5AC_READ)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap prefix")
- /* Get the total size of the local heap */
- if(H5HL_size(f, heap, &local_heap_size) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to compute size of local heap")
+ /* Get the pointer to the heap */
+ heap = prfx->heap;
/* Accumulate the size of the local heap */
- *heap_size += (hsize_t)local_heap_size;
+ *heap_size += (hsize_t)(heap->prfx_size + heap->dblk_size);
done:
- if(heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap")
+ if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_heapsize() */
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index fa458ca..6e725ac 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -38,6 +38,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5HLpkg.h" /* Local Heaps */
#include "H5MFprivate.h" /* File memory management */
+#include "H5WBprivate.h" /* Wrapped Buffers */
/****************/
@@ -45,7 +46,12 @@
/****************/
#define H5HL_VERSION 0 /* Local heap collection version */
-#define H5HL_FREE_NULL 1 /* End of free list on disk */
+
+/* Set the local heap size to speculatively read in */
+/* (needs to be more than the local heap prefix size to work at all and
+ * should be larger than the default local heap size to save the
+ * extra I/O operations) */
+#define H5HL_SPEC_READ_SIZE 512
/******************/
@@ -62,20 +68,48 @@
/* Local Prototypes */
/********************/
-/* Local encode/decode routines */
-static herr_t H5HL_serialize(H5F_t *f, H5HL_t *heap, uint8_t *buf);
-
/* Metadata cache callbacks */
-static H5HL_t *H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1,
- void *udata2);
-static herr_t H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, H5HL_t *heap, unsigned UNUSED * flags_ptr);
-static herr_t H5HL_clear(H5F_t *f, H5HL_t *heap, hbool_t destroy);
+static void *H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ const void *udata1, void *udata2);
+static herr_t H5HL_prefix_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
+ void *thing, unsigned *flags_ptr);
+static herr_t H5HL_prefix_dest(H5F_t *f, void *thing);
+static herr_t H5HL_prefix_clear(H5F_t *f, void *thing, hbool_t destroy);
+static herr_t H5HL_prefix_size(const H5F_t *f, const void *thing, size_t *size_ptr);
+static void *H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ const void *udata1, void *udata2);
+static herr_t H5HL_datablock_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
+ void *thing, unsigned *flags_ptr);
+static herr_t H5HL_datablock_dest(H5F_t *f, void *thing);
+static herr_t H5HL_datablock_clear(H5F_t *f, void *thing, hbool_t destroy);
+static herr_t H5HL_datablock_size(const H5F_t *f, const void *thing, size_t *size_ptr);
/*********************/
/* Package Variables */
/*********************/
+/* H5HL inherits cache-like properties from H5AC */
+const H5AC_class_t H5AC_LHEAP_PRFX[1] = {{
+ H5AC_LHEAP_PRFX_ID,
+ H5HL_prefix_load,
+ H5HL_prefix_flush,
+ H5HL_prefix_dest,
+ H5HL_prefix_clear,
+ NULL,
+ H5HL_prefix_size,
+}};
+
+const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{
+ H5AC_LHEAP_DBLK_ID,
+ H5HL_datablock_load,
+ H5HL_datablock_flush,
+ H5HL_datablock_dest,
+ H5HL_datablock_clear,
+ NULL,
+ H5HL_datablock_size,
+}};
+
/*****************************/
/* Library Private Variables */
@@ -86,85 +120,120 @@ static herr_t H5HL_clear(H5F_t *f, H5HL_t *heap, hbool_t destroy);
/* Local Variables */
/*******************/
-/* H5HL inherits cache-like properties from H5AC */
-const H5AC_class_t H5AC_LHEAP[1] = {{
- H5AC_LHEAP_ID,
- (H5AC_load_func_t)H5HL_load,
- (H5AC_flush_func_t)H5HL_flush,
- (H5AC_dest_func_t)H5HL_dest,
- (H5AC_clear_func_t)H5HL_clear,
- (H5AC_notify_func_t)NULL,
- (H5AC_size_func_t)H5HL_size,
-}};
/*-------------------------------------------------------------------------
- * Function: H5HL_serialize
+ * Function: H5HL_fl_deserialize
*
- * Purpose: Serialize the heap. This function will eliminate free
- * blocks at the tail of the heap and also split the block
- * if it needs to be split for the file. This is so that we
- * can serialize it correctly.
+ * Purpose: Deserialize the free list for a heap data block
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Bill Wendling
- * wendling@ncsa.uiuc.edu
- * Sept. 16, 2003
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 12 2008
*
*-------------------------------------------------------------------------
*/
static herr_t
-H5HL_serialize(H5F_t *f, H5HL_t *heap, uint8_t *buf)
+H5HL_fl_deserialize(H5HL_t *heap, hsize_t free_block)
{
- H5HL_free_t *fl;
- uint8_t *p;
- herr_t ret_value = SUCCEED;
+ H5HL_free_t *fl, *tail = NULL; /* Heap free block nodes */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_serialize)
+ FUNC_ENTER_NOAPI_NOINIT(H5HL_fl_deserialize)
- /* check args */
- assert(buf);
- assert(heap);
+ /* check arguments */
+ HDassert(heap);
- /* serialize the header */
- p = buf;
- fl = heap->freelist;
- HDmemcpy(p, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC);
- p += H5_SIZEOF_MAGIC;
- *p++ = H5HL_VERSION;
- *p++ = 0; /*reserved*/
- *p++ = 0; /*reserved*/
- *p++ = 0; /*reserved*/
- H5F_ENCODE_LENGTH(f, p, heap->heap_alloc);
- H5F_ENCODE_LENGTH(f, p, fl ? fl->offset : H5HL_FREE_NULL);
- H5F_addr_encode(f, &p, heap->addr);
-
- /* serialize the free list */
- for (; fl; fl = fl->next) {
- assert (fl->offset == H5HL_ALIGN (fl->offset));
- p = heap->chunk + H5HL_SIZEOF_HDR(f) + fl->offset;
-
- if (fl->next) {
- H5F_ENCODE_LENGTH(f, p, fl->next->offset);
- } else {
- H5F_ENCODE_LENGTH(f, p, H5HL_FREE_NULL);
- }
-
- H5F_ENCODE_LENGTH(f, p, fl->size);
- }
+ /* Build free list */
+ while(H5HL_FREE_NULL != free_block) {
+ const uint8_t *p; /* Pointer into image buffer */
+
+ /* Sanity check */
+ if(free_block >= heap->dblk_size)
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list")
+ /* Allocate & initialize free list node */
+ if(NULL == (fl = H5FL_MALLOC(H5HL_free_t)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed")
+ fl->offset = (size_t)free_block;
+ fl->prev = tail;
+ fl->next = NULL;
+
+ /* Insert node into list */
+ if(tail)
+ tail->next = fl;
+ tail = fl;
+ if(!heap->freelist)
+ heap->freelist = fl;
+
+ /* Decode offset of next free block */
+ p = heap->dblk_image + free_block;
+ H5F_DECODE_LENGTH_LEN(p, free_block, heap->sizeof_size);
+ if(free_block == 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "free block size is zero?")
+
+ /* Decode length of this free block */
+ H5F_DECODE_LENGTH_LEN(p, fl->size, heap->sizeof_size);
+ if(fl->offset + fl->size > heap->dblk_size)
+ HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list")
+ } /* end while */
+
+done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5HL_serialize() */
+} /* end H5HL_fl_deserialize() */
/*-------------------------------------------------------------------------
- * Function: H5HL_load
+ * Function: H5HL_fl_serialize
*
- * Purpose: Loads a heap from disk.
+ * Purpose: Serialize the free list for a heap data block
*
- * Return: Success: Ptr to a local heap memory data structure.
+ * Return: Success: SUCCESS
+ * Failure: FAIL
*
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 12 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+H5HL_fl_serialize(const H5HL_t *heap)
+{
+ H5HL_free_t *fl; /* Pointer to heap free list node */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_fl_serialize)
+
+ /* check arguments */
+ HDassert(heap);
+
+ /* Serialize the free list into the heap data's image */
+ for(fl = heap->freelist; fl; fl = fl->next) {
+ uint8_t *p; /* Pointer into raw data buffer */
+
+ HDassert(fl->offset == H5HL_ALIGN(fl->offset));
+ p = heap->dblk_image + fl->offset;
+
+ if(fl->next)
+ H5F_ENCODE_LENGTH_LEN(p, fl->next->offset, heap->sizeof_size)
+ else
+ H5F_ENCODE_LENGTH_LEN(p, H5HL_FREE_NULL, heap->sizeof_size)
+
+ H5F_ENCODE_LENGTH_LEN(p, fl->size, heap->sizeof_size)
+ } /* end for */
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5HL_fl_serialize() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_prefix_load
+ *
+ * Purpose: Loads a local heap prefix from disk.
+ *
+ * Return: Success: Ptr to a local heap memory data structure.
* Failure: NULL
*
* Programmer: Robb Matzke
@@ -173,110 +242,426 @@ H5HL_serialize(H5F_t *f, H5HL_t *heap, uint8_t *buf)
*
*-------------------------------------------------------------------------
*/
-static H5HL_t *
-H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1,
- void UNUSED * udata2)
+static void *
+H5HL_prefix_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1,
+ void *_udata)
{
- uint8_t hdr[52];
- size_t sizeof_hdr; /* Cache H5HL header size for file */
- const uint8_t *p = NULL;
- H5HL_t *heap = NULL;
- H5HL_free_t *fl = NULL, *tail = NULL;
- size_t free_block = H5HL_FREE_NULL;
- H5HL_t *ret_value;
+ H5HL_t *heap = NULL; /* Local heap */
+ H5HL_prfx_t *prfx = NULL; /* Heap prefix deserialized */
+ H5HL_cache_prfx_ud_t *udata = (H5HL_cache_prfx_ud_t *)_udata; /* User data for protecting local heap prefix */
+ uint8_t buf[H5HL_SPEC_READ_SIZE]; /* Buffer for decoding */
+ size_t spec_read_size; /* Size of buffer to speculatively read in */
+ const uint8_t *p; /* Pointer into decoding buffer */
+ haddr_t eoa; /* Relative end of file address */
+ void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5HL_load, NULL)
+ FUNC_ENTER_NOAPI_NOINIT(H5HL_prefix_load)
/* check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
HDassert(!udata1);
- HDassert(!udata2);
-
- /* Cache this for later */
- sizeof_hdr = H5HL_SIZEOF_HDR(f);
- HDassert(sizeof_hdr <= sizeof(hdr));
-
- /* Get the local heap's header */
- if(H5F_block_read(f, H5FD_MEM_LHEAP, addr, sizeof_hdr, dxpl_id, hdr) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read heap header")
- p = hdr;
+ HDassert(udata);
+ HDassert(udata->sizeof_size > 0);
+ HDassert(udata->sizeof_addr > 0);
+ HDassert(udata->sizeof_prfx > 0);
+ HDassert(udata->sizeof_prfx <= sizeof(buf));
+
+ /* Make certain we don't speculatively read off the end of the file */
+ if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_LHEAP)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, NULL, "unable to determine file size")
+
+ /* Compute the size of the speculative local heap prefix buffer */
+ H5_ASSIGN_OVERFLOW(spec_read_size, MIN(eoa - addr, H5HL_SPEC_READ_SIZE), /* From: */ hsize_t, /* To: */ size_t);
+ HDassert(spec_read_size >= udata->sizeof_prfx);
+
+ /* Attempt to speculatively read both local heap prefix and heap data */
+ if(H5F_block_read(f, H5FD_MEM_LHEAP, addr, spec_read_size, dxpl_id, buf) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read local heap prefix")
+ p = buf;
/* Check magic number */
- if(HDmemcmp(hdr, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad heap signature")
+ if(HDmemcmp(p, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC))
+ HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "bad local heap signature")
p += H5_SIZEOF_MAGIC;
/* Version */
if(H5HL_VERSION != *p++)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong version number in global heap")
+ HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong version number in global heap")
/* Reserved */
p += 3;
/* Allocate space in memory for the heap */
- if(NULL == (heap = H5FL_CALLOC(H5HL_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ if(NULL == (heap = H5HL_new(udata->sizeof_size, udata->sizeof_addr, udata->sizeof_prfx)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap structure")
+
+ /* Allocate the heap prefix */
+ if(NULL == (prfx = H5HL_prfx_new(heap)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap prefix")
+
+ /* Store the prefix's address & length */
+ heap->prfx_addr = addr;
+ heap->prfx_size = udata->sizeof_prfx;
+
+ /* Heap data size */
+ H5F_DECODE_LENGTH_LEN(p, heap->dblk_size, udata->sizeof_size);
+
+ /* Free list head */
+ H5F_DECODE_LENGTH_LEN(p, udata->free_block, udata->sizeof_size);
+ if(udata->free_block != H5HL_FREE_NULL && udata->free_block >= heap->dblk_size)
+ HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "bad heap free list")
+
+ /* Heap data address */
+ H5F_addr_decode_len(udata->sizeof_addr, &p, &(heap->dblk_addr));
+
+ /* Check if heap block exists */
+ if(heap->dblk_size) {
+ /* Check if heap data block is contiguous with header */
+ if(H5F_addr_eq((heap->prfx_addr + heap->prfx_size), heap->dblk_addr)) {
+ /* Note that the heap should be a single object in the cache */
+ heap->single_cache_obj = TRUE;
+
+ /* Allocate space for the heap data image */
+ if(NULL == (heap->dblk_image = H5FL_BLK_MALLOC(lheap_chunk, heap->dblk_size)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
+
+ /* Check if the current buffer from the speculative read already has the heap data */
+ if(spec_read_size >= (heap->prfx_size + heap->dblk_size)) {
+ /* Copy the heap data from the speculative read buffer */
+ HDmemcpy(heap->dblk_image, p, heap->dblk_size);
+ } /* end if */
+ else {
+ /* Read the local heap data block directly into buffer */
+ if(H5F_block_read(f, H5FD_MEM_LHEAP, heap->dblk_addr, heap->dblk_size, dxpl_id, heap->dblk_image) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read heap data")
+ } /* end else */
+
+ /* Build free list */
+ if(H5HL_fl_deserialize(heap, udata->free_block) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list")
+ } /* end if */
+ else
+ /* Note that the heap should _NOT_ be a single object in the cache */
+ heap->single_cache_obj = FALSE;
+ } /* end if */
+
+ /* Set flag to indicate prefix from loaded from file */
+ udata->loaded = TRUE;
- /* heap data size */
- H5F_DECODE_LENGTH(f, p, heap->heap_alloc);
+ /* Set return value */
+ ret_value = prfx;
- /* free list head */
- H5F_DECODE_LENGTH(f, p, free_block);
- if(free_block != H5HL_FREE_NULL && free_block >= heap->heap_alloc)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad heap free list")
+done:
+ /* Release the [possibly partially initialized] local heap on errors */
+ if(!ret_value) {
+ if(prfx) {
+ if(H5HL_prfx_dest(prfx) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap prefix")
+ } /* end if */
+ else {
+ if(heap && H5HL_dest(heap) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap")
+ } /* end else */
+ } /* end if */
- /* data */
- H5F_addr_decode(f, &p, &(heap->addr));
- if(NULL == (heap->chunk = H5FL_BLK_CALLOC(lheap_chunk, (sizeof_hdr + heap->heap_alloc))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- if(heap->heap_alloc &&
- H5F_block_read(f, H5FD_MEM_LHEAP, heap->addr, heap->heap_alloc, dxpl_id, heap->chunk + sizeof_hdr) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "unable to read heap data")
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_prefix_load() */
- /* Build free list */
- while(H5HL_FREE_NULL != free_block) {
- if(free_block >= heap->heap_alloc)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad heap free list")
- if(NULL == (fl = H5FL_MALLOC(H5HL_free_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- fl->offset = free_block;
- fl->prev = tail;
- fl->next = NULL;
- if(tail)
- tail->next = fl;
- tail = fl;
- if(!heap->freelist)
- heap->freelist = fl;
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_prefix_flush
+ *
+ * Purpose: Flushes a heap from memory to disk if it's dirty. Optionally
+ * deletes the heap from memory.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Jul 17 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HL_prefix_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
+ void *thing, unsigned UNUSED *flags_ptr)
+{
+ H5HL_prfx_t *prfx = (H5HL_prfx_t *)thing; /* Local heap prefix to flush */
+ H5WB_t *wb = NULL; /* Wrapped buffer for heap data */
+ uint8_t heap_buf[H5HL_SPEC_READ_SIZE]; /* Buffer for heap */
+ herr_t ret_value = SUCCEED; /* Return value */
- p = heap->chunk + sizeof_hdr + free_block;
+ FUNC_ENTER_NOAPI_NOINIT(H5HL_prefix_flush)
- H5F_DECODE_LENGTH(f, p, free_block);
- if(free_block == 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "free block size is zero?")
+ /* check arguments */
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(prfx);
+
+ if(prfx->cache_info.is_dirty) {
+ H5HL_t *heap = prfx->heap; /* Pointer to the local heap */
+ H5HL_free_t *fl = heap->freelist; /* Pointer to heap's free list */
+ uint8_t *buf; /* Pointer to heap buffer */
+ size_t buf_size; /* Size of buffer for encoding & writing heap info */
+ uint8_t *p; /* Pointer into raw data buffer */
+
+ /* Wrap the local buffer for serialized heap info */
+ if(NULL == (wb = H5WB_wrap(heap_buf, sizeof(heap_buf))))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't wrap buffer")
+
+ /* Compute the size of the buffer to encode & write */
+ buf_size = heap->prfx_size;
+ if(heap->single_cache_obj)
+ buf_size += heap->dblk_size;
+
+ /* Get a pointer to a buffer that's large enough for serialized heap */
+ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, buf_size)))
+ HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "can't get actual buffer")
+
+ /* Serialize the heap prefix */
+ p = buf;
+ HDmemcpy(p, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
+ *p++ = H5HL_VERSION;
+ *p++ = 0; /*reserved*/
+ *p++ = 0; /*reserved*/
+ *p++ = 0; /*reserved*/
+ H5F_ENCODE_LENGTH_LEN(p, heap->dblk_size, heap->sizeof_size);
+ H5F_ENCODE_LENGTH_LEN(p, fl ? fl->offset : H5HL_FREE_NULL, heap->sizeof_size);
+ H5F_addr_encode_len(heap->sizeof_addr, &p, heap->dblk_addr);
+
+ /* Check if the local heap is a single object in cache */
+ if(heap->single_cache_obj) {
+ /* Serialize the free list into the heap data's image */
+ H5HL_fl_serialize(heap);
+
+ /* Copy the heap data block into the cache image */
+ HDmemcpy(p, heap->dblk_image, heap->dblk_size);
+ } /* end if */
- H5F_DECODE_LENGTH(f, p, fl->size);
- if(fl->offset + fl->size > heap->heap_alloc)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad heap free list")
- } /* end while */
+ /* Write the prefix [and possibly the data block] to the file */
+ if(H5F_block_write(f, H5FD_MEM_LHEAP, addr, buf_size, dxpl_id, buf) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header and data to file")
+
+ prfx->cache_info.is_dirty = FALSE;
+ } /* end if */
+
+ /* Should we destroy the memory version? */
+ if(destroy)
+ if(H5HL_prfx_dest(prfx) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap prefix")
+
+done:
+ /* Release resources */
+ if(wb && H5WB_unwrap(wb) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_prefix_flush() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_prefix_dest
+ *
+ * Purpose: Destroys a heap prefix in memory.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Jan 15 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HL_prefix_dest(H5F_t UNUSED *f, void *thing)
+{
+ H5HL_prfx_t *prfx = (H5HL_prfx_t *)thing; /* Local heap prefix to destroy */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5HL_prefix_dest)
+
+ /* check arguments */
+ HDassert(prfx);
+ HDassert(prfx->heap);
+ HDassert(H5F_addr_eq(prfx->cache_info.addr, prfx->heap->prfx_addr));
+
+ /* Verify that entry is clean */
+ HDassert(prfx->cache_info.is_dirty == FALSE);
+
+ /* If we're going to free the space on disk, the address must be valid */
+ HDassert(!prfx->cache_info.free_file_space_on_destroy || H5F_addr_defined(prfx->cache_info.addr));
+
+ /* Check for freeing file space for local heap prefix */
+ if(prfx->cache_info.free_file_space_on_destroy) {
+ hsize_t free_size; /* Size of region to free in file */
+
+ /* Compute size to free for later */
+ free_size = prfx->heap->prfx_size;
+ if(prfx->heap->single_cache_obj)
+ free_size += prfx->heap->dblk_size;
+
+ /* Free the local heap prefix [and possible the data block] on disk */
+ /* (XXX: Nasty usage of internal DXPL value! -QAK) */
+ if(H5MF_xfree(f, H5FD_MEM_LHEAP, H5AC_dxpl_id, prfx->cache_info.addr, free_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap prefix")
+ } /* end if */
+
+ /* Destroy local heap prefix */
+ if(H5HL_prfx_dest(prfx) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't destroy local heap prefix")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_prefix_dest() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_prefix_clear
+ *
+ * Purpose: Mark a local heap prefix in memory as non-dirty.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Mar 20 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HL_prefix_clear(H5F_t UNUSED *f, void *thing, hbool_t destroy)
+{
+ H5HL_prfx_t *prfx = (H5HL_prfx_t *)thing; /* The local heap prefix to operate on */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5HL_prefix_clear)
+
+ /* check arguments */
+ HDassert(prfx);
+
+ /* Mark heap prefix as clean */
+ prfx->cache_info.is_dirty = FALSE;
+
+ if(destroy)
+ if(H5HL_prfx_dest(prfx) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap prefix")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_prefix_clear() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_prefix_size
+ *
+ * Purpose: Compute the size in bytes of the heap prefix on disk,
+ * and return it in *len_ptr. On failure, the value of *len_ptr
+ * is undefined.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: John Mainzer
+ * 5/13/04
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HL_prefix_size(const H5F_t UNUSED *f, const void *thing, size_t *size_ptr)
+{
+ const H5HL_prfx_t *prfx = (const H5HL_prfx_t *)thing; /* Pointer to local heap prefix to query */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_prefix_size)
+
+ /* check arguments */
+ HDassert(prfx);
+ HDassert(prfx->heap);
+ HDassert(size_ptr);
+
+ /* Calculate size of prefix in cache */
+ *size_ptr = prfx->heap->prfx_size;
+
+ /* If the heap is stored as a single object, add in the data block size also */
+ if(prfx->heap->single_cache_obj)
+ *size_ptr += prfx->heap->dblk_size;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5HL_prefix_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_datablock_load
+ *
+ * Purpose: Loads a local heap data block from disk.
+ *
+ * Return: Success: Ptr to a local heap data block memory data structure.
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Jan 5 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5HL_datablock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1,
+ void *_udata)
+{
+ H5HL_dblk_t *dblk = NULL; /* Heap data block deserialized */
+ H5HL_cache_dblk_ud_t *udata = (H5HL_cache_dblk_ud_t *)_udata; /* User data for protecting local heap data block */
+ void *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5HL_datablock_load)
+
+ /* check arguments */
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(!udata1);
+ HDassert(udata);
+ HDassert(udata->heap);
+ HDassert(!udata->heap->single_cache_obj);
+
+ /* Allocate space in memory for the heap data block */
+ if(NULL == (dblk = H5HL_dblk_new(udata->heap)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
+
+ /* Check for heap still retaining image */
+ if(NULL == udata->heap->dblk_image) {
+ /* Allocate space for the heap data image */
+ if(NULL == (udata->heap->dblk_image = H5FL_BLK_MALLOC(lheap_chunk, udata->heap->dblk_size)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate data block image buffer")
+
+ /* Read local heap data block */
+ if(H5F_block_read(f, H5FD_MEM_LHEAP, udata->heap->dblk_addr, udata->heap->dblk_size, dxpl_id, udata->heap->dblk_image) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read local heap data block")
+
+ /* Build free list */
+ if(H5HL_fl_deserialize(udata->heap, udata->free_block) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list")
+ } /* end if */
+
+ /* Set flag to indicate data block from loaded from file */
+ udata->loaded = TRUE;
/* Set return value */
- ret_value = heap;
+ ret_value = dblk;
done:
- if(!ret_value && heap)
- if(H5HL_dest(f,heap) < 0)
- HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy local heap collection")
+ /* Release the [possibly partially initialized] local heap on errors */
+ if(!ret_value && dblk)
+ if(H5HL_dblk_dest(dblk) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to destroy local heap data block")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5HL_load() */
+} /* end H5HL_datablock_load() */
/*-------------------------------------------------------------------------
- * Function: H5HL_flush
+ * Function: H5HL_datablock_flush
*
- * Purpose: Flushes a heap from memory to disk if it's dirty. Optionally
- * deletes the heap from memory.
+ * Purpose: Flushes a heap's data block from memory to disk if it's dirty.
+ * Optionally deletes the heap data block from memory.
*
* Return: Non-negative on success/Negative on failure
*
@@ -287,58 +672,48 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HL_t *heap, unsigned UNUSED * flags_ptr)
+H5HL_datablock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
+ void *_thing, unsigned UNUSED * flags_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5HL_dblk_t *dblk = (H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5HL_flush, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5HL_datablock_flush)
/* check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(heap);
-
- if(heap->cache_info.is_dirty) {
- haddr_t hdr_end_addr;
- size_t sizeof_hdr = H5HL_SIZEOF_HDR(f); /* cache H5HL header size for file */
-
- /* Write the header */
- if(H5HL_serialize(f, heap, heap->chunk) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTSERIALIZE, FAIL, "unable to serialize local heap")
+ HDassert(dblk);
+ HDassert(dblk->heap);
+ HDassert(!dblk->heap->single_cache_obj);
- /* Copy buffer to disk */
- hdr_end_addr = addr + (hsize_t)sizeof_hdr;
+ if(dblk->cache_info.is_dirty) {
+ H5HL_t *heap = dblk->heap; /* Pointer to the local heap */
- if(H5F_addr_eq(heap->addr, hdr_end_addr)) {
- /* The header and data are contiguous */
- if(H5F_block_write(f, H5FD_MEM_LHEAP, addr, (sizeof_hdr + heap->heap_alloc), dxpl_id, heap->chunk) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header and data to file")
- } /* end if */
- else {
- if(H5F_block_write(f, H5FD_MEM_LHEAP, addr, sizeof_hdr, dxpl_id, heap->chunk) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap header to file")
+ /* Serialize the free list into the heap data's image */
+ H5HL_fl_serialize(heap);
- if(H5F_block_write(f, H5FD_MEM_LHEAP, heap->addr, heap->heap_alloc, dxpl_id, heap->chunk + sizeof_hdr) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap data to file")
- } /* end else */
+ /* Write the data block to the file */
+ if(H5F_block_write(f, H5FD_MEM_LHEAP, heap->dblk_addr, heap->dblk_size, dxpl_id, heap->dblk_image) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap data block to file")
- heap->cache_info.is_dirty = FALSE;
+ dblk->cache_info.is_dirty = FALSE;
} /* end if */
/* Should we destroy the memory version? */
if(destroy)
- if(H5HL_dest(f, heap) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap collection")
+ if(H5HL_dblk_dest(dblk) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap data block")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5HL_flush() */
+} /* end H5HL_datablock_flush() */
/*-------------------------------------------------------------------------
- * Function: H5HL_dest
+ * Function: H5HL_datablock_dest
*
- * Purpose: Destroys a heap in memory.
+ * Purpose: Destroys a local heap data block in memory.
*
* Return: Non-negative on success/Negative on failure
*
@@ -348,75 +723,47 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5HL_dest(H5F_t *f, H5HL_t *heap)
+static herr_t
+H5HL_datablock_dest(H5F_t UNUSED *f, void *_thing)
{
- H5HL_free_t *fl; /* Heap object free list */
+ H5HL_dblk_t *dblk = (H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5HL_dest)
+ FUNC_ENTER_NOAPI_NOINIT(H5HL_datablock_dest)
/* check arguments */
- HDassert(heap);
+ HDassert(dblk);
+ HDassert(dblk->heap);
+ HDassert(!dblk->heap->single_cache_obj);
+ HDassert(H5F_addr_eq(dblk->cache_info.addr, dblk->heap->dblk_addr));
- /* Verify that node is clean */
- HDassert(heap->cache_info.is_dirty == FALSE);
+ /* Verify that entry is clean */
+ HDassert(dblk->cache_info.is_dirty == FALSE);
/* If we're going to free the space on disk, the address must be valid */
- HDassert(!heap->cache_info.free_file_space_on_destroy || H5F_addr_defined(heap->cache_info.addr));
-
- /* Check for freeing file space for local heap */
- if(heap->cache_info.free_file_space_on_destroy) {
- size_t sizeof_hdr; /* H5HL header size for file */
- haddr_t hdr_addr; /* Address of heap header in file */
-
- /* Compute this for later */
- sizeof_hdr = H5HL_SIZEOF_HDR(f);
- hdr_addr = heap->cache_info.addr;
-
- /* Check if the heap is contiguous on disk */
- HDassert(!H5F_addr_overflow(hdr_addr, sizeof_hdr));
- if(H5F_addr_eq(heap->addr, hdr_addr + sizeof_hdr)) {
- /* Free the contiguous local heap in one call */
- /* (XXX: Nasty usage of internal DXPL value! -QAK) */
- H5_CHECK_OVERFLOW(sizeof_hdr + heap->heap_alloc, size_t, hsize_t);
- if(H5MF_xfree(f, H5FD_MEM_LHEAP, H5AC_dxpl_id, hdr_addr, (hsize_t)(sizeof_hdr + heap->heap_alloc)) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free contiguous local heap")
- } /* end if */
- else {
- /* Free the local heap's header */
- /* (XXX: Nasty usage of internal DXPL value! -QAK) */
- H5_CHECK_OVERFLOW(sizeof_hdr, size_t, hsize_t);
- if(H5MF_xfree(f, H5FD_MEM_LHEAP, H5AC_dxpl_id, hdr_addr, (hsize_t)sizeof_hdr) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap header")
-
- /* Free the local heap's data */
- /* (XXX: Nasty usage of internal DXPL value! -QAK) */
- H5_CHECK_OVERFLOW(heap->heap_alloc, size_t, hsize_t);
- if(H5MF_xfree(f, H5FD_MEM_LHEAP, H5AC_dxpl_id, heap->addr, (hsize_t)heap->heap_alloc) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap data")
- } /* end else */
+ HDassert(!dblk->cache_info.free_file_space_on_destroy || H5F_addr_defined(dblk->cache_info.addr));
+
+ /* Check for freeing file space for local heap data block */
+ if(dblk->cache_info.free_file_space_on_destroy) {
+ /* Free the local heap data block on disk */
+ /* (XXX: Nasty usage of internal DXPL value! -QAK) */
+ if(H5MF_xfree(f, H5FD_MEM_LHEAP, H5AC_dxpl_id, dblk->cache_info.addr, (hsize_t)dblk->heap->dblk_size) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free local heap data block")
} /* end if */
- /* Release resources */
- if(heap->chunk)
- heap->chunk = H5FL_BLK_FREE(lheap_chunk, heap->chunk);
- while(heap->freelist) {
- fl = heap->freelist;
- heap->freelist = fl->next;
- (void)H5FL_FREE(H5HL_free_t, fl);
- } /* end while */
- (void)H5FL_FREE(H5HL_t, heap);
+ /* Destroy local heap data block */
+ if(H5HL_dblk_dest(dblk) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't destroy local heap data block")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5HL_dest() */
+} /* end H5HL_datablock_dest() */
/*-------------------------------------------------------------------------
- * Function: H5HL_clear
+ * Function: H5HL_datablock_clear
*
- * Purpose: Mark a local heap in memory as non-dirty.
+ * Purpose: Mark a local heap data block in memory as non-dirty.
*
* Return: Non-negative on success/Negative on failure
*
@@ -427,33 +774,34 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5HL_clear(H5F_t *f, H5HL_t *heap, hbool_t destroy)
+H5HL_datablock_clear(H5F_t UNUSED *f, void *_thing, hbool_t destroy)
{
+ H5HL_dblk_t *dblk = (H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5HL_clear)
+ FUNC_ENTER_NOAPI_NOINIT(H5HL_datablock_clear)
/* check arguments */
- HDassert(heap);
+ HDassert(dblk);
- /* Mark heap as clean */
- heap->cache_info.is_dirty = FALSE;
+ /* Mark local heap data block as clean */
+ dblk->cache_info.is_dirty = FALSE;
if(destroy)
- if(H5HL_dest(f, heap) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap collection")
+ if(H5HL_dblk_dest(dblk) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap data block")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5HL_clear() */
+} /* end H5HL_datablock_clear() */
/*-------------------------------------------------------------------------
- * Function: H5HL_size
+ * Function: H5HL_datablock_size
*
- * Purpose: Compute the size in bytes of the specified instance of
- * H5HL_t on disk, and return it in *len_ptr. On failure,
- * the value of *len_ptr is undefined.
+ * Purpose: Compute the size in bytes of the local heap data block on disk,
+ * and return it in *len_ptr. On failure, the value of *len_ptr
+ * is undefined.
*
* Return: Non-negative on success/Negative on failure
*
@@ -462,18 +810,21 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5HL_size(const H5F_t *f, const H5HL_t *heap, size_t *size_ptr)
+static herr_t
+H5HL_datablock_size(const H5F_t UNUSED *f, const void *_thing, size_t *size_ptr)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_size)
+ const H5HL_dblk_t *dblk = (const H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_datablock_size)
/* check arguments */
- HDassert(f);
- HDassert(heap);
+ HDassert(dblk);
+ HDassert(dblk->heap);
HDassert(size_ptr);
- *size_ptr = H5HL_SIZEOF_HDR(f) + heap->heap_alloc;
+ /* Set size of data block in cache */
+ *size_ptr = dblk->heap->dblk_size;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5HL_size() */
+} /* H5HL_datablock_size() */
diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c
index 1ebb14f..b8a8d35 100644
--- a/src/H5HLdbg.c
+++ b/src/H5HLdbg.c
@@ -22,7 +22,6 @@
#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
#include "H5Eprivate.h" /* Error handling */
#include "H5HLpkg.h" /* Local heaps */
#include "H5Iprivate.h" /* ID Functions */
@@ -59,82 +58,77 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int
H5HL_free_t *freelist = NULL;
uint8_t *marker = NULL;
size_t amount_free = 0;
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5HL_debug, FAIL);
+ FUNC_ENTER_NOAPI(H5HL_debug, FAIL)
/* check arguments */
- assert(f);
- assert(H5F_addr_defined(addr));
- assert(stream);
- assert(indent >= 0);
- assert(fwidth >= 0);
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(stream);
+ HDassert(indent >= 0);
+ HDassert(fwidth >= 0);
- if (NULL == (h = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
+ if(NULL == (h = (H5HL_t *)H5HL_protect(f, dxpl_id, addr, H5AC_READ)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap")
fprintf(stream, "%*sLocal Heap...\n", indent, "");
- fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth,
- "Dirty:",
- (int) (h->cache_info.is_dirty));
fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
"Header size (in bytes):",
- (unsigned long) H5HL_SIZEOF_HDR(f));
+ (unsigned long)h->prfx_size);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Address of heap data:",
- h->addr);
+ h->dblk_addr);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Data bytes allocated for heap:",
- h->heap_alloc);
+ h->dblk_size);
/*
* Traverse the free list and check that all free blocks fall within
* the heap and that no two free blocks point to the same region of
* the heap. */
- if (NULL==(marker = (uint8_t *)H5MM_calloc(h->heap_alloc)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ if(NULL == (marker = (uint8_t *)H5MM_calloc(h->dblk_size)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed")
fprintf(stream, "%*sFree Blocks (offset, size):\n", indent, "");
- for (free_block=0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) {
+ for(free_block = 0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) {
char temp_str[32];
sprintf(temp_str,"Block #%d:",free_block);
HDfprintf(stream, "%*s%-*s %8Zu, %8Zu\n", indent+3, "", MAX(0,fwidth-9),
temp_str,
freelist->offset, freelist->size);
- if (freelist->offset + freelist->size > h->heap_alloc) {
+ if((freelist->offset + freelist->size) > h->dblk_size)
fprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n");
- } else {
- for (i=overlap=0; i<(int)(freelist->size); i++) {
- if (marker[freelist->offset + i])
+ else {
+ for(i = overlap = 0; i < (int)(freelist->size); i++) {
+ if(marker[freelist->offset + i])
overlap++;
marker[freelist->offset + i] = 1;
- }
- if (overlap) {
- fprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS "
- "ONE!\n");
- } else {
+ } /* end for */
+ if(overlap)
+ fprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n");
+ else
amount_free += freelist->size;
- }
- }
- }
+ } /* end for */
+ } /* end for */
- if (h->heap_alloc) {
+ if(h->dblk_size)
fprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth,
"Percent of heap used:",
- (100.0 * (double)(h->heap_alloc - amount_free) / (double)h->heap_alloc));
- }
+ (100.0 * (double)(h->dblk_size - amount_free) / (double)h->dblk_size));
/*
* Print the data in a VMS-style octal dump.
*/
- H5_buffer_dump(stream, indent, h->chunk, marker, H5HL_SIZEOF_HDR(f), h->heap_alloc);
+ H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size);
done:
- if (h && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, h, FALSE) != SUCCEED)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header");
+ if(h && H5HL_unprotect(h) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
H5MM_xfree(marker);
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_debug() */
+
diff --git a/src/H5HLint.c b/src/H5HLint.c
new file mode 100644
index 0000000..c6d6839
--- /dev/null
+++ b/src/H5HLint.c
@@ -0,0 +1,417 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5HLint.c
+ * Oct 12 2008
+ * Quincey Koziol <koziol@hdfgroup.org>
+ *
+ * Purpose: Local heap internal routines.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5HLpkg.h" /* Local Heaps */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Declare a free list to manage the H5HL_t struct */
+H5FL_DEFINE_STATIC(H5HL_t);
+
+/* Declare a free list to manage the H5HL_dblk_t struct */
+H5FL_DEFINE_STATIC(H5HL_dblk_t);
+
+/* Declare a free list to manage the H5HL_prfx_t struct */
+H5FL_DEFINE_STATIC(H5HL_prfx_t);
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_new
+ *
+ * Purpose: Create a new local heap object
+ *
+ * Return: Success: non-NULL pointer to new local heap
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Jan 5 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+H5HL_t *
+H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size)
+{
+ H5HL_t *heap = NULL; /* New local heap */
+ H5HL_t *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5HL_new, NULL)
+
+ /* check arguments */
+ HDassert(sizeof_size > 0);
+ HDassert(sizeof_addr > 0);
+ HDassert(prfx_size > 0);
+
+ /* Allocate new local heap structure */
+ if(NULL == (heap = H5FL_CALLOC(H5HL_t)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
+
+ /* Initialize non-zero fields */
+ heap->sizeof_size = sizeof_size;
+ heap->sizeof_addr = sizeof_addr;
+ heap->prfx_size = prfx_size;
+
+ /* Set the return value */
+ ret_value = heap;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_new() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_inc_rc
+ *
+ * Purpose: Increment ref. count on heap
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 12 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HL_inc_rc(H5HL_t *heap)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_inc_rc)
+
+ /* check arguments */
+ HDassert(heap);
+
+ /* Increment heap's ref. count */
+ heap->rc++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HL_inc_rc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_dec_rc
+ *
+ * Purpose: Decrement ref. count on heap
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 12 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5HL_dec_rc(H5HL_t *heap)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_dec_rc)
+
+ /* check arguments */
+ HDassert(heap);
+
+ /* Decrement heap's ref. count */
+ heap->rc--;
+
+ /* Check if we should destroy the heap */
+ if(heap->rc == 0)
+ H5HL_dest(heap);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HL_dec_rc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_dest
+ *
+ * Purpose: Destroys a heap in memory.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Jan 15 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HL_dest(H5HL_t *heap)
+{
+ FUNC_ENTER_NOAPI_NOFUNC(H5HL_dest)
+
+ /* check arguments */
+ HDassert(heap);
+
+ /* Verify that node is unused */
+ HDassert(heap->prots == 0);
+ HDassert(heap->rc == 0);
+ HDassert(heap->prfx == NULL);
+ HDassert(heap->dblk == NULL);
+
+ if(heap->dblk_image)
+ heap->dblk_image = H5FL_BLK_FREE(lheap_chunk, heap->dblk_image);
+ while(heap->freelist) {
+ H5HL_free_t *fl;
+
+ fl = heap->freelist;
+ heap->freelist = fl->next;
+ fl = H5FL_FREE(H5HL_free_t, fl);
+ } /* end while */
+ heap = H5FL_FREE(H5HL_t, heap);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HL_dest() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_prfx_new
+ *
+ * Purpose: Create a new local heap prefix object
+ *
+ * Return: Success: non-NULL pointer to new local heap prefix
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 12 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+H5HL_prfx_t *
+H5HL_prfx_new(H5HL_t *heap)
+{
+ H5HL_prfx_t *prfx = NULL; /* New local heap prefix */
+ H5HL_prfx_t *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5HL_prfx_new, NULL)
+
+ /* check arguments */
+ HDassert(heap);
+
+ /* Allocate new local heap prefix */
+ if(NULL == (prfx = H5FL_CALLOC(H5HL_prfx_t)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
+
+ /* Increment ref. count on heap data structure */
+ if(H5HL_inc_rc(heap) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count")
+
+ /* Link the heap & the prefix */
+ prfx->heap = heap;
+ heap->prfx = prfx;
+
+ /* Set the return value */
+ ret_value = prfx;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_prfx_new() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_prfx_dest
+ *
+ * Purpose: Destroy a local heap prefix object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 12 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HL_prfx_dest(H5HL_prfx_t *prfx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5HL_prfx_dest, FAIL)
+
+ /* check arguments */
+ HDassert(prfx);
+
+ /* Check if prefix was initialized */
+ if(prfx->heap) {
+ /* Unlink prefix from heap */
+ prfx->heap->prfx = NULL;
+
+ /* Decrement ref. count on heap data structure */
+ if(H5HL_dec_rc(prfx->heap) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count")
+
+ /* Unlink heap from prefix */
+ prfx->heap = NULL;
+ } /* end if */
+
+ /* Free local heap prefix */
+ prfx = H5FL_FREE(H5HL_prfx_t, prfx);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_prfx_dest() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_dblk_new
+ *
+ * Purpose: Create a new local heap data block object
+ *
+ * Return: Success: non-NULL pointer to new local heap data block
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 12 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+H5HL_dblk_t *
+H5HL_dblk_new(H5HL_t *heap)
+{
+ H5HL_dblk_t *dblk = NULL; /* New local heap data block */
+ H5HL_dblk_t *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5HL_dblk_new, NULL)
+
+ /* check arguments */
+ HDassert(heap);
+
+ /* Allocate new local heap data block */
+ if(NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
+
+ /* Increment ref. count on heap data structure */
+ if(H5HL_inc_rc(heap) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count")
+
+ /* Link the heap & the data block */
+ dblk->heap = heap;
+ heap->dblk = dblk;
+
+ /* Set the return value */
+ ret_value = dblk;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_dblk_new() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5HL_dblk_dest
+ *
+ * Purpose: Destroy a local heap data block object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Oct 12 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HL_dblk_dest(H5HL_dblk_t *dblk)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5HL_dblk_dest, FAIL)
+
+ /* check arguments */
+ HDassert(dblk);
+
+ /* Check if data block was initialized */
+ if(dblk->heap) {
+ /* Unlink data block from heap */
+ dblk->heap->dblk = NULL;
+
+ /* Unpin the local heap prefix */
+ if(H5AC_unpin_entry(dblk->heap->prfx) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "can't unpin local heap prefix")
+
+ /* Decrement ref. count on heap data structure */
+ if(H5HL_dec_rc(dblk->heap) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count")
+
+ /* Unlink heap from data block */
+ dblk->heap = NULL;
+ } /* end if */
+
+ /* Free local heap data block */
+ dblk = H5FL_FREE(H5HL_dblk_t, dblk);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HL_dblk_dest() */
+
diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h
index 1e34a48..926ecd3 100644
--- a/src/H5HLpkg.h
+++ b/src/H5HLpkg.h
@@ -32,7 +32,6 @@
#include "H5HLprivate.h"
/* Other private headers needed by this file */
-#include "H5ACprivate.h" /* Metadata cache */
#include "H5FLprivate.h" /* Free lists */
@@ -40,15 +39,15 @@
/* Package Private Variables */
/*****************************/
-/* The cache subclass */
-H5_DLLVAR const H5AC_class_t H5AC_LHEAP[1];
+/* The local heap prefix cache subclass */
+H5_DLLVAR const H5AC_class_t H5AC_LHEAP_PRFX[1];
+
+/* The local heap data block cache subclass */
+H5_DLLVAR const H5AC_class_t H5AC_LHEAP_DBLK[1];
/* Declare extern the free list to manage the H5HL_free_t struct */
H5FL_EXTERN(H5HL_free_t);
-/* Declare extern the free list to manage the H5HL_t struct */
-H5FL_EXTERN(H5HL_t);
-
/* Declare extern the PQ free list to manage the heap chunk information */
H5FL_BLK_EXTERN(lheap_chunk);
@@ -59,10 +58,14 @@ H5FL_BLK_EXTERN(lheap_chunk);
#define H5HL_SIZEOF_HDR(F) \
H5HL_ALIGN(H5_SIZEOF_MAGIC + /*heap signature */ \
- 4 + /*reserved */ \
- H5F_SIZEOF_SIZE (F) + /*data size */ \
- H5F_SIZEOF_SIZE (F) + /*free list head */ \
- H5F_SIZEOF_ADDR (F)) /*data address */
+ 1 + /*version */ \
+ 3 + /*reserved */ \
+ H5F_SIZEOF_SIZE(F) + /*data size */ \
+ H5F_SIZEOF_SIZE(F) + /*free list head */ \
+ H5F_SIZEOF_ADDR(F)) /*data address */
+
+/* Value indicating end of free list on disk */
+#define H5HL_FREE_NULL 1
/****************************/
@@ -76,22 +79,83 @@ typedef struct H5HL_free_t {
struct H5HL_free_t *next; /*next entry in free list */
} H5HL_free_t;
+/* Forward declarations */
+typedef struct H5HL_dblk_t H5HL_dblk_t;
+typedef struct H5HL_prfx_t H5HL_prfx_t;
+
struct H5HL_t {
- H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
- /* first field in structure */
- haddr_t addr; /*address of data */
- size_t heap_alloc; /*size of heap on disk and in mem */
- uint8_t *chunk; /*the chunk, including header */
+ /* General heap-management fields */
+ size_t rc; /* Ref. count for prefix & data block using this struct */
+ size_t prots; /* # of times the heap has been protected */
+ size_t sizeof_size; /* Size of file sizes */
+ size_t sizeof_addr; /* Size of file addresses */
+ hbool_t single_cache_obj; /* Indicate if the heap is a single object in the cache */
+
+ /* Prefix-specific fields */
+ H5HL_prfx_t *prfx; /* The prefix object for the heap */
+ haddr_t prfx_addr; /* address of heap prefix */
+ size_t prfx_size; /* size of heap prefix */
+
+ /* Data block-specific fields */
+ H5HL_dblk_t *dblk; /* The data block object for the heap */
+ haddr_t dblk_addr; /* address of data block */
+ size_t dblk_size; /* size of heap data block on disk and in mem */
+ uint8_t *dblk_image; /* The data block image */
H5HL_free_t *freelist; /*the free list */
};
+/* Struct for heap data block */
+struct H5HL_dblk_t {
+ H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
+ /* first field in structure */
+ H5HL_t *heap; /* Pointer to heap for data block */
+};
+
+/* Struct for heap prefix */
+struct H5HL_prfx_t {
+ H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
+ /* first field in structure */
+ H5HL_t *heap; /* Pointer to heap for prefix */
+};
+
+/* Callback information for loading local heap prefix from disk */
+typedef struct H5HL_cache_prfx_ud_t {
+ /* Downwards */
+ size_t sizeof_size; /* Size of file sizes */
+ size_t sizeof_addr; /* Size of file addresses */
+ size_t sizeof_prfx; /* Size of heap prefix */
+
+ /* Upwards */
+ hbool_t loaded; /* Whether prefix was loaded from file */
+ hsize_t free_block; /* First free block in heap */
+} H5HL_cache_prfx_ud_t;
+
+/* Callback information for loading local heap data block from disk */
+typedef struct H5HL_cache_dblk_ud_t {
+ /* Downwards */
+ H5HL_t *heap; /* Local heap */
+ hsize_t free_block; /* First free block in heap */
+
+ /* Upwards */
+ hbool_t loaded; /* Whether data block was loaded from file */
+} H5HL_cache_dblk_ud_t;
+
/******************************/
/* Package Private Prototypes */
/******************************/
-H5_DLL herr_t H5HL_dest(H5F_t *f, H5HL_t *heap);
-H5_DLL herr_t H5HL_size(const H5F_t *f, const H5HL_t *heap, size_t *size_ptr);
+/* Heap routines */
+H5_DLL H5HL_t *H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size);
+H5_DLL herr_t H5HL_dest(H5HL_t *heap);
+
+/* Heap prefix routines */
+H5_DLL H5HL_prfx_t *H5HL_prfx_new(H5HL_t *heap);
+H5_DLL herr_t H5HL_prfx_dest(H5HL_prfx_t *prfx);
+
+/* Heap data block routines */
+H5_DLL H5HL_dblk_t *H5HL_dblk_new(H5HL_t *heap);
+H5_DLL herr_t H5HL_dblk_dest(H5HL_dblk_t *dblk);
#endif /* _H5HLpkg_H */
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index 2a3e2df..8679bee 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -62,10 +62,10 @@ typedef struct H5HL_t H5HL_t;
*/
H5_DLL herr_t H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr/*out*/);
H5_DLL H5HL_t *H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5AC_protect_t rw);
-H5_DLL void *H5HL_offset_into(H5F_t *f, const H5HL_t *heap, size_t offset);
+H5_DLL void *H5HL_offset_into(const H5HL_t *heap, size_t offset);
H5_DLL herr_t H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset,
size_t size);
-H5_DLL herr_t H5HL_unprotect(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, haddr_t addr);
+H5_DLL herr_t H5HL_unprotect(H5HL_t *heap);
H5_DLL size_t H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t size,
const void *buf);
H5_DLL herr_t H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
diff --git a/src/H5I.c b/src/H5I.c
index b116424..cf78d3b 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -1276,8 +1276,6 @@ done:
* Programmer: Quincey Koziol
* Dec 7, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -2096,7 +2094,7 @@ done:
ssize_t
H5Iget_name(hid_t id, char *name/*out*/, size_t size)
{
- ssize_t ret_value;
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API(H5Iget_name, FAIL)
H5TRACE3("Zs", "ixz", id, name, size);
diff --git a/src/H5L.c b/src/H5L.c
index b217abe..bedd593 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -569,7 +569,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type,
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Lcreate_ud() */
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index b99012c..db762cf 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -25,7 +25,7 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Lpkg.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Opublic.h" /* File objects */
+#include "H5Opublic.h" /* File objects */
#include "H5Pprivate.h" /* Property lists */
static hid_t H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group,
@@ -594,8 +594,8 @@ H5Lcreate_external(const char *file_name, const char *obj_name,
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
- if(norm_obj_name)
- H5MM_free(ext_link_buf);
+ H5MM_xfree(ext_link_buf);
+ H5MM_xfree(norm_obj_name);
FUNC_LEAVE_API(ret_value)
} /* end H5Lcreate_external() */
diff --git a/src/H5O.c b/src/H5O.c
index 1d70f09..4d8c9c9 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -367,7 +367,6 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
H5G_loc_t obj_loc; /* Location used to open group */
H5G_name_t obj_path; /* Opened object group hier. path */
H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Location at 'name' found */
hid_t lapl_id = H5P_LINK_ACCESS_DEFAULT; /* lapl to use to open this object */
hid_t ret_value = FAIL;
@@ -393,9 +392,6 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object")
done:
- if(ret_value < 0 && loc_found)
- if(H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
FUNC_LEAVE_API(ret_value)
} /* end H5Oopen_by_addr() */
@@ -1194,7 +1190,8 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id,
/* Cache object header */
if(H5AC_set(f, dxpl_id, H5AC_OHDR, oh_addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to cache object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header")
+ oh = NULL;
/* Set up object location */
loc->file = f;
@@ -1422,7 +1419,7 @@ int
H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
{
haddr_t addr = H5O_OH_GET_ADDR(oh); /* Object header address */
- int ret_value; /* Return value */
+ int ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5O_link_oh, FAIL)
@@ -1432,7 +1429,11 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
/* Check for too large of an adjustment */
if((unsigned)(-adjust) > oh->nlink)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative")
+
+ /* Adjust the link count for the object header */
oh->nlink += adjust;
+
+ /* Mark object header as dirty in cache */
*oh_flags |= H5AC__DIRTIED_FLAG;
/* Check if the object should be deleted */
@@ -1448,7 +1449,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
if(H5O_delete_oh(f, dxpl_id, oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file")
- /* Mark the object header as deleted */
+ /* Mark the object header for deletion */
*oh_flags = H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
} /* end else */
} /* end if */
@@ -1464,7 +1465,10 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
} /* end if */
} /* end if */
+ /* Adjust the link count for the object header */
oh->nlink += adjust;
+
+ /* Mark object header as dirty in cache */
*oh_flags |= H5AC__DIRTIED_FLAG;
} /* end if */
@@ -1538,10 +1542,10 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id)
HDassert(loc->file);
HDassert(H5F_addr_defined(loc->addr));
- /* get header */
+ /* Get header */
oh_acc = adjust ? H5AC_WRITE : H5AC_READ;
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, oh_acc)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Call the "real" link routine */
if((ret_value = H5O_link_oh(loc->file, adjust, dxpl_id, oh, &oh_flags)) < 0)
@@ -1549,7 +1553,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id)
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_link() */
@@ -1575,8 +1579,8 @@ done:
H5O_t *
H5O_pin(H5O_loc_t *loc, hid_t dxpl_id)
{
- H5O_t *oh = NULL; /* Object header */
- H5O_t *ret_value; /* Return value */
+ H5O_t *oh = NULL; /* Object header */
+ H5O_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5O_pin, NULL)
@@ -1587,7 +1591,7 @@ H5O_pin(H5O_loc_t *loc, hid_t dxpl_id)
/* Check for write access on the file */
if(0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "no write intent on file")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file")
/* Lock the object header into the cache */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
@@ -1596,7 +1600,7 @@ H5O_pin(H5O_loc_t *loc, hid_t dxpl_id)
/* Check if the object header needs to be pinned */
if(0 == oh->npins) {
/* Mark object header as un-evictable */
- if(H5AC_pin_protected_entry(loc->file, oh) < 0)
+ if(H5AC_pin_protected_entry(oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, NULL, "unable to pin object header")
} /* end if */
@@ -1631,22 +1635,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_unpin(H5O_loc_t *loc, H5O_t *oh)
+H5O_unpin(H5O_t *oh)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_unpin, FAIL)
/* check args */
- HDassert(loc);
- HDassert(loc->file);
- HDassert(H5F_addr_defined(loc->addr));
HDassert(oh);
/* Check if this is the last unpin operation */
if(1 == oh->npins) {
/* Mark object header as evictable again */
- if(H5AC_unpin_entry(loc->file, oh) < 0)
+ if(H5AC_unpin_entry(oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
} /* end if */
@@ -1732,7 +1733,7 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force)
} /* end else */
/* Mark object header as dirty in cache */
- if(H5AC_mark_pinned_or_protected_entry_dirty(f, oh) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
} /* end if */
@@ -1757,11 +1758,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_touch(H5O_loc_t *loc, hbool_t force, hid_t dxpl_id)
+H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id)
{
- H5O_t *oh = NULL;
- unsigned oh_flags = H5AC__NO_FLAGS_SET;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_t *oh = NULL; /* Object header to modify */
+ unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_touch, FAIL)
@@ -1774,18 +1775,18 @@ H5O_touch(H5O_loc_t *loc, hbool_t force, hid_t dxpl_id)
/* Get the object header */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Create/Update the modification time message */
if(H5O_touch_oh(loc->file, dxpl_id, oh, force) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to update object modificaton time")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to update object modificaton time")
/* Mark object header as changed */
oh_flags |= H5AC__DIRTIED_FLAG;
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_touch() */
@@ -1875,7 +1876,7 @@ H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
H5O_t *oh = NULL; /* Object header information */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5O_delete,FAIL)
+ FUNC_ENTER_NOAPI(H5O_delete, FAIL)
/* Check args */
HDassert(f);
@@ -1883,7 +1884,7 @@ H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
/* Get the object header information */
if(NULL == (oh = (H5O_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Delete object */
if(H5O_delete_oh(f, dxpl_id, oh) < 0)
@@ -1964,15 +1965,15 @@ H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id)
/* Load the object header */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Retrieve the type of the object */
if(H5O_obj_type_real(oh, obj_type) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
done:
- if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) != SUCCEED)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_obj_type() */
@@ -2042,15 +2043,15 @@ H5O_obj_class(const H5O_loc_t *loc, hid_t dxpl_id)
/* Load the object header */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header")
/* Test whether entry qualifies as a particular type of object */
if(NULL == (ret_value = H5O_obj_class_real(oh)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object type")
done:
- if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) != SUCCEED)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header")
+ if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_obj_class() */
@@ -2437,7 +2438,7 @@ H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr)
*-------------------------------------------------------------------------
*/
herr_t
-H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info,
+H5O_get_info(const H5O_loc_t *loc, hid_t dxpl_id, hbool_t want_ih_info,
H5O_info_t *oinfo)
{
const H5O_obj_class_t *obj_class; /* Class of object for header */
@@ -2447,21 +2448,21 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info,
FUNC_ENTER_NOAPI(H5O_get_info, FAIL)
/* Check args */
- HDassert(oloc);
+ HDassert(loc);
HDassert(oinfo);
/* Get the object header */
- if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Reset the object info structure */
HDmemset(oinfo, 0, sizeof(*oinfo));
/* Retrieve the file's fileno */
- H5F_GET_FILENO(oloc->file, oinfo->fileno);
+ H5F_GET_FILENO(loc->file, oinfo->fileno);
/* Set the object's address */
- oinfo->addr = oloc->addr;
+ oinfo->addr = loc->addr;
/* Get class for object */
if(NULL == (obj_class = H5O_obj_class_real(oh)))
@@ -2497,7 +2498,7 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info,
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME message")
if(exists > 0) {
/* Get "old style" modification time info */
- if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_ID, &oinfo->ctime))
+ if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_MTIME_ID, &oinfo->ctime))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME message")
} /* end if */
else {
@@ -2506,7 +2507,7 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info,
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME_NEW message")
if(exists > 0) {
/* Get "new style" modification time info */
- if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_NEW_ID, &oinfo->ctime))
+ if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_MTIME_NEW_ID, &oinfo->ctime))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME_NEW message")
} /* end if */
else
@@ -2519,7 +2520,7 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info,
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info")
/* Retrieve # of attributes */
- if(H5O_attr_count_real(oloc->file, dxpl_id, oh, &oinfo->num_attrs) < 0)
+ if(H5O_attr_count_real(loc->file, dxpl_id, oh, &oinfo->num_attrs) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count")
/* Get B-tree & heap metadata storage size, if requested */
@@ -2527,20 +2528,20 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info,
/* Check for 'bh_info' callback for this type of object */
if(obj_class->bh_info) {
/* Call the object's class 'bh_info' routine */
- if((obj_class->bh_info)(oloc->file, dxpl_id, oh, &(oinfo->meta_size.obj) /* out */) < 0)
+ if((obj_class->bh_info)(loc->file, dxpl_id, oh, &oinfo->meta_size.obj) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info")
} /* end if */
/* Get B-tree & heap info for any attributes */
if(oinfo->num_attrs > 0) {
- if(H5O_attr_bh_info(oloc->file, dxpl_id, oh, &oinfo->meta_size.attr/*out*/) < 0)
+ if(H5O_attr_bh_info(loc->file, dxpl_id, oh, &oinfo->meta_size.attr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info")
} /* end if */
} /* end if */
done:
- if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_get_info() */
@@ -2560,7 +2561,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_get_create_plist(const H5O_loc_t *oloc, hid_t dxpl_id, H5P_genplist_t *oc_plist)
+H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, H5P_genplist_t *oc_plist)
{
H5O_t *oh = NULL; /* Object header */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2568,12 +2569,12 @@ H5O_get_create_plist(const H5O_loc_t *oloc, hid_t dxpl_id, H5P_genplist_t *oc_pl
FUNC_ENTER_NOAPI(H5O_get_create_plist, FAIL)
/* Check args */
- HDassert(oloc);
+ HDassert(loc);
HDassert(oc_plist);
/* Get the object header */
- if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Set property values, if they were used for the object */
if(oh->version > H5O_VERSION_1) {
@@ -2594,8 +2595,8 @@ H5O_get_create_plist(const H5O_loc_t *oloc, hid_t dxpl_id, H5P_genplist_t *oc_pl
} /* end if */
done:
- if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_get_create_plist() */
@@ -2615,7 +2616,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_get_nlinks(const H5O_loc_t *oloc, hid_t dxpl_id, hsize_t *nlinks)
+H5O_get_nlinks(const H5O_loc_t *loc, hid_t dxpl_id, hsize_t *nlinks)
{
H5O_t *oh = NULL; /* Object header */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2623,19 +2624,19 @@ H5O_get_nlinks(const H5O_loc_t *oloc, hid_t dxpl_id, hsize_t *nlinks)
FUNC_ENTER_NOAPI(H5O_get_nlinks, FAIL)
/* Check args */
- HDassert(oloc);
+ HDassert(loc);
HDassert(nlinks);
/* Get the object header */
- if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Retrieve the # of link messages seen when the object header was loaded */
*nlinks = oh->link_msgs_seen;
done:
- if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_get_nlinks() */
@@ -2733,7 +2734,7 @@ H5O_get_oh_addr(const H5O_t *oh)
*-------------------------------------------------------------------------
*/
herr_t
-H5O_get_rc_and_type(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc, H5O_type_t *otype)
+H5O_get_rc_and_type(const H5O_loc_t *loc, hid_t dxpl_id, unsigned *rc, H5O_type_t *otype)
{
H5O_t *oh = NULL; /* Object header */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2741,13 +2742,13 @@ H5O_get_rc_and_type(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc, H5O_type
FUNC_ENTER_NOAPI(H5O_get_rc_and_type, FAIL)
/* Check args */
- HDassert(oloc);
+ HDassert(loc);
HDassert(rc);
HDassert(otype);
/* Get the object header */
- if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Set the object's reference count */
*rc = oh->nlink;
@@ -2757,8 +2758,8 @@ H5O_get_rc_and_type(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc, H5O_type
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
done:
- if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_get_rc_and_type() */
diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c
index e61d899..0984cd4 100644
--- a/src/H5Oainfo.c
+++ b/src/H5Oainfo.c
@@ -431,17 +431,17 @@ H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
if(H5A_dense_create(file_dst, dxpl_id, ainfo_dst) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes")
- if ( (H5A_dense_copy_file_all(file_src, ainfo_src, file_dst, ainfo_dst, recompute_size, cpy_info, dxpl_id)) <0)
+ if((H5A_dense_copy_file_all(file_src, ainfo_src, file_dst, ainfo_dst, recompute_size, cpy_info, dxpl_id)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes")
- }
+ } /* end if */
/* Set return value */
ret_value = ainfo_dst;
done:
/* Release destination attribute information on failure */
- if(ret_value == NULL && ainfo_dst != NULL)
- (void)H5FL_FREE(H5O_ainfo_t, ainfo_dst);
+ if(!ret_value && ainfo_dst)
+ ainfo_dst = H5FL_FREE(H5O_ainfo_t, ainfo_dst);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_ainfo_copy_file() */
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index bfc6908..dc72799 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -71,7 +71,7 @@ static unsigned H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
static htri_t H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u, hid_t dxpl_id);
static htri_t H5O_move_msgs_forward(H5F_t *f, H5O_t *oh, hid_t dxpl_id);
static htri_t H5O_merge_null(H5F_t *f, H5O_t *oh, hid_t dxpl_id);
-static htri_t H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id);
+static htri_t H5O_remove_empty_chunks(H5F_t *f, hid_t dxpl_id, H5O_t *oh);
static herr_t H5O_alloc_shrink_chunk(H5F_t *f, H5O_t *oh, hid_t dxpl_id, unsigned chunkno);
@@ -171,7 +171,6 @@ H5O_add_gap(H5O_t *oh, unsigned chunkno, unsigned idx,
/* Create new null message, with the tail of the previous null message */
null_msg = &(oh->mesg[oh->nmesgs++]);
null_msg->type = H5O_MSG_NULL;
- null_msg->dirty = TRUE;
null_msg->native = NULL;
null_msg->raw_size = new_gap_size - H5O_SIZEOF_MSGHDR_OH(oh);
null_msg->raw = (oh->chunk[chunkno].image + oh->chunk[chunkno].size)
@@ -182,6 +181,9 @@ H5O_add_gap(H5O_t *oh, unsigned chunkno, unsigned idx,
if(null_msg->raw_size)
HDmemset(null_msg->raw, 0, null_msg->raw_size);
+ /* Mark message as dirty */
+ null_msg->dirty = TRUE;
+
/* Reset size of gap in chunk */
oh->chunk[chunkno].gap = 0;
} /* end if */
@@ -347,12 +349,14 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type,
/* Create new null message, with the tail of the previous null message */
null_msg = &(oh->mesg[oh->nmesgs++]);
null_msg->type = H5O_MSG_NULL;
- null_msg->dirty = TRUE;
null_msg->native = NULL;
null_msg->raw = alloc_msg->raw + new_mesg_size;
null_msg->raw_size = alloc_msg->raw_size - new_mesg_size;
null_msg->chunkno = alloc_msg->chunkno;
+ /* Mark the message as dirty */
+ null_msg->dirty = TRUE;
+
/* Check for gap in new null message's chunk */
if(oh->chunk[null_msg->chunkno].gap > 0) {
unsigned null_chunkno = null_msg->chunkno; /* Chunk w/gap */
@@ -374,9 +378,11 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type,
/* Initialize the new message */
alloc_msg->type = new_type;
- alloc_msg->dirty = TRUE;
alloc_msg->native = new_native;
+ /* Mark the new message as dirty */
+ alloc_msg->dirty = TRUE;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_alloc_null() */
@@ -458,12 +464,8 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_alloc_extend_chunk(H5F_t *f,
- hid_t dxpl_id,
- H5O_t *oh,
- unsigned chunkno,
- size_t size,
- unsigned * msg_idx)
+H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
+ size_t size, unsigned * msg_idx)
{
size_t delta; /* Change in chunk's size */
size_t aligned_size = H5O_ALIGN_OH(oh, size);
@@ -596,7 +598,7 @@ H5O_alloc_extend_chunk(H5F_t *f,
if(oh->mesg[u].chunkno == chunkno) {
oh->mesg[u].raw = oh->chunk[chunkno].image + extra_prfx_size + (oh->mesg[u].raw - old_image);
- /* Flag message as dirty */
+ /* Flag message as dirty directly */
oh->mesg[u].dirty = TRUE;
} /* endif */
@@ -605,7 +607,7 @@ H5O_alloc_extend_chunk(H5F_t *f,
* it's size is directly encoded in the object header) */
if(chunkno > 0 && (H5O_CONT_ID == oh->mesg[u].type->id) &&
(((H5O_cont_t *)(oh->mesg[u].native))->chunkno == chunkno)) {
- /* Adjust size of continuation message */
+ /* Adjust size in continuation message */
HDassert(((H5O_cont_t *)(oh->mesg[u].native))->size == old_size);
((H5O_cont_t *)(oh->mesg[u].native))->size = oh->chunk[chunkno].size;
@@ -658,10 +660,7 @@ done:
*-------------------------------------------------------------------------
*/
static unsigned
-H5O_alloc_new_chunk(H5F_t *f,
- hid_t dxpl_id,
- H5O_t *oh,
- size_t size)
+H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size)
{
/* Struct for storing information about "best" messages to allocate from */
typedef struct {
@@ -917,7 +916,6 @@ H5O_alloc_new_chunk(H5F_t *f,
found_null = oh->nmesgs++;
null_msg = &(oh->mesg[found_null]);
null_msg->type = H5O_MSG_NULL;
- null_msg->dirty = TRUE;
null_msg->native = NULL;
null_msg->raw = oh->mesg[found_other.msgno].raw;
null_msg->raw_size = oh->mesg[found_other.msgno].raw_size;
@@ -964,6 +962,9 @@ H5O_alloc_new_chunk(H5F_t *f,
/* Adjust message index for new NULL message */
found_null--;
} /* end if */
+
+ /* Mark the new null message as dirty */
+ null_msg->dirty = TRUE;
} /* end if */
HDassert(found_null >= 0);
@@ -1077,7 +1078,7 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type,
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, UFAIL, "can't split null message")
/* Mark object header as dirty in cache */
- if(H5AC_mark_pinned_or_protected_entry_dirty(f, oh) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, UFAIL, "unable to mark object header as dirty")
/* Set return value */
@@ -1133,7 +1134,7 @@ H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg,
/* Clear message flags */
mesg->flags = 0;
- /* Indicate that the message was modified */
+ /* Mark the message as modified */
mesg->dirty = TRUE;
/* Check if chunk has a gap currently */
@@ -1455,12 +1456,14 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh, hid_t dxpl_id)
/* Initialize new null message to take over non-null message's location */
oh->mesg[new_null_msg].type = H5O_MSG_NULL;
- oh->mesg[new_null_msg].dirty = TRUE;
oh->mesg[new_null_msg].native = NULL;
oh->mesg[new_null_msg].raw = old_raw;
oh->mesg[new_null_msg].raw_size = curr_msg->raw_size;
oh->mesg[new_null_msg].chunkno = old_chunkno;
+ /* Mark new null message dirty */
+ oh->mesg[new_null_msg].dirty = TRUE;
+
/* Check for gap in new null message's chunk */
if(oh->chunk[old_chunkno].gap > 0) {
/* Eliminate the gap in the chunk */
@@ -1498,7 +1501,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh, hid_t dxpl_id)
} while(packed_msg);
/* Set return value */
- ret_value = did_packing;
+ ret_value = (htri_t)did_packing;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1612,7 +1615,7 @@ H5O_merge_null(H5F_t *f, H5O_t *oh, hid_t dxpl_id)
} while(merged_msg);
/* Set return value */
- ret_value = did_merging;
+ ret_value = (htri_t)did_merging;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1638,7 +1641,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id)
+H5O_remove_empty_chunks(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
{
hbool_t deleted_chunk; /* Whether to a chunk was deleted */
hbool_t did_deleting = FALSE; /* Whether any chunks were deleted */
@@ -1725,7 +1728,10 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id)
/* Adjust chunk # for messages in chunks after deleted chunk */
for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
+ /* Sanity check - there should be no messages in deleted chunk */
HDassert(curr_msg->chunkno != deleted_chunkno);
+
+ /* Adjust chunk index for messages in later chunks */
if(curr_msg->chunkno > deleted_chunkno)
curr_msg->chunkno--;
@@ -1752,7 +1758,7 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id)
} while(deleted_chunk);
/* Set return value */
- ret_value = did_deleting;
+ ret_value = (htri_t)did_deleting;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1810,7 +1816,7 @@ H5O_condense_header(H5F_t *f, H5O_t *oh, hid_t dxpl_id)
rescan_header = TRUE;
/* Scan for empty chunks to remove */
- result = H5O_remove_empty_chunks(f, oh, dxpl_id);
+ result = H5O_remove_empty_chunks(f, dxpl_id, oh);
if(result < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk")
if(result > 0)
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index ad068ad..4d8b17a 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -668,7 +668,7 @@ H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *mesg_type,
if(H5T_set_loc(((H5A_t *)native_src)->shared->dt, file_src, H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location")
- if ( NULL == (ret_value=H5A_attr_copy_file((H5A_t *)native_src, file_dst, recompute_size, cpy_info, dxpl_id)))
+ if(NULL == (ret_value = H5A_attr_copy_file((H5A_t *)native_src, file_dst, recompute_size, cpy_info, dxpl_id)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy attribute")
done:
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 67d0a92..72f02df 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -235,7 +235,7 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
/* Protect the object header to iterate over */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check if this object already has attribute information */
if(oh->version > H5O_VERSION_1) {
@@ -401,7 +401,7 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_create() */
@@ -488,7 +488,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
/* Protect the object header to iterate over */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, NULL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -545,7 +545,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_PROTECT, NULL, "unable to release object header")
+ HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_open_by_name() */
@@ -629,7 +629,7 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Protect the object header to iterate over */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, NULL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header")
/* Find out whether it has already been opened. If it has, close the object
* and make a copy of the already opened object to share the object info.
@@ -655,7 +655,7 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
done:
if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_PROTECT, NULL, "unable to release object header")
+ HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_open_by_idx() */
@@ -846,7 +846,7 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
HDassert(!udata->found);
/* Check for correct attribute message to modify */
- if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name) == 0) {
+ if(0 == HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name)) {
/* Update the shared attribute in the SOHM storage */
if(mesg->flags & H5O_MSG_FLAG_SHARED)
if(H5O_attr_update_shared(udata->f, udata->dxpl_id, oh, udata->attr, (H5O_shared_t *)mesg->native) < 0)
@@ -898,7 +898,7 @@ H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
/* Protect the object header to iterate over */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -944,7 +944,7 @@ H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_write */
@@ -1036,7 +1036,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
if(H5A_set_version(udata->f, ((H5A_t *)mesg->native)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5_ITER_ERROR, "unable to update attribute version")
- /* Mark message as dirty */
+ /* Mark the message as modified */
mesg->dirty = TRUE;
/* Check for shared message */
@@ -1132,7 +1132,7 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name,
/* Protect the object header to iterate over */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -1189,7 +1189,7 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name,
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_rename */
@@ -1227,7 +1227,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id,
/* Protect the object header to iterate over */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -1245,7 +1245,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id,
/* Release the object header */
if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
oh = NULL;
/* Iterate over attributes in dense storage */
@@ -1259,7 +1259,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id,
/* Release the object header */
if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
oh = NULL;
/* Check for skipping too many attributes */
@@ -1274,7 +1274,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id,
done:
/* Release resources */
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
if(atable.attrs && H5A_attr_release_table(&atable) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table")
@@ -1402,8 +1402,7 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo,
/* Insert attribute message into object header (Will increment
reference count on shared attributes) */
/* Find out whether the attribute has been opened */
- if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr,
- (atable.attrs[u])->shared->name)) < 0)
+ if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "failed in finding opened attribute")
/* If found the attribute is already opened, use the opened message to insert.
@@ -1523,7 +1522,7 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
/* Protect the object header to iterate over */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -1574,7 +1573,7 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_remove() */
@@ -1611,7 +1610,7 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
/* Protect the object header to iterate over */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -1670,7 +1669,7 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
if(atable.attrs && H5A_attr_release_table(&atable) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table")
@@ -1799,7 +1798,7 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
/* Protect the object header to iterate over */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
@@ -1837,7 +1836,7 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_exists */
@@ -1953,7 +1952,7 @@ H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id)
/* Protect the object header to iterate over */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Retrieve # of attributes on object */
if(H5O_attr_count_real(loc->file, dxpl_id, oh, &nattrs) < 0)
@@ -1964,7 +1963,7 @@ H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id)
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_count */
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index c0c1bfa..0709e60 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -135,9 +135,9 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
haddr_t eoa; /* Relative end of file address */
H5O_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5O_load, NULL)
+ FUNC_ENTER_NOAPI_NOINIT(H5O_load)
- /* check args */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
HDassert(!_udata1);
@@ -155,7 +155,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header")
p = read_buf;
- /* allocate ohdr and init chunk list */
+ /* Allocate space for the object header data structure */
if(NULL == (oh = H5FL_CALLOC(H5O_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
@@ -163,7 +163,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
oh->sizeof_size = H5F_SIZEOF_SIZE(f);
oh->sizeof_addr = H5F_SIZEOF_ADDR(f);
- /* Check for magic number */
+ /* Check for presence of magic number */
/* (indicates version 2 or later) */
if(!HDmemcmp(p, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/* Magic number */
@@ -268,12 +268,12 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
(nmesgs == 0 && chunk_size > 0))
HGOTO_ERROR(H5E_OHDR, H5E_VERSION, NULL, "bad object header chunk size")
- /* Reserved, in version 1 */
+ /* Reserved, in version 1 (for 8-byte alignment padding) */
p += 4;
} /* end else */
/* Determine object header prefix length */
- prefix_size = (size_t)(p - read_buf);
+ prefix_size = (size_t)(p - (const uint8_t *)read_buf);
HDassert((size_t)prefix_size == (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)));
/* Compute first chunk address */
@@ -282,7 +282,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
/* Allocate the message array */
oh->alloc_nmesgs = (nmesgs > 0) ? nmesgs : 1;
if(NULL == (oh->mesg = H5FL_SEQ_MALLOC(H5O_mesg_t, oh->alloc_nmesgs)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Read each chunk from disk */
while(H5F_addr_defined(chunk_addr)) {
@@ -298,7 +298,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
H5O_chunk_t *x = H5FL_SEQ_REALLOC(H5O_chunk_t, oh->chunk, (size_t)na);
if(!x)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed")
oh->alloc_nchunks = na;
oh->chunk = x;
} /* end if */
@@ -317,7 +317,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
oh->chunk[chunkno].size = chunk_size;
} /* end else */
if(NULL == (oh->chunk[chunkno].image = H5FL_BLK_MALLOC(chunk_image, oh->chunk[chunkno].size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Handle chunk 0 as special case */
if(chunkno == 0) {
@@ -401,7 +401,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
if(oh->version == H5O_VERSION_1)
p += 3; /*reserved*/
else {
- /* Only encode creation index if they are being tracked */
+ /* Only decode creation index if they are being tracked */
if(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)
UINT16DECODE(p, crt_idx);
} /* end else */
@@ -434,7 +434,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
/* Check if we need to extend message table to hold the new message */
if(oh->nmesgs >= oh->alloc_nmesgs)
if(H5O_alloc_msgs(oh, (size_t)1) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate more space for messages")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate more space for messages")
/* Get index for message */
mesgno = oh->nmesgs++;
@@ -455,12 +455,12 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
/* Allocate "unknown" message info */
if(NULL == (unknown = H5FL_MALLOC(H5O_unknown_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Save the original message type ID */
*unknown = id;
- /* Save 'native' form of continuation message */
+ /* Save 'native' form of unknown message */
oh->mesg[mesgno].native = unknown;
/* Set message to "unknown" class */
@@ -646,22 +646,16 @@ done:
* matzke@llnl.gov
* Aug 5 1997
*
- * Changes: JRM -- 8/21/06
- * Added the flags_ptr parameter. This parameter exists to
- * allow the flush routine to report to the cache if the
- * entry is resized or renamed as a result of the flush.
- * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry.
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr, H5O_t *oh, unsigned UNUSED * flags_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5O_flush, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5O_flush)
- /* check args */
+ /* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
HDassert(oh);
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 807d147..8bdbed5 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -44,6 +44,7 @@
#include "H5Opkg.h" /* Object headers */
#include "H5Pprivate.h" /* Property lists */
+
/****************/
/* Local Macros */
/****************/
@@ -316,7 +317,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
/* Get source object header */
if(NULL == (oh_src = (H5O_t *)H5AC_protect(oloc_src->file, dxpl_id, H5AC_OHDR, oloc_src->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Get pointer to object class for this object */
if(NULL == (obj_class = H5O_obj_class_real(oh_src)))
@@ -451,7 +452,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
if(cpy_info->preserve_null && deleted[mesgno]) {
mesg_dst->type = H5O_MSG_NULL;
mesg_dst->flags = 0;
- mesg_dst->dirty = 1;
+ mesg_dst->dirty = TRUE;
} /* end if */
/* Check for message class to operate on */
@@ -720,7 +721,8 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
/* Insert destination object header in cache */
if(H5AC_set(oloc_dst->file, dxpl_id, H5AC_OHDR, oloc_dst->addr, oh_dst, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to cache object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header")
+ oh_dst = NULL;
done:
/* Free deleted array */
@@ -728,17 +730,12 @@ done:
HDfree(deleted);
/* Release pointer to source object header and its derived objects */
- if(oh_src != NULL) {
- /* Unprotect the source object header */
- if(H5AC_unprotect(oloc_src->file, dxpl_id, H5AC_OHDR, oloc_src->addr, oh_src, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
- } /* end if */
+ if(oh_src && H5AC_unprotect(oloc_src->file, dxpl_id, H5AC_OHDR, oloc_src->addr, oh_src, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
/* Release pointer to destination object header */
- if(ret_value < 0 && oh_dst) {
- if(H5O_dest(oloc_dst->file, oh_dst) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
- } /* end if */
+ if(ret_value < 0 && oh_dst && H5O_dest(oloc_dst->file, oh_dst) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
/* Release user data for particular type of object to copy */
if(udata) {
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index cd041e0..b731ce9 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -534,8 +534,8 @@ done:
herr_t
H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth)
{
- H5O_t *oh = NULL;
- herr_t ret_value = SUCCEED;
+ H5O_t *oh = NULL; /* Object header to display */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_debug, FAIL)
@@ -547,14 +547,14 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
HDassert(fwidth >= 0);
if(NULL == (oh = (H5O_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* debug */
H5O_debug_real(f, dxpl_id, oh, addr, stream, indent, fwidth);
done:
if(oh && H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_debug() */
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 5702b34..0eb4ba2 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -126,11 +126,11 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh,
if(NULL == (heap = H5HL_protect(f, dxpl_id, mesg->heap_addr, H5AC_READ)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read protect link value")
- s = (const char *)H5HL_offset_into(f, heap, 0);
+ s = (const char *)H5HL_offset_into(heap, 0);
HDassert(s && !*s);
- if(H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr) < 0)
+ if(H5HL_unprotect(heap) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value")
heap = NULL;
#endif
@@ -146,7 +146,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh,
/* Name */
H5F_DECODE_LENGTH (f, p, mesg->slot[u].name_offset);
- s = (const char *)H5HL_offset_into(f, heap, mesg->slot[u].name_offset);
+ s = (const char *)H5HL_offset_into(heap, mesg->slot[u].name_offset);
HDassert(s && *s);
mesg->slot[u].name = H5MM_xstrdup (s);
HDassert(mesg->slot[u].name);
@@ -159,7 +159,7 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh,
HDassert(mesg->slot[u].size > 0);
} /* end for */
- if(H5HL_unprotect(f, dxpl_id, heap, mesg->heap_addr) < 0)
+ if(H5HL_unprotect(heap) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value")
heap = NULL;
@@ -482,7 +482,7 @@ H5O_efl_copy_file(H5F_t UNUSED *file_src, void *mesg_src, H5F_t *file_dst,
done:
/* Release resources */
- if(heap && H5HL_unprotect(file_dst, dxpl_id, heap, efl_dst->heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_EFL, H5E_PROTECT, NULL, "unable to unprotect EFL file name heap")
if(!ret_value)
if(efl_dst)
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index d133a0a..f403b81 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -556,7 +556,7 @@ H5O_fill_copy(const void *_src, void *_dst)
H5I_dec_ref(src_id, FALSE);
H5I_dec_ref(dst_id, FALSE);
if(bkg_buf)
- (void)H5FL_BLK_FREE(type_conv, bkg_buf);
+ bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf);
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, NULL, "datatype conversion failed")
} /* end if */
@@ -564,7 +564,7 @@ H5O_fill_copy(const void *_src, void *_dst)
H5I_dec_ref(src_id, FALSE);
H5I_dec_ref(dst_id, FALSE);
if(bkg_buf)
- (void)H5FL_BLK_FREE(type_conv, bkg_buf);
+ bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf);
} /* end if */
} /* end if */
} /* end if */
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 330189c..7a15947 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -560,8 +560,10 @@ H5O_layout_copy(const void *_mesg, void *_dest)
/* check args */
HDassert(mesg);
+
+ /* Allocate destination message, if necessary */
if(!dest && NULL == (dest = H5FL_MALLOC(H5O_layout_t)))
- HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "layout message allocation failed")
/* copy */
*dest = *mesg;
@@ -584,6 +586,10 @@ H5O_layout_copy(const void *_mesg, void *_dest)
ret_value = dest;
done:
+ if(ret_value == NULL)
+ if(NULL == _dest)
+ dest = H5FL_FREE(H5O_layout_t, dest);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_layout_copy() */
@@ -880,7 +886,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst,
done:
if(!ret_value)
if(layout_dst)
- (void)H5FL_FREE(H5O_layout_t, layout_dst);
+ layout_dst = H5FL_FREE(H5O_layout_t, layout_dst);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_layout_copy_file() */
diff --git a/src/H5Olink.c b/src/H5Olink.c
index ffe80e7..4ddfbf6 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -705,7 +705,6 @@ H5O_link_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_
hid_t UNUSED dxpl_id)
{
H5O_link_t *link_src = (H5O_link_t *)native_src;
- H5O_link_t *link_dst = NULL;
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_link_copy_file)
@@ -721,17 +720,10 @@ H5O_link_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t UNUSED *file_
/* Allocate "blank" link for destination */
/* (values will be filled in during 'post copy' operation) */
- if(NULL == (link_dst = H5FL_CALLOC(H5O_link_t)))
+ if(NULL == (ret_value = H5FL_CALLOC(H5O_link_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /* Set return value */
- ret_value = link_dst;
-
done:
- if(!ret_value)
- if(link_dst)
- H5O_link_free(link_dst);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_link_copy_file() */
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index 4a9ecb5..fc6146a 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -133,7 +133,7 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
/* Protect the object header */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Go append message to object header */
if(H5O_msg_append_oh(loc->file, dxpl_id, oh, type_id, mesg_flags, update_flags, mesg) < 0)
@@ -141,7 +141,7 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_create() */
@@ -286,7 +286,7 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
/* Protect the object header */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Call the "real" modify routine */
if(H5O_msg_write_real(loc->file, dxpl_id, oh, type, mesg_flags, update_flags, mesg) < 0)
@@ -294,7 +294,7 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_write() */
@@ -485,7 +485,7 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg,
/* Get the object header */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header")
/* Call the "real" read routine */
if(NULL == (ret_value = H5O_msg_read_oh(loc->file, dxpl_id, oh, type_id, mesg)))
@@ -493,7 +493,7 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg,
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_read() */
@@ -810,14 +810,14 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id)
/* Load the object header */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Count the messages of the correct type */
ret_value = H5O_msg_count_real(oh, type);
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_count() */
@@ -891,7 +891,7 @@ H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id)
/* Load the object header */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Call the "real" exists routine */
if((ret_value = H5O_msg_exists_oh(oh, type_id)) < 0)
@@ -899,7 +899,7 @@ H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id)
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) != SUCCEED)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_exists() */
@@ -988,7 +988,7 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj
/* Protect the object header to iterate over */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Call the "real" remove routine */
if((ret_value = H5O_msg_remove_real(loc->file, oh, type, sequence, NULL, NULL, adj_link, dxpl_id)) < 0)
@@ -996,7 +996,7 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_remove() */
@@ -1040,7 +1040,7 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence,
/* Protect the object header to iterate over */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Call the "real" remove routine */
if((ret_value = H5O_msg_remove_real(loc->file, oh, type, sequence, op, op_data, adj_link, dxpl_id)) < 0)
@@ -1048,7 +1048,7 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence,
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_remove_op() */
@@ -1231,7 +1231,7 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id,
/* Protect the object header to iterate over */
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Call the "real" iterate routine */
if((ret_value = H5O_msg_iterate_real(loc->file, oh, type, op, op_data, dxpl_id)) < 0)
@@ -1239,7 +1239,7 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id,
done:
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_iterate() */
@@ -1336,7 +1336,7 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object")
/* Mark object header as dirty in cache */
- if(H5AC_mark_pinned_or_protected_entry_dirty(f, oh) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
} /* end if */
@@ -1859,7 +1859,6 @@ H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src,
void *native_src, H5F_t *file_dst, hbool_t *recompute_size,
H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id)
{
- void *native_mesg = NULL;
void *ret_value;
FUNC_ENTER_NOAPI_NOINIT(H5O_msg_copy_file)
@@ -1876,16 +1875,10 @@ H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src,
/* The copy_file callback will return an H5O_shared_t only if the message
* to be copied is a committed datatype.
*/
- if(NULL == (native_mesg = (type->copy_file)(file_src, native_src, file_dst, recompute_size, cpy_info, udata, dxpl_id)))
+ if(NULL == (ret_value = (type->copy_file)(file_src, native_src, file_dst, recompute_size, cpy_info, udata, dxpl_id)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object header message to file")
- /* Set return value */
- ret_value = native_mesg;
-
done:
- if(NULL == ret_value && native_mesg)
- H5O_msg_free(type->id, native_mesg);
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_copy_file() */
@@ -1988,8 +1981,10 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
if(NULL == (idx_msg->native = (type->copy)(mesg, idx_msg->native)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy message to object header")
- /* Update the message flags and mark the message as modified */
+ /* Update the message flags */
idx_msg->flags = mesg_flags;
+
+ /* Mark the message as modified */
idx_msg->dirty = TRUE;
/* Update the modification time, if requested */
@@ -1998,7 +1993,7 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object")
/* Mark object header as dirty in cache */
- if(H5AC_mark_pinned_or_protected_entry_dirty(f, oh) < 0)
+ if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
done:
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index edb5d94..3b738a4 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -222,8 +222,8 @@ struct H5O_msg_class_t {
const char *name; /*for debugging */
size_t native_size; /*size of native message */
unsigned share_flags; /* Message sharing settings */
- void *(*decode)(H5F_t*, hid_t, H5O_t *, unsigned, unsigned *, const uint8_t *);
- herr_t (*encode)(H5F_t*, hbool_t, uint8_t*, const void *);
+ void *(*decode)(H5F_t *, hid_t, H5O_t *, unsigned, unsigned *, const uint8_t *);
+ herr_t (*encode)(H5F_t *, hbool_t, uint8_t *, const void *);
void *(*copy)(const void *, void *); /*copy native value */
size_t (*raw_size)(const H5F_t *, hbool_t, const void *);/*sizeof encoded message */
herr_t (*reset)(void *); /*free nested data structs */
@@ -260,7 +260,7 @@ typedef struct H5O_chunk_t {
} H5O_chunk_t;
struct H5O_t {
- H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
+ H5AC_info_t cache_info; /* Information for metadata cache functions, _must_ be */
/* first field in structure */
/* File-specific information (not stored) */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index db2dab8..d7e4e04 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -675,8 +675,8 @@ H5_DLL herr_t H5O_close(H5O_loc_t *loc);
H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id);
H5_DLL int H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags);
H5_DLL H5O_t *H5O_pin(H5O_loc_t *loc, hid_t dxpl_id);
-H5_DLL herr_t H5O_unpin(H5O_loc_t *loc, H5O_t *oh);
-H5_DLL herr_t H5O_touch(H5O_loc_t *loc, hbool_t force, hid_t dxpl_id);
+H5_DLL herr_t H5O_unpin(H5O_t *oh);
+H5_DLL herr_t H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id);
H5_DLL herr_t H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
hbool_t force);
#ifdef H5O_ENABLE_BOGUS
diff --git a/src/H5Otest.c b/src/H5Otest.c
index c7cd8a9..5282538 100644
--- a/src/H5Otest.c
+++ b/src/H5Otest.c
@@ -97,24 +97,24 @@ H5O_is_attr_dense_test(hid_t oid)
{
H5O_t *oh = NULL; /* Object header */
H5O_ainfo_t ainfo; /* Attribute information for object */
- H5O_loc_t *oloc; /* Pointer to object's location */
+ H5O_loc_t *loc; /* Pointer to object's location */
htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5O_is_attr_dense_test, FAIL)
/* Get object location for object */
- if(NULL == (oloc = H5O_get_loc(oid)))
+ if(NULL == (loc = H5O_get_loc(oid)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
/* Get the object header */
- if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if(H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0)
+ if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
@@ -129,8 +129,8 @@ H5O_is_attr_dense_test(hid_t oid)
ret_value = FALSE;
done:
- if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_is_attr_dense_test() */
@@ -161,24 +161,24 @@ H5O_is_attr_empty_test(hid_t oid)
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5O_ainfo_t ainfo; /* Attribute information for object */
htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */
- H5O_loc_t *oloc; /* Pointer to object's location */
+ H5O_loc_t *loc; /* Pointer to object's location */
hsize_t nattrs; /* Number of attributes */
htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5O_is_attr_empty_test, FAIL)
/* Get object location for object */
- if(NULL == (oloc = H5O_get_loc(oid)))
+ if(NULL == (loc = H5O_get_loc(oid)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
/* Get the object header */
- if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if((ainfo_exists = H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo)) < 0)
+ if((ainfo_exists = H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
@@ -194,7 +194,7 @@ H5O_is_attr_empty_test(hid_t oid)
HDassert(nattrs == 0);
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(oloc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL)))
+ if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Retrieve # of records in name index */
@@ -216,8 +216,8 @@ done:
/* Release resources */
if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
- if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_is_attr_empty_test() */
@@ -248,25 +248,25 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
H5O_t *oh = NULL; /* Object header */
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5O_ainfo_t ainfo; /* Attribute information for object */
- H5O_loc_t *oloc; /* Pointer to object's location */
+ H5O_loc_t *loc; /* Pointer to object's location */
hsize_t obj_nattrs; /* Number of attributes */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_num_attrs_test, FAIL)
/* Get object location for object */
- if(NULL == (oloc = H5O_get_loc(oid)))
+ if(NULL == (loc = H5O_get_loc(oid)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
/* Get the object header */
- if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if(H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0)
+ if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
@@ -281,7 +281,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
HDassert(obj_nattrs == 0);
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(oloc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL)))
+ if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Retrieve # of records in name index */
@@ -300,8 +300,8 @@ done:
/* Release resources */
if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
- if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_num_attrs_test() */
@@ -335,24 +335,24 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */
H5O_ainfo_t ainfo; /* Attribute information for object */
- H5O_loc_t *oloc; /* Pointer to object's location */
+ H5O_loc_t *loc; /* Pointer to object's location */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_attr_dense_info_test, FAIL)
/* Get object location for object */
- if(NULL == (oloc = H5O_get_loc(oid)))
+ if(NULL == (loc = H5O_get_loc(oid)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
/* Get the object header */
- if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Check for attribute info stored */
ainfo.fheap_addr = HADDR_UNDEF;
if(oh->version > H5O_VERSION_1) {
/* Check for (& retrieve if available) attribute info */
- if(H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0)
+ if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message")
} /* end if */
@@ -363,7 +363,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
HGOTO_DONE(FAIL)
/* Open the name index v2 B-tree */
- if(NULL == (bt2_name = H5B2_open(oloc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL)))
+ if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Retrieve # of records in name index */
@@ -373,7 +373,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
/* Check if there is a creation order index */
if(H5F_addr_defined(ainfo.corder_bt2_addr)) {
/* Open the creation order index v2 B-tree */
- if(NULL == (bt2_corder = H5B2_open(oloc->file, H5AC_ind_dxpl_id, ainfo.corder_bt2_addr, NULL)))
+ if(NULL == (bt2_corder = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.corder_bt2_addr, NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
/* Retrieve # of records in creation order index */
@@ -389,8 +389,8 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
if(bt2_corder && H5B2_close(bt2_corder, H5AC_ind_dxpl_id) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index")
- if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_attr_dense_info_test() */
@@ -421,7 +421,7 @@ herr_t
H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val)
{
H5O_t *oh = NULL; /* Object header */
- H5O_loc_t *oloc; /* Pointer to object's location */
+ H5O_loc_t *loc; /* Pointer to object's location */
H5O_mesg_t *idx_msg; /* Pointer to message */
unsigned idx; /* Index of message */
herr_t ret_value = SUCCEED; /* Return value */
@@ -429,12 +429,12 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val)
FUNC_ENTER_NOAPI(H5O_check_msg_marked_test, FAIL)
/* Get object location for object */
- if(NULL == (oloc = H5O_get_loc(oid)))
+ if(NULL == (loc = H5O_get_loc(oid)))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
/* Get the object header */
- if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
/* Locate "unknown" message */
for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++)
@@ -452,8 +452,8 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "'unknown' message type not found")
done:
- if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+ if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5O_check_msg_marked_test() */
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 17e1011..f62d47c 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1488,13 +1488,13 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
/* Convert the fill value */
if(H5T_convert(tpath, type_id, type_id, (size_t)1, (size_t)0, (size_t)0, fill.buf, bkg_buf, H5AC_ind_dxpl_id) < 0) {
if(bkg_buf)
- (void)H5FL_BLK_FREE(type_conv, bkg_buf);
+ bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf);
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed")
} /* end if */
/* Release the background buffer */
if(bkg_buf)
- (void)H5FL_BLK_FREE(type_conv, bkg_buf);
+ bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf);
} /* end if */
} /* end if */
else
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 486bda3..5d73afe 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -1336,27 +1336,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_mdc_config(hid_t plist_id,
- H5AC_cache_config_t *config_ptr)
+H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_mdc_config, FAIL);
+ FUNC_ENTER_API(H5Pset_mdc_config, FAIL)
H5TRACE2("e", "i*x", plist_id, config_ptr);
/* Get the plist structure */
- if( NULL == ( plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS) ) ) {
-
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- }
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* validate the new configuration */
- if ( H5AC_validate_config(config_ptr) < 0 ) {
-
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \
- "invalid metadata cache configuration");
- }
+ if(H5AC_validate_config(config_ptr) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid metadata cache configuration")
/* set the modified config */
@@ -1364,16 +1358,11 @@ H5Pset_mdc_config(hid_t plist_id,
* will have to test the version and do translation here.
*/
- if(H5P_set(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr)<0) {
-
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, \
- "can't set metadata cache initial config");
- }
+ if(H5P_set(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache initial config")
done:
-
FUNC_LEAVE_API(ret_value);
-
} /* H5Pset_mdc_config() */
@@ -1398,33 +1387,25 @@ done:
*
*-------------------------------------------------------------------------
*/
-
herr_t
-H5Pget_mdc_config(hid_t plist_id,
- H5AC_cache_config_t *config_ptr)
+H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr)
{
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pget_mdc_config, FAIL);
+ FUNC_ENTER_API(H5Pget_mdc_config, FAIL)
H5TRACE2("e", "i*x", plist_id, config_ptr);
/* Get the plist structure */
- if ( NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)) ) {
-
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- }
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* validate the config_ptr */
- if ( config_ptr == NULL ) {
-
+ if(config_ptr == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.")
- }
-
- if ( config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION ) {
+ if(config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.")
- }
/* If we ever support multiple versions of H5AC_cache_config_t, we
* will have to get the cannonical version here, and then translate
@@ -1432,16 +1413,11 @@ H5Pget_mdc_config(hid_t plist_id,
*/
/* Get the current initial metadata cache resize configuration */
- if ( H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0 ) {
-
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, \
- "can't get metadata cache initial resize config");
- }
+ if(H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get metadata cache initial resize config")
done:
-
- FUNC_LEAVE_API(ret_value);
-
+ FUNC_LEAVE_API(ret_value)
} /* H5Pget_mdc_config() */
diff --git a/src/H5S.c b/src/H5S.c
index c723127..83ee11c 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -19,7 +19,6 @@
#define H5_INTERFACE_INIT_FUNC H5S_init_interface
-#define _H5S_IN_H5S_C
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
@@ -207,8 +206,10 @@ H5S_create(H5S_class_t type)
ret_value = new_ds;
done:
- if(ret_value == NULL && new_ds)
- H5S_close(new_ds);
+ if(ret_value == NULL) {
+ if(new_ds && H5S_close(new_ds) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, NULL, "unable to release dataspace")
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_create() */
@@ -238,7 +239,7 @@ H5Screate(H5S_class_t type)
H5S_t *new_ds=NULL; /* New dataspace structure */
hid_t ret_value; /* Return value */
- FUNC_ENTER_API(H5Screate, FAIL);
+ FUNC_ENTER_API(H5Screate, FAIL)
H5TRACE1("i", "Sc", type);
/* Check args */
@@ -253,10 +254,12 @@ H5Screate(H5S_class_t type)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
done:
- if(ret_value < 0 && new_ds)
- H5S_close(new_ds);
+ if(ret_value < 0) {
+ if(new_ds && H5S_close(new_ds) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
+ } /* end if */
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Screate() */
@@ -279,7 +282,7 @@ H5S_extent_release(H5S_extent_t *extent)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5S_extent_release, FAIL);
+ FUNC_ENTER_NOAPI(H5S_extent_release, FAIL)
assert(extent);
@@ -292,7 +295,7 @@ H5S_extent_release(H5S_extent_t *extent)
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_extent_release() */
@@ -311,20 +314,22 @@ done:
herr_t
H5S_close(H5S_t *ds)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5S_close, FAIL)
HDassert(ds);
/* Release selection (this should come before the extent release) */
- H5S_SELECT_RELEASE(ds);
+ if(H5S_SELECT_RELEASE(ds) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace selection")
/* Release extent */
- H5S_extent_release(&ds->extent);
+ if(H5S_extent_release(&ds->extent) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent")
/* Release the main structure */
- (void)H5FL_FREE(H5S_t, ds);
+ ds = H5FL_FREE(H5S_t, ds);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -352,7 +357,7 @@ H5Sclose(hid_t space_id)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Sclose, FAIL);
+ FUNC_ENTER_API(H5Sclose, FAIL)
H5TRACE1("e", "i", space_id);
/* Check args */
@@ -364,7 +369,7 @@ H5Sclose(hid_t space_id)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -391,29 +396,29 @@ H5Scopy(hid_t space_id)
H5S_t *dst = NULL;
hid_t ret_value;
- FUNC_ENTER_API(H5Scopy, FAIL);
+ FUNC_ENTER_API(H5Scopy, FAIL)
H5TRACE1("i", "i", space_id);
/* Check args */
- if (NULL==(src=(H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if(NULL == (src = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
/* Copy */
- if (NULL == (dst = H5S_copy(src, FALSE, TRUE)))
+ if(NULL == (dst = H5S_copy(src, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace")
/* Atomize */
- if ((ret_value=H5I_register (H5I_DATASPACE, dst, TRUE))<0)
+ if((ret_value = H5I_register (H5I_DATASPACE, dst, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
done:
- if(ret_value<0) {
- if(dst!=NULL)
- H5S_close(dst);
+ if(ret_value < 0) {
+ if(dst && H5S_close(dst) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
} /* end if */
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Scopy() */
/*-------------------------------------------------------------------------
@@ -565,6 +570,10 @@ H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max)
ret_value = dst;
done:
+ if(NULL == ret_value)
+ if(dst)
+ dst = H5FL_FREE(H5S_t, dst);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_copy() */
@@ -672,7 +681,7 @@ H5S_get_npoints_max(const H5S_t *ds)
hsize_t ret_value;
unsigned u;
- FUNC_ENTER_NOAPI(H5S_get_npoints_max, 0);
+ FUNC_ENTER_NOAPI(H5S_get_npoints_max, 0)
/* check args */
assert(ds);
@@ -709,7 +718,7 @@ H5S_get_npoints_max(const H5S_t *ds)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -826,7 +835,7 @@ H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[]/*out*/,
H5S_t *ds;
int ret_value;
- FUNC_ENTER_API(H5Sget_simple_extent_dims, FAIL);
+ FUNC_ENTER_API(H5Sget_simple_extent_dims, FAIL)
H5TRACE3("Is", "ixx", space_id, dims, maxdims);
/* Check args */
@@ -836,7 +845,7 @@ H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[]/*out*/,
ret_value = H5S_get_simple_extent_dims(ds, dims, maxdims);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1106,7 +1115,7 @@ H5Sis_simple(hid_t space_id)
H5S_t *space; /* dataspace to modify */
htri_t ret_value;
- FUNC_ENTER_API(H5Sis_simple, FAIL);
+ FUNC_ENTER_API(H5Sis_simple, FAIL)
H5TRACE1("t", "i", space_id);
/* Check args and all the boring stuff. */
@@ -1116,7 +1125,7 @@ H5Sis_simple(hid_t space_id)
ret_value = H5S_is_simple(space);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1160,7 +1169,7 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/],
int u; /* local counting variable */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Sset_extent_simple, FAIL);
+ FUNC_ENTER_API(H5Sset_extent_simple, FAIL)
H5TRACE4("e", "iIs*[a1]h*[a1]h", space_id, rank, dims, max);
/* Check args */
@@ -1192,7 +1201,7 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/],
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set simple extent")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1291,67 +1300,66 @@ done:
*
* Failure: Negative
*
- * Errors:
- *
* Programmer: Quincey Koziol
* Tuesday, January 27, 1998
*
- * Modifications: Christian Chilan 01/17/2007
- * Verifies that each element of DIMS is not equal to
- * H5S_UNLIMITED.
- *
*-------------------------------------------------------------------------
*/
hid_t
H5Screate_simple(int rank, const hsize_t dims[/*rank*/],
const hsize_t maxdims[/*rank*/])
{
- hid_t ret_value;
H5S_t *space = NULL;
int i;
+ hid_t ret_value;
- FUNC_ENTER_API(H5Screate_simple, FAIL);
+ FUNC_ENTER_API(H5Screate_simple, FAIL)
H5TRACE3("i", "Is*[a0]h*[a0]h", rank, dims, maxdims);
/* Check arguments */
- if (rank<0)
+ if(rank < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality cannot be negative")
- if (rank>H5S_MAX_RANK)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality is too large")
- if (!dims && dims!=0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified")
+ if(rank > H5S_MAX_RANK)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality is too large")
+
+ /* We allow users to use this function to create scalar or null dataspace.
+ * Check DIMS isn't set when the RANK is 0.
+ */
+ if(!dims && rank != 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dataspace information")
+
/* Check whether the current dimensions are valid */
- for (i=0; i<rank; i++) {
- if (H5S_UNLIMITED==dims[i])
+ for(i = 0; i < rank; i++) {
+ if(H5S_UNLIMITED == dims[i])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "current dimension must have a specific size, not H5S_UNLIMITED")
- if (maxdims) {
- if (H5S_UNLIMITED!=maxdims[i] && maxdims[i]<dims[i])
+ if(maxdims) {
+ if(H5S_UNLIMITED != maxdims[i] && maxdims[i]<dims[i])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maxdims is smaller than dims")
- if (H5S_UNLIMITED!=maxdims[i] && dims[i]==0)
+ if(H5S_UNLIMITED != maxdims[i] && dims[i] == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "zero sized dimension for non-unlimited dimension")
- }
+ } /* end if */
else {
- if (dims[i]==0)
+ if(dims[i] == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "zero sized dimension for non-unlimited dimension")
- }
- }
+ } /* end else */
+ } /* end else */
/* Create the space and set the extent */
- if(NULL==(space=H5S_create_simple((unsigned)rank,dims,maxdims)))
+ if(NULL == (space = H5S_create_simple((unsigned)rank,dims,maxdims)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace")
/* Atomize */
- if ((ret_value=H5I_register (H5I_DATASPACE, space, TRUE))<0)
+ if((ret_value = H5I_register (H5I_DATASPACE, space, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
done:
- if (ret_value<0) {
- if (space!=NULL)
- H5S_close(space);
+ if(ret_value < 0) {
+ if(space && H5S_close(space) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace")
} /* end if */
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Screate_simple() */
/*-------------------------------------------------------------------------
@@ -1379,7 +1387,7 @@ H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/],
{
H5S_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5S_create_simple, NULL);
+ FUNC_ENTER_NOAPI(H5S_create_simple, NULL)
/* Check arguments */
assert(rank <=H5S_MAX_RANK);
@@ -1391,7 +1399,7 @@ H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/],
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "can't set dimensions")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_create_simple() */
@@ -1419,7 +1427,7 @@ H5Sencode(hid_t obj_id, void *buf, size_t *nalloc)
H5S_t *dspace;
herr_t ret_value=SUCCEED;
- FUNC_ENTER_API (H5Sencode, FAIL);
+ FUNC_ENTER_API (H5Sencode, FAIL)
H5TRACE3("e", "i*x*z", obj_id, buf, nalloc);
/* Check argument and retrieve object */
@@ -1430,7 +1438,7 @@ H5Sencode(hid_t obj_id, void *buf, size_t *nalloc)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1462,7 +1470,7 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc)
FUNC_ENTER_NOAPI_NOINIT(H5S_encode)
/* Allocate "fake" file structure */
- if(NULL == (f = H5F_fake_alloc((size_t)0)))
+ if(NULL == (f = H5F_fake_alloc((uint8_t)0)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct")
/* Find out the size of buffer needed for extent */
@@ -1573,7 +1581,7 @@ H5S_decode(const unsigned char *buf)
H5S_extent_t *extent;
size_t extent_size; /* size of the extent message*/
H5F_t *f = NULL; /* Fake file structure*/
- size_t sizeof_size; /* 'Size of sizes' for file */
+ uint8_t sizeof_size; /* 'Size of sizes' for file */
H5S_t *ret_value;
FUNC_ENTER_NOAPI_NOINIT(H5S_decode)
@@ -1658,14 +1666,14 @@ H5S_get_simple_extent_type(const H5S_t *space)
{
H5S_class_t ret_value;
- FUNC_ENTER_NOAPI(H5S_get_simple_extent_type, H5S_NO_CLASS);
+ FUNC_ENTER_NOAPI(H5S_get_simple_extent_type, H5S_NO_CLASS)
assert(space);
ret_value=H5S_GET_EXTENT_TYPE(space);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -1693,7 +1701,7 @@ H5Sget_simple_extent_type(hid_t sid)
H5S_t *space;
H5S_class_t ret_value;
- FUNC_ENTER_API(H5Sget_simple_extent_type, H5S_NO_CLASS);
+ FUNC_ENTER_API(H5Sget_simple_extent_type, H5S_NO_CLASS)
H5TRACE1("Sc", "i", sid);
/* Check arguments */
@@ -1703,7 +1711,7 @@ H5Sget_simple_extent_type(hid_t sid)
ret_value=H5S_GET_EXTENT_TYPE(space);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1727,7 +1735,7 @@ H5Sset_extent_none(hid_t space_id)
H5S_t *space; /* dataspace to modify */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Sset_extent_none, FAIL);
+ FUNC_ENTER_API(H5Sset_extent_none, FAIL)
H5TRACE1("e", "i", space_id);
/* Check args */
@@ -1741,7 +1749,7 @@ H5Sset_extent_none(hid_t space_id)
space->extent.type=H5S_NO_CLASS;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Sset_extent_none() */
@@ -1767,7 +1775,7 @@ H5Soffset_simple(hid_t space_id, const hssize_t *offset)
H5S_t *space; /* dataspace to modify */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Soffset_simple, FAIL);
+ FUNC_ENTER_API(H5Soffset_simple, FAIL)
H5TRACE2("e", "i*Hs", space_id, offset);
/* Check args */
@@ -1784,7 +1792,7 @@ H5Soffset_simple(hid_t space_id, const hssize_t *offset)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set offset")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Soffset_simple() */
@@ -1854,9 +1862,9 @@ done:
hbool_t
H5S_has_extent(const H5S_t *ds)
{
- htri_t ret_value;
+ hbool_t ret_value;
- FUNC_ENTER_NOAPI(H5S_has_extent, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_has_extent)
HDassert(ds);
@@ -1865,7 +1873,6 @@ H5S_has_extent(const H5S_t *ds)
else
ret_value = TRUE;
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_has_extent() */
diff --git a/src/H5SM.c b/src/H5SM.c
index cbb063b..9a97d88 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -2248,7 +2248,7 @@ H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap,
/* Load the object header from the cache */
if(NULL == (oh = (H5O_t *)H5AC_protect(oloc.file, dxpl_id, H5AC_OHDR, oloc.addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to load object header")
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header")
} /* end if */
else
oh = open_oh;
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index 1380e71..070b00e 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -175,7 +175,7 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
/* Don't count the checksum in the table size yet, since it comes after
* all of the index headers
*/
- HDassert((size_t)(p - buf) == H5SM_TABLE_SIZE(f) - H5SM_SIZEOF_CHECKSUM);
+ HDassert((size_t)(p - (const uint8_t *)buf) == H5SM_TABLE_SIZE(f) - H5SM_SIZEOF_CHECKSUM);
/* Allocate space for the index headers in memory*/
if(NULL == (table->indexes = (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes)))
@@ -216,7 +216,7 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
UINT32DECODE(p, stored_chksum);
/* Sanity check */
- HDassert((size_t)(p - buf) == size);
+ HDassert((size_t)(p - (const uint8_t *)buf) == size);
/* Compute checksum on entire header */
computed_chksum = H5_checksum_metadata(buf, (size - H5SM_SIZEOF_CHECKSUM), 0);
@@ -257,7 +257,7 @@ H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma
{
H5WB_t *wb = NULL; /* Wrapped buffer for table data */
uint8_t tbl_buf[H5SM_TBL_BUF_SIZE]; /* Buffer for table */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5SM_table_flush)
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 1c086b9..115d5d35 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -630,7 +630,7 @@ H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_all_offset(const H5S_t *space, hsize_t *offset)
+H5S_all_offset(const H5S_t UNUSED *space, hsize_t *offset)
{
FUNC_ENTER_NOAPI_NOFUNC(H5S_all_offset)
@@ -828,7 +828,7 @@ done:
herr_t
H5Sselect_all(hid_t spaceid)
{
- H5S_t *space; /* Dataspace to modify selection of */
+ H5S_t *space; /* Dataspace to modify selection of */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(H5Sselect_all, FAIL)
@@ -839,7 +839,7 @@ H5Sselect_all(hid_t spaceid)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* Call internal routine to do the work */
- if((ret_value = H5S_select_all(space, TRUE)) < 0)
+ if(H5S_select_all(space, TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
done:
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 21e08d4..bdcdc28 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -3531,58 +3531,61 @@ done:
herr_t
H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hsize_t *coords)
{
- herr_t ret_value=SUCCEED; /* Return value */
+ H5S_hyper_span_info_t *head = NULL; /* Pointer to new head of span tree */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_add_span_element);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_add_span_element)
- assert(space);
- assert(rank>0);
- assert(coords);
+ HDassert(space);
+ HDassert(rank > 0);
+ HDassert(coords);
/* Check if this is the first element in the selection */
- if(space->select.sel_info.hslab==NULL) {
- H5S_hyper_span_info_t *head; /* Pointer to new head of span tree */
-
+ if(NULL == space->select.sel_info.hslab) {
/* Allocate a span info node */
- if((head = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ if(NULL == (head = H5FL_MALLOC(H5S_hyper_span_info_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Set the reference count */
- head->count=1;
+ head->count = 1;
/* Reset the scratch pad space */
- head->scratch=0;
+ head->scratch = 0;
/* Build span tree for this coordinate */
- if((head->head=H5S_hyper_coord_to_span(rank,coords))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ if(NULL == (head->head = H5S_hyper_coord_to_span(rank, coords)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Allocate selection info */
- if((space->select.sel_info.hslab=H5FL_MALLOC(H5S_hyper_sel_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info");
+ if(NULL == (space->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
/* Set the selection to the new span tree */
- space->select.sel_info.hslab->span_lst=head;
+ space->select.sel_info.hslab->span_lst = head;
/* Set selection type */
- space->select.type=H5S_sel_hyper;
+ space->select.type = H5S_sel_hyper;
/* Reset "regular" hyperslab flag */
- space->select.sel_info.hslab->diminfo_valid=FALSE;
+ space->select.sel_info.hslab->diminfo_valid = FALSE;
/* Set # of elements in selection */
- space->select.num_elem=1;
+ space->select.num_elem = 1;
} /* end if */
else {
- if(H5S_hyper_add_span_element_helper(space->select.sel_info.hslab->span_lst,rank,coords)<0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ if(H5S_hyper_add_span_element_helper(space->select.sel_info.hslab->span_lst, rank, coords) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Increment # of elements in selection */
space->select.num_elem++;
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ if(ret_value < 0)
+ if(head)
+ H5S_hyper_free_span_info(head);
+
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_add_span_element() */
@@ -4382,13 +4385,13 @@ done:
static herr_t
H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** span_tree, hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
{
- H5S_hyper_span_t *new_span;
- herr_t ret_value=SUCCEED; /* Return value */
+ H5S_hyper_span_t *new_span = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_append_span);
- assert(prev_span);
- assert(span_tree);
+ HDassert(prev_span);
+ HDassert(span_tree);
/* Check for adding first node to merged spans */
if(*prev_span==NULL) {
@@ -4452,7 +4455,13 @@ H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** sp
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ if(ret_value < 0) {
+ if(new_span)
+ if(H5S_hyper_free_span(new_span) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "failed to release new hyperslab span")
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_append_span() */
@@ -5264,9 +5273,15 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
} /* end else */
/* Set return value */
- ret_value=merged_spans;
+ ret_value = merged_spans;
done:
+ if(ret_value == NULL) {
+ if(merged_spans)
+ if(H5S_hyper_free_span_info(merged_spans) < 0)
+ HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, NULL, "failed to release merged hyperslab spans")
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_hyper_merge_spans_helper() */
@@ -5409,85 +5424,109 @@ static H5S_hyper_span_info_t *
H5S_hyper_make_spans (unsigned rank, const hsize_t *start, const hsize_t *stride,
const hsize_t *count, const hsize_t *block)
{
- H5S_hyper_span_info_t *down;/* Pointer to spans in next dimension down */
- H5S_hyper_span_t *span; /* New hyperslab span */
- H5S_hyper_span_t *last_span;/* Current position in hyperslab span list */
- H5S_hyper_span_t *head; /* Head of new hyperslab span list */
- hsize_t stride_iter; /* Iterator over the stride values */
- int i; /* Counters */
- unsigned u; /* Counters */
- H5S_hyper_span_info_t *ret_value;
+ H5S_hyper_span_info_t *down; /* Pointer to spans in next dimension down */
+ H5S_hyper_span_t *span; /* New hyperslab span */
+ H5S_hyper_span_t *last_span; /* Current position in hyperslab span list */
+ H5S_hyper_span_t *head; /* Head of new hyperslab span list */
+ hsize_t stride_iter; /* Iterator over the stride values */
+ int i; /* Counters */
+ unsigned u; /* Counters */
+ H5S_hyper_span_info_t *ret_value = NULL;
FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_make_spans);
/* Check args */
- assert (rank>0);
- assert (start);
- assert (stride);
- assert (count);
- assert (block);
+ HDassert(rank > 0);
+ HDassert(start);
+ HDassert(stride);
+ HDassert(count);
+ HDassert(block);
/* Start creating spans in fastest changing dimension */
- down=NULL;
- for(i=(rank-1); i>=0; i--) {
+ down = NULL;
+ for(i = (rank - 1); i >= 0; i--) {
/* Start a new list in this dimension */
- head=last_span=NULL;
+ head = NULL;
+ last_span = NULL;
- /* Generate all the spans segments for this dimension */
- for(u=0, stride_iter=0; u<count[i]; u++,stride_iter+=stride[i]) {
+ /* Generate all the span segments for this dimension */
+ for(u = 0, stride_iter = 0; u < count[i]; u++, stride_iter += stride[i]) {
/* Allocate a span node */
- if((span = H5FL_MALLOC(H5S_hyper_span_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ if(NULL == (span = H5FL_MALLOC(H5S_hyper_span_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Set the span's basic information */
- span->low=start[i]+stride_iter;
- span->high=span->low+(block[i]-1);
- span->nelem=block[i];
- span->pstride=stride[i];
- span->next=NULL;
+ span->low = start[i] + stride_iter;
+ span->high = span->low + (block[i]-1);
+ span->nelem = block[i];
+ span->pstride = stride[i];
+ span->next = NULL;
/* Append to the list of spans in this dimension */
- if(head==NULL)
- head=span;
+ if(head == NULL)
+ head = span;
else
- last_span->next=span;
+ last_span->next = span;
/* Move current pointer */
- last_span=span;
+ last_span = span;
/* Set the information for the next dimension down's spans, if appropriate */
- if(down!=NULL) {
- span->down=down;
+ if(down != NULL) {
+ span->down = down;
down->count++; /* Increment reference count for shared span */
} /* end if */
else {
- span->down=NULL;
+ span->down = NULL;
} /* end else */
} /* end for */
/* Allocate a span info node */
- if((down = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
+ if(NULL == (down = H5FL_MALLOC(H5S_hyper_span_info_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
/* Set the reference count */
- down->count=0;
+ down->count = 0;
/* Reset the scratch pad space */
- down->scratch=0;
+ down->scratch = 0;
/* Keep the pointer to the next dimension down's completed list */
- down->head=head;
+ down->head = head;
} /* end for */
/* Indicate that there is a pointer to this tree */
- down->count=1;
+ down->count = 1;
/* Success! Return the head of the list in the slowest changing dimension */
- ret_value=down;
+ ret_value = down;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ /* cleanup if error (ret_value will be NULL) */
+ if(!ret_value) {
+ if(head || down) {
+ if(head && down)
+ if(down->head != head)
+ down = NULL;
+
+ do {
+ if(down) {
+ head = down->head;
+ (void)H5FL_FREE(H5S_hyper_span_info_t, down);
+ } /* end if */
+ down = head->down;
+
+ while(head) {
+ last_span = head->next;
+ (void)H5FL_FREE(H5S_hyper_span_t, head);
+ head = last_span;
+ } /* end while */
+ } while(down);
+ } /* end if */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_make_spans() */
@@ -5929,14 +5968,6 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
} /* end switch */
- /* Free the hyperslab trees generated from the clipping algorithm */
- if(a_not_b)
- H5S_hyper_free_span_info(a_not_b);
- if(a_and_b)
- H5S_hyper_free_span_info(a_and_b);
- if(b_not_a)
- H5S_hyper_free_span_info(b_not_a);
-
/* Check if the resulting hyperslab span tree is empty */
if(space->select.sel_info.hslab->span_lst==NULL) {
H5S_hyper_span_info_t *spans; /* Empty hyperslab span tree */
@@ -5973,10 +6004,19 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
} /* end else */
done:
- /* Free the new spans */
- if(new_spans!=NULL)
- if(H5S_hyper_free_span_info(new_spans)<0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans");
+ /* Free resources */
+ if(a_not_b)
+ if(H5S_hyper_free_span_info(a_not_b) < 0)
+ HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
+ if(a_and_b)
+ if(H5S_hyper_free_span_info(a_and_b) < 0)
+ HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
+ if(b_not_a)
+ if(H5S_hyper_free_span_info(b_not_a) < 0)
+ HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
+ if(new_spans)
+ if(H5S_hyper_free_span_info(new_spans) < 0)
+ HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5S_generate_hyperslab() */
@@ -6946,7 +6986,7 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
/* Copy the first dataspace */
if (NULL == (new_space = H5S_copy (space, TRUE, TRUE)))
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space");
/* Go modify the selection in the new dataspace */
if (H5S_select_hyperslab(new_space, op, start, stride, count, block)<0)
@@ -6954,7 +6994,7 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
/* Atomize */
if ((ret_value=H5I_register (H5I_DATASPACE, new_space, TRUE))<0)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom");
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom");
done:
if (ret_value<0 && new_space)
@@ -7002,7 +7042,7 @@ H5S_combine_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
/* Copy the first dataspace */
if (NULL == (new_space = H5S_copy (space1, TRUE, TRUE)))
- HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space");
/* Free the current selection for the new dataspace */
if(H5S_SELECT_RELEASE(new_space)<0)
@@ -7082,7 +7122,7 @@ H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
/* Atomize */
if ((ret_value=H5I_register (H5I_DATASPACE, new_space, TRUE))<0)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom");
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom");
done:
if (ret_value<0 && new_space)
@@ -7533,6 +7573,7 @@ partial_done: /* Yes, goto's are evil, so sue me... :-) */
/* Check if we are done */
if(io_bytes_left==0 || curr_seq>=maxseq) {
+ HDassert(curr_span);
abs_arr[fast_dim]=curr_span->low+(span_size/elem_size);
/* Check if we are still within the span */
diff --git a/src/H5Snone.c b/src/H5Snone.c
index fdea677..c6e8a6a 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -586,7 +586,7 @@ H5S_none_bounds(const H5S_t UNUSED *space, hsize_t UNUSED *start, hsize_t UNUSED
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_none_offset(const H5S_t *space, hsize_t *offset)
+H5S_none_offset(const H5S_t UNUSED *space, hsize_t UNUSED *offset)
{
FUNC_ENTER_NOAPI_NOFUNC(H5S_none_offset)
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 84b427e..5f4c74d 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -119,11 +119,11 @@ H5FL_DEFINE_STATIC(H5S_pnt_list_t);
herr_t
H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5S_point_iter_init);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_point_iter_init)
/* Check args */
- assert (space && H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(space));
- assert (iter);
+ HDassert(space && H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(space));
+ HDassert(iter);
/* Initialize the number of points to iterate over */
iter->elmt_left=space->select.num_elem;
@@ -134,7 +134,7 @@ H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
/* Initialize type of selection iterator */
iter->type=H5S_sel_iter_point;
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_point_iter_init() */
@@ -156,16 +156,16 @@ H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
static herr_t
H5S_point_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_coords);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_coords)
/* Check args */
- assert (iter);
- assert (coords);
+ HDassert(iter);
+ HDassert(coords);
/* Copy the offset of the current point */
HDmemcpy(coords,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_point_iter_coords() */
@@ -187,18 +187,18 @@ H5S_point_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords)
static herr_t
H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_block);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_block)
/* Check args */
- assert (iter);
- assert (start);
- assert (end);
+ HDassert(iter);
+ HDassert(start);
+ HDassert(end);
/* Copy the current point as a block */
HDmemcpy(start,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
HDmemcpy(end,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_point_iter_block() */
@@ -219,12 +219,12 @@ H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
static hsize_t
H5S_point_iter_nelmts (const H5S_sel_iter_t *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_nelmts);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_nelmts)
/* Check args */
- assert (iter);
+ HDassert(iter);
- FUNC_LEAVE_NOAPI(iter->elmt_left);
+ FUNC_LEAVE_NOAPI(iter->elmt_left)
} /* H5S_point_iter_nelmts() */
@@ -250,17 +250,17 @@ H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter)
{
htri_t ret_value=TRUE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_has_next_block);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_has_next_block)
/* Check args */
- assert (iter);
+ HDassert(iter);
/* Check if there is another point in the list */
if(iter->u.pnt.curr->next==NULL)
HGOTO_DONE(FALSE);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_point_iter_has_next_block() */
@@ -285,11 +285,11 @@ done:
static herr_t
H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_next);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_next)
/* Check args */
- assert (iter);
- assert (nelem>0);
+ HDassert(iter);
+ HDassert(nelem>0);
/* Increment the iterator */
while(nelem>0) {
@@ -297,7 +297,7 @@ H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem)
nelem--;
} /* end while */
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_point_iter_next() */
@@ -321,15 +321,15 @@ H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem)
static herr_t
H5S_point_iter_next_block(H5S_sel_iter_t *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_next_block);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_next_block)
/* Check args */
- assert (iter);
+ HDassert(iter);
/* Increment the iterator */
iter->u.pnt.curr=iter->u.pnt.curr->next;
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_point_iter_next_block() */
@@ -353,12 +353,12 @@ H5S_point_iter_next_block(H5S_sel_iter_t *iter)
static herr_t
H5S_point_iter_release (H5S_sel_iter_t UNUSED * iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_release);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_release)
/* Check args */
- assert (iter);
+ HDassert(iter);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_point_iter_release() */
@@ -471,10 +471,10 @@ H5S_point_release (H5S_t *space)
{
H5S_pnt_node_t *curr, *next; /* Point selection nodes */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_release);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_release)
/* Check args */
- assert (space);
+ HDassert(space);
/* Delete all the nodes from the list */
curr=space->select.sel_info.pnt_lst->head;
@@ -492,7 +492,7 @@ H5S_point_release (H5S_t *space)
/* Reset the number of elements in the selection */
space->select.num_elem=0;
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_point_release() */
@@ -584,42 +584,60 @@ done:
static herr_t
H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t UNUSED share_selection)
{
- H5S_pnt_node_t *curr, *new_node, *new_head; /* Point information nodes */
- herr_t ret_value=SUCCEED; /* return value */
+ H5S_pnt_node_t *curr, *new_node, *new_tail; /* Point information nodes */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_point_copy);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_point_copy)
- assert(src);
- assert(dst);
+ HDassert(src);
+ HDassert(dst);
/* Allocate room for the head of the point list */
- if((dst->select.sel_info.pnt_lst=H5FL_MALLOC(H5S_pnt_list_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node");
+ if(NULL == (dst->select.sel_info.pnt_lst = H5FL_MALLOC(H5S_pnt_list_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node")
- curr=src->select.sel_info.pnt_lst->head;
- new_head=NULL;
- while(curr!=NULL) {
- /* Create each point */
+ curr = src->select.sel_info.pnt_lst->head;
+ new_tail = NULL;
+ while(curr) {
+ /* Create new point */
if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node");
- if((new_node->pnt = (hsize_t *)H5MM_malloc(src->extent.rank*sizeof(hsize_t)))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information");
- HDmemcpy(new_node->pnt, curr->pnt, (src->extent.rank * sizeof(hsize_t)));
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node")
new_node->next = NULL;
+ if(NULL == (new_node->pnt = (hsize_t *)H5MM_malloc(src->extent.rank*sizeof(hsize_t)))) {
+ new_node = H5FL_FREE(H5S_pnt_node_t, new_node);
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information")
+ } /* end if */
+
+ /* Copy over the point's coordinates */
+ HDmemcpy(new_node->pnt, curr->pnt, (src->extent.rank * sizeof(hsize_t)));
/* Keep the order the same when copying */
- if(new_head==NULL)
- new_head=dst->select.sel_info.pnt_lst->head=new_node;
+ if(NULL == new_tail)
+ new_tail = dst->select.sel_info.pnt_lst->head = new_node;
else {
- new_head->next=new_node;
- new_head=new_node;
+ new_tail->next = new_node;
+ new_tail = new_node;
} /* end else */
- curr=curr->next;
+ curr = curr->next;
} /* end while */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ if(ret_value < 0) {
+ /* Traverse the (incomplete?) dst list, freeing all memory */
+ curr = dst->select.sel_info.pnt_lst->head;
+ while(curr) {
+ H5S_pnt_node_t *tmp_node = curr;
+
+ curr->pnt = H5MM_xfree(curr->pnt);
+ curr = curr->next;
+ tmp_node = H5FL_FREE(H5S_pnt_node_t, tmp_node);
+ } /* end while */
+
+ dst->select.sel_info.pnt_lst = H5FL_FREE(H5S_pnt_list_t, dst->select.sel_info.pnt_lst);
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_point_copy() */
@@ -650,9 +668,9 @@ H5S_point_is_valid (const H5S_t *space)
unsigned u; /* Counter */
htri_t ret_value=TRUE; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_valid);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_valid)
- assert(space);
+ HDassert(space);
/* Check each point to determine whether selection+offset is within extent */
curr = space->select.sel_info.pnt_lst->head;
@@ -670,7 +688,7 @@ H5S_point_is_valid (const H5S_t *space)
} /* end while */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_point_is_valid() */
@@ -738,9 +756,9 @@ H5S_point_serial_size (const H5S_t *space)
H5S_pnt_node_t *curr; /* Point information nodes */
hssize_t ret_value; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serial_size);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serial_size)
- assert(space);
+ HDassert(space);
/* Basic number of bytes required to serialize point selection:
* <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> +
@@ -756,7 +774,7 @@ H5S_point_serial_size (const H5S_t *space)
curr=curr->next;
} /* end while */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_point_serial_size() */
@@ -787,9 +805,9 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf)
uint32_t len=0; /* number of bytes used */
unsigned u; /* local counting variable */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serialize);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_serialize)
- assert(space);
+ HDassert(space);
/* Store the preamble information */
UINT32ENCODE(buf, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
@@ -822,7 +840,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf)
/* Encode length */
UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_point_serialize() */
@@ -1168,9 +1186,9 @@ H5S_point_is_contiguous(const H5S_t *space)
{
htri_t ret_value; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_contiguous);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_contiguous)
- assert(space);
+ HDassert(space);
/* One point is definitely contiguous */
if(space->select.num_elem==1)
@@ -1178,7 +1196,7 @@ H5S_point_is_contiguous(const H5S_t *space)
else /* More than one point might be contiguous, but it's complex to check and we don't need it right now */
ret_value=FALSE;
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_point_is_contiguous() */
@@ -1205,9 +1223,9 @@ H5S_point_is_single(const H5S_t *space)
{
htri_t ret_value; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_single);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_single)
- assert(space);
+ HDassert(space);
/* One point is definitely 'single' :-) */
if(space->select.num_elem==1)
@@ -1215,7 +1233,7 @@ H5S_point_is_single(const H5S_t *space)
else
ret_value=FALSE;
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_point_is_single() */
@@ -1245,10 +1263,10 @@ H5S_point_is_regular(const H5S_t *space)
{
htri_t ret_value; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_regular);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_is_regular)
/* Check args */
- assert(space);
+ HDassert(space);
/* Only simple check for regular points for now... */
if(space->select.num_elem==1)
@@ -1256,7 +1274,7 @@ H5S_point_is_regular(const H5S_t *space)
else
ret_value=FALSE;
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_point_is_regular() */
@@ -1420,31 +1438,31 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
int i; /* Local index variable */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_point_get_seq_list);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_point_get_seq_list)
/* Check args */
- assert(space);
- assert(iter);
- assert(maxseq>0);
- assert(maxelem>0);
- assert(nseq);
- assert(nelem);
- assert(off);
- assert(len);
+ HDassert(space);
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
/* Choose the minimum number of bytes to sequence through */
- H5_CHECK_OVERFLOW(iter->elmt_left,hsize_t,size_t);
- start_io_left=io_left=(size_t)MIN(iter->elmt_left,maxelem);
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ start_io_left = io_left = (size_t)MIN(iter->elmt_left, maxelem);
/* Get the dataspace dimensions */
- if ((ndims=H5S_get_simple_extent_dims (space, dims, NULL))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve data space dimensions");
+ if((ndims = H5S_get_simple_extent_dims (space, dims, NULL)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve data space dimensions")
/* Walk through the points in the selection, starting at the current */
/* location in the iterator */
- node=iter->u.pnt.curr;
- curr_seq=0;
- while(node!=NULL) {
+ node = iter->u.pnt.curr;
+ curr_seq = 0;
+ while(NULL != node) {
/* Compute the offset of each selected point in the buffer */
for(i = ndims - 1, acc = iter->elmt_size, loc = 0; i >= 0; i--) {
loc += (node->pnt[i] + space->select.offset[i]) * acc;
@@ -1507,6 +1525,6 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter,
*nelem=start_io_left-io_left;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_point_get_seq_list() */
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index fac5e1e..2858ddb 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -260,11 +260,9 @@ H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter);
#ifdef H5_HAVE_PARALLEL
-#ifndef _H5S_IN_H5S_C
/* Global vars whose value comes from environment variable */
/* (Defined in H5S.c) */
H5_DLLVAR hbool_t H5S_mpi_opt_types_g;
-#endif /* _H5S_IN_H5S_C */
H5_DLL herr_t
H5S_mpio_space_type( const H5S_t *space, size_t elmt_size,
diff --git a/src/H5T.c b/src/H5T.c
index de917f6..0a7eec4 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -2367,7 +2367,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
} /* end if */
H5T_close(old_path->src);
H5T_close(old_path->dst);
- H5FL_FREE(H5T_path_t,old_path);
+ old_path = H5FL_FREE(H5T_path_t, old_path);
/* Release temporary atoms */
H5I_dec_ref(tmp_sid, FALSE);
@@ -2380,17 +2380,17 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
} /* end else */
done:
- if (ret_value<0) {
- if (new_path) {
- if (new_path->src)
+ if(ret_value < 0) {
+ if(new_path) {
+ if(new_path->src)
H5T_close(new_path->src);
- if (new_path->dst)
+ if(new_path->dst)
H5T_close(new_path->dst);
- H5FL_FREE(H5T_path_t,new_path);
+ new_path = H5FL_FREE(H5T_path_t, new_path);
} /* end if */
- if (tmp_sid>=0)
+ if(tmp_sid >= 0)
H5I_dec_ref(tmp_sid, FALSE);
- if (tmp_did>=0)
+ if(tmp_did >= 0)
H5I_dec_ref(tmp_did, FALSE);
} /* end if */
@@ -2541,7 +2541,7 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
}
H5T_close(path->src);
H5T_close(path->dst);
- H5FL_FREE(H5T_path_t,path);
+ path = H5FL_FREE(H5T_path_t, path);
H5E_clear_stack(NULL); /*ignore all shutdown errors*/
} /* end else */
} /* end for */
@@ -2862,7 +2862,7 @@ H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc)
FUNC_ENTER_NOAPI_NOINIT(H5T_encode)
/* Allocate "fake" file structure */
- if(NULL == (f = H5F_fake_alloc((size_t)0)))
+ if(NULL == (f = H5F_fake_alloc((uint8_t)0)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct")
/* Find out the size of buffer needed */
@@ -2918,7 +2918,7 @@ H5T_decode(const unsigned char *buf)
FUNC_ENTER_NOAPI_NOINIT(H5T_decode)
/* Allocate "fake" file structure */
- if(NULL == (f = H5F_fake_alloc((size_t)0)))
+ if(NULL == (f = H5F_fake_alloc((uint8_t)0)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "can't allocate fake file struct")
/* Decode the type of the information */
@@ -2967,66 +2967,71 @@ done:
H5T_t *
H5T_create(H5T_class_t type, size_t size)
{
- H5T_t *dt = NULL;
- hid_t subtype;
- H5T_t *ret_value;
+ H5T_t *dt = NULL;
+ H5T_t *ret_value = NULL;
- FUNC_ENTER_NOAPI(H5T_create, NULL);
+ FUNC_ENTER_NOAPI(H5T_create, NULL)
- switch (type) {
+ switch(type) {
case H5T_INTEGER:
case H5T_FLOAT:
case H5T_TIME:
case H5T_STRING:
case H5T_BITFIELD:
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "type class is not appropriate - use H5Tcopy()");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "type class is not appropriate - use H5Tcopy()")
case H5T_OPAQUE:
case H5T_COMPOUND:
if(NULL == (dt = H5T_alloc()))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
dt->shared->type = type;
- if(type==H5T_COMPOUND) {
+ if(type == H5T_COMPOUND) {
dt->shared->u.compnd.packed=FALSE; /* Start out unpacked */
dt->shared->u.compnd.memb_size=0;
} /* end if */
- else if(type==H5T_OPAQUE)
+ else if(type == H5T_OPAQUE)
/* Initialize the tag in case it's not set later. A null tag will
* cause problems for later operations. */
dt->shared->u.opaque.tag = H5MM_strdup("");
break;
case H5T_ENUM:
- if (sizeof(char)==size) {
- subtype = H5T_NATIVE_SCHAR_g;
- } else if (sizeof(short)==size) {
- subtype = H5T_NATIVE_SHORT_g;
- } else if (sizeof(int)==size) {
- subtype = H5T_NATIVE_INT_g;
- } else if (sizeof(long)==size) {
- subtype = H5T_NATIVE_LONG_g;
- } else if (sizeof(long long)==size) {
- subtype = H5T_NATIVE_LLONG_g;
- } else {
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no applicable native integer type");
+ {
+ hid_t subtype;
+ H5T_t *sub_t_obj;
+
+ if(sizeof(char) == size)
+ subtype = H5T_NATIVE_SCHAR_g;
+ else if(sizeof(short) == size)
+ subtype = H5T_NATIVE_SHORT_g;
+ else if(sizeof(int) == size)
+ subtype = H5T_NATIVE_INT_g;
+ else if(sizeof(long) == size)
+ subtype = H5T_NATIVE_LONG_g;
+ else if(sizeof(long long) == size)
+ subtype = H5T_NATIVE_LLONG_g;
+ else
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no applicable native integer type")
+ if(NULL == (dt = H5T_alloc()))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ dt->shared->type = type;
+ if(NULL == (sub_t_obj = (H5T_t *)H5I_object(subtype)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, NULL, "unable to get datatype object")
+ if(NULL == (dt->shared->parent = H5T_copy(sub_t_obj, H5T_COPY_ALL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy base datatype")
}
- if(NULL == (dt = H5T_alloc()))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
- dt->shared->type = type;
- if (NULL==(dt->shared->parent=H5T_copy(H5I_object(subtype), H5T_COPY_ALL)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy base data type");
break;
case H5T_VLEN: /* Variable length datatype */
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tvlen_create()");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tvlen_create()")
case H5T_ARRAY: /* Array datatype */
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tarray_create2()");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tarray_create2()")
default:
- HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, NULL, "unknown data type class");
- }
+ HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, NULL, "unknown data type class")
+ } /* end switch */
dt->shared->size = size;
@@ -3034,15 +3039,15 @@ H5T_create(H5T_class_t type, size_t size)
ret_value = dt;
done:
- if(ret_value==NULL) {
- if(dt && (dt->shared != NULL))
- H5FL_FREE(H5T_shared_t, dt->shared);
- if(dt!=NULL)
- H5FL_FREE(H5T_t,dt);
+ if(NULL == ret_value) {
+ if(dt) {
+ dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
+ dt = H5FL_FREE(H5T_t, dt);
+ } /* end if */
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_create() */
/*-------------------------------------------------------------------------
@@ -3324,10 +3329,11 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
done:
if(ret_value == NULL) {
- if(new_dt->shared != NULL)
- H5FL_FREE(H5T_shared_t, new_dt->shared);
- if(new_dt != NULL)
- H5FL_FREE(H5T_t, new_dt);
+ if(new_dt) {
+ if(new_dt->shared)
+ new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared);
+ new_dt = H5FL_FREE(H5T_t, new_dt);
+ } /* end if */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -3419,8 +3425,8 @@ done:
if(ret_value == NULL)
if(dt) {
if(dt->shared)
- H5FL_FREE(H5T_shared_t, dt->shared);
- H5FL_FREE(H5T_t, dt);
+ dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
+ dt = H5FL_FREE(H5T_t, dt);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -3556,7 +3562,7 @@ H5T_close(H5T_t *dt)
if(H5T_free(dt) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype");
- H5FL_FREE(H5T_shared_t, dt->shared);
+ dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
} else {
/*
* If a named type is being closed then close the object header and
@@ -3582,7 +3588,7 @@ H5T_close(H5T_t *dt)
} /* end else */
/* Free the datatype struct */
- H5FL_FREE(H5T_t,dt);
+ dt = H5FL_FREE(H5T_t, dt);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -4273,48 +4279,47 @@ done:
*/
H5T_path_t *
H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
- H5T_conv_t func, hid_t dxpl_id, hbool_t is_api)
+ H5T_conv_t func, hid_t dxpl_id, hbool_t is_api)
{
int lt, rt; /*left and right edges */
int md; /*middle */
int cmp; /*comparison result */
int old_npaths; /* Previous number of paths in table */
- H5T_path_t *table=NULL; /*path existing in the table */
- H5T_path_t *path=NULL; /*new path */
- H5T_path_t *ret_value; /*return value */
- hid_t src_id=-1, dst_id=-1; /*src and dst type identifiers */
+ H5T_path_t *table = NULL; /*path existing in the table */
+ H5T_path_t *path = NULL; /*new path */
+ hid_t src_id = -1, dst_id = -1; /*src and dst type identifiers */
int i; /*counter */
- int nprint=0; /*lines of output printed */
+ int nprint = 0; /*lines of output printed */
+ H5T_path_t *ret_value; /*return value */
FUNC_ENTER_NOAPI(H5T_path_find, NULL);
- assert((!src && !dst) || (src && dst));
+ /* Sanity check */
+ HDassert(src);
+ HDassert(dst);
/*
* Make sure the first entry in the table is the no-op conversion path.
*/
- if (0==H5T_g.npaths) {
- if (NULL==(H5T_g.path=H5MM_malloc(128*sizeof(H5T_path_t*))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for type conversion path table");
+ if(0 == H5T_g.npaths) {
+ if(NULL == (H5T_g.path = H5MM_malloc(128 * sizeof(H5T_path_t *))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for type conversion path table")
H5T_g.apaths = 128;
- if (NULL==(H5T_g.path[0]=H5FL_CALLOC(H5T_path_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for no-op conversion path");
+ if(NULL == (H5T_g.path[0] = H5FL_CALLOC(H5T_path_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for no-op conversion path")
HDstrcpy(H5T_g.path[0]->name, "no-op");
H5T_g.path[0]->func = H5T_conv_noop;
H5T_g.path[0]->cdata.command = H5T_CONV_INIT;
- if (H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata),
- (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id)<0) {
+ if(H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) {
#ifdef H5T_DEBUG
- if (H5DEBUG(T)) {
- fprintf(H5DEBUG(T), "H5T: unable to initialize no-op "
- "conversion function (ignored)\n");
- }
+ if(H5DEBUG(T))
+ fprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n");
#endif
H5E_clear_stack(NULL); /*ignore the error*/
- }
+ } /* end if */
H5T_g.path[0]->is_noop = TRUE;
H5T_g.npaths = 1;
- }
+ } /* end if */
/*
* Find the conversion path. If source and destination types are equal
@@ -4325,35 +4330,36 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
* Only allow the no-op conversion to occur if no "force conversion" flags
* are set
*/
- if (src->shared->force_conv==FALSE && dst->shared->force_conv==FALSE && 0==H5T_cmp(src, dst, TRUE)) {
+ if(src->shared->force_conv == FALSE && dst->shared->force_conv == FALSE && 0 == H5T_cmp(src, dst, TRUE)) {
table = H5T_g.path[0];
cmp = 0;
md = 0;
- } else {
+ } /* end if */
+ else {
lt = md = 1;
rt = H5T_g.npaths;
cmp = -1;
- while (cmp && lt<rt) {
- md = (lt+rt) / 2;
- assert(H5T_g.path[md]);
+ while(cmp && lt < rt) {
+ md = (lt + rt) / 2;
+ HDassert(H5T_g.path[md]);
cmp = H5T_cmp(src, H5T_g.path[md]->src, FALSE);
- if (0==cmp) cmp = H5T_cmp(dst, H5T_g.path[md]->dst, FALSE);
- if (cmp<0) {
+ if(0 == cmp)
+ cmp = H5T_cmp(dst, H5T_g.path[md]->dst, FALSE);
+ if(cmp < 0)
rt = md;
- } else if (cmp>0) {
- lt = md+1;
- } else {
+ else if(cmp > 0)
+ lt = md + 1;
+ else
table = H5T_g.path[md];
- }
- }
- }
+ } /* end while */
+ } /* end else */
/* Keep a record of the number of paths in the table, in case one of the
* initialization calls below (hard or soft) causes more entries to be
* added to the table - QAK, 1/26/02
*/
- old_npaths=H5T_g.npaths;
+ old_npaths = H5T_g.npaths;
/*
* If we didn't find the path, if the caller is an API function specifying
@@ -4361,21 +4367,22 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
* specifying a new hard conversion and the path is a soft conversion, then
* create a new path and add the new function to the path.
*/
- if (!table || (table && func && is_api) || (table && !table->is_hard && func && !is_api)) {
- if (NULL==(path=H5FL_CALLOC(H5T_path_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for type conversion path");
- if (name && *name) {
+ if(!table || (table && func && is_api) || (table && !table->is_hard && func && !is_api)) {
+ if(NULL == (path = H5FL_CALLOC(H5T_path_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for type conversion path")
+ if(name && *name) {
HDstrncpy(path->name, name, (size_t)H5T_NAMELEN);
- path->name[H5T_NAMELEN-1] = '\0';
- } else {
+ path->name[H5T_NAMELEN - 1] = '\0';
+ } /* end if */
+ else
HDstrcpy(path->name, "NONAME");
- }
- if ((src && NULL==(path->src=H5T_copy(src, H5T_COPY_ALL))) ||
- (dst && NULL==(path->dst=H5T_copy(dst, H5T_COPY_ALL))))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy data type for conversion path");
- } else {
+ if(NULL == (path->src = H5T_copy(src, H5T_COPY_ALL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy datatype for conversion path")
+ if(NULL == (path->dst = H5T_copy(dst, H5T_COPY_ALL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy datatype for conversion path")
+ } /* end if */
+ else
path = table;
- }
/*
* If a hard conversion function is specified and none is defined for the
@@ -4383,25 +4390,24 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
* the existing path is a soft function, then add the new conversion to the path
* and initialize its conversion data.
*/
- if (func && (!table || (table && is_api) || (table && !table->is_hard && !is_api))) {
- assert(path!=table);
- assert(NULL==path->func);
- if (path->src && (src_id=H5I_register(H5I_DATATYPE,
- H5T_copy(path->src, H5T_COPY_ALL), FALSE))<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register source conversion type for query");
- if (path->dst && (dst_id=H5I_register(H5I_DATATYPE,
- H5T_copy(path->dst, H5T_COPY_ALL), FALSE))<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register destination conversion type for query");
+ if(func && (!table || (table && is_api) || (table && !table->is_hard && !is_api))) {
+ HDassert(path != table);
+ HDassert(NULL == path->func);
+ if(path->src && (src_id = H5I_register(H5I_DATATYPE, H5T_copy(path->src, H5T_COPY_ALL), FALSE)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register source conversion type for query")
+ if(path->dst && (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(path->dst, H5T_COPY_ALL), FALSE)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register destination conversion type for query")
path->cdata.command = H5T_CONV_INIT;
- if ((func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0,
- NULL, NULL, dxpl_id)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to initialize conversion function");
- if (src_id>=0) H5I_dec_ref(src_id, FALSE);
- if (dst_id>=0) H5I_dec_ref(dst_id, FALSE);
+ if((func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to initialize conversion function")
+ if(src_id >= 0)
+ H5I_dec_ref(src_id, FALSE);
+ if(dst_id >= 0)
+ H5I_dec_ref(dst_id, FALSE);
src_id = dst_id = -1;
path->func = func;
path->is_hard = TRUE;
- }
+ } /* end if */
/*
* If the path doesn't have a function by now (because it's a new path
@@ -4409,116 +4415,118 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
* for an applicable function and add it to the path. This can't happen
* for the no-op conversion path.
*/
- assert(path->func || (src && dst));
- for (i=H5T_g.nsoft-1; i>=0 && !path->func; --i) {
- if (src->shared->type!=H5T_g.soft[i].src ||
- dst->shared->type!=H5T_g.soft[i].dst) {
+ HDassert(path->func || (src && dst));
+ for(i = H5T_g.nsoft - 1; i >= 0 && !path->func; --i) {
+ if(src->shared->type != H5T_g.soft[i].src || dst->shared->type != H5T_g.soft[i].dst)
continue;
- }
- if ((src_id=H5I_register(H5I_DATATYPE,
- H5T_copy(path->src, H5T_COPY_ALL), FALSE))<0 ||
- (dst_id=H5I_register(H5I_DATATYPE,
- H5T_copy(path->dst, H5T_COPY_ALL), FALSE))<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register conversion types for query");
+ if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(path->src, H5T_COPY_ALL), FALSE)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register src conversion type for query")
+ if((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(path->dst, H5T_COPY_ALL), FALSE)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register dst conversion type for query")
path->cdata.command = H5T_CONV_INIT;
- if ((H5T_g.soft[i].func) (src_id, dst_id, &(path->cdata),
- (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id)<0) {
- HDmemset (&(path->cdata), 0, sizeof(H5T_cdata_t));
+ if((H5T_g.soft[i].func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) {
+ HDmemset(&(path->cdata), 0, sizeof(H5T_cdata_t));
H5E_clear_stack(NULL); /*ignore the error*/
- } else {
- HDstrcpy (path->name, H5T_g.soft[i].name);
+ } /* end if */
+ else {
+ HDstrcpy(path->name, H5T_g.soft[i].name);
path->func = H5T_g.soft[i].func;
path->is_hard = FALSE;
- }
+ } /* end else */
H5I_dec_ref(src_id, FALSE);
H5I_dec_ref(dst_id, FALSE);
src_id = dst_id = -1;
- }
- if (!path->func)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no appropriate function for conversion path");
+ } /* end for */
+ if(!path->func)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no appropriate function for conversion path")
/* Check if paths were inserted into the table through a recursive call
* and re-compute the correct location for this path if so. - QAK, 1/26/02
*/
- if(old_npaths!=H5T_g.npaths) {
+ if(old_npaths != H5T_g.npaths) {
lt = md = 1;
rt = H5T_g.npaths;
cmp = -1;
- while (cmp && lt<rt) {
- md = (lt+rt) / 2;
- assert(H5T_g.path[md]);
+ while(cmp && lt < rt) {
+ md = (lt + rt) / 2;
+ HDassert(H5T_g.path[md]);
cmp = H5T_cmp(src, H5T_g.path[md]->src, FALSE);
- if (0==cmp) cmp = H5T_cmp(dst, H5T_g.path[md]->dst, FALSE);
- if (cmp<0) {
+ if(0 == cmp)
+ cmp = H5T_cmp(dst, H5T_g.path[md]->dst, FALSE);
+ if(cmp < 0)
rt = md;
- } else if (cmp>0) {
- lt = md+1;
- } else {
+ else if(cmp > 0)
+ lt = md + 1;
+ else
table = H5T_g.path[md];
- }
- }
+ } /* end while */
} /* end if */
/* Replace an existing table entry or add a new entry */
- if (table && path!=table) {
- assert(table==H5T_g.path[md]);
+ if(table && path != table) {
+ HDassert(table == H5T_g.path[md]);
H5T_print_stats(table, &nprint/*in,out*/);
table->cdata.command = H5T_CONV_FREE;
- if ((table->func)(FAIL, FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0,
- NULL, NULL, dxpl_id)<0) {
+ if((table->func)(FAIL, FAIL, &(table->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, dxpl_id) < 0) {
#ifdef H5T_DEBUG
- if (H5DEBUG(T)) {
+ if(H5DEBUG(T)) {
fprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free "
"failed for %s (ignored)\n",
(unsigned long)(path->func), path->name);
- }
+ } /* end if */
#endif
H5E_clear_stack(NULL); /*ignore the failure*/
- }
- if (table->src) H5T_close(table->src);
- if (table->dst) H5T_close(table->dst);
- H5FL_FREE(H5T_path_t,table);
+ } /* end if */
+ if(table->src)
+ H5T_close(table->src);
+ if(table->dst)
+ H5T_close(table->dst);
+ table = H5FL_FREE(H5T_path_t, table);
table = path;
H5T_g.path[md] = path;
- } else if (path!=table) {
- assert(cmp);
- if (H5T_g.npaths >= H5T_g.apaths) {
+ } else if(path != table) {
+ HDassert(cmp);
+ if(H5T_g.npaths >= H5T_g.apaths) {
size_t na = MAX(128, 2 * H5T_g.apaths);
- H5T_path_t **x = H5MM_realloc (H5T_g.path,
- na*sizeof(H5T_path_t*));
- if (!x)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ H5T_path_t **x = H5MM_realloc (H5T_g.path, na * sizeof(H5T_path_t*));
+
+ if(!x)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
H5T_g.apaths = (int)na;
H5T_g.path = x;
- }
- if (cmp>0) md++;
- HDmemmove(H5T_g.path+md+1, H5T_g.path+md,
- (H5T_g.npaths-md) * sizeof(H5T_path_t*));
+ } /* end if */
+ if(cmp > 0)
+ md++;
+ HDmemmove(H5T_g.path + md + 1, H5T_g.path + md, (H5T_g.npaths - md) * sizeof(H5T_path_t*));
H5T_g.npaths++;
H5T_g.path[md] = path;
table = path;
- }
+ } /* end else-if */
/* Set the flag to indicate both source and destination types are compound types
* for the optimization of data reading (in H5Dio.c). */
- if(H5T_COMPOUND==H5T_get_class(src, TRUE) && H5T_COMPOUND==H5T_get_class(dst, TRUE))
+ if(H5T_COMPOUND == H5T_get_class(src, TRUE) && H5T_COMPOUND == H5T_get_class(dst, TRUE))
path->are_compounds = TRUE;
/* Set return value */
ret_value = path;
done:
- if (!ret_value && path && path!=table) {
- if (path->src) H5T_close(path->src);
- if (path->dst) H5T_close(path->dst);
- H5FL_FREE(H5T_path_t,path);
- }
- if (src_id>=0) H5I_dec_ref(src_id, FALSE);
- if (dst_id>=0) H5I_dec_ref(dst_id, FALSE);
+ if(!ret_value && path && path != table) {
+ if(path->src)
+ H5T_close(path->src);
+ if(path->dst)
+ H5T_close(path->dst);
+ path = H5FL_FREE(H5T_path_t, path);
+ } /* end if */
+ if(src_id >= 0)
+ H5I_dec_ref(src_id, FALSE);
+ if(dst_id >= 0)
+ H5I_dec_ref(dst_id, FALSE);
FUNC_LEAVE_NOAPI(ret_value);
-}
+} /* end H5T_path_find() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index dea6bed..46a1ac8 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -770,12 +770,12 @@ done:
if(ret_value == NULL) {
if(dt) {
if(shared_fo == NULL) /* Need to free shared fo */
- H5FL_FREE(H5T_shared_t, dt->shared);
+ dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);
H5O_loc_free(&(dt->oloc));
H5G_name_free(&(dt->path));
- H5FL_FREE(H5T_t, dt);
+ dt = H5FL_FREE(H5T_t, dt);
} /* end if */
if(shared_fo)
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index ecf93e1..bfa5d56 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -3185,13 +3185,13 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
done:
/* If the conversion buffer doesn't need to be freed, reset its pointer */
if(write_to_file && noop_conv)
- conv_buf=NULL;
+ conv_buf = NULL;
/* Release the conversion buffer (always allocated, except on errors) */
- if(conv_buf!=NULL)
- H5FL_BLK_FREE(vlen_seq,conv_buf);
+ if(conv_buf)
+ conv_buf = H5FL_BLK_FREE(vlen_seq, conv_buf);
/* Release the background buffer, if we have one */
- if(tmp_buf!=NULL)
- H5FL_BLK_FREE(vlen_seq,tmp_buf);
+ if(tmp_buf)
+ tmp_buf = H5FL_BLK_FREE(vlen_seq, tmp_buf);
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -3337,7 +3337,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
done:
/* Release the background buffer, if we have one */
if(bkg_buf)
- H5FL_BLK_FREE(array_seq, bkg_buf);
+ bkg_buf = H5FL_BLK_FREE(array_seq, bkg_buf);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_conv_array() */
diff --git a/src/H5Tcset.c b/src/H5Tcset.c
index c938cd2..4ec58ab 100644
--- a/src/H5Tcset.c
+++ b/src/H5Tcset.c
@@ -75,14 +75,14 @@ H5T_init_cset_interface(void)
H5T_cset_t
H5Tget_cset(hid_t type_id)
{
- H5T_t *dt = NULL;
+ H5T_t *dt;
H5T_cset_t ret_value;
FUNC_ENTER_API(H5Tget_cset, H5T_CSET_ERROR)
H5TRACE1("Tc", "i", type_id);
/* Check args */
- if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_CSET_ERROR, "not a data type")
while (dt->shared->parent && !H5T_IS_STRING(dt->shared))
dt = dt->shared->parent; /*defer to parent*/
@@ -121,14 +121,14 @@ done:
herr_t
H5Tset_cset(hid_t type_id, H5T_cset_t cset)
{
- H5T_t *dt = NULL;
+ H5T_t *dt;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(H5Tset_cset, FAIL)
H5TRACE2("e", "iTc", type_id, cset);
/* Check args */
- if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
if (H5T_STATE_TRANSIENT!=dt->shared->state)
HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only")
diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c
index 0314a38..9d9ad36 100644
--- a/src/H5Tdeprec.c
+++ b/src/H5Tdeprec.c
@@ -136,7 +136,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Commit the datatype to the file, using default property list values */
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index 75b5d03..8d8920b 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -38,6 +38,8 @@ static H5T_t *H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction
size_t *struct_align, size_t *offset, size_t *comp_size);
static H5T_t *H5T_get_native_float(size_t size, H5T_direction_t direction,
size_t *struct_align, size_t *offset, size_t *comp_size);
+static H5T_t* H5T_get_native_bitfield(size_t prec, H5T_direction_t direction,
+ size_t *struct_align, size_t *offset, size_t *comp_size);
static herr_t H5T_cmp_offset(size_t *comp_size, size_t *offset, size_t elem_size,
size_t nelems, size_t align, size_t *struct_align);
@@ -108,7 +110,7 @@ H5Tget_native_type(hid_t type_id, H5T_direction_t direction)
H5TRACE2("i", "iTd", type_id, direction);
/* check argument */
- if(NULL==(dt=H5I_object_verify(type_id, H5I_DATATYPE)))
+ if(NULL==(dt=(H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type")
if(direction!=H5T_DIR_DEFAULT && direction!=H5T_DIR_ASCEND
@@ -210,13 +212,19 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
}
break;
- /* These 2 types will be supported in the future. Simply return "not supported"
+ /* The time type will be supported in the future. Simply return "not supported"
* message for now.*/
case H5T_TIME:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "time type is not supported yet")
case H5T_BITFIELD:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "bit field type is not supported yet")
+ {
+ prec = dtype->shared->u.atomic.prec;
+
+ if((ret_value = H5T_get_native_bitfield(prec, direction, struct_align, offset, comp_size))==NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve integer for bitfield type")
+ }
+ break;
case H5T_OPAQUE:
if((ret_value=H5T_copy(dtype, H5T_COPY_TRANSIENT))==NULL)
@@ -237,7 +245,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type")
/* Decide if the data type is object or dataset region reference. */
- if(NULL==(dt=H5I_object(H5T_STD_REF_OBJ_g)))
+ if(NULL==(dt=(H5T_t *)H5I_object(H5T_STD_REF_OBJ_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type")
not_equal = H5T_cmp(ret_value, dt, FALSE);
@@ -556,46 +564,19 @@ H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
native_size = sizeof(long long);
}
} else if(direction == H5T_DIR_DESCEND) {
- if(prec>=H5Tget_precision(H5T_NATIVE_LLONG)) {
+ if(prec>H5Tget_precision(H5T_NATIVE_LONG)) {
match=H5T_NATIVE_INT_MATCH_LLONG;
native_size = sizeof(long long);
- } else if(prec>=H5Tget_precision(H5T_NATIVE_LONG)) {
- if(prec==H5Tget_precision(H5T_NATIVE_LONG)) {
- match=H5T_NATIVE_INT_MATCH_LONG;
- native_size = sizeof(long);
- } else {
- match=H5T_NATIVE_INT_MATCH_LLONG;
- native_size = sizeof(long long);
- }
- }
- else if(prec>=H5Tget_precision(H5T_NATIVE_INT)) {
- if(prec==H5Tget_precision(H5T_NATIVE_INT)) {
- match=H5T_NATIVE_INT_MATCH_INT;
- native_size = sizeof(int);
- } else {
- match=H5T_NATIVE_INT_MATCH_LONG;
- native_size = sizeof(long);
- }
- }
- else if(prec>=H5Tget_precision(H5T_NATIVE_SHORT)) {
- if(prec==H5Tget_precision(H5T_NATIVE_SHORT)) {
- match=H5T_NATIVE_INT_MATCH_SHORT;
- native_size = sizeof(short);
- } else {
- match=H5T_NATIVE_INT_MATCH_INT;
- native_size = sizeof(int);
- }
- }
- else if(prec>=H5Tget_precision(H5T_NATIVE_SCHAR)) {
- if(prec==H5Tget_precision(H5T_NATIVE_SCHAR)) {
- match=H5T_NATIVE_INT_MATCH_CHAR;
- native_size = sizeof(char);
- } else {
- match=H5T_NATIVE_INT_MATCH_SHORT;
- native_size = sizeof(short);
- }
- }
- else { /* If no native type matches the queried datatype, simply choose the type of smallest size. */
+ } else if(prec>H5Tget_precision(H5T_NATIVE_INT)) {
+ match=H5T_NATIVE_INT_MATCH_LONG;
+ native_size = sizeof(long);
+ } else if(prec>H5Tget_precision(H5T_NATIVE_SHORT)) {
+ match=H5T_NATIVE_INT_MATCH_INT;
+ native_size = sizeof(int);
+ } else if(prec>H5Tget_precision(H5T_NATIVE_SCHAR)) {
+ match=H5T_NATIVE_INT_MATCH_SHORT;
+ native_size = sizeof(short);
+ } else {
match=H5T_NATIVE_INT_MATCH_CHAR;
native_size = sizeof(char);
}
@@ -654,7 +635,7 @@ H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
/* Create new native type */
assert(tid>=0);
- if(NULL==(dt=H5I_object(tid)))
+ if(NULL==(dt=(H5T_t *)H5I_object(tid)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type")
if((ret_value=H5T_copy(dt, H5T_COPY_TRANSIENT))==NULL)
@@ -733,46 +714,23 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig
}
} else {
#if H5_SIZEOF_LONG_DOUBLE !=0
- if(size>=sizeof(long double)) {
+ if(size>sizeof(double)) {
match=H5T_NATIVE_FLOAT_MATCH_LDOUBLE;
native_size = sizeof(long double);
}
- else if(size>=sizeof(double)) {
- if(size==sizeof(double)) {
- match=H5T_NATIVE_FLOAT_MATCH_DOUBLE;
- native_size = sizeof(double);
- } else {
- match=H5T_NATIVE_FLOAT_MATCH_LDOUBLE;
- native_size = sizeof(long double);
- }
- }
- else if(size>=sizeof(float)) {
- if(size==sizeof(float)) {
- match=H5T_NATIVE_FLOAT_MATCH_FLOAT;
- native_size = sizeof(float);
- } else {
- match=H5T_NATIVE_FLOAT_MATCH_DOUBLE;
- native_size = sizeof(double);
- }
+ else if(size>sizeof(float)) {
+ match=H5T_NATIVE_FLOAT_MATCH_DOUBLE;
+ native_size = sizeof(double);
}
else {
match=H5T_NATIVE_FLOAT_MATCH_FLOAT;
native_size = sizeof(float);
}
#else
- if(size>=sizeof(double)) {
+ if(size>sizeof(float)) {
match=H5T_NATIVE_FLOAT_MATCH_DOUBLE;
native_size = sizeof(double);
}
- else if(size>=sizeof(float)) {
- if(size==sizeof(float)) {
- match=H5T_NATIVE_FLOAT_MATCH_FLOAT;
- native_size = sizeof(float);
- } else {
- match=H5T_NATIVE_FLOAT_MATCH_DOUBLE;
- native_size = sizeof(double);
- }
- }
else {
match=H5T_NATIVE_FLOAT_MATCH_FLOAT;
native_size = sizeof(float);
@@ -805,7 +763,7 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig
/* Create new native type */
assert(tid>=0);
- if(NULL==(dt=H5I_object(tid)))
+ if(NULL==(dt=(H5T_t *)H5I_object(tid)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type")
if((ret_value=H5T_copy(dt, H5T_COPY_TRANSIENT))==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type")
@@ -820,6 +778,94 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5T_get_native_bitfield
+ *
+ * Purpose: Returns the native bitfield type of a datatype. Bitfield
+ * is similar to unsigned integer.
+ *
+ * Return: Success: Returns the native data type if successful.
+ *
+ * Failure: negative
+ *
+ * Programmer: Raymond Lu
+ * 1 December 2009
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5T_t*
+H5T_get_native_bitfield(size_t prec, H5T_direction_t direction, size_t *struct_align,
+ size_t *offset, size_t *comp_size)
+{
+ H5T_t *dt; /* Appropriate native datatype to copy */
+ hid_t tid=(-1); /* Datatype ID of appropriate native datatype */
+ size_t align=0; /* Alignment necessary for native datatype */
+ size_t native_size=0; /* Datatype size of the native type */
+ H5T_t *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5T_get_native_bitfield, NULL);
+
+ if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) {
+ if(prec<=H5Tget_precision(H5T_NATIVE_B8)) {
+ tid = H5T_NATIVE_B8;
+ native_size = 1;
+ align = H5T_NATIVE_UINT8_ALIGN_g;
+ } else if(prec<=H5Tget_precision(H5T_NATIVE_B16)) {
+ tid = H5T_NATIVE_B16;
+ native_size = 2;
+ align = H5T_NATIVE_UINT16_ALIGN_g;
+ } else if(prec<=H5Tget_precision(H5T_NATIVE_B32)) {
+ tid = H5T_NATIVE_B32;
+ native_size = 4;
+ align = H5T_NATIVE_UINT32_ALIGN_g;
+ } else if(prec<=H5Tget_precision(H5T_NATIVE_B64)) {
+ tid = H5T_NATIVE_B64;
+ native_size = 8;
+ align = H5T_NATIVE_UINT64_ALIGN_g;
+ } else { /* If no native type matches the querried datatype, simply choose the type of biggest size. */
+ tid = H5T_NATIVE_B64;
+ native_size = 8;
+ align = H5T_NATIVE_UINT64_ALIGN_g;
+ }
+ } else if(direction == H5T_DIR_DESCEND) {
+ if(prec>H5Tget_precision(H5T_NATIVE_B32)) {
+ tid = H5T_NATIVE_B64;
+ native_size = 8;
+ align = H5T_NATIVE_UINT64_ALIGN_g;
+ } else if(prec>H5Tget_precision(H5T_NATIVE_B16)) {
+ tid = H5T_NATIVE_B32;
+ native_size = 4;
+ align = H5T_NATIVE_UINT32_ALIGN_g;
+ } else if(prec>H5Tget_precision(H5T_NATIVE_B8)) {
+ tid = H5T_NATIVE_B16;
+ native_size = 2;
+ align = H5T_NATIVE_UINT16_ALIGN_g;
+ } else {
+ tid = H5T_NATIVE_B8;
+ native_size = 1;
+ align = H5T_NATIVE_UINT8_ALIGN_g;
+ }
+ }
+
+ /* Create new native type */
+ assert(tid>=0);
+ if(NULL==(dt=(H5T_t *)H5I_object(tid)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type")
+
+ if((ret_value=H5T_copy(dt, H5T_COPY_TRANSIENT))==NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot copy type")
+
+ /* compute size and offset of compound type member. */
+ if(H5T_cmp_offset(comp_size, offset, native_size, (size_t)1, align, struct_align)<0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5T_cmp_offset
*
* Purpose: This function is only for convenience. It computes the
diff --git a/src/H5Toffset.c b/src/H5Toffset.c
index 5495368..17351f4 100644
--- a/src/H5Toffset.c
+++ b/src/H5Toffset.c
@@ -94,7 +94,7 @@ H5Tget_offset(hid_t type_id)
H5TRACE1("Is", "i", type_id);
/* Check args */
- if(NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type")
/* Get offset */
@@ -198,14 +198,14 @@ done:
herr_t
H5Tset_offset(hid_t type_id, size_t offset)
{
- H5T_t *dt = NULL;
+ H5T_t *dt;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(H5Tset_offset, FAIL)
H5TRACE2("e", "iz", type_id, offset);
/* Check args */
- if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type")
if (H5T_STATE_TRANSIENT!=dt->shared->state)
HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only")
diff --git a/src/H5Znbit.c b/src/H5Znbit.c
index 6f090c3..8f785a2 100644
--- a/src/H5Znbit.c
+++ b/src/H5Znbit.c
@@ -138,7 +138,7 @@ H5Z_can_apply_nbit(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id)
FUNC_ENTER_NOAPI(H5Z_can_apply_nbit, FAIL)
/* Get datatype */
- if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Get datatype's class, for checking the "datatype class" */
@@ -742,7 +742,7 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id)
FUNC_ENTER_NOAPI(H5Z_set_local_nbit, FAIL)
/* Get datatype */
- if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE)))
+ if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Get datatype's class */
@@ -781,7 +781,7 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype needs too many nbit parameters")
/* Allocate memory space for cd_values[] */
- if(NULL == (cd_values = H5MM_malloc(cd_values_actual_nparms * sizeof(unsigned))))
+ if(NULL == (cd_values = (unsigned *)H5MM_malloc(cd_values_actual_nparms * sizeof(unsigned))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for cd_values[]")
/* Get the plist structure */
@@ -862,81 +862,70 @@ done:
* Programmer: Xiaowen Wu
* Friday, January 21, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static size_t
H5Z_filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
size_t nbytes, size_t *buf_size, void **buf)
{
- size_t ret_value = 0; /* return value */
- size_t size_out = 0; /* size of output buffer */
- unsigned d_nelmts = 0; /* number of elements in the chunk */
- unsigned char *outbuf = NULL; /* pointer to new output buffer */
+ unsigned char *outbuf; /* pointer to new output buffer */
+ size_t size_out = 0; /* size of output buffer */
+ unsigned d_nelmts = 0; /* number of elements in the chunk */
+ size_t ret_value = 0; /* return value */
FUNC_ENTER_NOAPI(H5Z_filter_nbit, 0)
/* check arguments
* cd_values[0] stores actual number of parameters in cd_values[]
*/
- if (cd_nelmts!=cd_values[0])
+ if(cd_nelmts != cd_values[0])
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid nbit aggression level")
/* check if need to do nbit compress or decompress
* cd_values[1] stores the flag if true indicating no need to compress
*/
- if (cd_values[1]) {
- ret_value = *buf_size;
- goto done;
- }
+ if(cd_values[1])
+ HGOTO_DONE(*buf_size)
/* copy a filter parameter to d_nelmts */
d_nelmts = cd_values[2];
/* input; decompress */
- if (flags & H5Z_FLAG_REVERSE) {
+ if(flags & H5Z_FLAG_REVERSE) {
size_out = d_nelmts * cd_values[4]; /* cd_values[4] stores datatype size */
/* allocate memory space for decompressed buffer */
- if(NULL==(outbuf = H5MM_malloc(size_out)))
+ if(NULL == (outbuf = (unsigned char *)H5MM_malloc(size_out)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for nbit decompression")
/* decompress the buffer */
- H5Z_nbit_decompress(outbuf, d_nelmts, *buf, cd_values);
-
- *buf_size = size_out;
- ret_value = size_out;
- }
+ H5Z_nbit_decompress(outbuf, d_nelmts, (unsigned char *)*buf, cd_values);
+ } /* end if */
/* output; compress */
else {
- assert(nbytes == d_nelmts * cd_values[4]);
+ HDassert(nbytes == d_nelmts * cd_values[4]);
size_out = nbytes;
/* allocate memory space for compressed buffer */
- if(NULL==(outbuf = H5MM_malloc(size_out)))
+ if(NULL == (outbuf = (unsigned char *)H5MM_malloc(size_out)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for nbit compression")
/* compress the buffer, size_out will be changed */
- H5Z_nbit_compress(*buf, d_nelmts, outbuf, &size_out, cd_values);
-
- *buf_size = nbytes;
- ret_value = size_out;
- }
+ H5Z_nbit_compress((unsigned char *)*buf, d_nelmts, outbuf, &size_out, cd_values);
+ } /* end else */
/* free the input buffer */
H5MM_xfree(*buf);
/* set return values */
*buf = outbuf;
- outbuf = NULL;
+ *buf_size = size_out;
+ ret_value = size_out;
done:
- if(outbuf)
- H5MM_xfree(outbuf);
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5Z_filter_nbit() */
/* ======== Nbit Algorithm ===============================================
* assume one byte has 8 bit
@@ -946,14 +935,17 @@ done:
* atomic datatype is treated on byte basis
*/
-static void H5Z_nbit_next_byte(size_t *j, int *buf_len)
+static void
+H5Z_nbit_next_byte(size_t *j, int *buf_len)
{
++(*j);
*buf_len = 8 * sizeof(unsigned char);
}
-static void H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, int k, int begin_i,
-int end_i, unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p, int datatype_len)
+static void
+H5Z_nbit_decompress_one_byte(unsigned char *data, size_t data_offset, int k,
+ int begin_i, int end_i, unsigned char *buffer, size_t *j, int *buf_len,
+ parms_atomic p, int datatype_len)
{
int dat_len; /* dat_len is the number of bits to be copied in each data byte */
int uchar_offset;
@@ -995,7 +987,8 @@ int end_i, unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p, int d
}
}
-static void H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset,
+static void
+H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_offset,
unsigned char *buffer, size_t *j, int *buf_len, unsigned size)
{
unsigned i; /* index */
@@ -1018,7 +1011,8 @@ static void H5Z_nbit_decompress_one_nooptype(unsigned char *data, size_t data_of
}
}
-static void H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset,
+static void
+H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offset,
unsigned char *buffer, size_t *j, int *buf_len, parms_atomic p)
{
/* begin_i: the index of byte having first significant bit
@@ -1054,7 +1048,8 @@ static void H5Z_nbit_decompress_one_atomic(unsigned char *data, size_t data_offs
}
}
-static void H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset,
+static void
+H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offset,
unsigned char *buffer, size_t *j, int *buf_len, const unsigned parms[])
{
unsigned i, total_size, base_class, base_size, n, begin_index;
@@ -1101,7 +1096,8 @@ static void H5Z_nbit_decompress_one_array(unsigned char *data, size_t data_offse
} /* end switch */
}
-static void H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_offset,
+static void
+H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_offset,
unsigned char *buffer, size_t *j, int *buf_len, const unsigned parms[])
{
unsigned i, nmembers, member_offset, member_class, size;
@@ -1139,7 +1135,8 @@ static void H5Z_nbit_decompress_one_compound(unsigned char *data, size_t data_of
}
}
-static void H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer,
+static void
+H5Z_nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer,
const unsigned parms[])
{
/* i: index of data, j: index of buffer,
@@ -1410,7 +1407,5 @@ static void H5Z_nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned c
}
break;
} /* end switch */
-
- *buffer_size = j + 1; /* sometimes is catually j, but to be safe */
}
#endif /* H5_HAVE_FILTER_NBIT */
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index 1a6988f..762b316 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -62,7 +62,7 @@ typedef struct H5Z_node {
struct H5Z_data_xform_t {
char* xform_exp;
- struct H5Z_node* parse_root;
+ H5Z_node* parse_root;
H5Z_datval_ptrs* dat_val_pointers;
};
@@ -354,7 +354,7 @@ H5Z_unget_token(H5Z_token *current)
static H5Z_token *
H5Z_get_token(H5Z_token *current)
{
- void *ret_value = current;
+ H5Z_token *ret_value = current;
FUNC_ENTER_NOAPI(H5Z_get_token, NULL)
@@ -464,7 +464,7 @@ H5Z_get_token(H5Z_token *current)
current->tok_type = H5Z_XFORM_END;
/* Set return value */
- ret_value = (void *)current;
+ ret_value = current;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -732,7 +732,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers)
{
H5Z_node *factor=NULL;
H5Z_node *new_node;
- void* ret_value;
+ H5Z_node *ret_value;
FUNC_ENTER_NOAPI(H5Z_parse_factor, NULL);
@@ -871,17 +871,17 @@ done:
static H5Z_node *
H5Z_new_node(H5Z_token_type type)
{
- H5Z_node* ret_value = NULL;
+ H5Z_node *ret_value;
- FUNC_ENTER_NOAPI(H5Z_new_node, NULL);
+ FUNC_ENTER_NOAPI(H5Z_new_node, NULL)
- ret_value = H5MM_calloc(sizeof(H5Z_node));
- if(ret_value == NULL)
+ if(NULL == (ret_value = (H5Z_node *)H5MM_calloc(sizeof(H5Z_node))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to allocate space for nodes in the parse tree")
ret_value->type = type;
+
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -1108,66 +1108,52 @@ H5Z_xform_find_type(const H5T_t* type)
HDassert(type);
/* Check for SHORT type */
- if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_SHORT,H5I_DATATYPE), FALSE)) == 0)
+ if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_SHORT, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_SHORT)
-
- /* Check for INT type */
- else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_INT,H5I_DATATYPE), FALSE)) == 0)
+ /* Check for INT type */
+ else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_INT, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_INT)
-
- /* Check for LONG type */
- else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LONG,H5I_DATATYPE), FALSE)) == 0)
+ /* Check for LONG type */
+ else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LONG, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_LONG)
-
- /* Check for LONGLONG type */
- else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LLONG,H5I_DATATYPE), FALSE)) == 0)
+ /* Check for LONGLONG type */
+ else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LLONG, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_LLONG)
-
- /* Check for UCHAR type */
- else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_UCHAR,H5I_DATATYPE), FALSE)) == 0)
+ /* Check for UCHAR type */
+ else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_UCHAR, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_UCHAR)
-
- /* Check for CHAR type */
- else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_CHAR,H5I_DATATYPE), FALSE)) == 0)
+ /* Check for CHAR type */
+ else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_CHAR, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_CHAR)
-
- /* Check for SCHAR type */
- else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_SCHAR,H5I_DATATYPE), FALSE)) == 0)
+ /* Check for SCHAR type */
+ else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_SCHAR, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_SCHAR)
-
- /* Check for USHORT type */
- else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_USHORT,H5I_DATATYPE), FALSE)) == 0)
+ /* Check for USHORT type */
+ else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_USHORT, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_USHORT)
-
- /* Check for UINT type */
- else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_UINT,H5I_DATATYPE), FALSE)) == 0)
+ /* Check for UINT type */
+ else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_UINT, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_UINT)
-
- /* Check for ULONG type */
- else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_ULONG,H5I_DATATYPE), FALSE)) == 0)
+ /* Check for ULONG type */
+ else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_ULONG, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_ULONG)
-
- /* Check for ULONGLONG type */
- else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_ULLONG,H5I_DATATYPE), FALSE)) == 0)
+ /* Check for ULONGLONG type */
+ else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_ULLONG, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_ULLONG)
-
- /* Check for FLOAT type */
- else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_FLOAT,H5I_DATATYPE), FALSE)) == 0)
+ /* Check for FLOAT type */
+ else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_FLOAT, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_FLOAT)
-
- /* Check for DOUBLE type */
- else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_DOUBLE,H5I_DATATYPE), FALSE)) == 0)
+ /* Check for DOUBLE type */
+ else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_DOUBLE, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_DOUBLE)
-
#if H5_SIZEOF_LONG_DOUBLE !=0
- /* Check for LONGDOUBLE type */
- else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LDOUBLE,H5I_DATATYPE), FALSE)) == 0)
+ /* Check for LONGDOUBLE type */
+ else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LDOUBLE, H5I_DATATYPE), FALSE)) == 0)
HGOTO_DONE(H5T_NATIVE_LDOUBLE)
#endif
else
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not find matching type")
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z_xform_find_type() */
@@ -1356,22 +1342,20 @@ H5Z_xform_create(const char *expr)
assert(expr);
/* Allocate space for the data transform information */
- if((data_xform_prop = H5MM_calloc(sizeof(H5Z_data_xform_t)))==NULL)
+ if(NULL == (data_xform_prop = (H5Z_data_xform_t *)H5MM_calloc(sizeof(H5Z_data_xform_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for data transform info")
- if((data_xform_prop->dat_val_pointers = H5MM_malloc(sizeof(H5Z_datval_ptrs))) == NULL)
+ if(NULL == (data_xform_prop->dat_val_pointers = (H5Z_datval_ptrs *)H5MM_malloc(sizeof(H5Z_datval_ptrs))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for data transform array storage")
/* copy the user's string into the property */
- if((data_xform_prop->xform_exp = H5MM_xstrdup(expr))==NULL)
+ if(NULL == (data_xform_prop->xform_exp = (char *)H5MM_xstrdup(expr)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for data transform expression")
/* Find the number of times "x" is used in this equation, and allocate room for storing that many points */
- for(i=0; i<strlen(expr); i++)
- {
- if(isalpha(expr[i]))
+ for(i = 0; i < HDstrlen(expr); i++)
+ if(HDisalpha(expr[i]))
count++;
- }
/* When there are no "x"'s in the equation (ie, simple transform case),
* we don't need to allocate any space since no array will have to be
@@ -1385,7 +1369,7 @@ H5Z_xform_create(const char *expr)
data_xform_prop->dat_val_pointers->num_ptrs = 0;
/* we generate the parse tree right here and store a poitner to its root in the property. */
- if((data_xform_prop->parse_root = H5Z_xform_parse(expr, data_xform_prop->dat_val_pointers))==NULL)
+ if((data_xform_prop->parse_root = (H5Z_node *)H5Z_xform_parse(expr, data_xform_prop->dat_val_pointers))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to generate parse tree from expression")
/* Sanity check
@@ -1496,22 +1480,20 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop)
if(*data_xform_prop) {
/* Allocate new node */
- if((new_data_xform_prop = H5MM_calloc(sizeof(H5Z_data_xform_t)))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform info")
+ if(NULL == (new_data_xform_prop = (H5Z_data_xform_t *)H5MM_calloc(sizeof(H5Z_data_xform_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform info")
/* Copy string */
- if((new_data_xform_prop->xform_exp = H5MM_xstrdup((*data_xform_prop)->xform_exp))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform expression")
+ if(NULL == (new_data_xform_prop->xform_exp = (char *)H5MM_xstrdup((*data_xform_prop)->xform_exp)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform expression")
- if((new_data_xform_prop->dat_val_pointers = H5MM_malloc(sizeof(H5Z_datval_ptrs))) == NULL)
+ if(NULL == (new_data_xform_prop->dat_val_pointers = (H5Z_datval_ptrs *)H5MM_malloc(sizeof(H5Z_datval_ptrs))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform array storage")
/* Find the number of times "x" is used in this equation, and allocate room for storing that many points */
- for(i=0; i<strlen(new_data_xform_prop->xform_exp); i++)
- {
- if(isalpha(new_data_xform_prop->xform_exp[i]))
+ for(i = 0; i < HDstrlen(new_data_xform_prop->xform_exp); i++)
+ if(HDisalpha(new_data_xform_prop->xform_exp[i]))
count++;
- }
if(count > 0)
if((new_data_xform_prop->dat_val_pointers->ptr_dat_val = (void**) H5MM_calloc(count * sizeof(void**))) == NULL)
@@ -1520,7 +1502,6 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop)
/* Zero out num_pointers prior to H5Z_xform_cop_tree call; that call will increment it to the right amount */
new_data_xform_prop->dat_val_pointers->num_ptrs = 0;
-
/* Copy parse tree */
if((new_data_xform_prop->parse_root = (H5Z_node*)H5Z_xform_copy_tree((*data_xform_prop)->parse_root, (*data_xform_prop)->dat_val_pointers, new_data_xform_prop->dat_val_pointers)) == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "error copying the parse tree")
diff --git a/src/H5detect.c b/src/H5detect.c
index f76f159..ebd042d 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -821,8 +821,7 @@ H5TN_init_interface(void)\n\
done:\n\
if(ret_value < 0) {\n\
if(dt != NULL) {\n\
- if(dt->shared != NULL)\n\
- H5FL_FREE(H5T_shared_t, dt->shared);\n\
+ H5FL_FREE(H5T_shared_t, dt->shared);\n\
dt = H5FL_FREE(H5T_t, dt);\n\
} /* end if */\n\
} /* end if */\n\
diff --git a/src/H5private.h b/src/H5private.h
index 8f56db0..c0b5054 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1935,14 +1935,6 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
*
* Programmer: Quincey Koziol
*
- * Modifications:
- *
- * Robb Matzke, 4 Aug 1997
- * The pablo mask comes from the constant PABLO_MASK defined on a
- * per-file basis. The pablo_func_id comes from an auto variable
- * defined by FUNC_ENTER.
- * PABLO was deleted on January 21, 2005 EIP
- *
*-------------------------------------------------------------------------
*/
/* Threadsafety termination code for API routines */
@@ -1961,6 +1953,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
} /*end scope from end of FUNC_ENTER*/ \
}} /*end scope from beginning of FUNC_ENTER*/
+/* Use this macro to match the FUNC_ENTER_API_NOFS macro */
#define FUNC_LEAVE_API_NOFS(ret_value) \
FINISH_MPE_LOG; \
H5TRACE_RETURN(ret_value); \
diff --git a/src/H5public.h b/src/H5public.h
index 3244800..5c1aff8 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -71,10 +71,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 54 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 59 /* For tweaks, bug-fixes, or development */
#define H5_VERS_SUBRELEASE "FA_a4" /* For pre-releases like snap0 */
/* Empty string for real releases. */
-#define H5_VERS_INFO "HDF5 library version: 1.9.54-FA_a4" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.9.59-FA_a4" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/Makefile.am b/src/Makefile.am
index 307ce51..5c5a7aa 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -71,7 +71,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \
H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \
H5HG.c H5HGcache.c H5HGdbg.c \
- H5HL.c H5HLcache.c H5HLdbg.c \
+ H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c \
H5HP.c H5I.c H5L.c H5Lexternal.c \
H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
H5MM.c H5MP.c H5MPtest.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 4aee8ee..dcabcfe 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -123,14 +123,14 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \
H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \
H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo H5HL.lo \
- H5HLcache.lo H5HLdbg.lo H5HP.lo H5I.lo H5L.lo H5Lexternal.lo \
- H5MF.lo H5MFaggr.lo H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo \
- H5MPtest.lo H5O.lo H5Oainfo.lo H5Oalloc.lo H5Oattr.lo \
- H5Oattribute.lo H5Obogus.lo H5Obtreek.lo H5Ocache.lo \
- H5Ocont.lo H5Ocopy.lo H5Odbg.lo H5Odrvinfo.lo H5Odtype.lo \
- H5Oefl.lo H5Ofill.lo H5Ofsinfo.lo H5Oginfo.lo H5Olayout.lo \
- H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo H5Oname.lo \
- H5Onull.lo H5Opline.lo H5Orefcount.lo H5Osdspace.lo \
+ H5HLcache.lo H5HLdbg.lo H5HLint.lo H5HP.lo H5I.lo H5L.lo \
+ H5Lexternal.lo H5MF.lo H5MFaggr.lo H5MFdbg.lo H5MFsection.lo \
+ H5MM.lo H5MP.lo H5MPtest.lo H5O.lo H5Oainfo.lo H5Oalloc.lo \
+ H5Oattr.lo H5Oattribute.lo H5Obogus.lo H5Obtreek.lo \
+ H5Ocache.lo H5Ocont.lo H5Ocopy.lo H5Odbg.lo H5Odrvinfo.lo \
+ H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Ofsinfo.lo H5Oginfo.lo \
+ H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo \
+ H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo H5Osdspace.lo \
H5Oshared.lo H5Oshmesg.lo H5Ostab.lo H5Ostorage.lo H5Otest.lo \
H5Ounknown.lo H5P.lo H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo \
H5Pdeprec.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo \
@@ -402,12 +402,12 @@ CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
-# We use RUNTESTS instead of RUNSERIAL directly because it may be that
+# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
-RUNTESTS = $(RUNSERIAL)
+RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
@@ -441,7 +441,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 = 44
+LT_VERS_REVISION = 49
LT_VERS_AGE = 0
H5detect_CFLAGS = -g $(AM_CFLAGS)
@@ -487,7 +487,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \
H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \
H5HG.c H5HGcache.c H5HGdbg.c \
- H5HL.c H5HLcache.c H5HLdbg.c \
+ H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c \
H5HP.c H5I.c H5L.c H5Lexternal.c \
H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
H5MM.c H5MP.c H5MPtest.c \
@@ -799,6 +799,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HL.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HLcache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HLdbg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HLint.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HP.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5I.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5L.Plo@am__quote@
@@ -1383,7 +1384,7 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
- $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
@@ -1454,7 +1455,7 @@ build-check-p: $(LIB) $(PROGS) $(TESTS)
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
- RUNTESTS="$(RUNPARALLEL)" || exit 1; \
+ RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \