diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-08-19 19:19:51 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-08-19 19:19:51 (GMT) |
commit | aff0124b38f2ba19cd06431f756ff5791882dbae (patch) | |
tree | 7b00758d1f5f6a45690d21971c868d111a35367c /src/H5Gdeprec.c | |
parent | ffc4b3a7f73e9e808bcb11a5f86ce9d6229f31f8 (diff) | |
download | hdf5-aff0124b38f2ba19cd06431f756ff5791882dbae.zip hdf5-aff0124b38f2ba19cd06431f756ff5791882dbae.tar.gz hdf5-aff0124b38f2ba19cd06431f756ff5791882dbae.tar.bz2 |
[svn-r25537] VOL framework changes.
Diffstat (limited to 'src/H5Gdeprec.c')
-rw-r--r-- | src/H5Gdeprec.c | 126 |
1 files changed, 109 insertions, 17 deletions
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 7c6feb2..f1451a9 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -287,7 +287,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) /* Create the group through the VOL */ if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin, name, tmp_gcpl, - H5P_GROUP_ACCESS_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + H5P_GROUP_ACCESS_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") /* Get an atom for the group */ @@ -299,7 +299,7 @@ done: if(H5I_dec_ref(tmp_gcpl) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release property list") if (ret_value < 0 && grp) - if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -351,7 +351,8 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the group through the VOL */ - if(NULL == (grp = H5VL_group_open(obj, loc_params, vol_plugin, name, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (grp = H5VL_group_open(obj, loc_params, vol_plugin, name, H5P_DEFAULT, + H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") /* Get an atom for the group */ @@ -360,7 +361,7 @@ H5Gopen1(hid_t loc_id, const char *name) done: if (ret_value < 0 && grp) - if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gopen1() */ @@ -424,7 +425,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Create the link through the VOL */ if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_plugin, - lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { @@ -450,7 +451,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Create the link through the VOL */ if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj, loc_params, vol_plugin, - lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else if */ else @@ -531,7 +532,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Create the link through the VOL */ if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, obj2, loc_params2, (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), - lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { @@ -562,7 +563,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Create the link through the VOL */ if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj, loc_params, vol_plugin, - lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else if */ else @@ -610,7 +611,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) /* Create the link through the VOL */ if((ret_value = H5VL_link_move(obj, loc_params1, NULL, loc_params2, vol_plugin, - FALSE, H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -676,7 +677,7 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Move the link through the VOL */ if((ret_value = H5VL_link_move(obj1, loc_params1, obj2, loc_params2, (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), - FALSE, H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -718,8 +719,9 @@ H5Gunlink(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Delete the link through the VOL */ - if((ret_value = H5VL_link_remove(obj, loc_params, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") + if(H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_DELETE, + H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link") done: FUNC_LEAVE_API(ret_value) @@ -763,7 +765,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) /* Get the link info through the VOL */ if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_VAL, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, buf, size)) < 0) + H5AC_ind_dxpl_id, H5_REQUEST_NULL, buf, size)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link value") done: @@ -791,6 +793,93 @@ done: herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment) { + H5G_loc_t loc; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*s*s", loc_id, name, comment); + + 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 specified") + + if(H5G_loc_set_comment(&loc, name, comment, H5P_DEFAULT, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Gset_comment() */ + + +/*------------------------------------------------------------------------- + * Function: H5Gget_comment + * + * Purpose: Return at most BUFSIZE characters of the comment for the + * specified object. If BUFSIZE is large enough to hold the + * entire comment then the comment string will be null + * terminated, otherwise it will not. If the object does not + * have a comment value then no bytes are copied to the BUF + * buffer. + * + * Note: Deprecated in favor of H5Oget_comment/H5Oget_comment_by_name + * + * Return: Success: Number of characters in the comment counting + * the null terminator. The value returned may + * be larger than the BUFSIZE argument. + * + * Failure: Negative + * + * Programmer: Robb Matzke + * Monday, July 20, 1998 + * + *------------------------------------------------------------------------- + */ +int +H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) +{ + H5G_loc_t loc; + int ret_value; + + FUNC_ENTER_API(FAIL) + H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf); + + 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 specified") + if(bufsize > 0 && !buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified") + + if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get comment value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_comment() */ + +#if 0 + +/*------------------------------------------------------------------------- + * Function: H5Gset_comment + * + * Purpose: Gives the specified object a comment. The COMMENT string + * should be a null terminated string. An object can have only + * one comment at a time. Passing NULL for the COMMENT argument + * will remove the comment property from the object. + * + * Note: Deprecated in favor of H5Oset_comment/H5Oset_comment_by_name + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Monday, July 20, 1998 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Gset_comment(hid_t loc_id, const char *name, const char *comment) +{ void *obj = NULL; /* object token of loc_id */ H5VL_t *vol_plugin; /* VOL plugin information */ H5VL_loc_params_t loc_params; @@ -815,7 +904,8 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* set comment on object through the VOL */ - if(H5VL_object_misc(obj, loc_params, vol_plugin, H5VL_OBJECT_SET_COMMENT, H5AC_dxpl_id, H5_EVENT_STACK_NULL, comment) < 0) + if(H5VL_object_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value") done: @@ -875,8 +965,8 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_object_get(obj, loc_params, vol_plugin, H5VL_OBJECT_GET_COMMENT, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - buf, bufsize, &size) < 0) + if(H5VL_object_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + H5VL_OBJECT_GET_COMMENT, loc_params, buf, bufsize, &size) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object comment") ret_value = (int)size; @@ -884,6 +974,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) done: FUNC_LEAVE_API(ret_value) } /* end H5Gget_comment() */ +#endif /*------------------------------------------------------------------------- @@ -1239,7 +1330,8 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a group") /* Call internal function */ - if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, + idx, name, size, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name") done: |