summaryrefslogtreecommitdiffstats
path: root/src/H5Gdense.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/H5Gdense.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/H5Gdense.c')
-rw-r--r--src/H5Gdense.c41
1 files changed, 8 insertions, 33 deletions
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index 3b8be2f..4213076 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -1352,39 +1352,14 @@ H5G_dense_remove_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, H5B2_ITER_ERROR, "unable to remove link from creation order index v2 B-tree")
} /* end if */
- /* Retrieve the link's object type & decr. the ref. count on hard links, if requested */
- switch(lnk->type) {
- case H5L_TYPE_HARD:
- {
- H5O_loc_t tmp_oloc; /* Temporary object location */
-
- /* Build temporary object location */
- tmp_oloc.file = udata->f;
- tmp_oloc.addr = lnk->u.hard.addr;
-
- /* Get the type of the object */
- /* Note: no way to check for error :-( */
- if(udata->obj_type)
- *(udata->obj_type) = H5O_obj_type(&tmp_oloc, udata->dxpl_id);
-
- /* Decrement the ref count for the object, if requested */
- if(udata->adj_link)
- if(H5O_link(&tmp_oloc, -1, udata->dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to decrement object link count")
- }
- break;
-
- case H5L_TYPE_SOFT:
- if(udata->obj_type)
- *(udata->obj_type) = H5G_LINK;
- break;
-
- default: /* User-defined link */
- if(lnk->type < H5L_TYPE_UD_MIN)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown link type")
- if(udata->obj_type)
- *(udata->obj_type) = H5G_UDLINK;
- } /* end switch */
+ /* Determine the object's type */
+ if(H5G_link_obj_type(udata->f, udata->dxpl_id, lnk, udata->obj_type) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object type")
+
+ /* Perform the deletion action on the link */
+ /* (call link message "delete" callback directly: *ick* - QAK) */
+ if(H5O_link_delete(udata->f, udata->dxpl_id, lnk, udata->adj_link) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link")
/* Release the space allocated for the link */
H5O_free(H5O_LINK_ID, lnk);