summaryrefslogtreecommitdiffstats
path: root/src/H5Tcommit.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-08-26 22:09:17 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-08-26 22:09:17 (GMT)
commite271be083c2b7a542d282c52df41cd307c8e136f (patch)
tree66cb747bb72160e843ac93cbeea9300a8967a2b7 /src/H5Tcommit.c
parent39af44b6f2501df56998a2458db3551fc232a422 (diff)
downloadhdf5-e271be083c2b7a542d282c52df41cd307c8e136f.zip
hdf5-e271be083c2b7a542d282c52df41cd307c8e136f.tar.gz
hdf5-e271be083c2b7a542d282c52df41cd307c8e136f.tar.bz2
[svn-r25555] - rework the public H5VL wrappers to not use H5VL_t* and use a plugin hid_t instead
- rework the private VL layer to use the class structure directly - some bug fixes
Diffstat (limited to 'src/H5Tcommit.c')
-rw-r--r--src/H5Tcommit.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index efc443d..ed4d37b 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -173,7 +173,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
/* commit the datatype through the VOL */
- if (NULL == (dt = H5VL_datatype_commit(obj, loc_params, vol_plugin, name, type_id, lcpl_id,
+ if (NULL == (dt = H5VL_datatype_commit(obj, loc_params, vol_plugin->cls, name, type_id, lcpl_id,
tcpl_id, tapl_id, H5AC_dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to commit datatype")
@@ -186,6 +186,10 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id,
if (H5I_register_aux(type_id, vol_plugin) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach vol info to ID")
+ vol_plugin->nrefs ++;
+ if(H5I_inc_ref(vol_plugin->id, FALSE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin")
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Tcommit2() */
@@ -336,7 +340,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
/* commite the datatype through the VOL */
- if (NULL == (dt = H5VL_datatype_commit(obj, loc_params, vol_plugin, NULL, type_id, H5P_DEFAULT,
+ if (NULL == (dt = H5VL_datatype_commit(obj, loc_params, vol_plugin->cls, NULL, type_id, H5P_DEFAULT,
tcpl_id, tapl_id, H5AC_dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to commit datatype")
@@ -347,6 +351,10 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id)
if (H5I_register_aux(type_id, vol_plugin) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach vol info to ID")
+ vol_plugin->nrefs ++;
+ if(H5I_inc_ref(vol_plugin->id, FALSE) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin")
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Tcommit_anon() */
@@ -620,7 +628,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
/* Create the datatype through the VOL */
- if(NULL == (dt = H5VL_datatype_open(obj, loc_params, vol_plugin, name, tapl_id,
+ if(NULL == (dt = H5VL_datatype_open(obj, loc_params, vol_plugin->cls, name, tapl_id,
H5AC_dxpl_id, H5_REQUEST_NULL)))
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open datatype")
@@ -630,7 +638,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id)
done:
if (ret_value < 0 && dt)
- if(H5VL_datatype_close (dt, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
+ if(H5VL_datatype_close (dt, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release dataset")
FUNC_LEAVE_API(ret_value)
} /* end H5Topen2() */
@@ -694,7 +702,7 @@ H5Tget_create_plist(hid_t dtype_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
/* get the rest of the plist through the VOL */
- if(H5VL_datatype_get(type, vol_plugin, H5VL_DATATYPE_GET_TCPL,
+ if(H5VL_datatype_get(type, vol_plugin->cls, H5VL_DATATYPE_GET_TCPL,
H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get datatype")
} /* end if */
@@ -959,7 +967,7 @@ H5VL_create_datatype(void *dt_obj, H5VL_t *vol_plugin, hbool_t app_ref)
FUNC_ENTER_NOAPI(FAIL)
/* get required buf size for encoding the datatype */
- if(H5VL_datatype_get(dt_obj, vol_plugin, H5VL_DATATYPE_GET_BINARY,
+ if(H5VL_datatype_get(dt_obj, vol_plugin->cls, H5VL_DATATYPE_GET_BINARY,
H5AC_dxpl_id, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get datatype serialized size")
@@ -968,19 +976,19 @@ H5VL_create_datatype(void *dt_obj, H5VL_t *vol_plugin, hbool_t app_ref)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate space for datatype")
/* get binary description of the datatype */
- if(H5VL_datatype_get(dt_obj, vol_plugin, H5VL_DATATYPE_GET_BINARY,
+ if(H5VL_datatype_get(dt_obj, vol_plugin->cls, H5VL_DATATYPE_GET_BINARY,
H5AC_dxpl_id, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get serialized datatype")
- if(NULL == (dt = H5T_decode(buf)))
+ if(NULL == (dt = H5T_decode((const unsigned char *)buf)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't decode datatype")
dt->vol_obj = dt_obj;
H5MM_free(buf);
/* Get an atom for the datatype with the VOL information as the auxilary struct*/
- if((ret_value = H5I_register2(H5I_DATATYPE, dt, vol_plugin, app_ref)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
+ if((ret_value = H5VL_register_id(H5I_DATATYPE, dt, vol_plugin, app_ref)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize datatype handle")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1010,10 +1018,15 @@ H5T_close_datatype(void *type, H5VL_t *vol_plugin)
FUNC_ENTER_NOAPI_NOINIT
/* Close the datatype through the VOL*/
- if (NULL != dt->vol_obj)
- if((ret_value = H5VL_datatype_close(dt->vol_obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
+ if (NULL != dt->vol_obj) {
+ if((ret_value = H5VL_datatype_close(dt->vol_obj, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype")
+ /* decrement ref count on VOL ID */
+ if(H5VL_free_id(vol_plugin) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin")
+ }
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_close_datatype() */