summaryrefslogtreecommitdiffstats
path: root/src/H5G.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-09-28 14:20:21 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-09-28 14:20:21 (GMT)
commitc0941f01e38812435e8dd2052d3d7b5deab045dc (patch)
tree0d8a314e12f0f26ebb1cb1326ed5169fa09fab53 /src/H5G.c
parentb1df4a74cd6a4e620a7f73cedce611988ca151d8 (diff)
downloadhdf5-c0941f01e38812435e8dd2052d3d7b5deab045dc.zip
hdf5-c0941f01e38812435e8dd2052d3d7b5deab045dc.tar.gz
hdf5-c0941f01e38812435e8dd2052d3d7b5deab045dc.tar.bz2
[svn-r726] Changes since 19980924
---------------------- ./MANIFEST ./src/H5B.c ./src/H5Bprivate.h ./src/H5G.c ./src/H5Gnode.c ./src/H5Gprivate.h ./test/Makefile.in ./test/unlink.c [NEW] Finished H5Gunlink() and H5Grename(). ./src/H5F.c ./src/H5Fistore.c ./src/H5Fprivate.h Removed the last memcpy() from the chunk cache. ./src/H5Fistore.c The offset of a chunk within a dataset is an 8-byte quantity per dimension instead of 4 bytes. ./src/H5HL.c Fixed infinite loops in H5HL_remove().
Diffstat (limited to 'src/H5G.c')
-rw-r--r--src/H5G.c60
1 files changed, 56 insertions, 4 deletions
diff --git a/src/H5G.c b/src/H5G.c
index a8fa956..6f37549 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -523,14 +523,29 @@ H5Giterate(hid_t loc_id, const char *name, int *idx,
*-------------------------------------------------------------------------
*/
herr_t
-H5Gmove(hid_t __unused__ loc_id, const char __unused__ *src,
- const char __unused__ *dst)
+H5Gmove(hid_t loc_id, const char *src, const char *dst)
{
+ H5G_entry_t *loc=NULL;
+
FUNC_ENTER (H5Gmove, FAIL);
H5TRACE3("e","iss",loc_id,src,dst);
- HRETURN_ERROR (H5E_SYM, H5E_UNSUPPORTED, FAIL,
- "unable to rename object (not implemented yet)");
+ if (NULL==(loc=H5G_loc(loc_id))) {
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location");
+ }
+ if (!src || !*src) {
+ HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "no current name specified");
+ }
+ if (!dst || !*dst) {
+ HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
+ "no new name specified");
+ }
+
+ if (H5G_move(loc, src, dst)<0) {
+ HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL,
+ "unable to change object name");
+ }
FUNC_LEAVE (SUCCEED);
}
@@ -2383,3 +2398,40 @@ H5G_unlink(H5G_entry_t *loc, const char *name)
FUNC_LEAVE(SUCCEED);
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_move
+ *
+ * Purpose: Atomically rename an object.
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Friday, September 25, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_move(H5G_entry_t *loc, const char *src_name, const char *dst_name)
+{
+ FUNC_ENTER(H5G_move, FAIL);
+ assert(loc);
+ assert(src_name && *src_name);
+ assert(dst_name && *dst_name);
+
+ if (H5G_link(loc, H5G_LINK_HARD, src_name, dst_name)<0) {
+ HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL,
+ "unable to register new name for object");
+ }
+ if (H5G_unlink(loc, src_name)<0) {
+ HRETURN_ERROR(H5E_SYM, H5E_CANTINIT, FAIL,
+ "unable to deregister old object name");
+ }
+
+ FUNC_LEAVE(SUCCEED);
+}