summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2018-10-18 21:05:40 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2018-10-18 21:05:40 (GMT)
commit4e575a086553a23fc79d3e92f48eb9508711e6ca (patch)
treee3160ca419ba617d90cb89634376e9a17260c5de /src
parenta82aee9a5fb4b10951d95a0422a4125b18fe9a52 (diff)
parent2d6d5cad0cc426cd53b9d4fda15e53d8021e4c7b (diff)
downloadhdf5-4e575a086553a23fc79d3e92f48eb9508711e6ca.zip
hdf5-4e575a086553a23fc79d3e92f48eb9508711e6ca.tar.gz
hdf5-4e575a086553a23fc79d3e92f48eb9508711e6ca.tar.bz2
Merge pull request #1297 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:develop to develop
* commit '2d6d5cad0cc426cd53b9d4fda15e53d8021e4c7b': Updates to the VOL ID and object API calls.
Diffstat (limited to 'src')
-rw-r--r--src/H5A.c44
-rw-r--r--src/H5Adeprec.c14
-rw-r--r--src/H5D.c6
-rw-r--r--src/H5Ddeprec.c8
-rw-r--r--src/H5Dvirtual.c2
-rw-r--r--src/H5F.c12
-rw-r--r--src/H5Fint.c2
-rw-r--r--src/H5G.c6
-rw-r--r--src/H5Gdeprec.c4
-rw-r--r--src/H5I.c42
-rw-r--r--src/H5Iprivate.h26
-rw-r--r--src/H5L.c6
-rw-r--r--src/H5O.c34
-rw-r--r--src/H5Odeprec.c10
-rw-r--r--src/H5Oflush.c8
-rw-r--r--src/H5R.c4
-rw-r--r--src/H5Rdeprec.c6
-rw-r--r--src/H5Tcommit.c2
-rw-r--r--src/H5Tdeprec.c2
-rw-r--r--src/H5VL.c73
-rw-r--r--src/H5VLint.c204
-rw-r--r--src/H5VLnative.c8
-rw-r--r--src/H5VLnative.h2
-rw-r--r--src/H5VLprivate.h31
-rw-r--r--src/H5VLpublic.h10
25 files changed, 331 insertions, 235 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 3ac7ca2..b023c78 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -288,7 +288,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set property value for space id")
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Set location parameters */
@@ -301,7 +301,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
- if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
@@ -398,7 +398,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the attribute */
@@ -407,7 +407,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
- if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
@@ -467,7 +467,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id)
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
@@ -476,7 +476,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name)
/* Register the attribute and get an ID for it */
- if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
@@ -550,7 +550,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if (NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
@@ -559,7 +559,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
@@ -642,7 +642,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
@@ -651,7 +651,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
@@ -973,7 +973,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
loc_params.type = H5VL_OBJECT_BY_IDX;
@@ -1118,7 +1118,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the attribute information */
@@ -1182,7 +1182,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the attribute information */
@@ -1230,7 +1230,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name)
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set up collective metadata if appropriate */
@@ -1295,7 +1295,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Rename the attribute */
@@ -1373,7 +1373,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
loc_params.obj_type = H5I_get_type(loc_id);
/* get the loc object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Iterate over attributes */
@@ -1463,7 +1463,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
/* get the loc object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Iterate over attributes */
@@ -1518,7 +1518,7 @@ H5Adelete(hid_t loc_id, const char *name)
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Delete the attribute */
@@ -1577,7 +1577,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Delete the attribute */
@@ -1648,7 +1648,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
loc_params.obj_type = H5I_get_type(loc_id);
/* get the object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Delete the attribute through the VOL */
@@ -1724,7 +1724,7 @@ H5Aexists(hid_t obj_id, const char *attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
/* get the object */
- if(NULL == (vol_obj = H5VL_get_object(obj_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
loc_params.type = H5VL_OBJECT_BY_SELF;
@@ -1777,7 +1777,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
/* get the object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
loc_params.type = H5VL_OBJECT_BY_NAME;
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index 47983ea..cce9316 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -152,7 +152,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the attribute */
@@ -161,7 +161,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute")
/* Register the new attribute and get an ID for it */
- if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID")
done:
@@ -218,7 +218,7 @@ H5Aopen_name(hid_t loc_id, const char *name)
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if (NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
@@ -227,7 +227,7 @@ H5Aopen_name(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
- if ((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
@@ -287,7 +287,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the attribute */
@@ -296,7 +296,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute")
/* Register the attribute and get an ID for it */
- if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle")
done:
@@ -342,7 +342,7 @@ H5Aget_num_attrs(hid_t loc_id)
loc_params.obj_type = H5I_get_type(loc_id);
/* get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Get the number of attributes for the object */
diff --git a/src/H5D.c b/src/H5D.c
index 9f56197..eb40cc8 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -163,7 +163,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
- if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle")
done:
@@ -256,7 +256,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
- if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
@@ -319,7 +319,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
/* Register an atom for the dataset */
- if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
done:
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c
index 4abba93..58238bc 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -157,7 +157,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
loc_params.obj_type = H5I_get_type(loc_id);
/* get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Create the dataset through the VOL */
@@ -166,7 +166,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset")
/* Get an atom for the dataset */
- if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset")
done:
@@ -217,7 +217,7 @@ H5Dopen1(hid_t loc_id, const char *name)
loc_params.obj_type = H5I_get_type(loc_id);
/* get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Open the dataset */
@@ -226,7 +226,7 @@ H5Dopen1(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset")
/* Get an atom for the dataset */
- if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom")
done:
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 89974b2..77047e9 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -2977,7 +2977,7 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get native VOL driver ID")
/* Get a temporary identifier for this source dataset */
- if((temp_id = H5VL_object_register(*dset, H5I_DATASET, native_vol_id, FALSE)) < 0)
+ if((temp_id = H5VL_register_using_vol_id(H5I_DATASET, *dset, native_vol_id, FALSE)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID")
/* Refresh source dataset */
diff --git a/src/H5F.c b/src/H5F.c
index 2dcafb9..a31dff3 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -677,7 +677,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver")
/* Get an atom for the file */
- if((ret_value = H5VL_register_id(H5I_FILE, new_file, driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_FILE, new_file, driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
done:
@@ -757,7 +757,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver")
/* Get an ID for the file */
- if((ret_value = H5VL_register_id(H5I_FILE, new_file, driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_FILE, new_file, driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
done:
@@ -794,7 +794,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
}
/* get the file object */
- if(NULL == (vol_obj = H5VL_get_object(object_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Flush the object */
@@ -883,7 +883,7 @@ H5Freopen(hid_t file_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file")
/* Get an atom for the file */
- if((ret_value = H5VL_register_id(H5I_FILE, file, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_FILE, file, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
done:
@@ -1288,7 +1288,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file or file object")
/* Get the file object */
- if(NULL == (vol_obj = H5VL_get_object(obj_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
/* Get the filename via the VOL */
@@ -1334,7 +1334,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Get the file object */
- if(NULL == (vol_obj = H5VL_get_object(obj_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Get the file information */
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 230a744..6a57ca5 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -3303,7 +3303,7 @@ H5F__start_swmr_write(H5F_t *f)
if(grp_dset_count > 0) {
H5VL_object_t *vol_obj = NULL;
- if(NULL == (vol_obj = H5VL_get_object(obj_ids[0])))
+ if(NULL == (vol_obj = H5VL_vol_object(obj_ids[0])))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
vol_driver = vol_obj->driver;
diff --git a/src/H5G.c b/src/H5G.c
index 772d567..1d4667f 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -370,7 +370,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id,
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
- if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
done:
@@ -450,7 +450,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
- if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle")
done:
@@ -511,7 +511,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group")
/* Register an ID for the group */
- if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index ab73e7e..d2e991b 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -240,7 +240,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
/* Get an atom for the group */
- if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
@@ -302,7 +302,7 @@ H5Gopen1(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group")
/* Get an atom for the group */
- if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
diff --git a/src/H5I.c b/src/H5I.c
index 7d445a5..e1d947c 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -764,7 +764,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5I_register_with_id
+ * Function: H5I_register_using_existing_id
*
* Purpose: Registers an OBJECT in a TYPE with the supplied ID for it.
* This routine will check to ensure the supplied ID is not already
@@ -773,14 +773,17 @@ done:
* registered (thus, it is possible to register one object under
* multiple IDs).
*
+ * NOTE: Intended for use in refresh calls, where we have to close
+ * and re-open the underlying data, then hook the object back
+ * up to the original ID.
+ *
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t id)
+H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id)
{
- H5VL_object_t *new_vol_obj = NULL; /* pointer to new VOL object */
H5I_id_type_t *type_ptr; /* ptr to the type */
H5I_id_info_t *id_ptr; /* ptr to the new ID information */
herr_t ret_value = SUCCEED; /* return value */
@@ -789,10 +792,9 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t
/* Check arguments */
HDassert(object);
- HDassert(vol_driver);
/* Make sure ID is not already in use */
- if(NULL != (id_ptr = H5I__find_id(id)))
+ if(NULL != (id_ptr = H5I__find_id(existing_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use")
/* Make sure type number is valid */
@@ -806,36 +808,18 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
/* Make sure requested ID belongs to object's type */
- if(H5I_TYPE(id) != type)
+ if(H5I_TYPE(existing_id) != type)
HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "invalid type for provided ID")
/* Allocate new structure to house this ID */
if(NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t)))
HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed")
- /* Set up the new VOL object */
- if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t)))
- HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, FAIL, "can't allocate memory for VOL object");
- new_vol_obj->driver = vol_driver;
- new_vol_obj->data = object;
-
- /* Bump the reference count on the VOL driver */
- vol_driver->nrefs++;
-
/* Create the struct & insert requested ID */
- id_ptr->id = id;
+ id_ptr->id = existing_id;
id_ptr->count = 1; /* initial reference count*/
id_ptr->app_count = !!app_ref;
- if(H5I_DATATYPE == type) {
- void *dt = NULL;
-
- if(NULL == (dt = (void *)H5T_construct_datatype(new_vol_obj)))
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "can't construct datatype object");
-
- id_ptr->obj_ptr = dt;
- }
- else
- id_ptr->obj_ptr = new_vol_obj;
+ id_ptr->obj_ptr = object;
/* Insert into the type */
if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0)
@@ -844,7 +828,7 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5I_register_with_id() */
+} /* end H5I_register_using_existing_id() */
/*-------------------------------------------------------------------------
@@ -2222,7 +2206,7 @@ H5I__get_file_id(hid_t obj_id, H5I_type_t type)
FUNC_ENTER_STATIC
/* Get the object pointer */
- if (NULL == (vol_obj = H5VL_get_object(obj_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier")
/* Get the file through the VOL */
@@ -2237,7 +2221,7 @@ H5I__get_file_id(hid_t obj_id, H5I_type_t type)
/* If the ID does not exist, register it with the VOL driver */
if (H5I_INVALID_HID == ret_value) {
- if ((ret_value = H5VL_register_id(H5I_FILE, file, vol_obj->driver, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_FILE, file, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
}
else {
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index 8fd7caa..9068b5f 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -67,13 +67,7 @@ typedef struct H5I_class_t {
H5_DLL herr_t H5I_register_type(const H5I_class_t *cls);
H5_DLL int64_t H5I_nmembers(H5I_type_t type);
H5_DLL herr_t H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref);
-H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref);
-H5_DLL herr_t H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t id);
-H5_DLL void *H5I_subst(hid_t id, const void *new_object);
-H5_DLL void *H5I_object(hid_t id);
-H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type);
H5_DLL H5I_type_t H5I_get_type(hid_t id);
-H5_DLL void *H5I_remove(hid_t id);
H5_DLL herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref);
H5_DLL int H5I_get_ref(hid_t id, hbool_t app_ref);
H5_DLL int H5I_inc_ref(hid_t id, hbool_t app_ref);
@@ -83,6 +77,26 @@ H5_DLL int H5I_dec_app_ref_always_close(hid_t id);
H5_DLL int H5I_dec_type_ref(H5I_type_t type);
H5_DLL herr_t H5I_find_id(const void *object, H5I_type_t type, hid_t *id /*out*/);
+/* NOTE: The object and ID functions below deal in non-VOL objects (i.e.;
+ * H5S_t, etc.). Similar VOL calls exist in H5VLprivate.h. Use
+ * the H5VL calls with objects that go through the VOL, such as
+ * datasets and groups, and the H5I calls with objects
+ * that do not, such as property lists and dataspaces. Datatypes
+ * are can be either named, where they will use the VOL, or not,
+ * and thus require special treatment. See the datatype docs for
+ * how to handle this.
+ */
+
+/* Functions that manipulate objects */
+H5_DLL void *H5I_object(hid_t id);
+H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type);
+H5_DLL void *H5I_remove(hid_t id);
+H5_DLL void *H5I_subst(hid_t id, const void *new_object);
+
+/* ID registration functions */
+H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref);
+H5_DLL herr_t H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id);
+
/* Debugging functions */
H5_DLL herr_t H5I_dump_ids_for_type(H5I_type_t type);
diff --git a/src/H5L.c b/src/H5L.c
index 656edec..0beafba 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -489,7 +489,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name
loc_params.obj_type = H5I_get_type(link_loc_id);
/* get the location object */
- if(NULL == (vol_obj = (H5VL_object_t *)H5VL_get_object(link_loc_id)))
+ if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Get the plist structure */
@@ -580,12 +580,12 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
if(H5L_SAME_LOC != cur_loc_id) {
/* Get the current location object */
- if (NULL == (vol_obj1 = (H5VL_object_t *)H5VL_get_object(cur_loc_id)))
+ if (NULL == (vol_obj1 = (H5VL_object_t *)H5VL_vol_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
}
if(H5L_SAME_LOC != new_loc_id) {
/* Get the new location object */
- if(NULL == (vol_obj2 = (H5VL_object_t *)H5VL_get_object(new_loc_id)))
+ if(NULL == (vol_obj2 = (H5VL_object_t *)H5VL_vol_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
}
diff --git a/src/H5O.c b/src/H5O.c
index 77b9498..23b6dda7 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -135,7 +135,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
/* Get an atom for the object */
- if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
done:
FUNC_LEAVE_API(ret_value)
@@ -207,7 +207,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
&opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
- if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
done:
@@ -276,7 +276,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
/* Register the dataset ID */
- if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
done:
@@ -350,12 +350,12 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
if(H5L_SAME_LOC != obj_id) {
/* get the location object */
- if(NULL == (vol_obj1 = H5VL_get_object(obj_id)))
+ if(NULL == (vol_obj1 = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
}
if(H5L_SAME_LOC != new_loc_id) {
/* get the location object */
- if(NULL == (vol_obj2 = H5VL_get_object(new_loc_id)))
+ if(NULL == (vol_obj2 = H5VL_vol_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
}
/* Make sure that the VOL plugins are the same */
@@ -419,7 +419,7 @@ H5Oincr_refcount(hid_t object_id)
loc_params.obj_type = H5I_get_type(object_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(object_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set up collective metadata if appropriate */
@@ -470,7 +470,7 @@ H5Odecr_refcount(hid_t object_id)
loc_params.obj_type = H5I_get_type(object_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(object_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set up collective metadata if appropriate */
@@ -521,7 +521,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set the location struct fields */
@@ -575,7 +575,7 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields)
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
@@ -634,7 +634,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
@@ -700,7 +700,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
@@ -741,7 +741,7 @@ H5Oset_comment(hid_t obj_id, const char *comment)
H5TRACE2("e", "i*s", obj_id, comment);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(obj_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set up collective metadata if appropriate */
@@ -805,7 +805,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* (Re)set the object's comment */
@@ -845,7 +845,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize)
H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize);
/* Get the object */
- if (NULL == (vol_obj = H5VL_get_object(obj_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Set fields in the location struct */
@@ -904,7 +904,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
/* Retrieve the object's comment */
@@ -974,7 +974,7 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(obj_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set location parameters */
@@ -1058,7 +1058,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set location parameters */
diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c
index ead2028..68eb170 100644
--- a/src/H5Odeprec.c
+++ b/src/H5Odeprec.c
@@ -105,7 +105,7 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo)
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
@@ -157,7 +157,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
@@ -219,7 +219,7 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
loc_params.obj_type = H5I_get_type(loc_id);
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Retrieve the object's information */
@@ -284,7 +284,7 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(obj_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set location parameters */
@@ -363,7 +363,7 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the location object */
- if(NULL == (vol_obj = H5VL_get_object(loc_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Set location parameters */
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index 84095d9..40b6c6e 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -80,7 +80,7 @@ H5Oflush(hid_t obj_id)
H5TRACE1("e", "i", obj_id);
/* Check args */
- if(NULL == (vol_obj = H5VL_get_object(obj_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Set up collective metadata if appropriate */
@@ -245,7 +245,7 @@ H5Orefresh(hid_t oid)
H5TRACE1("e", "i", oid);
/* Check args */
- if(NULL == (vol_obj = H5VL_get_object(oid)))
+ if(NULL == (vol_obj = H5VL_vol_object(oid)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
/* Set up collective metadata if appropriate */
@@ -323,7 +323,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
* The vol_obj will disappear when the underlying object is closed, so
* we can't use that directly.
*/
- if(NULL == (vol_obj = H5VL_get_object(oid)))
+ if(NULL == (vol_obj = H5VL_vol_object(oid)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
driver = vol_obj->driver;
@@ -501,7 +501,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h
} /* end switch */
/* Re-register ID for the object */
- if((H5I_register_with_id(type, object, vol_driver, TRUE, oid)) < 0)
+ if((H5VL_register_using_existing_id(type, object, vol_driver, TRUE, oid)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh")
done:
diff --git a/src/H5R.c b/src/H5R.c
index 3e6517f..a2a7a14 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -189,7 +189,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the VOL object */
- if(NULL == (vol_obj = H5VL_get_object(obj_id)))
+ if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
/* Set location parameters */
@@ -204,7 +204,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r
&opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object")
- if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
done:
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index 9c1fcc5..f224cda 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -122,7 +122,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
loc_params.obj_type = H5I_get_type(id);
/* Get the vol object */
- if (NULL == (vol_obj = H5VL_get_object(id)))
+ if (NULL == (vol_obj = H5VL_vol_object(id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid file identifier")
/* Get the object information */
@@ -173,7 +173,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer")
/* Get the VOL object */
- if (NULL == (vol_obj = H5VL_get_object(obj_id)))
+ if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
loc_params.type = H5VL_OBJECT_BY_REF;
@@ -188,7 +188,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object")
/* Get an atom for the object */
- if ((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
+ if ((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle")
done:
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 8f7b4de..09a0f3f 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -600,7 +600,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype")
/* Register the type and return the ID */
- if((ret_value = H5VL_register_id(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype")
done:
diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c
index 1b59c6b..0e45587 100644
--- a/src/H5Tdeprec.c
+++ b/src/H5Tdeprec.c
@@ -203,7 +203,7 @@ H5Topen1(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype")
/* Register the type and return the ID */
- if((ret_value = H5VL_register_id(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0)
+ if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype")
done:
diff --git a/src/H5VL.c b/src/H5VL.c
index 24e558c..85b991f 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -201,7 +201,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VLregister
+ * Function: H5VLregister_driver
*
* Purpose: Registers a new VOL driver as a member of the virtual object
* layer class.
@@ -210,17 +210,17 @@ done:
* library is closed or the driver is
* unregistered.
*
- * Failure: A negative value (H5I_INVALID_HID).
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
-H5VLregister(const H5VL_class_t *cls)
+H5VLregister_driver(const H5VL_class_t *cls)
{
H5VL_get_driver_ud_t op_data;
hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "*x", cls);
/* Check arguments */
@@ -246,16 +246,16 @@ H5VLregister(const H5VL_class_t *cls)
HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver with the same name is already registered.")
/* Create the new class ID */
- if ((ret_value = H5VL_register(cls, sizeof(H5VL_class_t), TRUE)) < 0)
+ if ((ret_value = H5VL_register_driver(cls, sizeof(H5VL_class_t), TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLregister() */
+} /* end H5VLregister_driver() */
/*-------------------------------------------------------------------------
- * Function: H5VLregister_by_name
+ * Function: H5VLregister_driver_by_name
*
* Purpose: Registers a new VOL driver as a member of the virtual object
* layer class.
@@ -264,17 +264,17 @@ done:
* library is closed or the driver is
* unregistered.
*
- * Failure: A negative value.
+ * Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
-H5VLregister_by_name(const char *name)
+H5VLregister_driver_by_name(const char *name)
{
H5VL_get_driver_ud_t op_data;
hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
+ FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "*s", name);
/* Check arguments */
@@ -306,21 +306,21 @@ H5VLregister_by_name(const char *name)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL driver")
/* Register the driver we loaded */
- if ((ret_value = H5VL_register(cls, sizeof(H5VL_class_t), TRUE)) < 0)
+ if ((ret_value = H5VL_register_driver(cls, sizeof(H5VL_class_t), TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver ID")
}
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLregister_by_name() */
+} /* end H5VLregister_driver_by_name() */
/*-------------------------------------------------------------------------
- * Function: H5VLunregister
+ * Function: H5VLunregister_driver
*
- * Purpose: Removes a vol driver ID from the library. This in no way affects
+ * Purpose: Removes a VOL driver ID from the library. This in no way affects
* file access property lists which have been defined to use
- * this vol driver or files which are already opened under with
+ * this VOL driver or files which are already opened under with
* this driver.
*
* Return: Success: Non-negative
@@ -330,7 +330,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLunregister(hid_t vol_id)
+H5VLunregister_driver(hid_t vol_id)
{
H5VL_class_t *cls = NULL;
herr_t ret_value = SUCCEED; /* Return value */
@@ -348,11 +348,11 @@ H5VLunregister(hid_t vol_id)
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLunregister() */
+} /* end H5VLunregister_driver() */
/*-------------------------------------------------------------------------
- * Function: H5VLis_registered
+ * Function: H5VLis_driver_registered
*
* Purpose: Tests whether a VOL class has been registered or not
*
@@ -365,7 +365,7 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5VLis_registered(const char *name)
+H5VLis_driver_registered(const char *name)
{
H5VL_get_driver_ud_t op_data;
htri_t ret_value = FALSE; /* Return value */
@@ -385,7 +385,7 @@ H5VLis_registered(const char *name)
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5VLis_registered() */
+} /* end H5VLis_driver_registered() */
/*-------------------------------------------------------------------------
@@ -455,34 +455,39 @@ done:
/*---------------------------------------------------------------------------
- * Function: H5VLobject_register
+ * Function: H5VLregister
*
- * Purpose: Public routine to create an HDF5 hid_t with library
- * specific types, bypassing the limitation of H5Iregister.
+ * Purpose: Public routine to register an object and get an ID given a
+ * VOL driver ID.
*
- * Return: Success: Non-negative
+ * Unlike H5Iregister(), this API call can register library
+ * types (e.g.; H5I_DATASET).
*
- * Failure: Negative
+ * NOTE: This API call is mainly intended for VOL driver authors.
+ *
+ * Return: Success: A valid HDF5 ID
+ *
+ * Failure: H5I_INVALID_HID
*
*---------------------------------------------------------------------------
*/
hid_t
-H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t driver_id)
+H5VLregister(H5I_type_t type, const void *obj, hid_t driver_id)
{
- hid_t ret_value = FAIL;
+ hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_API(FAIL)
- H5TRACE3("i", "*xIti", obj, obj_type, driver_id);
+ FUNC_ENTER_API(H5I_INVALID_HID)
+ H5TRACE3("i", "It*xi", type, obj, driver_id);
if (NULL == obj)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object to register")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "obj pointer can't be NULL")
- if ((ret_value = H5VL_object_register(obj, obj_type, driver_id, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register object")
+ if ((ret_value = H5VL_register_using_vol_id(type, obj, driver_id, TRUE)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object")
done:
FUNC_LEAVE_API(ret_value)
-} /* H5VLobject_register */
+} /* H5VLregister */
/*-------------------------------------------------------------------------
@@ -540,7 +545,7 @@ H5VLget_object(hid_t obj_id, void **obj)
if (!obj)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object pointer")
- if (NULL == (*obj = H5VL_get_object(obj_id)))
+ if (NULL == (*obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain a valid object")
done:
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 78ba6d9..e246989 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -213,20 +213,21 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_register_id
+ * Function: H5VL_register
*
- * Purpose: Wrapper to register an object ID with a VOL aux struct
- * and increment ref count on VOL driver ID
+ * Purpose: VOL-aware version of H5I_register. Constructs an H5VL_object_t
+ * from the passed-in object and registers that. Does the right
+ * thing with datatypes, which are complicated under the VOL.
*
- * Return: Success: A valid HDF5 ID
+ * Return: Success: A valid HDF5 ID
* Failure: H5I_INVALID_HID
*
*-------------------------------------------------------------------------
*/
hid_t
-H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref)
+H5VL_register(H5I_type_t type, const void *object, H5VL_t *vol_driver, hbool_t app_ref)
{
- H5VL_object_t *new_obj = NULL;
+ H5VL_object_t *vol_obj = NULL;
hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
@@ -235,32 +236,135 @@ H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_
HDassert(object);
HDassert(vol_driver);
- /* setup VOL object */
- if (NULL == (new_obj = H5FL_CALLOC(H5VL_object_t)))
+ /* Set up VOL object to wrap the passed-in data */
+ if (NULL == (vol_obj = H5FL_CALLOC(H5VL_object_t)))
HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate top object structure");
- new_obj->driver = vol_driver;
- new_obj->data = object;
+ vol_obj->driver = vol_driver;
+ vol_obj->data = object;
vol_driver->nrefs++;
+ /* Datatypes need special handling under the VOL, since they have a non-VOL aspect */
if (H5I_DATATYPE == type) {
H5T_t *dt = NULL;
- if (NULL == (dt = H5T_construct_datatype(new_obj)))
+ if (NULL == (dt = H5T_construct_datatype(vol_obj)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "can't construct datatype object");
if ((ret_value = H5I_register(type, dt, app_ref)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle");
}
else {
- if ((ret_value = H5I_register(type, new_obj, app_ref)) < 0)
+ if ((ret_value = H5I_register(type, vol_obj, app_ref)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle");
}
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_register_id() */
+} /* end H5VL_register() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_register_using_existing_id
+ *
+ * Purpose: Registers an OBJECT in a TYPE with the supplied ID for it.
+ * This routine will check to ensure the supplied ID is not already
+ * in use, and ensure that it is a valid ID for the given type,
+ * but will NOT check to ensure the OBJECT is not already
+ * registered (thus, it is possible to register one object under
+ * multiple IDs).
+ *
+ * NOTE: Intended for use in refresh calls, where we have to close
+ * and re-open the underlying data, then hook the VOL object back
+ * up to the original ID.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t existing_id)
+{
+ H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */
+ void *stored_obj = NULL; /* Pointer to the object that will be stored */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check arguments */
+ HDassert(object);
+ HDassert(vol_driver);
+
+ /* Make sure type number is valid */
+ if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number")
+
+ /* Set up the new VOL object */
+ if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate memory for VOL object");
+ new_vol_obj->driver = vol_driver;
+ new_vol_obj->data = object;
+
+ /* Bump the reference count on the VOL driver */
+ vol_driver->nrefs++;
+
+ /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */
+ if(H5I_DATATYPE == type) {
+ if(NULL == (stored_obj = (void *)H5T_construct_datatype(new_vol_obj)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't construct datatype object");
+ }
+ else
+ stored_obj = (void *)new_vol_obj;
+
+ /* Call the underlying H5I function to complete the registration */
+ if(H5I_register_using_existing_id(type, stored_obj, app_ref, existing_id) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register object under existing ID")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_register_using_existing_id() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_register_using_vol_id
+ *
+ * Purpose: Utility function to create a user ID for an object created
+ * or opened through the VOL. Uses the VOL driver's ID to
+ * get the driver information instead of it being passed in.
+ *
+ * Return: Success: A valid HDF5 ID
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL_register_using_vol_id(H5I_type_t type, const void *obj, hid_t driver_id, hbool_t app_ref)
+{
+ H5VL_class_t *cls = NULL;
+ H5VL_t *driver = NULL; /* VOL driver struct */
+ hid_t ret_value = H5I_INVALID_HID;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL driver ID");
+
+ /* Setup VOL info struct */
+ if (NULL == (driver = H5FL_CALLOC(H5VL_t)))
+ HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VOL info struct");
+ driver->cls = cls;
+ driver->id = driver_id;
+ if (H5I_inc_ref(driver->id, FALSE) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver");
+
+ /* Get an ID for the VOL object */
+ if ((ret_value = H5VL_register(type, obj, driver, app_ref)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_register_using_vol_id() */
/*-------------------------------------------------------------------------
@@ -299,7 +403,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_register
+ * Function: H5VL_register_driver
*
* Purpose: Registers a new VOL driver as a member of the virtual object
* layer class.
@@ -312,7 +416,7 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5VL_register(const void *_cls, size_t size, hbool_t app_ref)
+H5VL_register_driver(const void *_cls, size_t size, hbool_t app_ref)
{
const H5VL_class_t *cls = (const H5VL_class_t *)_cls;
H5VL_class_t *saved = NULL;
@@ -338,47 +442,7 @@ done:
H5MM_xfree(saved);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_register() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_object_register
- *
- * Purpose: Utility function to create a user ID for an object created
- * or opened through the VOL
- *
- * Return: Success: A valid HDF5 ID
- * Failure: H5I_INVALID_HID
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5VL_object_register(void *obj, H5I_type_t obj_type, hid_t driver_id, hbool_t app_ref)
-{
- H5VL_class_t *cls = NULL;
- H5VL_t *driver = NULL; /* VOL driver struct */
- hid_t ret_value = H5I_INVALID_HID;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL driver ID");
-
- /* Setup VOL info struct */
- if (NULL == (driver = H5FL_CALLOC(H5VL_t)))
- HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VOL info struct");
- driver->cls = cls;
- driver->id = driver_id;
- if (H5I_inc_ref(driver->id, FALSE) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver");
-
- /* Get an ID for the VOL object */
- if ((ret_value = H5VL_register_id(obj_type, obj, driver, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_object_register() */
+} /* end H5VL_register_driver() */
/*-------------------------------------------------------------------------
@@ -402,7 +466,7 @@ H5VL_get_driver_name(hid_t id, char *name /*out*/, size_t size)
FUNC_ENTER_NOAPI(FAIL)
/* get the object pointer */
- if (NULL == (vol_obj = H5VL_get_object(id)))
+ if (NULL == (vol_obj = H5VL_vol_object(id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier");
cls = vol_obj->driver->cls;
@@ -423,7 +487,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_get_object
+ * Function: H5VL_vol_object
*
* Purpose: Utility function to return the object pointer associated with
* a hid_t. This routine is the same as H5I_object for all types
@@ -436,7 +500,7 @@ done:
*-------------------------------------------------------------------------
*/
H5VL_object_t *
-H5VL_get_object(hid_t id)
+H5VL_vol_object(hid_t id)
{
void *obj = NULL;
H5I_type_t obj_type = H5I_get_type(id);
@@ -463,7 +527,7 @@ H5VL_get_object(hid_t id)
ret_value = (H5VL_object_t *)obj;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_get_object() */
+} /* end H5VL_vol_object() */
/*-------------------------------------------------------------------------
@@ -597,15 +661,27 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_object_verify() */
-
-/* XXX (VOL MERGE): This could be a macro like in H5F */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_driver_data
+ *
+ * Purpose: Get the VOL-specific data stored in a VOL object
+ *
+ * Return: Success: Pointer to the data
+ *
+ * Failure: NULL (technically can't fail)
+ *
+ *-------------------------------------------------------------------------
+ */
void *
-H5VL_driver_object(H5VL_object_t *vol_obj)
+H5VL_driver_data(H5VL_object_t *vol_obj)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
+ HDassert(vol_obj);
+
FUNC_LEAVE_NOAPI(vol_obj->data)
-} /* end H5VL_driver_object() */
+} /* end H5VL_driver_data() */
/*-------------------------------------------------------------------------
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index acfceed..acd56cd 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -215,7 +215,7 @@ H5VL_native_init(void)
/* Register the native VOL driver, if it isn't already */
if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL)) {
- if((H5VL_NATIVE_ID_g = H5VL_register((const H5VL_class_t *)&H5VL_native_cls_g,
+ if((H5VL_NATIVE_ID_g = H5VL_register_driver((const H5VL_class_t *)&H5VL_native_cls_g,
sizeof(H5VL_class_t), TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL driver")
}
@@ -379,7 +379,7 @@ done:
*---------------------------------------------------------------------------
*/
hid_t
-H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref)
+H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref)
{
hid_t ret_value = H5I_INVALID_HID;
@@ -395,7 +395,7 @@ H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can only get an ID for an uncommitted datatype")
/* Get an ID for the object */
- if((ret_value = H5VL_object_register(obj, type, H5VL_NATIVE_ID_g, app_ref)) < 0)
+ if((ret_value = H5VL_register_using_vol_id(type, obj, H5VL_NATIVE_ID_g, app_ref)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object")
done:
@@ -422,7 +422,7 @@ H5VL_native_unregister(hid_t obj_id)
FUNC_ENTER_NOAPI_NOINIT
/* get the driver pointer */
- if(NULL == (vol_obj = (H5VL_object_t *)H5VL_get_object(obj_id)))
+ if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid ID")
/* free object */
diff --git a/src/H5VLnative.h b/src/H5VLnative.h
index 4e33e8a..19b9ff9 100644
--- a/src/H5VLnative.h
+++ b/src/H5VLnative.h
@@ -34,7 +34,7 @@ extern "C" {
H5_DLL herr_t H5Pset_fapl_native(hid_t fapl_id);
H5_DLL hid_t H5VL_native_get_driver_id(void);
H5_DLL hid_t H5VL_native_init(void);
-H5_DLL hid_t H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref);
+H5_DLL hid_t H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref);
H5_DLL herr_t H5VL_native_unregister(hid_t obj_id);
#ifdef __cplusplus
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index 98be308..003e6f5 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -53,17 +53,34 @@ typedef struct H5VL_driver_prop_t {
/* Library Private Prototypes */
/******************************/
-/* Common functions */
+/* Utility functions */
H5_DLL herr_t H5VL_init(void);
-H5_DLL hid_t H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref);
-H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj);
-H5_DLL hid_t H5VL_register(const void *cls, size_t size, hbool_t app_ref);
-H5_DLL hid_t H5VL_object_register(void *obj, H5I_type_t obj_type, hid_t driver_id, hbool_t app_ref);
+
+/* Functions that deal with VOL drivers */
+H5_DLL hid_t H5VL_register_driver(const void *cls, size_t size, hbool_t app_ref);
H5_DLL ssize_t H5VL_get_driver_name(hid_t id, char *name/*out*/, size_t size);
-H5_DLL H5VL_object_t *H5VL_get_object(hid_t id);
+
+/* NOTE: The object and ID functions below deal in VOL objects (i.e.;
+ * H5VL_object_t). Similar non-VOL calls exist in H5Iprivate.h. Use
+ * the H5VL calls with objects that go through the VOL, such as
+ * datasets and groups, and the H5I calls with objects
+ * that do not, such as property lists and dataspaces. Datatypes
+ * are can be either named, where they will use the VOL, or not,
+ * and thus require special treatment. See the datatype docs for
+ * how to handle this.
+ */
+
+/* Functions that manipulate VOL objects */
H5_DLL void *H5VL_object(hid_t id);
H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type);
-H5_DLL void *H5VL_driver_object(H5VL_object_t *obj);
+H5_DLL void *H5VL_driver_data(H5VL_object_t *obj);
+H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id);
+H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj);
+
+/* ID registration functions */
+H5_DLL hid_t H5VL_register(H5I_type_t type, const void *object, H5VL_t *vol_driver, hbool_t app_ref);
+H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, const void *obj, hid_t driver_id, hbool_t app_ref);
+H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t existing_id);
/* Attribute functions */
H5_DLL void *H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index d118bcc..600de0d 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -411,13 +411,13 @@ extern "C" {
H5_DLL herr_t H5VLinitialize(hid_t driver_id, hid_t vipl_id);
H5_DLL herr_t H5VLterminate(hid_t driver_id, hid_t vtpl_id);
H5_DLL herr_t H5VLclose(hid_t driver_id);
-H5_DLL hid_t H5VLregister(const H5VL_class_t *cls);
-H5_DLL hid_t H5VLregister_by_name(const char *driver_name);
-H5_DLL herr_t H5VLunregister(hid_t driver_id);
-H5_DLL htri_t H5VLis_registered(const char *name);
+H5_DLL hid_t H5VLregister_driver(const H5VL_class_t *cls);
+H5_DLL hid_t H5VLregister_driver_by_name(const char *driver_name);
+H5_DLL herr_t H5VLunregister_driver(hid_t driver_id);
+H5_DLL htri_t H5VLis_driver_registered(const char *name);
H5_DLL hid_t H5VLget_driver_id(const char *name);
H5_DLL ssize_t H5VLget_driver_name(hid_t id, char *name/*out*/, size_t size);
-H5_DLL hid_t H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t driver_id);
+H5_DLL hid_t H5VLregister(H5I_type_t obj_type, const void *obj, hid_t driver_id);
H5_DLL void *H5VLobject(hid_t id);
H5_DLL herr_t H5VLget_object(hid_t obj_id, void **obj);