summaryrefslogtreecommitdiffstats
path: root/src/H5Tcommit.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2012-03-22 14:40:08 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2012-03-22 14:40:08 (GMT)
commitd17a7fa26e972714082c5061f29f6b9335e189f4 (patch)
treeddc656ce236b5bff340f7d686e975ce7f24da55a /src/H5Tcommit.c
parent10dd81d6bf70d17a573f8202fbf375e6badd18b3 (diff)
downloadhdf5-d17a7fa26e972714082c5061f29f6b9335e189f4.zip
hdf5-d17a7fa26e972714082c5061f29f6b9335e189f4.tar.gz
hdf5-d17a7fa26e972714082c5061f29f6b9335e189f4.tar.bz2
[svn-r22119] Changes:
- add VOL implementation for H5O, H5D, and H5T functions - update the VOL interface with H5VLget routines - make upper level IDs of Type H5I_XXX_PUBLIC - bug fixes Comments: - some routines still don't go through VOL but have a workaround so they don't have to at the moment.
Diffstat (limited to 'src/H5Tcommit.c')
-rw-r--r--src/H5Tcommit.c67
1 files changed, 9 insertions, 58 deletions
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index a49d66e..7e90a2d 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -39,7 +39,7 @@
#include "H5Lprivate.h" /* Links */
#include "H5Pprivate.h" /* Property lists */
#include "H5Tpkg.h" /* Datatypes */
-
+#include "H5VLprivate.h" /* VOL plugins */
/****************/
/* Local Macros */
@@ -120,22 +120,16 @@ H5T_init_commit_interface(void)
*/
herr_t
H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
- hid_t tcpl_id, hid_t tapl_id)
+ hid_t tcpl_id, hid_t tapl_id)
{
- H5G_loc_t loc; /* Location to create datatype */
- H5T_t *type; /* Datatype for ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*siiii", loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
/* Get correct property list */
if(H5P_DEFAULT == lcpl_id)
@@ -158,10 +152,9 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list")
- /* Commit the type */
- if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype")
-
+ /* Open the object through the VOL */
+ if((ret_value = H5VL_datatype_commit(loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open object")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Tcommit2() */
@@ -551,23 +544,13 @@ done:
hid_t
H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id)
{
- H5T_t *type = NULL; /* Datatype opened in file */
- H5G_loc_t loc; /* Group location of object to open */
- H5G_name_t path; /* Datatype group hier. path */
- H5O_loc_t oloc; /* Datatype object location */
- H5O_type_t obj_type; /* Type of object at location */
- H5G_loc_t type_loc; /* Group object for datatype */
- hbool_t obj_found = FALSE; /* Object at 'name' found */
- hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datatype */
hid_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("i", "i*si", loc_id, name, tapl_id);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
- if(!name || !*name)
+ if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
/* Get correct property list */
@@ -577,43 +560,11 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id)
if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list")
- /* Set up datatype location to fill in */
- type_loc.oloc = &oloc;
- type_loc.path = &path;
- H5G_loc_reset(&type_loc);
-
- /*
- * Find the named datatype object header and read the datatype message
- * from it.
- */
- if(H5G_loc_find(&loc, name, &type_loc/*out*/, tapl_id, dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found")
- obj_found = TRUE;
-
- /* Check that the object found is the correct type */
- if(H5O_obj_type(&oloc, &obj_type, dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object type")
- if(obj_type != H5O_TYPE_NAMED_DATATYPE)
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a named datatype")
-
- /* Open it */
- if(NULL == (type = H5T_open(&type_loc, dxpl_id)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype")
-
- /* Register the type and return the ID */
- if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register named datatype")
+ /* Open the datatype through the VOL */
+ if((ret_value = H5VL_datatype_open(loc_id, name, tapl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open datatype")
done:
- if(ret_value < 0) {
- if(type != NULL)
- H5T_close(type);
- else {
- if(obj_found && H5F_addr_defined(type_loc.oloc->addr))
- H5G_loc_free(&type_loc);
- } /* end else */
- } /* end if */
-
FUNC_LEAVE_API(ret_value)
} /* end H5Topen2() */