summaryrefslogtreecommitdiffstats
path: root/generic/tclPort.h
Commit message (Expand)AuthorAgeFilesLines
* Proposed solution for Bug 3598300 on MacOSXbug_3598300jan.nijtmans2013-01-181-4/+1
* [Bug 3598300]: unix: tcl.h does not include sys/stat.h.jan.nijtmans2013-01-181-1/+3
* revert [8abba84224], and make sure that every source file that uses Tcl_StatB...jan.nijtmans2013-01-171-2/+3
* proposed fix for Bug 3598300jan.nijtmans2012-12-261-3/+2
* Move CYGWIN-specific stuff from tclPort.h to tclUnixPort.h, where it belongsjan.nijtmans2012-04-271-12/+0
* make some more internal tables constjan.nijtmans2012-04-231-1/+0
|\
* | cygwin should use SetEnvironmentVariable for windows envjan.nijtmans2012-04-051-2/+5
* | Now that we're no longer using SCM based on RCS, the RCS Keyword lines causedgp2011-03-021-2/+0
|\ \ | |/
| * Now that we're no longer using SCM based on RCS, the RCS Keyword lines causedgp2011-03-011-2/+0
| * * generic/tclPort.h: remove the ../{win,unix}/ header dirs as thehobbs2008-11-041-3/+3
| * * generic/tcl.h Made changes so that the "wideInt" Tcl_ObjTypedgp2003-04-161-5/+9
* | Various CYGWIN-related fixesnijtmans2010-01-311-7/+7
* | Fix environment tests under CYGWINnijtmans2010-01-061-1/+11
* | * generic/tclPort.h: remove the ../win/ header dir as the buildhobbs2008-11-041-2/+2
* | Merged kennykb-numerics-branch back to the head; TIPs 132 and 232Kevin B Kenny2005-05-101-1/+1
* | Move #include of tclConfig.h to right place.dkf2005-01-051-2/+2
* | * generic/tclPort.h: Relative include of tclWinPort.h returned as it was requ...davygrvy2004-11-241-2/+2
* | * unix/configure.in: The change below reveals that the publicdgp2004-11-171-1/+4
* | ChangeLog reformat.dgp2004-11-121-4/+1
* | * unix/Makefile.in: Be sure -I{BUILD_DIR} comes first so thatdgp2004-11-121-1/+4
* | * generic/tclPort.h:das2004-04-241-3/+3
* | Removed support for Mac OS Classic platform [Patch 918142]das2004-03-171-6/+2
* | * generic/tcl.h Made changes so that the "wideInt" Tcl_ObjTypedgp2003-04-161-5/+9
|/
* TIP#72 implementation. See ChangeLog for details.dkf2002-02-151-5/+17
* * generic/tcl.decls:stanton1999-05-251-2/+2
* * generic/tclPort.h: Added include of tcl.h since it definesstanton1999-04-231-1/+3
* merged tcl 8.1 branch back into the main trunkstanton1999-04-161-2/+2
* Replaced SCCS strings, fixed binary filescore_8_0_3stanton1998-09-141-1/+1
* Initial revisionrjohnson1998-03-261-0/+29
*/ @@ -874,7 +868,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 14 2006 * *------------------------------------------------------------------------- @@ -976,7 +969,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 2 2005 * *------------------------------------------------------------------------- @@ -1021,7 +1013,6 @@ done: * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 19 2005 * *------------------------------------------------------------------------- @@ -1045,7 +1036,6 @@ H5B2__assert_leaf(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 19 2005 * *------------------------------------------------------------------------- diff --git a/src/H5B2module.h b/src/H5B2module.h index 35c982c..6e8c92a 100644 --- a/src/H5B2module.h +++ b/src/H5B2module.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5B2stat.c b/src/H5B2stat.c index 5dd9cc2..5c09b3d 100644 --- a/src/H5B2stat.c +++ b/src/H5B2stat.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Monday, March 6, 2006 * * Purpose: v2 B-tree metadata statistics functions. diff --git a/src/H5B2test.c b/src/H5B2test.c index 7affd49..ee37c54 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, February 3, 2005 * * Purpose: v2 B-tree testing functions. diff --git a/src/H5Bcache.c b/src/H5Bcache.c index c2c7a80..80fb200 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -15,7 +15,7 @@ * * Created: H5Bcache.c * Oct 31 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement B-tree metadata cache methods. * @@ -98,7 +98,6 @@ const H5AC_class_t H5AC_BT[1] = {{ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 18, 2010 * *------------------------------------------------------------------------- @@ -135,7 +134,6 @@ H5B__cache_get_initial_load_size(void *_udata, size_t *image_len) * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 24, 2008 * *------------------------------------------------------------------------- @@ -241,7 +239,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 20, 2010 * *------------------------------------------------------------------------- @@ -277,7 +274,6 @@ H5B__cache_image_len(const void *_thing, size_t *image_len) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 24, 2008 * *------------------------------------------------------------------------- @@ -363,7 +359,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 26, 2008 * *------------------------------------------------------------------------- diff --git a/src/H5C.c b/src/H5C.c index 91e4158..fd4386c 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -147,11 +147,11 @@ static herr_t H5C__flash_increase_cache_size(H5C_t * cache_ptr, static herr_t H5C__flush_invalidate_cache(H5F_t *f, unsigned flags); -static herr_t H5C_flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags); +static herr_t H5C__flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags); static herr_t H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags); -static void * H5C_load_entry(H5F_t * f, +static void * H5C__load_entry(H5F_t * f, #ifdef H5_HAVE_PARALLEL hbool_t coll_access, #endif /* H5_HAVE_PARALLEL */ @@ -166,19 +166,20 @@ static herr_t H5C__mark_flush_dep_clean(H5C_cache_entry_t * entry); static herr_t H5C__serialize_ring(H5F_t *f, H5C_ring_t ring); static herr_t H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr); - +static herr_t H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, + H5C_cache_entry_t *entry_ptr); static herr_t H5C__verify_len_eoa(H5F_t *f, const H5C_class_t * type, haddr_t addr, size_t *len, hbool_t actual); #if H5C_DO_SLIST_SANITY_CHECKS -static hbool_t H5C_entry_in_skip_list(H5C_t * cache_ptr, +static hbool_t H5C__entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t *target_ptr); #endif /* H5C_DO_SLIST_SANITY_CHECKS */ #if H5C_DO_EXTREME_SANITY_CHECKS -static herr_t H5C_validate_lru_list(H5C_t * cache_ptr); -static herr_t H5C_validate_pinned_entry_list(H5C_t * cache_ptr); -static herr_t H5C_validate_protected_entry_list(H5C_t * cache_ptr); +static herr_t H5C__validate_lru_list(H5C_t * cache_ptr); +static herr_t H5C__validate_pinned_entry_list(H5C_t * cache_ptr); +static herr_t H5C__validate_protected_entry_list(H5C_t * cache_ptr); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ #ifndef NDEBUG @@ -406,17 +407,17 @@ H5C_create(size_t max_cache_size, (cache_ptr->resize_ctl).max_increment = H5C__DEF_AR_MAX_INCREMENT; (cache_ptr->resize_ctl).flash_incr_mode = H5C_flash_incr__off; - (cache_ptr->resize_ctl).flash_multiple = 1.0f; - (cache_ptr->resize_ctl).flash_threshold = 0.25f; + (cache_ptr->resize_ctl).flash_multiple = (double)1.0f; + (cache_ptr->resize_ctl).flash_threshold = (double)0.25f; (cache_ptr->resize_ctl).decr_mode = H5C_decr__off; - (cache_ptr->resize_ctl).upper_hr_threshold = H5C__DEF_AR_UPPER_THRESHHOLD; - (cache_ptr->resize_ctl).decrement = H5C__DEF_AR_DECREMENT; + (cache_ptr->resize_ctl).upper_hr_threshold = (double)H5C__DEF_AR_UPPER_THRESHHOLD; + (cache_ptr->resize_ctl).decrement = (double)H5C__DEF_AR_DECREMENT; (cache_ptr->resize_ctl).apply_max_decrement = TRUE; (cache_ptr->resize_ctl).max_decrement = H5C__DEF_AR_MAX_DECREMENT; (cache_ptr->resize_ctl).epochs_before_eviction = H5C__DEF_AR_EPCHS_B4_EVICT; (cache_ptr->resize_ctl).apply_empty_reserve = TRUE; - (cache_ptr->resize_ctl).empty_reserve = H5C__DEF_AR_EMPTY_RESERVE; + (cache_ptr->resize_ctl).empty_reserve = (double)H5C__DEF_AR_EMPTY_RESERVE; cache_ptr->epoch_markers_active = 0; @@ -691,7 +692,7 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, /*------------------------------------------------------------------------- - * Function: H5C_free_tag_list_cb + * Function: H5C__free_tag_list_cb * * Purpose: Callback function to free tag nodes from the skip list. * @@ -703,11 +704,11 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, *------------------------------------------------------------------------- */ static herr_t -H5C_free_tag_list_cb(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) +H5C__free_tag_list_cb(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) { H5C_tag_info_t *tag_info = (H5C_tag_info_t *)_item; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(tag_info); @@ -715,7 +716,7 @@ H5C_free_tag_list_cb(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED tag_info = H5FL_FREE(H5C_tag_info_t, tag_info); FUNC_LEAVE_NOAPI(0) -} /* H5C_free_tag_list_cb() */ +} /* H5C__free_tag_list_cb() */ /*------------------------------------------------------------------------- @@ -863,7 +864,7 @@ H5C_dest(H5F_t * f) } /* end if */ if(cache_ptr->tag_list != NULL) { - H5SL_destroy(cache_ptr->tag_list, H5C_free_tag_list_cb, NULL); + H5SL_destroy(cache_ptr->tag_list, H5C__free_tag_list_cb, NULL); cache_ptr->tag_list = NULL; } /* end if */ @@ -951,7 +952,7 @@ H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flag HDassert(H5F_addr_defined(addr)); #if H5C_DO_EXTREME_SANITY_CHECKS - if(H5C_validate_lru_list(cache_ptr) < 0) + if(H5C__validate_lru_list(cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -986,7 +987,7 @@ H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flag done: #if H5C_DO_EXTREME_SANITY_CHECKS - if(H5C_validate_lru_list(cache_ptr) < 0) + if(H5C__validate_lru_list(cache_ptr) < 0) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1094,9 +1095,9 @@ H5C_flush_cache(H5F_t *f, unsigned flags) #endif /* H5C_DO_SANITY_CHECKS */ #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1277,9 +1278,9 @@ H5C_insert_entry(H5F_t * f, #if H5C_DO_EXTREME_SANITY_CHECKS /* no need to verify that entry is not already in the index as */ /* we already make that check below. */ - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1468,9 +1469,9 @@ H5C_insert_entry(H5F_t * f, H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, FAIL) #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1500,9 +1501,9 @@ H5C_insert_entry(H5F_t * f, done: #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1828,9 +1829,9 @@ H5C_move_entry(H5C_t * cache_ptr, HDassert(H5F_addr_ne(old_addr, new_addr)); #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1932,9 +1933,9 @@ H5C_move_entry(H5C_t * cache_ptr, done: #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -1981,8 +1982,8 @@ H5C_resize_entry(void *thing, size_t new_size) HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "Entry isn't pinned or protected??") #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2081,8 +2082,8 @@ H5C_resize_entry(void *thing, size_t new_size) done: #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2123,9 +2124,9 @@ H5C_pin_protected_entry(void *thing) HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2140,9 +2141,9 @@ H5C_pin_protected_entry(void *thing) done: #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2210,9 +2211,9 @@ H5C_protect(H5F_t * f, HDassert( H5F_addr_defined(addr) ); #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2338,7 +2339,7 @@ H5C_protect(H5F_t * f, hit = FALSE; - if(NULL == (thing = H5C_load_entry(f, + if(NULL == (thing = H5C__load_entry(f, #ifdef H5_HAVE_PARALLEL coll_access, #endif /* H5_HAVE_PARALLEL */ @@ -2592,9 +2593,9 @@ H5C_protect(H5F_t * f, done: #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2910,9 +2911,9 @@ H5C_unpin_entry(void *_entry_ptr) HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2923,9 +2924,9 @@ H5C_unpin_entry(void *_entry_ptr) done: #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -3012,9 +3013,9 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) was_clean = ! ( entry_ptr->is_dirty ); #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -3211,9 +3212,9 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) done: #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) { + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) { HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -3958,7 +3959,7 @@ H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted) enum H5C_resize_status status = in_spec; /* will change if needed */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( f ); HDassert( cache_ptr ); @@ -4274,7 +4275,7 @@ H5C__autoadjust__ageout(H5F_t * f, double hit_rate, enum H5C_resize_status * sta size_t test_size; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( f ); HDassert( cache_ptr ); @@ -4375,10 +4376,10 @@ done: static herr_t H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ int i; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -4492,7 +4493,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *f, hbool_t write_permitte H5C_cache_entry_t * prev_ptr; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( f ); HDassert( cache_ptr ); @@ -4675,10 +4676,10 @@ done: static herr_t H5C__autoadjust__ageout__insert_new_marker(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ int i; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -4745,11 +4746,11 @@ done: static herr_t H5C__autoadjust__ageout__remove_all_markers(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ - int i; int ring_buf_index; + int i; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -4822,11 +4823,11 @@ done: static herr_t H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ - int i; int ring_buf_index; + int i; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -4912,7 +4913,7 @@ H5C__flash_increase_cache_size(H5C_t * cache_ptr, double hit_rate; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); @@ -5128,7 +5129,7 @@ H5C__flush_invalidate_cache(H5F_t *f, unsigned flags) */ ring = H5C_RING_USER; while(ring < H5C_RING_NTYPES) { - if(H5C_flush_invalidate_ring(f, ring, flags) < 0) + if(H5C__flush_invalidate_ring(f, ring, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate ring failed") ring++; } /* end while */ @@ -5176,7 +5177,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5C_flush_invalidate_ring + * Function: H5C__flush_invalidate_ring * * Purpose: Flush and destroy the entries contained in the target * cache and ring. @@ -5212,7 +5213,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) +H5C__flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) { H5C_t *cache_ptr; hbool_t restart_slist_scan; @@ -5231,7 +5232,7 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) #endif /* H5C_DO_SANITY_CHECKS */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC HDassert(f); HDassert(f->shared); @@ -5326,7 +5327,7 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) * This flag is set to TRUE by H5C__flush_single_entry if the slist * is modified by a pre_serialize, serialize, or notify callback. * - * H5C_flush_invalidate_ring() uses this flag to detect any + * H5C__flush_invalidate_ring() uses this flag to detect any * modifications to the slist that might corrupt the scan of * the slist -- and restart the scan in this event. */ @@ -5622,7 +5623,7 @@ H5C_flush_invalidate_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_flush_invalidate_ring() */ +} /* H5C__flush_invalidate_ring() */ /*------------------------------------------------------------------------- @@ -5679,9 +5680,9 @@ H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) HDassert(ring < H5C_RING_NTYPES); #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -6477,7 +6478,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5C_load_entry + * Function: H5C__load_entry * * Purpose: Attempt to load the entry at the specified disk address * and with the specified type into memory. If successful. @@ -6494,7 +6495,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5C_load_entry(H5F_t * f, +H5C__load_entry(H5F_t * f, #ifdef H5_HAVE_PARALLEL hbool_t coll_access, #endif /* H5_HAVE_PARALLEL */ @@ -6514,7 +6515,7 @@ H5C_load_entry(H5F_t * f, #endif /* H5_HAVE_PARALLEL */ void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(f); @@ -6812,7 +6813,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_load_entry() */ +} /* H5C__load_entry() */ /*------------------------------------------------------------------------- @@ -7160,7 +7161,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5C_validate_lru_list + * Function: H5C__validate_lru_list * * Purpose: Debugging function that scans the LRU list for errors. * @@ -7172,123 +7173,73 @@ done: * * Programmer: John Mainzer, 7/14/05 * - * Changes: - * - * Added code to verify that the LRU contains no pinned - * entries. JRM -- 4/25/14 - * *------------------------------------------------------------------------- */ #if H5C_DO_EXTREME_SANITY_CHECKS - static herr_t -H5C_validate_lru_list(H5C_t * cache_ptr) +H5C__validate_lru_list(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ int32_t len = 0; size_t size = 0; H5C_cache_entry_t * entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT - - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + FUNC_ENTER_STATIC - if ( ( ( cache_ptr->LRU_head_ptr == NULL ) - || - ( cache_ptr->LRU_tail_ptr == NULL ) - ) - && - ( cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr ) - ) { + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + if(((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_tail_ptr == NULL)) + && (cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") - } if(cache_ptr->LRU_list_len < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") - if ( ( cache_ptr->LRU_list_len == 1 ) - && - ( ( cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr ) - || - ( cache_ptr->LRU_head_ptr == NULL ) - || - ( cache_ptr->LRU_head_ptr->size != cache_ptr->LRU_list_size ) - ) - ) { - + if((cache_ptr->LRU_list_len == 1) && + ((cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr) || + (cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_head_ptr->size != cache_ptr->LRU_list_size))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") - } - - if ( ( cache_ptr->LRU_list_len >= 1 ) - && - ( ( cache_ptr->LRU_head_ptr == NULL ) - || - ( cache_ptr->LRU_head_ptr->prev != NULL ) - || - ( cache_ptr->LRU_tail_ptr == NULL ) - || - ( cache_ptr->LRU_tail_ptr->next != NULL ) - ) - ) { + if((cache_ptr->LRU_list_len >= 1) && + ((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_head_ptr->prev != NULL) + || (cache_ptr->LRU_tail_ptr == NULL) || (cache_ptr->LRU_tail_ptr->next != NULL))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") - } entry_ptr = cache_ptr->LRU_head_ptr; - while ( entry_ptr != NULL ) - { - - if ( ( entry_ptr != cache_ptr->LRU_head_ptr ) && - ( ( entry_ptr->prev == NULL ) || - ( entry_ptr->prev->next != entry_ptr ) ) ) { - + while(entry_ptr != NULL) { + if((entry_ptr != cache_ptr->LRU_head_ptr) && + ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") - } - - if ( ( entry_ptr != cache_ptr->LRU_tail_ptr ) && - ( ( entry_ptr->next == NULL ) || - ( entry_ptr->next->prev != entry_ptr ) ) ) { + if((entry_ptr != cache_ptr->LRU_tail_ptr) && + ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") - } - - if ( ( entry_ptr->is_pinned ) || - ( entry_ptr->pinned_from_client ) || - ( entry_ptr->pinned_from_cache ) ) { + if((entry_ptr->is_pinned) || + (entry_ptr->pinned_from_client) || (entry_ptr->pinned_from_cache)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") - } len++; size += entry_ptr->size; entry_ptr = entry_ptr->next; } - if ( ( cache_ptr->LRU_list_len != len ) || - ( cache_ptr->LRU_list_size != size ) ) { - + if((cache_ptr->LRU_list_len != len) || (cache_ptr->LRU_list_size != size)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") - } done: - - if ( ret_value != SUCCEED ) { - + if(ret_value != SUCCEED) HDassert(0); - } FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_validate_lru_list() */ - +} /* H5C__validate_lru_list() */ #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /*------------------------------------------------------------------------- * - * Function: H5C_validate_pinned_entry_list + * Function: H5C__validate_pinned_entry_list * * Purpose: Debugging function that scans the pinned entry list for * errors. @@ -7301,126 +7252,78 @@ done: * * Programmer: John Mainzer, 4/25/14 * - * Changes: - * - * None. - * *------------------------------------------------------------------------- */ #if H5C_DO_EXTREME_SANITY_CHECKS - static herr_t -H5C_validate_pinned_entry_list(H5C_t * cache_ptr) +H5C__validate_pinned_entry_list(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ int32_t len = 0; size_t size = 0; H5C_cache_entry_t * entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT - - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + FUNC_ENTER_STATIC - if ( ( ( cache_ptr->pel_head_ptr == NULL ) - || - ( cache_ptr->pel_tail_ptr == NULL ) - ) - && - ( cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr ) - ) { + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + if(((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_tail_ptr == NULL)) + && (cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") - } if(cache_ptr->pel_len < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") - if ( ( cache_ptr->pel_len == 1 ) - && - ( ( cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr ) - || - ( cache_ptr->pel_head_ptr == NULL ) - || - ( cache_ptr->pel_head_ptr->size != cache_ptr->pel_size ) - ) - ) { - + if((cache_ptr->pel_len == 1) && + ((cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr) || + (cache_ptr->pel_head_ptr == NULL) || + (cache_ptr->pel_head_ptr->size != cache_ptr->pel_size))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") - } - - if ( ( cache_ptr->pel_len >= 1 ) - && - ( ( cache_ptr->pel_head_ptr == NULL ) - || - ( cache_ptr->pel_head_ptr->prev != NULL ) - || - ( cache_ptr->pel_tail_ptr == NULL ) - || - ( cache_ptr->pel_tail_ptr->next != NULL ) - ) - ) { + if((cache_ptr->pel_len >= 1) && + ((cache_ptr->pel_head_ptr == NULL) || + (cache_ptr->pel_head_ptr->prev != NULL) || + (cache_ptr->pel_tail_ptr == NULL) || + (cache_ptr->pel_tail_ptr->next != NULL))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") - } entry_ptr = cache_ptr->pel_head_ptr; - while ( entry_ptr != NULL ) - { - - if ( ( entry_ptr != cache_ptr->pel_head_ptr ) && - ( ( entry_ptr->prev == NULL ) || - ( entry_ptr->prev->next != entry_ptr ) ) ) { - + while(entry_ptr != NULL) { + if((entry_ptr != cache_ptr->pel_head_ptr) && + ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") - } - - if ( ( entry_ptr != cache_ptr->pel_tail_ptr ) && - ( ( entry_ptr->next == NULL ) || - ( entry_ptr->next->prev != entry_ptr ) ) ) { + if((entry_ptr != cache_ptr->pel_tail_ptr) && + ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") - } - - if ( ! entry_ptr->is_pinned ) { + if(!entry_ptr->is_pinned) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") - } - - if ( ! ( ( entry_ptr->pinned_from_client ) || - ( entry_ptr->pinned_from_cache ) ) ) { + if(!(entry_ptr->pinned_from_client || entry_ptr->pinned_from_cache)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") - } len++; size += entry_ptr->size; entry_ptr = entry_ptr->next; } - if ( ( cache_ptr->pel_len != len ) || - ( cache_ptr->pel_size != size ) ) { - + if((cache_ptr->pel_len != len) || (cache_ptr->pel_size != size)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed") - } done: - - if ( ret_value != SUCCEED ) { - + if(ret_value != SUCCEED) HDassert(0); - } FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_validate_pinned_entry_list() */ - +} /* H5C__validate_pinned_entry_list() */ #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /*------------------------------------------------------------------------- * - * Function: H5C_validate_protected_entry_list + * Function: H5C__validate_protected_entry_list * * Purpose: Debugging function that scans the protected entry list for * errors. @@ -7433,26 +7336,21 @@ done: * * Programmer: John Mainzer, 4/25/14 * - * Changes: - * - * None. - * *------------------------------------------------------------------------- */ #if H5C_DO_EXTREME_SANITY_CHECKS - static herr_t -H5C_validate_protected_entry_list(H5C_t * cache_ptr) +H5C__validate_protected_entry_list(H5C_t * cache_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ int32_t len = 0; size_t size = 0; H5C_cache_entry_t * entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); if(((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_tail_ptr == NULL)) && (cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr)) @@ -7461,91 +7359,55 @@ H5C_validate_protected_entry_list(H5C_t * cache_ptr) if(cache_ptr->pl_len < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") - if ( ( cache_ptr->pl_len == 1 ) - && - ( ( cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr ) - || - ( cache_ptr->pl_head_ptr == NULL ) - || - ( cache_ptr->pl_head_ptr->size != cache_ptr->pl_size ) - ) - ) { - + if((cache_ptr->pl_len == 1) && + ((cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr) || + (cache_ptr->pl_head_ptr == NULL) || + (cache_ptr->pl_head_ptr->size != cache_ptr->pl_size))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") - } - - if ( ( cache_ptr->pl_len >= 1 ) - && - ( ( cache_ptr->pl_head_ptr == NULL ) - || - ( cache_ptr->pl_head_ptr->prev != NULL ) - || - ( cache_ptr->pl_tail_ptr == NULL ) - || - ( cache_ptr->pl_tail_ptr->next != NULL ) - ) - ) { + if((cache_ptr->pl_len >= 1) && + ((cache_ptr->pl_head_ptr == NULL) || + (cache_ptr->pl_head_ptr->prev != NULL) || + (cache_ptr->pl_tail_ptr == NULL) || + (cache_ptr->pl_tail_ptr->next != NULL))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") - } entry_ptr = cache_ptr->pl_head_ptr; - while ( entry_ptr != NULL ) - { - - if ( ( entry_ptr != cache_ptr->pl_head_ptr ) && - ( ( entry_ptr->prev == NULL ) || - ( entry_ptr->prev->next != entry_ptr ) ) ) { - + while(entry_ptr != NULL) { + if((entry_ptr != cache_ptr->pl_head_ptr) && + ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") - } - - if ( ( entry_ptr != cache_ptr->pl_tail_ptr ) && - ( ( entry_ptr->next == NULL ) || - ( entry_ptr->next->prev != entry_ptr ) ) ) { + if((entry_ptr != cache_ptr->pl_tail_ptr) && + ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") - } - - if ( ! entry_ptr->is_protected ) { + if(!entry_ptr->is_protected) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") - } - - if ( ( entry_ptr->is_read_only ) && - ( entry_ptr->ro_ref_count <= 0 ) ) { + if(entry_ptr->is_read_only && (entry_ptr->ro_ref_count <= 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") - } len++; size += entry_ptr->size; entry_ptr = entry_ptr->next; } - if ( ( cache_ptr->pl_len != len ) || - ( cache_ptr->pl_size != size ) ) { - + if((cache_ptr->pl_len != len) || (cache_ptr->pl_size != size)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed") - } done: - - if ( ret_value != SUCCEED ) { - + if(ret_value != SUCCEED) HDassert(0); - } FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_validate_protected_entry_list() */ - +} /* H5C__validate_protected_entry_list() */ #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /*------------------------------------------------------------------------- * - * Function: H5C_entry_in_skip_list + * Function: H5C__entry_in_skip_list * * Purpose: Debugging function that scans skip list to see if it * is in present. We need this, as it is possible for @@ -7556,49 +7418,39 @@ done: * * Programmer: John Mainzer, 11/1/14 * - * Changes: - * - * None. - * *------------------------------------------------------------------------- */ #if H5C_DO_SLIST_SANITY_CHECKS - static hbool_t -H5C_entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t *target_ptr) +H5C__entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t *target_ptr) { - hbool_t in_slist = FALSE; - H5SL_node_t * node_ptr = NULL; - H5C_cache_entry_t * entry_ptr = NULL; + H5SL_node_t *node_ptr; + hbool_t in_slist; - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( cache_ptr->slist_ptr ); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_ptr); node_ptr = H5SL_first(cache_ptr->slist_ptr); + in_slist = FALSE; + while((node_ptr != NULL) && (!in_slist)) { + H5C_cache_entry_t *entry_ptr; - while ( ( node_ptr != NULL ) && ( ! in_slist ) ) - { entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - HDassert( entry_ptr ); - HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); - HDassert( entry_ptr->is_dirty ); - HDassert( entry_ptr->in_slist ); - - if ( entry_ptr == target_ptr ) { + HDassert(entry_ptr); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->is_dirty); + HDassert(entry_ptr->in_slist); + if(entry_ptr == target_ptr) in_slist = TRUE; - - } else { - + else node_ptr = H5SL_next(node_ptr); - } } return(in_slist); - -} /* H5C_entry_in_skip_list() */ +} /* H5C__entry_in_skip_list() */ #endif /* H5C_DO_SLIST_SANITY_CHECKS */ @@ -8062,9 +7914,9 @@ H5C__serialize_cache(H5F_t *f) #endif /* H5C_DO_SANITY_CHECKS */ #if H5C_DO_EXTREME_SANITY_CHECKS - if((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || - (H5C_validate_lru_list(cache_ptr) < 0)) + if((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || + (H5C__validate_lru_list(cache_ptr) < 0)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -8502,7 +8354,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) { haddr_t new_addr = HADDR_UNDEF; @@ -8511,7 +8363,7 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); diff --git a/src/H5CS.c b/src/H5CS.c index 3fccce4..324d383 100644 --- a/src/H5CS.c +++ b/src/H5CS.c @@ -123,8 +123,6 @@ H5CS__get_stack(void) * Programmer: Quincey Koziol * Thursday, February 6, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -214,8 +212,6 @@ H5CS_push(const char *func_name) * Programmer: Quincey Koziol * Thursday, February 6, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5CX.c b/src/H5CX.c index b78d9ec..6beaf56 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, February 19, 2018 * * Purpose: diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index d5599f2..425bda3 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -1086,74 +1086,6 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED * cache_ptr) return; } /* H5C_stats__reset() */ -extern void -H5C__dump_entry(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, - hbool_t dump_parents, const char *prefix, int indent); - -static void -H5C__dump_parents(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, const char *prefix, int indent) -{ - unsigned u; - - for(u = 0; u < entry_ptr->flush_dep_nparents; u++) - H5C__dump_entry(cache_ptr, entry_ptr->flush_dep_parent[u], TRUE, prefix, indent + 2); -} - -typedef struct H5C__dump_child_ctx_t { - H5C_t *cache_ptr; - const H5C_cache_entry_t *parent; - hbool_t dump_parents; - const char *prefix; - int indent; -} H5C__dump_child_ctx_t; - -static int -H5C__dump_children_cb(H5C_cache_entry_t *entry_ptr, void *_ctx) -{ - H5C__dump_child_ctx_t *ctx = (H5C__dump_child_ctx_t *)_ctx; - - if(entry_ptr->tag_info->tag != entry_ptr->addr) { - unsigned u; - - HDassert(entry_ptr->flush_dep_nparents); - for(u = 0; u < entry_ptr->flush_dep_nparents; u++) - if(ctx->parent == entry_ptr->flush_dep_parent[u]) - H5C__dump_entry(ctx->cache_ptr, entry_ptr, ctx->dump_parents, ctx->prefix, ctx->indent + 2); - } /* end if */ - - return(H5_ITER_CONT); -} /* end H5C__dump_children_cb() */ - -static void -H5C__dump_children(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, - hbool_t dump_parents, const char *prefix, int indent) -{ - H5C__dump_child_ctx_t ctx; - - HDassert(entry_ptr->tag_info); - - ctx.cache_ptr = cache_ptr; - ctx.parent = entry_ptr; - ctx.dump_parents = dump_parents; - ctx.prefix = prefix; - ctx.indent = indent; - H5C__iter_tagged_entries(cache_ptr, entry_ptr->tag_info->tag, FALSE, H5C__dump_children_cb, &ctx); -} /* end H5C__dump_children() */ - -void -H5C__dump_entry(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, - hbool_t dump_parents, const char *prefix, int indent) -{ - HDassert(cache_ptr); - HDassert(entry_ptr); - - HDfprintf(stderr, "%*s%s: entry_ptr = (%a, '%s', %a, %t, %u, %u/%u)\n", indent, "", prefix, entry_ptr->addr, entry_ptr->type->name, entry_ptr->tag_info ? entry_ptr->tag_info->tag : HADDR_UNDEF, entry_ptr->is_dirty, entry_ptr->flush_dep_nparents, entry_ptr->flush_dep_nchildren, entry_ptr->flush_dep_ndirty_children); - if(dump_parents && entry_ptr->flush_dep_nparents) - H5C__dump_parents(cache_ptr, entry_ptr, "Parent", indent); - if(entry_ptr->flush_dep_nchildren) - H5C__dump_children(cache_ptr, entry_ptr, FALSE, "Child", indent); -} /* end H5C__dump_entry() */ - /*------------------------------------------------------------------------- * Function: H5C_flush_dependency_exists() diff --git a/src/H5Cimage.c b/src/H5Cimage.c index ee286d9..26cbe7d 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -864,54 +864,6 @@ H5C__free_image_entries_array(H5C_t * cache_ptr) /*------------------------------------------------------------------------- - * Function: H5C_force_cache_image_load() - * - * Purpose: On rare occasions, it is necessary to run - * H5MF_tidy_self_referential_fsm_hack() prior to the first - * metadata cache access. This is a problem as if there is a - * cache image at the end of the file, that routine will - * discard it. - * - * We solve this issue by calling this function, which will - * load the cache image and then call - * H5MF_tidy_self_referential_fsm_hack() to discard it. - * - * Return: SUCCEED on success, and FAIL on failure. - * - * Programmer: John Mainzer - * 1/11/17 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_force_cache_image_load(H5F_t *f) -{ - H5C_t *cache_ptr; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->load_image); - - /* Load the cache image, if requested */ - if(cache_ptr->load_image) { - cache_ptr->load_image = FALSE; - if(H5C__load_cache_image(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "can't load cache image") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_force_cache_image_load() */ - - -/*------------------------------------------------------------------------- * Function: H5C_get_cache_image_config * * Purpose: Copy the current configuration for cache image generation diff --git a/src/H5Cmodule.h b/src/H5Cmodule.h index 534404d..5b23490 100644 --- a/src/H5Cmodule.h +++ b/src/H5Cmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 8712af5..22c67ce 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -4911,8 +4911,6 @@ H5_DLL herr_t H5C__mark_flush_dep_unserialized(H5C_cache_entry_t * entry_ptr); H5_DLL herr_t H5C__make_space_in_cache(H5F_t * f, size_t space_needed, hbool_t write_permitted); H5_DLL herr_t H5C__flush_marked_entries(H5F_t * f); -H5_DLL herr_t H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, - H5C_cache_entry_t *entry_ptr); H5_DLL herr_t H5C__serialize_cache(H5F_t *f); H5_DLL herr_t H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_global, H5C_tag_iter_cb_t cb, void *cb_ctx); diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 0ba0234..f82f8df 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -20,8 +20,6 @@ * Purpose: Constants and typedefs available to the rest of the * library. * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -2243,7 +2241,6 @@ H5_DLL herr_t H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flags); H5_DLL herr_t H5C_flush_cache(H5F_t *f, unsigned flags); H5_DLL herr_t H5C_flush_tagged_entries(H5F_t *f, haddr_t tag); -H5_DLL herr_t H5C_force_cache_image_load(H5F_t * f); H5_DLL herr_t H5C_evict_tagged_entries(H5F_t *f, haddr_t tag, hbool_t match_global); H5_DLL herr_t H5C_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags); H5_DLL herr_t H5C_get_tag(const void *thing, /*OUT*/ haddr_t *tag); diff --git a/src/H5Cpublic.h b/src/H5Cpublic.h index 62107d9..565f41b 100644 --- a/src/H5Cpublic.h +++ b/src/H5Cpublic.h @@ -19,8 +19,6 @@ * * Purpose: Public include file for cache functions. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5Cpublic_H diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 098e01b..c80f90a 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Wednesday, October 8, 1997 * * Purpose: v1 B-tree indexed (chunked) I/O functions. The chunks are @@ -338,7 +338,7 @@ H5D__btree_cmp2(void *_lt_key, void *_udata, void *_rt_key) HDassert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); /* Compare the offsets but ignore the other fields */ - ret_value = H5VM_vector_cmp_u(udata->layout->ndims, lt_key->scaled, rt_key->scaled); + ret_value = H5VM__vector_cmp_u(udata->layout->ndims, lt_key->scaled, rt_key->scaled); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__btree_cmp2() */ @@ -620,8 +620,7 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * March 28, 2002 * *------------------------------------------------------------------------- diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index ccb786b..b9cf6cd 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -112,7 +112,7 @@ static herr_t H5D__bt2_found_cb(const void *nrecord, void *op_data); */ static herr_t H5D__bt2_remove_cb(const void *nrecord, void *_udata); -/* Callback for H5B2_modify() which is called in H5D__bt2_idx_insert() */ +/* Callback for H5B2_update() which is called in H5D__bt2_idx_insert() */ static herr_t H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed); /* Chunked layout indexing callbacks for v2 B-tree indexing */ @@ -256,7 +256,7 @@ H5D__bt2_crt_context(void *_udata) * Compute the size required for encoding the size of a chunk, * allowing for an extra byte, in case the filter makes the chunk larger. */ - ctx->chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)udata->chunk_size) + 8) / 8); + ctx->chunk_size_len = 1 + ((H5VM__log2_gen((uint64_t)udata->chunk_size) + 8) / 8); if(ctx->chunk_size_len > 8) ctx->chunk_size_len = 8; @@ -355,7 +355,7 @@ H5D__bt2_compare(const void *_udata, const void *_rec2, int *result) HDassert(rec2); /* Compare the offsets but ignore the other fields */ - *result = H5VM_vector_cmp_u(udata->ndims, rec1->scaled, rec2->scaled); + *result = H5VM__vector_cmp_u(udata->ndims, rec1->scaled, rec2->scaled); FUNC_LEAVE_NOAPI(ret_value) } /* H5D__bt2_compare() */ @@ -773,7 +773,7 @@ H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info) * Compute the size required for encoding the size of a chunk, * allowing for an extra byte, in case the filter makes the chunk larger. */ - chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8); + chunk_size_len = 1 + ((H5VM__log2_gen((uint64_t)idx_info->layout->size) + 8) / 8); if(chunk_size_len > 8) chunk_size_len = 8; @@ -837,7 +837,7 @@ H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage) * Function: H5D__bt2_mod_cb * * Purpose: Modify record for dataset chunk when it is found in a v2 B-tree. - * This is the callback for H5B2_modify() which is called in + * This is the callback for H5B2_update() which is called in * H5D__bt2_idx_insert(). * * Return: Success: non-negative @@ -1266,13 +1266,6 @@ done: * * Programmer: Vailin Choi; June 2010 * - * Modifications: - * Vailin Choi; March 2011 - * Initialize size of an unfiltered chunk. - * This is a fix for for the assertion failure in: - * [src/H5FSsection.c:968: H5FS_sect_link_size: Assertion `bin < sinfo->nbins' failed.] - * which is uncovered by test_unlink_chunked_dataset() in test/unlink.c - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index ee83564..4d351dd 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, April 24, 2008 * * Purpose: Abstract indexed (chunked) I/O functions. The logical @@ -278,7 +278,7 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); -/* format convert cb */ +/* Format convert cb */ static int H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); /* Helper routines */ @@ -300,9 +300,7 @@ static herr_t H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); static herr_t H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); - static herr_t H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm); - static herr_t H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm); static herr_t H5D__chunk_file_cb(void *elem, const H5T_t *type, unsigned ndims, const hsize_t *coords, void *fm); @@ -327,8 +325,8 @@ static herr_t H5D__chunk_collective_fill(const H5D_t *dset, static int H5D__chunk_cmp_addr(const void *addr1, const void *addr2); #endif /* H5_HAVE_PARALLEL */ -static int -H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); +/* Debugging helper routine callback */ +static int H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); /*********************/ /* Package Variables */ @@ -835,7 +833,7 @@ H5D__chunk_set_sizes(H5D_t *dset) unsigned enc_bytes_per_dim; /* Number of bytes required to encode this dimension */ /* Get encoded size of dim, in bytes */ - enc_bytes_per_dim = (H5VM_log2_gen(dset->shared->layout.u.chunk.dim[u]) + 8) / 8; + enc_bytes_per_dim = (H5VM__log2_gen(dset->shared->layout.u.chunk.dim[u]) + 8) / 8; /* Check if this is the largest value so far */ if(enc_bytes_per_dim > max_enc_bytes_per_dim) @@ -999,14 +997,14 @@ H5D__chunk_init(H5F_t *f, const H5D_t * const dset, hid_t dapl_id) rdcc->scaled_dims[u] = (dset->shared->curr_dims[u] + dset->shared->layout.u.chunk.dim[u] - 1) / dset->shared->layout.u.chunk.dim[u]; - if( !(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u])) ) + if(!(scaled_power2up = H5VM__power2up(rdcc->scaled_dims[u]))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") /* Inital 'power2up' values for scaled dimensions */ rdcc->scaled_power2up[u] = scaled_power2up; /* Number of bits required to encode scaled dimension size */ - rdcc->scaled_encode_bits[u] = H5VM_log2_gen(rdcc->scaled_power2up[u]); + rdcc->scaled_encode_bits[u] = H5VM__log2_gen(rdcc->scaled_power2up[u]); } /* end for */ } /* end if */ @@ -2821,12 +2819,12 @@ H5D__chunk_flush(H5D_t *dset) /* Loop over all entries in the chunk cache */ for(ent = rdcc->head; ent; ent = next) { - next = ent->next; + next = ent->next; if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0) nerrors++; } /* end for */ if(nerrors) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2970,7 +2968,7 @@ H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) /* Reset index structures */ if((storage->ops->reset)(storage, reset_addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset chunk index info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset chunk index info") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2992,7 +2990,7 @@ done: static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last) { - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(last); @@ -3615,14 +3613,14 @@ H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush) static herr_t H5D__chunk_cache_prune(const H5D_t *dset, size_t size) { - const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); - size_t total = rdcc->nbytes_max; - const int nmeth = 2; /*number of methods */ - int w[1]; /*weighting as an interval */ - H5D_rdcc_ent_t *p[2], *cur; /*list pointers */ - H5D_rdcc_ent_t *n[2]; /*list next pointers */ - int nerrors = 0; /* Accumulated error count during preemptions */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); + size_t total = rdcc->nbytes_max; + const int nmeth = 2; /* Number of methods */ + int w[1]; /* Weighting as an interval */ + H5D_rdcc_ent_t *p[2], *cur; /* List pointers */ + H5D_rdcc_ent_t *n[2]; /* List next pointers */ + int nerrors = 0; /* Accumulated error count during preemptions */ + herr_t ret_value = SUCCEED;/* Return value */ FUNC_ENTER_STATIC @@ -3643,62 +3641,62 @@ H5D__chunk_cache_prune(const H5D_t *dset, size_t size) while((p[0] || p[1]) && (rdcc->nbytes_used + size) > total) { int i; /* Local index variable */ - /* Introduce new pointers */ - for(i = 0; i < nmeth - 1; i++) + /* Introduce new pointers */ + for(i = 0; i < nmeth - 1; i++) if(0 == w[i]) p[i + 1] = rdcc->head; - /* Compute next value for each pointer */ - for(i = 0; i < nmeth; i++) + /* Compute next value for each pointer */ + for(i = 0; i < nmeth; i++) n[i] = p[i] ? p[i]->next : NULL; - /* Give each method a chance */ - for(i = 0; i < nmeth && (rdcc->nbytes_used + size) > total; i++) { - if(0 == i && p[0] && !p[0]->locked && + /* Give each method a chance */ + for(i = 0; i < nmeth && (rdcc->nbytes_used + size) > total; i++) { + if(0 == i && p[0] && !p[0]->locked && ((0 == p[0]->rd_count && 0 == p[0]->wr_count) || - (0 == p[0]->rd_count && dset->shared->layout.u.chunk.size == p[0]->wr_count) || - (dset->shared->layout.u.chunk.size == p[0]->rd_count && 0 == p[0]->wr_count))) { - /* - * Method 0: Preempt entries that have been completely written - * and/or completely read but not entries that are partially - * written or partially read. - */ - cur = p[0]; - } else if(1 == i && p[1] && !p[1]->locked) { - /* - * Method 1: Preempt the entry without regard to - * considerations other than being locked. This is the last - * resort preemption. - */ - cur = p[1]; - } else { - /* Nothing to preempt at this point */ - cur = NULL; - } + (0 == p[0]->rd_count && dset->shared->layout.u.chunk.size == p[0]->wr_count) || + (dset->shared->layout.u.chunk.size == p[0]->rd_count && 0 == p[0]->wr_count))) { + /* + * Method 0: Preempt entries that have been completely written + * and/or completely read but not entries that are partially + * written or partially read. + */ + cur = p[0]; + } else if(1 == i && p[1] && !p[1]->locked) { + /* + * Method 1: Preempt the entry without regard to + * considerations other than being locked. This is the last + * resort preemption. + */ + cur = p[1]; + } else { + /* Nothing to preempt at this point */ + cur = NULL; + } - if(cur) { + if(cur) { int j; /* Local index variable */ - for(j = 0; j < nmeth; j++) { - if(p[j] == cur) + for(j = 0; j < nmeth; j++) { + if(p[j] == cur) p[j] = NULL; - if(n[j] == cur) + if(n[j] == cur) n[j] = cur->next; - } /* end for */ - if(H5D__chunk_cache_evict(dset, cur, TRUE) < 0) + } /* end for */ + if(H5D__chunk_cache_evict(dset, cur, TRUE) < 0) nerrors++; - } /* end if */ - } /* end for */ + } /* end if */ + } /* end for */ - /* Advance pointers */ - for(i = 0; i < nmeth; i++) + /* Advance pointers */ + for(i = 0; i < nmeth; i++) p[i] = n[i]; - for(i = 0; i < nmeth - 1; i++) + for(i = 0; i < nmeth - 1; i++) w[i] -= 1; } /* end while */ if(nerrors) - HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry") + HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry") done: FUNC_LEAVE_NOAPI(ret_value) @@ -4347,7 +4345,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ hbool_t unfilt_edge_chunk_dim[H5O_LAYOUT_NDIMS]; /* Whether there are unfiltered edge chunks at the edge of each dimension */ hsize_t edge_chunk_scaled[H5O_LAYOUT_NDIMS]; /* Offset of the unfiltered edge chunks at the edge of each dimension */ unsigned nunfilt_edge_chunk_dims = 0; /* Number of dimensions on an edge */ - const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); + H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); /* Convenience variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -4556,9 +4554,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") #ifndef NDEBUG /* None of the chunks should be allocated */ - if(H5D_CHUNK_IDX_NONE != sc->idx_type) { + if(H5D_CHUNK_IDX_NONE != sc->idx_type) HDassert(!H5F_addr_defined(udata.chunk_block.offset)); - } /* Make sure the chunk is really in the dataset and outside the * original dimensions */ @@ -5126,8 +5123,8 @@ H5D__chunk_cmp_addr(const void *addr1, const void *addr2) * * Return: Non-negative on success/Negative on failure * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * March 26, 2002 + * Programmer: Pedro Vicente + * March 26, 2002 * *------------------------------------------------------------------------- */ @@ -5252,7 +5249,7 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * Algorithm: Robb Matzke * March 27, 2002 * @@ -5405,13 +5402,13 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) elmts_per_chunk = 1; for(u = 0; u < space_ndims; u++) { elmts_per_chunk *= layout->u.chunk.dim[u]; - chunk_dim[u] = layout->u.chunk.dim[u]; - shrunk_dim[u] = (space_dim[u] < old_dim[u]); + chunk_dim[u] = layout->u.chunk.dim[u]; + shrunk_dim[u] = (space_dim[u] < old_dim[u]); } /* end for */ /* Create a dataspace for a chunk & set the extent */ if(NULL == (chunk_space = H5S_create_simple(space_ndims, chunk_dim, NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") /* Reset hyperslab start array */ /* (hyperslabs will always start from origin) */ @@ -5599,7 +5596,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) /* Remove the chunk from disk, if present */ if(H5F_addr_defined(chk_udata.chunk_block.offset)) { /* Update the offset in idx_udata */ - idx_udata.scaled = udata.common.scaled; + idx_udata.scaled = udata.common.scaled; /* Remove the chunk from disk */ if((sc->ops->remove)(&idx_info, &idx_udata) < 0) @@ -5989,7 +5986,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) if(pline && pline->nused) { must_filter = TRUE; if((udata->common.layout->flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) && - H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, chunk_rec->scaled, udata->dset_dims)) + H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, chunk_rec->scaled, udata->dset_dims)) must_filter = FALSE; } @@ -6890,12 +6887,12 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old /* Compute the size required for encoding the size of a chunk, allowing * for an extra byte, in case the filter makes the chunk larger. */ - allow_chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)(idx_info->layout->size)) + 8) / 8); + allow_chunk_size_len = 1 + ((H5VM__log2_gen((uint64_t)(idx_info->layout->size)) + 8) / 8); if(allow_chunk_size_len > 8) allow_chunk_size_len = 8; /* Compute encoded size of chunk */ - new_chunk_size_len = (H5VM_log2_gen((uint64_t)(new_chunk->length)) + 8) / 8; + new_chunk_size_len = (H5VM__log2_gen((uint64_t)(new_chunk->length)) + 8) / 8; if(new_chunk_size_len > 8) HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "encoded chunk size is more than 8 bytes?!?") @@ -6932,9 +6929,9 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old } /* end else */ } /* end if */ else { - HDassert(!H5F_addr_defined(new_chunk->offset)); - HDassert(new_chunk->length == idx_info->layout->size); - alloc_chunk = TRUE; + HDassert(!H5F_addr_defined(new_chunk->offset)); + HDassert(new_chunk->length == idx_info->layout->size); + alloc_chunk = TRUE; } /* end else */ /* Actually allocate space for the chunk in the file */ diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 809cdfc..1792fa2 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * August 5, 2002 * * Purpose: Compact dataset I/O functions. These routines are similar diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 655f660..662be69 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 28, 2000 * * Purpose: diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index f4f4223..7668389 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -15,7 +15,7 @@ * * Created: H5Ddeprec.c * April 5 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Deprecated functions from the H5D interface. These * functions are here for compatibility purposes and may be diff --git a/src/H5Dearray.c b/src/H5Dearray.c index a53489e..56be6a7 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -252,7 +252,7 @@ H5D__earray_crt_context(void *_udata) /* Compute the size required for encoding the size of a chunk, allowing * for an extra byte, in case the filter makes the chunk larger. */ - ctx->chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)udata->chunk_size) + 8) / 8); + ctx->chunk_size_len = 1 + ((H5VM__log2_gen((uint64_t)udata->chunk_size) + 8) / 8); if(ctx->chunk_size_len > 8) ctx->chunk_size_len = 8; @@ -937,7 +937,7 @@ H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info) /* Compute the size required for encoding the size of a chunk, allowing * for an extra byte, in case the filter makes the chunk larger. */ - chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8); + chunk_size_len = 1 + ((H5VM__log2_gen((uint64_t)idx_info->layout->size) + 8) / 8); if(chunk_size_len > 8) chunk_size_len = 8; diff --git a/src/H5Defl.c b/src/H5Defl.c index 91caa61..79cec8c 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 30, 2004 */ @@ -336,9 +336,6 @@ done: * Programmer: Robb Matzke * Wednesday, March 4, 1998 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c index a9202c2..a79471a 100644 --- a/src/H5Dfarray.c +++ b/src/H5Dfarray.c @@ -248,7 +248,7 @@ H5D__farray_crt_context(void *_udata) /* Compute the size required for encoding the size of a chunk, allowing * for an extra byte, in case the filter makes the chunk larger. */ - ctx->chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)udata->chunk_size) + 8) / 8); + ctx->chunk_size_len = 1 + ((H5VM__log2_gen((uint64_t)udata->chunk_size) + 8) / 8); if(ctx->chunk_size_len > 8) ctx->chunk_size_len = 8; @@ -892,7 +892,7 @@ H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info) /* Compute the size required for encoding the size of a chunk, allowing * for an extra byte, in case the filter makes the chunk larger. */ - chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8); + chunk_size_len = 1 + ((H5VM__log2_gen((uint64_t)idx_info->layout->size) + 8) / 8); if(chunk_size_len > 8) chunk_size_len = 8; diff --git a/src/H5Dfill.c b/src/H5Dfill.c index 94c7b1c..0efe98a 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -15,7 +15,7 @@ * * Created: H5Dfill.c * Jun 19 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Fill value operations for datasets * @@ -647,7 +647,7 @@ done: static herr_t H5D__fill_release(H5D_fill_buf_info_t *fb_info) { - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(fb_info); diff --git a/src/H5Dint.c b/src/H5Dint.c index c063bb9..d662cec 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -97,6 +97,7 @@ static herr_t H5D__vlen_get_buf_size_cb(void *elem, hid_t type_id, unsigned ndim const hsize_t *point, void *op_data); static herr_t H5D__vlen_get_buf_size_gen_cb(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *op_data); +static herr_t H5D__check_filters(H5D_t *dataset); /*********************/ @@ -671,7 +672,7 @@ H5D__cache_dataspace_info(const H5D_t *dset) for(u = 0; u < dset->shared->ndims; u++) { hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */ - if( !(scaled_power2up = H5VM_power2up(dset->shared->curr_dims[u])) ) + if(!(scaled_power2up = H5VM__power2up(dset->shared->curr_dims[u]))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") dset->shared->curr_power2up[u] = scaled_power2up; } @@ -908,7 +909,7 @@ H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc) HDassert(dset); HDassert(oloc); - oh = H5O__create_ohdr(file, dset->shared->dcpl_id); + oh = H5O_create_ohdr(file, dset->shared->dcpl_id); if(NULL == oh) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't instantiate object header") @@ -917,7 +918,7 @@ H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "computed header size is invalid") /* Special allocation of space for compact datsets is handled by the call here. */ - if(H5O__apply_ohdr(file, oh, dset->shared->dcpl_id, ohdr_size, (size_t)1, oloc) == FAIL) + if(H5O_apply_ohdr(file, oh, dset->shared->dcpl_id, ohdr_size, (size_t)1, oloc) == FAIL) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't apply object header to file") done: @@ -1022,7 +1023,8 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) if(TRUE == use_minimized_header) { if(H5D__prepare_minimized_oh(file, dset, oloc) == FAIL) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create minimized dataset object header") - } else { + } /* end if */ + else { /* Add the dataset's raw data size to the size of the header, if the * raw data will be stored as compact */ @@ -2960,13 +2962,13 @@ done: * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ -herr_t +static herr_t H5D__check_filters(H5D_t *dataset) { H5O_fill_t *fill; /* Dataset's fill value */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC /* Check args */ HDassert(dataset); @@ -3086,14 +3088,14 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) dset->shared->cache.chunk.scaled_dims[dim_idx] > dset->shared->cache.chunk.nslots)) update_chunks = TRUE; - if(!(scaled_power2up = H5VM_power2up(scaled))) + if(!(scaled_power2up = H5VM__power2up(scaled))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") /* Check if the number of bits required to encode the scaled size value changed */ if(dset->shared->cache.chunk.scaled_power2up[dim_idx] != scaled_power2up) { /* Update the 'power2up' & 'encode_bits' values for the current dimension */ dset->shared->cache.chunk.scaled_power2up[dim_idx] = scaled_power2up; - dset->shared->cache.chunk.scaled_encode_bits[dim_idx] = H5VM_log2_gen(scaled_power2up); + dset->shared->cache.chunk.scaled_encode_bits[dim_idx] = H5VM__log2_gen(scaled_power2up); /* Indicate that the cached chunk indices need to be updated */ update_chunks = TRUE; diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index cfed02e..e56f341 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -1342,9 +1342,9 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in HDassert(fm); /* Obtain the current rank of the process and the number of processes */ - if ((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0) + if((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0) HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi rank") - if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) + if((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size") /* Set the actual-chunk-opt-mode property. */ @@ -1356,10 +1356,10 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in H5CX_set_mpio_actual_io_mode(H5D_MPIO_CHUNK_COLLECTIVE); /* Build a list of selected chunks in the collective io operation */ - if (H5D__construct_filtered_io_info_list(io_info, type_info, fm, &chunk_list, &chunk_list_num_entries) < 0) + if(H5D__construct_filtered_io_info_list(io_info, type_info, fm, &chunk_list, &chunk_list_num_entries) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't construct filtered I/O info list") - if (io_info->op_type == H5D_IO_OP_WRITE) { /* Filtered collective write */ + if(io_info->op_type == H5D_IO_OP_WRITE) { /* Filtered collective write */ H5D_chk_idx_info_t index_info; H5D_chunk_ud_t udata; hsize_t mpi_buf_count; @@ -1379,15 +1379,15 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in * updating each chunk with the data modifications from other processes, * then re-filtering the chunk. */ - for (i = 0; i < chunk_list_num_entries; i++) - if (mpi_rank == chunk_list[i].owners.new_owner) - if (H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0) + for(i = 0; i < chunk_list_num_entries; i++) + if(mpi_rank == chunk_list[i].owners.new_owner) + if(H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't process chunk entry") /* Gather the new chunk sizes to all processes for a collective reallocation * of the chunks in the file. */ - if (H5D__mpio_array_gatherv(chunk_list, chunk_list_num_entries, sizeof(H5D_filtered_collective_io_info_t), + if(H5D__mpio_array_gatherv(chunk_list, chunk_list_num_entries, sizeof(H5D_filtered_collective_io_info_t), (void **) &collective_chunk_list, &collective_chunk_list_num_entries, true, 0, io_info->comm, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, "couldn't gather new chunk sizes") @@ -1480,9 +1480,9 @@ done: H5MM_free(collective_chunk_list); /* Free the MPI buf and file types, if they were derived */ - if (mem_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) + if(mem_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if (file_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) + if(file_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) FUNC_LEAVE_NOAPI(ret_value) @@ -1770,9 +1770,9 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i HDassert(fm); /* Obtain the current rank of the process and the number of processes */ - if ((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0) + if((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0) HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi rank") - if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) + if((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size") /* Set the actual chunk opt mode property */ @@ -1784,7 +1784,7 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i H5CX_set_mpio_actual_io_mode(H5D_MPIO_CHUNK_COLLECTIVE); /* Build a list of selected chunks in the collective IO operation */ - if (H5D__construct_filtered_io_info_list(io_info, type_info, fm, &chunk_list, &chunk_list_num_entries) < 0) + if(H5D__construct_filtered_io_info_list(io_info, type_info, fm, &chunk_list, &chunk_list_num_entries) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't construct filtered I/O info list") /* Set up contiguous I/O info object */ @@ -1799,9 +1799,9 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i /* Set dataset storage for I/O info */ io_info->store = &store; - if (io_info->op_type == H5D_IO_OP_READ) { /* Filtered collective read */ - for (i = 0; i < chunk_list_num_entries; i++) - if (H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0) + if(io_info->op_type == H5D_IO_OP_READ) { /* Filtered collective read */ + for(i = 0; i < chunk_list_num_entries; i++) + if(H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't process chunk entry") } /* end if */ else { /* Filtered collective write */ @@ -1852,14 +1852,14 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i /* Check if this process has a chunk to work on for this iteration */ hbool_t have_chunk_to_process = (i < chunk_list_num_entries) && (mpi_rank == chunk_list[i].owners.new_owner); - if (have_chunk_to_process) - if (H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0) + if(have_chunk_to_process) + if(H5D__filtered_collective_chunk_entry_io(&chunk_list[i], io_info, type_info, fm) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't process chunk entry") /* Gather the new chunk sizes to all processes for a collective re-allocation * of the chunks in the file */ - if (H5D__mpio_array_gatherv(&chunk_list[i], have_chunk_to_process ? 1 : 0, sizeof(H5D_filtered_collective_io_info_t), + if(H5D__mpio_array_gatherv(&chunk_list[i], have_chunk_to_process ? 1 : 0, sizeof(H5D_filtered_collective_io_info_t), (void **) &collective_chunk_list, &collective_chunk_list_num_entries, true, 0, io_info->comm, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, "couldn't gather new chunk sizes") diff --git a/src/H5Dnone.c b/src/H5Dnone.c index 40ddcb8..751d067 100644 --- a/src/H5Dnone.c +++ b/src/H5Dnone.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Vailin Choi +/* Programmer: Vailin Choi * September 2010 * * Purpose: Implicit (Non Index) chunked I/O functions. diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 37a27d3..5efcc9b 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -234,8 +234,8 @@ typedef struct H5D_io_info_t { typedef struct H5D_chk_idx_info_t { H5F_t *f; /* File pointer for operation */ const H5O_pline_t *pline; /* I/O pipeline info */ - H5O_layout_chunk_t *layout; /* Chunk layout description */ - H5O_storage_chunk_t *storage; /* Chunk storage description */ + H5O_layout_chunk_t *layout; /* Chunk layout description */ + H5O_storage_chunk_t *storage; /* Chunk storage description */ } H5D_chk_idx_info_t; /* @@ -566,7 +566,6 @@ H5_DLL herr_t H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *coo H5_DLL haddr_t H5D__get_offset(const H5D_t *dset); H5_DLL herr_t H5D__vlen_get_buf_size(H5D_t *dset, hid_t type_id, hid_t space_id, hsize_t *size); H5_DLL herr_t H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id, hsize_t *size); -H5_DLL herr_t H5D__check_filters(H5D_t *dataset); H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size); H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset); H5_DLL herr_t H5D__flush_real(H5D_t *dataset); diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c index 33274bb..cd71e93 100644 --- a/src/H5Dsingle.c +++ b/src/H5Dsingle.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Vailin Choi +/* Programmer: Vailin Choi * May 2011; updated 10/2015 * * Purpose: Single Chunk I/O functions. diff --git a/src/H5Dtest.c b/src/H5Dtest.c index 916ec72..7c791d4 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, May 27, 2004 * * Purpose: Dataset testing functions. diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index e07f538..799ee2b 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Wednesday, January 28, 2015 * * Purpose: @@ -2238,7 +2238,7 @@ H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset) size_t i, j; /* Local index variables */ hbool_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(shared_dset); diff --git a/src/H5E.c b/src/H5E.c index f204864..0f7a031 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -391,7 +391,7 @@ H5E__get_stack(void) /*------------------------------------------------------------------------- - * Function: H5E_free_class + * Function: H5E__free_class * * Purpose: Private function to free an error class. * @@ -403,9 +403,9 @@ H5E__get_stack(void) *------------------------------------------------------------------------- */ static herr_t -H5E_free_class(H5E_cls_t *cls) +H5E__free_class(H5E_cls_t *cls) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments */ HDassert(cls); @@ -417,7 +417,7 @@ H5E_free_class(H5E_cls_t *cls) cls = H5FL_FREE(H5E_cls_t, cls); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_free_class() */ +} /* end H5E__free_class() */ /*------------------------------------------------------------------------- @@ -502,7 +502,7 @@ H5E__register_class(const char *cls_name, const char *lib_name, const char *vers done: if(!ret_value) - if(cls && H5E_free_class(cls) < 0) + if(cls && H5E__free_class(cls) < 0) HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class") FUNC_LEAVE_NOAPI(ret_value) @@ -572,7 +572,7 @@ H5E__unregister_class(H5E_cls_t *cls) HGOTO_ERROR(H5E_ERROR, H5E_BADITER, FAIL, "unable to free all messages in this error class") /* Free error class structure */ - if(H5E_free_class(cls) < 0) + if(H5E__free_class(cls) < 0) HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "unable to free error class") done: diff --git a/src/H5EA.c b/src/H5EA.c index 56663dc..a027792 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -15,7 +15,7 @@ * * Created: H5EA.c * Jun 17 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implements an "extensible array" for storing elements * in an array whose high bounds can extend and shrink. @@ -124,7 +124,6 @@ H5FL_BLK_DEFINE(ea_native_elmt); * NULL on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * Oct 10 2016 * *------------------------------------------------------------------------- @@ -190,7 +189,6 @@ END_FUNC(STATIC) /* end H5EA__new() */ * NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 17 2008 * *------------------------------------------------------------------------- @@ -241,7 +239,6 @@ END_FUNC(PRIV) /* end H5EA_create() */ * NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 28 2008 * *------------------------------------------------------------------------- @@ -283,7 +280,6 @@ END_FUNC(PRIV) /* end H5EA_open() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 21 2008 * *------------------------------------------------------------------------- @@ -314,7 +310,6 @@ END_FUNC(PRIV) /* end H5EA_get_nelmts() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 21 2008 * *------------------------------------------------------------------------- @@ -347,7 +342,6 @@ END_FUNC(PRIV) /* end H5EA_get_addr() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -559,7 +553,7 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, (page_idx * sblock->dblk_page_size); /* Check if page has been initialized yet */ - if(!H5VM_bit_get(sblock->page_init, page_init_idx)) { + if(!H5VM__bit_get(sblock->page_init, page_init_idx)) { /* Check if we are allowed to create the thing */ if(0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ /* Create the data block page */ @@ -567,7 +561,7 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, H5E_THROW(H5E_CANTCREATE, "unable to create data block page") /* Mark data block page as initialized in super block */ - H5VM_bit_set(sblock->page_init, page_init_idx, TRUE); + H5VM__bit_set(sblock->page_init, page_init_idx, TRUE); sblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else @@ -656,7 +650,6 @@ END_FUNC(STATIC) /* end H5EA__lookup_elmt() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -721,7 +714,6 @@ END_FUNC(PRIV) /* end H5EA_set() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- @@ -786,7 +778,6 @@ END_FUNC(PRIV) /* end H5EA_get() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 27 2009 * *------------------------------------------------------------------------- @@ -836,7 +827,6 @@ END_FUNC(PRIV) /* end H5EA_depend() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 21 2008 * *------------------------------------------------------------------------- @@ -937,7 +927,6 @@ END_FUNC(PRIV) /* end H5EA_close() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 28 2008 * *------------------------------------------------------------------------- diff --git a/src/H5EAcache.c b/src/H5EAcache.c index affa127..f7534fb 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -15,7 +15,7 @@ * * Created: H5EAcache.c * Aug 26 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement extensible array metadata cache methods. * @@ -239,7 +239,6 @@ const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1] = {{ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 16, 2013 * *------------------------------------------------------------------------- @@ -305,7 +304,6 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 16, 2013 * *------------------------------------------------------------------------- @@ -429,7 +427,6 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 16, 2013 * *------------------------------------------------------------------------- @@ -459,7 +456,6 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 16, 2013 * *------------------------------------------------------------------------- @@ -606,7 +602,6 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 16, 2013 * *------------------------------------------------------------------------- @@ -635,7 +630,6 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -708,7 +702,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -815,7 +808,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -845,7 +837,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -932,7 +923,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1001,7 +991,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1030,7 +1019,6 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1122,7 +1110,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1226,7 +1213,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1256,7 +1242,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1330,7 +1315,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 31 2009 * *------------------------------------------------------------------------- @@ -1414,7 +1398,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1443,7 +1426,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1536,7 +1518,6 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1639,7 +1620,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1672,7 +1652,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1744,7 +1723,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 31 2009 * *------------------------------------------------------------------------- @@ -1828,7 +1806,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1904,7 +1881,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -1970,7 +1946,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -2043,7 +2018,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -2073,7 +2047,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -2125,7 +2098,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 31 2009 * *------------------------------------------------------------------------- @@ -2209,7 +2181,6 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c index 6dd2e98..ee5c904 100644 --- a/src/H5EAdblkpage.c +++ b/src/H5EAdblkpage.c @@ -15,7 +15,7 @@ * * Created: H5EAdblkpage.c * Nov 20 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Data block page routines for extensible arrays. * @@ -91,7 +91,6 @@ H5FL_DEFINE_STATIC(H5EA_dblk_page_t); * Return: Non-NULL pointer to data block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 20 2008 * *------------------------------------------------------------------------- @@ -141,7 +140,6 @@ END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */ * Return: Valid file address on success/HADDR_UNDEF on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 20 2008 * *------------------------------------------------------------------------- @@ -206,7 +204,6 @@ END_FUNC(PKG) /* end H5EA__dblk_page_create() */ * Return: Non-NULL pointer to data block page on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 20 2008 * *------------------------------------------------------------------------- @@ -267,7 +264,6 @@ END_FUNC(PKG) /* end H5EA__dblk_page_protect() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 20 2008 * *------------------------------------------------------------------------- @@ -298,7 +294,6 @@ END_FUNC(PKG) /* end H5EA__dblk_page_unprotect() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 20 2008 * *------------------------------------------------------------------------- diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c index d926fd5..c72dc7c 100644 --- a/src/H5EAdblock.c +++ b/src/H5EAdblock.c @@ -15,7 +15,7 @@ * * Created: H5EAdblock.c * Sep 11 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Data block routines for extensible arrays. * @@ -92,7 +92,6 @@ H5FL_DEFINE_STATIC(H5EA_dblock_t); * Return: Non-NULL pointer to data block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- @@ -153,7 +152,6 @@ END_FUNC(PKG) /* end H5EA__dblock_alloc() */ * Return: Valid file address on success/HADDR_UNDEF on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -248,7 +246,6 @@ END_FUNC(PKG) /* end H5EA__dblock_create() */ * Return: Super block index on success/Can't fail * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- @@ -269,7 +266,7 @@ H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx)) /* Determine the superblock information for the index */ H5_CHECK_OVERFLOW(idx, /*From:*/hsize_t, /*To:*/uint64_t); - sblk_idx = H5VM_log2_gen((uint64_t)((idx / hdr->cparam.data_blk_min_elmts) + 1)); + sblk_idx = H5VM__log2_gen((uint64_t)((idx / hdr->cparam.data_blk_min_elmts) + 1)); /* Set return value */ ret_value = sblk_idx; @@ -285,7 +282,6 @@ END_FUNC(PKG) /* end H5EA__dblock_sblk_idx() */ * Return: Non-NULL pointer to data block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 18 2008 * *------------------------------------------------------------------------- @@ -348,7 +344,6 @@ END_FUNC(PKG) /* end H5EA__dblock_protect() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- @@ -379,7 +374,6 @@ END_FUNC(PKG) /* end H5EA__dblock_unprotect() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 22 2008 * *------------------------------------------------------------------------- @@ -442,7 +436,6 @@ END_FUNC(PKG) /* end H5EA__dblock_delete() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index ec40298..07330c1 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -15,7 +15,7 @@ * * Created: H5EAhdr.c * Aug 26 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Array header routines for extensible arrays. * @@ -110,7 +110,6 @@ H5FL_SEQ_DEFINE_STATIC(H5EA_sblk_info_t); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 26 2008 * *------------------------------------------------------------------------- @@ -180,7 +179,6 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 18 2008 * *------------------------------------------------------------------------- @@ -201,7 +199,7 @@ H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata)) HDassert(hdr->cparam.sup_blk_min_data_ptrs); /* Compute general information */ - hdr->nsblks = 1 + (hdr->cparam.max_nelmts_bits - H5VM_log2_of2(hdr->cparam.data_blk_min_elmts)); + hdr->nsblks = 1 + (hdr->cparam.max_nelmts_bits - H5VM__log2_of2(hdr->cparam.data_blk_min_elmts)); hdr->dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits; hdr->arr_off_size = (unsigned char)H5EA_SIZEOF_OFFSET_BITS(hdr->cparam.max_nelmts_bits); @@ -245,7 +243,6 @@ END_FUNC(PKG) /* end H5EA__hdr_init() */ * Return: Non-NULL pointer to buffer for elements on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 16 2008 * *------------------------------------------------------------------------- @@ -264,7 +261,7 @@ H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts)) /* Compute the index of the element buffer factory */ H5_CHECK_OVERFLOW(nelmts, /*From:*/size_t, /*To:*/uint32_t); - idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); + idx = H5VM__log2_of2((uint32_t)nelmts) - H5VM__log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); /* Check for needing to increase size of array of factories */ if(idx >= hdr->elmt_fac.nalloc) { @@ -312,7 +309,6 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 18 2008 * *------------------------------------------------------------------------- @@ -331,7 +327,7 @@ H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts)) /* Compute the index of the element buffer factory */ H5_CHECK_OVERFLOW(nelmts, /*From:*/size_t, /*To:*/uint32_t); - idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); + idx = H5VM__log2_of2((uint32_t)nelmts) - H5VM__log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); /* Free buffer for elements in index block */ HDassert(idx < hdr->elmt_fac.nalloc); @@ -349,7 +345,6 @@ END_FUNC(PKG) /* end H5EA__hdr_free_elmts() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 17 2008 * *------------------------------------------------------------------------- @@ -464,7 +459,6 @@ END_FUNC(PKG) /* end H5EA__hdr_create() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 26 2008 * *------------------------------------------------------------------------- @@ -497,7 +491,6 @@ END_FUNC(PKG) /* end H5EA__hdr_incr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 26 2008 * *------------------------------------------------------------------------- @@ -533,7 +526,6 @@ END_FUNC(PKG) /* end H5EA__hdr_decr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 26 2008 * *------------------------------------------------------------------------- @@ -559,7 +551,6 @@ END_FUNC(PKG) /* end H5EA__hdr_fuse_incr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 26 2008 * *------------------------------------------------------------------------- @@ -589,7 +580,6 @@ END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -619,7 +609,6 @@ END_FUNC(PKG) /* end H5EA__hdr_modified() */ * Return: Non-NULL pointer to header on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jul 31 2013 * *------------------------------------------------------------------------- @@ -677,7 +666,6 @@ END_FUNC(PKG) /* end H5EA__hdr_protect() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 1 2013 * *------------------------------------------------------------------------- @@ -708,7 +696,6 @@ END_FUNC(PKG) /* end H5EA__hdr_unprotect() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 26 2008 * *------------------------------------------------------------------------- @@ -765,7 +752,6 @@ END_FUNC(PKG) /* end H5EA__hdr_delete() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c index 1b5957a..c45d15a 100644 --- a/src/H5EAiblock.c +++ b/src/H5EAiblock.c @@ -15,7 +15,7 @@ * * Created: H5EAiblock.c * Sep 9 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Index block routines for extensible arrays. * @@ -42,7 +42,7 @@ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5FLprivate.h" /* Free Lists */ #include "H5MFprivate.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ @@ -98,7 +98,6 @@ H5FL_SEQ_DEFINE_STATIC(haddr_t); * Return: Non-NULL pointer to index block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -129,11 +128,6 @@ H5EA__iblock_alloc(H5EA_hdr_t *hdr)) iblock->nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs); iblock->ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1); iblock->nsblk_addrs = hdr->nsblks - iblock->nsblks; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nsblks = %u\n", FUNC, iblock->nsblks); -HDfprintf(stderr, "%s: iblock->ndblk_addrs = %Zu\n", FUNC, iblock->ndblk_addrs); -HDfprintf(stderr, "%s: iblock->nsblk_addrs = %Zu\n", FUNC, iblock->nsblk_addrs); -#endif /* QAK */ /* Allocate buffer for elements in index block */ if(hdr->cparam.idx_blk_elmts > 0) @@ -169,7 +163,6 @@ END_FUNC(PKG) /* end H5EA__iblock_alloc() */ * Return: Valid file address on success/HADDR_UNDEF on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -183,10 +176,6 @@ H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed)) haddr_t iblock_addr; /* Extensible array index block address */ hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); HDassert(stats_changed); @@ -197,9 +186,6 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Set size of index block on disk */ iblock->size = H5EA_IBLOCK_SIZE(iblock); -#ifdef QAK -HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size); -#endif /* QAK */ /* Allocate space for the index block on disk */ if(HADDR_UNDEF == (iblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_IBLOCK, (hsize_t)iblock->size))) @@ -284,7 +270,6 @@ END_FUNC(PKG) /* end H5EA__iblock_create() */ * Return: Non-NULL pointer to index block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -296,10 +281,6 @@ H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags)) /* Local variables */ H5EA_iblock_t *iblock = NULL; /* Pointer to index block */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); @@ -340,7 +321,6 @@ END_FUNC(PKG) /* end H5EA__iblock_protect() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -351,10 +331,6 @@ H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags)) /* Local variables */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(iblock); @@ -375,7 +351,6 @@ END_FUNC(PKG) /* end H5EA__iblock_unprotect() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2008 * *------------------------------------------------------------------------- @@ -387,10 +362,6 @@ H5EA__iblock_delete(H5EA_hdr_t *hdr)) /* Local variables */ H5EA_iblock_t *iblock = NULL; /* Pointer to index block */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* Sanity check */ HDassert(hdr); HDassert(H5F_addr_defined(hdr->idx_blk_addr)); @@ -459,7 +430,6 @@ END_FUNC(PKG) /* end H5EA__iblock_delete() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2008 * *------------------------------------------------------------------------- diff --git a/src/H5EAint.c b/src/H5EAint.c index 2baf1f4..ef8cd7a 100644 --- a/src/H5EAint.c +++ b/src/H5EAint.c @@ -15,7 +15,7 @@ * * Created: H5EAint.c * Jun 17 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Internal routines for extnsible arrays. * @@ -86,7 +86,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 26 2009 * *------------------------------------------------------------------------- @@ -116,7 +115,6 @@ END_FUNC(PKG) /* end H5EA__create_flush_depend() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 26 2009 * *------------------------------------------------------------------------- diff --git a/src/H5EApkg.h b/src/H5EApkg.h index b70231d..ad1fdfc 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -146,7 +146,7 @@ #define H5EA_SIZEOF_OFFSET_BITS(b) (((b) + 7) / 8) /* Compute the first super block index that will hold a certain # of data block pointers */ -#define H5EA_SBLK_FIRST_IDX(m) (2 * H5VM_log2_of2((uint32_t)m)) +#define H5EA_SBLK_FIRST_IDX(m) (2 * H5VM__log2_of2((uint32_t)m)) /****************************/ /* Package Private Typedefs */ diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c index fb7c458..b5b9d94 100644 --- a/src/H5EAsblock.c +++ b/src/H5EAsblock.c @@ -42,7 +42,7 @@ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5FLprivate.h" /* Free Lists */ #include "H5MFprivate.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ diff --git a/src/H5EAstat.c b/src/H5EAstat.c index 509d3f8..68e0b1e 100644 --- a/src/H5EAstat.c +++ b/src/H5EAstat.c @@ -15,7 +15,7 @@ * * Created: H5EAstat.c * Sep 11 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Extensible array metadata statistics functions. * @@ -87,7 +87,6 @@ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 21 2008 * *------------------------------------------------------------------------- @@ -98,10 +97,6 @@ H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats)) /* Local variables */ -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ - /* * Check arguments. */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 8926d6a..a0802bc 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, August 28, 2008 * * Purpose: Extensible array testing functions. @@ -38,7 +38,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5EApkg.h" /* Extensible Arrays */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5VMprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index 4462303..437c431 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -15,7 +15,7 @@ * * Created: H5Edeprec.c * April 11 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Deprecated functions from the H5E interface. These * functions are here for compatibility purposes and may be diff --git a/src/H5Eint.c b/src/H5Eint.c index 2371a5f..cf1d649 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -15,7 +15,7 @@ * * Created: H5Eint.c * April 11 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: General use, "internal" routines for error handling. * diff --git a/src/H5Emodule.h b/src/H5Emodule.h index 2d1bcd0..fbfc262 100644 --- a/src/H5Emodule.h +++ b/src/H5Emodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Epkg.h b/src/H5Epkg.h index 83f3816..eac5829 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, April 11, 2007 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5FA.c b/src/H5FA.c index f8bb094..871793e 100644 --- a/src/H5FA.c +++ b/src/H5FA.c @@ -15,7 +15,7 @@ * * Created: H5FA.c * April 2009 - * Vailin Choi + * Vailin Choi * * Purpose: Implements a Fixed Array for storing elements * of datasets with fixed dimensions. @@ -112,7 +112,6 @@ H5FL_BLK_DEFINE(fa_native_elmt); * NULL on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * Oct 17 2016 * *------------------------------------------------------------------------- @@ -396,13 +395,13 @@ H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt)) dblk_page_nelmts = dblock->dblk_page_nelmts; /* Check if the page has been created yet */ - if(!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { + if(!H5VM__bit_get(dblock->dblk_page_init, page_idx)) { /* Create the data block page */ if(H5FA__dblk_page_create(hdr, dblk_page_addr, dblk_page_nelmts) < 0) H5E_THROW(H5E_CANTCREATE, "unable to create data block page") /* Mark data block page as initialized in data block */ - H5VM_bit_set(dblock->dblk_page_init, page_idx, TRUE); + H5VM__bit_set(dblock->dblk_page_init, page_idx, TRUE); dblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ @@ -483,7 +482,7 @@ H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt)) page_idx = (size_t)(idx / dblock->dblk_page_nelmts); /* Check if the page is defined yet */ - if(!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { + if(!H5VM__bit_get(dblock->dblk_page_init, page_idx)) { /* Call the class's 'fill' callback */ if((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") diff --git a/src/H5FAcache.c b/src/H5FAcache.c index 8f5e696..90770fb 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -15,7 +15,7 @@ * * Created: H5FAcache.c * Jul 2 2009 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement fixed array metadata cache methods. * @@ -180,7 +180,6 @@ const H5AC_class_t H5AC_FARRAY_DBLK_PAGE[1] = {{ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 31, 2013 * *------------------------------------------------------------------------- @@ -246,7 +245,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 12, 2013 * *------------------------------------------------------------------------- @@ -359,7 +357,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 12, 2013 * *------------------------------------------------------------------------- @@ -389,7 +386,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 12, 2013 * *------------------------------------------------------------------------- @@ -527,7 +523,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_notify() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 12, 2013 * *------------------------------------------------------------------------- @@ -556,7 +551,6 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_free_icr() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 12, 2013 * *------------------------------------------------------------------------- @@ -644,7 +638,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -744,7 +737,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -777,7 +769,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_image_len() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -924,7 +915,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_notify() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -1001,7 +991,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_fsf_size() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -1068,7 +1057,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_verify_chksum() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -1141,7 +1129,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_deserialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -1171,7 +1158,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -1223,7 +1209,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_serialize() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * Oct 17 2016 * *------------------------------------------------------------------------- @@ -1286,7 +1271,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_notify() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c index b578cf2..431e6fa 100644 --- a/src/H5FAdbg.c +++ b/src/H5FAdbg.c @@ -229,7 +229,7 @@ H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Read and print each page's elements in the data block */ for(page_idx = 0; page_idx < dblock->npages; page_idx++) { - if(!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { + if(!H5VM__bit_get(dblock->dblk_page_init, page_idx)) { HDfprintf(stream, "%*s%-*s %Hu %s\n", indent, "", fwidth, "Page %Zu:", page_idx, "empty"); diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 506c767..b25d50b 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -414,7 +414,6 @@ END_FUNC(PKG) /* end H5FA__hdr_modified() */ * Return: Non-NULL pointer to header on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 12 2013 * *------------------------------------------------------------------------- @@ -471,7 +470,6 @@ END_FUNC(PKG) /* end H5FA__hdr_protect() */ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 12 2013 * *------------------------------------------------------------------------- @@ -491,7 +489,7 @@ H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags)) CATCH -END_FUNC(PKG) /* end H5EA__hdr_unprotect() */ +END_FUNC(PKG) /* end H5FA__hdr_unprotect() */ /*------------------------------------------------------------------------- diff --git a/src/H5FAint.c b/src/H5FAint.c index 9d3bce8..3a1375a 100644 --- a/src/H5FAint.c +++ b/src/H5FAint.c @@ -15,7 +15,7 @@ * * Created: H5FAint.c * Fall 2012 - * Dana Robinson + * Dana Robinson * * Purpose: Internal routines for fixed arrays. * diff --git a/src/H5FAmodule.h b/src/H5FAmodule.h index f675faf..57a85b1 100644 --- a/src/H5FAmodule.h +++ b/src/H5FAmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5FAstat.c b/src/H5FAstat.c index 49a56a9..882da99 100644 --- a/src/H5FAstat.c +++ b/src/H5FAstat.c @@ -35,9 +35,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ #include "H5MMprivate.h" /* Memory management */ diff --git a/src/H5FAtest.c b/src/H5FAtest.c index e55d408..2bcdc01 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -36,7 +36,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FApkg.h" /* Fixed Arrays */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5VMprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 0551dd0..2afe7ea 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, August 10, 1999 * * Purpose: A driver which stores the HDF5 data in main memory using @@ -144,8 +144,8 @@ static herr_t H5FD__core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, ha size_t size, const void *buf); static herr_t H5FD__core_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD__core_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_core_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_core_unlock(H5FD_t *_file); +static herr_t H5FD__core_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__core_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_core_g = { "core", /* name */ @@ -177,8 +177,8 @@ static const H5FD_class_t H5FD_core_g = { H5FD__core_write, /* write */ H5FD__core_flush, /* flush */ H5FD__core_truncate, /* truncate */ - H5FD_core_lock, /* lock */ - H5FD_core_unlock, /* unlock */ + H5FD__core_lock, /* lock */ + H5FD__core_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -345,7 +345,7 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) HDoff_t offset = (HDoff_t)addr; /* Offset to write at */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -414,7 +414,7 @@ H5FD__init_package(void) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5FD_core_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize core VFD") @@ -1581,7 +1581,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_core_lock + * Function: H5FD__core_lock * * Purpose: To place an advisory lock on a file. * The lock type to apply depends on the parameter "rw": @@ -1595,13 +1595,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_lock(H5FD_t *_file, hbool_t rw) +H5FD__core_lock(H5FD_t *_file, hbool_t rw) { H5FD_core_t *file = (H5FD_core_t*)_file; /* VFD file struct */ int lock_flags; /* file locking flags */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -1609,7 +1609,6 @@ H5FD_core_lock(H5FD_t *_file, hbool_t rw) * descriptor, this is a no-op. */ if(file->fd >= 0) { - /* Set exclusive or shared lock based on rw status */ lock_flags = rw ? LOCK_EX : LOCK_SH; @@ -1620,16 +1619,15 @@ H5FD_core_lock(H5FD_t *_file, hbool_t rw) else HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to lock file") } /* end if */ - } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_lock() */ +} /* end H5FD__core_lock() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_unlock + * Function: H5FD__core_unlock * * Purpose: To remove the existing lock on the file * @@ -1640,17 +1638,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_unlock(H5FD_t *_file) +H5FD__core_unlock(H5FD_t *_file) { H5FD_core_t *file = (H5FD_core_t*)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); - if(file->fd >= 0) { - + if(file->fd >= 0) if(HDflock(file->fd, LOCK_UN) < 0) { if(ENOSYS == errno) HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "file locking disabled on this file system (use HDF5_USE_FILE_LOCKING environment variable to override)") @@ -1658,9 +1655,7 @@ H5FD_core_unlock(H5FD_t *_file) HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to unlock file") } /* end if */ - } /* end if */ - done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_unlock() */ +} /* end H5FD__core_unlock() */ diff --git a/src/H5FDcore.h b/src/H5FDcore.h index 5fe2912..63b6f27 100644 --- a/src/H5FDcore.h +++ b/src/H5FDcore.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the core driver. diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 34c4346..1dbf857 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Purpose: The Direct I/O file driver forces the data to be written to @@ -23,15 +23,15 @@ #include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDdirect.h" /* Direct file driver */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDdirect.h" /* Direct file driver */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ #ifdef H5_HAVE_DIRECT @@ -109,69 +109,68 @@ typedef struct H5FD_direct_t { * which can be addressed entirely by the second * argument of the file seek function. */ -#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ - ((A) & ~(haddr_t)MAXADDR)) +#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) #define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) -#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - HADDR_UNDEF==(A)+(Z) || \ - (HDoff_t)((A)+(Z))<(HDoff_t)(A)) +#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ + HADDR_UNDEF == (A) + (Z) || \ + (HDoff_t)((A) + (Z)) < (HDoff_t)(A)) /* Prototypes */ -static herr_t H5FD_direct_term(void); -static void *H5FD_direct_fapl_get(H5FD_t *file); -static void *H5FD_direct_fapl_copy(const void *_old_fa); -static H5FD_t *H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, +static herr_t H5FD__direct_term(void); +static void *H5FD__direct_fapl_get(H5FD_t *file); +static void *H5FD__direct_fapl_copy(const void *_old_fa); +static H5FD_t *H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_direct_close(H5FD_t *_file); -static int H5FD_direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_direct_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_direct_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_direct_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_direct_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_direct_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__direct_close(H5FD_t *_file); +static int H5FD__direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__direct_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__direct_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__direct_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__direct_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__direct_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); +static herr_t H5FD__direct_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_direct_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__direct_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_direct_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_direct_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_direct_unlock(H5FD_t *_file); +static herr_t H5FD__direct_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__direct_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__direct_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_direct_g = { - "direct", /*name */ - MAXADDR, /*maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_direct_term, /*terminate */ - NULL, /*sb_size */ - NULL, /*sb_encode */ - NULL, /*sb_decode */ - sizeof(H5FD_direct_fapl_t), /*fapl_size */ - H5FD_direct_fapl_get, /*fapl_get */ - H5FD_direct_fapl_copy, /*fapl_copy */ - NULL, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_direct_open, /*open */ - H5FD_direct_close, /*close */ - H5FD_direct_cmp, /*cmp */ - H5FD_direct_query, /*query */ - NULL, /*get_type_map */ - NULL, /*alloc */ - NULL, /*free */ - H5FD_direct_get_eoa, /*get_eoa */ - H5FD_direct_set_eoa, /*set_eoa */ - H5FD_direct_get_eof, /*get_eof */ - H5FD_direct_get_handle, /*get_handle */ - H5FD_direct_read, /*read */ - H5FD_direct_write, /*write */ - NULL, /*flush */ - H5FD_direct_truncate, /*truncate */ - H5FD_direct_lock, /*lock */ - H5FD_direct_unlock, /*unlock */ - H5FD_FLMAP_DICHOTOMY /*fl_map */ + "direct", /* name */ + MAXADDR, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD__direct_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + sizeof(H5FD_direct_fapl_t), /* fapl_size */ + H5FD__direct_fapl_get, /* fapl_get */ + H5FD__direct_fapl_copy, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__direct_open, /* open */ + H5FD__direct_close, /* close */ + H5FD__direct_cmp, /* cmp */ + H5FD__direct_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD__direct_get_eoa, /* get_eoa */ + H5FD__direct_set_eoa, /* set_eoa */ + H5FD__direct_get_eof, /* get_eof */ + H5FD__direct_get_handle, /* get_handle */ + H5FD__direct_read, /* read */ + H5FD__direct_write, /* write */ + NULL, /* flush */ + H5FD__direct_truncate, /* truncate */ + H5FD__direct_lock, /* lock */ + H5FD__direct_unlock, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; /* Declare a free list to manage the H5FD_direct_t struct */ @@ -238,7 +237,7 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_direct_term + * Function: H5FD__direct_term * * Purpose: Shut down the VFD * @@ -250,15 +249,15 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_direct_term(void) +H5FD__direct_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Reset VFL ID */ H5FD_DIRECT_g=0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_direct_term() */ +} /* end H5FD__direct_term() */ /*------------------------------------------------------------------------- @@ -361,7 +360,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_fapl_get + * Function: H5FD__direct_fapl_get * * Purpose: Returns a file access property list which indicates how the * specified file is being accessed. The return list could be @@ -375,28 +374,26 @@ done: * Programmer: Raymond Lu * Wednesday, 18 October 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_direct_fapl_get(H5FD_t *_file) +H5FD__direct_fapl_get(H5FD_t *_file) { H5FD_direct_t *file = (H5FD_direct_t*)_file; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Set return value */ - ret_value= H5FD_direct_fapl_copy(&(file->fa)); + ret_value= H5FD__direct_fapl_copy(&(file->fa)); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_direct_fapl_get() */ +} /* end H5FD__direct_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD_direct_fapl_copy + * Function: H5FD__direct_fapl_copy * * Purpose: Copies the direct-specific file access properties. * @@ -407,17 +404,15 @@ done: * Programmer: Raymond Lu * Wednesday, 18 October 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_direct_fapl_copy(const void *_old_fa) +H5FD__direct_fapl_copy(const void *_old_fa) { const H5FD_direct_fapl_t *old_fa = (const H5FD_direct_fapl_t*)_old_fa; H5FD_direct_fapl_t *new_fa = H5MM_calloc(sizeof(H5FD_direct_fapl_t)); - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(new_fa); @@ -425,11 +420,11 @@ H5FD_direct_fapl_copy(const void *_old_fa) H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_direct_fapl_t)); FUNC_LEAVE_NOAPI(new_fa) -} /* end H5FD_direct_fapl_copy() */ +} /* end H5FD__direct_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5FD_direct_open + * Function: H5FD__direct_open * * Purpose: Create and/or opens a Unix file for direct I/O as an HDF5 file. * @@ -442,12 +437,10 @@ H5FD_direct_fapl_copy(const void *_old_fa) * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) +H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { int o_flags; int fd=(-1); @@ -462,7 +455,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd void *buf1, *buf2; H5FD_t *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check on file offsets */ HDassert(sizeof(HDoff_t)>=sizeof(size_t)); @@ -577,7 +570,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_close + * Function: H5FD__direct_close * * Purpose: Closes the file. * @@ -588,17 +581,15 @@ done: * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_close(H5FD_t *_file) +H5FD__direct_close(H5FD_t *_file) { H5FD_direct_t *file = (H5FD_direct_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if (HDclose(file->fd)<0) HSYS_GOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") @@ -611,7 +602,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_cmp + * Function: H5FD__direct_cmp * * Purpose: Compares two files belonging to this driver using an * arbitrary (but consistent) ordering. @@ -624,18 +615,16 @@ done: * Programmer: Raymond Lu * Thursday, 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -H5FD_direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +H5FD__direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_direct_t *f1 = (const H5FD_direct_t*)_f1; const H5FD_direct_t *f2 = (const H5FD_direct_t*)_f2; int ret_value=0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #ifdef H5_HAVE_WIN32_API if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) @@ -668,7 +657,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_query + * Function: H5FD__direct_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -680,14 +669,12 @@ done: * Programmer: Raymond Lu * Thursday, 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_query(const H5FD_t H5_ATTR_UNUSED * _f, unsigned long *flags /* out */) +H5FD__direct_query(const H5FD_t H5_ATTR_UNUSED * _f, unsigned long *flags /* out */) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set the VFL feature flags that this driver supports */ if(flags) { @@ -704,7 +691,7 @@ H5FD_direct_query(const H5FD_t H5_ATTR_UNUSED * _f, unsigned long *flags /* out /*------------------------------------------------------------------------- - * Function: H5FD_direct_get_eoa + * Function: H5FD__direct_get_eoa * * Purpose: Gets the end-of-address marker for the file. The EOA marker * is the first address past the last byte allocated in the @@ -717,26 +704,21 @@ H5FD_direct_query(const H5FD_t H5_ATTR_UNUSED * _f, unsigned long *flags /* out * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static haddr_t -H5FD_direct_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__direct_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_direct_t *file = (const H5FD_direct_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eoa) } /*------------------------------------------------------------------------- - * Function: H5FD_direct_set_eoa + * Function: H5FD__direct_set_eoa * * Purpose: Set the end-of-address marker for the file. This function is * called shortly after an existing HDF5 file is opened in order @@ -749,19 +731,14 @@ H5FD_direct_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) +H5FD__direct_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_direct_t *file = (H5FD_direct_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR file->eoa = addr; @@ -770,7 +747,7 @@ H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5FD_direct_get_eof + * Function: H5FD__direct_get_eof * * Purpose: Returns the end-of-file marker, which is the greater of * either the Unix end-of-file or the HDF5 end-of-address @@ -785,16 +762,14 @@ H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static haddr_t -H5FD_direct_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__direct_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_direct_t *file = (const H5FD_direct_t*)_file; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC FUNC_LEAVE_NOAPI(file->eof) } @@ -810,17 +785,15 @@ H5FD_direct_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * Programmer: Raymond Lu * 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handle) +H5FD__direct_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handle) { H5FD_direct_t *file = (H5FD_direct_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") @@ -832,7 +805,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_read + * Function: H5FD__direct_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR * into buffer BUF according to data transfer properties in @@ -846,12 +819,10 @@ done: * Programmer: Raymond Lu * Thursday, 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, +H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_direct_t *file = (H5FD_direct_t*)_file; @@ -867,7 +838,7 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN size_t copy_size = size; /* Size remaining to read when using copy buffer */ size_t copy_offset; /* Offset into copy buffer of the requested data */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -1018,7 +989,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_write + * Function: H5FD__direct_write * * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR * from buffer BUF according to data transfer properties in @@ -1031,12 +1002,10 @@ done: * Programmer: Raymond Lu * Thursday, 21 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, +H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { H5FD_direct_t *file = (H5FD_direct_t*)_file; @@ -1055,7 +1024,7 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U size_t copy_size = size; /* Size remaining to write when using copy buffer */ size_t copy_offset; /* Offset into copy buffer of the data to write */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -1253,7 +1222,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_truncate + * Function: H5FD__direct_truncate * * Purpose: Makes sure that the true file size is the same (or larger) * than the end-of-address. @@ -1268,12 +1237,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) +H5FD__direct_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { H5FD_direct_t *file = (H5FD_direct_t*)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -1314,11 +1283,11 @@ H5FD_direct_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATT done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_direct_truncate() */ +} /* end H5FD__direct_truncate() */ /*------------------------------------------------------------------------- - * Function: H5FD_direct_lock + * Function: H5FD__direct_lock * * Purpose: To place an advisory lock on a file. * The lock type to apply depends on the parameter "rw": @@ -1332,13 +1301,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_lock(H5FD_t *_file, hbool_t rw) +H5FD__direct_lock(H5FD_t *_file, hbool_t rw) { H5FD_direct_t *file = (H5FD_direct_t*)_file; /* VFD file struct */ const int lock = rw ? LOCK_EX : LOCK_SH; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -1348,11 +1317,11 @@ H5FD_direct_lock(H5FD_t *_file, hbool_t rw) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_direct_lock() */ +} /* end H5FD__direct_lock() */ /*------------------------------------------------------------------------- - * Function: H5FD_direct_unlock + * Function: H5FD__direct_unlock * * Purpose: To remove the existing lock on the file * @@ -1363,12 +1332,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_unlock(H5FD_t *_file) +H5FD__direct_unlock(H5FD_t *_file) { H5FD_direct_t *file = (H5FD_direct_t*)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -1377,7 +1346,7 @@ H5FD_direct_unlock(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_direct_unlock() */ +} /* end H5FD__direct_unlock() */ #endif /* H5_HAVE_DIRECT */ diff --git a/src/H5FDdirect.h b/src/H5FDdirect.h index 805f3be..630a1e6 100644 --- a/src/H5FDdirect.h +++ b/src/H5FDdirect.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Purpose: The public header file for the direct driver. diff --git a/src/H5FDdrvr_module.h b/src/H5FDdrvr_module.h index 59a419e..34beb32 100644 --- a/src/H5FDdrvr_module.h +++ b/src/H5FDdrvr_module.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index d110ef7..aa604c2 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 10, 1997 * * Purpose: Implements a family of files that acts as a single hdf5 @@ -79,67 +79,67 @@ typedef struct H5FD_family_fapl_t { } H5FD_family_fapl_t; /* Callback prototypes */ -static herr_t H5FD_family_term(void); -static void *H5FD_family_fapl_get(H5FD_t *_file); -static void *H5FD_family_fapl_copy(const void *_old_fa); -static herr_t H5FD_family_fapl_free(void *_fa); -static hsize_t H5FD_family_sb_size(H5FD_t *_file); -static herr_t H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/, +static herr_t H5FD__family_term(void); +static void *H5FD__family_fapl_get(H5FD_t *_file); +static void *H5FD__family_fapl_copy(const void *_old_fa); +static herr_t H5FD__family_fapl_free(void *_fa); +static hsize_t H5FD__family_sb_size(H5FD_t *_file); +static herr_t H5FD__family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/); -static herr_t H5FD_family_sb_decode(H5FD_t *_file, const char *name, +static herr_t H5FD__family_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf); -static H5FD_t *H5FD_family_open(const char *name, unsigned flags, +static H5FD_t *H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_family_close(H5FD_t *_file); -static int H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_family_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa); -static haddr_t H5FD_family_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, +static herr_t H5FD__family_close(H5FD_t *_file); +static int H5FD__family_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__family_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__family_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa); +static haddr_t H5FD__family_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); +static herr_t H5FD__family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *_buf/*out*/); -static herr_t H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, +static herr_t H5FD__family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *_buf); -static herr_t H5FD_family_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_family_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_family_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_family_unlock(H5FD_t *_file); +static herr_t H5FD__family_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__family_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__family_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__family_unlock(H5FD_t *_file); /* The class struct */ static const H5FD_class_t H5FD_family_g = { - "family", /*name */ - HADDR_MAX, /*maxaddr */ - H5F_CLOSE_WEAK, /*fc_degree */ - H5FD_family_term, /*terminate */ - H5FD_family_sb_size, /*sb_size */ - H5FD_family_sb_encode, /*sb_encode */ - H5FD_family_sb_decode, /*sb_decode */ - sizeof(H5FD_family_fapl_t), /*fapl_size */ - H5FD_family_fapl_get, /*fapl_get */ - H5FD_family_fapl_copy, /*fapl_copy */ - H5FD_family_fapl_free, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_family_open, /*open */ - H5FD_family_close, /*close */ - H5FD_family_cmp, /*cmp */ - H5FD_family_query, /*query */ - NULL, /*get_type_map */ - NULL, /*alloc */ - NULL, /*free */ - H5FD_family_get_eoa, /*get_eoa */ - H5FD_family_set_eoa, /*set_eoa */ - H5FD_family_get_eof, /*get_eof */ - H5FD_family_get_handle, /*get_handle */ - H5FD_family_read, /*read */ - H5FD_family_write, /*write */ - H5FD_family_flush, /*flush */ - H5FD_family_truncate, /*truncate */ - H5FD_family_lock, /*lock */ - H5FD_family_unlock, /*unlock */ - H5FD_FLMAP_DICHOTOMY /*fl_map */ + "family", /* name */ + HADDR_MAX, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD__family_term, /* terminate */ + H5FD__family_sb_size, /* sb_size */ + H5FD__family_sb_encode, /* sb_encode */ + H5FD__family_sb_decode, /* sb_decode */ + sizeof(H5FD_family_fapl_t), /* fapl_size */ + H5FD__family_fapl_get, /* fapl_get */ + H5FD__family_fapl_copy, /* fapl_copy */ + H5FD__family_fapl_free, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__family_open, /* open */ + H5FD__family_close, /* close */ + H5FD__family_cmp, /* cmp */ + H5FD__family_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD__family_get_eoa, /* get_eoa */ + H5FD__family_set_eoa, /* set_eoa */ + H5FD__family_get_eof, /* get_eof */ + H5FD__family_get_handle, /* get_handle */ + H5FD__family_read, /* read */ + H5FD__family_write, /* write */ + H5FD__family_flush, /* flush */ + H5FD__family_truncate, /* truncate */ + H5FD__family_lock, /* lock */ + H5FD__family_unlock, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -203,7 +203,7 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_family_term + * Function: H5FD__family_term * * Purpose: Shut down the VFD * @@ -215,15 +215,15 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_family_term(void) +H5FD__family_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Reset VFL ID */ H5FD_FAMILY_g=0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_family_term() */ +} /* end H5FD__family_term() */ /*------------------------------------------------------------------------- @@ -242,13 +242,6 @@ H5FD_family_term(void) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -296,13 +289,6 @@ done: * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ herr_t @@ -335,7 +321,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_family_fapl_get + * Function: H5FD__family_fapl_get * * Purpose: Gets a file access property list which could be used to * create an identical file. @@ -347,19 +333,17 @@ done: * Programmer: Robb Matzke * Friday, August 13, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_family_fapl_get(H5FD_t *_file) +H5FD__family_fapl_get(H5FD_t *_file) { H5FD_family_t *file = (H5FD_family_t*)_file; H5FD_family_fapl_t *fa = NULL; H5P_genplist_t *plist; /* Property list pointer */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL == (fa = (H5FD_family_fapl_t *)H5MM_calloc(sizeof(H5FD_family_fapl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -373,16 +357,16 @@ H5FD_family_fapl_get(H5FD_t *_file) ret_value=fa; done: - if(ret_value==NULL) { + if(ret_value==NULL) if(fa!=NULL) H5MM_xfree(fa); - } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /*------------------------------------------------------------------------- - * Function: H5FD_family_fapl_copy + * Function: H5FD__family_fapl_copy * * Purpose: Copies the family-specific file access properties. * @@ -393,19 +377,17 @@ done: * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_family_fapl_copy(const void *_old_fa) +H5FD__family_fapl_copy(const void *_old_fa) { const H5FD_family_fapl_t *old_fa = (const H5FD_family_fapl_t*)_old_fa; H5FD_family_fapl_t *new_fa = NULL; H5P_genplist_t *plist; /* Property list pointer */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL == (new_fa = (H5FD_family_fapl_t *)H5MM_malloc(sizeof(H5FD_family_fapl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -428,16 +410,16 @@ H5FD_family_fapl_copy(const void *_old_fa) ret_value=new_fa; done: - if(ret_value==NULL) { + if(ret_value==NULL) if(new_fa!=NULL) H5MM_xfree(new_fa); - } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /*------------------------------------------------------------------------- - * Function: H5FD_family_fapl_free + * Function: H5FD__family_fapl_free * * Purpose: Frees the family-specific file access properties. * @@ -448,17 +430,15 @@ done: * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_family_fapl_free(void *_fa) +H5FD__family_fapl_free(void *_fa) { H5FD_family_fapl_t *fa = (H5FD_family_fapl_t*)_fa; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5I_dec_ref(fa->memb_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID") @@ -470,7 +450,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_family_sb_size + * Function: H5FD__family_sb_size * * Purpose: Returns the size of the private information to be stored in * the superblock. @@ -482,14 +462,12 @@ done: * Programmer: Raymond Lu * Tuesday, May 10, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static hsize_t -H5FD_family_sb_size(H5FD_t H5_ATTR_UNUSED *_file) +H5FD__family_sb_size(H5FD_t H5_ATTR_UNUSED *_file) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* 8 bytes field for the size of member file size field should be * enough for now. */ @@ -498,7 +476,7 @@ H5FD_family_sb_size(H5FD_t H5_ATTR_UNUSED *_file) /*------------------------------------------------------------------------- - * Function: H5FD_family_sb_encode + * Function: H5FD__family_sb_encode * * Purpose: Encode driver information for the superblock. The NAME * argument is a nine-byte buffer which will be initialized with @@ -513,16 +491,14 @@ H5FD_family_sb_size(H5FD_t H5_ATTR_UNUSED *_file) * Programmer: Raymond Lu * Tuesday, May 10, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/) +H5FD__family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/) { H5FD_family_t *file = (H5FD_family_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Name and version number */ HDstrncpy(name, "NCSAfami", (size_t)9); @@ -532,18 +508,18 @@ H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out* * This is to guarantee backward compatibility. If a file is created with * v1.6 library and the driver info isn't saved in the superblock. We open * it with v1.8, the FILE->MEMB_SIZE will be the actual size of the first - * member file (see H5FD_family_open). So it isn't safe to use FILE->MEMB_SIZE. + * member file (see H5FD__family_open). So it isn't safe to use FILE->MEMB_SIZE. * If the file is created with v1.8, the correctness of FILE->PMEM_SIZE is - * checked in H5FD_family_sb_decode. SLU - 2009/3/21 + * checked in H5FD__family_sb_decode. SLU - 2009/3/21 */ UINT64ENCODE(buf, (uint64_t)file->pmem_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_family_sb_encode() */ +} /* end H5FD__family_sb_encode() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_sb_decode + * Function: H5FD__family_sb_decode * * Purpose: This function has 2 separate purpose. One is to decodes the * superblock information for this driver. The NAME argument is @@ -561,13 +537,13 @@ H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out* *------------------------------------------------------------------------- */ static herr_t -H5FD_family_sb_decode(H5FD_t *_file, const char H5_ATTR_UNUSED *name, const unsigned char *buf) +H5FD__family_sb_decode(H5FD_t *_file, const char H5_ATTR_UNUSED *name, const unsigned char *buf) { H5FD_family_t *file = (H5FD_family_t*)_file; uint64_t msize; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Read member file size. Skip name template for now although it's saved. */ UINT64DECODE(buf, msize); @@ -594,11 +570,11 @@ H5FD_family_sb_decode(H5FD_t *_file, const char H5_ATTR_UNUSED *name, const unsi done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_sb_decode() */ +} /* end H5FD__family_sb_decode() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_open + * Function: H5FD__family_open * * Purpose: Creates and/or opens a family of files as an HDF5 file. * @@ -621,7 +597,7 @@ done: */ H5_GCC_DIAG_OFF(format-nonliteral) static H5FD_t * -H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, +H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_family_t *file = NULL; @@ -630,7 +606,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, unsigned t_flags = flags & ~H5F_ACC_CREAT; H5FD_t *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ if(!name || !*name) @@ -769,12 +745,12 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_open() */ +} /* end H5FD__family_open() */ H5_GCC_DIAG_ON(format-nonliteral) /*------------------------------------------------------------------------- - * Function: H5FD_family_close + * Function: H5FD__family_close * * Purpose: Closes a family of files. * @@ -790,14 +766,14 @@ H5_GCC_DIAG_ON(format-nonliteral) *------------------------------------------------------------------------- */ static herr_t -H5FD_family_close(H5FD_t *_file) +H5FD__family_close(H5FD_t *_file) { H5FD_family_t *file = (H5FD_family_t*)_file; unsigned nerrors = 0; /* Number of errors while closing member files */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Close as many members as possible. Use private function here to avoid clearing * the error stack. We need the error message to indicate wrong member file size. */ @@ -822,11 +798,11 @@ H5FD_family_close(H5FD_t *_file) H5MM_xfree(file); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_close() */ +} /* end H5FD__family_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_cmp + * Function: H5FD__family_cmp * * Purpose: Compares two file families to see if they are the same. It * does this by comparing the first member of the two families. @@ -839,18 +815,16 @@ H5FD_family_close(H5FD_t *_file) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +H5FD__family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_family_t *f1 = (const H5FD_family_t*)_f1; const H5FD_family_t *f2 = (const H5FD_family_t*)_f2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(f1->nmembs >= 1 && f1->memb[0]); HDassert(f2->nmembs >= 1 && f2->memb[0]); @@ -858,11 +832,11 @@ H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) ret_value = H5FDcmp(f1->memb[0], f2->memb[0]); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_cmp() */ +} /* end H5FD__family_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_query + * Function: H5FD__family_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -876,11 +850,11 @@ H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) *------------------------------------------------------------------------- */ static herr_t -H5FD_family_query(const H5FD_t * _file, unsigned long *flags /* out */) +H5FD__family_query(const H5FD_t * _file, unsigned long *flags /* out */) { const H5FD_family_t *file = (const H5FD_family_t*)_file; /* Family VFD info */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set the VFL feature flags that this driver supports */ if(flags) { @@ -896,11 +870,11 @@ H5FD_family_query(const H5FD_t * _file, unsigned long *flags /* out */) } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_family_query() */ +} /* end H5FD__family_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_get_eoa + * Function: H5FD__family_get_eoa * * Purpose: Returns the end-of-address marker for the file. The EOA * marker is the first address past the last byte allocated in @@ -913,26 +887,21 @@ H5FD_family_query(const H5FD_t * _file, unsigned long *flags /* out */) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ static haddr_t -H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_family_t *file = (const H5FD_family_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eoa) } /*------------------------------------------------------------------------- - * Function: H5FD_family_set_eoa + * Function: H5FD__family_set_eoa * * Purpose: Set the end-of-address marker for the file. * @@ -943,11 +912,6 @@ H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * *------------------------------------------------------------------------- */ /* Disable warning for "format not a string literal" here -QAK */ @@ -958,7 +922,7 @@ H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) */ H5_GCC_DIAG_OFF(format-nonliteral) static herr_t -H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) +H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) { H5FD_family_t *file = (H5FD_family_t*)_file; haddr_t addr = abs_eoa; @@ -966,7 +930,7 @@ H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate space for the member name buffer */ if(NULL == (memb_name = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE))) @@ -1027,7 +991,7 @@ H5_GCC_DIAG_ON(format-nonliteral) /*------------------------------------------------------------------------- - * Function: H5FD_family_get_eof + * Function: H5FD__family_get_eof * * Purpose: Returns the end-of-file marker, which is the greater of * either the total family size or the current EOA marker. @@ -1041,19 +1005,17 @@ H5_GCC_DIAG_ON(format-nonliteral) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static haddr_t -H5FD_family_get_eof(const H5FD_t *_file, H5FD_mem_t type) +H5FD__family_get_eof(const H5FD_t *_file, H5FD_mem_t type) { const H5FD_family_t *file = (const H5FD_family_t*)_file; haddr_t eof=0; int i; /* Local index variable */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * Find the last member that has a non-zero EOF and break out of the loop @@ -1085,7 +1047,7 @@ H5FD_family_get_eof(const H5FD_t *_file, H5FD_mem_t type) /*------------------------------------------------------------------------- - * Function: H5FD_family_get_handle + * Function: H5FD__family_get_handle * * Purpose: Returns the file handle of FAMILY file driver. * @@ -1094,12 +1056,10 @@ H5FD_family_get_eof(const H5FD_t *_file, H5FD_mem_t type) * Programmer: Raymond Lu * Sept. 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) +H5FD__family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) { H5FD_family_t *file = (H5FD_family_t *)_file; H5P_genplist_t *plist; @@ -1107,7 +1067,7 @@ H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) int memb; herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the plist structure and family offset */ if(NULL == (plist = H5P_object_verify(fapl, H5P_FILE_ACCESS))) @@ -1127,7 +1087,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_family_read + * Function: H5FD__family_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR * into buffer BUF according to data transfer properties in @@ -1141,12 +1101,10 @@ done: * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, +H5FD__family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *_buf/*out*/) { H5FD_family_t *file = (H5FD_family_t*)_file; @@ -1158,7 +1116,7 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Get the member data transfer property list. If the transfer property @@ -1197,7 +1155,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_family_write + * Function: H5FD__family_write * * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR * from buffer BUF according to data transfer properties in @@ -1210,12 +1168,10 @@ done: * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, +H5FD__family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *_buf) { H5FD_family_t *file = (H5FD_family_t*)_file; @@ -1227,7 +1183,7 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Get the member data transfer property list. If the transfer property @@ -1266,7 +1222,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_family_flush + * Function: H5FD__family_flush * * Purpose: Flushes all family members. * @@ -1279,13 +1235,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_family_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) +H5FD__family_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) { H5FD_family_t *file = (H5FD_family_t*)_file; unsigned u, nerrors = 0; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC for(u = 0; u < file->nmembs; u++) if(file->memb[u] && H5FD_flush(file->memb[u], closing) < 0) @@ -1296,11 +1252,11 @@ H5FD_family_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_flush() */ +} /* end H5FD__family_flush() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_truncate + * Function: H5FD__family_truncate * * Purpose: Truncates all family members. * @@ -1314,13 +1270,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_family_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) +H5FD__family_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) { H5FD_family_t *file = (H5FD_family_t*)_file; unsigned u, nerrors = 0; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC for(u = 0; u < file->nmembs; u++) if(file->memb[u] && H5FD_truncate(file->memb[u], closing) < 0) @@ -1331,11 +1287,11 @@ H5FD_family_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closin done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_truncate() */ +} /* end H5FD__family_truncate() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_lock + * Function: H5FD__family_lock * * Purpose: To place an advisory lock on a file. * The lock type to apply depends on the parameter "rw": @@ -1349,13 +1305,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_family_lock(H5FD_t *_file, hbool_t rw) +H5FD__family_lock(H5FD_t *_file, hbool_t rw) { H5FD_family_t *file = (H5FD_family_t *)_file; /* VFD file struct */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Place the lock on all the member files */ for(u = 0; u < file->nmembs; u++) @@ -1379,11 +1335,11 @@ H5FD_family_lock(H5FD_t *_file, hbool_t rw) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_lock() */ +} /* end H5FD__family_lock() */ /*------------------------------------------------------------------------- - * Function: H5FD_family_unlock + * Function: H5FD__family_unlock * * Purpose: To remove the existing lock on the file * @@ -1394,13 +1350,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_family_unlock(H5FD_t *_file) +H5FD__family_unlock(H5FD_t *_file) { H5FD_family_t *file = (H5FD_family_t *)_file; /* VFD file struct */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Remove the lock on the member files */ for(u = 0; u < file->nmembs; u++) @@ -1410,5 +1366,5 @@ H5FD_family_unlock(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_family_unlock() */ +} /* end H5FD__family_unlock() */ diff --git a/src/H5FDfamily.h b/src/H5FDfamily.h index 1584cf6..45bdccc 100644 --- a/src/H5FDfamily.h +++ b/src/H5FDfamily.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 4, 1999 * * Purpose: The public header file for the family driver. diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 3d086ea..29d032e 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -20,9 +20,6 @@ * File System (HDFS). */ -/* This source code file is part of the H5FD driver module */ -#include "H5FDdrvr_module.h" - #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5FDprivate.h" /* File drivers */ @@ -32,8 +29,12 @@ #include "H5MMprivate.h" /* Memory management */ #ifdef H5_HAVE_LIBHDFS + +/* This source code file is part of the H5FD driver module */ +#include "H5FDdrvr_module.h" + +/* HDFS routines */ #include "hdfs.h" -#endif /* toggle function call prints: 1 turns on */ #define HDFS_DEBUG 0 @@ -74,7 +75,7 @@ static hid_t H5FD_HDFS_g = 0; #define HDFS_STATS_POW(bin_i, out_ptr) { \ unsigned long long donotshadowresult = 1; \ unsigned donotshadowindex = 0; \ - for (donotshadowindex = 0; \ + for(donotshadowindex = 0; \ donotshadowindex < (((bin_i) * HDFS_STATS_INTERVAL) + \ HDFS_STATS_START_POWER); \ donotshadowindex++) \ @@ -118,8 +119,6 @@ static unsigned long long hdfs_stats_boundaries[HDFS_STATS_BIN_COUNT]; * * Programmer: Jacob Smith * - * Changes: None - * ***************************************************************************/ typedef struct { unsigned long long count; @@ -130,7 +129,6 @@ typedef struct { #endif /* HDFS_STATS */ -#ifdef H5_HAVE_LIBHDFS /* "unique" identifier for `hdfs_t` structures. * Randomly generated by unweighted dice rolls. @@ -146,9 +144,7 @@ typedef struct { * * Contain/retain information associated with a file hosted on Hadoop * Distributed File System (HDFS). Instantiated and populated via - * `H5FD_hdfs_handle_open()` and cleaned up via `H5FD_hdfs_handle_close()`. - * - * + * `H5FD__hdfs_handle_open()` and cleaned up via `H5FD__hdfs_handle_close()`. * * `magic` (unisgned long) * @@ -175,8 +171,6 @@ typedef struct { * Programmer: Jacob Smith * May 2018 * - * Changes: None - * *************************************************************************** */ typedef struct { @@ -187,194 +181,6 @@ typedef struct { } hdfs_t; -/*-------------------------------------------------------------------------- - * Function: H5FD_hdfs_handle_open - * - * Purpose: Create a HDFS file handle, 'opening' the target file. - * - * Return: Success: Pointer to HDFS container/handle of opened file. - * Failure: NULL - * - * Programmer: Gerd Herber - * May 2018 - * - * Changes: None. - *-------------------------------------------------------------------------- - */ -static hdfs_t * -H5FD_hdfs_handle_open( - const char *path, - const char *namenode_name, - const int32_t namenode_port, - const char *user_name, - const char *kerberos_ticket_cache, - const int32_t stream_buffer_size) -{ - struct hdfsBuilder *builder = NULL; - hdfs_t *handle = NULL; - hdfs_t *ret_value = NULL; - - FUNC_ENTER_NOAPI_NOINIT - -#if HDFS_DEBUG - HDfprintf(stdout, "called H5FD_hdfs_handle_open.\n"); -#endif - - if (path == NULL || path[0] == '\0') { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "path cannot be null.\n") - } - if (namenode_name == NULL /* || namenode_name[0] == '\0' */ ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "namenode name cannot be null.\n") - } - if (namenode_port < 0 || namenode_port > 65535) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "namenode port must be non-negative and <= 65535.\n") - } - if (stream_buffer_size < 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "buffer size must non-negative.\n") - } - - handle = (hdfs_t *)H5MM_malloc(sizeof(hdfs_t)); - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, - "could not malloc space for handle.\n") - } - - handle->magic = (unsigned long)HDFS_HDFST_MAGIC; - handle->filesystem = NULL; /* TODO: not a pointer; NULL may cause bug */ - handle->fileinfo = NULL; - handle->file = NULL; /* TODO: not a pointer; NULL may cause bug */ - - builder = hdfsNewBuilder(); - if (!builder) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "(hdfs) failed to create builder") - } - hdfsBuilderSetNameNode(builder, namenode_name); - hdfsBuilderSetNameNodePort(builder, (tPort)namenode_port); - if (user_name != NULL && user_name[0] != '\0') { - hdfsBuilderSetUserName(builder, user_name); - } - if (kerberos_ticket_cache != NULL && kerberos_ticket_cache[0] != '\0') { - hdfsBuilderSetKerbTicketCachePath(builder, kerberos_ticket_cache); - } - /* Call to `hdfsBuilderConnect` releases builder, regardless of success. */ - handle->filesystem = hdfsBuilderConnect(builder); - if (!handle->filesystem) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "(hdfs) could not connect to default namenode") - } - handle->fileinfo = hdfsGetPathInfo(handle->filesystem, path); - if (!handle->fileinfo) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "hdfsGetPathInfo failed") - } - handle->file = hdfsOpenFile( - handle->filesystem, - path, - O_RDONLY, - stream_buffer_size, - 0, - 0); - if (!handle->file) { - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, - "(hdfs) could not open") - } - - ret_value = handle; - -done: - if (ret_value == NULL && handle != NULL) { - /* error; clean up */ - HDassert(handle->magic == HDFS_HDFST_MAGIC); - handle->magic++; - if (handle->file != NULL) { - if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, - "unable to close hdfs file handle") - } - } - if (handle->fileinfo != NULL) { - hdfsFreeFileInfo(handle->fileinfo, 1); - } - if (handle->filesystem != NULL) { - if (FAIL == (hdfsDisconnect(handle->filesystem))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, - "unable to disconnect from hdfs") - } - } - H5MM_xfree(handle); - } - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_hdfs_handle_open() */ - - -/*-------------------------------------------------------------------------- - * Function: H5FD_hdfs_handle_close - * - * Purpose: 'Close' an HDFS file container/handle, releasing underlying - * resources. - * - * Return: Success: `SUCCEED` (0) - * Failure: `FAIL` (-1) - * - * Programmer: Gerd Herber - * May 2018 - * - * Changes: None. - *-------------------------------------------------------------------------- - */ -static herr_t -H5FD_hdfs_handle_close(hdfs_t *handle) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - -#if HDFS_DEBUG - HDfprintf(stdout, "called H5FD_hdfs_close.\n"); -#endif - - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle cannot be null.\n") - } - if (handle->magic != HDFS_HDFST_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has invalid magic.\n") - } - - handle->magic++; - if (handle->file != NULL) { - if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "unable to close hdfs file handle") - } - } - if (handle->fileinfo != NULL) { - hdfsFreeFileInfo(handle->fileinfo, 1); - } - if (handle->filesystem != NULL) { - if (FAIL == (hdfsDisconnect(handle->filesystem))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "unable to disconnect hdfs file system") - } - } - - H5MM_xfree(handle); - -done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_hdfs_close() */ - -#endif /* H5_HAVE_LIBHDFS */ - /*************************************************************************** * @@ -432,17 +238,13 @@ done: * * Programmer: Jacob Smith * - * Changes: None. - * *************************************************************************** */ typedef struct H5FD_hdfs_t { H5FD_t pub; H5FD_hdfs_fapl_t fa; haddr_t eoa; -#ifdef H5_HAVE_LIBHDFS hdfs_t *hdfs_handle; -#endif #if HDFS_STATS hdfs_statsbin meta[HDFS_STATS_BIN_COUNT + 1]; hdfs_statsbin raw[HDFS_STATS_BIN_COUNT + 1]; @@ -459,75 +261,72 @@ typedef struct H5FD_hdfs_t { * Only included if HDFS code should compile. * */ -#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#ifdef H5_HAVE_LIBHDFS +#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) #define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) -#endif /* H5_HAVE_LIBHDFS */ /* Prototypes */ -static herr_t H5FD_hdfs_term(void); -static void *H5FD_hdfs_fapl_get(H5FD_t *_file); -static void *H5FD_hdfs_fapl_copy(const void *_old_fa); -static herr_t H5FD_hdfs_fapl_free(void *_fa); -static H5FD_t *H5FD_hdfs_open(const char *name, unsigned flags, hid_t fapl_id, +static herr_t H5FD__hdfs_term(void); +static void *H5FD__hdfs_fapl_get(H5FD_t *_file); +static void *H5FD__hdfs_fapl_copy(const void *_old_fa); +static herr_t H5FD__hdfs_fapl_free(void *_fa); +static H5FD_t *H5FD__hdfs_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_hdfs_close(H5FD_t *_file); -static int H5FD_hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_hdfs_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_hdfs_get_handle(H5FD_t *_file, hid_t fapl, +static herr_t H5FD__hdfs_close(H5FD_t *_file); +static int H5FD__hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__hdfs_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__hdfs_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_hdfs_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD__hdfs_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_hdfs_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD__hdfs_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_hdfs_truncate(H5FD_t *_file, hid_t dxpl_id, +static herr_t H5FD__hdfs_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_hdfs_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_hdfs_unlock(H5FD_t *_file); -static herr_t H5FD_hdfs_validate_config(const H5FD_hdfs_fapl_t * fa); +static herr_t H5FD__hdfs_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__hdfs_unlock(H5FD_t *_file); + +static herr_t H5FD__hdfs_validate_config(const H5FD_hdfs_fapl_t * fa); static const H5FD_class_t H5FD_hdfs_g = { "hdfs", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_hdfs_term, /* terminate */ + H5FD__hdfs_term, /* terminate */ NULL, /* sb_size */ NULL, /* sb_encode */ NULL, /* sb_decode */ sizeof(H5FD_hdfs_fapl_t), /* fapl_size */ - H5FD_hdfs_fapl_get, /* fapl_get */ - H5FD_hdfs_fapl_copy, /* fapl_copy */ - H5FD_hdfs_fapl_free, /* fapl_free */ + H5FD__hdfs_fapl_get, /* fapl_get */ + H5FD__hdfs_fapl_copy, /* fapl_copy */ + H5FD__hdfs_fapl_free, /* fapl_free */ 0, /* dxpl_size */ NULL, /* dxpl_copy */ NULL, /* dxpl_free */ - H5FD_hdfs_open, /* open */ - H5FD_hdfs_close, /* close */ - H5FD_hdfs_cmp, /* cmp */ - H5FD_hdfs_query, /* query */ + H5FD__hdfs_open, /* open */ + H5FD__hdfs_close, /* close */ + H5FD__hdfs_cmp, /* cmp */ + H5FD__hdfs_query, /* query */ NULL, /* get_type_map */ NULL, /* alloc */ NULL, /* free */ - H5FD_hdfs_get_eoa, /* get_eoa */ - H5FD_hdfs_set_eoa, /* set_eoa */ - H5FD_hdfs_get_eof, /* get_eof */ - H5FD_hdfs_get_handle, /* get_handle */ - H5FD_hdfs_read, /* read */ - H5FD_hdfs_write, /* write */ + H5FD__hdfs_get_eoa, /* get_eoa */ + H5FD__hdfs_set_eoa, /* set_eoa */ + H5FD__hdfs_get_eof, /* get_eof */ + H5FD__hdfs_get_handle, /* get_handle */ + H5FD__hdfs_read, /* read */ + H5FD__hdfs_write, /* write */ NULL, /* flush */ - H5FD_hdfs_truncate, /* truncate */ - H5FD_hdfs_lock, /* lock */ - H5FD_hdfs_unlock, /* unlock */ + H5FD__hdfs_truncate, /* truncate */ + H5FD__hdfs_lock, /* lock */ + H5FD__hdfs_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; -#ifdef H5_HAVE_LIBHDFS /* Declare a free list to manage the H5FD_hdfs_t struct */ H5FL_DEFINE_STATIC(H5FD_hdfs_t); -#endif /* H5_HAVE_LIBHDFS */ /*------------------------------------------------------------------------- @@ -537,9 +336,6 @@ H5FL_DEFINE_STATIC(H5FD_hdfs_t); * * Return: Non-negative on success/Negative on failure * - * Changes: Rename as appropriate for hdfs vfd. - * Jacob Smith 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -549,14 +345,11 @@ H5FD__init_package(void) FUNC_ENTER_STATIC - if (H5FD_hdfs_init() < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, - "unable to initialize hdfs VFD") - } + if(H5FD_hdfs_init() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize hdfs VFD") done: FUNC_LEAVE_NOAPI(ret_value) - } /* H5FD__init_package() */ @@ -584,11 +377,11 @@ H5FD_hdfs_init(void) FUNC_ENTER_NOAPI(FAIL) #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_init() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif if(H5I_VFL != H5I_get_type(H5FD_HDFS_g)) - H5FD_HDFS_g = H5FD_register( &H5FD_hdfs_g, sizeof(H5FD_class_t), FALSE); + H5FD_HDFS_g = H5FD_register(&H5FD_hdfs_g, sizeof(H5FD_class_t), FALSE); #if HDFS_STATS /* pre-compute statsbin boundaries @@ -609,7 +402,7 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_hdfs_term + * Function: H5FD__hdfs_term * * Purpose: Shut down the VFD * @@ -618,82 +411,162 @@ done: * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * - * Changes: Rename as appropriate for hdfs vfd. - * Jacob Smith 2018 - * *--------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_term(void) +H5FD__hdfs_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_term() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* Reset VFL ID */ H5FD_HDFS_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_hdfs_term() */ +} /* end H5FD__hdfs_term() */ -/*------------------------------------------------------------------------- - * Function: H5Pset_fapl_hdfs - * - * Purpose: Modify the file access property list to use the H5FD_HDFS - * driver defined in this source file. All driver specfic - * properties are passed in as a pointer to a suitably - * initialized instance of H5FD_hdfs_fapl_t +/*-------------------------------------------------------------------------- + * Function: H5FD__hdfs_handle_open * - * Return: SUCCEED/FAIL + * Purpose: Create a HDFS file handle, 'opening' the target file. * - * Programmer: John Mainzer - * 9/10/17 + * Return: Success: Pointer to HDFS container/handle of opened file. + * Failure: NULL * - * Changes: Rename as appropriate for hdfs vfd. - * Jacob Smith 2018 + * Programmer: Gerd Herber + * May 2018 * - *------------------------------------------------------------------------- + *-------------------------------------------------------------------------- */ -herr_t -H5Pset_fapl_hdfs(hid_t fapl_id, - H5FD_hdfs_fapl_t *fa) +static hdfs_t * +H5FD__hdfs_handle_open(const char *path, const char *namenode_name, + const int32_t namenode_port, const char *user_name, + const char *kerberos_ticket_cache, const int32_t stream_buffer_size) { - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = FAIL; - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*x", fapl_id, fa); + struct hdfsBuilder *builder = NULL; + hdfs_t *handle = NULL; + hdfs_t *ret_value = NULL; - HDassert(fa != NULL); + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5Pset_fapl_hdfs() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (plist == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, \ - "not a file access property list") - } + if(path == NULL || path[0] == '\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "path cannot be null") + if(namenode_name == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "namenode name cannot be null") + if(namenode_port < 0 || namenode_port > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "namenode port must be non-negative and <= 65535") + if(stream_buffer_size < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "buffer size must non-negative") - if (FAIL == H5FD_hdfs_validate_config(fa)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "invalid hdfs config") - } + handle = (hdfs_t *)H5MM_malloc(sizeof(hdfs_t)); + if(handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "could not malloc space for handle") - ret_value = H5P_set_driver(plist, H5FD_HDFS, (void *)fa); + handle->magic = (unsigned long)HDFS_HDFST_MAGIC; + handle->filesystem = NULL; /* TODO: not a pointer; NULL may cause bug */ + handle->fileinfo = NULL; + handle->file = NULL; /* TODO: not a pointer; NULL may cause bug */ + + builder = hdfsNewBuilder(); + if(!builder) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "(hdfs) failed to create builder") + hdfsBuilderSetNameNode(builder, namenode_name); + hdfsBuilderSetNameNodePort(builder, (tPort)namenode_port); + if(user_name != NULL && user_name[0] != '\0') + hdfsBuilderSetUserName(builder, user_name); + if(kerberos_ticket_cache != NULL && kerberos_ticket_cache[0] != '\0') + hdfsBuilderSetKerbTicketCachePath(builder, kerberos_ticket_cache); + + /* Call to `hdfsBuilderConnect` releases builder, regardless of success. */ + handle->filesystem = hdfsBuilderConnect(builder); + if(!handle->filesystem) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "(hdfs) could not connect to default namenode") + handle->fileinfo = hdfsGetPathInfo(handle->filesystem, path); + if(!handle->fileinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "hdfsGetPathInfo failed") + handle->file = hdfsOpenFile(handle->filesystem, path, O_RDONLY, stream_buffer_size, 0, 0); + if(!handle->file) + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "(hdfs) could not open") + + ret_value = handle; done: - FUNC_LEAVE_API(ret_value) + if(ret_value == NULL && handle != NULL) { + /* error; clean up */ + HDassert(handle->magic == HDFS_HDFST_MAGIC); + handle->magic++; + if(handle->file != NULL) + if(FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close hdfs file handle") + if(handle->fileinfo != NULL) + hdfsFreeFileInfo(handle->fileinfo, 1); + if(handle->filesystem != NULL) + if(FAIL == (hdfsDisconnect(handle->filesystem))) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to disconnect from hdfs") + H5MM_xfree(handle); + } -} /* H5Pset_fapl_hdfs() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__hdfs_handle_open() */ + + +/*-------------------------------------------------------------------------- + * Function: H5FD__hdfs_handle_close + * + * Purpose: 'Close' an HDFS file container/handle, releasing underlying + * resources. + * + * Return: Success: `SUCCEED` (0) + * Failure: `FAIL` (-1) + * + * Programmer: Gerd Herber + * May 2018 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5FD__hdfs_handle_close(hdfs_t *handle) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + +#if HDFS_DEBUG + HDfprintf(stdout, "called %s.\n", FUNC); +#endif + + if(handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null") + if(handle->magic != HDFS_HDFST_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic") + + handle->magic++; + if(handle->file != NULL) + if(FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close hdfs file handle") + if(handle->fileinfo != NULL) + hdfsFreeFileInfo(handle->fileinfo, 1); + if(handle->filesystem != NULL) + if(FAIL == (hdfsDisconnect(handle->filesystem))) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to disconnect hdfs file system") + + H5MM_xfree(handle); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__hdfs_handle_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_validate_config() + * Function: H5FD__hdfs_validate_config() * * Purpose: Test to see if the supplied instance of H5FD_hdfs_fapl_t * contains internally consistant data. Return SUCCEED if so, @@ -710,37 +583,70 @@ done: * Programmer: Jacob Smith * 9/10/17 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_validate_config(const H5FD_hdfs_fapl_t * fa) +H5FD__hdfs_validate_config(const H5FD_hdfs_fapl_t * fa) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(fa != NULL); - if ( fa->version != H5FD__CURR_HDFS_FAPL_T_VERSION ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Unknown H5FD_hdfs_fapl_t version"); - } - - if ( fa->namenode_port > 65535 ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Invalid namenode port number"); - } - if ( fa->namenode_port < 0 ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Invalid namenode port number"); - } + if(fa->version != H5FD__CURR_HDFS_FAPL_T_VERSION) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown H5FD_hdfs_fapl_t version"); + if(fa->namenode_port > 65535) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid namenode port number"); + if(fa->namenode_port < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid namenode port number"); done: FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__hdfs_validate_config() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_fapl_hdfs + * + * Purpose: Modify the file access property list to use the H5FD_HDFS + * driver defined in this source file. All driver specfic + * properties are passed in as a pointer to a suitably + * initialized instance of H5FD_hdfs_fapl_t + * + * Return: SUCCEED/FAIL + * + * Programmer: John Mainzer + * 9/10/17 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = FAIL; -} /* H5FD_hdfs_validate_config() */ + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*x", fapl_id, fa); + + HDassert(fa != NULL); + +#if HDFS_DEBUG + HDfprintf(stdout, "called %s.\n", FUNC); +#endif + + plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); + if(plist == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if(FAIL == H5FD__hdfs_validate_config(fa)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid hdfs config") + + ret_value = H5P_set_driver(plist, H5FD_HDFS, (void *)fa); + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pset_fapl_hdfs() */ /*------------------------------------------------------------------------- @@ -756,13 +662,10 @@ done: * Programmer: John Mainzer * 9/10/17 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5Pget_fapl_hdfs(hid_t fapl_id, - H5FD_hdfs_fapl_t *fa_out) +H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out) { const H5FD_hdfs_fapl_t *fa = NULL; H5P_genplist_t *plist = NULL; @@ -772,40 +675,31 @@ H5Pget_fapl_hdfs(hid_t fapl_id, H5TRACE2("e", "i*x", fapl_id, fa_out); #if HDFS_DEBUG - HDfprintf(stdout, "H5Pget_fapl_hdfs() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - if (fa_out == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "fa_out is NULL") - } + if(fa_out == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL") plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (plist == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access list") - } - if (H5FD_HDFS != H5P_peek_driver(plist)) { - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, - "incorrect VFL driver") - } + if(plist == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + if(H5FD_HDFS != H5P_peek_driver(plist)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") fa = (const H5FD_hdfs_fapl_t *)H5P_peek_driver_info(plist); - if (fa == NULL) { - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, - "bad VFL driver info") - } + if(fa == NULL) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") /* Copy the hdfs fapl data out */ HDmemcpy(fa_out, fa, sizeof(H5FD_hdfs_fapl_t)); done: FUNC_LEAVE_API(ret_value) - } /* H5Pget_fapl_hdfs() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_fapl_get + * Function: H5FD__hdfs_fapl_get * * Purpose: Gets a file access property list which could be used to * create an identical file. @@ -817,24 +711,20 @@ done: * Programmer: John Mainzer * 9/8/17 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_hdfs_fapl_get(H5FD_t *_file) +H5FD__hdfs_fapl_get(H5FD_t *_file) { H5FD_hdfs_t *file = (H5FD_hdfs_t*)_file; H5FD_hdfs_fapl_t *fa = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC fa = (H5FD_hdfs_fapl_t *)H5MM_calloc(sizeof(H5FD_hdfs_fapl_t)); - if (fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed") - } + if(fa == NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed") /* Copy the fields of the structure */ HDmemcpy(fa, &(file->fa), sizeof(H5FD_hdfs_fapl_t)); @@ -842,17 +732,15 @@ H5FD_hdfs_fapl_get(H5FD_t *_file) ret_value = fa; done: - if (ret_value == NULL && fa != NULL) { + if(ret_value == NULL && fa != NULL) H5MM_xfree(fa); /* clean up on error */ - } FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_hdfs_fapl_get() */ +} /* H5FD__hdfs_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_fapl_copy + * Function: H5FD__hdfs_fapl_copy * * Purpose: Copies the hdfs-specific file access properties. * @@ -863,40 +751,34 @@ done: * Programmer: John Mainzer * 9/8/17 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_hdfs_fapl_copy(const void *_old_fa) +H5FD__hdfs_fapl_copy(const void *_old_fa) { const H5FD_hdfs_fapl_t *old_fa = (const H5FD_hdfs_fapl_t*)_old_fa; H5FD_hdfs_fapl_t *new_fa = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC new_fa = (H5FD_hdfs_fapl_t *)H5MM_malloc(sizeof(H5FD_hdfs_fapl_t)); - if (new_fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed") - } + if(new_fa == NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed") HDmemcpy(new_fa, old_fa, sizeof(H5FD_hdfs_fapl_t)); ret_value = new_fa; done: - if (ret_value == NULL && new_fa != NULL) { + if(ret_value == NULL && new_fa != NULL) H5MM_xfree(new_fa); /* clean up on error */ - } FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_hdfs_fapl_copy() */ +} /* H5FD__hdfs_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_fapl_free + * Function: H5FD__hdfs_fapl_free * * Purpose: Frees the hdfs-specific file access properties. * @@ -905,30 +787,27 @@ done: * Programmer: John Mainzer * 9/8/17 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_fapl_free(void *_fa) +H5FD__hdfs_fapl_free(void *_fa) { H5FD_hdfs_fapl_t *fa = (H5FD_hdfs_fapl_t*)_fa; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(fa != NULL); /* sanity check */ H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5FD__hdfs_fapl_free() */ -} /* H5FD_hdfs_fapl_free() */ #if HDFS_STATS - /*---------------------------------------------------------------------------- * - * Function: hdfs_reset_stats() + * Function: hdfs__reset_stats() * * Purpose: * @@ -945,28 +824,24 @@ H5FD_hdfs_fapl_free(void *_fa) * Programmer: Jacob Smith * 2017-12-08 * - * Changes: None. - * *---------------------------------------------------------------------------- */ static herr_t -hdfs_reset_stats(H5FD_hdfs_t *file) +hdfs__reset_stats(H5FD_hdfs_t *file) { unsigned i = 0; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDprintf("hdfs_reset_stats() called\n"); + HDprintf("hdfs__reset_stats() called\n"); #endif - if (file == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file was null") - } + if(file == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null") - for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { + for(i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { file->raw[i].bytes = 0; file->raw[i].count = 0; file->raw[i].min = (unsigned long long)HDFS_STATS_STARTING_MIN; @@ -981,13 +856,13 @@ hdfs_reset_stats(H5FD_hdfs_t *file) done: FUNC_LEAVE_NOAPI(ret_value); -} /* hdfs_reset_stats */ +} /* hdfs__reset_stats */ #endif /* HDFS_STATS */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_open() + * Function: H5FD__hdfs_open() * * Purpose: * @@ -1006,137 +881,78 @@ done: * Programmer: Jacob Smith * 2017-11-02 * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS static H5FD_t * -H5FD_hdfs_open( - const char *path, - unsigned flags, - hid_t fapl_id, - haddr_t maxaddr) +H5FD__hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_t *ret_value = NULL; H5FD_hdfs_t *file = NULL; hdfs_t *handle = NULL; H5FD_hdfs_fapl_t fa; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_open() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* HDFS_DEBUG */ /* Sanity check on file offsets */ HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t)); /* Check arguments */ - if (!path || !*path) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "invalid file name") - } - if (0 == maxaddr || HADDR_UNDEF == maxaddr) { - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, - "bogus maxaddr") - } - if (ADDR_OVERFLOW(maxaddr)) { - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, - "bogus maxaddr") - } - if (flags != H5F_ACC_RDONLY) { - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, - "only Read-Only access allowed") - } - if (fapl_id == H5P_DEFAULT || fapl_id == H5P_FILE_ACCESS_DEFAULT) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "fapl cannot be H5P_DEFAULT") - } - if (FAIL == H5Pget_fapl_hdfs(fapl_id, &fa)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "can't get property list") - } - - handle = H5FD_hdfs_handle_open( - path, - fa.namenode_name, - fa.namenode_port, - fa.user_name, - fa.kerberos_ticket_cache, - fa.stream_buffer_size); - - if (handle == NULL) { - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, - "could not open") - } + if(!path || !*path) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") + if(0 == maxaddr || HADDR_UNDEF == maxaddr) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") + if(ADDR_OVERFLOW(maxaddr)) + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") + if(flags != H5F_ACC_RDONLY) + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, "only Read-Only access allowed") + if(fapl_id == H5P_DEFAULT || fapl_id == H5P_FILE_ACCESS_DEFAULT) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "fapl cannot be H5P_DEFAULT") + if(FAIL == H5Pget_fapl_hdfs(fapl_id, &fa)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't get property list") + + handle = H5FD__hdfs_handle_open(path, fa.namenode_name, fa.namenode_port, + fa.user_name, fa.kerberos_ticket_cache, fa.stream_buffer_size); + if(handle == NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "could not open") HDassert(handle->magic == HDFS_HDFST_MAGIC); - /* create new file struct - */ + /* Create new file struct */ file = H5FL_CALLOC(H5FD_hdfs_t); - if (file == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "unable to allocate file struct") - } + if(file == NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct") file->hdfs_handle = handle; HDmemcpy(&(file->fa), &fa, sizeof(H5FD_hdfs_fapl_t)); #if HDFS_STATS - if (FAIL == hdfs_reset_stats(file)) { - HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, - "unable to reset file statistics") - } + if(FAIL == hdfs__reset_stats(file)) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics") #endif /* HDFS_STATS */ ret_value = (H5FD_t*)file; done: - if (ret_value == NULL) { - if (handle != NULL) { - if (FAIL == H5FD_hdfs_handle_close(handle)) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, - "unable to close HDFS file handle") - } - } - if (file != NULL) { + if(ret_value == NULL) { + if(handle != NULL) + if(FAIL == H5FD__hdfs_handle_close(handle)) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close HDFS file handle") + if(file != NULL) file = H5FL_FREE(H5FD_hdfs_t, file); - } } /* end if null return value (error) */ FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__hdfs_open() */ -} /* H5FD_hdfs_open() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static H5FD_t * -H5FD_hdfs_open( - const char H5_ATTR_UNUSED *path, - unsigned H5_ATTR_UNUSED flags, - hid_t H5_ATTR_UNUSED fapl_id, - haddr_t H5_ATTR_UNUSED maxaddr) -{ - H5FD_t *ret_value = NULL; - - FUNC_ENTER_NOAPI_NOINIT - - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, - "Illegal open of unsupported virtual file (hdfs)"); - -done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_hdfs_open() */ - -#endif /* H5_HAVE_LIBHDFS */ #if HDFS_STATS /*---------------------------------------------------------------------------- * - * Function: hdfs_fprint_stats() + * Function: hdfs__fprint_stats() * * Purpose: * @@ -1186,14 +1002,10 @@ done: * * Programmer: Jacob Smith * - * Changes: None. - * *---------------------------------------------------------------------------- */ static herr_t -hdfs_fprint_stats( - FILE *stream, - const H5FD_hdfs_t *file) +hdfs__fprint_stats(FILE *stream, const H5FD_hdfs_t *file) { herr_t ret_value = SUCCEED; parsed_url_t *purl = NULL; @@ -1212,49 +1024,43 @@ hdfs_fprint_stats( unsigned suffix_i = 0; const char suffixes[] = { ' ', 'K', 'M', 'G', 'T', 'P' }; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - if (stream == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file stream cannot be null" ) - } - if (file == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file cannot be null") - } - if (file->hdfs_handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "hdfs handle cannot be null") - } - if (file->hdfs_handle->magic != HDFS_HDFST_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "hdfs handle has invalid magic") - } + if(stream == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null") + if(file == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null") + if(file->hdfs_handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hdfs handle cannot be null") + if(file->hdfs_handle->magic != HDFS_HDFST_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hdfs handle has invalid magic") /******************* * AGGREGATE STATS * *******************/ - for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { + for(i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { const hdfs_statsbin *r = &file->raw[i]; const hdfs_statsbin *m = &file->meta[i]; - if (m->min < min_meta) { min_meta = m->min; } - if (r->min < min_raw) { min_raw = r->min; } - if (m->max > max_meta) { max_meta = m->max; } - if (r->max > max_raw) { max_raw = r->max; } + if(m->min < min_meta) + min_meta = m->min; + if(r->min < min_raw) + min_raw = r->min; + if(m->max > max_meta) + max_meta = m->max; + if(r->max > max_raw) + max_raw = r->max; count_raw += r->count; count_meta += m->count; bytes_raw += r->bytes; bytes_meta += m->bytes; } - if (count_raw > 0) { + if(count_raw > 0) average_raw = (double)bytes_raw / (double)count_raw; - } - if (count_meta > 0) { + if(count_meta > 0) average_meta = (double)bytes_meta / (double)count_meta; - } /****************** * PRINT OVERVIEW * @@ -1265,9 +1071,8 @@ hdfs_fprint_stats( HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, bytes_raw); - if (count_raw + count_meta == 0) { + if(count_raw + count_meta == 0) goto done; - } /************************* * PRINT AGGREGATE STATS * @@ -1275,55 +1080,49 @@ hdfs_fprint_stats( HDfprintf(stream, "SIZES meta raw\n"); HDfprintf(stream, " min "); - if (count_meta == 0) { + if(count_meta == 0) HDfprintf(stream, " 0.000 "); - } else { + else { re_dub = (double)min_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); } - if (count_raw == 0) { + if(count_raw == 0) HDfprintf(stream, " 0.000 \n"); - } else { + else { re_dub = (double)min_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); } HDfprintf(stream, " avg "); re_dub = (double)average_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); re_dub = (double)average_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); HDfprintf(stream, " max "); re_dub = (double)max_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); re_dub = (double)max_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); @@ -1336,7 +1135,7 @@ hdfs_fprint_stats( HDfprintf(stream, " up-to meta raw meta raw meta raw\n"); - for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { + for(i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { const hdfs_statsbin *m; const hdfs_statsbin *r; unsigned long long range_end = 0; @@ -1351,55 +1150,47 @@ hdfs_fprint_stats( m = &file->meta[i]; r = &file->raw[i]; - if (r->count == 0 && m->count == 0) { + if(r->count == 0 && m->count == 0) continue; - } range_end = hdfs_stats_boundaries[i]; - if (i == HDFS_STATS_BIN_COUNT) { + if(i == HDFS_STATS_BIN_COUNT) { range_end = hdfs_stats_boundaries[i-1]; HDfprintf(stream, ">"); - } else { - HDfprintf(stream, " "); } + else + HDfprintf(stream, " "); bm_val = (double)m->bytes; - for (suffix_i = 0; bm_val >= 1024.0; suffix_i++) { + for(suffix_i = 0; bm_val >= 1024.0; suffix_i++) bm_val /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); bm_suffix = suffixes[suffix_i]; br_val = (double)r->bytes; - for (suffix_i = 0; br_val >= 1024.0; suffix_i++) { + for(suffix_i = 0; br_val >= 1024.0; suffix_i++) br_val /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); br_suffix = suffixes[suffix_i]; - if (m->count > 0) { + if(m->count > 0) am_val = (double)(m->bytes) / (double)(m->count); - } - for (suffix_i = 0; am_val >= 1024.0; suffix_i++) { + for(suffix_i = 0; am_val >= 1024.0; suffix_i++) am_val /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); am_suffix = suffixes[suffix_i]; - if (r->count > 0) { + if(r->count > 0) ar_val = (double)(r->bytes) / (double)(r->count); - } - for (suffix_i = 0; ar_val >= 1024.0; suffix_i++) { + for(suffix_i = 0; ar_val >= 1024.0; suffix_i++) ar_val /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); ar_suffix = suffixes[suffix_i]; re_dub = (double)range_end; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - } HDassert(suffix_i < sizeof(suffixes)); HDfprintf( @@ -1412,18 +1203,18 @@ hdfs_fprint_stats( br_val, br_suffix, /* rawdata bytes */ am_val, am_suffix, /* metadata average */ ar_val, ar_suffix); /* rawdata average */ - fflush(stream); + HDfflush(stream); } done: FUNC_LEAVE_NOAPI(ret_value); -} /* hdfs_fprint_stats */ +} /* hdfs__fprint_stats */ #endif /* HDFS_STATS */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_close() + * Function: H5FD__hdfs_close() * * Purpose: * @@ -1436,77 +1227,47 @@ done: * Programmer: Jacob Smith * 2017-11-02 * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static herr_t -H5FD_hdfs_close(H5FD_t *_file) +H5FD__hdfs_close(H5FD_t *_file) { herr_t ret_value = SUCCEED; H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_close() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - /* Sanity checks - */ + /* Sanity checks */ HDassert(file != NULL); HDassert(file->hdfs_handle != NULL); HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); - /* Close the underlying request handle - */ - if (file->hdfs_handle != NULL) { - if (FAIL == H5FD_hdfs_handle_close(file->hdfs_handle)) { - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "unable to close HDFS file handle") - } - } + /* Close the underlying request handle */ + if(file->hdfs_handle != NULL) + if(FAIL == H5FD__hdfs_handle_close(file->hdfs_handle)) + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close HDFS file handle") #if HDFS_STATS /* TODO: mechanism to re-target stats printout */ - if (FAIL == hdfs_fprint_stats(stdout, file)) { - HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, - "problem while writing file statistics") - } + if(FAIL == hdfs__fprint_stats(stdout, file)) + HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics") #endif /* HDFS_STATS */ - /* Release the file info - */ + /* Release the file info */ file = H5FL_FREE(H5FD_hdfs_t, file); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_close() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static herr_t -H5FD_hdfs_close(H5FD_t H5_ATTR_UNUSED *_file) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "Illegal close of unsupported Virtual File (hdfs)") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_close() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* end H5FD__hdfs_close() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_cmp() + * Function: H5FD__hdfs_cmp() * * Purpose: * @@ -1520,19 +1281,10 @@ done: * Programmer: Gerd Herber * May 2018 * - * Changes: - * - * + Replace `if (ret_value == 0)` chain with `HGOTO_DONE` jumps. - * Jacob Smith 17 May 2018 - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static int -H5FD_hdfs_cmp( - const H5FD_t *_f1, - const H5FD_t *_f2) +H5FD__hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { int ret_value = 0; const H5FD_hdfs_t *f1 = (const H5FD_hdfs_t *)_f1; @@ -1540,10 +1292,10 @@ H5FD_hdfs_cmp( hdfsFileInfo *finfo1 = NULL; hdfsFileInfo *finfo2 = NULL; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_cmp() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* HDFS_DEBUG */ HDassert(f1->hdfs_handle != NULL); @@ -1556,40 +1308,24 @@ H5FD_hdfs_cmp( HDassert(finfo1 != NULL); HDassert(finfo2 != NULL); - if (finfo1->mKind != finfo2->mKind) { HGOTO_DONE(-1); } - if (finfo1->mName != finfo2->mName) { HGOTO_DONE(-1); } - if (finfo1->mLastMod != finfo2->mLastMod) { HGOTO_DONE(-1); } - if (finfo1->mSize != finfo2->mSize) { HGOTO_DONE(-1); } - if (finfo1->mReplication != finfo2->mReplication) { HGOTO_DONE(-1); } - if (finfo1->mBlockSize != finfo2->mBlockSize) { HGOTO_DONE(-1); } - if (strcmp(finfo1->mOwner, finfo2->mOwner)) { HGOTO_DONE(-1); } - if (strcmp(finfo1->mGroup, finfo2->mGroup)) { HGOTO_DONE(-1); } - if (finfo1->mPermissions != finfo2->mPermissions) { HGOTO_DONE(-1); } - if (finfo1->mLastAccess != finfo2->mLastAccess) { HGOTO_DONE(-1); } + if(finfo1->mKind != finfo2->mKind) { HGOTO_DONE(-1); } + if(finfo1->mName != finfo2->mName) { HGOTO_DONE(-1); } + if(finfo1->mLastMod != finfo2->mLastMod) { HGOTO_DONE(-1); } + if(finfo1->mSize != finfo2->mSize) { HGOTO_DONE(-1); } + if(finfo1->mReplication != finfo2->mReplication) { HGOTO_DONE(-1); } + if(finfo1->mBlockSize != finfo2->mBlockSize) { HGOTO_DONE(-1); } + if(HDstrcmp(finfo1->mOwner, finfo2->mOwner)) { HGOTO_DONE(-1); } + if(HDstrcmp(finfo1->mGroup, finfo2->mGroup)) { HGOTO_DONE(-1); } + if(finfo1->mPermissions != finfo2->mPermissions) { HGOTO_DONE(-1); } + if(finfo1->mLastAccess != finfo2->mLastAccess) { HGOTO_DONE(-1); } done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_hdfs_cmp() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static int -H5FD_hdfs_cmp( - const H5FD_t H5_ATTR_UNUSED *_f1, - const H5FD_t H5_ATTR_UNUSED *_f2) -{ - int ret_value = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_hdfs_cmp() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* H5FD__hdfs_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_hdfs_query + * Function: H5FD__hdfs_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -1608,28 +1344,26 @@ H5FD_hdfs_cmp( *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_query( - const H5FD_t H5_ATTR_UNUSED *_file, - unsigned long *flags) /* out variable */ +H5FD__hdfs_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_query() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - if (flags) { + if(flags) { *flags = 0; *flags |= H5FD_FEAT_DATA_SIEVE; } FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FD_hdfs_query() */ +} /* H5FD__hdfs_query() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_get_eoa() + * Function: H5FD__hdfs_get_eoa() * * Purpose: * @@ -1644,50 +1378,26 @@ H5FD_hdfs_query( * Programmer: Jacob Smith * 2017-11-02 * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static haddr_t -H5FD_hdfs_get_eoa( - const H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_hdfs_t *file = (const H5FD_hdfs_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_eoa() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif FUNC_LEAVE_NOAPI(file->eoa) -} /* end H5FD_hdfs_get_eoa() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static haddr_t -H5FD_hdfs_get_eoa( - const H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_eoa() called.\n"); -#endif - - FUNC_LEAVE_NOAPI(0) -} /* end H5FD_hdfs_get_eoa() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* end H5FD__hdfs_get_eoa() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_set_eoa() + * Function: H5FD__hdfs_set_eoa() * * Purpose: * @@ -1700,54 +1410,28 @@ H5FD_hdfs_get_eoa( * Programmer: Jacob Smith * 2017-11-03 * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static herr_t -H5FD_hdfs_set_eoa( - H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - haddr_t addr) +H5FD__hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_set_eoa() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif file->eoa = addr; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FD_hdfs_set_eoa() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static herr_t -H5FD_hdfs_set_eoa( - H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - haddr_t H5_ATTR_UNUSED addr) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_set_eoa() called.\n"); -#endif - - FUNC_LEAVE_NOAPI(FAIL) -} /* H5FD_hdfs_set_eoa() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* H5FD__hdfs_set_eoa() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_get_eof() + * Function: H5FD__hdfs_get_eof() * * Purpose: * @@ -1763,49 +1447,27 @@ H5FD_hdfs_set_eoa( * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static haddr_t -H5FD_hdfs_get_eof( - const H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_hdfs_t *file = (const H5FD_hdfs_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_eof() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif HDassert(file->hdfs_handle != NULL); HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); FUNC_LEAVE_NOAPI((size_t) file->hdfs_handle->fileinfo->mSize) -} /* end H5FD_hdfs_get_eof() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static haddr_t -H5FD_hdfs_get_eof( - const H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_eof() called.\n"); -#endif - - FUNC_LEAVE_NOAPI((size_t)0) -} /* end H5FD_hdfs_get_eof() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* end H5FD__hdfs_get_eof() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_get_handle() + * Function: H5FD__hdfs_get_handle() * * Purpose: * @@ -1818,67 +1480,33 @@ H5FD_hdfs_get_eof( * Programmer: Jacob Smith * 2017-11-02 * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static herr_t -H5FD_hdfs_get_handle( - H5FD_t *_file, - hid_t H5_ATTR_UNUSED fapl, - void **file_handle) +H5FD__hdfs_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle) { herr_t ret_value = SUCCEED; H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_handle() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* HDFS_DEBUG */ - if (!file_handle) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file handle not valid") - } + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") *file_handle = file->hdfs_handle; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_get_handle() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static herr_t -H5FD_hdfs_get_handle( - H5FD_t H5_ATTR_UNUSED *_file, - hid_t H5_ATTR_UNUSED fapl, - void H5_ATTR_UNUSED **file_handle) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_get_handle() called.\n"); -#endif /* HDFS_DEBUG */ - - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, - "Illegal get-handle of unsupported virtual file (hdfs)"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_get_handle() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* end H5FD__hdfs_get_handle() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_read() + * Function: H5FD__hdfs_read() * * Purpose: * @@ -1896,20 +1524,11 @@ done: * Programmer: Jacob Smith * 2017-11-?? * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_LIBHDFS - static herr_t -H5FD_hdfs_read( - H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t addr, /* start offset */ - size_t size, /* length of read */ - void *buf) /* out */ +H5FD__hdfs_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf) { herr_t ret_value = SUCCEED; H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; @@ -1920,10 +1539,10 @@ H5FD_hdfs_read( unsigned bin_i = 0; #endif /* HDFS_STATS */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_read() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif /* HDFS_DEBUG */ HDassert(file != NULL); @@ -1933,44 +1552,33 @@ H5FD_hdfs_read( filesize = (size_t) file->hdfs_handle->fileinfo->mSize; - if ((addr > filesize) || ((addr + size) > filesize)) { - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, - "range exceeds file address") - } + if((addr > filesize) || ((addr + size) > filesize)) + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "range exceeds file address") - if (FAIL == hdfsPread( - file->hdfs_handle->filesystem, - file->hdfs_handle->file, - (tOffset)addr, - buf, - (tSize)size)) - { - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, - "unable to execute read") - } + if(FAIL == hdfsPread(file->hdfs_handle->filesystem, file->hdfs_handle->file, + (tOffset)addr, buf, (tSize)size)) + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read") #if HDFS_STATS - /* Find which "bin" this read fits in. Can be "overflow" bin. - */ - for (bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) { - if ((unsigned long long)size < hdfs_stats_boundaries[bin_i]) { + /* Find which "bin" this read fits in. Can be "overflow" bin. */ + for(bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) + if((unsigned long long)size < hdfs_stats_boundaries[bin_i]) break; - } - } bin = (type == H5FD_MEM_DRAW) ? &file->raw[bin_i] : &file->meta[bin_i]; - /* Store collected stats in appropriate bin - */ - if (bin->count == 0) { + /* Store collected stats in appropriate bin */ + if(bin->count == 0) { bin->min = size; bin->max = size; } else { - if (size < bin->min) { bin->min = size; } - if (size > bin->max) { bin->max = size; } + if(size < bin->min) + bin->min = size; + if(size > bin->max) + bin->max = size; } bin->count++; bin->bytes += (unsigned long long)size; @@ -1979,40 +1587,12 @@ H5FD_hdfs_read( done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_read() */ - -#else /* H5_HAVE_LIBHDFS not defined */ - -static herr_t -H5FD_hdfs_read( - H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t H5_ATTR_UNUSED addr, - size_t H5_ATTR_UNUSED size, - void H5_ATTR_UNUSED *buf) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - -#if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_read() called.\n"); -#endif /* HDFS_DEBUG */ - - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, - "Illegal get-handle of unsupported virtual file (hdfs)"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_read() */ - -#endif /* H5_HAVE_LIBHDFS */ +} /* end H5FD__hdfs_read() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_write() + * Function: H5FD__hdfs_write() * * Purpose: * @@ -2026,38 +1606,31 @@ done: * Programmer: Jacob Smith * 2017-10-23 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_write( - H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t H5_ATTR_UNUSED addr, - size_t H5_ATTR_UNUSED size, - const void H5_ATTR_UNUSED *buf) +H5FD__hdfs_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, + const void H5_ATTR_UNUSED *buf) { herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_write() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, - "cannot write to read-only file.") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_hdfs_write() */ +} /* H5FD__hdfs_write() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_truncate() + * Function: H5FD__hdfs_truncate() * * Purpose: * @@ -2073,35 +1646,30 @@ done: * Programmer: Jacob Smith * 2017-10-23 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_truncate( - H5FD_t H5_ATTR_UNUSED *_file, - hid_t H5_ATTR_UNUSED dxpl_id, - hbool_t H5_ATTR_UNUSED closing) +H5FD__hdfs_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id, + hbool_t H5_ATTR_UNUSED closing) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "H5FD_hdfs_truncate() called.\n"); + HDfprintf(stdout, "called %s.\n", FUNC); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, - "cannot truncate read-only file.") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_hdfs_truncate() */ +} /* end H5FD__hdfs_truncate() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_lock() + * Function: H5FD__hdfs_lock() * * Purpose: * @@ -2118,23 +1686,22 @@ done: * Programmer: Jacob Smith * 2017-11-03 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_lock( +H5FD__hdfs_lock( H5FD_t H5_ATTR_UNUSED *_file, hbool_t H5_ATTR_UNUSED rw) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR + FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_hdfs_lock() */ +} /* end H5FD__hdfs_lock() */ /*------------------------------------------------------------------------- * - * Function: H5FD_hdfs_unlock() + * Function: H5FD__hdfs_unlock() * * Purpose: * @@ -2148,14 +1715,14 @@ H5FD_hdfs_lock( * Programmer: Jacob Smith * 2017-11-03 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t -H5FD_hdfs_unlock(H5FD_t H5_ATTR_UNUSED *_file) +H5FD__hdfs_unlock(H5FD_t H5_ATTR_UNUSED *_file) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR + FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_hdfs_unlock() */ +} /* end H5FD__hdfs_unlock() */ +#endif /* H5_HAVE_LIBHDFS */ diff --git a/src/H5FDhdfs.h b/src/H5FDhdfs.h index 37252f0..d67ab9e 100644 --- a/src/H5FDhdfs.h +++ b/src/H5FDhdfs.h @@ -22,8 +22,13 @@ #ifndef H5FDhdfs_H #define H5FDhdfs_H -#define H5FD_HDFS (H5FD_hdfs_init()) +#ifdef H5_HAVE_LIBHDFS +#define H5FD_HDFS (H5FD_hdfs_init()) +#else /* H5_HAVE_LIBHDFS */ +#define H5FD_HDFS (-1) +#endif /* H5_HAVE_LIBHDFS */ +#ifdef H5_HAVE_LIBHDFS #ifdef __cplusplus extern "C" { #endif @@ -90,8 +95,6 @@ extern "C" { * Programmer: Jacob Smith * 2018-04-23 * - * Changes: None - * ****************************************************************************/ #define H5FD__CURR_HDFS_FAPL_T_VERSION 1 @@ -116,7 +119,7 @@ H5_DLL herr_t H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa); #ifdef __cplusplus } #endif +#endif /* H5_HAVE_LIBHDFS */ #endif /* ifndef H5FDhdfs_H */ - diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 78b7742..8793a76 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, April 17, 2000 * * Purpose: The POSIX unbuffered file driver using only the HDF5 public @@ -151,71 +151,71 @@ typedef struct H5FD_log_t { * which can be addressed entirely by the second * argument of the file seek function. */ -#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) +#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) #define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) #define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - HADDR_UNDEF==(A)+(Z) || \ - (HDoff_t)((A)+(Z))<(HDoff_t)(A)) + HADDR_UNDEF == (A) + (Z) || \ + (HDoff_t)((A) + (Z)) < (HDoff_t)(A)) /* Prototypes */ -static herr_t H5FD_log_term(void); -static void *H5FD_log_fapl_get(H5FD_t *file); -static void *H5FD_log_fapl_copy(const void *_old_fa); -static herr_t H5FD_log_fapl_free(void *_fa); -static H5FD_t *H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, +static herr_t H5FD__log_term(void); +static void *H5FD__log_fapl_get(H5FD_t *file); +static void *H5FD__log_fapl_copy(const void *_old_fa); +static herr_t H5FD__log_fapl_free(void *_fa); +static H5FD_t *H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_log_close(H5FD_t *_file); -static int H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_log_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); +static herr_t H5FD__log_close(H5FD_t *_file); +static int H5FD__log_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__log_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); static herr_t H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); -static haddr_t H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_log_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_log_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static haddr_t H5FD__log_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__log_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__log_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); +static herr_t H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_log_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_log_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_log_unlock(H5FD_t *_file); +static herr_t H5FD__log_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__log_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__log_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_log_g = { - "log", /*name */ - MAXADDR, /*maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_log_term, /*terminate */ - NULL, /*sb_size */ - NULL, /*sb_encode */ - NULL, /*sb_decode */ - sizeof(H5FD_log_fapl_t), /*fapl_size */ - H5FD_log_fapl_get, /*fapl_get */ - H5FD_log_fapl_copy, /*fapl_copy */ - H5FD_log_fapl_free, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_log_open, /*open */ - H5FD_log_close, /*close */ - H5FD_log_cmp, /*cmp */ - H5FD_log_query, /*query */ - NULL, /*get_type_map */ - H5FD_log_alloc, /*alloc */ - H5FD__log_free, /*free */ - H5FD_log_get_eoa, /*get_eoa */ - H5FD_log_set_eoa, /*set_eoa */ - H5FD_log_get_eof, /*get_eof */ - H5FD_log_get_handle, /*get_handle */ - H5FD_log_read, /*read */ - H5FD_log_write, /*write */ - NULL, /*flush */ - H5FD_log_truncate, /*truncate */ - H5FD_log_lock, /*lock */ - H5FD_log_unlock, /*unlock */ - H5FD_FLMAP_DICHOTOMY /*fl_map */ + "log", /* name */ + MAXADDR, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD__log_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + sizeof(H5FD_log_fapl_t), /* fapl_size */ + H5FD__log_fapl_get, /* fapl_get */ + H5FD__log_fapl_copy, /* fapl_copy */ + H5FD__log_fapl_free, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__log_open, /* open */ + H5FD__log_close, /* close */ + H5FD__log_cmp, /* cmp */ + H5FD__log_query, /* query */ + NULL, /* get_type_map */ + H5FD__log_alloc, /* alloc */ + H5FD__log_free, /* free */ + H5FD__log_get_eoa, /* get_eoa */ + H5FD__log_set_eoa, /* set_eoa */ + H5FD__log_get_eof, /* get_eof */ + H5FD__log_get_handle, /* get_handle */ + H5FD__log_read, /* read */ + H5FD__log_write, /* write */ + NULL, /* flush */ + H5FD__log_truncate, /* truncate */ + H5FD__log_lock, /* lock */ + H5FD__log_unlock, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; /* Declare a free list to manage the H5FD_log_t struct */ @@ -279,7 +279,7 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_log_term + * Function: H5FD__log_term * * Purpose: Shut down the VFD * @@ -291,15 +291,15 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_log_term(void) +H5FD__log_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Reset VFL ID */ H5FD_LOG_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_log_term() */ +} /* end H5FD__log_term() */ /*------------------------------------------------------------------------- @@ -352,7 +352,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_log_fapl_get + * Function: H5FD__log_fapl_get * * Purpose: Returns a file access property list which indicates how the * specified file is being accessed. The return list could be @@ -368,22 +368,22 @@ done: *------------------------------------------------------------------------- */ static void * -H5FD_log_fapl_get(H5FD_t *_file) +H5FD__log_fapl_get(H5FD_t *_file) { H5FD_log_t *file = (H5FD_log_t *)_file; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ - ret_value = H5FD_log_fapl_copy(&(file->fa)); + ret_value = H5FD__log_fapl_copy(&(file->fa)); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_fapl_get() */ +} /* end H5FD__log_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_fapl_copy + * Function: H5FD__log_fapl_copy * * Purpose: Copies the log-specific file access properties. * @@ -396,13 +396,13 @@ H5FD_log_fapl_get(H5FD_t *_file) *------------------------------------------------------------------------- */ static void * -H5FD_log_fapl_copy(const void *_old_fa) +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 = NULL; /* New FAPL info */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(old_fa); @@ -430,11 +430,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_fapl_copy() */ +} /* end H5FD__log_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_fapl_free + * Function: H5FD__log_fapl_free * * Purpose: Frees the log-specific file access properties. * @@ -446,11 +446,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_fapl_free(void *_fa) +H5FD__log_fapl_free(void *_fa) { H5FD_log_fapl_t *fa = (H5FD_log_fapl_t*)_fa; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Free the fapl information */ if(fa->logfile) @@ -458,11 +458,11 @@ H5FD_log_fapl_free(void *_fa) H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_log_fapl_free() */ +} /* end H5FD__log_fapl_free() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_open + * Function: H5FD__log_open * * Purpose: Create and/or opens a file as an HDF5 file. * @@ -477,7 +477,7 @@ H5FD_log_fapl_free(void *_fa) *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) +H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_log_t *file = NULL; H5P_genplist_t *plist; /* Property list */ @@ -492,7 +492,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) h5_stat_t sb; H5FD_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check on file offsets */ HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t)); @@ -649,11 +649,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_open() */ +} /* end H5FD__log_open() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_close + * Function: H5FD__log_close * * Purpose: Closes an HDF5 file. * @@ -666,13 +666,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_close(H5FD_t *_file) +H5FD__log_close(H5FD_t *_file) { H5FD_log_t *file = (H5FD_log_t *)_file; H5_timer_t close_timer; /* Timer for close() call */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(file); @@ -794,11 +794,11 @@ H5FD_log_close(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_close() */ +} /* end H5FD__log_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_cmp + * Function: H5FD__log_cmp * * Purpose: Compares two files belonging to this driver using an * arbitrary (but consistent) ordering. @@ -813,13 +813,13 @@ done: *------------------------------------------------------------------------- */ static int -H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +H5FD__log_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_log_t *f1 = (const H5FD_log_t *)_f1; const H5FD_log_t *f2 = (const H5FD_log_t *)_f2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #ifdef H5_HAVE_WIN32_API if(f1->dwVolumeSerialNumber < f2->dwVolumeSerialNumber) HGOTO_DONE(-1) @@ -850,11 +850,11 @@ H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_cmp() */ +} /* end H5FD__log_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_query + * Function: H5FD__log_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -867,11 +867,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */) +H5FD__log_query(const H5FD_t *_file, unsigned long *flags /* out */) { const H5FD_log_t *file = (const H5FD_log_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set the VFL feature flags that this driver supports */ if(flags) { @@ -890,11 +890,11 @@ H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */) } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_log_query() */ +} /* end H5FD__log_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_alloc + * Function: H5FD__log_alloc * * Purpose: Allocate file memory. * @@ -907,13 +907,13 @@ H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */) *------------------------------------------------------------------------- */ static haddr_t -H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hsize_t size) +H5FD__log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hsize_t size) { H5FD_log_t *file = (H5FD_log_t *)_file; haddr_t addr; haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Compute the address for the block to allocate */ addr = file->eoa; @@ -937,7 +937,7 @@ H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hsi ret_value = addr; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_alloc() */ +} /* end H5FD__log_alloc() */ /*------------------------------------------------------------------------- @@ -978,7 +978,7 @@ H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, /*------------------------------------------------------------------------- - * Function: H5FD_log_get_eoa + * Function: H5FD__log_get_eoa * * Purpose: Gets the end-of-address marker for the file. The EOA marker * is the first address past the last byte allocated in the @@ -993,18 +993,18 @@ H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, *------------------------------------------------------------------------- */ static haddr_t -H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__log_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_log_t *file = (const H5FD_log_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eoa) -} /* end H5FD_log_get_eoa() */ +} /* end H5FD__log_get_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_set_eoa + * Function: H5FD__log_set_eoa * * Purpose: Set the end-of-address marker for the file. This function is * called shortly after an existing HDF5 file is opened in order @@ -1018,11 +1018,11 @@ H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) +H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) { H5FD_log_t *file = (H5FD_log_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(file->fa.flags != 0) { /* Check for increasing file size */ @@ -1061,11 +1061,11 @@ H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) file->eoa = addr; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_log_set_eoa() */ +} /* end H5FD__log_set_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_get_eof + * Function: H5FD__log_get_eof * * Purpose: Returns the end-of-file marker, which is the greater of * either the filesystem end-of-file or the HDF5 end-of-address @@ -1082,18 +1082,18 @@ H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) *------------------------------------------------------------------------- */ static haddr_t -H5FD_log_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__log_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_log_t *file = (const H5FD_log_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eof) -} /* end H5FD_log_get_eof() */ +} /* end H5FD__log_get_eof() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_get_handle + * Function: H5FD__log_get_handle * * Purpose: Returns the file handle of LOG file driver. * @@ -1105,12 +1105,12 @@ H5FD_log_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_log_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle) +H5FD__log_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle) { H5FD_log_t *file = (H5FD_log_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") @@ -1119,11 +1119,11 @@ H5FD_log_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_get_handle() */ +} /* end H5FD__log_get_handle() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_read + * Function: H5FD__log_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR * into buffer BUF according to data transfer properties in @@ -1139,7 +1139,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, +H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_log_t *file = (H5FD_log_t *)_file; @@ -1154,7 +1154,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -1325,11 +1325,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_read() */ +} /* end H5FD__log_read() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_write + * Function: H5FD__log_write * * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR * from buffer BUF according to data transfer properties in @@ -1343,7 +1343,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, +H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { H5FD_log_t *file = (H5FD_log_t *)_file; @@ -1358,7 +1358,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(size > 0); @@ -1531,11 +1531,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_write() */ +} /* end H5FD__log_write() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_truncate + * Function: H5FD__log_truncate * * Purpose: Makes sure that the true file size is the same (or larger) * than the end-of-address. @@ -1548,12 +1548,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) +H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { H5FD_log_t *file = (H5FD_log_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -1639,11 +1639,11 @@ H5FD_log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_U done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_truncate() */ +} /* end H5FD__log_truncate() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_lock + * Function: H5FD__log_lock * * Purpose: Place a lock on the file * @@ -1655,13 +1655,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_lock(H5FD_t *_file, hbool_t rw) +H5FD__log_lock(H5FD_t *_file, hbool_t rw) { H5FD_log_t *file = (H5FD_log_t *)_file; /* VFD file struct */ int lock_flags; /* file locking flags */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(file); @@ -1679,11 +1679,11 @@ H5FD_log_lock(H5FD_t *_file, hbool_t rw) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_lock() */ +} /* end H5FD__log_lock() */ /*------------------------------------------------------------------------- - * Function: H5FD_log_unlock + * Function: H5FD__log_unlock * * Purpose: Remove the existing lock on the file * @@ -1694,12 +1694,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_log_unlock(H5FD_t *_file) +H5FD__log_unlock(H5FD_t *_file) { H5FD_log_t *file = (H5FD_log_t *)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -1712,5 +1712,5 @@ H5FD_log_unlock(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_log_unlock() */ +} /* end H5FD__log_unlock() */ diff --git a/src/H5FDlog.h b/src/H5FDlog.h index a69bb18..db51f3d 100644 --- a/src/H5FDlog.h +++ b/src/H5FDlog.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, April 17, 2000 * * Purpose: The public header file for the log driver. diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c index ef035c1..6bee4a7 100644 --- a/src/H5FDmirror.c +++ b/src/H5FDmirror.c @@ -25,6 +25,7 @@ #include "H5Fprivate.h" /* File access */ #include "H5FDprivate.h" /* File drivers */ #include "H5FDmirror.h" /* "Mirror" definitions */ +#include "H5FDmirror_priv.h" /* Private header for the mirror VFD */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -136,32 +137,32 @@ typedef struct H5FD_mirror_t { #if MIRROR_DEBUG_OP_CALLS #define LOG_OP_CALL(name) do { \ HDprintf("called %s()\n", (name)); \ - fflush(stdout); \ + HDfflush(stdout); \ } while (0) #else #define LOG_OP_CALL(name) /* no-op */ #endif /* MIRROR_DEBUG_OP_CALLS */ /* Prototypes */ -static herr_t H5FD_mirror_term(void); -static void *H5FD_mirror_fapl_get(H5FD_t *_file); -static void *H5FD_mirror_fapl_copy(const void *_old_fa); -static herr_t H5FD_mirror_fapl_free(void *_fa); -static haddr_t H5FD_mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_mirror_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static H5FD_t *H5FD_mirror_open(const char *name, unsigned flags, \ +static herr_t H5FD__mirror_term(void); +static void *H5FD__mirror_fapl_get(H5FD_t *_file); +static void *H5FD__mirror_fapl_copy(const void *_old_fa); +static herr_t H5FD__mirror_fapl_free(void *_fa); +static haddr_t H5FD__mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__mirror_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static H5FD_t *H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_mirror_close(H5FD_t *_file); -static herr_t H5FD_mirror_query(const H5FD_t *_file, unsigned long *flags); -static herr_t H5FD_mirror_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, \ +static herr_t H5FD__mirror_close(H5FD_t *_file); +static herr_t H5FD__mirror_query(const H5FD_t *_file, unsigned long *flags); +static herr_t H5FD__mirror_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_mirror_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD__mirror_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_mirror_truncate(H5FD_t *_file, hid_t dxpl_id, \ +static herr_t H5FD__mirror_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_mirror_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_mirror_unlock(H5FD_t *_file); +static herr_t H5FD__mirror_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__mirror_unlock(H5FD_t *_file); static herr_t H5FD__mirror_verify_reply(H5FD_mirror_t *file); @@ -169,40 +170,46 @@ static const H5FD_class_t H5FD_mirror_g = { "mirror", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_mirror_term, /* terminate */ + H5FD__mirror_term, /* terminate */ NULL, /* sb_size */ NULL, /* sb_encode */ NULL, /* sb_decode */ 0, /* fapl_size */ - H5FD_mirror_fapl_get, /* fapl_get */ - H5FD_mirror_fapl_copy, /* fapl_copy */ - H5FD_mirror_fapl_free, /* fapl_free */ + H5FD__mirror_fapl_get, /* fapl_get */ + H5FD__mirror_fapl_copy, /* fapl_copy */ + H5FD__mirror_fapl_free, /* fapl_free */ 0, /* dxpl_size */ NULL, /* dxpl_copy */ NULL, /* dxpl_free */ - H5FD_mirror_open, /* open */ - H5FD_mirror_close, /* close */ + H5FD__mirror_open, /* open */ + H5FD__mirror_close, /* close */ NULL, /* cmp */ - H5FD_mirror_query, /* query */ + H5FD__mirror_query, /* query */ NULL, /* get_type_map */ NULL, /* alloc */ NULL, /* free */ - H5FD_mirror_get_eoa, /* get_eoa */ - H5FD_mirror_set_eoa, /* set_eoa */ - H5FD_mirror_get_eof, /* get_eof */ + H5FD__mirror_get_eoa, /* get_eoa */ + H5FD__mirror_set_eoa, /* set_eoa */ + H5FD__mirror_get_eof, /* get_eof */ NULL, /* get_handle */ - H5FD_mirror_read, /* read */ - H5FD_mirror_write, /* write */ + H5FD__mirror_read, /* read */ + H5FD__mirror_write, /* write */ NULL, /* flush */ - H5FD_mirror_truncate, /* truncate */ - H5FD_mirror_lock, /* lock */ - H5FD_mirror_unlock, /* unlock */ + H5FD__mirror_truncate, /* truncate */ + H5FD__mirror_lock, /* lock */ + H5FD__mirror_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; +/* Declare a free list to manage the transmission buffers */ +H5FL_BLK_DEFINE_STATIC(xmit); + /* Declare a free list to manage the H5FD_mirror_t struct */ H5FL_DEFINE_STATIC(H5FD_mirror_t); +/* Declare a free list to manage the H5FD_mirror_xmit_open_t struct */ +H5FL_DEFINE_STATIC(H5FD_mirror_xmit_open_t); + /*------------------------------------------------------------------------- * Function: H5FD__init_package @@ -219,12 +226,10 @@ H5FD__init_package(void) FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD__init_package"); + LOG_OP_CALL(FUNC); - if (H5FD_mirror_init() < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, - "unable to initialize mirror VFD"); - } + if(H5FD_mirror_init() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize mirror VFD"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -248,12 +253,10 @@ H5FD_mirror_init(void) FUNC_ENTER_NOAPI(FAIL) - LOG_OP_CALL("H5FD_mirror_init"); + LOG_OP_CALL(FUNC); - if (H5I_VFL != H5I_get_type(H5FD_MIRROR_g)) { - H5FD_MIRROR_g = H5FD_register(&H5FD_mirror_g, sizeof(H5FD_class_t), - FALSE); - } + if(H5I_VFL != H5I_get_type(H5FD_MIRROR_g)) + H5FD_MIRROR_g = H5FD_register(&H5FD_mirror_g, sizeof(H5FD_class_t), FALSE); ret_value = H5FD_MIRROR_g; @@ -263,7 +266,7 @@ done: /* --------------------------------------------------------------------------- - * Function: H5FD_mirror_term + * Function: H5FD__mirror_term * * Purpose: Shut down the VFD * @@ -271,17 +274,17 @@ done: * --------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_term(void) +H5FD__mirror_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Reset VFL ID */ H5FD_MIRROR_g = 0; - LOG_OP_CALL("H5FD_mirror_term"); + LOG_OP_CALL(FUNC); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_mirror_term() */ +} /* end H5FD__mirror_term() */ /* --------------------------------------------------------------------------- @@ -301,10 +304,14 @@ size_t H5FD__mirror_xmit_decode_uint16(uint16_t *out, const unsigned char *_buf) { uint16_t n = 0; - LOG_OP_CALL("H5FD__mirror_xmit_decode_uint16"); + + LOG_OP_CALL(__func__); + HDassert(_buf && out); + HDmemcpy(&n, _buf, sizeof(n)); *out = (uint16_t)HDntohs(n); + return 2; /* number of bytes eaten */ } /* end H5FD__mirror_xmit_decode_uint16() */ @@ -326,14 +333,17 @@ size_t H5FD__mirror_xmit_decode_uint32(uint32_t *out, const unsigned char *_buf) { uint32_t n = 0; - LOG_OP_CALL("H5FD__mirror_xmit_decode_uint32"); + + LOG_OP_CALL(__func__); + HDassert(_buf && out); + HDmemcpy(&n, _buf, sizeof(n)); *out = (uint32_t)HDntohl(n); + return 4; /* number of bytes eaten */ } /* end H5FD__mirror_xmit_decode_uint32() */ - /* --------------------------------------------------------------------------- * Function: is_host_little_endian @@ -357,12 +367,11 @@ is_host_little_endian(void) uint8_t u8[4]; } echeck; echeck.u32 = 0xA1B2C3D4; - if (echeck.u8[0] == 0xD4) { + + if(echeck.u8[0] == 0xD4) return TRUE; - } - else { + else return FALSE; - } } /* end is_host_little_endian() */ @@ -385,15 +394,17 @@ size_t H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *_buf) { uint64_t n = 0; - LOG_OP_CALL("H5FD__mirror_xmit_decode_uint64"); + + LOG_OP_CALL(__func__); + HDassert(_buf && out); + HDmemcpy(&n, _buf, sizeof(n)); - if (TRUE == is_host_little_endian()) { + if(TRUE == is_host_little_endian()) *out = BSWAP_64(n); - } - else { + else *out = n; - } + return 8; } /* end H5FD__mirror_xmit_decode_uint64() */ @@ -412,9 +423,12 @@ H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *_buf) size_t H5FD__mirror_xmit_decode_uint8(uint8_t *out, const unsigned char *_buf) { - LOG_OP_CALL("H5FD__mirror_xmit_decode_uint8"); + LOG_OP_CALL(__func__); + HDassert(_buf && out); + HDmemcpy(out, _buf, sizeof(uint8_t)); + return 1; /* number of bytes eaten */ } /* end H5FD__mirror_xmit_decode_uint8() */ @@ -435,10 +449,14 @@ size_t H5FD__mirror_xmit_encode_uint16(unsigned char *_dest, uint16_t v) { uint16_t n = 0; - LOG_OP_CALL("H5FD__mirror_xmit_encode_uint16"); + + LOG_OP_CALL(__func__); + HDassert(_dest); + n = (uint16_t)HDhtons(v); HDmemcpy(_dest, &n, sizeof(n)); + return 2; } /* end H5FD__mirror_xmit_encode_uint16() */ @@ -459,10 +477,14 @@ size_t H5FD__mirror_xmit_encode_uint32(unsigned char *_dest, uint32_t v) { uint32_t n = 0; - LOG_OP_CALL("H5FD__mirror_xmit_encode_uint32"); + + LOG_OP_CALL(__func__); + HDassert(_dest); + n = (uint32_t)HDhtonl(v); HDmemcpy(_dest, &n, sizeof(n)); + return 4; } /* end H5FD__mirror_xmit_encode_uint32() */ @@ -483,12 +505,15 @@ size_t H5FD__mirror_xmit_encode_uint64(unsigned char *_dest, uint64_t v) { uint64_t n = v; - LOG_OP_CALL("H5FD__mirror_xmit_decode_uint64"); + + LOG_OP_CALL(__func__); + HDassert(_dest); - if (TRUE == is_host_little_endian()) { + + if(TRUE == is_host_little_endian()) n = BSWAP_64(v); - } HDmemcpy(_dest, &n, sizeof(n)); + return 8; } /* H5FD__mirror_xmit_encode_uint64() */ @@ -509,9 +534,12 @@ H5FD__mirror_xmit_encode_uint64(unsigned char *_dest, uint64_t v) size_t H5FD__mirror_xmit_encode_uint8(unsigned char *dest, uint8_t v) { - LOG_OP_CALL("H5FD__mirror_xmit_encode_uint8"); + LOG_OP_CALL(__func__); + HDassert(dest); + HDmemcpy(dest, &v, sizeof(v)); + return 1; } /* end H5FD__mirror_xmit_encode_uint8() */ @@ -540,8 +568,11 @@ H5FD_mirror_xmit_decode_header(H5FD_mirror_xmit_t *out, const unsigned char *buf) { size_t n_eaten = 0; - LOG_OP_CALL("H5FD_mirror_xmit_decode_header"); + + LOG_OP_CALL(__func__); + HDassert(out && buf); + n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->magic), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->version), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->session_token), @@ -550,6 +581,7 @@ H5FD_mirror_xmit_decode_header(H5FD_mirror_xmit_t *out, &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->op), &buf[n_eaten]); HDassert(n_eaten == H5FD_MIRROR_XMIT_HEADER_SIZE); + return n_eaten; } /* end H5FD_mirror_xmit_decode_header() */ @@ -578,11 +610,15 @@ H5FD_mirror_xmit_decode_lock(H5FD_mirror_xmit_lock_t *out, const unsigned char *buf) { size_t n_eaten = 0; - LOG_OP_CALL("H5FD_mirror_xmit_decode_lock"); + + LOG_OP_CALL(__func__); + HDassert(out && buf); + n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->rw), &buf[n_eaten]); HDassert(n_eaten == H5FD_MIRROR_XMIT_LOCK_SIZE); + return n_eaten; } /* end H5FD_mirror_xmit_decode_lock() */ @@ -612,8 +648,11 @@ H5FD_mirror_xmit_decode_open(H5FD_mirror_xmit_open_t *out, const unsigned char *buf) { size_t n_eaten = 0; - LOG_OP_CALL("H5FD_mirror_xmit_decode_open"); + + LOG_OP_CALL(__func__); + HDassert(out && buf); + n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->flags), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->maxaddr), &buf[n_eaten]); @@ -622,8 +661,9 @@ H5FD_mirror_xmit_decode_open(H5FD_mirror_xmit_open_t *out, HDassert((H5FD_MIRROR_XMIT_OPEN_SIZE - H5FD_MIRROR_XMIT_FILEPATH_MAX) == n_eaten); HDstrncpy(out->filename, (const char *)&buf[n_eaten], - H5FD_MIRROR_XMIT_FILEPATH_MAX-1); - out->filename[H5FD_MIRROR_XMIT_FILEPATH_MAX-1] = 0; /* force final NULL */ + H5FD_MIRROR_XMIT_FILEPATH_MAX - 1); + out->filename[H5FD_MIRROR_XMIT_FILEPATH_MAX - 1] = 0; /* force final NULL */ + return H5FD_MIRROR_XMIT_OPEN_SIZE; } /* end H5FD_mirror_xmit_decode_open() */ @@ -653,15 +693,19 @@ H5FD_mirror_xmit_decode_reply(H5FD_mirror_xmit_reply_t *out, const unsigned char *buf) { size_t n_eaten = 0; - LOG_OP_CALL("H5FD_mirror_xmit_decode_reply"); + + LOG_OP_CALL(__func__); + HDassert(out && buf); + n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->status), &buf[n_eaten]); HDassert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_eaten); HDstrncpy(out->message, (const char *)&buf[n_eaten], - H5FD_MIRROR_STATUS_MESSAGE_MAX-1); - out->message[H5FD_MIRROR_STATUS_MESSAGE_MAX-1] = 0; /* force NULL term */ + H5FD_MIRROR_STATUS_MESSAGE_MAX - 1); + out->message[H5FD_MIRROR_STATUS_MESSAGE_MAX - 1] = 0; /* force NULL term */ + return H5FD_MIRROR_XMIT_REPLY_SIZE; } /* end H5FD_mirror_xmit_decode_reply() */ @@ -690,12 +734,16 @@ H5FD_mirror_xmit_decode_set_eoa(H5FD_mirror_xmit_eoa_t *out, const unsigned char *buf) { size_t n_eaten = 0; - LOG_OP_CALL("H5FD_mirror_xmit_decode_set_eoa"); + + LOG_OP_CALL(__func__); + HDassert(out && buf); + n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->type), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->eoa_addr), &buf[n_eaten]); HDassert(n_eaten == H5FD_MIRROR_XMIT_EOA_SIZE); + return n_eaten; } /* end H5FD_mirror_xmit_decode_set_eoa() */ @@ -724,13 +772,17 @@ H5FD_mirror_xmit_decode_write(H5FD_mirror_xmit_write_t *out, const unsigned char *buf) { size_t n_eaten = 0; - LOG_OP_CALL("H5FD_mirror_xmit_decode_write"); + + LOG_OP_CALL(__func__); + HDassert(out && buf); + n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->type), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->offset), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->size), &buf[n_eaten]); HDassert(n_eaten == H5FD_MIRROR_XMIT_WRITE_SIZE); + return n_eaten; } /* end H5FD_mirror_xmit_decode_write() */ @@ -754,14 +806,18 @@ H5FD_mirror_xmit_encode_header(unsigned char *dest, const H5FD_mirror_xmit_t *x) { size_t n_writ = 0; - LOG_OP_CALL("H5FD_mirror_xmit_encode_header"); + + LOG_OP_CALL(__func__); + HDassert(dest && x); + n_writ += H5FD__mirror_xmit_encode_uint32((dest+n_writ), x->magic); n_writ += H5FD__mirror_xmit_encode_uint8((dest+n_writ), x->version); n_writ += H5FD__mirror_xmit_encode_uint32((dest+n_writ), x->session_token); n_writ += H5FD__mirror_xmit_encode_uint32((dest+n_writ), x->xmit_count); n_writ += H5FD__mirror_xmit_encode_uint8((dest+n_writ), x->op); HDassert(n_writ == H5FD_MIRROR_XMIT_HEADER_SIZE); + return n_writ; } /* end H5FD_mirror_xmit_encode_header() */ @@ -784,12 +840,16 @@ H5FD_mirror_xmit_encode_lock(unsigned char *dest, const H5FD_mirror_xmit_lock_t *x) { size_t n_writ = 0; - LOG_OP_CALL("H5FD_mirror_xmit_encode_lock"); + + LOG_OP_CALL(__func__); + HDassert(dest && x); + n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->rw); HDassert(n_writ == H5FD_MIRROR_XMIT_LOCK_SIZE); + return n_writ; } /* end H5FD_mirror_xmit_encode_lock() */ @@ -813,13 +873,14 @@ H5FD_mirror_xmit_encode_open(unsigned char *dest, const H5FD_mirror_xmit_open_t *x) { size_t n_writ = 0; - LOG_OP_CALL("H5FD_mirror_xmit_encode_open"); + + LOG_OP_CALL(__func__); + HDassert(dest && x); + /* clear entire structure, but especially its filepath string area */ - for (n_writ = 0; n_writ < H5FD_MIRROR_XMIT_OPEN_SIZE; n_writ++) { - *(dest+n_writ) = 0; - } - n_writ = 0; + HDmemset(dest, 0, H5FD_MIRROR_XMIT_OPEN_SIZE); + n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint32(&dest[n_writ], x->flags); @@ -827,8 +888,8 @@ H5FD_mirror_xmit_encode_open(unsigned char *dest, n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->size_t_blob); HDassert((H5FD_MIRROR_XMIT_OPEN_SIZE - H5FD_MIRROR_XMIT_FILEPATH_MAX) == n_writ); - HDstrncpy((char *)&dest[n_writ], x->filename, - H5FD_MIRROR_XMIT_FILEPATH_MAX); + HDstrncpy((char *)&dest[n_writ], x->filename, H5FD_MIRROR_XMIT_FILEPATH_MAX); + return H5FD_MIRROR_XMIT_OPEN_SIZE; } /* end H5FD_mirror_xmit_encode_open() */ @@ -853,20 +914,21 @@ H5FD_mirror_xmit_encode_reply(unsigned char *dest, const H5FD_mirror_xmit_reply_t *x) { size_t n_writ = 0; - LOG_OP_CALL("H5FD_mirror_xmit_encode_reply"); + + LOG_OP_CALL(__func__); + HDassert(dest && x); + /* clear entire structure, but especially its message string area */ - for (n_writ = 0; n_writ < H5FD_MIRROR_XMIT_REPLY_SIZE; n_writ++) { - *(dest+n_writ) = 0; - } - n_writ = 0; + HDmemset(dest, 0, H5FD_MIRROR_XMIT_REPLY_SIZE); + n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint32(&dest[n_writ], x->status); HDassert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_writ); - HDstrncpy((char *)&dest[n_writ], x->message, - H5FD_MIRROR_STATUS_MESSAGE_MAX); + HDstrncpy((char *)&dest[n_writ], x->message, H5FD_MIRROR_STATUS_MESSAGE_MAX); + return H5FD_MIRROR_XMIT_REPLY_SIZE; } /* end H5FD_mirror_xmit_encode_reply() */ @@ -890,13 +952,17 @@ H5FD_mirror_xmit_encode_set_eoa(unsigned char *dest, const H5FD_mirror_xmit_eoa_t *x) { size_t n_writ = 0; - LOG_OP_CALL("H5FD_mirror_xmit_encode_set_eoa"); + + LOG_OP_CALL(__func__); + HDassert(dest && x); + n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint8(&dest[n_writ], x->type); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->eoa_addr); HDassert(n_writ == H5FD_MIRROR_XMIT_EOA_SIZE); + return n_writ; } /* end H5FD_mirror_xmit_encode_set_eoa() */ @@ -920,14 +986,18 @@ H5FD_mirror_xmit_encode_write(unsigned char *dest, const H5FD_mirror_xmit_write_t *x) { size_t n_writ = 0; - LOG_OP_CALL("H5FD_mirror_xmit_encode_write"); + + LOG_OP_CALL(__func__); + HDassert(dest && x); + n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint8(&dest[n_writ], x->type); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->offset); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->size); HDassert(n_writ == H5FD_MIRROR_XMIT_WRITE_SIZE); + return n_writ; } /* end H5FD_mirror_xmit_encode_write() */ @@ -942,16 +1012,16 @@ H5FD_mirror_xmit_encode_write(unsigned char *dest, * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_close(const H5FD_mirror_xmit_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_close"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (TRUE == H5FD_mirror_xmit_is_xmit(xmit)) && - (H5FD_MIRROR_OP_CLOSE == xmit->op) ) - { + + if((TRUE == H5FD_mirror_xmit_is_xmit(xmit)) && (H5FD_MIRROR_OP_CLOSE == xmit->op)) return TRUE; - } + return FALSE; } /* end H5FD_mirror_xmit_is_close() */ @@ -966,16 +1036,16 @@ H5FD_mirror_xmit_is_close(const H5FD_mirror_xmit_t *xmit) * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_lock(const H5FD_mirror_xmit_lock_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_lock"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && - (H5FD_MIRROR_OP_LOCK == xmit->pub.op) ) - { + + if((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_LOCK == xmit->pub.op)) return TRUE; - } + return FALSE; } /* end H5FD_mirror_xmit_is_lock() */ @@ -990,16 +1060,17 @@ H5FD_mirror_xmit_is_lock(const H5FD_mirror_xmit_lock_t *xmit) * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_open(const H5FD_mirror_xmit_open_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_open"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && - (H5FD_MIRROR_OP_OPEN == xmit->pub.op) ) - { + + if((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_OPEN == xmit->pub.op)) + return TRUE; - } + return FALSE; } /* end H5FD_mirror_xmit_is_open() */ @@ -1014,16 +1085,16 @@ H5FD_mirror_xmit_is_open(const H5FD_mirror_xmit_open_t *xmit) * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_set_eoa(const H5FD_mirror_xmit_eoa_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_set_eoa"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && - (H5FD_MIRROR_OP_SET_EOA == xmit->pub.op) ) - { + + if((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_SET_EOA == xmit->pub.op)) return TRUE; - } + return FALSE; } /* end H5FD_mirror_xmit_is_eoa() */ @@ -1038,16 +1109,16 @@ H5FD_mirror_xmit_is_set_eoa(const H5FD_mirror_xmit_eoa_t *xmit) * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_reply(const H5FD_mirror_xmit_reply_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_reply"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && - (H5FD_MIRROR_OP_REPLY == xmit->pub.op) ) - { + + if((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_REPLY == xmit->pub.op)) return TRUE; - } + return FALSE; } /* end H5FD_mirror_xmit_is_reply() */ @@ -1062,16 +1133,16 @@ H5FD_mirror_xmit_is_reply(const H5FD_mirror_xmit_reply_t *xmit) * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_write(const H5FD_mirror_xmit_write_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_write"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && - (H5FD_MIRROR_OP_WRITE == xmit->pub.op) ) - { + + if((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_WRITE == xmit->pub.op)) return TRUE; - } + return FALSE; } /* end H5FD_mirror_xmit_is_write() */ @@ -1086,16 +1157,16 @@ H5FD_mirror_xmit_is_write(const H5FD_mirror_xmit_write_t *xmit) * Return: TRUE if valid; else FALSE. * --------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit) { - LOG_OP_CALL("H5FD_mirror_xmit_is_xmit"); + LOG_OP_CALL(__func__); + HDassert(xmit); - if ( (H5FD_MIRROR_XMIT_MAGIC != xmit->magic) || - (H5FD_MIRROR_XMIT_CURR_VERSION != xmit->version) ) - { + + if((H5FD_MIRROR_XMIT_MAGIC != xmit->magic) || (H5FD_MIRROR_XMIT_CURR_VERSION != xmit->version)) return FALSE; - } + return TRUE; } /* end H5FD_mirror_xmit_is_xmit() */ @@ -1111,60 +1182,55 @@ H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit) * Return: SUCCEED if ok, else FAIL. * ---------------------------------------------------------------------------- */ -herr_t +static herr_t H5FD__mirror_verify_reply(H5FD_mirror_t *file) { - char xmit_buf[H5FD_MIRROR_XMIT_REPLY_SIZE]; + unsigned char *xmit_buf = NULL; struct H5FD_mirror_xmit_reply_t reply; ssize_t read_ret = 0; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT; + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD__mirror_verify_reply"); + LOG_OP_CALL(FUNC); HDassert(file && file->sock_fd); + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); + read_ret = HDread(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_REPLY_SIZE); - if (read_ret < 0) { + if(read_ret < 0) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to read reply"); - } - if (read_ret != H5FD_MIRROR_XMIT_REPLY_SIZE) { + if(read_ret != H5FD_MIRROR_XMIT_REPLY_SIZE) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unexpected read size"); - } LOG_XMIT_BYTES("reply", xmit_buf, read_ret); - if (H5FD_mirror_xmit_decode_reply(&reply, (const unsigned char *)xmit_buf) - != H5FD_MIRROR_XMIT_REPLY_SIZE) - { + if(H5FD_mirror_xmit_decode_reply(&reply, xmit_buf) != H5FD_MIRROR_XMIT_REPLY_SIZE) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unable to decode reply xmit"); - } - if (H5FD_mirror_xmit_is_reply(&reply) != TRUE) { + if(H5FD_mirror_xmit_is_reply(&reply) != TRUE) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "xmit op code was not REPLY"); - } - if (reply.pub.session_token != file->xmit.session_token) { + if(reply.pub.session_token != file->xmit.session_token) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "wrong session"); - } - - if (reply.pub.xmit_count != (file->xmit_i)++) { + if(reply.pub.xmit_count != (file->xmit_i)++) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "xmit out of sync"); - } - - if (reply.status != H5FD_MIRROR_STATUS_OK) { - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, - "%s", (const char *)(reply.message)); - } + if(reply.status != H5FD_MIRROR_STATUS_OK) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "%s", (const char *)(reply.message)); done: + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD__mirror_verify_reply() */ /* ------------------------------------------------------------------------- - * Function: H5FD_mirror_fapl_get + * Function: H5FD__mirror_fapl_get * * Purpose: Get the file access propety list which could be used to create * an identical file. @@ -1174,37 +1240,35 @@ done: * ------------------------------------------------------------------------- */ static void * -H5FD_mirror_fapl_get(H5FD_t *_file) +H5FD__mirror_fapl_get(H5FD_t *_file) { H5FD_mirror_t *file = (H5FD_mirror_t *)_file; H5FD_mirror_fapl_t *fa = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_fapl_get"); + LOG_OP_CALL(FUNC); fa = (H5FD_mirror_fapl_t *)H5MM_calloc(sizeof(H5FD_mirror_fapl_t)); - if (NULL == fa) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "calloc failed"); - } + if(NULL == fa) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "calloc failed"); HDmemcpy(fa, &(file->fa), sizeof(H5FD_mirror_fapl_t)); ret_value = fa; done: - if (ret_value == NULL) { - if (fa != NULL) { + if(ret_value == NULL) + if(fa != NULL) H5MM_xfree(fa); - } - } + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_fapl_get() */ +} /* end H5FD__mirror_fapl_get() */ /* ------------------------------------------------------------------------- - * Function: H5FD_mirror_fapl_copy + * Function: H5FD__mirror_fapl_copy * * Purpose: Copies the mirror vfd-specific file access properties. * @@ -1213,37 +1277,34 @@ done: * ------------------------------------------------------------------------- */ static void * -H5FD_mirror_fapl_copy(const void *_old_fa) +H5FD__mirror_fapl_copy(const void *_old_fa) { const H5FD_mirror_fapl_t *old_fa = (const H5FD_mirror_fapl_t *)_old_fa; H5FD_mirror_fapl_t *new_fa = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_fapl_copy"); + LOG_OP_CALL(FUNC); new_fa = (H5FD_mirror_fapl_t *)H5MM_malloc(sizeof(H5FD_mirror_fapl_t)); - if (new_fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); - } + if(new_fa == NULL) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed"); HDmemcpy(new_fa, old_fa, sizeof(H5FD_mirror_fapl_t)); ret_value = new_fa; done: - if (ret_value == NULL) { - if (new_fa != NULL) { + if(ret_value == NULL) + if(new_fa != NULL) H5MM_xfree(new_fa); - } - } + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_fapl_copy() */ +} /* end H5FD__mirror_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_fapl_free + * Function: H5FD__mirror_fapl_free * * Purpose: Frees the mirror VFD-specific file access properties. * @@ -1251,13 +1312,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_fapl_free(void *_fa) +H5FD__mirror_fapl_free(void *_fa) { H5FD_mirror_fapl_t *fa = (H5FD_mirror_fapl_t*)_fa; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL("H5FD_mirror_fapl_free"); + LOG_OP_CALL(FUNC); /* sanity check */ HDassert(fa != NULL); @@ -1267,7 +1328,7 @@ H5FD_mirror_fapl_free(void *_fa) H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_mirror_fapl_free() */ +} /* end H5FD__mirror_fapl_free() */ /* ------------------------------------------------------------------------- @@ -1289,26 +1350,20 @@ H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_out) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", fapl_id, fa_out); - LOG_OP_CALL("H5Pget_fapl_mirror"); + LOG_OP_CALL(FUNC); - if (NULL == fa_out) { + if(NULL == fa_out) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL"); - } plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (NULL == plist) { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access property list"); - } - - if (H5P_peek_driver(plist) != H5FD_MIRROR) { + if(NULL == plist) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if(H5P_peek_driver(plist) != H5FD_MIRROR) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); - } fa = (const H5FD_mirror_fapl_t *)H5P_peek_driver_info(plist); - if (NULL == fa) { + if(NULL == fa) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); - } HDassert(fa->magic == H5FD_MIRROR_FAPL_MAGIC); /* sanity check */ @@ -1337,22 +1392,17 @@ H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", fapl_id, fa); - LOG_OP_CALL("H5Pset_fapl_mirror"); + LOG_OP_CALL(FUNC); plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (NULL == plist) { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file access property list"); - } - if (NULL == fa) { + if(NULL == plist) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + if(NULL == fa) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null fapl_t pointer"); - } - if (H5FD_MIRROR_FAPL_MAGIC != fa->magic) { + if(H5FD_MIRROR_FAPL_MAGIC != fa->magic) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fapl_t magic"); - } - if (H5FD_MIRROR_CURR_FAPL_T_VERSION != fa->version) { + if(H5FD_MIRROR_CURR_FAPL_T_VERSION != fa->version) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown fapl_t version"); - } ret_value = H5P_set_driver(plist, H5FD_MIRROR, (const void *)fa); @@ -1362,7 +1412,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mirror_open + * Function: H5FD__mirror_open * * Purpose: Create and/or opens a file as an HDF5 file. * @@ -1376,64 +1426,51 @@ done: *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_mirror_open(const char *name, +H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { -#define MIRR_OPEN_MAXBUF 16 /* local symbol to give meaning to magic number */ - /* #defined because it is needed at compile time */ - /* Large enough to hold a port number string */ int live_socket = -1; struct sockaddr_in target_addr; socklen_t addr_size; - char xmit_buf[H5FD_MIRROR_XMIT_OPEN_SIZE]; + unsigned char *xmit_buf = NULL; H5FD_mirror_fapl_t fa; H5FD_mirror_t *file = NULL; - H5FD_mirror_xmit_open_t open_xmit; + H5FD_mirror_xmit_open_t *open_xmit = NULL; H5FD_t *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_open"); + LOG_OP_CALL(FUNC); /* --------------- */ /* Check arguments */ /* --------------- */ - if (!name || !*name) { + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); - } - if (HDstrlen(name) >= H5FD_MIRROR_XMIT_FILEPATH_MAX) { + if(HDstrlen(name) >= H5FD_MIRROR_XMIT_FILEPATH_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "filename is too long"); - } - 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"); - } - if (H5Pget_fapl_mirror(fapl_id, &fa) == FAIL) { + if(H5Pget_fapl_mirror(fapl_id, &fa) == FAIL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't get config info"); - } - - if (H5FD_MIRROR_FAPL_MAGIC != fa.magic) { + if(H5FD_MIRROR_FAPL_MAGIC != fa.magic) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid fapl magic"); - } - - if (H5FD_MIRROR_CURR_FAPL_T_VERSION != fa.version) { + if(H5FD_MIRROR_CURR_FAPL_T_VERSION != fa.version) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid fapl version"); - } /* --------------------- */ /* Handshake with remote */ /* --------------------- */ live_socket = HDsocket(AF_INET, SOCK_STREAM, 0); - if (live_socket < 0) { + if(live_socket < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't create socket"); - } target_addr.sin_family = AF_INET; target_addr.sin_port = HDhtons((uint16_t)fa.handshake_port); @@ -1441,21 +1478,16 @@ H5FD_mirror_open(const char *name, HDmemset(target_addr.sin_zero, '\0', sizeof target_addr.sin_zero); addr_size = sizeof(target_addr); - if (HDconnect(live_socket, (struct sockaddr *)&target_addr, addr_size) < 0) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "can't connect to remote server"); - } + if(HDconnect(live_socket, (struct sockaddr *)&target_addr, addr_size) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't connect to remote server"); /* ------------- */ /* Open the file */ /* ------------- */ file = (H5FD_mirror_t *)H5FL_CALLOC(H5FD_mirror_t); - if (NULL == file) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "unable to allocate file struct"); - } + if(NULL == file) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct"); file->sock_fd = live_socket; file->xmit_i = 0; @@ -1466,49 +1498,53 @@ H5FD_mirror_open(const char *name, file->xmit.session_token = (uint32_t)(0x01020304 ^ file->sock_fd); /* TODO: hashing? */ /* int --> uint32_t may truncate on some systems... shouldn't matter? */ + open_xmit = (H5FD_mirror_xmit_open_t *)H5FL_CALLOC(H5FD_mirror_xmit_open_t); + if(NULL == open_xmit) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate open_xmit struct"); + file->xmit.op = H5FD_MIRROR_OP_OPEN; - open_xmit.pub = file->xmit; - open_xmit.flags = (uint32_t)flags; - open_xmit.maxaddr = (uint64_t)maxaddr; - open_xmit.size_t_blob = (uint64_t)((size_t)(-1)); - HDsnprintf(open_xmit.filename, H5FD_MIRROR_XMIT_FILEPATH_MAX-1, "%s", name); - - if (H5FD_mirror_xmit_encode_open((unsigned char *)xmit_buf, - (const H5FD_mirror_xmit_open_t *)&open_xmit) - != H5FD_MIRROR_XMIT_OPEN_SIZE) - { + open_xmit->pub = file->xmit; + open_xmit->flags = (uint32_t)flags; + open_xmit->maxaddr = (uint64_t)maxaddr; + open_xmit->size_t_blob = (uint64_t)((size_t)(-1)); + HDsnprintf(open_xmit->filename, H5FD_MIRROR_XMIT_FILEPATH_MAX-1, "%s", name); + + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate xmit buffer"); + + if(H5FD_mirror_xmit_encode_open(xmit_buf, open_xmit) != H5FD_MIRROR_XMIT_OPEN_SIZE) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL, "unable to encode open"); - } LOG_XMIT_BYTES("open", xmit_buf, H5FD_MIRROR_XMIT_OPEN_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_OPEN_SIZE) < 0) { + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_OPEN_SIZE) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL, "unable to transmit open"); - } - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid reply"); - } ret_value = (H5FD_t *)file; done: - if (NULL == ret_value) { - if (file) { + if(NULL == ret_value) { + if(file) file = H5FL_FREE(H5FD_mirror_t, file); - } - if (live_socket >= 0 && HDclose(live_socket) < 0) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, - "can't close socket"); - } + if(live_socket >= 0 && HDclose(live_socket) < 0) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "can't close socket"); } + + if(open_xmit) + open_xmit = H5FL_FREE(H5FD_mirror_xmit_open_t, open_xmit); + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value) -#undef MIRR_OPEN_MAXBUF -} /* end H5FD_mirror_open() */ +} /* end H5FD__mirror_open() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_close + * Function: H5FD__mirror_close * * Purpose: Closes the HDF5 file. * @@ -1523,16 +1559,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_close(H5FD_t *_file) +H5FD__mirror_close(H5FD_t *_file) { H5FD_mirror_t *file = (H5FD_mirror_t *)_file; - unsigned char xmit_buf[H5FD_MIRROR_XMIT_HEADER_SIZE]; + unsigned char *xmit_buf = NULL; int xmit_encoded = 0; /* monitor point of failure */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_close"); + LOG_OP_CALL(FUNC); /* Sanity check */ HDassert(file); @@ -1541,68 +1577,59 @@ H5FD_mirror_close(H5FD_t *_file) file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_CLOSE; - if (H5FD_mirror_xmit_encode_header(xmit_buf, - (const H5FD_mirror_xmit_t *)&(file->xmit)) - != H5FD_MIRROR_XMIT_HEADER_SIZE) - { + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); + + if(H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) != H5FD_MIRROR_XMIT_HEADER_SIZE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to encode close"); - } xmit_encoded = 1; LOG_XMIT_BYTES("close", xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) { + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to transmit close"); - } - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } - if (HDclose(file->sock_fd) < 0) { + if(HDclose(file->sock_fd) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "can't close socket"); - } done: - if (ret_value == FAIL) { - if (xmit_encoded == 0) { + if(ret_value == FAIL) { + if(xmit_encoded == 0) { /* Encode failed; send GOODBYE to force writer halt. * We can ignore any response from the writer, if we receive * any reply at all. */ - if (HDwrite(file->sock_fd, "GOODBYE", HDstrlen("GOODBYE")) < 0) { - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to transmit close"); - if (HDclose(file->sock_fd) < 0) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "can't close socket"); - } + if(HDwrite(file->sock_fd, "GOODBYE", HDstrlen("GOODBYE")) < 0) { + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to transmit close"); + if(HDclose(file->sock_fd) < 0) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "can't close socket"); file->sock_fd = -1; /* invalidate for later */ } /* end if problem writing goodbye; go down hard */ else - if (HDshutdown(file->sock_fd, SHUT_WR) < 0) { - HDONE_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, - "can't shutdown socket write: %s", - HDstrerror(errno)); - } /* end else-if problem shutting down socket */ + if(HDshutdown(file->sock_fd, SHUT_WR) < 0) + HDONE_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't shutdown socket write: %s", HDstrerror(errno)); } /* end if xmit encode failed */ - if (file->sock_fd >= 0) { - if (HDclose(file->sock_fd) < 0) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "can't close socket"); - } - } /* end if socket not closed by going down hard */ + if(file->sock_fd >= 0) + if(HDclose(file->sock_fd) < 0) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "can't close socket"); } /* end if error */ file = H5FL_FREE(H5FD_mirror_t, file); /* always release resources */ + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_close() */ +} /* end H5FD__mirror_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_query + * Function: H5FD__mirror_query * * Purpose: Get the driver feature flags implemented by the driver. * @@ -1610,11 +1637,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) +H5FD__mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) { - FUNC_ENTER_NOAPI_NOINIT_NOERR; + FUNC_ENTER_STATIC_NOERR; - LOG_OP_CALL("H5FD_mirror_query"); + LOG_OP_CALL(FUNC); /* Notice: the Mirror VFD Writer currently uses only the Sec2 driver as * the underying driver -- as such, the Mirror VFD implementation copies @@ -1624,23 +1651,21 @@ H5FD_mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) * is never included. * -- JOS 2020-01-13 */ - if (flags) { - *flags = 0 \ - | H5FD_FEAT_AGGREGATE_METADATA \ + if(flags) + *flags = H5FD_FEAT_AGGREGATE_METADATA \ | H5FD_FEAT_ACCUMULATE_METADATA \ | H5FD_FEAT_DATA_SIEVE \ | H5FD_FEAT_AGGREGATE_SMALLDATA \ | H5FD_FEAT_POSIX_COMPAT_HANDLE \ | H5FD_FEAT_SUPPORTS_SWMR_IO \ | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; - } FUNC_LEAVE_NOAPI(SUCCEED); -} /* end H5FD_mirror_query() */ +} /* end H5FD__mirror_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_get_eoa + * Function: H5FD__mirror_get_eoa * * Purpose: Gets the end-of-address marker for the file. The EOA marker * is the first address past the last byte allocated in the @@ -1652,22 +1677,22 @@ H5FD_mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) *------------------------------------------------------------------------- */ static haddr_t -H5FD_mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_mirror_t *file = (const H5FD_mirror_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL("H5FD_mirror_get_eoa"); + LOG_OP_CALL(FUNC); HDassert(file); FUNC_LEAVE_NOAPI(file->eoa) -} /* end H5FD_mirror_get_eoa() */ +} /* end H5FD__mirror_get_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_set_eoa + * Function: H5FD__mirror_set_eoa * * Purpose: Set the end-of-address marker for the file. This function is * called shortly after an existing HDF5 file is opened in order @@ -1677,16 +1702,16 @@ H5FD_mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) +H5FD__mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) { H5FD_mirror_xmit_eoa_t xmit_eoa; - unsigned char xmit_buf[H5FD_MIRROR_XMIT_EOA_SIZE]; + unsigned char *xmit_buf = NULL; H5FD_mirror_t *file = (H5FD_mirror_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_set_eoa"); + LOG_OP_CALL(FUNC); HDassert(file); @@ -1699,31 +1724,31 @@ H5FD_mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) xmit_eoa.type = (uint8_t)type; xmit_eoa.eoa_addr = (uint64_t)addr; - if (H5FD_mirror_xmit_encode_set_eoa(xmit_buf, - (const H5FD_mirror_xmit_eoa_t *)&xmit_eoa) - != H5FD_MIRROR_XMIT_EOA_SIZE) - { + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); + + if(H5FD_mirror_xmit_encode_set_eoa(xmit_buf, &xmit_eoa) != H5FD_MIRROR_XMIT_EOA_SIZE) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode set-eoa"); - } LOG_XMIT_BYTES("set-eoa", xmit_buf, H5FD_MIRROR_XMIT_EOA_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_EOA_SIZE) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, - "unable to transmit set-eoa"); - } + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_EOA_SIZE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit set-eoa"); - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } done: + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_set_eoa() */ +} /* end H5FD__mirror_set_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_get_eof + * Function: H5FD__mirror_get_eof * * Purpose: Returns the end-of-file marker, which is the greater of * either the filesystem end-of-file or the HDF5 end-of-address @@ -1736,49 +1761,43 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_mirror_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__mirror_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_mirror_t *file = (const H5FD_mirror_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL("H5FD_mirror_get_eof"); + LOG_OP_CALL(FUNC); HDassert(file); FUNC_LEAVE_NOAPI(file->eof) -} /* end H5FD_mirror_get_eof() */ +} /* end H5FD__mirror_get_eof() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_read + * Function: H5FD__mirror_read * - * Purpose: Required to register the driver. - * If called, MUST fail. + * Purpose: Required to register the driver, but if called, MUST fail. * * Return: FAIL *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_read(H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED fapl_id, - haddr_t H5_ATTR_UNUSED addr, - size_t H5_ATTR_UNUSED size, - void H5_ATTR_UNUSED *buf) +H5FD__mirror_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, + size_t H5_ATTR_UNUSED size, void H5_ATTR_UNUSED *buf) { - herr_t ret_value = FAIL; + FUNC_ENTER_STATIC_NOERR - FUNC_ENTER_NOAPI_NOINIT_NOERR + LOG_OP_CALL(FUNC); - LOG_OP_CALL("H5FD_mirror_read"); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_read() */ + FUNC_LEAVE_NOAPI(FAIL) +} /* end H5FD__mirror_read() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_write + * Function: H5FD__mirror_write * * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR * from buffer BUF according to data transfer properties in @@ -1795,21 +1814,17 @@ H5FD_mirror_read(H5FD_t H5_ATTR_UNUSED *_file, *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_write(H5FD_t *_file, - H5FD_mem_t type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t addr, - size_t size, - const void *buf) +H5FD__mirror_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, + haddr_t addr, size_t size, const void *buf) { H5FD_mirror_xmit_write_t xmit_write; - unsigned char xmit_buf[H5FD_MIRROR_XMIT_WRITE_SIZE]; + unsigned char *xmit_buf = NULL; H5FD_mirror_t *file = (H5FD_mirror_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_write"); + LOG_OP_CALL(FUNC); HDassert(file); HDassert(buf); @@ -1822,43 +1837,41 @@ H5FD_mirror_write(H5FD_t *_file, xmit_write.offset = (uint64_t)addr; xmit_write.type = (uint8_t)type; + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); /* Notify Writer of incoming data to write. */ - if (H5FD_mirror_xmit_encode_write(xmit_buf, - (const H5FD_mirror_xmit_write_t *)&xmit_write) - != H5FD_MIRROR_XMIT_WRITE_SIZE) - { + if(H5FD_mirror_xmit_encode_write(xmit_buf, &xmit_write) != H5FD_MIRROR_XMIT_WRITE_SIZE) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode write"); - } LOG_XMIT_BYTES("write", xmit_buf, H5FD_MIRROR_XMIT_WRITE_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_WRITE_SIZE) < 0) { + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_WRITE_SIZE) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit write"); - } /* Check that our write xmission was received */ - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } /* Send the data to be written */ - if (HDwrite(file->sock_fd, buf, size) < 0) { + if(HDwrite(file->sock_fd, buf, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit data"); - } /* Writer should reply that it got the data and is still okay/ready */ - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } done: + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_write() */ +} /* end H5FD__mirror_write() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_truncate + * Function: H5FD__mirror_truncate * * Purpose: Makes sure that the true file size is the same (or larger) * than the end-of-address. @@ -1867,45 +1880,45 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_truncate(H5FD_t *_file, - hid_t H5_ATTR_UNUSED dxpl_id, - hbool_t H5_ATTR_UNUSED closing) +H5FD__mirror_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, + hbool_t H5_ATTR_UNUSED closing) { - unsigned char xmit_buf[H5FD_MIRROR_XMIT_HEADER_SIZE]; + unsigned char *xmit_buf = NULL; H5FD_mirror_t *file = (H5FD_mirror_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_truncate"); + LOG_OP_CALL(FUNC); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_TRUNCATE; - if (H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) - != H5FD_MIRROR_XMIT_HEADER_SIZE) - { + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); + + if(H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) != H5FD_MIRROR_XMIT_HEADER_SIZE) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode truncate"); - } LOG_XMIT_BYTES("truncate", xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, - "unable to transmit truncate"); - } + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit truncate"); - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } done: + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_mirror_truncate() */ +} /* end H5FD__mirror_truncate() */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_lock + * Function: H5FD__mirror_lock * * Purpose: To place an advisory lock on a file. * The lock type to apply depends on the parameter "rw": @@ -1916,16 +1929,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_lock(H5FD_t *_file, hbool_t rw) +H5FD__mirror_lock(H5FD_t *_file, hbool_t rw) { H5FD_mirror_xmit_lock_t xmit_lock; - unsigned char xmit_buf[H5FD_MIRROR_XMIT_LOCK_SIZE]; + unsigned char *xmit_buf = NULL; H5FD_mirror_t *file = (H5FD_mirror_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT; + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_lock"); + LOG_OP_CALL(FUNC); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_LOCK; @@ -1933,30 +1946,31 @@ H5FD_mirror_lock(H5FD_t *_file, hbool_t rw) xmit_lock.pub = file->xmit; xmit_lock.rw = (uint64_t)rw; - if (H5FD_mirror_xmit_encode_lock(xmit_buf, - (const H5FD_mirror_xmit_lock_t *)&xmit_lock) - != H5FD_MIRROR_XMIT_LOCK_SIZE) - { + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); + + if(H5FD_mirror_xmit_encode_lock(xmit_buf, &xmit_lock) != H5FD_MIRROR_XMIT_LOCK_SIZE) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode lock"); - } LOG_XMIT_BYTES("lock", xmit_buf, H5FD_MIRROR_XMIT_LOCK_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_LOCK_SIZE) < 0) { + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_LOCK_SIZE) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit lock"); - } - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } done: + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value); -} /* end H5FD_mirror_lock */ +} /* end H5FD__mirror_lock */ /*------------------------------------------------------------------------- - * Function: H5FD_mirror_unlock + * Function: H5FD__mirror_unlock * * Purpose: Remove the existing lock on the file. * @@ -1964,38 +1978,40 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_mirror_unlock(H5FD_t *_file) +H5FD__mirror_unlock(H5FD_t *_file) { - unsigned char xmit_buf[H5FD_MIRROR_XMIT_HEADER_SIZE]; + unsigned char *xmit_buf = NULL; H5FD_mirror_t *file = (H5FD_mirror_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT; + FUNC_ENTER_STATIC - LOG_OP_CALL("H5FD_mirror_unlock"); + LOG_OP_CALL(FUNC); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_UNLOCK; - if (H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) - != H5FD_MIRROR_XMIT_HEADER_SIZE) - { + xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); + if(NULL == xmit_buf) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate xmit buffer"); + + if(H5FD_mirror_xmit_encode_header(xmit_buf, &(file->xmit)) != H5FD_MIRROR_XMIT_HEADER_SIZE) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to encode unlock"); - } LOG_XMIT_BYTES("unlock", xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE); - if (HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) { + if(HDwrite(file->sock_fd, xmit_buf, H5FD_MIRROR_XMIT_HEADER_SIZE) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to transmit unlock"); - } - if (H5FD__mirror_verify_reply(file) == FAIL) { + if(H5FD__mirror_verify_reply(file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid reply"); - } done: + if(xmit_buf) + xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); + FUNC_LEAVE_NOAPI(ret_value); -} /* end H5FD_mirror_unlock */ +} /* end H5FD__mirror_unlock */ #endif /* H5_HAVE_MIRROR_VFD */ diff --git a/src/H5FDmirror.h b/src/H5FDmirror.h index fb66b7b..7d15c1b 100644 --- a/src/H5FDmirror.h +++ b/src/H5FDmirror.h @@ -65,297 +65,6 @@ H5_DLL hid_t H5FD_mirror_init(void); H5_DLL herr_t H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_out); H5_DLL herr_t H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa); -/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = - * IPC - Mirror VFD and Remote Worker application. - * = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = - */ - - -/* The maximum allowed size for a receiving buffer when accepting bytes to - * write. Writes larger than this size are performed by multiple accept-write - * steps by the Writer. */ -#define H5FD_MIRROR_DATA_BUFFER_MAX H5_GB /* 1 Gigabyte */ - -#define H5FD_MIRROR_XMIT_CURR_VERSION 1 -#define H5FD_MIRROR_XMIT_MAGIC 0x87F8005B - -#define H5FD_MIRROR_OP_OPEN 1 -#define H5FD_MIRROR_OP_CLOSE 2 -#define H5FD_MIRROR_OP_WRITE 3 -#define H5FD_MIRROR_OP_TRUNCATE 4 -#define H5FD_MIRROR_OP_REPLY 5 -#define H5FD_MIRROR_OP_SET_EOA 6 -#define H5FD_MIRROR_OP_LOCK 7 -#define H5FD_MIRROR_OP_UNLOCK 8 - -#define H5FD_MIRROR_STATUS_OK 0 -#define H5FD_MIRROR_STATUS_ERROR 1 -#define H5FD_MIRROR_STATUS_MESSAGE_MAX 256 /* Dedicated error message size */ - -/* Maximum length of a path/filename string, including the NULL-terminator. - * Must not be smaller than H5FD_SPLITTER_PATH_MAX. */ -#define H5FD_MIRROR_XMIT_FILEPATH_MAX 4097 - -/* Define the exact sizes of the various xmit blobs as sent over the wire. - * This is used to minimize the number of bytes transmitted as well as to - * sanity-check received bytes. - * Any modifications to the xmit structures and/or the encode/decode functions - * must be reflected here. - * */ -#define H5FD_MIRROR_XMIT_HEADER_SIZE 14 -#define H5FD_MIRROR_XMIT_EOA_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 9) -#define H5FD_MIRROR_XMIT_LOCK_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 8) -#define H5FD_MIRROR_XMIT_OPEN_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 20 + H5FD_MIRROR_XMIT_FILEPATH_MAX) -#define H5FD_MIRROR_XMIT_REPLY_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 4 + H5FD_MIRROR_STATUS_MESSAGE_MAX) -#define H5FD_MIRROR_XMIT_WRITE_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 17) - -/* Maximum length of any xmit. */ -#define H5FD_MIRROR_XMIT_BUFFER_MAX MAX2( MAX3(H5FD_MIRROR_XMIT_HEADER_SIZE, \ - H5FD_MIRROR_XMIT_EOA_SIZE, \ - H5FD_MIRROR_XMIT_LOCK_SIZE), \ - MAX3(H5FD_MIRROR_XMIT_OPEN_SIZE, \ - H5FD_MIRROR_XMIT_REPLY_SIZE, \ - H5FD_MIRROR_XMIT_WRITE_SIZE) ) \ - -/* --------------------------------------------------------------------------- - * Structure: H5FD_mirror_xmit_t - * - * Common structure 'header' for all mirror VFD/worker IPC. - * Must be the first component of a derived operation xmit structure, - * such as file-open or write command. - * - * `magic` (uint32_t) - * A "unique" number identifying the structure and endianness of - * transmitting maching. - * Must be set to H5FD_MIRROR_XMIT_MAGIC native to the VFD "sender". - * - * `version` (uint8_t) - * Number used to identify the structure membership. - * Allows sane modifications to this structure in the future. - * Must be set to H5FD_MIRROR_XMIT_CURR_VERSION. - * - * `session_token` (uint32_t) - * A "unique" number identifying the session between VFD sender and - * remote receiver/worker/writer. Exists to help sanity-check. - * - * `xmit_count` (uint32_t) - * Which transmission this is since the session began. - * Used to sanity-check transmission errors. - * First xmit (file-open) must be 0. - * - * `op` (uint8_t) - * Number identifying which operation to perform. - * Corresponds with the extended structure outside of this xmit header. - * Possible values are all defined H5FD_MIRROR_OP_* constants. - * - * --------------------------------------------------------------------------- - */ -typedef struct H5FD_mirror_xmit_t { - uint32_t magic; - uint8_t version; - uint32_t session_token; - uint32_t xmit_count; - uint8_t op; -} H5FD_mirror_xmit_t; - -/* --------------------------------------------------------------------------- - * Structure: H5FD_mirror_xmit_eoa_t - * - * Structure containing eoa-set information from VFD sender. - * - * `pub` (H5FD_mirror_xmit_t) - * Common transmission header, containing session information. - * Must be first. - * - * `type` (uint8_t) - * System-independent alias for H5F[D]_mem_t. - * Specifies datatype to be written. - * - * `eoa_addr` (uint64_t) - * New address for eoa. - * (Natively 'haddr_t', always a 64-bit field) - * - * --------------------------------------------------------------------------- - */ -typedef struct H5FD_mirror_xmit_eoa_t { - H5FD_mirror_xmit_t pub; - uint8_t type; - uint64_t eoa_addr; -} H5FD_mirror_xmit_eoa_t; - -/* --------------------------------------------------------------------------- - * Structure: H5FD_mirror_xmit_lock_t - * - * Structure containing eoa-set information from VFD sender. - * - * `pub` (H5FD_mirror_xmit_t) - * Common transmission header, containing session information. - * Must be first. - * - * `rw` (uint64_t) - * The Read/Write mode flag passed into H5FDlock(). - * (Natively `hbool_t`, an 'int') TODO: native int may be 64-bit? - * - * --------------------------------------------------------------------------- - */ -typedef struct H5FD_mirror_xmit_lock_t { - H5FD_mirror_xmit_t pub; - uint64_t rw; -} H5FD_mirror_xmit_lock_t; - -/* --------------------------------------------------------------------------- - * Structure: H5FD_mirror_xmit_open_t - * - * Structure containing file-open information from the VFD sender. - * - * `pub` (H5FD_mirror_xmit_t) - * Common transmission header, containing session information. - * Must be first. - * - * `flags` (uint32_t) - * VFL-layer file-open flags passed directly to H5FDopen(). - * (Natively 'unsigned [int]') TODO: native int may be 64-bit? - * - * `maxaddr` (uint64_t) - * VFL-layer maximum allowed address space for the file to open passed - * directly to H5FDopen(). - * (Natively 'haddr_t', always a 64-bit field) - * - * `size_t_blob` (uint64_t) - * A number indicating how large a size_t is on the sending system. - * Must be set to (uint64_t)((size_t)(-1)) - * (maximum possible value of size_t, cast to uint64_t). - * The receiving system inspects this value -- if the local (remote) - * size_t is smaller than that of the Sender, issues a warning. - * Not an error, as: - * 1. It is assumed that underlying file systems/drivers have become - * smart enough to handle file sizes that otherwise might be - * constrained. - * 2. The Mirror Writer ingests bytes to write multiple 'slices' if the - * size is greater than H5FD_MIRROR_DATA_BUFFER_MAX, regardless of - * any size_t storage size disparity. - * - * `filename` (char[]) - * String giving the filename and path of file to open. - * - * --------------------------------------------------------------------------- - */ -typedef struct H5FD_mirror_xmit_open_t { - H5FD_mirror_xmit_t pub; - uint32_t flags; - uint64_t maxaddr; - uint64_t size_t_blob; - char filename[H5FD_MIRROR_XMIT_FILEPATH_MAX]; -} H5FD_mirror_xmit_open_t; - -/* --------------------------------------------------------------------------- - * Structure: H5FD_mirror_xmit_reply_t - * - * Structure used by the remote receiver/worker/writer to respond to - * a command from the VFD sender. - * - * `pub` (H5FD_mirror_xmit_t) - * Common transmission header, containing session information. - * Must be first. - * - * `status` (uint32_t) - * Number indicating whether the command was successful or if an - * occured. - * Allowed values are H5FD_MIRROR_STATUS_OK and - * H5FD_MIRROR_STATUS_ERROR. - * - * `message` (char[]) - * Error message. Populated if and only if there was a problem. - * It is possible that a message may reach the end of the alloted - * space without a NULL terminator -- the onus is on the programmer to - * handle this situation. - * - * --------------------------------------------------------------------------- - */ -typedef struct H5FD_mirror_xmit_reply_t { - H5FD_mirror_xmit_t pub; - uint32_t status; - char message[H5FD_MIRROR_STATUS_MESSAGE_MAX]; -} H5FD_mirror_xmit_reply_t; - -/* --------------------------------------------------------------------------- - * Structure: H5FD_mirror_xmit_write_t - * - * Structure containing data-write information from VFD sender. - * - * The data to be written is transmitted in subsequent, packets - * and may be broken up into more than one transmission buffer. - * The VFD sender and remote receiver/worker/writer must coordinate - * the receipt of data. - * - * `pub` (H5FD_mirror_xmit_t) - * Common transmission header, containing session information. - * Must be first. - * - * `type` (uint8_t) - * Specifies datatype to be written. - * (Natively 'H5FD_mem_t', an enumerated type in H5Fpublic.h) - * - * `offset` (uint64_t) - * Start location of write in file. - * (Natively 'haddr_t', always a 64-bit field) - * - * `size` (uint64_t) - * Size of the data to be written, in bytes. - * (Natively 'size_t', accommodate the largest possible as 64-bits) - * - * --------------------------------------------------------------------------- - */ -typedef struct H5FD_mirror_xmit_write_t { - H5FD_mirror_xmit_t pub; - uint8_t type; - uint64_t offset; - uint64_t size; -} H5FD_mirror_xmit_write_t; - - - -/* Encode/decode routines are required to "pack" the xmit data into a known - * byte format for transmission over the wire. - * - * All component numbers must be stored in "network" word order (Big-Endian). - * - * All components must be packed in the order given in the structure definition. - * - * All components must be packed with zero padding between. - */ - -H5_DLL size_t H5FD__mirror_xmit_decode_uint16(uint16_t *out, const unsigned char *buf); -H5_DLL size_t H5FD__mirror_xmit_decode_uint32(uint32_t *out, const unsigned char *buf); -H5_DLL size_t H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *buf); -H5_DLL size_t H5FD__mirror_xmit_decode_uint8(uint8_t *out, const unsigned char *buf); -H5_DLL size_t H5FD__mirror_xmit_encode_uint16(unsigned char *dest, uint16_t v); -H5_DLL size_t H5FD__mirror_xmit_encode_uint32(unsigned char *dest, uint32_t v); -H5_DLL size_t H5FD__mirror_xmit_encode_uint64(unsigned char *dest, uint64_t v); -H5_DLL size_t H5FD__mirror_xmit_encode_uint8(unsigned char *dest, uint8_t v); - -H5_DLL size_t H5FD_mirror_xmit_decode_header(H5FD_mirror_xmit_t *out, const unsigned char *buf); -H5_DLL size_t H5FD_mirror_xmit_decode_lock(H5FD_mirror_xmit_lock_t *out, const unsigned char *buf); -H5_DLL size_t H5FD_mirror_xmit_decode_open(H5FD_mirror_xmit_open_t *out, const unsigned char *buf); -H5_DLL size_t H5FD_mirror_xmit_decode_reply(H5FD_mirror_xmit_reply_t *out, const unsigned char *buf); -H5_DLL size_t H5FD_mirror_xmit_decode_set_eoa(H5FD_mirror_xmit_eoa_t *out, const unsigned char *buf); -H5_DLL size_t H5FD_mirror_xmit_decode_write(H5FD_mirror_xmit_write_t *out, const unsigned char *buf); - -H5_DLL size_t H5FD_mirror_xmit_encode_header(unsigned char *dest, const H5FD_mirror_xmit_t *x); -H5_DLL size_t H5FD_mirror_xmit_encode_lock(unsigned char *dest, const H5FD_mirror_xmit_lock_t *x); -H5_DLL size_t H5FD_mirror_xmit_encode_open(unsigned char *dest, const H5FD_mirror_xmit_open_t *x); -H5_DLL size_t H5FD_mirror_xmit_encode_reply(unsigned char *dest, const H5FD_mirror_xmit_reply_t *x); -H5_DLL size_t H5FD_mirror_xmit_encode_set_eoa(unsigned char *dest, const H5FD_mirror_xmit_eoa_t *x); -H5_DLL size_t H5FD_mirror_xmit_encode_write(unsigned char *dest, const H5FD_mirror_xmit_write_t *x); - -H5_DLL hbool_t H5FD_mirror_xmit_is_close(const H5FD_mirror_xmit_t *xmit); -H5_DLL hbool_t H5FD_mirror_xmit_is_lock(const H5FD_mirror_xmit_lock_t *xmit); -H5_DLL hbool_t H5FD_mirror_xmit_is_open(const H5FD_mirror_xmit_open_t *xmit); -H5_DLL hbool_t H5FD_mirror_xmit_is_reply(const H5FD_mirror_xmit_reply_t *xmit); -H5_DLL hbool_t H5FD_mirror_xmit_is_set_eoa(const H5FD_mirror_xmit_eoa_t *xmit); -H5_DLL hbool_t H5FD_mirror_xmit_is_write(const H5FD_mirror_xmit_write_t *xmit); -H5_DLL hbool_t H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit); - #ifdef __cplusplus } #endif @@ -368,4 +77,3 @@ H5_DLL hbool_t H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit); #endif /* H5FDmirror_H */ - diff --git a/src/H5FDmirror_priv.h b/src/H5FDmirror_priv.h new file mode 100644 index 0000000..dc15441 --- /dev/null +++ b/src/H5FDmirror_priv.h @@ -0,0 +1,323 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Public, shared definitions for Mirror VFD & remote Writer. + */ + +#ifndef H5FDmirror_priv_H +#define H5FDmirror_priv_H + +#ifdef H5_HAVE_MIRROR_VFD + +#ifdef __cplusplus +extern "C" { +#endif + +/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = + * IPC - Mirror VFD and Remote Worker application. + * = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = + */ + +/* The maximum allowed size for a receiving buffer when accepting bytes to + * write. Writes larger than this size are performed by multiple accept-write + * steps by the Writer. */ +#define H5FD_MIRROR_DATA_BUFFER_MAX H5_GB /* 1 Gigabyte */ + +#define H5FD_MIRROR_XMIT_CURR_VERSION 1 +#define H5FD_MIRROR_XMIT_MAGIC 0x87F8005B + +#define H5FD_MIRROR_OP_OPEN 1 +#define H5FD_MIRROR_OP_CLOSE 2 +#define H5FD_MIRROR_OP_WRITE 3 +#define H5FD_MIRROR_OP_TRUNCATE 4 +#define H5FD_MIRROR_OP_REPLY 5 +#define H5FD_MIRROR_OP_SET_EOA 6 +#define H5FD_MIRROR_OP_LOCK 7 +#define H5FD_MIRROR_OP_UNLOCK 8 + +#define H5FD_MIRROR_STATUS_OK 0 +#define H5FD_MIRROR_STATUS_ERROR 1 +#define H5FD_MIRROR_STATUS_MESSAGE_MAX 256 /* Dedicated error message size */ + +/* Maximum length of a path/filename string, including the NULL-terminator. + * Must not be smaller than H5FD_SPLITTER_PATH_MAX. */ +#define H5FD_MIRROR_XMIT_FILEPATH_MAX 4097 + +/* Define the exact sizes of the various xmit blobs as sent over the wire. + * This is used to minimize the number of bytes transmitted as well as to + * sanity-check received bytes. + * Any modifications to the xmit structures and/or the encode/decode functions + * must be reflected here. + * */ +#define H5FD_MIRROR_XMIT_HEADER_SIZE 14 +#define H5FD_MIRROR_XMIT_EOA_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 9) +#define H5FD_MIRROR_XMIT_LOCK_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 8) +#define H5FD_MIRROR_XMIT_OPEN_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 20 + H5FD_MIRROR_XMIT_FILEPATH_MAX) +#define H5FD_MIRROR_XMIT_REPLY_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 4 + H5FD_MIRROR_STATUS_MESSAGE_MAX) +#define H5FD_MIRROR_XMIT_WRITE_SIZE (H5FD_MIRROR_XMIT_HEADER_SIZE + 17) + +/* Maximum length of any xmit. */ +#define H5FD_MIRROR_XMIT_BUFFER_MAX MAX2( MAX3(H5FD_MIRROR_XMIT_HEADER_SIZE, \ + H5FD_MIRROR_XMIT_EOA_SIZE, \ + H5FD_MIRROR_XMIT_LOCK_SIZE), \ + MAX3(H5FD_MIRROR_XMIT_OPEN_SIZE, \ + H5FD_MIRROR_XMIT_REPLY_SIZE, \ + H5FD_MIRROR_XMIT_WRITE_SIZE) ) \ + +/* --------------------------------------------------------------------------- + * Structure: H5FD_mirror_xmit_t + * + * Common structure 'header' for all mirror VFD/worker IPC. + * Must be the first component of a derived operation xmit structure, + * such as file-open or write command. + * + * `magic` (uint32_t) + * A "unique" number identifying the structure and endianness of + * transmitting maching. + * Must be set to H5FD_MIRROR_XMIT_MAGIC native to the VFD "sender". + * + * `version` (uint8_t) + * Number used to identify the structure membership. + * Allows sane modifications to this structure in the future. + * Must be set to H5FD_MIRROR_XMIT_CURR_VERSION. + * + * `session_token` (uint32_t) + * A "unique" number identifying the session between VFD sender and + * remote receiver/worker/writer. Exists to help sanity-check. + * + * `xmit_count` (uint32_t) + * Which transmission this is since the session began. + * Used to sanity-check transmission errors. + * First xmit (file-open) must be 0. + * + * `op` (uint8_t) + * Number identifying which operation to perform. + * Corresponds with the extended structure outside of this xmit header. + * Possible values are all defined H5FD_MIRROR_OP_* constants. + * + * --------------------------------------------------------------------------- + */ +typedef struct H5FD_mirror_xmit_t { + uint32_t magic; + uint8_t version; + uint32_t session_token; + uint32_t xmit_count; + uint8_t op; +} H5FD_mirror_xmit_t; + +/* --------------------------------------------------------------------------- + * Structure: H5FD_mirror_xmit_eoa_t + * + * Structure containing eoa-set information from VFD sender. + * + * `pub` (H5FD_mirror_xmit_t) + * Common transmission header, containing session information. + * Must be first. + * + * `type` (uint8_t) + * System-independent alias for H5F[D]_mem_t. + * Specifies datatype to be written. + * + * `eoa_addr` (uint64_t) + * New address for eoa. + * (Natively 'haddr_t', always a 64-bit field) + * + * --------------------------------------------------------------------------- + */ +typedef struct H5FD_mirror_xmit_eoa_t { + H5FD_mirror_xmit_t pub; + uint8_t type; + uint64_t eoa_addr; +} H5FD_mirror_xmit_eoa_t; + +/* --------------------------------------------------------------------------- + * Structure: H5FD_mirror_xmit_lock_t + * + * Structure containing eoa-set information from VFD sender. + * + * `pub` (H5FD_mirror_xmit_t) + * Common transmission header, containing session information. + * Must be first. + * + * `rw` (uint64_t) + * The Read/Write mode flag passed into H5FDlock(). + * (Natively `hbool_t`, an 'int') TODO: native int may be 64-bit? + * + * --------------------------------------------------------------------------- + */ +typedef struct H5FD_mirror_xmit_lock_t { + H5FD_mirror_xmit_t pub; + uint64_t rw; +} H5FD_mirror_xmit_lock_t; + +/* --------------------------------------------------------------------------- + * Structure: H5FD_mirror_xmit_open_t + * + * Structure containing file-open information from the VFD sender. + * + * `pub` (H5FD_mirror_xmit_t) + * Common transmission header, containing session information. + * Must be first. + * + * `flags` (uint32_t) + * VFL-layer file-open flags passed directly to H5FDopen(). + * (Natively 'unsigned [int]') TODO: native int may be 64-bit? + * + * `maxaddr` (uint64_t) + * VFL-layer maximum allowed address space for the file to open passed + * directly to H5FDopen(). + * (Natively 'haddr_t', always a 64-bit field) + * + * `size_t_blob` (uint64_t) + * A number indicating how large a size_t is on the sending system. + * Must be set to (uint64_t)((size_t)(-1)) + * (maximum possible value of size_t, cast to uint64_t). + * The receiving system inspects this value -- if the local (remote) + * size_t is smaller than that of the Sender, issues a warning. + * Not an error, as: + * 1. It is assumed that underlying file systems/drivers have become + * smart enough to handle file sizes that otherwise might be + * constrained. + * 2. The Mirror Writer ingests bytes to write multiple 'slices' if the + * size is greater than H5FD_MIRROR_DATA_BUFFER_MAX, regardless of + * any size_t storage size disparity. + * + * `filename` (char[]) + * String giving the filename and path of file to open. + * + * --------------------------------------------------------------------------- + */ +typedef struct H5FD_mirror_xmit_open_t { + H5FD_mirror_xmit_t pub; + uint32_t flags; + uint64_t maxaddr; + uint64_t size_t_blob; + char filename[H5FD_MIRROR_XMIT_FILEPATH_MAX]; +} H5FD_mirror_xmit_open_t; + +/* --------------------------------------------------------------------------- + * Structure: H5FD_mirror_xmit_reply_t + * + * Structure used by the remote receiver/worker/writer to respond to + * a command from the VFD sender. + * + * `pub` (H5FD_mirror_xmit_t) + * Common transmission header, containing session information. + * Must be first. + * + * `status` (uint32_t) + * Number indicating whether the command was successful or if an + * occured. + * Allowed values are H5FD_MIRROR_STATUS_OK and + * H5FD_MIRROR_STATUS_ERROR. + * + * `message` (char[]) + * Error message. Populated if and only if there was a problem. + * It is possible that a message may reach the end of the alloted + * space without a NULL terminator -- the onus is on the programmer to + * handle this situation. + * + * --------------------------------------------------------------------------- + */ +typedef struct H5FD_mirror_xmit_reply_t { + H5FD_mirror_xmit_t pub; + uint32_t status; + char message[H5FD_MIRROR_STATUS_MESSAGE_MAX]; +} H5FD_mirror_xmit_reply_t; + +/* --------------------------------------------------------------------------- + * Structure: H5FD_mirror_xmit_write_t + * + * Structure containing data-write information from VFD sender. + * + * The data to be written is transmitted in subsequent, packets + * and may be broken up into more than one transmission buffer. + * The VFD sender and remote receiver/worker/writer must coordinate + * the receipt of data. + * + * `pub` (H5FD_mirror_xmit_t) + * Common transmission header, containing session information. + * Must be first. + * + * `type` (uint8_t) + * Specifies datatype to be written. + * (Natively 'H5FD_mem_t', an enumerated type in H5Fpublic.h) + * + * `offset` (uint64_t) + * Start location of write in file. + * (Natively 'haddr_t', always a 64-bit field) + * + * `size` (uint64_t) + * Size of the data to be written, in bytes. + * (Natively 'size_t', accommodate the largest possible as 64-bits) + * + * --------------------------------------------------------------------------- + */ +typedef struct H5FD_mirror_xmit_write_t { + H5FD_mirror_xmit_t pub; + uint8_t type; + uint64_t offset; + uint64_t size; +} H5FD_mirror_xmit_write_t; + + + +/* Encode/decode routines are required to "pack" the xmit data into a known + * byte format for transmission over the wire. + * + * All component numbers must be stored in "network" word order (Big-Endian). + * + * All components must be packed in the order given in the structure definition. + * + * All components must be packed with zero padding between. + */ + +H5_DLL size_t H5FD__mirror_xmit_decode_uint16(uint16_t *out, const unsigned char *buf); +H5_DLL size_t H5FD__mirror_xmit_decode_uint32(uint32_t *out, const unsigned char *buf); +H5_DLL size_t H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *buf); +H5_DLL size_t H5FD__mirror_xmit_decode_uint8(uint8_t *out, const unsigned char *buf); +H5_DLL size_t H5FD__mirror_xmit_encode_uint16(unsigned char *dest, uint16_t v); +H5_DLL size_t H5FD__mirror_xmit_encode_uint32(unsigned char *dest, uint32_t v); +H5_DLL size_t H5FD__mirror_xmit_encode_uint64(unsigned char *dest, uint64_t v); +H5_DLL size_t H5FD__mirror_xmit_encode_uint8(unsigned char *dest, uint8_t v); + +H5_DLL size_t H5FD_mirror_xmit_decode_header(H5FD_mirror_xmit_t *out, const unsigned char *buf); +H5_DLL size_t H5FD_mirror_xmit_decode_lock(H5FD_mirror_xmit_lock_t *out, const unsigned char *buf); +H5_DLL size_t H5FD_mirror_xmit_decode_open(H5FD_mirror_xmit_open_t *out, const unsigned char *buf); +H5_DLL size_t H5FD_mirror_xmit_decode_reply(H5FD_mirror_xmit_reply_t *out, const unsigned char *buf); +H5_DLL size_t H5FD_mirror_xmit_decode_set_eoa(H5FD_mirror_xmit_eoa_t *out, const unsigned char *buf); +H5_DLL size_t H5FD_mirror_xmit_decode_write(H5FD_mirror_xmit_write_t *out, const unsigned char *buf); + +H5_DLL size_t H5FD_mirror_xmit_encode_header(unsigned char *dest, const H5FD_mirror_xmit_t *x); +H5_DLL size_t H5FD_mirror_xmit_encode_lock(unsigned char *dest, const H5FD_mirror_xmit_lock_t *x); +H5_DLL size_t H5FD_mirror_xmit_encode_open(unsigned char *dest, const H5FD_mirror_xmit_open_t *x); +H5_DLL size_t H5FD_mirror_xmit_encode_reply(unsigned char *dest, const H5FD_mirror_xmit_reply_t *x); +H5_DLL size_t H5FD_mirror_xmit_encode_set_eoa(unsigned char *dest, const H5FD_mirror_xmit_eoa_t *x); +H5_DLL size_t H5FD_mirror_xmit_encode_write(unsigned char *dest, const H5FD_mirror_xmit_write_t *x); + +H5_DLL hbool_t H5FD_mirror_xmit_is_close(const H5FD_mirror_xmit_t *xmit); +H5_DLL hbool_t H5FD_mirror_xmit_is_lock(const H5FD_mirror_xmit_lock_t *xmit); +H5_DLL hbool_t H5FD_mirror_xmit_is_open(const H5FD_mirror_xmit_open_t *xmit); +H5_DLL hbool_t H5FD_mirror_xmit_is_reply(const H5FD_mirror_xmit_reply_t *xmit); +H5_DLL hbool_t H5FD_mirror_xmit_is_set_eoa(const H5FD_mirror_xmit_eoa_t *xmit); +H5_DLL hbool_t H5FD_mirror_xmit_is_write(const H5FD_mirror_xmit_write_t *xmit); +H5_DLL hbool_t H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit); + +#ifdef __cplusplus +} +#endif + +#endif /* H5_HAVE_MIRROR_VFD */ + +#endif /* H5FDmirror_priv_H */ + diff --git a/src/H5FDmodule.h b/src/H5FDmodule.h index ea1a9fd..11686be 100644 --- a/src/H5FDmodule.h +++ b/src/H5FDmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index b2959a5..43fa340 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, January 30, 2004 * * Purpose: Common routines for all MPI-based VFL drivers. @@ -43,8 +43,6 @@ * Programmer: Quincey Koziol * Friday, January 30, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -82,8 +80,6 @@ done: * Programmer: Quincey Koziol * Friday, January 30, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -120,8 +116,6 @@ done: * Programmer: Quincey Koziol * Friday, January 30, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ MPI_Comm @@ -158,8 +152,6 @@ done: * Programmer: John Mainzer * 4/4/17 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -197,13 +189,6 @@ done: * Programmer: Unknown * January 30, 1998 * - * Modifications: - * Robb Matzke, 1999-04-23 - * An error is reported for address overflows. The ADDR output - * argument is optional. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ haddr_t @@ -235,16 +220,6 @@ H5FD_mpi_MPIOff_to_haddr(MPI_Offset mpi_off) * Programmer: Unknown * January 30, 1998 * - * Modifications: - * Robb Matzke, 1999-04-23 - * An error is reported for address overflows. The ADDR output - * argument is optional. - * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ herr_t @@ -290,9 +265,6 @@ H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/) * Programmer: rky * 19981207 * - * Modifications: - * Robb Matzke, 1999-08-09 - * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ herr_t @@ -345,9 +317,6 @@ done: * Programmer: rky * 19981207 * - * Modifications: - * Robb Matzke, 1999-08-09 - * Modified to work with the virtual file layer. *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5FDmpi.h b/src/H5FDmpi.h index 2d62c79..da9f59b 100644 --- a/src/H5FDmpi.h +++ b/src/H5FDmpi.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, January 30, 2004 * * Purpose: The public header file for common items for all MPI VFL drivers diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 3d2e0cf..9475093 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * * Purpose: This is the MPI-2 I/O driver. diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h index 6ee0a1a..9d02153 100644 --- a/src/H5FDmpio.h +++ b/src/H5FDmpio.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the mpio driver. diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 72f4da5..fbca8e4 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 10, 1997 * * Purpose: Implements a file driver which dispatches I/O requests to @@ -1234,14 +1234,6 @@ H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * If the TYPE is H5FD_MEM_DEFAULT, simply find the biggest - * EOA of individual file because the EOA for the whole file - * is meaningless. - * *------------------------------------------------------------------------- */ static haddr_t @@ -1334,17 +1326,6 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 10 January 2007 - * EOA for the whole file is discarded because it's meaningless - * for MULTI file. This function only sets eoa for individual - * file. - * - * Raymond Lu - * 21 June 2011 - * Backward compatibility of EOA. Please the comment in the - * code. *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h index 0bd5718..b3c3c62 100644 --- a/src/H5FDmulti.h +++ b/src/H5FDmulti.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the "multi" driver. diff --git a/src/H5FDpkg.h b/src/H5FDpkg.h index 22b5d17..8ffffd1 100644 --- a/src/H5FDpkg.h +++ b/src/H5FDpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 3, 2008 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 2e3d3ce..7d5b66d 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, July 26, 1999 */ #ifndef _H5FDprivate_H diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index 61bf212..7297cf8 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, July 26, 1999 */ #ifndef _H5FDpublic_H diff --git a/src/H5FDros3.c b/src/H5FDros3.c index d99272c..38e34a0 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -13,7 +13,7 @@ /* * Read-Only S3 Virtual File Driver (VFD) * - * Programmer: Jacob Smith + * Programmer: Jacob Smith * 2017-10-13 * * Purpose: @@ -212,66 +212,67 @@ typedef struct H5FD_ros3_t { * Only included if it may be used -- ROS3 VFD is enabled. * */ -#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) +#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) #define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) /* Prototypes */ -static herr_t H5FD_ros3_term(void); -static void *H5FD_ros3_fapl_get(H5FD_t *_file); -static void *H5FD_ros3_fapl_copy(const void *_old_fa); -static herr_t H5FD_ros3_fapl_free(void *_fa); -static H5FD_t *H5FD_ros3_open(const char *name, unsigned flags, hid_t fapl_id, +static herr_t H5FD__ros3_term(void); +static void *H5FD__ros3_fapl_get(H5FD_t *_file); +static void *H5FD__ros3_fapl_copy(const void *_old_fa); +static herr_t H5FD__ros3_fapl_free(void *_fa); +static H5FD_t *H5FD__ros3_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_ros3_close(H5FD_t *_file); -static int H5FD_ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_ros3_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_ros3_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_ros3_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_ros3_get_handle(H5FD_t *_file, hid_t fapl, +static herr_t H5FD__ros3_close(H5FD_t *_file); +static int H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__ros3_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__ros3_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__ros3_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__ros3_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD__ros3_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_ros3_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD__ros3_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_ros3_truncate(H5FD_t *_file, hid_t dxpl_id, +static herr_t H5FD__ros3_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_ros3_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_ros3_unlock(H5FD_t *_file); -static herr_t H5FD_ros3_validate_config(const H5FD_ros3_fapl_t * fa); +static herr_t H5FD__ros3_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__ros3_unlock(H5FD_t *_file); + +static herr_t H5FD__ros3_validate_config(const H5FD_ros3_fapl_t * fa); static const H5FD_class_t H5FD_ros3_g = { "ros3", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_ros3_term, /* terminate */ + H5FD__ros3_term, /* terminate */ NULL, /* sb_size */ NULL, /* sb_encode */ NULL, /* sb_decode */ sizeof(H5FD_ros3_fapl_t), /* fapl_size */ - H5FD_ros3_fapl_get, /* fapl_get */ - H5FD_ros3_fapl_copy, /* fapl_copy */ - H5FD_ros3_fapl_free, /* fapl_free */ + H5FD__ros3_fapl_get, /* fapl_get */ + H5FD__ros3_fapl_copy, /* fapl_copy */ + H5FD__ros3_fapl_free, /* fapl_free */ 0, /* dxpl_size */ NULL, /* dxpl_copy */ NULL, /* dxpl_free */ - H5FD_ros3_open, /* open */ - H5FD_ros3_close, /* close */ - H5FD_ros3_cmp, /* cmp */ - H5FD_ros3_query, /* query */ + H5FD__ros3_open, /* open */ + H5FD__ros3_close, /* close */ + H5FD__ros3_cmp, /* cmp */ + H5FD__ros3_query, /* query */ NULL, /* get_type_map */ NULL, /* alloc */ NULL, /* free */ - H5FD_ros3_get_eoa, /* get_eoa */ - H5FD_ros3_set_eoa, /* set_eoa */ - H5FD_ros3_get_eof, /* get_eof */ - H5FD_ros3_get_handle, /* get_handle */ - H5FD_ros3_read, /* read */ - H5FD_ros3_write, /* write */ + H5FD__ros3_get_eoa, /* get_eoa */ + H5FD__ros3_set_eoa, /* set_eoa */ + H5FD__ros3_get_eof, /* get_eof */ + H5FD__ros3_get_handle, /* get_handle */ + H5FD__ros3_read, /* read */ + H5FD__ros3_write, /* write */ NULL, /* flush */ - H5FD_ros3_truncate, /* truncate */ - H5FD_ros3_lock, /* lock */ - H5FD_ros3_unlock, /* unlock */ + H5FD__ros3_truncate, /* truncate */ + H5FD__ros3_lock, /* lock */ + H5FD__ros3_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -297,14 +298,11 @@ H5FD__init_package(void) FUNC_ENTER_STATIC - if (H5FD_ros3_init() < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, - "unable to initialize ros3 VFD") - } + if(H5FD_ros3_init() < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize ros3 VFD") done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD__init_package() */ @@ -335,7 +333,7 @@ H5FD_ros3_init(void) HDfprintf(stdout, "H5FD_ros3_init() called.\n"); #endif - if (H5I_VFL != H5I_get_type(H5FD_ROS3_g)) + if(H5I_VFL != H5I_get_type(H5FD_ROS3_g)) H5FD_ROS3_g = H5FD_register(&H5FD_ros3_g, sizeof(H5FD_class_t), FALSE); #if ROS3_STATS @@ -343,6 +341,7 @@ H5FD_ros3_init(void) */ for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) { unsigned long long value = 0; + ROS3_STATS_POW(bin_i, &value) ros3_stats_boundaries[bin_i] = value; } @@ -353,12 +352,11 @@ H5FD_ros3_init(void) done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD_ros3_init() */ /*--------------------------------------------------------------------------- - * Function: H5FD_ros3_term + * Function: H5FD__ros3_term * * Purpose: Shut down the VFD * @@ -369,20 +367,19 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_term(void) +H5FD__ros3_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_term() called.\n"); + HDfprintf(stdout, "H5FD__ros3_term() called.\n"); #endif /* Reset VFL ID */ H5FD_ROS3_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) - -} /* end H5FD_ros3_term() */ +} /* end H5FD__ros3_term() */ /*------------------------------------------------------------------------- @@ -401,8 +398,7 @@ H5FD_ros3_term(void) *------------------------------------------------------------------------- */ herr_t -H5Pset_fapl_ros3(hid_t fapl_id, - H5FD_ros3_fapl_t *fa) +H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa) { H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = FAIL; @@ -417,25 +413,21 @@ H5Pset_fapl_ros3(hid_t fapl_id, #endif plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (plist == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, \ - "not a file access property list") - } + if(plist == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if (FAIL == H5FD_ros3_validate_config(fa)) { + if(FAIL == H5FD__ros3_validate_config(fa)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid ros3 config") - } ret_value = H5P_set_driver(plist, H5FD_ROS3, (void *)fa); done: FUNC_LEAVE_API(ret_value) - } /* end H5Pset_fapl_ros3() */ /*------------------------------------------------------------------------- - * Function: H5FD_ros3_validate_config() + * Function: H5FD__ros3_validate_config() * * Purpose: Test to see if the supplied instance of H5FD_ros3_fapl_t * contains internally consistant data. Return SUCCEED if so, @@ -455,34 +447,25 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_validate_config(const H5FD_ros3_fapl_t * fa) +H5FD__ros3_validate_config(const H5FD_ros3_fapl_t * fa) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(fa != NULL); - if ( fa->version != H5FD_CURR_ROS3_FAPL_T_VERSION ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Unknown H5FD_ros3_fapl_t version"); - } + if(fa->version != H5FD_CURR_ROS3_FAPL_T_VERSION) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown H5FD_ros3_fapl_t version"); - /* if set to authenticate, region and id cannot be empty strings - */ - if (fa->authenticate == TRUE) { - if ((fa->aws_region[0] == '\0') || - (fa->secret_id[0] == '\0')) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Inconsistent authentication information"); - } - } + /* if set to authenticate, region and id cannot be empty strings */ + if(fa->authenticate == TRUE) + if((fa->aws_region[0] == '\0') || (fa->secret_id[0] == '\0')) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Inconsistent authentication information"); done: FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_validate_config() */ +} /* end H5FD__ros3_validate_config() */ /*------------------------------------------------------------------------- @@ -498,13 +481,10 @@ done: * Programmer: John Mainzer * 9/10/17 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5Pget_fapl_ros3(hid_t fapl_id, - H5FD_ros3_fapl_t *fa_out) +H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_out) { const H5FD_ros3_fapl_t *fa = NULL; H5P_genplist_t *plist = NULL; @@ -517,35 +497,30 @@ H5Pget_fapl_ros3(hid_t fapl_id, HDfprintf(stdout, "H5Pget_fapl_ros3() called.\n"); #endif - if (fa_out == NULL) { + if(fa_out == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL") - } plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (plist == NULL) { + if(plist == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - } - if (H5FD_ROS3 != H5P_peek_driver(plist)) { + if(H5FD_ROS3 != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - } fa = (const H5FD_ros3_fapl_t *)H5P_peek_driver_info(plist); - if (fa == NULL) { + if(fa == NULL) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") - } /* Copy the ros3 fapl data out */ HDmemcpy(fa_out, fa, sizeof(H5FD_ros3_fapl_t)); done: FUNC_LEAVE_API(ret_value) - } /* end H5Pget_fapl_ros3() */ /*------------------------------------------------------------------------- - * Function: H5FD_ros3_fapl_get + * Function: H5FD__ros3_fapl_get * * Purpose: Gets a file access property list which could be used to * create an identical file. @@ -557,24 +532,20 @@ done: * Programmer: John Mainzer * 9/8/17 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_ros3_fapl_get(H5FD_t *_file) +H5FD__ros3_fapl_get(H5FD_t *_file) { H5FD_ros3_t *file = (H5FD_ros3_t*)_file; H5FD_ros3_fapl_t *fa = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC fa = (H5FD_ros3_fapl_t *)H5MM_calloc(sizeof(H5FD_ros3_fapl_t)); - if (fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed") - } + if(fa == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the fields of the structure */ HDmemcpy(fa, &(file->fa), sizeof(H5FD_ros3_fapl_t)); @@ -583,18 +554,16 @@ H5FD_ros3_fapl_get(H5FD_t *_file) ret_value = fa; done: - if (ret_value == NULL) { - if (fa != NULL) { + if(ret_value == NULL) + if(fa != NULL) H5MM_xfree(fa); - } - } - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_ros3_fapl_get() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__ros3_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD_ros3_fapl_copy + * Function: H5FD__ros3_fapl_copy * * Purpose: Copies the ros3-specific file access properties. * @@ -605,41 +574,35 @@ done: * Programmer: John Mainzer * 9/8/17 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FD_ros3_fapl_copy(const void *_old_fa) +H5FD__ros3_fapl_copy(const void *_old_fa) { const H5FD_ros3_fapl_t *old_fa = (const H5FD_ros3_fapl_t*)_old_fa; H5FD_ros3_fapl_t *new_fa = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC new_fa = (H5FD_ros3_fapl_t *)H5MM_malloc(sizeof(H5FD_ros3_fapl_t)); - if (new_fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed"); - } + if(new_fa == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); HDmemcpy(new_fa, old_fa, sizeof(H5FD_ros3_fapl_t)); ret_value = new_fa; done: - if (ret_value == NULL) { - if (new_fa != NULL) { + if(ret_value == NULL) + if(new_fa != NULL) H5MM_xfree(new_fa); - } - } - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_ros3_fapl_copy() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD__ros3_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5FD_ros3_fapl_free + * Function: H5FD__ros3_fapl_free * * Purpose: Frees the ros3-specific file access properties. * @@ -648,27 +611,23 @@ done: * Programmer: John Mainzer * 9/8/17 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_fapl_free(void *_fa) +H5FD__ros3_fapl_free(void *_fa) { H5FD_ros3_fapl_t *fa = (H5FD_ros3_fapl_t*)_fa; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(fa != NULL); /* sanity check */ H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) - -} /* end H5FD_ros3_fapl_free() */ +} /* end H5FD__ros3_fapl_free() */ #if ROS3_STATS - /*---------------------------------------------------------------------------- * * Function: ros3_reset_stats() @@ -696,18 +655,16 @@ ros3_reset_stats(H5FD_ros3_t *file) unsigned i = 0; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG HDprintf("ros3_reset_stats() called\n"); #endif - if (file == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file was null"); - } + if(file == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null"); - for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { + for(i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { file->raw[i].bytes = 0; file->raw[i].count = 0; file->raw[i].min = (unsigned long long)ROS3_STATS_STARTING_MIN; @@ -721,15 +678,13 @@ ros3_reset_stats(H5FD_ros3_t *file) done: FUNC_LEAVE_NOAPI(ret_value); - } /* end ros3_reset_stats() */ - #endif /* ROS3_STATS */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_open() + * Function: H5FD__ros3_open() * * Purpose: * @@ -759,11 +714,7 @@ done: *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_ros3_open( - const char *url, - unsigned flags, - hid_t fapl_id, - haddr_t maxaddr) +H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_ros3_t *file = NULL; struct tm *now = NULL; @@ -773,117 +724,89 @@ H5FD_ros3_open( H5FD_ros3_fapl_t fa; H5FD_t *ret_value = NULL; - - - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_open() called.\n"); + HDfprintf(stdout, "H5FD__ros3_open() called.\n"); #endif /* Sanity check on file offsets */ HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t)); /* Check arguments */ - if (!url || !*url) + if(!url || !*url) 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") - if (flags != H5F_ACC_RDONLY) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, - "only Read-Only access allowed") + if(flags != H5F_ACC_RDONLY) + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, "only Read-Only access allowed") - if (FAIL == H5Pget_fapl_ros3(fapl_id, &fa)) { + if(FAIL == H5Pget_fapl_ros3(fapl_id, &fa)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't get property list") - } - if (CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "unable to initialize curl global (placeholder flags)") - } + if(CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to initialize curl global (placeholder flags)") /* open file; procedure depends on whether or not the fapl instructs to * authenticate requests or not. */ - if (fa.authenticate == TRUE) { + if(fa.authenticate == TRUE) { /* compute signing key (part of AWS/S3 REST API) * can be re-used by user/key for 7 days after creation. * find way to re-use/share */ now = gmnow(); HDassert( now != NULL ); - if (ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "problem while writing iso8601 timestamp") - } - if (FAIL == H5FD_s3comms_signing_key(signing_key, - (const char *)fa.secret_key, - (const char *)fa.aws_region, - (const char *)iso8601now) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "problem while computing signing key") - } - - handle = H5FD_s3comms_s3r_open( - url, - (const char *)fa.aws_region, - (const char *)fa.secret_id, - (const unsigned char *)signing_key); - } else { + if(ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem while writing iso8601 timestamp") + if(FAIL == H5FD_s3comms_signing_key(signing_key, (const char *)fa.secret_key, + (const char *)fa.aws_region, (const char *)iso8601now)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem while computing signing key") + + handle = H5FD_s3comms_s3r_open( url, (const char *)fa.aws_region, + (const char *)fa.secret_id, (const unsigned char *)signing_key); + } + else handle = H5FD_s3comms_s3r_open(url, NULL, NULL, NULL); - } /* if/else should authenticate */ - if (handle == NULL) { + if(handle == NULL) /* If we want to check CURL's say on the matter in a controlled * fashion, this is the place to do it, but would need to make a * few minor changes to s3comms `s3r_t` and `s3r_read()`. */ HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "could not open"); - } - /* create new file struct - */ + /* create new file struct */ file = H5FL_CALLOC(H5FD_ros3_t); - if (file == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "unable to allocate file struct") - } + if(file == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") file->s3r_handle = handle; HDmemcpy(&(file->fa), &fa, sizeof(H5FD_ros3_fapl_t)); #if ROS3_STATS - if (FAIL == ros3_reset_stats(file)) { - HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, - "unable to reset file statistics") - } + if(FAIL == ros3_reset_stats(file)) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics") #endif /* ROS3_STATS */ ret_value = (H5FD_t*)file; done: - if (ret_value == NULL) { - if (handle != NULL) { - if (FAIL == H5FD_s3comms_s3r_close(handle)) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, - "unable to close s3 file handle") - } - } - if (file != NULL) { + if(ret_value == NULL) { + if(handle != NULL) + if(FAIL == H5FD_s3comms_s3r_close(handle)) + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close s3 file handle") + if(file != NULL) file = H5FL_FREE(H5FD_ros3_t, file); - } curl_global_cleanup(); /* early cleanup because open failed */ } /* end if null return value (error) */ FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_open() */ +} /* end H5FD__ros3_open() */ #if ROS3_STATS - /*---------------------------------------------------------------------------- * * Function: ros3_fprint_stats() @@ -939,8 +862,7 @@ done: *---------------------------------------------------------------------------- */ static herr_t -ros3_fprint_stats(FILE *stream, - const H5FD_ros3_t *file) +ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file) { herr_t ret_value = SUCCEED; parsed_url_t *purl = NULL; @@ -959,26 +881,16 @@ ros3_fprint_stats(FILE *stream, unsigned suffix_i = 0; const char suffixes[] = { ' ', 'K', 'M', 'G', 'T', 'P' }; + FUNC_ENTER_STATIC - - FUNC_ENTER_NOAPI_NOINIT - - if (stream == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file stream cannot be null" ); - } - if (file == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "file cannot be null"); - } - if (file->s3r_handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "s3 request handle cannot be null"); - } - if (file->s3r_handle->purl == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "parsed url structure cannot be null"); - } + if(stream == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null" ); + if(file == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null"); + if(file->s3r_handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "s3 request handle cannot be null"); + if(file->s3r_handle->purl == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "parsed url structure cannot be null"); purl = file->s3r_handle->purl; /****************** @@ -986,9 +898,9 @@ ros3_fprint_stats(FILE *stream, ******************/ HDfprintf(stream, "stats for %s://%s", purl->scheme, purl->host); - if (purl->port != NULL && purl->port[0] != '\0') + if(purl->port != NULL && purl->port[0] != '\0') HDfprintf(stream, ":%s", purl->port); - if (purl->query != NULL && purl->query[0] != '\0') { + if(purl->query != NULL && purl->query[0] != '\0') { if (purl->path != NULL && purl->path[0] != '\0') HDfprintf(stream, "/%s", purl->path); else @@ -1003,23 +915,27 @@ ros3_fprint_stats(FILE *stream, * AGGREGATE STATS * *******************/ - for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { + for(i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { const ros3_statsbin *r = &file->raw[i]; const ros3_statsbin *m = &file->meta[i]; - if (m->min < min_meta) min_meta = m->min; - if (r->min < min_raw) min_raw = r->min; - if (m->max > max_meta) max_meta = m->max; - if (r->max > max_raw) max_raw = r->max; + if(m->min < min_meta) + min_meta = m->min; + if(r->min < min_raw) + min_raw = r->min; + if(m->max > max_meta) + max_meta = m->max; + if(r->max > max_raw) + max_raw = r->max; count_raw += r->count; count_meta += m->count; bytes_raw += r->bytes; bytes_meta += m->bytes; } - if (count_raw > 0) + if(count_raw > 0) average_raw = (double)bytes_raw / (double)count_raw; - if (count_meta > 0) + if(count_meta > 0) average_meta = (double)bytes_meta / (double)count_meta; /****************** @@ -1031,7 +947,7 @@ ros3_fprint_stats(FILE *stream, HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, bytes_raw); - if (count_raw + count_meta == 0) + if(count_raw + count_meta == 0) goto done; /************************* @@ -1040,21 +956,21 @@ ros3_fprint_stats(FILE *stream, HDfprintf(stream, "SIZES meta raw\n"); HDfprintf(stream, " min "); - if (count_meta == 0) { + if(count_meta == 0) HDfprintf(stream, " 0.000 "); - } else { + else { re_dub = (double)min_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); } - if (count_raw == 0) { + if(count_raw == 0) HDfprintf(stream, " 0.000 \n"); - } else { + else { re_dub = (double)min_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); @@ -1062,26 +978,26 @@ ros3_fprint_stats(FILE *stream, HDfprintf(stream, " avg "); re_dub = (double)average_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); re_dub = (double)average_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); HDfprintf(stream, " max "); re_dub = (double)max_meta; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); re_dub = (double)max_raw; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); @@ -1095,7 +1011,7 @@ ros3_fprint_stats(FILE *stream, HDfprintf(stream, " up-to meta raw meta raw meta raw\n"); - for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { + for(i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { const ros3_statsbin *m; const ros3_statsbin *r; unsigned long long range_end = 0; @@ -1110,46 +1026,46 @@ ros3_fprint_stats(FILE *stream, m = &file->meta[i]; r = &file->raw[i]; - if (r->count == 0 && m->count == 0) + if(r->count == 0 && m->count == 0) continue; range_end = ros3_stats_boundaries[i]; - if (i == ROS3_STATS_BIN_COUNT) { + if(i == ROS3_STATS_BIN_COUNT) { range_end = ros3_stats_boundaries[i-1]; HDfprintf(stream, ">"); - } else { - HDfprintf(stream, " "); } + else + HDfprintf(stream, " "); bm_val = (double)m->bytes; - for (suffix_i = 0; bm_val >= 1024.0; suffix_i++) + for(suffix_i = 0; bm_val >= 1024.0; suffix_i++) bm_val /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); bm_suffix = suffixes[suffix_i]; br_val = (double)r->bytes; - for (suffix_i = 0; br_val >= 1024.0; suffix_i++) + for(suffix_i = 0; br_val >= 1024.0; suffix_i++) br_val /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); br_suffix = suffixes[suffix_i]; - if (m->count > 0) + if(m->count > 0) am_val = (double)(m->bytes) / (double)(m->count); - for (suffix_i = 0; am_val >= 1024.0; suffix_i++) + for(suffix_i = 0; am_val >= 1024.0; suffix_i++) am_val /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); am_suffix = suffixes[suffix_i]; - if (r->count > 0) + if(r->count > 0) ar_val = (double)(r->bytes) / (double)(r->count); - for (suffix_i = 0; ar_val >= 1024.0; suffix_i++) + for(suffix_i = 0; ar_val >= 1024.0; suffix_i++) ar_val /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); ar_suffix = suffixes[suffix_i]; re_dub = (double)range_end; - for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + for(suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); @@ -1163,7 +1079,7 @@ ros3_fprint_stats(FILE *stream, am_val, am_suffix, /* metadata average */ ar_val, ar_suffix); /* rawdata average */ - fflush(stream); + HDfflush(stream); } done: @@ -1175,7 +1091,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_close() + * Function: H5FD__ros3_close() * * Purpose: * @@ -1191,52 +1107,45 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_close(H5FD_t H5_ATTR_UNUSED *_file) +H5FD__ros3_close(H5FD_t H5_ATTR_UNUSED *_file) { H5FD_ros3_t *file = (H5FD_ros3_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_close() called.\n"); + HDfprintf(stdout, "H5FD__ros3_close() called.\n"); #endif - /* Sanity checks - */ + /* Sanity checks */ HDassert(file != NULL); HDassert(file->s3r_handle != NULL); /* Close the underlying request handle */ - if (FAIL == H5FD_s3comms_s3r_close(file->s3r_handle)) { - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "unable to close S3 request handle") - } + if(FAIL == H5FD_s3comms_s3r_close(file->s3r_handle)) + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close S3 request handle") #if ROS3_STATS /* TODO: mechanism to re-target stats printout */ - if (ros3_fprint_stats(stdout, file) == FAIL) { - HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, - "problem while writing file statistics") - } + if(ros3_fprint_stats(stdout, file) == FAIL) + HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics") #endif /* ROS3_STATS */ - /* Release the file info - */ + /* Release the file info */ file = H5FL_FREE(H5FD_ros3_t, file); done: curl_global_cleanup(); /* cleanup to answer init on open */ FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_close() */ +} /* end H5FD__ros3_close() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_cmp() + * Function: H5FD__ros3_cmp() * * Purpose: * @@ -1265,9 +1174,7 @@ done: *------------------------------------------------------------------------- */ static int -H5FD_ros3_cmp( - const H5FD_t *_f1, - const H5FD_t *_f2) +H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_ros3_t *f1 = (const H5FD_ros3_t *)_f1; const H5FD_ros3_t *f2 = (const H5FD_ros3_t *)_f2; @@ -1275,10 +1182,10 @@ H5FD_ros3_cmp( const parsed_url_t *purl2 = NULL; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_cmp() called.\n"); + HDfprintf(stdout, "H5FD__ros3_cmp() called.\n"); #endif HDassert(f1->s3r_handle != NULL); @@ -1294,113 +1201,80 @@ H5FD_ros3_cmp( HDassert(purl2->host != NULL); /* URL: SCHEME */ - if (HDstrcmp(purl1->scheme, purl2->scheme)) { + if(HDstrcmp(purl1->scheme, purl2->scheme)) HGOTO_DONE(-1); - } /* URL: HOST */ - if (HDstrcmp(purl1->host, purl2->host)) { + if(HDstrcmp(purl1->host, purl2->host)) HGOTO_DONE(-1); - } /* URL: PORT */ - if (purl1->port && purl2->port) { - if (HDstrcmp(purl1->port, purl2->port)) { + if(purl1->port && purl2->port) { + if(HDstrcmp(purl1->port, purl2->port)) HGOTO_DONE(-1); - } } - else - if (purl1->port) { + else if(purl1->port) HGOTO_DONE(-1); - } - else - if (purl2->port) { + else if(purl2->port) HGOTO_DONE(-1); - } /* URL: PATH */ - if (purl1->path && purl2->path) { - if (HDstrcmp(purl1->path, purl2->path)) { + if(purl1->path && purl2->path) { + if(HDstrcmp(purl1->path, purl2->path)) HGOTO_DONE(-1); - } } - else - if (purl1->path && !purl2->path) { + else if(purl1->path && !purl2->path) HGOTO_DONE(-1); - } - else - if (purl2->path && !purl1->path) { + else if(purl2->path && !purl1->path) HGOTO_DONE(-1); - } /* URL: QUERY */ - if (purl1->query && purl2->query) { - if (HDstrcmp(purl1->query, purl2->query)) { + if(purl1->query && purl2->query) { + if(HDstrcmp(purl1->query, purl2->query)) HGOTO_DONE(-1); - } } - else - if (purl1->query && !purl2->query) { + else if(purl1->query && !purl2->query) HGOTO_DONE(-1); - } - else - if (purl2->query && !purl1->query) { + else if(purl2->query && !purl1->query) HGOTO_DONE(-1); - } /* FAPL: AWS_REGION */ - if (f1->fa.aws_region[0] != '\0' && f2->fa.aws_region[0] != '\0') { - if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) { + if(f1->fa.aws_region[0] != '\0' && f2->fa.aws_region[0] != '\0') { + if(HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) HGOTO_DONE(-1); - } } - else - if (f1->fa.aws_region[0] != '\0') { + else if(f1->fa.aws_region[0] != '\0') HGOTO_DONE(-1); - } - else - if (f2->fa.aws_region[0] != '\0') { + else if(f2->fa.aws_region[0] != '\0') HGOTO_DONE(-1); - } /* FAPL: SECRET_ID */ - if (f1->fa.secret_id[0] != '\0' && f2->fa.secret_id[0] != '\0') { - if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) { + if(f1->fa.secret_id[0] != '\0' && f2->fa.secret_id[0] != '\0') { + if(HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) HGOTO_DONE(-1); - } } - else - if (f1->fa.secret_id[0] != '\0') { + else if(f1->fa.secret_id[0] != '\0') HGOTO_DONE(-1); - } - else - if (f2->fa.secret_id[0] != '\0') { + else if(f2->fa.secret_id[0] != '\0') HGOTO_DONE(-1); - } /* FAPL: SECRET_KEY */ - if (f1->fa.secret_key[0] != '\0' && f2->fa.secret_key[0] != '\0') { - if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) { + if(f1->fa.secret_key[0] != '\0' && f2->fa.secret_key[0] != '\0') { + if(HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) HGOTO_DONE(-1); - } } - else - if (f1->fa.secret_key[0] != '\0') { + else if(f1->fa.secret_key[0] != '\0') HGOTO_DONE(-1); - } - else - if (f2->fa.secret_key[0] != '\0') { + else if(f2->fa.secret_key[0] != '\0') HGOTO_DONE(-1); - } done: FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_ros3_cmp() */ +} /* H5FD__ros3_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_ros3_query + * Function: H5FD__ros3_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -1419,30 +1293,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, - unsigned long *flags /* out */) +H5FD__ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_query() called.\n"); + HDfprintf(stdout, "H5FD__ros3_query() called.\n"); #endif /* Set the VFL feature flags that this driver supports */ - if (flags) { + if(flags) { *flags = 0; /* OK to perform data sieving for faster raw data reads & writes */ *flags |= H5FD_FEAT_DATA_SIEVE; } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) - -} /* H5FD_ros3_query() */ +} /* H5FD__ros3_query() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_get_eoa() + * Function: H5FD__ros3_get_eoa() * * Purpose: * @@ -1460,25 +1332,23 @@ H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, *------------------------------------------------------------------------- */ static haddr_t -H5FD_ros3_get_eoa(const H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_ros3_t *file = (const H5FD_ros3_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_get_eoa() called.\n"); + HDfprintf(stdout, "H5FD__ros3_get_eoa() called.\n"); #endif FUNC_LEAVE_NOAPI(file->eoa) - -} /* end H5FD_ros3_get_eoa() */ +} /* end H5FD__ros3_get_eoa() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_set_eoa() + * Function: H5FD__ros3_set_eoa() * * Purpose: * @@ -1494,28 +1364,25 @@ H5FD_ros3_get_eoa(const H5FD_t *_file, *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_set_eoa(H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - haddr_t addr) +H5FD__ros3_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_ros3_t *file = (H5FD_ros3_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_set_eoa() called.\n"); + HDfprintf(stdout, "H5FD__ros3_set_eoa() called.\n"); #endif file->eoa = addr; FUNC_LEAVE_NOAPI(SUCCEED) - -} /* H5FD_ros3_set_eoa() */ +} /* H5FD__ros3_set_eoa() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_get_eof() + * Function: H5FD__ros3_get_eof() * * Purpose: * @@ -1532,25 +1399,23 @@ H5FD_ros3_set_eoa(H5FD_t *_file, *------------------------------------------------------------------------- */ static haddr_t -H5FD_ros3_get_eof(const H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__ros3_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_ros3_t *file = (const H5FD_ros3_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_get_eof() called.\n"); + HDfprintf(stdout, "H5FD__ros3_get_eof() called.\n"); #endif FUNC_LEAVE_NOAPI(H5FD_s3comms_s3r_get_filesize(file->s3r_handle)) - -} /* end H5FD_ros3_get_eof() */ +} /* end H5FD__ros3_get_eof() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_get_handle() + * Function: H5FD__ros3_get_handle() * * Purpose: * @@ -1566,34 +1431,31 @@ H5FD_ros3_get_eof(const H5FD_t *_file, *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_get_handle(H5FD_t *_file, - hid_t H5_ATTR_UNUSED fapl, - void **file_handle) +H5FD__ros3_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, + void **file_handle) { H5FD_ros3_t *file = (H5FD_ros3_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_get_handle() called.\n"); + HDfprintf(stdout, "H5FD__ros3_get_handle() called.\n"); #endif - if (!file_handle) { + if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") - } *file_handle = file->s3r_handle; done: FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_get_handle() */ +} /* end H5FD__ros3_get_handle() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_read() + * Function: H5FD__ros3_read() * * Purpose * @@ -1614,12 +1476,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_read(H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t addr, /* start offset */ - size_t size, /* length of read */ - void *buf) /* out */ +H5FD__ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, + void *buf) { H5FD_ros3_t *file = (H5FD_ros3_t *)_file; size_t filesize = 0; @@ -1631,10 +1490,10 @@ H5FD_ros3_read(H5FD_t *_file, #endif /* ROS3_STATS */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_read() called.\n"); + HDfprintf(stdout, "H5FD__ros3_read() called.\n"); #endif HDassert(file != NULL); @@ -1643,40 +1502,32 @@ H5FD_ros3_read(H5FD_t *_file, filesize = H5FD_s3comms_s3r_get_filesize(file->s3r_handle); - if ((addr > filesize) || ((addr + size) > filesize)) { + if((addr > filesize) || ((addr + size) > filesize)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "range exceeds file address") - } - if (H5FD_s3comms_s3r_read(file->s3r_handle, addr, size, buf) == FAIL) { + if(H5FD_s3comms_s3r_read(file->s3r_handle, addr, size, buf) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read") - } #if ROS3_STATS - /* Find which "bin" this read fits in. Can be "overflow" bin. - */ - for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) { - if ((unsigned long long)size < ros3_stats_boundaries[bin_i]) { + /* Find which "bin" this read fits in. Can be "overflow" bin. */ + for(bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) + if((unsigned long long)size < ros3_stats_boundaries[bin_i]) break; - } - } bin = (type == H5FD_MEM_DRAW) ? &file->raw[bin_i] : &file->meta[bin_i]; - /* Store collected stats in appropriate bin - */ - if (bin->count == 0) { + /* Store collected stats in appropriate bin */ + if(bin->count == 0) { bin->min = size; bin->max = size; } else { - if (size < bin->min) { + if(size < bin->min) bin->min = size; - } - if (size > bin->max) { + if(size > bin->max) bin->max = size; - } } bin->count++; bin->bytes += (unsigned long long)size; @@ -1685,13 +1536,12 @@ H5FD_ros3_read(H5FD_t *_file, done: FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_read() */ +} /* end H5FD__ros3_read() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_write() + * Function: H5FD__ros3_write() * * Purpose: * @@ -1708,33 +1558,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_write(H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t H5_ATTR_UNUSED addr, - size_t H5_ATTR_UNUSED size, - const void H5_ATTR_UNUSED *buf) +H5FD__ros3_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr, + size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) { herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_write() called.\n"); + HDfprintf(stdout, "H5FD__ros3_write() called.\n"); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, - "cannot write to read-only file.") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file.") done: FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_ros3_write() */ +} /* H5FD__ros3_write() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_truncate() + * Function: H5FD__ros3_truncate() * * Purpose: * @@ -1753,30 +1598,27 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_truncate(H5FD_t H5_ATTR_UNUSED *_file, - hid_t H5_ATTR_UNUSED dxpl_id, - hbool_t H5_ATTR_UNUSED closing) +H5FD__ros3_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id, + hbool_t H5_ATTR_UNUSED closing) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_truncate() called.\n"); + HDfprintf(stdout, "H5FD__ros3_truncate() called.\n"); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, - "cannot truncate read-only file.") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file.") done: FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_ros3_truncate() */ +} /* end H5FD__ros3_truncate() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_lock() + * Function: H5FD__ros3_lock() * * Purpose: * @@ -1796,18 +1638,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, +H5FD__ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, hbool_t H5_ATTR_UNUSED rw) { - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(SUCCEED) + FUNC_ENTER_STATIC_NOERR -} /* end H5FD_ros3_lock() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FD__ros3_lock() */ /*------------------------------------------------------------------------- * - * Function: H5FD_ros3_unlock() + * Function: H5FD__ros3_unlock() * * Purpose: * @@ -1824,12 +1666,12 @@ H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_unlock(H5FD_t H5_ATTR_UNUSED *_file) +H5FD__ros3_unlock(H5FD_t H5_ATTR_UNUSED *_file) { - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(SUCCEED) + FUNC_ENTER_STATIC_NOERR -} /* end H5FD_ros3_unlock() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FD__ros3_unlock() */ #endif /* H5_HAVE_ROS3_VFD */ diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index d9d4c88..e79ee0d 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -148,9 +148,8 @@ curlwritecallback(char *ptr, size_t product = (size * nmemb); size_t written = 0; - if (sds->magic != S3COMMS_CALLBACK_DATASTRUCT_MAGIC) { + if(sds->magic != S3COMMS_CALLBACK_DATASTRUCT_MAGIC) return written; - } if (size > 0) { HDmemcpy(&(sds->data[sds->size]), ptr, product); @@ -159,7 +158,6 @@ curlwritecallback(char *ptr, } return written; - } /* end curlwritecallback() */ @@ -236,22 +234,19 @@ H5FD_s3comms_hrb_node_set( FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_hrb_node_set.\n"); + HDfprintf(stdout, "called H5FD_s3comms_hrb_node_set."); HDprintf("NAME: %s\n", name); HDprintf("VALUE: %s\n", value); HDprintf("LIST:\n->"); - for (node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next) { + for(node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next) HDfprintf(stdout, "{%s}\n->", node_ptr->cat); - } HDprintf("(null)\n"); - fflush(stdout); + HDfflush(stdout); node_ptr = NULL; #endif - if (name == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to operate on null name.\n"); - } + if(name == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to operate on null name"); namelen = HDstrlen(name); /*********************** @@ -261,20 +256,17 @@ H5FD_s3comms_hrb_node_set( /* copy and lowercase name */ lowername = (char *)H5MM_malloc(sizeof(char) * (namelen + 1)); - if (lowername == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "cannot make space for lowercase name copy.\n"); - } - for (i = 0; i < namelen; i++) { - lowername[i] = (char)tolower((int)name[i]); - } + if(lowername == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for lowercase name copy."); + for(i = 0; i < namelen; i++) + lowername[i] = (char)HDtolower((int)name[i]); lowername[namelen] = 0; /* If value supplied, copy name, value, and concatenated "name: value". * If NULL, we will be removing a node or doing nothing, so no need for * copies */ - if (value != NULL) { + if(value != NULL) { int ret = 0; size_t valuelen = HDstrlen(value); size_t catlen = namelen + valuelen + 2; /* +2 from ": " */ @@ -282,38 +274,28 @@ H5FD_s3comms_hrb_node_set( namecpy = (char *)H5MM_malloc(sizeof(char) * (namelen + 1)); - if (namecpy == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "cannot make space for name copy.\n"); - } + if(namecpy == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for name copy."); HDmemcpy(namecpy, name, (namelen + 1)); valuecpy = (char *)H5MM_malloc(sizeof(char) * (valuelen + 1)); - if (valuecpy == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "cannot make space for value copy.\n"); - } + if(valuecpy == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for value copy."); HDmemcpy(valuecpy, value, (valuelen + 1)); nvcat = (char *)H5MM_malloc(sizeof(char) * catwrite); - if (nvcat == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "cannot make space for concatenated string.\n"); - } + if(nvcat == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for concatenated string."); ret = HDsnprintf(nvcat, catwrite, "%s: %s", name, value); - if (ret < 0 || (size_t)ret > catlen) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot concatenate `%s: %s", name, value); - } + if(ret < 0 || (size_t)ret > catlen) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot concatenate `%s: %s", name, value); HDassert( catlen == HDstrlen(nvcat) ); /* create new_node, should we need it */ new_node = (hrb_node_t *)H5MM_malloc(sizeof(hrb_node_t)); - if (new_node == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "cannot make space for new set.\n"); - } + if(new_node == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for new set."); new_node->magic = S3COMMS_HRB_NODE_MAGIC; new_node->name = NULL; @@ -327,14 +309,12 @@ H5FD_s3comms_hrb_node_set( * ACT ON LIST * ***************/ - if (*L == NULL) { - if (value == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "trying to remove node from empty list"); - } + if(*L == NULL) { + if(value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove node from empty list"); else { #if S3COMMS_DEBUG -HDprintf("CREATE NEW\n"); fflush(stdout); +HDprintf("CREATE NEW\n"); HDfflush(stdout); #endif /******************* * CREATE NEW LIST * @@ -358,13 +338,13 @@ HDprintf("CREATE NEW\n"); fflush(stdout); /* Check whether to modify/remove first node in list */ - if (strcmp(lowername, node_ptr->lowername) == 0) { + if(HDstrcmp(lowername, node_ptr->lowername) == 0) { is_looking = FALSE; if (value == NULL) { #if S3COMMS_DEBUG -HDprintf("REMOVE HEAD\n"); fflush(stdout); +HDprintf("REMOVE HEAD\n"); HDfflush(stdout); #endif /*************** * REMOVE HEAD * @@ -373,41 +353,41 @@ HDprintf("REMOVE HEAD\n"); fflush(stdout); *L = node_ptr->next; #if S3COMMS_DEBUG -HDprintf("FREEING CAT (node)\n"); fflush(stdout); +HDprintf("FREEING CAT (node)\n"); HDfflush(stdout); #endif H5MM_xfree(node_ptr->cat); #if S3COMMS_DEBUG -HDprintf("FREEING LOWERNAME (node)\n"); fflush(stdout); +HDprintf("FREEING LOWERNAME (node)\n"); HDfflush(stdout); #endif H5MM_xfree(node_ptr->lowername); #if S3COMMS_DEBUG -HDprintf("FREEING NAME (node)\n"); fflush(stdout); +HDprintf("FREEING NAME (node)\n"); HDfflush(stdout); #endif H5MM_xfree(node_ptr->name); #if S3COMMS_DEBUG -HDprintf("FREEING VALUE (node)\n"); fflush(stdout); +HDprintf("FREEING VALUE (node)\n"); HDfflush(stdout); #endif H5MM_xfree(node_ptr->value); #if S3COMMS_DEBUG HDprintf("MAGIC OK? %s\n", (node_ptr->magic == S3COMMS_HRB_NODE_MAGIC) ? "YES" : "NO"); -fflush(stdout); +HDfflush(stdout); #endif HDassert( node_ptr->magic == S3COMMS_HRB_NODE_MAGIC ); node_ptr->magic += 1ul; #if S3COMMS_DEBUG -HDprintf("FREEING POINTER\n"); fflush(stdout); +HDprintf("FREEING POINTER\n"); HDfflush(stdout); #endif H5MM_xfree(node_ptr); #if S3COMMS_DEBUG -HDprintf("FREEING WORKING LOWERNAME\n"); fflush(stdout); +HDprintf("FREEING WORKING LOWERNAME\n"); HDfflush(stdout); #endif H5MM_xfree(lowername); lowername = NULL; } else { #if S3COMMS_DEBUG -HDprintf("MODIFY HEAD\n"); fflush(stdout); +HDprintf("MODIFY HEAD\n"); HDfflush(stdout); #endif /*************** * MODIFY HEAD * @@ -429,17 +409,15 @@ HDprintf("MODIFY HEAD\n"); fflush(stdout); } } else - if (strcmp(lowername, node_ptr->lowername) < 0) { + if (HDstrcmp(lowername, node_ptr->lowername) < 0) { is_looking = FALSE; - if (value == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "trying to remove a node 'before' head"); - } + if(value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove a node 'before' head"); else { #if S3COMMS_DEBUG -HDprintf("PREPEND NEW HEAD\n"); fflush(stdout); +HDprintf("PREPEND NEW HEAD\n"); HDfflush(stdout); #endif /******************* * INSERT NEW HEAD * @@ -458,24 +436,22 @@ HDprintf("PREPEND NEW HEAD\n"); fflush(stdout); * SEARCH LIST * ***************/ - while (is_looking) { - if (node_ptr->next == NULL) { + while(is_looking) { + if(node_ptr->next == NULL) { is_looking = FALSE; - if (value == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "trying to remove absent node"); - } + if(value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node"); else { #if S3COMMS_DEBUG -HDprintf("APPEND A NODE\n"); fflush(stdout); +HDprintf("APPEND A NODE\n"); HDfflush(stdout); #endif /******************* * APPEND NEW NODE * *******************/ - HDassert( strcmp(lowername, node_ptr->lowername) > 0 ); + HDassert( HDstrcmp(lowername, node_ptr->lowername) > 0 ); new_node->name = namecpy; new_node->value = valuecpy; new_node->lowername = lowername; @@ -484,23 +460,21 @@ HDprintf("APPEND A NODE\n"); fflush(stdout); } } else - if (strcmp(lowername, node_ptr->next->lowername) < 0) { + if(HDstrcmp(lowername, node_ptr->next->lowername) < 0) { is_looking = FALSE; - if (value == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "trying to remove absent node"); - } + if(value == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node"); else { #if S3COMMS_DEBUG -HDprintf("INSERT A NODE\n"); fflush(stdout); +HDprintf("INSERT A NODE\n"); HDfflush(stdout); #endif /******************* * INSERT NEW NODE * *******************/ - HDassert( strcmp(lowername, node_ptr->lowername) > 0 ); + HDassert( HDstrcmp(lowername, node_ptr->lowername) > 0 ); new_node->name = namecpy; new_node->value = valuecpy; new_node->lowername = lowername; @@ -510,11 +484,11 @@ HDprintf("INSERT A NODE\n"); fflush(stdout); } } else - if (strcmp(lowername, node_ptr->next->lowername) == 0) { + if(HDstrcmp(lowername, node_ptr->next->lowername) == 0) { is_looking = FALSE; - if (value == NULL) { + if(value == NULL) { /***************** * REMOVE A NODE * *****************/ @@ -523,7 +497,7 @@ HDprintf("INSERT A NODE\n"); fflush(stdout); node_ptr->next = tmp->next; #if S3COMMS_DEBUG -HDprintf("REMOVE A NODE\n"); fflush(stdout); +HDprintf("REMOVE A NODE\n"); HDfflush(stdout); #endif H5MM_xfree(tmp->cat); H5MM_xfree(tmp->lowername); @@ -539,7 +513,7 @@ HDprintf("REMOVE A NODE\n"); fflush(stdout); } else { #if S3COMMS_DEBUG -HDprintf("MODIFY A NODE\n"); fflush(stdout); +HDprintf("MODIFY A NODE\n"); HDfflush(stdout); #endif /***************** * MODIFY A NODE * @@ -572,14 +546,17 @@ HDprintf("MODIFY A NODE\n"); fflush(stdout); } /* end while is_looking */ done: - if (ret_value == FAIL) { - /* clean up - */ - if (nvcat != NULL) { H5MM_xfree(nvcat); } - if (namecpy != NULL) { H5MM_xfree(namecpy); } - if (lowername != NULL) { H5MM_xfree(lowername); } - if (valuecpy != NULL) { H5MM_xfree(valuecpy); } - if (new_node != NULL) { + if(ret_value == FAIL) { + /* clean up */ + if(nvcat != NULL) + H5MM_xfree(nvcat); + if(namecpy != NULL) + H5MM_xfree(namecpy); + if(lowername != NULL) + H5MM_xfree(lowername); + if(valuecpy != NULL) + H5MM_xfree(valuecpy); + if(new_node != NULL) { HDassert( new_node->magic == S3COMMS_HRB_NODE_MAGIC ); new_node->magic += 1ul; H5MM_xfree(new_node); @@ -638,12 +615,10 @@ H5FD_s3comms_hrb_destroy(hrb_t **_buf) HDfprintf(stdout, "called H5FD_s3comms_hrb_destroy.\n"); #endif - if (_buf != NULL && *_buf != NULL) { + if(_buf != NULL && *_buf != NULL) { buf = *_buf; - if (buf->magic != S3COMMS_HRB_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "pointer's magic does not match.\n"); - } + if(buf->magic != S3COMMS_HRB_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "pointer's magic does not match."); H5MM_xfree(buf->verb); H5MM_xfree(buf->version); @@ -707,53 +682,38 @@ H5FD_s3comms_hrb_init_request(const char *_verb, HDfprintf(stdout, "called H5FD_s3comms_hrb_init_request.\n"); #endif - if (_resource == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "resource string cannot be null.\n"); - } + if(_resource == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "resource string cannot be null."); - /* populate valid NULLs with defaults - */ - if (_verb == NULL) { + /* populate valid NULLs with defaults */ + if(_verb == NULL) _verb = "GET"; - } - - if (_http_version == NULL) { + if(_http_version == NULL) _http_version = "HTTP/1.1"; - } - /* malloc space for and prepare structure - */ + /* malloc space for and prepare structure */ request = (hrb_t *)H5MM_malloc(sizeof(hrb_t)); - if (request == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, - "no space for request structure"); - } + if(request == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for request structure"); request->magic = S3COMMS_HRB_MAGIC; request->body = NULL; request->body_len = 0; request->first_header = NULL; - - /* malloc and copy strings for the structure - */ + /* malloc and copy strings for the structure */ reslen = HDstrlen(_resource); if (_resource[0] == '/') { res = (char *)H5MM_malloc(sizeof(char) * (reslen+1)); - if (res == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, - "no space for resource string"); - } + if(res == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for resource string"); HDmemcpy(res, _resource, (reslen+1)); } else { res = (char *)H5MM_malloc(sizeof(char) * (reslen+2)); - if (res == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, - "no space for resource string"); - } + if(res == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for resource string"); *res = '/'; HDmemcpy((&res[1]), _resource, (reslen+1)); HDassert( (reslen+1) == HDstrlen(res) ); @@ -761,24 +721,18 @@ H5FD_s3comms_hrb_init_request(const char *_verb, verblen = HDstrlen(_verb) + 1; verb = (char *)H5MM_malloc(sizeof(char) * verblen); - if (verb == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "no space for verb string"); - } + if(verb == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no space for verb string"); HDstrncpy(verb, _verb, verblen); vrsnlen = HDstrlen(_http_version) + 1; vrsn = (char *)H5MM_malloc(sizeof(char) * vrsnlen); - if (vrsn == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "no space for http-version string"); - } + if(vrsn == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no space for http-version string"); HDstrncpy(vrsn, _http_version, vrsnlen); - - /* place new copies into structure - */ + /* place new copies into structure */ request->resource = res; request->verb = verb; request->version = vrsn; @@ -786,13 +740,16 @@ H5FD_s3comms_hrb_init_request(const char *_verb, ret_value = request; done: - /* if there is an error, clean up after ourselves - */ + /* if there is an error, clean up after ourselves */ if (ret_value == NULL) { - if (request != NULL) H5MM_xfree(request); - if (vrsn != NULL) H5MM_xfree(vrsn); - if (verb != NULL) H5MM_xfree(verb); - if (res != NULL) H5MM_xfree(res); + if(request != NULL) + H5MM_xfree(request); + if(vrsn != NULL) + H5MM_xfree(vrsn); + if(verb != NULL) + H5MM_xfree(verb); + if(res != NULL) + H5MM_xfree(res); } FUNC_LEAVE_NOAPI(ret_value) @@ -836,14 +793,10 @@ H5FD_s3comms_s3r_close(s3r_t *handle) HDfprintf(stdout, "called H5FD_s3comms_s3r_close.\n"); #endif - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle cannot be null.\n"); - } - if (handle->magic != S3COMMS_S3R_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has invalid magic.\n"); - } + if(handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null."); + if(handle->magic != S3COMMS_S3R_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic."); curl_easy_cleanup(handle->curlhandle); @@ -854,10 +807,8 @@ H5FD_s3comms_s3r_close(s3r_t *handle) HDassert( handle->httpverb != NULL ); H5MM_xfree(handle->httpverb); - if (FAIL == H5FD_s3comms_free_purl(handle->purl)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to release parsed url structure") - } + if(FAIL == H5FD_s3comms_free_purl(handle->purl)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to release parsed url structure") H5MM_xfree(handle); @@ -893,9 +844,8 @@ H5FD_s3comms_s3r_get_filesize(s3r_t *handle) FUNC_ENTER_NOAPI_NOINIT_NOERR - if (handle != NULL) { + if(handle != NULL) ret_value = handle->filesize; - } FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_s3comms_s3r_get_filesize */ @@ -953,58 +903,33 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) HDfprintf(stdout, "called H5FD_s3comms_s3r_getsize.\n"); #endif - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle cannot be null.\n"); - } - if (handle->magic != S3COMMS_S3R_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has invalid magic.\n"); - } - if (handle->curlhandle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has bad (null) curlhandle.\n") - } + if(handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null."); + if(handle->magic != S3COMMS_S3R_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic."); + if(handle->curlhandle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle.") /******************** * PREPARE FOR HEAD * ********************/ curlh = handle->curlhandle; + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_NOBODY, 1L)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_NOBODY)."); - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_NOBODY, - 1L) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option (CURLOPT_NOBODY). " - "(placeholder flags)"); - } - - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_HEADERDATA, - &sds) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option (CURLOPT_HEADERDATA). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HEADERDATA, &sds)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_HEADERDATA)."); HDassert( handle->httpverb == NULL ); handle->httpverb = (char *)H5MM_malloc(sizeof(char) * 16); - if (handle->httpverb == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "unable to allocate space for S3 request HTTP verb"); - } + if(handle->httpverb == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "unable to allocate space for S3 request HTTP verb"); HDmemcpy(handle->httpverb, "HEAD", 5); headerresponse = (char *)H5MM_malloc(sizeof(char) * CURL_MAX_HTTP_HEADER); - if (headerresponse == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "unable to allocate space for curl header response"); - } + if(headerresponse == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "unable to allocate space for curl header response"); sds.data = headerresponse; /******************* @@ -1015,65 +940,43 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) * but, with a NULL destination and NOBODY and HEADERDATA supplied above, * only http metadata will be sent by server and recorded by s3comms */ - if (FAIL == - H5FD_s3comms_s3r_read(handle, 0, 0, NULL) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem in reading during getsize.\n"); - } + if(FAIL == H5FD_s3comms_s3r_read(handle, 0, 0, NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem in reading during getsize."); - if (sds.size > CURL_MAX_HTTP_HEADER) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "HTTP metadata buffer overrun\n"); - } else if (sds.size == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "No HTTP metadata\n"); + if(sds.size > CURL_MAX_HTTP_HEADER) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HTTP metadata buffer overrun"); + else if (sds.size == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "No HTTP metadata"); #if S3COMMS_DEBUG - } else { + else HDfprintf(stderr, "GETSIZE: OK\n"); #endif - } /****************** * PARSE RESPONSE * ******************/ - start = strstr(headerresponse, - "\r\nContent-Length: "); - if (start == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not find \"Content-Length\" in response.\n"); - } + start = HDstrstr(headerresponse, "\r\nContent-Length: "); + if(start == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not find \"Content-Length\" in response."); - /* move "start" to beginning of value in line; find end of line - */ + /* move "start" to beginning of value in line; find end of line */ start = start + HDstrlen("\r\nContent-Length: "); - end = strstr(start, "\r\n"); - if (end == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not find end of content length line"); - } + end = HDstrstr(start, "\r\n"); + if(end == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not find end of content length line"); /* place null terminator at end of numbers */ *end = '\0'; - content_length = strtoumax((const char *)start, - NULL, - 0); - - if (UINTMAX_MAX > SIZE_MAX && content_length > SIZE_MAX) { - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "content_length overflows size_t\n"); - } + content_length = HDstrtoumax((const char *)start, NULL, 0); + if(UINTMAX_MAX > SIZE_MAX && content_length > SIZE_MAX) + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "content_length overflows size_t"); - if (content_length == 0 || - errno == ERANGE) /* errno set by strtoumax*/ - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not convert found \"Content-Length\" response (\"%s\")", - start); /* range is null-terminated, remember */ - } + if(content_length == 0 || errno == ERANGE) /* errno set by HDstrtoumax*/ + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not convert found \"Content-Length\" response (\"%s\")", start); /* range is null-terminated, remember */ handle->filesize = (size_t)content_length; @@ -1081,32 +984,17 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) * UNDO HEAD SETTINGS * **********************/ - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_NOBODY, - NULL) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option (CURLOPT_NOBODY). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_NOBODY, NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_NOBODY)."); - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_HEADERDATA, - NULL) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option (CURLOPT_HEADERDATA). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HEADERDATA, NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_HEADERDATA)."); done: H5MM_xfree(headerresponse); sds.magic += 1; /* set to bad magic */ FUNC_LEAVE_NOAPI(ret_value); - } /* H5FD_s3comms_s3r_getsize */ @@ -1167,26 +1055,19 @@ H5FD_s3comms_s3r_open(const char *url, HDfprintf(stdout, "called H5FD_s3comms_s3r_open.\n"); #endif + if(url == NULL || url[0] == '\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "url cannot be null."); - - if (url == NULL || url[0] == '\0') { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "url cannot be null.\n"); - } - - if (FAIL == H5FD_s3comms_parse_url(url, &purl)) { + if(FAIL == H5FD_s3comms_parse_url(url, &purl)) /* probably a malformed url, but could be internal error */ - HGOTO_ERROR(H5E_ARGS, H5E_CANTCREATE, NULL, - "unable to create parsed url structure"); - } + HGOTO_ERROR(H5E_ARGS, H5E_CANTCREATE, NULL, "unable to create parsed url structure"); + HDassert( purl != NULL ); /* if above passes, this must be true */ HDassert( purl->magic == S3COMMS_PARSED_URL_MAGIC ); handle = (s3r_t *)H5MM_malloc(sizeof(s3r_t)); - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, - "could not malloc space for handle.\n"); - } + if(handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "could not malloc space for handle."); handle->magic = S3COMMS_S3R_MAGIC; handle->purl = purl; @@ -1200,50 +1081,35 @@ H5FD_s3comms_s3r_open(const char *url, * RECORD AUTHENTICATION INFORMATION * *************************************/ - if ((region != NULL && *region != '\0') || - (id != NULL && *id != '\0') || - (signing_key != NULL)) - { - /* if one exists, all three must exist - */ - if (region == NULL || region[0] == '\0') { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "region cannot be null.\n"); - } - if (id == NULL || id[0] == '\0') { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "secret id cannot be null.\n"); - } - if (signing_key == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "signing key cannot be null.\n"); - } + if((region != NULL && *region != '\0') || + (id != NULL && *id != '\0') || + (signing_key != NULL)) { - /* copy strings - */ + /* if one exists, all three must exist */ + if(region == NULL || region[0] == '\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "region cannot be null."); + if(id == NULL || id[0] == '\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "secret id cannot be null."); + if(signing_key == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "signing key cannot be null."); + + /* copy strings */ tmplen = HDstrlen(region) + 1; handle->region = (char *)H5MM_malloc(sizeof(char) * tmplen); - if (handle->region == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "could not malloc space for handle region copy.\n"); - } + if(handle->region == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle region copy."); HDmemcpy(handle->region, region, tmplen); tmplen = HDstrlen(id) + 1; handle->secret_id = (char *)H5MM_malloc(sizeof(char) * tmplen); - if (handle->secret_id == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "could not malloc space for handle ID copy.\n"); - } + if(handle->secret_id == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle ID copy."); HDmemcpy(handle->secret_id, id, tmplen); tmplen = SHA256_DIGEST_LENGTH; - handle->signing_key = - (unsigned char *)H5MM_malloc(sizeof(unsigned char) * tmplen); - if (handle->signing_key == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "could not malloc space for handle key copy.\n"); - } + handle->signing_key = (unsigned char *)H5MM_malloc(sizeof(unsigned char) * tmplen); + if(handle->signing_key == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle key copy."); HDmemcpy(handle->signing_key, signing_key, tmplen); } /* if authentication information provided */ @@ -1252,61 +1118,23 @@ H5FD_s3comms_s3r_open(const char *url, ************************/ curlh = curl_easy_init(); + if(curlh == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem creating curl easy handle!"); - if (curlh == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "problem creating curl easy handle!\n"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTPGET, 1L)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_HTTPGET)."); - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_HTTPGET, - 1L) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_HTTPGET). " - "(placeholder flags)"); - } - - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_HTTP_VERSION, - CURL_HTTP_VERSION_1_1) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_HTTP_VERSION). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_HTTP_VERSION)."); - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_FAILONERROR, - 1L) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_FAILONERROR). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_FAILONERROR, 1L)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_FAILONERROR)."); - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_WRITEFUNCTION, - curlwritecallback) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_WRITEFUNCTION). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_WRITEFUNCTION, curlwritecallback)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_WRITEFUNCTION)."); - if ( CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_URL, - url) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "error while setting CURL option (CURLOPT_URL). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_URL, url)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "error while setting CURL option (CURLOPT_URL)."); #if S3COMMS_CURL_VERBOSITY > 1 /* CURL will print (to stdout) information for each operation @@ -1322,12 +1150,8 @@ H5FD_s3comms_s3r_open(const char *url, * GET FILE SIZE * *******************/ - if (FAIL == - H5FD_s3comms_s3r_getsize(handle) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "problem in H5FD_s3comms_s3r_getsize.\n"); - } + if(FAIL == H5FD_s3comms_s3r_getsize(handle)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem in H5FD_s3comms_s3r_getsize."); /********************* * FINAL PREPARATION * @@ -1339,27 +1163,22 @@ H5FD_s3comms_s3r_open(const char *url, ret_value = handle; done: - if (ret_value == NULL) { - if (curlh != NULL) { + if(ret_value == NULL) { + if(curlh != NULL) curl_easy_cleanup(curlh); - } - if (FAIL == H5FD_s3comms_free_purl(purl)) { - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "unable to free parsed url structure") - } - if (handle != NULL) { + if(FAIL == H5FD_s3comms_free_purl(purl)) + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to free parsed url structure") + if(handle != NULL) { H5MM_xfree(handle->region); H5MM_xfree(handle->secret_id); H5MM_xfree(handle->signing_key); - if (handle->httpverb != NULL) { + if(handle->httpverb != NULL) H5MM_xfree(handle->httpverb); - } H5MM_xfree(handle); } } FUNC_LEAVE_NOAPI(ret_value) - } /* H5FD_s3comms_s3r_open */ @@ -1433,27 +1252,17 @@ H5FD_s3comms_s3r_read(s3r_t *handle, * ABSOLUTELY NECESSARY SANITY-CHECKS * **************************************/ - if (handle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle cannot be null.\n"); - } - if (handle->magic != S3COMMS_S3R_MAGIC) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has invalid magic.\n"); - } - if (handle->curlhandle == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has bad (null) curlhandle.\n") - } - if (handle->purl == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle has bad (null) url.\n") - } + if(handle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null."); + if(handle->magic != S3COMMS_S3R_MAGIC) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic."); + if(handle->curlhandle == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle.") + if(handle->purl == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) url.") HDassert( handle->purl->magic == S3COMMS_PARSED_URL_MAGIC ); - if (offset > handle->filesize || (len + offset) > handle->filesize) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to read past EoF") - } + if(offset > handle->filesize || (len + offset) > handle->filesize) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to read past EoF") curlh = handle->curlhandle; @@ -1461,26 +1270,16 @@ H5FD_s3comms_s3r_read(s3r_t *handle, * PREPARE WRITEDATA * *********************/ - if (dest != NULL) { - sds = (struct s3r_datastruct *)H5MM_malloc( - sizeof(struct s3r_datastruct)); - if (sds == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "could not malloc destination datastructure.\n"); - } + if(dest != NULL) { + sds = (struct s3r_datastruct *)H5MM_malloc(sizeof(struct s3r_datastruct)); + if(sds == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc destination datastructure."); sds->magic = S3COMMS_CALLBACK_DATASTRUCT_MAGIC; sds->data = (char *)dest; sds->size = 0; - if (CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_WRITEDATA, - sds) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, - "error while setting CURL option (CURLOPT_WRITEDATA). " - "(placeholder flags)"); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_WRITEDATA, sds)) + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "error while setting CURL option (CURLOPT_WRITEDATA)."); } /********************* @@ -1488,34 +1287,22 @@ H5FD_s3comms_s3r_read(s3r_t *handle, *********************/ if (len > 0) { - rangebytesstr = (char *)H5MM_malloc(sizeof(char) * \ - (S3COMMS_MAX_RANGE_STRING_SIZE+1) ); - if (rangebytesstr == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "could not malloc range format string.\n"); - } - ret = HDsnprintf(rangebytesstr, - (S3COMMS_MAX_RANGE_STRING_SIZE), + rangebytesstr = (char *)H5MM_malloc(sizeof(char) * (S3COMMS_MAX_RANGE_STRING_SIZE+1) ); + if(rangebytesstr == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string."); + ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes="H5_PRINTF_HADDR_FMT"-"H5_PRINTF_HADDR_FMT, - offset, - offset + len - 1); - if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to format HTTP Range value"); - } else if (offset > 0) { - rangebytesstr = (char *)H5MM_malloc(sizeof(char) * \ - (S3COMMS_MAX_RANGE_STRING_SIZE+1)); - if (rangebytesstr == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "could not malloc range format string.\n"); - } - ret = HDsnprintf(rangebytesstr, - (S3COMMS_MAX_RANGE_STRING_SIZE), - "bytes="H5_PRINTF_HADDR_FMT"-", - offset); - if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to format HTTP Range value"); + offset, offset + len - 1); + if(ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value"); + } else if(offset > 0) { + rangebytesstr = (char *)H5MM_malloc(sizeof(char) * (S3COMMS_MAX_RANGE_STRING_SIZE+1)); + if(rangebytesstr == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string."); + ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), + "bytes="H5_PRINTF_HADDR_FMT"-", offset); + if(ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value"); } /******************* @@ -1523,26 +1310,18 @@ H5FD_s3comms_s3r_read(s3r_t *handle, *******************/ if (handle->signing_key == NULL) { - /* Do not authenticate. - */ - if (rangebytesstr != NULL) { - /* Pass in range directly - */ + /* Do not authenticate. */ + if(rangebytesstr != NULL) { + /* Pass in range directly */ char *bytesrange_ptr = NULL; /* pointer past "bytes=" portion */ - bytesrange_ptr = strchr(rangebytesstr, '='); + bytesrange_ptr = HDstrchr(rangebytesstr, '='); HDassert( bytesrange_ptr != NULL ); bytesrange_ptr++; /* move to first char past '=' */ HDassert( *bytesrange_ptr != '\0' ); - if (CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_RANGE, - bytesrange_ptr) ) - { - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, - "error while setting CURL option (CURLOPT_RANGE). "); - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, bytesrange_ptr)) + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "error while setting CURL option (CURLOPT_RANGE). "); } } else { /* authenticate request @@ -1575,30 +1354,18 @@ H5FD_s3comms_s3r_read(s3r_t *handle, /**** VERIFY INFORMATION EXISTS ****/ - if (handle->region == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle must have non-null region.\n"); - } - if (handle->secret_id == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle must have non-null secret_id.\n"); - } - if (handle->signing_key == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle must have non-null signing_key.\n"); - } - if (handle->httpverb == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle must have non-null httpverb.\n"); - } - if (handle->purl->host == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle must have non-null host.\n"); - } - if (handle->purl->path == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "handle must have non-null resource.\n"); - } + if(handle->region == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null region."); + if(handle->secret_id == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null secret_id."); + if(handle->signing_key == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null signing_key."); + if(handle->httpverb == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null httpverb."); + if(handle->purl->host == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null host."); + if(handle->purl->path == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null resource."); /**** CREATE HTTP REQUEST STRUCTURE (hrb_t) ****/ @@ -1606,198 +1373,93 @@ H5FD_s3comms_s3r_read(s3r_t *handle, (const char *)handle->httpverb, (const char *)handle->purl->path, "HTTP/1.1"); - if (request == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not allocate hrb_t request.\n"); - } + if(request == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not allocate hrb_t request."); HDassert( request->magic == S3COMMS_HRB_MAGIC ); now = gmnow(); - if (ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not format ISO8601 time.\n"); - } + if(ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not format ISO8601 time."); - if (FAIL == - H5FD_s3comms_hrb_node_set( - &headers, - "x-amz-date", - (const char *)iso8601now) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to set x-amz-date header") - } - if (headers == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - } + if(FAIL == H5FD_s3comms_hrb_node_set( &headers, "x-amz-date", (const char *)iso8601now)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-date header") + if(headers == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); HDassert( headers->magic == S3COMMS_HRB_NODE_MAGIC ); - if (FAIL == - H5FD_s3comms_hrb_node_set( - &headers, - "x-amz-content-sha256", - (const char *)EMPTY_SHA256) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to set x-amz-content-sha256 header") - } - if (headers == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - } + if(FAIL == H5FD_s3comms_hrb_node_set(&headers, "x-amz-content-sha256", (const char *)EMPTY_SHA256)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-content-sha256 header") + if(headers == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); HDassert( headers->magic == S3COMMS_HRB_NODE_MAGIC ); - if (rangebytesstr != NULL) { - if (FAIL == - H5FD_s3comms_hrb_node_set( - &headers, - "Range", - (const char *)rangebytesstr) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to set range header") - } - if (headers == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - } + if(rangebytesstr != NULL) { + if(FAIL == H5FD_s3comms_hrb_node_set( &headers, "Range", rangebytesstr)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set range header") + if(headers == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); HDassert( headers->magic == S3COMMS_HRB_NODE_MAGIC ); } - if (FAIL == - H5FD_s3comms_hrb_node_set( - &headers, - "Host", - (const char *)handle->purl->host) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to set host header") - } - if (headers == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - } + if(FAIL == H5FD_s3comms_hrb_node_set(&headers, "Host", handle->purl->host)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set host header") + if(headers == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); HDassert( headers->magic == S3COMMS_HRB_NODE_MAGIC ); request->first_header = headers; /**** COMPUTE AUTHORIZATION ****/ - if (FAIL == /* buffer1 -> canonical request */ - H5FD_s3comms_aws_canonical_request( - buffer1, - 512, - signed_headers, - 48, - request) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "(placeholder flags)\n"); - } - if ( FAIL == /* buffer2->string-to-sign */ - H5FD_s3comms_tostringtosign(buffer2, - buffer1, - iso8601now, - handle->region) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "(placeholder flags)\n"); - } - if (FAIL == /* buffer1 -> signature */ - H5FD_s3comms_HMAC_SHA256(handle->signing_key, - SHA256_DIGEST_LENGTH, - buffer2, - HDstrlen(buffer2), - buffer1) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "(placeholder flags)\n"); - } + /* buffer1 -> canonical request */ + if(FAIL == H5FD_s3comms_aws_canonical_request(buffer1, 512, signed_headers, 48, request)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad canonical request"); + /* buffer2->string-to-sign */ + if(FAIL == H5FD_s3comms_tostringtosign(buffer2, buffer1, iso8601now, handle->region)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad string-to-sign"); + /* buffer1 -> signature */ + if(FAIL == H5FD_s3comms_HMAC_SHA256(handle->signing_key, SHA256_DIGEST_LENGTH, buffer2, HDstrlen(buffer2), buffer1)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad signature"); iso8601now[8] = 0; /* trim to yyyyMMDD */ - ret = S3COMMS_FORMAT_CREDENTIAL(buffer2, - handle->secret_id, - iso8601now, - handle->region, - "s3"); - if (ret == 0 || ret >= S3COMMS_MAX_CREDENTIAL_SIZE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to format aws4 credential string"); - - ret = HDsnprintf( - authorization, - 512, + ret = S3COMMS_FORMAT_CREDENTIAL(buffer2, handle->secret_id, iso8601now, handle->region, "s3"); + if(ret == 0 || ret >= S3COMMS_MAX_CREDENTIAL_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format aws4 credential string"); + + ret = HDsnprintf( authorization, 512, "AWS4-HMAC-SHA256 Credential=%s,SignedHeaders=%s,Signature=%s", - buffer2, - signed_headers, - buffer1); - if (ret <= 0 || ret >= 512) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to format aws4 authorization string"); - } + buffer2, signed_headers, buffer1); + if(ret <= 0 || ret >= 512) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format aws4 authorization string"); - /* append authorization header to http request buffer - */ - if (H5FD_s3comms_hrb_node_set( - &headers, - "Authorization", - (const char *)authorization) - == FAIL) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to set Authorization header") - } - if (headers == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem building headers list. " - "(placeholder flags)\n"); - } + /* append authorization header to http request buffer */ + if(H5FD_s3comms_hrb_node_set(&headers, "Authorization", (const char *)authorization) == FAIL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set Authorization header") + if(headers == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); - /* update hrb's "first header" pointer - */ + /* update hrb's "first header" pointer */ request->first_header = headers; /**** SET CURLHANDLE HTTP HEADERS FROM GENERATED DATA ****/ node = request->first_header; - while (node != NULL) { + while(node != NULL) { HDassert( node->magic == S3COMMS_HRB_NODE_MAGIC ); - curlheaders = curl_slist_append(curlheaders, - (const char *)node->cat); - if (curlheaders == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not append header to curl slist. " - "(placeholder flags)\n"); - } + curlheaders = curl_slist_append(curlheaders, (const char *)node->cat); + if(curlheaders == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not append header to curl slist."); node = node->next; } - /* sanity-check - */ - if (curlheaders == NULL) { + /* sanity-check */ + if(curlheaders == NULL) /* above loop was probably never run */ - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "curlheaders was never populated.\n"); - } - - /* finally, set http headers in curl handle - */ - if (curl_easy_setopt( - curlh, - CURLOPT_HTTPHEADER, - curlheaders) - != CURLE_OK) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while setting CURL option " - "(CURLOPT_HTTPHEADER). (placeholder flags)"); - } + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "curlheaders was never populated."); + /* finally, set http headers in curl handle */ + if(curl_easy_setopt(curlh, CURLOPT_HTTPHEADER, curlheaders) != CURLE_OK) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_HTTPHEADER)."); } /* end if should authenticate (info provided) */ /******************* @@ -1813,107 +1475,79 @@ H5FD_s3comms_s3r_read(s3r_t *handle, char curlerrbuf[CURL_ERROR_SIZE]; curlerrbuf[0] = '\0'; - if (CURLE_OK != - curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, curlerrbuf) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem setting error buffer") - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, curlerrbuf)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem setting error buffer") p_status = curl_easy_perform(curlh); - if (p_status != CURLE_OK) { - if (CURLE_OK != - curl_easy_getinfo(curlh, CURLINFO_RESPONSE_CODE, &httpcode) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem getting response code") - } + if(p_status != CURLE_OK) { + if(CURLE_OK != curl_easy_getinfo(curlh, CURLINFO_RESPONSE_CODE, &httpcode)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem getting response code") HDfprintf(stderr, "CURL ERROR CODE: %d\nHTTP CODE: %d\n", p_status, httpcode); HDfprintf(stderr, "%s\n", curl_easy_strerror(p_status)); - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, - "problem while performing request.\n"); - } - if (CURLE_OK != - curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, NULL) ) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem unsetting error buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "problem while performing request."); } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem unsetting error buffer") } /* verbose error reporting */ #else p_status = curl_easy_perform(curlh); - if (p_status != CURLE_OK) { - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, - "curl cannot perform request\n") - } + if(p_status != CURLE_OK) + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "curl cannot perform request") #endif #if S3COMMS_DEBUG - if (dest != NULL) { + if(dest != NULL) { HDfprintf(stderr, "len: %d\n", (int)len); HDfprintf(stderr, "CHECKING FOR BUFFER OVERFLOW\n"); - if (sds == NULL) { + if(sds == NULL) HDfprintf(stderr, "sds is NULL!\n"); - } else { HDfprintf(stderr, "sds: 0x%lx\n", (long long)sds); HDfprintf(stderr, "sds->size: %d\n", (int)sds->size); - if (len > sds->size) { + if(len > sds->size) HDfprintf(stderr, "buffer overwrite\n"); - } } } - else { + else HDfprintf(stderr, "performed on entire file\n"); - } #endif done: /* clean any malloc'd resources */ - if (curlheaders != NULL) { + if(curlheaders != NULL) { curl_slist_free_all(curlheaders); curlheaders = NULL; } - if (rangebytesstr != NULL) { + if(rangebytesstr != NULL) { H5MM_xfree(rangebytesstr); rangebytesstr = NULL; } - if (sds != NULL) { + if(sds != NULL) { H5MM_xfree(sds); sds = NULL; } - if (request != NULL) { - while (headers != NULL) - if (FAIL == - H5FD_s3comms_hrb_node_set(&headers, headers->name, NULL)) - { - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot release header node") - } + if(request != NULL) { + while(headers != NULL) + if(FAIL == H5FD_s3comms_hrb_node_set(&headers, headers->name, NULL)) + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot release header node") HDassert( NULL == headers ); - if (FAIL == H5FD_s3comms_hrb_destroy(&request)) { - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot release header request structure") - } + if(FAIL == H5FD_s3comms_hrb_destroy(&request)) + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot release header request structure") HDassert( NULL == request ); } - if (curlh != NULL) { + if(curlh != NULL) { /* clear any Range */ - if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, NULL) ) { - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot unset CURLOPT_RANGE") - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, NULL)) + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot unset CURLOPT_RANGE") /* clear headers */ - if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTPHEADER, NULL) ) { - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot unset CURLOPT_HTTPHEADER") - } + if(CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTPHEADER, NULL)) + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot unset CURLOPT_HTTPHEADER") } FUNC_LEAVE_NOAPI(ret_value); @@ -1951,9 +1585,8 @@ gmnow(void) struct tm *ret_value = NULL; /* Doctor assert, checks against error in time() */ - if ( (time_t)(-1) != time(now_ptr) ) { - ret_value = gmtime(now_ptr); - } + if((time_t)(-1) != HDtime(now_ptr)) + ret_value = HDgmtime(now_ptr); HDassert( ret_value != NULL ); @@ -2035,102 +1668,66 @@ H5FD_s3comms_aws_canonical_request( HDfprintf(stdout, "called H5FD_s3comms_aws_canonical_request.\n"); #endif - if (http_request == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "hrb object cannot be null.\n"); - } + if(http_request == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hrb object cannot be null."); HDassert( http_request->magic == S3COMMS_HRB_MAGIC ); - if (canonical_request_dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "canonical request destination cannot be null.\n"); - } + if(canonical_request_dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "canonical request destination cannot be null."); - if (signed_headers_dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "signed headers destination cannot be null.\n"); - } + if(signed_headers_dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "signed headers destination cannot be null."); - /* HTTP verb, resource path, and query string lines - */ + /* HTTP verb, resource path, and query string lines */ cr_len = (HDstrlen(http_request->verb) + HDstrlen(http_request->resource) + HDstrlen(query_params) + (size_t)3); /* three newline chars */ - if (cr_len >= cr_size) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "not enough space in canonical request"); - } - ret = HDsnprintf( /* TODO: compiler warning */ - canonical_request_dest, - (cr_size-1), + if(cr_len >= cr_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request"); + /* TODO: compiler warning */ + ret = HDsnprintf(canonical_request_dest, (cr_size - 1), "%s\n%s\n%s\n", - http_request->verb, - http_request->resource, - query_params); - if (ret < 0 || (size_t)ret >= cr_size) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to compose canonical request first line"); - } + http_request->verb, http_request->resource, query_params); + if(ret < 0 || (size_t)ret >= cr_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to compose canonical request first line"); - /* write in canonical headers, building signed headers concurrently - */ + /* write in canonical headers, building signed headers concurrently */ node = http_request->first_header; /* assumed sorted */ - while (node != NULL) { + while(node != NULL) { HDassert(node->magic == S3COMMS_HRB_NODE_MAGIC); - ret = HDsnprintf( - tmpstr, - 256, - "%s:%s\n", - node->lowername, - node->value); - if (ret < 0 || ret >= 256) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to concatenate HTTP header %s:%s", - node->lowername, - node->value); - } + ret = HDsnprintf( tmpstr, 256, "%s:%s\n", node->lowername, node->value); + if(ret < 0 || ret >= 256) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to concatenate HTTP header %s:%s", node->lowername, node->value); cr_len += HDstrlen(tmpstr); - if (cr_len + 1 > cr_size) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "not enough space in canonical request"); - } - strcat(canonical_request_dest, tmpstr); - - ret = HDsnprintf( - tmpstr, - 256, - "%s;", - node->lowername); - if (ret < 0 || ret >= 256) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to append semicolon to lowername %s", - node->lowername); - } + if(cr_len + 1 > cr_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request"); + HDstrcat(canonical_request_dest, tmpstr); + + ret = HDsnprintf( tmpstr, 256, "%s;", node->lowername); + if(ret < 0 || ret >= 256) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to append semicolon to lowername %s", node->lowername); sh_len += HDstrlen(tmpstr); - if (sh_len + 1 > sh_size) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "not enough space in signed headers"); - } - strcat(signed_headers_dest, tmpstr); + if(sh_len + 1 > sh_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in signed headers"); + HDstrcat(signed_headers_dest, tmpstr); node = node->next; } /* end while node is not NULL */ - /* remove tailing ';' from signed headers sequence - */ + /* remove trailing ';' from signed headers sequence */ signed_headers_dest[HDstrlen(signed_headers_dest) - 1] = '\0'; /* append signed headers and payload hash * NOTE: at present, no HTTP body is handled, per the nature of * requests/range-gets */ - strcat(canonical_request_dest, "\n"); - strcat(canonical_request_dest, signed_headers_dest); - strcat(canonical_request_dest, "\n"); - strcat(canonical_request_dest, EMPTY_SHA256); + HDstrcat(canonical_request_dest, "\n"); + HDstrcat(canonical_request_dest, signed_headers_dest); + HDstrcat(canonical_request_dest, "\n"); + HDstrcat(canonical_request_dest, EMPTY_SHA256); done: FUNC_LEAVE_NOAPI(ret_value); @@ -2184,30 +1781,20 @@ H5FD_s3comms_bytes_to_hex( HDfprintf(stdout, "called H5FD_s3comms_bytes_to_hex.\n"); #endif - if (dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "hex destination cannot be null.\n") - } - if (msg == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "bytes sequence cannot be null.\n") - } + if(dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hex destination cannot be null.") + if(msg == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bytes sequence cannot be null.") for (i = 0; i < msg_len; i++) { - int chars_written = HDsnprintf(&(dest[i * 2]), - 3, /* 'X', 'X', '\n' */ - (lowercase == TRUE) ? "%02x" : "%02X", - msg[i]); - if (chars_written != 2) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem while writing hex chars for %c", - msg[i]); - } + int chars_written = HDsnprintf(&(dest[i * 2]), 3, /* 'X', 'X', '\n' */ + (lowercase == TRUE) ? "%02x" : "%02X", msg[i]); + if(chars_written != 2) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem while writing hex chars for %c", msg[i]); } done: FUNC_LEAVE_NOAPI(ret_value); - } /* end H5FD_s3comms_bytes_to_hex() */ @@ -2239,13 +1826,18 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) HDprintf("called H5FD_s3comms_free_purl.\n"); #endif - if (purl != NULL) { + if(purl != NULL) { HDassert( purl->magic == S3COMMS_PARSED_URL_MAGIC ); - if (purl->scheme != NULL) { H5MM_xfree(purl->scheme); } - if (purl->host != NULL) { H5MM_xfree(purl->host); } - if (purl->port != NULL) { H5MM_xfree(purl->port); } - if (purl->path != NULL) { H5MM_xfree(purl->path); } - if (purl->query != NULL) { H5MM_xfree(purl->query); } + if(purl->scheme != NULL) + H5MM_xfree(purl->scheme); + if(purl->host != NULL) + H5MM_xfree(purl->host); + if(purl->port != NULL) + H5MM_xfree(purl->port); + if(purl->path != NULL) + H5MM_xfree(purl->path); + if(purl->query != NULL) + H5MM_xfree(purl->query); purl->magic += 1ul; H5MM_xfree(purl); } @@ -2302,29 +1894,14 @@ H5FD_s3comms_HMAC_SHA256( HDfprintf(stdout, "called H5FD_s3comms_HMAC_SHA256.\n"); #endif - if (dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "destination cannot be null."); - } + if(dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null."); - HMAC(EVP_sha256(), - key, - (int)key_len, - (const unsigned char *)msg, - msg_len, - md, - &md_len); - - if (H5FD_s3comms_bytes_to_hex( - dest, - (const unsigned char *)md, - (size_t)md_len, - true) - == FAIL) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not convert to hex string."); - } + HMAC(EVP_sha256(), key, (int)key_len, (const unsigned char *)msg, + msg_len, md, &md_len); + + if(H5FD_s3comms_bytes_to_hex(dest, (const unsigned char *)md, (size_t)md_len, true) == FAIL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not convert to hex string."); done: FUNC_LEAVE_NOAPI(ret_value); @@ -2407,93 +1984,73 @@ H5FD__s3comms_load_aws_creds_from_file( int found_setting = 0; char *line_buffer = &(buffer[0]); - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #if S3COMMS_DEBUG HDfprintf(stdout, "called load_aws_creds_from_file.\n"); #endif /* format target line for start of profile */ - if (32 < HDsnprintf(profile_line, 32, "[%s]", profile_name)) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, - "unable to format profile label") - } + if(32 < HDsnprintf(profile_line, 32, "[%s]", profile_name)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format profile label") /* look for start of profile */ do { /* clear buffer */ - for (buffer_i=0; buffer_i < 128; buffer_i++) { + for(buffer_i=0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0; - } line_buffer = fgets(line_buffer, 128, file); - if (line_buffer == NULL) { /* reached end of file */ + if(line_buffer == NULL) /* reached end of file */ goto done; - } - } while (strncmp(line_buffer, profile_line, HDstrlen(profile_line))); + } while (HDstrncmp(line_buffer, profile_line, HDstrlen(profile_line))); /* extract credentials from lines */ do { /* clear buffer */ - for (buffer_i=0; buffer_i < 128; buffer_i++) { + for(buffer_i=0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0; - } /* collect a line from file */ line_buffer = fgets(line_buffer, 128, file); - if (line_buffer == NULL) { + if(line_buffer == NULL) goto done; /* end of file */ - } /* loop over names to see if line looks like assignment */ - for (setting_i = 0; setting_i < setting_count; setting_i++) { + for(setting_i = 0; setting_i < setting_count; setting_i++) { size_t setting_name_len = 0; const char *setting_name = NULL; char line_prefix[128]; setting_name = setting_names[setting_i]; setting_name_len = HDstrlen(setting_name); - if (HDsnprintf(line_prefix, 128, "%s=", setting_name) < 0) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, - "unable to format line prefix") - } + if(HDsnprintf(line_prefix, 128, "%s=", setting_name) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format line prefix") /* found a matching name? */ - if (!HDstrncmp(line_buffer, line_prefix, setting_name_len + 1)) { + if(!HDstrncmp(line_buffer, line_prefix, setting_name_len + 1)) { found_setting = 1; /* skip NULL destination buffer */ - if (setting_pointers[setting_i] == NULL) { + if(setting_pointers[setting_i] == NULL) break; - } /* advance to end of name in string */ do { line_buffer++; } while (*line_buffer != 0 && *line_buffer != '='); - if (*line_buffer == 0 || *(line_buffer+1) == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "incomplete assignment in file") - } + if(*line_buffer == 0 || *(line_buffer+1) == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incomplete assignment in file") line_buffer++; /* was pointing at '='; advance */ /* copy line buffer into out pointer */ - if (HDstrncpy( - setting_pointers[setting_i], - (const char *)line_buffer, - HDstrlen(line_buffer)) - == NULL) - { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, - "unable to copy line into pointer") - } + HDstrncpy(setting_pointers[setting_i], (const char *)line_buffer, HDstrlen(line_buffer)); /* "trim" tailing whitespace by replacing with null terminator*/ buffer_i = 0; - while (!isspace(setting_pointers[setting_i][buffer_i])) { + while(!HDisspace(setting_pointers[setting_i][buffer_i])) buffer_i++; - } setting_pointers[setting_i][buffer_i] = '\0'; break; /* have read setting; don't compare with others */ @@ -2561,76 +2118,46 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, #else ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("HOME")) ; #endif - if (ret < 0 || (size_t)ret >= 117) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, - "unable to format home-aws path") - } + if(ret < 0 || (size_t)ret >= 117) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format home-aws path") ret = HDsnprintf(filepath, 128, "%s%s", awspath, "credentials"); - if (ret < 0 || (size_t)ret >= 128) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, - "unable to format credentials path") - } - - credfile = fopen(filepath, "r"); - if (credfile != NULL) { - if (H5FD__s3comms_load_aws_creds_from_file( - credfile, - profile_name, - key_id_out, - secret_access_key_out, - aws_region_out) - == FAIL) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to load from aws credentials") - } - if (fclose(credfile) == EOF) { - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, - "unable to close credentials file") - } + if(ret < 0 || (size_t)ret >= 128) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format credentials path") + + credfile = HDfopen(filepath, "r"); + if(credfile != NULL) { + if(H5FD__s3comms_load_aws_creds_from_file(credfile, profile_name, key_id_out, + secret_access_key_out, aws_region_out) == FAIL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws credentials") + if(HDfclose(credfile) == EOF) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close credentials file") credfile = NULL; } /* end if credential file opened */ ret = HDsnprintf(filepath, 128, "%s%s", awspath, "config"); - if (ret < 0 || (size_t)ret >= 128) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, - "unable to format config path") - } - credfile = fopen(filepath, "r"); - if (credfile != NULL) { - if (H5FD__s3comms_load_aws_creds_from_file( - credfile, - profile_name, + if(ret < 0 || (size_t)ret >= 128) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format config path") + credfile = HDfopen(filepath, "r"); + if(credfile != NULL) { + if(H5FD__s3comms_load_aws_creds_from_file( credfile, profile_name, (*key_id_out == 0) ? key_id_out : NULL, (*secret_access_key_out == 0) ? secret_access_key_out : NULL, - (*aws_region_out == 0) ? aws_region_out : NULL) - == FAIL) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to load from aws config") - } - if (fclose(credfile) == EOF) { - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, - "unable to close config file") - } + (*aws_region_out == 0) ? aws_region_out : NULL) == FAIL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws config") + if(HDfclose(credfile) == EOF) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close config file") credfile = NULL; } /* end if credential file opened */ /* fail if not all three settings were loaded */ - if (*key_id_out == 0 || - *secret_access_key_out == 0 || - *aws_region_out == 0) - { + if(*key_id_out == 0 || *secret_access_key_out == 0 || *aws_region_out == 0) ret_value = FAIL; - } done: - if (credfile != NULL) { - if (fclose(credfile) == EOF) { - HDONE_ERROR(H5E_ARGS, H5E_ARGS, FAIL, - "problem error-closing aws configuration file") - } - } + if(credfile != NULL) + if(HDfclose(credfile) == EOF) + HDONE_ERROR(H5E_ARGS, H5E_ARGS, FAIL, "problem error-closing aws configuration file") + FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_load_aws_profile() */ @@ -2675,16 +2202,14 @@ H5FD_s3comms_nlowercase( HDfprintf(stdout, "called H5FD_s3comms_nlowercase.\n"); #endif - if (dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "destination cannot be null.\n"); - } + if(dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null."); - if (len > 0) { + if(len > 0) { HDmemcpy(dest, s, len); do { len--; - dest[len] = (char)tolower( (int)dest[len] ); + dest[len] = (char)HDtolower((int)dest[len]); } while (len > 0); } @@ -2743,18 +2268,14 @@ H5FD_s3comms_parse_url( HDprintf("called H5FD_s3comms_parse_url.\n"); #endif - if (str == NULL || *str == '\0') { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "invalid url string"); - } + if(str == NULL || *str == '\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid url string"); urllen = (long int)HDstrlen(str); purl = (parsed_url_t *)H5MM_malloc(sizeof(parsed_url_t)); - if (purl == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "can't allocate space for parsed_url_t"); - } + if(purl == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for parsed_url_t"); purl->magic = S3COMMS_PARSED_URL_MAGIC; purl->scheme = NULL; purl->host = NULL; @@ -2767,38 +2288,27 @@ H5FD_s3comms_parse_url( ***************/ tmpstr = HDstrchr(curstr, ':'); - if (tmpstr == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "invalid SCHEME construction: probably not URL"); - } + if(tmpstr == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid SCHEME construction: probably not URL"); len = tmpstr - curstr; HDassert( (0 <= len) && (len < urllen) ); - /* check for restrictions - */ - for (i = 0; i < len; i++) { + /* check for restrictions */ + for(i = 0; i < len; i++) { /* scheme = [a-zA-Z+-.]+ (terminated by ":") */ - if (!isalpha(curstr[i]) && - '+' != curstr[i] && - '-' != curstr[i] && - '.' != curstr[i]) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "invalid SCHEME construction"); - } + if(!HDisalpha(curstr[i]) && '+' != curstr[i] && '-' != curstr[i] && + '.' != curstr[i]) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid SCHEME construction"); } - /* copy lowercased scheme to structure - */ + + /* copy lowercased scheme to structure */ purl->scheme = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); - if (purl->scheme == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "can't allocate space for SCHEME"); - } + if(purl->scheme == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for SCHEME"); (void)HDstrncpy(purl->scheme, curstr, (size_t)len); purl->scheme[len] = '\0'; - for ( i = 0; i < len; i++ ) { - purl->scheme[i] = (char)tolower(purl->scheme[i]); - } + for(i = 0; i < len; i++ ) + purl->scheme[i] = (char)HDtolower(purl->scheme[i]); /* Skip "://" */ tmpstr += 3; @@ -2808,46 +2318,33 @@ H5FD_s3comms_parse_url( * READ HOST * *************/ - if (*curstr == '[') { + if(*curstr == '[') { /* IPv6 */ - while (']' != *tmpstr) { - if (tmpstr == 0) { /* end of string reached! */ - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "reached end of URL: incomplete IPv6 HOST"); - } + while(']' != *tmpstr) { + /* end of string reached! */ + if(tmpstr == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reached end of URL: incomplete IPv6 HOST"); tmpstr++; } tmpstr++; } /* end if (IPv6) */ else { - while (0 != *tmpstr) { - if (':' == *tmpstr || - '/' == *tmpstr || - '?' == *tmpstr) - { + while(0 != *tmpstr) { + if(':' == *tmpstr || '/' == *tmpstr || '?' == *tmpstr) break; - } tmpstr++; } } /* end else (IPv4) */ len = tmpstr - curstr; - if (len == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "HOST substring cannot be empty"); - } - else - if (len > urllen) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem with length of HOST substring"); - } + if(len == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HOST substring cannot be empty"); + else if(len > urllen) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of HOST substring"); - /* copy host - */ + /* copy host */ purl->host = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); - if (purl->host == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "can't allocate space for HOST"); - } + if(purl->host == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for HOST"); (void)HDstrncpy(purl->host, curstr, (size_t)len); purl->host[len] = 0; @@ -2855,36 +2352,24 @@ H5FD_s3comms_parse_url( * READ PORT * *************/ - if (':' == *tmpstr) { + if(':' == *tmpstr) { tmpstr += 1; /* advance past ':' */ curstr = tmpstr; - while ((0 != *tmpstr) && ('/' != *tmpstr) && ('?' != *tmpstr)) { + while((0 != *tmpstr) && ('/' != *tmpstr) && ('?' != *tmpstr)) tmpstr++; - } len = tmpstr - curstr; - if (len == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "PORT element cannot be empty"); - } - else - if (len > urllen) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem with length of PORT substring"); - } - for (i = 0; i < len; i ++) { - if (!isdigit(curstr[i])) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "PORT is not a decimal string"); - } - } - - /* copy port - */ + if(len == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "PORT element cannot be empty"); + else if(len > urllen) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of PORT substring"); + for(i = 0; i < len; i ++) + if(!HDisdigit(curstr[i])) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "PORT is not a decimal string"); + + /* copy port */ purl->port = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); - if (purl->port == NULL) { /* cannot malloc */ - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "can't allocate space for PORT"); - } + if(purl->port == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for PORT"); (void)HDstrncpy(purl->port, curstr, (size_t)len); purl->port[len] = 0; } /* end if PORT element */ @@ -2893,27 +2378,21 @@ H5FD_s3comms_parse_url( * READ PATH * *************/ - if ('/' == *tmpstr) { + if('/' == *tmpstr) { /* advance past '/' */ tmpstr += 1; curstr = tmpstr; - /* seek end of PATH - */ - while ((0 != *tmpstr) && ('?' != *tmpstr)) { + /* seek end of PATH */ + while((0 != *tmpstr) && ('?' != *tmpstr)) tmpstr++; - } len = tmpstr - curstr; - if (len > urllen) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem with length of PATH substring"); - } - if (len > 0) { + if(len > urllen) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of PATH substring"); + if(len > 0) { purl->path = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); - if (purl->path == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "can't allocate space for PATH"); - } /* cannot malloc path pointer */ + if(purl->path == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for PATH"); (void)HDstrncpy(purl->path, curstr, (size_t)len); purl->path[len] = 0; } @@ -2923,25 +2402,19 @@ H5FD_s3comms_parse_url( * READ QUERY * **************/ - if ('?' == *tmpstr) { + if('?' == *tmpstr) { tmpstr += 1; curstr = tmpstr; - while (0 != *tmpstr) { + while(0 != *tmpstr) tmpstr++; - } len = tmpstr - curstr; - if (len == 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "QUERY cannot be empty"); - } else if (len > urllen) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem with length of QUERY substring"); - } + if(len == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "QUERY cannot be empty"); + else if(len > urllen) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of QUERY substring"); purl->query = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); - if (purl->query == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "can't allocate space for QUERY"); - } /* cannot malloc path pointer */ + if(purl->query == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for QUERY"); (void)HDstrncpy(purl->query, curstr, (size_t)len); purl->query[len] = 0; } /* end if QUERY exists */ @@ -2950,9 +2423,9 @@ H5FD_s3comms_parse_url( ret_value = SUCCEED; done: - if (ret_value == FAIL) { + if(ret_value == FAIL) H5FD_s3comms_free_purl(purl); - } + FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_parse_url() */ @@ -3016,9 +2489,8 @@ H5FD_s3comms_percent_encode_char( HDfprintf(stdout, "called H5FD_s3comms_percent_encode_char.\n"); #endif - if (repr == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination `repr`.\n") - } + if(repr == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination `repr`.") #if S3COMMS_DEBUG H5FD_s3comms_bytes_to_hex((char *)hex, s, 1, FALSE); @@ -3026,7 +2498,7 @@ H5FD_s3comms_percent_encode_char( HDfprintf(stdout, " CHAR-HEX: \"%s\"\n", hex); #endif - if (c <= (unsigned char)0x7f) { + if(c <= (unsigned char)0x7f) { /* character represented in a single "byte" * and single percent-code */ @@ -3035,11 +2507,8 @@ H5FD_s3comms_percent_encode_char( #endif *repr_len = 3; chars_written = HDsnprintf(repr, 4, "%%%02X", c); - if (chars_written < 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot write char %c", - c); - } + if(chars_written < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); } /* end if single-byte unicode char */ else { /* multi-byte, multi-percent representation @@ -3092,16 +2561,9 @@ H5FD_s3comms_percent_encode_char( acc += (stack_size > 2) ? 0x20 : 0; /* 0x00100000 */ acc += (stack_size > 3) ? 0x10 : 0; /* 0x00010000 */ stack_size--; - chars_written = HDsnprintf( - repr, - 4, - "%%%02X", - (unsigned char)(acc + stack[stack_size])); - if (chars_written < 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot write char %c", - c); - } + chars_written = HDsnprintf( repr, 4, "%%%02X", (unsigned char)(acc + stack[stack_size])); + if(chars_written < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); *repr_len += 3; /************************ @@ -3109,17 +2571,11 @@ H5FD_s3comms_percent_encode_char( ************************/ /* 10xxxxxx */ - for (i = 0; i < stack_size; i++) { - chars_written = HDsnprintf( - &repr[i*3 + 3], - 4, - "%%%02X", - (unsigned char)(0x80 + stack[stack_size - 1 - i])); - if (chars_written < 0) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "cannot write char %c", - c); - } + for(i = 0; i < stack_size; i++) { + chars_written = HDsnprintf( &repr[i*3 + 3], 4, + "%%%02X", (unsigned char)(0x80 + stack[stack_size - 1 - i])); + if(chars_written < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); *repr_len += 3; } /* end for each continuation byte */ } /* end else (multi-byte) */ @@ -3190,38 +2646,24 @@ H5FD_s3comms_signing_key( HDfprintf(stdout, "called H5FD_s3comms_signing_key.\n"); #endif - if (md == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Destination `md` cannot be NULL.\n") - } - if (secret == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "`secret` cannot be NULL.\n") - } - if (region == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "`region` cannot be NULL.\n") - } - if (iso8601now == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "`iso8601now` cannot be NULL.\n") - } + if(md == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Destination `md` cannot be NULL.") + if(secret == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`secret` cannot be NULL.") + if(region == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`region` cannot be NULL.") + if(iso8601now == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`iso8601now` cannot be NULL.") AWS4_secret_len = 4 + HDstrlen(secret) + 1; AWS4_secret = (char*)H5MM_malloc(sizeof(char *) * AWS4_secret_len); - if (AWS4_secret == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Could not allocate space.\n") - } + if(AWS4_secret == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Could not allocate space.") - /* prepend "AWS4" to start of the secret key - */ + /* prepend "AWS4" to start of the secret key */ ret = HDsnprintf(AWS4_secret, AWS4_secret_len,"%s%s", "AWS4", secret); - if ((size_t)ret != (AWS4_secret_len - 1)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem writing AWS4+secret `%s`", - secret); - } + if((size_t)ret != (AWS4_secret_len - 1)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem writing AWS4+secret `%s`", secret); /* hash_func, key, len(key), msg, len(msg), digest_dest, digest_len_dest * we know digest length, so ignore via NULL @@ -3320,37 +2762,26 @@ H5FD_s3comms_tostringtosign( HDfprintf(stdout, "called H5FD_s3comms_tostringtosign.\n"); #endif - if (dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "destination buffer cannot be null.\n") - } - if (req == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "canonical request cannot be null.\n") - } - if (now == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Timestring cannot be NULL.\n") - } - if (region == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Region cannot be NULL.\n") - } + if(dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer cannot be null.") + if(req == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "canonical request cannot be null.") + if(now == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Timestring cannot be NULL.") + if(region == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Region cannot be NULL.") - for (i = 0; i < 128; i++) { + for(i = 0; i < 128; i++) tmp[i] = '\0'; - } - for (i = 0; i < SHA256_DIGEST_LENGTH * 2 + 1; i++) { + for(i = 0; i < SHA256_DIGEST_LENGTH * 2 + 1; i++) { checksum[i] = '\0'; hexsum[i] = '\0'; } HDstrncpy(day, now, 8); day[8] = '\0'; ret = HDsnprintf(tmp, 127, "%s/%s/s3/aws4_request", day, region); - if (ret <= 0 || ret >= 127) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "problem adding day and region to string") - } + if(ret <= 0 || ret >= 127) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem adding day and region to string") HDmemcpy((dest + d), "AWS4-HMAC-SHA256\n", 17); d = 17; @@ -3363,24 +2794,14 @@ H5FD_s3comms_tostringtosign( d += HDstrlen(tmp); dest[d++] = '\n'; - SHA256((const unsigned char *)req, - HDstrlen(req), - checksum); + SHA256((const unsigned char *)req, HDstrlen(req), checksum); - if (H5FD_s3comms_bytes_to_hex( - hexsum, - (const unsigned char *)checksum, - SHA256_DIGEST_LENGTH, - true) - == FAIL) - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "could not create hex string"); - } + if(H5FD_s3comms_bytes_to_hex(hexsum, (const unsigned char *)checksum, + SHA256_DIGEST_LENGTH, true) == FAIL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not create hex string"); - for (i = 0; i < SHA256_DIGEST_LENGTH * 2; i++) { + for(i = 0; i < SHA256_DIGEST_LENGTH * 2; i++) dest[d++] = hexsum[i]; - } dest[d] = '\0'; @@ -3432,21 +2853,16 @@ H5FD_s3comms_trim(char *dest, HDfprintf(stdout, "called H5FD_s3comms_trim.\n"); #endif - if (dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "destination cannot be null.") - } - if (s == NULL) { + if(dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null.") + if(s == NULL) s_len = 0; - } - if (s_len > 0) { + if(s_len > 0) { /* Find first non-whitespace character from start; * reduce total length per character. */ - while ((s_len > 0) && - isspace((unsigned char)s[0]) && s_len > 0) - { + while((s_len > 0) && HDisspace((unsigned char)s[0]) && s_len > 0) { s++; s_len--; } @@ -3455,14 +2871,13 @@ H5FD_s3comms_trim(char *dest, * reduce length per-character. * If length is 0 already, there is no non-whitespace character. */ - if (s_len > 0) { + if(s_len > 0) { do { s_len--; - } while( isspace((unsigned char)s[s_len]) ); + } while(HDisspace((unsigned char)s[s_len])); s_len++; - /* write output into dest - */ + /* write output into dest */ HDmemcpy(dest, s, s_len); } } @@ -3534,54 +2949,36 @@ H5FD_s3comms_uriencode( HDfprintf(stdout, "H5FD_s3comms_uriencode called.\n"); #endif - if (s == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "source string cannot be NULL"); - } - if (dest == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "destination cannot be NULL"); - } + if(s == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source string cannot be NULL"); + if(dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be NULL"); /* Write characters to destination, converting to percent-encoded * "hex-utf-8" strings if necessary. * e.g., '$' -> "%24" */ - for (s_off = 0; s_off < s_len; s_off++) { + for(s_off = 0; s_off < s_len; s_off++) { c = s[s_off]; - if (isalnum(c) || - c == '.' || - c == '-' || - c == '_' || - c == '~' || - (c == '/' && encode_slash == FALSE)) - { + if(HDisalnum(c) || c == '.' || c == '-' || c == '_' || + c == '~' || (c == '/' && encode_slash == FALSE)) dest[dest_off++] = c; - } else { hex_off = 0; - if (H5FD_s3comms_percent_encode_char( - hex_buffer, - (const unsigned char)c, - &hex_len) - == FAIL) - { + if(H5FD_s3comms_percent_encode_char(hex_buffer, (const unsigned char)c, + &hex_len) == FAIL) { hex_buffer[0] = c; hex_buffer[1] = 0; - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to percent-encode character \'%s\' " - "at %d in \"%s\"", hex_buffer, (int)s_off, s); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to percent-encode character \'%s\' " "at %d in \"%s\"", hex_buffer, (int)s_off, s); } - for (hex_off = 0; hex_off < hex_len; hex_off++) { + for(hex_off = 0; hex_off < hex_len; hex_off++) dest[dest_off++] = hex_buffer[hex_off]; - } } /* end else (not a regular character) */ } /* end for each character */ - if (dest_off < s_len) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "buffer overflow"); + if(dest_off < s_len) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer overflow"); *n_written = dest_off; diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 3551905..f2ceb3b 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * * Purpose: The POSIX unbuffered file driver using only the HDF5 public @@ -95,7 +95,6 @@ typedef struct H5FD_sec2_t { * a single file. */ hbool_t fam_to_single; - } H5FD_sec2_t; /* @@ -113,37 +112,37 @@ typedef struct H5FD_sec2_t { * which can be addressed entirely by the second * argument of the file seek function. */ -#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) +#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) #define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) #define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - HADDR_UNDEF==(A)+(Z) || \ - (HDoff_t)((A)+(Z))<(HDoff_t)(A)) + HADDR_UNDEF == (A) + (Z) || \ + (HDoff_t)((A) + (Z)) < (HDoff_t)(A)) /* Prototypes */ -static herr_t H5FD_sec2_term(void); -static H5FD_t *H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, +static herr_t H5FD__sec2_term(void); +static H5FD_t *H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_sec2_close(H5FD_t *_file); -static int H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_sec2_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_sec2_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_sec2_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__sec2_close(H5FD_t *_file); +static int H5FD__sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__sec2_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__sec2_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__sec2_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__sec2_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); +static herr_t H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_sec2_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_sec2_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_sec2_unlock(H5FD_t *_file); +static herr_t H5FD__sec2_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__sec2_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__sec2_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_sec2_g = { "sec2", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_sec2_term, /* terminate */ + H5FD__sec2_term, /* terminate */ NULL, /* sb_size */ NULL, /* sb_encode */ NULL, /* sb_decode */ @@ -154,23 +153,23 @@ static const H5FD_class_t H5FD_sec2_g = { 0, /* dxpl_size */ NULL, /* dxpl_copy */ NULL, /* dxpl_free */ - H5FD_sec2_open, /* open */ - H5FD_sec2_close, /* close */ - H5FD_sec2_cmp, /* cmp */ - H5FD_sec2_query, /* query */ + H5FD__sec2_open, /* open */ + H5FD__sec2_close, /* close */ + H5FD__sec2_cmp, /* cmp */ + H5FD__sec2_query, /* query */ NULL, /* get_type_map */ NULL, /* alloc */ NULL, /* free */ - H5FD_sec2_get_eoa, /* get_eoa */ - H5FD_sec2_set_eoa, /* set_eoa */ - H5FD_sec2_get_eof, /* get_eof */ - H5FD_sec2_get_handle, /* get_handle */ - H5FD_sec2_read, /* read */ - H5FD_sec2_write, /* write */ + H5FD__sec2_get_eoa, /* get_eoa */ + H5FD__sec2_set_eoa, /* set_eoa */ + H5FD__sec2_get_eof, /* get_eof */ + H5FD__sec2_get_handle, /* get_handle */ + H5FD__sec2_read, /* read */ + H5FD__sec2_write, /* write */ NULL, /* flush */ - H5FD_sec2_truncate, /* truncate */ - H5FD_sec2_lock, /* lock */ - H5FD_sec2_unlock, /* unlock */ + H5FD__sec2_truncate, /* truncate */ + H5FD__sec2_lock, /* lock */ + H5FD__sec2_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -235,7 +234,7 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_sec2_term + * Function: H5FD__sec2_term * * Purpose: Shut down the VFD * @@ -247,15 +246,15 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_term(void) +H5FD__sec2_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Reset VFL ID */ H5FD_SEC2_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_sec2_term() */ +} /* end H5FD__sec2_term() */ /*------------------------------------------------------------------------- @@ -292,7 +291,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_sec2_open + * Function: H5FD__sec2_open * * Purpose: Create and/or opens a file as an HDF5 file. * @@ -307,7 +306,7 @@ done: *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) +H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_sec2_t *file = NULL; /* sec2 VFD info */ int fd = -1; /* File descriptor */ @@ -318,7 +317,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) h5_stat_t sb; H5FD_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check on file offsets */ HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t)); @@ -407,11 +406,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_open() */ +} /* end H5FD__sec2_open() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_close + * Function: H5FD__sec2_close * * Purpose: Closes an HDF5 file. * @@ -424,12 +423,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_close(H5FD_t *_file) +H5FD__sec2_close(H5FD_t *_file) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(file); @@ -443,11 +442,11 @@ H5FD_sec2_close(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_close() */ +} /* end H5FD__sec2_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_cmp + * Function: H5FD__sec2_cmp * * Purpose: Compares two files belonging to this driver using an * arbitrary (but consistent) ordering. @@ -462,13 +461,13 @@ done: *------------------------------------------------------------------------- */ static int -H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +H5FD__sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_sec2_t *f1 = (const H5FD_sec2_t *)_f1; const H5FD_sec2_t *f2 = (const H5FD_sec2_t *)_f2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR #ifdef H5_HAVE_WIN32_API if(f1->dwVolumeSerialNumber < f2->dwVolumeSerialNumber) HGOTO_DONE(-1) @@ -497,11 +496,11 @@ H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_cmp() */ +} /* end H5FD__sec2_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_query + * Function: H5FD__sec2_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -514,11 +513,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) +H5FD__sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) { const H5FD_sec2_t *file = (const H5FD_sec2_t *)_file; /* sec2 VFD info */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set the VFL feature flags that this driver supports */ /* Notice: the Mirror VFD Writer currently uses only the Sec2 driver as @@ -543,11 +542,11 @@ H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_sec2_query() */ +} /* end H5FD__sec2_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_get_eoa + * Function: H5FD__sec2_get_eoa * * Purpose: Gets the end-of-address marker for the file. The EOA marker * is the first address past the last byte allocated in the @@ -561,18 +560,18 @@ H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) *------------------------------------------------------------------------- */ static haddr_t -H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_sec2_t *file = (const H5FD_sec2_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eoa) -} /* end H5FD_sec2_get_eoa() */ +} /* end H5FD__sec2_get_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_set_eoa + * Function: H5FD__sec2_set_eoa * * Purpose: Set the end-of-address marker for the file. This function is * called shortly after an existing HDF5 file is opened in order @@ -586,20 +585,20 @@ H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) +H5FD__sec2_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR file->eoa = addr; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_sec2_set_eoa() */ +} /* end H5FD__sec2_set_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_get_eof + * Function: H5FD__sec2_get_eof * * Purpose: Returns the end-of-file marker, which is the greater of * either the filesystem end-of-file or the HDF5 end-of-address @@ -614,18 +613,18 @@ H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) *------------------------------------------------------------------------- */ static haddr_t -H5FD_sec2_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__sec2_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_sec2_t *file = (const H5FD_sec2_t *)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eof) -} /* end H5FD_sec2_get_eof() */ +} /* end H5FD__sec2_get_eof() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_get_handle + * Function: H5FD__sec2_get_handle * * Purpose: Returns the file handle of sec2 file driver. * @@ -637,12 +636,12 @@ H5FD_sec2_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle) +H5FD__sec2_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handle) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") @@ -651,11 +650,11 @@ H5FD_sec2_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handl done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_get_handle() */ +} /* end H5FD__sec2_get_handle() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_read + * Function: H5FD__sec2_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR * into buffer BUF according to data transfer properties in @@ -671,14 +670,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, +H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf /*out*/) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -691,17 +690,15 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS #ifndef H5_HAVE_PREADWRITE /* Seek to the correct location (if we don't have pread) */ - if(addr != file->pos || OP_READ != file->op) { + if(addr != file->pos || OP_READ != file->op) if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - } #endif /* H5_HAVE_PREADWRITE */ /* Read data, being careful of interrupted system calls, partial results, * and the end of the file. */ while(size > 0) { - h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ @@ -758,11 +755,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_read() */ +} /* end H5FD__sec2_read() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_write + * Function: H5FD__sec2_write * * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR * from buffer BUF according to data transfer properties in @@ -776,14 +773,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, +H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -796,17 +793,15 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #ifndef H5_HAVE_PREADWRITE /* Seek to the correct location (if we don't have pwrite) */ - if(addr != file->pos || OP_WRITE != file->op) { + if(addr != file->pos || OP_WRITE != file->op) if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - } #endif /* H5_HAVE_PREADWRITE */ /* Write the data, being careful of interrupted system calls and partial * results */ while(size > 0) { - h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ @@ -859,11 +854,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_write() */ +} /* end H5FD__sec2_write() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_truncate + * Function: H5FD__sec2_truncate * * Purpose: Makes sure that the true file size is the same (or larger) * than the end-of-address. @@ -876,12 +871,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) +H5FD__sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -928,11 +923,11 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_truncate() */ +} /* end H5FD__sec2_truncate() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_lock + * Function: H5FD__sec2_lock * * Purpose: To place an advisory lock on a file. * The lock type to apply depends on the parameter "rw": @@ -946,13 +941,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_lock(H5FD_t *_file, hbool_t rw) +H5FD__sec2_lock(H5FD_t *_file, hbool_t rw) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; /* VFD file struct */ int lock_flags; /* file locking flags */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -969,11 +964,11 @@ H5FD_sec2_lock(H5FD_t *_file, hbool_t rw) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_lock() */ +} /* end H5FD__sec2_lock() */ /*------------------------------------------------------------------------- - * Function: H5FD_sec2_unlock + * Function: H5FD__sec2_unlock * * Purpose: To remove the existing lock on the file * @@ -984,12 +979,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_unlock(H5FD_t *_file) +H5FD__sec2_unlock(H5FD_t *_file) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -1002,5 +997,5 @@ H5FD_sec2_unlock(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_sec2_unlock() */ +} /* end H5FD__sec2_unlock() */ diff --git a/src/H5FDsec2.h b/src/H5FDsec2.h index a4ade0b..d669582 100644 --- a/src/H5FDsec2.h +++ b/src/H5FDsec2.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the sec2 driver. diff --git a/src/H5FDspace.c b/src/H5FDspace.c index e1f0cb2..22d7e22 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -15,7 +15,7 @@ * * Created: H5FDspace.c * Jan 3 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Space allocation routines for the file driver code. * @@ -84,7 +84,7 @@ H5FL_DEFINE(H5FD_free_t); /*------------------------------------------------------------------------- - * Function: H5FD_extend + * Function: H5FD__extend * * Purpose: Extend the EOA space of a file. * @@ -99,12 +99,12 @@ H5FL_DEFINE(H5FD_free_t); *------------------------------------------------------------------------- */ static haddr_t -H5FD_extend(H5FD_t *file, H5FD_mem_t type, hsize_t size) +H5FD__extend(H5FD_t *file, H5FD_mem_t type, hsize_t size) { haddr_t eoa; /* Address of end-of-allocated space */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(file); @@ -129,7 +129,7 @@ H5FD_extend(H5FD_t *file, H5FD_mem_t type, hsize_t size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_extend() */ +} /* end H5FD__extend() */ /*------------------------------------------------------------------------- @@ -203,7 +203,7 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver allocation request failed") } /* end if */ else { - ret_value = H5FD_extend(file, type, size + extra); + ret_value = H5FD__extend(file, type, size + extra); if(!H5F_addr_defined(ret_value)) HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver eoa update request failed") } /* end else */ @@ -439,7 +439,7 @@ H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t blk_end, hsize_ /* Check if the block is exactly at the end of the file */ if(H5F_addr_eq(blk_end, eoa)) { /* Extend the object by extending the underlying file */ - if(HADDR_UNDEF == H5FD_extend(file, type, extra_requested)) + if(HADDR_UNDEF == H5FD__extend(file, type, extra_requested)) HGOTO_ERROR(H5E_VFL, H5E_CANTEXTEND, FAIL, "driver extend request failed") /* Mark EOA info dirty in cache, so change will get encoded */ diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index 4ed3c4a..18a8735 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -27,8 +27,6 @@ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5FDsec2.h" /* Generic Functions */ -#include "H5FDstdio.h" /* Generic Functions */ #include "H5Pprivate.h" /* Property lists */ /* The driver identification number, initialized at runtime */ @@ -83,9 +81,8 @@ typedef struct H5FD_splitter_t { #define H5FD_SPLITTER_WO_ERROR(file, funcname, errmajor, errminor, ret, mesg) \ { \ H5FD__splitter_log_error((file), (funcname), (mesg)); \ - if (FALSE == (file)->fa.ignore_wo_errs) { \ + if(FALSE == (file)->fa.ignore_wo_errs) \ HGOTO_ERROR((errmajor), (errminor), (ret), (mesg)) \ - } \ } #define H5FD_SPLITTER_DEBUG_OP_CALLS 0 /* debugging print toggle; 0 disables */ @@ -93,7 +90,7 @@ typedef struct H5FD_splitter_t { #if H5FD_SPLITTER_DEBUG_OP_CALLS #define H5FD_SPLITTER_LOG_CALL(name) do { \ HDprintf("called %s()\n", (name)); \ - fflush(stdout); \ + HDfflush(stdout); \ } while (0) #else #define H5FD_SPLITTER_LOG_CALL(name) /* no-op */ @@ -103,73 +100,75 @@ typedef struct H5FD_splitter_t { /* Print error messages from W/O channel to log file */ static herr_t H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const char *msg); - static int H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr); /* Prototypes */ -static herr_t H5FD_splitter_term(void); -static hsize_t H5FD_splitter_sb_size(H5FD_t *_file); -static herr_t H5FD_splitter_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/); -static herr_t H5FD_splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf); -static void *H5FD_splitter_fapl_get(H5FD_t *_file); -static void *H5FD_splitter_fapl_copy(const void *_old_fa); -static herr_t H5FD_splitter_fapl_free(void *_fapl); -static H5FD_t *H5FD_splitter_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_splitter_close(H5FD_t *_file); -static int H5FD_splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_splitter_query(const H5FD_t *_file, unsigned long *flags /* out */); -static herr_t H5FD_splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map); -static haddr_t H5FD_splitter_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); -static herr_t H5FD_splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); -static haddr_t H5FD_splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type); -static herr_t H5FD_splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr); -static haddr_t H5FD_splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type); -static herr_t H5FD_splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handle); -static herr_t H5FD_splitter_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_splitter_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD_splitter_lock(H5FD_t *_file, hbool_t rw); -static herr_t H5FD_splitter_unlock(H5FD_t *_file); +static herr_t H5FD__splitter_term(void); +static hsize_t H5FD__splitter_sb_size(H5FD_t *_file); +static herr_t H5FD__splitter_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/); +static herr_t H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf); +static void *H5FD__splitter_fapl_get(H5FD_t *_file); +static void *H5FD__splitter_fapl_copy(const void *_old_fa); +static herr_t H5FD__splitter_fapl_free(void *_fapl); +static H5FD_t *H5FD__splitter_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); +static herr_t H5FD__splitter_close(H5FD_t *_file); +static int H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__splitter_query(const H5FD_t *_file, unsigned long *flags /* out */); +static herr_t H5FD__splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map); +static haddr_t H5FD__splitter_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); +static herr_t H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); +static haddr_t H5FD__splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type); +static herr_t H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr); +static haddr_t H5FD__splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type); +static herr_t H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void** file_handle); +static herr_t H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf); +static herr_t H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); +static herr_t H5FD__splitter_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__splitter_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD__splitter_unlock(H5FD_t *_file); static const H5FD_class_t H5FD_splitter_g = { "splitter", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_splitter_term, /* terminate */ - H5FD_splitter_sb_size, /* sb_size */ - H5FD_splitter_sb_encode, /* sb_encode */ - H5FD_splitter_sb_decode, /* sb_decode */ + H5FD__splitter_term, /* terminate */ + H5FD__splitter_sb_size, /* sb_size */ + H5FD__splitter_sb_encode, /* sb_encode */ + H5FD__splitter_sb_decode, /* sb_decode */ sizeof(H5FD_splitter_fapl_t), /* fapl_size */ - H5FD_splitter_fapl_get, /* fapl_get */ - H5FD_splitter_fapl_copy, /* fapl_copy */ - H5FD_splitter_fapl_free, /* fapl_free */ + H5FD__splitter_fapl_get, /* fapl_get */ + H5FD__splitter_fapl_copy, /* fapl_copy */ + H5FD__splitter_fapl_free, /* fapl_free */ 0, /* dxpl_size */ NULL, /* dxpl_copy */ NULL, /* dxpl_free */ - H5FD_splitter_open, /* open */ - H5FD_splitter_close, /* close */ - H5FD_splitter_cmp, /* cmp */ - H5FD_splitter_query, /* query */ - H5FD_splitter_get_type_map, /* get_type_map */ - H5FD_splitter_alloc, /* alloc */ - H5FD_splitter_free, /* free */ - H5FD_splitter_get_eoa, /* get_eoa */ - H5FD_splitter_set_eoa, /* set_eoa */ - H5FD_splitter_get_eof, /* get_eof */ - H5FD_splitter_get_handle, /* get_handle */ - H5FD_splitter_read, /* read */ - H5FD_splitter_write, /* write */ - H5FD_splitter_flush, /* flush */ - H5FD_splitter_truncate, /* truncate */ - H5FD_splitter_lock, /* lock */ - H5FD_splitter_unlock, /* unlock */ + H5FD__splitter_open, /* open */ + H5FD__splitter_close, /* close */ + H5FD__splitter_cmp, /* cmp */ + H5FD__splitter_query, /* query */ + H5FD__splitter_get_type_map, /* get_type_map */ + H5FD__splitter_alloc, /* alloc */ + H5FD__splitter_free, /* free */ + H5FD__splitter_get_eoa, /* get_eoa */ + H5FD__splitter_set_eoa, /* set_eoa */ + H5FD__splitter_get_eof, /* get_eof */ + H5FD__splitter_get_handle, /* get_handle */ + H5FD__splitter_read, /* read */ + H5FD__splitter_write, /* write */ + H5FD__splitter_flush, /* flush */ + H5FD__splitter_truncate, /* truncate */ + H5FD__splitter_lock, /* lock */ + H5FD__splitter_unlock, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; /* Declare a free list to manage the H5FD_splitter_t struct */ H5FL_DEFINE_STATIC(H5FD_splitter_t); +/* Declare a free list to manage the H5FD_splitter_fapl_t struct */ +H5FL_DEFINE_STATIC(H5FD_splitter_fapl_t); + /*------------------------------------------------------------------------- * Function: H5FD__init_package @@ -186,11 +185,10 @@ H5FD__init_package(void) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD__init_package"); + H5FD_SPLITTER_LOG_CALL(FUNC); - if (H5FD_splitter_init() < 0) { + if(H5FD_splitter_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize splitter VFD") - } done: FUNC_LEAVE_NOAPI(ret_value) @@ -214,11 +212,10 @@ H5FD_splitter_init(void) FUNC_ENTER_NOAPI(FAIL) - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_init"); + H5FD_SPLITTER_LOG_CALL(FUNC); - if (H5I_VFL != H5I_get_type(H5FD_SPLITTER_g)) { + if(H5I_VFL != H5I_get_type(H5FD_SPLITTER_g)) H5FD_SPLITTER_g = H5FDregister(&H5FD_splitter_g); - } ret_value = H5FD_SPLITTER_g; @@ -228,7 +225,7 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_splitter_term + * Function: H5FD__splitter_term * * Purpose: Shut down the splitter VFD. * @@ -236,17 +233,17 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_term(void) +H5FD__splitter_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_term"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Reset VFL ID */ H5FD_SPLITTER_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_splitter_term() */ +} /* end H5FD__splitter_term() */ /*------------------------------------------------------------------------- @@ -265,25 +262,22 @@ H5FD__copy_plist(hid_t fapl_id, int ret_value = 0; H5P_genplist_t *plist_ptr = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD__copy_plist"); + H5FD_SPLITTER_LOG_CALL(FUNC); HDassert(id_out_ptr != NULL); - if (FALSE == H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) { + if(FALSE == H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "not a file access property list"); - } plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id); - if (NULL == plist_ptr) { + if(NULL == plist_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "unable to get property list"); - } *id_out_ptr = H5P_copy_plist(plist_ptr, FALSE); - if (H5I_INVALID_HID == *id_out_ptr) { + if(H5I_INVALID_HID == *id_out_ptr) HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, -1, "unable to copy file access property list"); - } done: FUNC_LEAVE_NOAPI(ret_value); @@ -302,28 +296,21 @@ done: herr_t H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config) { - H5FD_splitter_fapl_t info; + H5FD_splitter_fapl_t *info = NULL; H5P_genplist_t *plist_ptr = NULL; herr_t ret_value = SUCCEED; - H5Eclear2(H5E_DEFAULT); - FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*Dr", fapl_id, vfd_config); - H5FD_SPLITTER_LOG_CALL("H5Pset_fapl_splitter"); + H5FD_SPLITTER_LOG_CALL(FUNC); - if (H5FD_SPLITTER_MAGIC != vfd_config->magic) { + if(H5FD_SPLITTER_MAGIC != vfd_config->magic) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid configuration (magic number mismatch)") - } - if (H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != vfd_config->version) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invlaid config (version number mismatch)") - } - - if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id))) { + if(H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != vfd_config->version) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid config (version number mismatch)") + if(NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid property list") - } - /* Make sure that the W/O channel supports write-only capability. * Some drivers (e.g. family or multi) do revision of the superblock @@ -331,55 +318,54 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config) * Uses the feature flag H5FD_FEAT_DEFAULT_VFD_COMPATIBLE as the * determining attribute. */ - if (H5P_DEFAULT != vfd_config->wo_fapl_id) { + if(H5P_DEFAULT != vfd_config->wo_fapl_id) { H5FD_class_t *wo_driver = NULL; H5FD_driver_prop_t wo_driver_prop; H5P_genplist_t *wo_plist_ptr = NULL; unsigned long wo_driver_flags = 0; wo_plist_ptr = (H5P_genplist_t *)H5I_object(vfd_config->wo_fapl_id); - if (NULL == wo_plist_ptr) { + if(NULL == wo_plist_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - } - if (H5P_peek(wo_plist_ptr, H5F_ACS_FILE_DRV_NAME, &wo_driver_prop) < 0) { + if(H5P_peek(wo_plist_ptr, H5F_ACS_FILE_DRV_NAME, &wo_driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info") - } wo_driver = (H5FD_class_t *)H5I_object(wo_driver_prop.driver_id); - if (NULL == wo_driver) { + if(NULL == wo_driver) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list") - } - if (H5FD_driver_query(wo_driver, &wo_driver_flags) < 0) { + if(H5FD_driver_query(wo_driver, &wo_driver_flags) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't query VFD flags") - } - if (0 == (H5FD_FEAT_DEFAULT_VFD_COMPATIBLE & wo_driver_flags)) { + if(0 == (H5FD_FEAT_DEFAULT_VFD_COMPATIBLE & wo_driver_flags)) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unsuitable W/O driver") - } } /* end if W/O VFD is non-default */ + info = H5FL_CALLOC(H5FD_splitter_fapl_t); + if(NULL == info) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct") - info.ignore_wo_errs = vfd_config->ignore_wo_errs; - HDstrncpy(info.wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX); - HDstrncpy(info.log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX); - info.rw_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ - info.wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ + info->ignore_wo_errs = vfd_config->ignore_wo_errs; + HDstrncpy(info->wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX); + HDstrncpy(info->log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX); + info->rw_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ + info->wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ /* Set non-default channel FAPL IDs in splitter configuration info */ - if (H5P_DEFAULT != vfd_config->rw_fapl_id) { - if (FALSE == H5P_isa_class(vfd_config->rw_fapl_id, H5P_FILE_ACCESS)) { + if(H5P_DEFAULT != vfd_config->rw_fapl_id) { + if(FALSE == H5P_isa_class(vfd_config->rw_fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - } - info.rw_fapl_id = vfd_config->rw_fapl_id; + info->rw_fapl_id = vfd_config->rw_fapl_id; } - if (H5P_DEFAULT != vfd_config->wo_fapl_id) { - if (FALSE == H5P_isa_class(vfd_config->wo_fapl_id, H5P_FILE_ACCESS)) { + if(H5P_DEFAULT != vfd_config->wo_fapl_id) { + if(FALSE == H5P_isa_class(vfd_config->wo_fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - } - info.wo_fapl_id = vfd_config->wo_fapl_id; + info->wo_fapl_id = vfd_config->wo_fapl_id; } - ret_value = H5P_set_driver(plist_ptr, H5FD_SPLITTER, &info); + ret_value = H5P_set_driver(plist_ptr, H5FD_SPLITTER, info); done: + if(info) + info = H5FL_FREE(H5FD_splitter_fapl_t, info); + FUNC_LEAVE_API(ret_value) } /* end H5Pset_fapl_splitter() */ @@ -406,48 +392,39 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config_out) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*Dr", fapl_id, config_out); - H5FD_SPLITTER_LOG_CALL("H5Pget_fapl_splitter"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ - if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) { + if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - } - if (config_out == NULL) { + if(config_out == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config_out pointer is null") - } - if (H5FD_SPLITTER_MAGIC != config_out->magic) { + if(H5FD_SPLITTER_MAGIC != config_out->magic) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "info-out pointer invalid (magic number mismatch)") - } - if (H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != config_out->version) { + if(H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != config_out->version) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "info-out pointer invalid (version unsafe)") - } /* Pre-set out FAPL IDs with intent to replace these values */ config_out->rw_fapl_id = H5I_INVALID_HID; config_out->wo_fapl_id = H5I_INVALID_HID; /* Check and get the splitter fapl */ - if (NULL == (plist_ptr = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) { + if(NULL == (plist_ptr = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - } - if (H5FD_SPLITTER != H5P_peek_driver(plist_ptr)) { + if(H5FD_SPLITTER != H5P_peek_driver(plist_ptr)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - } - if (NULL == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr))) { + if(NULL == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unable to get specific-driver info") - } HDstrncpy(config_out->wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX); HDstrncpy(config_out->log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX); config_out->ignore_wo_errs = fapl_ptr->ignore_wo_errs; /* Copy R/W and W/O FAPLs */ - if (H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(config_out->rw_fapl_id)) < 0) { + if(H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(config_out->rw_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't copy R/W FAPL"); - } - if (H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(config_out->wo_fapl_id)) < 0) { + if(H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(config_out->wo_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't copy W/O FAPL"); - } done: FUNC_LEAVE_API(ret_value) @@ -455,7 +432,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_splitter_flush + * Function: H5FD__splitter_flush * * Purpose: Flushes all data to disk for both channels. * @@ -463,32 +440,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) +H5FD__splitter_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_flush"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Public API for dxpl "context" */ - if (H5FDflush(file->rw_file, dxpl_id, closing) < 0) { + if(H5FDflush(file->rw_file, dxpl_id, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush R/W file") - } - if (H5FDflush(file->wo_file, dxpl_id, closing) < 0) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_flush", - H5E_VFL, H5E_CANTFLUSH, FAIL, - "unable to flush W/O file") - } + if(H5FDflush(file->wo_file, dxpl_id, closing) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_flush() */ +} /* end H5FD__splitter_flush() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_read + * Function: H5FD__splitter_read * * Purpose: Reads SIZE bytes of data from the R/W channel, beginning at * address ADDR into buffer BUF according to data transfer @@ -502,45 +475,37 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_read( - H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, - hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t addr, - size_t size, - void *buf /*out*/) +H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_read"); + H5FD_SPLITTER_LOG_CALL(FUNC); HDassert(file && file->pub.cls); HDassert(buf); /* Check for overflow conditions */ - if (!H5F_addr_defined(addr)) { + if(!H5F_addr_defined(addr)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr) - } - if (REGION_OVERFLOW(addr, size)) { + if(REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr) - } /* Only read from R/W channel */ /* Public API for dxpl "context" */ - if (H5FDread(file->rw_file, type, dxpl_id, addr, size, buf) < 0) { + if(H5FDread(file->rw_file, type, dxpl_id, addr, size, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "Reading from R/W channel failed") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_read() */ +} /* end H5FD__splitter_read() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_write + * Function: H5FD__splitter_write * * Purpose: Writes SIZE bytes of data to R/W and W/O channels, beginning * at address ADDR from buffer BUF according to data transfer @@ -550,38 +515,34 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf) +H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, + haddr_t addr, size_t size, const void *buf) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; H5P_genplist_t *plist_ptr = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_write"); + H5FD_SPLITTER_LOG_CALL(FUNC); - if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(dxpl_id))) { + if(NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - } /* Write to each file */ /* Public API for dxpl "context" */ - if (H5FDwrite(file->rw_file, type, dxpl_id, addr, size, buf) < 0) { + if(H5FDwrite(file->rw_file, type, dxpl_id, addr, size, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "R/W file write failed") - } - if (H5FDwrite(file->wo_file, type, dxpl_id, addr, size, buf) < 0) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_write", - H5E_VFL, H5E_WRITEERROR, FAIL, - "unable to write W/O file") - } + if(H5FDwrite(file->wo_file, type, dxpl_id, addr, size, buf) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_write() */ +} /* end H5FD__splitter_write() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_fapl_get + * Function: H5FD__splitter_fapl_get * * Purpose: Returns a file access property list which indicates how the * specified file is being accessed. The return list could be @@ -593,23 +554,23 @@ done: *------------------------------------------------------------------------- */ static void * -H5FD_splitter_fapl_get(H5FD_t *_file) +H5FD__splitter_fapl_get(H5FD_t *_file) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_fapl_get"); + H5FD_SPLITTER_LOG_CALL(FUNC); - ret_value = H5FD_splitter_fapl_copy(&(file->fa)); + ret_value = H5FD__splitter_fapl_copy(&(file->fa)); FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD__splitter_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_fapl_copy + * Function: H5FD__splitter_fapl_copy * * Purpose: Copies the file access properties. * @@ -618,56 +579,45 @@ H5FD_splitter_fapl_get(H5FD_t *_file) *------------------------------------------------------------------------- */ static void * -H5FD_splitter_fapl_copy(const void *_old_fa) +H5FD__splitter_fapl_copy(const void *_old_fa) { const H5FD_splitter_fapl_t *old_fa_ptr = (const H5FD_splitter_fapl_t *)_old_fa; H5FD_splitter_fapl_t *new_fa_ptr = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_fapl_copy"); + H5FD_SPLITTER_LOG_CALL(FUNC); HDassert(old_fa_ptr); - new_fa_ptr = (H5FD_splitter_fapl_t *)H5MM_calloc(sizeof(H5FD_splitter_fapl_t)); - if (NULL == new_fa_ptr) { + new_fa_ptr = H5FL_CALLOC(H5FD_splitter_fapl_t); + if(NULL == new_fa_ptr) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL") - } - if (HDmemcpy(new_fa_ptr, old_fa_ptr, sizeof(H5FD_splitter_fapl_t)) == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, NULL, "unable to shallow-copy info") - } - if (HDstrncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX) == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, NULL, "unable to copy write-only channel file path") - } - if (HDstrncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX) == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, NULL, "unable to copy log file path") - } + HDmemcpy(new_fa_ptr, old_fa_ptr, sizeof(H5FD_splitter_fapl_t)); + HDstrncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX); + HDstrncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX); /* Copy R/W and W/O FAPLs */ - if (H5FD__copy_plist(old_fa_ptr->rw_fapl_id, &(new_fa_ptr->rw_fapl_id)) < 0) { + if(H5FD__copy_plist(old_fa_ptr->rw_fapl_id, &(new_fa_ptr->rw_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy R/W FAPL"); - } - if (H5FD__copy_plist(old_fa_ptr->wo_fapl_id, &(new_fa_ptr->wo_fapl_id)) < 0) { + if(H5FD__copy_plist(old_fa_ptr->wo_fapl_id, &(new_fa_ptr->wo_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy W/O FAPL"); - } ret_value = (void *)new_fa_ptr; done: - if (NULL == ret_value) { - if (new_fa_ptr) { - H5MM_free(new_fa_ptr); - } - } + if(NULL == ret_value) + if(new_fa_ptr) + new_fa_ptr = H5FL_FREE(H5FD_splitter_fapl_t, new_fa_ptr); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_fapl_copy() */ +} /* end H5FD__splitter_fapl_copy() */ /*-------------------------------------------------------------------------- - * Function: H5FD_splitter_fapl_free + * Function: H5FD__splitter_fapl_free * * Purpose: Releases the file access lists * @@ -675,35 +625,33 @@ done: *-------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_fapl_free(void *_fapl) +H5FD__splitter_fapl_free(void *_fapl) { H5FD_splitter_fapl_t *fapl = (H5FD_splitter_fapl_t*)_fapl; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_fapl_free"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(fapl); - if (H5I_dec_ref(fapl->rw_fapl_id) < 0) { + if(H5I_dec_ref(fapl->rw_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close R/W FAPL ID") - } - if (H5I_dec_ref(fapl->wo_fapl_id) < 0) { + if(H5I_dec_ref(fapl->wo_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close W/O FAPL ID") - } /* Free the property list */ - H5MM_free(fapl); + fapl = H5FL_FREE(H5FD_splitter_fapl_t, fapl); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_fapl_free() */ +} /* end H5FD__splitter_fapl_free() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_open + * Function: H5FD__splitter_open * * Purpose: Create and/or opens a file as an HDF5 file. * @@ -714,123 +662,99 @@ done: *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, haddr_t maxaddr) +H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, haddr_t maxaddr) { H5FD_splitter_t *file_ptr = NULL; /* Splitter VFD info */ const H5FD_splitter_fapl_t *fapl_ptr = NULL; /* Driver-specific property list */ H5P_genplist_t *plist_ptr = NULL; H5FD_t *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_open"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* 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") - } - if ( (H5P_FILE_ACCESS_DEFAULT == splitter_fapl_id) || - (H5FD_SPLITTER != H5Pget_driver(splitter_fapl_id)) ) - { + if((H5P_FILE_ACCESS_DEFAULT == splitter_fapl_id) || + (H5FD_SPLITTER != H5Pget_driver(splitter_fapl_id)) ) /* presupposes that H5P_FILE_ACCESS_DEFAULT is not a splitter */ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "driver is not splitter") - } file_ptr = (H5FD_splitter_t *)H5FL_CALLOC(H5FD_splitter_t); - if (NULL == file_ptr) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") - } + if(NULL == file_ptr) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct") file_ptr->fa.rw_fapl_id = H5I_INVALID_HID; file_ptr->fa.wo_fapl_id = H5I_INVALID_HID; /* Get the driver-specific file access properties */ plist_ptr = (H5P_genplist_t *)H5I_object(splitter_fapl_id); - if (NULL == plist_ptr) { + if(NULL == plist_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - } fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr); - if (NULL == fapl_ptr) { + if(NULL == fapl_ptr) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get VFL driver info") - } /* Copy simpler info */ - if (HDstrncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX) == NULL) { - HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, NULL, "unable to copy write-only path") - } - if (HDstrncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX) == NULL) { - HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, NULL, "unable to copy logfile path") - } + HDstrncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX); + HDstrncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX); file_ptr->fa.ignore_wo_errs = fapl_ptr->ignore_wo_errs; /* Copy R/W and W/O channel FAPLs. */ - if (H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(file_ptr->fa.rw_fapl_id)) < 0) { + if(H5FD__copy_plist(fapl_ptr->rw_fapl_id, &(file_ptr->fa.rw_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy R/W FAPL"); - } - if (H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(file_ptr->fa.wo_fapl_id)) < 0) { + if(H5FD__copy_plist(fapl_ptr->wo_fapl_id, &(file_ptr->fa.wo_fapl_id)) < 0) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy W/O FAPL"); - } /* Prepare log file if necessary. * If application wants to ignore the errors from W/O channel and * provided a name for the log file, then open it */ - if (!file_ptr->logfp) { - if (file_ptr->fa.log_file_path[0] != '\0') { + if(!file_ptr->logfp) { + if(file_ptr->fa.log_file_path[0] != '\0') { file_ptr->logfp = HDfopen(file_ptr->fa.log_file_path, "w"); - if (file_ptr->logfp == NULL) { + if(file_ptr->logfp == NULL) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open log file") - } } /* end if logfile path given */ } /* end if logfile pointer/handle does not exist */ file_ptr->rw_file = H5FD_open(name, flags, fapl_ptr->rw_fapl_id, HADDR_UNDEF); - if (!file_ptr->rw_file) { + if(!file_ptr->rw_file) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open R/W file") - } file_ptr->wo_file = H5FD_open(fapl_ptr->wo_path, flags, fapl_ptr->wo_fapl_id, HADDR_UNDEF); - if (!file_ptr->wo_file) { - H5FD_SPLITTER_WO_ERROR(file_ptr, "H5FD_splitter_open", - H5E_VFL, H5E_CANTOPENFILE, NULL, - "unable to open W/O file") - } + if(!file_ptr->wo_file) + H5FD_SPLITTER_WO_ERROR(file_ptr, FUNC, H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open W/O file") ret_value = (H5FD_t*)file_ptr; done: - if (NULL == ret_value) { - if (file_ptr) { - if (H5I_INVALID_HID != file_ptr->fa.rw_fapl_id) { + if(NULL == ret_value) { + if(file_ptr) { + if(H5I_INVALID_HID != file_ptr->fa.rw_fapl_id) H5I_dec_ref(file_ptr->fa.rw_fapl_id); - } - if (H5I_INVALID_HID != file_ptr->fa.wo_fapl_id) { + if(H5I_INVALID_HID != file_ptr->fa.wo_fapl_id) H5I_dec_ref(file_ptr->fa.wo_fapl_id); - } - if (file_ptr->rw_file) { + if(file_ptr->rw_file) H5FD_close(file_ptr->rw_file); - } - if (file_ptr->wo_file) { + if(file_ptr->wo_file) H5FD_close(file_ptr->wo_file); - } - if (file_ptr->logfp) { + if(file_ptr->logfp) HDfclose(file_ptr->logfp); - } H5FL_FREE(H5FD_splitter_t, file_ptr); } } /* end if error */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_open() */ +} /* end H5FD__splitter_open() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_close + * Function: H5FD__splitter_close * * Purpose: Closes files on both read-write and write-only channels. * @@ -839,39 +763,31 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_close(H5FD_t *_file) +H5FD__splitter_close(H5FD_t *_file) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_close"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Sanity check */ HDassert(file); - if (H5I_dec_ref(file->fa.rw_fapl_id) < 0) { + if(H5I_dec_ref(file->fa.rw_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_ARGS, FAIL, "can't close R/W FAPL") - } - if (H5I_dec_ref(file->fa.wo_fapl_id) < 0) { + if(H5I_dec_ref(file->fa.wo_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_ARGS, FAIL, "can't close W/O FAPL") - } - if (file->rw_file) { - if (H5FD_close(file->rw_file) == FAIL) { + if(file->rw_file) + if(H5FD_close(file->rw_file) == FAIL) HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close R/W file") - } - } - if (file->wo_file) { - if (H5FD_close(file->wo_file) == FAIL) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_close", - H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "unable to close W/O file") - } - } + if(file->wo_file) + if(H5FD_close(file->wo_file) == FAIL) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close W/O file") - if (file->logfp) { + if(file->logfp) { HDfclose(file->logfp); file->logfp = NULL; } @@ -882,11 +798,11 @@ H5FD_splitter_close(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_close() */ +} /* end H5FD__splitter_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_get_eoa + * Function: H5FD__splitter_get_eoa * * Purpose: Returns the end-of-address marker for the file. The EOA * marker is the first address past the last byte allocated in @@ -898,30 +814,29 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file; haddr_t ret_value = HADDR_UNDEF; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_get_eoa"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Sanity check */ HDassert(file); HDassert(file->rw_file); - if ((ret_value = H5FD_get_eoa(file->rw_file, type)) == HADDR_UNDEF) { + if((ret_value = H5FD_get_eoa(file->rw_file, type)) == HADDR_UNDEF) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, HADDR_UNDEF, "unable to get eoa") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_get_eoa */ +} /* end H5FD__splitter_get_eoa */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_set_eoa + * Function: H5FD__splitter_set_eoa * * Purpose: Set the end-of-address marker for the file. This function is * called shortly after an existing HDF5 file is opened in order @@ -931,37 +846,33 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) +H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_set_eoa";) + H5FD_SPLITTER_LOG_CALL(FUNC) /* Sanity check */ HDassert(file); HDassert(file->rw_file); HDassert(file->wo_file); - if (H5FD_set_eoa(file->rw_file, type, addr) < 0) { + if(H5FD_set_eoa(file->rw_file, type, addr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "H5FDset_eoa failed for R/W file") - } - if (H5FD_set_eoa(file->wo_file, type, addr) < 0) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_set_eoa", - H5E_VFL, H5E_CANTSET, FAIL, - "unable to set EOA for W/O file") - } + if(H5FD_set_eoa(file->wo_file, type, addr) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTSET, FAIL, "unable to set EOA for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_set_eoa() */ +} /* end H5FD__splitter_set_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_get_eof + * Function: H5FD__splitter_get_eof * * Purpose: Returns the end-of-address marker for the file. The EOA * marker is the first address past the last byte allocated in @@ -973,30 +884,29 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file; haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_get_eof"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Sanity check */ HDassert(file); HDassert(file->rw_file); - if (HADDR_UNDEF == (ret_value = H5FD_get_eof(file->rw_file, type))) { + if(HADDR_UNDEF == (ret_value = H5FD_get_eof(file->rw_file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "unable to get eof") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_get_eof */ +} /* end H5FD__splitter_get_eof */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_truncate + * Function: H5FD__splitter_truncate * * Purpose: Notify driver to truncate the file back to the allocated size. * @@ -1004,36 +914,32 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) +H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_truncate"); + H5FD_SPLITTER_LOG_CALL(FUNC); HDassert(file); HDassert(file->rw_file); HDassert(file->wo_file); - if (H5FDtruncate(file->rw_file, dxpl_id, closing) < 0) { + if(H5FDtruncate(file->rw_file, dxpl_id, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate R/W file") - } - if (H5FDtruncate(file->wo_file, dxpl_id, closing) < 0) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_truncate", - H5E_VFL, H5E_CANTUPDATE, FAIL, - "unable to truncate W/O file") - } + if(H5FDtruncate(file->wo_file, dxpl_id, closing) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_truncate */ +} /* end H5FD__splitter_truncate */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_sb_size + * Function: H5FD__splitter_sb_size * * Purpose: Obtains the number of bytes required to store the driver file * access data in the HDF5 superblock. @@ -1047,29 +953,28 @@ done: *------------------------------------------------------------------------- */ static hsize_t -H5FD_splitter_sb_size(H5FD_t *_file) +H5FD__splitter_sb_size(H5FD_t *_file) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; hsize_t ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_sb_size"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Sanity check */ HDassert(file); HDassert(file->rw_file); - if (file->rw_file) { + if(file->rw_file) ret_value = H5FD_sb_size(file->rw_file); - } FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_sb_size */ +} /* end H5FD__splitter_sb_size */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_sb_encode + * Function: H5FD__splitter_sb_encode * * Purpose: Encode driver-specific data into the output arguments. * @@ -1077,30 +982,29 @@ H5FD_splitter_sb_size(H5FD_t *_file) *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/) +H5FD__splitter_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out*/) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_sb_encode"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Sanity check */ HDassert(file); HDassert(file->rw_file); - if (file->rw_file && H5FD_sb_encode(file->rw_file, name, buf) < 0) { + if(file->rw_file && H5FD_sb_encode(file->rw_file, name, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTENCODE, FAIL, "unable to encode the superblock in R/W file") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_sb_encode */ +} /* end H5FD__splitter_sb_encode */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_sb_decode + * Function: H5FD__splitter_sb_decode * * Purpose: Decodes the driver information block. * @@ -1110,30 +1014,29 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) +H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_sb_decode"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Sanity check */ HDassert(file); HDassert(file->rw_file); - if (H5FD_sb_load(file->rw_file, name, buf) < 0) { + if(H5FD_sb_load(file->rw_file, name, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode the superblock in R/W file") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_sb_decode */ +} /* end H5FD__splitter_sb_decode */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_cmp + * Function: H5FD__splitter_cmp * * Purpose: Compare the keys of two files. * @@ -1142,15 +1045,15 @@ done: *------------------------------------------------------------------------- */ static int -H5FD_splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_splitter_t *f1 = (const H5FD_splitter_t *)_f1; const H5FD_splitter_t *f2 = (const H5FD_splitter_t *)_f2; herr_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_cmp"); + H5FD_SPLITTER_LOG_CALL(FUNC); HDassert(f1); HDassert(f2); @@ -1158,11 +1061,11 @@ H5FD_splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) ret_value = H5FD_cmp(f1->rw_file, f2->rw_file); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_cmp */ +} /* end H5FD__splitter_cmp */ /*-------------------------------------------------------------------------- - * Function: H5FD_splitter_get_handle + * Function: H5FD__splitter_get_handle * * Purpose: Returns a pointer to the file handle of low-level virtual * file driver. @@ -1171,17 +1074,15 @@ H5FD_splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) *-------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_get_handle( - H5FD_t *_file, - hid_t H5_ATTR_UNUSED fapl, - void **file_handle) +H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, + void **file_handle) { H5FD_splitter_t *file = (H5FD_splitter_t*)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_get_handle"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(file); @@ -1189,18 +1090,16 @@ H5FD_splitter_get_handle( HDassert(file_handle); /* Only do for R/W channel */ - if (H5FD_get_vfd_handle(file->rw_file, file->fa.rw_fapl_id, file_handle) < 0) - { + if(H5FD_get_vfd_handle(file->rw_file, file->fa.rw_fapl_id, file_handle) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to get handle of R/W file") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_get_handle */ +} /* end H5FD__splitter_get_handle */ /*-------------------------------------------------------------------------- - * Function: H5FD_splitter_lock + * Function: H5FD__splitter_lock * * Purpose: Sets a file lock. * @@ -1208,37 +1107,32 @@ done: *-------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_lock(H5FD_t *_file, hbool_t rw) +H5FD__splitter_lock(H5FD_t *_file, hbool_t rw) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_lock"); + H5FD_SPLITTER_LOG_CALL(FUNC); HDassert(file); HDassert(file->rw_file); /* Place the lock on each file */ - if (H5FD_lock(file->rw_file, rw) < 0) { + if(H5FD_lock(file->rw_file, rw) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTLOCK, FAIL, "unable to lock R/W file") - } - if (file->wo_file != NULL) { - if (H5FD_lock(file->wo_file, rw) < 0) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_lock", - H5E_VFL, H5E_CANTLOCK, FAIL, - "unable to lock W/O file") - } - } + if(file->wo_file != NULL) + if(H5FD_lock(file->wo_file, rw) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTLOCK, FAIL, "unable to lock W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_lock */ +} /* end H5FD__splitter_lock */ /*-------------------------------------------------------------------------- - * Function: H5FD_splitter_unlock + * Function: H5FD__splitter_unlock * * Purpose: Removes a file lock. * @@ -1246,37 +1140,33 @@ done: *-------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_unlock(H5FD_t *_file) +H5FD__splitter_unlock(H5FD_t *_file) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_unlock"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(file); HDassert(file->rw_file); /* Remove the lock on each file */ - if (H5FD_unlock(file->rw_file) < 0) { + if(H5FD_unlock(file->rw_file) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCK, FAIL, "unable to unlock R/W file") - } - if (file->wo_file != NULL) { - if (H5FD_unlock(file->wo_file) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCK, FAIL, - "unable to unlock W/O file") - } - } + if(file->wo_file != NULL) + if(H5FD_unlock(file->wo_file) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCK, FAIL, "unable to unlock W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_unlock */ +} /* end H5FD__splitter_unlock */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_query + * Function: H5FD__splitter_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -1285,40 +1175,37 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_query(const H5FD_t *_file, unsigned long *flags /* out */) +H5FD__splitter_query(const H5FD_t *_file, unsigned long *flags /* out */) { const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_query"); + H5FD_SPLITTER_LOG_CALL(FUNC); - if (file) { + if(file) { HDassert(file); HDassert(file->rw_file); - if (H5FDquery(file->rw_file, flags) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTLOCK, FAIL, - "unable to query R/W file"); - } + if(H5FDquery(file->rw_file, flags) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTLOCK, FAIL, "unable to query R/W file"); } else { /* There is no file. Because this is a pure passthrough VFD, * it has no features of its own. */ - if (flags) { + if(flags) *flags = 0; - } } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_query() */ +} /* end H5FD__splitter_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_alloc + * Function: H5FD__splitter_alloc * * Purpose: Allocate file memory. * @@ -1326,37 +1213,33 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) +H5FD__splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_alloc"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(file); HDassert(file->rw_file); /* Allocate memory for each file, only return the return value for R/W file. */ - if ((ret_value = H5FDalloc(file->rw_file, type, dxpl_id, size)) == HADDR_UNDEF) { + if((ret_value = H5FDalloc(file->rw_file, type, dxpl_id, size)) == HADDR_UNDEF) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate for R/W file") - } - if (H5FDalloc(file->wo_file, type, dxpl_id, size) == HADDR_UNDEF) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_alloc", - H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, - "unable to alloc for W/O file") - } + if(H5FDalloc(file->wo_file, type, dxpl_id, size) == HADDR_UNDEF) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to alloc for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_alloc() */ +} /* end H5FD__splitter_alloc() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_get_type_map + * Function: H5FD__splitter_get_type_map * * Purpose: Retrieve the memory type mapping for this file * @@ -1364,31 +1247,30 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) +H5FD__splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) { const H5FD_splitter_t *file = (const H5FD_splitter_t *)_file; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_get_type_map"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(file); HDassert(file->rw_file); /* Retrieve memory type mapping for R/W channel only */ - if (H5FD_get_fs_type_map(file->rw_file, type_map) < 0) { + if(H5FD_get_fs_type_map(file->rw_file, type_map) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to allocate for R/W file") - } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_get_type_map() */ +} /* end H5FD__splitter_get_type_map() */ /*------------------------------------------------------------------------- - * Function: H5FD_splitter_free + * Function: H5FD__splitter_free * * Purpose: Free the resources for the splitter VFD. * @@ -1396,32 +1278,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) +H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { H5FD_splitter_t *file = (H5FD_splitter_t *)_file; /* VFD file struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL("H5FD_splitter_free"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(file); HDassert(file->rw_file); - if (H5FDfree(file->rw_file, type, dxpl_id, addr, size) < 0) { + if(H5FDfree(file->rw_file, type, dxpl_id, addr, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free for R/W file") - } - if (H5FDfree(file->wo_file, type, dxpl_id, addr, size) < 0) { - H5FD_SPLITTER_WO_ERROR(file, "H5FD_splitter_free", - H5E_VFL, H5E_CANTINIT, FAIL, - "unable to free for W/O file") - } + if(H5FDfree(file->wo_file, type, dxpl_id, addr, size) < 0) + H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, FAIL, "unable to free for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_splitter_free() */ +} /* end H5FD__splitter_free() */ /*------------------------------------------------------------------------- @@ -1435,33 +1313,29 @@ done: static herr_t H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const char *msg) { - size_t size = 0; - char *s = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL("H5FD__splitter_log_error"); + H5FD_SPLITTER_LOG_CALL(FUNC); /* Check arguments */ HDassert(file); HDassert(atfunc && *atfunc); HDassert(msg && *msg); - if (file->logfp != NULL) { - size = strlen(atfunc) + strlen(msg) + 3; /* ':', ' ', '\n' */ - s = (char *)malloc(sizeof(char) * (size+1)); - if (NULL == s) { + if(file->logfp != NULL) { + size_t size; + char *s; + + size = HDstrlen(atfunc) + HDstrlen(msg) + 3; /* ':', ' ', '\n' */ + s = (char *)HDmalloc(sizeof(char) * (size + 1)); + if(NULL == s) ret_value = FAIL; - } - else - if (size < (size_t)HDsnprintf(s, size+1, "%s: %s\n", atfunc, msg)) { + else if(size < (size_t)HDsnprintf(s, size+1, "%s: %s\n", atfunc, msg)) ret_value = FAIL; - } - else - if (size != HDfwrite(s, 1, size, file->logfp)) { + else if(size != HDfwrite(s, 1, size, file->logfp)) ret_value = FAIL; - } HDfree(s); } diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index d29a1b4..1d401c2 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Wednesday, October 22, 1997 * * Purpose: The C STDIO virtual file driver which only uses calls from stdio.h. diff --git a/src/H5FDstdio.h b/src/H5FDstdio.h index f99aacf..9a5bc78 100644 --- a/src/H5FDstdio.h +++ b/src/H5FDstdio.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Purpose: The public header file for the sec2 driver. diff --git a/src/H5FDtest.c b/src/H5FDtest.c index 2eb176d..7afc1bf 100644 --- a/src/H5FDtest.c +++ b/src/H5FDtest.c @@ -110,6 +110,5 @@ H5FD__supports_swmr_test(const char *vfd_name) ret_value = !HDstrcmp(vfd_name, "log") || !HDstrcmp(vfd_name, "sec2"); FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD__supports_swmr_test() */ diff --git a/src/H5FDwindows.h b/src/H5FDwindows.h index 5cf68a1..5e23712 100644 --- a/src/H5FDwindows.h +++ b/src/H5FDwindows.h @@ -12,8 +12,8 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Scott Wegner - * Based on code by Robb Matzke + * Programmer: Scott Wegner + * Based on code by Robb Matzke * Thursday, May 24 2007 * * Purpose: The public header file for the windows driver. diff --git a/src/H5FL.c b/src/H5FL.c index 66d27fb..e50616a 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, March 23, 2000 * * Purpose: Manage priority queues of free-lists (of blocks of bytes). diff --git a/src/H5FLmodule.h b/src/H5FLmodule.h index 48b8d2b..dbce75c 100644 --- a/src/H5FLmodule.h +++ b/src/H5FLmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index 94a51e5..a2c019a 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -15,12 +15,10 @@ * * Created: H5FLprivate.h * Mar 23 2000 - * Quincey Koziol + * Quincey Koziol * * Purpose: Private non-prototype header. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5FLprivate_H diff --git a/src/H5FS.c b/src/H5FS.c index 6d574c0..cb60c0e 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 2, 2006 * * Purpose: Free space tracking functions. @@ -787,9 +787,6 @@ H5FS__dirty(H5FS_t *fspace) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE -#ifdef QAK -HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(fspace); @@ -1206,9 +1203,6 @@ void H5FS__assert(const H5FS_t *fspace) { FUNC_ENTER_PACKAGE_NOERR -#ifdef QAK -HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS__assert", fspace->tot_sect_count); -#endif /* QAK */ /* Checks for section info, if it's available */ if(fspace->sinfo) { @@ -1224,9 +1218,6 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS__assert", fspace-> HDassert(fspace->tot_sect_count >= fspace->serial_sect_count); HDassert(fspace->tot_sect_count >= fspace->ghost_sect_count); HDassert(fspace->tot_sect_count == (fspace->serial_sect_count + fspace->ghost_sect_count)); -#ifdef QAK - HDassert(fspace->serial_sect_count > 0 || fspace->ghost_sect_count == 0); -#endif /* QAK */ FUNC_LEAVE_NOAPI_VOID } /* end H5FS__assert() */ diff --git a/src/H5FScache.c b/src/H5FScache.c index c3e3998..ed468b4 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -15,7 +15,7 @@ * * Created: H5FScache.c * May 2 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement file free space metadata cache methods. * @@ -163,7 +163,6 @@ const H5AC_class_t H5AC_FSPACE_SINFO[1] = {{ * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -235,7 +234,6 @@ H5FS__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 18 2013 * *------------------------------------------------------------------------- @@ -350,7 +348,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -796,7 +793,6 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@lbl.gov * January 3, 2017 * *------------------------------------------------------------------------- @@ -860,7 +856,6 @@ done: * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -1032,7 +1027,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l unsigned sect_cnt_size; /* The size of the section size counts */ /* Compute the size of the section counts */ - sect_cnt_size = H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count); + sect_cnt_size = H5VM__limit_enc_size((uint64_t)fspace->serial_sect_count); /* Reset the section count, the "add" routine will update it */ old_tot_sect_count = fspace->tot_sect_count; @@ -1132,7 +1127,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14, 2013 * *------------------------------------------------------------------------- @@ -1300,7 +1294,7 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, /* Set up user data for iterator */ udata.sinfo = sinfo; udata.image = ℑ - udata.sect_cnt_size = H5VM_limit_enc_size((uint64_t)sinfo->fspace->serial_sect_count); + udata.sect_cnt_size = H5VM__limit_enc_size((uint64_t)sinfo->fspace->serial_sect_count); /* Iterate over all the bins */ for(bin = 0; bin < sinfo->nbins; bin++) diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index c615b68..9708e9e 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -15,7 +15,7 @@ * * Created: H5FSdbg.c * May 9 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Dump debugging information about a free space manager * diff --git a/src/H5FSint.c b/src/H5FSint.c index 6ba5748..926b818 100644 --- a/src/H5FSint.c +++ b/src/H5FSint.c @@ -15,7 +15,7 @@ * * Created: H5FSint.c * Fall 2012 - * Dana Robinson + * Dana Robinson * * Purpose: Internal routines for free space managers. * diff --git a/src/H5FSmodule.h b/src/H5FSmodule.h index b2869dd..88c663b 100644 --- a/src/H5FSmodule.h +++ b/src/H5FSmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index 2c56ab6..0cc328e 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 2, 2006 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index d2e1f90..e02a8e2 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -15,7 +15,7 @@ * * Created: H5FSprivate.h * May 2 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Private header for library accessible file free space routines. * diff --git a/src/H5FSsection.c b/src/H5FSsection.c index d783901..269f63c 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 31, 2006 * * Purpose: Free space tracking functions. @@ -144,10 +144,10 @@ HDfprintf(stderr, "%s: fspace->addr = %a\n", FUNC, fspace->addr); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set non-zero values */ - sinfo->nbins = H5VM_log2_gen(fspace->max_sect_size); + sinfo->nbins = H5VM__log2_gen(fspace->max_sect_size); sinfo->sect_prefix_size = H5FS_SINFO_PREFIX_SIZE(f); sinfo->sect_off_size = (fspace->max_sect_addr + 7) / 8; - sinfo->sect_len_size = H5VM_limit_enc_size((uint64_t)fspace->max_sect_size); + sinfo->sect_len_size = H5VM__limit_enc_size((uint64_t)fspace->max_sect_size); #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: fspace->max_sect_size = %Hu\n", FUNC, fspace->max_sect_size); HDfprintf(stderr, "%s: fspace->max_sect_addr = %u\n", FUNC, fspace->max_sect_addr); @@ -518,12 +518,6 @@ H5FS__sect_serialize_size(H5FS_t *fspace) /* Check arguments. */ HDassert(fspace); -#ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - fspace->sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->sect_size); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Zu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count); -HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->alloc_sect_size); -HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count); -#endif /* QAK */ /* Compute the size of the buffer required to serialize all the sections */ if(fspace->serial_sect_count > 0) { @@ -533,11 +527,7 @@ HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_se sect_buf_size = fspace->sinfo->sect_prefix_size; /* Count for each differently sized serializable section */ -#ifdef QAK -HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count); -#endif /* QAK */ - sect_buf_size += fspace->sinfo->serial_size_count * H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count); + sect_buf_size += fspace->sinfo->serial_size_count * H5VM__limit_enc_size((uint64_t)fspace->serial_sect_count); /* Size for each differently sized serializable section */ sect_buf_size += fspace->sinfo->serial_size_count * fspace->sinfo->sect_len_size; @@ -604,10 +594,6 @@ H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, fspace->serial_sect_count++; /* Increment amount of space required to serialize all sections */ -#ifdef QAK -HDfprintf(stderr, "%s: sinfo->serial_size = %Zu\n", FUNC, fspace->sinfo->serial_size); -HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); -#endif /* QAK */ fspace->sinfo->serial_size += cls->serial_size; /* Update the free space sections' serialized size */ @@ -664,10 +650,6 @@ H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) fspace->serial_sect_count--; /* Decrement amount of space required to serialize all sections */ -#ifdef QAK -HDfprintf(stderr, "%s: fspace->serial_size = %Zu\n", FUNC, fspace->sinfo->serial_size); -HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); -#endif /* QAK */ fspace->sinfo->serial_size -= cls->serial_size; /* Update the free space sections' serialized size */ @@ -710,9 +692,6 @@ H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node * the bin's skiplist is also a skiplist...) */ sinfo->bins[bin].tot_sect_count--; -#ifdef QAK -HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bins[bin].sect_count); -#endif /* QAK */ /* Check for 'ghost' or 'serializable' section */ if(cls->flags & H5FS_CLS_GHOST_OBJ) { @@ -798,7 +777,7 @@ H5FS__sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, HDassert(cls); /* Determine correct bin which holds items of at least the section's size */ - bin = H5VM_log2_gen(sect->size); + bin = H5VM__log2_gen(sect->size); HDassert(bin < sinfo->nbins); if(sinfo->bins[bin].bin_list == NULL) HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "node's bin is empty?") @@ -853,9 +832,6 @@ H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, if(!(cls->flags & H5FS_CLS_SEPAR_OBJ)) { H5FS_section_info_t *tmp_sect_node; /* Temporary section node */ -#ifdef QAK -HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC, (unsigned)sect->type); -#endif /* QAK */ tmp_sect_node = (H5FS_section_info_t *)H5SL_remove(fspace->sinfo->merge_list, §->addr); if(tmp_sect_node == NULL || tmp_sect_node != sect) HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") @@ -866,9 +842,6 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk") /* Decrement amount of free space managed */ -#ifdef QAK -HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); -#endif /* QAK */ fspace->tot_space -= sect->size; done: @@ -982,9 +955,6 @@ H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC -#ifdef QAK -HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, sect->addr); -#endif /* QAK */ /* Check arguments. */ HDassert(sinfo); @@ -993,16 +963,15 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s HDassert(sect->size); /* Determine correct bin which holds items of the section's size */ - bin = H5VM_log2_gen(sect->size); + bin = H5VM__log2_gen(sect->size); HDassert(bin < sinfo->nbins); if(sinfo->bins[bin].bin_list == NULL) { if(NULL == (sinfo->bins[bin].bin_list = H5SL_create(H5SL_TYPE_HSIZE, NULL))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for free space nodes") } /* end if */ - else { + else /* Check for node list of the correct size already */ fspace_node = (H5FS_node_t *)H5SL_search(sinfo->bins[bin].bin_list, §->size); - } /* end else */ /* Check if we need to create a new skip list for nodes of this size */ if(fspace_node == NULL) { @@ -1030,9 +999,6 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, s /* (Different from the # of items in the bin's skiplist, since each node on * the bin's skiplist is also a skiplist...) */ -#ifdef QAK -HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bins[bin].sect_count); -#endif /* QAK */ sinfo->bins[bin].tot_sect_count++; if(cls->flags & H5FS_CLS_GHOST_OBJ) { sinfo->bins[bin].ghost_sect_count++; @@ -1095,9 +1061,6 @@ H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, /* Add section to the address-ordered list of sections, if allowed */ if(!(cls->flags & H5FS_CLS_SEPAR_OBJ)) { -#ifdef QAK -HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUNC, (unsigned)sect->type); -#endif /* QAK */ if(fspace->sinfo->merge_list == NULL) if(NULL == (fspace->sinfo->merge_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for merging free space sections") @@ -1146,21 +1109,12 @@ H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) cls = &fspace->sect_cls[sect->type]; /* Add section to size tracked data structures */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); -#endif /* QAK */ if(H5FS__sect_link_size(fspace->sinfo, cls, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to size tracking data structures") -#ifdef QAK -HDfprintf(stderr, "%s: Check 2.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); -#endif /* QAK */ /* Update rest of free space manager data structures for section addition */ if(H5FS__sect_link_rest(fspace, cls, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to non-size tracking data structures") -#ifdef QAK -HDfprintf(stderr, "%s: Check 3.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); -#endif /* QAK */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1304,9 +1258,6 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) } while(modified); } /* end if */ HDassert(*sect); -#ifdef QAK -HDfprintf(stderr, "%s: Done merging, (*sect) = {%a, %Hu, %u, %s}\n", FUNC, (*sect)->addr, (*sect)->size, (*sect)->type, ((*sect)->state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ /* Loop until no more shrinking */ do { @@ -1319,10 +1270,6 @@ HDfprintf(stderr, "%s: Done merging, (*sect) = {%a, %Hu, %u, %s}\n", FUNC, (*sec if((status = (*sect_cls->can_shrink)(*sect, op_data)) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container") if(status > 0) { -#ifdef QAK -HDfprintf(stderr, "%s: Can shrink!\n", FUNC); -#endif /* QAK */ - /* Remove SECT from free-space manager */ /* (only possible to happen on second+ pass through loop) */ if(remove_sect) { @@ -1365,18 +1312,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); if(remove_sect && (*sect != NULL)) *sect = NULL; -#ifdef QAK -HDfprintf(stderr, "%s: Done shrinking\n", FUNC); -if(*sect) - HDfprintf(stderr, "%s: (*sect) = {%a, %Hu, %u, %s}\n", FUNC, (*sect)->addr, (*sect)->size, (*sect)->type, ((*sect)->state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -else - HDfprintf(stderr, "%s: *sect = %p\n", FUNC, *sect); -#endif /* QAK */ - done: -#ifdef QAK -HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS__sect_merge() */ @@ -1704,12 +1640,8 @@ H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node HDassert(node); /* Determine correct bin which holds items of at least the section's size */ - bin = H5VM_log2_gen(request); + bin = H5VM__log2_gen(request); HDassert(bin < fspace->sinfo->nbins); -#ifdef QAK -HDfprintf(stderr, "%s: fspace->sinfo->nbins = %u\n", FUNC, fspace->sinfo->nbins); -HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); -#endif /* QAK */ alignment = fspace->alignment; if(!((alignment > 1) && (request >= fspace->align_thres))) alignment = 0; /* no alignment */ @@ -1841,10 +1773,6 @@ H5FS_sect_find(H5F_t *f, H5FS_t *fspace, hsize_t request, H5FS_section_info_t ** FUNC_ENTER_NOAPI(FAIL) -#ifdef QAK -HDfprintf(stderr, "%s: request = %Hu\n", FUNC, request); -#endif /* QAK */ - /* Check arguments. */ HDassert(fspace); HDassert(fspace->nclasses); @@ -1852,11 +1780,6 @@ HDfprintf(stderr, "%s: request = %Hu\n", FUNC, request); HDassert(node); /* Check for any sections on free space list */ -#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); -#endif /* QAK */ if(fspace->tot_sect_count > 0) { /* Get a pointer to the section info */ if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) @@ -1871,9 +1794,6 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se if(ret_value > 0) { /* Note that we've modified the section info */ sinfo_modified = TRUE; -#ifdef QAK -HDfprintf(stderr, "%s: (*node)->size = %Hu, (*node)->addr = %a, (*node)->type = %u\n", FUNC, (*node)->size, (*node)->addr, (*node)->type); -#endif /* QAK */ } /* end if */ } /* end if */ @@ -1890,7 +1810,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_iterate_sect_cb + * Function: H5FS__iterate_sect_cb * * Purpose: Skip list iterator callback to iterate over free space sections * of a particular size @@ -1903,13 +1823,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_iterate_sect_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) +H5FS__iterate_sect_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) { H5FS_section_info_t *sect_info = (H5FS_section_info_t *)_item; /* Free space section to work on */ H5FS_iter_ud_t *udata = (H5FS_iter_ud_t *)_udata; /* Callback info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sect_info); @@ -1922,11 +1842,11 @@ H5FS_iterate_sect_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_iterate_sect_cb() */ +} /* H5FS__iterate_sect_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_iterate_node_cb + * Function: H5FS__iterate_node_cb * * Purpose: Skip list iterator callback to iterate over free space sections * in a bin @@ -1939,13 +1859,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_iterate_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) +H5FS__iterate_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) { H5FS_node_t *fspace_node = (H5FS_node_t *)_item; /* Free space size node to work on */ H5FS_iter_ud_t *udata = (H5FS_iter_ud_t *)_udata; /* Callback info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace_node); @@ -1954,12 +1874,12 @@ H5FS_iterate_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) /* Iterate through all the sections of this size */ HDassert(fspace_node->sect_list); - if(H5SL_iterate(fspace_node->sect_list, H5FS_iterate_sect_cb, udata) < 0) + if(H5SL_iterate(fspace_node->sect_list, H5FS__iterate_sect_cb, udata) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section nodes") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_iterate_node_cb() */ +} /* H5FS__iterate_node_cb() */ /*------------------------------------------------------------------------- @@ -1987,10 +1907,6 @@ H5FS_sect_iterate(H5F_t *f, H5FS_t *fspace, H5FS_operator_t op, void *op_data) HDassert(fspace); HDassert(op); -#ifdef QAK -HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_count); -#endif /* QAK */ - /* Set up user data for iterator */ udata.fspace = fspace; udata.op = op; @@ -2006,14 +1922,11 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_c sinfo_valid = TRUE; /* Iterate over all the bins */ -#ifdef QAK -HDfprintf(stderr, "%s: Iterate over section bins\n", FUNC); -#endif /* QAK */ for(bin = 0; bin < fspace->sinfo->nbins; bin++) { /* Check if there are any sections in this bin */ if(fspace->sinfo->bins[bin].bin_list) { /* Iterate over list of section size nodes for bin */ - if(H5SL_iterate(fspace->sinfo->bins[bin].bin_list, H5FS_iterate_node_cb, &udata) < 0) + if(H5SL_iterate(fspace->sinfo->bins[bin].bin_list, H5FS__iterate_node_cb, &udata) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section size nodes") } /* end if */ } /* end for */ @@ -2098,10 +2011,6 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, old_class = sect->type; old_cls = &fspace->sect_cls[sect->type]; new_cls = &fspace->sect_cls[new_class]; -#ifdef QAK -HDfprintf(stderr, "%s: old_cls->flags = %x\n", FUNC, old_cls->flags); -HDfprintf(stderr, "%s: new_cls->flags = %x\n", FUNC, new_cls->flags); -#endif /* QAK */ /* Check if the section's class change will affect the # of serializable or ghost sections */ if((old_cls->flags & H5FS_CLS_GHOST_OBJ) != (new_cls->flags & H5FS_CLS_GHOST_OBJ)) { @@ -2114,15 +2023,12 @@ HDfprintf(stderr, "%s: new_cls->flags = %x\n", FUNC, new_cls->flags); to_ghost = FALSE; else to_ghost = TRUE; -#ifdef QAK -HDfprintf(stderr, "%s: to_ghost = %u\n", FUNC, to_ghost); -#endif /* QAK */ /* Sanity check */ HDassert(fspace->sinfo->bins); /* Determine correct bin which holds items of at least the section's size */ - bin = H5VM_log2_gen(sect->size); + bin = H5VM__log2_gen(sect->size); HDassert(bin < fspace->sinfo->nbins); HDassert(fspace->sinfo->bins[bin].bin_list); @@ -2180,15 +2086,9 @@ HDfprintf(stderr, "%s: to_ghost = %u\n", FUNC, to_ghost); to_mergable = TRUE; else to_mergable = FALSE; -#ifdef QAK -HDfprintf(stderr, "%s: to_mergable = %u\n", FUNC, to_mergable); -#endif /* QAK */ /* Add or remove section from merge list, as appropriate */ if(to_mergable) { -#ifdef QAK -HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUNC, (unsigned)sect->type); -#endif /* QAK */ if(fspace->sinfo->merge_list == NULL) if(NULL == (fspace->sinfo->merge_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for merging free space sections") @@ -2198,9 +2098,6 @@ HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUN else { H5FS_section_info_t *tmp_sect_node; /* Temporary section node */ -#ifdef QAK -HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC, (unsigned)sect->type); -#endif /* QAK */ tmp_sect_node = (H5FS_section_info_t *)H5SL_remove(fspace->sinfo->merge_list, §->addr); if(tmp_sect_node == NULL || tmp_sect_node != sect) HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") @@ -2246,9 +2143,6 @@ H5FS__sect_assert(const H5FS_t *fspace) hsize_t separate_obj; /* The number of separate objects managed */ FUNC_ENTER_PACKAGE_NOERR -#ifdef QAK -HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS__sect_assert", fspace->tot_sect_count); -#endif /* QAK */ /* Initialize state */ separate_obj = 0; @@ -2305,9 +2199,6 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS__sect_assert", fsp /* Get section node & it's class */ sect = (H5FS_section_info_t *)H5SL_item(curr_sect_node); cls = &fspace->sect_cls[sect->type]; -#ifdef QAK -HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", "H5FS__sect_assert", sect->size, sect->addr, sect->type); -#endif /* QAK */ /* Sanity check section */ HDassert(H5F_addr_defined(sect->addr)); diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 74a170b..5ad7634 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -15,7 +15,7 @@ * * Created: H5Faccum.c * Jan 10 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: File metadata "accumulator" routines. (Used to * cache small metadata I/Os and group them into a @@ -105,7 +105,6 @@ H5FL_BLK_DEFINE_STATIC(meta_accum); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- @@ -154,7 +153,7 @@ H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t new_alloc_size; /* New size of accumulator */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ - new_alloc_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(new_size - 1))); + new_alloc_size = (size_t)1 << (1 + H5VM__log2_gen((uint64_t)(new_size - 1))); /* Reallocate the metadata accumulator buffer */ if(NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_alloc_size))) @@ -274,7 +273,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jun 11 2009 * *------------------------------------------------------------------------- @@ -298,7 +296,7 @@ H5F__accum_adjust(H5F_meta_accum_t *accum, H5FD_t *file, size_t new_size; /* New size of accumulator */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ - new_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)((size + accum->size) - 1))); + new_size = (size_t)1 << (1 + H5VM__log2_gen((uint64_t)((size + accum->size) - 1))); /* Check for accumulator getting too big */ if(new_size > H5F_ACCUM_MAX_SIZE) { @@ -413,7 +411,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- @@ -612,7 +609,7 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t new_alloc_size; /* New size of accumulator */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ - new_alloc_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1))); + new_alloc_size = (size_t)1 << (1 + H5VM__log2_gen((uint64_t)(size - 1))); /* Reallocate the metadata accumulator buffer */ if(NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_alloc_size))) @@ -656,7 +653,7 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t clear_size; /* Size of memory that needs clearing */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ - new_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1))); + new_size = (size_t)1 << (1 + H5VM__log2_gen((uint64_t)(size - 1))); /* Grow the metadata accumulator buffer */ if(NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_size))) @@ -704,7 +701,7 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t new_size; /* New size of accumulator */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ - new_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1))); + new_size = (size_t)1 << (1 + H5VM__log2_gen((uint64_t)(size - 1))); /* Reallocate the metadata accumulator buffer */ if(NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_size))) @@ -841,7 +838,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- @@ -1007,7 +1003,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- @@ -1050,7 +1045,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 10 2008 * *------------------------------------------------------------------------- diff --git a/src/H5Fcwfs.c b/src/H5Fcwfs.c index 26452b6..2b368d5 100644 --- a/src/H5Fcwfs.c +++ b/src/H5Fcwfs.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 19, 2011 * * Purpose: Each file has a small cache of global heap collections called diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c index 535b43d..09f6829 100644 --- a/src/H5Fdbg.c +++ b/src/H5Fdbg.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Wednesday, July 9, 2003 * * Purpose: File object debugging functions. @@ -39,7 +39,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 1 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index a047161..76a0991 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -15,7 +15,7 @@ * * Created: H5Fdeprec.c * October 1 2009 - * Quincey Koziol + * Quincey Koziol * * Purpose: Deprecated functions from the H5F interface. These * functions are here for compatibility purposes and may be diff --git a/src/H5Fefc.c b/src/H5Fefc.c index 77d29f5..c9a3a00 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -15,7 +15,7 @@ * * Created: H5Defc.c * December 13, 2010 - * Neil Fortner + * Neil Fortner * * Purpose: External file caching routines - implements a * cache of external files to minimize the number of diff --git a/src/H5Ffake.c b/src/H5Ffake.c index 67bd180..36fea5b 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -34,7 +34,6 @@ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 2, 2006 * *------------------------------------------------------------------------- @@ -79,7 +78,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 2, 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Fint.c b/src/H5Fint.c index 0bda894..f206199 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1854,7 +1854,7 @@ H5F__post_open(H5F_t *f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__flush() */ +} /* end H5F__post_open() */ /*------------------------------------------------------------------------- diff --git a/src/H5Fio.c b/src/H5Fio.c index 34dd0d6..7a901aa 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -15,7 +15,7 @@ * * Created: H5Fio.c * Jan 10 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: File I/O routines. * @@ -86,7 +86,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 * *------------------------------------------------------------------------- @@ -130,7 +129,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 * *------------------------------------------------------------------------- @@ -175,7 +173,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 * *------------------------------------------------------------------------- @@ -220,7 +217,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Fmodule.h b/src/H5Fmodule.h index 0481512..fb362fc 100644 --- a/src/H5Fmodule.h +++ b/src/H5Fmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 5e6b899..9d32fa5 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -627,7 +627,7 @@ H5F__mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs) /*------------------------------------------------------------------------- - * Function: H5F_flush_mounts_recurse + * Function: H5F__flush_mounts_recurse * * Purpose: Flush a mount hierarchy, recursively * @@ -639,20 +639,20 @@ H5F__mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs) *------------------------------------------------------------------------- */ static herr_t -H5F_flush_mounts_recurse(H5F_t *f) +H5F__flush_mounts_recurse(H5F_t *f) { unsigned nerrors = 0; /* Errors from recursive flushes */ unsigned u; /* Index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); /* Flush all child files, not stopping for errors */ for(u = 0; u < f->shared->mtab.nmounts; u++) - if(H5F_flush_mounts_recurse(f->shared->mtab.child[u].file) < 0) + if(H5F__flush_mounts_recurse(f->shared->mtab.child[u].file) < 0) nerrors++; /* Call the "real" flush routine, for this file */ @@ -665,7 +665,7 @@ H5F_flush_mounts_recurse(H5F_t *f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_flush_mounts_recurse() */ +} /* end H5F__flush_mounts_recurse() */ /*------------------------------------------------------------------------- @@ -695,7 +695,7 @@ H5F_flush_mounts(H5F_t *f) f = f->parent; /* Flush the mounted file hierarchy */ - if(H5F_flush_mounts_recurse(f) < 0) + if(H5F__flush_mounts_recurse(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") done: diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 0c46f59..8189821 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -15,7 +15,7 @@ * * Created: H5Fmpi.c * Jan 10 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: MPI-related routines. * diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 46185ff..fe58fdb 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 28, 2000 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index c5d4c89..1cfd103 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -116,16 +116,16 @@ typedef struct H5F_t H5F_t; /* Encode a 64-bit unsigned integer and its length into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ # define UINT64ENCODE_VARLEN(p, n) { \ - uint64_t __n = (uint64_t)(n); \ - unsigned _s = H5VM_limit_enc_size(__n); \ - \ - *(p)++ = (uint8_t)_s; \ - UINT64ENCODE_VAR(p, __n, _s); \ + uint64_t __n = (uint64_t)(n); \ + unsigned _s = H5VM__limit_enc_size(__n); \ + \ + *(p)++ = (uint8_t)_s; \ + UINT64ENCODE_VAR(p, __n, _s); \ } # define H5_ENCODE_UNSIGNED(p, n) { \ - HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ - UINT32ENCODE(p, n) \ + HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ + UINT32ENCODE(p, n) \ } /* Assumes the endianness of uint64_t is the same as double */ diff --git a/src/H5Fquery.c b/src/H5Fquery.c index e1b11c8..565f492 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -15,7 +15,7 @@ * * Created: H5Fquery.c * Jan 10 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: File structure query routines. * @@ -763,7 +763,6 @@ H5F_sieve_buf_size(const H5F_t *f) * Failure: (should not happen) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jul 8 2005 * *------------------------------------------------------------------------- diff --git a/src/H5Fspace.c b/src/H5Fspace.c index 6baf163..3d969f9 100644 --- a/src/H5Fspace.c +++ b/src/H5Fspace.c @@ -15,7 +15,7 @@ * * Created: H5Fspace.c * Dec 30 2013 - * Quincey Koziol + * Quincey Koziol * * Purpose: Space allocation routines for the file. * diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 9fd2831..cf3f72a 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -318,7 +318,6 @@ done: * Failure: FAIL * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept 12, 2003 * *------------------------------------------------------------------------- @@ -896,8 +895,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing fsinfo message to superblock extension") } else { - if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) - { + if(H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) { #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ f->shared->sblock = NULL; #endif /* JRM */ @@ -1067,7 +1065,6 @@ done: * Failure: FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sept 15, 2003 * *------------------------------------------------------------------------- diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 119548c..329bf21 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -15,7 +15,7 @@ * * Created: H5Fsuper_cache.c * Aug 15 2009 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement file superblock & driver info metadata cache methods. * @@ -309,7 +309,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 17, 2013 * *------------------------------------------------------------------------- @@ -338,7 +337,6 @@ H5F__cache_superblock_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * November 17, 2016 * *------------------------------------------------------------------------- @@ -428,7 +426,6 @@ H5F__cache_superblock_verify_chksum(const void *_image, size_t len, void *_udata * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 18 2013 * *------------------------------------------------------------------------- @@ -621,7 +618,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 19, 2013 * *------------------------------------------------------------------------- @@ -654,7 +650,6 @@ H5F__cache_superblock_image_len(const void *_thing, size_t *image_len) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 19 2013 * *------------------------------------------------------------------------- @@ -798,7 +793,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 20, 2013 * *------------------------------------------------------------------------- @@ -833,7 +827,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 20, 2013 * *------------------------------------------------------------------------- @@ -861,7 +854,6 @@ H5F__cache_drvrinfo_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *i * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * November 17, 2016 * *------------------------------------------------------------------------- @@ -905,7 +897,6 @@ done: * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 20 2013 * *------------------------------------------------------------------------- @@ -966,7 +957,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 20, 2013 * *------------------------------------------------------------------------- @@ -1000,7 +990,6 @@ H5F__cache_drvrinfo_image_len(const void *_thing, size_t *image_len) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 20 2013 * *------------------------------------------------------------------------- @@ -1064,7 +1053,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * July 20, 2013 * *------------------------------------------------------------------------- diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 49a2a22..97c7e3e 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -15,7 +15,7 @@ * * Created: H5Ftest.c * Jan 3 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: File testing routines. * diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index 71e0b2d..918e18c 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -15,7 +15,7 @@ * * Created: H5Gbtree2.c * Sep 9 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: v2 B-tree callbacks for indexing fields on links * @@ -75,27 +75,27 @@ typedef struct H5G_fh_ud_cmp_t { /* v2 B-tree function callbacks */ /* v2 B-tree driver callbacks for 'creation order' index */ -static herr_t H5G_dense_btree2_corder_store(void *native, const void *udata); -static herr_t H5G_dense_btree2_corder_compare(const void *rec1, const void *rec2, int *result); -static herr_t H5G_dense_btree2_corder_encode(uint8_t *raw, const void *native, +static herr_t H5G__dense_btree2_corder_store(void *native, const void *udata); +static herr_t H5G__dense_btree2_corder_compare(const void *rec1, const void *rec2, int *result); +static herr_t H5G__dense_btree2_corder_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5G_dense_btree2_corder_decode(const uint8_t *raw, void *native, +static herr_t H5G__dense_btree2_corder_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, +static herr_t H5G__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record, const void *_udata); /* v2 B-tree driver callbacks for 'name' index */ -static herr_t H5G_dense_btree2_name_store(void *native, const void *udata); +static herr_t H5G__dense_btree2_name_store(void *native, const void *udata); static herr_t H5G__dense_btree2_name_compare(const void *rec1, const void *rec2, int *result); -static herr_t H5G_dense_btree2_name_encode(uint8_t *raw, const void *native, +static herr_t H5G__dense_btree2_name_encode(uint8_t *raw, const void *native, void *ctx); -static herr_t H5G_dense_btree2_name_decode(const uint8_t *raw, void *native, +static herr_t H5G__dense_btree2_name_decode(const uint8_t *raw, void *native, void *ctx); -static herr_t H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, +static herr_t H5G__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record, const void *_udata); /* Fractal heap function callbacks */ -static herr_t H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data); +static herr_t H5G__dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data); /*********************/ @@ -108,11 +108,11 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */ sizeof(H5G_dense_bt2_name_rec_t), /* Size of native record */ NULL, /* Create client callback context */ NULL, /* Destroy client callback context */ - H5G_dense_btree2_name_store, /* Record storage callback */ - H5G__dense_btree2_name_compare, /* Record comparison callback */ - H5G_dense_btree2_name_encode, /* Record encoding callback */ - H5G_dense_btree2_name_decode, /* Record decoding callback */ - H5G_dense_btree2_name_debug /* Record debugging callback */ + H5G__dense_btree2_name_store, /* Record storage callback */ + H5G__dense_btree2_name_compare, /* Record comparison callback */ + H5G__dense_btree2_name_encode, /* Record encoding callback */ + H5G__dense_btree2_name_decode, /* Record decoding callback */ + H5G__dense_btree2_name_debug /* Record debugging callback */ }}; /* v2 B-tree class for indexing 'creation order' field of links */ @@ -122,11 +122,11 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */ sizeof(H5G_dense_bt2_corder_rec_t), /* Size of native record */ NULL, /* Create client callback context */ NULL, /* Destroy client callback context */ - H5G_dense_btree2_corder_store, /* Record storage callback */ - H5G_dense_btree2_corder_compare, /* Record comparison callback */ - H5G_dense_btree2_corder_encode, /* Record encoding callback */ - H5G_dense_btree2_corder_decode, /* Record decoding callback */ - H5G_dense_btree2_corder_debug /* Record debugging callback */ + H5G__dense_btree2_corder_store, /* Record storage callback */ + H5G__dense_btree2_corder_compare, /* Record comparison callback */ + H5G__dense_btree2_corder_encode, /* Record encoding callback */ + H5G__dense_btree2_corder_decode, /* Record decoding callback */ + H5G__dense_btree2_corder_debug /* Record debugging callback */ }}; /*****************************/ @@ -141,7 +141,7 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */ /*------------------------------------------------------------------------- - * Function: H5G_dense_fh_name_cmp + * Function: H5G__dense_fh_name_cmp * * Purpose: Compares the name of a link in a fractal heap to another * name @@ -149,19 +149,18 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */ * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) +H5G__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) { H5G_fh_ud_cmp_t *udata = (H5G_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */ H5O_link_t *lnk; /* Pointer to link created from heap object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Decode link information */ if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) @@ -181,11 +180,11 @@ H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_fh_name_cmp() */ +} /* end H5G__dense_fh_name_cmp() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_name_store + * Function: H5G__dense_btree2_name_store * * Purpose: Store user information into native record for v2 B-tree * @@ -198,19 +197,19 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_store(void *_nrecord, const void *_udata) +H5G__dense_btree2_name_store(void *_nrecord, const void *_udata) { const H5G_bt2_ud_ins_t *udata = (const H5G_bt2_ud_ins_t *)_udata; H5G_dense_bt2_name_rec_t *nrecord = (H5G_dense_bt2_name_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Copy user information info native record */ nrecord->hash = udata->common.name_hash; H5MM_memcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_name_store() */ +} /* H5G__dense_btree2_name_store() */ /*------------------------------------------------------------------------- @@ -240,16 +239,6 @@ H5G__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int HDassert(bt2_udata); HDassert(bt2_rec); -#ifdef QAK -{ -unsigned u; - -HDfprintf(stderr, "%s: bt2_udata = {'%s', %x}\n", "H5G__dense_btree2_name_compare", bt2_udata->name, (unsigned)bt2_udata->name_hash); -HDfprintf(stderr, "%s: bt2_rec = {%x, ", "H5G__dense_btree2_name_compare", (unsigned)bt2_rec->hash); -for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) - HDfprintf(stderr, "%02x%s", bt2_rec->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); -} -#endif /* QAK */ /* Check hash value */ if(bt2_udata->name_hash < bt2_rec->hash) *result = (-1); @@ -272,7 +261,7 @@ for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) fh_udata.cmp = 0; /* Check if the user's link and the B-tree's link have the same name */ - if(H5HF_op(bt2_udata->fheap, bt2_rec->id, H5G_dense_fh_name_cmp, &fh_udata) < 0) + if(H5HF_op(bt2_udata->fheap, bt2_rec->id, H5G__dense_fh_name_cmp, &fh_udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") /* Callback will set comparison value */ @@ -285,7 +274,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_name_encode + * Function: H5G__dense_btree2_name_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -298,22 +287,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UNUSED *ctx) +H5G__dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UNUSED *ctx) { const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Encode the record's fields */ UINT32ENCODE(raw, nrecord->hash) H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_name_encode() */ +} /* H5G__dense_btree2_name_encode() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_name_decode + * Function: H5G__dense_btree2_name_decode * * Purpose: Decode raw disk form of record into native form * @@ -326,22 +315,22 @@ H5G_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UN *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UNUSED *ctx) +H5G__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UNUSED *ctx) { H5G_dense_bt2_name_rec_t *nrecord = (H5G_dense_bt2_name_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Decode the record's fields */ UINT32DECODE(raw, nrecord->hash) H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_name_decode() */ +} /* H5G__dense_btree2_name_decode() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_name_debug + * Function: H5G__dense_btree2_name_debug * * Purpose: Debug native form of record * @@ -354,13 +343,13 @@ H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UN *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, +H5G__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord; unsigned u; /* Local index variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%x, ", indent, "", fwidth, "Record:", (unsigned)nrecord->hash); @@ -368,11 +357,11 @@ H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_name_debug() */ +} /* H5G__dense_btree2_name_debug() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_store + * Function: H5G__dense_btree2_corder_store * * Purpose: Store user information into native record for v2 B-tree * @@ -385,23 +374,23 @@ H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_store(void *_nrecord, const void *_udata) +H5G__dense_btree2_corder_store(void *_nrecord, const void *_udata) { const H5G_bt2_ud_ins_t *udata = (const H5G_bt2_ud_ins_t *)_udata; H5G_dense_bt2_corder_rec_t *nrecord = (H5G_dense_bt2_corder_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Copy user information info native record */ nrecord->corder = udata->common.corder; H5MM_memcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_store() */ +} /* H5G__dense_btree2_corder_store() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_compare + * Function: H5G__dense_btree2_corder_compare * * Purpose: Compare two native information records, according to some key * @@ -415,27 +404,17 @@ H5G_dense_btree2_corder_store(void *_nrecord, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, int *result) +H5G__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, int *result) { const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata; const H5G_dense_bt2_corder_rec_t *bt2_rec = (const H5G_dense_bt2_corder_rec_t *)_bt2_rec; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(bt2_udata); HDassert(bt2_rec); -#ifdef QAK -{ -unsigned u; - -HDfprintf(stderr, "%s: bt2_udata->corder = %Hd\n", "H5G_dense_btree2_corder_compare", (hsize_t)bt2_udata->corder); -HDfprintf(stderr, "%s: bt2_rec = {%Hu, ", "H5G_dense_btree2_corder_compare", (hsize_t)bt2_rec->corder); -for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) - HDfprintf(stderr, "%02x%s", bt2_rec->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); -} -#endif /* QAK */ /* Check creation order value */ if(bt2_udata->corder < bt2_rec->corder) *result = -1; @@ -445,11 +424,11 @@ for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) *result = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_compare() */ +} /* H5G__dense_btree2_corder_compare() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_encode + * Function: H5G__dense_btree2_corder_encode * * Purpose: Encode native information into raw form for storing on disk * @@ -462,22 +441,22 @@ for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UNUSED *ctx) +H5G__dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UNUSED *ctx) { const H5G_dense_bt2_corder_rec_t *nrecord = (const H5G_dense_bt2_corder_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Encode the record's fields */ INT64ENCODE(raw, nrecord->corder) H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_encode() */ +} /* H5G__dense_btree2_corder_encode() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_decode + * Function: H5G__dense_btree2_corder_decode * * Purpose: Decode raw disk form of record into native form * @@ -490,22 +469,22 @@ H5G_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_ *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UNUSED *ctx) +H5G__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UNUSED *ctx) { H5G_dense_bt2_corder_rec_t *nrecord = (H5G_dense_bt2_corder_rec_t *)_nrecord; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Decode the record's fields */ INT64DECODE(raw, nrecord->corder) H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_decode() */ +} /* H5G__dense_btree2_corder_decode() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_corder_debug + * Function: H5G__dense_btree2_corder_debug * * Purpose: Debug native form of record * @@ -518,13 +497,13 @@ H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_ *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, +H5G__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord, const void H5_ATTR_UNUSED *_udata) { const H5G_dense_bt2_corder_rec_t *nrecord = (const H5G_dense_bt2_corder_rec_t *)_nrecord; unsigned u; /* Local index variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDfprintf(stream, "%*s%-*s {%llu, ", indent, "", fwidth, "Record:", (unsigned long long)nrecord->corder); @@ -532,5 +511,5 @@ H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5G_dense_btree2_corder_debug() */ +} /* H5G__dense_btree2_corder_debug() */ diff --git a/src/H5Gcache.c b/src/H5Gcache.c index 13a33a3..22b0488 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -15,7 +15,7 @@ * * Created: H5Gcache.c * Feb 5 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement group metadata cache methods. * diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index 1a76012..d14ec20 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -15,7 +15,7 @@ * * Created: H5Gcompact.c * Sep 5 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Functions for handling compact storage. * @@ -75,7 +75,6 @@ static herr_t H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 5 2005 * *------------------------------------------------------------------------- @@ -178,7 +177,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * *------------------------------------------------------------------------- @@ -257,7 +255,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_compact_remove_common_cb + * Function: H5G__compact_remove_common_cb * * Purpose: Common callback routine for deleting 'link' message for a * particular name. @@ -265,19 +263,18 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 5 2005 * *------------------------------------------------------------------------- */ static herr_t -H5G_compact_remove_common_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) +H5G__compact_remove_common_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */ H5G_iter_rm_t *udata = (H5G_iter_rm_t *)_udata; /* 'User data' passed in */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(lnk); @@ -295,7 +292,7 @@ H5G_compact_remove_common_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, voi done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_compact_remove_common_cb() */ +} /* end H5G__compact_remove_common_cb() */ /*------------------------------------------------------------------------- @@ -328,7 +325,7 @@ H5G__compact_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, udata.name = name; /* Iterate over the link messages to delete the right one */ - if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G_compact_remove_common_cb, &udata, TRUE) < 0) + if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G__compact_remove_common_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link message") done: @@ -376,7 +373,7 @@ H5G__compact_remove_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, udata.name = ltable.lnks[n].name; /* Iterate over the link messages to delete the right one */ - if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G_compact_remove_common_cb, &udata, TRUE) < 0) + if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G__compact_remove_common_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link message") done: @@ -441,7 +438,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 20 2005 * *------------------------------------------------------------------------- @@ -487,7 +483,6 @@ done: * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 20 2005 * *------------------------------------------------------------------------- @@ -533,7 +528,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 6 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Gdense.c b/src/H5Gdense.c index a2ef55c..8545d73 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -15,7 +15,7 @@ * * Created: H5Gdense.c * Sep 9 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Routines for operating on "dense" link storage for a * group in a file. @@ -250,7 +250,6 @@ typedef struct { * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 9 2006 * *------------------------------------------------------------------------- @@ -294,17 +293,11 @@ H5G__dense_create(H5F_t *f, H5O_linfo_t *linfo, const H5O_pline_t *pline) /* Retrieve the heap's address in the file */ if(H5HF_get_heap_addr(fheap, &(linfo->fheap_addr)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get fractal heap address") -#ifdef QAK -HDfprintf(stderr, "%s: linfo->fheap_addr = %a\n", FUNC, linfo->fheap_addr); -#endif /* QAK */ /* Retrieve the heap's ID length in the file */ if(H5HF_get_id_len(fheap, &fheap_id_len) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length") HDassert(fheap_id_len == H5G_DENSE_FHEAP_ID_LEN); -#ifdef QAK -HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); -#endif /* QAK */ /* Create the name index v2 B-tree */ HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam)); @@ -321,9 +314,6 @@ HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len); /* Retrieve the v2 B-tree's address in the file */ if(H5B2_get_addr(bt2_name, &(linfo->name_bt2_addr)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for name index") -#ifdef QAK -HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr); -#endif /* QAK */ /* Check if we should create a creation order index v2 B-tree */ if(linfo->index_corder) { @@ -342,9 +332,6 @@ HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr) /* Retrieve the v2 B-tree's address in the file */ if(H5B2_get_addr(bt2_corder, &(linfo->corder_bt2_addr)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for creation order index") -#ifdef QAK -HDfprintf(stderr, "%s: linfo->corder_bt2_addr = %a\n", FUNC, linfo->corder_bt2_addr); -#endif /* QAK */ } /* end if */ done: @@ -368,7 +355,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- @@ -394,17 +380,10 @@ H5G__dense_insert(H5F_t *f, const H5O_linfo_t *linfo, const H5O_link_t *lnk) HDassert(f); HDassert(linfo); HDassert(lnk); -#ifdef QAK -HDfprintf(stderr, "%s: linfo->fheap_addr = %a\n", FUNC, linfo->fheap_addr); -HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr); -#endif /* QAK */ /* Find out the size of buffer needed for serialized link */ if((link_size = H5O_msg_raw_size(f, H5O_LINK_ID, FALSE, lnk)) == 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size") -#ifdef QAK -HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDstrlen(lnk->name), link_size); -#endif /* QAK */ /* Wrap the local buffer for serialized link */ if(NULL == (wb = H5WB_wrap(link_buf, sizeof(link_buf)))) @@ -472,26 +451,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_lookup_cb + * Function: H5G__dense_lookup_cb * * Purpose: Callback when a link is located in an index * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_lookup_cb(const void *_lnk, void *_user_lnk) +H5G__dense_lookup_cb(const void *_lnk, void *_user_lnk) { const H5O_link_t *lnk = (const H5O_link_t *)_lnk; /* Record from B-tree */ H5O_link_t *user_lnk = (H5O_link_t *)_user_lnk; /* User data from v2 B-tree link lookup */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -505,7 +483,7 @@ H5G_dense_lookup_cb(const void *_lnk, void *_user_lnk) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_lookup_cb() */ +} /* end H5G__dense_lookup_cb() */ /*------------------------------------------------------------------------- @@ -516,7 +494,6 @@ done: * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- @@ -553,7 +530,7 @@ H5G__dense_lookup(H5F_t *f, const H5O_linfo_t *linfo, const char *name, udata.fheap = fheap; udata.name = name; udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0); - udata.found_op = H5G_dense_lookup_cb; /* v2 B-tree comparison callback */ + udata.found_op = H5G__dense_lookup_cb; /* v2 B-tree comparison callback */ udata.found_op_data = lnk; /* Find & copy the named link in the 'name' index */ @@ -572,7 +549,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_lookup_by_idx_fh_cb + * Function: H5G__dense_lookup_by_idx_fh_cb * * Purpose: Callback for fractal heap operator, to make copy of link when * when lookup up a link by index @@ -580,19 +557,18 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) +H5G__dense_lookup_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) { H5G_fh_ud_lbi_t *udata = (H5G_fh_ud_lbi_t *)_udata; /* User data for fractal heap 'op' callback */ H5O_link_t *tmp_lnk = NULL; /* Temporary pointer to link */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Decode link information & keep a copy */ if(NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) @@ -608,31 +584,30 @@ done: H5O_msg_free(H5O_LINK_ID, tmp_lnk); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_lookup_by_idx_fh_cb() */ +} /* end H5G__dense_lookup_by_idx_fh_cb() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_lookup_by_idx_bt2_cb + * Function: H5G__dense_lookup_by_idx_bt2_cb * * Purpose: v2 B-tree callback for dense link storage lookup by index * * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_lookup_by_idx_bt2_cb(const void *_record, void *_bt2_udata) +H5G__dense_lookup_by_idx_bt2_cb(const void *_record, void *_bt2_udata) { const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record; H5G_bt2_ud_lbi_t *bt2_udata = (H5G_bt2_ud_lbi_t *)_bt2_udata; /* User data for callback */ H5G_fh_ud_lbi_t fh_udata; /* User data for fractal heap 'op' callback */ int ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Prepare user data for callback */ /* down */ @@ -640,12 +615,12 @@ H5G_dense_lookup_by_idx_bt2_cb(const void *_record, void *_bt2_udata) fh_udata.lnk = bt2_udata->lnk; /* Call fractal heap 'op' routine, to copy the link information */ - if(H5HF_op(bt2_udata->fheap, record->id, H5G_dense_lookup_by_idx_fh_cb, &fh_udata) < 0) + if(H5HF_op(bt2_udata->fheap, record->id, H5G__dense_lookup_by_idx_fh_cb, &fh_udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, H5_ITER_ERROR, "link found callback failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_lookup_by_idx_bt2_cb() */ +} /* end H5G__dense_lookup_by_idx_bt2_cb() */ /*------------------------------------------------------------------------- @@ -657,7 +632,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2006 * *------------------------------------------------------------------------- @@ -727,7 +701,7 @@ H5G__dense_lookup_by_idx(H5F_t *f, const H5O_linfo_t *linfo, udata.lnk = lnk; /* Find & copy the link in the appropriate index */ - if(H5B2_index(bt2, order, n, H5G_dense_lookup_by_idx_bt2_cb, &udata) < 0) + if(H5B2_index(bt2, order, n, H5G__dense_lookup_by_idx_bt2_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to locate link in index") } /* end if */ else { /* Otherwise, we need to build a table of the links and sort it */ @@ -758,7 +732,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_build_table_cb + * Function: H5G__dense_build_table_cb * * Purpose: Callback routine for building table of links from dense * link storage. @@ -767,18 +741,17 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sept 25 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_build_table_cb(const H5O_link_t *lnk, void *_udata) +H5G__dense_build_table_cb(const H5O_link_t *lnk, void *_udata) { H5G_dense_bt_ud_t *udata = (H5G_dense_bt_ud_t *)_udata; /* 'User data' passed in */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(lnk); @@ -794,7 +767,7 @@ H5G_dense_build_table_cb(const H5O_link_t *lnk, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_build_table_cb() */ +} /* end H5G__dense_build_table_cb() */ /*------------------------------------------------------------------------- @@ -843,7 +816,7 @@ H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, udata.curr_lnk = 0; /* Iterate over the links in the group, building a table of the link messages */ - if(H5G__dense_iterate(f, linfo, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G_dense_build_table_cb, &udata) < 0) + if(H5G__dense_iterate(f, linfo, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G__dense_build_table_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links") /* Sort link table in correct iteration order */ @@ -859,7 +832,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_iterate_fh_cb + * Function: H5G__dense_iterate_fh_cb * * Purpose: Callback for fractal heap operator, to make user's callback * when iterating over links @@ -867,18 +840,17 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_iterate_fh_cb(const void *obj, size_t obj_len, void *_udata) +H5G__dense_iterate_fh_cb(const void *obj, size_t obj_len, void *_udata) { H5G_fh_ud_it_t *udata = (H5G_fh_ud_it_t *)_udata; /* User data for fractal heap 'op' callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Decode link information & keep a copy */ /* (we make a copy instead of calling the user/library callback directly in @@ -892,30 +864,29 @@ H5G_dense_iterate_fh_cb(const void *obj, size_t obj_len, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_iterate_fh_cb() */ +} /* end H5G__dense_iterate_fh_cb() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_iterate_bt2_cb + * Function: H5G__dense_iterate_bt2_cb * * Purpose: v2 B-tree callback for dense link storage iterator * * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) +H5G__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) { const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record; H5G_bt2_ud_it_t *bt2_udata = (H5G_bt2_ud_it_t *)_bt2_udata; /* User data for callback */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check for skipping links */ if(bt2_udata->skip > 0) @@ -928,7 +899,7 @@ H5G_dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) fh_udata.f = bt2_udata->f; /* Call fractal heap 'op' routine, to copy the link information */ - if(H5HF_op(bt2_udata->fheap, record->id, H5G_dense_iterate_fh_cb, &fh_udata) < 0) + if(H5HF_op(bt2_udata->fheap, record->id, H5G__dense_iterate_fh_cb, &fh_udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, H5_ITER_ERROR, "heap op callback failed") /* Make the callback */ @@ -948,7 +919,7 @@ H5G_dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_iterate_bt2_cb() */ +} /* end H5G__dense_iterate_bt2_cb() */ /*------------------------------------------------------------------------- @@ -959,14 +930,14 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ herr_t H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, - H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data) + H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, + void *op_data) { H5HF_t *fheap = NULL; /* Fractal heap handle */ H5G_link_table_t ltable = {0, NULL}; /* Table of links */ @@ -1036,7 +1007,7 @@ H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, /* Iterate over the records in the v2 B-tree's "native" order */ /* (by hash of name) */ - if((ret_value = H5B2_iterate(bt2, H5G_dense_iterate_bt2_cb, &udata)) < 0) + if((ret_value = H5B2_iterate(bt2, H5G__dense_iterate_bt2_cb, &udata)) < 0) HERROR(H5E_SYM, H5E_BADITER, "link iteration failed"); /* Update the last link examined, if requested */ @@ -1067,7 +1038,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_get_name_by_idx_fh_cb + * Function: H5G__dense_get_name_by_idx_fh_cb * * Purpose: Callback for fractal heap operator, to retrieve name according * to an index @@ -1075,19 +1046,18 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 19 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) +H5G__dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) { H5G_fh_ud_gnbi_t *udata = (H5G_fh_ud_gnbi_t *)_udata; /* User data for fractal heap 'op' callback */ H5O_link_t *lnk; /* Pointer to link created from heap object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Decode link information */ if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) @@ -1108,31 +1078,30 @@ H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_get_name_by_idx_fh_cb() */ +} /* end H5G__dense_get_name_by_idx_fh_cb() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_get_name_by_idx_bt2_cb + * Function: H5G__dense_get_name_by_idx_bt2_cb * * Purpose: v2 B-tree callback for dense link storage 'get name by idx' call * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 19 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_get_name_by_idx_bt2_cb(const void *_record, void *_bt2_udata) +H5G__dense_get_name_by_idx_bt2_cb(const void *_record, void *_bt2_udata) { const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record; H5G_bt2_ud_gnbi_t *bt2_udata = (H5G_bt2_ud_gnbi_t *)_bt2_udata; /* User data for callback */ H5G_fh_ud_gnbi_t fh_udata; /* User data for fractal heap 'op' callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Prepare user data for callback */ /* down */ @@ -1141,7 +1110,7 @@ H5G_dense_get_name_by_idx_bt2_cb(const void *_record, void *_bt2_udata) fh_udata.name_size = bt2_udata->name_size; /* Call fractal heap 'op' routine, to perform user callback */ - if(H5HF_op(bt2_udata->fheap, record->id, H5G_dense_get_name_by_idx_fh_cb, &fh_udata) < 0) + if(H5HF_op(bt2_udata->fheap, record->id, H5G__dense_get_name_by_idx_fh_cb, &fh_udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link found callback failed") /* Set the name's full length to return */ @@ -1149,7 +1118,7 @@ H5G_dense_get_name_by_idx_bt2_cb(const void *_record, void *_bt2_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_get_name_by_idx_bt2_cb() */ +} /* end H5G__dense_get_name_by_idx_bt2_cb() */ /*------------------------------------------------------------------------- @@ -1161,7 +1130,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 19 2006 * *------------------------------------------------------------------------- @@ -1231,7 +1199,7 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, udata.name_size = size; /* Retrieve the name according to the v2 B-tree's index order */ - if(H5B2_index(bt2, order, n, H5G_dense_get_name_by_idx_bt2_cb, &udata) < 0) + if(H5B2_index(bt2, order, n, H5G__dense_get_name_by_idx_bt2_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLIST, FAIL, "can't locate object in v2 B-tree") /* Set return value */ @@ -1271,27 +1239,26 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_remove_fh_cb + * Function: H5G__dense_remove_fh_cb * * Purpose: Callback for fractal heap operator when removing links * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 12 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_remove_fh_cb(const void *obj, size_t obj_len, void *_udata) +H5G__dense_remove_fh_cb(const void *obj, size_t obj_len, void *_udata) { H5G_fh_ud_rm_t *udata = (H5G_fh_ud_rm_t *)_udata; /* User data for fractal heap 'op' callback */ H5O_link_t *lnk = NULL; /* Pointer to link created from heap object */ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Decode link information */ if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) @@ -1332,31 +1299,30 @@ done: H5O_msg_free(H5O_LINK_ID, lnk); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_remove_fh_cb() */ +} /* end H5G__dense_remove_fh_cb() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_remove_bt2_cb + * Function: H5G__dense_remove_bt2_cb * * Purpose: v2 B-tree callback for dense link storage record removal * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 12 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_remove_bt2_cb(const void *_record, void *_bt2_udata) +H5G__dense_remove_bt2_cb(const void *_record, void *_bt2_udata) { const H5G_dense_bt2_name_rec_t *record = (const H5G_dense_bt2_name_rec_t *)_record; H5G_bt2_ud_rm_t *bt2_udata = (H5G_bt2_ud_rm_t *)_bt2_udata; /* User data for callback */ H5G_fh_ud_rm_t fh_udata; /* User data for fractal heap 'op' callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Set up the user data for fractal heap 'op' callback */ fh_udata.f = bt2_udata->common.f; @@ -1365,7 +1331,7 @@ H5G_dense_remove_bt2_cb(const void *_record, void *_bt2_udata) fh_udata.replace_names = bt2_udata->replace_names; /* Call fractal heap 'op' routine, to perform user callback */ - if(H5HF_op(bt2_udata->common.fheap, record->id, H5G_dense_remove_fh_cb, &fh_udata) < 0) + if(H5HF_op(bt2_udata->common.fheap, record->id, H5G__dense_remove_fh_cb, &fh_udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link removal callback failed") /* Remove record from fractal heap, if requested */ @@ -1375,7 +1341,7 @@ H5G_dense_remove_bt2_cb(const void *_record, void *_bt2_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_remove_bt2_cb() */ +} /* end H5G__dense_remove_bt2_cb() */ /*------------------------------------------------------------------------- @@ -1386,7 +1352,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 12 2006 * *------------------------------------------------------------------------- @@ -1430,7 +1395,7 @@ H5G__dense_remove(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_ udata.replace_names = TRUE; /* Remove the record from the name index v2 B-tree */ - if(H5B2_remove(bt2, &udata, H5G_dense_remove_bt2_cb, &udata) < 0) + if(H5B2_remove(bt2, &udata, H5G__dense_remove_bt2_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from name index v2 B-tree") done: @@ -1445,25 +1410,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_dense_remove_by_idx_fh_cb + * Function: H5G__dense_remove_by_idx_fh_cb * * Purpose: Callback for fractal heap operator when removing links by index * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 15 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) +H5G__dense_remove_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) { H5G_fh_ud_rmbi_t *udata = (H5G_fh_ud_rmbi_t *)_udata; /* User data for fractal heap 'op' callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Decode link information */ if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) @@ -1473,24 +1437,23 @@ H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_remove_by_idx_fh_cb() */ +} /* end H5G__dense_remove_by_idx_fh_cb() */ /*------------------------------------------------------------------------- - * Function: H5G_dense_remove_by_idx_bt2_cb + * Function: H5G__dense_remove_by_idx_bt2_cb * * Purpose: v2 B-tree callback for dense link storage record removal by index * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 15 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) +H5G__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) { H5G_bt2_ud_rmbi_t *bt2_udata = (H5G_bt2_ud_rmbi_t *)_bt2_udata; /* User data for callback */ H5G_fh_ud_rmbi_t fh_udata; /* User data for fractal heap 'op' callback */ @@ -1498,7 +1461,7 @@ H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) const uint8_t *heap_id; /* Heap ID for link */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Determine the index being used */ if(bt2_udata->idx_type == H5_INDEX_NAME) { @@ -1521,7 +1484,7 @@ H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) fh_udata.lnk = NULL; /* Call fractal heap 'op' routine, to perform user callback */ - if(H5HF_op(bt2_udata->fheap, heap_id, H5G_dense_remove_by_idx_fh_cb, &fh_udata) < 0) + if(H5HF_op(bt2_udata->fheap, heap_id, H5G__dense_remove_by_idx_fh_cb, &fh_udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link removal callback failed") HDassert(fh_udata.lnk); @@ -1579,7 +1542,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for 'other' index") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_dense_remove_by_idx_bt2_cb() */ +} /* end H5G__dense_remove_by_idx_bt2_cb() */ /*------------------------------------------------------------------------- @@ -1591,7 +1554,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 14 2006 * *------------------------------------------------------------------------- @@ -1662,7 +1624,7 @@ H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_ful udata.grp_full_path_r = grp_full_path_r; /* Remove the record from the name index v2 B-tree */ - if(H5B2_remove_by_idx(bt2, order, n, H5G_dense_remove_by_idx_bt2_cb, &udata) < 0) + if(H5B2_remove_by_idx(bt2, order, n, H5G__dense_remove_by_idx_bt2_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from indexed v2 B-tree") } /* end if */ else { /* Otherwise, we need to build a table of the links and sort it */ @@ -1700,7 +1662,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 12 2006 * *------------------------------------------------------------------------- @@ -1743,7 +1704,7 @@ H5G__dense_delete(H5F_t *f, H5O_linfo_t *linfo, hbool_t adj_link) udata.replace_names = FALSE; /* Delete the name index, adjusting the ref. count on links removed */ - if(H5B2_delete(f, linfo->name_bt2_addr, NULL, H5G_dense_remove_bt2_cb, &udata) < 0) + if(H5B2_delete(f, linfo->name_bt2_addr, NULL, H5G__dense_remove_bt2_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index") /* Close the fractal heap */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 126456b..1d85eb7 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -15,7 +15,7 @@ * * Created: H5Gdeprec.c * June 21 2006 - * James Laird + * James Laird * * Purpose: Deprecated functions from the H5G interface. These * functions are here for compatibility purposes and may be @@ -986,7 +986,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c H5G_trav_goi_t *udata = (H5G_trav_goi_t *)_udata; /* User data passed in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC; + FUNC_ENTER_STATIC /* Check if the name in this group resolved to a valid link */ if(lnk == NULL && obj_loc == NULL) @@ -1082,7 +1082,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, HDassert(name && *name); /* Reset stat buffer */ - if (statbuf) + if(statbuf) HDmemset(statbuf, 0, sizeof(H5G_stat_t)); /* Set up user data for retrieving information */ @@ -1091,11 +1091,11 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, udata.loc_file = loc->oloc->file; /* Traverse the group hierarchy to locate the object to get info about */ - if (H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : (H5G_TARGET_SLINK | H5G_TARGET_UDLINK)), H5G__get_objinfo_cb, &udata) < 0) + if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : (H5G_TARGET_SLINK | H5G_TARGET_UDLINK)), H5G__get_objinfo_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist"); /* If we're pointing at a soft or UD link, get the real link length and type */ - if (statbuf && follow_link == 0) { + if(statbuf && follow_link == 0) { H5L_info2_t linfo; /* Link information buffer */ herr_t ret; diff --git a/src/H5Gent.c b/src/H5Gent.c index 19aef10..632ffa0 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 19, 1997 */ @@ -86,7 +86,6 @@ H5FL_BLK_EXTERN(str_buf); * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- @@ -128,7 +127,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- @@ -194,7 +192,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- @@ -234,7 +231,6 @@ done: * Failure: Negative * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 18 1997 * *------------------------------------------------------------------------- @@ -306,7 +302,6 @@ done: * Failure: Negative * * Programmer: Pedro Vicente - * pvn@ncsa.uiuc.edu * ???day, August ??, 2002 * * Notes: 'depth' parameter determines how much of the group entry @@ -385,7 +380,6 @@ H5G__ent_reset(H5G_entry_t *ent) * Failure: Negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 20 2005 * *------------------------------------------------------------------------- @@ -530,7 +524,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 29 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Gint.c b/src/H5Gint.c index 0f9f9cb..c3c8719 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -15,7 +15,7 @@ * * Created: H5Gint.c * April 5 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: General use, "internal" routines for groups. * @@ -88,6 +88,7 @@ typedef struct { /********************/ static herr_t H5G__open_oid(H5G_t *grp); +static herr_t H5G__visit_cb(const H5O_link_t *lnk, void *_udata); /*********************/ @@ -179,7 +180,6 @@ done: * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 11 1997 * *------------------------------------------------------------------------- @@ -719,7 +719,7 @@ H5G_unmount(H5G_t *grp) /*------------------------------------------------------------------------- - * Function: H5G_iterate_cb + * Function: H5G__iterate_cb * * Purpose: Callback function for iterating over links in a group * @@ -732,12 +732,12 @@ H5G_unmount(H5G_t *grp) *------------------------------------------------------------------------- */ static herr_t -H5G_iterate_cb(const H5O_link_t *lnk, void *_udata) +H5G__iterate_cb(const H5O_link_t *lnk, void *_udata) { H5G_iter_appcall_ud_t *udata = (H5G_iter_appcall_ud_t *)_udata; /* User data for callback */ herr_t ret_value = H5_ITER_ERROR; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(lnk); @@ -770,7 +770,7 @@ H5G_iterate_cb(const H5O_link_t *lnk, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_iterate_cb() */ +} /* end H5G__iterate_cb() */ /*------------------------------------------------------------------------- @@ -818,7 +818,7 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, udata.op_data = op_data; /* Call the real group iteration routine */ - if((ret_value = H5G__obj_iterate(&(grp->oloc), idx_type, order, skip, last_lnk, H5G_iterate_cb, &udata)) < 0) + if((ret_value = H5G__obj_iterate(&(grp->oloc), idx_type, order, skip, last_lnk, H5G__iterate_cb, &udata)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "error iterating over links") done: @@ -835,7 +835,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_free_visit_visited + * Function: H5G__free_visit_visited * * Purpose: Free the key for an object visited during a group traversal * @@ -847,18 +847,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *operator_data/*in,out*/) +H5G__free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *operator_data/*in,out*/) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR item = H5FL_FREE(H5_obj_t, item); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_free_visit_visited() */ +} /* end H5G__free_visit_visited() */ /*------------------------------------------------------------------------- - * Function: H5G_visit_cb + * Function: H5G__visit_cb * * Purpose: Callback function for recursively visiting links from a group * @@ -871,7 +871,7 @@ H5G_free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *------------------------------------------------------------------------- */ static herr_t -H5G_visit_cb(const H5O_link_t *lnk, void *_udata) +H5G__visit_cb(const H5O_link_t *lnk, void *_udata) { H5G_iter_visit_ud_t *udata = (H5G_iter_visit_ud_t *)_udata; /* User data for callback */ H5L_info2_t info; /* Link info */ @@ -884,7 +884,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata) size_t len_needed; /* Length of path string needed */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(lnk); @@ -998,7 +998,7 @@ H5G_visit_cb(const H5O_link_t *lnk, void *_udata) udata->curr_loc = &obj_loc; /* Iterate over links in group */ - ret_value = H5G__obj_iterate(&obj_oloc, idx_type, udata->order, (hsize_t)0, NULL, H5G_visit_cb, udata); + ret_value = H5G__obj_iterate(&obj_oloc, idx_type, udata->order, (hsize_t)0, NULL, H5G__visit_cb, udata); /* Restore location */ udata->curr_loc = old_loc; @@ -1016,7 +1016,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_visit_cb() */ +} /* end H5G__visit_cb() */ /*------------------------------------------------------------------------- @@ -1140,14 +1140,14 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, } /* end if */ /* Call the link iteration routine */ - if((ret_value = H5G__obj_iterate(&(grp->oloc), idx_type, order, (hsize_t)0, NULL, H5G_visit_cb, &udata)) < 0) + if((ret_value = H5G__obj_iterate(&(grp->oloc), idx_type, order, (hsize_t)0, NULL, H5G__visit_cb, &udata)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't visit links") done: /* Release user data resources */ H5MM_xfree(udata.path); if(udata.visited) - H5SL_destroy(udata.visited, H5G_free_visit_visited, NULL); + H5SL_destroy(udata.visited, H5G__free_visit_visited, NULL); /* Release the group opened */ if(gid != H5I_INVALID_HID) { diff --git a/src/H5Glink.c b/src/H5Glink.c index cbe5307..8b8377a 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -63,10 +63,10 @@ /* Local Prototypes */ /********************/ -static int H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2); -static int H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2); -static int H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2); -static int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2); +static int H5G__link_cmp_name_inc(const void *lnk1, const void *lnk2); +static int H5G__link_cmp_name_dec(const void *lnk1, const void *lnk2); +static int H5G__link_cmp_corder_inc(const void *lnk1, const void *lnk2); +static int H5G__link_cmp_corder_dec(const void *lnk1, const void *lnk2); /*********************/ @@ -86,7 +86,7 @@ static int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2); /*------------------------------------------------------------------------- - * Function: H5G_link_cmp_name_inc + * Function: H5G__link_cmp_name_inc * * Purpose: Callback routine for comparing two link names, in * increasing alphabetic order @@ -103,16 +103,16 @@ static int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2); *------------------------------------------------------------------------- */ static int -H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2) +H5G__link_cmp_name_inc(const void *lnk1, const void *lnk2) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk1)->name, ((const H5O_link_t *)lnk2)->name)) -} /* end H5G_link_cmp_name_inc() */ +} /* end H5G__link_cmp_name_inc() */ /*------------------------------------------------------------------------- - * Function: H5G_link_cmp_name_dec + * Function: H5G__link_cmp_name_dec * * Purpose: Callback routine for comparing two link names, in * decreasing alphabetic order @@ -129,16 +129,16 @@ H5G_link_cmp_name_inc(const void *lnk1, const void *lnk2) *------------------------------------------------------------------------- */ static int -H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2) +H5G__link_cmp_name_dec(const void *lnk1, const void *lnk2) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk2)->name, ((const H5O_link_t *)lnk1)->name)) -} /* end H5G_link_cmp_name_dec() */ +} /* end H5G__link_cmp_name_dec() */ /*------------------------------------------------------------------------- - * Function: H5G_link_cmp_corder_inc + * Function: H5G__link_cmp_corder_inc * * Purpose: Callback routine for comparing two link creation orders, in * increasing order @@ -154,11 +154,11 @@ H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2) *------------------------------------------------------------------------- */ static int -H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2) +H5G__link_cmp_corder_inc(const void *lnk1, const void *lnk2) { int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(((const H5O_link_t *)lnk1)->corder < ((const H5O_link_t *)lnk2)->corder) ret_value = -1; @@ -168,11 +168,11 @@ H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2) ret_value = 0; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_link_cmp_corder_inc() */ +} /* end H5G__link_cmp_corder_inc() */ /*------------------------------------------------------------------------- - * Function: H5G_link_cmp_corder_dec + * Function: H5G__link_cmp_corder_dec * * Purpose: Callback routine for comparing two link creation orders, in * decreasing order @@ -188,11 +188,11 @@ H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2) *------------------------------------------------------------------------- */ static int -H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2) +H5G__link_cmp_corder_dec(const void *lnk1, const void *lnk2) { int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(((const H5O_link_t *)lnk1)->corder < ((const H5O_link_t *)lnk2)->corder) ret_value = 1; @@ -202,7 +202,7 @@ H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2) ret_value = 0; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_link_cmp_corder_dec() */ +} /* end H5G__link_cmp_corder_dec() */ /*------------------------------------------------------------------------- @@ -434,18 +434,18 @@ H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, /* Pick appropriate sorting routine */ if(idx_type == H5_INDEX_NAME) { if(order == H5_ITER_INC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_link_cmp_name_inc); + HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_name_inc); else if(order == H5_ITER_DEC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_link_cmp_name_dec); + HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_name_dec); else HDassert(order == H5_ITER_NATIVE); } /* end if */ else { HDassert(idx_type == H5_INDEX_CRT_ORDER); if(order == H5_ITER_INC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_link_cmp_corder_inc); + HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_corder_inc); else if(order == H5_ITER_DEC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G_link_cmp_corder_dec); + HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_corder_dec); else HDassert(order == H5_ITER_NATIVE); } /* end else */ diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 2461c51..3109b49 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -621,7 +621,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_loc_exists_cb + * Function: H5G__loc_exists_cb * * Purpose: Callback for checking if an object exists * @@ -633,13 +633,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, +H5G__loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) { H5G_loc_exists_t *udata = (H5G_loc_exists_t *)_udata; /* User data passed in */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check if the name in this group resolved to a valid object */ if(obj_loc == NULL) @@ -655,7 +655,7 @@ H5G_loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UN *own_loc = H5G_OWN_NONE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_loc_exists_cb() */ +} /* end H5G__loc_exists_cb() */ /*------------------------------------------------------------------------- @@ -687,7 +687,7 @@ H5G_loc_exists(const H5G_loc_t *loc, const char *name) udata.exists = FALSE; /* Traverse group hierarchy to locate object */ - if(H5G_traverse(loc, name, H5G_TARGET_EXISTS, H5G_loc_exists_cb, &udata) < 0) + if(H5G_traverse(loc, name, H5G_TARGET_EXISTS, H5G__loc_exists_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't check if object exists") /* Set return value */ diff --git a/src/H5Gmodule.h b/src/H5Gmodule.h index 19ea982..883aa6d 100644 --- a/src/H5Gmodule.h +++ b/src/H5Gmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Gname.c b/src/H5Gname.c index e1004de..95b85b4 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -81,14 +81,14 @@ typedef struct H5G_gnba_iter_t { /* Local Prototypes */ /********************/ -static htri_t H5G_common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r); -static H5RS_str_t *H5G_build_fullpath(const char *prefix, const char *name); +static htri_t H5G__common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r); +static H5RS_str_t *H5G__build_fullpath(const char *prefix, const char *name); #ifdef NOT_YET -static H5RS_str_t *H5G_build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *name_r); +static H5RS_str_t *H5G__build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *name_r); #endif /* NOT_YET */ -static herr_t H5G_name_move_path(H5RS_str_t **path_r_ptr, +static herr_t H5G__name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char *src_path, const char *dst_path); -static int H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key); +static int H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key); /*********************/ @@ -208,7 +208,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_common_path + * Function: H5G__common_path * * Purpose: Determine if one path is a valid prefix of another path * @@ -222,14 +222,14 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5G_common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r) +H5G__common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r) { const char *fullpath; /* Pointer to actual fullpath string */ const char *prefix; /* Pointer to actual prefix string */ size_t nchars1,nchars2; /* Number of characters in components */ htri_t ret_value=FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Get component of each name */ fullpath=H5RS_get_str(fullpath_r); @@ -270,11 +270,11 @@ H5G_common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_common_path() */ +} /* end H5G__common_path() */ /*------------------------------------------------------------------------- - * Function: H5G_build_fullpath + * Function: H5G__build_fullpath * * Purpose: Build a full path from a prefix & base pair of strings * @@ -287,7 +287,7 @@ done: *------------------------------------------------------------------------- */ static H5RS_str_t * -H5G_build_fullpath(const char *prefix, const char *name) +H5G__build_fullpath(const char *prefix, const char *name) { char *full_path; /* Full user path built */ size_t orig_path_len; /* Original length of the path */ @@ -296,7 +296,7 @@ H5G_build_fullpath(const char *prefix, const char *name) unsigned need_sep; /* Flag to indicate if separator is needed */ H5RS_str_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(prefix); @@ -331,7 +331,7 @@ H5G_build_fullpath(const char *prefix, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_build_fullpath() */ +} /* end H5G__build_fullpath() */ /*------------------------------------------------------------------------- @@ -363,7 +363,7 @@ H5G_build_fullpath_refstr_str(H5RS_str_t *prefix_r, const char *name) HDassert(prefix); /* Create reference counted string for path */ - ret_value = H5G_build_fullpath(prefix, name); + ret_value = H5G__build_fullpath(prefix, name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_build_fullpath_refstr_str() */ @@ -385,13 +385,13 @@ H5G_build_fullpath_refstr_str(H5RS_str_t *prefix_r, const char *name) *------------------------------------------------------------------------- */ static H5RS_str_t * -H5G_build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *name_r) +H5G__build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *name_r) { const char *prefix; /* Pointer to raw string of prefix */ const char *name; /* Pointer to raw string of name */ H5RS_str_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Get the pointer to the prefix */ prefix = H5RS_get_str(prefix_r); @@ -400,10 +400,10 @@ H5G_build_fullpath_refstr_refstr(const H5RS_str_t *prefix_r, const H5RS_str_t *n name = H5RS_get_str(name_r); /* Create reference counted string for path */ - ret_value = H5G_build_fullpath(prefix, name); + ret_value = H5G__build_fullpath(prefix, name); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_build_fullpath_refstr_refstr() */ +} /* end H5G__build_fullpath_refstr_refstr() */ #endif /* NOT_YET */ @@ -663,7 +663,7 @@ H5G_name_free(H5G_name_t *name) /*------------------------------------------------------------------------- - * Function: H5G_name_move_path + * Function: H5G__name_move_path * * Purpose: Update a user or canonical path after an object moves * @@ -676,7 +676,7 @@ H5G_name_free(H5G_name_t *name) *------------------------------------------------------------------------- */ static herr_t -H5G_name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char *src_path, +H5G__name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char *src_path, const char *dst_path) { const char *path; /* Path to update */ @@ -684,7 +684,7 @@ H5G_name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char size_t full_suffix_len; /* Length of full suffix */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(path_r_ptr && *path_r_ptr); @@ -762,11 +762,11 @@ H5G_name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_name_move_path() */ +} /* end H5G__name_move_path() */ /*------------------------------------------------------------------------- - * Function: H5G_name_replace_cb + * Function: H5G__name_replace_cb * * Purpose: H5I_iterate callback function to replace group entry names * @@ -779,7 +779,7 @@ done: *------------------------------------------------------------------------- */ static int -H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) +H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) { const H5G_names_t *names = (const H5G_names_t *)key; /* Get operation's information */ H5O_loc_t *oloc; /* Object location for object that the ID refers to */ @@ -788,7 +788,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) hbool_t obj_in_child = FALSE; /* Flag to indicate that the object is in the child mount hier. */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(obj_ptr); @@ -907,7 +907,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) else { /* Check if the source is along the entry's path */ /* (But not actually the entry itself) */ - if(H5G_common_path(obj_path->full_path_r, names->src_full_path_r) && + if(H5G__common_path(obj_path->full_path_r, names->src_full_path_r) && H5RS_cmp(obj_path->full_path_r, names->src_full_path_r)) { /* Hide the user path */ (obj_path->obj_hidden)++; @@ -957,7 +957,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) } /* end if */ else { /* Check if file being unmounted was hiding the object */ - if(H5G_common_path(obj_path->full_path_r, names->src_full_path_r) && + if(H5G__common_path(obj_path->full_path_r, names->src_full_path_r) && H5RS_cmp(obj_path->full_path_r, names->src_full_path_r)) { /* Un-hide the user path */ (obj_path->obj_hidden)--; @@ -971,7 +971,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) */ case H5G_NAME_DELETE: /* Check if the location being unlinked is in the path for the current object */ - if(H5G_common_path(obj_path->full_path_r, names->src_full_path_r)) { + if(H5G__common_path(obj_path->full_path_r, names->src_full_path_r)) { /* Free paths for object */ H5G_name_free(obj_path); } /* end if */ @@ -983,7 +983,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) */ case H5G_NAME_MOVE: /* Link move case, check for relative names case */ /* Check if the src object moved is in the current object's path */ - if(H5G_common_path(obj_path->full_path_r, names->src_full_path_r)) { + if(H5G__common_path(obj_path->full_path_r, names->src_full_path_r)) { const char *full_path; /* Full path of current object */ const char *full_suffix; /* Suffix of full path, after src_path */ size_t full_suffix_len; /* Length of suffix of full path after src_path*/ @@ -1012,7 +1012,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) /* Update the user path, if one exists */ if(obj_path->user_path_r) - if(H5G_name_move_path(&(obj_path->user_path_r), full_suffix, src_path, dst_path) < 0) + if(H5G__name_move_path(&(obj_path->user_path_r), full_suffix, src_path, dst_path) < 0) HGOTO_ERROR(H5E_SYM, H5E_PATH, FAIL, "can't build user path name") /* Build new full path */ @@ -1040,7 +1040,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) done: FUNC_LEAVE_NOAPI(ret_value); -} /* end H5G_name_replace_cb() */ +} /* end H5G__name_replace_cb() */ /*------------------------------------------------------------------------- @@ -1166,17 +1166,17 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, /* Search through group IDs */ if(search_group) - if(H5I_iterate(H5I_GROUP, H5G_name_replace_cb, &names, FALSE) < 0) + if(H5I_iterate(H5I_GROUP, H5G__name_replace_cb, &names, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over groups") /* Search through dataset IDs */ if(search_dataset) - if(H5I_iterate(H5I_DATASET, H5G_name_replace_cb, &names, FALSE) < 0) + if(H5I_iterate(H5I_DATASET, H5G__name_replace_cb, &names, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datasets") /* Search through datatype IDs */ if(search_datatype) - if(H5I_iterate(H5I_DATATYPE, H5G_name_replace_cb, &names, FALSE) < 0) + if(H5I_iterate(H5I_DATATYPE, H5G__name_replace_cb, &names, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datatypes") } /* end if */ } /* end if */ @@ -1187,7 +1187,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_get_name_by_addr_cb + * Function: H5G__get_name_by_addr_cb * * Purpose: Callback for retrieving object's name by address * @@ -1201,7 +1201,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, +H5G__get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, void *_udata) { H5G_gnba_iter_t *udata = (H5G_gnba_iter_t *)_udata; /* User data for iteration */ @@ -1211,7 +1211,7 @@ H5G_get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, hbool_t obj_found = FALSE; /* Object at 'path' found */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(path); @@ -1261,7 +1261,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_get_name_by_addr_cb() */ +} /* end H5G__get_name_by_addr_cb() */ /*------------------------------------------------------------------------- @@ -1310,7 +1310,7 @@ H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size) udata.path = NULL; /* Visit all the links in the file */ - if((status = H5G_visit(&root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G_get_name_by_addr_cb, &udata)) < 0) + if((status = H5G_visit(&root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G__get_name_by_addr_cb, &udata)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, (-1), "group traversal failed while looking for object name") else if(status > 0) found_obj = TRUE; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 2e7b367..5578f83 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -75,21 +75,21 @@ typedef struct H5G_node_key_t { /********************/ /* B-tree callbacks */ -static H5UC_t *H5G_node_get_shared(const H5F_t *f, const void *_udata); +static H5UC_t *H5G__node_get_shared(const H5F_t *f, const void *_udata); static herr_t H5G__node_create(H5F_t *f, H5B_ins_t op, void *_lt_key, void *_udata, void *_rt_key, haddr_t *addr_p/*out*/); -static int H5G_node_cmp2(void *_lt_key, void *_udata, void *_rt_key); -static int H5G_node_cmp3(void *_lt_key, void *_udata, void *_rt_key); -static htri_t H5G_node_found(H5F_t *f, haddr_t addr, const void *_lt_key, +static int H5G__node_cmp2(void *_lt_key, void *_udata, void *_rt_key); +static int H5G__node_cmp3(void *_lt_key, void *_udata, void *_rt_key); +static htri_t H5G__node_found(H5F_t *f, haddr_t addr, const void *_lt_key, void *_udata); static H5B_ins_t H5G__node_insert(H5F_t *f, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, hbool_t *rt_key_changed, haddr_t *new_node_p/*out*/); -static H5B_ins_t H5G_node_remove(H5F_t *f, haddr_t addr, void *lt_key, +static H5B_ins_t H5G__node_remove(H5F_t *f, haddr_t addr, void *lt_key, hbool_t *lt_key_changed, void *udata, void *rt_key, hbool_t *rt_key_changed); -static herr_t H5G_node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key); -static herr_t H5G_node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key); -static herr_t H5G_node_debug_key(FILE *stream, int indent, int fwidth, +static herr_t H5G__node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key); +static herr_t H5G__node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key); +static herr_t H5G__node_debug_key(FILE *stream, int indent, int fwidth, const void *key, const void *udata); @@ -101,19 +101,19 @@ static herr_t H5G_node_debug_key(FILE *stream, int indent, int fwidth, H5B_class_t H5B_SNODE[1] = {{ H5B_SNODE_ID, /*id */ sizeof(H5G_node_key_t), /*sizeof_nkey */ - H5G_node_get_shared, /*get_shared */ + H5G__node_get_shared, /*get_shared */ H5G__node_create, /*new */ - H5G_node_cmp2, /*cmp2 */ - H5G_node_cmp3, /*cmp3 */ - H5G_node_found, /*found */ + H5G__node_cmp2, /*cmp2 */ + H5G__node_cmp3, /*cmp3 */ + H5G__node_found, /*found */ H5G__node_insert, /*insert */ TRUE, /*follow min branch? */ TRUE, /*follow max branch? */ H5B_RIGHT, /*critical key */ - H5G_node_remove, /*remove */ - H5G_node_decode_key, /*decode */ - H5G_node_encode_key, /*encode */ - H5G_node_debug_key /*debug */ + H5G__node_remove, /*remove */ + H5G__node_decode_key, /*decode */ + H5G__node_encode_key, /*encode */ + H5G__node_debug_key /*debug */ }}; /* Declare a free list to manage the H5G_node_t struct */ @@ -134,7 +134,7 @@ H5FL_SEQ_DEFINE(H5G_entry_t); /*------------------------------------------------------------------------- - * Function: H5G_node_get_shared + * Function: H5G__node_get_shared * * Purpose: Returns the shared B-tree info for the specified UDATA. * @@ -148,19 +148,19 @@ H5FL_SEQ_DEFINE(H5G_entry_t); *------------------------------------------------------------------------- */ static H5UC_t * -H5G_node_get_shared(const H5F_t *f, const void H5_ATTR_UNUSED *_udata) +H5G__node_get_shared(const H5F_t *f, const void H5_ATTR_UNUSED *_udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(f); /* Return the pointer to the ref-count object */ FUNC_LEAVE_NOAPI(H5F_GRP_BTREE_SHARED(f)) -} /* end H5G_node_get_shared() */ +} /* end H5G__node_get_shared() */ /*------------------------------------------------------------------------- - * Function: H5G_node_decode_key + * Function: H5G__node_decode_key * * Purpose: Decodes a raw key into a native key. * @@ -172,11 +172,11 @@ H5G_node_get_shared(const H5F_t *f, const void H5_ATTR_UNUSED *_udata) *------------------------------------------------------------------------- */ static herr_t -H5G_node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key) +H5G__node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key) { H5G_node_key_t *key = (H5G_node_key_t *) _key; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(shared); HDassert(raw); @@ -185,11 +185,11 @@ H5G_node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key) H5F_DECODE_LENGTH_LEN(raw, key->offset, shared->sizeof_len); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_node_decode_key() */ +} /* end H5G__node_decode_key() */ /*------------------------------------------------------------------------- - * Function: H5G_node_encode_key + * Function: H5G__node_encode_key * * Purpose: Encodes a native key into a raw key. * @@ -201,11 +201,11 @@ H5G_node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key) *------------------------------------------------------------------------- */ static herr_t -H5G_node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key) +H5G__node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key) { const H5G_node_key_t *key = (const H5G_node_key_t *) _key; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(shared); HDassert(raw); @@ -214,11 +214,11 @@ H5G_node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key) H5F_ENCODE_LENGTH_LEN(raw, key->offset, shared->sizeof_len); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_node_encode_key() */ +} /* end H5G__node_encode_key() */ /*------------------------------------------------------------------------- - * Function: H5G_node_debug_key + * Function: H5G__node_debug_key * * Purpose: Prints a key. * @@ -230,13 +230,13 @@ H5G_node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key) *------------------------------------------------------------------------- */ static herr_t -H5G_node_debug_key(FILE *stream, int indent, int fwidth, const void *_key, +H5G__node_debug_key(FILE *stream, 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; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(key); @@ -255,7 +255,7 @@ H5G_node_debug_key(FILE *stream, int indent, int fwidth, const void *_key, HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Cannot get name; heap address not specified\n"); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5G_node_debug_key() */ +} /* end H5G__node_debug_key() */ /*------------------------------------------------------------------------- @@ -361,7 +361,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_node_cmp2 + * Function: H5G__node_cmp2 * * Purpose: Compares two keys from a B-tree node (LT_KEY and RT_KEY). * The UDATA pointer supplies extra data not contained in the @@ -381,7 +381,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_node_cmp2(void *_lt_key, void *_udata, void *_rt_key) +H5G__node_cmp2(void *_lt_key, void *_udata, void *_rt_key) { H5G_bt_common_t *udata = (H5G_bt_common_t *) _udata; H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key; @@ -389,7 +389,7 @@ H5G_node_cmp2(void *_lt_key, void *_udata, void *_rt_key) const char *s1, *s2; int ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(udata && udata->heap); @@ -407,11 +407,11 @@ H5G_node_cmp2(void *_lt_key, void *_udata, void *_rt_key) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5G_node_cmp2() */ +} /* H5G__node_cmp2() */ /*------------------------------------------------------------------------- - * Function: H5G_node_cmp3 + * Function: H5G__node_cmp3 * * Purpose: Compares two keys from a B-tree node (LT_KEY and RT_KEY) * against another key (not necessarily the same type) @@ -435,7 +435,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_node_cmp3(void *_lt_key, void *_udata, void *_rt_key) +H5G__node_cmp3(void *_lt_key, void *_udata, void *_rt_key) { H5G_bt_common_t *udata = (H5G_bt_common_t *) _udata; H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key; @@ -443,7 +443,7 @@ H5G_node_cmp3(void *_lt_key, void *_udata, void *_rt_key) const char *s; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(udata && udata->heap); @@ -465,11 +465,11 @@ H5G_node_cmp3(void *_lt_key, void *_udata, void *_rt_key) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_cmp3() */ +} /* end H5G__node_cmp3() */ /*------------------------------------------------------------------------- - * Function: H5G_node_found + * Function: H5G__node_found * * Purpose: The B-tree search engine has found the symbol table node * which contains the requested symbol if the symbol exists. @@ -494,7 +494,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5G_node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, +H5G__node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, void *_udata) { H5G_bt_lkp_t *udata = (H5G_bt_lkp_t *)_udata; @@ -504,7 +504,7 @@ H5G_node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, const char *s; htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -548,7 +548,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_found() */ +} /* end H5G__node_found() */ /*------------------------------------------------------------------------- @@ -720,7 +720,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_node_remove + * Function: H5G__node_remove * * Purpose: The B-tree removal engine has found the symbol table node * which should contain the name which is being removed. This @@ -748,7 +748,7 @@ done: *------------------------------------------------------------------------- */ static H5B_ins_t -H5G_node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key/*in,out*/, +H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key/*in,out*/, hbool_t H5_ATTR_UNUSED *lt_key_changed/*out*/, void *_udata/*in,out*/, void *_rt_key/*in,out*/, hbool_t *rt_key_changed/*out*/) @@ -761,7 +761,7 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key/*in, int cmp = 1; H5B_ins_t ret_value = H5B_INS_ERROR; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ HDassert(f); @@ -926,7 +926,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release symbol table node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_remove() */ +} /* end H5G__node_remove() */ /*------------------------------------------------------------------------- diff --git a/src/H5Gobj.c b/src/H5Gobj.c index 1892182..c2d7fe6 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -15,7 +15,7 @@ * * Created: H5Gobj.c * Sep 5 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Functions for abstract handling of objects in groups. * @@ -85,7 +85,7 @@ typedef struct { /********************/ /* Local Prototypes */ /********************/ -static herr_t H5G_obj_compact_to_dense_cb(const void *_mesg, unsigned idx, +static herr_t H5G__obj_compact_to_dense_cb(const void *_mesg, unsigned idx, void *_udata); static herr_t H5G__obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *linfo); @@ -114,7 +114,6 @@ static herr_t H5G__obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *l * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 29 2005 * *------------------------------------------------------------------------- @@ -169,7 +168,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 29 2005 * *------------------------------------------------------------------------- @@ -304,7 +302,6 @@ done: * Failure: FAIL if error occurred * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 11 2007 * *------------------------------------------------------------------------- @@ -360,7 +357,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_obj_compact_to_dense_cb + * Function: H5G__obj_compact_to_dense_cb * * Purpose: Callback routine for converting "compact" to "dense" * link storage form. @@ -368,19 +365,18 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 30 2005 * *------------------------------------------------------------------------- */ static herr_t -H5G_obj_compact_to_dense_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) +H5G__obj_compact_to_dense_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */ H5G_obj_oh_it_ud1_t *udata = (H5G_obj_oh_it_ud1_t *)_udata; /* 'User data' passed in */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_TAG(udata->oh_addr) + FUNC_ENTER_STATIC_TAG(udata->oh_addr) /* check arguments */ HDassert(lnk); @@ -392,11 +388,11 @@ H5G_obj_compact_to_dense_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void done: FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5G_obj_compact_to_dense_cb() */ +} /* end H5G__obj_compact_to_dense_cb() */ /*------------------------------------------------------------------------- - * Function: H5G_obj_stab_to_new_cb + * Function: H5G__obj_stab_to_new_cb * * Purpose: Callback routine for converting "symbol table" link storage to * "new format" storage (either "compact" or "dense" storage). @@ -404,18 +400,17 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sept 16 2006 * *------------------------------------------------------------------------- */ static herr_t -H5G_obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata) +H5G__obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata) { H5G_obj_stab_it_ud1_t *udata = (H5G_obj_stab_it_ud1_t *)_udata; /* 'User data' passed in */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ HDassert(lnk); @@ -428,7 +423,7 @@ H5G_obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_obj_stab_to_new_cb() */ +} /* end H5G__obj_stab_to_new_cb() */ /*------------------------------------------------------------------------- @@ -443,7 +438,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 6 2005 * *------------------------------------------------------------------------- @@ -529,7 +523,7 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* Iterate over the 'link' messages, inserting them into the dense link storage */ op.op_type = H5O_MESG_OP_APP; - op.u.app_op = H5G_obj_compact_to_dense_cb; + op.u.app_op = H5G__obj_compact_to_dense_cb; if(H5O_msg_iterate(grp_oloc, H5O_LINK_ID, &op, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links") @@ -561,7 +555,7 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, udata.grp_oloc = grp_oloc; /* Iterate through all links in "old format" group and insert them into new format */ - if(H5G__stab_iterate(grp_oloc, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G_obj_stab_to_new_cb, &udata) < 0) + if(H5G__stab_iterate(grp_oloc, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G__obj_stab_to_new_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over old format links") /* Remove the symbol table message from the group */ @@ -710,7 +704,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 27 2006 * *------------------------------------------------------------------------- @@ -1102,7 +1095,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 26 2005 * *------------------------------------------------------------------------- @@ -1155,7 +1147,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 6 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 8ad03d0..9289ab5 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, September 18, 1997 * * Purpose: This file contains declarations which are visible diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 501c883..96e695d 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -15,7 +15,7 @@ * * Created: H5Gprivate.h * Jul 11 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Library-visible declarations. * diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 170b74d..3f74d45 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -15,7 +15,7 @@ * * Created: H5Gpublic.h * Jul 11 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Public declarations for the H5G package * diff --git a/src/H5Groot.c b/src/H5Groot.c index 36aa8f6..79b7075 100644 --- a/src/H5Groot.c +++ b/src/H5Groot.c @@ -15,7 +15,7 @@ * * Created: H5Groot.c * Apr 8 2009 - * Neil Fortner + * Neil Fortner * * Purpose: Functions for operating on the root group. * @@ -137,7 +137,6 @@ H5G_rootof(H5F_t *f) * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 11 1997 * *------------------------------------------------------------------------- @@ -370,7 +369,6 @@ H5G_root_free(H5G_t *grp) * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 5 2007 * *------------------------------------------------------------------------- diff --git a/src/H5Gstab.c b/src/H5Gstab.c index e8d38b9..1ca28ef 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Friday, September 19, 1997 * */ @@ -127,7 +127,6 @@ typedef struct H5G_bt_it_lbi_t { * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Nov 7 2005 * *------------------------------------------------------------------------- @@ -194,7 +193,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 1 1997 * *------------------------------------------------------------------------- @@ -249,7 +247,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@uiuc.edu * Nov 7 2005 * *------------------------------------------------------------------------- @@ -304,7 +301,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 1 1997 * *------------------------------------------------------------------------- @@ -683,7 +679,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_stab_get_name_by_idx_cb + * Function: H5G__stab_get_name_by_idx_cb * * Purpose: Callback for B-tree iteration 'by index' info query to * retrieve the name of a link @@ -697,14 +693,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) +H5G__stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) { H5G_bt_it_gnbi_t *udata = (H5G_bt_it_gnbi_t *)_udata; size_t name_off; /* Offset of name in heap */ const char *name; /* Pointer to name string in heap */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(ent); @@ -721,7 +717,7 @@ H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_get_name_by_idx_cb */ +} /* end H5G__stab_get_name_by_idx_cb */ /*------------------------------------------------------------------------- @@ -778,7 +774,7 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t /* Set iteration information */ udata.common.idx = n; udata.common.num_objs = 0; - udata.common.op = H5G_stab_get_name_by_idx_cb; + udata.common.op = H5G__stab_get_name_by_idx_cb; udata.heap = heap; udata.name = NULL; udata_valid = TRUE; @@ -815,7 +811,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_stab_lookup_cb + * Function: H5G__stab_lookup_cb * * Purpose: B-tree 'find' callback to retrieve location for an object * @@ -829,12 +825,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_stab_lookup_cb(const H5G_entry_t *ent, void *_udata) +H5G__stab_lookup_cb(const H5G_entry_t *ent, void *_udata) { H5G_stab_fnd_ud_t *udata = (H5G_stab_fnd_ud_t *)_udata; /* 'User data' passed in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check for setting link info */ if(udata->lnk) @@ -844,7 +840,7 @@ H5G_stab_lookup_cb(const H5G_entry_t *ent, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_lookup_cb() */ +} /* end H5G__stab_lookup_cb() */ /*------------------------------------------------------------------------- @@ -855,7 +851,6 @@ done: * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 20 2005 * *------------------------------------------------------------------------- @@ -892,7 +887,7 @@ H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk) /* Set up the user data for actual B-tree find operation */ bt_udata.common.name = name; bt_udata.common.heap = heap; - bt_udata.op = H5G_stab_lookup_cb; + bt_udata.op = H5G__stab_lookup_cb; bt_udata.op_data = &udata; /* Search the B-tree */ @@ -909,7 +904,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_stab_lookup_by_idx_cb + * Function: H5G__stab_lookup_by_idx_cb * * Purpose: Callback for B-tree iteration 'by index' info query to * retrieve the link @@ -923,13 +918,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata) +H5G__stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata) { H5G_bt_it_lbi_t *udata = (H5G_bt_it_lbi_t *)_udata; const char *name; /* Pointer to name string in heap */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(ent); @@ -946,7 +941,7 @@ H5G_stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_lookup_by_idx_cb */ +} /* end H5G__stab_lookup_by_idx_cb */ /*------------------------------------------------------------------------- @@ -957,7 +952,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2006 * *------------------------------------------------------------------------- @@ -1000,7 +994,7 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_ /* Set iteration information */ udata.common.idx = n; udata.common.num_objs = 0; - udata.common.op = H5G_stab_lookup_by_idx_cb; + udata.common.op = H5G__stab_lookup_by_idx_cb; udata.heap = heap; udata.lnk = lnk; udata.found = FALSE; @@ -1040,7 +1034,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner - * nfortne2@hdfgroup.org * Mar 17, 2009 * *------------------------------------------------------------------------- diff --git a/src/H5Gtest.c b/src/H5Gtest.c index f9ab6f2..03efc7e 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Monday, October 17, 2005 * * Purpose: Group testing functions. @@ -814,7 +814,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner - * nfortne2@hdfgroup.org * April 6 2011 * *------------------------------------------------------------------------- diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 5a4380d..15088d9 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -15,7 +15,7 @@ * * Created: H5Gtraverse.c * Sep 13 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Functions for traversing group hierarchy * @@ -355,7 +355,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 20 2006 * *------------------------------------------------------------------------- @@ -464,7 +463,6 @@ done: * resolved. * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 11 1997 * *------------------------------------------------------------------------- @@ -811,7 +809,6 @@ done: * traversed. * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sep 13 2005 * *------------------------------------------------------------------------- @@ -835,7 +832,7 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver /* Retrieve the original # of soft / UD links that are able to be traversed * (So that multiple calls to H5G_traverse don't incorrectly look - * like they've traversed too many. Nested calls, like in H5L_move(), + * like they've traversed too many. Nested calls, like in H5L__move(), * may need their own mechanism to set & reset the # of links to traverse) */ if(H5CX_get_nlinks(&orig_nlinks) < 0) diff --git a/src/H5HF.c b/src/H5HF.c index 5d52ca4..2e437ad 100644 --- a/src/H5HF.c +++ b/src/H5HF.c @@ -15,7 +15,7 @@ * * Created: H5HF.c * Feb 24 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implements a "fractal heap" for storing variable- * length objects in a file. @@ -88,53 +88,51 @@ H5FL_DEFINE_STATIC(H5HF_t); /*------------------------------------------------------------------------- - * Function: H5HF_op_read + * Function: H5HF__op_read * * Purpose: Performs a 'read' operation for a heap 'op' callback * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_op_read(const void *obj, size_t obj_len, void *op_data) +H5HF__op_read(const void *obj, size_t obj_len, void *op_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Perform "read", using memcpy() */ H5MM_memcpy(op_data, obj, obj_len); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_op_read() */ +} /* end H5HF__op_read() */ /*------------------------------------------------------------------------- - * Function: H5HF_op_write + * Function: H5HF__op_write * * Purpose: Performs a 'write' operation for a heap 'op' callback * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_op_write(const void *obj, size_t obj_len, void *op_data) +H5HF__op_write(const void *obj, size_t obj_len, void *op_data) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Perform "write", using memcpy() */ H5MM_memcpy((void *)obj, op_data, obj_len); /* Casting away const OK -QAK */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_op_write() */ +} /* end H5HF__op_write() */ /*------------------------------------------------------------------------- @@ -146,7 +144,6 @@ H5HF_op_write(const void *obj, size_t obj_len, void *op_data) * NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -168,7 +165,7 @@ H5HF_create(H5F_t *f, const H5HF_create_t *cparam) HDassert(cparam); /* Create shared fractal heap header */ - if(HADDR_UNDEF == (fh_addr = H5HF_hdr_create(f, cparam))) + if(HADDR_UNDEF == (fh_addr = H5HF__hdr_create(f, cparam))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create fractal heap header") /* Allocate fractal heap wrapper */ @@ -181,11 +178,11 @@ H5HF_create(H5F_t *f, const H5HF_create_t *cparam) /* Point fractal heap wrapper at header and bump it's ref count */ fh->hdr = hdr; - if(H5HF_hdr_incr(fh->hdr) < 0) + if(H5HF__hdr_incr(fh->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") /* Increment # of files using this heap header */ - if(H5HF_hdr_fuse_incr(fh->hdr) < 0) + if(H5HF__hdr_fuse_incr(fh->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment file reference count on shared heap header") /* Set file pointer for this heap open context */ @@ -214,7 +211,6 @@ done: * NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 18 2006 * *------------------------------------------------------------------------- @@ -248,11 +244,11 @@ H5HF_open(H5F_t *f, haddr_t fh_addr) /* Point fractal heap wrapper at header */ fh->hdr = hdr; - if(H5HF_hdr_incr(fh->hdr) < 0) + if(H5HF__hdr_incr(fh->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") /* Increment # of files using this heap header */ - if(H5HF_hdr_fuse_incr(fh->hdr) < 0) + if(H5HF__hdr_fuse_incr(fh->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment file reference count on shared heap header") /* Set file pointer for this heap open context */ @@ -280,7 +276,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -311,7 +306,6 @@ H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p) * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 18 2006 * *------------------------------------------------------------------------- @@ -343,7 +337,6 @@ H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr_p) * filled in), negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -381,7 +374,7 @@ H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id/*out*/) /* Check for 'tiny' object */ else if(size <= hdr->tiny_max_len) { /* Store 'tiny' object in heap */ - if(H5HF_tiny_insert(hdr, size, obj, id) < 0) + if(H5HF__tiny_insert(hdr, size, obj, id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't store 'tiny' object in fractal heap") } /* end if */ else { @@ -409,7 +402,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 9 2006 * *------------------------------------------------------------------------- @@ -442,7 +434,7 @@ H5HF_get_obj_len(H5HF_t *fh, const void *_id, size_t *obj_len_p) /* Check type of object in heap */ if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) { - if(H5HF_man_get_obj_len(fh->hdr, id, obj_len_p) < 0) + if(H5HF__man_get_obj_len(fh->hdr, id, obj_len_p) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'managed' object's length") } /* end if */ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) { @@ -450,7 +442,7 @@ H5HF_get_obj_len(H5HF_t *fh, const void *_id, size_t *obj_len_p) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'huge' object's length") } /* end if */ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { - if(H5HF_tiny_get_obj_len(fh->hdr, id, obj_len_p) < 0) + if(H5HF__tiny_get_obj_len(fh->hdr, id, obj_len_p) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'tiny' object's length") } /* end if */ else { @@ -471,7 +463,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 20 2015 * *------------------------------------------------------------------------- @@ -533,7 +524,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 18 2006 * *------------------------------------------------------------------------- @@ -577,7 +567,7 @@ H5HF_read(H5HF_t *fh, const void *_id, void *obj/*out*/) } /* end if */ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { /* Read 'tiny' object from file */ - if(H5HF_tiny_read(fh->hdr, id, obj) < 0) + if(H5HF__tiny_read(fh->hdr, id, obj) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read 'tiny' object from fractal heap") } /* end if */ else { @@ -610,7 +600,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * *------------------------------------------------------------------------- @@ -681,7 +670,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sept 11 2006 * *------------------------------------------------------------------------- @@ -725,7 +713,7 @@ H5HF_op(H5HF_t *fh, const void *_id, H5HF_operator_t op, void *op_data) } /* end if */ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { /* Operate on 'tiny' object from file */ - if(H5HF_tiny_op(fh->hdr, id, op, op_data) < 0) + if(H5HF__tiny_op(fh->hdr, id, op, op_data) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "can't operate on 'tiny' object from fractal heap") } /* end if */ else { @@ -746,7 +734,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 15 2006 * *------------------------------------------------------------------------- @@ -790,7 +777,7 @@ H5HF_remove(H5HF_t *fh, const void *_id) } /* end if */ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { /* Remove 'tiny' object from heap statistics */ - if(H5HF_tiny_remove(fh->hdr, id) < 0) + if(H5HF__tiny_remove(fh->hdr, id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove 'tiny' object from fractal heap") } /* end if */ else { @@ -811,7 +798,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -831,7 +817,7 @@ H5HF_close(H5HF_t *fh) HDassert(fh); /* Decrement file reference & check if this is the last open fractal heap using the shared heap header */ - if(0 == H5HF_hdr_fuse_decr(fh->hdr)) { + if(0 == H5HF__hdr_fuse_decr(fh->hdr)) { /* Set the shared heap header's file context for this operation */ fh->hdr->f = fh->f; @@ -850,8 +836,8 @@ H5HF_close(H5HF_t *fh) * a reference loop and the objects couldn't be removed from * the metadata cache - QAK) */ - if(H5HF_man_iter_ready(&fh->hdr->next_block)) - if(H5HF_man_iter_reset(&fh->hdr->next_block) < 0) + if(H5HF__man_iter_ready(&fh->hdr->next_block)) + if(H5HF__man_iter_reset(&fh->hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") /* Shut down the huge object information */ @@ -873,10 +859,10 @@ H5HF_close(H5HF_t *fh) } /* end if */ /* Decrement the reference count on the heap header */ - /* (don't put in H5HF_hdr_fuse_decr() as the heap header may be evicted + /* (don't put in H5HF__hdr_fuse_decr() as the heap header may be evicted * immediately -QAK) */ - if(H5HF_hdr_decr(fh->hdr) < 0) + if(H5HF__hdr_decr(fh->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") /* Check for pending heap deletion */ @@ -908,7 +894,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 4 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index 479c2bd..756ddb5 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -15,7 +15,7 @@ * * Created: H5HFbtree2.c * Aug 7 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: v2 B-tree callbacks for "huge" object tracker * diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 8dbdf25..31430f9 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -15,7 +15,7 @@ * * Created: H5HFcache.c * Feb 24 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement fractal heap metadata cache methods. * @@ -255,7 +255,6 @@ done: * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -305,7 +304,6 @@ H5HF__dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable) * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -353,7 +351,7 @@ H5HF__dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) * * Note also that the value returned by this function presumes that * there is no I/O filtering data in the header. If there is, the - * size reported will be too small, and H5C_load_entry() + * size reported will be too small, and H5C__load_entry() * will have to make two tries to load the fractal heap header. * * Return: Success: SUCCEED @@ -507,7 +505,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, HDassert(dirty); /* Allocate space for the fractal heap data structure */ - if(NULL == (hdr = H5HF_hdr_alloc(udata->f))) + if(NULL == (hdr = H5HF__hdr_alloc(udata->f))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Deserialize the fractal heap header's prefix */ @@ -591,7 +589,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, HDassert((size_t)(image - (const uint8_t *)_image) == hdr->heap_size); /* Finish initialization of heap header */ - if(H5HF_hdr_finish_init(hdr) < 0) + if(H5HF__hdr_finish_init(hdr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't finish initializing shared fractal heap header") /* Set return value */ @@ -599,7 +597,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, done: if(!ret_value && hdr) - if(H5HF_hdr_free(hdr) < 0) + if(H5HF__hdr_free(hdr) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to release fractal heap header") FUNC_LEAVE_NOAPI(ret_value) @@ -879,7 +877,7 @@ H5HF__cache_hdr_free_icr(void *_thing) HDassert(hdr->cache_info.type == H5AC_FHEAP_HDR); HDassert(hdr->rc == 0); - if(H5HF_hdr_free(hdr) < 0) + if(H5HF__hdr_free(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "unable to release fractal heap header") done: @@ -1009,7 +1007,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /* Share common heap information */ iblock->hdr = hdr; - if(H5HF_hdr_incr(hdr) < 0) + if(H5HF__hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") /* Set block's internal information */ @@ -1049,7 +1047,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED iblock->par_entry = udata->par_info->entry; if(iblock->parent) { /* Share parent block */ - if(H5HF_iblock_incr(iblock->parent) < 0) + if(H5HF__iblock_incr(iblock->parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block") /* Set max. # of rows in this block */ @@ -1144,7 +1142,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED done: if(!ret_value && iblock) - if(H5HF_man_iblock_dest(iblock) < 0) + if(H5HF__man_iblock_dest(iblock) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap indirect block") FUNC_LEAVE_NOAPI(ret_value) @@ -1280,7 +1278,7 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, hdr->man_dtable.table_addr = iblock_addr; /* Mark that heap header was modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end if */ else { @@ -1295,7 +1293,7 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, par_iblock->ents[par_entry].addr = iblock_addr; /* Mark that parent was modified */ - if(H5HF_iblock_dirty(par_iblock) < 0) + if(H5HF__iblock_dirty(par_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end if */ @@ -1559,7 +1557,7 @@ H5HF__cache_iblock_free_icr(void *thing) HDassert(iblock->hdr); /* Destroy fractal heap indirect block */ - if(H5HF_man_iblock_dest(iblock) < 0) + if(H5HF__man_iblock_dest(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") done: @@ -1792,7 +1790,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, /* Share common heap information */ dblock->hdr = hdr; - if(H5HF_hdr_incr(hdr) < 0) + if(H5HF__hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") /* Set block's internal information */ @@ -1885,7 +1883,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, dblock->par_entry = par_info->entry; if(dblock->parent) { /* Share parent block */ - if(H5HF_iblock_incr(dblock->parent) < 0) + if(H5HF__iblock_incr(dblock->parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block") } /* end if */ @@ -1915,7 +1913,7 @@ done: /* Cleanup on error */ if(!ret_value && dblock) - if(H5HF_man_dblock_dest(dblock) < 0) + if(H5HF__man_dblock_dest(dblock) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap direct block") FUNC_LEAVE_NOAPI(ret_value) @@ -2269,7 +2267,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, /* Check if heap header was modified */ if(hdr_changed) - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end if */ else { /* the direct block's parent is an indirect block */ @@ -2321,7 +2319,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, /* Check if parent was modified */ if(par_changed) - if(H5HF_iblock_dirty(par_iblock) < 0) + if(H5HF__iblock_dirty(par_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end else */ } /* end if */ @@ -2357,7 +2355,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, hdr->man_dtable.table_addr = dblock_addr; /* Mark that heap header was modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end if */ else { /* the direct block's parent is an indirect block */ @@ -2371,7 +2369,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, par_iblock->ents[par_entry].addr = dblock_addr; /* Mark that parent was modified */ - if(H5HF_iblock_dirty(par_iblock) < 0) + if(H5HF__iblock_dirty(par_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end else */ } /* end if */ @@ -2574,7 +2572,7 @@ H5HF__cache_dblock_free_icr(void *_thing) HDassert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); /* Destroy fractal heap direct block */ - if(H5HF_man_dblock_dest(dblock) < 0) + if(H5HF__man_dblock_dest(dblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap direct block") done: diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 22de0c4..f6c7f0e 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -15,7 +15,7 @@ * * Created: H5HFdbg.c * Feb 24 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Dump debugging information about a fractal heap * @@ -78,7 +78,7 @@ typedef struct { /* Local Prototypes */ /********************/ -static herr_t H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, +static herr_t H5HF__dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth); @@ -105,7 +105,6 @@ static herr_t H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 20 2015 * *------------------------------------------------------------------------- @@ -172,22 +171,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_dtable_debug + * Function: H5HF__dtable_debug * * Purpose: Prints debugging info about a doubling table * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 28 2006 * *------------------------------------------------------------------------- */ static herr_t -H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth) +H5HF__dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwidth) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * Check arguments. @@ -240,7 +238,7 @@ H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwi dtable->num_id_first_row); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_dtable_debug() */ +} /* end H5HF__dtable_debug() */ /*------------------------------------------------------------------------- @@ -251,7 +249,6 @@ H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwi * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 23 2012 * *------------------------------------------------------------------------- @@ -328,7 +325,7 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i hdr->tiny_nobjs); HDfprintf(stream, "%*sManaged Objects Doubling-Table Info...\n", indent, ""); - H5HF_dtable_debug(&hdr->man_dtable, stream, indent + 3, MAX(0, fwidth - 3)); + H5HF__dtable_debug(&hdr->man_dtable, stream, indent + 3, MAX(0, fwidth - 3)); /* Print information about I/O filters */ if(hdr->filter_len > 0) { @@ -371,7 +368,6 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 24 2006 * *------------------------------------------------------------------------- @@ -416,7 +412,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 13 2006 * *------------------------------------------------------------------------- @@ -500,7 +495,6 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 28 2006 * *------------------------------------------------------------------------- @@ -627,7 +621,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 23 2012 * *------------------------------------------------------------------------- @@ -709,10 +702,10 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, unsigned first_row_bits; /* Number of bits used bit addresses in first row */ unsigned num_indirect_rows; /* Number of rows of blocks in each indirect block */ - first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + - H5VM_log2_of2(hdr->man_dtable.cparam.width); + first_row_bits = H5VM__log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + + H5VM__log2_of2(hdr->man_dtable.cparam.width); for(u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++) { - num_indirect_rows = (H5VM_log2_gen(hdr->man_dtable.row_block_size[u]) - first_row_bits) + 1; + num_indirect_rows = (H5VM__log2_gen(hdr->man_dtable.row_block_size[u]) - first_row_bits) + 1; HDsnprintf(temp_str, sizeof(temp_str), "Row #%u: (# of rows: %u)", (unsigned)u, num_indirect_rows); HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); @@ -759,7 +752,6 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 7 2006 * *------------------------------------------------------------------------- @@ -817,7 +809,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 13 2006 * *------------------------------------------------------------------------- @@ -849,11 +840,6 @@ H5HF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) HDfprintf(udata->stream, "%*s%-*s %Hu\n", udata->indent, "", udata->fwidth, "Section size:", sect->sect_info.size); -#ifdef QAK - HDfprintf(udata->stream, "%*s%-*s %s\n", udata->indent, "", udata->fwidth, - "Section state:", - (sect->sect_info.state == H5FS_SECT_LIVE ? "live" : "serialized")); -#endif /* QAK */ /* Dump section-specific debugging information */ if(H5FS_sect_debug(udata->fspace, _sect, udata->stream, udata->indent + 3, MAX(0, udata->fwidth - 3)) < 0) @@ -872,7 +858,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 9 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index a6560e2..96392c1 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -15,7 +15,7 @@ * * Created: H5HFdblock.c * Apr 10 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Direct block routines for fractal heaps. * @@ -86,7 +86,6 @@ H5FL_DEFINE(H5HF_direct_t); * Return: Pointer to new direct block on success, NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- @@ -119,7 +118,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, /* Share common heap information */ dblock->hdr = hdr; - if(H5HF_hdr_incr(hdr) < 0) + if(H5HF__hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") /* Set info for direct block */ @@ -162,7 +161,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, /* Attach to parent indirect block, if there is one */ dblock->parent = par_iblock; if(dblock->parent) { - if(H5HF_man_iblock_attach(dblock->parent, par_entry, dblock_addr) < 0) + if(H5HF__man_iblock_attach(dblock->parent, par_entry, dblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't attach direct block to parent indirect block") dblock->fd_parent = par_iblock; } /* end if */ @@ -171,7 +170,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, dblock->par_entry = par_entry; /* Create a new 'single' section for the free space in the block */ - if(NULL == (sec_node = H5HF_sect_single_new((dblock->block_off + H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)), + if(NULL == (sec_node = H5HF__sect_single_new((dblock->block_off + H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)), free_space, dblock->parent, dblock->par_entry))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create section for new direct block's free space") @@ -190,7 +189,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap direct block to cache") /* Increase the allocated heap size */ - if(H5HF_hdr_inc_alloc(hdr, dblock->size) < 0) + if(H5HF__hdr_inc_alloc(hdr, dblock->size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't increase allocated heap size") /* Set the address of of direct block, if requested */ @@ -200,7 +199,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, done: if(ret_value < 0) if(dblock) - if(H5HF_man_dblock_dest(dblock) < 0) + if(H5HF__man_dblock_dest(dblock) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap direct block") FUNC_LEAVE_NOAPI(ret_value) @@ -219,7 +218,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 17 2006 * *------------------------------------------------------------------------- @@ -272,7 +270,7 @@ H5HF__man_dblock_destroy(H5HF_hdr_t *hdr, H5HF_direct_t *dblock, HDassert(hdr->man_dtable.cparam.start_block_size == dblock->size); /* Sanity check block iterator */ - HDassert(!H5HF_man_iter_ready(&hdr->next_block)); + HDassert(!H5HF__man_iter_ready(&hdr->next_block)); /* Reset header information back to "empty heap" state */ if(H5HF__hdr_empty(hdr) < 0) @@ -334,7 +332,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 13 2006 * *------------------------------------------------------------------------- @@ -359,7 +356,7 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, if(request < hdr->man_dtable.cparam.start_block_size) min_dblock_size = hdr->man_dtable.cparam.start_block_size; else { - min_dblock_size = ((size_t)1) << (1 + H5VM_log2_gen((uint64_t)request)); + min_dblock_size = ((size_t)1) << (1 + H5VM__log2_gen((uint64_t)request)); HDassert(min_dblock_size <= hdr->man_dtable.cparam.max_direct_size); } /* end else */ @@ -383,7 +380,7 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, } /* end if */ /* Extend heap to cover new direct block */ - if(H5HF_hdr_adjust_heap(hdr, (hsize_t)hdr->man_dtable.cparam.start_block_size, (hssize_t)hdr->man_dtable.row_tot_dblock_free[0]) < 0) + if(H5HF__hdr_adjust_heap(hdr, (hsize_t)hdr->man_dtable.cparam.start_block_size, (hssize_t)hdr->man_dtable.row_tot_dblock_free[0]) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") } /* end if */ /* Root entry already exists, allocate direct block from root indirect block */ @@ -398,7 +395,7 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, HGOTO_ERROR(H5E_HEAP, H5E_CANTUPDATE, FAIL, "unable to update block iterator") /* Retrieve information about current iterator position */ - if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) + 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") HDassert(next_row < iblock->nrows); H5_CHECKED_ASSIGN(next_size, size_t, hdr->man_dtable.row_block_size[next_row], hsize_t); @@ -410,7 +407,7 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not su } /* end if */ /* Advance "next block" iterator to next direct block entry */ - if(H5HF_hdr_inc_iter(hdr, (hsize_t)next_size, 1) < 0) + 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") /* Create new direct block at current location*/ @@ -432,7 +429,6 @@ done: * Return: Pointer to direct block on success, NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -515,7 +511,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 8 2006 * *------------------------------------------------------------------------- @@ -546,7 +541,7 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Look up row & column for object */ - if(H5HF_dtable_lookup(&hdr->man_dtable, obj_off, &row, &col) < 0) + 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") /* Set initial indirect block info */ @@ -564,7 +559,7 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting parent indirect block */ /* Compute # of rows in child indirect block */ - nrows = (H5VM_log2_gen(hdr->man_dtable.row_block_size[row]) - hdr->man_dtable.first_row_bits) + 1; + nrows = (H5VM__log2_gen(hdr->man_dtable.row_block_size[row]) - hdr->man_dtable.first_row_bits) + 1; HDassert(nrows < iblock->nrows); /* child must be smaller than parent */ /* Compute indirect block's entry */ @@ -595,7 +590,7 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, did_protect = new_did_protect; /* 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) + 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 */ } /* end while */ @@ -624,7 +619,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- @@ -682,24 +676,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_dblock_dest + * Function: H5HF__man_dblock_dest * * Purpose: Destroys a fractal heap direct block in memory. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Feb 27 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_dblock_dest(H5HF_direct_t *dblock) +H5HF__man_dblock_dest(H5HF_direct_t *dblock) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -708,7 +701,7 @@ H5HF_man_dblock_dest(H5HF_direct_t *dblock) /* Decrement reference count on shared fractal heap info */ HDassert(dblock->hdr != NULL); - if(H5HF_hdr_decr(dblock->hdr) < 0) + if(H5HF__hdr_decr(dblock->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") if(dblock->parent) if(H5HF__iblock_decr(dblock->parent) < 0) @@ -722,5 +715,5 @@ H5HF_man_dblock_dest(H5HF_direct_t *dblock) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_dblock_dest() */ +} /* end H5HF__man_dblock_dest() */ diff --git a/src/H5HFdtable.c b/src/H5HFdtable.c index 6e9429a..ad317c9 100644 --- a/src/H5HFdtable.c +++ b/src/H5HFdtable.c @@ -15,7 +15,7 @@ * * Created: H5HFdtable.c * Apr 10 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: "Doubling table" routines for fractal heaps. * @@ -75,27 +75,26 @@ /*------------------------------------------------------------------------- - * Function: H5HF_dtable_init + * Function: H5HF__dtable_init * * Purpose: Initialize values for doubling table * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_dtable_init(H5HF_dtable_t *dtable) +H5HF__dtable_init(H5HF_dtable_t *dtable) { hsize_t tmp_block_size; /* Temporary block size */ hsize_t acc_block_off; /* Accumulated block offset */ size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -103,10 +102,10 @@ H5HF_dtable_init(H5HF_dtable_t *dtable) HDassert(dtable); /* Compute/cache some values */ - dtable->start_bits = H5VM_log2_of2((uint32_t)dtable->cparam.start_block_size); - dtable->first_row_bits = dtable->start_bits + H5VM_log2_of2(dtable->cparam.width); + dtable->start_bits = H5VM__log2_of2((uint32_t)dtable->cparam.start_block_size); + dtable->first_row_bits = dtable->start_bits + H5VM__log2_of2(dtable->cparam.width); dtable->max_root_rows = (dtable->cparam.max_index - dtable->first_row_bits) + 1; - dtable->max_direct_bits = H5VM_log2_of2((uint32_t)dtable->cparam.max_direct_size); + dtable->max_direct_bits = H5VM__log2_of2((uint32_t)dtable->cparam.max_direct_size); dtable->max_direct_rows = (dtable->max_direct_bits - dtable->start_bits) + 2; dtable->num_id_first_row = dtable->cparam.start_block_size * dtable->cparam.width; dtable->max_dir_blk_off_size = H5HF_SIZEOF_OFFSET_LEN(dtable->cparam.max_direct_size); @@ -133,26 +132,25 @@ H5HF_dtable_init(H5HF_dtable_t *dtable) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_dtable_init() */ +} /* end H5HF__dtable_init() */ /*------------------------------------------------------------------------- - * Function: H5HF_dtable_lookup + * Function: H5HF__dtable_lookup * * Purpose: Compute the row & col of an offset in a doubling-table * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsigned *col) +H5HF__dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsigned *col) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -160,9 +158,6 @@ H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsi HDassert(dtable); HDassert(row); HDassert(col); -#ifdef QAK -HDfprintf(stderr, "%s: off = %Hu\n", "H5HF_dtable_lookup", off); -#endif /* QAK */ /* Check for offset in first row */ if(off < dtable->num_id_first_row) { @@ -170,37 +165,33 @@ HDfprintf(stderr, "%s: off = %Hu\n", "H5HF_dtable_lookup", off); H5_CHECKED_ASSIGN(*col, unsigned, (off / dtable->cparam.start_block_size), hsize_t); } /* end if */ else { - unsigned high_bit = H5VM_log2_gen(off); /* Determine the high bit in the offset */ + unsigned high_bit = H5VM__log2_gen(off); /* Determine the high bit in the offset */ hsize_t off_mask = ((hsize_t)1) << high_bit; /* Compute mask for determining column */ -#ifdef QAK -HDfprintf(stderr, "%s: high_bit = %u, off_mask = %Hu\n", "H5HF_dtable_lookup", high_bit, off_mask); -#endif /* QAK */ *row = (high_bit - dtable->first_row_bits) + 1; H5_CHECKED_ASSIGN(*col, unsigned, ((off - off_mask) / dtable->row_block_size[*row]), hsize_t); } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_dtable_lookup() */ +} /* end H5HF__dtable_lookup() */ /*------------------------------------------------------------------------- - * Function: H5HF_dtable_dest + * Function: H5HF__dtable_dest * * Purpose: Release information for doubling table * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_dtable_dest(H5HF_dtable_t *dtable) +H5HF__dtable_dest(H5HF_dtable_t *dtable) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -220,28 +211,27 @@ H5HF_dtable_dest(H5HF_dtable_t *dtable) H5MM_xfree(dtable->row_max_dblock_free); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_dtable_dest() */ +} /* end H5HF__dtable_dest() */ /*------------------------------------------------------------------------- - * Function: H5HF_dtable_size_to_row + * Function: H5HF__dtable_size_to_row * * Purpose: Compute row that can hold block of a certain size * * Return: Non-negative on success (can't fail) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 25 2006 * *------------------------------------------------------------------------- */ unsigned -H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) +H5HF__dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) { unsigned row = 0; /* Row where block will fit */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -251,58 +241,56 @@ H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) if(block_size == dtable->cparam.start_block_size) row = 0; else - row = (H5VM_log2_of2((uint32_t)block_size) - H5VM_log2_of2((uint32_t)dtable->cparam.start_block_size)) + 1; + row = (H5VM__log2_of2((uint32_t)block_size) - H5VM__log2_of2((uint32_t)dtable->cparam.start_block_size)) + 1; FUNC_LEAVE_NOAPI(row) -} /* end H5HF_dtable_size_to_row() */ +} /* end H5HF__dtable_size_to_row() */ /*------------------------------------------------------------------------- - * Function: H5HF_dtable_size_to_rows + * Function: H5HF__dtable_size_to_rows * * Purpose: Compute # of rows of indirect block of a given size * * Return: Non-negative on success (can't fail) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- */ unsigned -H5HF_dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size) +H5HF__dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size) { unsigned rows = 0; /* # of rows required for indirect block */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. */ HDassert(dtable); - rows = (H5VM_log2_gen(size) - dtable->first_row_bits) + 1; + rows = (H5VM__log2_gen(size) - dtable->first_row_bits) + 1; FUNC_LEAVE_NOAPI(rows) -} /* end H5HF_dtable_size_to_rows() */ +} /* end H5HF__dtable_size_to_rows() */ /*------------------------------------------------------------------------- - * Function: H5HF_dtable_span_size + * Function: H5HF__dtable_span_size * * Purpose: Compute the size covered by a span of entries * * Return: Non-zero span size on success/zero on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 25 2006 * *------------------------------------------------------------------------- */ hsize_t -H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, +H5HF__dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned start_col, unsigned num_entries) { unsigned start_entry; /* Entry for first block covered */ @@ -311,7 +299,7 @@ H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned end_entry; /* Entry for last block covered */ hsize_t acc_span_size = 0; /* Accumulated span size */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -326,10 +314,6 @@ H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, end_entry = (start_entry + num_entries) - 1; end_row = end_entry / dtable->cparam.width; end_col = end_entry % dtable->cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: start_row = %u, start_col = %u, start_entry = %u\n", "H5HF_sect_indirect_span_size", start_row, start_col, start_entry); -HDfprintf(stderr, "%s: end_row = %u, end_col = %u, end_entry = %u\n", "H5HF_sect_indirect_span_size", end_row, end_col, end_entry); -#endif /* QAK */ /* Initialize accumulated span size */ acc_span_size = 0; @@ -362,9 +346,6 @@ HDfprintf(stderr, "%s: end_row = %u, end_col = %u, end_entry = %u\n", "H5HF_sect ((end_col - start_col) + 1); } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: acc_span_size = %Hu\n", "H5HF_dtable_span_size", acc_span_size); -#endif /* QAK */ FUNC_LEAVE_NOAPI(acc_span_size) -} /* end H5HF_sect_indirect_span_size() */ +} /* end H5HF__dtable_span_size() */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 5750a03..4a645cd 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -15,7 +15,7 @@ * * Created: H5HFhdr.c * Apr 10 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Heap header routines for fractal heaps. * @@ -46,7 +46,7 @@ #ifndef NDEBUG /* Limit on the size of the max. direct block size */ /* (This is limited to 32-bits currently, because I think it's unlikely to - * need to be larger, the 32-bit limit for H5VM_log2_of2(n), and + * need to be larger, the 32-bit limit for H5VM__log2_of2(n), and * some offsets/sizes are encoded with a maximum of 32-bits - QAK) */ #define H5HF_MAX_DIRECT_SIZE_LIMIT ((hsize_t)2 * 1024 * 1024 * 1024) @@ -94,25 +94,24 @@ H5FL_DEFINE_STATIC(H5HF_hdr_t); /*------------------------------------------------------------------------- - * Function: H5HF_hdr_alloc + * Function: H5HF__hdr_alloc * * Purpose: Allocate shared fractal heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- */ H5HF_hdr_t * -H5HF_hdr_alloc(H5F_t *f) +H5HF__hdr_alloc(H5F_t *f) { H5HF_hdr_t *hdr = NULL; /* Shared fractal heap header */ H5HF_hdr_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -133,7 +132,7 @@ H5HF_hdr_alloc(H5F_t *f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_alloc() */ +} /* end H5HF__hdr_alloc() */ /*------------------------------------------------------------------------- @@ -145,13 +144,12 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- */ static herr_t -H5HF_hdr_compute_free_space(H5HF_hdr_t *hdr, unsigned iblock_row) +H5HF__hdr_compute_free_space(H5HF_hdr_t *hdr, unsigned iblock_row) { hsize_t acc_heap_size; /* Accumumated heap space */ hsize_t iblock_size; /* Size of indirect block to calculate for */ @@ -160,7 +158,7 @@ H5HF_hdr_compute_free_space(H5HF_hdr_t *hdr, unsigned iblock_row) unsigned curr_row; /* Current row in block */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * Check arguments. @@ -189,28 +187,27 @@ H5HF_hdr_compute_free_space(H5HF_hdr_t *hdr, unsigned iblock_row) hdr->man_dtable.row_max_dblock_free[iblock_row] = max_dblock_free; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_compute_free_space() */ +} /* end H5HF__hdr_compute_free_space() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_finish_init_phase1 + * Function: H5HF__hdr_finish_init_phase1 * * Purpose: First phase to finish initializing info in shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 12 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr) +H5HF__hdr_finish_init_phase1(H5HF_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -219,38 +216,37 @@ H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr) /* Compute/cache some values */ hdr->heap_off_size = (uint8_t)H5HF_SIZEOF_OFFSET_BITS(hdr->man_dtable.cparam.max_index); - if(H5HF_dtable_init(&hdr->man_dtable) < 0) + if(H5HF__dtable_init(&hdr->man_dtable) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize doubling table info") /* Set the size of heap IDs */ hdr->heap_len_size = (uint8_t)MIN(hdr->man_dtable.max_dir_blk_off_size, - H5VM_limit_enc_size((uint64_t)hdr->max_man_size)); + H5VM__limit_enc_size((uint64_t)hdr->max_man_size)); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_finish_init_phase1() */ +} /* end H5HF__hdr_finish_init_phase1() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_finish_init_phase2 + * Function: H5HF__hdr_finish_init_phase2 * * Purpose: Second phase to finish initializing info in shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 12 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_finish_init_phase2(H5HF_hdr_t *hdr) +H5HF__hdr_finish_init_phase2(H5HF_hdr_t *hdr) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -265,46 +261,45 @@ H5HF_hdr_finish_init_phase2(H5HF_hdr_t *hdr) H5_CHECKED_ASSIGN(hdr->man_dtable.row_max_dblock_free[u], size_t, hdr->man_dtable.row_tot_dblock_free[u], hsize_t); } /* end if */ else - if(H5HF_hdr_compute_free_space(hdr, u) < 0) + 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") } /* end for */ /* Initialize the block iterator for searching for free space */ - if(H5HF_man_iter_init(&hdr->next_block) < 0) + if(H5HF__man_iter_init(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize space search block iterator") /* Initialize the information for tracking 'huge' objects */ - if(H5HF_huge_init(hdr) < 0) + if(H5HF__huge_init(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize info for tracking huge objects") /* Initialize the information for tracking 'tiny' objects */ - if(H5HF_tiny_init(hdr) < 0) + if(H5HF__tiny_init(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize info for tracking tiny objects") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_finish_init_phase2() */ +} /* end H5HF__hdr_finish_init_phase2() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_finish_init + * Function: H5HF__hdr_finish_init * * Purpose: Finish initializing info in shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_finish_init(H5HF_hdr_t *hdr) +H5HF__hdr_finish_init(H5HF_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -312,39 +307,38 @@ H5HF_hdr_finish_init(H5HF_hdr_t *hdr) HDassert(hdr); /* First phase of header final initialization */ - if(H5HF_hdr_finish_init_phase1(hdr) < 0) + if(H5HF__hdr_finish_init_phase1(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't finish phase #1 of header final initialization") /* Second phase of header final initialization */ - if(H5HF_hdr_finish_init_phase2(hdr) < 0) + if(H5HF__hdr_finish_init_phase2(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't finish phase #2 of header final initialization") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_finish_init() */ +} /* end H5HF__hdr_finish_init() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_create + * Function: H5HF__hdr_create * * Purpose: Create new fractal heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- */ haddr_t -H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) +H5HF__hdr_create(H5F_t *f, const H5HF_create_t *cparam) { H5HF_hdr_t *hdr = NULL; /* The new fractal heap header information */ size_t dblock_overhead; /* Direct block's overhead */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -377,7 +371,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) #endif /* NDEBUG */ /* Allocate & basic initialization for the shared header */ - if(NULL == (hdr = H5HF_hdr_alloc(f))) + if(NULL == (hdr = H5HF__hdr_alloc(f))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "can't allocate space for shared heap info") #ifndef NDEBUG @@ -401,7 +395,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* First phase of header final initialization */ /* (doesn't need ID length set up) */ - if(H5HF_hdr_finish_init_phase1(hdr) < 0) + if(H5HF__hdr_finish_init_phase1(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't finish phase #1 of header final initialization") /* Copy any I/O filter pipeline */ @@ -484,7 +478,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* Second phase of header final initialization */ /* (needs ID and filter lengths set up) */ - if(H5HF_hdr_finish_init_phase2(hdr) < 0) + if(H5HF__hdr_finish_init_phase2(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't finish phase #2 of header final initialization") /* Extra checking for possible gap between max. direct block size minus @@ -506,11 +500,11 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) done: if(!H5F_addr_defined(ret_value) && hdr) - if(H5HF_hdr_free(hdr) < 0) + if(H5HF__hdr_free(hdr) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, HADDR_UNDEF, "unable to release fractal heap header") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_create() */ +} /* end H5HF__hdr_create() */ /*------------------------------------------------------------------------- @@ -521,7 +515,6 @@ done: * Return: Pointer to indirect block on success, NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 5 2010 * *------------------------------------------------------------------------- @@ -564,24 +557,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_hdr_incr + * Function: H5HF__hdr_incr * * Purpose: Increment component reference count on shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_incr(H5HF_hdr_t *hdr) +H5HF__hdr_incr(H5HF_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -596,28 +588,27 @@ H5HF_hdr_incr(H5HF_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_incr() */ +} /* end H5HF__hdr_incr() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_decr + * Function: H5HF__hdr_decr * * Purpose: Decrement component reference count on shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_decr(H5HF_hdr_t *hdr) +H5HF__hdr_decr(H5HF_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); @@ -635,26 +626,25 @@ H5HF_hdr_decr(H5HF_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_decr() */ +} /* end H5HF__hdr_decr() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_fuse_incr + * Function: H5HF__hdr_fuse_incr * * Purpose: Increment file reference count on shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 1 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_fuse_incr(H5HF_hdr_t *hdr) +H5HF__hdr_fuse_incr(H5HF_hdr_t *hdr) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(hdr); @@ -663,26 +653,25 @@ H5HF_hdr_fuse_incr(H5HF_hdr_t *hdr) hdr->file_rc++; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_hdr_fuse_incr() */ +} /* end H5HF__hdr_fuse_incr() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_fuse_decr + * Function: H5HF__hdr_fuse_decr * * Purpose: Decrement file reference count on shared heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Oct 1 2006 * *------------------------------------------------------------------------- */ size_t -H5HF_hdr_fuse_decr(H5HF_hdr_t *hdr) +H5HF__hdr_fuse_decr(H5HF_hdr_t *hdr) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(hdr); @@ -692,37 +681,35 @@ H5HF_hdr_fuse_decr(H5HF_hdr_t *hdr) hdr->file_rc--; FUNC_LEAVE_NOAPI(hdr->file_rc) -} /* end H5HF_hdr_fuse_decr() */ +} /* end H5HF__hdr_fuse_decr() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_dirty + * Function: H5HF__hdr_dirty * * Purpose: Mark heap header as dirty * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_dirty(H5HF_hdr_t *hdr) +H5HF__hdr_dirty(H5HF_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(hdr); /* Resize pinned header in cache if I/O filter is present. */ - if(hdr->filter_len > 0) { + if(hdr->filter_len > 0) if(H5AC_resize_entry(hdr, (size_t)hdr->heap_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap header") - } /* end if */ /* Mark header as dirty in cache */ if(H5AC_mark_entry_dirty(hdr) < 0) @@ -730,28 +717,27 @@ H5HF_hdr_dirty(H5HF_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_dirty() */ +} /* end H5HF__hdr_dirty() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_adj_free + * Function: H5HF__hdr_adj_free * * Purpose: Adjust the free space for a heap * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 9 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt) +H5HF__hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -763,33 +749,32 @@ H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt) hdr->total_man_free = (hsize_t)((hssize_t)hdr->total_man_free + amt); /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_adj_free() */ +} /* end H5HF__hdr_adj_free() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_adjust_heap + * Function: H5HF__hdr_adjust_heap * * Purpose: Adjust heap space * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 10 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free) +H5HF__hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -804,31 +789,30 @@ H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free) hdr->total_man_free = (hsize_t)((hssize_t)hdr->total_man_free + extra_free); /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark header as dirty") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_adjust_heap() */ +} /* end H5HF__hdr_adjust_heap() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_inc_alloc + * Function: H5HF__hdr_inc_alloc * * Purpose: Increase allocated size of heap * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 23 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size) +H5HF__hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -840,28 +824,27 @@ H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size) hdr->man_alloc_size += alloc_size; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_hdr_inc_alloc() */ +} /* end H5HF__hdr_inc_alloc() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_start_iter + * Function: H5HF__hdr_start_iter * * Purpose: Start "next block" iterator at an offset/entry in the heap * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 30 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, unsigned curr_entry) +H5HF__hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, unsigned curr_entry) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -870,7 +853,7 @@ H5HF_hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, HDassert(iblock); /* Set up "next block" iterator at correct location */ - if(H5HF_man_iter_start_entry(hdr, &hdr->next_block, iblock, curr_entry) < 0) + if(H5HF__man_iter_start_entry(hdr, &hdr->next_block, iblock, curr_entry) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize block iterator") /* Set the offset of the iterator in the heap */ @@ -878,28 +861,27 @@ H5HF_hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_start_iter() */ +} /* end H5HF__hdr_start_iter() */ /*------------------------------------------------------------------------- - * Function: H5HF_hdr_reset_iter + * Function: H5HF__hdr_reset_iter * * Purpose: Reset "next block" iterator * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off) +H5HF__hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -907,7 +889,7 @@ H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off) HDassert(hdr); /* Reset "next block" iterator */ - if(H5HF_man_iter_reset(&hdr->next_block) < 0) + if(H5HF__man_iter_reset(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") /* Set the offset of the iterator in the heap */ @@ -915,7 +897,7 @@ H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_reset_iter() */ +} /* end H5HF__hdr_reset_iter() */ /*------------------------------------------------------------------------- @@ -926,7 +908,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 3 2006 * *------------------------------------------------------------------------- @@ -951,11 +932,11 @@ H5HF__hdr_skip_blocks(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, /* Compute the span within the heap to skip */ 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); + sect_size = H5HF__dtable_span_size(&hdr->man_dtable, row, col, nentries); HDassert(sect_size > 0); /* Advance the new block iterator */ - if(H5HF_hdr_inc_iter(hdr, sect_size, nentries) < 0) + if(H5HF__hdr_inc_iter(hdr, sect_size, nentries) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't increase allocated heap size") /* Add 'indirect' section for blocks skipped in this row */ @@ -978,7 +959,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 14 2006 * *------------------------------------------------------------------------- @@ -1009,17 +989,17 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) unsigned min_dblock_row; /* Minimum row for direct block size request */ /* Compute min. row for direct block requested */ - min_dblock_row = H5HF_dtable_size_to_row(&hdr->man_dtable, min_dblock_size); + min_dblock_row = H5HF__dtable_size_to_row(&hdr->man_dtable, min_dblock_size); /* Initialize block iterator, if necessary */ - if(!H5HF_man_iter_ready(&hdr->next_block)) { + if(!H5HF__man_iter_ready(&hdr->next_block)) { /* Start iterator with previous offset of iterator */ if(H5HF__man_iter_start_offset(hdr, &hdr->next_block, hdr->man_iter_off) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to set block iterator location") } /* end if */ /* Get information about current iterator location */ - if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) + 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") /* Check for skipping over blocks in the current block */ @@ -1039,7 +1019,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't add skipped blocks to heap's free space") /* Get information about new iterator location */ - if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) + 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") } /* end if */ @@ -1057,16 +1037,16 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) } /* end if */ else { /* Move iterator up one level */ - if(H5HF_man_iter_up(&hdr->next_block) < 0) + if(H5HF__man_iter_up(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location") /* Increment location of next block at this level */ - if(H5HF_man_iter_next(hdr, &hdr->next_block, 1) < 0) + if(H5HF__man_iter_next(hdr, &hdr->next_block, 1) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't advance fractal heap block location") } /* end else */ /* Get information about new iterator location */ - if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) + 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") /* Indicate that we walked up */ @@ -1081,7 +1061,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) 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]); + child_nrows = H5HF__dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[next_row]); /* Check for skipping over indirect blocks */ /* (that don't have direct blocks large enough to hold direct block size requested) */ @@ -1090,7 +1070,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) unsigned child_entry; /* Entry of child indirect block */ /* Compute # of rows needed in child indirect block */ - child_rows_needed = (H5VM_log2_of2((uint32_t)min_dblock_size) - H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size)) + 2; + child_rows_needed = (H5VM__log2_of2((uint32_t)min_dblock_size) - H5VM__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)) @@ -1114,7 +1094,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") /* Move iterator down one level (pins indirect block) */ - if(H5HF_man_iter_down(&hdr->next_block, new_iblock) < 0) + if(H5HF__man_iter_down(&hdr->next_block, new_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location") /* Check for skipping over rows and add free section for skipped rows */ @@ -1135,7 +1115,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) } /* end else */ /* Get information about new iterator location */ - if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) + 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") /* Indicate that we walked down */ @@ -1150,24 +1130,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_hdr_inc_iter + * Function: H5HF__hdr_inc_iter * * Purpose: Advance "next block" iterator * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 23 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries) +H5HF__hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1177,7 +1156,7 @@ H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries) /* Advance the iterator for the current location within the indirect block */ if(hdr->next_block.curr) - if(H5HF_man_iter_next(hdr, &hdr->next_block, nentries) < 0) + if(H5HF__man_iter_next(hdr, &hdr->next_block, nentries) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location") /* Increment the offset of the iterator in the heap */ @@ -1185,7 +1164,7 @@ H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_inc_iter() */ +} /* end H5HF__hdr_inc_iter() */ /*------------------------------------------------------------------------- @@ -1197,7 +1176,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -1219,7 +1197,7 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) HDassert(hdr); /* Initialize block iterator, if necessary */ - if(!H5HF_man_iter_ready(&hdr->next_block)) + if(!H5HF__man_iter_ready(&hdr->next_block)) /* Start iterator with previous offset of iterator */ if(H5HF__man_iter_start_offset(hdr, &hdr->next_block, hdr->man_iter_off) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to set block iterator location") @@ -1227,7 +1205,7 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) /* Walk backwards through heap, looking for direct block to place iterator after */ /* Get information about current iterator location */ - if(H5HF_man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) + 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") /* Move current iterator position backwards once */ @@ -1253,11 +1231,11 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) /* Check for parent of current indirect block */ if(iblock->parent) { /* Move iterator to parent of current block */ - if(H5HF_man_iter_up(&hdr->next_block) < 0) + if(H5HF__man_iter_up(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to move current block iterator location up") /* Get information about current iterator location */ - if(H5HF_man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) + 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") /* Move current iterator position backwards once */ @@ -1271,7 +1249,7 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) hdr->man_iter_off = 0; /* Reset 'next block' iterator */ - if(H5HF_man_iter_reset(&hdr->next_block) < 0) + if(H5HF__man_iter_reset(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") } /* end else */ } /* end if */ @@ -1287,7 +1265,7 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) curr_entry++; /* Set the current location of the iterator to next entry after the existing direct block */ - if(H5HF_man_iter_set_entry(hdr, &hdr->next_block, curr_entry) < 0) + if(H5HF__man_iter_set_entry(hdr, &hdr->next_block, curr_entry) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "unable to set current block iterator location") /* Update iterator offset */ @@ -1301,18 +1279,18 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) unsigned child_nrows; /* # of rows in child block */ /* 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]); + child_nrows = H5HF__dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[row]); /* Lock child indirect block */ if(NULL == (child_iblock = H5HF__man_iblock_protect(hdr, iblock->ents[curr_entry].addr, child_nrows, iblock, curr_entry, FALSE, H5AC__NO_FLAGS_SET, &did_protect))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") /* Set the current location of the iterator */ - if(H5HF_man_iter_set_entry(hdr, &hdr->next_block, curr_entry) < 0) + if(H5HF__man_iter_set_entry(hdr, &hdr->next_block, curr_entry) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "unable to set current block iterator location") /* Walk down into child indirect block (pins child block) */ - if(H5HF_man_iter_down(&hdr->next_block, child_iblock) < 0) + if(H5HF__man_iter_down(&hdr->next_block, child_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location") /* Update iterator location */ @@ -1342,7 +1320,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 17 2006 * *------------------------------------------------------------------------- @@ -1358,10 +1335,9 @@ H5HF__hdr_empty(H5HF_hdr_t *hdr) HDassert(hdr); /* Reset block iterator, if necessary */ - if(H5HF_man_iter_ready(&hdr->next_block)) { - if(H5HF_man_iter_reset(&hdr->next_block) < 0) + if(H5HF__man_iter_ready(&hdr->next_block)) + if(H5HF__man_iter_reset(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") - } /* end if */ /* Shrink managed heap size */ hdr->man_size = 0; @@ -1378,7 +1354,7 @@ H5HF__hdr_empty(H5HF_hdr_t *hdr) hdr->total_man_free = 0; /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark header as dirty") done: @@ -1387,24 +1363,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_hdr_free + * Function: H5HF__hdr_free * * Purpose: Free shared fractal heap header * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 27 2009 * *------------------------------------------------------------------------- */ herr_t -H5HF_hdr_free(H5HF_hdr_t *hdr) +H5HF__hdr_free(H5HF_hdr_t *hdr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1412,7 +1387,7 @@ H5HF_hdr_free(H5HF_hdr_t *hdr) HDassert(hdr); /* Free the block size lookup table for the doubling table */ - if(H5HF_dtable_dest(&hdr->man_dtable) < 0) + if(H5HF__dtable_dest(&hdr->man_dtable) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap doubling table") /* Release any I/O pipeline filter information */ @@ -1425,7 +1400,7 @@ H5HF_hdr_free(H5HF_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_hdr_free() */ +} /* end H5HF__hdr_free() */ /*------------------------------------------------------------------------- @@ -1436,7 +1411,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 5 2007 * *------------------------------------------------------------------------- diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index d496d62..065e7c3 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -15,7 +15,7 @@ * * Created: H5HFhuge.c * Aug 7 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Routines for "huge" objects in fractal heap * @@ -67,7 +67,7 @@ static herr_t H5HF__huge_bt2_create(H5HF_hdr_t *hdr); /* Local 'huge' object support routines */ -static hsize_t H5HF_huge_new_id(H5HF_hdr_t *hdr); +static hsize_t H5HF__huge_new_id(H5HF_hdr_t *hdr); static herr_t H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, H5HF_operator_t op, void *op_data); @@ -95,7 +95,6 @@ static herr_t H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- @@ -168,22 +167,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_huge_init + * Function: H5HF__huge_init * * Purpose: Initialize information for tracking 'huge' objects * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_huge_init(H5HF_hdr_t *hdr) +H5HF__huge_init(H5HF_hdr_t *hdr) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -196,10 +194,6 @@ H5HF_huge_init(H5HF_hdr_t *hdr) * the file in the heap ID (which will speed up accessing it) and we don't * have any I/O pipeline filters. */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->id_len = %u\n", "H5HF_huge_init", (unsigned)hdr->id_len); -HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr->filter_len); -#endif /* QAK */ if(hdr->filter_len > 0) { if((hdr->id_len - 1) >= (unsigned)(hdr->sizeof_addr + hdr->sizeof_size + 4 + hdr->sizeof_size)) { /* Indicate that v2 B-tree doesn't have to be used to locate object */ @@ -238,11 +232,11 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr- hdr->huge_bt2 = NULL; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_huge_init() */ +} /* end H5HF__huge_init() */ /*------------------------------------------------------------------------- - * Function: H5HF_huge_new_id + * Function: H5HF__huge_new_id * * Purpose: Determine a new ID for an indirectly accessed 'huge' object * (either filtered or not) @@ -250,18 +244,17 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", "H5HF_huge_init", (unsigned)hdr- * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 15 2006 * *------------------------------------------------------------------------- */ static hsize_t -H5HF_huge_new_id(H5HF_hdr_t *hdr) +H5HF__huge_new_id(H5HF_hdr_t *hdr) { hsize_t new_id; /* New object's ID */ hsize_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -287,7 +280,7 @@ H5HF_huge_new_id(H5HF_hdr_t *hdr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_huge_new_id() */ +} /* end H5HF__huge_new_id() */ /*------------------------------------------------------------------------- @@ -298,7 +291,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- @@ -314,9 +306,6 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE -#ifdef QAK -HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); -#endif /* QAK */ /* * Check arguments. @@ -362,10 +351,6 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); if(H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &write_size, &write_buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, 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: obj_size = %Zu, obj = %p\n", FUNC, obj_size, obj); -#endif /* QAK */ /* Update size of object on disk */ write_size = nbytes; @@ -399,9 +384,6 @@ HDfprintf(stderr, "%s: obj_size = %Zu, obj = %p\n", FUNC, obj_size, obj); obj_rec.len = write_size; obj_rec.filter_mask = filter_mask; obj_rec.obj_size = obj_size; -#ifdef QAK -HDfprintf(stderr, "%s: obj_rec = {%a, %Hu, %x, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len, obj_rec.filter_mask, obj_rec.obj_size); -#endif /* QAK */ /* Insert record for object in v2 B-tree */ if(H5B2_insert(hdr->huge_bt2, &obj_rec) < 0) @@ -420,9 +402,6 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu, %x, %Hu}\n", FUNC, obj_rec.addr, obj_ /* Initialize record for tracking object in v2 B-tree */ obj_rec.addr = obj_addr; obj_rec.len = write_size; -#ifdef QAK -HDfprintf(stderr, "%s: obj_rec = {%a, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len); -#endif /* QAK */ /* Insert record for object in v2 B-tree */ if(H5B2_insert(hdr->huge_bt2, &obj_rec) < 0) @@ -441,7 +420,7 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len); hsize_t new_id; /* New ID for object */ /* Get new ID for object */ - if(0 == (new_id = H5HF_huge_new_id(hdr))) + if(0 == (new_id = H5HF__huge_new_id(hdr))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't generate new ID for object") if(hdr->filter_len > 0) { @@ -451,9 +430,6 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len); filt_indir_rec.filter_mask = filter_mask; filt_indir_rec.obj_size = obj_size; filt_indir_rec.id = new_id; -#ifdef QAK -HDfprintf(stderr, "%s: filt_indir_rec = {%a, %Hu, %x, %Hu, %Hu}\n", FUNC, filt_indir_rec.addr, filt_indir_rec.len, filt_indir_rec.filter_mask, filt_indir_rec.obj_size, filt_indir_rec.id); -#endif /* QAK */ /* Set pointer to record to insert */ ins_rec = &filt_indir_rec; @@ -463,9 +439,6 @@ HDfprintf(stderr, "%s: filt_indir_rec = {%a, %Hu, %x, %Hu, %Hu}\n", FUNC, filt_i indir_rec.addr = obj_addr; indir_rec.len = write_size; indir_rec.id = new_id; -#ifdef QAK -HDfprintf(stderr, "%s: indir_rec = {%a, %Hu, %Hu}\n", FUNC, indir_rec.addr, indir_rec.len, indir_rec.id); -#endif /* QAK */ /* Set pointer to record to insert */ ins_rec = &indir_rec; @@ -485,7 +458,7 @@ HDfprintf(stderr, "%s: indir_rec = {%a, %Hu, %Hu}\n", FUNC, indir_rec.addr, indi hdr->huge_nobjs++; /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") done: @@ -501,7 +474,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -592,7 +564,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -678,7 +649,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -829,7 +799,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 21 2007 * *------------------------------------------------------------------------- @@ -907,7 +876,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sept 11 2006 * *------------------------------------------------------------------------- @@ -943,7 +911,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sept 11 2006 * *------------------------------------------------------------------------- @@ -980,7 +947,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -1072,7 +1038,7 @@ H5HF__huge_remove(H5HF_hdr_t *hdr, const uint8_t *id) hdr->huge_nobjs--; /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") done: @@ -1088,7 +1054,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- @@ -1134,7 +1099,7 @@ H5HF__huge_term(H5HF_hdr_t *hdr) hdr->huge_ids_wrapped = FALSE; /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end if */ @@ -1152,7 +1117,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 07eb9cd..1c40d53 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -15,7 +15,7 @@ * * Created: H5HFiblock.c * Apr 10 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Indirect block routines for fractal heaps. * @@ -99,7 +99,6 @@ H5FL_SEQ_DEFINE(H5HF_indirect_ptr_t); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 17 2006 * *------------------------------------------------------------------------- @@ -166,7 +165,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 17 2006 * *------------------------------------------------------------------------- @@ -191,24 +189,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_iblock_incr + * Function: H5HF__iblock_incr * * Purpose: Increment reference count on shared indirect block * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_iblock_incr(H5HF_indirect_t *iblock) +H5HF__iblock_incr(H5HF_indirect_t *iblock) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(iblock); @@ -224,7 +221,7 @@ H5HF_iblock_incr(H5HF_indirect_t *iblock) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_iblock_incr() */ +} /* end H5HF__iblock_incr() */ /*------------------------------------------------------------------------- @@ -235,7 +232,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 27 2006 * *------------------------------------------------------------------------- @@ -299,8 +295,8 @@ H5HF__iblock_decr(H5HF_indirect_t *iblock) } /* end if */ else { /* Destroy the indirect block */ - if(H5HF_man_iblock_dest(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") + if(H5HF__man_iblock_dest(iblock) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") } /* end else */ } /* end if */ @@ -310,24 +306,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_iblock_dirty + * Function: H5HF__iblock_dirty * * Purpose: Mark indirect block as dirty * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 21 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_iblock_dirty(H5HF_indirect_t *iblock) +H5HF__iblock_dirty(H5HF_indirect_t *iblock) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(iblock); @@ -338,7 +333,7 @@ H5HF_iblock_dirty(H5HF_indirect_t *iblock) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_iblock_dirty() */ +} /* end H5HF__iblock_dirty() */ /*------------------------------------------------------------------------- @@ -349,7 +344,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -377,7 +371,7 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) nrows = hdr->man_dtable.cparam.start_root_rows; - block_row_off = H5VM_log2_of2((uint32_t)min_dblock_size) - H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size); + block_row_off = H5VM__log2_of2((uint32_t)min_dblock_size) - H5VM__log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size); if(block_row_off > 0) block_row_off++; /* Account for the pair of initial rows of the initial block size */ rows_needed = 1 + block_row_off; @@ -418,7 +412,7 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") dblock->fd_parent = iblock; - if(H5HF_man_iblock_attach(iblock, 0, hdr->man_dtable.table_addr) < 0) + if(H5HF__man_iblock_attach(iblock, 0, hdr->man_dtable.table_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't attach root direct block to parent indirect block") /* Check for I/O filters on this heap */ @@ -443,7 +437,7 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) } /* end if */ /* Start iterator at correct location */ - if(H5HF_hdr_start_iter(hdr, iblock, (hsize_t)(have_direct_block ? hdr->man_dtable.cparam.start_block_size : 0), have_direct_block) < 0) + if(H5HF__hdr_start_iter(hdr, iblock, (hsize_t)(have_direct_block ? hdr->man_dtable.cparam.start_block_size : 0), have_direct_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize block iterator") /* Check for skipping over direct blocks, in order to get to large enough block */ @@ -454,7 +448,7 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't add skipped blocks to heap's free space") /* Mark indirect block as modified */ - if(H5HF_iblock_dirty(iblock) < 0) + if(H5HF__iblock_dirty(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") /* Unprotect root indirect block (it's pinned by the iterator though) */ @@ -476,7 +470,7 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) acc_dblock_free -= hdr->man_dtable.row_tot_dblock_free[0]; /* Extend heap to cover new root indirect block */ - if(H5HF_hdr_adjust_heap(hdr, hdr->man_dtable.row_block_off[nrows], (hssize_t)acc_dblock_free) < 0) + if(H5HF__hdr_adjust_heap(hdr, hdr->man_dtable.row_block_off[nrows], (hssize_t)acc_dblock_free) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") done: @@ -492,7 +486,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -518,7 +511,7 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) FUNC_ENTER_PACKAGE /* Get "new block" iterator information */ - if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) + 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") next_size = hdr->man_dtable.row_block_size[next_row]; @@ -538,7 +531,7 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) skip_direct_rows = TRUE; /* Make certain we allocate at least the required row for the block requested */ - min_nrows = 1 + H5HF_dtable_size_to_row(&hdr->man_dtable, min_dblock_size); + min_nrows = 1 + H5HF__dtable_size_to_row(&hdr->man_dtable, min_dblock_size); /* Set the information for the next block, of the appropriate size */ new_next_entry = (min_nrows - 1) * hdr->man_dtable.cparam.width; @@ -644,7 +637,7 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) } /* end if */ /* Mark indirect block as dirty */ - if(H5HF_iblock_dirty(iblock) < 0) + if(H5HF__iblock_dirty(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") /* Update other shared header info */ @@ -652,7 +645,7 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) hdr->man_dtable.table_addr = new_addr; /* Extend heap to cover new root indirect block */ - if(H5HF_hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], (hssize_t)acc_dblock_free) < 0) + 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") done: @@ -668,7 +661,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jun 12 2006 * *------------------------------------------------------------------------- @@ -697,7 +689,7 @@ H5HF__man_iblock_root_halve(H5HF_indirect_t *iblock) max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; /* Compute new # of rows in root indirect block */ - new_nrows = (unsigned)1 << (1 + H5VM_log2_gen((uint64_t)max_child_row)); + new_nrows = (unsigned)1 << (1 + H5VM__log2_gen((uint64_t)max_child_row)); /* Check if the indirect block is NOT currently allocated in temp. file space */ /* (temp. file space does not need to be freed) */ @@ -769,7 +761,7 @@ H5HF__man_iblock_root_halve(H5HF_indirect_t *iblock) } /* end if */ /* Mark indirect block as dirty */ - if(H5HF_iblock_dirty(iblock) < 0) + if(H5HF__iblock_dirty(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") /* Update other shared header info */ @@ -777,7 +769,7 @@ H5HF__man_iblock_root_halve(H5HF_indirect_t *iblock) hdr->man_dtable.table_addr = new_addr; /* Shrink heap to only cover new root indirect block */ - if(H5HF_hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], -(hssize_t)acc_dblock_free) < 0) + 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") done: @@ -796,7 +788,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -856,11 +847,11 @@ H5HF__man_iblock_root_revert(H5HF_indirect_t *root_iblock) hdr->man_dtable.table_addr = dblock_addr; /* Reset 'next block' iterator */ - if(H5HF_hdr_reset_iter(hdr, (hsize_t)dblock_size) < 0) + if(H5HF__hdr_reset_iter(hdr, (hsize_t)dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") /* Extend heap to just cover first direct block */ - if(H5HF_hdr_adjust_heap(hdr, (hsize_t)hdr->man_dtable.cparam.start_block_size, (hssize_t)hdr->man_dtable.row_tot_dblock_free[0]) < 0) + if(H5HF__hdr_adjust_heap(hdr, (hsize_t)hdr->man_dtable.cparam.start_block_size, (hssize_t)hdr->man_dtable.row_tot_dblock_free[0]) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") /* Scan free space sections to reset any 'parent' pointers */ @@ -886,7 +877,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -919,11 +909,11 @@ H5HF__man_iblock_alloc_row(H5HF_hdr_t *hdr, H5HF_free_section_t **sec_node) HGOTO_ERROR(H5E_HEAP, H5E_CANTREVIVE, FAIL, "can't revive indirect section") /* Get a pointer to the indirect block covering the section */ - if(NULL == (iblock = H5HF_sect_row_get_iblock(old_sec_node))) + 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") /* Hold indirect block in memory, until direct block can point to it */ - if(H5HF_iblock_incr(iblock) < 0) + if(H5HF__iblock_incr(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") iblock_held = TRUE; @@ -953,7 +943,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- @@ -986,7 +975,7 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, /* Share common heap information */ iblock->hdr = hdr; - if(H5HF_hdr_incr(hdr) < 0) + if(H5HF__hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") /* Set info for indirect block */ @@ -1050,7 +1039,7 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, iblock->par_entry = par_entry; if(iblock->parent) { /* Attach new block to parent */ - if(H5HF_man_iblock_attach(iblock->parent, par_entry, *addr_p) < 0) + if(H5HF__man_iblock_attach(iblock->parent, par_entry, *addr_p) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't attach indirect block to parent indirect block") /* Compute the indirect block's offset in the heap's address space */ @@ -1080,7 +1069,7 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, done: if(ret_value < 0) if(iblock) - if(H5HF_man_iblock_dest(iblock) < 0) + if(H5HF__man_iblock_dest(iblock) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") FUNC_LEAVE_NOAPI(ret_value) @@ -1095,7 +1084,6 @@ done: * Return: Pointer to indirect block on success, NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 17 2006 * *------------------------------------------------------------------------- @@ -1226,7 +1214,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 17 2006 * *------------------------------------------------------------------------- @@ -1273,24 +1260,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_iblock_attach + * Function: H5HF__man_iblock_attach * * Purpose: Attach a child block (direct or indirect) to an indirect block * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 30 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_addr) +H5HF__man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_addr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1300,7 +1286,7 @@ H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_ad HDassert(!H5F_addr_defined(iblock->ents[entry].addr)); /* Increment the reference count on this indirect block */ - if(H5HF_iblock_incr(iblock) < 0) + if(H5HF__iblock_incr(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") /* Point at the child block */ @@ -1329,12 +1315,12 @@ H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_ad iblock->nchildren++; /* Mark indirect block as modified */ - if(H5HF_iblock_dirty(iblock) < 0) + if(H5HF__iblock_dirty(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_iblock_attach() */ +} /* end H5HF__man_iblock_attach() */ /*------------------------------------------------------------------------- @@ -1345,7 +1331,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -1451,7 +1436,7 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) /* If the indirect block wasn't removed already (by reverting it) */ if(!iblock->removed_from_cache) { /* Mark indirect block as modified */ - if(H5HF_iblock_dirty(iblock) < 0) + if(H5HF__iblock_dirty(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") /* Check for last child being removed from indirect block */ @@ -1551,22 +1536,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_iblock_entry_addr + * Function: H5HF__man_iblock_entry_addr * * Purpose: Retrieve the address of an indirect block's child * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, haddr_t *child_addr) +H5HF__man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, haddr_t *child_addr) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -1578,7 +1562,7 @@ H5HF_man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, haddr_t *chi *child_addr = iblock->ents[entry].addr; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_iblock_entry_addr() */ +} /* end H5HF__man_iblock_entry_addr() */ /*------------------------------------------------------------------------- @@ -1593,7 +1577,6 @@ H5HF_man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, haddr_t *chi * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 7 2006 * *------------------------------------------------------------------------- @@ -1653,7 +1636,7 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, row_block_size = (hsize_t)hdr->man_dtable.row_block_size[row]; /* Compute # of rows in next child indirect block to use */ - child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, row_block_size); + child_nrows = H5HF__dtable_size_to_rows(&hdr->man_dtable, row_block_size); /* Delete child indirect block */ if(H5HF__man_iblock_delete(hdr, iblock->ents[entry].addr, child_nrows, iblock, entry) < 0) @@ -1739,10 +1722,10 @@ H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr, haddr_t iblock_addr, size_t u; /* Local index variable */ entry = hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width; - first_row_bits = H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + - H5VM_log2_of2(hdr->man_dtable.cparam.width); + first_row_bits = H5VM__log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size) + + H5VM__log2_of2(hdr->man_dtable.cparam.width); num_indirect_rows = - (H5VM_log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1; + (H5VM__log2_gen(hdr->man_dtable.row_block_size[hdr->man_dtable.max_direct_rows]) - first_row_bits) + 1; for(u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++, num_indirect_rows++) { size_t v; /* Local index variable */ @@ -1774,7 +1757,6 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * Jan 14 2018 * *------------------------------------------------------------------------- @@ -1799,7 +1781,7 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, HDassert(ret_entry); /* Look up row & column for object */ - if(H5HF_dtable_lookup(&hdr->man_dtable, block_off, &row, &col) < 0) + if(H5HF__dtable_lookup(&hdr->man_dtable, block_off, &row, &col) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of block") /* Sanity check - first lookup must be an indirect block */ @@ -1823,7 +1805,7 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, prev_col = col; /* Look up row & column in new indirect block for object */ - if(H5HF_dtable_lookup(&hdr->man_dtable, (block_off - par_block_off), &row, &col) < 0) + if(H5HF__dtable_lookup(&hdr->man_dtable, (block_off - par_block_off), &row, &col) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of block") } /* end while */ @@ -1841,24 +1823,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_iblock_dest + * Function: H5HF__man_iblock_dest * * Purpose: Destroys a fractal heap indirect block in memory. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 6 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iblock_dest(H5HF_indirect_t *iblock) +H5HF__man_iblock_dest(H5HF_indirect_t *iblock) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1868,7 +1849,7 @@ H5HF_man_iblock_dest(H5HF_indirect_t *iblock) /* Decrement reference count on shared info */ HDassert(iblock->hdr); - if(H5HF_hdr_decr(iblock->hdr) < 0) + if(H5HF__hdr_decr(iblock->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") if(iblock->parent) if(H5HF__iblock_decr(iblock->parent) < 0) @@ -1887,5 +1868,5 @@ H5HF_man_iblock_dest(H5HF_indirect_t *iblock) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_iblock_dest() */ +} /* end H5HF__man_iblock_dest() */ diff --git a/src/H5HFiter.c b/src/H5HFiter.c index ceebc3b..002ff01 100644 --- a/src/H5HFiter.c +++ b/src/H5HFiter.c @@ -15,7 +15,7 @@ * * Created: H5HFiter.c * Apr 24 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Block iteration routines for fractal heaps. * @@ -77,7 +77,7 @@ H5FL_DEFINE(H5HF_block_loc_t); /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_init + * Function: H5HF__man_iter_init * * Purpose: Initialize a block iterator for walking over all the blocks * in a fractal heap. (initialization finishes when iterator is @@ -86,15 +86,14 @@ H5FL_DEFINE(H5HF_block_loc_t); * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_init(H5HF_block_iter_t *biter) +H5HF__man_iter_init(H5HF_block_iter_t *biter) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -105,7 +104,7 @@ H5HF_man_iter_init(H5HF_block_iter_t *biter) HDmemset(biter, 0, sizeof(H5HF_block_iter_t)); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_iter_init() */ +} /* end H5HF__man_iter_init() */ /*------------------------------------------------------------------------- @@ -117,7 +116,6 @@ H5HF_man_iter_init(H5HF_block_iter_t *biter) * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- @@ -212,7 +210,7 @@ H5HF__man_iter_start_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, /* Compute # of rows in context indirect block */ child_size = hdr->man_dtable.row_block_size[biter->curr->up->row]; - iblock_nrows = (H5VM_log2_gen(child_size) - hdr->man_dtable.first_row_bits) + 1; + iblock_nrows = (H5VM__log2_gen(child_size) - hdr->man_dtable.first_row_bits) + 1; } /* end else */ /* Load indirect block for this context location */ @@ -223,7 +221,7 @@ H5HF__man_iter_start_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, biter->curr->context = iblock; /* Hold the indirect block with the location */ - if(H5HF_iblock_incr(biter->curr->context) < 0) + if(H5HF__iblock_incr(biter->curr->context) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") /* Release the current indirect block */ @@ -265,22 +263,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_set_entry + * Function: H5HF__man_iter_set_entry * * Purpose: Set the current entry for the iterator * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_set_entry(const H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned entry) +H5HF__man_iter_set_entry(const H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned entry) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -293,11 +290,11 @@ H5HF_man_iter_set_entry(const H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigne biter->curr->col = entry % hdr->man_dtable.cparam.width; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_iter_set_entry() */ +} /* end H5HF__man_iter_set_entry() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_start_entry + * Function: H5HF__man_iter_start_entry * * Purpose: Initialize a block iterator to a particular location within * an indirect block @@ -305,19 +302,18 @@ H5HF_man_iter_set_entry(const H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigne * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, +H5HF__man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, H5HF_indirect_t *iblock, unsigned start_entry) { H5HF_block_loc_t *new_loc = NULL; /* Pointer to new block location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -339,7 +335,7 @@ H5HF_man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, new_loc->up = NULL; /* Increment reference count on indirect block */ - if(H5HF_iblock_incr(new_loc->context) < 0) + if(H5HF__iblock_incr(new_loc->context) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") /* Make new location the current location */ @@ -353,11 +349,11 @@ done: new_loc = H5FL_FREE(H5HF_block_loc_t, new_loc); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_iter_start_entry() */ +} /* end H5HF__man_iter_start_entry() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_reset + * Function: H5HF__man_iter_reset * * Purpose: Reset a block iterator to it's initial state, freeing any * location context it currently has @@ -365,17 +361,16 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_reset(H5HF_block_iter_t *biter) +H5HF__man_iter_reset(H5HF_block_iter_t *biter) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -414,26 +409,25 @@ H5HF_man_iter_reset(H5HF_block_iter_t *biter) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_iter_reset() */ +} /* end H5HF__man_iter_reset() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_next + * Function: H5HF__man_iter_next * * Purpose: Advance to the next block within the current block of the heap * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries) +H5HF__man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -450,29 +444,28 @@ H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries) /* HDassert(biter->curr->row <= biter->curr->context->nrows); */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_iter_next() */ +} /* end H5HF__man_iter_next() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_up + * Function: H5HF__man_iter_up * * Purpose: Move iterator up one level * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_up(H5HF_block_iter_t *biter) +H5HF__man_iter_up(H5HF_block_iter_t *biter) { H5HF_block_loc_t *up_loc; /* Pointer to 'up' block location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -498,29 +491,28 @@ H5HF_man_iter_up(H5HF_block_iter_t *biter) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_iter_up() */ +} /* end H5HF__man_iter_up() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_down + * Function: H5HF__man_iter_down * * Purpose: Move iterator down one level * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock) +H5HF__man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock) { H5HF_block_loc_t *down_loc = NULL; /* Pointer to new 'down' block location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -542,7 +534,7 @@ H5HF_man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock) down_loc->up = biter->curr; /* Increment reference count on indirect block */ - if(H5HF_iblock_incr(down_loc->context) < 0) + if(H5HF__iblock_incr(down_loc->context) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") /* Make down location the current location */ @@ -553,27 +545,26 @@ done: down_loc = H5FL_FREE(H5HF_block_loc_t, down_loc); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_man_iter_down() */ +} /* end H5HF__man_iter_down() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_curr + * Function: H5HF__man_iter_curr * * Purpose: Retrieve information about the current block iterator location * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, +H5HF__man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, unsigned *entry, H5HF_indirect_t **block) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -592,66 +583,25 @@ H5HF_man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, *block = biter->curr->context; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_iter_curr() */ - - -/*------------------------------------------------------------------------- - * Function: H5HF_man_iter_offset - * - * Purpose: Retrieve offset of iterator in heap - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Apr 25 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5HF_man_iter_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, hsize_t *offset) -{ - hsize_t curr_offset; /* For computing offset in heap */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* - * Check arguments. - */ - HDassert(biter); - HDassert(biter->ready); - HDassert(biter->curr->context); - HDassert(offset); - - /* Compute the offset in the heap */ - curr_offset = biter->curr->context->block_off; - curr_offset += hdr->man_dtable.row_block_off[biter->curr->row]; - curr_offset += biter->curr->col * hdr->man_dtable.row_block_size[biter->curr->row]; - - /* Assign the return value */ - *offset = curr_offset; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_iter_offset() */ +} /* end H5HF__man_iter_curr() */ /*------------------------------------------------------------------------- - * Function: H5HF_man_iter_ready + * Function: H5HF__man_iter_ready * * Purpose: Query if iterator is ready to use * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Apr 25 2006 * *------------------------------------------------------------------------- */ hbool_t -H5HF_man_iter_ready(H5HF_block_iter_t *biter) +H5HF__man_iter_ready(H5HF_block_iter_t *biter) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -659,5 +609,5 @@ H5HF_man_iter_ready(H5HF_block_iter_t *biter) HDassert(biter); FUNC_LEAVE_NOAPI(biter->ready) -} /* end H5HF_man_iter_ready() */ +} /* end H5HF__man_iter_ready() */ diff --git a/src/H5HFman.c b/src/H5HFman.c index ea00546..7a2f93c 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -15,7 +15,7 @@ * * Created: H5HFman.c * Feb 24 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: "Managed" object routines for fractal heaps. * @@ -97,7 +97,6 @@ static herr_t H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 13 2006 * *------------------------------------------------------------------------- @@ -154,7 +153,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) HDassert(sec_node->sect_info.state == H5FS_SECT_LIVE); /* Retrieve direct block address from section */ - if(H5HF_sect_single_dblock_info(hdr, sec_node, &dblock_addr, &dblock_size) < 0) + if(H5HF__sect_single_dblock_info(hdr, sec_node, &dblock_addr, &dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") /* Lock direct block */ @@ -197,7 +196,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) hdr->man_nobjs++; /* Reduce space available in heap (marks header dirty) */ - if(H5HF_hdr_adj_free(hdr, -(ssize_t)obj_size) < 0) + if(H5HF__hdr_adj_free(hdr, -(ssize_t)obj_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap") done: @@ -215,22 +214,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_man_get_obj_len + * Function: H5HF__man_get_obj_len * * Purpose: Get the size of a managed heap object * * Return: SUCCEED (Can't fail) * - * Programmer: Dana Robinson (derobins@hdfgroup.org) + * Programmer: Dana Robinson * August 2012 * *------------------------------------------------------------------------- */ herr_t -H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) +H5HF__man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -249,7 +248,7 @@ H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) UINT64DECODE_VAR(id, *obj_len_p, hdr->heap_len_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_man_get_obj_len() */ +} /* end H5HF__man_get_obj_len() */ /*------------------------------------------------------------------------- @@ -260,7 +259,6 @@ H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) * Return: SUCCEED (Can't fail) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 20 2015 * *------------------------------------------------------------------------- @@ -296,7 +294,6 @@ H5HF__man_get_obj_off(const H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 17 2006 * *------------------------------------------------------------------------- @@ -445,7 +442,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Mar 17 2006 * *------------------------------------------------------------------------- @@ -465,7 +461,7 @@ H5HF__man_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) HDassert(obj); /* Call the internal 'op' routine routine */ - if(H5HF__man_op_real(hdr, id, H5HF_op_read, obj, 0) < 0) + if(H5HF__man_op_real(hdr, id, H5HF__op_read, obj, 0) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") done: @@ -481,7 +477,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * *------------------------------------------------------------------------- @@ -502,7 +497,7 @@ H5HF__man_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj) /* Call the internal 'op' routine routine */ /* (Casting away const OK - QAK) */ - if(H5HF__man_op_real(hdr, id, H5HF_op_write, (void *)obj, H5HF_OP_MODIFY) < 0) + if(H5HF__man_op_real(hdr, id, H5HF__op_write, (void *)obj, H5HF_OP_MODIFY) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") done: @@ -518,7 +513,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Sept 11 2006 * *------------------------------------------------------------------------- @@ -554,7 +548,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 15 2006 * *------------------------------------------------------------------------- @@ -643,7 +636,7 @@ H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id) HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object overruns end of direct block") /* Create free space section node */ - if(NULL == (sec_node = H5HF_sect_single_new(obj_off, obj_len, iblock, dblock_entry))) + 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") /* Unlock indirect block */ @@ -654,7 +647,7 @@ H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id) } /* end if */ /* Increase space available in heap (marks header dirty) */ - if(H5HF_hdr_adj_free(hdr, (ssize_t)obj_len) < 0) + if(H5HF__hdr_adj_free(hdr, (ssize_t)obj_len) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap") /* Update statistics about heap */ diff --git a/src/H5HFmodule.h b/src/H5HFmodule.h index dd6576a..0334673 100644 --- a/src/H5HFmodule.h +++ b/src/H5HFmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 83e46fc..ca05798 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, February 24, 2006 * * Purpose: This file contains declarations which are visible only within @@ -134,7 +134,7 @@ /* Compute the # of bytes required to store an offset into a given buffer size */ #define H5HF_SIZEOF_OFFSET_BITS(b) (((b) + 7) / 8) -#define H5HF_SIZEOF_OFFSET_LEN(l) H5HF_SIZEOF_OFFSET_BITS(H5VM_log2_of2((unsigned)(l))) +#define H5HF_SIZEOF_OFFSET_LEN(l) H5HF_SIZEOF_OFFSET_BITS(H5VM__log2_of2((unsigned)(l))) /* Heap ID bit flags */ /* Heap ID version (2 bits: 6-7) */ @@ -220,9 +220,6 @@ typedef struct H5HF_dtable_t { /* Fractal heap free list info (forward decl - defined in H5HFflist.c) */ typedef struct H5HF_freelist_t H5HF_freelist_t; -/* Forward decl indirect block info */ -typedef struct H5HF_indirect_t H5HF_indirect_t; - /* Fractal heap block location */ typedef struct H5HF_block_loc_t { /* Necessary table fields */ @@ -293,7 +290,7 @@ typedef struct H5HF_free_section_t { /* (Each fractal heap header has certain information that is shared across all * the instances of blocks in that fractal heap) */ -typedef struct H5HF_hdr_t { +struct H5HF_hdr_t { /* Information for H5AC cache functions, _must_ be first field in structure */ H5AC_info_t cache_info; @@ -358,7 +355,7 @@ typedef struct H5HF_hdr_t { uint8_t heap_off_size; /* Size of heap offsets (in bytes) */ uint8_t heap_len_size; /* Size of heap ID lengths (in bytes) */ hbool_t checked_filters; /* TRUE if pipeline passes can_apply checks */ -} H5HF_hdr_t; +}; /* Common indirect block doubling table entry */ /* (common between entries pointing to direct & indirect child blocks) */ @@ -606,46 +603,45 @@ H5FL_BLK_EXTERN(direct_block); /******************************/ /* Doubling table routines */ -H5_DLL herr_t H5HF_dtable_init(H5HF_dtable_t *dtable); -H5_DLL herr_t H5HF_dtable_dest(H5HF_dtable_t *dtable); -H5_DLL herr_t H5HF_dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, +H5_DLL herr_t H5HF__dtable_init(H5HF_dtable_t *dtable); +H5_DLL herr_t H5HF__dtable_dest(H5HF_dtable_t *dtable); +H5_DLL herr_t H5HF__dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, unsigned *col); -H5_DLL unsigned H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size); -H5_DLL unsigned H5HF_dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size); -H5_DLL hsize_t H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, +H5_DLL unsigned H5HF__dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size); +H5_DLL unsigned H5HF__dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size); +H5_DLL hsize_t H5HF__dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned start_col, unsigned num_entries); /* Heap header routines */ -H5_DLL H5HF_hdr_t * H5HF_hdr_alloc(H5F_t *f); -H5_DLL haddr_t H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam); +H5_DLL H5HF_hdr_t * H5HF__hdr_alloc(H5F_t *f); +H5_DLL haddr_t H5HF__hdr_create(H5F_t *f, const H5HF_create_t *cparam); H5_DLL H5HF_hdr_t *H5HF__hdr_protect(H5F_t *f, haddr_t addr, unsigned flags); -H5_DLL herr_t H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_finish_init_phase2(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_finish_init(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_incr(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_decr(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_fuse_incr(H5HF_hdr_t *hdr); -H5_DLL size_t H5HF_hdr_fuse_decr(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_dirty(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt); -H5_DLL herr_t H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free); -H5_DLL herr_t H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size); -H5_DLL herr_t H5HF_hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, unsigned curr_entry); +H5_DLL herr_t H5HF__hdr_finish_init_phase1(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_finish_init_phase2(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_finish_init(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_incr(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_decr(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_fuse_incr(H5HF_hdr_t *hdr); +H5_DLL size_t H5HF__hdr_fuse_decr(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_dirty(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt); +H5_DLL herr_t H5HF__hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free); +H5_DLL herr_t H5HF__hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size); +H5_DLL herr_t H5HF__hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, unsigned curr_entry); H5_DLL herr_t H5HF__hdr_skip_blocks(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start_entry, unsigned nentries); H5_DLL herr_t H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size); -H5_DLL herr_t H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries); +H5_DLL herr_t H5HF__hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries); H5_DLL herr_t H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr); -H5_DLL herr_t H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off); +H5_DLL herr_t H5HF__hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off); H5_DLL herr_t H5HF__hdr_empty(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_free(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__hdr_free(H5HF_hdr_t *hdr); H5_DLL herr_t H5HF__hdr_delete(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_hdr_dest(H5HF_hdr_t *hdr); /* Indirect block routines */ -H5_DLL herr_t H5HF_iblock_incr(H5HF_indirect_t *iblock); +H5_DLL herr_t H5HF__iblock_incr(H5HF_indirect_t *iblock); H5_DLL herr_t H5HF__iblock_decr(H5HF_indirect_t *iblock); -H5_DLL herr_t H5HF_iblock_dirty(H5HF_indirect_t *iblock); +H5_DLL herr_t H5HF__iblock_dirty(H5HF_indirect_t *iblock); H5_DLL herr_t H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size); H5_DLL herr_t H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, @@ -659,10 +655,10 @@ H5_DLL H5HF_indirect_t *H5HF__man_iblock_protect(H5HF_hdr_t *hdr, haddr_t iblock hbool_t must_protect, unsigned flags, hbool_t *did_protect); H5_DLL herr_t H5HF__man_iblock_unprotect(H5HF_indirect_t *iblock, unsigned cache_flags, hbool_t did_protect); -H5_DLL herr_t H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, +H5_DLL herr_t H5HF__man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t dblock_addr); H5_DLL herr_t H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry); -H5_DLL herr_t H5HF_man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, +H5_DLL herr_t H5HF__man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, haddr_t *child_addr); H5_DLL herr_t H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_nrows, H5HF_indirect_t *par_iblock, unsigned par_entry); @@ -670,7 +666,7 @@ H5_DLL herr_t H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned nrows, H5HF_indirect_t *par_iblock, unsigned par_entry, hsize_t *heap_size/*out*/); H5_DLL herr_t H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, hsize_t *ret_par_block_off, unsigned *ret_entry); -H5_DLL herr_t H5HF_man_iblock_dest(H5HF_indirect_t *iblock); +H5_DLL herr_t H5HF__man_iblock_dest(H5HF_indirect_t *iblock); /* Direct block routines */ H5_DLL herr_t H5HF__man_dblock_new(H5HF_hdr_t *fh, size_t request, @@ -688,12 +684,12 @@ H5_DLL herr_t H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, unsigned flags); H5_DLL herr_t H5HF__man_dblock_delete(H5F_t *f, haddr_t dblock_addr, hsize_t dblock_size); -H5_DLL herr_t H5HF_man_dblock_dest(H5HF_direct_t *dblock); +H5_DLL herr_t H5HF__man_dblock_dest(H5HF_direct_t *dblock); /* Managed object routines */ H5_DLL herr_t H5HF__man_insert(H5HF_hdr_t *fh, size_t obj_size, const void *obj, void *id); -H5_DLL herr_t H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, +H5_DLL herr_t H5HF__man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p); H5_DLL void H5HF__man_get_obj_off(const H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off_p); @@ -704,7 +700,7 @@ H5_DLL herr_t H5HF__man_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t o H5_DLL herr_t H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id); /* 'Huge' object routines */ -H5_DLL herr_t H5HF_huge_init(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__huge_init(H5HF_hdr_t *hdr); H5_DLL herr_t H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *id); H5_DLL herr_t H5HF__huge_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, @@ -731,46 +727,32 @@ H5_DLL herr_t H5HF__huge_bt2_filt_dir_found(const void *nrecord, void *op_data); H5_DLL herr_t H5HF__huge_bt2_filt_dir_remove(const void *nrecord, void *op_data); /* 'Tiny' object routines */ -H5_DLL herr_t H5HF_tiny_init(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, +H5_DLL herr_t H5HF__tiny_init(H5HF_hdr_t *hdr); +H5_DLL herr_t H5HF__tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *id); -H5_DLL herr_t H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, +H5_DLL herr_t H5HF__tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p); -H5_DLL herr_t H5HF_tiny_read(H5HF_hdr_t *fh, const uint8_t *id, void *obj); -H5_DLL herr_t H5HF_tiny_op(H5HF_hdr_t *hdr, const uint8_t *id, +H5_DLL herr_t H5HF__tiny_read(H5HF_hdr_t *fh, const uint8_t *id, void *obj); +H5_DLL herr_t H5HF__tiny_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_data); -H5_DLL herr_t H5HF_tiny_remove(H5HF_hdr_t *fh, const uint8_t *id); - -/* Debugging routines for dumping file structures */ -H5_DLL void H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, - FILE *stream, int indent, int fwidth); -H5_DLL herr_t H5HF_hdr_debug(H5F_t *f, haddr_t addr, - FILE *stream, int indent, int fwidth); -H5_DLL herr_t H5HF_dblock_debug(H5F_t *f, haddr_t addr, - FILE *stream, int indent, int fwidth, haddr_t hdr_addr, size_t nrec); -H5_DLL void H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, - FILE *stream, int indent, int fwidth); -H5_DLL herr_t H5HF_iblock_debug(H5F_t *f, haddr_t addr, - FILE *stream, int indent, int fwidth, haddr_t hdr_addr, unsigned nrows); +H5_DLL herr_t H5HF__tiny_remove(H5HF_hdr_t *fh, const uint8_t *id); /* Block iteration routines */ -H5_DLL herr_t H5HF_man_iter_init(H5HF_block_iter_t *biter); +H5_DLL herr_t H5HF__man_iter_init(H5HF_block_iter_t *biter); H5_DLL herr_t H5HF__man_iter_start_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, hsize_t offset); -H5_DLL herr_t H5HF_man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, +H5_DLL herr_t H5HF__man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, H5HF_indirect_t *iblock, unsigned start_entry); -H5_DLL herr_t H5HF_man_iter_set_entry(const H5HF_hdr_t *hdr, +H5_DLL herr_t H5HF__man_iter_set_entry(const H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned entry); -H5_DLL herr_t H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, +H5_DLL herr_t H5HF__man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries); -H5_DLL herr_t H5HF_man_iter_up(H5HF_block_iter_t *biter); -H5_DLL herr_t H5HF_man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock); -H5_DLL herr_t H5HF_man_iter_reset(H5HF_block_iter_t *biter); -H5_DLL herr_t H5HF_man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, +H5_DLL herr_t H5HF__man_iter_up(H5HF_block_iter_t *biter); +H5_DLL herr_t H5HF__man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock); +H5_DLL herr_t H5HF__man_iter_reset(H5HF_block_iter_t *biter); +H5_DLL herr_t H5HF__man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, unsigned *entry, H5HF_indirect_t **block); -H5_DLL herr_t H5HF_man_iter_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, - hsize_t *offset); -H5_DLL hbool_t H5HF_man_iter_ready(H5HF_block_iter_t *biter); +H5_DLL hbool_t H5HF__man_iter_ready(H5HF_block_iter_t *biter); /* Free space manipulation routines */ H5_DLL herr_t H5HF__space_start(H5HF_hdr_t *hdr, hbool_t may_create); @@ -789,24 +771,24 @@ H5_DLL herr_t H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, uint16_t new_class); /* Free space section routines */ -H5_DLL H5HF_free_section_t *H5HF_sect_single_new(hsize_t sect_off, +H5_DLL H5HF_free_section_t *H5HF__sect_single_new(hsize_t sect_off, size_t sect_size, H5HF_indirect_t *parent, unsigned par_entry); H5_DLL herr_t H5HF__sect_single_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); -H5_DLL herr_t H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, +H5_DLL herr_t H5HF__sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, haddr_t *dblock_addr, size_t *dblock_size); H5_DLL herr_t H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, size_t amt); H5_DLL herr_t H5HF__sect_row_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); H5_DLL herr_t H5HF__sect_row_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned *entry_p); -H5_DLL H5HF_indirect_t *H5HF_sect_row_get_iblock(H5HF_free_section_t *sect); +H5_DLL H5HF_indirect_t *H5HF__sect_row_get_iblock(H5HF_free_section_t *sect); H5_DLL herr_t H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start_entry, unsigned nentries); H5_DLL herr_t H5HF__sect_single_free(H5FS_section_info_t *sect); /* Internal operator callbacks */ -H5_DLL herr_t H5HF_op_read(const void *obj, size_t obj_len, void *op_data); -H5_DLL herr_t H5HF_op_write(const void *obj, size_t obj_len, void *op_data); +H5_DLL herr_t H5HF__op_read(const void *obj, size_t obj_len, void *op_data); +H5_DLL herr_t H5HF__op_write(const void *obj, size_t obj_len, void *op_data); /* Testing routines */ #ifdef H5HF_TESTING diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h index 4eec1c1..4919b90 100644 --- a/src/H5HFprivate.h +++ b/src/H5HFprivate.h @@ -15,7 +15,7 @@ * * Created: H5HFprivate.h * Feb 24 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Private header for library accessible fractal heap routines. * @@ -86,8 +86,10 @@ typedef struct H5HF_stat_t { hsize_t tiny_nobjs; /* Number of 'tiny' objects in heap */ } H5HF_stat_t; -/* Fractal heap info (forward decl - defined in H5HFpkg.h) */ +/* Fractal heap info (forward decls - defined in H5HFpkg.h) */ typedef struct H5HF_t H5HF_t; +typedef struct H5HF_hdr_t H5HF_hdr_t; +typedef struct H5HF_indirect_t H5HF_indirect_t; /* Typedef for 'op' operations */ typedef herr_t (*H5HF_operator_t)(const void *obj/*in*/, size_t obj_len, @@ -128,5 +130,17 @@ H5_DLL herr_t H5HF_id_print(H5HF_t *fh, const void *id, FILE *stream, int indent H5_DLL herr_t H5HF_sects_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth); #endif /* H5HF_DEBUGGING */ +/* Debugging routines for dumping file structures */ +H5_DLL void H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, + FILE *stream, int indent, int fwidth); +H5_DLL herr_t H5HF_hdr_debug(H5F_t *f, haddr_t addr, + FILE *stream, int indent, int fwidth); +H5_DLL herr_t H5HF_dblock_debug(H5F_t *f, haddr_t addr, + FILE *stream, int indent, int fwidth, haddr_t hdr_addr, size_t nrec); +H5_DLL void H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, + FILE *stream, int indent, int fwidth); +H5_DLL herr_t H5HF_iblock_debug(H5F_t *f, haddr_t addr, + FILE *stream, int indent, int fwidth, haddr_t hdr_addr, unsigned nrows); + #endif /* _H5HFprivate_H */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index a0f984b..b2d1e3c 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 1, 2006 * * Purpose: Free space section routines for fractal heaps @@ -68,12 +68,12 @@ typedef struct { /********************/ /* Shared routines */ -static herr_t H5HF_sect_init_cls(H5FS_section_class_t *cls, +static herr_t H5FS__sect_init_cls(H5FS_section_class_t *cls, H5HF_hdr_t *hdr); -static herr_t H5HF_sect_term_cls(H5FS_section_class_t *cls); -static H5HF_free_section_t *H5HF_sect_node_new(unsigned sect_type, +static herr_t H5FS__sect_term_cls(H5FS_section_class_t *cls); +static H5HF_free_section_t *H5FS__sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, H5FS_section_state_t state); -static herr_t H5HF_sect_node_free(H5HF_free_section_t *sect, +static herr_t H5HF__sect_node_free(H5HF_free_section_t *sect, H5HF_indirect_t *parent); /* 'single' section routines */ @@ -99,12 +99,12 @@ static herr_t H5HF__sect_single_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *sect); /* 'row' section routines */ -static H5HF_free_section_t *H5HF_sect_row_create(haddr_t sect_off, +static H5HF_free_section_t *H5HF__sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, unsigned row, unsigned col, unsigned nentries, H5HF_free_section_t *under_sect); static herr_t H5HF__sect_row_first(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); static herr_t H5HF__sect_row_parent_removed(H5HF_free_section_t *sect); -static herr_t H5HF_sect_row_from_single(H5HF_hdr_t *hdr, +static herr_t H5HF__sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_direct_t *dblock); static herr_t H5HF__sect_row_free_real(H5HF_free_section_t *sect); @@ -131,7 +131,7 @@ static herr_t H5HF__sect_row_debug(const H5FS_section_info_t *sect, FILE *stream, int indent, int fwidth); /* 'indirect' section routines */ -static H5HF_free_section_t *H5HF_sect_indirect_new(H5HF_hdr_t *hdr, +static H5HF_free_section_t *H5HF__sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, H5HF_indirect_t *iblock, hsize_t iblock_off, unsigned row, unsigned col, unsigned nentries); @@ -139,9 +139,9 @@ static herr_t H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t hbool_t first_child, H5HF_free_section_t **first_row_sect, unsigned space_flags, unsigned start_row, unsigned start_col, unsigned end_row, unsigned end_col); -static H5HF_free_section_t *H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, +static H5HF_free_section_t *H5HF__sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, H5HF_free_section_t *row_sect); -static herr_t H5HF_sect_indirect_decr(H5HF_free_section_t *sect); +static herr_t H5HF__sect_indirect_decr(H5HF_free_section_t *sect); static herr_t H5HF__sect_indirect_revive_row(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); static herr_t H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, @@ -152,28 +152,28 @@ static herr_t H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned child_entry); static herr_t H5HF__sect_indirect_first(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); -static hbool_t H5HF_sect_indirect_is_first(H5HF_free_section_t *sect); -static H5HF_indirect_t * H5HF_sect_indirect_get_iblock(H5HF_free_section_t *sect); -static hsize_t H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect); -static H5HF_free_section_t * H5HF_sect_indirect_top(H5HF_free_section_t *sect); +static hbool_t H5HF__sect_indirect_is_first(H5HF_free_section_t *sect); +static H5HF_indirect_t * H5HF__sect_indirect_get_iblock(H5HF_free_section_t *sect); +static hsize_t H5HF__sect_indirect_iblock_off(const H5HF_free_section_t *sect); +static H5HF_free_section_t *H5HF__sect_indirect_top(H5HF_free_section_t *sect); static herr_t H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *sect1, H5HF_free_section_t *sect2); static herr_t H5HF__sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); static herr_t H5HF__sect_indirect_shrink(H5HF_hdr_t *hdr, H5HF_free_section_t *sect); -static herr_t H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, +static herr_t H5HF__sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, uint8_t *buf); static H5FS_section_info_t *H5HF__sect_indirect_deserialize(H5HF_hdr_t *hdr, const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size, unsigned *des_flags); -static herr_t H5HF_sect_indirect_free(H5HF_free_section_t *sect); -static herr_t H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, +static herr_t H5HF__sect_indirect_free(H5HF_free_section_t *sect); +static herr_t H5HF__sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect); -static herr_t H5HF_sect_indirect_debug(const H5HF_free_section_t *sect, +static herr_t H5HF__sect_indirect_debug(const H5HF_free_section_t *sect, FILE *stream, int indent, int fwidth); /* 'indirect' section callbacks */ -static herr_t H5HF_sect_indirect_init_cls(H5FS_section_class_t *cls, void *udata); -static herr_t H5HF_sect_indirect_term_cls(H5FS_section_class_t *cls); +static herr_t H5HF__sect_indirect_init_cls(H5FS_section_class_t *cls, void *udata); +static herr_t H5HF__sect_indirect_term_cls(H5FS_section_class_t *cls); /*********************/ @@ -273,8 +273,8 @@ H5FS_section_class_t H5HF_FSPACE_SECT_CLS_INDIRECT[1] = {{ NULL, /* Class private info */ /* Class methods */ - H5HF_sect_indirect_init_cls, /* Initialize section class */ - H5HF_sect_indirect_term_cls, /* Terminate section class */ + H5HF__sect_indirect_init_cls, /* Initialize section class */ + H5HF__sect_indirect_term_cls, /* Terminate section class */ /* Object methods */ NULL, /* Add section */ @@ -306,7 +306,7 @@ H5FL_DEFINE(H5HF_free_section_t); /*------------------------------------------------------------------------- - * Function: H5HF_sect_init_cls + * Function: H5FS__sect_init_cls * * Purpose: Initialize the common class structure * @@ -319,12 +319,12 @@ H5FL_DEFINE(H5HF_free_section_t); *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_init_cls(H5FS_section_class_t *cls, H5HF_hdr_t *hdr) +H5FS__sect_init_cls(H5FS_section_class_t *cls, H5HF_hdr_t *hdr) { H5HF_sect_private_t *cls_prvt; /* Pointer to class private info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(cls); @@ -339,16 +339,16 @@ H5HF_sect_init_cls(H5FS_section_class_t *cls, H5HF_hdr_t *hdr) cls->cls_private = cls_prvt; /* Increment reference count on heap header */ - if(H5HF_hdr_incr(hdr) < 0) + if(H5HF__hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_init_cls() */ +} /* H5FS__sect_init_cls() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_term_cls + * Function: H5FS__sect_term_cls * * Purpose: Terminate the common class structure * @@ -361,12 +361,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_term_cls(H5FS_section_class_t *cls) +H5FS__sect_term_cls(H5FS_section_class_t *cls) { H5HF_sect_private_t *cls_prvt; /* Pointer to class private info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(cls); @@ -375,7 +375,7 @@ H5HF_sect_term_cls(H5FS_section_class_t *cls) cls_prvt = (H5HF_sect_private_t *)cls->cls_private; /* Decrement reference count on heap header */ - if(H5HF_hdr_decr(cls_prvt->hdr) < 0) + if(H5HF__hdr_decr(cls_prvt->hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") /* Free the class private information */ @@ -383,11 +383,11 @@ H5HF_sect_term_cls(H5FS_section_class_t *cls) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_term_cls() */ +} /* H5FS__sect_term_cls() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_node_new + * Function: H5FS__sect_node_new * * Purpose: Allocate a free space section node of a particular type * @@ -401,13 +401,13 @@ done: *------------------------------------------------------------------------- */ static H5HF_free_section_t * -H5HF_sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, +H5FS__sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, H5FS_section_state_t sect_state) { H5HF_free_section_t *new_sect; /* New section */ H5HF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(H5F_addr_defined(sect_addr)); @@ -429,11 +429,11 @@ H5HF_sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_node_new() */ +} /* H5FS__sect_node_new() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_node_free + * Function: H5HF__sect_node_free * * Purpose: Free a section node * @@ -447,11 +447,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_node_free(H5HF_free_section_t *sect, H5HF_indirect_t *iblock) +H5HF__sect_node_free(H5HF_free_section_t *sect, H5HF_indirect_t *iblock) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(sect); @@ -465,30 +465,29 @@ H5HF_sect_node_free(H5HF_free_section_t *sect, H5HF_indirect_t *iblock) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_node_free() */ +} /* H5HF__sect_node_free() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_single_new + * Function: H5HF__sect_single_new * * Purpose: Create a new 'single' section and return it to the caller * * Return: Pointer to new section on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 30 2006 * *------------------------------------------------------------------------- */ H5HF_free_section_t * -H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, +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 */ H5HF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -496,13 +495,13 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, HDassert(sect_size); /* Create free space section node */ - if(NULL == (sect = H5HF_sect_node_new(H5HF_FSPACE_SECT_SINGLE, sect_off, (hsize_t)sect_size, H5FS_SECT_LIVE))) + if(NULL == (sect = H5FS__sect_node_new(H5HF_FSPACE_SECT_SINGLE, sect_off, (hsize_t)sect_size, H5FS_SECT_LIVE))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for single section") /* Set the 'single' specific fields */ sect->u.single.parent = parent; if(sect->u.single.parent) { - if(H5HF_iblock_incr(sect->u.single.parent) < 0) + 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") } /* end if */ sect->u.single.par_entry = par_entry; @@ -517,7 +516,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_single_new() */ +} /* end H5HF__sect_single_new() */ /*------------------------------------------------------------------------- @@ -528,7 +527,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * October 24 2006 * *------------------------------------------------------------------------- @@ -556,7 +554,7 @@ H5HF__sect_single_locate_parent(H5HF_hdr_t *hdr, hbool_t refresh, HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") /* Increment reference count on indirect block that free section is in */ - if(H5HF_iblock_incr(sec_iblock) < 0) + if(H5HF__iblock_incr(sec_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") /* Check for refreshing existing parent information */ @@ -590,7 +588,6 @@ done: * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * May 8 2006 * *------------------------------------------------------------------------- @@ -631,23 +628,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_single_dblock_info + * Function: H5HF__sect_single_dblock_info * * Purpose: Retrieve the direct block information for a single section * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * October 24 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, +H5HF__sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, haddr_t *dblock_addr, size_t *dblock_size) { - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -673,7 +669,7 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_sect_single_dblock_info() */ +} /* end H5HF__sect_single_dblock_info() */ /*------------------------------------------------------------------------- @@ -686,7 +682,6 @@ H5HF_sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 31 2006 * *------------------------------------------------------------------------- @@ -752,7 +747,7 @@ H5HF__sect_single_full_dblock(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) size_t dblock_overhead; /* Direct block's overhead */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sect); @@ -760,7 +755,7 @@ H5HF__sect_single_full_dblock(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) HDassert(hdr); /* Retrieve direct block address from section */ - if(H5HF_sect_single_dblock_info(hdr, sect, &dblock_addr, &dblock_size) < 0) + if(H5HF__sect_single_dblock_info(hdr, sect, &dblock_addr, &dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") /* Check for section occupying entire direct block */ @@ -776,7 +771,7 @@ H5HF__sect_single_full_dblock(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) HDassert(H5F_addr_eq(dblock->block_off + dblock_overhead, sect->sect_info.addr)); /* Convert 'single' section into 'row' section */ - if(H5HF_sect_row_from_single(hdr, sect, dblock) < 0) + 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") /* Destroy direct block */ @@ -876,7 +871,7 @@ H5HF__sect_single_deserialize(const H5FS_section_class_t H5_ATTR_UNUSED *cls, HDassert(sect_size); /* Create free list section node */ - if(NULL == (new_sect = H5HF_sect_node_new(H5HF_FSPACE_SECT_SINGLE, sect_addr, sect_size, H5FS_SECT_SERIALIZED))) + if(NULL == (new_sect = H5FS__sect_node_new(H5HF_FSPACE_SECT_SINGLE, sect_addr, sect_size, H5FS_SECT_SERIALIZED))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "allocation failed for direct block free list section") /* Set return value */ @@ -1086,7 +1081,7 @@ H5HF__sect_single_shrink(H5FS_section_info_t **_sect, void *_udata) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section") /* Retrieve direct block address from section */ - if(H5HF_sect_single_dblock_info(hdr, (*sect), &dblock_addr, &dblock_size) < 0) + if(H5HF__sect_single_dblock_info(hdr, (*sect), &dblock_addr, &dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") /* Protect the direct block for the section */ @@ -1140,14 +1135,13 @@ H5HF__sect_single_free(H5FS_section_info_t *_sect) HDassert(sect); /* Check for live reference to an indirect block */ - if(sect->sect_info.state == H5FS_SECT_LIVE) { + if(sect->sect_info.state == H5FS_SECT_LIVE) /* Get parent indirect block, if there was one */ if(sect->u.single.parent) parent = sect->u.single.parent; - } /* end if */ /* Release the section */ - if(H5HF_sect_node_free(sect, parent) < 0) + if(H5HF__sect_node_free(sect, parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node") done: @@ -1194,7 +1188,7 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5 HDassert(H5F_addr_defined(iblock->ents[sect->u.single.par_entry].addr)); /* Retrieve direct block address from section */ - status = H5HF_sect_single_dblock_info(iblock->hdr, (const H5HF_free_section_t *)sect, &dblock_addr, &dblock_size); + status = H5HF__sect_single_dblock_info(iblock->hdr, (const H5HF_free_section_t *)sect, &dblock_addr, &dblock_size); HDassert(status >= 0); HDassert(H5F_addr_eq(iblock->ents[sect->u.single.par_entry].addr, dblock_addr)); HDassert(dblock_size > 0); @@ -1239,7 +1233,7 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5 /*------------------------------------------------------------------------- - * Function: H5HF_sect_row_create + * Function: H5HF__sect_row_create * * Purpose: Create a new 'row' section * @@ -1253,13 +1247,13 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5 *------------------------------------------------------------------------- */ static H5HF_free_section_t * -H5HF_sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, +H5HF__sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, unsigned row, unsigned col, unsigned nentries, H5HF_free_section_t *under_sect) { H5HF_free_section_t *sect = NULL; /* 'Row' section created */ H5HF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sect_size); @@ -1268,7 +1262,7 @@ H5HF_sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, /* Create 'row' free space section node */ /* ("inherits" underlying indirect section's state) */ - if(NULL == (sect = H5HF_sect_node_new((unsigned)(is_first ? H5HF_FSPACE_SECT_FIRST_ROW : H5HF_FSPACE_SECT_NORMAL_ROW), sect_off, sect_size, under_sect->sect_info.state))) + if(NULL == (sect = H5FS__sect_node_new((unsigned)(is_first ? H5HF_FSPACE_SECT_FIRST_ROW : H5HF_FSPACE_SECT_NORMAL_ROW), sect_off, sect_size, under_sect->sect_info.state))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for row section") /* Set the 'row' specific fields */ @@ -1283,29 +1277,28 @@ H5HF_sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_row_create() */ +} /* H5HF__sect_row_create() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_row_from_single + * Function: H5HF__sect_row_from_single * * Purpose: Convert a 'single' section into a 'row' section * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, +H5HF__sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_direct_t *dblock) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -1323,7 +1316,7 @@ H5HF_sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, sect->u.row.checked_out = FALSE; /* Create indirect section that underlies the row section */ - if(NULL == (sect->u.row.under = H5HF_sect_indirect_for_row(hdr, dblock->parent, sect))) + if(NULL == (sect->u.row.under = H5HF__sect_indirect_for_row(hdr, dblock->parent, sect))) HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "serializing row section not supported yet") /* Release single section's hold on underlying indirect block */ @@ -1332,7 +1325,7 @@ H5HF_sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_row_from_single() */ +} /* end H5HF__sect_row_from_single() */ /*------------------------------------------------------------------------- @@ -1343,7 +1336,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -1391,7 +1383,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -1467,7 +1458,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -1501,24 +1491,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_row_get_iblock + * Function: H5HF__sect_row_get_iblock * * Purpose: Retrieve the indirect block for a row section * * Return: Pointer to indirect block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 9 2006 * *------------------------------------------------------------------------- */ H5HF_indirect_t * -H5HF_sect_row_get_iblock(H5HF_free_section_t *sect) +H5HF__sect_row_get_iblock(H5HF_free_section_t *sect) { H5HF_indirect_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -1528,10 +1517,10 @@ H5HF_sect_row_get_iblock(H5HF_free_section_t *sect) sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); HDassert(sect->sect_info.state == H5FS_SECT_LIVE); - ret_value = H5HF_sect_indirect_get_iblock(sect->u.row.under); + ret_value = H5HF__sect_indirect_get_iblock(sect->u.row.under); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_row_get_iblock() */ +} /* end H5HF__sect_row_get_iblock() */ /*------------------------------------------------------------------------- @@ -1543,7 +1532,6 @@ H5HF_sect_row_get_iblock(H5HF_free_section_t *sect) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * koziol@lbl.gov * February 4 2018 * *------------------------------------------------------------------------- @@ -1617,7 +1605,7 @@ H5HF__sect_row_init_cls(H5FS_section_class_t *cls, void *_udata) HDassert(hdr); /* Call common class initialization */ - if(H5HF_sect_init_cls(cls, hdr) < 0) + if(H5FS__sect_init_cls(cls, hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize common section class") /* First row sections actually are proxies for indirection sections on disk */ @@ -1659,7 +1647,7 @@ H5HF__sect_row_term_cls(H5FS_section_class_t *cls) HDassert(cls); /* Call common class termination */ - if(H5HF_sect_term_cls(cls) < 0) + if(H5FS__sect_term_cls(cls) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't terminate common section class") done: @@ -1700,7 +1688,7 @@ H5HF__sect_row_serialize(const H5FS_section_class_t *cls, /* Forward to indirect routine to serialize underlying section */ hdr = ((H5HF_sect_private_t *)(cls->cls_private))->hdr; - if(H5HF_sect_indirect_serialize(hdr, sect->u.row.under, buf) < 0) + if(H5HF__sect_indirect_serialize(hdr, sect->u.row.under, buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSERIALIZE, FAIL, "can't serialize row section's underlying indirect section") done: @@ -1785,22 +1773,20 @@ H5HF__sect_row_can_merge(const H5FS_section_info_t *_sect1, HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); /* Get the top indirect section underlying each row */ - top_indir_sect1 = H5HF_sect_indirect_top(sect1->u.row.under); + top_indir_sect1 = H5HF__sect_indirect_top(sect1->u.row.under); HDassert(top_indir_sect1); - top_indir_sect2 = H5HF_sect_indirect_top(sect2->u.row.under); + top_indir_sect2 = H5HF__sect_indirect_top(sect2->u.row.under); HDassert(top_indir_sect2); /* Check if second section shares the same underlying indirect block as * the first section, but doesn't already have same underlying indirect * section. */ - if(top_indir_sect1 != top_indir_sect2) { - if(H5HF_sect_indirect_iblock_off(sect1->u.row.under) == H5HF_sect_indirect_iblock_off(sect2->u.row.under)) { + if(top_indir_sect1 != top_indir_sect2) + if(H5HF__sect_indirect_iblock_off(sect1->u.row.under) == H5HF__sect_indirect_iblock_off(sect2->u.row.under)) /* 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) - } /* end if */ - } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1846,7 +1832,7 @@ H5HF__sect_row_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, H5HF_free_section_t *top_indir_sect; /* Top indirect section for row */ /* Get the top indirect section underlying second row section */ - top_indir_sect = H5HF_sect_indirect_top(sect2->u.row.under); + top_indir_sect = H5HF__sect_indirect_top(sect2->u.row.under); /* Shrink away underlying indirect section */ if(H5HF__sect_indirect_shrink(hdr, top_indir_sect) < 0) @@ -1934,7 +1920,7 @@ H5HF__sect_row_shrink(H5FS_section_info_t **_sect, void *_udata) HDassert((*sect)->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); /* Get the top indirect section underlying each row */ - top_indir_sect = H5HF_sect_indirect_top((*sect)->u.row.under); + top_indir_sect = H5HF__sect_indirect_top((*sect)->u.row.under); /* Shrink away underlying indirect section */ if(H5HF__sect_indirect_shrink(hdr, top_indir_sect) < 0) @@ -1972,7 +1958,7 @@ H5HF__sect_row_free_real(H5HF_free_section_t *sect) HDassert(sect); /* Release the section */ - if(H5HF_sect_node_free(sect, NULL) < 0) + if(H5HF__sect_node_free(sect, NULL) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node") done: @@ -2006,7 +1992,7 @@ H5HF__sect_row_free(H5FS_section_info_t *_sect) HDassert(sect->u.row.under); /* Decrement the ref. count on the row section's underlying indirect section */ - if(H5HF_sect_indirect_decr(sect->u.row.under) < 0) + if(H5HF__sect_indirect_decr(sect->u.row.under) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't detach section node") /* Release the section */ @@ -2069,10 +2055,10 @@ H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t HDassert(sect->u.row.row == indir_sect->u.indirect.row); /* Get the top indirect section underlying row */ - top_indir_sect = H5HF_sect_indirect_top(sect->u.row.under); + top_indir_sect = H5HF__sect_indirect_top(sect->u.row.under); /* Check that the row's underlying indirect section is valid */ - H5HF_sect_indirect_valid(hdr, top_indir_sect); + H5HF__sect_indirect_valid(hdr, top_indir_sect); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -2119,7 +2105,7 @@ H5HF__sect_row_debug(const H5FS_section_info_t *_sect, FILE *stream, int indent, HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Underlying indirect section:"); - H5HF_sect_indirect_debug(sect->u.row.under, stream, indent + 3, MAX(0, fwidth - 3)); + H5HF__sect_indirect_debug(sect->u.row.under, stream, indent + 3, MAX(0, fwidth - 3)); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -2127,24 +2113,23 @@ H5HF__sect_row_debug(const H5FS_section_info_t *_sect, FILE *stream, int indent, /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_iblock_off + * Function: H5HF__sect_indirect_iblock_off * * Purpose: Get the offset of the indirect block for the section * * Return: Offset of indirect block in "heap space" (can't fail) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- */ static hsize_t -H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect) +H5HF__sect_indirect_iblock_off(const H5HF_free_section_t *sect) { hsize_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * Check arguments. @@ -2154,28 +2139,27 @@ 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; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_indirect_iblock_off() */ +} /* end H5HF__sect_indirect_iblock_off() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_top + * Function: H5HF__sect_indirect_top * * Purpose: Get the "top" indirect section * * Return: Pointer to the top indirect section (can't fail) * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- */ static H5HF_free_section_t * -H5HF_sect_indirect_top(H5HF_free_section_t *sect) +H5HF__sect_indirect_top(H5HF_free_section_t *sect) { H5HF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * Check arguments. @@ -2183,16 +2167,16 @@ H5HF_sect_indirect_top(H5HF_free_section_t *sect) HDassert(sect); if(sect->u.indirect.parent) - ret_value = H5HF_sect_indirect_top(sect->u.indirect.parent); + ret_value = H5HF__sect_indirect_top(sect->u.indirect.parent); else ret_value = sect; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_indirect_top() */ +} /* end H5HF__sect_indirect_top() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_init_cls + * Function: H5HF__sect_indirect_init_cls * * Purpose: Initialize the "indirect" class structure * @@ -2206,19 +2190,19 @@ H5HF_sect_indirect_top(H5HF_free_section_t *sect) *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_init_cls(H5FS_section_class_t *cls, void *_udata) +H5HF__sect_indirect_init_cls(H5FS_section_class_t *cls, void *_udata) { H5HF_hdr_t *hdr = (H5HF_hdr_t *)_udata; /* Fractal heap header */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(cls); HDassert(hdr); /* Call to common class initialization */ - if(H5HF_sect_init_cls(cls, hdr) < 0) + if(H5FS__sect_init_cls(cls, hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize common section class") /* Set the size of all serialized objects of this class of sections */ @@ -2226,11 +2210,11 @@ H5HF_sect_indirect_init_cls(H5FS_section_class_t *cls, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_indirect_init_cls() */ +} /* H5HF__sect_indirect_init_cls() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_term_cls + * Function: H5HF__sect_indirect_term_cls * * Purpose: Terminate the "indirect" class structure * @@ -2244,26 +2228,26 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_term_cls(H5FS_section_class_t *cls) +H5HF__sect_indirect_term_cls(H5FS_section_class_t *cls) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(cls); /* Call common class termination */ - if(H5HF_sect_term_cls(cls) < 0) + if(H5FS__sect_term_cls(cls) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't terminate common section class") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_indirect_term_cls() */ +} /* H5HF__sect_indirect_term_cls() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_new + * Function: H5HF__sect_indirect_new * * Purpose: Create a new 'indirect' section for other routines to finish * initializing. @@ -2271,20 +2255,19 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- */ static H5HF_free_section_t * -H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, +H5HF__sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, H5HF_indirect_t *iblock, hsize_t iblock_off, unsigned row, unsigned col, unsigned nentries) { H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ H5HF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -2293,7 +2276,7 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, HDassert(nentries); /* Create free space section node */ - if(NULL == (sect = H5HF_sect_node_new(H5HF_FSPACE_SECT_INDIRECT, sect_off, + if(NULL == (sect = H5FS__sect_node_new(H5HF_FSPACE_SECT_INDIRECT, sect_off, sect_size, (iblock ? H5FS_SECT_LIVE : H5FS_SECT_SERIALIZED)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for indirect section") @@ -2302,7 +2285,7 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, sect->u.indirect.u.iblock = iblock; sect->u.indirect.iblock_entries = hdr->man_dtable.cparam.width * sect->u.indirect.u.iblock->max_rows; - if(H5HF_iblock_incr(sect->u.indirect.u.iblock) < 0) + 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") } /* end if */ else { @@ -2314,7 +2297,7 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, sect->u.indirect.num_entries = nentries; /* Compute span size of indirect section */ - sect->u.indirect.span_size = H5HF_dtable_span_size(&hdr->man_dtable, + sect->u.indirect.span_size = H5HF__dtable_span_size(&hdr->man_dtable, row, col, nentries); HDassert(sect->u.indirect.span_size > 0); @@ -2332,30 +2315,29 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_indirect_new() */ +} /* end H5HF__sect_indirect_new() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_for_row + * Function: H5HF__sect_indirect_for_row * * Purpose: Create the underlying indirect section for a new row section * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- */ static H5HF_free_section_t * -H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, +H5HF__sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, H5HF_free_section_t *row_sect) { H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ H5HF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -2366,7 +2348,7 @@ H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, HDassert(row_sect->u.row.row < hdr->man_dtable.max_direct_rows); /* Create free space section node */ - if(NULL == (sect = H5HF_sect_indirect_new(hdr, row_sect->sect_info.addr, + if(NULL == (sect = H5HF__sect_indirect_new(hdr, row_sect->sect_info.addr, row_sect->sect_info.size, iblock, iblock->block_off, row_sect->u.row.row, row_sect->u.row.col, row_sect->u.row.num_entries))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create indirect section") @@ -2391,11 +2373,11 @@ H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, done: if(!ret_value && sect) - if(H5HF_sect_indirect_free(sect) < 0) + if(H5HF__sect_indirect_free(sect) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "can't free indirect section node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_indirect_for_row() */ +} /* end H5HF__sect_indirect_for_row() */ /*------------------------------------------------------------------------- @@ -2407,7 +2389,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- @@ -2521,7 +2502,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_free_section_t *row_sect = NULL; /* 'Row' free space section to add */ /* Create 'row' free space section node */ - if(NULL == (row_sect = H5HF_sect_row_create(curr_off, + if(NULL == (row_sect = H5HF__sect_row_create(curr_off, (hdr->man_dtable.row_block_size[u] - dblock_overhead), first_child, u, row_col, row_entries, sect))) HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "creation failed for child row section") @@ -2558,7 +2539,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned v; /* Local index variable */ /* 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_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; /* Add an indirect section for each indirect block in the row */ @@ -2570,7 +2551,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, haddr_t child_iblock_addr; /* Child indirect block's address on disk */ /* 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) + 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") /* If the child indirect block's address is defined, protect it */ @@ -2585,7 +2566,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, child_iblock = NULL; /* Create free space section node */ - if(NULL == (child_sect = H5HF_sect_indirect_new(hdr, curr_off, (hsize_t)0, + if(NULL == (child_sect = H5HF__sect_indirect_new(hdr, curr_off, (hsize_t)0, child_iblock, curr_off, 0, 0, child_nentries))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") @@ -2658,7 +2639,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 3 2006 * *------------------------------------------------------------------------- @@ -2702,7 +2682,7 @@ H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start sect_off += hdr->man_dtable.row_block_size[start_row] * start_col; /* Create free space section node */ - if(NULL == (sect = H5HF_sect_indirect_new(hdr, sect_off, (hsize_t)0, iblock, + if(NULL == (sect = H5HF__sect_indirect_new(hdr, sect_off, (hsize_t)0, iblock, iblock->block_off, start_row, start_col, nentries))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") @@ -2720,7 +2700,7 @@ H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start done: if(ret_value < 0 && sect) - if(H5HF_sect_indirect_free(sect) < 0) + if(H5HF__sect_indirect_free(sect) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") FUNC_LEAVE_NOAPI(ret_value) @@ -2728,24 +2708,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_decr + * Function: H5HF__sect_indirect_decr * * Purpose: Decrement ref. count on indirect section * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 6 2006 * *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_decr(H5HF_free_section_t *sect) +H5HF__sect_indirect_decr(H5HF_free_section_t *sect) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -2764,18 +2743,18 @@ H5HF_sect_indirect_decr(H5HF_free_section_t *sect) par_sect = sect->u.indirect.parent; /* Free indirect section */ - if(H5HF_sect_indirect_free(sect) < 0) + if(H5HF__sect_indirect_free(sect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") /* Decrement ref. count on indirect section's parent */ if(par_sect) - if(H5HF_sect_indirect_decr(par_sect) < 0) + if(H5HF__sect_indirect_decr(par_sect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't decrement ref. count on parent indirect section") } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_indirect_decr() */ +} /* end H5HF__sect_indirect_decr() */ /*------------------------------------------------------------------------- @@ -2786,7 +2765,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 3 2006 * *------------------------------------------------------------------------- @@ -2832,7 +2810,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -2854,7 +2831,7 @@ H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_indi HDassert(sect_iblock); /* Increment reference count on indirect block that free section is in */ - if(H5HF_iblock_incr(sect_iblock) < 0) + if(H5HF__iblock_incr(sect_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") /* Set the pointer to the section's indirect block */ @@ -2891,7 +2868,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -2954,7 +2930,7 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, hbool_t is_first; /* Flag to indicate that this section is the first section in hierarchy */ /* Check if this section is the first section */ - is_first = H5HF_sect_indirect_is_first(sect); + is_first = H5HF__sect_indirect_is_first(sect); /* Remove this indirect section from parent indirect section */ if(H5HF__sect_indirect_reduce(hdr, sect->u.indirect.parent, sect->u.indirect.par_entry) < 0) @@ -3069,7 +3045,7 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, } /* end else */ /* Create peer indirect section */ - if(NULL == (peer_sect = H5HF_sect_indirect_new(hdr, sect->sect_info.addr, + if(NULL == (peer_sect = H5HF__sect_indirect_new(hdr, sect->sect_info.addr, sect->sect_info.size, iblock, iblock_off, start_row, start_col, peer_nentries))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") @@ -3144,7 +3120,7 @@ done: /* Sanity check - we should only be here if an error occurred */ HDassert(ret_value < 0); - if(H5HF_sect_indirect_free(peer_sect) < 0) + if(H5HF__sect_indirect_free(peer_sect) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") } /* end if */ @@ -3162,7 +3138,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -3203,7 +3178,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_t is_first; /* Flag to indicate that this section is the first section in hierarchy */ /* Check if this section is the first section */ - is_first = H5HF_sect_indirect_is_first(sect); + is_first = H5HF__sect_indirect_is_first(sect); /* Reduce parent indirect section */ if(H5HF__sect_indirect_reduce(hdr, sect->u.indirect.parent, sect->u.indirect.par_entry) < 0) @@ -3298,7 +3273,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, /* 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.span_size = H5HF__dtable_span_size(&hdr->man_dtable, sect->u.indirect.row, sect->u.indirect.col, new_nentries); HDassert(sect->u.indirect.span_size > 0); @@ -3308,7 +3283,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, peer_sect_addr += hdr->man_dtable.row_block_size[child_row]; /* Create peer indirect section */ - if(NULL == (peer_sect = H5HF_sect_indirect_new(hdr, peer_sect_addr, + if(NULL == (peer_sect = H5HF__sect_indirect_new(hdr, peer_sect_addr, sect->sect_info.size, iblock, iblock_off, peer_start_row, peer_start_col, peer_nentries))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") @@ -3370,7 +3345,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, /* Decrement # of sections which depend on this row */ /* (Must be last as section can be freed) */ - if(H5HF_sect_indirect_decr(sect) < 0) + if(H5HF__sect_indirect_decr(sect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't decrement section's ref. count ") done: @@ -3380,7 +3355,7 @@ done: /* Sanity check - we should only be here if an error occurred */ HDassert(ret_value < 0); - if(H5HF_sect_indirect_free(peer_sect) < 0) + if(H5HF__sect_indirect_free(peer_sect) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") } /* end if */ @@ -3389,24 +3364,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_is_first + * Function: H5HF__sect_indirect_is_first * * Purpose: Check if indirect section is first in all parents * * Return: Non-negative (TRUE/FALSE) on success/ * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 17 2006 * *------------------------------------------------------------------------- */ static hbool_t -H5HF_sect_indirect_is_first(H5HF_free_section_t *sect) +H5HF__sect_indirect_is_first(H5HF_free_section_t *sect) { hbool_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(sect); @@ -3414,13 +3388,13 @@ H5HF_sect_indirect_is_first(H5HF_free_section_t *sect) /* Recurse to parent */ if(sect->u.indirect.parent) { if(sect->sect_info.addr == sect->u.indirect.parent->sect_info.addr) - ret_value = H5HF_sect_indirect_is_first(sect->u.indirect.parent); + ret_value = H5HF__sect_indirect_is_first(sect->u.indirect.parent); } /* end if */ else ret_value = TRUE; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_sect_indirect_is_first() */ +} /* end H5HF__sect_indirect_is_first() */ /*------------------------------------------------------------------------- @@ -3431,7 +3405,6 @@ H5HF_sect_indirect_is_first(H5HF_free_section_t *sect) * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -3476,22 +3449,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_get_iblock + * Function: H5HF__sect_indirect_get_iblock * * Purpose: Retrieve the indirect block for a indirect section * * Return: Pointer to indirect block on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 9 2006 * *------------------------------------------------------------------------- */ static H5HF_indirect_t * -H5HF_sect_indirect_get_iblock(H5HF_free_section_t *sect) +H5HF__sect_indirect_get_iblock(H5HF_free_section_t *sect) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* * Check arguments. @@ -3501,7 +3473,7 @@ H5HF_sect_indirect_get_iblock(H5HF_free_section_t *sect) HDassert(sect->sect_info.state == H5FS_SECT_LIVE); FUNC_LEAVE_NOAPI(sect->u.indirect.u.iblock) -} /* end H5HF_sect_indirect_get_iblock() */ +} /* end H5HF__sect_indirect_get_iblock() */ /*------------------------------------------------------------------------- @@ -3545,9 +3517,9 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, HDassert(row_sect2->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); /* Set up indirect section information */ - sect1 = H5HF_sect_indirect_top(row_sect1->u.row.under); + sect1 = H5HF__sect_indirect_top(row_sect1->u.row.under); HDassert(sect1); - sect2 = H5HF_sect_indirect_top(row_sect2->u.row.under); + sect2 = H5HF__sect_indirect_top(row_sect2->u.row.under); HDassert(sect2); /* Sanity check some assumptions about the indirect sections */ @@ -3722,11 +3694,11 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, /* Decrement ref. count on second indirect section's parent */ HDassert(sect2->u.indirect.rc == 0); if(sect2->u.indirect.parent) - if(H5HF_sect_indirect_decr(sect2->u.indirect.parent) < 0) + if(H5HF__sect_indirect_decr(sect2->u.indirect.parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't decrement ref. count on parent indirect section") /* Free second indirect section */ - if(H5HF_sect_indirect_free(sect2) < 0) + if(H5HF__sect_indirect_free(sect2) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") /* Re-add the second section's first row */ @@ -3806,7 +3778,7 @@ H5HF__sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) HDassert(par_row >= hdr->man_dtable.max_direct_rows); /* Create parent indirect section */ - if(NULL == (par_sect = H5HF_sect_indirect_new(hdr, sect->sect_info.addr, + if(NULL == (par_sect = H5HF__sect_indirect_new(hdr, sect->sect_info.addr, sect->sect_info.size, par_iblock, par_block_off, par_row, par_col, 1))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") @@ -3828,7 +3800,7 @@ H5HF__sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) done: if(ret_value < 0) - if(par_sect && H5HF_sect_indirect_free(par_sect) < 0) + if(par_sect && H5HF__sect_indirect_free(par_sect) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") FUNC_LEAVE_NOAPI(ret_value) @@ -3883,7 +3855,7 @@ H5HF__sect_indirect_shrink(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free child section node") /* Free the indirect section itself */ - if(H5HF_sect_indirect_free(sect) < 0) + if(H5HF__sect_indirect_free(sect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") done: @@ -3892,7 +3864,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_serialize + * Function: H5HF__sect_indirect_serialize * * Purpose: Serialize a "live" indirect section into a buffer * @@ -3906,12 +3878,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, +H5HF__sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, uint8_t *buf) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(hdr); @@ -3921,7 +3893,7 @@ H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, /* Check if this indirect section has a parent & forward if this section is first */ if(sect->u.indirect.parent) { if(sect->sect_info.addr == sect->u.indirect.parent->sect_info.addr) - if(H5HF_sect_indirect_serialize(hdr, sect->u.indirect.parent, buf) < 0) + if(H5HF__sect_indirect_serialize(hdr, sect->u.indirect.parent, buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSERIALIZE, FAIL, "can't serialize indirect section's parent indirect section") } /* end if */ else { @@ -3945,7 +3917,7 @@ H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_indirect_serialize() */ +} /* H5HF__sect_indirect_serialize() */ /*------------------------------------------------------------------------- @@ -3997,7 +3969,7 @@ H5HF__sect_indirect_deserialize(H5HF_hdr_t *hdr, const uint8_t *buf, UINT16DECODE(buf, nentries); /* Create free space section node */ - if(NULL == (new_sect = H5HF_sect_indirect_new(hdr, sect_addr, sect_size, + if(NULL == (new_sect = H5HF__sect_indirect_new(hdr, sect_addr, sect_size, NULL, iblock_off, start_row, start_col, nentries))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create indirect section") @@ -4027,7 +3999,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_free + * Function: H5HF__sect_indirect_free * * Purpose: Free a 'indirect' section node * @@ -4041,12 +4013,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_free(H5HF_free_section_t *sect) +H5HF__sect_indirect_free(H5HF_free_section_t *sect) { H5HF_indirect_t *iblock = NULL; /* Indirect block for section */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(sect); @@ -4057,23 +4029,22 @@ H5HF_sect_indirect_free(H5HF_free_section_t *sect) sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.indir_ents); /* Check for live reference to an indirect block */ - if(sect->sect_info.state == H5FS_SECT_LIVE) { + if(sect->sect_info.state == H5FS_SECT_LIVE) /* Get indirect block, if there was one */ if(sect->u.indirect.u.iblock) iblock = sect->u.indirect.u.iblock; - } /* end if */ /* Release the sections */ - if(H5HF_sect_node_free(sect, iblock) < 0) + if(H5HF__sect_node_free(sect, iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_sect_indirect_free() */ +} /* H5HF__sect_indirect_free() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_valid + * Function: H5HF__sect_indirect_valid * * Purpose: Check the validity of a section * @@ -4086,7 +4057,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) +H5HF__sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) { unsigned start_row; /* Row for first block covered */ unsigned start_col; /* Column for first block covered */ @@ -4095,7 +4066,7 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) unsigned end_entry; /* Entry for last block covered */ unsigned u; /* Local index variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check arguments */ HDassert(hdr); @@ -4167,16 +4138,16 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) } /* end if */ /* Recursively check child indirect section */ - H5HF_sect_indirect_valid(hdr, tmp_child_sect); + H5HF__sect_indirect_valid(hdr, tmp_child_sect); } /* end for */ } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_sect_indirect_valid() */ +} /* H5HF__sect_indirect_valid() */ /*------------------------------------------------------------------------- - * Function: H5HF_sect_indirect_debug + * Function: H5HF__sect_indirect_debug * * Purpose: Dump debugging information about an indirect free space section * @@ -4190,10 +4161,10 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_indirect_debug(const H5HF_free_section_t *sect, +H5HF__sect_indirect_debug(const H5HF_free_section_t *sect, FILE *stream, int indent, int fwidth) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments. */ HDassert(sect); @@ -4210,5 +4181,5 @@ H5HF_sect_indirect_debug(const H5HF_free_section_t *sect, sect->u.indirect.num_entries); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_sect_indirect_debug() */ +} /* H5HF__sect_indirect_debug() */ diff --git a/src/H5HFspace.c b/src/H5HFspace.c index ad5ff0f..b518996 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -15,7 +15,7 @@ * * Created: H5HFspace.c * May 2 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Space allocation routines for fractal heaps. * @@ -89,7 +89,6 @@ * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -153,7 +152,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 15 2006 * *------------------------------------------------------------------------- @@ -198,7 +196,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -237,7 +234,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_space_revert_root_cb + * Function: H5HF__space_revert_root_cb * * Purpose: Callback routine from iterator, to reset 'parent' pointers in * sections, when the heap is changing from having a root indirect @@ -247,18 +244,17 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 24 2012 * *------------------------------------------------------------------------- */ static herr_t -H5HF_space_revert_root_cb(H5FS_section_info_t *_sect, void H5_ATTR_UNUSED *_udata) +H5HF__space_revert_root_cb(H5FS_section_info_t *_sect, void H5_ATTR_UNUSED *_udata) { H5HF_free_section_t *sect = (H5HF_free_section_t *)_sect; /* Section to dump info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -279,7 +275,7 @@ H5HF_space_revert_root_cb(H5FS_section_info_t *_sect, void H5_ATTR_UNUSED *_udat done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_space_revert_root_cb() */ +} /* end H5HF__space_revert_root_cb() */ /*------------------------------------------------------------------------- @@ -292,7 +288,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 23 2012 * *------------------------------------------------------------------------- @@ -312,7 +307,7 @@ H5HF__space_revert_root(const H5HF_hdr_t *hdr) /* Only need to scan the sections if the free space has been initialized */ if(hdr->fspace) /* Iterate over all sections, resetting the parent pointers in 'single' sections */ - if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_revert_root_cb, NULL) < 0) + if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF__space_revert_root_cb, NULL) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to reset parent pointers") done: @@ -321,7 +316,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HF_space_create_root_cb + * Function: H5HF__space_create_root_cb * * Purpose: Callback routine from iterator, to set 'parent' pointers in * sections to newly created root indirect block, when the heap @@ -331,19 +326,18 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 24 2012 * *------------------------------------------------------------------------- */ static herr_t -H5HF_space_create_root_cb(H5FS_section_info_t *_sect, void *_udata) +H5HF__space_create_root_cb(H5FS_section_info_t *_sect, void *_udata) { H5HF_free_section_t *sect = (H5HF_free_section_t *)_sect; /* Section to dump info */ H5HF_indirect_t *root_iblock = (H5HF_indirect_t *)_udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -357,7 +351,7 @@ H5HF_space_create_root_cb(H5FS_section_info_t *_sect, void *_udata) HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE); /* Increment ref. count on new root indirect block */ - if(H5HF_iblock_incr(root_iblock) < 0) + if(H5HF__iblock_incr(root_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on section's indirect block") /* Set parent info ("live" section must _NOT_ have a parent right now) */ @@ -370,7 +364,7 @@ H5HF_space_create_root_cb(H5FS_section_info_t *_sect, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_space_create_root_cb() */ +} /* end H5HF__space_create_root_cb() */ /*------------------------------------------------------------------------- @@ -384,7 +378,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 24 2012 * *------------------------------------------------------------------------- @@ -405,7 +398,7 @@ H5HF__space_create_root(const H5HF_hdr_t *hdr, H5HF_indirect_t *root_iblock) /* Only need to scan the sections if the free space has been initialized */ if(hdr->fspace) /* Iterate over all sections, seting the parent pointers in 'single' sections to the new indirect block */ - if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF_space_create_root_cb, root_iblock) < 0) + if(H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF__space_create_root_cb, root_iblock) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to set parent pointers") done: @@ -422,7 +415,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * August 14 2007 * *------------------------------------------------------------------------- @@ -467,7 +459,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 24 2006 * *------------------------------------------------------------------------- @@ -505,7 +496,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -529,9 +519,6 @@ H5HF__space_close(H5HF_hdr_t *hdr) /* Retrieve the number of sections for this heap */ if(H5FS_sect_stats(hdr->fspace, NULL, &nsects) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOUNT, FAIL, "can't query free space section count") -#ifdef QAK -HDfprintf(stderr, "%s: nsects = %Hu\n", FUNC, nsects); -#endif /* QAK */ /* Close the free space for the heap */ if(H5FS_close(hdr->f, hdr->fspace) < 0) @@ -560,7 +547,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Aug 7 2006 * *------------------------------------------------------------------------- @@ -596,7 +582,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 10 2006 * *------------------------------------------------------------------------- @@ -607,9 +592,6 @@ H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, uint16 herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -#endif /* QAK */ /* * Check arguments. diff --git a/src/H5HFstat.c b/src/H5HFstat.c index 7d18ba6..456fd60 100644 --- a/src/H5HFstat.c +++ b/src/H5HFstat.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Monday, March 6, 2006 * * Purpose: Fractal heap metadata statistics functions. diff --git a/src/H5HFtest.c b/src/H5HFtest.c index d6eecd7..14b20eb 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Thursday, February 3, 2006 * * Purpose: Fractal heap testing functions. @@ -189,13 +189,10 @@ H5HF_cmp_cparam_test(const H5HF_create_t *cparam1, const H5HF_create_t *cparam2) /* Don't worry about comparing the filter names right now... */ /* (they are expanded during the encode/decode process, but aren't copied - * during the H5Z_append operation, generating false positive failures) + * during the H5Z_append operation, generating false positive failures -QAK) */ -#ifdef QAK +#if 0 /* Check filter name */ -HDfprintf(stderr, "%s: Check 1.0\n", "H5HF_cmp_cparam_test"); -HDfprintf(stderr, "%s: cparam1->pline.filter[%Zu].name = %s\n", "H5HF_cmp_cparam_test", u, (cparam1->pline.filter[u].name ? cparam1->pline.filter[u].name : "")); -HDfprintf(stderr, "%s: cparam2->pline.filter[%Zu].name = %s\n", "H5HF_cmp_cparam_test", u, (cparam2->pline.filter[u].name ? cparam2->pline.filter[u].name : "")); if(!cparam1->pline.filter[u].name && cparam2->pline.filter[u].name) HGOTO_DONE(-1) else if(cparam1->pline.filter[u].name && !cparam2->pline.filter[u].name) @@ -204,7 +201,7 @@ HDfprintf(stderr, "%s: cparam2->pline.filter[%Zu].name = %s\n", "H5HF_cmp_cparam if((ret_value = HDstrcmp(cparam1->pline.filter[u].name, cparam2->pline.filter[u].name))) HGOTO_DONE(ret_value) } /* end if */ -#endif /* QAK */ +#endif /* Check # of filter parameters */ if(cparam1->pline.filter[u].cd_nelmts < cparam2->pline.filter[u].cd_nelmts) diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c index 113124c..21da6da 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -15,7 +15,7 @@ * * Created: H5HFtiny.c * Aug 14 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Routines for "tiny" objects in fractal heap * @@ -63,7 +63,7 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, +static herr_t H5HF__tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_data); @@ -83,22 +83,21 @@ static herr_t H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, /*------------------------------------------------------------------------- - * Function: H5HF_tiny_init + * Function: H5HF__tiny_init * * Purpose: Initialize information for tracking 'tiny' objects * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 14 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_tiny_init(H5HF_hdr_t *hdr) +H5HF__tiny_init(H5HF_hdr_t *hdr) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -126,33 +125,29 @@ H5HF_tiny_init(H5HF_hdr_t *hdr) } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_tiny_init() */ +} /* end H5HF__tiny_init() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_insert + * Function: H5HF__tiny_insert * * Purpose: Pack a 'tiny' object in a heap ID * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 14 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) +H5HF__tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) { uint8_t *id = (uint8_t *)_id; /* Pointer to ID buffer */ size_t enc_obj_size; /* Encoded object size */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT -#ifdef QAK -HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); -#endif /* QAK */ + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -185,33 +180,32 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); hdr->tiny_nobjs++; /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_tiny_insert() */ +} /* end H5HF__tiny_insert() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_get_obj_len + * Function: H5HF__tiny_get_obj_len * * Purpose: Get the size of a 'tiny' object in a fractal heap * * Return: SUCCEED (Can't fail) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 14 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) +H5HF__tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) { size_t enc_obj_size; /* Encoded object size */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* * Check arguments. @@ -233,30 +227,29 @@ H5HF_tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) *obj_len_p = enc_obj_size + 1; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HF_tiny_get_obj_len() */ +} /* end H5HF__tiny_get_obj_len() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_op_real + * Function: H5HF__tiny_op_real * * Purpose: Internal routine to perform operation on 'tiny' object * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 11 2006 * *------------------------------------------------------------------------- */ static herr_t -H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, +H5HF__tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_data) { size_t enc_obj_size; /* Encoded object size */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -266,8 +259,8 @@ H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, HDassert(op); /* Get the object's encoded length */ - /* H5HF_tiny_obj_len can't fail */ - ret_value = H5HF_tiny_get_obj_len(hdr, id, &enc_obj_size); + /* H5HF__tiny_obj_len can't fail */ + ret_value = H5HF__tiny_get_obj_len(hdr, id, &enc_obj_size); /* Advance past flag byte(s) */ if(!hdr->tiny_len_extended) @@ -285,28 +278,27 @@ H5HF_tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_tiny_op_real() */ +} /* end H5HF__tiny_op_real() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_read + * Function: H5HF__tiny_read * * Purpose: Read a 'tiny' object from the heap * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 8 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_tiny_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) +H5HF__tiny_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -316,34 +308,33 @@ H5HF_tiny_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) HDassert(obj); /* Call the internal 'op' routine */ - if(H5HF_tiny_op_real(hdr, id, H5HF_op_read, obj) < 0) + if(H5HF__tiny_op_real(hdr, id, H5HF__op_read, obj) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_tiny_read() */ +} /* end H5HF__tiny_read() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_op + * Function: H5HF__tiny_op * * Purpose: Operate directly on a 'tiny' object * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sept 11 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_tiny_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, +H5HF__tiny_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_data) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -353,34 +344,33 @@ H5HF_tiny_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, HDassert(op); /* Call the internal 'op' routine routine */ - if(H5HF_tiny_op_real(hdr, id, op, op_data) < 0) + if(H5HF__tiny_op_real(hdr, id, op, op_data) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_tiny_op() */ +} /* end H5HF__tiny_op() */ /*------------------------------------------------------------------------- - * Function: H5HF_tiny_remove + * Function: H5HF__tiny_remove * * Purpose: Remove a 'tiny' object from the heap statistics * * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Aug 14 2006 * *------------------------------------------------------------------------- */ herr_t -H5HF_tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id) +H5HF__tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id) { size_t enc_obj_size; /* Encoded object size */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -389,17 +379,17 @@ H5HF_tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id) HDassert(id); /* Get the object's encoded length */ - /* H5HF_tiny_obj_len can't fail */ - ret_value = H5HF_tiny_get_obj_len(hdr, id, &enc_obj_size); + /* H5HF__tiny_obj_len can't fail */ + ret_value = H5HF__tiny_get_obj_len(hdr, id, &enc_obj_size); /* Update statistics about heap */ hdr->tiny_size -= enc_obj_size; hdr->tiny_nobjs--; /* Mark heap header as modified */ - if(H5HF_hdr_dirty(hdr) < 0) + if(H5HF__hdr_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_tiny_remove() */ +} /* end H5HF__tiny_remove() */ diff --git a/src/H5HG.c b/src/H5HG.c index f9d780c..dc945e0 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, March 27, 1998 * * Purpose: Operations on the global heap. The global heap is the set of @@ -763,7 +763,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5HG_remove (H5F_t *f, H5HG_t *hobj) +H5HG_remove(H5F_t *f, H5HG_t *hobj) { H5HG_heap_t *heap = NULL; uint8_t *p = NULL, *obj_start = NULL; diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 7485aad..f85df33 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -15,7 +15,7 @@ * * Created: H5HGcache.c * Feb 5 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement global heap metadata cache methods. * diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c index a5e5363..a0697aa 100644 --- a/src/H5HGdbg.c +++ b/src/H5HGdbg.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Wednesday, July 9, 2003 * * Purpose: Global Heap object debugging functions. @@ -77,7 +77,6 @@ * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Mar 27, 1998 * *------------------------------------------------------------------------- diff --git a/src/H5HGmodule.h b/src/H5HGmodule.h index 1c68206..e661328 100644 --- a/src/H5HGmodule.h +++ b/src/H5HGmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index 3119de4..735b4fb 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, July 9, 2003 * * Purpose: This file contains declarations which are visible diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index 573ef39..1a22d56 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, March 27, 1998 */ #ifndef _H5HGprivate_H diff --git a/src/H5HGquery.c b/src/H5HGquery.c index 35abc2e..005235c 100644 --- a/src/H5HGquery.c +++ b/src/H5HGquery.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, July 20, 2011 * * Purpose: Query routines for global heaps. diff --git a/src/H5HL.c b/src/H5HL.c index f290294..f628e93 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -15,7 +15,7 @@ * * Created: H5HL.c * Jul 16 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Heap functions for the local heaps used by symbol * tables to store names (among other things). diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 734ec5c..38cf060 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -15,7 +15,7 @@ * * Created: H5HLcache.c * Feb 5 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implement local heap metadata cache methods. * diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index edb0261..c0ec68b 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Wednesday, July 9, 2003 * * Purpose: Local Heap object debugging functions. diff --git a/src/H5HLdblk.c b/src/H5HLdblk.c index c3fcffe..88348a0 100644 --- a/src/H5HLdblk.c +++ b/src/H5HLdblk.c @@ -15,7 +15,7 @@ * * Created: H5HLdblk.c * Summer 2012 - * Dana Robinson + * Dana Robinson * * Purpose: Data block routines for local heaps. * diff --git a/src/H5HLint.c b/src/H5HLint.c index cc3e3ea..17527c1 100644 --- a/src/H5HLint.c +++ b/src/H5HLint.c @@ -15,7 +15,7 @@ * * Created: H5HLint.c * Oct 12 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: Local heap internal routines. * diff --git a/src/H5HLprfx.c b/src/H5HLprfx.c index 41c254a..8c4ffad 100644 --- a/src/H5HLprfx.c +++ b/src/H5HLprfx.c @@ -15,7 +15,7 @@ * * Created: H5HLprfx.c * Summer 2012 - * Dana Robinson + * Dana Robinson * * Purpose: Prefix routines for local heaps. * diff --git a/src/H5HP.c b/src/H5HP.c index 4ef5662..340457b 100644 --- a/src/H5HP.c +++ b/src/H5HP.c @@ -46,10 +46,10 @@ struct H5HP_t { }; /* Static functions */ -static herr_t H5HP_swim_max(H5HP_t *heap, size_t loc); -static herr_t H5HP_swim_min(H5HP_t *heap, size_t loc); -static herr_t H5HP_sink_max(H5HP_t *heap, size_t loc); -static herr_t H5HP_sink_min(H5HP_t *heap, size_t loc); +static herr_t H5HP__swim_max(H5HP_t *heap, size_t loc); +static herr_t H5HP__swim_min(H5HP_t *heap, size_t loc); +static herr_t H5HP__sink_max(H5HP_t *heap, size_t loc); +static herr_t H5HP__sink_min(H5HP_t *heap, size_t loc); /* Declare a free list to manage the H5HP_t struct */ H5FL_DEFINE_STATIC(H5HP_t); @@ -60,11 +60,11 @@ H5FL_SEQ_DEFINE_STATIC(H5HP_ent_t); /*-------------------------------------------------------------------------- NAME - H5HP_swim_max + H5HP__swim_max PURPOSE Restore heap condition by moving an object upward USAGE - herr_t H5HP_swim_max(heap, loc) + herr_t H5HP__swim_max(heap, loc) H5HP_t *heap; IN/OUT: Pointer to heap to modify size_t loc; IN: Location to start from @@ -80,13 +80,13 @@ H5FL_SEQ_DEFINE_STATIC(H5HP_ent_t); REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5HP_swim_max(H5HP_t *heap, size_t loc) +H5HP__swim_max(H5HP_t *heap, size_t loc) { int val; /* Temporary copy value of object to move in heap */ H5HP_info_t *obj; /* Temporary pointer to object to move in heap */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Get copies of the information about the object to move in the heap */ val=heap->heap[loc].val; @@ -113,16 +113,16 @@ H5HP_swim_max(H5HP_t *heap, size_t loc) heap->heap[loc].obj->heap_loc=loc; FUNC_LEAVE_NOAPI(ret_value); -} /* end H5HP_swim_max() */ +} /* end H5HP__swim_max() */ /*-------------------------------------------------------------------------- NAME - H5HP_swim_min + H5HP__swim_min PURPOSE Restore heap condition by moving an object upward USAGE - herr_t H5HP_swim_min(heap, loc) + herr_t H5HP__swim_min(heap, loc) H5HP_t *heap; IN/OUT: Pointer to heap to modify size_t loc; IN: Location to start from @@ -138,13 +138,13 @@ H5HP_swim_max(H5HP_t *heap, size_t loc) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5HP_swim_min(H5HP_t *heap, size_t loc) +H5HP__swim_min(H5HP_t *heap, size_t loc) { int val; /* Temporary copy value of object to move in heap */ H5HP_info_t *obj; /* Temporary pointer to object to move in heap */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Get copies of the information about the object to move in the heap */ val=heap->heap[loc].val; @@ -171,16 +171,16 @@ H5HP_swim_min(H5HP_t *heap, size_t loc) heap->heap[loc].obj->heap_loc=loc; FUNC_LEAVE_NOAPI(ret_value); -} /* end H5HP_swim_min() */ +} /* end H5HP__swim_min() */ /*-------------------------------------------------------------------------- NAME - H5HP_sink_max + H5HP__sink_max PURPOSE Restore heap condition by moving an object downward USAGE - herr_t H5HP_sink_max(heap, loc) + herr_t H5HP__sink_max(heap, loc) H5HP_t *heap; IN/OUT: Pointer to heap to modify size_t loc; IN: Location to start from @@ -196,13 +196,13 @@ H5HP_swim_min(H5HP_t *heap, size_t loc) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5HP_sink_max(H5HP_t *heap, size_t loc) +H5HP__sink_max(H5HP_t *heap, size_t loc) { int val; /* Temporary copy value of object to move in heap */ void *obj; /* Temporary pointer to object to move in heap */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Get copies of the information about the object to move in the heap */ val=heap->heap[loc].val; @@ -240,16 +240,16 @@ H5HP_sink_max(H5HP_t *heap, size_t loc) heap->heap[loc].obj->heap_loc = loc; FUNC_LEAVE_NOAPI(ret_value); -} /* end H5HP_sink_max() */ +} /* end H5HP__sink_max() */ /*-------------------------------------------------------------------------- NAME - H5HP_sink_min + H5HP__sink_min PURPOSE Restore heap condition by moving an object downward USAGE - herr_t H5HP_sink_min(heap, loc) + herr_t H5HP__sink_min(heap, loc) H5HP_t *heap; IN/OUT: Pointer to heap to modify size_t loc; IN: Location to start from @@ -265,13 +265,13 @@ H5HP_sink_max(H5HP_t *heap, size_t loc) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5HP_sink_min(H5HP_t *heap, size_t loc) +H5HP__sink_min(H5HP_t *heap, size_t loc) { int val; /* Temporary copy value of object to move in heap */ void *obj; /* Temporary pointer to object to move in heap */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Get copies of the information about the object to move in the heap */ val=heap->heap[loc].val; @@ -309,7 +309,7 @@ H5HP_sink_min(H5HP_t *heap, size_t loc) heap->heap[loc].obj->heap_loc = loc; FUNC_LEAVE_NOAPI(ret_value); -} /* end H5HP_sink_min() */ +} /* end H5HP__sink_min() */ /*-------------------------------------------------------------------------- @@ -493,11 +493,11 @@ H5HP_insert(H5HP_t *heap, int val, void *obj) /* Restore heap condition */ if(heap->type==H5HP_MAX_HEAP) { - if(H5HP_swim_max(heap,heap->nobjs)<0) + if(H5HP__swim_max(heap,heap->nobjs)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to restore heap condition"); } /* end if */ else { - if(H5HP_swim_min(heap,heap->nobjs)<0) + if(H5HP__swim_min(heap,heap->nobjs)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to restore heap condition"); } /* end else */ @@ -619,11 +619,11 @@ H5HP_remove(H5HP_t *heap, int *val, void **obj) /* Restore heap condition, if there are objects on the heap */ if(heap->nobjs>0) { if(heap->type==H5HP_MAX_HEAP) { - if(H5HP_sink_max(heap, (size_t)1) < 0) + if(H5HP__sink_max(heap, (size_t)1) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "unable to restore heap condition"); } /* end if */ else { - if(H5HP_sink_min(heap, (size_t)1) < 0) + if(H5HP__sink_min(heap, (size_t)1) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "unable to restore heap condition"); } /* end else */ } /* end if */ @@ -695,21 +695,21 @@ H5HP_change(H5HP_t *heap, int val, void *_obj) /* Restore heap condition */ if(valtype==H5HP_MAX_HEAP) { - if(H5HP_sink_max(heap,obj_loc)<0) + if(H5HP__sink_max(heap,obj_loc)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); } /* end if */ else { - if(H5HP_swim_min(heap,obj_loc)<0) + if(H5HP__swim_min(heap,obj_loc)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); } /* end else */ } /* end if */ else { if(heap->type==H5HP_MAX_HEAP) { - if(H5HP_swim_max(heap,obj_loc)<0) + if(H5HP__swim_max(heap,obj_loc)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); } /* end if */ else { - if(H5HP_sink_min(heap,obj_loc)<0) + if(H5HP__sink_min(heap,obj_loc)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); } /* end else */ } /* end else */ @@ -778,11 +778,11 @@ H5HP_incr(H5HP_t *heap, unsigned amt, void *_obj) /* Restore heap condition */ if(H5HP_MAX_HEAP == heap->type) { - if(H5HP_swim_max(heap, obj_loc) < 0) + if(H5HP__swim_max(heap, obj_loc) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition") } /* end if */ else { - if(H5HP_sink_min(heap, obj_loc) < 0) + if(H5HP__sink_min(heap, obj_loc) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition") } /* end else */ @@ -851,11 +851,11 @@ H5HP_decr(H5HP_t *heap, unsigned amt, void *_obj) /* Restore heap condition */ if(heap->type==H5HP_MAX_HEAP) { - if(H5HP_sink_max(heap,obj_loc)<0) + if(H5HP__sink_max(heap,obj_loc)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); } /* end if */ else { - if(H5HP_swim_min(heap,obj_loc)<0) + if(H5HP__swim_min(heap,obj_loc)<0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); } /* end else */ diff --git a/src/H5Imodule.h b/src/H5Imodule.h index 60bda5a..9c56842 100644 --- a/src/H5Imodule.h +++ b/src/H5Imodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h index 2c1d81f..54b7b43 100644 --- a/src/H5Ipkg.h +++ b/src/H5Ipkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, May 15, 2003 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5Itest.c b/src/H5Itest.c index 07c1965..a51f860 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Tuesday, July 27, 2010 * * Purpose: ID testing functions. diff --git a/src/H5L.c b/src/H5L.c index 4ef045d..f6b361a 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -98,7 +98,7 @@ typedef struct { /* Local Prototypes */ /********************/ -static int H5L_find_class_idx(H5L_type_t id); +static int H5L__find_class_idx(H5L_type_t id); static herr_t H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -1559,7 +1559,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_find_class_idx + * Function: H5L__find_class_idx * * Purpose: Given a link class ID, return the offset in the global array * that holds all the registered link classes. @@ -1574,12 +1574,12 @@ done: *------------------------------------------------------------------------- */ static int -H5L_find_class_idx(H5L_type_t id) +H5L__find_class_idx(H5L_type_t id) { size_t i; /* Local index variable */ int ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR for(i = 0; i < H5L_table_used_g; i++) if(H5L_table_g[i].id == id) @@ -1587,7 +1587,7 @@ H5L_find_class_idx(H5L_type_t id) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_find_class_idx */ +} /* end H5L__find_class_idx */ /*------------------------------------------------------------------------- @@ -1613,7 +1613,7 @@ H5L_find_class(H5L_type_t id) FUNC_ENTER_NOAPI(NULL) /* Get the index in the global table */ - if((idx = H5L_find_class_idx(id)) < 0) + if((idx = H5L__find_class_idx(id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, NULL, "unable to find link class") /* Set return value */ @@ -2054,7 +2054,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_create_hard + * Function: H5L__create_hard * * Purpose: Creates a hard link from NEW_NAME to CUR_NAME. * @@ -2066,7 +2066,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name, +H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id) { char *norm_cur_name = NULL; /* Pointer to normalized current name */ @@ -2078,7 +2078,7 @@ H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name, hbool_t loc_valid = FALSE; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check args */ HDassert(cur_loc); @@ -2123,11 +2123,11 @@ done: H5MM_xfree(norm_cur_name); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_create_hard() */ +} /* end H5L__create_hard() */ /*------------------------------------------------------------------------- - * Function: H5L_create_soft + * Function: H5L__create_soft * * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH. * @@ -2139,14 +2139,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_create_soft(const char *target_path, const H5G_loc_t *link_loc, +H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id) { char *norm_target = NULL; /* Pointer to normalized current name */ H5O_link_t lnk; /* Link to insert */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check args */ HDassert(link_loc); @@ -2171,7 +2171,7 @@ done: H5MM_xfree(norm_target); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_create_soft() */ +} /* end H5L__create_soft() */ /*------------------------------------------------------------------------- @@ -2206,7 +2206,7 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, lnk.u.ud.udata = NULL; /* Make sure that this link class is registered */ - if(H5L_find_class_idx(type) < 0) + if(H5L__find_class_idx(type) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "link class has not been registered with library") /* Fill in UD link-specific information in the link struct*/ @@ -2327,7 +2327,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_get_val + * Function: H5L__get_val * * Purpose: Returns the value of a symbolic link or the udata for a * user-defined link. @@ -2346,12 +2346,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size) +H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size) { H5L_trav_gv_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(loc); @@ -2367,7 +2367,7 @@ H5L_get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t siz done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5L_get_val() */ +} /* H5L__get_val() */ /*------------------------------------------------------------------------- @@ -2422,7 +2422,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_get_val_by_idx + * Function: H5L__get_val_by_idx * * Purpose: Internal routine to query a link value according to the * index within a group @@ -2435,13 +2435,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size) { H5L_trav_gvbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -2460,7 +2460,7 @@ H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_get_val_by_idx() */ +} /* end H5L__get_val_by_idx() */ /*------------------------------------------------------------------------- @@ -2513,7 +2513,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_delete + * Function: H5L__delete * * Purpose: Delete a link from a group. * @@ -2525,12 +2525,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_delete(const H5G_loc_t *loc, const char *name) +H5L__delete(const H5G_loc_t *loc, const char *name) { char *norm_name = NULL; /* Pointer to normalized name */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(loc); @@ -2550,7 +2550,7 @@ done: H5MM_xfree(norm_name); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_delete() */ +} /* end H5L__delete() */ /*------------------------------------------------------------------------- @@ -2593,7 +2593,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_delete_by_idx + * Function: H5L__delete_by_idx * * Purpose: Internal routine to delete a link according to its index * within a group. @@ -2606,13 +2606,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n) { H5L_trav_rmbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(loc); @@ -2629,7 +2629,7 @@ H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_delete_by_idx() */ +} /* end H5L__delete_by_idx() */ /*------------------------------------------------------------------------- @@ -2859,7 +2859,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_move + * Function: H5L__move * * Purpose: Atomically move or copy a link. * @@ -2879,7 +2879,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_loc, +H5L__move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, hid_t lcpl_id) { unsigned dst_target_flags = H5G_TARGET_NORMAL; @@ -2888,7 +2888,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo H5L_trav_mv_t udata; /* User data for traversal */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(src_loc); @@ -2935,7 +2935,7 @@ H5L_move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_lo done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_move() */ +} /* end H5L__move() */ /*------------------------------------------------------------------------- @@ -3036,7 +3036,7 @@ done: * * Purpose: Returns whether a link exists in a group * - * Note: Same as H5L_exists, except that missing links are reported + * Note: Same as H5L__exists, except that missing links are reported * as 'FALSE' instead of causing failures * * Return: Non-negative (TRUE/FALSE) on success/Negative on failure @@ -3099,7 +3099,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_exists + * Function: H5L__exists * * Purpose: Returns whether a link exists in a group * @@ -3114,12 +3114,12 @@ done: *------------------------------------------------------------------------- */ htri_t -H5L_exists(const H5G_loc_t *loc, const char *name) +H5L__exists(const H5G_loc_t *loc, const char *name) { H5L_trav_le_t udata; /* User data for traversal */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* A path of "/" will always exist in a file */ if(0 == HDstrcmp(name, "/")) @@ -3135,7 +3135,7 @@ H5L_exists(const H5G_loc_t *loc, const char *name) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5L_exists() */ +} /* H5L__exists() */ /*------------------------------------------------------------------------- @@ -3260,7 +3260,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_get_info_by_idx + * Function: H5L__get_info_by_idx * * Purpose: Internal routine to retrieve link info according to an * index's order. @@ -3270,13 +3270,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, +H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo /*out*/) { H5L_trav_gibi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -3295,7 +3295,7 @@ H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_get_info_by_idx() */ +} /* end H5L__get_info_by_idx() */ /*------------------------------------------------------------------------- @@ -3339,7 +3339,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_get_name_by_idx + * Function: H5L__get_name_by_idx * * Purpose: Internal routine to retrieve link name according to an * index's order. @@ -3349,14 +3349,14 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, +H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size) { H5L_trav_gnbi_t udata; /* User data for callback */ ssize_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -3379,7 +3379,7 @@ H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_get_name_by_idx() */ +} /* end H5L__get_name_by_idx() */ /*------------------------------------------------------------------------- @@ -3391,7 +3391,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Sep 29 2006 * *------------------------------------------------------------------------- diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 8a3e3e1..b8c7819 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -291,7 +291,7 @@ H5L__extern_query(const char H5_ATTR_UNUSED * link_name, const void *_udata, siz const uint8_t *udata = (const uint8_t *)_udata; /* Pointer to external link buffer */ ssize_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check external link version & flags */ if(((*udata >> 4) & 0x0F) != H5L_EXT_VERSION) diff --git a/src/H5Lmodule.h b/src/H5Lmodule.h index cba4de4..d80126d 100644 --- a/src/H5Lmodule.h +++ b/src/H5Lmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5Lpkg.h b/src/H5Lpkg.h index f0e9cfc..34890a1 100644 --- a/src/H5Lpkg.h +++ b/src/H5Lpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: James Laird + * Programmer: James Laird * Friday, December 1, 2005 * * Purpose: This file contains declarations which are visible @@ -51,9 +51,31 @@ /* Package Private Prototypes */ /******************************/ +H5_DLL herr_t H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, + const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id); +H5_DLL herr_t H5L__create_soft(const char *target_path, const H5G_loc_t *cur_loc, + const char *cur_name, hid_t lcpl_id); H5_DLL herr_t H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, const void * ud_data, size_t ud_data_size, H5L_type_t type, hid_t lcpl_id); +H5_DLL htri_t H5L__exists(const H5G_loc_t *loc, const char *name); +H5_DLL herr_t H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + H5L_info2_t *linfo /*out*/); +H5_DLL ssize_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + char *name /*out*/, size_t size); +H5_DLL herr_t H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, + size_t size); +H5_DLL herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + void *buf/*out*/, size_t size); +H5_DLL herr_t H5L__move(const H5G_loc_t *src_loc, const char *src_name, + const H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, + hid_t lcpl_id); +H5_DLL herr_t H5L__delete(const H5G_loc_t *loc, const char *name); +H5_DLL herr_t H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n); H5_DLL herr_t H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc, H5O_link_t *dst_lnk, H5O_copy_t *cpy_info); diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index 0487557..df842f3 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -113,31 +113,9 @@ H5_DLL herr_t H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid_t lcpl_id); H5_DLL herr_t H5L_link_object(const H5G_loc_t *new_loc, const char *new_name, H5O_obj_create_t *ocrt_info, hid_t lcpl_id); -H5_DLL herr_t H5L_create_hard(H5G_loc_t *cur_loc, const char *cur_name, - const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id); -H5_DLL herr_t H5L_create_soft(const char *target_path, const H5G_loc_t *cur_loc, - const char *cur_name, hid_t lcpl_id); -H5_DLL herr_t H5L_move(const H5G_loc_t *src_loc, const char *src_name, - const H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, - hid_t lcpl_id); H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name); -H5_DLL htri_t H5L_exists(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info2_t *linkbuf/*out*/); -H5_DLL herr_t H5L_delete(const H5G_loc_t *loc, const char *name); -H5_DLL herr_t H5L_delete_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n); -H5_DLL herr_t H5L_get_info_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - H5L_info2_t *linfo /*out*/); -H5_DLL ssize_t H5L_get_name_by_idx(const H5G_loc_t *loc, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - char *name /*out*/, size_t size); -H5_DLL herr_t H5L_get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, - size_t size); -H5_DLL herr_t H5L_get_val_by_idx(const H5G_loc_t *loc, const char *name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - void *buf/*out*/, size_t size); H5_DLL herr_t H5L_register_external(void); H5_DLL herr_t H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index 3bac5ac..861fafc 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -57,7 +57,7 @@ extern "C" { * Values 64 to 255 are for "user-defined" link class types; these types are * defined by HDF5 but their behavior can be overridden by users. * Users who want to create new classes of links should contact the HDF5 - * development team at hdfhelp@ncsa.uiuc.edu . + * development team at help@hdfgroup.org. * These values can never change because they appear in HDF5 files. */ typedef enum { diff --git a/src/H5MF.c b/src/H5MF.c index fac6620..7de09cb 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -15,7 +15,7 @@ * * Created: H5MF.c * Jul 11 1997 - * Robb Matzke + * Robb Matzke * * Purpose: File memory management functions. * @@ -51,9 +51,11 @@ #define H5MF_FSPACE_EXPAND 120 /* Percent of "normal" size to expand serialized free space size */ #define H5MF_CHECK_FSM(FSM, CF) \ - HDassert(*CF == FALSE); \ - if(!H5F_addr_defined(FSM->addr) || !H5F_addr_defined(FSM->sect_addr)) \ - *CF = TRUE; + do { \ + HDassert(*CF == FALSE); \ + if(!H5F_addr_defined(FSM->addr) || !H5F_addr_defined(FSM->sect_addr)) \ + *CF = TRUE; \ + } while(0) /* For non-paged aggregation: map allocation request type to tracked free-space type */ /* F_SH -- pointer to H5F_shared_t; T -- H5FD_mem_t */ @@ -300,7 +302,6 @@ H5MF__alloc_to_fs_type(H5F_shared_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 8 2008 * *------------------------------------------------------------------------- @@ -380,7 +381,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 8 2008 * *------------------------------------------------------------------------- @@ -419,7 +419,7 @@ H5MF__create_fstype(H5F_t *f, H5F_mem_page_t type) fs_create.client = H5FS_CLIENT_FILE_ID; fs_create.shrink_percent = H5MF_FSPACE_SHRINK; fs_create.expand_percent = H5MF_FSPACE_EXPAND; - fs_create.max_sect_addr = 1 + H5VM_log2_gen((uint64_t)f->shared->maxaddr); + fs_create.max_sect_addr = 1 + H5VM__log2_gen((uint64_t)f->shared->maxaddr); fs_create.max_sect_size = f->shared->maxaddr; /* Set up alignment and threshold to use depending on TYPE */ @@ -466,7 +466,6 @@ done: * Failure: negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 8 2008 * *------------------------------------------------------------------------- @@ -781,7 +780,6 @@ done: * Failure: HADDR_UNDEF * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 11 1997 * *------------------------------------------------------------------------- @@ -1086,7 +1084,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 17 1997 * *------------------------------------------------------------------------- @@ -1448,7 +1445,6 @@ H5MF__sects_dump(f, stderr); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Feb 14 2008 * *------------------------------------------------------------------------- @@ -2173,7 +2169,7 @@ H5MF__close_shrink_eoa(H5F_t *f) } /* end for */ /* check the two aggregators */ - if((status = H5MF_aggrs_try_shrink_eoa(f)) < 0) + if((status = H5MF__aggrs_try_shrink_eoa(f)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") else if(status > 0) eoa_shrank = TRUE; @@ -2503,7 +2499,7 @@ H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, hsize_t hnums = 0; /* # of sections */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -3334,35 +3330,31 @@ static herr_t H5MF__continue_alloc_fsm(H5F_shared_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(f_sh); HDassert(continue_alloc_fsm); /* Check sm_hdr_fspace */ - if(sm_hdr_fspace && sm_hdr_fspace->serial_sect_count > 0 && sm_hdr_fspace->sinfo) { + if(sm_hdr_fspace && sm_hdr_fspace->serial_sect_count > 0 && sm_hdr_fspace->sinfo) H5MF_CHECK_FSM(sm_hdr_fspace, continue_alloc_fsm); - } /* end if */ if(!(*continue_alloc_fsm)) if(sm_sinfo_fspace && sm_sinfo_fspace != sm_hdr_fspace && - sm_sinfo_fspace->serial_sect_count > 0 && sm_sinfo_fspace->sinfo) { + sm_sinfo_fspace->serial_sect_count > 0 && sm_sinfo_fspace->sinfo) H5MF_CHECK_FSM(sm_hdr_fspace, continue_alloc_fsm); - } /* end if */ if(H5F_SHARED_PAGED_AGGR(f_sh) && !(*continue_alloc_fsm)) { /* Check lg_hdr_fspace */ - if(lg_hdr_fspace && lg_hdr_fspace->serial_sect_count > 0 && lg_hdr_fspace->sinfo) { + if(lg_hdr_fspace && lg_hdr_fspace->serial_sect_count > 0 && lg_hdr_fspace->sinfo) H5MF_CHECK_FSM(lg_hdr_fspace, continue_alloc_fsm); - } /* end if */ /* Check lg_sinfo_fspace */ if(!(*continue_alloc_fsm)) if(lg_sinfo_fspace && lg_sinfo_fspace != lg_hdr_fspace && - lg_sinfo_fspace->serial_sect_count > 0 && lg_sinfo_fspace->sinfo) { + lg_sinfo_fspace->serial_sect_count > 0 && lg_sinfo_fspace->sinfo) H5MF_CHECK_FSM(lg_sinfo_fspace, continue_alloc_fsm); - } /* end if */ } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index 0124555..ce7db6b 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 8, 2008 * * Purpose: Routines for aggregating free space allocations @@ -874,7 +874,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5MF_aggrs_try_shrink_eoa + * Function: H5MF__aggrs_try_shrink_eoa * * Purpose: Check the metadata & small block aggregators to see if * EOA shrink is possible; if so, shrink each aggregator @@ -887,13 +887,13 @@ done: *------------------------------------------------------------------------- */ htri_t -H5MF_aggrs_try_shrink_eoa(H5F_t *f) +H5MF__aggrs_try_shrink_eoa(H5F_t *f) { htri_t ma_status; /* Whether the metadata aggregator can shrink the EOA */ htri_t sda_status; /* Whether the small data aggregator can shrink the EOA */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Check args */ HDassert(f); @@ -915,5 +915,5 @@ H5MF_aggrs_try_shrink_eoa(H5F_t *f) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5MF_aggrs_try_shrink_eoa() */ +} /* end H5MF__aggrs_try_shrink_eoa() */ diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index 43e2305..abdecce 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -15,7 +15,7 @@ * * Created: H5MFdbg.c * Jan 31 2008 - * Quincey Koziol + * Quincey Koziol * * Purpose: File memory management debugging functions. * @@ -92,7 +92,6 @@ static herr_t H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata); * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * January 31 2008 * *------------------------------------------------------------------------- @@ -148,7 +147,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * January 31 2008 * *------------------------------------------------------------------------- @@ -209,7 +207,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 31 2008 * *------------------------------------------------------------------------- diff --git a/src/H5MFmodule.h b/src/H5MFmodule.h index 53daabf..6b3aba5 100644 --- a/src/H5MFmodule.h +++ b/src/H5MFmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index fc398db..7d72658 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 8, 2008 * * Purpose: This file contains declarations which are visible only within @@ -191,6 +191,7 @@ H5_DLL herr_t H5MF__sect_free(H5FS_section_info_t *sect); /* Block aggregator routines */ H5_DLL htri_t H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, haddr_t abs_blk_end, hsize_t extra_requested); +H5_DLL htri_t H5MF__aggrs_try_shrink_eoa(H5F_t *f); H5_DLL htri_t H5MF__aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, const H5MF_free_section_t *sect, H5MF_shrink_type_t *shrink); H5_DLL herr_t H5MF__aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index acd773b..2e9ea99 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -15,7 +15,7 @@ * * Created: H5MFprivate.h * Jul 11 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Private header file for file memory management. * @@ -69,7 +69,6 @@ H5_DLL haddr_t H5MF_alloc_tmp(H5F_t *f, hsize_t size); /* 'block aggregator' routines */ H5_DLL herr_t H5MF_free_aggrs(H5F_t *f); -H5_DLL htri_t H5MF_aggrs_try_shrink_eoa(H5F_t *f); /* Free space manager settling routines */ H5_DLL herr_t H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled); diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 715ece4..f69df41 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 8, 2008 * * Purpose: Free space section callbacks for file. @@ -112,7 +112,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{ NULL, /* Add section */ NULL, /* Serialize section */ H5MF__sect_deserialize, /* Deserialize section */ - H5MF__sect_simple_can_merge, /* Can sections merge? */ + H5MF__sect_simple_can_merge, /* Can sections merge? */ H5MF__sect_simple_merge, /* Merge sections */ H5MF__sect_simple_can_shrink, /* Can section shrink container?*/ H5MF__sect_simple_shrink, /* Shrink container w/section */ @@ -136,16 +136,16 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{ /* Object methods */ H5MF__sect_small_add, /* Add section */ - NULL, /* Serialize section */ - H5MF__sect_deserialize, /* Deserialize section */ + NULL, /* Serialize section */ + H5MF__sect_deserialize, /* Deserialize section */ H5MF__sect_small_can_merge, /* Can sections merge? */ H5MF__sect_small_merge, /* Merge sections */ - NULL, /* Can section shrink container?*/ - NULL, /* Shrink container w/section */ + NULL, /* Can section shrink container?*/ + NULL, /* Shrink container w/section */ H5MF__sect_free, /* Free section */ H5MF__sect_valid, /* Check validity of section */ H5MF__sect_split, /* Split section node for alignment */ - NULL, /* Dump debugging for section */ + NULL, /* Dump debugging for section */ }}; /* Class info for "large" free space sections */ @@ -166,7 +166,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{ H5MF__sect_deserialize, /* Deserialize section */ H5MF__sect_large_can_merge, /* Can sections merge? */ H5MF__sect_large_merge, /* Merge sections */ - H5MF__sect_large_can_shrink, /* Can section shrink container?*/ + H5MF__sect_large_can_shrink, /* Can section shrink container?*/ H5MF__sect_large_shrink, /* Shrink container w/section */ H5MF__sect_free, /* Free section */ H5MF__sect_valid, /* Check validity of section */ @@ -199,7 +199,6 @@ H5FL_DEFINE(H5MF_free_section_t); * Return: Pointer to new section on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * January 8 2008 * *------------------------------------------------------------------------- diff --git a/src/H5MM.c b/src/H5MM.c index cceac4f..efe955a 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -15,7 +15,7 @@ * * Created: H5MM.c * Jul 10 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Memory management functions * diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index 0787eb2..b6c1002 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -15,7 +15,7 @@ * * Created: H5MMprivate.h * Jul 10 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Private header for memory management. * diff --git a/src/H5MMpublic.h b/src/H5MMpublic.h index 4e54c33..faa3032 100644 --- a/src/H5MMpublic.h +++ b/src/H5MMpublic.h @@ -13,15 +13,13 @@ /*------------------------------------------------------------------------- * - * Created: H5MMproto.h + * Created: H5MMpublic.h * Jul 10 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Public declarations for the H5MM (memory management) * package. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5MMpublic_H diff --git a/src/H5MP.c b/src/H5MP.c index 7947e7d..e773655 100644 --- a/src/H5MP.c +++ b/src/H5MP.c @@ -15,7 +15,7 @@ * * Created: H5MP.c * May 2 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Implements memory pools. (Similar to Apache's APR * memory pools) @@ -82,7 +82,6 @@ H5FL_DEFINE(H5MP_pool_t); * Return: Pointer to the memory pool "header" on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2005 * *------------------------------------------------------------------------- @@ -125,26 +124,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5MP_new_page + * Function: H5MP__new_page * * Purpose: Allocate new page for a memory pool * * Return: Pointer to the page allocated on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 4 2005 * *------------------------------------------------------------------------- */ static H5MP_page_t * -H5MP_new_page(H5MP_pool_t *mp, size_t page_size) +H5MP__new_page(H5MP_pool_t *mp, size_t page_size) { H5MP_page_t *new_page; /* New page created */ H5MP_page_blk_t *first_blk; /* Pointer to first block in page */ H5MP_page_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(mp); @@ -163,9 +161,6 @@ H5MP_new_page(H5MP_pool_t *mp, size_t page_size) new_page->free_size = mp->max_size; new_page->fac_alloc = TRUE; } /* end else */ -#ifdef QAK -HDfprintf(stderr,"%s: Allocating new page = %p\n", FUNC, new_page); -#endif /* QAK */ /* Initialize page information */ first_blk = H5MP_PAGE_FIRST_BLOCK(new_page); @@ -191,7 +186,7 @@ HDfprintf(stderr,"%s: Allocating new page = %p\n", FUNC, new_page); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5MP_new_page() */ +} /* end H5MP__new_page() */ /*------------------------------------------------------------------------- @@ -202,7 +197,6 @@ done: * Return: Pointer to the space allocated on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2005 * *------------------------------------------------------------------------- @@ -223,10 +217,6 @@ H5MP_malloc (H5MP_pool_t *mp, size_t request) /* Compute actual size needed */ needed = H5MP_BLOCK_ALIGN(request) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)); -#ifdef QAK -HDfprintf(stderr,"%s: sizeof(H5MP_page_blk_t) = %Zu\n", FUNC, sizeof(H5MP_page_blk_t)); -HDfprintf(stderr,"%s: request = %Zu, needed = %Zu\n", FUNC, request, needed); -#endif /* QAK */ /* See if the request can be handled by existing free space */ if(needed <= mp->free_size) { @@ -275,7 +265,7 @@ HDfprintf(stderr,"%s: request = %Zu, needed = %Zu\n", FUNC, request, needed); (needed + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_t))) : mp->page_size; /* Allocate new page */ - if(NULL == (alloc_page = H5MP_new_page(mp, page_size))) + if(NULL == (alloc_page = H5MP__new_page(mp, page_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for page") /* Set the block to allocate from */ @@ -323,9 +313,6 @@ found: /* Set new space pointer for the return value */ ret_value = ((unsigned char *)alloc_free) + H5MP_BLOCK_ALIGN(sizeof(H5MP_page_blk_t)); -#ifdef QAK -HDfprintf(stderr,"%s: Allocating space from page, ret_value = %p\n", FUNC, ret_value); -#endif /* QAK */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -340,7 +327,6 @@ done: * Return: NULL on success/NULL on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 3 2005 * * Note: Should we release pages that have no used blocks? @@ -369,9 +355,6 @@ H5MP_free(H5MP_pool_t *mp, void *spc) /* Add it's space to the amount of free space in the page & pool */ spc_page = spc_blk->page; -#ifdef QAK -HDfprintf(stderr,"%s: Freeing from page = %p\n", "H5MP_free", spc_page); -#endif /* QAK */ spc_page->free_size += spc_blk->size; mp->free_size += spc_blk->size; @@ -429,7 +412,6 @@ HDfprintf(stderr,"%s: Freeing from page = %p\n", "H5MP_free", spc_page); * Return: Non-negative on success/negative on failure * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 3 2005 * *------------------------------------------------------------------------- diff --git a/src/H5MPmodule.h b/src/H5MPmodule.h index 27f7706..19b137f 100644 --- a/src/H5MPmodule.h +++ b/src/H5MPmodule.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, September 12, 2015 * * Purpose: This file contains declarations which define macros for the diff --git a/src/H5MPpkg.h b/src/H5MPpkg.h index 29a25fa..ee2eb34 100644 --- a/src/H5MPpkg.h +++ b/src/H5MPpkg.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 2, 2005 * * Purpose: This file contains declarations which are visible only within diff --git a/src/H5MPprivate.h b/src/H5MPprivate.h index 009cb50..be97e5d 100644 --- a/src/H5MPprivate.h +++ b/src/H5MPprivate.h @@ -15,7 +15,7 @@ * * Created: H5MPprivate.h * May 2 2005 - * Quincey Koziol + * Quincey Koziol * * Purpose: Private header for memory pool routines. * diff --git a/src/H5MPtest.c b/src/H5MPtest.c index 0cba847..fa5b165 100644 --- a/src/H5MPtest.c +++ b/src/H5MPtest.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Tuesday, May 3, 2005 * * Purpose: Memory pool testing functions. @@ -42,8 +42,6 @@ * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -74,8 +72,6 @@ H5MP_get_pool_free_size(const H5MP_pool_t *mp, size_t *free_size) * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -109,8 +105,6 @@ H5MP_get_pool_first_page(const H5MP_pool_t *mp, H5MP_page_t **page) * Programmer: Quincey Koziol * Wednesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ htri_t @@ -144,9 +138,6 @@ H5MP_pool_is_free_size_correct(const H5MP_pool_t *mp) /* Check that the free space from the blocks on the free list * corresponds to space in page */ -#ifdef QAK -HDfprintf(stderr,"%s: page_free = %Zu, page->free_size = %Zu\n", "H5MP_pool_is_free_size_correct", page_free, page->free_size); -#endif /* QAK */ if(page_free != page->free_size) HGOTO_DONE (FALSE) @@ -159,9 +150,6 @@ HDfprintf(stderr,"%s: page_free = %Zu, page->free_size = %Zu\n", "H5MP_pool_is_f /* Check that the free space from the pages * corresponds to free space in pool */ -#ifdef QAK -HDfprintf(stderr,"%s: pool_free = %Zu, mp->free_size = %Zu\n", "H5MP_pool_is_free_size_correct", pool_free, mp->free_size); -#endif /* QAK */ if(pool_free != mp->free_size) HGOTO_DONE (FALSE) @@ -182,8 +170,6 @@ done: * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -214,8 +200,6 @@ H5MP_get_page_free_size(const H5MP_page_t *page, size_t *free_size) * Programmer: Quincey Koziol * Tuesday, May 3, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 2d95ee9..fb08048 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -15,7 +15,7 @@ * * Created: H5Oainfo.c * Mar 6 2007 - * Quincey Koziol + * Quincey Koziol * * Purpose: Attribute Information messages. * @@ -36,12 +36,12 @@ /* PRIVATE PROTOTYPES */ static void *H5O__ainfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_ainfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void *H5O_ainfo_copy(const void *_mesg, void *_dest); -static size_t H5O_ainfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__ainfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void *H5O__ainfo_copy(const void *_mesg, void *_dest); +static size_t H5O__ainfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__ainfo_free(void *_mesg); static herr_t H5O__ainfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); -static herr_t H5O_ainfo_pre_copy_file(H5F_t *file_src, const void *mesg_src, +static herr_t H5O__ainfo_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata); static void *H5O__ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, @@ -59,16 +59,16 @@ const H5O_msg_class_t H5O_MSG_AINFO[1] = {{ sizeof(H5O_ainfo_t), /*native message size */ 0, /* messages are sharable? */ H5O__ainfo_decode, /*decode message */ - H5O_ainfo_encode, /*encode message */ - H5O_ainfo_copy, /*copy the native value */ - H5O_ainfo_size, /*size of symbol table entry */ + H5O__ainfo_encode, /*encode message */ + H5O__ainfo_copy, /*copy the native value */ + H5O__ainfo_size, /*size of symbol table entry */ NULL, /*default reset method */ H5O__ainfo_free, /* free method */ H5O__ainfo_delete, /* file delete method */ NULL, /* link method */ NULL, /*set share method */ NULL, /*can share method */ - H5O_ainfo_pre_copy_file, /* pre copy native value to file */ + H5O__ainfo_pre_copy_file, /* pre copy native value to file */ H5O__ainfo_copy_file, /* copy native value to file */ H5O__ainfo_post_copy_file, /* post copy native value to file */ NULL, /* get creation index */ @@ -97,7 +97,6 @@ H5FL_DEFINE_STATIC(H5O_ainfo_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- @@ -165,25 +164,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_ainfo_encode + * Function: H5O__ainfo_encode * * Purpose: Encodes a message. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- */ static herr_t -H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; unsigned char flags; /* Flags for encoding attribute info */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -215,11 +213,11 @@ H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co HDassert(!H5F_addr_defined(ainfo->corder_bt2_addr)); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_ainfo_encode() */ +} /* end H5O__ainfo_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_ainfo_copy + * Function: H5O__ainfo_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -228,19 +226,18 @@ H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- */ static void * -H5O_ainfo_copy(const void *_mesg, void *_dest) +H5O__ainfo_copy(const void *_mesg, void *_dest) { const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; H5O_ainfo_t *dest = (H5O_ainfo_t *) _dest; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(ainfo); @@ -255,11 +252,11 @@ H5O_ainfo_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_ainfo_copy() */ +} /* end H5O__ainfo_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_ainfo_size + * Function: H5O__ainfo_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -269,18 +266,17 @@ done: * Failure: zero * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- */ static size_t -H5O_ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = (size_t)(1 /* Version */ @@ -291,7 +287,7 @@ H5O_ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void + (ainfo->index_corder ? H5F_SIZEOF_ADDR(f) : 0)); /* Address of v2 B-tree for indexing creation order values of attributes */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_ainfo_size() */ +} /* end H5O__ainfo_size() */ /*------------------------------------------------------------------------- @@ -358,7 +354,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5O_ainfo_pre_copy_file + * Function: H5O__ainfo_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files. @@ -372,10 +368,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, +H5O__ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, hbool_t *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(deleted); @@ -388,7 +384,7 @@ H5O_ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSE *deleted = TRUE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_ainfo_pre_copy_file() */ +} /* end H5O__ainfo_pre_copy_file() */ /*------------------------------------------------------------------------- @@ -499,7 +495,6 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 6 2007 * *------------------------------------------------------------------------- diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 8850ef6..3c19cf4 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -15,7 +15,7 @@ * * Created: H5Oalloc.c * Nov 17 2006 - * Quincey Koziol