summaryrefslogtreecommitdiffstats
path: root/src/H5L.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-11-13 21:45:35 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-11-13 21:45:35 (GMT)
commitf494ab7674dc39225deb4a06ba211f82f3e9df5e (patch)
tree55d6b6ace03aa2063c0569466d9ef474fcf66487 /src/H5L.c
parent3f7dc01ccc7f9702c3a4080afe0c2ddebf34c032 (diff)
downloadhdf5-f494ab7674dc39225deb4a06ba211f82f3e9df5e.zip
hdf5-f494ab7674dc39225deb4a06ba211f82f3e9df5e.tar.gz
hdf5-f494ab7674dc39225deb4a06ba211f82f3e9df5e.tar.bz2
[svn-r12906] Description:
Straighten out some convoluted code when links were being deleted, which could cause the "delete" callback for user-defined links to not get called when the group they were in was deleted. Had to compromise on the "delete" callback though - only calls the callback with the ID for the file the link is in, instead of the group, since the group is being held open upstream in the calling sequence during a group deletion and this prevents a group and its ID from being created. (This could possibly be worked around, but would cause a fair bit of havoc in the code and I'm not entirely certain it's worth it...) Tested on: Linux/32 2.6 (chicago)
Diffstat (limited to 'src/H5L.c')
-rw-r--r--src/H5L.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/H5L.c b/src/H5L.c
index 1dff29d..2b2363d 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -1958,10 +1958,6 @@ H5L_delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSE
H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/)
{
H5L_trav_rm_t *udata = (H5L_trav_rm_t *)_udata; /* User data passed in */
- H5G_t *grp = NULL; /* H5G_t for this group, opened to pass to user callback */
- hid_t grp_id = FAIL; /* ID for this group (passed to user callback) */
- H5G_loc_t temp_loc; /* For UD callback */
- hbool_t temp_loc_init = FALSE; /* Temporary location has been initialized? */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5L_delete_cb)
@@ -1974,55 +1970,11 @@ H5L_delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSE
if(lnk == NULL)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "can't delete self")
- /* If there is a user-defined callback, call it before deleting the link */
- if(lnk->type >= H5L_TYPE_UD_MIN)
- {
- const H5L_class_t *link_class; /* User-defined link class */
-
- /* Get the link class for this type of link. */
- if(NULL == (link_class = H5L_find_class(lnk->type)))
- HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class not registered")
-
- if(link_class->del_func != NULL)
- {
- H5O_loc_t temp_oloc;
- H5G_name_t temp_path;
-
- H5G_name_reset(&temp_path);
-
- /* Get object location for link's parent group */
- if(H5O_loc_copy(&temp_oloc, grp_loc->oloc, H5_COPY_DEEP) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location")
-
- temp_loc.oloc = &temp_oloc;
- temp_loc.path = &temp_path;
- temp_loc_init = TRUE;
-
- /* Set up group for user-defined callback */
- if((grp = H5G_open(&temp_loc, udata->dxpl_id)) == NULL)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open group")
- if((grp_id = H5I_register(H5I_GROUP, grp)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
-
- /* Call user-defined link's 'delete' callback */
- if((link_class->del_func)(name, grp_id, lnk->u.ud.udata, lnk->u.ud.size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "link deletion callback returned failure")
- } /* end if */
- } /* end if */
-
/* Remove the link from the group */
if(H5G_loc_remove(grp_loc, name, obj_loc, udata->dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to remove link from group")
done:
- /* Close the location given to the user callback if it was created */
- if(grp_id >= 0)
- H5I_dec_ref(grp_id);
- else if(grp != NULL)
- H5G_close(grp);
- else if(temp_loc_init)
- H5G_loc_free(&temp_loc);
-
/* Indicate that this callback didn't take ownership of the group *
* location for the object */
*own_loc = H5G_OWN_NONE;