summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2016-01-11 16:07:17 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2016-01-11 16:07:17 (GMT)
commit994401b905680598db47e154e5123b8838f1f1c8 (patch)
tree62c4e3327817d95c81bfab4ec0a9fe6f52661aeb /src
parent23fce5cea130631d56b9f1beaf002c000e995f9c (diff)
downloadhdf5-994401b905680598db47e154e5123b8838f1f1c8.zip
hdf5-994401b905680598db47e154e5123b8838f1f1c8.tar.gz
hdf5-994401b905680598db47e154e5123b8838f1f1c8.tar.bz2
[svn-r28852] Fix to downgrade superblock version for the tool h5format_convert so DLS can use 1.8 h5dump on the converted file.
Tested on jam, osx1010test, quail, emu, moohan, ostrich, platypus.
Diffstat (limited to 'src')
-rw-r--r--src/H5F.c59
-rw-r--r--src/H5Fpublic.h1
2 files changed, 60 insertions, 0 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 948eb7a..e54c49d 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1872,3 +1872,62 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Fstop_mdc_logging() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fformat_convert_super (Internal)
+ *
+ * Purpose: Downgrade the superblock version for the tool h5format_convert.
+ * (NOTE: more needs to be done to this routine)
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Jan 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fformat_convert_super(hid_t fid)
+{
+ H5F_t *f = NULL; /* File to flush */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "i", fid);
+
+ switch(H5I_get_type(fid)) {
+ case H5I_FILE:
+ if(NULL == (f = (H5F_t *)H5I_object(fid)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ if(f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_LATEST)
+ HGOTO_DONE(SUCCEED)
+ f->shared->sblock->super_vers = HDF5_SUPERBLOCK_VERSION_LATEST - 1;
+
+ /* Mark superblock as dirty */
+ if(H5F_super_dirty(f) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty")
+
+ break;
+
+ case H5I_GROUP:
+ case H5I_DATATYPE:
+ case H5I_DATASET:
+ case H5I_ATTR:
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_DATASPACE:
+ case H5I_REFERENCE:
+ case H5I_VFL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_NTYPES:
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ } /* end switch */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fformat_convert_super() */
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index fa45d10..7c77a92 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -246,6 +246,7 @@ H5_DLL herr_t H5Fstop_mdc_logging(hid_t file_id);
H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id,
/*OUT*/ hbool_t *is_enabled,
/*OUT*/ hbool_t *is_currently_logging);
+H5_DLL herr_t H5Fformat_convert_super(hid_t fid);
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);