diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2012-03-29 10:49:38 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2012-03-29 10:49:38 (GMT) |
commit | a3dcbef52b3cd8407ac57f148ded89eb2f4fdecb (patch) | |
tree | 6fd51971d513083394b67d2d17b2fdee8aa49187 /tools/h5repack/h5repack_copy.c | |
parent | e13eb463e03e978a203f77cbaf8bc504e05b28f3 (diff) | |
download | hdf5-a3dcbef52b3cd8407ac57f148ded89eb2f4fdecb.zip hdf5-a3dcbef52b3cd8407ac57f148ded89eb2f4fdecb.tar.gz hdf5-a3dcbef52b3cd8407ac57f148ded89eb2f4fdecb.tar.bz2 |
[svn-r22180] Description:
Add new "metadata block size" command line option ('-M <x>' or
'--metadata_block_size=<x>') for h5repack.
Tested on:
Mac OSX/64 10.7.3 (amazon) w/debug)
(h5committest upcoming)
Diffstat (limited to 'tools/h5repack/h5repack_copy.c')
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 152 |
1 files changed, 65 insertions, 87 deletions
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 55cf932..15df639 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -132,23 +132,23 @@ int copy_objects(const char* fnamein, goto out; } - if(!options->fs_strategy) - { - if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) - { - error_msg("failed to retrieve file space strategy\n"); - goto out; - } - } - - if(!options->fs_threshold) - { - if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) - { - error_msg("failed to retrieve file space threshold\n"); - goto out; - } - } + if(!options->fs_strategy) + { + if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) + { + error_msg("failed to retrieve file space strategy\n"); + goto out; + } + } + + if(!options->fs_threshold) + { + if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) + { + error_msg("failed to retrieve file space threshold\n"); + goto out; + } + } if(H5Pclose(fcpl_in) < 0) { @@ -254,135 +254,113 @@ int copy_objects(const char* fnamein, } /* end if */ } /* end if */ } /* end if */ - - - - #if defined (H5REPACK_DEBUG_USER_BLOCK) - print_user_block(fnamein,fidin); + print_user_block(fnamein, fidin); #endif - /*------------------------------------------------------------------------- * set the new user userblock options in the FCPL (before H5Fcreate ) *------------------------------------------------------------------------- */ - if ( options->ublock_size > 0 ) { /* either use the FCPL already created or create a new one */ - if(fcpl != H5P_DEFAULT) + if(fcpl == H5P_DEFAULT) { - /* set user block size */ - if(H5Pset_userblock(fcpl, options->ublock_size) < 0) - { - error_msg("failed to set userblock size\n"); - goto out; - } - - } - - else - { - /* create a file creation property list */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { error_msg("fail to create a file creation property list\n"); goto out; } - - /* set user block size */ - if(H5Pset_userblock(fcpl, options->ublock_size) < 0) - { - error_msg("failed to set userblock size\n"); - goto out; - } - } - - + /* set user block size */ + if(H5Pset_userblock(fcpl, options->ublock_size) < 0) + { + error_msg("failed to set userblock size\n"); + goto out; + } } - /*------------------------------------------------------------------------- * set alignment options *------------------------------------------------------------------------- */ - - if ( options->alignment > 0 ) { /* either use the FAPL already created or create a new one */ - if (fapl != H5P_DEFAULT) + if (fapl == H5P_DEFAULT) { - - if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) + /* create a file access property list */ + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - error_msg("failed to set alignment\n"); + error_msg("Could not create file access property list\n"); goto out; } - } - else + if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { + error_msg("failed to set alignment\n"); + goto out; + } + } + /*------------------------------------------------------------------------- + * set metadata block size option + *------------------------------------------------------------------------- + */ + if ( options->meta_block_size > 0 ) + { + /* either use the FAPL already created or create a new one */ + if (fapl == H5P_DEFAULT) + { /* create a file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { error_msg("Could not create file access property list\n"); goto out; } - - if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) - { - error_msg("failed to set alignment\n"); - goto out; - } - } + if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) + { + error_msg("failed to set metadata block size\n"); + goto out; + } } + /*------------------------------------------------------------------------- + * set free-space strategy options + *------------------------------------------------------------------------- + */ + /* either use the FCPL already created or create a new one */ - if(fcpl != H5P_DEFAULT) + if(fcpl == H5P_DEFAULT) { - /* 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"); - goto out; - } + /* create a file creation property list */ + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + { + error_msg("fail to create a file creation property list\n"); + goto out; + } } - else + + /* set file space strategy and free space threshold */ + if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) { - /* create a file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { - error_msg("fail to create a file creation property list\n"); - goto out; - } - - /* 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"); - goto out; - } + error_msg("failed to set file space strategy & threshold \n"); + goto out; } /*------------------------------------------------------------------------- * create the output file *------------------------------------------------------------------------- */ - - if(options->verbose) printf("Making file <%s>...\n",fnameout); - if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0) { error_msg("<%s>: Could not create file\n", fnameout ); |