diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Dint.c | 860 |
1 files changed, 344 insertions, 516 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c index bdedd1e..b6c0341 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -21,14 +21,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -54,18 +54,18 @@ typedef struct { /* General stuff */ static herr_t H5D__get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache); static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, - hbool_t vl_type); + hbool_t vl_type); static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, - const H5T_t *type); + const H5T_t *type); static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, - hid_t dapl_id); + hid_t dapl_id); static herr_t H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, - char **extfile_prefix); + char **extfile_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, - hsize_t old_dim[]); + hsize_t old_dim[]); static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id); /*********************/ @@ -109,9 +109,9 @@ static H5D_shared_t H5D_def_dset; /* Dataset ID class */ static const H5I_class_t H5I_DATASET_CLS[1] = {{ - H5I_DATASET, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ + H5I_DATASET, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ (H5I_free_t)H5D_close /* Callback routine for closing objects of this class */ }}; @@ -121,17 +121,13 @@ static hbool_t H5D_top_package_initialize_s = FALSE; /*------------------------------------------------------------------------- - * Function: H5D_init + * Function: H5D_init * - * Purpose: Initialize the interface from some other layer. + * Purpose: Initialize the interface from some other layer. * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Quincey Koziol - * Saturday, March 4, 2000 + * Return: Success: non-negative * + * Failure: negative *------------------------------------------------------------------------- */ herr_t @@ -149,7 +145,7 @@ done: /*-------------------------------------------------------------------------- NAME - H5D__init_package -- Initialize interface-specific information + H5D__init_package -- Initialize interface-specific information USAGE herr_t H5D__init_package() @@ -211,28 +207,24 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_top_term_package - * - * Purpose: Close the "top" of the interface, releasing IDs, etc. - * - * Return: Success: Positive if anything was done that might - * affect other interfaces; zero otherwise. - * Failure: Negative. + * Function: H5D_top_term_package * - * Programmer: Quincey Koziol - * Sunday, September 13, 2015 + * Purpose: Close the "top" of the interface, releasing IDs, etc. * + * Return: Success: Positive if anything was done that might + * affect other interfaces; zero otherwise. + * Failure: Negative. *------------------------------------------------------------------------- */ int H5D_top_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5D_top_package_initialize_s) { - if(H5I_nmembers(H5I_DATASET) > 0) { + if(H5I_nmembers(H5I_DATASET) > 0) { /* The dataset API uses the "force" flag set to true because it * is using the "file objects" (H5FO) API functions to track open * objects in the file. Using the H5FO code means that dataset @@ -255,9 +247,9 @@ H5D_top_term_package(void) * * QAK - 5/13/03 */ - (void)H5I_clear_type(H5I_DATASET, TRUE, FALSE); + (void)H5I_clear_type(H5I_DATASET, TRUE, FALSE); n++; /*H5I*/ - } /* end if */ + } /* end if */ /* Mark closed */ if(0 == n) @@ -269,26 +261,22 @@ H5D_top_term_package(void) /*------------------------------------------------------------------------- - * Function: H5D_term_package - * - * Purpose: Terminate this interface. + * Function: H5D_term_package * - * Note: Finishes shutting down the interface, after - * H5D_top_term_package() is called + * Purpose: Terminate this interface. * - * Return: Success: Positive if anything was done that might - * affect other interfaces; zero otherwise. - * Failure: Negative. - * - * Programmer: Robb Matzke - * Friday, November 20, 1998 + * Note: Finishes shutting down the interface, after + * H5D_top_term_package() is called * + * Return: Success: Positive if anything was done that might + * affect other interfaces; zero otherwise. + * Failure: Negative. *------------------------------------------------------------------------- */ int H5D_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -440,17 +428,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__create_named - * - * Purpose: Internal routine to create a new dataset. + * Function: H5D__create_named * - * Return: Success: Non-NULL, pointer to new dataset object. + * Purpose: Internal routine to create a new dataset. * - * Failure: NULL - * - * Programmer: Quincey Koziol - * Thursday, April 5, 2007 + * Return: Success: Non-NULL, pointer to new dataset object. * + * Failure: NULL *------------------------------------------------------------------------- */ H5D_t * @@ -460,7 +444,7 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, { H5O_obj_create_t ocrt_info; /* Information for object creation */ H5D_obj_create_t dcrt_info; /* Information for dataset creation */ - H5D_t *ret_value = NULL; /* Return value */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -505,11 +489,7 @@ done: * * Return: * Success: Non-negative - * * Failture: Negative - * - * Programmer: Raymond Lu - * *------------------------------------------------------------------------- */ herr_t @@ -557,7 +537,7 @@ H5D__get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id *allocation = H5D_SPACE_STATUS_NOT_ALLOCATED; else if(space_allocated == full_size) *allocation = H5D_SPACE_STATUS_ALLOCATED; - else + else *allocation = H5D_SPACE_STATUS_PART_ALLOCATED; } /* end if */ else { @@ -575,17 +555,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__new - * - * Purpose: Creates a new, empty dataset structure + * Function: H5D__new * - * Return: Success: Pointer to a new dataset descriptor. - * - * Failure: NULL - * - * Programmer: Quincey Koziol - * Monday, October 12, 1998 + * Purpose: Creates a new, empty dataset structure * + * Return: Success: Pointer to a new dataset descriptor. + * Failure: NULL *------------------------------------------------------------------------- */ static H5D_shared_t * @@ -636,26 +611,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__init_type + * Function: H5D__init_type * - * Purpose: Copy a datatype for a dataset's use, performing all the + * Purpose: Copy a datatype for a dataset's use, performing all the * necessary adjustments, etc. * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Thursday, June 24, 2004 - * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) { - htri_t relocatable; /* Flag whether the type is relocatable */ - htri_t immutable; /* Flag whether the type is immutable */ - hbool_t use_latest_format; /* Flag indicating the 'latest datatype version support' is enabled */ - herr_t ret_value = SUCCEED; /* Return value */ + htri_t relocatable; /* Flag whether the type is relocatable */ + htri_t immutable; /* Flag whether the type is immutable */ + hbool_t use_latest_format; /* Flag indicating the 'latest datatype version support' is enabled */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -681,8 +652,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) if((dset->shared->type = H5T_copy(type, H5T_COPY_ALL)) == NULL) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype") - /* Convert a datatype (if committed) to a transient type if the committed datatype's file - location is different from the file location where the dataset will be created */ + /* Convert a datatype (if committed) to a transient type if the committed datatype's file + location is different from the file location where the dataset will be created */ if(H5T_convert_committed_datatype(dset->shared->type, file) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info") @@ -696,8 +667,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype") /* Get a datatype ID for the dataset's datatype */ - if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type") + if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type") } /* end if */ /* Not a custom datatype, just use it directly */ else { @@ -715,16 +686,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__cache_dataspace_info - * - * Purpose: Cache dataspace info for a dataset - * - * Return: Success: SUCCEED - * Failure: FAIL + * Function: H5D__cache_dataspace_info * - * Programmer: Quincey Koziol - * Wednesday, November 19, 2014 + * Purpose: Cache dataspace info for a dataset * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ static herr_t @@ -759,17 +726,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__init_space + * Function: H5D__init_space * - * Purpose: Copy a dataspace for a dataset's use, performing all the + * Purpose: Copy a dataspace for a dataset's use, performing all the * necessary adjustments, etc. * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Tuesday, July 24, 2007 - * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ static herr_t @@ -811,16 +774,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__update_oh_info - * - * Purpose: Create and fill object header for dataset - * - * Return: Success: SUCCEED - * Failure: FAIL + * Function: H5D__update_oh_info * - * Programmer: Bill Wendling - * Thursday, October 31, 2002 + * Purpose: Create and fill object header for dataset * + * Return: Success: SUCCEED + * Failure: FAIL *------------------------------------------------------------------------- */ static herr_t @@ -831,9 +790,9 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) H5O_loc_t *oloc = NULL; /* Dataset's object location */ H5O_layout_t *layout; /* Dataset's layout information */ H5T_t *type; /* Dataset's datatype */ - H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */ - H5D_fill_value_t fill_status; /* Fill value status */ - hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */ + H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */ + H5D_fill_value_t fill_status; /* Fill value status */ + hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ herr_t ret_value = SUCCEED; /* Return value */ @@ -875,10 +834,12 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) if(fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(fill_prop, type, &fill_changed, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type") - fill_prop->fill_defined = TRUE; - } else if(fill_status == H5D_FILL_VALUE_UNDEFINED) { - fill_prop->fill_defined = FALSE; - } else + fill_prop->fill_defined = TRUE; + } + else if(fill_status == H5D_FILL_VALUE_UNDEFINED) { + fill_prop->fill_defined = FALSE; + } + else HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine if fill value is defined") /* Check for invalid fill & allocation time setting */ @@ -961,17 +922,17 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) (H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_ID_NAME) > 0) ) { uint8_t bogus_flags = 0; /* Flags for creating "bogus" message */ - unsigned bogus_id; /* "bogus" ID */ + unsigned bogus_id; /* "bogus" ID */ - /* Retrieve "bogus" message ID */ + /* Retrieve "bogus" message ID */ if(H5P_get(dc_plist, H5O_BOGUS_MSG_ID_NAME, &bogus_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options") /* Retrieve "bogus" message flags */ if(H5P_get(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus message options") /* Add a "bogus" message (for error testing). */ - if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0) + if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message") } /* end if */ } @@ -1010,9 +971,6 @@ done: * should be used. * * Return: SUCCEED/FAIL - * - * Programmer: Steffen Kiess - * October 16, 2015 *-------------------------------------------------------------------------- */ static herr_t @@ -1025,7 +983,7 @@ H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix size_t extfile_prefix_len; /* length of expanded prefix */ H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ - + FUNC_ENTER_NOAPI_NOINIT @@ -1064,7 +1022,7 @@ H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix extpath_len = HDstrlen(extpath); prefix_len = HDstrlen(prefix); extfile_prefix_len = extpath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; - + if(NULL == (*extfile_prefix = (char *)H5MM_malloc(extfile_prefix_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer") HDsnprintf(*extfile_prefix, extfile_prefix_len, "%s%s", extpath, prefix + HDstrlen("${ORIGIN}")); @@ -1081,32 +1039,27 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__create - * - * Purpose: Creates a new dataset with name NAME in file F and associates - * with it a datatype TYPE for each element as stored in the - * file, dimensionality information or dataspace SPACE, and - * other miscellaneous properties CREATE_PARMS. All arguments - * are deep-copied before being associated with the new dataset, - * so the caller is free to subsequently modify them without - * affecting the dataset. - * - * Return: Success: Pointer to a new dataset - * - * Failure: NULL - * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 - * + * Function: H5D__create + * + * Purpose: Creates a new dataset with name NAME in file F and associates + * with it a datatype TYPE for each element as stored in the + * file, dimensionality information or dataspace SPACE, and + * other miscellaneous properties CREATE_PARMS. All arguments + * are deep-copied before being associated with the new dataset, + * so the caller is free to subsequently modify them without + * affecting the dataset. + * + * Return: Success: Pointer to a new dataset + * Failure: NULL *------------------------------------------------------------------------- */ H5D_t * H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id) { - const H5T_t *type; /* Datatype for dataset */ - H5D_t *new_dset = NULL; - H5P_genplist_t *dc_plist = NULL; /* New Property list */ + const H5T_t *type; /* Datatype for dataset */ + H5D_t *new_dset = NULL; + H5P_genplist_t *dc_plist = NULL; /* New Property list */ hbool_t has_vl_type = FALSE; /* Flag to indicate a VL-type for dataset */ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ hbool_t layout_copied = FALSE; /* Flag to indicate that layout message was copied */ @@ -1114,7 +1067,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hbool_t pline_copied = FALSE; /* Flag to indicate that pipeline message was copied */ hbool_t efl_copied = FALSE; /* Flag to indicate that external file list message was copied */ H5G_loc_t dset_loc; /* Dataset location */ - H5D_t *ret_value = NULL; /* Return value */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1218,24 +1171,24 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Set the latest version of the layout, pline & fill messages, if requested */ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DSET_MSG_FLAGS)) { /* Set the latest version for the I/O pipeline message */ - if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_PLINE_MSG)) - if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline") + if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_PLINE_MSG)) + if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline") /* Set the latest version for the fill message */ - if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG)) - /* Set the latest version for the fill value message */ - if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value") + if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG)) + /* Set the latest version for the fill value message */ + if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value") /* Set the latest version for the layout message */ - if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_LAYOUT_MSG)) - /* Set the latest version for the layout message */ - if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout") + if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_LAYOUT_MSG)) + /* Set the latest version for the layout message */ + if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout") } /* end if */ else if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) { - /* Use latest indexing type for layout message version >= 4 */ + /* Use latest indexing type for layout message version >= 4 */ if(H5D__layout_set_latest_indexing(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest indexing") } /* end if */ @@ -1261,7 +1214,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Set up append flush parameters for the dataset */ if(H5D__append_flush_setup(new_dset, dapl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property") /* Set the external file prefix */ if(H5D_build_extfile_prefix(new_dset, dapl_id, &new_dset->shared->extfile_prefix) < 0) @@ -1329,10 +1282,6 @@ done: * * Return: Success: Ptr to a new dataset. * Failure: NULL - * - * Programmer: Neil Fortner - * Friday, March 6, 2015 - * *------------------------------------------------------------------------- */ H5D_t * @@ -1387,17 +1336,13 @@ done: /* *------------------------------------------------------------------------- - * Function: H5D_open + * Function: H5D_open * - * Purpose: Checks if dataset is already open, or opens a dataset for + * Purpose: Checks if dataset is already open, or opens a dataset for * access. * - * Return: Success: Dataset ID - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Friday, December 20, 2002 - * + * Return: Success: Dataset ID + * Failure: FAIL *------------------------------------------------------------------------- */ H5D_t * @@ -1509,19 +1454,15 @@ done: /* *------------------------------------------------------------------------- - * Function: H5D__flush_append_setup - * - * Purpose: Set the append flush parameters for a dataset - * - * Return: Non-negative on success/Negative on failure + * Function: H5D__flush_append_setup * - * Programmer: Vailin Choi - * Wednesday, January 8, 2014 + * Purpose: Set the append flush parameters for a dataset * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ static herr_t -H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id) +H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id) { herr_t ret_value = SUCCEED; /* return value */ @@ -1538,47 +1479,47 @@ H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id) if(dapl_id != H5P_DATASET_ACCESS_DEFAULT && dset->shared->layout.type == H5D_CHUNKED) { H5P_genplist_t *dapl; /* data access property list object pointer */ - /* Get dataset access property list */ - if(NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for dapl ID"); + /* Get dataset access property list */ + if(NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for dapl ID"); - /* Check if append flush property exists */ - if(H5P_exist_plist(dapl, H5D_ACS_APPEND_FLUSH_NAME) > 0) { + /* Check if append flush property exists */ + if(H5P_exist_plist(dapl, H5D_ACS_APPEND_FLUSH_NAME) > 0) { H5D_append_flush_t info; - /* Get append flush property */ - if(H5P_get(dapl, H5D_ACS_APPEND_FLUSH_NAME, &info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get append flush info") - if(info.ndims > 0) { - hsize_t curr_dims[H5S_MAX_RANK]; /* current dimension sizes */ - hsize_t max_dims[H5S_MAX_RANK]; /* current dimension sizes */ - int rank; /* dataspace # of dimensions */ - unsigned u; /* local index variable */ - - /* Get dataset rank */ - if((rank = H5S_get_simple_extent_dims(dset->shared->space, curr_dims, max_dims)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") - if(info.ndims != (unsigned)rank) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension rank does not match dataset rank") - - /* Validate boundary sizes */ - for(u = 0; u < info.ndims; u++) - if(info.boundary[u] != 0) /* when a non-zero boundary is set */ - /* the dimension is extendible? */ - if(max_dims[u] != H5S_UNLIMITED && max_dims[u] == curr_dims[u]) - break; + /* Get append flush property */ + if(H5P_get(dapl, H5D_ACS_APPEND_FLUSH_NAME, &info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get append flush info") + if(info.ndims > 0) { + hsize_t curr_dims[H5S_MAX_RANK]; /* current dimension sizes */ + hsize_t max_dims[H5S_MAX_RANK]; /* current dimension sizes */ + int rank; /* dataspace # of dimensions */ + unsigned u; /* local index variable */ + + /* Get dataset rank */ + if((rank = H5S_get_simple_extent_dims(dset->shared->space, curr_dims, max_dims)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") + if(info.ndims != (unsigned)rank) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension rank does not match dataset rank") + + /* Validate boundary sizes */ + for(u = 0; u < info.ndims; u++) + if(info.boundary[u] != 0) /* when a non-zero boundary is set */ + /* the dimension is extendible? */ + if(max_dims[u] != H5S_UNLIMITED && max_dims[u] == curr_dims[u]) + break; /* At least one boundary dimension is not extendible */ - if(u != info.ndims) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension is not valid") + if(u != info.ndims) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension is not valid") /* Copy append flush settings */ - dset->shared->append_flush.ndims = info.ndims; - dset->shared->append_flush.func = info.func; - dset->shared->append_flush.udata = info.udata; - HDmemcpy(dset->shared->append_flush.boundary, info.boundary, sizeof(info.boundary)); - } /* end if */ - } /* end if */ + dset->shared->append_flush.ndims = info.ndims; + dset->shared->append_flush.func = info.func; + dset->shared->append_flush.udata = info.udata; + HDmemcpy(dset->shared->append_flush.boundary, info.boundary, sizeof(info.boundary)); + } /* end if */ + } /* end if */ } /* end if */ done: @@ -1587,15 +1528,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__open_oid - * - * Purpose: Opens a dataset for access. - * - * Return: Dataset pointer on success, NULL on failure + * Function: H5D__open_oid * - * Programmer: Quincey Koziol - * Monday, October 12, 1998 + * Purpose: Opens a dataset for access. * + * Return: Dataset pointer on success, NULL on failure *------------------------------------------------------------------------- */ static herr_t @@ -1605,8 +1542,8 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) H5O_fill_t *fill_prop; /* Pointer to dataset's fill value info */ unsigned alloc_time_state; /* Allocation time state */ htri_t msg_exists; /* Whether a particular type of message exists */ - hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ - herr_t ret_value = SUCCEED; /* Return value */ + hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(dxpl_id, dataset->oloc.addr, FAIL) @@ -1652,7 +1589,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) /* Set up flush append property */ if(H5D__append_flush_setup(dataset, dapl_id)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set up flush append property") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set up flush append property") /* Point at dataset's copy, to cache it for later */ fill_prop = &dataset->shared->dcpl_cache.fill; @@ -1665,7 +1602,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message") } /* end if */ else { - /* For backward compatibility, try to retrieve the old fill value message */ + /* For backward compatibility, try to retrieve the old fill value message */ if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_FILL_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists") if(msg_exists) { @@ -1740,7 +1677,7 @@ done: if(H5F_addr_defined(dataset->oloc.addr) && H5O_close(&(dataset->oloc), NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header") if(dataset->shared) { - if(layout_init) + if(layout_init) if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") if(dataset->shared->space && H5S_close(dataset->shared->space) < 0) @@ -1763,17 +1700,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_close - * - * Purpose: Insures that all data has been saved to the file, closes the - * dataset object header, and frees all resources used by the - * descriptor. + * Function: H5D_close * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Purpose: Insures that all data has been saved to the file, closes the + * dataset object header, and frees all resources used by the + * descriptor. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -1896,7 +1829,7 @@ H5D_close(H5D_t *dataset) if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__GET_CORKED, &corked) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") if(corked) - if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0) + if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object") /* @@ -1920,9 +1853,9 @@ H5D_close(H5D_t *dataset) /* Evict dataset metadata if evicting on close */ if(!file_closed && H5F_SHARED(dataset->oloc.file) && H5F_EVICT_ON_CLOSE(dataset->oloc.file)) { - if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_ind_read_dxpl_id) < 0) + if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_ind_read_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") - if(H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) + if(H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") } /* end if */ @@ -1969,23 +1902,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_mult_refresh_close - * - * Purpose: Closing down the needed information when the dataset has - * multiple opens. (From H5O_refresh_metadata_close()) + * Function: H5D_mult_refresh_close * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Vailin Choi - * 12/24/15 + * Purpose: Closing down the needed information when the dataset has + * multiple opens. (From H5O_refresh_metadata_close()) * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t H5D_mult_refresh_close(hid_t dset_id, hid_t dxpl_id) { - H5D_t *dataset; /* Dataset to refresh */ - herr_t ret_value = SUCCEED; /* return value */ + H5D_t *dataset; /* Dataset to refresh */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2051,16 +1980,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_mult_refresh_reopen - * - * Purpose: Re-initialize the needed info when the dataset has multiple - * opens. (From H5O_refresh_metadata_reopen()) + * Function: H5D_mult_refresh_reopen * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Vailin Choi - * 12/24/15 + * Purpose: Re-initialize the needed info when the dataset has multiple + * opens. (From H5O_refresh_metadata_reopen()) * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2075,25 +2000,25 @@ H5D_mult_refresh_reopen(H5D_t *dataset, hid_t dxpl_id) HDassert(dataset->shared->fo_count > 0); if(dataset->shared->fo_count > 1) { - /* Release dataspace info */ - if(H5S_close(dataset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace") - - /* Re-load dataspace info */ - if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc), dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header") - - /* Cache the dataset's dataspace info */ - if(H5D__cache_dataspace_info(dataset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info") - - /* Release layout info */ - if(H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info") - - /* Re-load layout message info */ - if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout), dxpl_id)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message") + /* Release dataspace info */ + if(H5S_close(dataset->shared->space) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + + /* Re-load dataspace info */ + if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc), dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header") + + /* Cache the dataset's dataspace info */ + if(H5D__cache_dataspace_info(dataset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info") + + /* Release layout info */ + if(H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info") + + /* Re-load layout message info */ + if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout), dxpl_id)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message") } /* end if */ done: @@ -2102,16 +2027,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_oloc - * - * Purpose: Returns a pointer to the object location for a dataset. - * - * Return: Success: Ptr to location - * Failure: NULL + * Function: H5D_oloc * - * Programmer: Robb Matzke - * Friday, April 24, 1998 + * Purpose: Returns a pointer to the object location for a dataset. * + * Return: Success: Ptr to location + * Failure: NULL *------------------------------------------------------------------------- */ H5O_loc_t * @@ -2125,16 +2046,12 @@ H5D_oloc(H5D_t *dataset) /*------------------------------------------------------------------------- - * Function: H5D_nameof + * Function: H5D_nameof * - * Purpose: Returns a pointer to the group hier. path for a dataset. - * - * Return: Success: Ptr to entry - * Failure: NULL - * - * Programmer: Quincey Koziol - * Monday, September 12, 2005 + * Purpose: Returns a pointer to the group hier. path for a dataset. * + * Return: Success: Ptr to entry + * Failure: NULL *------------------------------------------------------------------------- */ H5G_name_t * @@ -2148,17 +2065,13 @@ H5D_nameof(H5D_t *dataset) /*------------------------------------------------------------------------- - * Function: H5D_typeof - * - * Purpose: Returns a pointer to the dataset's datatype. The datatype - * is not copied. - * - * Return: Success: Ptr to the dataset's datatype, uncopied. - * Failure: NULL + * Function: H5D_typeof * - * Programmer: Robb Matzke - * Thursday, June 4, 1998 + * Purpose: Returns a pointer to the dataset's datatype. The datatype + * is not copied. * + * Return: Success: Ptr to the dataset's datatype, uncopied. + * Failure: NULL *------------------------------------------------------------------------- */ H5T_t * @@ -2176,15 +2089,11 @@ H5D_typeof(const H5D_t *dset) /*------------------------------------------------------------------------- - * Function: H5D__alloc_storage + * Function: H5D__alloc_storage * - * Purpose: Allocate storage for the raw data of a dataset. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Friday, January 16, 1998 + * Purpose: Allocate storage for the raw data of a dataset. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2192,11 +2101,11 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, hsize_t old_dim[]) { const H5D_t *dset = io_info->dset; /* The dataset object */ - H5F_t *f = dset->oloc.file; /* The dataset's file pointer */ - H5O_layout_t *layout; /* The dataset's layout information */ - hbool_t must_init_space = FALSE; /* Flag to indicate that space should be initialized */ - hbool_t addr_set = FALSE; /* Flag to indicate that the dataset's storage address was set */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_t *f = dset->oloc.file; /* The dataset's file pointer */ + H5O_layout_t *layout; /* The dataset's layout information */ + hbool_t must_init_space = FALSE; /* Flag to indicate that space should be initialized */ + hbool_t addr_set = FALSE; /* Flag to indicate that the dataset's storage address was set */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2246,19 +2155,18 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, } /* end if */ /* If space allocation is set to 'early' and we are extending - * the dataset, indicate that space should be allocated, so the + * the dataset, indicate that space should be allocated, so the * index gets expanded. -QAK */ - if(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY - && time_alloc == H5D_ALLOC_EXTEND) - must_init_space = TRUE; + if(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY && time_alloc == H5D_ALLOC_EXTEND) + must_init_space = TRUE; break; case H5D_COMPACT: /* Check if space is already allocated */ if(NULL == layout->storage.u.compact.buf) { - /* Reserve space in layout header message for the entire array. - * Starting from the 1.8.7 release, we allow dataspace to have + /* Reserve space in layout header message for the entire array. + * Starting from the 1.8.7 release, we allow dataspace to have * zero dimension size. So the storage size can be zero. * SLU 2011/4/4 */ if(layout->storage.u.compact.size > 0) { @@ -2270,7 +2178,8 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, /* Indicate that we should initialize storage space */ must_init_space = TRUE; - } else { + } + else { layout->storage.u.compact.dirty = FALSE; must_init_space = FALSE; } @@ -2312,7 +2221,7 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value") } /* end if */ else { - H5D_fill_value_t fill_status; /* The fill value status */ + H5D_fill_value_t fill_status; /* The fill value status */ /* Check the dataset's fill-value status */ if(H5P_is_fill_value_defined(&dset->shared->dcpl_cache.fill, &fill_status) < 0) @@ -2346,24 +2255,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__init_storage + * Function: H5D__init_storage * - * Purpose: Initialize the data for a new dataset. If a selection is - * defined for SPACE then initialize only that part of the - * dataset. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Monday, October 5, 1998 + * Purpose: Initialize the data for a new dataset. If a selection is + * defined for SPACE then initialize only that part of the + * dataset. * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]) { const H5D_t *dset = io_info->dset; /* dataset pointer */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2422,22 +2327,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_storage_size - * - * Purpose: Determines how much space has been reserved to store the raw - * data of a dataset. + * Function: H5D__get_storage_size * - * Return: Non-negative on success, negative on failure - * - * Programmer: Robb Matzke - * Wednesday, April 21, 1999 + * Purpose: Determines how much space has been reserved to store the raw + * data of a dataset. * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ herr_t H5D__get_storage_size(H5D_t *dset, hid_t dxpl_id, hsize_t *storage_size) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, dset->oloc.addr, FAIL) @@ -2481,24 +2382,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_offset - * - * Purpose: Private function for H5D__get_offset. Returns the address - * of dataset in file. - * - * Return: Success: the address of dataset - * - * Failure: HADDR_UNDEF + * Function: H5D__get_offset * - * Programmer: Raymond Lu - * November 6, 2002 + * Purpose: Private function for H5D__get_offset. Returns the address + * of dataset in file. * + * Return: Success: the address of dataset + * Failure: HADDR_UNDEF *------------------------------------------------------------------------- */ haddr_t H5D__get_offset(const H5D_t *dset) { - haddr_t ret_value = HADDR_UNDEF; + haddr_t ret_value = HADDR_UNDEF; FUNC_ENTER_PACKAGE @@ -2530,18 +2426,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_vlen_reclaim + * Function: H5D_vlen_reclaim * - * Purpose: Frees the buffers allocated for storing variable-length data - * in memory. Only frees the VL data in the selection defined in the - * dataspace. The dataset transfer property list is required to find the - * correct allocation/free methods for the VL data in the buffer. - * - * Return: Non-negative on success, negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, November 22, 2005 + * Purpose: Frees the buffers allocated for storing variable-length data + * in memory. Only frees the VL data in the selection defined in the + * dataspace. The dataset transfer property list is required to find the + * correct allocation/free methods for the VL data in the buffer. * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2551,7 +2443,7 @@ H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, void *buf) H5S_sel_iter_op_t dset_op; /* Operator for iteration */ H5T_vlen_alloc_info_t _vl_alloc_info; /* VL allocation info buffer */ H5T_vlen_alloc_info_t *vl_alloc_info = &_vl_alloc_info; /* VL allocation info */ - herr_t ret_value = FAIL; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2581,18 +2473,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__vlen_get_buf_size_alloc - * - * Purpose: This routine makes certain there is enough space in the temporary - * buffer for the new data to read in. All the VL data read in is actually - * placed in this buffer, overwriting the previous data. Needless to say, - * this data is not actually usable. - * - * Return: Non-negative on success, negative on failure + * Function: H5D__vlen_get_buf_size_alloc * - * Programmer: Quincey Koziol - * Tuesday, August 17, 1999 + * Purpose: This routine makes certain there is enough space in the temporary + * buffer for the new data to read in. All the VL data read in is actually + * placed in this buffer, overwriting the previous data. Needless to say, + * this data is not actually usable. * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ void * @@ -2615,14 +2503,14 @@ H5D__vlen_get_buf_size_alloc(size_t size, void *info) /*------------------------------------------------------------------------- - * Function: H5D__vlen_get_buf_size + * Function: H5D__vlen_get_buf_size * - * Purpose: This routine checks the number of bytes required to store a single - * element from a dataset in memory, creating a selection with just the - * single element selected to read in the element and using a custom memory - * allocator for any VL data encountered. - * The *size value is modified according to how many bytes are - * required to store the element in memory. + * Purpose: This routine checks the number of bytes required to store a single + * element from a dataset in memory, creating a selection with just the + * single element selected to read in the element and using a custom memory + * allocator for any VL data encountered. + * The *size value is modified according to how many bytes are + * required to store the element in memory. * * Implementation: This routine actually performs the read with a custom * memory manager which basically just counts the bytes requested and @@ -2632,11 +2520,7 @@ H5D__vlen_get_buf_size_alloc(size_t size, void *info) * Kinda kludgy, but easier than the other method of trying to figure out * the sizes without actually reading the data in... - QAK * - * Return: Non-negative on success, negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, August 17, 1999 - * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2673,15 +2557,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__check_filters - * - * Purpose: Check if the filters have be initialized for the dataset - * - * Return: Non-negative on success/Negative on failure + * Function: H5D__check_filters * - * Programmer: Quincey Koziol - * Thursday, October 11, 2007 + * Purpose: Check if the filters have be initialized for the dataset * + * Return: Non-negative on success/Negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2727,16 +2607,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__set_extent + * Function: H5D__set_extent * - * Purpose: Based on H5D_extend, allows change to a lower dimension, - * calls H5S_set_extent and H5D__chunk_prune_by_extent instead - * - * Return: Non-negative on success, negative on failure - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * April 9, 2002 + * Purpose: Based on H5D_extend, allows change to a lower dimension, + * calls H5S_set_extent and H5D__chunk_prune_by_extent instead * + * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ herr_t @@ -2810,7 +2686,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) dset->shared->cache.chunk.scaled_dims[u] > dset->shared->cache.chunk.nslots)) update_chunks = TRUE; - if( !(scaled_power2up = H5VM_power2up(scaled)) ) + if(!(scaled_power2up = H5VM_power2up(scaled))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") /* Check if the number of bits required to encode the scaled size value changed */ @@ -2899,7 +2775,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) && (dset->shared->dcpl_cache.pline.nused > 0)) if(H5D__chunk_update_old_edge_chunks(dset, dxpl_id, curr_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to do update old edge chunks") - } /* end if */ + } /* end if */ /* Mark the dataspace as dirty, for later writing to the file */ if(H5D__mark(dset, dxpl_id, H5D_MARK_SPACE) < 0) @@ -2912,16 +2788,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__flush_sieve_buf + * Function: H5D__flush_sieve_buf * - * Purpose: Flush any dataset sieve buffer info cached in memory - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * July 27, 2009 + * Purpose: Flush any dataset sieve buffer info cached in memory * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -2953,16 +2825,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__flush_real - * - * Purpose: Flush any dataset information cached in memory - * - * Return: Success: Non-negative - * Failure: Negative + * Function: H5D__flush_real * - * Programmer: Quincey Koziol - * December 6, 2007 + * Purpose: Flush any dataset information cached in memory * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -2990,29 +2858,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__format_convert + * Function: H5D__format_convert * - * Purpose: For chunked: downgrade the chunk indexing type to version 1 B-tree - * For compact/contiguous: downgrade layout version to 3 - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Vailin Choi - * Feb 2015 + * Purpose: For chunked: downgrade the chunk indexing type to version 1 B-tree + * For compact/contiguous: downgrade layout version to 3 * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5D__format_convert(H5D_t *dataset, hid_t dxpl_id) { - H5D_chk_idx_info_t new_idx_info; /* Index info for the new layout */ - H5D_chk_idx_info_t idx_info; /* Index info for the current layout */ + H5D_chk_idx_info_t new_idx_info; /* Index info for the new layout */ + H5D_chk_idx_info_t idx_info; /* Index info for the current layout */ H5O_layout_t *newlayout = NULL; /* The new layout */ hbool_t init_new_index = FALSE; /* Indicate that the new chunk index is initialized */ - hbool_t delete_old_layout = FALSE; /* Indicate that the old layout message is deleted */ + hbool_t delete_old_layout = FALSE; /* Indicate that the old layout message is deleted */ hbool_t add_new_layout = FALSE; /* Indicate that the new layout message is added */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, dataset->oloc.addr, FAIL) @@ -3062,7 +2926,7 @@ H5D__format_convert(H5D_t *dataset, hid_t dxpl_id) if((new_idx_info.storage->ops->create)(&new_idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index") - /* Iterate over the chunks in the current index and insert the chunk addresses + /* Iterate over the chunks in the current index and insert the chunk addresses * into the version 1 B-tree chunk index */ if(H5D__chunk_format_convert(dataset, &idx_info, &new_idx_info) < 0) @@ -3105,7 +2969,7 @@ H5D__format_convert(H5D_t *dataset, hid_t dxpl_id) case H5D_NLAYOUTS: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type") - default: + default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type") } /* end switch */ @@ -3147,16 +3011,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__mark - * - * Purpose: Mark some aspect of a dataset as dirty + * Function: H5D__mark * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * July 4, 2008 + * Purpose: Mark some aspect of a dataset as dirty * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t @@ -3212,24 +3072,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__flush_cb - * - * Purpose: Flush any dataset information cached in memory + * Function: H5D__flush_cb * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * November 8, 2007 + * Purpose: Flush any dataset information cached in memory * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ static int H5D__flush_cb(void *_dataset, hid_t H5_ATTR_UNUSED id, void *_udata) { - H5D_t *dataset = (H5D_t *)_dataset; /* Dataset pointer */ + H5D_t *dataset = (H5D_t *)_dataset; /* Dataset pointer */ H5D_flush_ud_t *udata = (H5D_flush_ud_t *)_udata; /* User data for callback */ - int ret_value = H5_ITER_CONT; /* Return value */ + int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_STATIC @@ -3249,23 +3105,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_flush - * - * Purpose: Flush any dataset information cached in memory + * Function: H5D_flush * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Ray Lu - * August 14, 2002 + * Purpose: Flush any dataset information cached in memory * + * Return: Success: Non-negative + * Failure: Negative *------------------------------------------------------------------------- */ herr_t H5D_flush(const H5F_t *f, hid_t dxpl_id) { - H5D_flush_ud_t udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_flush_ud_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3286,19 +3138,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_get_create_plist - * - * Purpose: Private function for H5Dget_create_plist - * - * Return: Success: ID for a copy of the dataset creation - * property list. The template should be - * released by calling H5P_close(). + * Function: H5D_get_create_plist * - * Failure: FAIL - * - * Programmer: Robb Matzke - * Tuesday, February 3, 1998 + * Purpose: Private function for H5Dget_create_plist * + * Return: Success: ID for a copy of the dataset creation + * property list. The template should be + * released by calling H5P_close(). + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t @@ -3309,8 +3156,8 @@ H5D_get_create_plist(H5D_t *dset) H5O_layout_t copied_layout; /* Layout to tweak */ H5O_fill_t copied_fill; /* Fill value to tweak */ H5O_efl_t copied_efl; /* External file list to tweak */ - hid_t new_dcpl_id = FAIL; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t new_dcpl_id = FAIL; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3351,7 +3198,7 @@ H5D_get_create_plist(H5D_t *dset) /* Reset index info, if the chunk ops are set */ if(copied_layout.storage.u.chunk.ops) - /* Reset address and pointer of the array struct for the chunked storage index */ + /* Reset address and pointer of the array struct for the chunked storage index */ if(H5D_chunk_idx_reset(&copied_layout.storage.u.chunk, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest") @@ -3468,18 +3315,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_get_access_plist - * - * Purpose: Returns a copy of the dataset access property list. - * - * Return: Success: ID for a copy of the dataset access - * property list. - * - * Failure: FAIL + * Function: H5D_get_access_plist * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Purpose: Returns a copy of the dataset access property list. * + * Return: Success: ID for a copy of the dataset access + * property list. + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t @@ -3537,24 +3379,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_get_space - * - * Purpose: Returns and ID for the dataspace of the dataset. - * - * Return: Success: ID for dataspace - * - * Failure: FAIL + * Function: H5D_get_space * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Purpose: Returns and ID for the dataspace of the dataset. * + * Return: Success: ID for dataspace + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5D_get_space(H5D_t *dset) { - H5S_t *space = NULL; - hid_t ret_value = H5I_INVALID_HID; + H5S_t *space = NULL; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI_NOINIT @@ -3582,24 +3419,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_get_type + * Function: H5D_get_type * - * Purpose: Returns and ID for the datatype of the dataset. - * - * Return: Success: ID for datatype - * - * Failure: FAIL - * - * Programmer: Mohamad Chaarawi - * March, 2012 + * Purpose: Returns and ID for the datatype of the dataset. * + * Return: Success: ID for datatype + * Failure: FAIL *------------------------------------------------------------------------- */ hid_t H5D_get_type(H5D_t *dset) { - H5T_t *dt = NULL; - hid_t ret_value = FAIL; + H5T_t *dt = NULL; + hid_t ret_value = FAIL; FUNC_ENTER_NOAPI_NOINIT @@ -3633,15 +3465,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__refresh + * Function: H5D__refresh * - * Purpose: Refreshes all buffers associated with a dataset. - * - * Return: SUCCEED/FAIL - * - * Programmer: Dana Robinson - * November 2015 + * Purpose: Refreshes all buffers associated with a dataset. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ herr_t @@ -3668,7 +3496,7 @@ H5D__refresh(hid_t dset_id, H5D_t *dset, hid_t dxpl_id) if(H5D__virtual_refresh_source_dsets(dset, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh VDS source datasets") } /* end if */ - + /* Refresh dataset object */ if((H5O_refresh_metadata(dset_id, dset->oloc, dxpl_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh dataset") |