diff options
author | David Young <dyoung@hdfgroup.org> | 2019-12-09 16:30:58 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2019-12-09 16:30:58 (GMT) |
commit | c8f533cfc33ac743227cbed8eba361c715a2976f (patch) | |
tree | bcae5320f80bac774647cacbbd8493604f9384d2 /src/H5Gloc.c | |
parent | adcf8a315e82c0848d126e7e46b662930c081896 (diff) | |
download | hdf5-c8f533cfc33ac743227cbed8eba361c715a2976f.zip hdf5-c8f533cfc33ac743227cbed8eba361c715a2976f.tar.gz hdf5-c8f533cfc33ac743227cbed8eba361c715a2976f.tar.bz2 |
Merge all of my changes from merge-back-to-feature-vfd_swmr-attempt-1,
including the merge of `hdffv/hdf5/develop`, back to the branch that Vailin and
I share.
Now I need to put this branch on a fork with a less confusing name than
vchoi_fork!
Diffstat (limited to 'src/H5Gloc.c')
-rw-r--r-- | src/H5Gloc.c | 73 |
1 files changed, 50 insertions, 23 deletions
diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 2f935e8..40d56c6 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -137,29 +137,25 @@ static herr_t H5G__loc_get_comment_cb(H5G_loc_t *grp_loc, const char *name, /*------------------------------------------------------------------------- - * Function: H5G_loc + * Function: H5G_loc_real * - * Purpose: Given an object ID return a location for the object. + * Purpose: Utility routine to get object location * * Returns: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t -H5G_loc(hid_t loc_id, H5G_loc_t *loc) +H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - switch(H5I_get_type(loc_id)) { + switch(type) { case H5I_FILE: { - H5F_t *f = NULL; - - /* Get the file struct */ - if(NULL == (f = (H5F_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file ID") + H5F_t *f = (H5F_t *)obj; /* Construct a group location for root group of the file */ if(H5G_root_loc(f, loc) < 0) @@ -169,10 +165,8 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) case H5I_GROUP: { - H5G_t *group = NULL; + H5G_t *group = (H5G_t *)obj; - if(NULL == (group = (H5G_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group ID") if(NULL == (loc->oloc = H5G_oloc(group))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of group") if(NULL == (loc->path = H5G_nameof(group))) @@ -184,8 +178,9 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) { H5T_t *dt = NULL; - if(NULL == (dt = (H5T_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid type ID") + /* Get the actual datatype object if the VOL object is set */ + dt = H5T_get_actual_type((H5T_t *)obj); + if(NULL == (loc->oloc = H5T_oloc(dt))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of datatype") if(NULL == (loc->path = H5T_nameof(dt))) @@ -195,10 +190,8 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) case H5I_DATASET: { - H5D_t *dset = NULL; + H5D_t *dset = (H5D_t *)obj; - if(NULL == (dset = (H5D_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data ID") if(NULL == (loc->oloc = H5D_oloc(dset))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of dataset") if(NULL == (loc->path = H5D_nameof(dset))) @@ -208,10 +201,8 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) case H5I_ATTR: { - H5A_t *attr = NULL; + H5A_t *attr = (H5A_t *)obj; - if(NULL == (attr = (H5A_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid attribute ID") if(NULL == (loc->oloc = H5A_oloc(attr))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of attribute") if(NULL == (loc->path = H5A_nameof(attr))) @@ -219,12 +210,12 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) break; } - case H5I_REFERENCE: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of reference") - case H5I_DATASPACE: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace") + case H5I_MAP: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maps not supported in native VOL connector") + case H5I_GENPROP_CLS: case H5I_GENPROP_LST: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of property list") @@ -237,6 +228,12 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) case H5I_VFL: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual file driver (VFD)") + case H5I_VOL: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual object layer (VOL) connector") + + case H5I_SPACE_SEL_ITER: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a dataspace selection iterator") + case H5I_UNINIT: case H5I_BADID: case H5I_NTYPES: @@ -246,6 +243,36 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_loc_real() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_loc + * + * Purpose: Given an object ID return a location for the object. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5G_loc(hid_t loc_id, H5G_loc_t *loc) +{ + void *obj = NULL; /* VOL object */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Get the object from the VOL */ + if(NULL == (obj = H5VL_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Fill in the struct */ + if(H5G_loc_real(obj, H5I_get_type(loc_id), loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to fill in location struct") + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_loc() */ |