summaryrefslogtreecommitdiffstats
path: root/src/H5Dint.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2018-04-29 08:04:21 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2018-04-29 08:04:21 (GMT)
commit01f196b31a03f072b685f998b0805c1f90322c2b (patch)
tree6e1cae004705ade1c870e4c6612a76b55be3c331 /src/H5Dint.c
parentda4b69097756158fdbfcbf52b5b552e2034d263d (diff)
parentb3c5284692093953132c6c8227e0980b670bf4ad (diff)
downloadhdf5-01f196b31a03f072b685f998b0805c1f90322c2b.zip
hdf5-01f196b31a03f072b685f998b0805c1f90322c2b.tar.gz
hdf5-01f196b31a03f072b685f998b0805c1f90322c2b.tar.bz2
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/hdffv/hdf5 into merge_hyperslab_updates
Diffstat (limited to 'src/H5Dint.c')
-rw-r--r--src/H5Dint.c1785
1 files changed, 822 insertions, 963 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index febf76a..b9d9cce 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -5,12 +5,10 @@
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from help@hdfgroup.org. *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/****************/
@@ -23,14 +21,15 @@
/***********/
/* 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 "H5CXprivate.h" /* API Contexts */
+#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 */
/****************/
@@ -42,41 +41,31 @@
/* Local Typedefs */
/******************/
-/* Struct for holding callback info during H5D_flush operation */
-typedef struct {
- const H5F_t *f; /* Pointer to file being flushed */
- hid_t dxpl_id; /* DXPL for I/O operations */
-} H5D_flush_ud_t;
-
/********************/
/* Local Prototypes */
/********************/
/* 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);
+static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, 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);
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);
-static herr_t H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id,
- char **extfile_prefix);
-static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id);
+static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id);
+static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id,
+ const char *prefix_type, char **file_prefix);
+static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_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__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size);
static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id);
+static herr_t H5D__close_cb(H5D_t *dataset);
/*********************/
/* Package Variables */
/*********************/
-/* Define a "default" dataset transfer property list cache structure to use for default DXPLs */
-H5D_dxpl_cache_t H5D_def_dxpl_cache;
-
/* Declare a free list to manage blocks of VL data */
H5FL_BLK_DEFINE(vlen_vl_buf);
@@ -111,10 +100,10 @@ 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_free_t)H5D_close /* Callback routine for closing objects of this class */
+ H5I_DATASET, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5D__close_cb /* Callback routine for closing objects of this class */
}};
/* Flag indicating "top" of interface has been initialized */
@@ -123,17 +112,13 @@ static hbool_t H5D_top_package_initialize_s = FALSE;
/*-------------------------------------------------------------------------
- * Function: H5D_init
- *
- * Purpose: Initialize the interface from some other layer.
+ * Function: H5D_init
*
- * Return: Success: non-negative
+ * Purpose: Initialize the interface from some other layer.
*
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Saturday, March 4, 2000
+ * Return: Success: non-negative
*
+ * Failure: negative
*-------------------------------------------------------------------------
*/
herr_t
@@ -151,7 +136,7 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5D__init_package -- Initialize interface-specific information
+ H5D__init_package -- Initialize interface-specific information
USAGE
herr_t H5D__init_package()
@@ -197,13 +182,6 @@ H5D__init_package(void)
if(H5P_get(def_dcpl, H5O_CRT_PIPELINE_NAME, &H5D_def_dset.dcpl_cache.pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter")
- /* Reset the "default DXPL cache" information */
- HDmemset(&H5D_def_dxpl_cache, 0, sizeof(H5D_dxpl_cache_t));
-
- /* Get the default DXPL cache information */
- if(H5D__get_dxpl_cache_real(H5P_DATASET_XFER_DEFAULT, &H5D_def_dxpl_cache) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve default DXPL info")
-
/* Mark "top" of interface as initialized, too */
H5D_top_package_initialize_s = TRUE;
@@ -213,28 +191,24 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_top_term_package
- *
- * Purpose: Close the "top" of the interface, releasing IDs, etc.
+ * Function: H5D_top_term_package
*
- * Return: Success: Positive if anything was done that might
- * affect other interfaces; zero otherwise.
- * Failure: Negative.
- *
- * 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
@@ -257,9 +231,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)
@@ -271,26 +245,22 @@ H5D_top_term_package(void)
/*-------------------------------------------------------------------------
- * Function: H5D_term_package
- *
- * Purpose: Terminate this interface.
- *
- * Note: Finishes shutting down the interface, after
- * H5D_top_term_package() is called
+ * Function: H5D_term_package
*
- * Return: Success: Positive if anything was done that might
- * affect other interfaces; zero otherwise.
- * Failure: Negative.
+ * Purpose: Terminate this interface.
*
- * 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
@@ -311,160 +281,25 @@ H5D_term_package(void)
} /* end H5D_term_package() */
-/*--------------------------------------------------------------------------
- NAME
- H5D__get_dxpl_cache_real
- PURPOSE
- Get all the values for the DXPL cache.
- USAGE
- herr_t H5D__get_dxpl_cache_real(dxpl_id, cache)
- hid_t dxpl_id; IN: DXPL to query
- H5D_dxpl_cache_t *cache;IN/OUT: DXPL cache to fill with values
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Query all the values from a DXPL that are needed by internal routines
- within the library.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5D__get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache)
-{
- H5P_genplist_t *dx_plist; /* Data transfer property list */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Check args */
- HDassert(cache);
-
- /* Get the dataset transfer property list */
- if(NULL == (dx_plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
-
- /* Get maximum temporary buffer size */
- if(H5P_get(dx_plist, H5D_XFER_MAX_TEMP_BUF_NAME, &cache->max_temp_buf) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve maximum temporary buffer size")
-
- /* Get temporary buffer pointer */
- if(H5P_get(dx_plist, H5D_XFER_TCONV_BUF_NAME, &cache->tconv_buf) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve temporary buffer pointer")
-
- /* Get background buffer pointer */
- if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_NAME, &cache->bkgr_buf) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer pointer")
-
- /* Get background buffer type */
- if(H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &cache->bkgr_buf_type) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type")
-
- /* Get B-tree split ratios */
- if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &cache->btree_split_ratio) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios")
-
- /* Get I/O vector size */
- if(H5P_get(dx_plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &cache->vec_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve I/O vector size")
-
-#ifdef H5_HAVE_PARALLEL
- /* Collect Parallel I/O information for possible later use */
- if(H5P_get(dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &cache->xfer_mode) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method")
- if(H5P_get(dx_plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &cache->coll_opt_mode) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve collective transfer option")
-#endif /* H5_HAVE_PARALLEL */
-
- /* Get error detection properties */
- if(H5P_get(dx_plist, H5D_XFER_EDC_NAME, &cache->err_detect) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve error detection info")
-
- /* Get filter callback function */
- if(H5P_get(dx_plist, H5D_XFER_FILTER_CB_NAME, &cache->filter_cb) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve filter callback function")
-
- /* Look at the data transform property */
- /* (Note: 'peek', not 'get' - if this turns out to be a problem, we should
- * add a H5D__free_dxpl_cache() routine. -QAK)
- */
- if(H5P_peek(dx_plist, H5D_XFER_XFORM_NAME, &cache->data_xform_prop) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve data transform info")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__get_dxpl_cache_real() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5D__get_dxpl_cache
- PURPOSE
- Get all the values for the DXPL cache.
- USAGE
- herr_t H5D__get_dxpl_cache(dxpl_id, cache)
- hid_t dxpl_id; IN: DXPL to query
- H5D_dxpl_cache_t *cache;IN/OUT: DXPL cache to fill with values
- RETURNS
- Non-negative on success/Negative on failure.
- DESCRIPTION
- Query all the values from a DXPL that are needed by internal routines
- within the library.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- The CACHE pointer should point at already allocated memory to place
- non-default property list info. If a default property list is used, the
- CACHE pointer will be changed to point at the default information.
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5D__get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t **cache)
-{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- /* Check args */
- HDassert(cache);
-
- /* Check for the default DXPL */
- if(dxpl_id==H5P_DATASET_XFER_DEFAULT)
- *cache=&H5D_def_dxpl_cache;
- else
- if(H5D__get_dxpl_cache_real(dxpl_id,*cache) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't retrieve DXPL values")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5D__get_dxpl_cache() */
-
-
/*-------------------------------------------------------------------------
- * Function: H5D__create_named
- *
- * Purpose: Internal routine to create a new dataset.
- *
- * Return: Success: Non-NULL, pointer to new dataset object.
+ * Function: H5D__create_named
*
- * Failure: NULL
+ * Purpose: Internal routine to create a new dataset.
*
- * Programmer: Quincey Koziol
- * Thursday, April 5, 2007
+ * Return: Success: Non-NULL, pointer to new dataset object.
*
+ * Failure: NULL
*-------------------------------------------------------------------------
*/
H5D_t *
H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id,
- const H5S_t *space, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id,
- hid_t dxpl_id)
+ const H5S_t *space, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_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
+ FUNC_ENTER_PACKAGE_VOL
/* Check arguments */
HDassert(loc);
@@ -474,7 +309,6 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id,
HDassert(lcpl_id != H5P_DEFAULT);
HDassert(dcpl_id != H5P_DEFAULT);
HDassert(dapl_id != H5P_DEFAULT);
- HDassert(dxpl_id != H5P_DEFAULT);
/* Set up dataset creation info */
dcrt_info.type_id = type_id;
@@ -488,7 +322,7 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id,
ocrt_info.new_obj = NULL;
/* Create the new dataset and link it to its parent group */
- if(H5L_link_object(loc, name, &ocrt_info, lcpl_id, dapl_id, dxpl_id) < 0)
+ if(H5L_link_object(loc, name, &ocrt_info, lcpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create and link to dataset")
HDassert(ocrt_info.new_obj);
@@ -496,40 +330,78 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id,
ret_value = (H5D_t *)ocrt_info.new_obj;
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_VOL(ret_value)
} /* end H5D__create_named() */
/*-------------------------------------------------------------------------
+ * Function: H5D__create_anon
+ *
+ * Purpose: Internal routine to create a new anonymous dataset.
+ *
+ * Note: This routine is needed so that there's a non-API routine for
+ * creating datasets that can set up VOL / SWMR info
+ * (which need a DXPL).
+ *
+ * Return: Success: Non-NULL, pointer to new dataset object.
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * December 9, 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+H5D_t *
+H5D__create_anon(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
+ hid_t dapl_id)
+{
+ H5D_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_PACKAGE_VOL
+
+ /* Check arguments */
+ HDassert(file);
+ HDassert(type_id != H5P_DEFAULT);
+ HDassert(space);
+ HDassert(dcpl_id != H5P_DEFAULT);
+ HDassert(dapl_id != H5P_DEFAULT);
+
+ /* Build and open the dataset */
+ if(NULL == (ret_value = H5D__create(file, type_id, space, dcpl_id, dapl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset")
+
+done:
+ FUNC_LEAVE_NOAPI_VOL(ret_value)
+} /* end H5D__create_anon() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__get_space_status
*
* Purpose: Returns the status of dataspace allocation.
*
* Return:
* Success: Non-negative
- *
* Failture: Negative
- *
- * Programmer: Raymond Lu
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5D__get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id)
+H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation)
{
- hsize_t space_allocated; /* The number of bytes allocated for chunks */
- hssize_t snelmts; /* Temporary holder for number of elements in dataspace */
- hsize_t nelmts; /* Number of elements in dataspace */
- size_t dt_size; /* Size of datatype */
- hsize_t full_size; /* The number of bytes in the dataset when fully populated */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE_VOL
HDassert(dset);
/* Check for chunked layout */
if(dset->shared->layout.type == H5D_CHUNKED) {
+ hsize_t space_allocated; /* The number of bytes allocated for chunks */
+ hssize_t snelmts; /* Temporary holder for number of elements in dataspace */
+ hsize_t nelmts; /* Number of elements in dataspace */
+ size_t dt_size; /* Size of datatype */
+ hsize_t full_size; /* The number of bytes in the dataset when fully populated */
+
/* For chunked layout set the space status by the storage size */
/* Get the dataset's dataspace */
HDassert(dset->shared->space);
@@ -551,7 +423,7 @@ H5D__get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id
HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed")
/* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */
- if(H5D__get_storage_size(dset, dxpl_id, &space_allocated) < 0)
+ if(H5D__get_storage_size_real(dset, &space_allocated) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage")
/* Decide on how much of the space is allocated */
@@ -559,7 +431,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 {
@@ -572,22 +444,17 @@ H5D__get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_VOL(ret_value)
} /* end H5D__get_space_status() */
/*-------------------------------------------------------------------------
- * Function: H5D__new
- *
- * Purpose: Creates a new, empty dataset structure
- *
- * Return: Success: Pointer to a new dataset descriptor.
- *
- * Failure: NULL
+ * Function: H5D__new
*
- * 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 *
@@ -638,26 +505,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_at_least_v18; /* Flag indicating to use at least v18 format versions */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -674,17 +537,17 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
if((immutable = H5T_is_immutable(type)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?")
- /* Get the file's 'use the latest datatype version support' flag */
- use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATATYPE);
+ /* To use at least v18 format versions or not */
+ use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
/* Copy the datatype if it's a custom datatype or if it'll change when it's location is changed */
- if(!immutable || relocatable || use_latest_format) {
+ if(!immutable || relocatable || use_at_least_v18) {
/* Copy datatype for dataset */
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")
@@ -692,14 +555,13 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
if(H5T_set_loc(dset->shared->type, file, H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't set datatype location")
- /* Set the latest format, if requested */
- if(use_latest_format)
- if(H5T_set_latest_version(dset->shared->type) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
+ /* Set the version for datatype */
+ if(H5T_set_version(file, dset->shared->type) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set 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 {
@@ -717,16 +579,12 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__cache_dataspace_info
+ * Function: H5D__cache_dataspace_info
*
- * Purpose: Cache dataspace info for a dataset
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * Wednesday, November 19, 2014
+ * Purpose: Cache dataspace info for a dataset
*
+ * Return: Success: SUCCEED
+ * Failure: FAIL
*-------------------------------------------------------------------------
*/
static herr_t
@@ -747,8 +605,13 @@ H5D__cache_dataspace_info(const H5D_t *dset)
dset->shared->ndims = (unsigned)sndims;
/* Compute the inital 'power2up' values */
- for(u = 0; u < dset->shared->ndims; u++)
- dset->shared->curr_power2up[u] = H5VM_power2up(dset->shared->curr_dims[u]);
+ for(u = 0; u < dset->shared->ndims; u++) {
+ hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */
+
+ if( !(scaled_power2up = H5VM_power2up(dset->shared->curr_dims[u])) )
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2")
+ dset->shared->curr_power2up[u] = scaled_power2up;
+ } /* end for */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -756,23 +619,18 @@ 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
H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
{
- hbool_t use_latest_format; /* Flag indicating the 'latest dataspace version support' is enabled */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -782,9 +640,6 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
HDassert(dset);
HDassert(space);
- /* Get the file's 'use the latest dataspace version support' flag */
- use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATASPACE);
-
/* Copy dataspace for dataset */
if(NULL == (dset->shared->space = H5S_copy(space, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace")
@@ -793,10 +648,9 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
if(H5D__cache_dataspace_info(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info")
- /* Set the latest format, if requested */
- if(use_latest_format)
- if(H5S_set_latest_version(dset->shared->space) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
+ /* Set the version for dataspace */
+ if(H5S_set_version(file, dset->shared->space) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
/* Set the dataset's dataspace to 'all' selection */
if(H5S_select_all(dset->shared->space, TRUE) < 0)
@@ -808,30 +662,27 @@ 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
-H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
+H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
{
H5O_t *oh = NULL; /* Pointer to dataset's object header */
size_t ohdr_size = H5D_MINHDR_SIZE; /* Size of dataset's object header */
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 */
+ hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -846,6 +697,9 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
type = dset->shared->type;
fill_prop = &dset->shared->dcpl_cache.fill;
+ /* To use at least v18 format versions or not */
+ use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
+
/* Retrieve "defined" status of fill value */
if(H5P_is_fill_value_defined(fill_prop, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
@@ -869,13 +723,14 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
/* Determine whether fill value is defined or not */
if(fill_status == H5D_FILL_VALUE_DEFAULT || fill_status == H5D_FILL_VALUE_USER_DEFINED) {
/* Convert fill value buffer to dataset's datatype */
- if(fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(fill_prop, type, &fill_changed, dxpl_id) < 0)
+ if(fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(fill_prop, type, &fill_changed) < 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;
+ } /* end if */
+ 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 */
@@ -901,29 +756,29 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
ohdr_size += layout->storage.u.compact.size;
/* Create an object header for the dataset */
- if(H5O_create(file, dxpl_id, ohdr_size, (size_t)1, dset->shared->dcpl_id, oloc/*out*/) < 0)
+ if(H5O_create(file, ohdr_size, (size_t)1, dset->shared->dcpl_id, oloc/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset object header")
HDassert(file == dset->oloc.file);
/* Pin the object header */
- if(NULL == (oh = H5O_pin(oloc, dxpl_id)))
+ if(NULL == (oh = H5O_pin(oloc)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header")
/* Write the dataspace header message */
- if(H5S_append(file, dxpl_id, oh, dset->shared->space) < 0)
+ if(H5S_append(file, oh, dset->shared->space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update dataspace header message")
/* Write the datatype header message */
- if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT, 0, type) < 0)
+ if(H5O_msg_append_oh(file, oh, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT, 0, type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update datatype header message")
/* Write new fill value message */
- if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_FILL_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, fill_prop) < 0)
+ if(H5O_msg_append_oh(file, oh, H5O_FILL_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, fill_prop) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update new fill value header message")
/* If there is valid information for the old fill value struct, add it */
- /* (only if we aren't trying to write the 'latest fill message version support') */
- if(fill_prop->buf && !(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG))) {
+ /* (only if we aren't using v18 format versions and above */
+ if(fill_prop->buf && !use_at_least_v18) {
H5O_fill_t old_fill_prop; /* Copy of fill value property, for writing as "old" fill value */
/* Shallow copy the fill value property */
@@ -934,12 +789,12 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
H5O_msg_reset_share(H5O_FILL_ID, &old_fill_prop);
/* Write old fill value */
- if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_FILL_ID, H5O_MSG_FLAG_CONSTANT, 0, &old_fill_prop) < 0)
+ if(H5O_msg_append_oh(file, oh, H5O_FILL_ID, H5O_MSG_FLAG_CONSTANT, 0, &old_fill_prop) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update old fill value header message")
} /* end if */
/* Update/create the layout (and I/O pipeline & EFL) messages */
- if(H5D__layout_oh_create(file, dxpl_id, oh, dset, dapl_id) < 0)
+ if(H5D__layout_oh_create(file, oh, dset, dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout/pline/efl header message")
/* Indicate that the layout information was initialized */
@@ -958,28 +813,28 @@ 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, oh, bogus_id, (unsigned)bogus_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message")
} /* end if */
}
#endif /* H5O_ENABLE_BOGUS */
/* Add a modification time message, if using older format. */
- /* (If using the latest 'no modification time message' version support, the modification time is part of the object
+ /* (If using v18 format versions and above, the the modification time is part of the object
* header and doesn't use a separate message -QAK)
*/
- if(!(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_NO_MOD_TIME_MSG)))
- if(H5O_touch_oh(file, dxpl_id, oh, TRUE) < 0)
+ if(!use_at_least_v18)
+ if(H5O_touch_oh(file, oh, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message")
done:
@@ -992,57 +847,60 @@ done:
if(ret_value < 0)
if(layout_init)
/* Destroy the layout information for the dataset */
- if(dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset, dxpl_id) < 0)
+ if(dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__update_oh_info() */
+
/*--------------------------------------------------------------------------
- * Function: H5D_build_extfile_prefix
+ * Function: H5D__build_file_prefix
*
- * Purpose: Determine the external file prefix to be used and store
- * it in extfile_prefix. Stores an empty string if no prefix
+ * Purpose: Determine the file prefix to be used and store
+ * it in file_prefix. Stores an empty string if no prefix
* should be used.
*
* Return: SUCCEED/FAIL
- *
- * Programmer: Steffen Kiess
- * October 16, 2015
*--------------------------------------------------------------------------
*/
static herr_t
-H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix /*out*/)
+H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type,
+ char **file_prefix /*out*/)
{
char *prefix = NULL; /* prefix used to look for the file */
- char *extpath = NULL; /* absolute path of directory the HDF5 file is in */
- size_t extpath_len; /* length of extpath */
+ char *filepath = NULL; /* absolute path of directory the HDF5 file is in */
+ size_t filepath_len; /* length of file path */
size_t prefix_len; /* length of prefix */
- size_t extfile_prefix_len; /* length of expanded prefix */
+ size_t file_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
+ FUNC_ENTER_STATIC
+ /* Sanity checks */
HDassert(dset);
HDassert(dset->oloc.file);
-
- extpath = H5F_EXTPATH(dset->oloc.file);
- HDassert(extpath);
+ filepath = H5F_EXTPATH(dset->oloc.file);
+ HDassert(filepath);
/* XXX: Future thread-safety note - getenv is not required
* to be reentrant.
*/
- prefix = HDgetenv("HDF5_EXTFILE_PREFIX");
+ if(HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0)
+ prefix = HDgetenv("HDF5_VDS_PREFIX");
+ else if (HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0)
+ prefix = HDgetenv("HDF5_EXTFILE_PREFIX");
+ else
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible")
if(prefix == NULL || *prefix == '\0') {
- /* Set prefix to value of H5D_ACS_EFILE_PREFIX_NAME property */
+ /* Set prefix to value of prefix_type property */
if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- if(H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix")
+ if(H5P_peek(plist, prefix_type, &prefix) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file prefix")
} /* end if */
/* Prefix has to be checked for NULL / empty string again because the
@@ -1052,58 +910,53 @@ H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix
/* filename is interpreted as relative to the current directory,
* does not need to be expanded
*/
- if(NULL == (*extfile_prefix = (char *)H5MM_strdup("")))
+ if(NULL == (*file_prefix = (char *)H5MM_strdup("")))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
} /* end if */
else {
if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) {
/* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */
- extpath_len = HDstrlen(extpath);
+ filepath_len = HDstrlen(filepath);
prefix_len = HDstrlen(prefix);
- extfile_prefix_len = extpath_len + prefix_len - HDstrlen("${ORIGIN}") + 1;
-
- if(NULL == (*extfile_prefix = (char *)H5MM_malloc(extfile_prefix_len)))
+ file_prefix_len = filepath_len + prefix_len - HDstrlen("${ORIGIN}") + 1;
+
+ if(NULL == (*file_prefix = (char *)H5MM_malloc(file_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}"));
+ HDsnprintf(*file_prefix, file_prefix_len, "%s%s", filepath, prefix + HDstrlen("${ORIGIN}"));
} /* end if */
else {
- if(NULL == (*extfile_prefix = (char *)H5MM_strdup(prefix)))
+ if(NULL == (*file_prefix = (char *)H5MM_strdup(prefix)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
} /* end else */
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5D_build_extfile_prefix() */
+} /* H5D__build_file_prefix() */
/*-------------------------------------------------------------------------
- * 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)
+ hid_t dapl_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 */
@@ -1111,7 +964,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
@@ -1120,7 +973,6 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
HDassert(H5I_DATATYPE == H5I_get_type(type_id));
HDassert(space);
HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id));
- HDassert(H5I_GENPROP_LST == H5I_get_type(dxpl_id));
/* Get the dataset's datatype */
if(NULL == (type = (const H5T_t *)H5I_object(type_id)))
@@ -1210,33 +1062,22 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
/* Don't allow compact datasets to allocate space later */
if(layout->type == H5D_COMPACT && fill->alloc_time != H5D_ALLOC_TIME_EARLY)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "compact dataset must have early space allocation")
-
- /* If MPI VFD is used, no filter support yet. */
- if(H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI) && pline->nused > 0)
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel I/O does not support filters yet")
} /* end if */
- /* 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")
-
- /* 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")
-
- /* 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")
- } /* end if */
- else if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
- /* Use latest indexing type for layout message version >= 4 */
+ /* Set the version for the I/O pipeline message */
+ if(H5O_pline_set_version(file, &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 version for the fill message */
+ if(H5O_fill_set_version(file, &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(H5D__layout_set_version(file, &new_dset->shared->layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout")
+
+ if(new_dset->shared->layout.version >= H5O_LAYOUT_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 */
@@ -1254,7 +1095,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to construct layout information")
/* Update the dataset's object header info. */
- if(H5D__update_oh_info(file, dxpl_id, new_dset, dapl_id) < 0)
+ if(H5D__update_oh_info(file, new_dset, dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't update the metadata cache")
/* Indicate that the layout information was initialized */
@@ -1262,12 +1103,16 @@ 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)
+ if(H5D__build_file_prefix(new_dset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &new_dset->shared->extfile_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix")
+ /* Set the VDS file prefix */
+ if(H5D__build_file_prefix(new_dset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &new_dset->shared->vds_prefix) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix")
+
/* Add the dataset to the list of opened objects in the file */
if(H5FO_top_incr(new_dset->oloc.file, new_dset->oloc.addr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't incr object ref. count")
@@ -1282,7 +1127,7 @@ done:
if(!ret_value && new_dset && new_dset->shared) {
if(new_dset->shared) {
if(layout_init)
- if(new_dset->shared->layout.ops->dest && (new_dset->shared->layout.ops->dest)(new_dset, dxpl_id) < 0)
+ if(new_dset->shared->layout.ops->dest && (new_dset->shared->layout.ops->dest)(new_dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "unable to destroy layout info")
if(pline_copied)
if(H5O_msg_reset(H5O_PLINE_ID, &new_dset->shared->dcpl_cache.pline) < 0)
@@ -1301,18 +1146,19 @@ done:
if(new_dset->shared->type && H5I_dec_ref(new_dset->shared->type_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype")
if(H5F_addr_defined(new_dset->oloc.addr)) {
- if(H5O_dec_rc_by_loc(&(new_dset->oloc), dxpl_id) < 0)
+ if(H5O_dec_rc_by_loc(&(new_dset->oloc)) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object")
if(H5O_close(&(new_dset->oloc), NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release object header")
if(file) {
- if(H5O_delete(file, dxpl_id, new_dset->oloc.addr) < 0)
+ if(H5O_delete(file, new_dset->oloc.addr) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDELETE, NULL, "unable to delete object header")
} /* end if */
} /* end if */
if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list")
new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix);
+ new_dset->shared->vds_prefix = (char *)H5MM_xfree(new_dset->shared->vds_prefix);
new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared);
} /* end if */
new_dset->oloc.file = NULL;
@@ -1330,15 +1176,10 @@ done:
*
* Return: Success: Ptr to a new dataset.
* Failure: NULL
- *
- * Programmer: Neil Fortner
- * Friday, March 6, 2015
- *
*-------------------------------------------------------------------------
*/
H5D_t *
-H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id,
- hid_t dxpl_id)
+H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id)
{
H5D_t *dset = NULL;
H5G_loc_t dset_loc; /* Object location of dataset */
@@ -1348,7 +1189,7 @@ H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id,
hbool_t loc_found = FALSE; /* Location at 'name' found */
H5D_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE_VOL
/* Check args */
HDassert(loc);
@@ -1360,18 +1201,18 @@ H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id,
H5G_loc_reset(&dset_loc);
/* Find the dataset object */
- if(H5G_loc_find(loc, name, &dset_loc, dapl_id, dxpl_id) < 0)
+ if(H5G_loc_find(loc, name, &dset_loc) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, NULL, "not found")
loc_found = TRUE;
/* Check that the object found is the correct type */
- if(H5O_obj_type(&oloc, &obj_type, dxpl_id) < 0)
+ if(H5O_obj_type(&oloc, &obj_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get object type")
if(obj_type != H5O_TYPE_DATASET)
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, NULL, "not a dataset")
/* Open the dataset */
- if(NULL == (dset = H5D_open(&dset_loc, dapl_id, dxpl_id)))
+ if(NULL == (dset = H5D_open(&dset_loc, dapl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't open dataset")
/* Set return value */
@@ -1382,31 +1223,28 @@ done:
if(loc_found && H5G_loc_free(&dset_loc) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "can't free location")
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_VOL(ret_value)
} /* end H5D__open_name() */
/*
*-------------------------------------------------------------------------
- * 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 *
-H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id)
+H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
{
H5D_shared_t *shared_fo = NULL;
H5D_t *dataset = NULL;
char *extfile_prefix = NULL; /* Expanded external file prefix */
+ char *vds_prefix = NULL; /* Expanded vds prefix */
H5D_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1427,16 +1265,20 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path")
/* Get the external file prefix */
- if(H5D_build_extfile_prefix(dataset, dapl_id, &extfile_prefix) < 0)
+ if(H5D__build_file_prefix(dataset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &extfile_prefix) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix")
+ /* Get the VDS prefix */
+ if(H5D__build_file_prefix(dataset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &vds_prefix) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix")
+
/* Check if dataset was already open */
if(NULL == (shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr))) {
/* Clear any errors from H5FO_opened() */
H5E_clear_stack(NULL);
/* Open the dataset object */
- if(H5D__open_oid(dataset, dapl_id, dxpl_id) < 0)
+ if(H5D__open_oid(dataset, dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, NULL, "not found")
/* Add the dataset to the list of opened objects in the file */
@@ -1455,6 +1297,11 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id)
/* Prevent string from being freed during done: */
extfile_prefix = NULL;
+ /* Set the vds file prefix */
+ dataset->shared->vds_prefix = vds_prefix;
+ /* Prevent string from being freed during done: */
+ vds_prefix = NULL;
+
} /* end if */
else {
/* Point to shared info */
@@ -1486,14 +1333,16 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id)
done:
extfile_prefix = (char *)H5MM_xfree(extfile_prefix);
+ vds_prefix = (char *)H5MM_xfree(vds_prefix);
if(ret_value == NULL) {
/* Free the location--casting away const*/
if(dataset) {
if(shared_fo == NULL && dataset->shared) { /* Need to free shared fo */
dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix);
+ dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix);
dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
- }
+ } /* end if */
H5O_loc_free(&(dataset->oloc));
H5G_name_free(&(dataset->path));
@@ -1510,19 +1359,15 @@ done:
/*
*-------------------------------------------------------------------------
- * Function: H5D__flush_append_setup
- *
- * Purpose: Set the append flush parameters for a dataset
+ * Function: H5D__flush_append_setup
*
- * Return: Non-negative on success/Negative on failure
- *
- * 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 */
@@ -1539,47 +1384,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:
@@ -1588,28 +1433,24 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__open_oid
- *
- * Purpose: Opens a dataset for access.
+ * Function: H5D__open_oid
*
- * Return: Dataset pointer on success, NULL on failure
- *
- * Programmer: Quincey Koziol
- * Monday, October 12, 1998
+ * Purpose: Opens a dataset for access.
*
+ * Return: Dataset pointer on success, NULL on failure
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id)
+H5D__open_oid(H5D_t *dataset, hid_t dapl_id)
{
H5P_genplist_t *plist; /* Property list */
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)
+ FUNC_ENTER_STATIC_TAG(dataset->oloc.addr)
/* check args */
HDassert(dataset);
@@ -1623,13 +1464,13 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open")
/* Get the type and space */
- if(NULL == (dataset->shared->type = (H5T_t *)H5O_msg_read(&(dataset->oloc), H5O_DTYPE_ID, NULL, dxpl_id)))
+ if(NULL == (dataset->shared->type = (H5T_t *)H5O_msg_read(&(dataset->oloc), H5O_DTYPE_ID, NULL)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load type info from dataset header")
if(H5T_set_loc(dataset->shared->type, dataset->oloc.file, H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location")
- if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc), dxpl_id)))
+ if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header")
/* Cache the dataset's dataspace info */
@@ -1645,7 +1486,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
/* Get the layout/pline/efl message information */
- if(H5D__layout_oh_read(dataset, dxpl_id, dapl_id, plist) < 0)
+ if(H5D__layout_oh_read(dataset, dapl_id, plist) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout/pline/efl info")
/* Indicate that the layout information was initialized */
@@ -1653,24 +1494,24 @@ 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;
/* Try to get the new fill value message from the object header */
- if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_FILL_NEW_ID, dxpl_id)) < 0)
+ if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_FILL_NEW_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists")
if(msg_exists) {
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_NEW_ID, fill_prop, dxpl_id))
+ if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_NEW_ID, fill_prop))
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 */
- if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_FILL_ID, dxpl_id)) < 0)
+ /* For backward compatibility, try to retrieve the old fill value message */
+ if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_FILL_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists")
if(msg_exists) {
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_ID, fill_prop, dxpl_id))
+ if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_ID, fill_prop))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message")
} /* end if */
else {
@@ -1729,8 +1570,6 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id)
H5D_io_info_t io_info;
io_info.dset = dataset;
- io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id;
- io_info.md_dxpl_id = dxpl_id;
if(H5D__alloc_storage(&io_info, H5D_ALLOC_OPEN, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage")
@@ -1741,8 +1580,8 @@ 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(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, dxpl_id) < 0)
+ if(layout_init)
+ if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
if(dataset->shared->space && H5S_close(dataset->shared->space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
@@ -1752,29 +1591,55 @@ done:
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
} /* end if */
else {
- if(H5T_close(dataset->shared->type) < 0)
+ if(H5T_close_real(dataset->shared->type) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
} /* end else */
} /* end if */
} /* end if */
} /* end if */
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__open_oid() */
/*-------------------------------------------------------------------------
- * Function: H5D_close
+ * Function: H5D__close_cb
*
- * Purpose: Insures that all data has been saved to the file, closes the
- * dataset object header, and frees all resources used by the
- * descriptor.
+ * Purpose: Callback routine for closing a dataset ID. Closes the dataset
+ * object that was attached to the ID.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Robb Matzke
- * Thursday, December 4, 1997
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__close_cb(H5D_t *dataset)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC_VOL
+
+ /* check args */
+ HDassert(dataset && dataset->oloc.file && dataset->shared);
+ HDassert(dataset->shared->fo_count > 0);
+
+ /* Call actual dataset close routine */
+ if(H5D_close(dataset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close dataset");
+
+done:
+ FUNC_LEAVE_NOAPI_VOL(ret_value)
+} /* end H5D__close_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * 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.
+ *
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
@@ -1800,7 +1665,7 @@ H5D_close(H5D_t *dataset)
if(dataset->shared->fo_count == 0) {
/* Flush the dataset's information. Continue to close even if it fails. */
- if(H5D__flush_real(dataset, H5AC_ind_read_dxpl_id) < 0)
+ if(H5D__flush_real(dataset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info")
/* Set a flag to indicate the dataset is closing, before we start freeing things */
@@ -1880,12 +1745,15 @@ H5D_close(H5D_t *dataset)
} /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Destroy any cached layout information for the dataset */
- if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, H5AC_ind_read_dxpl_id) < 0)
+ if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
/* Free the external file prefix */
dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix);
+ /* Free the vds file prefix */
+ dataset->shared->vds_prefix = (char *)H5MM_xfree(dataset->shared->vds_prefix);
+
/* Release layout, fill-value, efl & pipeline messages */
if(dataset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT)
free_failed |= (H5O_msg_reset(H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline) < 0) ||
@@ -1897,7 +1765,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")
/*
@@ -1910,21 +1778,21 @@ H5D_close(H5D_t *dataset)
/* Remove the dataset from the list of opened objects in the file */
if(H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object")
- if(H5FO_delete(dataset->oloc.file, H5AC_ind_read_dxpl_id, dataset->oloc.addr) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't remove dataset from list of open objects")
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object")
+ if(H5FO_delete(dataset->oloc.file, dataset->oloc.addr) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't remove dataset from list of open objects")
/* Close the dataset object */
/* (This closes the file, if this is the last object open) */
if(H5O_close(&(dataset->oloc), &file_closed) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header")
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header")
/* 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)
- 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)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata")
+ if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata")
+ if(H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata")
} /* end if */
/*
@@ -1935,7 +1803,6 @@ H5D_close(H5D_t *dataset)
*/
dataset->oloc.file = NULL;
dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared);
-
} /* end if */
else {
/* Decrement the ref. count for this object in the top file */
@@ -1970,23 +1837,19 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_mult_refresh_close
+ * Function: H5D_mult_refresh_close
*
- * 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
- *
- * 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_mult_refresh_close(hid_t dset_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)
@@ -2042,7 +1905,7 @@ H5D_mult_refresh_close(hid_t dset_id, hid_t dxpl_id)
} /* end switch */ /*lint !e788 All appropriate cases are covered */
/* Destroy any cached layout information for the dataset */
- if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, dxpl_id) < 0)
+ if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
} /* end if */
@@ -2052,20 +1915,16 @@ 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.
*
+ * Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
-H5D_mult_refresh_reopen(H5D_t *dataset, hid_t dxpl_id)
+H5D_mult_refresh_reopen(H5D_t *dataset)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2076,25 +1935,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))))
+ 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)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message")
} /* end if */
done:
@@ -2103,16 +1962,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 *
@@ -2126,16 +1981,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 *
@@ -2149,17 +2000,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 *
@@ -2177,15 +2024,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
@@ -2193,11 +2036,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
@@ -2219,7 +2062,7 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
/* Check if we have a zero-sized dataset */
if(layout->storage.u.contig.size > 0) {
/* Reserve space in the file for the entire array */
- if(H5D__contig_alloc(f, io_info->md_dxpl_id, &layout->storage.u.contig/*out*/) < 0)
+ if(H5D__contig_alloc(f, &layout->storage.u.contig/*out*/) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage")
/* Indicate that we should initialize storage space */
@@ -2236,7 +2079,7 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
case H5D_CHUNKED:
if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) {
/* Create the root of the index that manages chunked storage */
- if(H5D__chunk_create(dset /*in,out*/, io_info->md_dxpl_id) < 0)
+ if(H5D__chunk_create(dset /*in,out*/) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
/* Indicate that we set the storage addr */
@@ -2247,19 +2090,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) {
@@ -2271,7 +2113,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;
}
@@ -2313,7 +2156,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)
@@ -2337,7 +2180,7 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc,
*/
if(time_alloc != H5D_ALLOC_CREATE && addr_set)
/* Mark the layout as dirty, for later writing to the file */
- if(H5D__mark(dset, io_info->md_dxpl_id, H5D_MARK_LAYOUT) < 0)
+ if(H5D__mark(dset, H5D_MARK_LAYOUT) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty")
} /* end if */
@@ -2347,24 +2190,20 @@ done:
/*-------------------------------------------------------------------------
- * 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.
+ * Function: H5D__init_storage
*
- * 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
@@ -2375,7 +2214,7 @@ H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t
/* If we will be immediately overwriting the values, don't bother to clear them */
if(!full_overwrite) {
/* Fill the compact dataset storage */
- if(H5D__compact_fill(dset, io_info->md_dxpl_id) < 0)
+ if(H5D__compact_fill(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize compact dataset storage")
} /* end if */
break;
@@ -2423,29 +2262,25 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__get_storage_size
- *
- * Purpose: Determines how much space has been reserved to store the raw
- * data of a dataset.
- *
- * Return: Non-negative on success, negative on failure
+ * Function: H5D__get_storage_size_real
*
- * 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)
+static herr_t
+H5D__get_storage_size_real(const H5D_t *dset, 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)
+ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
switch(dset->shared->layout.type) {
case H5D_CHUNKED:
if((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) {
- if(H5D__chunk_allocated(dset, dxpl_id, storage_size) < 0)
+ if(H5D__chunk_allocated(dset, storage_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve chunked dataset allocated size")
} /* end if */
else
@@ -2477,29 +2312,53 @@ H5D__get_storage_size(H5D_t *dset, hid_t dxpl_id, hsize_t *storage_size)
} /*lint !e788 All appropriate cases are covered */
done:
- FUNC_LEAVE_NOAPI_TAG(ret_value, 0)
-} /* end H5D__get_storage_size() */
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
+} /* end H5D__get_storage_size_real() */
/*-------------------------------------------------------------------------
- * Function: H5D__get_offset
+ * Function: H5D__get_storage_size
*
- * Purpose: Private function for H5D__get_offset. Returns the address
- * of dataset in file.
+ * Purpose: Determines how much space has been reserved to store the raw
+ * data of a dataset.
*
- * Return: Success: the address of dataset
+ * Note: This routine is needed so that there's a non-API routine for
+ * creating attributes that can set up VOL / SWMR info
+ * (which need a DXPL).
*
- * Failure: HADDR_UNDEF
+ * Return: Non-negative on success, negative on failure
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE_VOL
+
+ /* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */
+ if(H5D__get_storage_size_real(dset, storage_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage")
+
+done:
+ FUNC_LEAVE_NOAPI_VOL(ret_value)
+} /* end H5D__get_storage_size() */
+
+
+/*-------------------------------------------------------------------------
+ * 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
@@ -2531,42 +2390,35 @@ done:
/*-------------------------------------------------------------------------
- * 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.
+ * Function: H5D_vlen_reclaim
*
- * 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.
*
+ * Return: Non-negative on success, negative on failure
*-------------------------------------------------------------------------
*/
herr_t
-H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, void *buf)
+H5D_vlen_reclaim(hid_t type_id, H5S_t *space, void *buf)
{
H5T_t *type; /* Datatype */
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 */
+ H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */
+ herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(H5I_DATATYPE == H5I_get_type(type_id));
HDassert(space);
- HDassert(H5P_isa_class(plist_id, H5P_DATASET_XFER));
HDassert(buf);
if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype")
/* Get the allocation info */
- if(H5T_vlen_get_alloc_info(plist_id,&vl_alloc_info) < 0)
+ if(H5CX_get_vlen_alloc_info(&vl_alloc_info) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info")
/* Call H5S_select_iterate with args, etc. */
@@ -2574,7 +2426,7 @@ H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, void *buf)
dset_op.u.app_op.op = H5T_vlen_reclaim;
dset_op.u.app_op.type_id = type_id;
- ret_value = H5S_select_iterate(buf, type, space, &dset_op, vl_alloc_info);
+ ret_value = H5S_select_iterate(buf, type, space, &dset_op, &vl_alloc_info);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2582,18 +2434,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.
+ * Function: H5D__vlen_get_buf_size_alloc
*
- * Return: Non-negative on success, negative on failure
- *
- * 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 *
@@ -2616,14 +2464,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
@@ -2633,15 +2481,12 @@ 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
-H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATTR_UNUSED ndim, const hsize_t *point, void *op_data)
+H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id,
+ unsigned H5_ATTR_UNUSED ndim, const hsize_t *point, void *op_data)
{
H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)op_data;
H5T_t *dt; /* Datatype for operation */
@@ -2665,7 +2510,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ATT
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point")
/* Read in the point (with the custom VL memory allocator) */
- if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->xfer_pid, vlen_bufsize->fl_tbuf) < 0)
+ if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->fl_tbuf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point")
done:
@@ -2674,15 +2519,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__check_filters
+ * Function: H5D__check_filters
*
- * Purpose: Check if the filters have be initialized for the dataset
- *
- * Return: Non-negative on success/Negative on failure
- *
- * 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
@@ -2728,27 +2569,23 @@ done:
/*-------------------------------------------------------------------------
- * 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
+ * Function: H5D__set_extent
*
- * 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
-H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
+H5D__set_extent(H5D_t *dset, const hsize_t *size)
{
hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */
htri_t changed; /* Whether the dataspace changed size */
size_t u, v; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_TAG(dxpl_id, dset->oloc.addr, FAIL)
+ FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr)
/* Check args */
HDassert(dset);
@@ -2811,8 +2648,11 @@ 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)))
+ 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 */
- if(dset->shared->cache.chunk.scaled_power2up[u] != (scaled_power2up = H5VM_power2up(scaled))) {
+ if(dset->shared->cache.chunk.scaled_power2up[u] != scaled_power2up) {
/* Update the 'power2up' & 'encode_bits' values for the current dimension */
dset->shared->cache.chunk.scaled_power2up[u] = scaled_power2up;
dset->shared->cache.chunk.scaled_encode_bits[u] = H5VM_log2_gen(scaled_power2up);
@@ -2840,7 +2680,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
/* Check if updating the chunk cache indices is necessary */
if(update_chunks)
/* Update the chunk cache indices */
- if(H5D__chunk_update_cache(dset, dxpl_id) < 0)
+ if(H5D__chunk_update_cache(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update cached chunk indices")
} /* end if */
@@ -2873,12 +2713,10 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
H5D_io_info_t io_info;
io_info.dset = dset;
- io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id;
- io_info.md_dxpl_id = dxpl_id;
if(H5D__alloc_storage(&io_info, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset storage")
- }
+ } /* end if */
/*-------------------------------------------------------------------------
* Remove chunk information in the case of chunked datasets
* This removal takes place only in case we are shrinking the dateset
@@ -2888,42 +2726,38 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id)
if(H5D_CHUNKED == dset->shared->layout.type) {
if(shrink && (*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage))
/* Remove excess chunks */
- if(H5D__chunk_prune_by_extent(dset, dxpl_id, curr_dims) < 0)
+ if(H5D__chunk_prune_by_extent(dset, curr_dims) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks")
/* Update chunks that are no longer edge chunks as a result of
* expansion */
if(expand && (dset->shared->layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS)
&& (dset->shared->dcpl_cache.pline.nused > 0))
- if(H5D__chunk_update_old_edge_chunks(dset, dxpl_id, curr_dims) < 0)
+ if(H5D__chunk_update_old_edge_chunks(dset, 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)
+ if(H5D__mark(dset, H5D_MARK_SPACE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty")
} /* end if */
done:
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
+ FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
} /* end H5D__set_extent() */
/*-------------------------------------------------------------------------
- * Function: H5D__flush_sieve_buf
- *
- * Purpose: Flush any dataset sieve buffer info cached in memory
+ * Function: H5D__flush_sieve_buf
*
- * 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
-H5D__flush_sieve_buf(H5D_t *dataset, hid_t dxpl_id)
+H5D__flush_sieve_buf(H5D_t *dataset)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2938,7 +2772,7 @@ H5D__flush_sieve_buf(H5D_t *dataset, hid_t dxpl_id)
/* Write dirty data sieve buffer to file */
if(H5F_block_write(dataset->oloc.file, H5FD_MEM_DRAW, dataset->shared->cache.contig.sieve_loc,
- dataset->shared->cache.contig.sieve_size, dxpl_id, dataset->shared->cache.contig.sieve_buf) < 0)
+ dataset->shared->cache.contig.sieve_size, dataset->shared->cache.contig.sieve_buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
/* Reset sieve buffer dirty flag */
@@ -2951,208 +2785,231 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__flush_real
- *
- * Purpose: Flush any dataset information cached in memory
+ * Function: H5D__flush_real
*
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 6, 2007
+ * Purpose: Flush any dataset information cached in memory
*
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
-H5D__flush_real(H5D_t *dataset, hid_t dxpl_id)
+H5D__flush_real(H5D_t *dataset)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_TAG(dxpl_id, dataset->oloc.addr, FAIL)
+ FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr)
/* Check args */
HDassert(dataset);
HDassert(dataset->shared);
/* Avoid flushing the dataset (again) if it's closing */
- if(!dataset->shared->closing) {
+ if(!dataset->shared->closing)
/* Flush cached raw data for each kind of dataset layout */
- if(dataset->shared->layout.ops->flush &&
- (dataset->shared->layout.ops->flush)(dataset, dxpl_id) < 0)
+ if(dataset->shared->layout.ops->flush && (dataset->shared->layout.ops->flush)(dataset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush raw data")
- } /* end if */
done:
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__flush_real() */
/*-------------------------------------------------------------------------
- * 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
+ * Function: H5D__flush
*
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Vailin Choi
- * Feb 2015
+ * Purpose: Flush dataset information cached in memory
*
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
-H5D__format_convert(H5D_t *dataset, hid_t dxpl_id)
+H5D__flush(H5D_t *dset, hid_t dset_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 */
- H5O_layout_t newlayout; /* 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 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)
+ FUNC_ENTER_PACKAGE_VOL
/* Check args */
- HDassert(dataset);
+ HDassert(dset);
+ HDassert(dset->shared);
- switch(dataset->shared->layout.type) {
- case H5D_CHUNKED:
- HDassert(dataset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE);
+ /* Flush any dataset information still cached in memory */
+ if(H5D__flush_real(dset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush cached dataset info")
- /* Set up the current index info */
- idx_info.f = dataset->oloc.file;
- idx_info.dxpl_id = dxpl_id;
- idx_info.pline = &dataset->shared->dcpl_cache.pline;
- idx_info.layout = &dataset->shared->layout.u.chunk;
- idx_info.storage = &dataset->shared->layout.storage.u.chunk;
+ /* Flush object's metadata to file */
+ if(H5O_flush_common(&dset->oloc, dset_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset and object flush callback")
- /* Copy the current layout info to the new layout */
- HDmemcpy(&newlayout, &dataset->shared->layout, sizeof(H5O_layout_t));
+done:
+ FUNC_LEAVE_NOAPI_VOL(ret_value)
+} /* end H5D__flush() */
- /* Set up info for version 1 B-tree in the new layout */
- newlayout.version = H5O_LAYOUT_VERSION_3;
- newlayout.storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE;
- newlayout.storage.u.chunk.idx_addr = HADDR_UNDEF;
- newlayout.storage.u.chunk.ops = H5D_COPS_BTREE;
- newlayout.storage.u.chunk.u.btree.shared = NULL;
+
+/*-------------------------------------------------------------------------
+ * 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
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D__format_convert(H5D_t *dataset)
+{
+ 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 add_new_layout = FALSE; /* Indicate that the new layout message is added */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Set up the index info to version 1 B-tree */
- new_idx_info.f = dataset->oloc.file;
- new_idx_info.dxpl_id = dxpl_id;
- new_idx_info.pline = &dataset->shared->dcpl_cache.pline;
- new_idx_info.layout = &newlayout.u.chunk;
- new_idx_info.storage = &newlayout.storage.u.chunk;
+ FUNC_ENTER_PACKAGE_VOL_TAG(dataset->oloc.addr)
- /* Initialize version 1 B-tree */
- if(new_idx_info.storage->ops->init &&
- (new_idx_info.storage->ops->init)(&new_idx_info, dataset->shared->space, dataset->oloc.addr) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information")
- init_new_index = TRUE;
+ /* Check args */
+ HDassert(dataset);
- /* If the current chunk index exists */
- if(H5F_addr_defined(idx_info.storage->idx_addr)) {
+ switch(dataset->shared->layout.type) {
+ case H5D_CHUNKED:
+ HDassert(dataset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE);
- /* Create v1 B-tree chunk index */
- if((new_idx_info.storage->ops->create)(&new_idx_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index")
+ if(NULL == (newlayout = (H5O_layout_t *)H5MM_calloc(sizeof(H5O_layout_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer")
- /* 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)
- HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate/convert chunk index")
- } /* end if */
+ /* Set up the current index info */
+ idx_info.f = dataset->oloc.file;
+ idx_info.pline = &dataset->shared->dcpl_cache.pline;
+ idx_info.layout = &dataset->shared->layout.u.chunk;
+ idx_info.storage = &dataset->shared->layout.storage.u.chunk;
+
+ /* Copy the current layout info to the new layout */
+ HDmemcpy(newlayout, &dataset->shared->layout, sizeof(H5O_layout_t));
+
+ /* Set up info for version 1 B-tree in the new layout */
+ newlayout->version = H5O_LAYOUT_VERSION_3;
+ newlayout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE;
+ newlayout->storage.u.chunk.idx_addr = HADDR_UNDEF;
+ newlayout->storage.u.chunk.ops = H5D_COPS_BTREE;
+ newlayout->storage.u.chunk.u.btree.shared = NULL;
+
+ /* Set up the index info to version 1 B-tree */
+ new_idx_info.f = dataset->oloc.file;
+ new_idx_info.pline = &dataset->shared->dcpl_cache.pline;
+ new_idx_info.layout = &(newlayout->u).chunk;
+ new_idx_info.storage = &(newlayout->storage).u.chunk;
+
+ /* Initialize version 1 B-tree */
+ if(new_idx_info.storage->ops->init && (new_idx_info.storage->ops->init)(&new_idx_info, dataset->shared->space, dataset->oloc.addr) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information")
+ init_new_index = TRUE;
+
+ /* If the current chunk index exists */
+ if(H5F_addr_defined(idx_info.storage->idx_addr)) {
+
+ /* Create v1 B-tree chunk index */
+ 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
+ * into the version 1 B-tree chunk index
+ */
+ if(H5D__chunk_format_convert(dataset, &idx_info, &new_idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate/convert chunk index")
+ } /* end if */
- /* Delete the old "current" layout message */
- if(H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message")
+ /* Delete the old "current" layout message */
+ if(H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message")
- delete_old_layout = TRUE;
+ delete_old_layout = TRUE;
- /* Append the new layout message to the object header */
- if(H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &newlayout, dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout header message")
+ /* Append the new layout message to the object header */
+ if(H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, newlayout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout header message")
- add_new_layout = TRUE;
+ add_new_layout = TRUE;
- /* Release the old (current) chunk index */
- if(idx_info.storage->ops->dest && (idx_info.storage->ops->dest)(&idx_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
+ /* Release the old (current) chunk index */
+ if(idx_info.storage->ops->dest && (idx_info.storage->ops->dest)(&idx_info) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
- /* Copy the new layout to the dataset's layout */
- HDmemcpy(&dataset->shared->layout, &newlayout, sizeof(H5O_layout_t));
+ /* Copy the new layout to the dataset's layout */
+ HDmemcpy(&dataset->shared->layout, newlayout, sizeof(H5O_layout_t));
- break;
+ break;
- case H5D_CONTIGUOUS:
+ case H5D_CONTIGUOUS:
case H5D_COMPACT:
- HDassert(dataset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT);
- dataset->shared->layout.version = H5O_LAYOUT_VERSION_DEFAULT;
- if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), dxpl_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message")
- break;
+ HDassert(dataset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT);
+ dataset->shared->layout.version = H5O_LAYOUT_VERSION_DEFAULT;
+ if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dataset->shared->layout)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message")
+ break;
- case H5D_VIRTUAL:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "virtual dataset layout not supported")
+ case H5D_VIRTUAL:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "virtual dataset layout not supported")
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type")
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type")
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type")
} /* end switch */
done:
if(ret_value < 0 && dataset->shared->layout.type == H5D_CHUNKED) {
- /* Remove new layout message */
- if(add_new_layout)
- if(H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE, dxpl_id) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message")
-
- /* Add back old layout message */
- if(delete_old_layout)
- if(H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &dataset->shared->layout, dxpl_id) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to add layout header message")
-
- /* Clean up v1 b-tree chunk index */
- if(init_new_index) {
- if(H5F_addr_defined(new_idx_info.storage->idx_addr)) {
- /* Check for valid address i.e. tag */
- if(!H5F_addr_defined(dataset->oloc.addr))
- HDONE_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "address undefined")
-
- /* Expunge from cache all v1 B-tree type entries associated with tag */
- if(H5AC_expunge_tag_type_metadata(dataset->oloc.file, dxpl_id, dataset->oloc.addr, H5AC_BT_ID, H5AC__NO_FLAGS_SET))
- HDONE_ERROR(H5E_DATASET, H5E_CANTEXPUNGE, FAIL, "unable to expunge index metadata")
- } /* end if */
-
- /* Delete v1 B-tree chunk index */
- if(new_idx_info.storage->ops->dest && (new_idx_info.storage->ops->dest)(&new_idx_info) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
- } /* end if */
+ /* Remove new layout message */
+ if(add_new_layout)
+ if(H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE) < 0)
+ HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message")
+
+ /* Add back old layout message */
+ if(delete_old_layout)
+ if(H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &dataset->shared->layout) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to add layout header message")
+
+ /* Clean up v1 b-tree chunk index */
+ if(init_new_index) {
+ if(H5F_addr_defined(new_idx_info.storage->idx_addr)) {
+ /* Check for valid address i.e. tag */
+ if(!H5F_addr_defined(dataset->oloc.addr))
+ HDONE_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "address undefined")
+
+ /* Expunge from cache all v1 B-tree type entries associated with tag */
+ if(H5AC_expunge_tag_type_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_BT_ID, H5AC__NO_FLAGS_SET))
+ HDONE_ERROR(H5E_DATASET, H5E_CANTEXPUNGE, FAIL, "unable to expunge index metadata")
+ } /* end if */
+
+ /* Delete v1 B-tree chunk index */
+ if(new_idx_info.storage->ops->dest && (new_idx_info.storage->ops->dest)(&new_idx_info) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info")
+ } /* end if */
} /* end if */
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
+ if(newlayout != NULL)
+ newlayout = (H5O_layout_t *)H5MM_xfree(newlayout);
+
+ FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
} /* end H5D__format_convert() */
/*-------------------------------------------------------------------------
- * Function: H5D__mark
- *
- * Purpose: Mark some aspect of a dataset as dirty
- *
- * Return: Success: Non-negative
- * Failure: Negative
+ * Function: H5D__mark
*
- * Programmer: Quincey Koziol
- * July 4, 2008
+ * Purpose: Mark some aspect of a dataset as dirty
*
+ * Return: Success: Non-negative
+ * Failure: Negative
*-------------------------------------------------------------------------
*/
herr_t
-H5D__mark(const H5D_t *dataset, hid_t H5_ATTR_UNUSED dxpl_id, unsigned flags)
+H5D__mark(const H5D_t *dataset, unsigned flags)
{
H5O_t *oh = NULL; /* Pointer to dataset's object header */
herr_t ret_value = SUCCEED; /* Return value */
@@ -3168,12 +3025,12 @@ H5D__mark(const H5D_t *dataset, hid_t H5_ATTR_UNUSED dxpl_id, unsigned flags)
unsigned update_flags = H5O_UPDATE_TIME; /* Modification time flag */
/* Pin the object header */
- if(NULL == (oh = H5O_pin(&dataset->oloc, dxpl_id)))
+ if(NULL == (oh = H5O_pin(&dataset->oloc)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header")
/* Update the layout on disk, if it's been changed */
if(flags & H5D_MARK_LAYOUT) {
- if(H5D__layout_oh_write(dataset, dxpl_id, oh, update_flags) < 0)
+ if(H5D__layout_oh_write(dataset, oh, update_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout info")
/* Reset the "update the modification time" flag, so we only do it once */
@@ -3182,7 +3039,7 @@ H5D__mark(const H5D_t *dataset, hid_t H5_ATTR_UNUSED dxpl_id, unsigned flags)
/* Update the dataspace on disk, if it's been changed */
if(flags & H5D_MARK_SPACE) {
- if(H5S_write(dataset->oloc.file, dxpl_id, oh, update_flags, dataset->shared->space) < 0)
+ if(H5S_write(dataset->oloc.file, oh, update_flags, dataset->shared->space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace")
/* Reset the "update the modification time" flag, so we only do it once */
@@ -3204,105 +3061,125 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__flush_cb
- *
- * Purpose: Flush any dataset information cached in memory
- *
- * Return: Success: Non-negative
- * Failure: Negative
+ * Function: H5D__flush_all_cb
*
- * 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__flush_all_cb(void *_dataset, hid_t H5_ATTR_UNUSED id, void *_udata)
{
- 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 */
+ H5D_t *dataset = (H5D_t *)_dataset; /* Dataset pointer */
+ H5F_t *f = (H5F_t *)_udata; /* User data for callback */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
/* Check args */
HDassert(dataset);
+ HDassert(f);
/* Check for dataset in same file */
- if(udata->f == dataset->oloc.file) {
+ if(f == dataset->oloc.file)
/* Flush the dataset's information */
- if(H5D__flush_real(dataset, udata->dxpl_id) < 0)
+ if(H5D__flush_real(dataset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to flush cached dataset info")
- } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__flush_cb() */
+} /* end H5D__flush_all_cb() */
/*-------------------------------------------------------------------------
- * Function: H5D_flush
- *
- * Purpose: Flush any dataset information cached in memory
+ * Function: H5D_flush_all
*
- * 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_all(const H5F_t *f)
{
- H5D_flush_ud_t udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(f);
- /* Set user data for callback */
- udata.f = f;
- udata.dxpl_id = dxpl_id;
-
/* Iterate over all the open datasets */
- if(H5I_iterate(H5I_DATASET, H5D__flush_cb, &udata, FALSE) < 0)
+ if(H5I_iterate(H5I_DATASET, H5D__flush_all_cb, (void *)f, FALSE) < 0) /* Casting away const OK -QAK */
HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to flush cached dataset info")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D_flush() */
+} /* end H5D_flush_all() */
/*-------------------------------------------------------------------------
- * Function: H5D_get_create_plist
+ * Function: H5D__get_create_plist
*
- * Purpose: Private function for H5Dget_create_plist
+ * Purpose: Internal routine to retrieve a dataset's creation property list.
*
- * Return: Success: ID for a copy of the dataset creation
- * property list. The template should be
- * released by calling H5P_close().
+ * Note: This routine is needed so that there's a non-API routine
+ * that can set up VOL / SWMR info (which need a DXPL).
+ *
+ * Return: Success: ID for a copy of the dataset creation property
+ * list. The property list ID should be released
+ * by calling H5Pclose().
*
* Failure: FAIL
*
- * Programmer: Robb Matzke
- * Tuesday, February 3, 1998
+ * Programmer: Quincey Koziol
+ * December 18, 2017
*
*-------------------------------------------------------------------------
*/
hid_t
-H5D_get_create_plist(H5D_t *dset)
+H5D__get_create_plist(const H5D_t *dset)
+{
+ hid_t ret_value = FAIL; /* Return value */
+
+ FUNC_ENTER_PACKAGE_VOL
+
+ /* Check arguments */
+ HDassert(dset);
+
+ /* Retrieve the DCPL */
+ if((ret_value = H5D_get_create_plist(dset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset's creation property list")
+
+done:
+ FUNC_LEAVE_NOAPI_VOL(ret_value)
+} /* end H5D__get_create_plist() */
+
+
+/*-------------------------------------------------------------------------
+ * 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().
+ * Failure: FAIL
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5D_get_create_plist(const H5D_t *dset)
{
H5P_genplist_t *dcpl_plist; /* Dataset's DCPL */
H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */
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)
@@ -3317,7 +3194,7 @@ H5D_get_create_plist(H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list")
/* Retrieve any object creation properties */
- if(H5O_get_create_plist(&dset->oloc, H5AC_ind_read_dxpl_id, new_plist) < 0)
+ if(H5O_get_create_plist(&dset->oloc, new_plist) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object creation info")
/* Get the layout property */
@@ -3343,7 +3220,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")
@@ -3379,7 +3256,7 @@ H5D_get_create_plist(H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy dataset datatype for fill value")
/* Set up type conversion function */
- if(NULL == (tpath = H5T_path_find(dset->shared->type, copied_fill.type, NULL, NULL, H5AC_noio_dxpl_id, FALSE)))
+ if(NULL == (tpath = H5T_path_find(dset->shared->type, copied_fill.type)))
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types")
/* Convert disk form of fill value into memory form */
@@ -3407,7 +3284,7 @@ H5D_get_create_plist(H5D_t *dset)
} /* end if */
/* Convert fill value */
- if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf, bkg_buf, H5AC_noio_dxpl_id) < 0) {
+ if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf, bkg_buf) < 0) {
H5I_dec_ref(src_id);
H5I_dec_ref(dst_id);
if(bkg_buf)
@@ -3460,22 +3337,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_get_access_plist
- *
- * Purpose: Returns a copy of the dataset access property list.
+ * Function: H5D_get_access_plist
*
- * Return: Success: ID for a copy of the dataset access
- * property list.
- *
- * Failure: FAIL
- *
- * 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
-H5D_get_access_plist(H5D_t *dset)
+H5D_get_access_plist(const H5D_t *dset)
{
H5P_genplist_t *old_plist; /* Default DAPL */
H5P_genplist_t *new_plist; /* New DAPL */
@@ -3510,6 +3382,10 @@ H5D_get_access_plist(H5D_t *dset)
if(H5P_set(new_plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &(dset->shared->layout.storage.u.virt.printf_gap)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS printf gap")
+ /* Set the vds prefix option */
+ if(H5P_set(new_plist, H5D_ACS_VDS_PREFIX_NAME, &(dset->shared->vds_prefix)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vds prefix")
+
/* Set the external file prefix option */
if(H5P_set(new_plist, H5D_ACS_EFILE_PREFIX_NAME, &(dset->shared->extfile_prefix)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file prefix")
@@ -3518,41 +3394,35 @@ H5D_get_access_plist(H5D_t *dset)
ret_value = new_dapl_id;
done:
- if(ret_value < 0) {
+ if(ret_value < 0)
if(new_dapl_id > 0)
if(H5I_dec_app_ref(new_dapl_id) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't free")
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_get_access_plist() */
/*-------------------------------------------------------------------------
- * Function: H5D_get_space
- *
- * Purpose: Returns and ID for the dataspace of the dataset.
- *
- * Return: Success: ID for dataspace
+ * Function: H5D__get_space
*
- * Failure: FAIL
- *
- * 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)
+H5D__get_space(const 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
+ FUNC_ENTER_PACKAGE_VOL
/* If the layout is virtual, update the extent */
if(dset->shared->layout.type == H5D_VIRTUAL)
- if(H5D__virtual_set_extent_unlim(dset, H5AC_ind_read_dxpl_id) < 0)
+ if(H5D__virtual_set_extent_unlim(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update virtual dataset extent")
/* Read the dataspace message and return a dataspace object */
@@ -3569,31 +3439,27 @@ done:
if(H5S_close(space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D_get_space() */
+ FUNC_LEAVE_NOAPI_VOL(ret_value)
+} /* end H5D__get_space() */
/*-------------------------------------------------------------------------
- * Function: H5D_get_type
- *
- * Purpose: Returns and ID for the datatype of the dataset.
+ * Function: H5D__get_type
*
- * Return: Success: ID for datatype
+ * Purpose: Returns and ID for the datatype of the dataset.
*
- * Failure: FAIL
- *
- * Programmer: Mohamad Chaarawi
- * March, 2012
+ * Return: Success: ID for datatype
+ * Failure: FAIL
*
*-------------------------------------------------------------------------
*/
hid_t
-H5D_get_type(H5D_t *dset)
+H5D__get_type(const 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
+ FUNC_ENTER_PACKAGE
/* Patch the datatype's "top level" file pointer */
if(H5T_patch_file(dset->shared->type, dset->oloc.file) < 0)
@@ -3615,35 +3481,30 @@ H5D_get_type(H5D_t *dset)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype")
done:
- if(ret_value < 0) {
+ if(ret_value < 0)
if(dt && H5T_close(dt) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype")
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D_get_type() */
+} /* end H5D__get_type() */
/*-------------------------------------------------------------------------
- * Function: H5D__refresh
- *
- * Purpose: Refreshes all buffers associated with a dataset.
- *
- * Return: SUCCEED/FAIL
+ * Function: H5D__refresh
*
- * Programmer: Dana Robinson
- * November 2015
+ * Purpose: Refreshes all buffers associated with a dataset.
*
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
-H5D__refresh(hid_t dset_id, H5D_t *dset, hid_t dxpl_id)
+H5D__refresh(hid_t dset_id, H5D_t *dset)
{
H5D_virtual_held_file_t *head = NULL; /* Pointer to list of files held open */
hbool_t virt_dsets_held = FALSE; /* Whether virtual datasets' files are held open */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE_VOL
/* Sanity check */
HDassert(dset);
@@ -3657,22 +3518,20 @@ H5D__refresh(hid_t dset_id, H5D_t *dset, hid_t dxpl_id)
virt_dsets_held = TRUE;
/* Refresh source datasets for virtual dataset */
- if(H5D__virtual_refresh_source_dsets(dset, dxpl_id) < 0)
+ if(H5D__virtual_refresh_source_dsets(dset) < 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)
+ if((H5O_refresh_metadata(dset_id, dset->oloc)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh dataset")
done:
- /* Release hold on virtual datasets' files */
- if(virt_dsets_held) {
- /* Release the hold on source datasets' files */
+ /* Release hold on (source) virtual datasets' files */
+ if(virt_dsets_held)
if(H5D__virtual_release_source_dset_files(head) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't release VDS source files held open")
- } /* end if */
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI_VOL(ret_value)
} /* end H5D__refresh() */