From 8c20b495d070d9571e41b51c6eefe11708dde35d Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Tue, 10 Apr 2012 11:30:13 -0500 Subject: [svn-r22272] provide the wrapped ids to iterate/visit routines somehow stable version --- src/H5.c | 2 +- src/H5F.c | 1 - src/H5Fprivate.h | 2 ++ src/H5Fquery.c | 21 +++++++++++ src/H5Gint.c | 30 +++++++++------- src/H5Gtraverse.c | 5 +-- src/H5L.c | 15 ++++++-- src/H5O.c | 6 +++- src/H5Olink.c | 11 ++++-- src/H5VLnative.c | 103 +++++++++++++++++++++++++----------------------------- test/links.c | 12 +++---- 11 files changed, 123 insertions(+), 85 deletions(-) diff --git a/src/H5.c b/src/H5.c index 4a0fa15..98aa4c0 100644 --- a/src/H5.c +++ b/src/H5.c @@ -31,7 +31,7 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5Tprivate.h" /* Datatypes */ #include "H5SLprivate.h" /* Skip lists */ - +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ diff --git a/src/H5F.c b/src/H5F.c index b5fd25f..7c7db13 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -2958,4 +2958,3 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5F_set_store_msg_crt_idx() */ - diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 32ad227..939bc3f 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -507,6 +507,7 @@ struct H5B_class_t; struct H5RC_t; struct H5O_loc_t; struct H5HG_heap_t; +struct H5VL_class_t; /* Private functions */ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, @@ -531,6 +532,7 @@ H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref); H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref); H5_DLL size_t H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref); H5_DLL size_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *obj_id_list, hbool_t app_ref); +H5_DLL struct H5VL_class_t *H5F_get_vol_cls(const H5F_t *f); /* Functions than retrieve values set/cached from the superblock/FCPL */ H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index c04ba24..c9b21ea 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -1073,3 +1073,24 @@ H5F_use_tmp_space(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->use_tmp_space) } /* end H5F_use_tmp_space() */ + +/*------------------------------------------------------------------------- + * Function: H5F_get_vol_cls + * + * Return: vol_cls on success/abort on failure (shouldn't fail) + * + * Programmer: Mohamad Chaarawi + * April 2012 + * + *------------------------------------------------------------------------- + */ +H5VL_class_t * +H5F_get_vol_cls(const H5F_t *f) +{ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f); + + FUNC_LEAVE_NOAPI(f->vol_cls) +} /* end H5F_get_parent() */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 1dcc518..ca60a6a 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -814,8 +814,7 @@ H5G_iterate(hid_t loc_id, const char *group_name, hid_t gid = -1; /* ID of group to iterate over */ H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */ H5G_iter_appcall_ud_t udata; /* User data for callback */ - H5VL_id_wrapper_t *id_wrapper1; /* user id structure of the location where the group will be opend */ - H5VL_id_wrapper_t *id_wrapper2; /* user id structure of new opend group*/ + H5VL_id_wrapper_t *id_wrapper; /* user id structure of new opend group*/ herr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -825,10 +824,6 @@ H5G_iterate(hid_t loc_id, const char *group_name, HDassert(last_lnk); HDassert(lnk_op && lnk_op->op_func.op_new); - /* get the ID struct */ - if(NULL == (id_wrapper1 = (H5VL_id_wrapper_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid user identifier") - /* * Open the group on which to operate. We also create a group ID which * we can pass to the application-defined operator. @@ -842,12 +837,12 @@ H5G_iterate(hid_t loc_id, const char *group_name, /* MSC - Create a new id that points to a struct that holds the group id and the VOL plugin */ /* Allocate new id structure */ - if(NULL == (id_wrapper2 = (H5VL_id_wrapper_t *)H5MM_malloc(sizeof(H5VL_id_wrapper_t)))) + if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5MM_malloc(sizeof(H5VL_id_wrapper_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - id_wrapper2->obj_id = gid; - id_wrapper2->vol_plugin = id_wrapper1->vol_plugin; + id_wrapper->obj_id = gid; + id_wrapper->vol_plugin = H5F_get_vol_cls(loc.oloc->file); - if((gid = H5I_register(H5I_GROUP_PUBLIC, id_wrapper2, TRUE)) < 0) + if((gid = H5I_register(H5I_GROUP_PUBLIC, id_wrapper, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize group handle") /* Set up user data for callback */ @@ -862,7 +857,7 @@ H5G_iterate(hid_t loc_id, const char *group_name, done: /* Release the group opened */ if(gid > 0) { - if(H5I_dec_app_ref(gid) < 0) + if(H5I_dec_app_ref(id_wrapper->obj_id) < 0 && H5I_dec_app_ref(gid) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") } /* end if */ else if(grp && H5G_close(grp) < 0) @@ -1100,6 +1095,7 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_t loc; /* Location of group passed in */ H5G_loc_t start_loc; /* Location of starting group */ unsigned rc; /* Reference count of object */ + H5VL_id_wrapper_t *id_wrapper; /* wrapper for the group ID */ herr_t ret_value; /* Return value */ /* Portably clear udata struct (before FUNC_ENTER) */ @@ -1123,6 +1119,16 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5G_loc(gid, &start_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + /* MSC - Create a new id that points to a struct that holds the group id and the VOL plugin */ + /* Allocate new id structure */ + if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5MM_malloc(sizeof(H5VL_id_wrapper_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + id_wrapper->obj_id = gid; + id_wrapper->vol_plugin = H5F_get_vol_cls(loc.oloc->file); + + if((gid = H5I_register(H5I_GROUP_PUBLIC, id_wrapper, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize group handle") + /* Set up user data */ udata.gid = gid; udata.curr_loc = &start_loc; @@ -1198,7 +1204,7 @@ done: /* Release the group opened */ if(gid > 0) { - if(H5I_dec_app_ref(gid) < 0) + if(H5I_dec_app_ref(id_wrapper->obj_id) < 0 && H5I_dec_app_ref(gid) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") } /* end if */ else if(grp && H5G_close(grp) < 0) diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index b375fe1..6411175 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -29,7 +29,6 @@ /****************/ #define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ /***********/ @@ -39,7 +38,6 @@ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ -#include "H5Fpkg.h" /* Files */ #include "H5Gpkg.h" /* Groups */ #include "H5HLprivate.h" /* Local Heaps */ #include "H5Iprivate.h" /* IDs */ @@ -218,8 +216,7 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5MM_malloc(sizeof(H5VL_id_wrapper_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") id_wrapper->obj_id = cur_grp; - id_wrapper->vol_plugin = grp_loc->oloc->file->vol_cls; - grp_loc->oloc->file->vol_cls->nrefs++; + id_wrapper->vol_plugin = H5F_get_vol_cls(grp_loc->oloc->file); if((cur_grp = H5I_register(H5I_GROUP_PUBLIC, id_wrapper, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize group handle") diff --git a/src/H5L.c b/src/H5L.c index 32e0c41..fd86258 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -1154,8 +1154,6 @@ H5Literate(hid_t id, H5_index_t idx_type, H5_iter_order_t order, H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_lnk; /* Index of last object looked at */ hsize_t idx; /* Internal location to hold index */ - H5VL_id_wrapper_t *id_wrapper; /* user id structure */ - hid_t grp_id; herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1696,6 +1694,7 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED H5G_loc_t temp_loc; /* For UD callback */ hbool_t temp_loc_init = FALSE; /* Temporary location for UD callback (temp_loc) has been initialized */ hbool_t obj_created = FALSE; /* Whether an object was created (through a hard link) */ + H5VL_id_wrapper_t *id_wrapper; /* wrapper for the group ID */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1790,6 +1789,16 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED if((grp_id = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register ID for group") + /* MSC - Create a new id that points to a struct that holds the group id and the VOL plugin */ + /* Allocate new id structure */ + if(NULL == (id_wrapper = (H5VL_id_wrapper_t *)H5MM_malloc(sizeof(H5VL_id_wrapper_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + id_wrapper->obj_id = grp_id; + id_wrapper->vol_plugin = H5F_get_vol_cls(grp_loc->oloc->file); + + if((grp_id = H5I_register(H5I_GROUP_PUBLIC, id_wrapper, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize group handle") + /* Make callback */ if((link_class->create_func)(name, grp_id, udata->lnk->u.ud.udata, udata->lnk->u.ud.size, H5P_DEFAULT) < 0) HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "link creation callback failed") @@ -1813,7 +1822,7 @@ done: /* Close the location given to the user callback if it was created */ if(grp_id >= 0) { - if(H5I_dec_app_ref(grp_id) < 0) + if(H5I_dec_app_ref(id_wrapper->obj_id) < 0 && H5I_dec_app_ref(grp_id) < 0) HDONE_ERROR(H5E_ATOM, H5E_CANTRELEASE, FAIL, "unable to close atom from UD callback") } /* end if */ else if(grp != NULL) { diff --git a/src/H5O.c b/src/H5O.c index 7e1f6ba..82d9453 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -253,6 +253,7 @@ done: free (location); location = NULL; } + FUNC_LEAVE_API(ret_value) } /* end H5Oopen() */ @@ -409,7 +410,8 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ + char *name = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "ii*sii", obj_id, new_loc_id, new_name, lcpl_id, lapl_id); @@ -438,6 +440,8 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, /* set creation properties */ if(H5P_set(plist, H5L_CRT_TARGET_ID_NAME, &obj_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id") + if(H5P_set(plist, H5L_CRT_TARGET_NAME_NAME, &name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id") /* Create the link through the VOL */ if((ret_value = H5VL_link_create(H5VL_CREATE_HARD_LINK, new_loc_id, new_name, diff --git a/src/H5Olink.c b/src/H5Olink.c index ccc6d0e..a374807 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -635,19 +635,26 @@ H5O_link_delete(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, void *_mesg) /* Check for delete callback */ if(link_class->del_func) { hid_t file_id; /* ID for the file the link is located in (passed to user callback) */ + hid_t wrapper_id; /* Get a file ID for the file the link is in */ if((file_id = H5F_get_id(f, FALSE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID") + wrapper_id = file_id; + + if (H5VL_replace_with_uids (&wrapper_id, 1) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID") + /* Call user-defined link's 'delete' callback */ - if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) { + if((link_class->del_func)(lnk->name, wrapper_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) { H5I_dec_ref(file_id); + H5I_dec_ref(wrapper_id); HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure") } /* end if */ /* Release the file ID */ - if(H5I_dec_ref(file_id) < 0) + if(H5I_dec_ref(file_id) < 0 && H5I_dec_ref(wrapper_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file") } /* end if */ } /* end if */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index cec022e..366f771 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -958,20 +958,20 @@ H5VL_native_group_get(hid_t obj_id, H5VL_group_get_t get_type, va_list arguments case H5VL_GROUP_GET_INFO: { H5G_info_t *grp_info = va_arg (arguments, H5G_info_t *); - H5O_loc_t *oloc = va_arg (arguments, H5O_loc_t *); + H5G_loc_t *obj_loc = va_arg (arguments, H5G_loc_t *); H5G_loc_t loc; if(H5G_loc(obj_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!H5F_addr_defined(oloc->addr)) + if(!H5F_addr_defined(obj_loc->oloc->addr)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no address supplied") /* Retrieve the group's information */ - if(H5G__obj_info(oloc, grp_info, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(obj_loc->oloc, grp_info, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - if(H5O_loc_free(oloc) < 0) + if(H5G_loc_free(obj_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") break; } @@ -1001,9 +1001,7 @@ static hid_t H5VL_native_object_open(hid_t loc_id, void *location, hid_t lapl_id) { H5G_loc_t loc; - H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t *oloc = (H5O_loc_t *)location; + H5G_loc_t *obj_loc = (H5G_loc_t *)location; hid_t ret_value = FAIL; FUNC_ENTER_NOAPI_NOINIT @@ -1011,21 +1009,17 @@ H5VL_native_object_open(hid_t loc_id, void *location, hid_t lapl_id) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - if(!H5F_addr_defined(oloc->addr)) + if(!H5F_addr_defined(obj_loc->oloc->addr)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no address supplied") - /* Set up opened group location to fill in */ - obj_loc.oloc = oloc; - obj_loc.path = &obj_path; - H5G_name_reset(obj_loc.path); - /* Open the object */ - if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_dxpl_id, TRUE)) < 0) + if((ret_value = H5O_open_by_loc(obj_loc, lapl_id, H5AC_dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: - if(H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") + if(ret_value < 0) + if(H5G_loc_free(obj_loc) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_native_object_open() */ @@ -1115,21 +1109,21 @@ H5VL_native_object_get(hid_t id, H5VL_object_get_t get_type, va_list arguments) case H5VL_OBJECT_GET_INFO: { H5O_info_t *obj_info = va_arg (arguments, H5O_info_t *); - H5O_loc_t *oloc = va_arg (arguments, H5O_loc_t *); + H5G_loc_t *obj_loc = va_arg (arguments, H5G_loc_t *); hbool_t loc_set = FALSE; - if(NULL == oloc) { - oloc = loc.oloc; + if(NULL == obj_loc) { + obj_loc = &loc; } else { loc_set = TRUE; } /* Retrieve the object's information */ - if(H5O_get_info(oloc, H5AC_ind_dxpl_id, TRUE, obj_info) < 0) + if(H5O_get_info(obj_loc->oloc, H5AC_ind_dxpl_id, TRUE, obj_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve object info") - if(loc_set && H5O_loc_free(oloc) < 0) + if(loc_set && H5G_loc_free(obj_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") break; } @@ -1173,29 +1167,31 @@ static herr_t H5VL_native_object_lookup(hid_t loc_id, H5VL_object_lookup_t lookup_type, va_list arguments) { H5G_loc_t loc; - H5G_loc_t obj_loc; + H5G_loc_t *obj_loc; H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t **location; + H5G_loc_t **location; haddr_t obj_addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT - location = va_arg (arguments, H5O_loc_t **); - *location = (H5O_loc_t *) H5MM_malloc (sizeof (H5O_loc_t)); + location = va_arg (arguments, H5G_loc_t **); + *location = (H5G_loc_t *) H5MM_malloc (sizeof (H5G_loc_t)); if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - obj_loc.oloc = *location; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); + obj_loc = *location; + obj_loc->oloc = (H5O_loc_t *) H5MM_malloc (sizeof (H5O_loc_t));//*location; + obj_loc->path = (H5G_name_t *) H5MM_malloc (sizeof (H5G_name_t));//&obj_path; + H5G_loc_reset(obj_loc); switch (lookup_type) { case H5VL_OBJECT_LOOKUP: - (*location)->addr = loc.oloc->addr; - (*location)->file = loc.oloc->file; - (*location)->holding_file = loc.oloc->holding_file; + obj_loc->oloc->addr = loc.oloc->addr; + obj_loc->oloc->file = loc.oloc->file; + obj_loc->oloc->holding_file = loc.oloc->holding_file; + obj_loc->path = loc.path; break; case H5VL_OBJECT_LOOKUP_BY_NAME: { @@ -1205,7 +1201,7 @@ H5VL_native_object_lookup(hid_t loc_id, H5VL_object_lookup_t lookup_type, va_lis HDassert(name && *name); /* Find the object's location */ - if((ret_value = H5G_loc_find(&loc, name, &obj_loc, lapl_id, H5AC_dxpl_id)) < 0) + if((ret_value = H5G_loc_find(&loc, name, obj_loc, lapl_id, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") break; } @@ -1219,16 +1215,16 @@ H5VL_native_object_lookup(hid_t loc_id, H5VL_object_lookup_t lookup_type, va_lis /* Find the object's location, according to the order in the index */ if((ret_value = H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, - &obj_loc/*out*/, lapl_id, H5AC_dxpl_id)) < 0) + obj_loc/*out*/, lapl_id, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") break; } case H5VL_OBJECT_LOOKUP_BY_ADDR: { obj_addr = va_arg (arguments, haddr_t); - (*location)->addr = obj_addr; - (*location)->file = loc.oloc->file; - (*location)->holding_file = loc.oloc->holding_file; + obj_loc->oloc->addr = obj_addr; + obj_loc->oloc->file = loc.oloc->file; + obj_loc->oloc->holding_file = loc.oloc->holding_file; break; } case H5VL_OBJECT_LOOKUP_BY_REF: @@ -1246,9 +1242,9 @@ H5VL_native_object_lookup(hid_t loc_id, H5VL_object_lookup_t lookup_type, va_lis switch(ref_type) { case H5R_OBJECT: - (*location)->addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */ - (*location)->file = loc.oloc->file; - (*location)->holding_file = loc.oloc->holding_file; + obj_loc->oloc->addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */ + obj_loc->oloc->file = loc.oloc->file; + obj_loc->oloc->holding_file = loc.oloc->holding_file; break; case H5R_DATASET_REGION: @@ -1270,8 +1266,8 @@ H5VL_native_object_lookup(hid_t loc_id, H5VL_object_lookup_t lookup_type, va_lis /* Get the object oid for the dataset */ p = buf; //H5F_addr_decode(file, &p, &(obj_addr)); - H5F_addr_decode(file, &p, &((*location)->addr)); - (*location)->file = file; + H5F_addr_decode(file, &p, &(obj_loc->oloc->addr)); + obj_loc->oloc->file = file; /* Free the buffer allocated in H5HG_read() */ H5MM_xfree(buf); } /* end case */ @@ -1289,8 +1285,8 @@ H5VL_native_object_lookup(hid_t loc_id, H5VL_object_lookup_t lookup_type, va_lis HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't lookup this object") } /* end switch */ - if(H5G_name_free(obj_loc.path) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to free path") + //if(H5G_name_free(obj_loc.path) < 0) + //HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to free path") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2095,20 +2091,17 @@ H5VL_native_attr_create(hid_t loc_id, const char *attr_name, hid_t acpl_id, hid_ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") } else { /* H5Acreate_by_name */ - H5G_loc_t obj_loc; /* Object location */ H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t *oloc = (H5O_loc_t *)location; - + H5G_loc_t *obj_loc = (H5G_loc_t *)location; /* Set up opened group location to fill in */ - obj_loc.oloc = oloc;//&obj_oloc; - obj_loc.path = &obj_path; - H5G_name_reset(obj_loc.path); - + //obj_loc.oloc = oloc;; + //obj_loc.path = &obj_path; + //H5G_name_reset(obj_loc.path); /* Go do the real work for attaching the attribute to the dataset */ - if((ret_value = H5A_create(&obj_loc, attr_name, type, space, acpl_id, H5AC_dxpl_id)) < 0) + if((ret_value = H5A_create(obj_loc, attr_name, type, space, acpl_id, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") - if(H5G_loc_free(&obj_loc) < 0) + if(H5G_loc_free(obj_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") } @@ -2146,13 +2139,13 @@ H5VL_native_attr_open(hid_t loc_id, void *location, const char *attr_name, hid_t HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(NULL != location) { /* H5Aopen_by_name */ - H5O_loc_t *oloc = (H5O_loc_t *)location; + H5G_loc_t *obj_loc = (H5G_loc_t *)location; /* Read in attribute from object header */ - if(NULL == (attr = H5O_attr_open_by_name(oloc, attr_name, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5O_attr_open_by_name(obj_loc->oloc, attr_name, H5AC_ind_dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from object header") - if(H5O_loc_free(oloc) < 0) + if(H5G_loc_free(obj_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") } diff --git a/test/links.c b/test/links.c index 329b9a2..6d69fea 100644 --- a/test/links.c +++ b/test/links.c @@ -7380,17 +7380,17 @@ done: /* Close the target object if we opened it */ if(target_obj >= 0) { switch(H5Iget_type(target_obj)) { - case H5I_GROUP: + case H5I_GROUP_PUBLIC: if(H5Gclose(target_obj) < 0) ret_value = -1; break; - case H5I_DATASET: + case H5I_DATASET_PUBLIC: if(H5Dclose(target_obj) < 0) ret_value = -1; break; - case H5I_DATATYPE: + case H5I_DATATYPE_PUBLIC: if(H5Tclose(target_obj) < 0) ret_value = -1; break; @@ -7467,17 +7467,17 @@ done: /* Close the target object if we opened it */ if(target_obj >= 0) { switch(H5Iget_type(target_obj)) { - case H5I_GROUP: + case H5I_GROUP_PUBLIC: if(H5Gclose(target_obj) < 0) ret_value = -1; break; - case H5I_DATASET: + case H5I_DATASET_PUBLIC: if(H5Dclose(target_obj) < 0) ret_value = -1; break; - case H5I_DATATYPE: + case H5I_DATATYPE_PUBLIC: if(H5Tclose(target_obj) < 0) ret_value = -1; break; -- cgit v0.12