diff --git a/bin/format_source b/bin/format_source index dea771ce7f4..c5aec15bf0f 100755 --- a/bin/format_source +++ b/bin/format_source @@ -25,10 +25,12 @@ find . \( -type d -path ./config -prune -and -not -path ./config \) \ -name H5LTanalyze.c \ -or -name H5LTparse.c \ -or -name H5LTparse.h \ - -or -name H5Epubgen.h \ + -or -name H5Edefin.h \ -or -name H5Einit.h \ + -or -name H5Emajdef.h \ + -or -name H5Emindef.h \ + -or -name H5Epubgen.h \ -or -name H5Eterm.h \ - -or -name H5Edefin.h \ -or -name H5version.h \ -or -name H5overflow.h \ \) \) \ diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index ff47f5501af..afbc3b5b83c 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -383,7 +383,7 @@ New Features CMake supports two main files, CMakePresets.json and CMakeUserPresets.json, that allow users to specify common configure options and share them with others. HDF added a CMakePresets.json file of a typical configuration and support - file, config/cmake-presets/hidden-presets.json. + file, config/cmake-presets/hidden-presets.json. Also added a section to INSTALL_CMake.txt with very basic explanation of the process to use CMakePresets. @@ -431,6 +431,15 @@ New Features Library: -------- + - Added new routines for interacting with error stacks: H5Epause_stack, + H5Eresume_stack, and H5Eis_paused. These routines can be used to + indicate that errors from a call to an HDF5 routine should not be + pushed on to an error stack. Primarily targeted toward 3rd-party + developers of Virtual File Drivirs (VFDs) and Virtual Object Layer (VOL) + connectors, these routines allow developers to perform "speculative" + operations (such as trying to open a file or object) without requiring + that the error stack be cleared after a speculative operation fails. + - H5Pset_external() now uses HDoff_t, which is always a 64-bit type The H5Pset_external() call took an off_t parameter in HDF5 1.14.x and @@ -581,7 +590,7 @@ New Features to filtered datasets. The Subfiling VFD now properly handles vector I/O requests in their entirety, resulting in fewer I/O calls, improved vector I/O performance and improved vector I/O memory efficiency. - + - Added a simple cache to the read-only S3 (ros3) VFD The read-only S3 VFD now caches the first N bytes of a file stored diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 11874878fd7..ac31231b1e8 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -875,16 +875,14 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir intent = H5F_INTENT(vdset->oloc.file); /* Try opening the file */ - src_file = H5F_prefix_open_file(vdset->oloc.file, H5F_PREFIX_VDS, vdset->shared->vds_prefix, - source_dset->file_name, intent, - vdset->shared->layout.storage.u.virt.source_fapl); + if (H5F_prefix_open_file(true, &src_file, vdset->oloc.file, H5F_PREFIX_VDS, vdset->shared->vds_prefix, + source_dset->file_name, intent, + vdset->shared->layout.storage.u.virt.source_fapl) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENFILE, FAIL, "can't try opening file"); /* If we opened the source file here, we should close it when leaving */ if (src_file) src_file_open = true; - else - /* Reset the error stack */ - H5E_clear_stack(); } /* end if */ else /* Source file is ".", use the virtual dataset's file */ diff --git a/src/H5E.c b/src/H5E.c index 0eb256f4ad4..f1b865e7c17 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -532,8 +532,11 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(FAIL) - if (err_stack == H5E_DEFAULT) - estack = NULL; + /* Check for 'default' error stack */ + if (err_stack == H5E_DEFAULT) { + if (NULL == (estack = H5E__get_my_stack())) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get the default error stack"); + } else { /* Only clear the error stack if it's not the default stack */ H5E_clear_stack(); @@ -543,35 +546,33 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ - /* Note that the variable-argument parsing for the format is identical in - * the H5E_printf_stack() routine - correct errors and make changes in both - * places. -QAK - */ - - /* Format the description */ - va_start(ap, fmt); - va_started = true; - - /* Duplicate string information */ - if (NULL == (tmp_file = strdup(file))) - HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate file string"); - if (NULL == (tmp_func = strdup(func))) - HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate function string"); - - /* Increment refcount on non-library IDs */ - if (cls_id != H5E_ERR_CLS_g) - if (H5I_inc_ref(cls_id, false) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment class ID"); - if (maj_id < H5E_first_maj_id_g || maj_id > H5E_last_maj_id_g) - if (H5I_inc_ref(maj_id, false) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment major error ID"); - if (min_id < H5E_first_min_id_g || min_id > H5E_last_min_id_g) - if (H5I_inc_ref(min_id, false) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment minor error ID"); - - /* Push the error on the stack */ - if (H5E__push_stack(estack, true, tmp_file, tmp_func, line, cls_id, maj_id, min_id, fmt, &ap) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack"); + /* Check if error reporting is paused for this stack */ + if (!estack->paused) { + /* Start the variable-argument parsing */ + va_start(ap, fmt); + va_started = true; + + /* Duplicate string information */ + if (NULL == (tmp_file = strdup(file))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate file string"); + if (NULL == (tmp_func = strdup(func))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate function string"); + + /* Increment refcount on non-library IDs */ + if (cls_id != H5E_ERR_CLS_g) + if (H5I_inc_ref(cls_id, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment class ID"); + if (maj_id < H5E_first_maj_id_g || maj_id > H5E_last_maj_id_g) + if (H5I_inc_ref(maj_id, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment major error ID"); + if (min_id < H5E_first_min_id_g || min_id > H5E_last_min_id_g) + if (H5I_inc_ref(min_id, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment minor error ID"); + + /* Push the error on the stack */ + if (H5E__push_stack(estack, true, tmp_file, tmp_func, line, cls_id, maj_id, min_id, fmt, &ap) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack"); + } done: if (va_started) @@ -865,7 +866,6 @@ H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_sta H5E_stack_t *dst_stack, *src_stack; /* Error stacks */ herr_t ret_value = SUCCEED; /* Return value */ - /* Don't clear the error stack! :-) */ FUNC_ENTER_API(FAIL) /* Check args */ @@ -889,3 +889,118 @@ H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_sta done: FUNC_LEAVE_API(ret_value) } /* end H5Eappend_stack() */ + +/*------------------------------------------------------------------------- + * Function: H5Eis_paused + * + * Purpose: Check if pushing errors on an error stack is paused + * + * Return: Non-negative value on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Eis_paused(hid_t stack_id, hbool_t *is_paused) +{ + H5E_stack_t *stack; /* Error stack */ + herr_t ret_value = SUCCEED; /* Return value */ + + /* Don't clear the error stack! :-) */ + FUNC_ENTER_API_NOCLEAR(FAIL) + + /* Get the correct error stack */ + if (stack_id == H5E_DEFAULT) { + if (NULL == (stack = H5E__get_my_stack())) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); + } /* end if */ + else { + /* Only clear the error stack if it's not the default stack */ + H5E_clear_stack(); + + /* Get the error stack to operate on */ + if (NULL == (stack = (H5E_stack_t *)H5I_object_verify(stack_id, H5I_ERROR_STACK))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error stack ID"); + } /* end else */ + + /* Check arguments */ + if (NULL == is_paused) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "is_paused parameter is NULL"); + + /* Check if the stack is paused */ + *is_paused = (stack->paused > 0); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Eis_paused() */ + +/*------------------------------------------------------------------------- + * Function: H5Epause_stack + * + * Purpose: Pause pushing errors on an error stack + * + * Return: Non-negative value on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Epause_stack(hid_t stack_id) +{ + H5E_stack_t *stack; /* Error stack */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + /* Get the correct error stack */ + if (stack_id == H5E_DEFAULT) { + if (NULL == (stack = H5E__get_my_stack())) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); + } /* end if */ + else + /* Get the error stack to operate on */ + if (NULL == (stack = (H5E_stack_t *)H5I_object_verify(stack_id, H5I_ERROR_STACK))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error stack ID"); + + /* Increment pause counter */ + stack->paused++; + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Epause_stack() */ + +/*------------------------------------------------------------------------- + * Function: H5Eresume_stack + * + * Purpose: Resume pushing errors on an error stack + * + * Return: Non-negative value on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Eresume_stack(hid_t stack_id) +{ + H5E_stack_t *stack; /* Error stack */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + /* Get the correct error stack */ + if (stack_id == H5E_DEFAULT) { + if (NULL == (stack = H5E__get_my_stack())) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); + } /* end if */ + else + /* Get the error stack to operate on */ + if (NULL == (stack = (H5E_stack_t *)H5I_object_verify(stack_id, H5I_ERROR_STACK))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error stack ID"); + + /* Check for pause/resume imbalance */ + if (0 == stack->paused) + HGOTO_ERROR(H5E_ERROR, H5E_BADRANGE, FAIL, "resuming more than paused"); + + /* Decrement pause counter */ + stack->paused--; + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Eresume_stack() */ diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index 06648000ae1..87b39e4133f 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -182,30 +182,38 @@ H5Eget_minor(H5E_minor_t min) herr_t H5Epush1(const char *file, const char *func, unsigned line, H5E_major_t maj, H5E_minor_t min, const char *str) { - const char *tmp_file; /* Copy of the file name */ - const char *tmp_func; /* Copy of the function name */ - herr_t ret_value = SUCCEED; /* Return value */ + H5E_stack_t *estack; /* Pointer to error stack to modify */ + const char *tmp_file; /* Copy of the file name */ + const char *tmp_func; /* Copy of the function name */ + herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(FAIL) - /* Duplicate string information */ - if (NULL == (tmp_file = strdup(file))) - HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate file string"); - if (NULL == (tmp_func = strdup(func))) - HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate function string"); - - /* Increment refcount on non-library IDs */ - if (maj < H5E_first_maj_id_g || maj > H5E_last_maj_id_g) - if (H5I_inc_ref(maj, false) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment major error ID"); - if (min < H5E_first_min_id_g || min > H5E_last_min_id_g) - if (H5I_inc_ref(min, false) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment minor error ID"); - - /* Push the error on the default error stack */ - if (H5E__push_stack(NULL, true, tmp_file, tmp_func, line, H5E_ERR_CLS_g, maj, min, str, NULL) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack"); + /* Get the 'default' error stack */ + if (NULL == (estack = H5E__get_my_stack())) + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get the default error stack"); + + /* Check if error reporting is paused for this stack */ + if (!estack->paused) { + /* Duplicate string information */ + if (NULL == (tmp_file = strdup(file))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate file string"); + if (NULL == (tmp_func = strdup(func))) + HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "can't duplicate function string"); + + /* Increment refcount on non-library IDs */ + if (maj < H5E_first_maj_id_g || maj > H5E_last_maj_id_g) + if (H5I_inc_ref(maj, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment major error ID"); + if (min < H5E_first_min_id_g || min > H5E_last_min_id_g) + if (H5I_inc_ref(min, false) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "can't increment minor error ID"); + + /* Push the error on the default error stack */ + if (H5E__push_stack(estack, true, tmp_file, tmp_func, line, H5E_ERR_CLS_g, maj, min, str, NULL) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack"); + } done: FUNC_LEAVE_API(ret_value) @@ -259,6 +267,7 @@ H5Eprint1(FILE *stream) /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(FAIL) + /* Get the 'default' error stack */ if (NULL == (estack = H5E__get_my_stack())) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); diff --git a/src/H5Eint.c b/src/H5Eint.c index 00b6efbe33d..9590f3cbbee 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -188,7 +188,6 @@ H5E_init(void) HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group"); #ifndef H5_HAVE_THREADSAFE - H5E_stack_g[0].nused = 0; H5E__set_default_auto(H5E_stack_g); #endif /* H5_HAVE_THREADSAFE */ @@ -317,7 +316,6 @@ H5E__get_stack(void) assert(estack); /* Set the thread-specific info */ - estack->nused = 0; H5E__set_default_auto(estack); /* (It's not necessary to release this in this API, it is @@ -821,8 +819,7 @@ H5E__append_stack(H5E_stack_t *dst_stack, const H5E_stack_t *src_stack) /*-------------------------------------------------------------------------- * Function: H5E__set_default_auto * - * Purpose: Initialize "automatic" error stack reporting info to library - * default + * Purpose: Initialize error stack to library default * * Return: SUCCEED/FAIL * @@ -833,6 +830,8 @@ H5E__set_default_auto(H5E_stack_t *stk) { FUNC_ENTER_PACKAGE_NOERR + stk->nused = 0; + #ifndef H5_NO_DEPRECATED_SYMBOLS #ifdef H5_USE_16_API_DEFAULT stk->auto_op.vers = 1; @@ -848,6 +847,7 @@ H5E__set_default_auto(H5E_stack_t *stk) #endif /* H5_NO_DEPRECATED_SYMBOLS */ stk->auto_data = NULL; + stk->paused = 0; FUNC_LEAVE_NOAPI_VOID } /* end H5E__set_default_auto() */ @@ -1383,9 +1383,10 @@ herr_t H5E_printf_stack(const char *file, const char *func, unsigned line, hid_t maj_id, hid_t min_id, const char *fmt, ...) { - va_list ap; /* Varargs info */ - bool va_started = false; /* Whether the variable argument list is open */ - herr_t ret_value = SUCCEED; /* Return value */ + H5E_stack_t *estack; /* Pointer to error stack to modify */ + va_list ap; /* Varargs info */ + bool va_started = false; /* Whether the variable argument list is open */ + herr_t ret_value = SUCCEED; /* Return value */ /* * WARNING: We cannot call HERROR() from within this function or else we @@ -1401,18 +1402,20 @@ H5E_printf_stack(const char *file, const char *func, unsigned line, hid_t maj_id assert(min_id >= H5E_first_min_id_g && min_id <= H5E_last_min_id_g); assert(fmt); - /* Note that the variable-argument parsing for the format is identical in - * the H5Epush2() routine - correct errors and make changes in both - * places. -QAK - */ + /* Get the 'default' error stack */ + if (NULL == (estack = H5E__get_my_stack())) + HGOTO_DONE(FAIL); - /* Start the variable-argument parsing */ - va_start(ap, fmt); - va_started = true; + /* Check if error reporting is paused for this stack */ + if (!estack->paused) { + /* Start the variable-argument parsing */ + va_start(ap, fmt); + va_started = true; - /* Push the error on the stack */ - if (H5E__push_stack(NULL, false, file, func, line, H5E_ERR_CLS_g, maj_id, min_id, fmt, &ap) < 0) - HGOTO_DONE(FAIL); + /* Push the error on the stack */ + if (H5E__push_stack(estack, false, file, func, line, H5E_ERR_CLS_g, maj_id, min_id, fmt, &ap) < 0) + HGOTO_DONE(FAIL); + } done: if (va_started) @@ -1458,11 +1461,6 @@ H5E__push_stack(H5E_stack_t *estack, bool app_entry, const char *file, const cha assert(maj_id > 0); assert(min_id > 0); - /* Check for 'default' error stack */ - if (estack == NULL) - if (NULL == (estack = H5E__get_my_stack())) - HGOTO_DONE(FAIL); - /* * Push the error if there's room. Otherwise just forget it. */ @@ -1688,8 +1686,9 @@ H5E_clear_stack(void) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); /* Empty the error stack */ - if (H5E__clear_entries(estack, estack->nused) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack"); + if (estack->nused) + if (H5E__clear_entries(estack, estack->nused) < 0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1791,3 +1790,80 @@ H5E_dump_api_stack(void) FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_dump_api_stack() */ + +/*------------------------------------------------------------------------- + * Function: H5E_pause_stack + * + * Purpose: Pause pushing errors on the default error stack. + * + * Generally used via the H5E_PAUSE_ERRORS / H5E_RESUME_ERRORS + * macros. + * + * When one needs to temporarily disable recording errors while + * trying something that's likely or expected to fail. The code + * to try can be nested between these macros like: + * + * H5E_PAUSE_ERRORS { + * ...stuff here that's likely to fail... + * } H5E_RESUME_ERRORS + * + * Warning: don't break, return, or longjmp() from the block of + * code or the error reporting won't be properly restored! + * + * Return: none + * + *------------------------------------------------------------------------- + */ +void +H5E_pause_stack(void) +{ + H5E_stack_t *estack = H5E__get_my_stack(); + + FUNC_ENTER_NOAPI_NOERR + + assert(estack); + + /* Increment pause counter */ + estack->paused++; + + FUNC_LEAVE_NOAPI_VOID +} /* end H5E_pause_stack() */ + +/*------------------------------------------------------------------------- + * Function: H5E_resume_stack + * + * Purpose: Resume pushing errors on the default error stack. + * + * Generally used via the H5E_PAUSE_ERRORS / H5E_RESUME_ERRORS + * macros. + * + * When one needs to temporarily disable recording errors while + * trying something that's likely or expected to fail. The code + * to try can be nested between these macros like: + * + * H5E_PAUSE_ERRORS { + * ...stuff here that's likely to fail... + * } H5E_RESUME_ERRORS + * + * Warning: don't break, return, or longjmp() from the block of + * code or the error reporting won't be properly restored! + * + * Return: none + * + *------------------------------------------------------------------------- + */ +void +H5E_resume_stack(void) +{ + H5E_stack_t *estack = H5E__get_my_stack(); + + FUNC_ENTER_NOAPI_NOERR + + assert(estack); + assert(estack->paused); + + /* Decrement pause counter */ + estack->paused--; + + FUNC_LEAVE_NOAPI_VOID +} /* end H5E_resume_stack() */ diff --git a/src/H5Epkg.h b/src/H5Epkg.h index 2d950ca3d7b..1577939c184 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -114,6 +114,7 @@ typedef struct H5E_stack_t { H5E_entry_t entries[H5E_MAX_ENTRIES]; /* Array of error entries */ H5E_auto_op_t auto_op; /* Operator for 'automatic' error reporting */ void *auto_data; /* Callback data for 'automatic error reporting */ + unsigned paused; /* Whether error reporting is paused (>0) for this stack */ } H5E_stack_t; /*****************************/ diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 3777805aeb9..a3f8b693b33 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -21,6 +21,23 @@ /* Private headers needed by this file */ #include "H5private.h" +/* + * When one needs to temporarily disable recording errors while trying + * something that's likely or expected to fail. The code to try can be nested + * between these macros like: + * + * H5E_PAUSE_ERRORS { + * ...stuff here that's likely to fail... + * } H5E_RESUME_ERRORS + * + * Warning: don't break, return, or longjmp() from the block of code or + * the error reporting won't be properly restored! + * + */ +#define H5E_PAUSE_ERRORS H5E_pause_stack(); + +#define H5E_RESUME_ERRORS H5E_resume_stack(); + /* * HERROR macro, used to facilitate error reporting between a FUNC_ENTER() * and a FUNC_LEAVE() within a function body. The arguments are the major @@ -186,5 +203,7 @@ H5_DLL herr_t H5E_printf_stack(const char *file, const char *func, unsigned line hid_t min_idx, const char *fmt, ...) H5_ATTR_FORMAT(printf, 6, 7); H5_DLL herr_t H5E_clear_stack(void); H5_DLL herr_t H5E_dump_api_stack(void); +H5_DLL void H5E_pause_stack(void); +H5_DLL void H5E_resume_stack(void); #endif /* H5Eprivate_H */ diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 2b0e48dc9fd..49628efb9be 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -77,11 +77,12 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; * trying something that's likely or expected to fail. The code to try can * be nested between calls to H5Eget_auto() and H5Eset_auto(), but it's * easier just to use this macro like: + * * H5E_BEGIN_TRY { * ...stuff here that's likely to fail... * } H5E_END_TRY * - * Warning: don't break, return, or longjmp() from the body of the loop or + * Warning: don't break, return, or longjmp() from the block of code or * the error reporting won't be properly restored! * * These two macros still use the old API functions for backward compatibility @@ -322,6 +323,71 @@ H5_DLL hid_t H5Eget_current_stack(void); * \since 1.14.0 */ H5_DLL herr_t H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_stack); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief * Check if pushing errors on an error stack is paused + * + * \estack_id{stack_id} + * \param[out] is_paused Flag whether stack is paused + * \return \herr_t + * + * \details H5Eis_paused() can be used within HDF5 VOL connectors and other + * dynamically loaded components to check if the HDF5 library, or other + * component has paused pushing error on the default error stack or + * an application stack. + * + * The library may pause pushing errors on the default error stack + * when performing "speculative" operations, such as testing for the + * existence of something that could be located at one of many + * locations. \p stack_id is the error stack to query, and the value + * pointed to by \p is_paused is set to TRUE/FALSE. + * + * If an error occurs while attempting to query the status of \p stack_id, + * the value pointed to by \p is_paused is unchanged. + * + * \since 1.14.5 + */ +H5_DLL herr_t H5Eis_paused(hid_t stack_id, hbool_t *is_paused); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief * Pause pushing errors on an error stack + * + * \estack_id{stack_id} + * \return \herr_t + * + * \details H5Epause_stack() pauses pushing errors on an error stack. Pushing + * an error on a paused error stack will be ignored (not fail). + * + * H5Eresume_stack() is used to allow errors to be pushed on a stack. + * Calls to H5Epause_stack() and H5Eresume_stack() must be matched. + * + * Calls to H5Epause_stack()/H5Eresume_stack() may be nested. + * + * \since 1.14.5 + */ +H5_DLL herr_t H5Epause_stack(hid_t stack_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief * Resume pushing errors on an error stack + * + * \estack_id{stack_id} + * \return \herr_t + * + * \details H5Eresume_stack() resumes pushing errors on an error stack. + * + * Calls to H5Epause_stack() and H5Eresume_stack() must be matched. + * + * Calls to H5Epause_stack()/H5Eresume_stack() may be nested. + * + * \since 1.14.5 + */ +H5_DLL herr_t H5Eresume_stack(hid_t stack_id); /** * -------------------------------------------------------------------------- * \ingroup H5E diff --git a/src/H5FD.c b/src/H5FD.c index 1f603806b7d..a6f35ad6a87 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -693,7 +693,7 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); /* Call private function */ - if (NULL == (ret_value = H5FD_open(name, flags, fapl_id, maxaddr))) + if (H5FD_open(false, &ret_value, name, flags, fapl_id, maxaddr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file"); done: @@ -703,64 +703,88 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /*------------------------------------------------------------------------- * Function: H5FD_open * - * Purpose: Private version of H5FDopen() - * - * Return: Success: Pointer to a new file driver struct + * Purpose: Opens a file named NAME for the type(s) of access described + * by the bit vector FLAGS according to a file access + * property list FAPL_ID (which may be the constant H5P_DEFAULT). + * The file should expect to handle format addresses in the range + * [0, MAXADDR] (if MAXADDR is the undefined address then the + * caller doesn't care about the address range). + * + * If the 'try' flag is true, the VFD 'open' callback is called + * with errors paused and not opening the file is not treated as + * an error; SUCCEED is returned, with the file ptr set to NULL. + * If 'try' is false, the VFD 'open' callback is made with errors + * unpaused and a failure generates an error. * - * Failure: NULL + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -H5FD_t * -H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) +herr_t +H5FD_open(bool try, H5FD_t **_file, const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_class_t *driver; /* VFD for file */ - H5FD_t *file = NULL; /* VFD file struct */ - H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ - H5P_genplist_t *plist; /* Property list pointer */ - unsigned long driver_flags = 0; /* File-inspecific driver feature flags */ - H5FD_file_image_info_t file_image_info; /* Initial file image */ - H5FD_t *ret_value = NULL; /* Return value */ + H5FD_t *file = NULL; /* File opened */ + H5FD_class_t *driver; /* VFD for file */ + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + H5P_genplist_t *plist; /* Property list pointer */ + unsigned long driver_flags = 0; /* File-inspecific driver feature flags */ + H5FD_file_image_info_t file_image_info; /* Initial file image */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI(FAIL) + + /* Reset 'out' parameter */ + *_file = NULL; /* Sanity checks */ if (0 == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "zero format address range"); /* Get file access property list */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); /* Get the VFD to open the file with */ if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID & info"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info"); /* Get driver info */ if (NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id))) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list"); + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list"); if (NULL == driver->open) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method"); + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no `open' method"); /* Query driver flag */ if (H5FD_driver_query(driver, &driver_flags) < 0) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't query VFD flags"); + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't query VFD flags"); /* Get initial file image info */ if (H5P_peek(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file image info"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info"); /* If an image is provided, make sure the driver supports this feature */ - assert(((file_image_info.buffer != NULL) && (file_image_info.size > 0)) || - ((file_image_info.buffer == NULL) && (file_image_info.size == 0))); - if ((file_image_info.buffer != NULL) && !(driver_flags & H5FD_FEAT_ALLOW_FILE_IMAGE)) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file image set, but not supported."); + assert((file_image_info.buffer && file_image_info.size > 0) || + (!file_image_info.buffer && file_image_info.size == 0)); + if (file_image_info.buffer && !(driver_flags & H5FD_FEAT_ALLOW_FILE_IMAGE)) + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file image set, but not supported."); - /* Dispatch to file driver */ if (HADDR_UNDEF == maxaddr) maxaddr = driver->maxaddr; - if (NULL == (file = (driver->open)(name, flags, fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed"); + + /* Try dispatching to file driver */ + if (try) { + H5E_PAUSE_ERRORS + { + file = (driver->open)(name, flags, fapl_id, maxaddr); + } + H5E_RESUME_ERRORS + + /* Check if file was not opened */ + if (NULL == file) + HGOTO_DONE(SUCCEED); + } + else if (NULL == (file = (driver->open)(name, flags, fapl_id, maxaddr))) + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "can't open file"); /* Set the file access flags */ file->access_flags = flags; @@ -770,22 +794,22 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) */ file->driver_id = driver_prop.driver_id; if (H5I_inc_ref(file->driver_id, false) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver"); + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver"); file->cls = driver; file->maxaddr = maxaddr; - if (H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(file->threshold)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold"); - if (H5P_get(plist, H5F_ACS_ALIGN_NAME, &(file->alignment)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment"); + if (H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &file->threshold) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment threshold"); + if (H5P_get(plist, H5F_ACS_ALIGN_NAME, &file->alignment) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment"); /* Retrieve the VFL driver feature flags */ - if (H5FD__query(file, &(file->feature_flags)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver"); + if (H5FD__query(file, &file->feature_flags) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to query file driver"); /* Increment the global serial number & assign it to this H5FD_t object */ if (++H5FD_file_serial_no_g == 0) { /* (Just error out if we wrap around for now...) */ - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to get file serial number"); + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to get file serial number"); } /* end if */ file->fileno = H5FD_file_serial_no_g; @@ -793,8 +817,8 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* (This will be changed later, when the superblock is located) */ file->base_addr = 0; - /* Set return value */ - ret_value = file; + /* Set 'out' parameter */ + *_file = file; done: /* Can't cleanup 'file' information, since we don't know what type it is */ diff --git a/src/H5FDonion.c b/src/H5FDonion.c index f1b46d83ada..96f9166b244 100644 --- a/src/H5FDonion.c +++ b/src/H5FDonion.c @@ -710,25 +710,20 @@ H5FD__onion_create_truncate_onion(H5FD_onion_t *file, const char *filename, cons HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid backing FAPL ID"); /* Create backing files for onion history */ - - if (NULL == (file->original_file = H5FD_open(filename, flags, backing_fapl_id, maxaddr))) + if (H5FD_open(false, &file->original_file, filename, flags, backing_fapl_id, maxaddr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing file"); - - if (NULL == (file->onion_file = H5FD_open(name_onion, flags, backing_fapl_id, maxaddr))) + if (H5FD_open(false, &file->onion_file, name_onion, flags, backing_fapl_id, maxaddr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing onion file"); - - if (NULL == (file->recovery_file = H5FD_open(recovery_file_nameery, flags, backing_fapl_id, maxaddr))) + if (H5FD_open(false, &file->recovery_file, recovery_file_nameery, flags, backing_fapl_id, maxaddr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing file"); /* Write "empty" .h5 file contents (signature ONIONEOF) */ - if (H5FD_set_eoa(file->original_file, H5FD_MEM_DRAW, 8) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't extend EOA"); if (H5FD_write(file->original_file, H5FD_MEM_DRAW, 0, 8, "ONIONEOF") < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "cannot write header to the backing h5 file"); /* Write nascent history (with no revisions) to "recovery" */ - if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HISTORY))) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer"); size = H5FD__onion_history_encode(history, buf, &history->checksum); @@ -745,7 +740,6 @@ H5FD__onion_create_truncate_onion(H5FD_onion_t *file, const char *filename, cons /* Write history header with "no" history. * Size of the "recovery" history recorded for later use on close. */ - if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HEADER))) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer"); size = H5FD__onion_header_encode(hdr, buf, &hdr->checksum); @@ -1019,15 +1013,12 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma /* Opening an existing onion file */ /* Open the existing file using the specified fapl */ - if (NULL == (file->original_file = H5FD_open(filename, flags, backing_fapl_id, maxaddr))) + if (H5FD_open(false, &file->original_file, filename, flags, backing_fapl_id, maxaddr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open canonical file (does not exist?)"); /* Try to open any existing onion file */ - H5E_BEGIN_TRY - { - file->onion_file = H5FD_open(name_onion, flags, backing_fapl_id, maxaddr); - } - H5E_END_TRY + if (H5FD_open(true, &file->onion_file, name_onion, flags, backing_fapl_id, maxaddr) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "cannot try opening the backing onion file"); /* If that didn't work, create a new onion file */ /* TODO: Move to a new function */ @@ -1054,9 +1045,8 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma file->align_history_on_pages = true; } - if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->original_file, H5FD_MEM_DEFAULT))) { + if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->original_file, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file"); - } if (H5FD_set_eoa(file->original_file, H5FD_MEM_DRAW, canon_eof) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA"); hdr->origin_eof = canon_eof; @@ -1068,11 +1058,9 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid backing FAPL ID"); /* Create backing files for onion history */ - - if ((file->onion_file = H5FD_open(name_onion, (H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC), - backing_fapl_id, maxaddr)) == NULL) { + if (H5FD_open(false, &file->onion_file, name_onion, + (H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC), backing_fapl_id, maxaddr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "cannot open the backing onion file"); - } /* Write history header with "no" history */ hdr->history_size = H5FD_ONION_ENCODED_SIZE_HISTORY; /* record for later use */ @@ -1092,16 +1080,14 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma history->n_revisions = 0; size = H5FD__onion_history_encode(history, hist_buf, &history->checksum); file->header.history_size = size; /* record for later use */ - if (H5FD_ONION_ENCODED_SIZE_HISTORY != size) { + if (H5FD_ONION_ENCODED_SIZE_HISTORY != size) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't encode history"); - } if (H5FD_set_eoa(file->onion_file, H5FD_MEM_DRAW, saved_size + size + 1) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA"); - if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, 0, saved_size, head_buf) < 0) { + if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, 0, saved_size, head_buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL, "cannot write header to the backing onion file"); - } file->onion_eof = (haddr_t)saved_size; if (true == file->align_history_on_pages) @@ -1112,24 +1098,21 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma file->header.history_addr = file->onion_eof; /* Write nascent history (with no revisions) to the backing onion file */ - if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, saved_size + 1, size, hist_buf) < 0) { + if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, saved_size + 1, size, hist_buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL, "cannot write history to the backing onion file"); - } file->header.history_size = size; /* record for later use */ H5MM_xfree(head_buf); H5MM_xfree(hist_buf); } - else { + else HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open onion file (does not exist?)."); - } } - if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->original_file, H5FD_MEM_DEFAULT))) { + if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->original_file, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file"); - } if (H5FD_set_eoa(file->original_file, H5FD_MEM_DRAW, canon_eof) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA"); @@ -1139,10 +1122,9 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma file->align_history_on_pages = (file->header.flags & H5FD_ONION_HEADER_FLAG_PAGE_ALIGNMENT) ? true : false; - if (H5FD_ONION_HEADER_FLAG_WRITE_LOCK & file->header.flags) { - /* Opening a file twice in write mode is an error */ + /* Opening a file twice in write mode is an error */ + if (H5FD_ONION_HEADER_FLAG_WRITE_LOCK & file->header.flags) HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "Can't open file already opened in write-mode"); - } else { /* Read in the history from the onion file */ if (H5FD__onion_ingest_history(&file->history, file->onion_file, file->header.history_addr, @@ -1154,21 +1136,18 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma fa->revision_num != H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "target revision ID out of range"); - if (fa->revision_num == 0) { + if (fa->revision_num == 0) file->curr_rev_record.logical_eof = canon_eof; - } else if (file->history.n_revisions > 0 && H5FD__onion_ingest_revision_record( &file->curr_rev_record, file->onion_file, &file->history, - MIN(fa->revision_num - 1, (file->history.n_revisions - 1))) < 0) { + MIN(fa->revision_num - 1, (file->history.n_revisions - 1))) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get revision record from backing store"); - } if (H5F_ACC_RDWR & flags) if (H5FD__onion_open_rw(file, flags, maxaddr, new_open) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "can't write-open write-locked file"); } - } /* End if opening existing file */ /* Copy comment from FAPL info, if one is given */ @@ -1211,7 +1190,6 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma H5I_dec_app_ref(fa->backing_fapl_id); if ((NULL == ret_value) && file) { - if (file->original_file) if (H5FD_close(file->original_file) < 0) HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy backing canon"); @@ -1221,13 +1199,11 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma if (file->recovery_file) if (H5FD_close(file->recovery_file) < 0) HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy backing recov"); - if (file->rev_index) if (H5FD__onion_revision_index_destroy(file->rev_index) < 0) HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy revision index"); H5MM_xfree(file->history.record_locs); - H5MM_xfree(file->recovery_file_name); H5MM_xfree(file->curr_rev_record.comment); @@ -1270,10 +1246,8 @@ H5FD__onion_open_rw(H5FD_onion_t *file, unsigned int flags, haddr_t maxaddr, boo HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't write-open write-locked file"); /* Copy history to recovery file */ - - if (NULL == - (file->recovery_file = H5FD_open(file->recovery_file_name, (flags | H5F_ACC_CREAT | H5F_ACC_TRUNC), - file->fa.backing_fapl_id, maxaddr))) + if (H5FD_open(false, &file->recovery_file, file->recovery_file_name, + (flags | H5F_ACC_CREAT | H5F_ACC_TRUNC), file->fa.backing_fapl_id, maxaddr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "unable to create recovery file"); if (0 == (size = H5FD__onion_write_history(&file->history, file->recovery_file, 0, 0))) @@ -1282,20 +1256,15 @@ H5FD__onion_open_rw(H5FD_onion_t *file, unsigned int flags, haddr_t maxaddr, boo HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "written history differed from expected size"); /* Set write-lock flag in onion header */ - if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HEADER))) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate space for encoded buffer"); - file->header.flags |= H5FD_ONION_HEADER_FLAG_WRITE_LOCK; - if (0 == (size = H5FD__onion_header_encode(&file->header, buf, &checksum))) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "problem encoding history header"); - if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, 0, size, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write updated history header"); /* Prepare revision index and finalize write-mode open */ - if (NULL == (file->rev_index = H5FD__onion_revision_index_init(file->fa.page_size))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize revision index"); file->curr_rev_record.parent_revision_num = file->curr_rev_record.revision_num; @@ -1679,7 +1648,7 @@ H5FDonion_get_revision_count(const char *filename, hid_t fapl_id, uint64_t *revi HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Onion VFL driver"); /* Open the file with the driver */ - if (NULL == (file = H5FD_open(filename, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF))) + if (H5FD_open(false, &file, filename, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "unable to open file with onion driver"); /* Call the private function */ diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 2fe54a588a9..942dc21e2e5 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -124,7 +124,8 @@ H5_DLL htri_t H5FD_is_driver_registered_by_name(const char *driver_name, H5_DLL htri_t H5FD_is_driver_registered_by_value(H5FD_class_value_t driver_value, hid_t *registered_id); H5_DLL hid_t H5FD_get_driver_id_by_name(const char *name, bool is_api); H5_DLL hid_t H5FD_get_driver_id_by_value(H5FD_class_value_t value, bool is_api); -H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); +H5_DLL herr_t H5FD_open(bool try, H5FD_t **file, const char *name, unsigned flags, hid_t fapl_id, + haddr_t maxaddr); H5_DLL herr_t H5FD_close(H5FD_t *file); H5_DLL int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2); H5_DLL herr_t H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags /*out*/); diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index 434f870407f..778d112822e 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -854,12 +854,9 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha } /* 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 (H5FD_open(false, &file_ptr->rw_file, name, flags, fapl_ptr->rw_fapl_id, HADDR_UNDEF) < 0) 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) + if (H5FD_open(false, &file_ptr->wo_file, fapl_ptr->wo_path, flags, fapl_ptr->wo_fapl_id, HADDR_UNDEF) < 0) H5FD_SPLITTER_WO_ERROR(file_ptr, __func__, H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open W/O file") ret_value = (H5FD_t *)file_ptr; diff --git a/src/H5FDsubfiling/H5FDsubfiling.c b/src/H5FDsubfiling/H5FDsubfiling.c index 7971050b1c4..6fbd3696200 100644 --- a/src/H5FDsubfiling/H5FDsubfiling.c +++ b/src/H5FDsubfiling/H5FDsubfiling.c @@ -1235,7 +1235,7 @@ H5FD__subfiling_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t ma H5_SUBFILING_GOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, "can't set stub file ID on FAPL"); /* Open the HDF5 file's subfiles */ - if (NULL == (file_ptr->sf_file = H5FD_open(name, flags, file_ptr->fa.ioc_fapl_id, HADDR_UNDEF))) + if (H5FD_open(false, &file_ptr->sf_file, name, flags, file_ptr->fa.ioc_fapl_id, HADDR_UNDEF) < 0) H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open IOC file"); if (driver->value == H5_VFD_IOC) { diff --git a/src/H5FDsubfiling/H5subfiling_common.c b/src/H5FDsubfiling/H5subfiling_common.c index 0493603f828..53fb0ce3c4c 100644 --- a/src/H5FDsubfiling/H5subfiling_common.c +++ b/src/H5FDsubfiling/H5subfiling_common.c @@ -573,7 +573,7 @@ H5_open_subfiling_stub_file(const char *name, unsigned flags, MPI_Comm file_comm if (H5P_set_driver(plist, H5FD_MPIO, NULL, NULL) < 0) H5_SUBFILING_GOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI I/O driver on FAPL"); - if (NULL == (stub_file = H5FD_open(name, flags, fapl_id, HADDR_UNDEF))) + if (H5FD_open(false, &stub_file, name, flags, fapl_id, HADDR_UNDEF) < 0) H5_SUBFILING_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "couldn't open HDF5 stub file"); HDcompile_assert(sizeof(uint64_t) >= sizeof(ino_t)); diff --git a/src/H5Fefc.c b/src/H5Fefc.c index fa7dd1e6d0b..e8ecc6d0efe 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -62,6 +62,8 @@ struct H5F_efc_t { }; /* Private prototypes */ +static herr_t H5F__efc_open_file(bool try, H5F_t **file, const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id); static herr_t H5F__efc_release_real(H5F_efc_t *efc); static herr_t H5F__efc_remove_ent(H5F_efc_t *efc, H5F_efc_ent_t *ent); static void H5F__efc_try_close_tag1(H5F_shared_t *sf, H5F_shared_t **tail); @@ -114,66 +116,128 @@ H5F__efc_create(unsigned max_nfiles) FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__efc_create() */ +/*------------------------------------------------------------------------- + * Function: H5F__efc_open_file + * + * Purpose: Helper routine to try opening and setting up a file. + * + * If the 'try' flag is true, not opening the file with the + * underlying 'open' call is not treated an error; SUCCEED is + * returned, with the file ptr set to NULL. If 'try' is false, + * failing the 'open' call generates an error. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5F__efc_open_file(bool try, H5F_t **_file, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) +{ + H5F_t *file = NULL; /* File opened */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Reset 'out' parameter */ + *_file = NULL; + + /* Open the file */ + if (H5F_open(try, &file, name, flags, fcpl_id, fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't open file"); + + /* Check if file was not opened */ + if (NULL == file) { + assert(try); + HGOTO_DONE(SUCCEED); + } + + /* Make file post open call */ + if (H5F__post_open(file) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file"); + + /* Increment the number of open objects to prevent the file from being + * closed out from under us - "simulate" having an open file id. Note + * that this behaviour replaces the calls to H5F_incr_nopen_objs() and + * H5F_decr_nopen_objs() in H5L_extern_traverse(). */ + file->nopen_objs++; + + /* Set 'out' parameter */ + *_file = file; + +done: + if (ret_value < 0) + if (file) + if (H5F_try_close(file, NULL) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file"); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__efc_open_file() */ + /*------------------------------------------------------------------------- * Function: H5F__efc_open * - * Purpose: Opens a file using the external file cache. The target - * file is added to the external file cache of the parent - * if it is not already present. If the target file is in - * the parent's EFC, simply returns the target file. When + * Purpose: Attempts to open a file using the external file cache. + * + * The target file is added to the external file cache of the + * parent if it is not already present. If the target file is + * in the parent's EFC, simply returns the target file. When * the file object is no longer in use, it should be closed * with H5F_efc_close (will not actually close the file * until it is evicted from the EFC). * - * Return: Pointer to open file on success - * NULL on failure + * If the 'try' flag is true, not opening the file with the + * underlying 'open' call is not treated an error; SUCCEED is + * returned, with the file ptr set to NULL. If 'try' is false, + * failing the 'open' call generates an error. + * + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -H5F_t * -H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) +herr_t +H5F__efc_open(bool try, H5F_efc_t *efc, H5F_t **_file, const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id) { - H5F_efc_ent_t *ent = NULL; /* Entry for target file in efc */ - bool open_file = false; /* Whether ent->file needs to be closed in case of error */ - H5P_genplist_t *plist; /* Property list pointer for FAPL */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - H5F_t *ret_value = NULL; /* Return value */ + H5F_efc_ent_t *ent = NULL; /* Entry for target file in efc */ + bool open_file = false; /* Whether ent->file needs to be closed in case of error */ + H5P_genplist_t *plist; /* Property list pointer for FAPL */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity checks */ + assert(_file); assert(name); + /* Reset 'out' parameter */ + *_file = NULL; + /* Get the VOL info from the fapl */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, NULL, "not a file access property list"); + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info"); + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL connector info"); /* Stash a copy of the "top-level" connector property, before any pass-through * connectors modify or unwrap it. */ if (H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set VOL connector info in API context"); + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VOL connector info in API context"); - /* Check if the EFC exists. If it does not, just call H5F_open(). We + /* Check if the EFC exists. If it does not, just open the file. We * support this so clients do not have to make 2 different calls depending * on the state of the efc. */ if (!efc) { - if (NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file"); + if (H5F__efc_open_file(try, _file, name, flags, fcpl_id, fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file"); - /* Make file post open call */ - if (H5F__post_open(ret_value) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file"); + /* Check if file was not opened */ + if (NULL == *_file) + assert(try); - /* Increment the number of open objects to prevent the file from being - * closed out from under us - "simulate" having an open file id. Note - * that this behaviour replaces the calls to H5F_incr_nopen_objs() and - * H5F_decr_nopen_objs() in H5L_extern_traverse(). */ - ret_value->nopen_objs++; - - HGOTO_DONE(ret_value); + /* Done now */ + HGOTO_DONE(SUCCEED); } /* end if */ /* Search the skip list for name if the skip list exists, create the skip @@ -185,7 +249,7 @@ H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, h else { assert(efc->nfiles == 0); if (NULL == (efc->slist = H5SL_create(H5SL_TYPE_STR, NULL))) - HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, NULL, "can't create skip list"); + HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "can't create skip list"); } /* end else */ /* If we found the file update the LRU list and return the cached file, @@ -231,54 +295,56 @@ H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, h * do not add it to cache */ if (ent) { if (H5F__efc_remove_ent(efc, ent) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTREMOVE, NULL, + HGOTO_ERROR(H5E_FILE, H5E_CANTREMOVE, FAIL, "can't remove entry from external file cache"); /* Do not free ent, we will recycle it below */ } /* end if */ else { - /* Cannot cache file, just open file and return */ - if (NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file"); + /* Cannot cache file, just try opening file and return */ + if (H5F__efc_open_file(try, _file, name, flags, fcpl_id, fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file"); - /* Make file post open call */ - if (H5F__post_open(ret_value) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file"); + /* Check if file was not opened */ + if (NULL == *_file) + assert(try); - /* Increment the number of open objects to prevent the file from - * being closed out from under us - "simulate" having an open - * file id */ - ret_value->nopen_objs++; - - HGOTO_DONE(ret_value); + /* Done now */ + HGOTO_DONE(SUCCEED); } /* end else */ } /* end if */ else /* Allocate new entry */ if (NULL == (ent = H5FL_MALLOC(H5F_efc_ent_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "memory allocation failed"); - /* Build new entry */ - if (NULL == (ent->name = H5MM_strdup(name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + /* Reset pointers */ + ent->file = NULL; + ent->name = NULL; - /* Open the file */ - if (NULL == (ent->file = H5F_open(name, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file"); - open_file = true; + /* Try opening the file */ + if (H5F__efc_open_file(try, &ent->file, name, flags, fcpl_id, fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file"); - /* Make file post open call */ - if (H5F__post_open(ent->file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file"); + /* Check if file was actually opened */ + if (NULL == ent->file) { + /* Sanity check */ + assert(try); + + ent = H5FL_FREE(H5F_efc_ent_t, ent); + HGOTO_DONE(SUCCEED); + } + else + open_file = true; - /* Increment the number of open objects to prevent the file from being - * closed out from under us - "simulate" having an open file id */ - ent->file->nopen_objs++; + /* Build new entry */ + if (NULL == (ent->name = H5MM_strdup(name))) + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Add the file to the cache */ /* Skip list */ if (H5SL_insert(efc->slist, ent, ent->name) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, NULL, "can't insert entry into skip list"); + HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, FAIL, "can't insert entry into skip list"); /* Add to head of LRU list and update tail if necessary */ ent->LRU_next = efc->LRU_head; @@ -300,23 +366,18 @@ H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, h ent->file->shared->efc->nrefs++; } /* end else */ - assert(ent); - assert(ent->file); - assert(ent->name); - assert(ent->nopen); - - /* Set the return value */ - ret_value = ent->file; + /* Set 'out' parameter */ + *_file = ent->file; done: - if (!ret_value) + if (ret_value < 0) if (ent) { if (open_file) { ent->file->nopen_objs--; if (H5F_try_close(ent->file, NULL) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "can't close external file"); + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file"); } /* end if */ - ent->name = (char *)H5MM_xfree(ent->name); + ent->name = H5MM_xfree(ent->name); ent = H5FL_FREE(H5F_efc_ent_t, ent); } /* end if */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 0cc48c82c9f..883cc00d857 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -819,12 +819,12 @@ H5F__getenv_prefix_name(char **env_prefix /*in,out*/) * * Purpose: Attempts to open a dataset file. * - * Return: Pointer to an opened file on success / NULL on failure + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ -H5F_t * -H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const char *prop_prefix, - const char *file_name, unsigned file_intent, hid_t fapl_id) +herr_t +H5F_prefix_open_file(bool try, H5F_t **_file, H5F_t *primary_file, H5F_prefix_open_t prefix_type, + const char *prop_prefix, const char *file_name, unsigned file_intent, hid_t fapl_id) { H5F_t *src_file = NULL; /* Source file */ H5F_efc_t *efc = NULL; /* External file cache */ @@ -832,12 +832,14 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c char *actual_file_name = NULL; /* File's actual name */ char *temp_file_name = NULL; /* Temporary pointer to file name */ size_t temp_file_name_len; /* Length of temporary file name */ - H5F_t *ret_value = NULL; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI(FAIL) - assert(primary_file); - assert(primary_file->shared); + assert(_file); + + /* Reset 'out' parameter */ + *_file = NULL; efc = primary_file->shared->efc; @@ -846,21 +848,19 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Copy the file name to use */ if (NULL == (temp_file_name = H5MM_strdup(file_name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "memory allocation failed"); temp_file_name_len = strlen(temp_file_name); /* Target file_name is an absolute pathname: see RM for detailed description */ if (H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) { /* Try opening file */ - src_file = H5F__efc_open(efc, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + if (H5F__efc_open(true, efc, &src_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file"); /* Adjust temporary file name if file not opened */ if (NULL == src_file) { char *ptr; - /* Reset the error stack */ - H5E_clear_stack(); - /* Get last component of file_name */ H5_GET_LAST_DELIMITER(file_name, ptr) assert(ptr); @@ -875,13 +875,11 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c } /* end if */ else if (H5_CHECK_ABS_DRIVE(file_name)) { /* Try opening file */ - src_file = H5F__efc_open(efc, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + if (H5F__efc_open(true, efc, &src_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file"); /* Adjust temporary file name if file not opened */ if (NULL == src_file) { - /* Reset the error stack */ - H5E_clear_stack(); - /* Strip ":" */ strncpy(temp_file_name, &file_name[2], temp_file_name_len); temp_file_name[temp_file_name_len - 1] = '\0'; @@ -898,7 +896,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c else if (H5F_PREFIX_ELINK == prefix_type) env_prefix = getenv("HDF5_EXT_PREFIX"); else - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, NULL, "prefix type is not sensible"); + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "prefix type is not sensible"); /* If environment variable is defined, iterate through prefixes it defines */ if (NULL != env_prefix) { @@ -906,7 +904,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Make a copy of the environment variable string */ if (NULL == (saved_env = tmp_env_prefix = H5MM_strdup(env_prefix))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Loop over prefixes in environment variable */ while ((tmp_env_prefix) && (*tmp_env_prefix)) { @@ -916,23 +914,20 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c if (out_prefix_name && (*out_prefix_name)) { if (H5F__build_name(out_prefix_name, temp_file_name, &full_name /*out*/) < 0) { saved_env = (char *)H5MM_xfree(saved_env); - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename"); + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't prepend prefix to filename"); } /* end if */ /* Try opening file */ - src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + if (H5F__efc_open(true, efc, &src_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, + fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file"); /* Release copy of file name */ full_name = (char *)H5MM_xfree(full_name); - /* Check for file not opened */ - if (NULL == src_file) - /* Reset the error stack */ - H5E_clear_stack(); /* Leave if file was opened */ - else + if (src_file) break; - H5E_clear_stack(); } /* end if */ } /* end while */ @@ -944,18 +939,14 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c if (src_file == NULL && prop_prefix) { /* Construct name to open */ if (H5F__build_name(prop_prefix, temp_file_name, &full_name /*out*/) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename"); + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't prepend prefix to filename"); /* Try opening file */ - src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + if (H5F__efc_open(true, efc, &src_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file"); /* Release name */ full_name = (char *)H5MM_xfree(full_name); - - /* Check for file not opened */ - if (NULL == src_file) - /* Reset the error stack */ - H5E_clear_stack(); } /* end if */ /* Try searching from main file's "extpath": see description in H5F_open() & H5_build_extpath() */ @@ -965,30 +956,24 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c if (NULL != (dspath = H5F_EXTPATH(primary_file))) { /* Construct name to open */ if (H5F__build_name(dspath, temp_file_name, &full_name /*out*/) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename"); + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't prepend prefix to filename"); /* Try opening file */ - src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + if (H5F__efc_open(true, efc, &src_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, + fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file"); /* Release name */ full_name = (char *)H5MM_xfree(full_name); - - /* Check for file not opened */ - if (NULL == src_file) - /* Reset the error stack */ - H5E_clear_stack(); } /* end if */ } /* end if */ /* Try the relative file_name stored in temp_file_name */ if (src_file == NULL) { /* Try opening file */ - src_file = H5F__efc_open(efc, temp_file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); - - /* Check for file not opened */ - if (NULL == src_file) - /* Reset the error stack */ - H5E_clear_stack(); + if (H5F__efc_open(true, efc, &src_file, temp_file_name, file_intent, H5P_FILE_CREATE_DEFAULT, + fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file"); } /* end if */ /* try the 'resolved' name for the virtual file */ @@ -997,7 +982,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Copy resolved file name */ if (NULL == (actual_file_name = H5MM_strdup(H5F_ACTUAL_NAME(primary_file)))) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "can't duplicate resolved file name string"); + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't duplicate resolved file name string"); /* get last component of file_name */ H5_GET_LAST_DELIMITER(actual_file_name, ptr) @@ -1007,28 +992,28 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Build new file name for the external file */ if (H5F__build_name((ptr ? actual_file_name : ""), temp_file_name, &full_name /*out*/) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename"); + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't prepend prefix to filename"); actual_file_name = (char *)H5MM_xfree(actual_file_name); /* Try opening with the resolved name */ - src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + if (H5F__efc_open(true, efc, &src_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file"); /* Release name */ full_name = (char *)H5MM_xfree(full_name); - - /* Check for file not opened */ - if (NULL == src_file) - /* Reset the error stack */ - H5E_clear_stack(); } /* end if */ - /* Set return value (possibly NULL or valid H5F_t *) */ - ret_value = src_file; + /* Set 'out' parameter */ + *_file = src_file; + + /* See is we should return an error */ + if (NULL == src_file && !try) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't open file"); done: - if ((NULL == ret_value) && src_file) - if (H5F_efc_close(primary_file, src_file) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "can't close source file"); + if (ret_value < 0) + if (src_file && H5F_efc_close(primary_file, src_file) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close source file"); if (full_name) full_name = (char *)H5MM_xfree(full_name); if (temp_file_name) @@ -1050,7 +1035,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c htri_t H5F__is_hdf5(const char *name, hid_t fapl_id) { - H5FD_t *file = NULL; /* Low-level file struct */ + H5FD_t *lf = NULL; /* Low-level file struct */ H5F_shared_t *shared = NULL; /* Shared part of file */ haddr_t sig_addr = HADDR_UNDEF; /* Address of hdf5 file signature */ htri_t ret_value = FAIL; /* Return value */ @@ -1061,7 +1046,7 @@ H5F__is_hdf5(const char *name, hid_t fapl_id) /* NOTE: This now uses the fapl_id that was passed in, so H5Fis_accessible() * should work with arbitrary VFDs, unlike H5Fis_hdf5(). */ - if (NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF))) + if (H5FD_open(false, &lf, name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to open file"); /* If the file is already open, it's an HDF5 file @@ -1070,19 +1055,19 @@ H5F__is_hdf5(const char *name, hid_t fapl_id) * mandatory file locks (like Windows), creating a new file handle and attempting * to read through it will fail so we have to try this first. */ - if ((shared = H5F__sfile_search(file)) != NULL) + if (NULL != (shared = H5F__sfile_search(lf))) ret_value = true; else { /* The file is an HDF5 file if the HDF5 file signature can be found */ - if (H5FD_locate_signature(file, &sig_addr) < 0) + if (H5FD_locate_signature(lf, &sig_addr) < 0) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "error while trying to locate file signature"); ret_value = (HADDR_UNDEF != sig_addr); } done: /* Close the file */ - if (file) - if (H5FD_close(file) < 0 && true == ret_value) + if (lf) + if (H5FD_close(lf) < 0 && true == ret_value) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); FUNC_LEAVE_NOAPI(ret_value) @@ -1724,10 +1709,10 @@ H5F__check_if_using_file_locks(H5P_genplist_t *fapl, bool *use_file_locking, boo } /* end H5F__check_if_using_file_locks() */ /*------------------------------------------------------------------------- - * Function: H5F_open + * Function: H5F_open * - * Purpose: Opens (or creates) a file. This function understands the - * following flags which are similar in nature to the Posix + * Purpose: Attempts to open (or create) a file. This function understands + * the following flags which are similar in nature to the POSIX * open(2) flags. * * H5F_ACC_RDWR: Open with read/write access. If the file is @@ -1791,13 +1776,17 @@ H5F__check_if_using_file_locks(H5P_genplist_t *fapl, bool *use_file_locking, boo * f: the open fails with flags combination from both the first and second opens * s: the open succeeds with flags combination from both the first and second opens * + * NOTE: If the 'try' flag is true, not opening the file with the + * "non-tentative" VFD 'open' call is not treated an error; SUCCEED is + * returned, with the file ptr set to NULL. If 'try' is false, failing + * the "non-tentative" VFD 'open' call generates an error. + * + * Return: SUCCEED/FAIL * - * Return: Success: A new file pointer. - * Failure: NULL *------------------------------------------------------------------------- */ -H5F_t * -H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) +herr_t +H5F_open(bool try, H5F_t **_file, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { H5F_t *file = NULL; /*the success return value */ H5F_shared_t *shared = NULL; /*shared part of `file' */ @@ -1809,16 +1798,19 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) size_t page_buf_size; unsigned page_buf_min_meta_perc = 0; unsigned page_buf_min_raw_perc = 0; - bool set_flag = false; /*set the status_flags in the superblock */ - bool clear = false; /*clear the status_flags */ - bool evict_on_close; /* evict on close value from plist */ - bool use_file_locking = true; /* Using file locks? */ - bool ignore_disabled_locks = false; /* Ignore disabled file locks? */ - bool ci_load = false; /* whether MDC ci load requested */ - bool ci_write = false; /* whether MDC CI write requested */ - H5F_t *ret_value = NULL; /*actual return value */ + bool set_flag = false; /*set the status_flags in the superblock */ + bool clear = false; /*clear the status_flags */ + bool evict_on_close; /* evict on close value from plist */ + bool use_file_locking = true; /* Using file locks? */ + bool ignore_disabled_locks = false; /* Ignore disabled file locks? */ + bool ci_load = false; /* whether MDC ci load requested */ + bool ci_write = false; /* whether MDC CI write requested */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) - FUNC_ENTER_NOAPI(NULL) + /* Reset 'out' parameter */ + *_file = NULL; /* * If the driver has a 'cmp' method then the driver is capable of @@ -1829,15 +1821,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * same file more than once at a time. */ if (NULL == (drvr = H5FD_get_class(fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to retrieve VFL class"); + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve VFL class"); /* Get the file access property list, for future queries */ if (NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list"); /* Check if we are using file locking */ if (H5F__check_if_using_file_locks(a_plist, &use_file_locking, &ignore_disabled_locks) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file locking flags"); + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file locking flags"); /* * Opening a file is a two step process. First we try to open the @@ -1850,40 +1842,40 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * application's responsibility to prevent this situation (there's no * way for us to detect it here anyway). */ - if (drvr->cmp) + if (drvr->cmp) { tent_flags = flags & ~(H5F_ACC_CREAT | H5F_ACC_TRUNC | H5F_ACC_EXCL); - else - tent_flags = flags; - /* - * When performing a tentative open of a file where we have stripped away - * flags such as H5F_ACC_CREAT from the specified file access flags, the - * H5E_BEGIN/END_TRY macros are used to suppress error output since there - * is an expectation that the tentative open might fail. Even though we - * explicitly clear the error stack after such a failure, the underlying - * file driver might maintain its own error stack and choose whether to - * display errors based on whether the library has disabled error reporting. - * Since we wish to suppress that error output as well for the case of - * tentative file opens, surrounding the file open call with the - * H5E_BEGIN/END_TRY macros is an explicit instruction to the file driver - * not to display errors. If the tentative file open call fails, another - * attempt at opening the file will be made without error output being - * suppressed. - * - * However, if stripping away the H5F_ACC_CREAT flag and others left us - * with the same file access flags as before, then we will skip this - * tentative file open and only make a single attempt at opening the file. - * In this case, we don't want to suppress error output since the underlying - * file driver might provide more details on why the file open failed. - */ - if (tent_flags != flags) { - /* Make tentative attempt to open file */ - H5E_BEGIN_TRY - { - lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF); + /* + * When performing a tentative open of a file where we have stripped + * away flags such as H5F_ACC_CREAT from the specified file access + * flags, use 'try open' operation to avoid pushing error messages + * on the error stack since there is an expectation that the tentative + * open might fail. + * + * If the tentative file open call fails, another attempt at opening + * the file will be made without error output being suppressed. + * + * However, if stripping away the H5F_ACC_CREAT flag and others left + * us with the same file access flags as before, then we will skip + * this tentative file open and only make a single attempt at opening + * the file. In this case, we don't want to suppress errors since + * the underlying file driver might provide more details on why the + * file open failed. + */ + if (tent_flags != flags) { + /* Make tentative attempt to open file */ + if (H5FD_open(true, &lf, name, tent_flags, fapl_id, HADDR_UNDEF) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file"); + + /* If the tentative open failed, reset the file access flags, + * then make another attempt at opening the file. + */ + if (NULL == lf) + tent_flags = flags; } - H5E_END_TRY } + else + tent_flags = flags; /* * If a tentative attempt to open the file wasn't necessary, attempt @@ -1891,15 +1883,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * the error stack and reset the file access flags, then make another * attempt at opening the file. */ - if ((tent_flags == flags) || (lf == NULL)) { - if (tent_flags != flags) { - H5E_clear_stack(); - tent_flags = flags; + if (NULL == lf) { + if (H5FD_open(try, &lf, name, tent_flags, fapl_id, HADDR_UNDEF) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't try opening file"); + + /* Check if file was not opened */ + if (NULL == lf) { + assert(try); + HGOTO_DONE(SUCCEED); } - - if (NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", - name, tent_flags); } /* Is the file already open? */ @@ -1915,26 +1907,26 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * SWMR write/read access flags don't agree. */ if (H5FD_close(lf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to close low-level file info"); if (flags & H5F_ACC_TRUNC) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to truncate a file which is already open"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to truncate a file which is already open"); if (flags & H5F_ACC_EXCL) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file exists"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "file exists"); if ((flags & H5F_ACC_RDWR) && 0 == (shared->flags & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is already open for read-only"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "file is already open for read-only"); if ((flags & H5F_ACC_SWMR_WRITE) && 0 == (shared->flags & H5F_ACC_SWMR_WRITE)) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "SWMR write access flag not the same for file that is already open"); if ((flags & H5F_ACC_SWMR_READ) && !((shared->flags & H5F_ACC_SWMR_WRITE) || (shared->flags & H5F_ACC_SWMR_READ) || (shared->flags & H5F_ACC_RDWR))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "SWMR read access flag not the same for file that is already open"); /* Allocate new "high-level" file struct */ if ((file = H5F__new(shared, flags, fcpl_id, fapl_id, NULL)) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create new file object"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create new file object"); } /* end if */ else { /* Check if tentative open was good enough */ @@ -1945,10 +1937,12 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * file and open it for real. */ if (H5FD_close(lf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to close low-level file info"); + lf = NULL; - if (NULL == (lf = H5FD_open(name, flags, fapl_id, HADDR_UNDEF))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file"); + if (H5FD_open(false, &lf, name, flags, fapl_id, HADDR_UNDEF) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file"); + assert(lf); } /* end if */ /* Place an advisory lock on the file */ @@ -1956,8 +1950,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if (H5FD_lock(lf, (bool)((flags & H5F_ACC_RDWR) ? true : false)) < 0) { /* Locking failed - Closing will remove the lock */ if (H5FD_close(lf) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "unable to close low-level file info"); - HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, NULL, "unable to lock the file"); + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close low-level file info"); + HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, FAIL, "unable to lock the file"); } /* end if */ /* Create the 'top' file structure */ @@ -1967,8 +1961,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * so we have to close lf here before heading to the error handling. */ if (H5FD_close(lf) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info"); - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to initialize file structure"); + HDONE_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to close low-level file info"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to initialize file structure"); } /* end if */ /* Need to set status_flags in the superblock if the driver has a 'lock' method */ @@ -1978,9 +1972,9 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Check to see if both SWMR and cache image are requested. Fail if so */ if (H5C_cache_image_status(file, &ci_load, &ci_write) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get MDC cache image status"); + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MDC cache image status"); if ((ci_load || ci_write) && (flags & (H5F_ACC_SWMR_READ | H5F_ACC_SWMR_WRITE))) - HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, NULL, "can't have both SWMR and cache image"); + HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "can't have both SWMR and cache image"); /* Retain the name the file was opened with */ file->open_name = H5MM_xstrdup(name); @@ -1998,26 +1992,26 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) } else if (shared->nrefs > 1) { if (file->shared->use_file_locking != use_file_locking) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file locking flag values don't match"); + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "file locking flag values don't match"); if (file->shared->use_file_locking && (file->shared->ignore_disabled_locks != ignore_disabled_locks)) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "file locking 'ignore disabled locks' flag values don't match"); } /* Check if page buffering is enabled */ if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &page_buf_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get page buffer size"); + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get page buffer size"); if (page_buf_size) { /* Query for other page buffer cache properties */ if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &page_buf_min_meta_perc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get minimum metadata fraction of page buffer"); + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get minimum metadata fraction of page buffer"); if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &page_buf_min_raw_perc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get minimum raw data fraction of page buffer"); + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get minimum raw data fraction of page buffer"); } /* end if */ /* Get the evict on close setting */ if (H5P_get(a_plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, &evict_on_close) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get evict on close value"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get evict on close value"); #ifdef H5_HAVE_PARALLEL /* Check for unsupported settings in parallel */ @@ -2033,15 +2027,16 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if (page_buf_size) { /* Collective metadata writes are not supported with page buffering */ if (file->shared->coll_md_write) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "collective metadata writes are not supported with page buffering"); - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "page buffering is disabled for parallel"); + /* Temporary: fail file create when page buffering feature is enabled for parallel */ + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "page buffering is disabled for parallel"); } if (mpi_size > 1) { if (evict_on_close) - HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, NULL, + HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "evict on close is currently not supported in parallel HDF5"); } } @@ -2061,24 +2056,24 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Create the page buffer before initializing the superblock */ if (page_buf_size) if (H5PB_create(shared, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer"); + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create page buffer"); /* Initialize information about the superblock and allocate space for it */ /* (Writes superblock extension messages, if there are any) */ if (H5F__super_init(file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to allocate file superblock"); + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to allocate file superblock"); /* Create and open the root group */ /* (This must be after the space for the superblock is allocated in * the file, since the superblock must be at offset 0) */ if (H5G_mkroot(file, true) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group"); + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create/open root group"); } /* end if */ else if (1 == shared->nrefs) { /* Read the superblock if it hasn't been read before. */ if (H5F__super_read(file, a_plist, true) < 0) - HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock"); + HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "unable to read superblock"); /* Skip trying to create a page buffer if the file space strategy * stored in the superblock isn't paged. @@ -2097,11 +2092,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Create the page buffer *after* reading the superblock */ if (page_buf_size) if (H5PB_create(shared, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer"); + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create page buffer"); /* Open the root group */ if (H5G_mkroot(file, false) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read root group"); } /* end if */ /* @@ -2111,7 +2106,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * the degree in shared file structure. */ if (H5P_get(a_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file close degree"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree"); if (shared->nrefs == 1) { if (fc_degree == H5F_CLOSE_DEFAULT) shared->fc_degree = lf->cls->fc_degree; @@ -2120,16 +2115,16 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) } /* end if */ else if (shared->nrefs > 1) { if (fc_degree == H5F_CLOSE_DEFAULT && shared->fc_degree != lf->cls->fc_degree) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match"); + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "file close degree doesn't match"); if (fc_degree != H5F_CLOSE_DEFAULT && fc_degree != shared->fc_degree) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match"); + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "file close degree doesn't match"); } /* end if */ /* This is a private property to clear the status_flags in the super block */ /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */ if (H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) { if (H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get clearance for status_flags"); else if (clear) file->shared->sblock->status_flags = 0; } /* end if */ @@ -2143,18 +2138,18 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) shared->evict_on_close = evict_on_close; else if (shared->nrefs > 1) { if (shared->evict_on_close != evict_on_close) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "file evict-on-close value doesn't match"); + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file evict-on-close value doesn't match"); } /* end if */ /* Formulate the absolute path for later search of target file for external links */ if (shared->nrefs == 1) { if (H5_build_extpath(name, &file->shared->extpath) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath"); + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to build extpath"); } /* Formulate the actual file name, after following symlinks, etc. */ if (H5F__build_actual_name(file, a_plist, name, &file->actual_name) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build actual name"); + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to build actual name"); if (set_flag) { if (H5F_INTENT(file) & H5F_ACC_RDWR) { /* Set and check consistency of status_flags */ @@ -2163,7 +2158,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if (file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS || file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "file is already open for write/SWMR write (may use to clear " "file consistency flags)"); } /* version 3 superblock */ @@ -2174,16 +2169,16 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Flush the superblock & superblock extension */ if (H5F_super_dirty(file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, NULL, "unable to mark superblock as dirty"); + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty"); if (H5F_flush_tagged_metadata(file, H5AC__SUPERBLOCK_TAG) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, NULL, "unable to flush superblock"); + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock"); if (H5F_flush_tagged_metadata(file, file->shared->sblock->ext_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, NULL, "unable to flush superblock extension"); + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock extension"); /* Remove the file lock for SWMR_WRITE */ if (use_file_locking && (H5F_INTENT(file) & H5F_ACC_SWMR_WRITE)) { if (H5FD_unlock(file->shared->lf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, NULL, "unable to unlock the file"); + HGOTO_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock the file"); } /* end if */ } /* end if */ else { /* H5F_ACC_RDONLY: check consistency of status_flags */ @@ -2194,25 +2189,25 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) !(file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)) || (!(file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) && file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "file is not already open for SWMR writing"); } /* end if */ else if ((file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) || (file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "file is already open for write (may use to clear file " "consistency flags)"); } /* version 3 superblock */ } /* end else */ } /* end if set_flag */ - /* Success */ - ret_value = file; + /* Set 'out' parameter */ + *_file = file; done: - if ((NULL == ret_value) && file) + if (ret_value < 0 && file) if (H5F__dest(file, false, true) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file"); + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_open() */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 06d13ebffdd..3ecff5a28bc 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -460,11 +460,12 @@ H5_DLL herr_t H5F__set_mpi_atomicity(H5F_t *file, bool flag); /* External file cache routines */ H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles); -H5_DLL H5F_t *H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); -H5_DLL unsigned H5F__efc_max_nfiles(H5F_efc_t *efc); -H5_DLL herr_t H5F__efc_release(H5F_efc_t *efc); -H5_DLL herr_t H5F__efc_destroy(H5F_efc_t *efc); -H5_DLL herr_t H5F__efc_try_close(H5F_t *f); +H5_DLL herr_t H5F__efc_open(bool try, H5F_efc_t *efc, H5F_t **file, const char *name, unsigned flags, + hid_t fcpl_id, hid_t fapl_id); +H5_DLL unsigned H5F__efc_max_nfiles(H5F_efc_t *efc); +H5_DLL herr_t H5F__efc_release(H5F_efc_t *efc); +H5_DLL herr_t H5F__efc_destroy(H5F_efc_t *efc); +H5_DLL herr_t H5F__efc_try_close(H5F_t *f); /* Space allocation routines */ H5_DLL haddr_t H5F__alloc(H5F_t *f, H5F_mem_t type, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index d2b1b887a7f..a4ad311a189 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -495,7 +495,8 @@ typedef enum H5F_prefix_open_t { /* Private functions */ H5_DLL herr_t H5F_init(void); -H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); +H5_DLL herr_t H5F_open(bool try, H5F_t **file, const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id); H5_DLL herr_t H5F_try_close(H5F_t *f, bool *was_closed /*out*/); H5_DLL hid_t H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, bool app_ref); @@ -659,7 +660,7 @@ H5_DLL herr_t H5F_shared_get_mpi_file_sync_required(const H5F_shared_t *f_sh, H5_DLL herr_t H5F_efc_close(H5F_t *parent, H5F_t *file); /* File prefix routines */ -H5_DLL H5F_t *H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, +H5_DLL herr_t H5F_prefix_open_file(bool try, H5F_t **file, H5F_t *primary_file, H5F_prefix_open_t prefix_type, const char *prop_prefix, const char *file_name, unsigned file_intent, hid_t fapl_id); diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 89484ea1134..88ee6baa201 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -212,8 +212,8 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get external link prefix"); /* Search for the target file */ - if (NULL == (ext_file = H5F_prefix_open_file(loc.oloc->file, H5F_PREFIX_ELINK, elink_prefix, file_name, - intent, fapl_id))) + if (H5F_prefix_open_file(false, &ext_file, loc.oloc->file, H5F_PREFIX_ELINK, elink_prefix, file_name, + intent, fapl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open external file, external link file name = '%s'", file_name); diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index b0686d0f1df..cb4841f2595 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -90,7 +90,7 @@ H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; /* Create the file */ - if (NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id))) + if (H5F_open(false, &new_file, name, flags, fcpl_id, fapl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file"); new_file->id_exists = true; @@ -124,7 +124,7 @@ H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t H5 FUNC_ENTER_PACKAGE /* Open the file */ - if (NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) + if (H5F_open(false, &new_file, name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file"); new_file->id_exists = true; diff --git a/test/efc.c b/test/efc.c index 484320dc3d0..b5399823c89 100644 --- a/test/efc.c +++ b/test/efc.c @@ -66,7 +66,7 @@ test_single(void) TEST_ERROR; /* Open parent file */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; /* Disable EFC for child files */ @@ -77,12 +77,12 @@ test_single(void) * count = 2, release EFC, verify ref count = 1. Verifies a file can be * held open by the EFC. */ - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp1->shared->nrefs != 2) TEST_ERROR; @@ -96,13 +96,13 @@ test_single(void) /* Test 2: Verify that subsequent efc_open requests return the cached top * level file pointer. Open file 1 through EFC, close, open again, verify * file pointers are the same. */ - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; ftmp1 = f1; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1 != ftmp1) TEST_ERROR; @@ -117,34 +117,34 @@ test_single(void) * that the one added first is evicted. Then reopen files in a different * order. Open each file normally after closing through EFC the first time * to track ref counts. */ - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f2) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 2) TEST_ERROR; if (f2->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 2) TEST_ERROR; @@ -153,12 +153,12 @@ test_single(void) if (f3->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f4 = H5F__efc_open(f0->shared->efc, filename[4], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f4) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; @@ -169,7 +169,7 @@ test_single(void) if (f4->shared->nrefs != 2) TEST_ERROR; - if (NULL == (ftmp3 = H5F__efc_open(f0->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, ftmp3) < 0) FAIL_STACK_ERROR; @@ -182,7 +182,7 @@ test_single(void) if (f4->shared->nrefs != 2) TEST_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f0->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, ftmp2) < 0) FAIL_STACK_ERROR; @@ -195,7 +195,7 @@ test_single(void) if (f4->shared->nrefs != 2) TEST_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f0->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, ftmp1) < 0) FAIL_STACK_ERROR; @@ -208,7 +208,7 @@ test_single(void) if (f4->shared->nrefs != 1) TEST_ERROR; - if (NULL == (ftmp4 = H5F__efc_open(f0->shared->efc, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &ftmp4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, ftmp4) < 0) FAIL_STACK_ERROR; @@ -242,10 +242,10 @@ test_single(void) /* Test 4: Verify that files kept open through the EFC are not evicted by * H5F__efc_release(). */ - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp1->shared->nrefs != 2) TEST_ERROR; @@ -268,36 +268,36 @@ test_single(void) * filling up the cache. Open 4 files while holding the first open. Verify * that the second file is evicted. Close the first file, reopen the * second, and verify that the first file is evicted. */ - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp1->shared != f1->shared) TEST_ERROR; if (ftmp1->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f2) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp2->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR; if (ftmp2->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f4 = H5F__efc_open(f0->shared->efc, filename[4], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f4) < 0) FAIL_STACK_ERROR; @@ -310,7 +310,7 @@ test_single(void) FAIL_STACK_ERROR; if (ftmp1->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f2) < 0) FAIL_STACK_ERROR; @@ -318,7 +318,7 @@ test_single(void) TEST_ERROR; if (ftmp2->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; @@ -342,42 +342,42 @@ test_single(void) * prevents further files from being cached. Open and hold open 3 files * through the EFC, then open the fourth and verify that it was not added to * the EFC. */ - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp1->shared != f1->shared) TEST_ERROR; if (ftmp1->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp2->shared != f2->shared) TEST_ERROR; if (ftmp2->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp3->shared != f3->shared) TEST_ERROR; if (ftmp3->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f4 = H5F__efc_open(f0->shared->efc, filename[4], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f4) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp4->shared->nrefs != 1) TEST_ERROR; @@ -415,13 +415,13 @@ test_single(void) /* Test 7: Test multiple file opens. Open a file twice, close it once, then * verify that it is not evicted by H5F__efc_release(). */ - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp1->shared->nrefs != 2) TEST_ERROR; @@ -492,19 +492,19 @@ test_graph_nocycle(void) * ref count reduced (implying file 1 was closed). Do the same with the * opening order reversed. */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f2) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp2->shared->nrefs != 2) TEST_ERROR; @@ -517,15 +517,15 @@ test_graph_nocycle(void) if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == - (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < + 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(ftmp1->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, ftmp1->shared->efc, &f2, filename[2], + H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_try_close(ftmp1, NULL) < 0) FAIL_STACK_ERROR; @@ -533,7 +533,7 @@ test_graph_nocycle(void) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp2->shared->nrefs != 2) TEST_ERROR; @@ -549,35 +549,35 @@ test_graph_nocycle(void) /* Test 2: 5 file chain. The parent file has 2 child files, each of which * has their own child file. Verifies that releasing the parent's EFC * closes all 4 children. */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f2) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp2->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F__efc_open(f3->shared->efc, filename[4], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, f4) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp4->shared->nrefs != 2) TEST_ERROR; @@ -600,17 +600,17 @@ test_graph_nocycle(void) * closed until both parents' EFCs are released. First release through one * parent, then reopen through that parent and release the other, then * re-release the first parent. */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f1->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, f3) < 0) FAIL_STACK_ERROR; @@ -618,7 +618,7 @@ test_graph_nocycle(void) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp2) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp3->shared->nrefs != 2) TEST_ERROR; @@ -628,7 +628,7 @@ test_graph_nocycle(void) if (ftmp3->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f2) < 0) FAIL_STACK_ERROR; @@ -652,20 +652,20 @@ test_graph_nocycle(void) /* Test 4: Simple "diamond" tree. The parent file has two children, which * shared the same child. Verify that releasing the parent file closes all * files. */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f3) < 0) FAIL_STACK_ERROR; @@ -673,7 +673,7 @@ test_graph_nocycle(void) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp3->shared->nrefs != 3) TEST_ERROR; @@ -691,27 +691,27 @@ test_graph_nocycle(void) /* Test 5: Dense 5 file graph. f0 caches f1, f2, f3 and f4. f1 and f2 * each cache f3 and f4. f3 caches f4. Verify that releasing f0 closes all * files. */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F__efc_open(f0->shared->efc, filename[4], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f4) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F__efc_open(f1->shared->efc, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f4) < 0) FAIL_STACK_ERROR; @@ -719,21 +719,21 @@ test_graph_nocycle(void) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F__efc_open(f2->shared->efc, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, f4) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f2) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F__efc_open(f3->shared->efc, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &f4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, f4) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp4->shared->nrefs != 5) TEST_ERROR; @@ -742,15 +742,15 @@ test_graph_nocycle(void) FAIL_STACK_ERROR; if (ftmp4->shared->nrefs != 1) TEST_ERROR; - if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp1->shared->nrefs != 1) TEST_ERROR; - if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp2->shared->nrefs != 1) TEST_ERROR; - if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (ftmp3->shared->nrefs != 1) TEST_ERROR; @@ -811,9 +811,9 @@ test_graph_cycle(void) /* Test 1: File caches itself. Verify that closing the file causes it to be * actually closed, and there is no other unexpected behavior. */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f0->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, ftmp0) < 0) FAIL_STACK_ERROR; @@ -824,7 +824,7 @@ test_graph_cycle(void) if (f0->shared->nrefs != 1) TEST_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f0->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, ftmp0) < 0) FAIL_STACK_ERROR; @@ -832,7 +832,7 @@ test_graph_cycle(void) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; @@ -842,12 +842,12 @@ test_graph_cycle(void) /* Test 2: Indirectly referenced file caches itself. Same as above except * the file is part of another file's EFC. */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f1->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp1) < 0) FAIL_STACK_ERROR; @@ -857,17 +857,17 @@ test_graph_cycle(void) FAIL_STACK_ERROR; if (H5F__efc_release(f0->shared->efc) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f1->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp1) < 0) FAIL_STACK_ERROR; @@ -877,7 +877,7 @@ test_graph_cycle(void) FAIL_STACK_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; @@ -885,12 +885,12 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 3: Simple 2 file cycle */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; @@ -903,10 +903,10 @@ test_graph_cycle(void) if (f0->shared->nrefs != 1) TEST_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; @@ -916,7 +916,7 @@ test_graph_cycle(void) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; @@ -924,15 +924,15 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 4: Simple 2 file cycle (indirectly referenced) */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR; @@ -944,7 +944,7 @@ test_graph_cycle(void) FAIL_STACK_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; @@ -952,21 +952,21 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 5: Parallel double cycle */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f2->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp0) < 0) FAIL_STACK_ERROR; @@ -976,7 +976,7 @@ test_graph_cycle(void) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; @@ -984,21 +984,21 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 6: Parallel double cycle with release */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f2->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp0) < 0) FAIL_STACK_ERROR; @@ -1014,26 +1014,26 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 7: Chained parallel double cycle */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f2) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f3->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp1) < 0) FAIL_STACK_ERROR; @@ -1047,7 +1047,7 @@ test_graph_cycle(void) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; @@ -1055,26 +1055,26 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 8: Chained parallel double cycle with release */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f2) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f3->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp1) < 0) FAIL_STACK_ERROR; @@ -1094,14 +1094,14 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 9: Simple 2 file cycle, extra ID on root */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp1, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp1) < 0) FAIL_STACK_ERROR; @@ -1117,7 +1117,7 @@ test_graph_cycle(void) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; @@ -1125,14 +1125,14 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 10: Simple 2 file cycle, extra ID on second file */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; @@ -1147,7 +1147,7 @@ test_graph_cycle(void) FAIL_STACK_ERROR; if (ftmp1->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 2) TEST_ERROR; @@ -1156,13 +1156,13 @@ test_graph_cycle(void) FAIL_STACK_ERROR; if (H5F_try_close(ftmp1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; @@ -1170,23 +1170,23 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 11: Parallel double cycle, extra ID on a child file */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f2->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp0) < 0) FAIL_STACK_ERROR; @@ -1201,7 +1201,7 @@ test_graph_cycle(void) FAIL_STACK_ERROR; if (ftmp2->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 3) TEST_ERROR; @@ -1210,19 +1210,19 @@ test_graph_cycle(void) FAIL_STACK_ERROR; if (H5F_try_close(ftmp2, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; @@ -1230,23 +1230,23 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 12: Parallel double cycle, extra ID on a child file, with release */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f2->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp0) < 0) FAIL_STACK_ERROR; @@ -1276,28 +1276,28 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 13: Chained parallel double cycle, extra ID on a child file */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f2) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f3->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp1) < 0) FAIL_STACK_ERROR; @@ -1316,7 +1316,7 @@ test_graph_cycle(void) FAIL_STACK_ERROR; if (ftmp3->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 2) TEST_ERROR; @@ -1325,25 +1325,25 @@ test_graph_cycle(void) FAIL_STACK_ERROR; if (H5F_try_close(ftmp3, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f2, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 1) TEST_ERROR; @@ -1352,28 +1352,28 @@ test_graph_cycle(void) /* Test 14: Chained parallel double cycle, extra ID on a child file, with * release */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f2) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f3->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp1) < 0) FAIL_STACK_ERROR; @@ -1407,24 +1407,24 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 15: One local and one remote cycle */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f3->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp2) < 0) FAIL_STACK_ERROR; @@ -1437,25 +1437,25 @@ test_graph_cycle(void) if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f2, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 1) TEST_ERROR; @@ -1463,24 +1463,24 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 16: One local and one remote cycle, with release */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f3->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp2) < 0) FAIL_STACK_ERROR; @@ -1497,19 +1497,19 @@ test_graph_cycle(void) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f2, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 1) TEST_ERROR; @@ -1517,26 +1517,26 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 17: One local and one remote cycle, remote cycle held open */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f3->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp2) < 0) FAIL_STACK_ERROR; @@ -1549,7 +1549,7 @@ test_graph_cycle(void) if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; @@ -1560,19 +1560,19 @@ test_graph_cycle(void) if (H5F_try_close(ftmp3, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f2, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 1) TEST_ERROR; @@ -1581,26 +1581,26 @@ test_graph_cycle(void) /* Test 18: One local and one remote cycle, remote cycle held open, with * release */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f3->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp2) < 0) FAIL_STACK_ERROR; @@ -1617,13 +1617,13 @@ test_graph_cycle(void) TEST_ERROR; if (ftmp3->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 2) TEST_ERROR; @@ -1634,7 +1634,7 @@ test_graph_cycle(void) FAIL_STACK_ERROR; if (ftmp3->shared->nrefs != 1) TEST_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; @@ -1648,44 +1648,44 @@ test_graph_cycle(void) /* Test 19: "Diamond" shape with links moving from bottom (root) to top. * Also cycle between bottom (root) and top and cycles on the sides. */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f3->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F__efc_open(f1->shared->efc, filename[4], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f4->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f4->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f4, ftmp1) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f4) < 0) FAIL_STACK_ERROR; - if (NULL == (f5 = H5F__efc_open(f2->shared->efc, filename[5], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f5->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f5->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f5, ftmp2) < 0) FAIL_STACK_ERROR; @@ -1700,37 +1700,37 @@ test_graph_cycle(void) if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f2, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f3, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f4->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f4, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f5->shared->nrefs != 1) TEST_ERROR; @@ -1740,44 +1740,44 @@ test_graph_cycle(void) /* Test 20: "Diamond" shape with links moving from bottom (root) to top. * Also cycle between bottom (root) and top, cycles on the sides, and * release the files instead of closing. */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f3->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F__efc_open(f1->shared->efc, filename[4], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f4->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f4->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f4, ftmp1) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f4) < 0) FAIL_STACK_ERROR; - if (NULL == (f5 = H5F__efc_open(f2->shared->efc, filename[5], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f5->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f5->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f5, ftmp2) < 0) FAIL_STACK_ERROR; @@ -1796,31 +1796,31 @@ test_graph_cycle(void) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f2, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f3, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f4->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f4, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f5->shared->nrefs != 1) TEST_ERROR; @@ -1829,52 +1829,52 @@ test_graph_cycle(void) /* Test 21: "Diamond" shape with links moving from bottom (root) to top. * Also cycle between bottom (root) and top, cycles on sides held open. */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f3->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F__efc_open(f1->shared->efc, filename[4], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f4->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f4->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f4, ftmp1) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f4) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f5 = H5F__efc_open(f2->shared->efc, filename[5], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f5->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f5->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f5, ftmp2) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, f5) < 0) FAIL_STACK_ERROR; - if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f5, filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; @@ -1893,7 +1893,7 @@ test_graph_cycle(void) TEST_ERROR; if (f5->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 2) TEST_ERROR; @@ -1909,7 +1909,7 @@ test_graph_cycle(void) FAIL_STACK_ERROR; if (f5->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 2) TEST_ERROR; @@ -1919,37 +1919,37 @@ test_graph_cycle(void) if (H5F_try_close(f5, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f2, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f3, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f4->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f4, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f5->shared->nrefs != 1) TEST_ERROR; @@ -1959,52 +1959,52 @@ test_graph_cycle(void) /* Test 22: "Diamond" shape with links moving from bottom (root) to top. * Also cycle between bottom (root) and top, cycles on sides held open. * Also release the files instead of closing. */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f3->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f3) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F__efc_open(f1->shared->efc, filename[4], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f4, filename[4], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f4->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f4->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f4, ftmp1) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, f4) < 0) FAIL_STACK_ERROR; - if (NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f4, filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f5 = H5F__efc_open(f2->shared->efc, filename[5], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f5, filename[5], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f5->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f5->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f5, ftmp2) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, f5) < 0) FAIL_STACK_ERROR; - if (NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f5, filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; @@ -2025,7 +2025,7 @@ test_graph_cycle(void) TEST_ERROR; if (f5->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 3) TEST_ERROR; @@ -2040,7 +2040,7 @@ test_graph_cycle(void) TEST_ERROR; if (f5->shared->nrefs != 2) TEST_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 2) TEST_ERROR; @@ -2055,7 +2055,7 @@ test_graph_cycle(void) TEST_ERROR; if (f5->shared->nrefs != 1) TEST_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 1) TEST_ERROR; @@ -2071,69 +2071,69 @@ test_graph_cycle(void) /* Test 23: Dense "ball" of files. 4 files each cache all files (including * itself). */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f0->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, ftmp0) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f1->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp1) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f1->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp2) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp3 = H5F__efc_open(f1->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp3) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f2->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp0) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f2->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp2) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp3) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f3->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp0) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f3->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp1) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f3->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp2) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp3 = H5F__efc_open(f3->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp3) < 0) FAIL_STACK_ERROR; @@ -2147,25 +2147,25 @@ test_graph_cycle(void) if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f2, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 1) TEST_ERROR; @@ -2174,69 +2174,69 @@ test_graph_cycle(void) /* Test 24: Dense "ball" of files. 4 files each cache all files (including * itself). Release the files instead of closing. */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f0->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, ftmp0) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f0->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f1->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp1) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f1->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp2) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp3 = H5F__efc_open(f1->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp3) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f2->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp0) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp1) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f2->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp2) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp3 = H5F__efc_open(f2->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f2, ftmp3) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f3->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp0) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp1 = H5F__efc_open(f3->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp1) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp2 = H5F__efc_open(f3->shared->efc, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp2) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp3 = H5F__efc_open(f3->shared->efc, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f3->shared->efc, &ftmp3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f3, ftmp3) < 0) FAIL_STACK_ERROR; @@ -2254,19 +2254,19 @@ test_graph_cycle(void) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f2, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 1) TEST_ERROR; @@ -2274,12 +2274,12 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 25: File held open by EFC client interrupts cycle, with release */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; @@ -2307,19 +2307,19 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 26: File held open by EFC does not interrupt cycle, with release */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F__efc_open(f0->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 2) TEST_ERROR; @@ -2341,23 +2341,23 @@ test_graph_cycle(void) /* Test 27: File held open by EFC client through non-parent file does not * interrupt cycle, but parent file does (no valid way around it) */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 2) TEST_ERROR; @@ -2376,7 +2376,7 @@ test_graph_cycle(void) TEST_ERROR; if (f3->shared->nrefs != 1) TEST_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 2) TEST_ERROR; @@ -2389,13 +2389,13 @@ test_graph_cycle(void) TEST_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 2) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 2) TEST_ERROR; @@ -2406,19 +2406,19 @@ test_graph_cycle(void) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 2) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 3) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 2) TEST_ERROR; @@ -2427,25 +2427,25 @@ test_graph_cycle(void) if (H5F_try_close(f2, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f2, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 1) TEST_ERROR; @@ -2455,23 +2455,23 @@ test_graph_cycle(void) /* Test 28: File held open by EFC client through non-parent file does not * interrupt cycle, but parent file does (no valid way around it), with * release */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f0, f1) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f2->shared->efc, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f2->shared->efc, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F__efc_open(f1->shared->efc, filename[3], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f3, filename[3], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 2) TEST_ERROR; @@ -2514,13 +2514,13 @@ test_graph_cycle(void) TEST_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f3, filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f3->shared->nrefs != 1) TEST_ERROR; @@ -2533,16 +2533,16 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 29: File without EFC interrupts cycle */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5Pset_elink_file_cache_size(fapl_id, 0) < 0) TEST_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5Pset_elink_file_cache_size(fapl_id, 8) < 0) TEST_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 2) TEST_ERROR; @@ -2557,13 +2557,13 @@ test_graph_cycle(void) if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; @@ -2571,12 +2571,12 @@ test_graph_cycle(void) FAIL_STACK_ERROR; /* Test 30: File without EFC does not interrupt cycle */ - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F__efc_open(f0->shared->efc, filename[1], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f0->shared->efc, &f1, filename[1], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; - if (NULL == (ftmp0 = H5F__efc_open(f1->shared->efc, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &ftmp0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5F_efc_close(f1, ftmp0) < 0) FAIL_STACK_ERROR; @@ -2584,8 +2584,8 @@ test_graph_cycle(void) FAIL_STACK_ERROR; if (H5Pset_elink_file_cache_size(fapl_id, 0) < 0) TEST_ERROR; - if (NULL == (f2 = H5F__efc_open(f1->shared->efc, filename[2], - H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id))) + if (H5F__efc_open(false, f1->shared->efc, &f2, filename[2], H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, + fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (H5Pset_elink_file_cache_size(fapl_id, 8) < 0) TEST_ERROR; @@ -2596,19 +2596,19 @@ test_graph_cycle(void) if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f0, filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f0->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f0, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f1, filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f1->shared->nrefs != 1) TEST_ERROR; if (H5F_try_close(f1, NULL) < 0) FAIL_STACK_ERROR; - if (NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id))) + if (H5F_open(false, &f2, filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id) < 0) FAIL_STACK_ERROR; if (f2->shared->nrefs != 1) TEST_ERROR; diff --git a/test/error_test.c b/test/error_test.c index bb780215574..84db80e3f93 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -456,8 +456,7 @@ custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) static herr_t test_create(void) { - const char *err_func = "test_create"; /* Function name for pushing error */ - const char *err_msg = "Error message"; /* Error message for pushing error */ + const char *err_msg = "Error message"; /* Error message for pushing error */ ssize_t err_num; /* Number of errors on stack */ hid_t estack_id = H5I_INVALID_HID; /* Error stack ID */ @@ -471,7 +470,7 @@ test_create(void) TEST_ERROR; /* Push an error with a long description */ - if (H5Epush(estack_id, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", + if (H5Epush(estack_id, __FILE__, __func__, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0) TEST_ERROR; @@ -512,14 +511,13 @@ test_create(void) static herr_t test_copy(void) { - const char *err_func = "test_copy"; /* Function name for pushing error */ - const char *err_msg = "Error message"; /* Error message for pushing error */ + const char *err_msg = "Error message"; /* Error message for pushing error */ ssize_t err_num; /* Number of errors on stack */ hid_t estack_id = H5I_INVALID_HID; /* Error stack ID */ herr_t ret; /* Generic return value */ /* Push an error with a long description */ - if (H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", + if (H5Epush(H5E_DEFAULT, __FILE__, __func__, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0) TEST_ERROR; @@ -581,7 +579,6 @@ test_copy(void) static herr_t test_append(void) { - const char *err_func = "test_append"; /* Function name for pushing error */ const char *err_msg1 = "Error message #1"; /* Error message #1 for pushing error */ const char *err_msg2 = "Error message #2"; /* Error message #2 for pushing error */ ssize_t err_num; /* Number of errors on stack */ @@ -590,7 +587,7 @@ test_append(void) herr_t ret; /* Generic return value */ /* Push an error */ - if (H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", + if (H5Epush(H5E_DEFAULT, __FILE__, __func__, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg1) < 0) TEST_ERROR; @@ -613,7 +610,7 @@ test_append(void) TEST_ERROR; /* Push an error on stack #2 */ - if (H5Epush(estack_id2, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE, "%s", + if (H5Epush(estack_id2, __FILE__, __func__, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE, "%s", err_msg2) < 0) TEST_ERROR; @@ -660,7 +657,7 @@ test_append(void) TEST_ERROR; /* Append error stack #2 to error stack #1, and close stack #2 */ - if (H5Eappend_stack(estack_id1, estack_id2, true) < 0) + if (H5Eappend_stack(estack_id1, estack_id2, TRUE) < 0) TEST_ERROR; /* Try to close error stack #2. Should fail because H5Eappend_stack @@ -685,6 +682,166 @@ test_append(void) return -1; } /* end test_append() */ +/*------------------------------------------------------------------------- + * Function: test_pause + * + * Purpose: Test pausing error stacks + * + * Return: Success: 0 + * Failure: -1 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_pause(void) +{ + const char *err_msg1 = "Error message #1"; /* Error message #1 for pushing error */ + ssize_t err_num; /* Number of errors on stack */ + hid_t estack_id1 = H5I_INVALID_HID; /* Error stack ID */ + hbool_t is_paused; /* Whether error stack is paused */ + herr_t ret; /* Generic return value */ + + /* Push an error */ + if (H5Epush(H5E_DEFAULT, __FILE__, __func__, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", + err_msg1) < 0) + TEST_ERROR; + + /* Copy error stack, which clears the original */ + if ((estack_id1 = H5Eget_current_stack()) < 0) + TEST_ERROR; + + /* Check the number of errors on stack #1 */ + err_num = H5Eget_num(estack_id1); + if (err_num != 1) + TEST_ERROR; + + /* Check for bad arguments */ + is_paused = TRUE; + H5E_BEGIN_TRY + { + ret = H5Eis_paused(H5I_INVALID_HID, &is_paused); + } + H5E_END_TRY + if (ret >= 0) + TEST_ERROR; + + /* Verify that default stack is not paused */ + is_paused = TRUE; + if (H5Eis_paused(H5E_DEFAULT, &is_paused) < 0) + TEST_ERROR; + if (FALSE != is_paused) + TEST_ERROR; + + /* Verify that application stack is not paused */ + is_paused = TRUE; + if (H5Eis_paused(estack_id1, &is_paused) < 0) + TEST_ERROR; + if (FALSE != is_paused) + TEST_ERROR; + + /* Check for bad arguments */ + H5E_BEGIN_TRY + { + ret = H5Epause_stack(H5I_INVALID_HID); + } + H5E_END_TRY + if (ret >= 0) + TEST_ERROR; + /* Check for bad arguments */ + H5E_BEGIN_TRY + { + ret = H5Eresume_stack(H5I_INVALID_HID); + } + H5E_END_TRY + if (ret >= 0) + TEST_ERROR; + + /* Pause error stack */ + if (H5Epause_stack(estack_id1) < 0) + TEST_ERROR; + + /* Check if stack is paused */ + is_paused = FALSE; + if (H5Eis_paused(estack_id1, &is_paused) < 0) + TEST_ERROR; + if (TRUE != is_paused) + TEST_ERROR; + + /* Resume error stack */ + if (H5Eresume_stack(estack_id1) < 0) + TEST_ERROR; + + /* Check if stack is paused */ + is_paused = TRUE; + if (H5Eis_paused(estack_id1, &is_paused) < 0) + TEST_ERROR; + if (FALSE != is_paused) + TEST_ERROR; + + /* Check for resuming too many times */ + H5E_BEGIN_TRY + { + ret = H5Eresume_stack(estack_id1); + } + H5E_END_TRY + if (ret >= 0) + TEST_ERROR; + + /* Check if stack is paused, after trying to resume too many times */ + is_paused = TRUE; + if (H5Eis_paused(estack_id1, &is_paused) < 0) + TEST_ERROR; + if (FALSE != is_paused) + TEST_ERROR; + + /* Close error stack */ + if (H5Eclose_stack(estack_id1) < 0) + TEST_ERROR; + + /* Pause default error stack */ + if (H5Epause_stack(H5E_DEFAULT) < 0) + TEST_ERROR; + + /* Check if stack is paused */ + is_paused = FALSE; + if (H5Eis_paused(H5E_DEFAULT, &is_paused) < 0) + TEST_ERROR; + if (TRUE != is_paused) + TEST_ERROR; + + /* Resume error stack */ + if (H5Eresume_stack(H5E_DEFAULT) < 0) + TEST_ERROR; + + /* Check if stack is paused */ + is_paused = TRUE; + if (H5Eis_paused(H5E_DEFAULT, &is_paused) < 0) + TEST_ERROR; + if (FALSE != is_paused) + TEST_ERROR; + + /* Check for resuming too many times */ + H5E_BEGIN_TRY + { + ret = H5Eresume_stack(H5E_DEFAULT); + } + H5E_END_TRY + if (ret >= 0) + TEST_ERROR; + + /* Check if stack is paused, after trying to resume too many times */ + is_paused = TRUE; + if (H5Eis_paused(H5E_DEFAULT, &is_paused) < 0) + TEST_ERROR; + if (FALSE != is_paused) + TEST_ERROR; + + return 0; + +error: + return -1; +} /* end test_pause() */ + /*------------------------------------------------------------------------- * Function: close_error * @@ -868,6 +1025,10 @@ main(void) if (test_append() < 0) TEST_ERROR; + /* Test pausing error stacks */ + if (test_pause() < 0) + TEST_ERROR; + /* Close error information */ if (close_error() < 0) TEST_ERROR;