diff options
Diffstat (limited to 'src/H5Rdeprec.c')
-rw-r--r-- | src/H5Rdeprec.c | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index b8133b2..710adaf 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -41,9 +41,11 @@ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5Gprivate.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ #include "H5Oprivate.h" /* Object headers */ #include "H5Rpkg.h" /* References */ #include "H5Ppublic.h" /* for using H5P_DATASET_ACCESS_DEFAULT */ +#include "H5VLprivate.h" /* VOL plugins */ /****************/ @@ -109,7 +111,8 @@ H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) { - H5G_loc_t loc; /* Object location */ + H5VL_object_t *obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; H5O_type_t obj_type; /* Object type */ H5G_obj_t ret_value; /* Return value */ @@ -117,16 +120,22 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) H5TRACE3("Go", "iRt*x", id, ref_type, ref); /* Check args */ - if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location") if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference type") if(ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer") - /* Get the object information */ - if(H5R_get_obj_type(loc.oloc->file, H5AC_ind_dxpl_id, ref_type, ref, &obj_type) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type") + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); + + /* get the vol object */ + if(NULL == (obj = H5VL_get_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + + /* get the object type through the VOL */ + if((ret_value = H5VL_object_get(obj->vol_obj, loc_params, obj->vol_info->vol_cls, H5VL_REF_GET_TYPE, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, &obj_type, ref_type, ref)) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") /* Set return value */ ret_value = H5G_map_obj_type(obj_type); @@ -161,27 +170,39 @@ done: hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) { - H5G_loc_t loc; /* Group location */ - H5F_t *file = NULL; /* File object */ - hid_t ret_value; + H5VL_object_t *obj = NULL; /* object token of loc_id */ + H5I_type_t opened_type; + void *opened_obj = NULL; + H5VL_loc_params_t loc_params; + hid_t ret_value = FAIL; FUNC_ENTER_API(FAIL) H5TRACE3("i", "iRt*x", obj_id, ref_type, _ref); /* Check args */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") - /* Get the file pointer from the entry */ - file = loc.oloc->file; + /* get the vol object */ + if(NULL == (obj = H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + + loc_params.type = H5VL_OBJECT_BY_REF; + loc_params.loc_data.loc_by_ref.ref_type = ref_type; + loc_params.loc_data.loc_by_ref._ref = _ref; + loc_params.loc_data.loc_by_ref.lapl_id = H5P_DATASET_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(obj_id); + + /* Open the object through the VOL */ + if(NULL == (opened_obj = H5VL_object_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls, &opened_type, + H5AC_ind_dxpl_id, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open object") - /* Create reference */ - if((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_ind_dxpl_id, ref_type, _ref, TRUE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable dereference object") + /* Get an atom for the object */ + if((ret_value = H5VL_register_id(opened_type, opened_obj, obj->vol_info, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle") done: FUNC_LEAVE_API(ret_value) |