From fae493e84cdad20df6ecdb564a353e95323b8157 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 3 Jun 2022 19:12:40 +0000 Subject: Committing clang-format changes --- src/H5FD.c | 56 +++++++------- src/H5FDcore.c | 9 +-- src/H5FDfamily.c | 6 +- src/H5FDlog.c | 3 +- src/H5FDros3.c | 2 +- src/H5FDsec2.c | 4 +- src/H5FDstdio.c | 11 +-- src/H5FDvfd_swmr.c | 222 ++++++++++++++++++++++++----------------------------- src/H5FDvfd_swmr.h | 23 +++--- src/H5Fint.c | 99 ++++++++++++------------ src/H5Fprivate.h | 4 +- src/H5Fvfd_swmr.c | 11 ++- test/vfd_swmr.c | 20 +++-- 13 files changed, 215 insertions(+), 255 deletions(-) diff --git a/src/H5FD.c b/src/H5FD.c index 4488c5c..7e5596f 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -83,7 +83,6 @@ static herr_t H5FD__query(const H5FD_t *f, unsigned long *flags /*out*/); */ static unsigned long H5FD_file_serial_no_g; - /* File driver ID class */ static const H5I_class_t H5I_VFL_CLS[1] = {{ H5I_VFL, /* ID class value */ @@ -706,7 +705,6 @@ done: FUNC_LEAVE_API(ret_value) } - /*------------------------------------------------------------------------- * Function: H5FD_open * @@ -721,13 +719,13 @@ done: H5FD_t * H5FD_open(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_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 */ FUNC_ENTER_NOAPI(NULL) @@ -924,14 +922,14 @@ done: * Failure: Must never fail. * * Changes: Re-worked function to use H5FD_ctl() to obtain the terminal - * VFDs for f1 and f2. Typically, these are the same thing, + * VFDs for f1 and f2. Typically, these are the same thing, * however, if there is an intervening pass through VFD * (i.e. splitter of vfd swrmr reader vfd), using the terminal * VFD for the comparison will avoid some false negatives. * - * Note, however, that we will still fail to detect the + * Note, however, that we will still fail to detect the * case in which a give file is opened twice with different - * terminal VFDs. + * terminal VFDs. * * JRM -- 5/5/22 * @@ -941,32 +939,32 @@ done: int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) { - const H5FD_t * term_f1 = f1; - const H5FD_t * term_f2 = f2; - herr_t ctl_result; - int ret_value = -1; /* Return value */ + const H5FD_t *term_f1 = f1; + const H5FD_t *term_f2 = f2; + herr_t ctl_result; + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOERR; /* return value is arbitrary */ - /* For each of f1 and f2, check to see if the ctl call is defined. If it is, * use the ctl call to try to obtain the terminal VFD. Since this function - * is not allowed to fail, discard the error stack if either of the ctl call + * is not allowed to fail, discard the error stack if either of the ctl call * fail. */ - if ( ( f1 ) && ( f1->cls ) && ( f1->cls->ctl ) ) { + if ((f1) && (f1->cls) && (f1->cls->ctl)) { H5E_BEGIN_TRY { - ctl_result = H5FD_ctl(f1, H5FD_CTL__GET_TERMINAL_VFD, H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | - H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG, NULL, (void **)(&term_f1)); + ctl_result = H5FD_ctl(f1, H5FD_CTL__GET_TERMINAL_VFD, + H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG, NULL, + (void **)(&term_f1)); } H5E_END_TRY; - /* if the ctl call failed, set term_f1 equal to f1. This will probably be + /* if the ctl call failed, set term_f1 equal to f1. This will probably be * wrong -- but it will be no worse than using the top level VFD unconditionally. */ - if ( ctl_result != SUCCEED ) { + if (ctl_result != SUCCEED) { H5E_clear_stack(NULL); @@ -974,19 +972,20 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) } } - if ( ( f2 ) && ( f2->cls ) && ( f2->cls->ctl ) ) { + if ((f2) && (f2->cls) && (f2->cls->ctl)) { H5E_BEGIN_TRY { - ctl_result = H5FD_ctl(f2, H5FD_CTL__GET_TERMINAL_VFD, H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | - H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG, NULL, (void **)(&term_f2)); + ctl_result = H5FD_ctl(f2, H5FD_CTL__GET_TERMINAL_VFD, + H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG, NULL, + (void **)(&term_f2)); } H5E_END_TRY; - /* if the ctl call failed, set term_f1 equal to f1. This will probably be + /* if the ctl call failed, set term_f1 equal to f1. This will probably be * wrong -- but it will be no worse than using the top level VFD unconditionally. */ - if ( ctl_result != SUCCEED ) { + if (ctl_result != SUCCEED) { H5E_clear_stack(NULL); @@ -1021,7 +1020,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_cmp() */ - /*------------------------------------------------------------------------- * Function: H5FDquery * diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 64088fe..e09e250 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -149,7 +149,7 @@ static herr_t H5FD__core_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing static herr_t H5FD__core_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD__core_unlock(H5FD_t *_file); static herr_t H5FD__core_delete(const char *filename, hid_t fapl_id); -static herr_t H5FD__core_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, +static herr_t H5FD__core_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, void **output); static inline const H5FD_core_fapl_t *H5FD__core_get_default_config(void); @@ -1773,9 +1773,9 @@ done: * input and output * * At present, the only op code supported is - * H5FD_CTL__GET_TERMINAL_VFD, which is used to obtain a - * pointer to the instance of H5FD_t associated with the - * terminal VFD. This allows comparison of files whose + * H5FD_CTL__GET_TERMINAL_VFD, which is used to obtain a + * pointer to the instance of H5FD_t associated with the + * terminal VFD. This allows comparison of files whose * terminal VFD may have overlying pass through VFDs. * * Return: Non-negative on success/Negative on failure @@ -1813,4 +1813,3 @@ H5FD__core_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_AT done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__core_ctl() */ - diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 4619259..185ca4e 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -1609,7 +1609,7 @@ done: */ static herr_t H5FD__family_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_ATTR_UNUSED *input, - void **output) + void **output) { H5FD_family_t *file = (H5FD_family_t *)_file; herr_t ret_value = SUCCEED; @@ -1624,7 +1624,7 @@ H5FD__family_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_ case H5FD_CTL__GET_TERMINAL_VFD: /* On can argue as to whether the family VFD should be regarded as terminal. * It is treated as such here, as it is the lowest VFD through which all I/O - * request pass. + * request pass. * * For now at least, this works as this is the level at which files are compared. */ @@ -1642,5 +1642,3 @@ H5FD__family_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__sec2_ctl() */ - - diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 315e6f8..a920cd9 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -178,7 +178,7 @@ static herr_t H5FD__log_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) static herr_t H5FD__log_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD__log_unlock(H5FD_t *_file); static herr_t H5FD__log_delete(const char *filename, hid_t fapl_id); -static herr_t H5FD__log_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, +static herr_t H5FD__log_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, void **output); static const H5FD_class_t H5FD_log_g = { @@ -1848,4 +1848,3 @@ H5FD__log_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_ATT done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__log_ctl() */ - diff --git a/src/H5FDros3.c b/src/H5FDros3.c index 3e01e27..3aae108 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -233,7 +233,7 @@ static herr_t H5FD__ros3_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, ha static herr_t H5FD__ros3_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); static herr_t H5FD__ros3_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD__ros3_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, +static herr_t H5FD__ros3_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, void **output); static herr_t H5FD__ros3_validate_config(const H5FD_ros3_fapl_t *fa); diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 2611506..b88605c 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -1064,8 +1064,8 @@ done: * The input and output parameters allow op_code specific * input and output * - * At present, the only op code supported is - * H5FD_CTL__GET_TERMINAL_VFD, which is used in the + * At present, the only op code supported is + * H5FD_CTL__GET_TERMINAL_VFD, which is used in the * comparison of files under layers of pass through VFDs. * * Return: Non-negative on success/Negative on failure diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 5a1bb4c..ad59bc9 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -1262,15 +1262,15 @@ H5FD_stdio_delete(const char *filename, hid_t /*UNUSED*/ fapl_id) *------------------------------------------------------------------------- */ static herr_t -H5FD__stdio_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void /* UNUSED */ *input, +H5FD__stdio_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void /* UNUSED */ *input, void **output) { static const char *func = "H5FD__stdio_ctl"; /* Function Name for error reporting */ - H5FD_stdio_t *file = (H5FD_stdio_t *)_file; + H5FD_stdio_t * file = (H5FD_stdio_t *)_file; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); - + /* Quiet compiler */ (void)input; @@ -1284,11 +1284,12 @@ H5FD__stdio_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void /* U /* Unknown op code */ default: if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) - H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_FCNTL, "unknown op_code and fail if unknown flag is set", -1); + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_FCNTL, + "unknown op_code and fail if unknown flag is set", -1); break; } - return(0); /* SUCCEED */ + return (0); /* SUCCEED */ } /* end H5FD__stdio_ctl() */ diff --git a/src/H5FDvfd_swmr.c b/src/H5FDvfd_swmr.c index 4e0a978..89b65f9 100644 --- a/src/H5FDvfd_swmr.c +++ b/src/H5FDvfd_swmr.c @@ -34,7 +34,7 @@ static hid_t H5FD_VFD_SWMR_g = 0; typedef struct H5FD_vfd_swmr_t { H5FD_t pub; /* public stuff, must be first */ - H5FD_vfd_swmr_reader_fapl_t fa; /* driver-specific file access properties */ + H5FD_vfd_swmr_reader_fapl_t fa; /* driver-specific file access properties */ /* HDF5 file */ char hdf5_filename[H5FD_MAX_FILENAME_LEN]; /* Name of the HDF5 file from open */ @@ -88,8 +88,8 @@ static herr_t H5FD__vfd_swmr_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_i static herr_t H5FD__vfd_swmr_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD__vfd_swmr_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD__vfd_swmr_unlock(H5FD_t *_file); -static herr_t H5FD__vfd_swmr_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, - const void *input, void **output); +static herr_t H5FD__vfd_swmr_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, + void **output); /* VFD SWMR */ static htri_t H5FD__vfd_swmr_header_deserialize(H5FD_vfd_swmr_t *, H5FD_vfd_swmr_md_header *); @@ -98,41 +98,41 @@ static htri_t H5FD__vfd_swmr_index_deserialize(const H5FD_vfd_swmr_t *file, H5FD static herr_t H5FD__vfd_swmr_load_hdr_and_idx(H5FD_vfd_swmr_t *, hbool_t); static const H5FD_class_t H5FD_vfd_swmr_g = { - H5FD_VFD_SWMR_VALUE, /* value */ - "vfd_swmr", /* name */ - MAXADDR, /* maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ - H5FD__vfd_swmr_term, /* terminate */ - NULL, /* sb_size */ - NULL, /* sb_encode */ - NULL, /* sb_decode */ - sizeof(H5FD_vfd_swmr_reader_fapl_t), /* fapl_size */ - H5FD__vfd_swmr_fapl_get, /* fapl_get */ - H5FD__vfd_swmr_fapl_copy, /* fapl_copy */ - H5FD__vfd_swmr_fapl_free, /* fapl_free */ - 0, /* dxpl_size */ - NULL, /* dxpl_copy */ - NULL, /* dxpl_free */ - H5FD__vfd_swmr_open, /* open */ - H5FD__vfd_swmr_close, /* close */ - H5FD__vfd_swmr_cmp, /* cmp */ - H5FD__vfd_swmr_query, /* query */ - NULL, /* get_type_map */ - NULL, /* alloc */ - NULL, /* free */ - H5FD__vfd_swmr_get_eoa, /* get_eoa */ - H5FD__vfd_swmr_set_eoa, /* set_eoa */ - H5FD__vfd_swmr_get_eof, /* get_eof */ - H5FD__vfd_swmr_get_handle, /* get_handle */ - H5FD__vfd_swmr_read, /* read */ - H5FD__vfd_swmr_write, /* write */ - NULL, /* flush */ - H5FD__vfd_swmr_truncate, /* truncate */ - H5FD__vfd_swmr_lock, /* lock */ - H5FD__vfd_swmr_unlock, /* unlock */ - NULL, /* del */ - H5FD__vfd_swmr_ctl, /* ctl */ - H5FD_FLMAP_DICHOTOMY /* fl_map */ + H5FD_VFD_SWMR_VALUE, /* value */ + "vfd_swmr", /* name */ + MAXADDR, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD__vfd_swmr_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + sizeof(H5FD_vfd_swmr_reader_fapl_t), /* fapl_size */ + H5FD__vfd_swmr_fapl_get, /* fapl_get */ + H5FD__vfd_swmr_fapl_copy, /* fapl_copy */ + H5FD__vfd_swmr_fapl_free, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__vfd_swmr_open, /* open */ + H5FD__vfd_swmr_close, /* close */ + H5FD__vfd_swmr_cmp, /* cmp */ + H5FD__vfd_swmr_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD__vfd_swmr_get_eoa, /* get_eoa */ + H5FD__vfd_swmr_set_eoa, /* set_eoa */ + H5FD__vfd_swmr_get_eof, /* get_eof */ + H5FD__vfd_swmr_get_handle, /* get_handle */ + H5FD__vfd_swmr_read, /* read */ + H5FD__vfd_swmr_write, /* write */ + NULL, /* flush */ + H5FD__vfd_swmr_truncate, /* truncate */ + H5FD__vfd_swmr_lock, /* lock */ + H5FD__vfd_swmr_unlock, /* unlock */ + NULL, /* del */ + H5FD__vfd_swmr_ctl, /* ctl */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; /* Declare a free list to manage the H5FD_vfd_swmr_t struct */ @@ -191,7 +191,6 @@ H5FD__vfd_swmr_term(void) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__vfd_swmr_term() */ - /*------------------------------------------------------------------------- * Function: H5FD__vfd_swmr_fapl_get * @@ -218,7 +217,6 @@ H5FD__vfd_swmr_fapl_get(H5FD_t *_file) } /* end H5FD__vfd_swmr_fapl_get() */ - /*------------------------------------------------------------------------- * Function: H5FD__vfd_swmr_fapl_copy * @@ -232,7 +230,7 @@ static void * H5FD__vfd_swmr_fapl_copy(const void *_old_fa) { const H5FD_vfd_swmr_reader_fapl_t *old_fa_ptr = (const H5FD_vfd_swmr_reader_fapl_t *)_old_fa; - H5FD_vfd_swmr_reader_fapl_t *new_fa_ptr = NULL; + H5FD_vfd_swmr_reader_fapl_t * new_fa_ptr = NULL; void * ret_value = NULL; FUNC_ENTER_PACKAGE @@ -249,12 +247,10 @@ H5FD__vfd_swmr_fapl_copy(const void *_old_fa) ret_value = (void *)new_fa_ptr; done: - if (NULL == ret_value) - { - if (new_fa_ptr) - { + if (NULL == ret_value) { + if (new_fa_ptr) { new_fa_ptr->magic = 0; - new_fa_ptr = H5FL_FREE(H5FD_vfd_swmr_reader_fapl_t, new_fa_ptr); + new_fa_ptr = H5FL_FREE(H5FD_vfd_swmr_reader_fapl_t, new_fa_ptr); } } @@ -262,7 +258,6 @@ done: } /* end H5FD__vfd_swmr_fapl_copy() */ - /*-------------------------------------------------------------------------- * Function: H5FD__vfd_swmr_fapl_free * @@ -280,25 +275,24 @@ H5FD__vfd_swmr_fapl_free(void *_fapl) FUNC_ENTER_PACKAGE /* Check arguments */ - if ( ( NULL == fapl ) || ( fapl->magic != H5FD_VFD_SWMR_READER_MAGIC ) ) + if ((NULL == fapl) || (fapl->magic != H5FD_VFD_SWMR_READER_MAGIC)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL or invalid H5FD_vfd_swmr_reader_fapl_t *") /* Free the property list */ fapl->magic = 0; - fapl = H5FL_FREE(H5FD_vfd_swmr_reader_fapl_t, fapl); + fapl = H5FL_FREE(H5FD_vfd_swmr_reader_fapl_t, fapl); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__vfd_swmr_fapl_free() */ - /*------------------------------------------------------------------------- * Function: H5P_pop_vfd_swmr_reader_vfd_off_fapl * - * Purpose: After a file has been opened in VFD SWMR reader mode, we - * must pop the vfd swmr reader driver entry off the supplied - * fapl. If we don't, and the fapl is used to open a second + * Purpose: After a file has been opened in VFD SWMR reader mode, we + * must pop the vfd swmr reader driver entry off the supplied + * fapl. If we don't, and the fapl is used to open a second * file (i.e. via virtual data sets), we would have multiple * vfd swmr reader driver entries pushed on the vfd stack. * @@ -307,9 +301,9 @@ done: * 1) Read the file driver entry from the supplied fapl. Verify * that it specifies the vfd swmr reader VFD. * - * 2) Read the file driver entry from the sub fapl specified - * in the vfd swmr reader vfd fapl entry. Set the file - * driver entry on the supplied fapl equal to that on + * 2) Read the file driver entry from the sub fapl specified + * in the vfd swmr reader vfd fapl entry. Set the file + * driver entry on the supplied fapl equal to that on * the sub-fapl. * * 3) Discard the sub-fapl? Not sure if this is necessary. @@ -323,11 +317,11 @@ done: herr_t H5P_pop_vfd_swmr_reader_vfd_off_fapl(hid_t fapl_id) { - H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ - H5P_genplist_t * plist_ptr = NULL; - hid_t sub_fapl_id; - H5P_genplist_t * sub_plist_ptr = NULL; - herr_t ret_value = SUCCEED; + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + H5P_genplist_t * plist_ptr = NULL; + hid_t sub_fapl_id; + H5P_genplist_t * sub_plist_ptr = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -335,7 +329,6 @@ H5P_pop_vfd_swmr_reader_vfd_off_fapl(hid_t fapl_id) if (NULL == (plist_ptr = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - /* 1) Read the file driver entry from the supplied fapl. Verify * that it specifies the vfd swmr reader VFD. */ @@ -345,17 +338,16 @@ H5P_pop_vfd_swmr_reader_vfd_off_fapl(hid_t fapl_id) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file driver ID & info") /* verify that it specifies the vfd swrm reader vfd */ - if ( driver_prop.driver_id != H5FD_VFD_SWMR ) + if (driver_prop.driver_id != H5FD_VFD_SWMR) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "fapl driver prop not vfd swmr reader") - if ( ( ((const H5FD_vfd_swmr_reader_fapl_t *)(driver_prop.driver_info)) == NULL ) || - ( ((const H5FD_vfd_swmr_reader_fapl_t *)(driver_prop.driver_info))->magic != - H5FD_VFD_SWMR_READER_MAGIC ) ) + if ((((const H5FD_vfd_swmr_reader_fapl_t *)(driver_prop.driver_info)) == NULL) || + (((const H5FD_vfd_swmr_reader_fapl_t *)(driver_prop.driver_info))->magic != + H5FD_VFD_SWMR_READER_MAGIC)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "fapl driver info invalid") sub_fapl_id = ((const H5FD_vfd_swmr_reader_fapl_t *)(driver_prop.driver_info))->fapl_id; - /* 2) Read the file driver entry from the sub fapl specified * in the vfd swmr reader vfd fapl entry. Set the file * driver entry on the supplied fapl equal to that on @@ -369,20 +361,19 @@ H5P_pop_vfd_swmr_reader_vfd_off_fapl(hid_t fapl_id) if (H5P_peek(sub_plist_ptr, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get sub-fapl file driver ID & info") - /* insert the driver info from the sub-fapl into the supplied fapl. There is - * some question in my mind as to whether I should be making a copy of the + /* insert the driver info from the sub-fapl into the supplied fapl. There is + * some question in my mind as to whether I should be making a copy of the * info and string obtained above. While I don't think it is necessary, * if we get occult failures, this is a good place to look. * - * Note that for now, the driver info on the sub-fapl should only specify the - * sec2 VFD -- which has NULL info and config string. Thus, if it is an + * Note that for now, the driver info on the sub-fapl should only specify the + * sec2 VFD -- which has NULL info and config string. Thus, if it is an * issue, it may not appear immediately. */ - if ( H5P_set_driver(plist_ptr, driver_prop.driver_id, - driver_prop.driver_info, driver_prop.driver_config_str) < 0 ) + if (H5P_set_driver(plist_ptr, driver_prop.driver_id, driver_prop.driver_info, + driver_prop.driver_config_str) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set driver on supplied fapl") - /* 3) Discard the sub-fapl? Not sure if this is necessary. Will wait on this for now. */ done: @@ -391,22 +382,21 @@ done: } /* end H5P_pop_vfd_swmr_reader_vfd_off_fapl() */ - /*------------------------------------------------------------------------- * Function: H5P_push_vfd_swmr_reader_vfd_on_fapl * - * Purpose: When a file is opened in VFD SWMR reader mode, we must - * adjust the fapl so as to push the VFD SWMR reader vfd on - * the VFD stack specified in the fapl. + * Purpose: When a file is opened in VFD SWMR reader mode, we must + * adjust the fapl so as to push the VFD SWMR reader vfd on + * the VFD stack specified in the fapl. * * Do this as follows: * * 1) Copy the file driver from the supplied fapl. Note - * that due to potential VFD stacking, we can't verify - * that this VFD supports vfd swmr. This will have to + * that due to potential VFD stacking, we can't verify + * that this VFD supports vfd swmr. This will have to * wait until after the file is opened. * - * 2) Create a new FAPL, and set the file driver optained + * 2) Create a new FAPL, and set the file driver optained * in 1) in the new FAPL. * * 3) Allocate a new instance of H5FD_vfd_swmr_reader_config_t, @@ -423,13 +413,13 @@ done: herr_t H5P_push_vfd_swmr_reader_vfd_on_fapl(hid_t fapl_id) { - H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ - H5FD_vfd_swmr_reader_fapl_t * info = NULL; - H5P_genplist_t * plist_ptr = NULL; - hid_t sub_fapl_id; - H5P_genplist_t * sub_plist_ptr = NULL; - H5P_genclass_t * pclass = NULL; - herr_t ret_value = SUCCEED; + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + H5FD_vfd_swmr_reader_fapl_t *info = NULL; + H5P_genplist_t * plist_ptr = NULL; + hid_t sub_fapl_id; + H5P_genplist_t * sub_plist_ptr = NULL; + H5P_genclass_t * pclass = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -437,7 +427,6 @@ H5P_push_vfd_swmr_reader_vfd_on_fapl(hid_t fapl_id) if (NULL == (plist_ptr = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - /* 1) Copy the file driver from the supplied fapl. Note * that due to potential VFD stacking, we can't verify * that this VFD supports vfd swmr. This will have to @@ -448,7 +437,6 @@ H5P_push_vfd_swmr_reader_vfd_on_fapl(hid_t fapl_id) if (H5P_peek(plist_ptr, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get init driver ID & info") - /* 2) Create a new FAPL, and set the file driver optained in 1) in the new FAPL. */ /* create a new FAPL */ @@ -462,20 +450,19 @@ H5P_push_vfd_swmr_reader_vfd_on_fapl(hid_t fapl_id) if (NULL == (sub_plist_ptr = (H5P_genplist_t *)H5I_object(sub_fapl_id))) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get sub-fapl pointer") - /* insert the driver info from the base fapl into the sub-fapl. There is - * some question in my mind as to whether I should be making a copy of the + /* insert the driver info from the base fapl into the sub-fapl. There is + * some question in my mind as to whether I should be making a copy of the * info and string obtained above. While I don't think it is necessary, * if we get occult failures, this is a good place to look. * - * Note that for now, the driver info being inserted in sub-fapl should only specify - * the sec2 VFD -- which has NULL info and config string. Thus, if it is an + * Note that for now, the driver info being inserted in sub-fapl should only specify + * the sec2 VFD -- which has NULL info and config string. Thus, if it is an * issue, it may not appear immediately. */ - if ( H5P_set_driver(sub_plist_ptr, driver_prop.driver_id, - driver_prop.driver_info, driver_prop.driver_config_str) < 0 ) + if (H5P_set_driver(sub_plist_ptr, driver_prop.driver_id, driver_prop.driver_info, + driver_prop.driver_config_str) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set driver on sub-fapl") - /* 3) Allocate a new instance of H5FD_vfd_swmr_reader_config_t, * load it with the ID of the FAPL created in 2, and use * it to overwrite the file driver entry in the supplied @@ -501,7 +488,6 @@ done: } /* end H5P_push_vfd_swmr_reader_vfd_on_fapl() */ - /*------------------------------------------------------------------------- * Function: H5FD__swmr_reader_open * @@ -611,13 +597,13 @@ H5FD__vfd_swmr_create_make_believe_data(H5FD_vfd_swmr_t *_file) static H5FD_t * H5FD__vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_vfd_swmr_t * file = NULL; - size_t page_buf_size; - H5P_genplist_t * plist; - H5F_vfd_swmr_config_t * vfd_swmr_config; - const H5FD_vfd_swmr_reader_fapl_t * fa_ptr = NULL; - H5FD_t * ret_value = NULL; /* Return value */ - htri_t is_hdf5; + H5FD_vfd_swmr_t * file = NULL; + size_t page_buf_size; + H5P_genplist_t * plist; + H5F_vfd_swmr_config_t * vfd_swmr_config; + const H5FD_vfd_swmr_reader_fapl_t *fa_ptr = NULL; + H5FD_t * ret_value = NULL; /* Return value */ + htri_t is_hdf5; FUNC_ENTER_PACKAGE @@ -642,7 +628,6 @@ H5FD__vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t max if (NULL == (file = H5FL_CALLOC(H5FD_vfd_swmr_t))) HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, NULL, "unable to allocate file struct") - /* get the vfd swrm reader fapl entry. */ if (H5P_peek_driver(plist) != H5FD_VFD_SWMR) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "incorrect VFL driver"); @@ -652,16 +637,15 @@ H5FD__vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t max HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info"); HDassert(fa_ptr->magic == H5FD_VFD_SWMR_READER_MAGIC); /* sanity check */ - - /* the fapl id stored in fa_ptr->fapl_id should contain a driver entry that - * specifies a VFD that supports VFD SWMR. Since there may be a stack of + + /* the fapl id stored in fa_ptr->fapl_id should contain a driver entry that + * specifies a VFD that supports VFD SWMR. Since there may be a stack of * VFDs, we can't check this until after file open. Further, the vfd swmr - * reader vfd is currenty hard coded to use the sec2 vfd as its underlying - * vfd. Thus we just save a copy of the H5FD_vfd_swmr_reader_fapl_t for + * reader vfd is currenty hard coded to use the sec2 vfd as its underlying + * vfd. Thus we just save a copy of the H5FD_vfd_swmr_reader_fapl_t for * now. */ H5MM_memcpy(&(file->fa), fa_ptr, sizeof(H5FD_vfd_swmr_reader_fapl_t)); - vfd_swmr_config = &file->config; @@ -707,7 +691,6 @@ H5FD__vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t max if ((file->hdf5_file_lf = H5FD_open(name, flags, H5P_FILE_ACCESS_DEFAULT, maxaddr)) == NULL) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "can't set driver info"); - /* set pb_configured to FALSE. This field should not exist, but * until we modify the file open procedure to create the page buffer * before there is any file I/O when opening a file VFD SWMR reader, @@ -731,7 +714,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__vfd_swmr_open() */ - /*------------------------------------------------------------------------- * Function: H5FD__vfd_swmr_close * @@ -806,7 +788,6 @@ H5FD__vfd_swmr_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__vfd__swmr_cmp() */ - /*------------------------------------------------------------------------- * Function: H5FD__vfd_swmr_query * @@ -1117,7 +1098,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__vfd_swmr_read() */ - /*------------------------------------------------------------------------- * Function: H5FD__vfd_swmr_write * @@ -1128,9 +1108,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD__vfd_swmr_write(H5FD_t H5_ATTR_UNUSED * _file, H5FD_mem_t H5_ATTR_UNUSED type, +H5FD__vfd_swmr_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, - const void H5_ATTR_UNUSED * buf) + const void H5_ATTR_UNUSED *buf) { FUNC_ENTER_PACKAGE_NOERR /* Yes, even though this pushes an error on the stack */ @@ -1140,7 +1120,6 @@ H5FD__vfd_swmr_write(H5FD_t H5_ATTR_UNUSED * _file, H5FD_mem_t H5_ATTR_UNUSED ty } /* end H5FD__vfd_swmr_write() */ - /*------------------------------------------------------------------------- * Function: H5FD_vfd_swmr_truncate * @@ -1152,7 +1131,7 @@ H5FD__vfd_swmr_write(H5FD_t H5_ATTR_UNUSED * _file, H5FD_mem_t H5_ATTR_UNUSED ty *------------------------------------------------------------------------- */ static herr_t -H5FD__vfd_swmr_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id, +H5FD__vfd_swmr_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { FUNC_ENTER_PACKAGE_NOERR /* Yes, even though this pushes an error on the stack */ @@ -1162,7 +1141,6 @@ H5FD__vfd_swmr_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_ FUNC_LEAVE_NOAPI(FAIL) } - /*------------------------------------------------------------------------- * Function: H5FD__vfd_swmr_lock * @@ -1217,7 +1195,6 @@ done: } /* end H5FD__vfd_swmr_unlock() */ - /*------------------------------------------------------------------------- * Function: H5FD__vfd_swmr_ctl * @@ -1277,7 +1254,6 @@ done: } /* end H5FD__vfd_swmr_ctl() */ - /*------------------------------------------------------------------------- * Function: H5FD__vfd_swmr_load_hdr_and_idx() * diff --git a/src/H5FDvfd_swmr.h b/src/H5FDvfd_swmr.h index 326f825..95e7979 100644 --- a/src/H5FDvfd_swmr.h +++ b/src/H5FDvfd_swmr.h @@ -22,41 +22,39 @@ /* Semi-unique constant used to help identify structure pointers */ #define H5FD_VFD_SWMR_READER_MAGIC 0xABC123 - /* ---------------------------------------------------------------------------- * Structure: H5FD_vfd_swmr_reader_fapl_t * * Structure for configuring the VFD SWMR reader VFD. This structure and the - * associated FAPL entry and get / set routines are for HDF5 library use only, - * and should never be seen by the user. + * associated FAPL entry and get / set routines are for HDF5 library use only, + * and should never be seen by the user. * - * When a file is opened in VFD SWMR mode, the VFD SWMR reader VFD is inserted + * When a file is opened in VFD SWMR mode, the VFD SWMR reader VFD is inserted * at the top of the user supplied (or default) VFD stack. * - * The fields of this structure are discussed indvidually below. Note that - * there is no version field, since this structure should not be accessible + * The fields of this structure are discussed indvidually below. Note that + * there is no version field, since this structure should not be accessible * to the user. The set of fields is quite limited, as most of the necessary * configuration data is taken from the VFD SWMR configuration FAPL entry * * magic (int32_t) * Semi-unique number, used to sanity-check that a given pointer is * likely (or not) to be this structure type. MUST be first. - * If magic is not H5FD_VFD_SWMR_READER_MAGIC, the structure (and/or + * If magic is not H5FD_VFD_SWMR_READER_MAGIC, the structure (and/or * pointer to) must be considered invalid. * * fapl_id (hid_t) - * Library-given identification number of the FAPL containing the user - * supplied VFD stack. Must be set to H5P_DEFAULT or contain a file + * Library-given identification number of the FAPL containing the user + * supplied VFD stack. Must be set to H5P_DEFAULT or contain a file * driver entry specifying a VFD that supports VFD SWMR * * ---------------------------------------------------------------------------- */ typedef struct H5FD_vfd_swmr_reader_fapl_t { - int32_t magic; - hid_t fapl_id; + int32_t magic; + hid_t fapl_id; } H5FD_vfd_swmr_reader_fapl_t; - #ifdef __cplusplus extern "C" { #endif @@ -65,7 +63,6 @@ H5_DLL hid_t H5FD_vfd_swmr_init(void); H5_DLL herr_t H5P_pop_vfd_swmr_reader_vfd_off_fapl(hid_t fapl_id); H5_DLL herr_t H5P_push_vfd_swmr_reader_vfd_on_fapl(hid_t fapl_id); - #ifdef __cplusplus } #endif diff --git a/src/H5Fint.c b/src/H5Fint.c index c700ac6..82c61a0 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -40,7 +40,7 @@ #if 1 /* JRM */ /* probably want to re-work this */ #include "H5FDvfd_swmr.h" -#endif /* JRM */ +#endif /* JRM */ #include "H5VLnative_private.h" /* Native VOL connector */ @@ -1807,34 +1807,34 @@ done: H5F_t * H5F_open(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' */ - H5FD_t * lf = NULL; /*file driver part of `shared' */ - unsigned tent_flags; /*tentative flags */ - H5FD_class_t * drvr; /*file driver class info */ - H5P_genplist_t * a_plist; /*file access property list */ - H5F_close_degree_t fc_degree; /*file close degree */ - size_t page_buf_size; - unsigned page_buf_min_meta_perc = 0; - unsigned page_buf_min_raw_perc = 0; - hbool_t vfd_swmr = FALSE; /* TRUE iff opening file with VFD SWMR */ - hbool_t vfd_swmr_writer = FALSE; /* TRUE iff opening file as VFD SWMR */ - /* writer. */ - hbool_t pop_vfd_swmr_reader_vfd = FALSE; /* Flag set when the VFD SWMR reader VFD */ - /* has been pushed on the supplied fapl */ - /* and must be poped before return. */ - hbool_t set_flag = FALSE; /* Set the status_flags in the superblock */ - hbool_t clear = FALSE; /* Clear the status_flags */ - hbool_t evict_on_close; /* Evict on close value from plist */ - hbool_t use_file_locking = TRUE; /* Using file locks? */ - hbool_t ci_load = FALSE; /* Whether MDC ci load requested */ - hbool_t ci_write = FALSE; /* Whether MDC ci write requested */ - hbool_t file_create = FALSE; /* Creating a new file or not */ - H5F_vfd_swmr_config_t * vfd_swmr_config_ptr = NULL; /* Points to VFD SMWR config info */ - H5F_generate_md_ck_cb_t cb_info = {NULL}; /* For VFD SWMR NFS testing: - initialize the callback to generate - checksums for metadata files */ - H5F_t *ret_value = NULL; /* Actual return value */ + H5F_t * file = NULL; /*the success return value */ + H5F_shared_t * shared = NULL; /*shared part of `file' */ + H5FD_t * lf = NULL; /*file driver part of `shared' */ + unsigned tent_flags; /*tentative flags */ + H5FD_class_t * drvr; /*file driver class info */ + H5P_genplist_t * a_plist; /*file access property list */ + H5F_close_degree_t fc_degree; /*file close degree */ + size_t page_buf_size; + unsigned page_buf_min_meta_perc = 0; + unsigned page_buf_min_raw_perc = 0; + hbool_t vfd_swmr = FALSE; /* TRUE iff opening file with VFD SWMR */ + hbool_t vfd_swmr_writer = FALSE; /* TRUE iff opening file as VFD SWMR */ + /* writer. */ + hbool_t pop_vfd_swmr_reader_vfd = FALSE; /* Flag set when the VFD SWMR reader VFD */ + /* has been pushed on the supplied fapl */ + /* and must be poped before return. */ + hbool_t set_flag = FALSE; /* Set the status_flags in the superblock */ + hbool_t clear = FALSE; /* Clear the status_flags */ + hbool_t evict_on_close; /* Evict on close value from plist */ + hbool_t use_file_locking = TRUE; /* Using file locks? */ + hbool_t ci_load = FALSE; /* Whether MDC ci load requested */ + hbool_t ci_write = FALSE; /* Whether MDC ci write requested */ + hbool_t file_create = FALSE; /* Creating a new file or not */ + H5F_vfd_swmr_config_t * vfd_swmr_config_ptr = NULL; /* Points to VFD SMWR config info */ + H5F_generate_md_ck_cb_t cb_info = {NULL}; /* For VFD SWMR NFS testing: + initialize the callback to generate + checksums for metadata files */ + H5F_t *ret_value = NULL; /* Actual return value */ FUNC_ENTER_NOAPI(NULL) @@ -1842,10 +1842,9 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if (NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") - /* start by testing to see if we are opening the file VFD SWMR reader. If * we are, we must "push" the vfd swrm reader vfd on the vfd "stack" supplied - * by the user in the fapl. Since the user may use the fapl elsewhere, we + * by the user in the fapl. Since the user may use the fapl elsewhere, we * must "pop" the vfd swmr reader vfd off the vfd "stack" before we return. * * In passing, collect the VFD SWMR configuration info for later use. @@ -1863,7 +1862,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if (vfd_swmr_config_ptr->version) { /* get the page buffer size and verify that it is greater tha zero. Note - * that this get of the page buffer size is redundant -- we do it again + * that this get of the page buffer size is redundant -- we do it again * below. */ if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &page_buf_size) < 0) @@ -1878,7 +1877,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) */ /* Legacy SWMR and VFD SWMR are incompatible. Fail if the legacy SWMR flags are set */ - if ( (flags & H5F_ACC_SWMR_WRITE) || ( flags & H5F_ACC_SWMR_READ) ) + if ((flags & H5F_ACC_SWMR_WRITE) || (flags & H5F_ACC_SWMR_READ)) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "Legacy and VFD SWMR are incompatible") /* Verify that file access flags are consistent with VFD SWMR configuration */ @@ -1887,30 +1886,28 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if ((flags & H5F_ACC_RDWR) == 0 && vfd_swmr_config_ptr->writer) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "file access is reader but VFD SWMR config is writer") - - if ( ((flags & H5F_ACC_RDWR) == 0) && (! vfd_swmr_config_ptr->writer) ) { + if (((flags & H5F_ACC_RDWR) == 0) && (!vfd_swmr_config_ptr->writer)) { vfd_swmr = TRUE; - /* We are opening a file as a VFD SWMR reader. Push the vfd swrm reader vfd on the - * vfd stack specified in the fapl. Set the pop_vfd_swmr_reader flag to trigger a + /* We are opening a file as a VFD SWMR reader. Push the vfd swrm reader vfd on the + * vfd stack specified in the fapl. Set the pop_vfd_swmr_reader flag to trigger a * pop of the vfd swmr reader vfd on exit from this function. */ - if ( H5P_push_vfd_swmr_reader_vfd_on_fapl(fapl_id) < 0 ) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, "can't push VFD SWMR reader VFD on FAPL"); + if (H5P_push_vfd_swmr_reader_vfd_on_fapl(fapl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, "can't push VFD SWMR reader VFD on FAPL"); pop_vfd_swmr_reader_vfd = TRUE; - - } else if ( ( flags & H5F_ACC_RDWR ) && ( vfd_swmr_config_ptr->writer ) ) { + } + else if ((flags & H5F_ACC_RDWR) && (vfd_swmr_config_ptr->writer)) { - vfd_swmr = TRUE; + vfd_swmr = TRUE; vfd_swmr_writer = TRUE; - } + } /* if we get to this point, vfd_swmr must be TRUE. */ HDassert(vfd_swmr); - /* Retrieve the private property for VFD SWMR testing */ if (H5P_get(a_plist, H5F_ACS_GENERATE_MD_CK_CB_NAME, &cb_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get generate_md_ck_cb info") @@ -1932,12 +1929,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file locking flag") /* turn off file locking unconditionally if the file is being opened VFD SWMR reader */ - if ( ( vfd_swmr ) && ( ! vfd_swmr_writer ) ) { + if ((vfd_swmr) && (!vfd_swmr_writer)) { - use_file_locking = FALSE; + use_file_locking = FALSE; } - /* * Opening a file is a two step process. First we try to open the * file in a way which doesn't affect its state (like not truncating @@ -1965,7 +1961,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) name, tent_flags) } /* end if */ - /* Avoid reusing a virtual file opened exclusively by a second virtual * file, or opening the same file twice with different parameters. */ @@ -2001,13 +1996,13 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) "SWMR read access flag not the same for file that is already open") /* fail if VFD SWMR configurations disagree */ - if ( HDmemcmp(&(shared->vfd_swmr_config), vfd_swmr_config_ptr, sizeof(H5F_vfd_swmr_config_t)) ) + if (HDmemcmp(&(shared->vfd_swmr_config), vfd_swmr_config_ptr, sizeof(H5F_vfd_swmr_config_t))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "VFD SWMR configuration not the same for file that is already open") - /* Arguably, we should fail if there is a page size mismatch. However, if I read + /* Arguably, we should fail if there is a page size mismatch. However, if I read * the code correctly, the page size and page buffer configuration from the open file - * will domininate. Thus, there probably isn't a functional issue. That said, + * will domininate. Thus, there probably isn't a functional issue. That said, * this should be thought about. */ @@ -2299,7 +2294,7 @@ done: if (vfd_swmr_config_ptr) H5MM_free(vfd_swmr_config_ptr); - if ( ( pop_vfd_swmr_reader_vfd ) && ( H5P_pop_vfd_swmr_reader_vfd_off_fapl(fapl_id) < 0 ) ) + if ((pop_vfd_swmr_reader_vfd) && (H5P_pop_vfd_swmr_reader_vfd_off_fapl(fapl_id) < 0)) HDONE_ERROR(H5E_PLIST, H5E_CANTSET, NULL, "can't pop vfd swrm reader vfd off vfd stack") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index adc2b40..e5d3339 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -1218,8 +1218,8 @@ H5_DLL herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_han /* VFD SWMR functions */ H5_DLL hbool_t H5F_get_use_vfd_swmr(const H5F_t *f); H5_DLL herr_t H5F_vfd_swmr_init(H5F_t *f, hbool_t file_create); -H5_DLL herr_t H5F_vfd_swmr_build_md_path_name(H5F_vfd_swmr_config_t *config, const char *hdf5_filename, - char *name /*out*/); +H5_DLL herr_t H5F_vfd_swmr_build_md_path_name(H5F_vfd_swmr_config_t *config, const char *hdf5_filename, + char *name /*out*/); H5_DLL herr_t H5F_vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing); H5_DLL herr_t H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t index_len, H5FD_vfd_swmr_idx_entry_t *index); diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c index 0e24804..702c362 100644 --- a/src/H5Fvfd_swmr.c +++ b/src/H5Fvfd_swmr.c @@ -191,8 +191,8 @@ H5F_vfd_swmr_init(H5F_t *f, hbool_t file_create) if (NULL == (shared->md_file_path_name = H5MM_calloc((H5FD_MAX_FILENAME_LEN + 1) * sizeof(char)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name") - if ( H5F_vfd_swmr_build_md_path_name(&(shared->vfd_swmr_config), f->open_name, - shared->md_file_path_name) < 0 ) + if (H5F_vfd_swmr_build_md_path_name(&(shared->vfd_swmr_config), f->open_name, + shared->md_file_path_name) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to build metadata file name") if (((shared->vfd_swmr_md_fd = HDopen(shared->md_file_path_name, O_CREAT | O_RDWR | O_TRUNC, @@ -300,8 +300,8 @@ done: * Programmer: Vailin Choi -- 1/13/2022 * * Changes: Moved to H5Fvfd_swmr.c from H5FDvfd_swmr.c, and renamed - * accordingly. Changed FUNC_ENTER_PACKAGE to - * FUNC_ENTER_NOAPI. Converted to a private function so + * accordingly. Changed FUNC_ENTER_PACKAGE to + * FUNC_ENTER_NOAPI. Converted to a private function so * that it can be called in H5FDvfd_swmr.c * * JRM -- 5/17/22 @@ -309,8 +309,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_vfd_swmr_build_md_path_name(H5F_vfd_swmr_config_t *config, const char *hdf5_filename, - char *name /*out*/) +H5F_vfd_swmr_build_md_path_name(H5F_vfd_swmr_config_t *config, const char *hdf5_filename, char *name /*out*/) { size_t tot_len = 0; size_t tmp_len = 0; diff --git a/test/vfd_swmr.c b/test/vfd_swmr.c index e4f337d..e3149f2 100644 --- a/test/vfd_swmr.c +++ b/test/vfd_swmr.c @@ -5403,11 +5403,11 @@ test_vfds_same_file_opens(hid_t orig_fapl, const char *env_h5_drvr) FAIL_STACK_ERROR; #if 1 /* Use test cases #4 and #5 when John's changes are merged */ - /* - * Case #4 + /* + * Case #4 * --Open the file as writer with both legacy SWMR and VFD SWMR configured . * --NOTE: The open should fail when John's changes are merged but for now it succeeds. - */ + */ /* * Set up VFD SWMR configuration as writer in fapl @@ -5416,8 +5416,7 @@ test_vfds_same_file_opens(hid_t orig_fapl, const char *env_h5_drvr) /* config, tick_len, max_lag, presume_posix_semantics, writer, * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, * md_file_path, md_file_name, updater_file_path */ - init_vfd_swmr_config(config, 4, 10, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, - MD_FILENAME, NULL); + init_vfd_swmr_config(config, 4, 10, FALSE, TRUE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); if ((fapl = H5Pcopy(orig_fapl)) < 0) FAIL_STACK_ERROR; @@ -5442,18 +5441,17 @@ test_vfds_same_file_opens(hid_t orig_fapl, const char *env_h5_drvr) if (H5Pclose(fapl) < 0) FAIL_STACK_ERROR; - /* + /* * Case #5: * --Open the file as reader with both legacy SWMR and VFD SWMR configured . * --NOTE: The open should fail when John's changes are merged but for now it succeeds. - */ + */ /* config, tick_len, max_lag, presume_posix_semantics, writer, * maintain_metadata_file, generate_updater_files, flush_raw_data, md_pages_reserved, * md_file_path, md_file_name, updater_file_path */ /* NOTE: Set "presume_posix_semantics" to TRUE and "writer" to FALSE */ - init_vfd_swmr_config(config, 4, 10, TRUE, FALSE, TRUE, FALSE, TRUE, 2, NULL, - MD_FILENAME, NULL); + init_vfd_swmr_config(config, 4, 10, TRUE, FALSE, TRUE, FALSE, TRUE, 2, NULL, MD_FILENAME, NULL); if ((fapl = H5Pcopy(orig_fapl)) < 0) FAIL_STACK_ERROR; @@ -5469,11 +5467,11 @@ test_vfds_same_file_opens(hid_t orig_fapl, const char *env_h5_drvr) } H5E_END_TRY; /* Change the section of code inside the "for loop" to TEST_ERROR when John's changes are merged */ - if(fid1 >= 0) { + if (fid1 >= 0) { printf("The reader open succeeds which shouldn't be\n"); if (H5Fclose(fid1) < 0) FAIL_STACK_ERROR; - } + } if (H5Pclose(fapl) < 0) FAIL_STACK_ERROR; -- cgit v0.12