From 348b6d97a77a4c272dbd8b769a1cfb8e3840c2ce Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 9 Jul 2020 11:11:27 -0700 Subject: Minor renaming in H5S hyperslab code. --- src/H5Shyper.c | 24 ++++++++++-------------- src/H5Spkg.h | 3 ++- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 6023205..10b961b 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -87,10 +87,6 @@ static herr_t H5S__hyper_generate_spans(H5S_t *space); static herr_t H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]); -/* Needed for use in hyperslab code (H5Shyper.c) */ -#ifdef NEW_HYPERSLAB_API -static herr_t H5S__select_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2); -#endif /*NEW_HYPERSLAB_API*/ static void H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count, hsize_t *block, hsize_t clip_size); static hsize_t H5S__hyper_get_clip_extent_real(const H5S_t *clip_space, @@ -7848,7 +7844,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5S__select_select + * Function: H5S__modify_select * * Purpose: Internal version of H5Sselect_select(). * @@ -7859,14 +7855,14 @@ done: * *------------------------------------------------------------------------- */ -static herr_t -H5S_select_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2) +herr_t +H5S__modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2) { H5S_hyper_span_info_t *tmp_spans = NULL; /* Temporary copy of selection */ hbool_t span2_owned=FALSE; /* Flag to indicate that span2 was used in H5S_operate_hyperslab() */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* Check args */ HDassert(space1); @@ -7906,7 +7902,7 @@ done: H5S__hyper_free_span_info(tmp_spans); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_select_select() */ +} /* end H5S__modify_select() */ /*-------------------------------------------------------------------------- @@ -7914,7 +7910,7 @@ done: H5Sselect_select PURPOSE Refine a hyperslab selection with an operation using a second hyperslab - to modify it. + to modify it USAGE herr_t H5Sselect_select(space1, op, space2) hid_t space1; IN/OUT: First Dataspace ID @@ -7934,8 +7930,8 @@ done: herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) { - H5S_t *space1; /* First Dataspace */ - H5S_t *space2; /* Second Dataspace */ + H5S_t *space1; /* First Dataspace */ + H5S_t *space2; /* Second Dataspace */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -7958,7 +7954,7 @@ H5Sselect_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections") /* Go refine the first selection */ - if(H5S_select_select(space1, op, space2)<0) + if(H5S__modify_select(space1, op, space2) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to modify hyperslab selection") done: @@ -10348,7 +10344,7 @@ H5S_hyper_get_first_inc_block(const H5S_t *space, hsize_t clip_size, hbool_t *partial) { H5S_hyper_sel_t *hslab; /* Convenience pointer to hyperslab info */ - H5S_hyper_dim_t *diminfo; /* Convenience pointer to opt_diminfo in unlimited dimension */ + H5S_hyper_dim_t *diminfo; /* Convenience pointer to diminfo in unlimited dimension */ hsize_t ret_value = 0; FUNC_ENTER_NOAPI(0) diff --git a/src/H5Spkg.h b/src/H5Spkg.h index d95c4ff..2961ef1 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -303,7 +303,8 @@ H5_DLL herr_t H5S__extent_release(H5S_extent_t *extent); H5_DLL herr_t H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max); -/* Operations on selections */ +/* Operations on hyperslab selections */ +H5_DLL herr_t H5S__modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2); H5_DLL herr_t H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, const H5S_t *src_intersect_space, H5S_t *proj_space); -- cgit v0.12 From 252c57f8d0bc9fb650e15b7536b7b26a07e34eac Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 9 Jul 2020 13:38:38 -0700 Subject: H5F and H5FS normalization with develop. --- src/H5F.c | 593 ++++++++++++++++++++++++++---------------------------- src/H5FS.c | 72 +++---- src/H5FScache.c | 44 ++-- src/H5FSpkg.h | 10 +- src/H5FSprivate.h | 2 +- src/H5FSsection.c | 300 +++++++++++++-------------- src/H5Fint.c | 114 +++++------ src/H5Fpkg.h | 1 - src/H5HFspace.c | 2 +- src/H5MF.c | 5 +- 10 files changed, 563 insertions(+), 580 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 83ce5f6..97ee8f3 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -113,16 +113,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_term_package + * Function: H5F_term_package * - * Purpose: Terminate this interface: free all memory and reset global - * variables to their initial values. Release all ID groups - * associated with this interface. + * Purpose: Terminate this interface: free all memory and reset global + * variables to their initial values. Release all ID groups + * associated with this interface. * - * Return: Success: Positive if anything was done that might - * have affected other interfaces; - * zero otherwise. - * Failure: Never fails. + * Return: Success: Positive if anything was done that might + * have affected other interfaces; + * zero otherwise. + * + * Failure: Never fails *------------------------------------------------------------------------- */ int @@ -155,14 +156,15 @@ H5F_term_package(void) /*------------------------------------------------------------------------- - * Function: H5Fget_create_plist + * Function: H5Fget_create_plist * - * Purpose: Get an atom for a copy of the file-creation property list for - * this file. This function returns an atom with a copy of the - * properties used to create a file. + * Purpose: Get an atom for a copy of the file-creation property list for + * this file. This function returns an atom with a copy of the + * properties used to create a file. * - * Return: Success: template ID - * Failure: FAIL + * Return: Success: Object ID for a copy of the file creation + * property list. + * Failure: H5I_INVALID_HID *------------------------------------------------------------------------- */ hid_t @@ -170,20 +172,20 @@ H5Fget_create_plist(hid_t file_id) { H5F_t *file; /* File info */ H5P_genplist_t *plist; /* Property list */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* check args */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") if(NULL == (plist = (H5P_genplist_t *)H5I_object(file->shared->fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file creation property list") - /* Create the property list object to return */ + /* Retrieve the file creation property list */ if((ret_value = H5P_copy_plist(plist, TRUE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to copy file creation properties") + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties") done: FUNC_LEAVE_API(ret_value) @@ -191,37 +193,37 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_access_plist + * Function: H5Fget_access_plist * - * Purpose: Returns a copy of the file access property list of the - * specified file. + * Purpose: Returns a copy of the file access property list of the + * specified file. * * NOTE: Make sure that, if you are going to overwrite * information in the copied property list that was * previously opened and assigned to the property list, then * you must close it before overwriting the values. * - * Return: Success: Object ID for a copy of the file access - * property list. - * Failure: FAIL + * Return: Success: Object ID for a copy of the file access + * property list. + * Failure: H5I_INVALID_HID *------------------------------------------------------------------------- */ hid_t H5Fget_access_plist(hid_t file_id) { H5F_t *f; /* File info */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* Check args */ if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file's access property list */ if((ret_value = H5F_get_access_plist(f, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list") done: FUNC_LEAVE_API(ret_value) @@ -229,12 +231,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_obj_count + * Function: H5Fget_obj_count * - * Purpose: Public function returning the number of opened object IDs - * (files, datasets, groups and datatypes) in the same file. + * Purpose: Public function returning the number of opened object IDs + * (files, datasets, groups and datatypes) in the same file. * - * Return: Non-negative on success; negative on failure. + * Return: Success: The number of opened object IDs + * Failure: -1 *------------------------------------------------------------------------- */ ssize_t @@ -242,22 +245,22 @@ H5Fget_obj_count(hid_t file_id, unsigned types) { H5F_t *f = NULL; /* File to query */ size_t obj_count = 0; /* Number of opened objects */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = 0; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE2("Zs", "iIu", file_id, types); /* Check arguments */ if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file id") if(0 == (types & H5F_OBJ_ALL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type") /* Perform the query */ if(H5F_get_obj_count(f, types, TRUE, &obj_count) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_count failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "H5F_get_obj_count failed") - /* Set the return value */ + /* Set return value */ ret_value = (ssize_t)obj_count; done: @@ -266,11 +269,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_object_ids + * Function: H5Fget_object_ids * - * Purpose: Public function to return a list of opened object IDs. + * Purpose: Public function to return a list of opened object IDs. * - * Return: Non-negative on success; negative on failure. + * Return: Success: The number of IDs in oid_list + * Failure: -1 *------------------------------------------------------------------------- */ ssize_t @@ -278,22 +282,22 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) { H5F_t *f = NULL; /* File to query */ size_t obj_id_count = 0; /* Number of open objects */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = 0; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE4("Zs", "iIuz*i", file_id, types, max_objs, oid_list); /* Check arguments */ if(file_id != (hid_t)H5F_OBJ_ALL && (NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file id") if(0 == (types & H5F_OBJ_ALL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type") if(!oid_list) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "object ID list is NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "object ID list is NULL") /* Perform the query */ if(H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_id_count) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "H5F_get_obj_ids failed") /* Set the return value */ ret_value = (ssize_t)obj_id_count; @@ -309,30 +313,30 @@ done: * Purpose: Returns a pointer to the file handle of the low-level file * driver. * - * Return: Success: non-negative value. - * Failure: negative. + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t -H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle) +H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) { H5F_t *file; /* File to query */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "ii**x", file_id, fapl, file_handle); + H5TRACE3("e", "ii**x", file_id, fapl_id, file_handle); /* Check args */ if(!file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer") - /* Get the file */ + /* Get the file object */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Retrieve the VFD handle for the file */ - if(H5F_get_vfd_handle(file, fapl, file_handle) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") + if(H5F_get_vfd_handle(file, fapl_id, file_handle) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") done: FUNC_LEAVE_API(ret_value) @@ -348,8 +352,8 @@ done: * driver when attempting to open the file when in fact it * should use all known file drivers. * - * Return: Success: TRUE/FALSE - * Failure: Negative + * Return: Success: TRUE/FALSE + * Failure: -1 (includes file does not exist) *------------------------------------------------------------------------- */ htri_t @@ -367,7 +371,7 @@ H5Fis_hdf5(const char *name) /* call the private is_HDF5 function */ /* (Should not trigger raw data I/O - QAK, 2018/01/03) */ if((ret_value = H5F__is_hdf5(name)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable open file") + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5") done: FUNC_LEAVE_API(ret_value) @@ -394,37 +398,37 @@ done: * the list of file creation and file access properties. * * Return: Success: A file ID - * Failure: FAIL + * Failure: H5I_INVALID_HID *------------------------------------------------------------------------- */ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - H5F_t *new_file = NULL; /* file struct for new file */ - hid_t ret_value; /* return value */ + H5F_t *new_file = NULL; /* File struct for new file */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); /* Check/fix arguments */ - if (!filename || !*filename) + if(!filename || !*filename) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name") /* In this routine, we only accept the following flags: * H5F_ACC_EXCL, H5F_ACC_TRUNC and H5F_ACC_SWMR_WRITE */ - if (flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) + if(flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid flags") /* The H5F_ACC_EXCL and H5F_ACC_TRUNC flags are mutually exclusive */ - if ((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) + if((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "mutually exclusive flags for file creation") /* Check file creation property list */ - if (H5P_DEFAULT == fcpl_id) + if(H5P_DEFAULT == fcpl_id) fcpl_id = H5P_FILE_CREATE_DEFAULT; else - if (TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) + if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not file create property list") /* Verify access property list and set up collective metadata if appropriate */ @@ -439,13 +443,13 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) flags |= H5F_ACC_EXCL; /*default*/ flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; - /* Create a new file or truncate an existing file. */ + /* Create a new file or truncate an existing file */ if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") /* Get an atom for the file */ - if ((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file") + if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") /* Keep this ID in file object structure */ new_file->file_id = ret_value; @@ -472,21 +476,19 @@ done: * See Also: H5Fpublic.h for a list of possible values for FLAGS. * * Return: Success: A file ID - * - * Failure: FAIL - * + * Failure: H5I_INVALID_HID *------------------------------------------------------------------------- */ hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { H5F_t *new_file = NULL; /* file struct for new file */ - hid_t ret_value; /* return value */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "*sIui", filename, flags, fapl_id); - /* Check/fix arguments. */ + /* Check arguments */ if(!filename || !*filename) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name") /* Reject undefined flags (~H5F_ACC_PUBLIC_FLAGS) and the H5F_ACC_TRUNC & H5F_ACC_EXCL flags */ @@ -508,9 +510,9 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") - /* Get an atom for the file */ + /* Get an ID for the file */ if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") /* Keep this ID in file object structure */ new_file->file_id = ret_value; @@ -518,19 +520,19 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) done: if(ret_value < 0 && new_file && H5F_try_close(new_file, NULL) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problems closing file") - FUNC_LEAVE_API(ret_value) } /* end H5Fopen() */ /*------------------------------------------------------------------------- - * Function: H5Fflush + * Function: H5Fflush * - * Purpose: Flushes all outstanding buffers of a file to disk but does - * not remove them from the cache. The OBJECT_ID can be a file, - * dataset, group, attribute, or named data type. + * Purpose: Flushes all outstanding buffers of a file to disk but does + * not remove them from the cache. The OBJECT_ID can be a file, + * dataset, group, attribute, or named data type. * - * Return: Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -538,7 +540,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) { H5F_t *f = NULL; /* File to flush */ H5O_loc_t *oloc = NULL; /* Object location for ID */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "iFs", object_id, scope); @@ -645,17 +647,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fclose + * Function: H5Fclose * - * Purpose: This function closes the file specified by FILE_ID by - * flushing all data to storage, and terminating access to the - * file through FILE_ID. If objects (e.g., datasets, groups, - * etc.) are open in the file then the underlying storage is not - * closed until those objects are closed; however, all data for - * the file and the open objects is flushed. + * Purpose: This function closes the file specified by FILE_ID by + * flushing all data to storage, and terminating access to the + * file through FILE_ID. If objects (e.g., datasets, groups, + * etc.) are open in the file then the underlying storage is not + * closed until those objects are closed; however, all data for + * the file and the open objects is flushed. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -668,7 +670,7 @@ H5Fclose(hid_t file_id) /* Check arguments */ if(H5I_FILE != H5I_get_type(file_id)) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID") /* Close the file */ if(H5F__close(file_id) < 0) @@ -680,16 +682,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Freopen + * Function: H5Freopen * - * Purpose: Reopen a file. The new file handle which is returned points - * to the same file as the specified file handle. Both handles - * share caches and other information. The only difference - * between the handles is that the new handle is not mounted - * anywhere and no files are mounted on it. + * Purpose: Reopen a file. The new file handle which is returned points + * to the same file as the specified file handle. Both handles + * share caches and other information. The only difference + * between the handles is that the new handle is not mounted + * anywhere and no files are mounted on it. * - * Return: Success: New file ID - * Failure: FAIL + * Return: Success: New file ID + * Failure: H5I_INVALID_HID *------------------------------------------------------------------------- */ hid_t @@ -697,18 +699,18 @@ H5Freopen(hid_t file_id) { H5F_t *old_file = NULL; H5F_t *new_file = NULL; - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); /* Check arguments */ if(NULL == (old_file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Get a new "top level" file struct, sharing the same "low level" file struct */ if(NULL == (new_file = H5F__new(old_file->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file") /* Duplicate old file's names */ new_file->open_name = H5MM_xstrdup(old_file->open_name); @@ -716,7 +718,7 @@ H5Freopen(hid_t file_id) new_file->extpath = H5MM_xstrdup(old_file->extpath); if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register an ID for file handle") /* Keep this ID in file object structure */ new_file->file_id = ret_value; @@ -724,19 +726,20 @@ H5Freopen(hid_t file_id) done: if(ret_value < 0 && new_file) if(H5F__dest(new_file, FALSE) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "can't close file") FUNC_LEAVE_API(ret_value) } /* end H5Freopen() */ /*------------------------------------------------------------------------- - * Function: H5Fget_intent + * Function: H5Fget_intent * - * Purpose: Public API to retrieve the file's 'intent' flags passed - * during H5Fopen() + * Purpose: Public API to retrieve the file's 'intent' flags passed + * during H5Fopen() * - * Return: Non-negative on success/negative on failure + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -785,8 +788,8 @@ done: * * Purpose: Retrieves the amount of free space in the file. * - * Return: Success: Amount of free space for type - * Failure: Negative + * Return: Success: Amount of free space for type + * Failure: -1 *------------------------------------------------------------------------- */ hssize_t @@ -796,16 +799,16 @@ H5Fget_freespace(hid_t file_id) hsize_t tot_space; /* Amount of free space in the file */ hssize_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE1("Hs", "i", file_id); - /* Check args */ + /* Get the file object */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") - /* Go get the actual amount of free space in the file */ + /* Get the amount of free space in the file */ if(H5MF_get_freespace(file, &tot_space, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") ret_value = (hssize_t)tot_space; @@ -819,7 +822,7 @@ done: * * Purpose: Retrieves the file size of the HDF5 file. This function * is called after an existing file is opened in order - * to learn the true size of the underlying file. + * to learn the true size of the underlying file. * * Return: Success: Non-negative * Failure: Negative @@ -831,7 +834,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) H5F_t *file; /* File object for file ID */ haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */ haddr_t base_addr; /* Base address for the file */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", file_id, size); @@ -840,9 +843,9 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Go get the actual file size */ + /* Get the file size */ if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") base_addr = H5FD_get_base_addr(file->shared->lf); @@ -858,56 +861,56 @@ done: * Function: H5Fget_file_image * * Purpose: If a buffer is provided (via the buf_ptr argument) and is - * big enough (size in buf_len argument), load *buf_ptr with - * an image of the open file whose ID is provided in the - * file_id parameter, and return the number of bytes copied - * to the buffer. + * big enough (size in buf_len argument), load *buf_ptr with + * an image of the open file whose ID is provided in the + * file_id parameter, and return the number of bytes copied + * to the buffer. * - * If the buffer exists, but is too small to contain an image - * of the indicated file, return a negative number. + * If the buffer exists, but is too small to contain an image + * of the indicated file, return a negative number. * - * Finally, if no buffer is provided, return the size of the - * buffer needed. This value is simply the eoa of the target - * file. + * Finally, if no buffer is provided, return the size of the + * buffer needed. This value is simply the eoa of the target + * file. * - * Note that any user block is skipped. + * Note that any user block is skipped. * - * Also note that the function may not be used on files - * opened with either the split/multi file driver or the - * family file driver. + * Also note that the function may not be used on files + * opened with either the split/multi file driver or the + * family file driver. * - * In the former case, the sparse address space makes the - * get file image operation impractical, due to the size of - * the image typically required. + * In the former case, the sparse address space makes the + * get file image operation impractical, due to the size of + * the image typically required. * - * In the case of the family file driver, the problem is - * the driver message in the super block, which will prevent - * the image being opened with any driver other than the - * family file driver -- which negates the purpose of the - * operation. This can be fixed, but no resources for - * this now. + * In the case of the family file driver, the problem is + * the driver message in the super block, which will prevent + * the image being opened with any driver other than the + * family file driver -- which negates the purpose of the + * operation. This can be fixed, but no resources for + * this now. * - * Return: Success: Bytes copied / number of bytes needed. - * Failure: negative value + * Return: Success: Bytes copied / number of bytes needed + * Failure: -1 *------------------------------------------------------------------------- */ ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) { H5F_t *file; /* File object for file ID */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*xz", file_id, buf_ptr, buf_len); /* Check args */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID") /* call private get_file_image function */ /* (Should not trigger raw data I/O - QAK, 2018/01/03) */ if((ret_value = H5F__get_file_image(file, buf_ptr, buf_len)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file image") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") done: FUNC_LEAVE_API(ret_value) @@ -915,17 +918,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_mdc_config + * Function: H5Fget_mdc_config * - * Purpose: Retrieves the current automatic cache resize configuration - * from the metadata cache, and return it in *config_ptr. + * Purpose: Retrieves the current automatic cache resize configuration + * from the metadata cache, and return it in *config_ptr. * - * Note that the version field of *config_Ptr must be correctly - * filled in by the caller. This allows us to adapt for - * obsolete versions of the structure. + * Note that the version field of *config_Ptr must be correctly + * filled in by the caller. This allows us to adapt for + * obsolete versions of the structure. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -943,9 +946,9 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) if((NULL == config_ptr) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr") - /* Go get the resize configuration */ + /* Get the metadata cache configuration */ if(H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") done: FUNC_LEAVE_API(ret_value) @@ -956,11 +959,11 @@ done: * Function: H5Fset_mdc_config * * Purpose: Sets the current metadata cache automatic resize - * configuration, using the contents of the instance of - * H5AC_cache_config_t pointed to by config_ptr. + * configuration, using the contents of the instance of + * H5AC_cache_config_t pointed to by config_ptr. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -972,13 +975,13 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); - /* Check args */ + /* Get the file object */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - /* set the resize configuration */ + /* Set the metadata cache configuration */ if(H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed.") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration") done: FUNC_LEAVE_API(ret_value) @@ -989,12 +992,12 @@ done: * Function: H5Fget_mdc_hit_rate * * Purpose: Retrieves the current hit rate from the metadata cache. - * This rate is the overall hit rate since the last time - * the hit rate statistics were reset either manually or - * automatically. + * This rate is the overall hit rate since the last time + * the hit rate statistics were reset either manually or + * automatically. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1007,15 +1010,14 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) H5TRACE2("e", "i*d", file_id, hit_rate_ptr); /* Check args */ - if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - if(NULL == hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") + if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Go get the current hit rate */ + /* Get the current hit rate */ if(H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: FUNC_LEAVE_API(ret_value) @@ -1026,13 +1028,13 @@ done: * Function: H5Fget_mdc_size * * Purpose: Retrieves the maximum size, minimum clean size, current - * size, and current number of entries from the metadata - * cache associated with the specified file. If any of - * the ptr parameters are NULL, the associated datum is - * not returned. + * size, and current number of entries from the metadata + * cache associated with the specified file. If any of + * the ptr parameters are NULL, the associated datum is + * not returned. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1051,11 +1053,9 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Go get the size data */ - if(H5AC_get_cache_size(file->shared->cache, max_size_ptr, - min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.") - + /* Get the size data */ + if(H5AC_get_cache_size(file->shared->cache, max_size_ptr, min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size") if(cur_num_entries_ptr != NULL) *cur_num_entries_ptr = (int)cur_num_entries; @@ -1068,16 +1068,16 @@ done: * Function: H5Freset_mdc_hit_rate_stats * * Purpose: Reset the hit rate statistic whose current value can - * be obtained via the H5Fget_mdc_hit_rate() call. Note - * that this statistic will also be reset once per epoch - * by the automatic cache resize code if it is enabled. + * be obtained via the H5Fget_mdc_hit_rate() call. Note + * that this statistic will also be reset once per epoch + * by the automatic cache resize code if it is enabled. * - * It is probably a bad idea to call this function unless - * you are controlling cache size from your program instead - * of using our cache size control code. + * It is probably a bad idea to call this function unless + * you are controlling cache size from your program instead + * of using our cache size control code. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1089,13 +1089,13 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); - /* Check args */ + /* Get the file object */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the hit rate statistic */ if(H5AC_reset_cache_hit_rate_stats(file->shared->cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") done: FUNC_LEAVE_API(ret_value) @@ -1106,18 +1106,19 @@ done: * Function: H5Fget_name * * Purpose: Gets the name of the file to which object OBJ_ID belongs. - * If `name' is non-NULL then write up to `size' bytes into that + * If 'name' is non-NULL then write up to 'size' bytes into that * buffer and always return the length of the entry name. - * Otherwise `size' is ignored and the function does not store the name, - * just returning the number of characters required to store the name. - * If an error occurs then the buffer pointed to by `name' (NULL or non-NULL) - * is unchanged and the function returns a negative value. + * Otherwise `size' is ignored and the function does not store + * the name, just returning the number of characters required to + * store the name. If an error occurs then the buffer pointed to + * by 'name' (NULL or non-NULL) is unchanged and the function + * returns a negative value. * * Note: This routine returns the name that was used to open the file, * not the actual name after resolving symlinks, etc. * - * Return: Success: The length of the file name - * Failure: Negative + * Return: Success: The length of the file name + * Failure: -1 *------------------------------------------------------------------------- */ ssize_t @@ -1125,9 +1126,9 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) { H5F_t *f; /* Top file in mount hierarchy */ size_t len; - ssize_t ret_value; + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", obj_id, name, size); /* For file IDs, get the file object directly */ @@ -1143,7 +1144,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) /* Get symbol table entry */ if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a valid object ID") f = loc.oloc->file; } /* end else */ @@ -1172,8 +1173,8 @@ done: * in the SOHM table if there is one. * 3. The amount of free space tracked in the file. * - * Return: Success: non-negative on success - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1187,7 +1188,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) /* Check args */ if(!finfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file info pointer can't be NULL") /* For file IDs, get the file object directly */ /* (This prevents the H5G_loc() call from returning the file pointer for @@ -1195,14 +1196,14 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) */ if(H5I_get_type(obj_id) == H5I_FILE ) { if(NULL == (f = (H5F_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") } /* end if */ else { H5G_loc_t loc; /* Object location */ /* Get symbol table entry */ if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") f = loc.oloc->file; } /* end else */ HDassert(f->shared); @@ -1219,23 +1220,24 @@ done: /*------------------------------------------------------------------------- * Function: H5Fget_metadata_read_retry_info * - * Purpose: To retrieve the collection of read retries for metadata items with checksum. + * Purpose: To retrieve the collection of read retries for metadata + * items with checksum. * - * Return: Success: non-negative on success - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) { - H5F_t *file; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *file; /* File object for file ID */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", file_id, info); /* Check args */ - if (!info) + if(!info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Get the file pointer */ @@ -1252,15 +1254,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_free_sections + * Function: H5Fget_free_sections * - * Purpose: To get free-space section information for free-space manager with - * TYPE that is associated with file FILE_ID. - * If SECT_INFO is null, this routine returns the total # of free-space - * sections. + * Purpose: To get free-space section information for free-space manager with + * TYPE that is associated with file FILE_ID. + * If SECT_INFO is null, this routine returns the total # of free-space + * sections. * - * Return: Success: non-negative, the total # of free space sections - * Failure: negative + * Return: Success: The total # of free space sections + * Failure: -1 *------------------------------------------------------------------------- */ ssize_t @@ -1268,20 +1270,20 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/) { H5F_t *file; /* Top file in mount hierarchy */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE4("Zs", "iFmzx", file_id, type, nsects, sect_info); /* Check args */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") if(sect_info && nsects == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0") /* Get the free-space section information in the file */ if((ret_value = H5MF_get_free_sections(file, type, nsects, sect_info)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") done: FUNC_LEAVE_API(ret_value) @@ -1295,15 +1297,15 @@ done: * provided file, potentially closing any cached files * unless they are held open from somewhere\ else. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5Fclear_elink_file_cache(hid_t file_id) { H5F_t *file; /* File */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); @@ -1312,9 +1314,8 @@ H5Fclear_elink_file_cache(hid_t file_id) if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* See if there's an EFC */ + /* Release the EFC */ if(file->shared->efc) - /* Release the EFC */ if(H5F__efc_release(file->shared->efc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") @@ -1326,10 +1327,10 @@ done: /*------------------------------------------------------------------------- * Function: H5Fstart_swmr_write * - * Purpose: To enable SWMR writing mode for the file - * - * Return: Non-negative on success/negative on failure + * Purpose: To enable SWMR writing mode for the file * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1341,17 +1342,17 @@ H5Fstart_swmr_write(hid_t file_id) FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); - /* check args */ + /* Check args */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call the internal routine */ + /* Start SWMR writing */ if(H5F__start_swmr_write(file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "unable to convert file format") + HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") done: FUNC_LEAVE_API(ret_value) @@ -1364,14 +1365,15 @@ done: * Purpose: Start metadata cache logging operations for a file. * - Logging must have been set up via the fapl. * - * Return: Non-negative on success/Negative on errors + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5Fstart_mdc_logging(hid_t file_id) { H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); @@ -1396,14 +1398,15 @@ done: * - Does not close the log file. * - Logging must have been set up via the fapl. * - * Return: Non-negative on success/Negative on errors + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5Fstop_mdc_logging(hid_t file_id) { H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); @@ -1428,7 +1431,8 @@ done: * set up via the fapl. is_currently_logging determines if * log messages are being recorded at this time. * - * Return: Non-negative on success/Negative on errors + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1436,7 +1440,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, hbool_t *is_currently_logging) { H5F_t *file; /* File info */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*b*b", file_id, is_enabled, is_currently_logging); @@ -1462,14 +1466,15 @@ done: * H5Fset_latest_format() starting release 1.10.2. * See explanation for H5Fset_latest_format() in H5Fdeprec.c. * - * Return: Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) { H5F_t *f; /* File */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "iFvFv", file_id, low, high); @@ -1482,9 +1487,9 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal set_libver_bounds function */ + /* Set the library's version bounds */ if(H5F__set_libver_bounds(f, low, high) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: FUNC_LEAVE_API(ret_value) @@ -1498,7 +1503,8 @@ done: * downgrade persistent file space to non-persistent * for 1.8 library. * - * Return: Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1536,15 +1542,15 @@ done: * * Purpose: Resets statistics for the page buffer layer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5Freset_page_buffering_stats(hid_t file_id) { H5F_t *file; /* File to reset stats on */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", file_id); @@ -1569,8 +1575,8 @@ done: * * Purpose: Retrieves statistics for the page buffer layer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1578,7 +1584,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2 unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]) { H5F_t *file; /* File object for file ID */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*Iu*Iu*Iu*Iu*Iu", file_id, accesses, hits, misses, evictions, @@ -1610,8 +1616,8 @@ done: * image_len: --size of the on disk metadata cache image * --zero if no cache image * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1625,13 +1631,13 @@ H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len) /* Check args */ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") if(NULL == image_addr || NULL == image_len) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL image addr or image len") /* Go get the address and size of the cache image */ if(H5AC_get_mdc_image_info(file->shared->cache, image_addr, image_len) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") done: FUNC_LEAVE_API(ret_value) @@ -1641,14 +1647,12 @@ done: /*------------------------------------------------------------------------- * Function: H5Fget_eoa * - * Purpose: Returns the address of the first byte after the last + * Purpose: Gets the address of the first byte after the last * allocated memory in the file. * (See H5FDget_eoa() in H5FD.c) * - * Return: Success: First byte after allocated memory. - * Failure: HADDR_UNDEF - * - * Return: Non-negative on success/Negative on errors + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1687,7 +1691,8 @@ done: * * Purpose: Set the EOA for the file to the maximum of (EOA, EOF) + increment * - * Return: Non-negative on success/Negative on errors + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1724,24 +1729,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_dset_no_attrs_hint + * Function: H5Fget_dset_no_attrs_hint * * Purpose: * * Get the file-level setting to create minimized dataset object headers. * Result is stored at pointer `minimize`. * - * Return: - * - * Success: SUCCEED (0) (non-negative value) - * Failure: FAIL (-1) (negative value) - * - * Programmer: - * - * Jacob Smith - * 15 August 2018 - * - * Changes: None. + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -1768,30 +1764,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fset_dset_no_attrs_hint - * - * Purpose: - * - * Set the file-level setting to create minimized dataset object headers. + * Function: H5Fset_dset_no_attrs_hint * - * Return: + * Purpose: Set the file-level setting to create minimized dataset object + * headers. * - * Success: SUCCEED (0) (non-negative value) - * Failure: FAIL (-1) (negative value) - * - * Programmer: - * - * Jacob Smith - * 15 August 2018 - * - * Changes: None. + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize) { H5F_t *file = NULL; /* File object for file ID */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "ib", file_id, minimize); @@ -1805,3 +1791,4 @@ H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize) done: FUNC_LEAVE_API(ret_value) } /* H5Fset_dset_no_attrs_hint */ + diff --git a/src/H5FS.c b/src/H5FS.c index 79915dc..6d574c0 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -36,6 +36,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FSpkg.h" /* File free space */ #include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -58,8 +59,8 @@ /********************/ /* Section info routines */ -static herr_t H5FS_sinfo_free_sect_cb(void *item, void *key, void *op_data); -static herr_t H5FS_sinfo_free_node_cb(void *item, void *key, void *op_data); +static herr_t H5FS__sinfo_free_sect_cb(void *item, void *key, void *op_data); +static herr_t H5FS__sinfo_free_node_cb(void *item, void *key, void *op_data); /*********************/ @@ -221,7 +222,7 @@ HDfprintf(stderr, "%s: fspace->rc = %u\n", FUNC, fspace->rc); /* Increment the reference count on the free space manager header */ HDassert(fspace->rc <= 1); - if(H5FS_incr(fspace) < 0) + if(H5FS__incr(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header") fspace->alignment = alignment; @@ -545,7 +546,7 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC); } /* end if */ /* Destroy section info */ - if(H5FS_sinfo_dest(fspace->sinfo) < 0) + if(H5FS__sinfo_dest(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "unable to destroy free space section info") } /* end else */ @@ -560,7 +561,7 @@ HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC); } /* end else */ /* Decrement the reference count on the free space manager header */ - if(H5FS_decr(fspace) < 0) + if(H5FS__decr(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header") done: @@ -664,14 +665,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) +H5FS_size(const H5FS_t *fspace, hsize_t *meta_size) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* * Check arguments. */ - HDassert(f); HDassert(fspace); HDassert(meta_size); @@ -683,7 +683,7 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) /*------------------------------------------------------------------------- - * Function: H5FS_incr + * Function: H5FS__incr * * Purpose: Increment reference count on free space header * @@ -695,11 +695,11 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) *------------------------------------------------------------------------- */ herr_t -H5FS_incr(H5FS_t *fspace) +H5FS__incr(H5FS_t *fspace) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc); #endif /* H5FS_DEBUG */ @@ -719,11 +719,11 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_incr() */ +} /* end H5FS__incr() */ /*------------------------------------------------------------------------- - * Function: H5FS_decr + * Function: H5FS__decr * * Purpose: Decrement reference count on free space header * @@ -735,11 +735,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_decr(H5FS_t *fspace) +H5FS__decr(H5FS_t *fspace) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc); #endif /* H5FS_DEBUG */ @@ -766,11 +766,11 @@ HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fsp done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_decr() */ +} /* end H5FS__decr() */ /*------------------------------------------------------------------------- - * Function: H5FS_dirty + * Function: H5FS__dirty * * Purpose: Mark free space header as dirty * @@ -782,11 +782,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_dirty(H5FS_t *fspace) +H5FS__dirty(H5FS_t *fspace) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE #ifdef QAK HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); #endif /* QAK */ @@ -802,7 +802,7 @@ HDfprintf(stderr, "%s: Marking free space header as dirty\n", FUNC); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_dirty() */ +} /* end H5FS__dirty() */ /*------------------------------------------------------------------------- @@ -875,7 +875,7 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace) fspace->alloc_sect_size = fspace->sect_size; /* Mark free-space header as dirty */ - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") /* Cache the free-space section info */ @@ -959,7 +959,7 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hbool_t free_file_space) } /* end if */ /* Mark free-space manager header as dirty */ - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ @@ -1052,7 +1052,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_sect_cb + * Function: H5FS__sinfo_free_sect_cb * * Purpose: Free a size-tracking node for a bin * @@ -1064,12 +1064,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) +H5FS__sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) { H5FS_section_info_t *sect = (H5FS_section_info_t *)_sect; /* Section to free */ const H5FS_sinfo_t *sinfo = (const H5FS_sinfo_t *)op_data; /* Free space manager for section */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(sect); HDassert(sinfo); @@ -1078,11 +1078,11 @@ H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) (*sinfo->fspace->sect_cls[sect->type].free)(sect); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_sinfo_free_sect_cb() */ +} /* H5FS__sinfo_free_sect_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_node_cb + * Function: H5FS__sinfo_free_node_cb * * Purpose: Free a size-tracking node for a bin * @@ -1094,27 +1094,27 @@ H5FS_sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) +H5FS__sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) { H5FS_node_t *fspace_node = (H5FS_node_t *)item; /* Temporary pointer to free space list node */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(fspace_node); HDassert(op_data); /* Release the skip list for sections of this size */ - H5SL_destroy(fspace_node->sect_list, H5FS_sinfo_free_sect_cb, op_data); + H5SL_destroy(fspace_node->sect_list, H5FS__sinfo_free_sect_cb, op_data); /* Release free space list node */ fspace_node = H5FL_FREE(H5FS_node_t, fspace_node); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_sinfo_free_node_cb() */ +} /* H5FS__sinfo_free_node_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_dest + * Function: H5FS__sinfo_dest * * Purpose: Destroys a free space section info in memory. * @@ -1126,12 +1126,12 @@ H5FS_sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) *------------------------------------------------------------------------- */ herr_t -H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) +H5FS__sinfo_dest(H5FS_sinfo_t *sinfo) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Check arguments. @@ -1143,7 +1143,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) /* Clear out lists of nodes */ for(u = 0; u < sinfo->nbins; u++) if(sinfo->bins[u].bin_list) { - H5SL_destroy(sinfo->bins[u].bin_list, H5FS_sinfo_free_node_cb, sinfo); + H5SL_destroy(sinfo->bins[u].bin_list, H5FS__sinfo_free_node_cb, sinfo); sinfo->bins[u].bin_list = NULL; } /* end if */ @@ -1160,7 +1160,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) * disappearing immediately) */ sinfo->fspace->sinfo = NULL; - if(H5FS_decr(sinfo->fspace) < 0) + if(H5FS__decr(sinfo->fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header") sinfo->fspace = NULL; @@ -1169,7 +1169,7 @@ H5FS_sinfo_dest(H5FS_sinfo_t *sinfo) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FS_sinfo_dest() */ +} /* end H5FS__sinfo_dest() */ herr_t H5FS_get_sect_count(const H5FS_t *frsp, hsize_t *tot_sect_count) diff --git a/src/H5FScache.c b/src/H5FScache.c index 9f9501b..e4bec6d 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -982,7 +982,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l HDassert(dirty); /* Allocate a new free space section info */ - if(NULL == (sinfo = H5FS_sinfo_new(udata->f, fspace))) + if(NULL == (sinfo = H5FS__sinfo_new(udata->f, fspace))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* initialize old_sect_size */ @@ -1004,11 +1004,11 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l /* Check for any serialized sections */ if(fspace->serial_sect_count > 0) { - hsize_t old_tot_sect_count; /* Total section count from header */ - hsize_t old_serial_sect_count; /* Total serializable section count from header */ - hsize_t old_ghost_sect_count; /* Total ghost section count from header */ - hsize_t old_tot_space; /* Total space managed from header */ - unsigned sect_cnt_size; /* The size of the section size counts */ + hsize_t old_tot_sect_count; /* Total section count from header */ + hsize_t H5_ATTR_NDEBUG_UNUSED old_serial_sect_count; /* Total serializable section count from header */ + hsize_t H5_ATTR_NDEBUG_UNUSED old_ghost_sect_count; /* Total ghost section count from header */ + hsize_t H5_ATTR_NDEBUG_UNUSED old_tot_space; /* Total space managed from header */ + unsigned sect_cnt_size; /* The size of the section size counts */ /* Compute the size of the section counts */ sect_cnt_size = H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count); @@ -1088,7 +1088,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l done: if(!ret_value && sinfo) - if(H5FS_sinfo_dest(sinfo) < 0) + if(H5FS__sinfo_dest(sinfo) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space info") FUNC_LEAVE_NOAPI(ret_value) @@ -1113,7 +1113,6 @@ static herr_t H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len) { const H5FS_sinfo_t *sinfo = (const H5FS_sinfo_t *)_thing; /* Pointer to the object */ - const H5FS_t *fspace; /* Free space header */ FUNC_ENTER_STATIC_NOERR @@ -1121,10 +1120,9 @@ H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len) HDassert(sinfo); HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); - fspace = sinfo->fspace; - HDassert(fspace); - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); + HDassert(sinfo->fspace); + HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); HDassert(image_len); /* Set the image length size */ @@ -1244,7 +1242,6 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, void *_thing) { H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; /* Pointer to the object */ - H5FS_t *fspace; /* Free space header */ H5FS_iter_ud_t udata; /* User data for callbacks */ uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t metadata_chksum; /* Computed metadata checksum value */ @@ -1259,12 +1256,11 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, HDassert(sinfo); HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); - fspace = sinfo->fspace; - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); - HDassert(fspace->cache_info.is_pinned); - HDassert(fspace->sect_size == len); - HDassert(fspace->sect_cls); + HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); + HDassert(sinfo->fspace->cache_info.is_pinned); + HDassert(sinfo->fspace->sect_size == len); + HDassert(sinfo->fspace->sect_cls); /* Magic number */ H5MM_memcpy(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -1391,7 +1387,6 @@ static herr_t H5FS__cache_sinfo_free_icr(void *_thing) { H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; /* Pointer to the object */ - H5FS_t *fspace; /* Free space header */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1400,13 +1395,12 @@ H5FS__cache_sinfo_free_icr(void *_thing) HDassert(sinfo); HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); - fspace = sinfo->fspace; - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); - HDassert(fspace->cache_info.is_pinned); + HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); + HDassert(sinfo->fspace->cache_info.is_pinned); /* Destroy free space info */ - if(H5FS_sinfo_dest(sinfo) < 0) + if(H5FS__sinfo_dest(sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space info") done: diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index eff4dcf..2c56ab6 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -221,16 +221,16 @@ H5_DLL herr_t H5FS__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t /* Free space manager header routines */ H5_DLL H5FS_t *H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata); -H5_DLL herr_t H5FS_incr(H5FS_t *fspace); -H5_DLL herr_t H5FS_decr(H5FS_t *fspace); -H5_DLL herr_t H5FS_dirty(H5FS_t *fspace); +H5_DLL herr_t H5FS__incr(H5FS_t *fspace); +H5_DLL herr_t H5FS__decr(H5FS_t *fspace); +H5_DLL herr_t H5FS__dirty(H5FS_t *fspace); /* Free space section routines */ -H5_DLL H5FS_sinfo_t *H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace); +H5_DLL H5FS_sinfo_t *H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace); /* Routines for destroying structures */ H5_DLL herr_t H5FS__hdr_dest(H5FS_t *hdr); -H5_DLL herr_t H5FS_sinfo_dest(H5FS_sinfo_t *sinfo); +H5_DLL herr_t H5FS__sinfo_dest(H5FS_sinfo_t *sinfo); /* Sanity check routines */ #ifdef H5FS_DEBUG_ASSERT diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index 31fc63c..d2e1f90 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -182,7 +182,7 @@ H5_DLL H5FS_t *H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_c H5_DLL H5FS_t *H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold); -H5_DLL herr_t H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size); +H5_DLL herr_t H5FS_size(const H5FS_t *fspace, hsize_t *meta_size); H5_DLL herr_t H5FS_delete(H5F_t *f, haddr_t fs_addr); H5_DLL herr_t H5FS_close(H5F_t *f, H5FS_t *fspace); H5_DLL herr_t H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr); diff --git a/src/H5FSsection.c b/src/H5FSsection.c index bd35cbd..26b6eab 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -64,26 +64,26 @@ typedef struct { /********************/ /* Local Prototypes */ /********************/ -static herr_t H5FS_sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned flags); -static herr_t H5FS_sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls); -static herr_t H5FS_size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, +static herr_t H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls); +static herr_t H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, const H5FS_section_class_t *cls); -static herr_t H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect); -static herr_t H5FS_sect_unlink_rest(H5FS_t *fspace, +static herr_t H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect); -static herr_t H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect); -static herr_t H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect); +static herr_t H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect); -static herr_t H5FS_sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, +static herr_t H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect, unsigned flags); -static herr_t H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, +static herr_t H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags); -static herr_t H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, +static herr_t H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data); -static htri_t H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node); -static herr_t H5FS_sect_serialize_size(H5FS_t *fspace); +static htri_t H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node); +static herr_t H5FS__sect_serialize_size(H5FS_t *fspace); /*********************/ @@ -112,7 +112,7 @@ H5FL_DEFINE(H5FS_sinfo_t); /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_new + * Function: H5FS__sinfo_new * * Purpose: Create new section info structure * @@ -125,12 +125,12 @@ H5FL_DEFINE(H5FS_sinfo_t); *------------------------------------------------------------------------- */ H5FS_sinfo_t * -H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace) +H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace) { H5FS_sinfo_t *sinfo = NULL; /* Section information struct created */ H5FS_sinfo_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(f); @@ -160,7 +160,7 @@ HDfprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n", HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space section bin array") /* Increment the reference count on the free space manager header */ - if(H5FS_incr(fspace) < 0) + if(H5FS__incr(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header") sinfo->fspace = fspace; @@ -183,11 +183,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sinfo_new() */ +} /* H5FS__sinfo_new() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_lock + * Function: H5FS__sinfo_lock * * Purpose: Make certain the section info for the free space manager is * in memory. @@ -204,12 +204,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) +H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) { H5FS_sinfo_cache_ud_t cache_udata; /* User-data for cache callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: Called, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC, fspace->addr, fspace->sinfo, fspace->sect_addr); @@ -280,7 +280,7 @@ HDfprintf(stderr, "%s: Creating new section info\n", FUNC); HDassert(fspace->ghost_sect_count == 0); /* Allocate and initialize free space section info */ - if(NULL == (fspace->sinfo = H5FS_sinfo_new(f, fspace))) + if(NULL == (fspace->sinfo = H5FS__sinfo_new(f, fspace))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create section info") /* Set initial size of section info to 0 */ @@ -298,11 +298,11 @@ HDfprintf(stderr, "%s: Leaving, fspace->addr = %a, fspace->sinfo = %p, fspace->s HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sinfo_lock() */ +} /* H5FS__sinfo_lock() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_unlock + * Function: H5FS__sinfo_unlock * * Purpose: Release the section info, either giving ownership back to * the cache or letting the free space header keep it. @@ -315,11 +315,11 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" *------------------------------------------------------------------------- */ static herr_t -H5FS_sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) +H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: Called, modified = %t, fspace->addr = %a, fspace->sect_addr = %a\n", FUNC, modified, fspace->addr, fspace->sect_addr); HDfprintf(stderr, "%s: fspace->sinfo_lock_count = %u, fspace->sinfo_modified = %t, fspace->sinfo_protected = %t\n", FUNC, fspace->sinfo_lock_count, fspace->sinfo_modified, fspace->sinfo_protected); @@ -347,7 +347,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" /* Assume that the modification will affect the statistics in the header * and mark that dirty also */ - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ @@ -373,6 +373,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" /* Check if the section info size in the file has changed */ if(fspace->sect_size != fspace->alloc_sect_size) cache_flags |= H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG; + } /* end if */ /* Sanity check */ @@ -442,7 +443,7 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC); /* If we haven't already marked the header dirty, do so now */ if(!modified) - if(H5FS_dirty(fspace) < 0) + if(H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") #ifdef H5FS_SINFO_DEBUG @@ -460,11 +461,11 @@ done: HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sinfo_unlock() */ +} /* H5FS__sinfo_unlock() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_serialize_size + * Function: H5FS__sect_serialize_size * * Purpose: Determine serialized size of all sections in free space manager * @@ -476,17 +477,17 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_serialize_size(H5FS_t *fspace) +H5FS__sect_serialize_size(H5FS_t *fspace) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments. */ HDassert(fspace); #ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - fspace->sect_size = %Hu\n", "H5FS_sect_serialize_size", fspace->sect_size); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Zu\n", "H5FS_sect_serialize_size", fspace->serial_sect_count); -HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", "H5FS_sect_serialize_size", fspace->alloc_sect_size); -HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_serialize_size", fspace->sinfo->serial_size_count); +HDfprintf(stderr, "%s: Check 1.0 - fspace->sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->sect_size); +HDfprintf(stderr, "%s: fspace->serial_sect_count = %Zu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count); +HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", "H5FS__sect_serialize_size", fspace->alloc_sect_size); +HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count); #endif /* QAK */ /* Compute the size of the buffer required to serialize all the sections */ @@ -498,8 +499,8 @@ HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_ser /* Count for each differently sized serializable section */ #ifdef QAK -HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS_sect_serialize_size", fspace->sinfo->serial_size_count); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_size", fspace->serial_sect_count); +HDfprintf(stderr, "%s: fspace->sinfo->serial_size_count = %Zu\n", "H5FS__sect_serialize_size", fspace->sinfo->serial_size_count); +HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS__sect_serialize_size", fspace->serial_sect_count); #endif /* QAK */ sect_buf_size += fspace->sinfo->serial_size_count * H5VM_limit_enc_size((uint64_t)fspace->serial_sect_count); @@ -523,11 +524,11 @@ HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_ fspace->sect_size = fspace->sinfo->sect_prefix_size; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FS_sect_serialize_size() */ +} /* H5FS__sect_serialize_size() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_increase + * Function: H5FS__sect_increase * * Purpose: Increase the size of the serialized free space section info * on disk @@ -540,12 +541,12 @@ HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_ *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, +H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned flags) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -577,18 +578,18 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); /* Update the free space sections' serialized size */ /* (if we're not deserializing the sections from disk) */ if(!(flags & H5FS_ADD_DESERIALIZING)) { - if(H5FS_sect_serialize_size(fspace) < 0) + if(H5FS__sect_serialize_size(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") } /* end if */ } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_increase() */ +} /* H5FS__sect_increase() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_decrease + * Function: H5FS__sect_decrease * * Purpose: Decrease the size of the serialized free space section info * on disk @@ -601,11 +602,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) +H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -635,17 +636,17 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); fspace->sinfo->serial_size -= cls->serial_size; /* Update the free space sections' serialized size */ - if(H5FS_sect_serialize_size(fspace) < 0) + if(H5FS__sect_serialize_size(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_decrease() */ +} /* H5FS__sect_decrease() */ /*------------------------------------------------------------------------- - * Function: H5FS_size_node_decr + * Function: H5FS__size_node_decr * * Purpose: Decrement the number of sections of a particular size * @@ -657,12 +658,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, +H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node, const H5FS_section_class_t *cls) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sinfo); @@ -728,11 +729,11 @@ HDfprintf(stderr, "%s: sinfo->bins[%u].sect_count = %Zu\n", FUNC, bin, sinfo->bi done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_size_node_decr() */ +} /* H5FS__size_node_decr() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_size + * Function: H5FS__sect_unlink_size * * Purpose: Remove a section node from size tracking data structures for * a free space manager @@ -745,7 +746,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +H5FS__sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect) { H5FS_node_t *fspace_node; /* Free list size node */ @@ -753,7 +754,7 @@ H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, unsigned bin; /* Bin to put the free space section in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sinfo); @@ -777,16 +778,16 @@ H5FS_sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") /* Decrement # of sections in section size node */ - if(H5FS_size_node_decr(sinfo, bin, fspace_node, cls) < 0) + if(H5FS__size_node_decr(sinfo, bin, fspace_node, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_unlink_size() */ +} /* H5FS__sect_unlink_size() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_rest + * Function: H5FS__sect_unlink_rest * * Purpose: Finish unlinking a section from the rest of the free space * manager's data structures, after the section has been removed @@ -800,12 +801,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, +H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -826,7 +827,7 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC } /* end if */ /* Update section info & check if we need less room for the serialized free space sections */ - if(H5FS_sect_decrease(fspace, cls) < 0) + if(H5FS__sect_decrease(fspace, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk") /* Decrement amount of free space managed */ @@ -837,11 +838,11 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_unlink_rest() */ +} /* H5FS__sect_unlink_rest() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_remove_real + * Function: H5FS__sect_remove_real * * Purpose: Remove a section from the free space manager * @@ -853,12 +854,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) +H5FS__sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) { const H5FS_section_class_t *cls; /* Class of section */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -869,16 +870,16 @@ H5FS_sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) cls = &fspace->sect_cls[sect->type]; /* Remove node from size tracked data structures */ - if(H5FS_sect_unlink_size(fspace->sinfo, cls, sect) < 0) + if(H5FS__sect_unlink_size(fspace->sinfo, cls, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from size tracking data structures") /* Update rest of free space manager data structures for node removal */ - if(H5FS_sect_unlink_rest(fspace, cls, sect) < 0) + if(H5FS__sect_unlink_rest(fspace, cls, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_remove_real() */ +} /* H5FS__sect_remove_real() */ /*------------------------------------------------------------------------- @@ -907,17 +908,17 @@ H5FS_sect_remove(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect) HDassert(sect); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; /* Perform actual section removal */ - if(H5FS_sect_remove_real(fspace, sect) < 0) + if(H5FS__sect_remove_real(fspace, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove section") done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, TRUE) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, TRUE) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -925,7 +926,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_size + * Function: H5FS__sect_link_size * * Purpose: Add a section of free space to the free list bins * @@ -937,7 +938,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, +H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_section_info_t *sect) { H5FS_node_t *fspace_node = NULL; /* Pointer to free space node of the correct size */ @@ -945,7 +946,7 @@ H5FS_sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, unsigned bin; /* Bin to put the free space section in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef QAK HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a\n", FUNC, sect->size, sect->addr); #endif /* QAK */ @@ -1028,11 +1029,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_link_size() */ +} /* H5FS__sect_link_size() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_rest + * Function: H5FS__sect_link_rest * * Purpose: Link a section into the rest of the non-size tracking * free space manager data structures @@ -1045,12 +1046,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, +H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_section_info_t *sect, unsigned flags) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1070,7 +1071,7 @@ HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUN } /* end if */ /* Update section info & check if we need more room for the serialized free space sections */ - if(H5FS_sect_increase(fspace, cls, flags) < 0) + if(H5FS__sect_increase(fspace, cls, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk") /* Increment amount of free space managed */ @@ -1078,11 +1079,11 @@ HDfprintf(stderr, "%s: inserting object into merge list, sect->type = %u\n", FUN done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_link_rest() */ +} /* H5FS__sect_link_rest() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_link + * Function: H5FS__sect_link * * Purpose: Link a section into the internal data structures * @@ -1094,12 +1095,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) +H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) { const H5FS_section_class_t *cls; /* Class of section */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1113,14 +1114,14 @@ H5FS_sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) #ifdef QAK HDfprintf(stderr, "%s: Check 1.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); #endif /* QAK */ - if(H5FS_sect_link_size(fspace->sinfo, cls, sect) < 0) + if(H5FS__sect_link_size(fspace->sinfo, cls, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to size tracking data structures") #ifdef QAK HDfprintf(stderr, "%s: Check 2.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); #endif /* QAK */ /* Update rest of free space manager data structures for section addition */ - if(H5FS_sect_link_rest(fspace, cls, sect, flags) < 0) + if(H5FS__sect_link_rest(fspace, cls, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to non-size tracking data structures") #ifdef QAK HDfprintf(stderr, "%s: Check 3.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); @@ -1128,11 +1129,11 @@ HDfprintf(stderr, "%s: Check 3.0 - fspace->tot_space = %Hu\n", FUNC, fspace->tot done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_link() */ +} /* H5FS__sect_link() */ /*------------------------------------------------------------------------- - * Function: H5FS_sect_merge + * Function: H5FS__sect_merge * * Purpose: Attempt to merge a returned free space section with existing * free space. @@ -1145,7 +1146,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) +H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) { H5FS_section_class_t *sect_cls; /* Section's class */ hbool_t modified; /* Flag to indicate merge or shrink occurred */ @@ -1153,7 +1154,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) htri_t status; /* Status value */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1203,7 +1204,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) HDassert(tmp_sect_cls->merge); /* Remove 'less than' node from data structures */ - if(H5FS_sect_remove_real(fspace, tmp_sect) < 0) + if(H5FS__sect_remove_real(fspace, tmp_sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") /* Merge the two sections together */ @@ -1249,7 +1250,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) HDassert(sect_cls->merge); /* Remove 'greater than' node from data structures */ - if(H5FS_sect_remove_real(fspace, tmp_sect) < 0) + if(H5FS__sect_remove_real(fspace, tmp_sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") /* Merge the two sections together */ @@ -1290,7 +1291,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); /* Remove SECT from free-space manager */ /* (only possible to happen on second+ pass through loop) */ if(remove_sect) { - if(H5FS_sect_remove_real(fspace, *sect) < 0) + if(H5FS__sect_remove_real(fspace, *sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") remove_sect = FALSE; } /* end if */ @@ -1342,7 +1343,7 @@ done: HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); #endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_merge() */ +} /* H5FS__sect_merge() */ /*------------------------------------------------------------------------- @@ -1379,7 +1380,7 @@ HDfprintf(stderr, "%s: *sect = {%a, %Hu, %u, %s}\n", FUNC, sect->addr, sect->siz HDassert(sect->size); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -1396,7 +1397,7 @@ HDfprintf(stderr, "%s: Returning space\n", FUNC); #endif /* H5FS_SINFO_DEBUG */ /* Attempt to merge returned section with existing sections */ - if(H5FS_sect_merge(fspace, §, op_data) < 0) + if(H5FS__sect_merge(fspace, §, op_data) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") } /* end if */ @@ -1405,7 +1406,7 @@ HDfprintf(stderr, "%s: Returning space\n", FUNC); * be NULL at this point - QAK) */ if(sect) - if(H5FS_sect_link(fspace, sect, flags) < 0) + if(H5FS__sect_link(fspace, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") #ifdef H5FS_SINFO_DEBUG @@ -1418,7 +1419,7 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") #ifdef H5FS_DEBUG_ASSERT @@ -1475,7 +1476,7 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se H5FS_section_info_t *sect; /* Temporary free space section */ /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -1511,7 +1512,7 @@ if(_section_) H5FS_section_class_t *cls; /* Section's class */ /* Remove section from data structures */ - if(H5FS_sect_remove_real(fspace, sect) < 0) + if(H5FS__sect_remove_real(fspace, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") /* Get class for section */ @@ -1537,7 +1538,7 @@ if(_section_) /* Re-adding the section could cause it to disappear (particularly when paging) */ if(sect) { /* Re-add adjusted section to free sections data structures */ - if(H5FS_sect_link(fspace, sect, 0) < 0) + if(H5FS__sect_link(fspace, sect, 0) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") } /* end if */ } /* end if */ @@ -1561,7 +1562,7 @@ if(_section_) done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -1601,13 +1602,13 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, HDassert(sect->size); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; saved_fs_size = sect->size; /* Attempt to merge/shrink section with existing sections */ - if(H5FS_sect_merge(fspace, §, op_data) < 0) + if(H5FS__sect_merge(fspace, §, op_data) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") /* Check if section is shrunk and/or merged away completely */ @@ -1618,7 +1619,7 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, else { /* Check if section is merged */ if(sect->size > saved_fs_size) { - if(H5FS_sect_link(fspace, sect, flags) < 0) + if(H5FS__sect_link(fspace, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") sinfo_modified = TRUE; HGOTO_DONE(TRUE) @@ -1627,7 +1628,7 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -1635,7 +1636,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_find_node + * Function: H5FS__sect_find_node * * Purpose: Locate a section of free space (in existing free space list * bins) that is large enough to fulfill request. @@ -1648,7 +1649,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) +H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) { H5FS_node_t *fspace_node; /* Free list size node */ unsigned bin; /* Bin to put the free space section in */ @@ -1658,7 +1659,7 @@ H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node) const H5FS_section_class_t *cls; /* Class of section */ hsize_t alignment; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(fspace); @@ -1696,9 +1697,9 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); /* Get section's class */ cls = &fspace->sect_cls[(*node)->type]; /* Decrement # of sections in section size node */ - if(H5FS_size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0) + if(H5FS__size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") - if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) + if(H5FS__sect_unlink_rest(fspace, cls, *node) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") /* Indicate that we found a node for the request */ HGOTO_DONE(TRUE) @@ -1741,10 +1742,10 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); if(NULL == (*node = (H5FS_section_info_t *)H5SL_remove(curr_fspace_node->sect_list, &curr_sect->addr))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") /* Decrement # of sections in section size node */ - if(H5FS_size_node_decr(fspace->sinfo, bin, curr_fspace_node, cls) < 0) + if(H5FS__size_node_decr(fspace->sinfo, bin, curr_fspace_node, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") - if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) + if(H5FS__sect_unlink_rest(fspace, cls, *node) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") /* @@ -1755,7 +1756,7 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); */ if(mis_align) { split_sect = cls->split(*node, frag_size); - if((H5FS_sect_link(fspace, split_sect, 0) < 0)) + if((H5FS__sect_link(fspace, split_sect, 0) < 0)) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") /* sanity check */ HDassert(split_sect->addr < (*node)->addr); @@ -1780,7 +1781,7 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FS_sect_find_node() */ +} /* H5FS__sect_find_node() */ /*------------------------------------------------------------------------- @@ -1823,12 +1824,12 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se #endif /* QAK */ if(fspace->tot_sect_count > 0) { /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; /* Look for node in bins */ - if((ret_value = H5FS_sect_find_node(fspace, request, node)) < 0) + if((ret_value = H5FS__sect_find_node(fspace, request, node)) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from bins") /* Decrement # of sections on free list, if we found an object */ @@ -1843,7 +1844,7 @@ HDfprintf(stderr, "%s: (*node)->size = %Hu, (*node)->addr = %a, (*node)->type = done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, sinfo_modified) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") #ifdef H5FS_DEBUG_ASSERT @@ -1965,7 +1966,7 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_c unsigned bin; /* Current bin we are on */ /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__READ_ONLY_FLAG) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__READ_ONLY_FLAG) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -1985,7 +1986,7 @@ HDfprintf(stderr, "%s: Iterate over section bins\n", FUNC); done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, FALSE) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, FALSE) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -2054,7 +2055,7 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, HDassert(new_class < fspace->nclasses); /* Get a pointer to the section info */ - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -2179,12 +2180,12 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC fspace->sinfo->serial_size += fspace->sect_cls[new_class].serial_size; /* Update current space used for free space sections */ - if(H5FS_sect_serialize_size(fspace) < 0) + if(H5FS__sect_serialize_size(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, TRUE) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, TRUE) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -2343,15 +2344,14 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", "H /*------------------------------------------------------------------------- - * Function: H5FS_sect_try_shrink_eoa + * Function: H5FS_sect_try_shrink_eoa * - * Purpose: To shrink the last section on the merge list if the section - * is at EOF. + * Purpose: To shrink the last section on the merge list if the section + * is at EOF. * - * Return: Success: non-negative (TRUE/FALSE) - * Failure: negative + * Return: TRUE/FALSE/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * *------------------------------------------------------------------------- */ @@ -2367,7 +2367,7 @@ H5FS_sect_try_shrink_eoa(H5F_t *f, H5FS_t *fspace, void *op_data) /* Check arguments. */ HDassert(fspace); - if(H5FS_sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) + if(H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; @@ -2382,30 +2382,30 @@ H5FS_sect_try_shrink_eoa(H5F_t *f, H5FS_t *fspace, void *op_data) /* Get the pointer to the last section, from the last node */ tmp_sect = (H5FS_section_info_t *)H5SL_item(last_node); HDassert(tmp_sect); - tmp_sect_cls = &fspace->sect_cls[tmp_sect->type]; - if(tmp_sect_cls->can_shrink) { + tmp_sect_cls = &fspace->sect_cls[tmp_sect->type]; + if(tmp_sect_cls->can_shrink) { /* Check if the section can be shrunk away */ - if((ret_value = (*tmp_sect_cls->can_shrink)(tmp_sect, op_data)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container") - if(ret_value > 0) { - HDassert(tmp_sect_cls->shrink); + if((ret_value = (*tmp_sect_cls->can_shrink)(tmp_sect, op_data)) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container") + if(ret_value > 0) { + HDassert(tmp_sect_cls->shrink); /* Remove section from free space manager */ - if(H5FS_sect_remove_real(fspace, tmp_sect) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") + if(H5FS__sect_remove_real(fspace, tmp_sect) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") section_removed = TRUE; /* Shrink away section */ - if((*tmp_sect_cls->shrink)(&tmp_sect, op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container") - } /* end if */ - } /* end if */ - } /* end if */ + if((*tmp_sect_cls->shrink)(&tmp_sect, op_data) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container") + } /* end if */ + } /* end if */ + } /* end if */ } /* end if */ done: /* Release the section info */ - if(sinfo_valid && H5FS_sinfo_unlock(f, fspace, section_removed) < 0) + if(sinfo_valid && H5FS__sinfo_unlock(f, fspace, section_removed) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") FUNC_LEAVE_NOAPI(ret_value) @@ -2557,15 +2557,15 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, if(H5F_IS_TMP_ADDR(f, (eoa + fspace->sect_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "hdr file space alloc will overlap into 'temporary' file space") - hdr_alloc_size = H5FS_HEADER_SIZE(f); + hdr_alloc_size = H5FS_HEADER_SIZE(f); - /* if page allocation is enabled, extend the hdr_alloc_size to the - * next page boundary. + /* if page allocation is enabled, extend the hdr_alloc_size to the + * next page boundary. */ if(H5F_PAGED_AGGR(f)) { HDassert(0 == (eoa % f->shared->fs_page_size)); - hdr_alloc_size = ((hdr_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; + hdr_alloc_size = ((hdr_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; HDassert(hdr_alloc_size >= H5FS_HEADER_SIZE(f)); HDassert((hdr_alloc_size % f->shared->fs_page_size) == 0); @@ -2599,13 +2599,13 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, sinfo_alloc_size = fspace->sect_size; - /* if paged allocation is enabled, extend the sinfo_alloc_size to the - * next page boundary. + /* if paged allocation is enabled, extend the sinfo_alloc_size to the + * next page boundary. */ if(H5F_PAGED_AGGR(f)) { HDassert(0 == (eoa % f->shared->fs_page_size)); - sinfo_alloc_size = ((sinfo_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; + sinfo_alloc_size = ((sinfo_alloc_size / f->shared->fs_page_size) + 1) * f->shared->fs_page_size; HDassert(sinfo_alloc_size >= fspace->sect_size); HDassert((sinfo_alloc_size % f->shared->fs_page_size) == 0); diff --git a/src/H5Fint.c b/src/H5Fint.c index 8760e4c..badf60b 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -47,7 +47,7 @@ /* Local Typedefs */ /******************/ -/* Struct only used by functions H5F_get_objects and H5F_get_objects_cb */ +/* Struct only used by functions H5F__get_objects and H5F__get_objects_cb */ typedef struct H5F_olist_t { H5I_type_t obj_type; /* Type of object to look for */ hid_t *obj_id_list; /* Pointer to the list of open IDs to return */ @@ -73,10 +73,11 @@ typedef struct H5F_olist_t { /* Local Prototypes */ /********************/ -static int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); +static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); +static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/); static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/); -static herr_t H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); +static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); static herr_t H5F__flush_phase1(H5F_t *f); static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); @@ -237,8 +238,8 @@ H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_i HDassert(obj_id_count_ptr); /* Perform the query */ - if((ret_value = H5F_get_objects(f, types, 0, NULL, app_ref, obj_id_count_ptr)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_objects failed") + if((ret_value = H5F__get_objects(f, types, 0, NULL, app_ref, obj_id_count_ptr)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -264,8 +265,8 @@ H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list HDassert(obj_id_count_ptr); /* Perform the query */ - if((ret_value = H5F_get_objects(f, types, max_objs, oid_list, app_ref, obj_id_count_ptr)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_objects failed") + if((ret_value = H5F__get_objects(f, types, max_objs, oid_list, app_ref, obj_id_count_ptr)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -282,14 +283,14 @@ done: * Return: SUCCEED/FAIL *--------------------------------------------------------------------------- */ -herr_t -H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr) +static herr_t +H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr) { size_t obj_id_count = 0; /* Number of open IDs */ H5F_olist_t olist; /* Structure to hold search results */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(obj_id_count_ptr); @@ -314,7 +315,7 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_ * IDs on the object list. */ if(types & H5F_OBJ_FILE) { olist.obj_type = H5I_FILE; - if(H5I_iterate(H5I_FILE, H5F_get_objects_cb, &olist, app_ref) < 0) + if(H5I_iterate(H5I_FILE, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(1)") } /* end if */ @@ -325,7 +326,7 @@ H5F_get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id_ if(!olist.max_nobjs || (olist.max_nobjs && olist.list_indexshared); - - f->shared->crt_dset_min_ohdr_flag = minimize; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5F_set_min_dset_ohdr() */ +} /* end H5F__get_objects_cb() */ /*-------------------------------------------------------------------------- @@ -800,16 +777,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__is_hdf5 + * Function: H5F__is_hdf5 * - * Purpose: Check the file signature to detect an HDF5 file. + * Purpose: Check the file signature to detect an HDF5 file. * - * Bugs: This function is not robust: it only uses the default file - * driver when attempting to open the file when in fact it - * should use all known file drivers. + * Bugs: This function is not robust: it only uses the default file + * driver when attempting to open the file when in fact it + * should use all known file drivers. * - * Return: Success: TRUE/FALSE - * * Failure: Negative + * Return: TRUE/FALSE/FAIL *------------------------------------------------------------------------- */ htri_t @@ -821,7 +797,7 @@ H5F__is_hdf5(const char *name) FUNC_ENTER_PACKAGE - /* Open the file at the virtual file layer */ + /* Open the file */ if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to open file") @@ -1710,7 +1686,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "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) + 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") if(set_flag) { @@ -2274,7 +2250,7 @@ H5F_decr_nopen_objs(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_build_actual_name + * Function: H5F__build_actual_name * * Purpose: Retrieve the name of a file, after following symlinks, etc. * @@ -2284,7 +2260,7 @@ H5F_decr_nopen_objs(H5F_t *f) *------------------------------------------------------------------------- */ static herr_t -H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, +H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char **actual_name/*out*/) { hid_t new_fapl_id = H5I_INVALID_HID; /* ID for duplicated FAPL */ @@ -2294,7 +2270,7 @@ H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *na #endif /* H5_HAVE_SYMLINK */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -2391,7 +2367,7 @@ done: #endif /* H5_HAVE_SYMLINK */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_build_actual_name() */ +} /* H5F__build_actual_name() */ /*------------------------------------------------------------------------- @@ -3513,3 +3489,27 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__format_convert() */ + +/*------------------------------------------------------------------------- + * Function: H5F_set_min_dset_ohdr + * + * Purpose: Set the crt_dset_ohdr_flag field with a new value. + * + * Return: SUCCEED/FAIL + *------------------------------------------------------------------------- + */ +herr_t +H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(f); + HDassert(f->shared); + + f->shared->crt_dset_min_ohdr_flag = minimize; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5F_set_min_dset_ohdr() */ + diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index b73005a..e4892ed 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -399,7 +399,6 @@ H5_DLL H5F_t *H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_ H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush); H5_DLL herr_t H5F__flush(H5F_t *f); H5_DLL htri_t H5F__is_hdf5(const char *name); -H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len); H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo); H5_DLL herr_t H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info); diff --git a/src/H5HFspace.c b/src/H5HFspace.c index 37a0502..ad5ff0f 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -447,7 +447,7 @@ H5HF__space_size(H5HF_hdr_t *hdr, hsize_t *fs_size) /* Get free space metadata size */ if(hdr->fspace) { - if(H5FS_size(hdr->f, hdr->fspace, fs_size) < 0) + if(H5FS_size(hdr->fspace, fs_size) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info") } /* end if */ else diff --git a/src/H5MF.c b/src/H5MF.c index 38e84dc..c5afd94 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -2294,6 +2294,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -2307,7 +2308,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) /* Retrieve free space size from free space manager */ if(H5FS_sect_stats(f->shared->fs_man[type], &type_fs_size, NULL) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space stats") - if(H5FS_size(f, f->shared->fs_man[type], &type_meta_size) < 0) + if(H5FS_size(f->shared->fs_man[type], &type_meta_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space metadata stats") /* Increment total free space for types */ @@ -2323,6 +2324,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, &curr_ring); curr_ring = needed_ring; @@ -2438,6 +2440,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, &curr_ring); curr_ring = needed_ring; -- cgit v0.12 From e9313f3147cc54a695d5f253ffd51891f92637b5 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 9 Jul 2020 15:19:14 -0700 Subject: Fixed Duff's device fall through warnings in hyperslab code. --- src/H5Shyper.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 10b961b..4a14c03 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -8659,15 +8659,15 @@ H5S__hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter, /* Read in data until an entire sequence can't be written out any longer */ while(curr_rows > 0) { -#define DUFF_GUTS \ -/* Store the sequence information */ \ -off[curr_seq] = loc; \ -len[curr_seq] = actual_bytes; \ - \ -/* Increment sequence count */ \ -curr_seq++; \ - \ -/* Increment information to reflect block just processed */ \ +#define DUFF_GUTS \ +/* Store the sequence information */ \ +off[curr_seq] = loc; \ +len[curr_seq] = actual_bytes; \ + \ +/* Increment sequence count */ \ +curr_seq++; \ + \ +/* Increment information to reflect block just processed */ \ loc += fast_dim_buf_off; #ifdef NO_DUFFS_DEVICE @@ -8691,18 +8691,25 @@ loc += fast_dim_buf_off; do { DUFF_GUTS + H5_ATTR_FALLTHROUGH case 7: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 6: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 5: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 4: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 3: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 2: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 1: DUFF_GUTS } while (--duffs_index > 0); -- cgit v0.12 From ca50f03bcafd50559d254aa76d0969edbd454688 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 9 Jul 2020 15:40:18 -0700 Subject: H5S_hyper_adjust_s() optimization from develop. --- src/H5Sall.c | 3 ++- src/H5Shyper.c | 56 +++++++++++++++++++++++++++++++++----------------------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/H5Sall.c b/src/H5Sall.c index 08fbb5c..a6ebc8f 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -426,9 +426,10 @@ H5S__all_release(H5S_t *space) PURPOSE Copy a selection from one dataspace to another USAGE - herr_t H5S__all_copy(dst, src) + herr_t H5S__all_copy(dst, src, share_selection) H5S_t *dst; OUT: Pointer to the destination dataspace H5S_t *src; IN: Pointer to the source dataspace + hbool_t; IN: Whether to share the selection between the dataspaces RETURNS Non-negative on success/Negative on failure DESCRIPTION diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 4a14c03..eca0ed3 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -287,14 +287,14 @@ H5S__hyper_print_diminfo(FILE *f, const H5S_t *space) /*------------------------------------------------------------------------- * Function: H5S__hyper_iter_init * - * Purpose: Initializes iteration information for hyperslab span tree selection. + * Purpose: Initializes iteration information for hyperslab selection. * * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Saturday, February 24, 2001 * - * Notes: If the 'elmt_size' parameter is set to zero, the regular + * Notes: If the 'iter->elmt_size' field is set to zero, the regular * hyperslab selection iterator will not be 'flattened'. This * is used by the H5S_select_shape_same() code to avoid changing * the rank and appearance of the selection. @@ -362,7 +362,7 @@ H5S__hyper_iter_init(const H5S_t *space, H5S_sel_iter_t *iter) /* Check if the regular selection can be "flattened" */ if(cont_dim > 0) { - unsigned last_dim_flattened = 1; /* Flag to indicate that the last dimension was flattened */ + hbool_t last_dim_flattened = TRUE; /* Flag to indicate that the last dimension was flattened */ unsigned flat_rank = rank-cont_dim; /* Number of dimensions after flattening */ unsigned curr_dim; /* Current dimension */ @@ -378,7 +378,7 @@ H5S__hyper_iter_init(const H5S_t *space, H5S_sel_iter_t *iter) acc *= mem_size[i]; /* Indicate that the dimension was flattened */ - last_dim_flattened = 1; + last_dim_flattened = TRUE; } /* end if */ else { if(last_dim_flattened) { @@ -396,7 +396,7 @@ H5S__hyper_iter_init(const H5S_t *space, H5S_sel_iter_t *iter) iter->u.hyp.sel_off[curr_dim] = space->select.offset[i] * (hssize_t)acc; /* Reset the "last dim flattened" flag to avoid flattened any further dimensions */ - last_dim_flattened = 0; + last_dim_flattened = FALSE; /* Reset the "accumulator" for possible further dimension flattening */ acc = 1; @@ -763,7 +763,7 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) block_elem = tdiminfo[temp_dim].block - iter_offset[temp_dim]; /* Compute the number of actual elements to advance */ - actual_elem = (size_t)MIN(nelem,block_elem); + actual_elem = (size_t)MIN(nelem, block_elem); /* Move the iterator over as many elements as possible */ iter_offset[temp_dim] += actual_elem; @@ -1306,7 +1306,7 @@ H5S__hyper_span_scratch(H5S_hyper_span_info_t *spans) Helper routine to copy a hyperslab span tree USAGE H5S_hyper_span_info_t * H5S__hyper_copy_span_helper(spans) - H5S_hyper_span_info_t *spans; IN: Span tree to copy + H5S_hyper_span_info_t *spans; IN: Span tree to copy RETURNS Pointer to the copied span tree on success, NULL on failure DESCRIPTION @@ -1394,9 +1394,9 @@ done: Copy a hyperslab span tree USAGE H5S_hyper_span_info_t * H5S__hyper_copy_span(span_info) - H5S_hyper_span_info_t *span_info; IN: Span tree to copy + H5S_hyper_span_info_t *span_info; IN: Span tree to copy RETURNS - Non-negative on success, negative on failure + Pointer to the copied span tree on success, NULL on failure DESCRIPTION Copy a hyperslab span tree, using reference counting as appropriate. (Which means that just the nodes in the top span tree are duplicated and @@ -4758,6 +4758,8 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, herr_t H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset) { + hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */ + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -4766,23 +4768,31 @@ H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset) HDassert(space); HDassert(offset); - /* Subtract the offset from the "regular" coordinates, if they exist */ - if(space->select.sel_info.hslab->diminfo_valid) { - unsigned u; /* Local index variable */ + /* Check for an all-zero offset vector */ + for(u = 0; u < space->extent.rank; u++) + if(0 != offset[u]) { + non_zero_offset = TRUE; + break; + } /* end if */ - for(u = 0; u < space->extent.rank; u++) { - HDassert((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start >= offset[u]); - space->select.sel_info.hslab->opt_diminfo[u].start = (hsize_t)((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start - offset[u]); - } /* end for */ - } /* end if */ + /* Only perform operation if the offset is non-zero */ + if(non_zero_offset) { + /* Subtract the offset from the "regular" coordinates, if they exist */ + if(space->select.sel_info.hslab->diminfo_valid) { + for(u = 0; u < space->extent.rank; u++) { + HDassert((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start >= offset[u]); + space->select.sel_info.hslab->opt_diminfo[u].start = (hsize_t)((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start - offset[u]); + } /* end for */ + } /* end if */ - /* Subtract the offset from the span tree coordinates, if they exist */ - if(space->select.sel_info.hslab->span_lst) { - H5S__hyper_adjust_s_helper(space->select.sel_info.hslab->span_lst, offset); + /* Subtract the offset from the span tree coordinates, if they exist */ + if(space->select.sel_info.hslab->span_lst) { + H5S__hyper_adjust_s_helper(space->select.sel_info.hslab->span_lst, offset); - /* Reset the scratch pointers for the next routine which needs them */ - H5S__hyper_span_scratch(space->select.sel_info.hslab->span_lst); - } /* end if */ + /* Reset the scratch pointers for the next routine which needs them */ + H5S__hyper_span_scratch(space->select.sel_info.hslab->span_lst); + } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) -- cgit v0.12 From 07dc34123861eed0f4d04dea29094649dec679bf Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 9 Jul 2020 17:00:29 -0700 Subject: Moved hyperslab code to use the new H5S_diminfo_valid_t enum. --- src/H5Shyper.c | 67 +++++++++++++++++++++++++++++++--------------------------- src/H5Spkg.h | 11 +++++++++- src/H5Stest.c | 5 ++++- 3 files changed, 50 insertions(+), 33 deletions(-) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index eca0ed3..10fe123 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -328,7 +328,7 @@ H5S__hyper_iter_init(const H5S_t *space, H5S_sel_iter_t *iter) tdiminfo = space->select.sel_info.hslab->opt_diminfo; /* Check for the special case of just one H5Sselect_hyperslab call made */ - if(space->select.sel_info.hslab->diminfo_valid) { + if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { /* Initialize the information needed for regular hyperslab I/O */ const hsize_t *mem_size; /* Temporary pointer to dataspace extent's dimension sizes */ hsize_t acc; /* Accumulator for "flattened" dimension's sizes */ @@ -1668,7 +1668,7 @@ H5S__hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection) /* Copy the hyperslab information */ dst_hslab->diminfo_valid = src_hslab->diminfo_valid; - if(src_hslab->diminfo_valid) { + if(src_hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { size_t u; /* Local index variable */ for(u=0; uextent.rank; u++) { @@ -1676,7 +1676,7 @@ H5S__hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection) dst_hslab->app_diminfo[u]=src_hslab->app_diminfo[u]; } /* end for */ } /* end if */ - dst->select.sel_info.hslab->span_lst=src->select.sel_info.hslab->span_lst; + dst->select.sel_info.hslab->span_lst = src->select.sel_info.hslab->span_lst; /* Check if there is hyperslab span information to copy */ /* (Regular hyperslab information is copied with the selection structure) */ @@ -1796,7 +1796,7 @@ H5S__hyper_is_valid(const H5S_t *space) HGOTO_DONE(FALSE) /* Check for a "regular" hyperslab selection */ - if(space->select.sel_info.hslab->diminfo_valid) { + if(H5S_DIMINFO_VALID_YES == space->select.sel_info.hslab->diminfo_valid) { const H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */ hssize_t end; /* The high bound of a region in a dimension */ unsigned u; /* Counter */ @@ -1904,7 +1904,7 @@ H5S__get_select_hyper_nblocks(const H5S_t *space, hbool_t app_ref) HDassert(space->select.sel_info.hslab->unlim_dim < 0); /* Check for a "regular" hyperslab selection */ - if(space->select.sel_info.hslab->diminfo_valid) { + if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { unsigned u; /* Local index variable */ /* Check each dimension */ @@ -2509,7 +2509,7 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) if(!*space) { /* Patch the rank of the allocated dataspace */ - (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0])); + HDmemset(dims, 0, (size_t)rank * sizeof(dims[0])); if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions") } /* end if */ @@ -2740,7 +2740,7 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo HDassert(space->select.sel_info.hslab->unlim_dim < 0); /* Check for a "regular" hyperslab selection */ - if(space->select.sel_info.hslab->diminfo_valid) { + if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary hyperslab counts */ hsize_t offset[H5S_MAX_RANK]; /* Offset of element in dataspace */ @@ -3042,7 +3042,7 @@ H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) } /* end for */ /* Check for a "regular" hyperslab selection */ - if(space->select.sel_info.hslab->diminfo_valid) { + if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */ /* Check each dimension */ @@ -3115,7 +3115,7 @@ H5S__hyper_offset(const H5S_t *space, hsize_t *offset) dim_size = space->extent.size; /* Check for a "regular" hyperslab selection */ - if(space->select.sel_info.hslab->diminfo_valid) { + if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* Local alias for diminfo */ /* Loop through starting coordinates, calculating the linear offset */ @@ -3279,7 +3279,7 @@ H5S__hyper_is_contiguous(const H5S_t *space) HDassert(space); /* Check for a "regular" hyperslab selection */ - if(space->select.sel_info.hslab->diminfo_valid) { + if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { const H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */ /* @@ -3461,7 +3461,7 @@ H5S__hyper_is_single(const H5S_t *space) HDassert(space); /* Check for a "single" hyperslab selection */ - if(space->select.sel_info.hslab->diminfo_valid) { + if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { unsigned u; /* index variable */ /* @@ -3534,7 +3534,7 @@ H5S__hyper_is_regular(const H5S_t *space) HDassert(space); /* Only simple check for regular hyperslabs for now... */ - if(space->select.sel_info.hslab->diminfo_valid) + if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) ret_value = TRUE; else ret_value = FALSE; @@ -3947,7 +3947,7 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords) space->select.type = H5S_sel_hyper; /* Reset "regular" hyperslab flag */ - space->select.sel_info.hslab->diminfo_valid = FALSE; + space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO; /* Set unlim_dim */ space->select.sel_info.hslab->unlim_dim = -1; @@ -4295,7 +4295,7 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) /* Only perform operation if the offset is non-zero */ if(non_zero_offset) { /* Subtract the offset from the "regular" coordinates, if they exist */ - if(space->select.sel_info.hslab->diminfo_valid) { + if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { for(u = 0; u < space->extent.rank; u++) { HDassert(space->select.sel_info.hslab->opt_diminfo[u].start >= offset[u]); space->select.sel_info.hslab->opt_diminfo[u].start -= offset[u]; @@ -4340,7 +4340,7 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset) HDassert(offset); /* Check for a "regular" hyperslab selection */ - if(space->select.sel_info.hslab->diminfo_valid) { + if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* Alias for dataspace's diminfo information */ unsigned u; /* Counter */ @@ -4550,7 +4550,7 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of new_space->select.sel_info.hslab->unlim_dim = -1; /* Check for a "regular" hyperslab selection */ - if(base_space->select.sel_info.hslab->diminfo_valid) { + if(base_space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { unsigned base_space_dim; /* Current dimension in the base dataspace */ unsigned new_space_dim; /* Current dimension in the new dataspace */ @@ -4619,7 +4619,7 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of } /* end for */ /* Indicate that the dimension information is valid */ - new_space->select.sel_info.hslab->diminfo_valid = TRUE; + new_space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_YES; /* Indicate that there's no slab information */ new_space->select.sel_info.hslab->span_lst = NULL; @@ -4665,7 +4665,7 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of } /* end else */ /* Indicate that the dimension information is not valid */ - new_space->select.sel_info.hslab->diminfo_valid = FALSE; + new_space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO; } /* end else */ /* Number of elements selected will be the same */ @@ -4778,7 +4778,7 @@ H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset) /* Only perform operation if the offset is non-zero */ if(non_zero_offset) { /* Subtract the offset from the "regular" coordinates, if they exist */ - if(space->select.sel_info.hslab->diminfo_valid) { + if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { for(u = 0; u < space->extent.rank; u++) { HDassert((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start >= offset[u]); space->select.sel_info.hslab->opt_diminfo[u].start = (hsize_t)((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start - offset[u]); @@ -6254,7 +6254,7 @@ H5S__hyper_rebuild(H5S_t *space) } /* end for */ - space->select.sel_info.hslab->diminfo_valid = TRUE; + space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_YES; } /* end else */ done: @@ -6826,7 +6826,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], space->select.sel_info.hslab->unlim_dim = unlim_dim; /* Indicate that the dimension information is valid */ - space->select.sel_info.hslab->diminfo_valid = TRUE; + space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_YES; /* Indicate that there's no slab information */ space->select.sel_info.hslab->span_lst = NULL; @@ -6890,7 +6890,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree") /* Indicate that the regular dimensions are no longer valid */ - space->select.sel_info.hslab->diminfo_valid = FALSE; + space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO; /* Set selection type */ /* (Could be overridden by resetting selection to 'none', below) */ @@ -7514,7 +7514,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, space->select.sel_info.hslab->unlim_dim = unlim_dim; /* Indicate that the dimension information is valid */ - space->select.sel_info.hslab->diminfo_valid = TRUE; + space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_YES; /* Indicate that there's no slab information */ space->select.sel_info.hslab->span_lst = NULL; @@ -7574,7 +7574,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree") /* Indicate that the regular dimensions are no longer valid */ - space->select.sel_info.hslab->diminfo_valid = FALSE; + space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO; /* Add in the new hyperslab information */ if(H5S__generate_hyperslab (space, op, start, opt_stride, opt_count, opt_block)<0) @@ -7767,8 +7767,9 @@ H5S__combine_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, NULL, "can't release selection") /* Allocate space for the hyperslab selection information */ - if((new_space->select.sel_info.hslab=H5FL_CALLOC(H5S_hyper_sel_t))==NULL) + if((new_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab info") + new_space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO; /* Set unlim_dim */ new_space->select.sel_info.hslab->unlim_dim = -1; @@ -7897,8 +7898,9 @@ H5S__modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection") /* Allocate space for the hyperslab selection information */ - if((space1->select.sel_info.hslab=H5FL_CALLOC(H5S_hyper_sel_t))==NULL) + if((space1->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info") + space1->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO; /* Set unlim_dim */ space1->select.sel_info.hslab->unlim_dim = -1; @@ -9185,7 +9187,7 @@ H5S__hyper_get_seq_list(const H5S_t *space, unsigned H5_ATTR_UNUSED flags, H5S_s HDassert(space->select.sel_info.hslab->unlim_dim < 0); /* Check for the special case of just one H5Sselect_hyperslab call made */ - if(space->select.sel_info.hslab->diminfo_valid) { + if(H5S_DIMINFO_VALID_YES == space->select.sel_info.hslab->diminfo_valid) { const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */ const hssize_t *sel_off; /* Selection offset in dataspace */ hsize_t *mem_size; /* Size of the source buffer */ @@ -9434,9 +9436,11 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, goto loop_end; /* Allocate space for the hyperslab selection information (note this sets - * diminfo_valid to FALSE, diminfo arrays to 0, and span list to NULL) */ + * diminfo arrays to 0, and span list to NULL) + */ if((proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t)) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info") + proj_space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO; /* Set selection type */ proj_space->select.type = H5S_sel_hyper; @@ -9789,6 +9793,7 @@ H5S__hyper_subtract(H5S_t *space, H5S_t *subtract_space) /* Allocate space for the hyperslab selection information */ if((space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t)) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info") + space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO; /* Set unlim_dim */ space->select.sel_info.hslab->unlim_dim = -1; @@ -9965,7 +9970,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) space->select.num_elem = diminfo->block * hslab->num_elem_non_unlim; /* Mark that opt_diminfo is valid */ - hslab->diminfo_valid = TRUE; + hslab->diminfo_valid = H5S_DIMINFO_VALID_YES; } /* end if */ else { /* Calculate number of elements */ @@ -9998,7 +10003,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to generate span tree") /* Indicate that the regular dimensions are no longer valid */ - hslab->diminfo_valid = FALSE; + hslab->diminfo_valid = H5S_DIMINFO_VALID_NO; /* "And" selection with calculated block to perform clip operation */ if(H5S__generate_hyperslab(space, H5S_SELECT_AND, start, H5S_hyper_ones_g, H5S_hyper_ones_g, block) < 0) @@ -10006,7 +10011,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) } /* end if */ else /* Last block is complete, simply mark that opt_diminfo is valid */ - hslab->diminfo_valid = TRUE; + hslab->diminfo_valid = H5S_DIMINFO_VALID_YES; } /* end else */ done: diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 2961ef1..9013adf 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -141,9 +141,18 @@ struct H5S_hyper_span_info_t { struct H5S_hyper_span_t *head; /* Pointer to list of spans in next dimension down */ }; +/* Enum for diminfo_valid field in H5S_hyper_sel_t */ +typedef enum { + /* DER: Revert to develop order once the hyperslab optimizations are complete */ + H5S_DIMINFO_VALID_NO, /* 1: diminfo is not valid but may or may not be possible to constuct */ + H5S_DIMINFO_VALID_IMPOSSIBLE, /* 0: diminfo is not valid and can never be valid with the current selection */ + H5S_DIMINFO_VALID_YES /* 2: diminfo is valid */ +} H5S_diminfo_valid_t; + /* Information about hyperslab selection */ typedef struct { - hbool_t diminfo_valid; /* Whether the dataset has valid diminfo */ + H5S_diminfo_valid_t diminfo_valid; /* Whether the dataset has valid diminfo */ + H5S_hyper_dim_t opt_diminfo[H5S_MAX_RANK]; /* per-dim selection info */ H5S_hyper_dim_t app_diminfo[H5S_MAX_RANK]; /* per-dim selection info */ /* 'opt_diminfo' points to a [potentially] optimized version of the user's diff --git a/src/H5Stest.c b/src/H5Stest.c index 60c5679..4c7709b 100644 --- a/src/H5Stest.c +++ b/src/H5Stest.c @@ -94,7 +94,10 @@ H5S__get_rebuild_status_test(hid_t space_id) if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - ret_value = (htri_t)space->select.sel_info.hslab->diminfo_valid; + if(H5S_DIMINFO_VALID_YES == space->select.sel_info.hslab->diminfo_valid) + ret_value = TRUE; + else + ret_value = FALSE; done: FUNC_LEAVE_NOAPI(ret_value) -- cgit v0.12 From 443aa9a38f59bf4148925a86c07cfe14bac9e888 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 9 Jul 2020 18:53:18 -0700 Subject: Moved over the H5S_hyper_diminfo_t from develop. Also fixed the issue with the H5S_diminfo_valid_t enum from the last commit. --- src/H5Shyper.c | 194 +++++++++++++++++++++++++++++--------------------------- src/H5Spkg.h | 26 +++++--- src/H5Sselect.c | 18 +++--- 3 files changed, 124 insertions(+), 114 deletions(-) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 10fe123..af9e3bc 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -276,8 +276,8 @@ H5S__hyper_print_diminfo(FILE *f, const H5S_t *space) { FUNC_ENTER_STATIC_NOERR - H5S__hyper_print_diminfo_helper(f, "opt_diminfo", space->extent.rank, space->select.sel_info.hslab->opt_diminfo); - H5S__hyper_print_diminfo_helper(f, "app_diminfo", space->extent.rank, space->select.sel_info.hslab->app_diminfo); + H5S__hyper_print_diminfo_helper(f, "diminfo.opt", space->extent.rank, space->select.sel_info.hslab->diminfo.opt); + H5S__hyper_print_diminfo_helper(f, "diminfo.app", space->extent.rank, space->select.sel_info.hslab->diminfo.app); FUNC_LEAVE_NOAPI(SUCCEED) } @@ -325,11 +325,11 @@ H5S__hyper_iter_init(const H5S_t *space, H5S_sel_iter_t *iter) rank = space->extent.rank; /* Set the temporary pointer to the dimension information */ - tdiminfo = space->select.sel_info.hslab->opt_diminfo; + tdiminfo = space->select.sel_info.hslab->diminfo.opt; /* Check for the special case of just one H5Sselect_hyperslab call made */ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { -/* Initialize the information needed for regular hyperslab I/O */ + /* Initialize the information needed for regular hyperslab I/O */ const hsize_t *mem_size; /* Temporary pointer to dataspace extent's dimension sizes */ hsize_t acc; /* Accumulator for "flattened" dimension's sizes */ unsigned cont_dim = 0; /* # of contiguous dimensions */ @@ -1672,8 +1672,8 @@ H5S__hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection) size_t u; /* Local index variable */ for(u=0; uextent.rank; u++) { - dst_hslab->opt_diminfo[u]=src_hslab->opt_diminfo[u]; - dst_hslab->app_diminfo[u]=src_hslab->app_diminfo[u]; + dst_hslab->diminfo.opt[u]=src_hslab->diminfo.opt[u]; + dst_hslab->diminfo.app[u]=src_hslab->diminfo.app[u]; } /* end for */ } /* end if */ dst->select.sel_info.hslab->span_lst = src->select.sel_info.hslab->span_lst; @@ -1797,7 +1797,7 @@ H5S__hyper_is_valid(const H5S_t *space) /* Check for a "regular" hyperslab selection */ if(H5S_DIMINFO_VALID_YES == space->select.sel_info.hslab->diminfo_valid) { - const H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */ + const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->diminfo.opt; /* local alias for diminfo */ hssize_t end; /* The high bound of a region in a dimension */ unsigned u; /* Counter */ @@ -1909,8 +1909,8 @@ H5S__get_select_hyper_nblocks(const H5S_t *space, hbool_t app_ref) /* Check each dimension */ for(ret_value = 1, u = 0; u < space->extent.rank; u++) - ret_value *= (app_ref ? space->select.sel_info.hslab->app_diminfo[u].count : - space->select.sel_info.hslab->opt_diminfo[u].count); + ret_value *= (app_ref ? space->select.sel_info.hslab->diminfo.app[u].count : + space->select.sel_info.hslab->diminfo.opt[u].count); } /* end if */ else ret_value = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst); @@ -2272,7 +2272,7 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) /* Set some convienence values */ ndims = space->extent.rank; - diminfo = space->select.sel_info.hslab->opt_diminfo; + diminfo = space->select.sel_info.hslab->diminfo.opt; /* Calculate the # of blocks */ if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */ @@ -2305,7 +2305,7 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) /* Check for a "regular" hyperslab selection */ if(is_regular) { - /* If flags indicates a regular hyperslab or unlimited dimension, encode opt_diminfo */ + /* If flags indicates a regular hyperslab or unlimited dimension, encode diminfo.opt */ if(version == H5S_HYPER_VERSION_2) { HDassert(H5S_UNLIMITED == HSIZE_UNDEF); @@ -2759,21 +2759,21 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo * Use the "optimized dimension information" to pass back information * on the blocks set, not the "application information". */ - diminfo = space->select.sel_info.hslab->opt_diminfo; + diminfo = space->select.sel_info.hslab->diminfo.opt; else if(space->select.sel_info.hslab->unlim_dim >= 0) /* - * There is an unlimited dimension so we must use opt_diminfo as + * There is an unlimited dimension so we must use diminfo.opt as * it has been "clipped" to the current extent. */ - diminfo = space->select.sel_info.hslab->opt_diminfo; + diminfo = space->select.sel_info.hslab->diminfo.opt; else /* * Use the "application dimension information" to pass back to * the user the blocks they set, not the optimized, internal * information. */ - diminfo = space->select.sel_info.hslab->app_diminfo; + diminfo = space->select.sel_info.hslab->diminfo.app; /* Build the tables of count sizes as well as the initial offset */ for(u = 0; u < ndims; u++) { @@ -3043,7 +3043,7 @@ H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) /* Check for a "regular" hyperslab selection */ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { - const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */ + const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->diminfo.opt; /* local alias for diminfo */ /* Check each dimension */ for(i = 0; i < rank; i++) { @@ -3116,7 +3116,7 @@ H5S__hyper_offset(const H5S_t *space, hsize_t *offset) /* Check for a "regular" hyperslab selection */ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { - const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* Local alias for diminfo */ + const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->diminfo.opt; /* Local alias for diminfo */ /* Loop through starting coordinates, calculating the linear offset */ accum = 1; @@ -3280,7 +3280,7 @@ H5S__hyper_is_contiguous(const H5S_t *space) /* Check for a "regular" hyperslab selection */ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { - const H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab->opt_diminfo; /* local alias for diminfo */ + const H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab->diminfo.opt; /* local alias for diminfo */ /* * For a regular hyperslab to be contiguous, it must have only one @@ -3471,7 +3471,7 @@ H5S__hyper_is_single(const H5S_t *space) /* Check for a single block */ for(u = 0; u < space->extent.rank; u++) - if(space->select.sel_info.hslab->opt_diminfo[u].count > 1) + if(space->select.sel_info.hslab->diminfo.opt[u].count > 1) HGOTO_DONE(FALSE) } /* end if */ else { @@ -4297,8 +4297,8 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) /* Subtract the offset from the "regular" coordinates, if they exist */ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { for(u = 0; u < space->extent.rank; u++) { - HDassert(space->select.sel_info.hslab->opt_diminfo[u].start >= offset[u]); - space->select.sel_info.hslab->opt_diminfo[u].start -= offset[u]; + HDassert(space->select.sel_info.hslab->diminfo.opt[u].start >= offset[u]); + space->select.sel_info.hslab->diminfo.opt[u].start -= offset[u]; } /* end for */ } /* end if */ @@ -4341,7 +4341,7 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset) /* Check for a "regular" hyperslab selection */ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { - const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->opt_diminfo; /* Alias for dataspace's diminfo information */ + const H5S_hyper_dim_t *diminfo = space->select.sel_info.hslab->diminfo.opt; /* Alias for dataspace's diminfo information */ unsigned u; /* Counter */ /* Build the table of the initial offset */ @@ -4556,7 +4556,7 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of /* Check if the new space's rank is < or > base space's rank */ if(new_space->extent.rank < base_space->extent.rank) { - const H5S_hyper_dim_t *opt_diminfo = base_space->select.sel_info.hslab->opt_diminfo; /* Alias for dataspace's diminfo information */ + const H5S_hyper_dim_t *opt_diminfo = base_space->select.sel_info.hslab->diminfo.opt; /* Alias for dataspace's diminfo information */ hsize_t block[H5S_MAX_RANK]; /* Block selected in base dataspace */ unsigned u; /* Local index variable */ @@ -4578,15 +4578,15 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of /* Set the diminfo information for the higher dimensions */ for(new_space_dim = 0; new_space_dim < (new_space->extent.rank - base_space->extent.rank); new_space_dim++) { - new_space->select.sel_info.hslab->app_diminfo[new_space_dim].start = 0; - new_space->select.sel_info.hslab->app_diminfo[new_space_dim].stride = 1; - new_space->select.sel_info.hslab->app_diminfo[new_space_dim].count = 1; - new_space->select.sel_info.hslab->app_diminfo[new_space_dim].block = 1; - - new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].start = 0; - new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].stride = 1; - new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].count = 1; - new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].block = 1; + new_space->select.sel_info.hslab->diminfo.app[new_space_dim].start = 0; + new_space->select.sel_info.hslab->diminfo.app[new_space_dim].stride = 1; + new_space->select.sel_info.hslab->diminfo.app[new_space_dim].count = 1; + new_space->select.sel_info.hslab->diminfo.app[new_space_dim].block = 1; + + new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].start = 0; + new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].stride = 1; + new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].count = 1; + new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].block = 1; } /* end for */ /* Start at beginning of base space's dimension info */ @@ -4595,23 +4595,23 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of /* Copy the diminfo */ while(base_space_dim < base_space->extent.rank) { - new_space->select.sel_info.hslab->app_diminfo[new_space_dim].start = - base_space->select.sel_info.hslab->app_diminfo[base_space_dim].start; - new_space->select.sel_info.hslab->app_diminfo[new_space_dim].stride = - base_space->select.sel_info.hslab->app_diminfo[base_space_dim].stride; - new_space->select.sel_info.hslab->app_diminfo[new_space_dim].count = - base_space->select.sel_info.hslab->app_diminfo[base_space_dim].count; - new_space->select.sel_info.hslab->app_diminfo[new_space_dim].block = - base_space->select.sel_info.hslab->app_diminfo[base_space_dim].block; - - new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].start = - base_space->select.sel_info.hslab->opt_diminfo[base_space_dim].start; - new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].stride = - base_space->select.sel_info.hslab->opt_diminfo[base_space_dim].stride; - new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].count = - base_space->select.sel_info.hslab->opt_diminfo[base_space_dim].count; - new_space->select.sel_info.hslab->opt_diminfo[new_space_dim].block = - base_space->select.sel_info.hslab->opt_diminfo[base_space_dim].block; + new_space->select.sel_info.hslab->diminfo.app[new_space_dim].start = + base_space->select.sel_info.hslab->diminfo.app[base_space_dim].start; + new_space->select.sel_info.hslab->diminfo.app[new_space_dim].stride = + base_space->select.sel_info.hslab->diminfo.app[base_space_dim].stride; + new_space->select.sel_info.hslab->diminfo.app[new_space_dim].count = + base_space->select.sel_info.hslab->diminfo.app[base_space_dim].count; + new_space->select.sel_info.hslab->diminfo.app[new_space_dim].block = + base_space->select.sel_info.hslab->diminfo.app[base_space_dim].block; + + new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].start = + base_space->select.sel_info.hslab->diminfo.opt[base_space_dim].start; + new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].stride = + base_space->select.sel_info.hslab->diminfo.opt[base_space_dim].stride; + new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].count = + base_space->select.sel_info.hslab->diminfo.opt[base_space_dim].count; + new_space->select.sel_info.hslab->diminfo.opt[new_space_dim].block = + base_space->select.sel_info.hslab->diminfo.opt[base_space_dim].block; /* Advance to next dimensions */ base_space_dim++; @@ -4780,8 +4780,8 @@ H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset) /* Subtract the offset from the "regular" coordinates, if they exist */ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { for(u = 0; u < space->extent.rank; u++) { - HDassert((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start >= offset[u]); - space->select.sel_info.hslab->opt_diminfo[u].start = (hsize_t)((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start - offset[u]); + HDassert((hssize_t)space->select.sel_info.hslab->diminfo.opt[u].start >= offset[u]); + space->select.sel_info.hslab->diminfo.opt[u].start = (hsize_t)((hssize_t)space->select.sel_info.hslab->diminfo.opt[u].start - offset[u]); } /* end for */ } /* end if */ @@ -6242,8 +6242,8 @@ H5S__hyper_rebuild(H5S_t *space) H5S_hyper_dim_t *diminfo; H5S_hyper_dim_t *app_diminfo; - diminfo = space->select.sel_info.hslab->opt_diminfo; - app_diminfo = space->select.sel_info.hslab->app_diminfo; + diminfo = space->select.sel_info.hslab->diminfo.opt; + app_diminfo = space->select.sel_info.hslab->diminfo.app; for(curr_dim = 0; curr_dim < rank; curr_dim++) { @@ -6252,7 +6252,7 @@ H5S__hyper_rebuild(H5S_t *space) app_diminfo[(rank - curr_dim) - 1].count = diminfo[(rank - curr_dim) - 1].count = top_span_slab_info[curr_dim].count; app_diminfo[(rank - curr_dim) - 1].block = diminfo[(rank - curr_dim) - 1].block = top_span_slab_info[curr_dim].block; - } /* end for */ + } space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_YES; } /* end else */ @@ -6301,15 +6301,15 @@ H5S__hyper_generate_spans(H5S_t *space) /* These should be able to be converted to assertions once everything * that calls this function checks for unlimited selections first * (especially the new hyperslab API) -NAF */ - if(space->select.sel_info.hslab->opt_diminfo[u].count == H5S_UNLIMITED) + if(space->select.sel_info.hslab->diminfo.opt[u].count == H5S_UNLIMITED) HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "can't generate spans with unlimited count") - if(space->select.sel_info.hslab->opt_diminfo[u].block == H5S_UNLIMITED) + if(space->select.sel_info.hslab->diminfo.opt[u].block == H5S_UNLIMITED) HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "can't generate spans with unlimited block") - tmp_start[u] = space->select.sel_info.hslab->opt_diminfo[u].start; - tmp_stride[u] = space->select.sel_info.hslab->opt_diminfo[u].stride; - tmp_count[u] = space->select.sel_info.hslab->opt_diminfo[u].count; - tmp_block[u] = space->select.sel_info.hslab->opt_diminfo[u].block; + tmp_start[u] = space->select.sel_info.hslab->diminfo.opt[u].start; + tmp_stride[u] = space->select.sel_info.hslab->diminfo.opt[u].stride; + tmp_count[u] = space->select.sel_info.hslab->diminfo.opt[u].count; + tmp_block[u] = space->select.sel_info.hslab->diminfo.opt[u].block; } /* end for */ /* Build the hyperslab information also */ @@ -6809,15 +6809,15 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], /* Save the diminfo */ space->select.num_elem = 1; for(u = 0; u < space->extent.rank; u++) { - space->select.sel_info.hslab->app_diminfo[u].start = start[u]; - space->select.sel_info.hslab->app_diminfo[u].stride = stride[u]; - space->select.sel_info.hslab->app_diminfo[u].count = count[u]; - space->select.sel_info.hslab->app_diminfo[u].block = block[u]; + space->select.sel_info.hslab->diminfo.app[u].start = start[u]; + space->select.sel_info.hslab->diminfo.app[u].stride = stride[u]; + space->select.sel_info.hslab->diminfo.app[u].count = count[u]; + space->select.sel_info.hslab->diminfo.app[u].block = block[u]; - space->select.sel_info.hslab->opt_diminfo[u].start = start[u]; - space->select.sel_info.hslab->opt_diminfo[u].stride = opt_stride[u]; - space->select.sel_info.hslab->opt_diminfo[u].count = opt_count[u]; - space->select.sel_info.hslab->opt_diminfo[u].block = opt_block[u]; + space->select.sel_info.hslab->diminfo.opt[u].start = start[u]; + space->select.sel_info.hslab->diminfo.opt[u].stride = opt_stride[u]; + space->select.sel_info.hslab->diminfo.opt[u].count = opt_count[u]; + space->select.sel_info.hslab->diminfo.opt[u].block = opt_block[u]; space->select.num_elem *= (opt_count[u] * opt_block[u]); } /* end for */ @@ -7497,15 +7497,15 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, /* Save the diminfo */ space->select.num_elem=1; for(u=0; uextent.rank; u++) { - space->select.sel_info.hslab->app_diminfo[u].start = start[u]; - space->select.sel_info.hslab->app_diminfo[u].stride = stride[u]; - space->select.sel_info.hslab->app_diminfo[u].count = count[u]; - space->select.sel_info.hslab->app_diminfo[u].block = block[u]; + space->select.sel_info.hslab->diminfo.app[u].start = start[u]; + space->select.sel_info.hslab->diminfo.app[u].stride = stride[u]; + space->select.sel_info.hslab->diminfo.app[u].count = count[u]; + space->select.sel_info.hslab->diminfo.app[u].block = block[u]; - space->select.sel_info.hslab->opt_diminfo[u].start = start[u]; - space->select.sel_info.hslab->opt_diminfo[u].stride = opt_stride[u]; - space->select.sel_info.hslab->opt_diminfo[u].count = opt_count[u]; - space->select.sel_info.hslab->opt_diminfo[u].block = opt_block[u]; + space->select.sel_info.hslab->diminfo.opt[u].start = start[u]; + space->select.sel_info.hslab->diminfo.opt[u].stride = opt_stride[u]; + space->select.sel_info.hslab->diminfo.opt[u].count = opt_count[u]; + space->select.sel_info.hslab->diminfo.opt[u].block = opt_block[u]; space->select.num_elem*=(opt_count[u]*opt_block[u]); } /* end for */ @@ -9931,7 +9931,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) H5S_hyper_sel_t *hslab = NULL; /* Convenience pointer to hyperslab info */ hsize_t orig_count; /* Original count in unlimited dimension */ int orig_unlim_dim; /* Original unliminted dimension */ - H5S_hyper_dim_t *diminfo = NULL; /* Convenience pointer to opt_diminfo in unlimited dimension */ + H5S_hyper_dim_t *diminfo = NULL; /* Convenience pointer to diminfo.opt in unlimited dimension */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -9947,7 +9947,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) orig_unlim_dim = hslab->unlim_dim; /* Set up convenience pointer */ - diminfo = &hslab->opt_diminfo[orig_unlim_dim]; + diminfo = &hslab->diminfo.opt[orig_unlim_dim]; /* Save original count in unlimited dimension */ orig_count = diminfo->count; @@ -9963,13 +9963,17 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) /* Convert to "none" selection */ if(H5S_select_none(space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection") + + /* Reset the convenience pointers */ + hslab = NULL; + diminfo = NULL; } /* end if */ /* Check for single block in unlimited dimension */ else if(orig_count == (hsize_t)1) { /* Calculate number of elements */ space->select.num_elem = diminfo->block * hslab->num_elem_non_unlim; - /* Mark that opt_diminfo is valid */ + /* Mark that diminfo.opt is valid */ hslab->diminfo_valid = H5S_DIMINFO_VALID_YES; } /* end if */ else { @@ -10010,7 +10014,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs") } /* end if */ else - /* Last block is complete, simply mark that opt_diminfo is valid */ + /* Last block is complete, simply mark that diminfo.opt is valid */ hslab->diminfo_valid = H5S_DIMINFO_VALID_YES; } /* end else */ @@ -10062,7 +10066,7 @@ H5S__hyper_get_clip_extent_real(const H5S_t *clip_space, hsize_t num_slices, HDassert(clip_space->select.sel_info.hslab); HDassert(clip_space->select.sel_info.hslab->unlim_dim >= 0); - diminfo = &clip_space->select.sel_info.hslab->opt_diminfo[clip_space->select.sel_info.hslab->unlim_dim]; + diminfo = &clip_space->select.sel_info.hslab->diminfo.opt[clip_space->select.sel_info.hslab->unlim_dim]; if(num_slices == 0) ret_value = incl_trail ? diminfo->start : 0; @@ -10216,7 +10220,7 @@ H5S_hyper_get_clip_extent_match(const H5S_t *clip_space, HDassert(clip_space->select.sel_info.hslab->num_elem_non_unlim == match_space->select.sel_info.hslab->num_elem_non_unlim); - match_diminfo = &match_space->select.sel_info.hslab->opt_diminfo[match_space->select.sel_info.hslab->unlim_dim]; + match_diminfo = &match_space->select.sel_info.hslab->diminfo.opt[match_space->select.sel_info.hslab->unlim_dim]; /* Get initial count and block */ count = match_diminfo->count; @@ -10295,23 +10299,23 @@ H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index) hslab = space->select.sel_info.hslab; HDassert(hslab); HDassert(hslab->unlim_dim >= 0); - HDassert(hslab->opt_diminfo[hslab->unlim_dim].count == H5S_UNLIMITED); + HDassert(hslab->diminfo.opt[hslab->unlim_dim].count == H5S_UNLIMITED); /* Set start to select block_indexth block in unlimited dimension and set * count to 1 in that dimension to only select that block. Copy all other * diminfo parameters. */ for(u = 0; u < space->extent.rank; u++) { if((int)u == hslab->unlim_dim){ - start[u] = hslab->opt_diminfo[u].start + (block_index - * hslab->opt_diminfo[u].stride); + start[u] = hslab->diminfo.opt[u].start + (block_index + * hslab->diminfo.opt[u].stride); count[u] = (hsize_t)1; } /* end if */ else { - start[u] = hslab->opt_diminfo[u].start; - count[u] = hslab->opt_diminfo[u].count; + start[u] = hslab->diminfo.opt[u].start; + count[u] = hslab->diminfo.opt[u].count; } /* end else */ - stride[u] = hslab->opt_diminfo[u].stride; - block[u] = hslab->opt_diminfo[u].block; + stride[u] = hslab->diminfo.opt[u].stride; + block[u] = hslab->diminfo.opt[u].block; } /* end for */ /* Create output space, copy extent */ @@ -10376,9 +10380,9 @@ H5S_hyper_get_first_inc_block(const H5S_t *space, hsize_t clip_size, hslab = space->select.sel_info.hslab; HDassert(hslab); HDassert(hslab->unlim_dim >= 0); - HDassert(hslab->opt_diminfo[hslab->unlim_dim].count == H5S_UNLIMITED); + HDassert(hslab->diminfo.opt[hslab->unlim_dim].count == H5S_UNLIMITED); - diminfo = &hslab->opt_diminfo[hslab->unlim_dim]; + diminfo = &hslab->diminfo.opt[hslab->unlim_dim]; /* Check for selection outside of clip_size */ if(diminfo->start >= clip_size) { @@ -10495,16 +10499,16 @@ H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[], /* Retrieve hyperslab parameters */ if(start) for(u = 0; u < space->extent.rank; u++) - start[u] = space->select.sel_info.hslab->app_diminfo[u].start; + start[u] = space->select.sel_info.hslab->diminfo.app[u].start; if(stride) for(u = 0; u < space->extent.rank; u++) - stride[u] = space->select.sel_info.hslab->app_diminfo[u].stride; + stride[u] = space->select.sel_info.hslab->diminfo.app[u].stride; if(count) for(u = 0; u < space->extent.rank; u++) - count[u] = space->select.sel_info.hslab->app_diminfo[u].count; + count[u] = space->select.sel_info.hslab->diminfo.app[u].count; if(block) for(u = 0; u < space->extent.rank; u++) - block[u] = space->select.sel_info.hslab->app_diminfo[u].block; + block[u] = space->select.sel_info.hslab->diminfo.app[u].block; done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 9013adf..5e73e8e 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -143,24 +143,30 @@ struct H5S_hyper_span_info_t { /* Enum for diminfo_valid field in H5S_hyper_sel_t */ typedef enum { - /* DER: Revert to develop order once the hyperslab optimizations are complete */ - H5S_DIMINFO_VALID_NO, /* 1: diminfo is not valid but may or may not be possible to constuct */ H5S_DIMINFO_VALID_IMPOSSIBLE, /* 0: diminfo is not valid and can never be valid with the current selection */ + H5S_DIMINFO_VALID_NO, /* 1: diminfo is not valid but may or may not be possible to constuct */ H5S_DIMINFO_VALID_YES /* 2: diminfo is valid */ } H5S_diminfo_valid_t; +/* Information about 'diminfo' form of hyperslab selection */ +typedef struct { + /* 'opt' points to a [potentially] optimized version of the user's + * regular hyperslab information. 'app' points to the actual parameters + * that the application used for setting the hyperslab selection. + * + * The 'app' values are only used for regurgitating the original values + * used to set the hyperslab to the application when it queries the + * hyperslab selection information. + */ + H5S_hyper_dim_t app[H5S_MAX_RANK]; /* Application-set per-dim selection info */ + H5S_hyper_dim_t opt[H5S_MAX_RANK]; /* Optimized per-dim selection info */ +} H5S_hyper_diminfo_t; + /* Information about hyperslab selection */ typedef struct { H5S_diminfo_valid_t diminfo_valid; /* Whether the dataset has valid diminfo */ - H5S_hyper_dim_t opt_diminfo[H5S_MAX_RANK]; /* per-dim selection info */ - H5S_hyper_dim_t app_diminfo[H5S_MAX_RANK]; /* per-dim selection info */ - /* 'opt_diminfo' points to a [potentially] optimized version of the user's - * hyperslab information. 'app_diminfo' points to the actual parameters - * that the application used for setting the hyperslab selection. These - * are only used for re-gurgitating the original values used to set the - * hyperslab to the application when it queries the hyperslab selection - * information. */ + H5S_hyper_diminfo_t diminfo; /* Dimension info form of hyperslab selection */ int unlim_dim; /* Dimension where selection is unlimited, or -1 if none */ hsize_t num_elem_non_unlim; /* # of elements in a "slice" excluding the unlimited dimension */ H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information of all dimensions */ diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 815c0b8..87a9d47 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -1734,8 +1734,8 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2) /* (Both must be, at this point, if one is) */ HGOTO_DONE(TRUE) } /* end if */ - else if((H5S_GET_SELECT_TYPE(space_a) == H5S_SEL_HYPERSLABS && space_a->select.sel_info.hslab->diminfo_valid) - && (H5S_GET_SELECT_TYPE(space_b) == H5S_SEL_HYPERSLABS && space_b->select.sel_info.hslab->diminfo_valid)) { + else if((H5S_GET_SELECT_TYPE(space_a) == H5S_SEL_HYPERSLABS && (H5S_DIMINFO_VALID_YES == space_a->select.sel_info.hslab->diminfo_valid)) + && (H5S_GET_SELECT_TYPE(space_b) == H5S_SEL_HYPERSLABS && (H5S_DIMINFO_VALID_YES == space_b->select.sel_info.hslab->diminfo_valid))) { int space_a_dim; /* Current dimension in dataspace A */ int space_b_dim; /* Current dimension in dataspace B */ @@ -1746,16 +1746,16 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2) * block == 1 in all dimensions that appear only in space_a. */ while(space_b_dim >= 0) { - if(space_a->select.sel_info.hslab->opt_diminfo[space_a_dim].stride != - space_b->select.sel_info.hslab->opt_diminfo[space_b_dim].stride) + if(space_a->select.sel_info.hslab->diminfo.opt[space_a_dim].stride != + space_b->select.sel_info.hslab->diminfo.opt[space_b_dim].stride) HGOTO_DONE(FALSE) - if(space_a->select.sel_info.hslab->opt_diminfo[space_a_dim].count != - space_b->select.sel_info.hslab->opt_diminfo[space_b_dim].count) + if(space_a->select.sel_info.hslab->diminfo.opt[space_a_dim].count != + space_b->select.sel_info.hslab->diminfo.opt[space_b_dim].count) HGOTO_DONE(FALSE) - if(space_a->select.sel_info.hslab->opt_diminfo[space_a_dim].block != - space_b->select.sel_info.hslab->opt_diminfo[space_b_dim].block) + if(space_a->select.sel_info.hslab->diminfo.opt[space_a_dim].block != + space_b->select.sel_info.hslab->diminfo.opt[space_b_dim].block) HGOTO_DONE(FALSE) space_a_dim--; @@ -1763,7 +1763,7 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2) } /* end while */ while(space_a_dim >= 0) { - if(space_a->select.sel_info.hslab->opt_diminfo[space_a_dim].block != 1) + if(space_a->select.sel_info.hslab->diminfo.opt[space_a_dim].block != 1) HGOTO_DONE(FALSE) space_a_dim--; -- cgit v0.12