diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 07:32:40 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 07:32:40 (GMT) |
commit | 1dbb83aabd9404f4b626e19193b7472a653ed8f5 (patch) | |
tree | 8ad3409e9bc2977486d5137240381d719587bc0a /src/H5Ftest.c | |
parent | 711d12bb586b23d5bdea4f57fe0101255324cc78 (diff) | |
download | hdf5-1dbb83aabd9404f4b626e19193b7472a653ed8f5.zip hdf5-1dbb83aabd9404f4b626e19193b7472a653ed8f5.tar.gz hdf5-1dbb83aabd9404f4b626e19193b7472a653ed8f5.tar.bz2 |
Brings file locking changes from develop
Diffstat (limited to 'src/H5Ftest.c')
-rw-r--r-- | src/H5Ftest.c | 100 |
1 files changed, 66 insertions, 34 deletions
diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 63e0b25..03b613c 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -15,7 +15,7 @@ * * Created: H5Ftest.c * Jan 3 2007 - * Quincey Koziol <koziol@hdfgroup.org> + * Quincey Koziol * * Purpose: File testing routines. * @@ -231,6 +231,71 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__get_sbe_addr_test() */ +/*------------------------------------------------------------------------- + * Function: H5F__same_file_test + * + * Purpose: Check if two file IDs refer to the same underlying file. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * Oct 13, 2018 + * + *------------------------------------------------------------------------- + */ +htri_t +H5F__same_file_test(hid_t file_id1, hid_t file_id2) +{ + H5F_t *file1, *file2; /* File info */ + htri_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + if (NULL == (file1 = (H5F_t *)H5VL_object_verify(file_id1, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if (NULL == (file2 = (H5F_t *)H5VL_object_verify(file_id2, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + + /* If they are using the same underlying "shared" file struct, they are the same file */ + ret_value = (file1->shared == file2->shared); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__same_file_test() */ + +/*------------------------------------------------------------------------- + * Function: H5F__reparse_file_lock_variable_test + * + * Purpose: Re-parse the file locking environment variable. + * + * Since getenv(3) is fairly expensive, we only parse it once, + * when the library opens. This test function is used to + * re-parse the environment variable after we've changed it + * with setnev(3). + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Summer 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F__reparse_file_lock_variable_test(void) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + /* Check the file locking environment variable */ + if (H5F__parse_file_lock_env_var(&use_locks_env_g) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to parse file locking environment variable") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__reparse_file_lock_variable_test() */ + /* * VFD SWMR tests */ @@ -595,36 +660,3 @@ done: } FUNC_LEAVE_NOAPI(ret_value) } /* H5F__vfd_swmr_writer_md_test() */ - -/*------------------------------------------------------------------------- - * Function: H5F__same_file_test - * - * Purpose: Check if two file IDs refer to the same underlying file. - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * Oct 13, 2018 - * - *------------------------------------------------------------------------- - */ -htri_t -H5F__same_file_test(hid_t file_id1, hid_t file_id2) -{ - H5F_t *file1, *file2; /* File info */ - htri_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Check arguments */ - if (NULL == (file1 = (H5F_t *)H5VL_object_verify(file_id1, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - if (NULL == (file2 = (H5F_t *)H5VL_object_verify(file_id2, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - - /* If they are using the same underlying "shared" file struct, they are the same file */ - ret_value = (file1->shared == file2->shared); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__same_file_test() */ |