diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2008-10-03 03:54:23 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2008-10-03 03:54:23 (GMT) |
commit | 3d008d3756c094fa205770b810fa2719c3e21687 (patch) | |
tree | 46c06c3ad13199c2a415dc8d5c9fc28123aeb83a /src/H5Lexternal.c | |
parent | 33ae6a749eaa04ee7ab91d7b63cb430fd4e0fc8f (diff) | |
download | hdf5-3d008d3756c094fa205770b810fa2719c3e21687.zip hdf5-3d008d3756c094fa205770b810fa2719c3e21687.tar.gz hdf5-3d008d3756c094fa205770b810fa2719c3e21687.tar.bz2 |
[svn-r15762] Changes for bug #1247 so that the user can specify the driver
to use when opening the external linked target file.
1. Two new public routines are added to H5Plapl.c as well as
"del/copy/close" callbacks for the property itself.
2. Modify H5L_extern_traverse() to use the fapl set via
H5Pset_elink_fapl() and retrieve via H5Pget_elink_fapl().
3. Add 3 tests to links.c to verify H5Pset/get_elink_fapl().
Also fix the compiler warning for the "if condition" in
H5_build_extpath() of H5system.c.
Diffstat (limited to 'src/H5Lexternal.c')
-rw-r--r-- | src/H5Lexternal.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index acd6ee9..d5a441d 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -171,6 +171,14 @@ done: * Vailin Choi, April 2, 2008 * Add handling to search for the target file * See description in RM: H5Lcreate_external + * + * Vailin Choi; Sept. 12th, 2008; bug #1247 + * Retrieve the file access property list identifer that is set + * for link access property via H5Pget_elink_fapl(). + * If the return value is H5P_DEFAULT, the parent's file access + * property is used to H5F_open() the target file; + * Otherwise, the file access property retrieved from H5Pget_elink_fapl() + * is used to H5F_open() the target file. * *------------------------------------------------------------------------- */ @@ -197,6 +205,8 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group, char *env_prefix=NULL, *tmp_env_prefix=NULL; char *out_prefix_name=NULL, *pp=NULL; + H5P_genplist_t *fa_plist; /* File access property list pointer */ + H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */ FUNC_ENTER_NOAPI(H5L_extern_traverse, FAIL) @@ -219,31 +229,25 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group, if(NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + /* get the fapl_id set for lapl_id if any */ + if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links") + /* Get the location for the group holding the external link */ if(H5G_loc(cur_group, &loc) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get object location") - /* Whatever access properties and intent the user used on the old file, - * use the same ones to open the new file. If this is a bad default, - * users can override this callback using H5Lregister. - */ + /* get the file access mode flags for the parent file */ intent = H5F_INTENT(loc.oloc->file); - if((fapl_id = H5F_get_access_plist(loc.oloc->file, FALSE)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get file access property list") - /* Check for non-"weak" file close degree for parent file */ - if(H5F_GET_FC_DEGREE(loc.oloc->file) != H5F_CLOSE_WEAK) { - H5P_genplist_t *fa_plist; /* Property list pointer */ - H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree */ + if ((fapl_id == H5P_DEFAULT) && ((fapl_id = H5F_get_access_plist(loc.oloc->file, FALSE)) < 0)) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get parent's file access property list") - /* Get the plist structure */ - if(NULL == (fa_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Set file close degree for new file to "weak" */ - if(H5P_set(fa_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") - } /* end if */ + /* Set file close degree for new file to "weak" */ + if(NULL == (fa_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + if(H5P_set(fa_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") /* * Start searching for the target file |