diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2016-01-11 16:07:17 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2016-01-11 16:07:17 (GMT) |
commit | 994401b905680598db47e154e5123b8838f1f1c8 (patch) | |
tree | 62c4e3327817d95c81bfab4ec0a9fe6f52661aeb /tools | |
parent | 23fce5cea130631d56b9f1beaf002c000e995f9c (diff) | |
download | hdf5-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 'tools')
-rw-r--r-- | tools/h5format_convert/h5fc_gentest.c | 18 | ||||
-rw-r--r-- | tools/h5format_convert/h5format_convert.c | 40 | ||||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_v_all.ddl | 1 | ||||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_v_bt1.ddl | 1 | ||||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl | 1 | ||||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_v_n_all.ddl | 1 | ||||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl | 1 | ||||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl | 1 |
8 files changed, 62 insertions, 2 deletions
diff --git a/tools/h5format_convert/h5fc_gentest.c b/tools/h5format_convert/h5fc_gentest.c index 4dcc286..888aa27 100644 --- a/tools/h5format_convert/h5fc_gentest.c +++ b/tools/h5format_convert/h5fc_gentest.c @@ -172,6 +172,7 @@ gen_latest(const char *fname) { hid_t fid = -1; /* file id */ hid_t fapl = -1; /* file access property list */ + hid_t fcpl = -1; /* file creation property list */ hid_t gid = -1; /* group id */ hid_t sid = -1; /* space id */ hid_t dcpl = -1; /* dataset creation property id */ @@ -188,7 +189,12 @@ gen_latest(const char *fname) if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) goto error; - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + goto error; + if(H5Pset_shared_mesg_nindexes(fcpl, 4) < 0) + goto error; + + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0) goto error; /* Create a group */ @@ -365,6 +371,7 @@ static void gen_non(const char *fname) { hid_t fid = -1; /* file id */ + hid_t fcpl = -1; /* file creation property list */ hid_t gid = -1; /* group id */ hid_t sid = -1; /* space id */ hid_t dcpl = -1; /* dataset creation property id */ @@ -376,8 +383,15 @@ gen_non(const char *fname) int i; /* local index variable */ int buf[24]; /* data buffer */ + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + goto error; + if(H5Pset_shared_mesg_nindexes(fcpl, 4) < 0) + goto error; + if(H5Pset_istore_k(fcpl, 64) < 0) + goto error; + /* Create a new file with SWMR_WRITE + non-latest-format */ - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, fcpl, H5P_DEFAULT)) < 0) goto error; /* Create a group */ diff --git a/tools/h5format_convert/h5format_convert.c b/tools/h5format_convert/h5format_convert.c index 7686acc..a80e332 100644 --- a/tools/h5format_convert/h5format_convert.c +++ b/tools/h5format_convert/h5format_convert.c @@ -377,6 +377,9 @@ main(int argc, const char *argv[]) H5E_auto2_t func; void *edata; hid_t fid = -1; + hid_t fcpl = -1; + H5F_file_space_type_t strategy; + hsize_t threshold; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); @@ -405,6 +408,28 @@ main(int argc, const char *argv[]) } else if(verbose_g) printf("Open the file %s\n", fname_g); + /* A temporaray fix: + * need to handle H5O_FSINFO_ID message when downgrade superblock version from 3 to 2 + */ + if((fcpl = H5Fget_create_plist(fid)) < 0) { + error_msg("unable to get file creation property list for \"%s\"\n", fname_g); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + if(H5Pget_file_space(fcpl, &strategy, &threshold) < 0) { + error_msg("unable to get file space strategy/threshold\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + /* Check for non-default strategy/threshold: + * --whether there is H5O_FSINFO_ID message in the superblock extension + */ + if(strategy != H5F_FILE_SPACE_ALL || threshold != 1) { + error_msg("unable to convert due to non-default file space strategy/threshold\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + if(dset_g) { /* Convert a specified dataset in the file */ if(verbose_g) printf("Going to process dataset: %s...\n", dname_g); @@ -417,6 +442,21 @@ main(int argc, const char *argv[]) goto done; } + if(verbose_g) { + if(noop_g) { + printf("Not processing the file's superblock version...\n"); + h5tools_setstatus(EXIT_SUCCESS); + goto done; + } + printf("Processing the file's superblock version...\n"); + } + + if(H5Fformat_convert_super(fid) < 0) { + error_msg("unable to convert file's superblock version\"%s\"\n", fname_g); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + done: /* Close the file */ if(fid >= 0) { diff --git a/tools/h5format_convert/testfiles/h5fc_v_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_all.ddl index 3f474fe..5a35c55 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_all.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_all.ddl @@ -23,4 +23,5 @@ Retrieve the dataset's chunk indexing type Chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list +Processing the file's superblock version... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl index abb0a89..c96b647 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_bt1.ddl @@ -8,4 +8,5 @@ Retrieve the dataset's chunk indexing type Chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list +Processing the file's superblock version... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl index a26dc66..a7a622a 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl @@ -10,4 +10,5 @@ Verify the dataset's chunk indexing type is not version 1 B-tree Not converting the dataset Close the dataset Close the dataset creation property list +Not processing the file's superblock version... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl index 76c70ee..3e92568 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl @@ -44,4 +44,5 @@ Retrieve the dataset's layout Dataset is not chunked: no further action Close the dataset Close the dataset creation property list +Not processing the file's superblock version... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl index 86081f3..bdf3380 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl @@ -9,4 +9,5 @@ Retrieve the dataset's chunk indexing type Chunk indexing type is already version 1 B-tree: no further action Close the dataset Close the dataset creation property list +Not processing the file's superblock version... Close the file diff --git a/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl index baba0e4..4caafe9 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_non_chunked.ddl @@ -6,4 +6,5 @@ Retrieve the dataset's layout Dataset is not chunked: no further action Close the dataset Close the dataset creation property list +Processing the file's superblock version... Close the file |