summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5A.c4
-rw-r--r--src/H5D.c8
-rw-r--r--src/H5Dint.c6
-rw-r--r--src/H5Gint.c2
-rw-r--r--src/H5Gloc.c13
-rw-r--r--src/H5Gtest.c16
-rw-r--r--src/H5Gtraverse.c18
-rw-r--r--src/H5I.c51
-rw-r--r--src/H5L.c10
-rw-r--r--src/H5Sselect.c2
-rw-r--r--src/H5T.c13
-rw-r--r--src/H5Tvlen.c2
-rw-r--r--src/H5VL.c115
-rw-r--r--src/H5VLnative.c6
14 files changed, 210 insertions, 56 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 09e838f..c59e098 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -225,7 +225,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
H5TRACE6("i", "i*siiii", loc_id, attr_name, type_id, space_id, acpl_id, aapl_id);
/* check arguments */
- if(H5I_ATTR_PUBLIC == H5I_get_type(loc_id))
+ if(H5I_ATTR_PUBLIC == H5I_get_type(loc_id) || H5I_DATATYPE == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if(!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
@@ -301,7 +301,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
acpl_id, aapl_id, lapl_id);
/* check arguments */
- if(H5I_ATTR_PUBLIC == H5I_get_type(loc_id))
+ if(H5I_ATTR_PUBLIC == H5I_get_type(loc_id) || H5I_DATATYPE == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if(!obj_name || !*obj_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name")
diff --git a/src/H5D.c b/src/H5D.c
index acb300f..4a9c03f 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -647,7 +647,7 @@ H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid operator")
if(NULL == buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer")
- if(H5I_DATATYPE != H5I_get_type(type_id))
+ if(H5I_DATATYPE != H5I_get_type(type_id) && H5I_DATATYPE_PUBLIC != H5I_get_type(type_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype")
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
@@ -686,7 +686,8 @@ H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf)
H5TRACE4("e", "iii*x", type_id, space_id, plist_id, buf);
/* Check args */
- if(H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL)
+ if((H5I_DATATYPE != H5I_get_type(type_id) && H5I_DATATYPE_PUBLIC != H5I_get_type(type_id)) ||
+ buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
@@ -748,7 +749,8 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
/* Check args */
if(H5I_DATASET_PUBLIC != H5I_get_type(dataset_id) ||
- H5I_DATATYPE != H5I_get_type(type_id) || size == NULL)
+ (H5I_DATATYPE != H5I_get_type(type_id) && H5I_DATATYPE_PUBLIC != H5I_get_type(type_id)) ||
+ size == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 043909c..31cd84b 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -1921,7 +1921,7 @@ H5D_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t op,
/* Check args */
HDassert(buf);
- HDassert(H5I_DATATYPE == H5I_get_type(type_id));
+ HDassert(H5I_DATATYPE == H5I_get_type(type_id) || H5I_DATATYPE_PUBLIC == H5I_get_type(type_id));
HDassert(space);
HDassert(H5S_has_extent(space));
HDassert(op);
@@ -1957,7 +1957,7 @@ H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, void *buf)
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- HDassert(H5I_DATATYPE == H5I_get_type(type_id));
+ HDassert(H5I_DATATYPE == H5I_get_type(type_id) || H5I_DATATYPE_PUBLIC == H5I_get_type(type_id));
HDassert(space);
HDassert(H5P_isa_class(plist_id, H5P_DATASET_XFER));
HDassert(buf);
@@ -2044,7 +2044,7 @@ H5D_vlen_get_buf_size(void UNUSED *elem, hid_t type_id, unsigned UNUSED ndim, co
FUNC_ENTER_NOAPI_NOINIT
HDassert(op_data);
- HDassert(H5I_DATATYPE == H5I_get_type(type_id));
+ HDassert(H5I_DATATYPE == H5I_get_type(type_id) || H5I_DATATYPE_PUBLIC == H5I_get_type(type_id));
/* Check args */
if(NULL == (dt = (H5T_t *)H5I_object(type_id)))
diff --git a/src/H5Gint.c b/src/H5Gint.c
index ee0295c..1dcc518 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -840,7 +840,7 @@ H5G_iterate(hid_t loc_id, const char *group_name,
if((gid = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
- /* Create a new id that points to a struct that holds the group id and the VOL plugin */
+ /* MSC - Create a new id that points to a struct that holds the group id and the VOL plugin */
/* Allocate new id structure */
if(NULL == (id_wrapper2 = (H5VL_id_wrapper_t *)H5MM_malloc(sizeof(H5VL_id_wrapper_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index d5b0d21..1080add 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -157,16 +157,14 @@ static herr_t H5G_loc_get_comment_cb(H5G_loc_t *grp_loc, const char *name,
*-------------------------------------------------------------------------
*/
herr_t
-H5G_loc(hid_t id, H5G_loc_t *loc)
+H5G_loc(hid_t loc_id, H5G_loc_t *loc)
{
- H5VL_id_wrapper_t *id_wrapper; /* user id structure */
- hid_t loc_id;
H5I_type_t id_type;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- id_type = H5I_get_type(id);
+ id_type = H5I_get_type(loc_id);
/* get the actual ID from an upper ID level */
/* MSC - this is a workaround to allow the test suite to pass and
at some point needs to be removed once all high level operations
@@ -174,13 +172,12 @@ H5G_loc(hid_t id, H5G_loc_t *loc)
if (H5I_FILE_PUBLIC == id_type || H5I_GROUP_PUBLIC == id_type ||
H5I_DATASET_PUBLIC == id_type || H5I_DATATYPE_PUBLIC == id_type ||
H5I_ATTR_PUBLIC == id_type) {
- if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(id)))
+ H5VL_id_wrapper_t *id_wrapper; /* user id structure */
+ if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
loc_id = id_wrapper->obj_id;
}
- else {
- loc_id = id;
- }
+
switch(H5I_get_type(loc_id)) {
case H5I_FILE:
{
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index 48aa10b..86730a7 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -36,6 +36,7 @@
#include "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
#include "H5Iprivate.h" /* IDs */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
@@ -514,6 +515,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
{
void *obj_ptr; /* Pointer to object for ID */
H5G_name_t *obj_path; /* Pointer to group hier. path for obj */
+ H5I_type_t id_type;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -522,6 +524,20 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
HDassert(user_path_len);
HDassert(obj_hidden);
+ id_type = H5I_get_type(obj_id);
+ /* get the actual OBJ_ID from an upper ID level */
+ /* MSC - this is a workaround to allow the test suite to pass and
+ at some point needs to be removed once all high level operations
+ that needs to go through the VOL actually go through the VOL*/
+ if (H5I_FILE_PUBLIC == id_type || H5I_GROUP_PUBLIC == id_type ||
+ H5I_DATASET_PUBLIC == id_type || H5I_DATATYPE_PUBLIC == id_type ||
+ H5I_ATTR_PUBLIC == id_type) {
+ H5VL_id_wrapper_t *id_wrapper; /* user id structure */
+ if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
+ obj_id = id_wrapper->obj_id;
+ }
+
/* Get pointer to object for ID */
if(NULL == (obj_ptr = H5I_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get object for ID")
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index aff87f8..b375fe1 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -29,6 +29,7 @@
/****************/
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
+#define H5F_PACKAGE /*suppress error about including H5Fpkg */
/***********/
@@ -38,6 +39,7 @@
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
+#include "H5Fpkg.h" /* Files */
#include "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
#include "H5Iprivate.h" /* IDs */
@@ -45,7 +47,7 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Ppublic.h" /* Property Lists */
#include "H5WBprivate.h" /* Wrapped Buffers */
-
+#include "H5VLprivate.h" /* VOL */
/****************/
/* Local Macros */
@@ -180,6 +182,7 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk,
hid_t lapl_id = (-1); /* LAPL local to this routine */
H5P_genplist_t *lapl; /* LAPL with nlinks set */
hid_t cur_grp = (-1);
+ H5VL_id_wrapper_t *id_wrapper; /* wrapper for the group ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -210,6 +213,17 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk,
if((cur_grp = H5I_register(H5I_GROUP, grp, FALSE)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ /* MSC - Create a new id that points to a struct that holds the group id and the VOL plugin */
+ /* Allocate new id structure */
+ if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5MM_malloc(sizeof(H5VL_id_wrapper_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ id_wrapper->obj_id = cur_grp;
+ id_wrapper->vol_plugin = grp_loc->oloc->file->vol_cls;
+ grp_loc->oloc->file->vol_cls->nrefs++;
+
+ if((cur_grp = H5I_register(H5I_GROUP_PUBLIC, id_wrapper, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize group handle")
+
/* Check for generic default property list and use link access default if so */
if(_lapl_id == H5P_DEFAULT) {
HDassert(H5P_LINK_ACCESS_DEFAULT != -1);
@@ -280,7 +294,7 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk,
done:
/* Close location given to callback. */
- if(cur_grp > 0 && H5I_dec_ref(cur_grp) < 0)
+ if(cur_grp > 0 && H5I_dec_ref(id_wrapper->obj_id) < 0 && H5I_dec_ref(cur_grp) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close atom for current location")
if(ret_value < 0 && cb_return > 0 && H5I_dec_ref(cb_return) < 0)
diff --git a/src/H5I.c b/src/H5I.c
index d60d405..617b7a4 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -2156,25 +2156,12 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5Iget_file_id(hid_t uid)
+H5Iget_file_id(hid_t id)
{
- H5VL_id_wrapper_t *id_wrapper; /* user id structure */
- hid_t id;
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE1("i", "i", uid);
-
- if (H5I_FILE_PUBLIC == H5I_get_type(uid) || H5I_GROUP_PUBLIC == H5I_get_type(uid) ||
- H5I_DATASET_PUBLIC == H5I_get_type(uid) || H5I_DATATYPE_PUBLIC == H5I_get_type(uid) ||
- H5I_ATTR_PUBLIC == H5I_get_type(uid)) {
- if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(uid)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
- id = id_wrapper->obj_id;
- }
- else {
- id = uid;
- }
+ H5TRACE1("i", "i", id);
if((ret_value = H5I_get_file_id(id, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID")
@@ -2205,10 +2192,25 @@ hid_t
H5I_get_file_id(hid_t obj_id, hbool_t app_ref)
{
H5I_type_t type; /* ID type */
+ H5I_type_t id_type;
hid_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
+ id_type = H5I_get_type(obj_id);
+ /* get the actual OBJ_ID from an upper ID level */
+ /* MSC - this is a workaround to allow the test suite to pass and
+ at some point needs to be removed once all high level operations
+ that needs to go through the VOL actually go through the VOL*/
+ if (H5I_FILE_PUBLIC == id_type || H5I_GROUP_PUBLIC == id_type ||
+ H5I_DATASET_PUBLIC == id_type || H5I_DATATYPE_PUBLIC == id_type ||
+ H5I_ATTR_PUBLIC == id_type) {
+ H5VL_id_wrapper_t *id_wrapper; /* user id structure */
+ if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
+ obj_id = id_wrapper->obj_id;
+ }
+
/* Get object type */
type = H5I_TYPE(obj_id);
if(H5I_FILE == type) {
@@ -2280,6 +2282,12 @@ H5VL_replace_with_uids(hid_t *old_list, ssize_t num_ids)
else if (H5I_DATASET == type) {
type_ptr = H5I_id_type_list_g[H5I_DATASET_PUBLIC];
}
+ else if (H5I_DATATYPE == type) {
+ type_ptr = H5I_id_type_list_g[H5I_DATATYPE_PUBLIC];
+ }
+ else if (H5I_ATTR == type) {
+ type_ptr = H5I_id_type_list_g[H5I_ATTR_PUBLIC];
+ }
else {
ret_value ++;
continue;
@@ -2341,12 +2349,21 @@ H5VL_inc_ref_uid(hid_t id, hbool_t app_ref)
type = H5I_get_type(id);
- if (type == H5I_FILE) {
+ if (H5I_FILE == type) {
type_ptr = H5I_id_type_list_g[H5I_FILE_PUBLIC];
}
- else if (type = H5I_GROUP) {
+ else if (H5I_GROUP == type) {
type_ptr = H5I_id_type_list_g[H5I_GROUP_PUBLIC];
}
+ else if (H5I_DATASET == type) {
+ type_ptr = H5I_id_type_list_g[H5I_DATASET_PUBLIC];
+ }
+ else if (H5I_DATATYPE == type) {
+ type_ptr = H5I_id_type_list_g[H5I_DATATYPE_PUBLIC];
+ }
+ else if (H5I_ATTR == type) {
+ type_ptr = H5I_id_type_list_g[H5I_ATTR_PUBLIC];
+ }
else {
HGOTO_DONE(ret_value)
}
diff --git a/src/H5L.c b/src/H5L.c
index 3705144..32e0c41 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -1311,19 +1311,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Lvisit(hid_t uid, H5_index_t idx_type, H5_iter_order_t order,
+H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
H5L_iterate_t op, void *op_data)
{
H5I_type_t id_type; /* Type of ID */
- H5VL_id_wrapper_t *id_wrapper; /* user id structure */
- hid_t grp_id;
herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "iIiIox*x", grp_id, idx_type, order, op, op_data);
- id_type = H5I_get_type(uid);
+ id_type = H5I_get_type(grp_id);
+#if 0
if (H5I_FILE_PUBLIC == id_type) {
if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(uid)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
@@ -1333,9 +1332,10 @@ H5Lvisit(hid_t uid, H5_index_t idx_type, H5_iter_order_t order,
else {
grp_id = uid;
}
+#endif
/* Check args */
- if(!(H5I_GROUP == id_type || H5I_FILE == id_type))
+ if(!(H5I_GROUP_PUBLIC == id_type || H5I_FILE_PUBLIC == id_type))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 91aed1e..b1d1058 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -1240,7 +1240,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t
/* Check args */
HDassert(buf);
- HDassert(H5I_DATATYPE == H5I_get_type(type_id));
+ HDassert(H5I_DATATYPE == H5I_get_type(type_id) || H5I_DATATYPE_PUBLIC == H5I_get_type(type_id));
HDassert(space);
HDassert(op);
diff --git a/src/H5T.c b/src/H5T.c
index 1bc1f87..392228b 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -45,6 +45,7 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
#include "H5Tpkg.h" /* Datatypes */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/* Check for header needed for SGI floating-point code */
#ifdef H5_HAVE_SYS_FPU_H
@@ -1634,12 +1635,22 @@ H5Tcopy(hid_t type_id)
{
H5T_t *dt; /* Pointer to the datatype to copy */
H5T_t *new_dt = NULL;
+ H5I_type_t id_type;
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("i", "i", type_id);
- switch(H5I_get_type(type_id)) {
+ id_type = H5I_get_type(type_id);
+ if (H5I_DATATYPE_PUBLIC == id_type || H5I_DATASET_PUBLIC == id_type) {
+ H5VL_id_wrapper_t *id_wrapper;
+ if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(type_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
+ type_id = id_wrapper->obj_id;
+ id_type = H5I_get_type(type_id);
+ }
+
+ switch(id_type) {
case H5I_DATATYPE:
/* The argument is a datatype handle */
if(NULL == (dt = (H5T_t *)H5I_object(type_id)))
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 267692c..ace0a73 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -1164,7 +1164,7 @@ H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned UNUSED ndim, const hsize_t
HDassert(elem);
HDassert(vl_alloc_info);
- HDassert(H5I_DATATYPE == H5I_get_type(type_id));
+ HDassert(H5I_DATATYPE == H5I_get_type(type_id) || H5I_DATATYPE_PUBLIC == H5I_get_type(type_id));
/* Check args */
if(NULL == (dt = H5I_object_verify(type_id, H5I_DATATYPE)))
diff --git a/src/H5VL.c b/src/H5VL.c
index 7a78ef8..19125e9 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -166,7 +166,7 @@ H5VL_term_interface(void)
}
if((n2=H5I_nmembers(H5I_FILE_PUBLIC))!=0) {
- H5I_clear_type(H5I_FILE_PUBLIC, FALSE, FALSE);
+ H5I_clear_type(H5I_FILE_PUBLIC, TRUE, FALSE);
term = FALSE;
} else {
H5I_dec_type_ref(H5I_FILE_PUBLIC);
@@ -1041,11 +1041,7 @@ H5VL_object_open_by_loc(hid_t uid, void *obj_loc, hid_t lapl_id)
id_type = H5I_get_type(object_id);
- if (H5I_FILE == id_type) {
- if((ret_value = H5I_register(H5I_FILE_PUBLIC, id_wrapper2, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle")
- }
- else if (H5I_GROUP == id_type) {
+ if (H5I_GROUP == id_type) {
if((ret_value = H5I_register(H5I_GROUP_PUBLIC, id_wrapper2, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle")
}
@@ -1240,7 +1236,7 @@ herr_t
H5VL_datatype_commit(hid_t uid, const char *name, hid_t type_id, hid_t lcpl_id,
hid_t tcpl_id, hid_t tapl_id)
{
- H5VL_id_wrapper_t *id_wrapper1; /* user id structure of the location where the datatype will be commitd */
+ H5VL_id_wrapper_t *id_wrapper1; /* wrapper object of the location where the datatype will be commitd */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1263,11 +1259,14 @@ H5VL_datatype_commit(hid_t uid, const char *name, hid_t type_id, hid_t lcpl_id,
/* Allocate new id structure */
if(NULL == (id_wrapper2 = (H5VL_id_wrapper_t *)H5MM_malloc(sizeof(H5VL_id_wrapper_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- id_wrapper2->obj_id = type_id;
- id_wrapper2->vol_plugin = id_wrapper1->vol_plugin;
- if((ret_value = H5I_register(H5I_DATATYPE_PUBLIC, id_wrapper2, TRUE)) < 0)
+ if((id_wrapper2->obj_id = H5I_register(H5I_DATATYPE, H5I_object(type_id), TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize datatype handle")
+ id_wrapper2->vol_plugin = id_wrapper1->vol_plugin;
+
+ H5I_subst(type_id, id_wrapper2);
+ //H5I_remove_verify(type_id, H5I_DATATYPE);
+
#endif
done:
@@ -1363,6 +1362,28 @@ H5VL_dataset_create(hid_t uid, const char *name, hid_t dcpl_id, hid_t dapl_id)
FUNC_ENTER_NOAPI(FAIL)
+ /* unwrap the datatype id if it is a named datatype */
+ {
+ H5VL_id_wrapper_t *id_wrapper;
+ hid_t type_id;
+ H5P_genplist_t *plist;
+ /* Get the plist structure */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* get creation properties */
+ if(H5P_get(plist, H5D_CRT_TYPE_ID_NAME, &type_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for datatype id")
+
+ if(H5I_DATATYPE_PUBLIC == H5I_get_type(type_id)) {
+ /* get the ID struct */
+ if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(type_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
+
+ if(H5P_set(plist, H5D_CRT_TYPE_ID_NAME, &(id_wrapper->obj_id)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for datatype id")
+ }
+ }
/* get the ID struct */
if(NULL == (id_wrapper1 = (H5VL_id_wrapper_t *)H5I_object(uid)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
@@ -1663,6 +1684,29 @@ H5VL_dataset_get(hid_t uid, H5VL_dataset_get_t get_type, ...)
arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
va_end (arguments);
+
+ /* if the get_type is a named datatype, create a wrapper for it */
+ if(H5VL_DATASET_GET_TYPE == get_type) {
+ H5VL_id_wrapper_t *temp_id_wrapper; /* user id structure */
+ hid_t *ret_id;
+
+ va_start (arguments, get_type);
+ ret_id = va_arg (arguments, hid_t *);
+
+ if(H5T_committed((H5T_t *)H5I_object_verify(*ret_id, H5I_DATATYPE))) {
+ /* Create a new id that points to a struct that holds the attr id and the VOL plugin */
+ /* Allocate new id structure */
+ if(NULL == (temp_id_wrapper = (H5VL_id_wrapper_t *)H5MM_malloc(sizeof(H5VL_id_wrapper_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ temp_id_wrapper->obj_id = *ret_id;
+ temp_id_wrapper->vol_plugin = id_wrapper->vol_plugin;
+
+ if((*ret_id = H5I_register(H5I_DATATYPE_PUBLIC, temp_id_wrapper, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attr handle")
+ }
+ va_end (arguments);
+ }
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_dataset_get() */
@@ -1831,11 +1875,19 @@ H5VL_attr_create(hid_t uid, const char *name, hid_t acpl_id, hid_t aapl_id)
{
H5VL_id_wrapper_t *id_wrapper1; /* user id structure of the location where the attr will be created */
H5VL_id_wrapper_t *id_wrapper2; /* user id structure of new created attr*/
- hid_t loc_id; /* actual attr ID */
- hid_t ret_value; /* Return value */
+ H5I_type_t id_type;
+ hid_t loc_id; /* actual attr ID */
+ hid_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
+ id_type = H5I_get_type(uid);
+ /* Check id */
+ if(H5I_FILE_PUBLIC != id_type && H5I_GROUP_PUBLIC != id_type &&
+ H5I_DATASET_PUBLIC != id_type && H5I_DATATYPE_PUBLIC != id_type &&
+ H5I_ATTR_PUBLIC != id_type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID")
+
/* get the ID struct */
if(NULL == (id_wrapper1 = (H5VL_id_wrapper_t *)H5I_object(uid)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
@@ -1884,11 +1936,19 @@ H5VL_attr_open(hid_t loc_id, void *location, const char *name, hid_t aapl_id)
{
H5VL_id_wrapper_t *id_wrapper1; /* user id structure of the location where the attr will be opend */
H5VL_id_wrapper_t *id_wrapper2; /* user id structure of new opend attr*/
+ H5I_type_t id_type;
hid_t attr_id; /* actual attr ID */
hid_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
+ id_type = H5I_get_type(loc_id);
+ /* Check id */
+ if(H5I_FILE_PUBLIC != id_type && H5I_GROUP_PUBLIC != id_type &&
+ H5I_DATASET_PUBLIC != id_type && H5I_DATATYPE_PUBLIC != id_type &&
+ H5I_ATTR_PUBLIC != id_type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID")
+
/* get the ID struct */
if(NULL == (id_wrapper1 = (H5VL_id_wrapper_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
@@ -2086,6 +2146,28 @@ H5VL_attr_get(hid_t uid, H5VL_attr_get_t get_type, ...)
arguments)) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
va_end (arguments);
+
+ /* if the get_type is a named datatype, create a wrapper for it */
+ if(H5VL_ATTR_GET_TYPE == get_type) {
+ H5VL_id_wrapper_t *temp_id_wrapper; /* user id structure */
+ hid_t *ret_id;
+
+ va_start (arguments, get_type);
+ ret_id = va_arg (arguments, hid_t *);
+
+ if(H5T_committed((H5T_t *)H5I_object_verify(*ret_id, H5I_DATATYPE))) {
+ /* Create a new id that points to a struct that holds the attr id and the VOL plugin */
+ /* Allocate new id structure */
+ if(NULL == (temp_id_wrapper = (H5VL_id_wrapper_t *)H5MM_malloc(sizeof(H5VL_id_wrapper_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ temp_id_wrapper->obj_id = *ret_id;
+ temp_id_wrapper->vol_plugin = id_wrapper->vol_plugin;
+
+ if((*ret_id = H5I_register(H5I_DATATYPE_PUBLIC, temp_id_wrapper, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attr handle")
+ }
+ va_end (arguments);
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_attr_get() */
@@ -2109,10 +2191,18 @@ H5VL_attr_generic(hid_t uid, H5VL_attr_generic_t generic_type, ...)
{
H5VL_id_wrapper_t *id_wrapper; /* user id structure */
va_list arguments; /* argument list passed from the API call */
+ H5I_type_t id_type;
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
+ id_type = H5I_get_type(uid);
+ /* Check id */
+ if(H5I_FILE_PUBLIC != id_type && H5I_GROUP_PUBLIC != id_type &&
+ H5I_DATASET_PUBLIC != id_type && H5I_DATATYPE_PUBLIC != id_type &&
+ H5I_ATTR_PUBLIC != id_type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a user ID")
+
/* get the ID struct */
if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5I_object(uid)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier")
@@ -2142,6 +2232,7 @@ H5VL_attr_generic(hid_t uid, H5VL_attr_generic_t generic_type, ...)
if((*ret_id = H5I_register(H5I_ATTR_PUBLIC, temp_id_wrapper, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attr handle")
+ va_end (arguments);
}
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index dd76f48..cec022e 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -299,6 +299,9 @@ H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id)
if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
+ /* store a pointer to the VOL class in the file structure */
+ new_file->vol_cls = &H5VL_native_g;
+
/* Keep this ID in file object structure */
new_file->file_id = ret_value;
@@ -348,6 +351,9 @@ H5VL_native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t f
if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
+ /* store a pointer to the VOL class in the file structure */
+ new_file->vol_cls = &H5VL_native_g;
+
/* Keep this ID in file object structure */
new_file->file_id = ret_value;