summaryrefslogtreecommitdiffstats
path: root/src/H5Plapl.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2006-08-03 22:35:58 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2006-08-03 22:35:58 (GMT)
commitb5724779d0b10f610de10bf2ab88d62202160272 (patch)
treed89656e3ceb6504d3338ddfb7ae8aec76db66159 /src/H5Plapl.c
parentb1e0516dd0b0795ec04dbe86f909412e94cbaa2a (diff)
downloadhdf5-b5724779d0b10f610de10bf2ab88d62202160272.zip
hdf5-b5724779d0b10f610de10bf2ab88d62202160272.tar.gz
hdf5-b5724779d0b10f610de10bf2ab88d62202160272.tar.bz2
[svn-r12533] Standardized the way path prefixes are passed to external links using a
LAPL. Now there are H5Pget and H5Pset functions for "elink_prefixes".
Diffstat (limited to 'src/H5Plapl.c')
-rw-r--r--src/H5Plapl.c82
1 files changed, 80 insertions, 2 deletions
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index cfe6b50..4a80cc2 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -75,8 +75,6 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Pget_nlinks
*
- * Purpose: Get the number of soft or UD traversals allowed when using
- * this property list.
* Purpose: Gets the number of soft or user-defined links that can be
* traversed before a failure occurs.
*
@@ -115,3 +113,83 @@ done:
}
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_elink_prefix
+ *
+ * Purpose: Set a prefix to be applied to the path of any external links
+ * traversed. The prefix is appended to the filename stored
+ * in the external link.
+ *
+ * The prefix is supplied by giving a pointer to a user-
+ * allocated buffer. This buffer should not be freed
+ * until this property list has been closed.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Thursday, August 3, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_elink_prefix(hid_t plist_id, const char *prefix)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pset_elink_prefix, FAIL)
+ H5TRACE2("e","iz",plist_id,nlinks);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Set prefix */
+ if(H5P_set(plist, H5L_ELINK_PREFIX_NAME, &prefix) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_elink_prefix() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_elink_prefix
+ *
+ * Purpose: Gets the prefix to be applied to any external link
+ * traversals made using this property list.
+ *
+ * If the pointer is not NULL, it points to a user-allocated
+ * buffer.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Thursday, August 3, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_elink_prefix(hid_t plist_id, char **prefix)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_elink_prefix, FAIL)
+ H5TRACE2("e","i*z",plist_id,nlinks);
+
+ if(!prefix)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer passed in");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get the current prefix */
+ if(H5P_get(plist, H5L_ELINK_PREFIX_NAME, prefix) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+}
+