diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-07-03 17:00:01 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-07-03 17:00:01 (GMT) |
commit | 153444fed7bd9dfb2b7d90a47c79d11bd1188e96 (patch) | |
tree | ec623ec5a7ebeca40c7195d2f698c9f6a95192da /src | |
parent | 3a6668b2f948d266bf7c99d641c331ff09021ceb (diff) | |
download | hdf5-153444fed7bd9dfb2b7d90a47c79d11bd1188e96.zip hdf5-153444fed7bd9dfb2b7d90a47c79d11bd1188e96.tar.gz hdf5-153444fed7bd9dfb2b7d90a47c79d11bd1188e96.tar.bz2 |
[svn-r8800] Purpose:
Code cleanup
Description:
Fix problems when compiling with C++ compiler.
Also clean up some warnings with gcc 3.4.x
Platforms tested:
FreeBSD 4.10 (sleipnir)
Too minor to require h5committest
Diffstat (limited to 'src')
-rw-r--r-- | src/H5AC.c | 12 | ||||
-rw-r--r-- | src/H5B.c | 58 | ||||
-rw-r--r-- | src/H5C.c | 222 | ||||
-rw-r--r-- | src/H5Cprivate.h | 10 | ||||
-rw-r--r-- | src/H5Fpkg.h | 2 | ||||
-rw-r--r-- | src/H5Gnode.c | 38 | ||||
-rw-r--r-- | src/H5HG.c | 30 | ||||
-rw-r--r-- | src/H5HGdbg.c | 2 | ||||
-rw-r--r-- | src/H5HL.c | 25 | ||||
-rw-r--r-- | src/H5HLdbg.c | 2 | ||||
-rw-r--r-- | src/H5I.c | 10 | ||||
-rw-r--r-- | src/H5O.c | 32 |
12 files changed, 197 insertions, 246 deletions
@@ -369,7 +369,7 @@ H5AC_create(const H5F_t *f, cache_ptr = H5C_create(H5C__DEFAULT_MAX_CACHE_SIZE, H5C__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1), - &H5AC_entry_type_names, + (const char **)H5AC_entry_type_names, H5AC_check_if_write_permitted); if ( NULL == cache_ptr ) { @@ -378,7 +378,7 @@ H5AC_create(const H5F_t *f, } else { - f->shared->cache = (struct H5AC_t *)cache_ptr; + f->shared->cache = (H5AC_t *)cache_ptr; } @@ -620,7 +620,7 @@ H5AC_set(H5F_t *f, info_ptr->addr = addr; info_ptr->type = type; - info_ptr->protected = FALSE; + info_ptr->is_protected = FALSE; #ifdef H5_HAVE_PARALLEL #ifdef H5_HAVE_FPHDF5 @@ -966,7 +966,7 @@ H5AC_protect(H5F_t *f, info_ptr->addr = addr; info_ptr->type = type; - info_ptr->protected = TRUE; + info_ptr->is_protected = TRUE; if ( (type->size)(f, thing, &(info_ptr->size)) < 0 ) { @@ -1119,9 +1119,9 @@ H5AC_unprotect(H5F_t *f, if ( H5FD_is_fphdf5_driver(lf) ) { - HDassert( info_ptr->protected ); + HDassert( info_ptr->is_protected ); - info_ptr->protected = FALSE; + info_ptr->is_protected = FALSE; /* * FIXME: If the metadata is *really* deleted at this point @@ -242,7 +242,7 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, bt->sizeof_node = size; bt->total_native_keysize = total_native_keysize; bt->sizeof_rkey = sizeof_rkey; - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; bt->ndirty = 0; bt->level = 0; bt->left = HADDR_UNDEF; @@ -346,7 +346,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) bt->sizeof_node = size = H5B_nodesize(f, type, &total_nkey_size, bt->sizeof_rkey); bt->total_native_keysize = total_nkey_size; bt->type = type; - bt->cache_info.dirty = FALSE; + bt->cache_info.is_dirty = FALSE; bt->ndirty = 0; if (NULL==(bt->page=H5FL_BLK_MALLOC(page,size)) || NULL==(bt->native=H5FL_BLK_MALLOC(native_block,total_nkey_size)) || @@ -519,7 +519,7 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt) assert(bt->type); assert(bt->type->encode); - if (bt->cache_info.dirty) { + if (bt->cache_info.is_dirty) { unsigned u; if (H5B_serialize(f, bt, bt->page) < 0) @@ -537,7 +537,7 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt) if (H5F_block_write(f, H5FD_MEM_BTREE, addr, bt->sizeof_node, dxpl_id, bt->page) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree node to disk") - bt->cache_info.dirty = FALSE; + bt->cache_info.is_dirty = FALSE; bt->ndirty = 0; } @@ -577,7 +577,7 @@ H5B_dest(H5F_t UNUSED *f, H5B_t *bt) assert(bt); /* Verify that node is clean */ - assert(bt->cache_info.dirty==0); + assert(bt->cache_info.is_dirty==0); H5FL_SEQ_FREE(haddr_t,bt->child); H5FL_SEQ_FREE(H5B_key_t,bt->key); @@ -620,7 +620,7 @@ H5B_clear(H5F_t *f, H5B_t *bt, hbool_t destroy) /* Look for dirty keys and reset the dirty flag. */ for (u=0; u<=bt->nchildren; u++) bt->key[u].dirty = FALSE; - bt->cache_info.dirty = FALSE; + bt->cache_info.is_dirty = FALSE; if (destroy) if (H5B_dest(f, bt) < 0) @@ -653,7 +653,7 @@ H5B_compute_size(H5F_t *f, H5B_t *bt, size_t *size_ptr) herr_t ret_value = SUCCEED; /* Return value */ size_t size; - FUNC_ENTER_NOAPI(H5B_compute_size, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5B_compute_size) /* check arguments */ HDassert(f); @@ -953,7 +953,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_t *old_bt, haddr /* * Truncate the old node. */ - old_bt->cache_info.dirty = TRUE; + old_bt->cache_info.is_dirty = TRUE; old_bt->nchildren = nleft; old_bt->ndirty = MIN(old_bt->ndirty, old_bt->nchildren); @@ -967,7 +967,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_t *old_bt, haddr if (NULL == (tmp_bt = H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load right sibling") - tmp_bt->cache_info.dirty = TRUE; + tmp_bt->cache_info.is_dirty = TRUE; tmp_bt->left = *new_addr_p; if (H5AC_unprotect(f, dxpl_id, H5AC_BT, old_bt->right, tmp_bt, FALSE) != SUCCEED) @@ -1183,7 +1183,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, if (NULL == (bt = H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child") - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; bt->left = old_root; if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, FALSE) != SUCCEED) @@ -1201,7 +1201,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, /* 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 */ - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; /* Make a copy of the old root information */ if (NULL == (new_bt = H5B_copy(f, bt))) { @@ -1223,7 +1223,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, 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) */ - new_bt->cache_info.dirty = TRUE; + new_bt->cache_info.is_dirty = TRUE; new_bt->left = HADDR_UNDEF; new_bt->right = HADDR_UNDEF; @@ -1289,7 +1289,7 @@ H5B_insert_child(const H5F_t *f, const H5B_class_t *type, H5B_t *bt, assert(bt); assert(bt->nchildren<2*H5F_KVALUE(f, type)); - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; recsize = bt->sizeof_rkey + H5F_SIZEOF_ADDR(f); if (H5B_INS_RIGHT == anchor) { @@ -1472,7 +1472,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR, "unable to create leaf node") } bt->nchildren = 1; - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; bt->ndirty = 1; bt->key[0].dirty = TRUE; bt->key[1].dirty = TRUE; @@ -1601,7 +1601,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * Update the left and right keys of the current node. */ if (*lt_key_changed) { - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; bt->key[idx].dirty = TRUE; if (idx > 0) { *lt_key_changed = FALSE; @@ -1610,7 +1610,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type } } if (*rt_key_changed) { - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; bt->key[idx+1].dirty = TRUE; if (idx+1 < bt->nchildren) { *rt_key_changed = FALSE; @@ -1623,7 +1623,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * The insertion simply changed the address for the child. */ bt->child[idx] = child_addr; - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; bt->ndirty = MAX(bt->ndirty, idx+1); ret_value = H5B_INS_NOOP; @@ -1934,7 +1934,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * our right key and indicate that it changed. */ if (*lt_key_changed) { - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; bt->key[idx].dirty = TRUE; if (idx>0) { /* Don't propagate change out of this B-tree node */ @@ -1944,7 +1944,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type } } if (*rt_key_changed) { - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; bt->key[idx+1].dirty = TRUE; if (idx+1<bt->nchildren) { /* Don't propagate change out of this B-tree node */ @@ -1966,7 +1966,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, "unable to decode key") HDmemcpy(sibling->key[0].nkey, bt->key[idx+1].nkey, type->sizeof_nkey); sibling->key[0].dirty = TRUE; - sibling->cache_info.dirty = TRUE; + sibling->cache_info.is_dirty = TRUE; if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, FALSE) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") @@ -1988,7 +1988,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * keys and the subtree pointer. Free this node (unless it's the * root node) and return H5B_INS_REMOVE. */ - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; bt->nchildren = 0; bt->ndirty = 0; if (level>0) { @@ -1997,7 +1997,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node from tree") sibling->right = bt->right; - sibling->cache_info.dirty = TRUE; + sibling->cache_info.is_dirty = TRUE; if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->left, sibling, FALSE) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") @@ -2016,7 +2016,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type sibling->key[0].dirty = TRUE; sibling->left = bt->left; - sibling->cache_info.dirty = TRUE; + sibling->cache_info.is_dirty = TRUE; if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, FALSE) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") @@ -2041,7 +2041,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * key into lt_key and notify the caller that the left key has * changed. Return H5B_INS_NOOP. */ - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; bt->nchildren -= 1; bt->ndirty = bt->nchildren; @@ -2074,7 +2074,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * freed). We copy the new right-most key into rt_key and notify the * caller that the right key has changed. Return H5B_INS_NOOP. */ - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; bt->nchildren -= 1; bt->ndirty = MIN(bt->ndirty, bt->nchildren); assert(bt->key[bt->nchildren].nkey); @@ -2095,7 +2095,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, "unable to decode key") HDmemcpy(sibling->key[0].nkey, bt->key[bt->nchildren].nkey, type->sizeof_nkey); sibling->key[0].dirty = TRUE; - sibling->cache_info.dirty = TRUE; + sibling->cache_info.is_dirty = TRUE; if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, FALSE) != SUCCEED) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") @@ -2114,7 +2114,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * the right are shifted left by one place. The subtree has already * been freed). Return H5B_INS_NOOP. */ - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; bt->nchildren -= 1; bt->ndirty = bt->nchildren; @@ -2202,7 +2202,7 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void if (0==bt->nchildren && 0!=bt->level) { bt->level = 0; - bt->cache_info.dirty = TRUE; + bt->cache_info.is_dirty = TRUE; } if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, FALSE) != SUCCEED) @@ -2483,7 +2483,7 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f bt->sizeof_rkey); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Dirty flag:", - bt->cache_info.dirty ? "True" : "False"); + bt->cache_info.is_dirty ? "True" : "False"); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of initial dirty children:", bt->ndirty); @@ -65,6 +65,10 @@ * * - Create MPI type for dirty objects when flushing in parallel. * + * - Fix TBBT routines so deletions don't move nodes in memory and + * point directly to the TBBT node from the LRU list, eliminating + * binary tree lookups when evicting objects from the cache. + * * Tests: * * - Trim execution time. @@ -92,12 +96,6 @@ #include "H5TBprivate.h" /* Threaded, Balanced, Binary Trees */ -/* Interface initialization -- disabled in this case */ -#if 0 -static int interface_initialize_g = 0; -#endif -#define INTERFACE_INIT NULL - /**************************************************************************** * @@ -866,7 +864,7 @@ struct H5C_t uint32_t magic; int32_t max_type_id; - const char * (* type_name_table_ptr)[]; + const char * (* type_name_table_ptr); size_t max_cache_size; size_t min_clean_size; @@ -1025,7 +1023,7 @@ H5C_t * H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, - const char * (* type_name_table_ptr)[], + const char * (* type_name_table_ptr), H5C_write_permitted_func_t check_write_permitted) { int i; @@ -1043,8 +1041,8 @@ H5C_create(size_t max_cache_size, for ( i = 0; i <= max_type_id; i++ ) { - HDassert( (*type_name_table_ptr)[i] ); - HDassert( strlen((* type_name_table_ptr)[i]) > 0 ); + HDassert( (type_name_table_ptr)[i] ); + HDassert( HDstrlen(( type_name_table_ptr)[i]) > 0 ); } @@ -1328,7 +1326,7 @@ H5C_flush_cache(H5F_t * f, actual_index_size += entry_ptr->size; #endif /* H5C_DO_SANITY_CHECKS */ - if ( entry_ptr->protected ) { + if ( entry_ptr->is_protected ) { /* we have major problems -- but lets flush everything * we can before we flag an error. @@ -1573,7 +1571,7 @@ H5C_insert_entry(H5F_t * f, * marking it unprotected. */ - entry_ptr->protected = FALSE; + entry_ptr->is_protected = FALSE; if ( H5C_insert_entry_in_tree(cache_ptr, entry_ptr) < 0 ) { @@ -1654,7 +1652,7 @@ H5C_rename_entry(H5F_t * f, entry_ptr = old_node_ptr->key; HDassert( entry_ptr->addr == old_addr ); HDassert( entry_ptr->type == type ); - HDassert( !(entry_ptr->protected) ); + HDassert( !(entry_ptr->is_protected) ); } search_target.addr = new_addr; @@ -1891,7 +1889,7 @@ H5C_protect(H5F_t * f, HDassert( entry_ptr->addr == addr ); HDassert( entry_ptr->type == type ); - if ( entry_ptr->protected ) { + if ( entry_ptr->is_protected ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ "Target already protected?!?.") @@ -1903,7 +1901,7 @@ H5C_protect(H5F_t * f, "Can't update replacement policy for protect") } - entry_ptr->protected = TRUE; + entry_ptr->is_protected = TRUE; ret_value = thing; @@ -1984,7 +1982,7 @@ H5C_unprotect(H5F_t * f, HDassert( entry_ptr->addr == addr ); HDassert( entry_ptr->type == type ); - if ( ! (entry_ptr->protected) ) { + if ( ! (entry_ptr->is_protected) ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ "Entry already unprotected??") @@ -1996,7 +1994,7 @@ H5C_unprotect(H5F_t * f, "Can't update replacement policy for unprotect.") } - entry_ptr->protected = FALSE; + entry_ptr->is_protected = FALSE; /* this implementation of the "deleted" option is a bit inefficient, as * we re-insert the entry to be deleted into the replacement policy @@ -2068,7 +2066,11 @@ done: herr_t H5C_stats(H5C_t * cache_ptr, const char * cache_name, - hbool_t display_detailed_stats) + hbool_t +#ifndef H5C_COLLECT_CACHE_STATS + UNUSED +#endif /* H5C_COLLECT_CACHE_STATS */ + display_detailed_stats) { herr_t ret_value = SUCCEED; /* Return value */ #if H5C_COLLECT_CACHE_STATS @@ -2202,7 +2204,7 @@ H5C_stats(H5C_t * cache_ptr, HDfprintf(stdout, "\n"); HDfprintf(stdout, " Stats on %s:\n", - (*(cache_ptr->type_name_table_ptr))[i]); + ((cache_ptr->type_name_table_ptr))[i]); if ( ( cache_ptr->hits[i] > 0 ) || ( cache_ptr->misses[i] > 0 ) ) { @@ -2274,7 +2276,9 @@ done: void H5C_stats__reset(H5C_t * cache_ptr) { +#if H5C_COLLECT_CACHE_STATS int i; +#endif /* H5C_COLLECT_CACHE_STATS */ HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -2432,7 +2436,7 @@ H5C_flush_single_entry(H5F_t * f, H5C_cache_entry_t * entry_ptr = NULL; H5C_cache_entry_t search_target; - FUNC_ENTER_NOAPI(H5C_flush_single_entry, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5C_flush_single_entry) HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -2464,7 +2468,7 @@ H5C_flush_single_entry(H5F_t * f, HDassert( node_ptr->data == node_ptr->key ); } - if ( ( entry_ptr != NULL ) && ( entry_ptr->protected ) ) + if ( ( entry_ptr != NULL ) && ( entry_ptr->is_protected ) ) { /* Attempt to flush a protected entry -- scream and die. */ HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, \ @@ -2491,7 +2495,7 @@ H5C_flush_single_entry(H5F_t * f, */ if ( ( ! cache_ptr->skip_dxpl_id_checks ) && ( ! clear_only ) && - ( entry_ptr->dirty ) && + ( entry_ptr->is_dirty ) && ( IS_H5FD_MPI(f) ) ) { H5P_genplist_t *dxpl; /* Dataset transfer property list */ @@ -2565,7 +2569,7 @@ H5C_flush_single_entry(H5F_t * f, /* Only block for all the processes on the first piece of metadata */ - if ( *first_flush_ptr && entry_ptr->dirty ) { + if ( *first_flush_ptr && entry_ptr->is_dirty ) { status = (entry_ptr->type->flush)(f, primary_dxpl_id, destroy, entry_ptr->addr, entry_ptr); *first_flush_ptr = FALSE; @@ -2583,7 +2587,7 @@ H5C_flush_single_entry(H5F_t * f, if ( ! destroy ) { - HDassert( !(entry_ptr->dirty) ); + HDassert( !(entry_ptr->is_dirty) ); } } @@ -2618,7 +2622,7 @@ H5C_insert_entry_in_tree(H5C_t * cache_ptr, herr_t ret_value = SUCCEED; /* Return value */ H5TB_NODE * node_ptr = NULL; - FUNC_ENTER_NOAPI(H5C_insert_entry_in_tree, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5C_insert_entry_in_tree) HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -2683,7 +2687,7 @@ H5C_load_entry(H5F_t * f, void * ret_value = NULL; H5C_cache_entry_t * entry_ptr = NULL; - FUNC_ENTER_NOAPI(H5C_load_entry, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5C_load_entry) HDassert( skip_file_checks || f ); HDassert( type ); @@ -2699,11 +2703,11 @@ H5C_load_entry(H5F_t * f, entry_ptr = (H5C_cache_entry_t *)thing; - HDassert( entry_ptr->dirty == FALSE ); + HDassert( entry_ptr->is_dirty == FALSE ); entry_ptr->addr = addr; entry_ptr->type = type; - entry_ptr->protected = FALSE; + entry_ptr->is_protected = FALSE; if ( (type->size)(f, thing, &(entry_ptr->size)) < 0 ) { @@ -2783,7 +2787,7 @@ H5C_make_space_in_cache(H5F_t * f, H5C_cache_entry_t * entry_ptr; H5C_cache_entry_t * prev_ptr; - FUNC_ENTER_NOAPI(H5C_make_space_in_cache, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5C_make_space_in_cache) HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -2803,11 +2807,11 @@ H5C_make_space_in_cache(H5F_t * f, ( entry_ptr != NULL ) ) { - HDassert( ! (entry_ptr->protected) ); + HDassert( ! (entry_ptr->is_protected) ); prev_ptr = entry_ptr->prev; - if ( entry_ptr->dirty ) { + if ( entry_ptr->is_dirty ) { result = H5C_flush_single_entry(f, primary_dxpl_id, @@ -2850,8 +2854,8 @@ H5C_make_space_in_cache(H5F_t * f, ( entry_ptr != NULL ) ) { - HDassert( ! (entry_ptr->protected) ); - HDassert( entry_ptr->dirty ); + HDassert( ! (entry_ptr->is_protected) ); + HDassert( entry_ptr->is_dirty ); prev_ptr = entry_ptr->aux_prev; @@ -2889,8 +2893,8 @@ H5C_make_space_in_cache(H5F_t * f, ( entry_ptr != NULL ) ) { - HDassert( ! (entry_ptr->protected) ); - HDassert( ! (entry_ptr->dirty) ); + HDassert( ! (entry_ptr->is_protected) ); + HDassert( ! (entry_ptr->is_dirty) ); prev_ptr = entry_ptr->aux_prev; @@ -2946,22 +2950,16 @@ H5C_remove_entry_from_tree(H5C_t * cache_ptr, { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5C_remove_entry_from_tree, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5C_remove_entry_from_tree) HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( entry_ptr ); + HDassert( !entry_ptr->is_protected); HDassert( node_ptr ); HDassert( node_ptr->data == entry_ptr ); HDassert( entry_ptr->size > 0 ); - if ( entry_ptr->protected ) - { - /* Attempt to delete a protected entry -- scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, \ - "Attempt to delete protected entry") - } - if ( H5TB_rem(&(cache_ptr->index_tree_ptr->root), node_ptr, NULL) != entry_ptr ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ @@ -3010,21 +3008,13 @@ H5C_update_rp_for_eviction(H5C_t * cache_ptr, { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5C_update_rp_for_eviction, FAIL) - -#if H5C_DO_SANITY_CHECKS - - if ( ( cache_ptr == NULL ) || - ( cache_ptr->magic != H5C__H5C_T_MAGIC ) || - ( entry_ptr == NULL ) || - ( entry_ptr->protected ) || - ( entry_ptr->size <= 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "General sanity checks failed") - } - -#endif /* H5C_DO_SANITY_CHECKS */ + FUNC_ENTER_NOAPI_NOINIT(H5C_update_rp_for_eviction) + HDassert( cache_ptr ); + HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + HDassert( entry_ptr ); + HDassert( !entry_ptr->is_protected); + HDassert( entry_ptr->size > 0 ); /* modified LRU specific code */ @@ -3040,7 +3030,7 @@ H5C_update_rp_for_eviction(H5C_t * cache_ptr, * dirty flag. */ - if ( entry_ptr->dirty ) { + if ( entry_ptr->is_dirty ) { H5C__AUX_DLL_REMOVE(entry_ptr, cache_ptr->dLRU_head_ptr, \ cache_ptr->dLRU_tail_ptr, \ @@ -3053,7 +3043,9 @@ H5C_update_rp_for_eviction(H5C_t * cache_ptr, cache_ptr->cLRU_list_size) } +#if H5C_DO_SANITY_CHECKS done: +#endif /* H5C_DO_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -3087,18 +3079,13 @@ H5C_update_rp_for_flush(H5C_t * cache_ptr, { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5C_update_rp_for_flush, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5C_update_rp_for_flush) -#if H5C_DO_SANITY_CHECKS - if ( ( cache_ptr == NULL ) || - ( cache_ptr->magic != H5C__H5C_T_MAGIC ) || - ( entry_ptr == NULL ) || - ( entry_ptr->protected ) || - ( entry_ptr->size <= 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "General sanity checks failed") - } -#endif /* H5C_DO_SANITY_CHECKS */ + HDassert( cache_ptr ); + HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + HDassert( entry_ptr ); + HDassert( !entry_ptr->is_protected); + HDassert( entry_ptr->size > 0 ); /* modified LRU specific code */ @@ -3122,7 +3109,7 @@ H5C_update_rp_for_flush(H5C_t * cache_ptr, * LRU list. */ - if ( entry_ptr->dirty ) { + if ( entry_ptr->is_dirty ) { H5C__AUX_DLL_REMOVE(entry_ptr, cache_ptr->dLRU_head_ptr, \ cache_ptr->dLRU_tail_ptr, \ cache_ptr->dLRU_list_len, \ @@ -3138,7 +3125,9 @@ H5C_update_rp_for_flush(H5C_t * cache_ptr, cache_ptr->cLRU_tail_ptr, cache_ptr->cLRU_list_len, \ cache_ptr->cLRU_list_size) +#if H5C_DO_SANITY_CHECKS done: +#endif /* H5C_DO_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -3172,18 +3161,13 @@ H5C_update_rp_for_insertion(H5C_t * cache_ptr, { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5C_update_rp_for_insertion, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5C_update_rp_for_insertion) -#if H5C_DO_SANITY_CHECKS - if ( ( cache_ptr == NULL ) || - ( cache_ptr->magic != H5C__H5C_T_MAGIC ) || - ( entry_ptr == NULL ) || - ( entry_ptr->protected ) || - ( entry_ptr->size <= 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "General sanity checks failed") - } -#endif /* H5C_DO_SANITY_CHECKS */ + HDassert( cache_ptr ); + HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + HDassert( entry_ptr ); + HDassert( !entry_ptr->is_protected); + HDassert( entry_ptr->size > 0 ); /* modified LRU specific code */ @@ -3197,7 +3181,7 @@ H5C_update_rp_for_insertion(H5C_t * cache_ptr, * appropriate. */ - if ( entry_ptr->dirty ) { + if ( entry_ptr->is_dirty ) { H5C__AUX_DLL_PREPEND(entry_ptr, cache_ptr->dLRU_head_ptr, \ cache_ptr->dLRU_tail_ptr, \ cache_ptr->dLRU_list_len, \ @@ -3209,7 +3193,9 @@ H5C_update_rp_for_insertion(H5C_t * cache_ptr, cache_ptr->cLRU_list_size) } +#if H5C_DO_SANITY_CHECKS done: +#endif /* H5C_DO_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -3247,18 +3233,13 @@ H5C_update_rp_for_protect(H5C_t * cache_ptr, { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5C_update_rp_for_protect, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5C_update_rp_for_protect) -#if H5C_DO_SANITY_CHECKS - if ( ( cache_ptr == NULL ) || - ( cache_ptr->magic != H5C__H5C_T_MAGIC ) || - ( entry_ptr == NULL ) || - ( entry_ptr->protected ) || - ( entry_ptr->size <= 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "General sanity checks failed") - } -#endif /* H5C_DO_SANITY_CHECKS */ + HDassert( cache_ptr ); + HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + HDassert( entry_ptr ); + HDassert( !entry_ptr->is_protected); + HDassert( entry_ptr->size > 0 ); /* modified LRU specific code */ @@ -3272,7 +3253,7 @@ H5C_update_rp_for_protect(H5C_t * cache_ptr, * as appropriate. */ - if ( entry_ptr->dirty ) { + if ( entry_ptr->is_dirty ) { H5C__AUX_DLL_REMOVE(entry_ptr, cache_ptr->dLRU_head_ptr, \ cache_ptr->dLRU_tail_ptr, \ @@ -3297,7 +3278,9 @@ H5C_update_rp_for_protect(H5C_t * cache_ptr, H5C__DLL_APPEND(entry_ptr, cache_ptr->pl_head_ptr, cache_ptr->pl_tail_ptr, \ cache_ptr->pl_len, cache_ptr->pl_size) +#if H5C_DO_SANITY_CHECKS done: +#endif /* H5C_DO_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -3331,18 +3314,13 @@ H5C_update_rp_for_rename(H5C_t * cache_ptr, { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5C_update_rp_for_rename, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5C_update_rp_for_rename) -#if H5C_DO_SANITY_CHECKS - if ( ( cache_ptr == NULL ) || - ( cache_ptr->magic != H5C__H5C_T_MAGIC ) || - ( entry_ptr == NULL ) || - ( entry_ptr->protected ) || - ( entry_ptr->size <= 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "General sanity checks failed") - } -#endif /* H5C_DO_SANITY_CHECKS */ + HDassert( cache_ptr ); + HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + HDassert( entry_ptr ); + HDassert( !entry_ptr->is_protected); + HDassert( entry_ptr->size > 0 ); /* modified LRU specific code */ @@ -3360,7 +3338,7 @@ H5C_update_rp_for_rename(H5C_t * cache_ptr, * as appropriate. */ - if ( entry_ptr->dirty ) { + if ( entry_ptr->is_dirty ) { H5C__AUX_DLL_REMOVE(entry_ptr, cache_ptr->dLRU_head_ptr, \ cache_ptr->dLRU_tail_ptr, \ @@ -3385,7 +3363,9 @@ H5C_update_rp_for_rename(H5C_t * cache_ptr, cache_ptr->cLRU_list_size) } +#if H5C_DO_SANITY_CHECKS done: +#endif /* H5C_DO_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -3423,18 +3403,13 @@ H5C_update_rp_for_unprotect(H5C_t * cache_ptr, { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5C_update_rp_for_unprotect, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5C_update_rp_for_unprotect) -#if H5C_DO_SANITY_CHECKS - if ( ( cache_ptr == NULL ) || - ( cache_ptr->magic != H5C__H5C_T_MAGIC ) || - ( entry_ptr == NULL ) || - ( !(entry_ptr->protected) ) || - ( entry_ptr->size <= 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "General sanity checks failed") - } -#endif /* H5C_DO_SANITY_CHECKS */ + HDassert( cache_ptr ); + HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + HDassert( entry_ptr ); + HDassert( entry_ptr->is_protected); + HDassert( entry_ptr->size > 0 ); /* Regardless of the replacement policy, remove the entry from the * protected list. @@ -3456,7 +3431,7 @@ H5C_update_rp_for_unprotect(H5C_t * cache_ptr, * dirty LRU list as appropriate. */ - if ( entry_ptr->dirty ) { + if ( entry_ptr->is_dirty ) { H5C__AUX_DLL_PREPEND(entry_ptr, cache_ptr->dLRU_head_ptr, \ cache_ptr->dLRU_tail_ptr, \ @@ -3473,18 +3448,11 @@ H5C_update_rp_for_unprotect(H5C_t * cache_ptr, /* End modified LRU specific code. */ +#if H5C_DO_SANITY_CHECKS done: +#endif /* H5C_DO_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) } /* H5C_update_rp_for_unprotect() */ - -/*************************************************************************/ -/*************************************************************************/ -/*************************************************************************/ -/********************************** END **********************************/ -/*************************************************************************/ -/*************************************************************************/ -/*************************************************************************/ - diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 2a0d3db..98bf009 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -172,7 +172,7 @@ typedef herr_t (*H5C_write_permitted_func_t)(H5F_t *f, * The name is not particularly descriptive, but is retained * to avoid changes in existing code. * - * dirty: Boolean flag indicating whether the contents of the cache + * is_dirty: Boolean flag indicating whether the contents of the cache * entry has been modified since the last time it was written * to disk. * @@ -186,7 +186,7 @@ typedef herr_t (*H5C_write_permitted_func_t)(H5F_t *f, * someday. However it will require a change in the * cache interface. * - * protected: Boolean flag indicating whether this entry is protected + * is_protected: Boolean flag indicating whether this entry is protected * (or locked, to use more conventional terms). When it is * protected, the entry cannot be flushed or accessed until * it is unprotected (or unlocked -- again to use more @@ -279,8 +279,8 @@ typedef struct H5C_cache_entry_t haddr_t addr; size_t size; const H5C_class_t * type; - hbool_t dirty; - hbool_t protected; + hbool_t is_dirty; + hbool_t is_protected; /* fields supporting replacement policies: */ @@ -312,7 +312,7 @@ typedef struct H5C_t H5C_t; H5_DLL H5C_t * H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, - const char * (* type_name_table_ptr)[], + const char * (* type_name_table_ptr), H5C_write_permitted_func_t check_write_permitted); H5_DLL herr_t H5C_dest(H5F_t * f, diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index ce850ab..0853a89 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -111,7 +111,7 @@ typedef struct H5F_file_t { unsigned super_chksum; /* Superblock checksum */ unsigned drvr_chksum; /* Driver info block checksum */ - struct H5AC_t *cache; /* The object cache */ + H5AC_t *cache; /* The object cache */ hid_t fcpl_id; /* File creation property list ID */ int mdc_nelmts; /* Size of meta data cache (elements) */ size_t rdcc_nelmts; /* Size of raw data chunk cache (elmts) */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 530020e..629cb48 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -442,7 +442,7 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_ for (i=0; i<sym->nsyms; i++) { if (sym->entry[i].dirty) { /* Set the node's dirty flag */ - sym->cache_info.dirty = TRUE; + sym->cache_info.is_dirty = TRUE; /* Reset the entry's dirty flag */ sym->entry[i].dirty=FALSE; @@ -452,7 +452,7 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_ /* * Write the symbol node to disk. */ - if (sym->cache_info.dirty) { + if (sym->cache_info.is_dirty) { size = H5G_node_size(f); /* Allocate temporary buffer */ @@ -468,7 +468,7 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_ H5FL_BLK_FREE(symbol_node,buf); /* Reset the node's dirty flag */ - sym->cache_info.dirty = FALSE; + sym->cache_info.is_dirty = FALSE; } /* @@ -563,7 +563,7 @@ H5G_node_dest(H5F_t UNUSED *f, H5G_node_t *sym) assert(sym); /* Verify that node is clean */ - assert (sym->cache_info.dirty==0); + assert (sym->cache_info.is_dirty==0); if(sym->entry) sym->entry = H5FL_SEQ_FREE(H5G_entry_t,sym->entry); @@ -605,7 +605,7 @@ H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy) /* Look for dirty entries and reset the dirty flag. */ for (i=0; i<sym->nsyms; i++) sym->entry[i].dirty=FALSE; - sym->cache_info.dirty = FALSE; + sym->cache_info.is_dirty = FALSE; /* * Destroy the symbol node? This might happen if the node is being @@ -639,9 +639,7 @@ done: static herr_t H5G_compute_size(H5F_t *f, H5G_node_t UNUSED *sym, size_t *size_ptr) { - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5G_compute_size, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_compute_size); /* * Check arguments. @@ -651,9 +649,7 @@ H5G_compute_size(H5F_t *f, H5G_node_t UNUSED *sym, size_t *size_ptr) *size_ptr = H5G_node_size(f); -done: - FUNC_LEAVE_NOAPI(ret_value); - + FUNC_LEAVE_NOAPI(SUCCEED); } /* H5G_compute_size() */ @@ -701,7 +697,7 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key, size = H5G_node_size(f); 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"); - sym->cache_info.dirty = TRUE; + sym->cache_info.is_dirty = TRUE; sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t,(2*H5F_SYM_LEAF_K(f))); if (NULL==sym->entry) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); @@ -1096,13 +1092,13 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, HDmemcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f), H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t)); snrt->nsyms = H5F_SYM_LEAF_K(f); - snrt->cache_info.dirty = TRUE; + snrt->cache_info.is_dirty = TRUE; /* The left node */ HDmemset(sn->entry + H5F_SYM_LEAF_K(f), 0, H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t)); sn->nsyms = H5F_SYM_LEAF_K(f); - sn->cache_info.dirty = TRUE; + sn->cache_info.is_dirty = TRUE; /* The middle key */ md_key->offset = sn->entry[sn->nsyms - 1].name_off; @@ -1130,7 +1126,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, } else { /* Where to insert the new entry? */ ret_value = H5B_INS_NOOP; - sn->cache_info.dirty = TRUE; + sn->cache_info.is_dirty = TRUE; insert_into = sn; if (idx == sn->nsyms) { rt_key->offset = offset; @@ -1314,7 +1310,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, *rt_key = *lt_key; *rt_key_changed = TRUE; sn->nsyms = 0; - sn->cache_info.dirty = TRUE; + sn->cache_info.is_dirty = TRUE; if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5G_node_size(f))<0 || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, TRUE)<0) { sn = NULL; @@ -1330,7 +1326,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, * change. */ sn->nsyms -= 1; - sn->cache_info.dirty = TRUE; + sn->cache_info.is_dirty = TRUE; HDmemmove(sn->entry+idx, sn->entry+idx+1, (sn->nsyms-idx)*sizeof(H5G_entry_t)); ret_value = H5B_INS_NOOP; @@ -1342,7 +1338,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, * should be changed to reflect the new right-most entry. */ sn->nsyms -= 1; - sn->cache_info.dirty = TRUE; + sn->cache_info.is_dirty = TRUE; rt_key->offset = sn->entry[sn->nsyms-1].name_off; *rt_key_changed = TRUE; ret_value = H5B_INS_NOOP; @@ -1353,7 +1349,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, * node. */ sn->nsyms -= 1; - sn->cache_info.dirty = TRUE; + sn->cache_info.is_dirty = TRUE; HDmemmove(sn->entry+idx, sn->entry+idx+1, (sn->nsyms-idx)*sizeof(H5G_entry_t)); ret_value = H5B_INS_NOOP; @@ -1380,7 +1376,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, *rt_key = *lt_key; *rt_key_changed = TRUE; sn->nsyms = 0; - sn->cache_info.dirty = TRUE; + sn->cache_info.is_dirty = TRUE; if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5G_node_size(f))<0 || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, TRUE)<0) { sn = NULL; @@ -1729,7 +1725,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, fprintf(stream, "%*sSymbol Table Node...\n", indent, ""); fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Dirty:", - sn->cache_info.dirty ? "Yes" : "No"); + sn->cache_info.is_dirty ? "Yes" : "No"); fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Size of Node (in bytes):", (unsigned)H5G_node_size(f)); fprintf(stream, "%*s%-*s %d of %d\n", indent, "", fwidth, @@ -214,7 +214,7 @@ H5HG_create (H5F_t *f, hid_t dxpl_id, size_t size) "memory allocation failed"); heap->addr = addr; heap->size = size; - heap->cache_info.dirty = TRUE; + heap->cache_info.is_dirty = TRUE; if (NULL==(heap->chunk = H5FL_BLK_MALLOC (heap_chunk,size))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, \ "memory allocation failed"); @@ -519,10 +519,10 @@ H5HG_flush (H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HG_heap_t assert (H5F_addr_eq (addr, heap->addr)); assert (heap); - if (heap->cache_info.dirty) { + if (heap->cache_info.is_dirty) { if (H5F_block_write (f, H5FD_MEM_GHEAP, addr, heap->size, dxpl_id, heap->chunk)<0) HGOTO_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write global heap collection to file"); - heap->cache_info.dirty = 0; + heap->cache_info.is_dirty = FALSE; } if (destroy) { @@ -560,7 +560,7 @@ H5HG_dest (H5F_t *f, H5HG_heap_t *heap) assert (heap); /* Verify that node is clean */ - assert (heap->cache_info.dirty==0); + assert (heap->cache_info.is_dirty==FALSE); for (i=0; i<f->shared->ncwfs; i++) { if (f->shared->cwfs[i]==heap) { @@ -602,7 +602,7 @@ H5HG_clear(H5F_t *f, H5HG_heap_t *heap, hbool_t destroy) assert (heap); /* Mark heap as clean */ - heap->cache_info.dirty = 0; + heap->cache_info.is_dirty = FALSE; if (destroy) if (H5HG_dest(f, heap) < 0) @@ -632,9 +632,7 @@ done: static herr_t H5HG_compute_size(H5F_t UNUSED *f, H5HG_heap_t *heap, size_t *size_ptr) { - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5HG_compute_size, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HG_compute_size); /* Check arguments */ HDassert(heap); @@ -642,9 +640,7 @@ H5HG_compute_size(H5F_t UNUSED *f, H5HG_heap_t *heap, size_t *size_ptr) *size_ptr = heap->size; -done: - FUNC_LEAVE_NOAPI(ret_value); - + FUNC_LEAVE_NOAPI(SUCCEED); } /* H5HG_compute_size() */ @@ -757,7 +753,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size) } /* Mark the heap as dirty */ - heap->cache_info.dirty = 1; + heap->cache_info.is_dirty = TRUE; /* Set the return value */ ret_value=idx; @@ -848,7 +844,7 @@ H5HG_extend (H5F_t *f, H5HG_heap_t *heap, size_t size) assert(H5HG_ISALIGNED(heap->obj[0].size)); /* Mark the heap as dirty */ - heap->cache_info.dirty = 1; + heap->cache_info.is_dirty = TRUE; done: FUNC_LEAVE_NOAPI(ret_value); @@ -1020,7 +1016,7 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out* need-(H5HG_SIZEOF_OBJHDR(f)+size)); #endif /* OLD_WAY */ } /* end if */ - heap->cache_info.dirty = TRUE; + heap->cache_info.is_dirty = TRUE; /* Return value */ hobj->addr = heap->addr; @@ -1227,7 +1223,7 @@ H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) 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->cache_info.dirty = TRUE; + heap->cache_info.is_dirty = TRUE; } /* end if */ /* Set return value */ @@ -1306,14 +1302,14 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) H5F_ENCODE_LENGTH (f, p, heap->obj[0].size); } HDmemset (heap->obj+hobj->idx, 0, sizeof(H5HG_obj_t)); - heap->cache_info.dirty = 1; + heap->cache_info.is_dirty = TRUE; if (heap->obj[0].size+H5HG_SIZEOF_HDR(f)==heap->size) { /* * The collection is empty. Remove it from the CWFS list and return it * to the file free list. */ - heap->cache_info.dirty = FALSE; + heap->cache_info.is_dirty = FALSE; H5_CHECK_OVERFLOW(heap->size,size_t,hsize_t); H5MF_xfree(f, H5FD_MEM_GHEAP, dxpl_id, heap->addr, (hsize_t)heap->size); deleted=TRUE; /* Indicate that the object was deleted, for the unprotect call */ diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c index f3f081f..dccdc54 100644 --- a/src/H5HGdbg.c +++ b/src/H5HGdbg.c @@ -75,7 +75,7 @@ H5HG_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, fprintf(stream, "%*sGlobal Heap Collection...\n", indent, ""); fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, "Dirty:", - (int)(h->cache_info.dirty)); + (int)(h->cache_info.is_dirty)); fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Total collection size in file:", (unsigned long)(h->size)); @@ -170,7 +170,7 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) } /* add to cache */ - heap->cache_info.dirty = 1; + heap->cache_info.is_dirty = TRUE; if (H5AC_set(f, dxpl_id, H5AC_LHEAP, *addr_p, heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache heap"); @@ -549,7 +549,7 @@ H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HL_t *heap) assert(H5F_addr_defined(addr)); assert(heap); - if (heap->cache_info.dirty) { + 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 */ @@ -578,7 +578,7 @@ H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HL_t *heap) HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "unable to write heap data to file") } - heap->cache_info.dirty = 0; + heap->cache_info.is_dirty = FALSE; } /* Should we destroy the memory version? */ @@ -618,7 +618,7 @@ H5HL_dest(H5F_t UNUSED *f, H5HL_t *heap) assert(heap); /* Verify that node is clean */ - assert (heap->cache_info.dirty==0); + assert (heap->cache_info.is_dirty==FALSE); if(heap->chunk) heap->chunk = H5FL_BLK_FREE(heap_chunk,heap->chunk); @@ -659,7 +659,7 @@ H5HL_clear(H5F_t *f, H5HL_t *heap, hbool_t destroy) assert(heap); /* Mark heap as clean */ - heap->cache_info.dirty = 0; + heap->cache_info.is_dirty = FALSE; if (destroy) if (H5HL_dest(f, heap) < 0) @@ -688,9 +688,7 @@ done: static herr_t H5HL_compute_size(H5F_t *f, H5HL_t *heap, size_t *size_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5HL_compute_size, FAIL); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_compute_size); /* check arguments */ HDassert(f); @@ -699,10 +697,7 @@ H5HL_compute_size(H5F_t *f, H5HL_t *heap, size_t *size_ptr) *size_ptr = H5HL_SIZEOF_HDR(f) + heap->disk_alloc; -done: - - FUNC_LEAVE_NOAPI(ret_value) - + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HL_compute_size() */ @@ -961,7 +956,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t buf_size, const void * if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_PROTECT, (size_t)(-1), "unable to load heap"); - ++heap->cache_info.dirty; + heap->cache_info.is_dirty=TRUE; /* Cache this for later */ sizeof_hdr= H5HL_SIZEOF_HDR(f); @@ -1134,7 +1129,7 @@ H5HL_write(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, co assert(offset < heap->mem_alloc); assert(offset + size <= heap->mem_alloc); - ++heap->cache_info.dirty; + heap->cache_info.is_dirty=TRUE; HDmemcpy(heap->chunk + H5HL_SIZEOF_HDR(f) + offset, buf, size); done: @@ -1200,7 +1195,7 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size) assert(offset + size <= heap->mem_alloc); fl = heap->freelist; - ++heap->cache_info.dirty; + heap->cache_info.is_dirty=TRUE; /* * Check if this chunk can be prepended or appended to an already diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index 1197fb8..0061d37 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -73,7 +73,7 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fprintf(stream, "%*sLocal Heap...\n", indent, ""); fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, "Dirty:", - (int) (h->cache_info.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)); @@ -439,9 +439,7 @@ herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members) FUNC_ENTER_API(H5Inmembers, FAIL); if( H5I_IS_LIB_TYPE( type ) ) - { HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type"); - } /* Validate parameters. This needs to be done here, instead of letting * the private interface handle it, because the public interface throws @@ -454,10 +452,12 @@ herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members) if (num_members) { - *num_members = H5I_nmembers(type); + int members; - if (*num_members < 0) - ret_value = FAIL; + if ((members = H5I_nmembers(type)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTCOUNT, FAIL, "can't compute number of members"); + + *num_members=(hsize_t)members; } done: @@ -281,7 +281,7 @@ H5O_init(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5G_entry_t *ent/*out*/, had if (NULL == (oh = H5FL_MALLOC(H5O_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - oh->cache_info.dirty = TRUE; + oh->cache_info.is_dirty = TRUE; oh->version = H5O_VERSION; oh->nlink = 0; @@ -658,7 +658,7 @@ H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh) assert(oh); /* flush */ - if (oh->cache_info.dirty) { + if (oh->cache_info.is_dirty) { p = buf; /* encode version */ @@ -779,7 +779,7 @@ H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh) oh->chunk[u].dirty = FALSE; } /* end if */ } /* end for */ - oh->cache_info.dirty = FALSE; + oh->cache_info.is_dirty = FALSE; } if (destroy) { @@ -818,7 +818,7 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh) assert(oh); /* Verify that node is clean */ - assert (oh->cache_info.dirty==0); + assert (oh->cache_info.is_dirty==FALSE); /* destroy chunks */ for (i = 0; i < oh->nchunks; i++) { @@ -883,7 +883,7 @@ H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy) oh->mesg[u].dirty=FALSE; /* Mark whole header as clean */ - oh->cache_info.dirty=FALSE; + oh->cache_info.is_dirty=FALSE; if (destroy) if (H5O_dest(f, oh) < 0) @@ -921,9 +921,8 @@ H5O_compute_size(H5F_t *f, H5O_t *oh, size_t *size_ptr) { unsigned u; size_t size; - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_compute_size, FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5O_compute_size); /* check args */ HDassert(f); @@ -941,10 +940,7 @@ H5O_compute_size(H5F_t *f, H5O_t *oh, size_t *size_ptr) *size_ptr = size; -done: - - FUNC_LEAVE_NOAPI(ret_value); - + FUNC_LEAVE_NOAPI(SUCCEED); } /* H5O_compute_size() */ @@ -1240,7 +1236,7 @@ H5O_link(const H5G_entry_t *ent, int adjust, hid_t dxpl_id) if (oh->nlink + adjust < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "link count would be negative"); oh->nlink += adjust; - oh->cache_info.dirty = TRUE; + oh->cache_info.is_dirty = TRUE; /* Check if the object should be deleted */ if(oh->nlink==0) { @@ -1261,7 +1257,7 @@ H5O_link(const H5G_entry_t *ent, int adjust, hid_t dxpl_id) } /* end if */ } else if (adjust>0) { oh->nlink += adjust; - oh->cache_info.dirty = TRUE; + oh->cache_info.is_dirty = TRUE; } /* Set return value */ @@ -2203,7 +2199,7 @@ H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type, idx_msg->flags = flags; idx_msg->dirty = TRUE; - oh->cache_info.dirty = TRUE; + oh->cache_info.is_dirty = TRUE; done: FUNC_LEAVE_NOAPI(ret_value); @@ -2270,7 +2266,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) } *((time_t*)(oh->mesg[idx].native)) = now; oh->mesg[idx].dirty = TRUE; - oh->cache_info.dirty = TRUE; + oh->cache_info.is_dirty = TRUE; done: FUNC_LEAVE_NOAPI(ret_value); @@ -2560,7 +2556,7 @@ H5O_remove_real(H5G_entry_t *ent, const H5O_class_t *type, int sequence, hid_t d else curr_msg->native = H5O_free_real(type, curr_msg->native); curr_msg->dirty = TRUE; - oh->cache_info.dirty = TRUE; + oh->cache_info.is_dirty = TRUE; H5O_touch_oh(ent->file, oh, FALSE); } } @@ -3022,7 +3018,7 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size) msg->dirty = TRUE; msg->native = NULL; - oh->cache_info.dirty = TRUE; + oh->cache_info.is_dirty = TRUE; /* Set return value */ ret_value=idx; @@ -3489,7 +3485,7 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, "Dirty:", - (int) (oh->cache_info.dirty)); + (int) (oh->cache_info.is_dirty)); HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, "Version:", (int) (oh->version)); |