Finished move of H5DOread/write_chunk calls to H5D.
This commit is contained in:
280
src/H5CX.c
280
src/H5CX.c
@@ -233,24 +233,10 @@ typedef struct H5CX_t {
|
||||
hbool_t data_transform_valid; /* Whether data transform info is valid */
|
||||
H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */
|
||||
hbool_t vl_alloc_info_valid; /* Whether VL datatype alloc info is valid */
|
||||
hbool_t dcr_flag; /* Direct chunk read flag (H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME) */
|
||||
hbool_t dcr_flag_valid; /* Whether direct chunk read flag is valid */
|
||||
hsize_t *dcr_offset; /* Direct chunk read offset (H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME) */
|
||||
hbool_t dcr_offset_valid; /* Whether direct chunk read offset is valid */
|
||||
hbool_t dcw_flag; /* Direct chunk write flag (H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME) */
|
||||
hbool_t dcw_flag_valid; /* Whether direct chunk write flag is valid */
|
||||
uint32_t dcw_filters; /* Direct chunk write filter flags (H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME) */
|
||||
hbool_t dcw_filters_valid; /* Whether direct chunk write filter flags is valid */
|
||||
hsize_t *dcw_offset; /* Direct chunk write offset (H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME) */
|
||||
hbool_t dcw_offset_valid; /* Whether direct chunk write offset is valid */
|
||||
uint32_t dcw_datasize; /* Direct chunk write data size (H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME) */
|
||||
hbool_t dcw_datasize_valid; /* Whether direct chunk write data size is valid */
|
||||
H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
|
||||
hbool_t dt_conv_cb_valid; /* Whether datatype conversion struct is valid */
|
||||
|
||||
/* Return-only DXPL properties to return to application */
|
||||
uint32_t dcr_filters; /* Direct chunk read filter flags (H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME) */
|
||||
hbool_t dcr_filters_set; /* Whether direct chunk read filter flags are set */
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chunk_opt; /* Chunk optimization mode used for parallel I/O (H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME) */
|
||||
hbool_t mpio_actual_chunk_opt_set; /* Whether chunk optimization mode used for parallel I/O is set */
|
||||
@@ -321,12 +307,6 @@ typedef struct H5CX_dxpl_cache_t {
|
||||
H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */
|
||||
H5Z_data_xform_t *data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */
|
||||
H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */
|
||||
hbool_t dcr_flag; /* Direct chunk read flag (H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME) */
|
||||
hsize_t *dcr_offset; /* Direct chunk read offset (H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME) */
|
||||
hbool_t dcw_flag; /* Direct chunk write flag (H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME) */
|
||||
uint32_t dcw_datasize; /* Direct chunk write data size (H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME) */
|
||||
hsize_t *dcw_offset; /* Direct chunk write offset (H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME) */
|
||||
uint32_t dcw_filters; /* Direct chunk write filter flags (H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME) */
|
||||
H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */
|
||||
} H5CX_dxpl_cache_t;
|
||||
|
||||
@@ -469,27 +449,10 @@ H5CX__init_package(void)
|
||||
if(H5P_get(dx_plist, H5D_XFER_VLEN_FREE_INFO_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.free_info) < 0)
|
||||
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info")
|
||||
|
||||
/* Get direct chunk read info */
|
||||
if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, &H5CX_def_dxpl_cache.dcr_flag) < 0)
|
||||
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk read flag")
|
||||
if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, &H5CX_def_dxpl_cache.dcr_offset) < 0)
|
||||
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk read offset")
|
||||
|
||||
/* Get direct chunk write info */
|
||||
if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &H5CX_def_dxpl_cache.dcw_flag) < 0)
|
||||
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk write flag")
|
||||
if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &H5CX_def_dxpl_cache.dcw_filters) < 0)
|
||||
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk write filter mask")
|
||||
if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &H5CX_def_dxpl_cache.dcw_offset) < 0)
|
||||
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk write offset")
|
||||
if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &H5CX_def_dxpl_cache.dcw_datasize) < 0)
|
||||
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk write data size")
|
||||
|
||||
/* Get datatype conversion struct */
|
||||
if(H5P_get(dx_plist, H5D_XFER_CONV_CB_NAME, &H5CX_def_dxpl_cache.dt_conv_cb) < 0)
|
||||
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve datatype conversion exception callback")
|
||||
|
||||
|
||||
/* Reset the "default LAPL cache" information */
|
||||
HDmemset(&H5CX_def_lapl_cache, 0, sizeof(H5CX_lapl_cache_t));
|
||||
|
||||
@@ -1789,216 +1752,6 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5CX_get_vlen_alloc_info() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5CX_get_dcr_flag
|
||||
*
|
||||
* Purpose: Retrieves the direct chunk read flag for the current API call context.
|
||||
*
|
||||
* Return: Non-negative on success / Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* March 6, 2018
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5CX_get_dcr_flag(hbool_t *dcr_flag)
|
||||
{
|
||||
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(dcr_flag);
|
||||
HDassert(head && *head);
|
||||
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
|
||||
|
||||
H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, dcr_flag)
|
||||
|
||||
/* Get the value */
|
||||
*dcr_flag = (*head)->ctx.dcr_flag;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5CX_get_dcr_flag() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5CX_get_dcr_offset
|
||||
*
|
||||
* Purpose: Retrieves the direct chunk read offset for the current API call context.
|
||||
*
|
||||
* Return: Non-negative on success / Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* March 6, 2018
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5CX_get_dcr_offset(hsize_t **dcr_offset)
|
||||
{
|
||||
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(dcr_offset);
|
||||
HDassert(head && *head);
|
||||
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
|
||||
|
||||
H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, dcr_offset)
|
||||
|
||||
/* Get the value */
|
||||
*dcr_offset = (*head)->ctx.dcr_offset;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5CX_get_dcr_offset() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5CX_get_dcw_flag
|
||||
*
|
||||
* Purpose: Retrieves the direct chunk write flag for the current API call context.
|
||||
*
|
||||
* Return: Non-negative on success / Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* March 6, 2018
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5CX_get_dcw_flag(hbool_t *dcw_flag)
|
||||
{
|
||||
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(dcw_flag);
|
||||
HDassert(head && *head);
|
||||
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
|
||||
|
||||
H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, dcw_flag)
|
||||
|
||||
/* Get the value */
|
||||
*dcw_flag = (*head)->ctx.dcw_flag;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5CX_get_dcw_flag() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5CX_get_dcw_filters
|
||||
*
|
||||
* Purpose: Retrieves the direct chunk write filter mask for the current API call context.
|
||||
*
|
||||
* Return: Non-negative on success / Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* March 6, 2018
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5CX_get_dcw_filters(uint32_t *dcw_filters)
|
||||
{
|
||||
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(dcw_filters);
|
||||
HDassert(head && *head);
|
||||
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
|
||||
|
||||
H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, dcw_filters)
|
||||
|
||||
/* Get the value */
|
||||
*dcw_filters = (*head)->ctx.dcw_filters;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5CX_get_dcw_filters() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5CX_get_dcw_offset
|
||||
*
|
||||
* Purpose: Retrieves the direct chunk write offset for the current API call context.
|
||||
*
|
||||
* Return: Non-negative on success / Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* March 6, 2018
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5CX_get_dcw_offset(hsize_t **dcw_offset)
|
||||
{
|
||||
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(dcw_offset);
|
||||
HDassert(head && *head);
|
||||
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
|
||||
|
||||
H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, dcw_offset)
|
||||
|
||||
/* Get the value */
|
||||
*dcw_offset = (*head)->ctx.dcw_offset;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5CX_get_dcw_offset() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5CX_get_dcw_datasize
|
||||
*
|
||||
* Purpose: Retrieves the direct chunk write data size for the current API call context.
|
||||
*
|
||||
* Return: Non-negative on success / Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* March 6, 2018
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5CX_get_dcw_datasize(uint32_t *dcw_datasize)
|
||||
{
|
||||
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(dcw_datasize);
|
||||
HDassert(head && *head);
|
||||
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
|
||||
|
||||
H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, dcw_datasize)
|
||||
|
||||
/* Get the value */
|
||||
*dcw_datasize = (*head)->ctx.dcw_datasize;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5CX_get_dcw_datasize() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5CX_get_dt_conv_cb
|
||||
@@ -2358,38 +2111,6 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5CX_set_nlinks() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5CX_set_dcr_filters
|
||||
*
|
||||
* Purpose: Sets the direct chunk read filter flags for the current API call context.
|
||||
*
|
||||
* Return: <none>
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* March 6, 2018
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
H5CX_set_dcr_filters(uint32_t direct_filters)
|
||||
{
|
||||
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
|
||||
/* Sanity checks */
|
||||
HDassert(head && *head);
|
||||
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT ||
|
||||
(*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
|
||||
|
||||
/* Cache the filter mask for later, marking it to set in DXPL when context popped */
|
||||
(*head)->ctx.dcr_filters = direct_filters;
|
||||
(*head)->ctx.dcr_filters_set = TRUE;
|
||||
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* end H5CX_set_dcr_filters() */
|
||||
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -2755,7 +2476,6 @@ H5CX__pop_common(void)
|
||||
HDassert(head && *head);
|
||||
|
||||
/* Check for cached DXPL properties to return to application */
|
||||
H5CX_SET_PROP(H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME, dcr_filters)
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
H5CX_SET_PROP(H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, mpio_actual_chunk_opt)
|
||||
H5CX_SET_PROP(H5D_MPIO_ACTUAL_IO_MODE_NAME, mpio_actual_io_mode)
|
||||
|
||||
@@ -95,12 +95,6 @@ H5_DLL herr_t H5CX_get_err_detect(H5Z_EDC_t *err_detect);
|
||||
H5_DLL herr_t H5CX_get_filter_cb(H5Z_cb_t *filter_cb);
|
||||
H5_DLL herr_t H5CX_get_data_transform(H5Z_data_xform_t **data_transform);
|
||||
H5_DLL herr_t H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info);
|
||||
H5_DLL herr_t H5CX_get_dcr_flag(hbool_t *direct_read);
|
||||
H5_DLL herr_t H5CX_get_dcr_offset(hsize_t **direct_offset);
|
||||
H5_DLL herr_t H5CX_get_dcw_flag(hbool_t *direct_write);
|
||||
H5_DLL herr_t H5CX_get_dcw_filters(uint32_t *direct_filters);
|
||||
H5_DLL herr_t H5CX_get_dcw_offset(hsize_t **direct_offset);
|
||||
H5_DLL herr_t H5CX_get_dcw_datasize(uint32_t *direct_datasize);
|
||||
H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct);
|
||||
|
||||
/* "Getter" routines for LAPL properties cached in API context */
|
||||
@@ -127,7 +121,6 @@ H5_DLL herr_t H5CX_set_vlen_alloc_info(H5MM_allocate_t alloc_func,
|
||||
H5_DLL herr_t H5CX_set_nlinks(size_t nlinks);
|
||||
|
||||
/* "Setter" routines for cached DXPL properties that must be returned to application */
|
||||
H5_DLL void H5CX_set_dcr_filters(uint32_t direct_filters);
|
||||
#ifdef H5_HAVE_PARALLEL
|
||||
H5_DLL void H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t chunk_opt);
|
||||
H5_DLL void H5CX_set_mpio_actual_io_mode(H5D_mpio_actual_io_mode_t actual_io_mode);
|
||||
|
||||
386
src/H5Dio.c
386
src/H5Dio.c
@@ -113,102 +113,56 @@ herr_t
|
||||
H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
|
||||
hid_t file_space_id, hid_t dxpl_id, void *buf/*out*/)
|
||||
{
|
||||
H5D_t *dset = NULL;
|
||||
const H5S_t *mem_space = NULL;
|
||||
const H5S_t *file_space = NULL;
|
||||
hbool_t direct_read = FALSE;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
H5D_t *dset = NULL;
|
||||
const H5S_t *mem_space = NULL;
|
||||
const H5S_t *file_space = NULL;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
H5TRACE6("e", "iiiiix", dset_id, mem_type_id, mem_space_id, file_space_id,
|
||||
dxpl_id, buf);
|
||||
|
||||
/* check arguments */
|
||||
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
|
||||
if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID")
|
||||
if(NULL == dset->oloc.file)
|
||||
if (NULL == dset->oloc.file)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
|
||||
if(mem_space_id < 0)
|
||||
if (mem_space_id < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid mem_space_id")
|
||||
if(file_space_id < 0)
|
||||
if (file_space_id < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file_space_id")
|
||||
|
||||
if(H5S_ALL != mem_space_id) {
|
||||
if(NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE)))
|
||||
/* Check dataspaces */
|
||||
if (H5S_ALL != mem_space_id) {
|
||||
if (NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
|
||||
|
||||
/* Check for valid selection */
|
||||
if(H5S_SELECT_VALID(mem_space) != TRUE)
|
||||
if (H5S_SELECT_VALID(mem_space) != TRUE)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent")
|
||||
} /* end if */
|
||||
|
||||
if(H5S_ALL != file_space_id) {
|
||||
if(NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE)))
|
||||
}
|
||||
if (H5S_ALL != file_space_id) {
|
||||
if (NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
|
||||
|
||||
/* Check for valid selection */
|
||||
if(H5S_SELECT_VALID(file_space) != TRUE)
|
||||
if (H5S_SELECT_VALID(file_space) != TRUE)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent")
|
||||
} /* end if */
|
||||
}
|
||||
|
||||
/* Get the default dataset transfer property list if the user didn't provide one */
|
||||
if(H5P_DEFAULT == dxpl_id)
|
||||
if (H5P_DEFAULT == dxpl_id)
|
||||
dxpl_id = H5P_DATASET_XFER_DEFAULT;
|
||||
else
|
||||
if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
|
||||
if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
|
||||
|
||||
/* Set DXPL for operation */
|
||||
H5CX_set_dxpl(dxpl_id);
|
||||
|
||||
/* Retrieve the 'direct read' flag */
|
||||
if(H5CX_get_dcr_flag(&direct_read) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting flag for direct chunk read")
|
||||
|
||||
/* Set up for direct read of chunk, bypassing filters, etc. */
|
||||
if(direct_read) {
|
||||
hsize_t *direct_offset; /* Chunk offset from calling routine */
|
||||
hsize_t internal_offset[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
|
||||
uint32_t direct_filters = 0; /* Filters for chunk */
|
||||
unsigned u; /* Local index variable */
|
||||
|
||||
/* Sanity check */
|
||||
if(H5D_CHUNKED != dset->shared->layout.type)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
|
||||
|
||||
/* Get the direct chunk offset */
|
||||
if(H5CX_get_dcr_offset(&direct_offset) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting offset for direct chunk read")
|
||||
HDassert(direct_offset);
|
||||
|
||||
/* The library's chunking code requires the offset terminates with a zero. So transfer the
|
||||
* offset array to an internal offset array */
|
||||
for(u = 0; u < dset->shared->ndims; u++) {
|
||||
/* Make sure the offset doesn't exceed the dataset's dimensions */
|
||||
if(direct_offset[u] > dset->shared->curr_dims[u])
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset")
|
||||
|
||||
/* Make sure the offset fall right on a chunk's boundary */
|
||||
if(direct_offset[u] % dset->shared->layout.u.chunk.dim[u])
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary")
|
||||
|
||||
internal_offset[u] = direct_offset[u];
|
||||
} /* end for */
|
||||
|
||||
/* Terminate the offset with a zero */
|
||||
internal_offset[dset->shared->ndims] = 0;
|
||||
|
||||
/* Read the raw chunk */
|
||||
if(H5D__chunk_direct_read(dset, internal_offset, &direct_filters, buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read chunk directly")
|
||||
|
||||
/* Set the chunk filter mask for application */
|
||||
H5CX_set_dcr_filters(direct_filters);
|
||||
} /* end if */
|
||||
else
|
||||
/* Read raw data */
|
||||
if(H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
|
||||
/* Read raw data */
|
||||
if (H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
@@ -231,56 +185,62 @@ herr_t
|
||||
H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters,
|
||||
void *buf)
|
||||
{
|
||||
hbool_t created_dxpl = FALSE; /* Whether we created a DXPL */
|
||||
hbool_t do_direct_read = TRUE; /* Flag for direct writes */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
H5D_t *dset = NULL;
|
||||
hsize_t internal_offset[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
|
||||
unsigned u; /* Local index variable */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf);
|
||||
|
||||
/* Check arguments */
|
||||
if(dset_id < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset ID")
|
||||
if(!buf)
|
||||
if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID")
|
||||
if (NULL == dset->oloc.file)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
|
||||
if (H5D_CHUNKED != dset->shared->layout.type)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
|
||||
if (!buf)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL")
|
||||
if(!offset)
|
||||
if (!offset)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset cannot be NULL")
|
||||
if(!filters)
|
||||
if (!filters)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filters cannot be NULL")
|
||||
|
||||
/* If the user passed in a default DXPL, create one to pass to H5Dwrite() */
|
||||
if(H5P_DEFAULT == dxpl_id) {
|
||||
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "cannot create dxpl")
|
||||
created_dxpl = TRUE;
|
||||
} /* end if */
|
||||
/* Get the default dataset transfer property list if the user didn't provide one */
|
||||
if (H5P_DEFAULT == dxpl_id)
|
||||
dxpl_id = H5P_DATASET_XFER_DEFAULT;
|
||||
else
|
||||
if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
|
||||
|
||||
/* Set direct write parameters */
|
||||
if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, &do_direct_read) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set direct read property")
|
||||
if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, &offset) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set offset property")
|
||||
/* Set DXPL for operation */
|
||||
H5CX_set_dxpl(dxpl_id);
|
||||
|
||||
/* Read chunk */
|
||||
if(H5Dread(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "cannot read from dataset")
|
||||
/* The library's chunking code requires the offset to terminate with a zero.
|
||||
* So transfer the offset array to an internal offset array that we
|
||||
* can properly terminate (don't mess with the passed-in buffer).
|
||||
*/
|
||||
for (u = 0; u < dset->shared->ndims; u++) {
|
||||
/* Make sure the offset doesn't exceed the dataset's dimensions */
|
||||
if (offset[u] > dset->shared->curr_dims[u])
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset")
|
||||
|
||||
/* Get the filter mask */
|
||||
if(H5Pget(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME, filters) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "cannot get filter mask property")
|
||||
/* Make sure the offset fall right on a chunk's boundary */
|
||||
if (offset[u] % dset->shared->layout.u.chunk.dim[u])
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary")
|
||||
|
||||
done:
|
||||
if(created_dxpl) {
|
||||
if(H5Pclose(dxpl_id) < 0)
|
||||
HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close dxpl")
|
||||
} /* end if */
|
||||
else {
|
||||
/* Reset the direct read flag on user DXPL */
|
||||
do_direct_read = FALSE;
|
||||
if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, &do_direct_read) < 0)
|
||||
HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot reset direct write property")
|
||||
internal_offset[u] = offset[u];
|
||||
}
|
||||
|
||||
/* Terminate the offset with a zero */
|
||||
internal_offset[dset->shared->ndims] = 0;
|
||||
|
||||
/* Read the raw chunk */
|
||||
if (H5D__chunk_direct_read(dset, internal_offset, filters, buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Dread_chunk() */
|
||||
|
||||
@@ -320,10 +280,9 @@ herr_t
|
||||
H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
|
||||
hid_t file_space_id, hid_t dxpl_id, const void *buf)
|
||||
{
|
||||
H5D_t *dset = NULL;
|
||||
H5D_t *dset = NULL;
|
||||
const H5S_t *mem_space = NULL;
|
||||
const H5S_t *file_space = NULL;
|
||||
hbool_t direct_write = FALSE;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
@@ -331,50 +290,46 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
|
||||
dxpl_id, buf);
|
||||
|
||||
/* check arguments */
|
||||
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
|
||||
if(NULL == dset->oloc.file)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
|
||||
if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID")
|
||||
if (NULL == dset->oloc.file)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
|
||||
if (mem_space_id < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid mem_space_id")
|
||||
if (file_space_id < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file_space_id")
|
||||
|
||||
/* Check dataspace selections */
|
||||
if (H5S_ALL != mem_space_id) {
|
||||
if (NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "mem_space_id is not a dataspace ID")
|
||||
|
||||
/* Check for valid selection */
|
||||
if (H5S_SELECT_VALID(mem_space) != TRUE)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "memory selection + offset not within extent")
|
||||
}
|
||||
if (H5S_ALL != file_space_id) {
|
||||
if (NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_space_id is not a dataspace ID")
|
||||
|
||||
/* Check for valid selection */
|
||||
if (H5S_SELECT_VALID(file_space) != TRUE)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "file selection + offset not within extent")
|
||||
}
|
||||
|
||||
/* Get the default dataset transfer property list if the user didn't provide one */
|
||||
if(H5P_DEFAULT == dxpl_id)
|
||||
if (H5P_DEFAULT == dxpl_id)
|
||||
dxpl_id = H5P_DATASET_XFER_DEFAULT;
|
||||
else
|
||||
if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
|
||||
if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
|
||||
|
||||
/* Set DXPL for operation */
|
||||
H5CX_set_dxpl(dxpl_id);
|
||||
|
||||
/* Retrieve the 'direct write' flag */
|
||||
if(H5CX_get_dcw_flag(&direct_write) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting flag for direct chunk read")
|
||||
|
||||
/* Check dataspace selections if this is not a direct write */
|
||||
if(!direct_write) {
|
||||
if(mem_space_id < 0 || file_space_id < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
|
||||
|
||||
if(H5S_ALL != mem_space_id) {
|
||||
if(NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
|
||||
|
||||
/* Check for valid selection */
|
||||
if(H5S_SELECT_VALID(mem_space) != TRUE)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "memory selection+offset not within extent")
|
||||
} /* end if */
|
||||
if(H5S_ALL != file_space_id) {
|
||||
if(NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
|
||||
|
||||
/* Check for valid selection */
|
||||
if(H5S_SELECT_VALID(file_space) != TRUE)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "file selection+offset not within extent")
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
|
||||
if(H5D__pre_write(dset, direct_write, mem_type_id, mem_space, file_space, buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't prepare for writing data")
|
||||
/* Write the data */
|
||||
if (H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
@@ -397,129 +352,70 @@ herr_t
|
||||
H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
|
||||
size_t data_size, const void *buf)
|
||||
{
|
||||
hbool_t created_dxpl = FALSE; /* Whether we created a DXPL */
|
||||
hbool_t do_direct_write = TRUE; /* Flag for direct writes */
|
||||
uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
H5D_t *dset = NULL;
|
||||
hsize_t internal_offset[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
|
||||
unsigned u; /* Local index variable */
|
||||
uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(FAIL)
|
||||
H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf);
|
||||
|
||||
/* Check arguments */
|
||||
if(dset_id < 0)
|
||||
if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset ID")
|
||||
if(!buf)
|
||||
if (NULL == dset->oloc.file)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file")
|
||||
if (H5D_CHUNKED != dset->shared->layout.type)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
|
||||
if (!buf)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL")
|
||||
if(!offset)
|
||||
if (!offset)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset cannot be NULL")
|
||||
if(!data_size)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data_size cannot be NULL")
|
||||
if (0 == data_size)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data_size cannot be zero")
|
||||
|
||||
/* Make sure data size is less than 4 GiB */
|
||||
data_size_32 = (uint32_t)data_size;
|
||||
if(data_size != (size_t)data_size_32)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data_size")
|
||||
if (data_size != (size_t)data_size_32)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data_size - chunks cannot be > 4 GiB")
|
||||
|
||||
/* If the user passed in a default DXPL, create one to pass to H5Dwrite() */
|
||||
if(H5P_DEFAULT == dxpl_id) {
|
||||
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "cannot create dxpl")
|
||||
created_dxpl = TRUE;
|
||||
} /* end if */
|
||||
/* Get the default dataset transfer property list if the user didn't provide one */
|
||||
if (H5P_DEFAULT == dxpl_id)
|
||||
dxpl_id = H5P_DATASET_XFER_DEFAULT;
|
||||
else
|
||||
if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
|
||||
|
||||
/* Set direct write parameters */
|
||||
if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set direct read property")
|
||||
if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &filters) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set filters property")
|
||||
if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &offset) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set offset property")
|
||||
if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &data_size_32) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set data size property")
|
||||
/* Set DXPL for operation */
|
||||
H5CX_set_dxpl(dxpl_id);
|
||||
|
||||
/* Write chunk */
|
||||
if(H5Dwrite(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "cannot write to dataset")
|
||||
/* The library's chunking code requires the offset to terminate with a zero.
|
||||
* So transfer the offset array to an internal offset array that we
|
||||
* can properly terminate (don't mess with the passed-in buffer).
|
||||
*/
|
||||
for (u = 0; u < dset->shared->ndims; u++) {
|
||||
/* Make sure the offset doesn't exceed the dataset's dimensions */
|
||||
if (offset[u] > dset->shared->curr_dims[u])
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset")
|
||||
|
||||
done:
|
||||
if(created_dxpl) {
|
||||
if(H5Pclose(dxpl_id) < 0)
|
||||
HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close dxpl")
|
||||
} /* end if */
|
||||
else {
|
||||
/* Reset the direct write flag on user DXPL */
|
||||
do_direct_write = FALSE;
|
||||
if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0)
|
||||
HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot reset direct write property")
|
||||
/* Make sure the offset fall right on a chunk's boundary */
|
||||
if (offset[u] % dset->shared->layout.u.chunk.dim[u])
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary")
|
||||
|
||||
internal_offset[u] = offset[u];
|
||||
}
|
||||
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Dwrite_chunk() */
|
||||
/* Terminate the offset with a zero */
|
||||
internal_offset[dset->shared->ndims] = 0;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5D__pre_write
|
||||
*
|
||||
* Purpose: Preparation for writing data.
|
||||
*
|
||||
* Return: SUCCEED/FAIL
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
|
||||
const H5S_t *mem_space, const H5S_t *file_space, const void *buf)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_PACKAGE_VOL
|
||||
|
||||
/* Direct chunk write */
|
||||
if(direct_write) {
|
||||
uint32_t direct_filters;
|
||||
hsize_t *direct_offset;
|
||||
uint32_t direct_datasize;
|
||||
hsize_t internal_offset[H5O_LAYOUT_NDIMS];
|
||||
unsigned u; /* Local index variable */
|
||||
|
||||
if(H5D_CHUNKED != dset->shared->layout.type)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
|
||||
|
||||
/* Retrieve parameters for direct chunk write */
|
||||
if(H5CX_get_dcw_filters(&direct_filters) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting filter info for direct chunk write")
|
||||
if(H5CX_get_dcw_offset(&direct_offset) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting offset info for direct chunk write")
|
||||
if(H5CX_get_dcw_datasize(&direct_datasize) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting data size for direct chunk write")
|
||||
|
||||
/* The library's chunking code requires the offset terminates with a zero. So transfer the
|
||||
* offset array to an internal offset array */
|
||||
for(u = 0; u < dset->shared->ndims; u++) {
|
||||
/* Make sure the offset doesn't exceed the dataset's dimensions */
|
||||
if(direct_offset[u] > dset->shared->curr_dims[u])
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset")
|
||||
|
||||
/* Make sure the offset fall right on a chunk's boundary */
|
||||
if(direct_offset[u] % dset->shared->layout.u.chunk.dim[u])
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary")
|
||||
|
||||
internal_offset[u] = direct_offset[u];
|
||||
} /* end for */
|
||||
|
||||
/* Terminate the offset with a zero */
|
||||
internal_offset[dset->shared->ndims] = 0;
|
||||
|
||||
/* write raw data */
|
||||
if(H5D__chunk_direct_write(dset, direct_filters, internal_offset, direct_datasize, buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write chunk directly")
|
||||
} /* end if */
|
||||
else
|
||||
/* Normal write of raw data */
|
||||
if(H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
|
||||
/* Write chunk */
|
||||
if (H5D__chunk_direct_write(dset, filters, internal_offset, data_size, buf) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI_VOL(ret_value)
|
||||
} /* end H5D__pre_write() */
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Dwrite_chunk() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
||||
@@ -583,8 +583,6 @@ H5_DLL herr_t H5D__refresh(hid_t dset_id, H5D_t *dataset);
|
||||
H5_DLL herr_t H5D__format_convert(H5D_t *dataset);
|
||||
|
||||
/* Internal I/O routines */
|
||||
H5_DLL herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
|
||||
const H5S_t *mem_space, const H5S_t *file_space, const void *buf);
|
||||
H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id,
|
||||
const H5S_t *mem_space, const H5S_t *file_space, void *buf/*out*/);
|
||||
H5_DLL herr_t H5D__write(H5D_t *dataset, hid_t mem_type_id,
|
||||
|
||||
@@ -152,22 +152,6 @@
|
||||
#define H5D_XFER_XFORM_COPY H5P__dxfr_xform_copy
|
||||
#define H5D_XFER_XFORM_CMP H5P__dxfr_xform_cmp
|
||||
#define H5D_XFER_XFORM_CLOSE H5P__dxfr_xform_close
|
||||
/* Definitions for properties of direct chunk write */
|
||||
#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_SIZE sizeof(hbool_t)
|
||||
#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_DEF FALSE
|
||||
#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_SIZE sizeof(uint32_t)
|
||||
#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_DEF 0
|
||||
#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_SIZE sizeof(hsize_t *)
|
||||
#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF NULL
|
||||
#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_SIZE sizeof(uint32_t)
|
||||
#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF 0
|
||||
/* Definitions for properties of direct chunk read */
|
||||
#define H5D_XFER_DIRECT_CHUNK_READ_FLAG_SIZE sizeof(hbool_t)
|
||||
#define H5D_XFER_DIRECT_CHUNK_READ_FLAG_DEF FALSE
|
||||
#define H5D_XFER_DIRECT_CHUNK_READ_FILTERS_SIZE sizeof(uint32_t)
|
||||
#define H5D_XFER_DIRECT_CHUNK_READ_FILTERS_DEF 0
|
||||
#define H5D_XFER_DIRECT_CHUNK_READ_OFFSET_SIZE sizeof(hsize_t *)
|
||||
#define H5D_XFER_DIRECT_CHUNK_READ_OFFSET_DEF NULL
|
||||
|
||||
|
||||
/******************/
|
||||
@@ -266,13 +250,6 @@ static const H5Z_EDC_t H5D_def_enable_edc_g = H5D_XFER_EDC_DEF; /* De
|
||||
static const H5Z_cb_t H5D_def_filter_cb_g = H5D_XFER_FILTER_CB_DEF; /* Default value for filter callback */
|
||||
static const H5T_conv_cb_t H5D_def_conv_cb_g = H5D_XFER_CONV_CB_DEF; /* Default value for datatype conversion callback */
|
||||
static const void *H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */
|
||||
static const hbool_t H5D_def_direct_chunk_flag_g = H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_DEF; /* Default value for the flag of direct chunk write */
|
||||
static const uint32_t H5D_def_direct_chunk_filters_g = H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_DEF; /* Default value for the filters of direct chunk write */
|
||||
static const hsize_t *H5D_def_direct_chunk_offset_g = H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF; /* Default value for the offset of direct chunk write */
|
||||
static const uint32_t H5D_def_direct_chunk_datasize_g = H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF; /* Default value for the datasize of direct chunk write */
|
||||
static const hbool_t direct_chunk_read_flag = H5D_XFER_DIRECT_CHUNK_READ_FLAG_DEF; /* Default value for the flag of direct chunk read */
|
||||
static const hsize_t *direct_chunk_read_offset = H5D_XFER_DIRECT_CHUNK_READ_OFFSET_DEF; /* Default value for the offset of direct chunk read */
|
||||
static const uint32_t direct_chunk_read_filters = H5D_XFER_DIRECT_CHUNK_READ_FILTERS_DEF; /* Default value for the filters of direct chunk read */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -423,48 +400,6 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
|
||||
H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
|
||||
|
||||
/* Register the property of flag for direct chunk write */
|
||||
/* (Note: this property should not have an encode/decode callback -QAK) */
|
||||
if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_SIZE, &H5D_def_direct_chunk_flag_g,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
|
||||
|
||||
/* Register the property of filter for direct chunk write */
|
||||
/* (Note: this property should not have an encode/decode callback -QAK) */
|
||||
if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_SIZE, &H5D_def_direct_chunk_filters_g,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
|
||||
|
||||
/* Register the property of offset for direct chunk write */
|
||||
/* (Note: this property should not have an encode/decode callback -QAK) */
|
||||
if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_SIZE, &H5D_def_direct_chunk_offset_g,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
|
||||
|
||||
/* Register the property of datasize for direct chunk write */
|
||||
/* (Note: this property should not have an encode/decode callback -QAK) */
|
||||
if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_SIZE, &H5D_def_direct_chunk_datasize_g,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
|
||||
|
||||
/* Register the property of flag for direct chunk read */
|
||||
/* (Note: this property should not have an encode/decode callback) */
|
||||
if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, H5D_XFER_DIRECT_CHUNK_READ_FLAG_SIZE, &direct_chunk_read_flag,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
|
||||
|
||||
/* Register the property of filter for direct chunk read */
|
||||
/* (Note: this property should not have an encode/decode callback) */
|
||||
if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME, H5D_XFER_DIRECT_CHUNK_READ_FILTERS_SIZE, &direct_chunk_read_filters,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
|
||||
|
||||
/* Register the property of offset for direct chunk read */
|
||||
/* (Note: this property should not have an encode/decode callback) */
|
||||
if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_SIZE, &direct_chunk_read_offset,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5P__dxfr_reg_prop() */
|
||||
|
||||
Reference in New Issue
Block a user