summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-07-22 15:25:49 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-07-22 15:25:49 (GMT)
commitad8de00a0e61dce379f2eb9d424924aad63fe7bc (patch)
tree9a0b0e76e5edb48e1cedf4753eee0669f007121d /src
parent568f982ed26e88f8f8b9253b07cf8cd9bdebfcf6 (diff)
downloadhdf5-ad8de00a0e61dce379f2eb9d424924aad63fe7bc.zip
hdf5-ad8de00a0e61dce379f2eb9d424924aad63fe7bc.tar.gz
hdf5-ad8de00a0e61dce379f2eb9d424924aad63fe7bc.tar.bz2
[svn-r25463] more aligning with trunk.
Diffstat (limited to 'src')
-rw-r--r--src/H5Aint.c53
-rw-r--r--src/H5Apkg.h12
-rw-r--r--src/H5Aprivate.h8
-rw-r--r--src/H5Dint.c2
-rw-r--r--src/H5Dio.c96
-rw-r--r--src/H5Dpkg.h8
-rw-r--r--src/H5Dprivate.h9
-rw-r--r--src/H5F.c89
-rw-r--r--src/H5Fint.c249
-rw-r--r--src/H5Fprivate.h3
-rw-r--r--src/H5Fquery.c1
-rw-r--r--src/H5Ftest.c2
-rw-r--r--src/H5VLnative.c64
13 files changed, 290 insertions, 306 deletions
diff --git a/src/H5Aint.c b/src/H5Aint.c
index e78376d..d2dbed3 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -132,26 +132,22 @@ H5FL_SEQ_DEFINE(H5A_t_ptr);
* H5S_t *space; IN: Dataspace of attribute
* hid_t acpl_id IN: Attribute creation property list
*
- * Return: attribute structure on success, NULL on Failuer
+ * Return: attribute structure on success, NULL on Failure.
*
* Programmer: Quincey Koziol
* April 2, 1998
*
- * Modified: Mohamad Chaarawi
- * June 2012
- * Retuen H5A_t* instead of hid_t
- *
*-------------------------------------------------------------------------
*/
H5A_t *
H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
const H5S_t *space, hid_t acpl_id, hid_t dxpl_id)
{
+ H5A_t *attr = NULL; /* Attribute created */
hssize_t snelmts; /* elements in attribute */
size_t nelmts; /* elements in attribute */
htri_t tri_ret; /* htri_t return value */
- H5A_t *attr = NULL;
- H5A_t *ret_value = NULL; /* Attribute created */
+ H5A_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->oloc->addr, NULL)
@@ -926,49 +922,6 @@ H5A_get_info(const H5A_t *attr, H5A_info_t *ainfo)
} /* end H5A_get_info() */
-/*--------------------------------------------------------------------------
- NAME
- H5A_delete_by_idx
- PURPOSE
- private version of H5Adelete_by_idx
- RETURNS
- Non-negative on success/Negative on failure
---------------------------------------------------------------------------*/
-herr_t
-H5A_delete_by_idx(H5G_loc_t loc, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, hid_t lapl_id)
-{
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Set up opened group location to fill in */
- obj_loc.oloc = &obj_oloc;
- obj_loc.path = &obj_path;
- H5G_loc_reset(&obj_loc);
-
- /* Find the object's location */
- if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found")
- loc_found = TRUE;
-
- /* Delete the attribute from the location */
- if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
-
-done:
- /* Release resources */
- if(loc_found && H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5A_delete_by_idx() */
-
-
/*-------------------------------------------------------------------------
* Function: H5A_copy
*
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index 4fd8c6e..efa2b74 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -185,13 +185,16 @@ H5_DLLVAR const H5B2_class_t H5A_BT2_CORDER[1];
/* Function prototypes for H5A package scope */
H5_DLL herr_t H5A_init(void);
+H5_DLL herr_t H5A__term_deprec_interface(void);
H5_DLL H5A_t *H5A_create(const H5G_loc_t *loc, const char *name,
const H5T_t *type, const H5S_t *space, hid_t acpl_id, hid_t dxpl_id);
-H5_DLL herr_t H5A__term_deprec_interface(void);
H5_DLL H5A_t *H5A_open_by_name(const H5G_loc_t *loc, const char *obj_name,
const char *attr_name, hid_t lapl_id, hid_t dxpl_id);
H5_DLL H5A_t *H5A_open_by_idx(const H5G_loc_t *loc, const char *obj_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t dxpl_id);
+H5_DLL herr_t H5A_open_common(const H5G_loc_t *loc, H5A_t *attr);
+H5_DLL herr_t H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id);
+H5_DLL herr_t H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id);
H5_DLL ssize_t H5A_get_name(H5A_t *attr, size_t buf_size, char *buf);
H5_DLL H5A_t *H5A_copy(H5A_t *new_attr, const H5A_t *old_attr);
H5_DLL herr_t H5A_get_info(const H5A_t *attr, H5A_info_t *ainfo);
@@ -202,9 +205,10 @@ H5_DLL herr_t H5A_free(H5A_t *attr);
H5_DLL herr_t H5A_close(H5A_t *attr);
H5_DLL htri_t H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo);
H5_DLL herr_t H5A_set_version(const H5F_t *f, H5A_t *attr);
-H5_DLL herr_t H5A_open_common(const H5G_loc_t *loc, H5A_t *attr);
-H5_DLL herr_t H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id);
-H5_DLL herr_t H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id);
+H5_DLL herr_t H5A_rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name,
+ const char *new_attr_name, hid_t lapl_id);
+H5_DLL htri_t H5A_exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name,
+ hid_t lapl_id);
/* Attribute "dense" storage routines */
H5_DLL herr_t H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo);
diff --git a/src/H5Aprivate.h b/src/H5Aprivate.h
index fa774fa..6646fa2 100644
--- a/src/H5Aprivate.h
+++ b/src/H5Aprivate.h
@@ -32,6 +32,7 @@
/* Library Private Macros */
/**************************/
+
/****************************/
/* Library Private Typedefs */
/****************************/
@@ -82,11 +83,6 @@ H5_DLL herr_t H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc,
H5_DLL herr_t H5O_attr_iterate(hid_t loc_id, hid_t dxpl_id, H5_index_t idx_type,
H5_iter_order_t order, hsize_t skip, hsize_t *last_attr,
const H5A_attr_iter_op_t *op, void *op_data);
-H5_DLL herr_t H5A_rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name,
- const char *new_attr_name, hid_t lapl_id);
-H5_DLL herr_t H5A_delete_by_idx(H5G_loc_t loc, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, hid_t lapl_id);
-H5_DLL htri_t H5A_exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name,
- hid_t lapl_id);
+
#endif /* _H5Aprivate_H */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 1b15260..1beb0a2 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -2084,7 +2084,7 @@ H5D__vlen_get_buf_size(void UNUSED *elem, hid_t type_id, unsigned UNUSED ndim, c
type_id, vlen_bufsize->mspace_id,
vlen_bufsize->fspace_id, vlen_bufsize->xfer_pid,
vlen_bufsize->fl_tbuf, H5_EVENT_STACK_NULL) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 94517a7..4a99313 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -120,9 +120,11 @@ herr_t
H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, void *buf/*out*/)
{
- H5VL_t *vol_plugin = NULL;
- void *dset = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_t *vol_plugin = NULL;
+ void *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,
@@ -134,6 +136,23 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
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, "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, "selection+offset not within extent")
+ } /* end if */
+
/* Get the default dataset transfer property list if the user didn't provide one */
if (H5P_DEFAULT == plist_id)
plist_id= H5P_DATASET_XFER_DEFAULT;
@@ -191,17 +210,19 @@ 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)
{
- H5VL_t *vol_plugin;
- void *dset;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_t *vol_plugin = NULL;
+ void *dset = NULL;
+ H5P_genplist_t *plist; /* Property list pointer */
+ 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)
H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id,
dxpl_id, buf);
/* check arguments */
- if(!dset_id)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
@@ -212,6 +233,37 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms")
+ /* Get the dataset transfer property list */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
+
+ /* Retrieve the 'direct write' flag */
+ if(H5P_get(plist, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &direct_write) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting flag for direct chunk write")
+
+ /* 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 */
+ }
+
/* get the plugin pointer */
if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
@@ -239,31 +291,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__pre_write(H5D_t *dset, hid_t mem_type_id, const H5S_t *mem_space,
- const H5S_t *file_space, hid_t dxpl_id, const void *buf)
+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,
+ hid_t dxpl_id, const void *buf)
{
- H5P_genplist_t *plist; /* Property list pointer */
- hbool_t direct_write = FALSE;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
-
- /* 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, "not xfer parms")
-
- /* Get the dataset transfer property list */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
- /* Retrieve the 'direct write' flag */
- if(H5P_get(plist, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &direct_write) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting flag for direct chunk write")
+ FUNC_ENTER_STATIC
/* Direct chunk write */
if(direct_write) {
+ H5P_genplist_t *plist; /* Property list pointer */
uint32_t direct_filters;
hsize_t *direct_offset;
uint32_t direct_datasize;
@@ -272,6 +310,10 @@ H5D__pre_write(H5D_t *dset, hid_t mem_type_id, const H5S_t *mem_space,
hsize_t internal_offset[H5O_LAYOUT_NDIMS];
int i;
+ /* Get the dataset transfer property list */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
+
if(H5D_CHUNKED != dset->shared->layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 5713ee3..9d828e4 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -550,6 +550,14 @@ H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset, hid_t dxpl_id);
H5_DLL herr_t H5D__mark(const H5D_t *dataset, hid_t dxpl_id, unsigned flags);
H5_DLL herr_t H5D__flush_real(H5D_t *dataset, hid_t dxpl_id);
+/* 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, hid_t dxpl_id, 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, hid_t dset_xfer_plist, void *buf/*out*/);
+H5_DLL herr_t H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
+ const H5S_t *file_space, hid_t dset_xfer_plist, const void *buf);
+
/* Functions that perform direct serial I/O operations */
H5_DLL herr_t H5D__select_read(const H5D_io_info_t *io_info,
const H5D_type_info_t *type_info,
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index faa10c2..0b8b76f 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -154,15 +154,6 @@ typedef struct H5D_copy_file_ud_t {
/******************************/
/* Library Private Prototypes */
/******************************/
-/* Internal I/O routines */
-H5_DLL herr_t H5D__pre_write(H5D_t *dset, hid_t mem_type_id, const H5S_t *mem_space,
- const H5S_t *file_space, hid_t dxpl_id, 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, hid_t dset_xfer_plist,
- void *buf/*out*/);
-H5_DLL herr_t H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
- const H5S_t *file_space, hid_t dset_xfer_plist,
- const void *buf);
H5_DLL herr_t H5D_init(void);
H5_DLL H5D_t *H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id);
diff --git a/src/H5F.c b/src/H5F.c
index ec6501b..5ae09cf 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -35,6 +35,7 @@
#include "H5VLnative.h" /* Native Plugin */
#include "H5VLprivate.h" /* VOL plugins */
+
/****************/
/* Local Macros */
/****************/
@@ -43,22 +44,33 @@
/* Local Typedefs */
/******************/
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
/********************/
/* Local Prototypes */
/********************/
+
+
/*********************/
/* Package Variables */
/*********************/
+
/*****************************/
/* Library Private Variables */
/*****************************/
+
/*******************/
/* Local Variables */
/*******************/
+
/* File ID class */
static const H5I_class_t H5I_FILE_CLS[1] = {{
H5I_FILE, /* ID class value */
@@ -120,20 +132,6 @@ H5F_init(void)
FUNC_ENTER_NOAPI(FAIL)
/* FUNC_ENTER() does all the work */
-#if 0
- FUNC_ENTER_NOAPI_NOINIT
-
- /*
- * Initialize the atom group for the file IDs.
- */
- if(H5I_register_type(H5I_FILE_CLS) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_init_interface() */
-#endif
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_init() */
@@ -292,7 +290,6 @@ H5F_get_all_count_cb(void UNUSED *obj_ptr, hid_t UNUSED obj_id, void *key)
*(udata->obj_count) = *(udata->obj_count)+1;
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F_get_all_count_cb */
@@ -385,7 +382,7 @@ H5F_get_all_ids_cb(void UNUSED *obj_ptr, hid_t obj_id, void *key)
H5F_trav_obj_ids_t *udata = (H5F_trav_obj_ids_t *)key;
int ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
if(*udata->obj_count >= udata->max_objs)
HGOTO_DONE(H5_ITER_STOP);
@@ -433,11 +430,12 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list)
if(file_id != (hid_t)H5F_OBJ_ALL) {
H5VL_t *vol_plugin;
void *obj;
+
/* get the plugin pointer */
if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
/* get the file object */
- if(NULL == (obj = (void *)H5I_object(file_id)))
+ if(NULL == (obj = (void *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_OBJ_IDS, H5AC_dxpl_id, H5_EVENT_STACK_NULL,
@@ -531,6 +529,7 @@ done:
* Purpose: Check if the file can be opened with the given fapl.
*
* Return: Success: TRUE/FALSE
+ *
* Failure: Negative
*
* Programmer: Mohamad Chaarawi
@@ -557,8 +556,8 @@ H5Fis_accessible(const char *name, hid_t fapl_id)
if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list")
- if(H5VL_file_misc(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5AC_ind_dxpl_g, H5_EVENT_STACK_NULL,
- fapl_id, name, &ret_value) < 0)
+ if(H5VL_file_misc(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5AC_dxpl_id,
+ H5_EVENT_STACK_NULL, fapl_id, name, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle")
done:
@@ -630,7 +629,8 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list")
/* create a new file or truncate an existing file through the VOL */
- if(NULL == (file = H5VL_file_create(&vol_plugin, filename, flags, fcpl_id, fapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL)))
+ if(NULL == (file = H5VL_file_create(&vol_plugin, filename, flags, fcpl_id, fapl_id,
+ H5AC_dxpl_id, H5_EVENT_STACK_NULL)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file")
/* Get an atom for the file with the VOL information as the auxilary struct*/
@@ -1222,12 +1222,16 @@ herr_t
H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr)
{
H5VL_t *vol_plugin;
- void *obj;
+ void *file;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*d", file_id, hit_rate_ptr);
+ /* Check args */
+ if(NULL == (file = (void *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+
if(NULL == hit_rate_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer")
@@ -1235,12 +1239,8 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr)
if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
- /* get the file object */
- if(NULL == (obj = (void *)H5I_object(file_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
-
- if((ret_value = H5VL_file_optional(obj, vol_plugin, H5VL_FILE_GET_MDC_HR, H5AC_dxpl_id, H5_EVENT_STACK_NULL,
- hit_rate_ptr)) < 0)
+ if((ret_value = H5VL_file_optional(file, vol_plugin, H5VL_FILE_GET_MDC_HR,
+ H5AC_dxpl_id, H5_EVENT_STACK_NULL, hit_rate_ptr)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC hit rate")
done:
@@ -1270,22 +1270,22 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
size_t *cur_size_ptr, int *cur_num_entries_ptr)
{
H5VL_t *vol_plugin;
- void *obj;
+ void *file;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*z*z*z*Is", file_id, max_size_ptr, min_clean_size_ptr,
cur_size_ptr, cur_num_entries_ptr);
+ /* Check args */
+ if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+
/* get the plugin pointer */
if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
- /* get the file object */
- if(NULL == (obj = (void *)H5I_object(file_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
-
- if((ret_value = H5VL_file_optional(obj, vol_plugin, H5VL_FILE_GET_MDC_SIZE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, max_size_ptr,
+ if((ret_value = H5VL_file_optional(file, vol_plugin, H5VL_FILE_GET_MDC_SIZE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, max_size_ptr,
min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC size")
@@ -1470,13 +1470,15 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects,
H5F_sect_info_t *sect_info/*out*/)
{
H5VL_t *vol_plugin;
- void *obj;
+ void *file;
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("Zs", "iFmzx", file_id, type, nsects, sect_info);
/* Check args */
+ if(NULL == (file = (void *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
if(sect_info && nsects == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0")
@@ -1484,11 +1486,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects,
if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
- /* get the file object */
- if(NULL == (obj = (void *)H5I_object(file_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
-
- if(H5VL_file_optional(obj, vol_plugin, H5VL_FILE_GET_FREE_SECTIONS, H5AC_dxpl_id, H5_EVENT_STACK_NULL, sect_info,
+ if(H5VL_file_optional(file, vol_plugin, H5VL_FILE_GET_FREE_SECTIONS, H5AC_dxpl_id, H5_EVENT_STACK_NULL, sect_info,
&ret_value, type, nsects) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file free sections")
done:
@@ -1513,22 +1511,23 @@ done:
herr_t
H5Fclear_elink_file_cache(hid_t file_id)
{
- H5VL_t *vol_plugin;
- void *obj;
+ H5VL_t *vol_plugin;
+ void *file;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
+ /* Check args */
+ if(NULL == (file = (void *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+
/* get the plugin pointer */
if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
- /* get the file object */
- if(NULL == (obj = (void *)H5I_object(file_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if(H5VL_file_optional(obj, vol_plugin, H5VL_FILE_CLEAR_ELINK_CACHE, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0)
+ if(H5VL_file_optional(file, vol_plugin, H5VL_FILE_CLEAR_ELINK_CACHE, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
done:
diff --git a/src/H5Fint.c b/src/H5Fint.c
index c6f68cb..45dfb89 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -1294,6 +1294,7 @@ herr_t
H5F_close(H5F_t *f)
{
herr_t ret_value = SUCCEED; /* Return value */
+
FUNC_ENTER_NOAPI_NOINIT
/* Sanity check */
@@ -1460,10 +1461,10 @@ H5F_try_close(H5F_t *f)
/* Check if this is a child file in a mounting hierarchy & proceed up the
* hierarchy if so.
*/
- if(f->parent) {
+ if(f->parent)
if(H5F_try_close(f->parent) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close parent file")
- }
+
/* Unmount and close each child before closing the current file. */
if(H5F_close_mounts(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't unmount child files")
@@ -1537,6 +1538,45 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5F_get_id
+ *
+ * Purpose: Get the file ID, incrementing it, or "resurrecting" it as
+ * appropriate.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * Oct 29, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5F_get_id(H5F_t *file, hbool_t app_ref)
+{
+ hid_t ret_value;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ HDassert(file);
+
+ if (FAIL == (ret_value = H5I_get_id(file, H5I_FILE))) {
+ /* resurrect the ID - Register an ID with the native plugin */
+ if((ret_value = H5VL_native_register(H5I_FILE, file, app_ref)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ file->id_exists = TRUE;
+ }
+ else {
+ /* Increment ref count on existing ID */
+ if(H5I_inc_ref(ret_value, app_ref) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_get_id() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_incr_nopen_objs
*
* Purpose: Increment the number of open objects for a file.
@@ -1874,106 +1914,6 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*o
/*-------------------------------------------------------------------------
- * Function: H5F_get_file_image
- *
- * Purpose: Private version of H5Fget_file_image
- *
- * Return: Success: Bytes copied / number of bytes needed.
- * Failure: negative value
- *
- * Programmer: John Mainzer
- * 11/15/11
- *
- *-------------------------------------------------------------------------
- */
-ssize_t
-H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
-{
- H5FD_t *fd_ptr; /* file driver */
- haddr_t eoa; /* End of file address */
- ssize_t ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- if(!file || !file->shared || !file->shared->lf)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file_id yields invalid file pointer")
- fd_ptr = file->shared->lf;
- if(!fd_ptr->cls)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "fd_ptr yields invalid class pointer")
-
- /* the address space used by the split and multi file drivers is not
- * a good fit for this call. Since the plan is to depreciate these
- * drivers anyway, don't bother to do a "force fit".
- *
- * The following clause tests for the multi file driver, and fails
- * if the supplied file has the multi file driver as its top level
- * file driver. However, this test will not work if there is some
- * other file driver sitting on top of the multi file driver.
- *
- * I'm not sure if this is possible at present, but in all likelyhood,
- * it will become possible in the future. On the other hand, we may
- * remove the split/multi file drivers before then.
- *
- * I am leaving this solution in for now, but we should review it,
- * and improve the solution if necessary.
- *
- * JRM -- 11/11/22
- */
- if(HDstrcmp(fd_ptr->cls->name, "multi") == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not supported for multi file driver.")
-
- /* While the family file driver is conceptually fully compatible
- * with the get file image operation, it sets a file driver message
- * in the super block that prevents the image being opened with any
- * driver other than the family file driver. Needless to say, this
- * rather defeats the purpose of the get file image operation.
- *
- * While this problem is quire solvable, the required time and
- * resources are lacking at present. Hence, for now, we don't
- * allow the get file image operation to be perfomed on files
- * opened with the family file driver.
- *
- * Observe that the following test only looks at the top level
- * driver, and fails if there is some other driver sitting on to
- * of the family file driver.
- *
- * I don't think this can happen at present, but that may change
- * in the future.
- * JRM -- 12/21/11
- */
- if(HDstrcmp(fd_ptr->cls->name, "family") == 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "Not supported for family file driver.")
-
- /* Go get the actual file size */
- if(HADDR_UNDEF == (eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
-
- /* set ret_value = to eoa -- will overwrite this if appropriate */
- ret_value = (ssize_t)eoa;
-
- /* test to see if a buffer was provided -- if not, we are done */
- if(buf_ptr != NULL) {
- size_t space_needed; /* size of file image */
-
- /* Check for buffer too small */
- if((haddr_t)buf_len < eoa)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "supplied buffer too small")
-
- space_needed = (size_t)eoa;
-
- /* read in the file image */
- /* (Note compensation for base address addition in internal routine) */
- if(H5FD_read(fd_ptr, H5AC_ind_dxpl_g, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed")
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5F_get_file_image() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5F_set_grp_btree_shared
*
* Purpose: Set the grp_btree_shared field with a valid ref-count pointer.
@@ -2120,39 +2060,100 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag)
/*-------------------------------------------------------------------------
- * Function: H5F_get_id
+ * Function: H5F_get_file_image
*
- * Purpose: Get the file ID, incrementing it, or "resurrecting" it as
- * appropriate.
+ * Purpose: Private version of H5Fget_file_image
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Success: Bytes copied / number of bytes needed.
+ * Failure: negative value
*
- * Programmer: Raymond Lu
- * Oct 29, 2003
+ * Programmer: John Mainzer
+ * 11/15/11
*
*-------------------------------------------------------------------------
*/
-hid_t
-H5F_get_id(H5F_t *file, hbool_t app_ref)
+ssize_t
+H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
{
- hid_t ret_value;
+ H5FD_t *fd_ptr; /* file driver */
+ haddr_t eoa; /* End of file address */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
- HDassert(file);
+ /* Check args */
+ if(!file || !file->shared || !file->shared->lf)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file_id yields invalid file pointer")
+ fd_ptr = file->shared->lf;
+ if(!fd_ptr->cls)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "fd_ptr yields invalid class pointer")
- if (FAIL == (ret_value = H5I_get_id(file, H5I_FILE))) {
- /* resurrect the ID - Register an ID with the native plugin */
- if((ret_value = H5VL_native_register(H5I_FILE, file, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
- file->id_exists = TRUE;
- }
- else {
- /* Increment ref count on existing ID */
- if(H5I_inc_ref(ret_value, app_ref) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed")
- }
+ /* the address space used by the split and multi file drivers is not
+ * a good fit for this call. Since the plan is to depreciate these
+ * drivers anyway, don't bother to do a "force fit".
+ *
+ * The following clause tests for the multi file driver, and fails
+ * if the supplied file has the multi file driver as its top level
+ * file driver. However, this test will not work if there is some
+ * other file driver sitting on top of the multi file driver.
+ *
+ * I'm not sure if this is possible at present, but in all likelyhood,
+ * it will become possible in the future. On the other hand, we may
+ * remove the split/multi file drivers before then.
+ *
+ * I am leaving this solution in for now, but we should review it,
+ * and improve the solution if necessary.
+ *
+ * JRM -- 11/11/22
+ */
+ if(HDstrcmp(fd_ptr->cls->name, "multi") == 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not supported for multi file driver.")
+ /* While the family file driver is conceptually fully compatible
+ * with the get file image operation, it sets a file driver message
+ * in the super block that prevents the image being opened with any
+ * driver other than the family file driver. Needless to say, this
+ * rather defeats the purpose of the get file image operation.
+ *
+ * While this problem is quire solvable, the required time and
+ * resources are lacking at present. Hence, for now, we don't
+ * allow the get file image operation to be perfomed on files
+ * opened with the family file driver.
+ *
+ * Observe that the following test only looks at the top level
+ * driver, and fails if there is some other driver sitting on to
+ * of the family file driver.
+ *
+ * I don't think this can happen at present, but that may change
+ * in the future.
+ * JRM -- 12/21/11
+ */
+ if(HDstrcmp(fd_ptr->cls->name, "family") == 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "Not supported for family file driver.")
+
+ /* Go get the actual file size */
+ if(HADDR_UNDEF == (eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
+
+ /* set ret_value = to eoa -- will overwrite this if appropriate */
+ ret_value = (ssize_t)eoa;
+
+ /* test to see if a buffer was provided -- if not, we are done */
+ if(buf_ptr != NULL) {
+ size_t space_needed; /* size of file image */
+
+ /* Check for buffer too small */
+ if((haddr_t)buf_len < eoa)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "supplied buffer too small")
+
+ space_needed = (size_t)eoa;
+
+ /* read in the file image */
+ /* (Note compensation for base address addition in internal routine) */
+ if(H5FD_read(fd_ptr, H5AC_ind_dxpl_g, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed")
+ } /* end if */
+
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_get_id() */
+} /* H5F_get_file_image() */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index b459476..c8cbb83 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -29,6 +29,7 @@
/* Private headers needed by this file */
#include "H5VMprivate.h" /* Vectors and arrays */
+
/**************************/
/* Library Private Macros */
/**************************/
@@ -294,7 +295,7 @@ typedef struct {
#define H5F_NOPEN_OBJS(F) ((F)->nopen_objs)
#define H5F_INCR_NOPEN_OBJS(F) ((F)->nopen_objs++)
#define H5F_DECR_NOPEN_OBJS(F) ((F)->nopen_objs--)
-#define H5F_FILE_ID(F) ((F)->id_exists)//file_id)
+#define H5F_FILE_ID(F) ((F)->id_exists)
#define H5F_PARENT(F) ((F)->parent)
#define H5F_NMOUNTS(F) ((F)->nmounts)
#define H5F_DRIVER_ID(F) ((F)->shared->lf->driver_id)
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 2e15191..4c25a71 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -1072,3 +1072,4 @@ H5F_use_tmp_space(const H5F_t *f)
FUNC_LEAVE_NOAPI(f->shared->use_tmp_space)
} /* end H5F_use_tmp_space() */
+
diff --git a/src/H5Ftest.c b/src/H5Ftest.c
index 0073db7..73b00a6 100644
--- a/src/H5Ftest.c
+++ b/src/H5Ftest.c
@@ -45,7 +45,7 @@
#include "H5Gpkg.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
#include "H5SMpkg.h" /* Shared object header messages */
-#include "H5VLprivate.h" /* Virtual Object Layer */
+
/****************/
/* Local Macros */
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index 9df9eb9..4dcd2ba 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -1496,25 +1496,13 @@ H5VL_native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id,
if(NULL == dset->oloc.file)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
- if(mem_space_id < 0 || file_space_id < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
-
- 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)
- 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)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
+ 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(file_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)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* read raw data */
if(H5D__read(dset, mem_type_id, mem_space, file_space, plist_id, buf/*out*/) < 0)
@@ -1542,10 +1530,12 @@ static herr_t
H5VL_native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t dxpl_id, const void *buf, void UNUSED **req)
{
- H5D_t *dset = (H5D_t *)obj;
- const H5S_t *mem_space = NULL;
- const H5S_t *file_space = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t *dset = (H5D_t *)obj;
+ const H5S_t *mem_space = NULL;
+ const H5S_t *file_space = NULL;
+ H5P_genplist_t *plist; /* Property list pointer */
+ hbool_t direct_write = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1553,27 +1543,25 @@ H5VL_native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id,
if(NULL == dset->oloc.file)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
- if(mem_space_id < 0 || file_space_id < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
+ /* Get the dataset transfer property list */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
- 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")
+ /* Retrieve the 'direct write' flag */
+ if(H5P_get(plist, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &direct_write) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting flag for direct chunk write")
- /* 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 data space")
+ if(!direct_write) {
+ 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(file_space) != TRUE)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "file 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, "not a data space")
} /* end if */
- if(H5D__pre_write(dset, mem_type_id, mem_space, file_space, dxpl_id, buf) < 0)
+ if(H5D__pre_write(dset, direct_write, mem_type_id, mem_space, file_space, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't prepare for writing data")
done: