summaryrefslogtreecommitdiffstats
path: root/tools/src/h5repack
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2017-03-14 04:30:37 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2017-03-14 04:30:37 (GMT)
commit0313cbb91d974b153dbe8747d193ac3c619eea3b (patch)
treeaf6c4a631d5753685ee0033a6a8415a25fc97672 /tools/src/h5repack
parent847d675f2743ec420ef6c9efdd6e52ae93b4fe44 (diff)
downloadhdf5-0313cbb91d974b153dbe8747d193ac3c619eea3b.zip
hdf5-0313cbb91d974b153dbe8747d193ac3c619eea3b.tar.gz
hdf5-0313cbb91d974b153dbe8747d193ac3c619eea3b.tar.bz2
Final merge of page buffering branch to develop
Diffstat (limited to 'tools/src/h5repack')
-rw-r--r--tools/src/h5repack/h5repack.c6
-rw-r--r--tools/src/h5repack/h5repack.h16
-rw-r--r--tools/src/h5repack/h5repack_copy.c74
-rw-r--r--tools/src/h5repack/h5repack_main.c81
-rw-r--r--tools/src/h5repack/h5repack_verify.c112
5 files changed, 205 insertions, 84 deletions
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index c79db1c..c09dee6 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -78,8 +78,7 @@ int h5repack(const char* infile, const char* outfile, pack_opt_t *options) {
*-------------------------------------------------------------------------
*/
int
-h5repack_init(pack_opt_t *options, int verbose, hbool_t latest,
- H5F_file_space_type_t strategy, hsize_t threshold)
+h5repack_init(pack_opt_t *options, int verbose, hbool_t latest)
{
int k, n;
@@ -96,9 +95,6 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest,
options->filter_g[n].cd_values[k] = 0;
}
- options->fs_strategy = strategy;
- options->fs_threshold = threshold;
-
return (options_table_init(&(options->op_tbl)));
}
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index d2ab923..5ad0b80 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -30,6 +30,13 @@
#define FORMAT_OBJ_ATTR " %-27s %s\n" /* obj type, name */
#define MAX_COMPACT_DSIZE 64512 /* max data size for compact layout. -1k for header size */
+/* File space default information */
+#define FS_PAGESIZE_DEF 4096
+#define FS_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR
+#define FS_PERSIST_DEF FALSE
+#define FS_THRESHOLD_DEF 1
+
+
/*-------------------------------------------------------------------------
* data structures for command line options
*-------------------------------------------------------------------------
@@ -115,8 +122,10 @@ typedef struct {
hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
hsize_t threshold; /* alignment threshold for H5Pset_alignment */
hsize_t alignment; /* alignment for H5Pset_alignment */
- H5F_file_space_type_t fs_strategy; /* File space handling strategy */
- hsize_t fs_threshold; /* Free space section threshold */
+ H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
+ int fs_persist; /* Free space section threshold */
+ long fs_threshold; /* Free space section threshold */
+ long long fs_pagesize; /* File space page size */
} pack_opt_t;
@@ -138,8 +147,7 @@ extern "C" {
int h5repack(const char* infile, const char* outfile, pack_opt_t *options);
int h5repack_addfilter(const char* str, pack_opt_t *options);
int h5repack_addlayout(const char* str, pack_opt_t *options);
-int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest,
- H5F_file_space_type_t strategy, hsize_t threshold);
+int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest);
int h5repack_end(pack_opt_t *options);
int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options);
int h5repack_cmp_pl(const char *fname1, const char *fname2);
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 1519053..45d52bf 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -96,6 +96,14 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
hsize_t ub_size = 0; /* size of user block */
hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
hid_t fapl = H5P_DEFAULT; /* file access property list ID */
+ H5F_fspace_strategy_t set_strategy; /* Strategy to be set in outupt file */
+ hbool_t set_persist; /* Persist free-space status to be set in output file */
+ hsize_t set_threshold; /* Free-space section threshold to be set in output file */
+ hsize_t set_pagesize; /* File space page size to be set in output file */
+ H5F_fspace_strategy_t in_strategy; /* Strategy from input file */
+ hbool_t in_persist; /* Persist free-space status from input file */
+ hsize_t in_threshold; /* Free-space section threshold from input file */
+ hsize_t in_pagesize; /* File space page size from input file */
/*-------------------------------------------------------------------------
* open input file
@@ -106,7 +114,7 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- /* get user block size and file space strategy/threshold */
+ /* get user block size and file space strategy/persist/threshold */
{
hid_t fcpl_in; /* file creation property list ID for input file */
@@ -120,19 +128,17 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- if (!options->fs_strategy) {
- if (H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) {
- error_msg("failed to retrieve file space strategy\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
- }
+ /* If the -S option is not set, get "strategy" from the input file */
+ if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) {
+ error_msg("failed to retrieve file space strategy\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- if (!options->fs_threshold) {
- if (H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) {
- error_msg("failed to retrieve file space threshold\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
- }
- }
+ /* If the -G option is not set, get "pagesize" from the input file */
+ if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) {
+ error_msg("failed to retrieve file space threshold\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
if (H5Pclose(fcpl_in) < 0) {
error_msg("failed to close property list\n");
@@ -291,9 +297,9 @@ print_user_block(fnamein, fidin);
}
/*-------------------------------------------------------------------------
- * set free-space strategy options
- *-------------------------------------------------------------------------
- */
+ * Set file space information
+ *-------------------------------------------------------------------------
+ */
/* either use the FCPL already created or create a new one */
if (fcpl == H5P_DEFAULT) {
@@ -304,12 +310,44 @@ print_user_block(fnamein, fidin);
}
}
- /* set file space strategy and free space threshold */
- if (H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) {
- error_msg("failed to set file space strategy & threshold \n");
+ /* Set file space info to those from input file */
+ set_strategy = in_strategy;
+ set_persist = in_persist;
+ set_threshold = in_threshold;
+ set_pagesize = in_pagesize;
+
+ if(options->fs_strategy == (H5F_fspace_strategy_t)-1) /* A default strategy is specified by user */
+ set_strategy = FS_STRATEGY_DEF;
+ else if(options->fs_strategy != (H5F_fspace_strategy_t)0) /* Set strategy as specified by user */
+ set_strategy = options->fs_strategy;
+
+ if(options->fs_persist == -1) /* A default "persist" is specified by user */
+ set_persist = FS_PERSIST_DEF;
+ else if(options->fs_persist != 0) /* Set "persist" as specified by user */
+ set_persist = (hbool_t)options->fs_persist;
+
+ if(options->fs_threshold == -1) /* A "0" threshold is specified by user */
+ set_threshold = (hsize_t)0;
+ else if(options->fs_threshold != 0) /* Set threshold as specified by user */
+ set_threshold = (hsize_t)options->fs_threshold;
+
+ /* Set file space information as specified */
+ if(H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0) {
+ error_msg("failed to set file space strategy\n");
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
+ if(options->fs_pagesize == -1) /* A "0" file space page size is specified by user */
+ set_pagesize = (hsize_t)0;
+ else if(options->fs_pagesize != 0) /* Set file space page size as specified by user */
+ set_pagesize = (hsize_t)options->fs_pagesize;
+
+ if(set_pagesize != FS_PAGESIZE_DEF) /* Set non-default file space page size as specified */
+ if(H5Pset_file_space_page_size(fcpl, set_pagesize) < 0) {
+ error_msg("failed to set file space page size\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+
/*-------------------------------------------------------------------------
* create the output file
*-------------------------------------------------------------------------
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 1807056..a8b4cfe 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -33,7 +33,7 @@ const char *outfile = NULL;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:T:E";
+static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:P:T:G:E";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "version", no_arg, 'V' },
@@ -55,7 +55,9 @@ static struct long_options l_opts[] = {
{ "infile", require_arg, 'i' }, /* -i for backward compability */
{ "outfile", require_arg, 'o' }, /* -o for backward compability */
{ "fs_strategy", require_arg, 'S' },
+ { "fs_persist", require_arg, 'P' },
{ "fs_threshold", require_arg, 'T' },
+ { "fs_pagesize", require_arg, 'G' },
{ "enable-error-stack", no_arg, 'E' },
{ NULL, 0, '\0' }
};
@@ -92,8 +94,10 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " -a A, --alignment=A Alignment value for H5Pset_alignment\n");
PRINTVALSTREAM(rawoutstream, " -f FILT, --filter=FILT Filter type\n");
PRINTVALSTREAM(rawoutstream, " -l LAYT, --layout=LAYT Layout type\n");
- PRINTVALSTREAM(rawoutstream, " -S FS_STRGY, --fs_strategy=FS_STRGY File space management strategy\n");
- PRINTVALSTREAM(rawoutstream, " -T FS_THRD, --fs_threshold=FS_THRD Free-space section threshold\n");
+ PRINTVALSTREAM(rawoutstream, " -S FS_STRATEGY, --fs_strategy=FS_STRATEGY File space management strategy for H5Pset_file_space_strategy\n");
+ PRINTVALSTREAM(rawoutstream, " -P FS_PERSIST, --fs_persist=FS_PERSIST Persisting or not persisting free-space for H5Pset_file_space_strategy\n");
+ PRINTVALSTREAM(rawoutstream, " -T FS_THRESHOLD, --fs_threshold=FS_THRESHOLD Free-space section threshold for H5Pset_file_space_strategy\n");
+ PRINTVALSTREAM(rawoutstream, " -G FS_PAGESIZE, --fs_pagesize=FS_PAGESIZE File space page size for H5Pset_file_space_page_size\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " M - is an integer greater than 1, size of dataset in bytes (default is 0) \n");
PRINTVALSTREAM(rawoutstream, " E - is a filename.\n");
@@ -109,18 +113,27 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n");
PRINTVALSTREAM(rawoutstream, " occur.\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " FS_STRGY is the file space management strategy to use for the output file.\n");
- PRINTVALSTREAM(rawoutstream, " It is a string as listed below:\n");
- PRINTVALSTREAM(rawoutstream, " ALL_PERSIST - Use persistent free-space managers, aggregators and virtual file driver\n");
- PRINTVALSTREAM(rawoutstream, " for file space allocation\n");
- PRINTVALSTREAM(rawoutstream, " ALL - Use non-persistent free-space managers, aggregators and virtual file driver\n");
- PRINTVALSTREAM(rawoutstream, " for file space allocation\n");
- PRINTVALSTREAM(rawoutstream, " AGGR_VFD - Use aggregators and virtual file driver for file space allocation\n");
- PRINTVALSTREAM(rawoutstream, " VFD - Use virtual file driver for file space allocation\n");
+ PRINTVALSTREAM(rawoutstream, " FS_STRATEGY is a string indicating the file space strategy used:\n");
+ PRINTVALSTREAM(rawoutstream, " FSM_AGGR:\n");
+ PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are free-space managers, aggregators and virtual file driver.\n");
+ PRINTVALSTREAM(rawoutstream, " PAGE:\n");
+ PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are free-space managers with embedded paged aggregation and virtual file driver.\n");
+ PRINTVALSTREAM(rawoutstream, " AGGR:\n");
+ PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are aggregators and virtual file driver.\n");
+ PRINTVALSTREAM(rawoutstream, " NONE:\n");
+ PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are virtual file driver.\n");
+ PRINTVALSTREAM(rawoutstream, " The default strategy when not set is FSM_AGGR without persisting free-space.\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " FS_THRD is the free-space section threshold to use for the output file.\n");
- PRINTVALSTREAM(rawoutstream, " It is the minimum size (in bytes) of free-space sections to be tracked\n");
- PRINTVALSTREAM(rawoutstream, " by the the library's free-space managers.\n");
+ PRINTVALSTREAM(rawoutstream, " FS_PERSIST is 1 to persisting free-space or 0 to not persisting free-space.\n");
+ PRINTVALSTREAM(rawoutstream, " The default when not set is not persisting free-space.\n");
+ PRINTVALSTREAM(rawoutstream, " The value is ignored for AGGR and NONE strategies.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " FS_THRESHOLD is the minimum size (in bytes) of free-space sections to be tracked by the library.\n");
+ PRINTVALSTREAM(rawoutstream, " The default when not set is 1.\n");
+ PRINTVALSTREAM(rawoutstream, " The value is ignored for AGGR and NONE strategies.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " FS_PAGESIZE is the size (in bytes) >=512 that is used by the library when the file space strategy PAGE is used.\n");
+ PRINTVALSTREAM(rawoutstream, " The default when not set is 4096.\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " FILT - is a string with the format:\n");
PRINTVALSTREAM(rawoutstream, "\n");
@@ -521,25 +534,45 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
char strategy[MAX_NC_NAME];
HDstrcpy(strategy, opt_arg);
- if(!HDstrcmp(strategy, "ALL_PERSIST"))
- options->fs_strategy = H5F_FILE_SPACE_ALL_PERSIST;
- else if(!HDstrcmp(strategy, "ALL"))
- options->fs_strategy = H5F_FILE_SPACE_ALL;
- else if(!HDstrcmp(strategy, "AGGR_VFD"))
- options->fs_strategy = H5F_FILE_SPACE_AGGR_VFD;
- else if(!HDstrcmp(strategy, "VFD"))
- options->fs_strategy = H5F_FILE_SPACE_VFD;
+ if(!HDstrcmp(strategy, "FSM_AGGR"))
+ options->fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
+ else if(!HDstrcmp(strategy, "PAGE"))
+ options->fs_strategy = H5F_FSPACE_STRATEGY_PAGE;
+ else if(!HDstrcmp(strategy, "AGGR"))
+ options->fs_strategy = H5F_FSPACE_STRATEGY_AGGR;
+ else if(!HDstrcmp(strategy, "NONE"))
+ options->fs_strategy = H5F_FSPACE_STRATEGY_NONE;
else {
error_msg("invalid file space management strategy\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
}
+ if(options->fs_strategy == (H5F_fspace_strategy_t)0)
+ /* To distinguish the "specified" zero value */
+ options->fs_strategy = (H5F_fspace_strategy_t)-1;
}
break;
+ case 'P':
+ options->fs_persist = HDatoi( opt_arg );
+ if(options->fs_persist == 0)
+ /* To distinguish the "specified" zero value */
+ options->fs_persist = -1;
+ break;
+
case 'T':
- options->fs_threshold = (hsize_t) HDatol( opt_arg );
+ options->fs_threshold = HDatol( opt_arg );
+ if(options->fs_threshold == 0)
+ /* To distinguish the "specified" zero value */
+ options->fs_threshold = -1;
+ break;
+
+ case 'G':
+ options->fs_pagesize = HDatoll( opt_arg );
+ if(options->fs_pagesize == 0)
+ /* To distinguish the "specified" zero value */
+ options->fs_pagesize = -1;
break;
case 'E':
@@ -611,7 +644,7 @@ int main(int argc, const char **argv)
}
/* initialize options */
- h5repack_init(&options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t) 0);
+ h5repack_init(&options, 0, FALSE);
if (parse_command_line(argc, argv, &options) < 0)
goto done;
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index 58dea03..1022d7a 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -58,8 +58,10 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
int ok = 1;
hid_t fcpl_in = -1; /* file creation property for input file */
hid_t fcpl_out = -1; /* file creation property for output file */
- H5F_file_space_type_t in_strat, out_strat; /* file space handling strategy for in/output file */
- hsize_t in_thresh, out_thresh; /* free space section threshold for in/output file */
+ H5F_fspace_strategy_t in_strategy, out_strategy; /* file space handling strategy for in/output file */
+ hbool_t in_persist, out_persist; /* free-space persist status for in/output file */
+ hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */
+ hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */
/* open the output file */
if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
@@ -196,8 +198,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
}
/*-------------------------------------------------------------------------
- * Verify that file space strategy and free space threshold
- * are set as expected
+ * Verify that file space info are set as expected
*-------------------------------------------------------------------------
*/
@@ -211,12 +212,18 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed");
}
- /* Get file space management info for input file */
- if(H5Pget_file_space(fcpl_in, &in_strat, &in_thresh) < 0) {
+ /* Get file space info for input file */
+ if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) {
error_msg("failed to retrieve file space strategy & threshold\n");
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed");
}
+ /* Get file space page size for input file */
+ if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) {
+ error_msg("failed to retrieve file space page size\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed");
+ }
+
/* Output file is already opened */
/* Get file creation property list for output file */
if((fcpl_out = H5Fget_create_plist(fidout)) < 0) {
@@ -224,45 +231,84 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed");
}
- /* Get file space management info for output file */
- if(H5Pget_file_space(fcpl_out, &out_strat, &out_thresh) < 0) {
+ /* Get file space info for output file */
+ if(H5Pget_file_space_strategy(fcpl_out, &out_strategy, &out_persist, &out_threshold) < 0) {
error_msg("failed to retrieve file space strategy & threshold\n");
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed");
}
+ /* Get file space page size for output file */
+ if(H5Pget_file_space_page_size(fcpl_out, &out_pagesize) < 0) {
+ error_msg("failed to retrieve file space page size\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed");
+ }
+
/*
- * If the strategy option is not set,
- * file space handling strategy should be the same for both
- * input & output files.
- * If the strategy option is set,
- * the output file's file space handling strategy should be the same
- * as what is set via the strategy option
+ * If -S option is set, the file space handling strategy should be set as specified.
+ * If -S option is not set, the file space handling strategy should be
+ * the same as the input file's strategy.
*/
- if(!options->fs_strategy && out_strat != in_strat) {
- error_msg("file space strategy not set as unexpected\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
-
+ if(options->fs_strategy) {
+ if(out_strategy != (options->fs_strategy == (-1) ? 0 : options->fs_strategy)) {
+ error_msg("file space strategy not set as unexpected\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ }
+ } else {
+ if(out_strategy != in_strategy) {
+ error_msg("file space strategy not set as unexpected\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ }
}
- else if(options->fs_strategy && out_strat!= options->fs_strategy) {
- error_msg("file space strategy not set as unexpected\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+
+ /*
+ * If the -P option is set, the free-space persist status should be set as specified.
+ * If the -P option is not set, the free-space persist status should be
+ * the same as the input file's free-space persist status
+ */
+ if(options->fs_persist) {
+ if(out_persist != (hbool_t)(options->fs_persist == (-1) ? FALSE : options->fs_persist)) {
+ error_msg("free-space persist status is not set as unexpected\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ }
+ } else {
+ if(out_persist != in_persist) {
+ error_msg("free-space persist status is not set as unexpected\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ }
}
/*
- * If the threshold option is not set,
- * the free space section threshold should be the same for both
- * input & output files.
- * If the threshold option is set,
- * the output file's free space section threshold should be the same
- * as what is set via the threshold option.
+ * If the -T option is set, the threshold size should be set as specified.
+ * If the -T option is not set, the threshold should be the same as the
+ * input file's threshold size.
*/
- if(!options->fs_threshold && out_thresh != in_thresh) {
- error_msg("free space threshold not set as unexpected\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free space threshold not set as unexpected");
+ if(options->fs_threshold) {
+ if(out_threshold != (hsize_t)(options->fs_threshold == (-1) ? 0 : options->fs_threshold)) {
+ error_msg("threshold is not set as unexpectec\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ }
+ } else {
+ if(out_threshold != in_threshold) {
+ error_msg("threshold is not set as unexpected\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ }
}
- else if(options->fs_threshold && out_thresh != options->fs_threshold) {
- error_msg("free space threshold not set as unexpected\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free space threshold not set as unexpected");
+
+ /*
+ * If the -G option is set, the file space page size should be set as specified.
+ * If the -G option is not set, the file space page size should be
+ * the same as the input file's file space page size.
+ */
+ if(options->fs_pagesize) {
+ if(out_pagesize != (hsize_t)(options->fs_pagesize == (-1) ? 0 : options->fs_pagesize)) {
+ error_msg("file space page size is not set as unexpected\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ }
+ } else { /* "-G" is not set */
+ if(out_pagesize != in_pagesize) {
+ error_msg("file space page size is not set as unexpected\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ }
}
/* Closing */