summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-11-01 17:32:49 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-11-01 17:32:49 (GMT)
commitecaf22fa0450205a508c961b59dbe616d0449b0a (patch)
tree8639af89b517b320d8ce09aa5e958f54fc2ad481 /src/H5O.c
parent88cf7ce60bd0784835d66ff79945baeaa0ddd678 (diff)
downloadhdf5-ecaf22fa0450205a508c961b59dbe616d0449b0a.zip
hdf5-ecaf22fa0450205a508c961b59dbe616d0449b0a.tar.gz
hdf5-ecaf22fa0450205a508c961b59dbe616d0449b0a.tar.bz2
[svn-r14228] Description:
Change H5Llink to H5Olink, which makes more sense. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/H5O.c b/src/H5O.c
index 9e1c927..681413e 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -369,6 +369,61 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Olink
+ *
+ * Purpose: Creates a hard link from NEW_NAME to the object specified
+ * by OBJ_ID using properties defined in the Link Creation
+ * Property List LCPL.
+ *
+ * This function should be used to link objects that have just
+ * been created.
+ *
+ * NEW_NAME is interpreted relative to
+ * NEW_LOC_ID, which is either a file ID or a
+ * group ID.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Tuesday, December 13, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
+ hid_t lapl_id)
+{
+ H5G_loc_t new_loc;
+ H5G_loc_t obj_loc;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Olink, FAIL)
+ H5TRACE5("e", "ii*sii", obj_id, new_loc_id, new_name, lcpl_id, lapl_id);
+
+ /* Check arguments */
+ if(H5G_loc(obj_id, &obj_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(new_loc_id == H5L_SAME_LOC)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot use H5L_SAME_LOC when only one location is specified")
+ if(H5G_loc(new_loc_id, &new_loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!new_name || !*new_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(HDstrlen(new_name) > H5L_MAX_LINK_NAME_LEN)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "name too long")
+ if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
+
+ /* Link to the object */
+ if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Olink() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Oincr_refcount
*
* Purpose: Warning! This function is EXTREMELY DANGEROUS!